@mappedin/mappedin-js 6.0.1-alpha.32 → 6.0.1-alpha.33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/esm/index.js CHANGED
@@ -1,16 +1,17 @@
1
- import{h as Wc,i as fm,j as dm}from"./chunk-3MNEOWBT.js";import{a as Mr}from"./chunk-W43PFPS7.js";import{A as $d,B as Jd,C as Kd,D as Y,E as Ne,F as Qd,Fa as Ki,G as ti,H as qi,I as Ce,Ia as fs,J as Mt,Ja as pm,L as xr,M as io,Ma as hm,O as Ft,P as tm,Pa as Pr,Q as no,R as em,S as rm,T as $i,W as im,X as nm,Y as us,a as cs,ba as om,c as eo,d as ro,ea as ps,fa as hs,ga as am,ia as oo,m as Zd,n as qd,oa as sm,pa as Sr,qa as jc,ra as lm,sa as Re,ta as ke,u as Zi,ua as cm,va as um,w as at,x as W,xa as Ji}from"./chunk-NCVDSTLX.js";import{a as s,b as N,d as Cr,e as v,f as u,g as w,h as E,i as j,j as f,k as b}from"./chunk-KMHSGG4L.js";var Im=N((nu,ou)=>{f();(function(e,t){typeof nu=="object"&&typeof ou<"u"?ou.exports=t():typeof define=="function"&&define.amd?define(t):(e=e||self).RBush=t()})(nu,function(){"use strict";function e(g,C,T,M,I){s(function _(O,k,B,R,G){for(;R>B;){if(R-B>600){var H=R-B+1,Q=k-B+1,lt=Math.log(H),ht=.5*Math.exp(2*lt/3),yt=.5*Math.sqrt(lt*ht*(H-ht)/H)*(Q-H/2<0?-1:1),At=Math.max(B,Math.floor(k-Q*ht/H+yt)),ve=Math.min(R,Math.floor(k+(H-Q)*ht/H+yt));_(O,k,At,ve,G)}var kt=O[k],ut=B,Ct=R;for(t(O,B,k),G(O[R],kt)>0&&t(O,B,R);ut<Ct;){for(t(O,ut,Ct),ut++,Ct--;G(O[ut],kt)<0;)ut++;for(;G(O[Ct],kt)>0;)Ct--}G(O[B],kt)===0?t(O,B,Ct):t(O,++Ct,R),Ct<=k&&(B=Ct+1),k<=Ct&&(R=Ct-1)}},"t")(g,C,T||0,M||g.length-1,I||r)}s(e,"t");function t(g,C,T){var M=g[C];g[C]=g[T],g[T]=M}s(t,"i");function r(g,C){return g<C?-1:g>C?1:0}s(r,"n");var i=s(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,T){if(!T)return C.indexOf(g);for(var M=0;M<C.length;M++)if(T(g,C[M]))return M;return-1}s(n,"e");function o(g,C){a(g,0,g.children.length,C,g)}s(o,"a");function a(g,C,T,M,I){I||(I=S(null)),I.minX=1/0,I.minY=1/0,I.maxX=-1/0,I.maxY=-1/0;for(var _=C;_<T;_++){var O=g.children[_];l(I,g.leaf?M(O):O)}return I}s(a,"h");function l(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}s(l,"o");function c(g,C){return g.minX-C.minX}s(c,"s");function h(g,C){return g.minY-C.minY}s(h,"l");function d(g){return(g.maxX-g.minX)*(g.maxY-g.minY)}s(d,"f");function m(g){return g.maxX-g.minX+(g.maxY-g.minY)}s(m,"u");function y(g,C){return g.minX<=C.minX&&g.minY<=C.minY&&C.maxX<=g.maxX&&C.maxY<=g.maxY}s(y,"m");function x(g,C){return C.minX<=g.maxX&&C.minY<=g.maxY&&C.maxX>=g.minX&&C.maxY>=g.minY}s(x,"c");function S(g){return{children:g,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}s(S,"p");function P(g,C,T,M,I){for(var _=[C,T];_.length;)if(!((T=_.pop())-(C=_.pop())<=M)){var O=C+Math.ceil((T-C)/M/2)*M;e(g,O,C,T,I),_.push(C,O,O,T)}}return s(P,"d"),i.prototype.all=function(){return this._all(this.data,[])},i.prototype.search=function(g){var C=this.data,T=[];if(!x(g,C))return T;for(var M=this.toBBox,I=[];C;){for(var _=0;_<C.children.length;_++){var O=C.children[_],k=C.leaf?M(O):O;x(g,k)&&(C.leaf?T.push(O):y(g,k)?this._all(O,T):I.push(O))}C=I.pop()}return T},i.prototype.collides=function(g){var C=this.data;if(!x(g,C))return!1;for(var T=[];C;){for(var M=0;M<C.children.length;M++){var I=C.children[M],_=C.leaf?this.toBBox(I):I;if(x(g,_)){if(C.leaf||y(g,_))return!0;T.push(I)}}C=T.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 T=this._build(g.slice(),0,g.length-1,0);if(this.data.children.length)if(this.data.height===T.height)this._splitRoot(this.data,T);else{if(this.data.height<T.height){var M=this.data;this.data=T,T=M}this._insert(T,this.data.height-T.height-1,!0)}else this.data=T;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 T,M,I,_=this.data,O=this.toBBox(g),k=[],B=[];_||k.length;){if(_||(_=k.pop(),M=k[k.length-1],T=B.pop(),I=!0),_.leaf){var R=n(g,_.children,C);if(R!==-1)return _.children.splice(R,1),k.push(_),this._condense(k),this}I||_.leaf||!y(_,O)?M?(T++,_=M.children[T],I=!1):_=null:(k.push(_),B.push(T),T=0,M=_,_=_.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 T=[];g;)g.leaf?C.push.apply(C,g.children):T.push.apply(T,g.children),g=T.pop();return C},i.prototype._build=function(g,C,T,M){var I,_=T-C+1,O=this._maxEntries;if(_<=O)return o(I=S(g.slice(C,T+1)),this.toBBox),I;M||(M=Math.ceil(Math.log(_)/Math.log(O)),O=Math.ceil(_/Math.pow(O,M-1))),(I=S([])).leaf=!1,I.height=M;var k=Math.ceil(_/O),B=k*Math.ceil(Math.sqrt(O));P(g,C,T,B,this.compareMinX);for(var R=C;R<=T;R+=B){var G=Math.min(R+B-1,T);P(g,R,G,k,this.compareMinY);for(var H=R;H<=G;H+=k){var Q=Math.min(H+k-1,G);I.children.push(this._build(g,H,Q,M-1))}}return o(I,this.toBBox),I},i.prototype._chooseSubtree=function(g,C,T,M){for(;M.push(C),!C.leaf&&M.length-1!==T;){for(var I=1/0,_=1/0,O=void 0,k=0;k<C.children.length;k++){var B=C.children[k],R=d(B),G=(H=g,Q=B,(Math.max(Q.maxX,H.maxX)-Math.min(Q.minX,H.minX))*(Math.max(Q.maxY,H.maxY)-Math.min(Q.minY,H.minY))-R);G<_?(_=G,I=R<I?R:I,O=B):G===_&&R<I&&(I=R,O=B)}C=O||C.children[0]}var H,Q;return C},i.prototype._insert=function(g,C,T){var M=T?g:this.toBBox(g),I=[],_=this._chooseSubtree(M,this.data,C,I);for(_.children.push(g),l(_,M);C>=0&&I[C].children.length>this._maxEntries;)this._split(I,C),C--;this._adjustParentBBoxes(M,I,C)},i.prototype._split=function(g,C){var T=g[C],M=T.children.length,I=this._minEntries;this._chooseSplitAxis(T,I,M);var _=this._chooseSplitIndex(T,I,M),O=S(T.children.splice(_,T.children.length-_));O.height=T.height,O.leaf=T.leaf,o(T,this.toBBox),o(O,this.toBBox),C?g[C-1].children.push(O):this._splitRoot(T,O)},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,T){for(var M,I,_,O,k,B,R,G=1/0,H=1/0,Q=C;Q<=T-C;Q++){var lt=a(g,0,Q,this.toBBox),ht=a(g,Q,T,this.toBBox),yt=(I=lt,_=ht,O=void 0,k=void 0,B=void 0,R=void 0,O=Math.max(I.minX,_.minX),k=Math.max(I.minY,_.minY),B=Math.min(I.maxX,_.maxX),R=Math.min(I.maxY,_.maxY),Math.max(0,B-O)*Math.max(0,R-k)),At=d(lt)+d(ht);yt<G?(G=yt,M=Q,H=At<H?At:H):yt===G&&At<H&&(H=At,M=Q)}return M||T-C},i.prototype._chooseSplitAxis=function(g,C,T){var M=g.leaf?this.compareMinX:c,I=g.leaf?this.compareMinY:h;this._allDistMargin(g,C,T,M)<this._allDistMargin(g,C,T,I)&&g.children.sort(M)},i.prototype._allDistMargin=function(g,C,T,M){g.children.sort(M);for(var I=this.toBBox,_=a(g,0,C,I),O=a(g,T-C,T,I),k=m(_)+m(O),B=C;B<T-C;B++){var R=g.children[B];l(_,g.leaf?I(R):R),k+=m(_)}for(var G=T-C-1;G>=C;G--){var H=g.children[G];l(O,g.leaf?I(H):H),k+=m(O)}return k},i.prototype._adjustParentBBoxes=function(g,C,T){for(var M=T;M>=0;M--)l(C[M],g)},i.prototype._condense=function(g){for(var C=g.length-1,T=void 0;C>=0;C--)g[C].children.length===0?C>0?(T=g[C-1].children).splice(T.indexOf(g[C]),1):this.clear():o(g[C],this.toBBox)},i})});var uu=N(V=>{"use strict";f();Object.defineProperty(V,"__esModule",{value:!0});V.earthRadius=63710088e-1;V.factors={centimeters:V.earthRadius*100,centimetres:V.earthRadius*100,degrees:V.earthRadius/111325,feet:V.earthRadius*3.28084,inches:V.earthRadius*39.37,kilometers:V.earthRadius/1e3,kilometres:V.earthRadius/1e3,meters:V.earthRadius,metres:V.earthRadius,miles:V.earthRadius/1609.344,millimeters:V.earthRadius*1e3,millimetres:V.earthRadius*1e3,nauticalmiles:V.earthRadius/1852,radians:1,yards:V.earthRadius*1.0936};V.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/V.earthRadius,yards:1.0936133};V.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 Ir(e,t,r){r===void 0&&(r={});var i={type:"Feature"};return(r.id===0||r.id)&&(i.id=r.id),r.bbox&&(i.bbox=r.bbox),i.properties=t||{},i.geometry=e,i}s(Ir,"feature");V.feature=Ir;function Y3(e,t,r){switch(r===void 0&&(r={}),e){case"Point":return au(t).geometry;case"LineString":return lu(t).geometry;case"Polygon":return su(t).geometry;case"MultiPoint":return _m(t).geometry;case"MultiLineString":return Em(t).geometry;case"MultiPolygon":return Lm(t).geometry;default:throw new Error(e+" is invalid")}}s(Y3,"geometry");V.geometry=Y3;function au(e,t,r){if(r===void 0&&(r={}),!e)throw new Error("coordinates is required");if(!Array.isArray(e))throw new Error("coordinates must be an Array");if(e.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!bs(e[0])||!bs(e[1]))throw new Error("coordinates must contain numbers");var i={type:"Point",coordinates:e};return Ir(i,t,r)}s(au,"point");V.point=au;function j3(e,t,r){return r===void 0&&(r={}),Cs(e.map(function(i){return au(i,t)}),r)}s(j3,"points");V.points=j3;function su(e,t,r){r===void 0&&(r={});for(var i=0,n=e;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 l={type:"Polygon",coordinates:e};return Ir(l,t,r)}s(su,"polygon");V.polygon=su;function W3(e,t,r){return r===void 0&&(r={}),Cs(e.map(function(i){return su(i,t)}),r)}s(W3,"polygons");V.polygons=W3;function lu(e,t,r){if(r===void 0&&(r={}),e.length<2)throw new Error("coordinates must be an array of two or more positions");var i={type:"LineString",coordinates:e};return Ir(i,t,r)}s(lu,"lineString");V.lineString=lu;function U3(e,t,r){return r===void 0&&(r={}),Cs(e.map(function(i){return lu(i,t)}),r)}s(U3,"lineStrings");V.lineStrings=U3;function Cs(e,t){t===void 0&&(t={});var r={type:"FeatureCollection"};return t.id&&(r.id=t.id),t.bbox&&(r.bbox=t.bbox),r.features=e,r}s(Cs,"featureCollection");V.featureCollection=Cs;function Em(e,t,r){r===void 0&&(r={});var i={type:"MultiLineString",coordinates:e};return Ir(i,t,r)}s(Em,"multiLineString");V.multiLineString=Em;function _m(e,t,r){r===void 0&&(r={});var i={type:"MultiPoint",coordinates:e};return Ir(i,t,r)}s(_m,"multiPoint");V.multiPoint=_m;function Lm(e,t,r){r===void 0&&(r={});var i={type:"MultiPolygon",coordinates:e};return Ir(i,t,r)}s(Lm,"multiPolygon");V.multiPolygon=Lm;function z3(e,t,r){r===void 0&&(r={});var i={type:"GeometryCollection",geometries:e};return Ir(i,t,r)}s(z3,"geometryCollection");V.geometryCollection=z3;function Z3(e,t){if(t===void 0&&(t=0),t&&!(t>=0))throw new Error("precision must be a positive number");var r=Math.pow(10,t||0);return Math.round(e*r)/r}s(Z3,"round");V.round=Z3;function Om(e,t){t===void 0&&(t="kilometers");var r=V.factors[t];if(!r)throw new Error(t+" units is invalid");return e*r}s(Om,"radiansToLength");V.radiansToLength=Om;function cu(e,t){t===void 0&&(t="kilometers");var r=V.factors[t];if(!r)throw new Error(t+" units is invalid");return e/r}s(cu,"lengthToRadians");V.lengthToRadians=cu;function q3(e,t){return Dm(cu(e,t))}s(q3,"lengthToDegrees");V.lengthToDegrees=q3;function $3(e){var t=e%360;return t<0&&(t+=360),t}s($3,"bearingToAzimuth");V.bearingToAzimuth=$3;function Dm(e){var t=e%(2*Math.PI);return t*180/Math.PI}s(Dm,"radiansToDegrees");V.radiansToDegrees=Dm;function J3(e){var t=e%360;return t*Math.PI/180}s(J3,"degreesToRadians");V.degreesToRadians=J3;function K3(e,t,r){if(t===void 0&&(t="kilometers"),r===void 0&&(r="kilometers"),!(e>=0))throw new Error("length must be a positive number");return Om(cu(e,t),r)}s(K3,"convertLength");V.convertLength=K3;function Q3(e,t,r){if(t===void 0&&(t="meters"),r===void 0&&(r="kilometers"),!(e>=0))throw new Error("area must be a positive number");var i=V.areaFactors[t];if(!i)throw new Error("invalid original units");var n=V.areaFactors[r];if(!n)throw new Error("invalid final units");return e/i*n}s(Q3,"convertArea");V.convertArea=Q3;function bs(e){return!isNaN(e)&&e!==null&&!Array.isArray(e)}s(bs,"isNumber");V.isNumber=bs;function t5(e){return!!e&&e.constructor===Object}s(t5,"isObject");V.isObject=t5;function e5(e){if(!e)throw new Error("bbox is required");if(!Array.isArray(e))throw new Error("bbox must be an Array");if(e.length!==4&&e.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");e.forEach(function(t){if(!bs(t))throw new Error("bbox must only contain numbers")})}s(e5,"validateBBox");V.validateBBox=e5;function r5(e){if(!e)throw new Error("id is required");if(["string","number"].indexOf(typeof e)===-1)throw new Error("id must be a number or a string")}s(r5,"validateId");V.validateId=r5});var Fm=N(wt=>{"use strict";f();Object.defineProperty(wt,"__esModule",{value:!0});var Gt=uu();function co(e,t,r){if(e!==null)for(var i,n,o,a,l,c,h,d=0,m=0,y,x=e.type,S=x==="FeatureCollection",P=x==="Feature",g=S?e.features.length:1,C=0;C<g;C++){h=S?e.features[C].geometry:P?e.geometry:e,y=h?h.type==="GeometryCollection":!1,l=y?h.geometries.length:1;for(var T=0;T<l;T++){var M=0,I=0;if(a=y?h.geometries[T]:h,a!==null){c=a.coordinates;var _=a.type;switch(d=r&&(_==="Polygon"||_==="MultiPolygon")?1:0,_){case null:break;case"Point":if(t(c,m,C,M,I)===!1)return!1;m++,M++;break;case"LineString":case"MultiPoint":for(i=0;i<c.length;i++){if(t(c[i],m,C,M,I)===!1)return!1;m++,_==="MultiPoint"&&M++}_==="LineString"&&M++;break;case"Polygon":case"MultiLineString":for(i=0;i<c.length;i++){for(n=0;n<c[i].length-d;n++){if(t(c[i][n],m,C,M,I)===!1)return!1;m++}_==="MultiLineString"&&M++,_==="Polygon"&&I++}_==="Polygon"&&M++;break;case"MultiPolygon":for(i=0;i<c.length;i++){for(I=0,n=0;n<c[i].length;n++){for(o=0;o<c[i][n].length-d;o++){if(t(c[i][n][o],m,C,M,I)===!1)return!1;m++}I++}M++}break;case"GeometryCollection":for(i=0;i<a.geometries.length;i++)if(co(a.geometries[i],t,r)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}s(co,"coordEach");function i5(e,t,r,i){var n=r;return co(e,function(o,a,l,c,h){a===0&&r===void 0?n=o:n=t(n,o,a,l,c,h)},i),n}s(i5,"coordReduce");function Am(e,t){var r;switch(e.type){case"FeatureCollection":for(r=0;r<e.features.length&&t(e.features[r].properties,r)!==!1;r++);break;case"Feature":t(e.properties,0);break}}s(Am,"propEach");function n5(e,t,r){var i=r;return Am(e,function(n,o){o===0&&r===void 0?i=n:i=t(i,n,o)}),i}s(n5,"propReduce");function Nm(e,t){if(e.type==="Feature")t(e,0);else if(e.type==="FeatureCollection")for(var r=0;r<e.features.length&&t(e.features[r],r)!==!1;r++);}s(Nm,"featureEach");function o5(e,t,r){var i=r;return Nm(e,function(n,o){o===0&&r===void 0?i=n:i=t(i,n,o)}),i}s(o5,"featureReduce");function a5(e){var t=[];return co(e,function(r){t.push(r)}),t}s(a5,"coordAll");function pu(e,t){var r,i,n,o,a,l,c,h,d,m,y=0,x=e.type==="FeatureCollection",S=e.type==="Feature",P=x?e.features.length:1;for(r=0;r<P;r++){for(l=x?e.features[r].geometry:S?e.geometry:e,h=x?e.features[r].properties:S?e.properties:{},d=x?e.features[r].bbox:S?e.bbox:void 0,m=x?e.features[r].id:S?e.id:void 0,c=l?l.type==="GeometryCollection":!1,a=c?l.geometries.length:1,n=0;n<a;n++){if(o=c?l.geometries[n]:l,o===null){if(t(null,y,h,d,m)===!1)return!1;continue}switch(o.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(t(o,y,h,d,m)===!1)return!1;break}case"GeometryCollection":{for(i=0;i<o.geometries.length;i++)if(t(o.geometries[i],y,h,d,m)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}y++}}s(pu,"geomEach");function s5(e,t,r){var i=r;return pu(e,function(n,o,a,l,c){o===0&&r===void 0?i=n:i=t(i,n,o,a,l,c)}),i}s(s5,"geomReduce");function xs(e,t){pu(e,function(r,i,n,o,a){var l=r===null?null:r.type;switch(l){case null:case"Point":case"LineString":case"Polygon":return t(Gt.feature(r,n,{bbox:o,id:a}),i,0)===!1?!1:void 0}var c;switch(l){case"MultiPoint":c="Point";break;case"MultiLineString":c="LineString";break;case"MultiPolygon":c="Polygon";break}for(var h=0;h<r.coordinates.length;h++){var d=r.coordinates[h],m={type:c,coordinates:d};if(t(Gt.feature(m,n),i,h)===!1)return!1}})}s(xs,"flattenEach");function l5(e,t,r){var i=r;return xs(e,function(n,o,a){o===0&&a===0&&r===void 0?i=n:i=t(i,n,o,a)}),i}s(l5,"flattenReduce");function Rm(e,t){xs(e,function(r,i,n){var o=0;if(r.geometry){var a=r.geometry.type;if(!(a==="Point"||a==="MultiPoint")){var l,c=0,h=0,d=0;if(co(r,function(m,y,x,S,P){if(l===void 0||i>c||S>h||P>d){l=m,c=i,h=S,d=P,o=0;return}var g=Gt.lineString([l,m],r.properties);if(t(g,i,n,P,o)===!1)return!1;o++,l=m})===!1)return!1}}})}s(Rm,"segmentEach");function c5(e,t,r){var i=r,n=!1;return Rm(e,function(o,a,l,c,h){n===!1&&r===void 0?i=o:i=t(i,o,a,l,c,h),n=!0}),i}s(c5,"segmentReduce");function km(e,t){if(!e)throw new Error("geojson is required");xs(e,function(r,i,n){if(r.geometry!==null){var o=r.geometry.type,a=r.geometry.coordinates;switch(o){case"LineString":if(t(r,i,n,0,0)===!1)return!1;break;case"Polygon":for(var l=0;l<a.length;l++)if(t(Gt.lineString(a[l],r.properties),i,n,l)===!1)return!1;break}}})}s(km,"lineEach");function u5(e,t,r){var i=r;return km(e,function(n,o,a,l){o===0&&r===void 0?i=n:i=t(i,n,o,a,l)}),i}s(u5,"lineReduce");function p5(e,t){if(t=t||{},!Gt.isObject(t))throw new Error("options is invalid");var r=t.featureIndex||0,i=t.multiFeatureIndex||0,n=t.geometryIndex||0,o=t.segmentIndex||0,a=t.properties,l;switch(e.type){case"FeatureCollection":r<0&&(r=e.features.length+r),a=a||e.features[r].properties,l=e.features[r].geometry;break;case"Feature":a=a||e.properties,l=e.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":l=e;break;default:throw new Error("geojson is invalid")}if(l===null)return null;var c=l.coordinates;switch(l.type){case"Point":case"MultiPoint":return null;case"LineString":return o<0&&(o=c.length+o-1),Gt.lineString([c[o],c[o+1]],a,t);case"Polygon":return n<0&&(n=c.length+n),o<0&&(o=c[n].length+o-1),Gt.lineString([c[n][o],c[n][o+1]],a,t);case"MultiLineString":return i<0&&(i=c.length+i),o<0&&(o=c[i].length+o-1),Gt.lineString([c[i][o],c[i][o+1]],a,t);case"MultiPolygon":return i<0&&(i=c.length+i),n<0&&(n=c[i].length+n),o<0&&(o=c[i][n].length-o-1),Gt.lineString([c[i][n][o],c[i][n][o+1]],a,t)}throw new Error("geojson is invalid")}s(p5,"findSegment");function h5(e,t){if(t=t||{},!Gt.isObject(t))throw new Error("options is invalid");var r=t.featureIndex||0,i=t.multiFeatureIndex||0,n=t.geometryIndex||0,o=t.coordIndex||0,a=t.properties,l;switch(e.type){case"FeatureCollection":r<0&&(r=e.features.length+r),a=a||e.features[r].properties,l=e.features[r].geometry;break;case"Feature":a=a||e.properties,l=e.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":l=e;break;default:throw new Error("geojson is invalid")}if(l===null)return null;var c=l.coordinates;switch(l.type){case"Point":return Gt.point(c,a,t);case"MultiPoint":return i<0&&(i=c.length+i),Gt.point(c[i],a,t);case"LineString":return o<0&&(o=c.length+o),Gt.point(c[o],a,t);case"Polygon":return n<0&&(n=c.length+n),o<0&&(o=c[n].length+o),Gt.point(c[n][o],a,t);case"MultiLineString":return i<0&&(i=c.length+i),o<0&&(o=c[i].length+o),Gt.point(c[i][o],a,t);case"MultiPolygon":return i<0&&(i=c.length+i),n<0&&(n=c[i].length+n),o<0&&(o=c[i][n].length-o),Gt.point(c[i][n][o],a,t)}throw new Error("geojson is invalid")}s(h5,"findPoint");wt.coordAll=a5;wt.coordEach=co;wt.coordReduce=i5;wt.featureEach=Nm;wt.featureReduce=o5;wt.findPoint=h5;wt.findSegment=p5;wt.flattenEach=xs;wt.flattenReduce=l5;wt.geomEach=pu;wt.geomReduce=s5;wt.lineEach=km;wt.lineReduce=u5;wt.propEach=Am;wt.propReduce=n5;wt.segmentEach=Rm;wt.segmentReduce=c5});var hu=N((Aw,Gm)=>{"use strict";f();var Bm=Object.prototype.toString;Gm.exports=s(function(t){var r=Bm.call(t),i=r==="[object Arguments]";return i||(i=r!=="[object Array]"&&t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&Bm.call(t.callee)==="[object Function]"),i},"isArguments")});var Zm=N((kw,zm)=>{"use strict";f();var Um;Object.keys||(uo=Object.prototype.hasOwnProperty,fu=Object.prototype.toString,Vm=hu(),du=Object.prototype.propertyIsEnumerable,Hm=!du.call({toString:null},"toString"),Xm=du.call(function(){},"prototype"),po=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],Ss=s(function(e){var t=e.constructor;return t&&t.prototype===e},"equalsConstructorPrototype"),Ym={$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},jm=function(){if(typeof window>"u")return!1;for(var e in window)try{if(!Ym["$"+e]&&uo.call(window,e)&&window[e]!==null&&typeof window[e]=="object")try{Ss(window[e])}catch{return!0}}catch{return!0}return!1}(),Wm=s(function(e){if(typeof window>"u"||!jm)return Ss(e);try{return Ss(e)}catch{return!1}},"equalsConstructorPrototypeIfNotBuggy"),Um=s(function(t){var r=t!==null&&typeof t=="object",i=fu.call(t)==="[object Function]",n=Vm(t),o=r&&fu.call(t)==="[object String]",a=[];if(!r&&!i&&!n)throw new TypeError("Object.keys called on a non-object");var l=Xm&&i;if(o&&t.length>0&&!uo.call(t,0))for(var c=0;c<t.length;++c)a.push(String(c));if(n&&t.length>0)for(var h=0;h<t.length;++h)a.push(String(h));else for(var d in t)!(l&&d==="prototype")&&uo.call(t,d)&&a.push(String(d));if(Hm)for(var m=Wm(t),y=0;y<po.length;++y)!(m&&po[y]==="constructor")&&uo.call(t,po[y])&&a.push(po[y]);return a},"keys"));var uo,fu,Vm,du,Hm,Xm,po,Ss,Ym,jm,Wm;zm.exports=Um});var Ms=N((Gw,Jm)=>{"use strict";f();var f5=Array.prototype.slice,d5=hu(),qm=Object.keys,Ps=qm?s(function(t){return qm(t)},"keys"):Zm(),$m=Object.keys;Ps.shim=s(function(){if(Object.keys){var t=function(){var r=Object.keys(arguments);return r&&r.length===arguments.length}(1,2);t||(Object.keys=s(function(i){return d5(i)?$m(f5.call(i)):$m(i)},"keys"))}else Object.keys=Ps;return Object.keys||Ps},"shimObjectKeys");Jm.exports=Ps});var Qm=N((Xw,Km)=>{"use strict";f();Km.exports=Error});var e1=N((jw,t1)=>{"use strict";f();t1.exports=EvalError});var i1=N((Uw,r1)=>{"use strict";f();r1.exports=RangeError});var o1=N((Zw,n1)=>{"use strict";f();n1.exports=ReferenceError});var mu=N(($w,a1)=>{"use strict";f();a1.exports=SyntaxError});var Qe=N((Kw,s1)=>{"use strict";f();s1.exports=TypeError});var c1=N((tT,l1)=>{"use strict";f();l1.exports=URIError});var ho=N((rT,u1)=>{"use strict";f();u1.exports=s(function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var t={},r=Symbol("test"),i=Object(r);if(typeof r=="string"||Object.prototype.toString.call(r)!=="[object Symbol]"||Object.prototype.toString.call(i)!=="[object Symbol]")return!1;var n=42;t[r]=n;for(r 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]!==r||!Object.prototype.propertyIsEnumerable.call(t,r))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var a=Object.getOwnPropertyDescriptor(t,r);if(a.value!==n||a.enumerable!==!0)return!1}return!0},"hasSymbols")});var ws=N((oT,h1)=>{"use strict";f();var p1=typeof Symbol<"u"&&Symbol,m5=ho();h1.exports=s(function(){return typeof p1!="function"||typeof Symbol!="function"||typeof p1("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:m5()},"hasNativeSymbols")});var d1=N((lT,f1)=>{"use strict";f();var yu={__proto__:null,foo:{}},y5=Object;f1.exports=s(function(){return{__proto__:yu}.foo===yu.foo&&!(yu instanceof y5)},"hasProto")});var g1=N((pT,y1)=>{"use strict";f();var g5="Function.prototype.bind called on incompatible ",v5=Object.prototype.toString,b5=Math.max,C5="[object Function]",m1=s(function(t,r){for(var i=[],n=0;n<t.length;n+=1)i[n]=t[n];for(var o=0;o<r.length;o+=1)i[o+t.length]=r[o];return i},"concatty"),x5=s(function(t,r){for(var i=[],n=r||0,o=0;n<t.length;n+=1,o+=1)i[o]=t[n];return i},"slicy"),S5=s(function(e,t){for(var r="",i=0;i<e.length;i+=1)r+=e[i],i+1<e.length&&(r+=t);return r},"joiny");y1.exports=s(function(t){var r=this;if(typeof r!="function"||v5.apply(r)!==C5)throw new TypeError(g5+r);for(var i=x5(arguments,1),n,o=s(function(){if(this instanceof n){var d=r.apply(this,m1(i,arguments));return Object(d)===d?d:this}return r.apply(t,m1(i,arguments))},"binder"),a=b5(0,r.length-i.length),l=[],c=0;c<a;c++)l[c]="$"+c;if(n=Function("binder","return function ("+S5(l,",")+"){ return binder.apply(this,arguments); }")(o),r.prototype){var h=s(function(){},"Empty");h.prototype=r.prototype,n.prototype=new h,h.prototype=null}return n},"bind")});var Ts=N((dT,v1)=>{"use strict";f();var P5=g1();v1.exports=Function.prototype.bind||P5});var gu=N((yT,b1)=>{"use strict";f();var M5=Function.prototype.call,w5=Object.prototype.hasOwnProperty,T5=Ts();b1.exports=T5.call(M5,w5)});var Se=N((vT,M1)=>{"use strict";f();var Z,I5=Qm(),E5=e1(),_5=i1(),L5=o1(),rn=mu(),en=Qe(),O5=c1(),P1=Function,vu=s(function(e){try{return P1('"use strict"; return ('+e+").constructor;")()}catch{}},"getEvalledConstructor"),ei=Object.getOwnPropertyDescriptor;if(ei)try{ei({},"")}catch{ei=null}var bu=s(function(){throw new en},"throwTypeError"),D5=ei?function(){try{return arguments.callee,bu}catch{try{return ei(arguments,"callee").get}catch{return bu}}}():bu,Qi=ws()(),A5=d1()(),Ot=Object.getPrototypeOf||(A5?function(e){return e.__proto__}:null),tn={},N5=typeof Uint8Array>"u"||!Ot?Z:Ot(Uint8Array),ri={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?Z:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?Z:ArrayBuffer,"%ArrayIteratorPrototype%":Qi&&Ot?Ot([][Symbol.iterator]()):Z,"%AsyncFromSyncIteratorPrototype%":Z,"%AsyncFunction%":tn,"%AsyncGenerator%":tn,"%AsyncGeneratorFunction%":tn,"%AsyncIteratorPrototype%":tn,"%Atomics%":typeof Atomics>"u"?Z:Atomics,"%BigInt%":typeof BigInt>"u"?Z:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?Z:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?Z:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?Z:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":I5,"%eval%":eval,"%EvalError%":E5,"%Float32Array%":typeof Float32Array>"u"?Z:Float32Array,"%Float64Array%":typeof Float64Array>"u"?Z:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?Z:FinalizationRegistry,"%Function%":P1,"%GeneratorFunction%":tn,"%Int8Array%":typeof Int8Array>"u"?Z:Int8Array,"%Int16Array%":typeof Int16Array>"u"?Z:Int16Array,"%Int32Array%":typeof Int32Array>"u"?Z:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Qi&&Ot?Ot(Ot([][Symbol.iterator]())):Z,"%JSON%":typeof JSON=="object"?JSON:Z,"%Map%":typeof Map>"u"?Z:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Qi||!Ot?Z:Ot(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?Z:Promise,"%Proxy%":typeof Proxy>"u"?Z:Proxy,"%RangeError%":_5,"%ReferenceError%":L5,"%Reflect%":typeof Reflect>"u"?Z:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?Z:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Qi||!Ot?Z:Ot(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?Z:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Qi&&Ot?Ot(""[Symbol.iterator]()):Z,"%Symbol%":Qi?Symbol:Z,"%SyntaxError%":rn,"%ThrowTypeError%":D5,"%TypedArray%":N5,"%TypeError%":en,"%Uint8Array%":typeof Uint8Array>"u"?Z:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?Z:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?Z:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?Z:Uint32Array,"%URIError%":O5,"%WeakMap%":typeof WeakMap>"u"?Z:WeakMap,"%WeakRef%":typeof WeakRef>"u"?Z:WeakRef,"%WeakSet%":typeof WeakSet>"u"?Z:WeakSet};if(Ot)try{null.error}catch(e){C1=Ot(Ot(e)),ri["%Error.prototype%"]=C1}var C1,R5=s(function e(t){var r;if(t==="%AsyncFunction%")r=vu("async function () {}");else if(t==="%GeneratorFunction%")r=vu("function* () {}");else if(t==="%AsyncGeneratorFunction%")r=vu("async function* () {}");else if(t==="%AsyncGenerator%"){var i=e("%AsyncGeneratorFunction%");i&&(r=i.prototype)}else if(t==="%AsyncIteratorPrototype%"){var n=e("%AsyncGenerator%");n&&Ot&&(r=Ot(n.prototype))}return ri[t]=r,r},"doEval"),x1={__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"]},fo=Ts(),Is=gu(),k5=fo.call(Function.call,Array.prototype.concat),F5=fo.call(Function.apply,Array.prototype.splice),S1=fo.call(Function.call,String.prototype.replace),Es=fo.call(Function.call,String.prototype.slice),B5=fo.call(Function.call,RegExp.prototype.exec),G5=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,V5=/\\(\\)?/g,H5=s(function(t){var r=Es(t,0,1),i=Es(t,-1);if(r==="%"&&i!=="%")throw new rn("invalid intrinsic syntax, expected closing `%`");if(i==="%"&&r!=="%")throw new rn("invalid intrinsic syntax, expected opening `%`");var n=[];return S1(t,G5,function(o,a,l,c){n[n.length]=l?S1(c,V5,"$1"):a||o}),n},"stringToPath"),X5=s(function(t,r){var i=t,n;if(Is(x1,i)&&(n=x1[i],i="%"+n[0]+"%"),Is(ri,i)){var o=ri[i];if(o===tn&&(o=R5(i)),typeof o>"u"&&!r)throw new en("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:n,name:i,value:o}}throw new rn("intrinsic "+t+" does not exist!")},"getBaseIntrinsic");M1.exports=s(function(t,r){if(typeof t!="string"||t.length===0)throw new en("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new en('"allowMissing" argument must be a boolean');if(B5(/^%?[^%]*%?$/,t)===null)throw new rn("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var i=H5(t),n=i.length>0?i[0]:"",o=X5("%"+n+"%",r),a=o.name,l=o.value,c=!1,h=o.alias;h&&(n=h[0],F5(i,k5([0,1],h)));for(var d=1,m=!0;d<i.length;d+=1){var y=i[d],x=Es(y,0,1),S=Es(y,-1);if((x==='"'||x==="'"||x==="`"||S==='"'||S==="'"||S==="`")&&x!==S)throw new rn("property names with quotes must have matching quotes");if((y==="constructor"||!m)&&(c=!0),n+="."+y,a="%"+n+"%",Is(ri,a))l=ri[a];else if(l!=null){if(!(y in l)){if(!r)throw new en("base intrinsic for "+t+" exists, but the property is not available.");return}if(ei&&d+1>=i.length){var P=ei(l,y);m=!!P,m&&"get"in P&&!("originalValue"in P.get)?l=P.get:l=l[y]}else m=Is(l,y),l=l[y];m&&!c&&(ri[a]=l)}}return l},"GetIntrinsic")});var Ls=N((xT,w1)=>{"use strict";f();var Y5=Se(),_s=Y5("%Object.defineProperty%",!0)||!1;if(_s)try{_s({},"a",{value:1})}catch{_s=!1}w1.exports=_s});var Ds=N((PT,T1)=>{"use strict";f();var j5=Se(),Os=j5("%Object.getOwnPropertyDescriptor%",!0);if(Os)try{Os([],"length")}catch{Os=null}T1.exports=Os});var As=N((wT,_1)=>{"use strict";f();var I1=Ls(),W5=mu(),nn=Qe(),E1=Ds();_1.exports=s(function(t,r,i){if(!t||typeof t!="object"&&typeof t!="function")throw new nn("`obj` must be an object or a function`");if(typeof r!="string"&&typeof r!="symbol")throw new nn("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new nn("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new nn("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new nn("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new nn("`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,l=arguments.length>6?arguments[6]:!1,c=!!E1&&E1(t,r);if(I1)I1(t,r,{configurable:a===null&&c?c.configurable:!a,enumerable:n===null&&c?c.enumerable:!n,value:i,writable:o===null&&c?c.writable:!o});else if(l||!n&&!o&&!a)t[r]=i;else throw new W5("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},"defineDataProperty")});var Ns=N((ET,O1)=>{"use strict";f();var Cu=Ls(),L1=s(function(){return!!Cu},"hasPropertyDescriptors");L1.hasArrayLengthDefineBug=s(function(){if(!Cu)return null;try{return Cu([],"length",{value:1}).length!==1}catch{return!0}},"hasArrayLengthDefineBug");O1.exports=L1});var Er=N((OT,R1)=>{"use strict";f();var U5=Ms(),z5=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",Z5=Object.prototype.toString,q5=Array.prototype.concat,D1=As(),$5=s(function(e){return typeof e=="function"&&Z5.call(e)==="[object Function]"},"isFunction"),A1=Ns()(),J5=s(function(e,t,r,i){if(t in e){if(i===!0){if(e[t]===r)return}else if(!$5(i)||!i())return}A1?D1(e,t,r,!0):D1(e,t,r)},"defineProperty"),N1=s(function(e,t){var r=arguments.length>2?arguments[2]:{},i=U5(t);z5&&(i=q5.call(i,Object.getOwnPropertySymbols(t)));for(var n=0;n<i.length;n+=1)J5(e,i[n],t[i[n]],r[i[n]])},"defineProperties");N1.supportsDescriptors=!!A1;R1.exports=N1});var V1=N((NT,G1)=>{"use strict";f();var K5=Se(),k1=As(),Q5=Ns()(),F1=Ds(),B1=Qe(),t4=K5("%Math.floor%");G1.exports=s(function(t,r){if(typeof t!="function")throw new B1("`fn` is not a function");if(typeof r!="number"||r<0||r>4294967295||t4(r)!==r)throw new B1("`length` must be a positive 32-bit integer");var i=arguments.length>2&&!!arguments[2],n=!0,o=!0;if("length"in t&&F1){var a=F1(t,"length");a&&!a.configurable&&(n=!1),a&&!a.writable&&(o=!1)}return(n||o||!i)&&(Q5?k1(t,"length",r,!0,!0):k1(t,"length",r)),t},"setFunctionLength")});var ii=N((FT,Rs)=>{"use strict";f();var xu=Ts(),ks=Se(),e4=V1(),r4=Qe(),Y1=ks("%Function.prototype.apply%"),j1=ks("%Function.prototype.call%"),W1=ks("%Reflect.apply%",!0)||xu.call(j1,Y1),H1=Ls(),i4=ks("%Math.max%");Rs.exports=s(function(t){if(typeof t!="function")throw new r4("a function is required");var r=W1(xu,j1,arguments);return e4(r,1+i4(0,t.length-(arguments.length-1)),!0)},"callBind");var X1=s(function(){return W1(xu,Y1,arguments)},"applyBind");H1?H1(Rs.exports,"apply",{value:X1}):Rs.exports.apply=X1});var le=N((VT,Z1)=>{"use strict";f();var U1=Se(),z1=ii(),n4=z1(U1("String.prototype.indexOf"));Z1.exports=s(function(t,r){var i=U1(t,!!r);return typeof i=="function"&&n4(t,".prototype.")>-1?z1(i):i},"callBoundIntrinsic")});var Su=N((YT,Q1)=>{"use strict";f();var o4=Ms(),J1=ho()(),K1=le(),q1=Object,a4=K1("Array.prototype.push"),$1=K1("Object.prototype.propertyIsEnumerable"),s4=J1?Object.getOwnPropertySymbols:null;Q1.exports=s(function(t,r){if(t==null)throw new TypeError("target must be an object");var i=q1(t);if(arguments.length===1)return i;for(var n=1;n<arguments.length;++n){var o=q1(arguments[n]),a=o4(o),l=J1&&(Object.getOwnPropertySymbols||s4);if(l)for(var c=l(o),h=0;h<c.length;++h){var d=c[h];$1(o,d)&&a4(a,d)}for(var m=0;m<a.length;++m){var y=a[m];if($1(o,y)){var x=o[y];i[y]=x}}}return i},"assign")});var Mu=N((UT,ty)=>{"use strict";f();var Pu=Su(),l4=s(function(){if(!Object.assign)return!1;for(var e="abcdefghijklmnopqrst",t=e.split(""),r={},i=0;i<t.length;++i)r[t[i]]=t[i];var n=Object.assign({},r),o="";for(var a in n)o+=a;return e!==o},"lacksProperEnumerationOrder"),c4=s(function(){if(!Object.assign||!Object.preventExtensions)return!1;var e=Object.preventExtensions({1:2});try{Object.assign(e,"xy")}catch{return e[1]==="y"}return!1},"assignHasPendingExceptions");ty.exports=s(function(){return!Object.assign||l4()||c4()?Pu:Object.assign},"getPolyfill")});var ry=N((qT,ey)=>{"use strict";f();var u4=Er(),p4=Mu();ey.exports=s(function(){var t=p4();return u4(Object,{assign:t},{assign:function(){return Object.assign!==t}}),t},"shimAssign")});var ay=N((KT,oy)=>{"use strict";f();var h4=Er(),f4=ii(),d4=Su(),iy=Mu(),m4=ry(),y4=f4.apply(iy()),ny=s(function(t,r){return y4(Object,arguments)},"assign");h4(ny,{getPolyfill:iy,implementation:d4,shim:m4});oy.exports=ny});var ly=N((eI,sy)=>{"use strict";f();var yo=s(function(){return typeof s(function(){},"f").name=="string"},"functionsHaveNames"),mo=Object.getOwnPropertyDescriptor;if(mo)try{mo([],"length")}catch{mo=null}yo.functionsHaveConfigurableNames=s(function(){if(!yo()||!mo)return!1;var t=mo(function(){},"name");return!!t&&!!t.configurable},"functionsHaveConfigurableNames");var g4=Function.prototype.bind;yo.boundFunctionsHaveNames=s(function(){return yo()&&typeof g4=="function"&&s(function(){},"f").bind().name!==""},"boundFunctionsHaveNames");sy.exports=yo});var py=N((nI,uy)=>{"use strict";f();var cy=As(),v4=Ns()(),b4=ly().functionsHaveConfigurableNames(),C4=Qe();uy.exports=s(function(t,r){if(typeof t!="function")throw new C4("`fn` is not a function");var i=arguments.length>2&&!!arguments[2];return(!i||b4)&&(v4?cy(t,"name",r,!0,!0):cy(t,"name",r)),t},"setFunctionName")});var wu=N((sI,hy)=>{"use strict";f();var x4=py(),S4=Qe(),P4=Object;hy.exports=x4(s(function(){if(this==null||this!==P4(this))throw new S4("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 Tu=N((uI,fy)=>{"use strict";f();var M4=wu(),w4=Er().supportsDescriptors,T4=Object.getOwnPropertyDescriptor;fy.exports=s(function(){if(w4&&/a/mig.flags==="gim"){var t=T4(RegExp.prototype,"flags");if(t&&typeof t.get=="function"&&typeof RegExp.prototype.dotAll=="boolean"&&typeof RegExp.prototype.hasIndices=="boolean"){var r="",i={};if(Object.defineProperty(i,"hasIndices",{get:function(){r+="d"}}),Object.defineProperty(i,"sticky",{get:function(){r+="y"}}),r==="dy")return t.get}}return M4},"getPolyfill")});var yy=N((fI,my)=>{"use strict";f();var I4=Er().supportsDescriptors,E4=Tu(),_4=Object.getOwnPropertyDescriptor,L4=Object.defineProperty,O4=TypeError,dy=Object.getPrototypeOf,D4=/a/;my.exports=s(function(){if(!I4||!dy)throw new O4("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var t=E4(),r=dy(D4),i=_4(r,"flags");return(!i||i.get!==t)&&L4(r,"flags",{configurable:!0,enumerable:!1,get:t}),t},"shimFlags")});var Cy=N((yI,by)=>{"use strict";f();var A4=Er(),N4=ii(),R4=wu(),gy=Tu(),k4=yy(),vy=N4(gy());A4(vy,{getPolyfill:gy,implementation:R4,shim:k4});by.exports=vy});var _r=N((vI,xy)=>{"use strict";f();var F4=ho();xy.exports=s(function(){return F4()&&!!Symbol.toStringTag},"hasToStringTagShams")});var Eu=N((xI,Py)=>{"use strict";f();var B4=_r()(),G4=le(),Iu=G4("Object.prototype.toString"),Fs=s(function(t){return B4&&t&&typeof t=="object"&&Symbol.toStringTag in t?!1:Iu(t)==="[object Arguments]"},"isArguments"),Sy=s(function(t){return Fs(t)?!0:t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&Iu(t)!=="[object Array]"&&Iu(t.callee)==="[object Function]"},"isArguments"),V4=function(){return Fs(arguments)}();Fs.isLegacyArguments=Sy;Py.exports=V4?Fs:Sy});var My=N(()=>{f()});var jy=N((II,Yy)=>{f();var Bu=typeof Map=="function"&&Map.prototype,_u=Object.getOwnPropertyDescriptor&&Bu?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,Gs=Bu&&_u&&typeof _u.get=="function"?_u.get:null,wy=Bu&&Map.prototype.forEach,Gu=typeof Set=="function"&&Set.prototype,Lu=Object.getOwnPropertyDescriptor&&Gu?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,Vs=Gu&&Lu&&typeof Lu.get=="function"?Lu.get:null,Ty=Gu&&Set.prototype.forEach,H4=typeof WeakMap=="function"&&WeakMap.prototype,vo=H4?WeakMap.prototype.has:null,X4=typeof WeakSet=="function"&&WeakSet.prototype,bo=X4?WeakSet.prototype.has:null,Y4=typeof WeakRef=="function"&&WeakRef.prototype,Iy=Y4?WeakRef.prototype.deref:null,j4=Boolean.prototype.valueOf,W4=Object.prototype.toString,U4=Function.prototype.toString,z4=String.prototype.match,Vu=String.prototype.slice,Or=String.prototype.replace,Z4=String.prototype.toUpperCase,Ey=String.prototype.toLowerCase,Fy=RegExp.prototype.test,_y=Array.prototype.concat,Be=Array.prototype.join,q4=Array.prototype.slice,Ly=Math.floor,Au=typeof BigInt=="function"?BigInt.prototype.valueOf:null,Ou=Object.getOwnPropertySymbols,Nu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,on=typeof Symbol=="function"&&typeof Symbol.iterator=="object",Vt=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===on||!0)?Symbol.toStringTag:null,By=Object.prototype.propertyIsEnumerable,Oy=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(e){return e.__proto__}:null);function Dy(e,t){if(e===1/0||e===-1/0||e!==e||e&&e>-1e3&&e<1e3||Fy.call(/e/,t))return t;var r=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof e=="number"){var i=e<0?-Ly(-e):Ly(e);if(i!==e){var n=String(i),o=Vu.call(t,n.length+1);return Or.call(n,r,"$&_")+"."+Or.call(Or.call(o,/([0-9]{3})/g,"$&_"),/_$/,"")}}return Or.call(t,r,"$&_")}s(Dy,"addNumericSeparator");var Ru=My(),Ay=Ru.custom,Ny=Vy(Ay)?Ay:null;Yy.exports=s(function e(t,r,i,n){var o=r||{};if(Lr(o,"quoteStyle")&&o.quoteStyle!=="single"&&o.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(Lr(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=Lr(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(Lr(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(Lr(o,"numericSeparator")&&typeof o.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var l=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 Xy(t,o);if(typeof t=="number"){if(t===0)return 1/0/t>0?"0":"-0";var c=String(t);return l?Dy(t,c):c}if(typeof t=="bigint"){var h=String(t)+"n";return l?Dy(t,h):h}var d=typeof o.depth>"u"?5:o.depth;if(typeof i>"u"&&(i=0),i>=d&&d>0&&typeof t=="object")return ku(t)?"[Array]":"[Object]";var m=f7(o,i);if(typeof n>"u")n=[];else if(Hy(n,t)>=0)return"[Circular]";function y(lt,ht,yt){if(ht&&(n=q4.call(n),n.push(ht)),yt){var At={depth:o.depth};return Lr(o,"quoteStyle")&&(At.quoteStyle=o.quoteStyle),e(lt,At,i+1,n)}return e(lt,o,i+1,n)}if(s(y,"inspect"),typeof t=="function"&&!Ry(t)){var x=n7(t),S=Bs(t,y);return"[Function"+(x?": "+x:" (anonymous)")+"]"+(S.length>0?" { "+Be.call(S,", ")+" }":"")}if(Vy(t)){var P=on?Or.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):Nu.call(t);return typeof t=="object"&&!on?go(P):P}if(u7(t)){for(var g="<"+Ey.call(String(t.nodeName)),C=t.attributes||[],T=0;T<C.length;T++)g+=" "+C[T].name+"="+Gy($4(C[T].value),"double",o);return g+=">",t.childNodes&&t.childNodes.length&&(g+="..."),g+="</"+Ey.call(String(t.nodeName))+">",g}if(ku(t)){if(t.length===0)return"[]";var M=Bs(t,y);return m&&!h7(M)?"["+Fu(M,m)+"]":"[ "+Be.call(M,", ")+" ]"}if(K4(t)){var I=Bs(t,y);return!("cause"in Error.prototype)&&"cause"in t&&!By.call(t,"cause")?"{ ["+String(t)+"] "+Be.call(_y.call("[cause]: "+y(t.cause),I),", ")+" }":I.length===0?"["+String(t)+"]":"{ ["+String(t)+"] "+Be.call(I,", ")+" }"}if(typeof t=="object"&&a){if(Ny&&typeof t[Ny]=="function"&&Ru)return Ru(t,{depth:d-i});if(a!=="symbol"&&typeof t.inspect=="function")return t.inspect()}if(o7(t)){var _=[];return wy&&wy.call(t,function(lt,ht){_.push(y(ht,t,!0)+" => "+y(lt,t))}),ky("Map",Gs.call(t),_,m)}if(l7(t)){var O=[];return Ty&&Ty.call(t,function(lt){O.push(y(lt,t))}),ky("Set",Vs.call(t),O,m)}if(a7(t))return Du("WeakMap");if(c7(t))return Du("WeakSet");if(s7(t))return Du("WeakRef");if(t7(t))return go(y(Number(t)));if(r7(t))return go(y(Au.call(t)));if(e7(t))return go(j4.call(t));if(Q4(t))return go(y(String(t)));if(typeof window<"u"&&t===window)return"{ [object Window] }";if(t===global)return"{ [object globalThis] }";if(!J4(t)&&!Ry(t)){var k=Bs(t,y),B=Oy?Oy(t)===Object.prototype:t instanceof Object||t.constructor===Object,R=t instanceof Object?"":"null prototype",G=!B&&Vt&&Object(t)===t&&Vt in t?Vu.call(Dr(t),8,-1):R?"Object":"",H=B||typeof t.constructor!="function"?"":t.constructor.name?t.constructor.name+" ":"",Q=H+(G||R?"["+Be.call(_y.call([],G||[],R||[]),": ")+"] ":"");return k.length===0?Q+"{}":m?Q+"{"+Fu(k,m)+"}":Q+"{ "+Be.call(k,", ")+" }"}return String(t)},"inspect_");function Gy(e,t,r){var i=(r.quoteStyle||t)==="double"?'"':"'";return i+e+i}s(Gy,"wrapQuotes");function $4(e){return Or.call(String(e),/"/g,"&quot;")}s($4,"quote");function ku(e){return Dr(e)==="[object Array]"&&(!Vt||!(typeof e=="object"&&Vt in e))}s(ku,"isArray");function J4(e){return Dr(e)==="[object Date]"&&(!Vt||!(typeof e=="object"&&Vt in e))}s(J4,"isDate");function Ry(e){return Dr(e)==="[object RegExp]"&&(!Vt||!(typeof e=="object"&&Vt in e))}s(Ry,"isRegExp");function K4(e){return Dr(e)==="[object Error]"&&(!Vt||!(typeof e=="object"&&Vt in e))}s(K4,"isError");function Q4(e){return Dr(e)==="[object String]"&&(!Vt||!(typeof e=="object"&&Vt in e))}s(Q4,"isString");function t7(e){return Dr(e)==="[object Number]"&&(!Vt||!(typeof e=="object"&&Vt in e))}s(t7,"isNumber");function e7(e){return Dr(e)==="[object Boolean]"&&(!Vt||!(typeof e=="object"&&Vt in e))}s(e7,"isBoolean");function Vy(e){if(on)return e&&typeof e=="object"&&e instanceof Symbol;if(typeof e=="symbol")return!0;if(!e||typeof e!="object"||!Nu)return!1;try{return Nu.call(e),!0}catch{}return!1}s(Vy,"isSymbol");function r7(e){if(!e||typeof e!="object"||!Au)return!1;try{return Au.call(e),!0}catch{}return!1}s(r7,"isBigInt");var i7=Object.prototype.hasOwnProperty||function(e){return e in this};function Lr(e,t){return i7.call(e,t)}s(Lr,"has");function Dr(e){return W4.call(e)}s(Dr,"toStr");function n7(e){if(e.name)return e.name;var t=z4.call(U4.call(e),/^function\s*([\w$]+)/);return t?t[1]:null}s(n7,"nameOf");function Hy(e,t){if(e.indexOf)return e.indexOf(t);for(var r=0,i=e.length;r<i;r++)if(e[r]===t)return r;return-1}s(Hy,"indexOf");function o7(e){if(!Gs||!e||typeof e!="object")return!1;try{Gs.call(e);try{Vs.call(e)}catch{return!0}return e instanceof Map}catch{}return!1}s(o7,"isMap");function a7(e){if(!vo||!e||typeof e!="object")return!1;try{vo.call(e,vo);try{bo.call(e,bo)}catch{return!0}return e instanceof WeakMap}catch{}return!1}s(a7,"isWeakMap");function s7(e){if(!Iy||!e||typeof e!="object")return!1;try{return Iy.call(e),!0}catch{}return!1}s(s7,"isWeakRef");function l7(e){if(!Vs||!e||typeof e!="object")return!1;try{Vs.call(e);try{Gs.call(e)}catch{return!0}return e instanceof Set}catch{}return!1}s(l7,"isSet");function c7(e){if(!bo||!e||typeof e!="object")return!1;try{bo.call(e,bo);try{vo.call(e,vo)}catch{return!0}return e instanceof WeakSet}catch{}return!1}s(c7,"isWeakSet");function u7(e){return!e||typeof e!="object"?!1:typeof HTMLElement<"u"&&e instanceof HTMLElement?!0:typeof e.nodeName=="string"&&typeof e.getAttribute=="function"}s(u7,"isElement");function Xy(e,t){if(e.length>t.maxStringLength){var r=e.length-t.maxStringLength,i="... "+r+" more character"+(r>1?"s":"");return Xy(Vu.call(e,0,t.maxStringLength),t)+i}var n=Or.call(Or.call(e,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,p7);return Gy(n,"single",t)}s(Xy,"inspectString");function p7(e){var t=e.charCodeAt(0),r={8:"b",9:"t",10:"n",12:"f",13:"r"}[t];return r?"\\"+r:"\\x"+(t<16?"0":"")+Z4.call(t.toString(16))}s(p7,"lowbyte");function go(e){return"Object("+e+")"}s(go,"markBoxed");function Du(e){return e+" { ? }"}s(Du,"weakCollectionOf");function ky(e,t,r,i){var n=i?Fu(r,i):Be.call(r,", ");return e+" ("+t+") {"+n+"}"}s(ky,"collectionOf");function h7(e){for(var t=0;t<e.length;t++)if(Hy(e[t],`
2
- `)>=0)return!1;return!0}s(h7,"singleLineValues");function f7(e,t){var r;if(e.indent===" ")r=" ";else if(typeof e.indent=="number"&&e.indent>0)r=Be.call(Array(e.indent+1)," ");else return null;return{base:r,prev:Be.call(Array(t+1),r)}}s(f7,"getIndent");function Fu(e,t){if(e.length===0)return"";var r=`
3
- `+t.prev+t.base;return r+Be.call(e,","+r)+`
4
- `+t.prev}s(Fu,"indentedJoin");function Bs(e,t){var r=ku(e),i=[];if(r){i.length=e.length;for(var n=0;n<e.length;n++)i[n]=Lr(e,n)?t(e[n],e):""}var o=typeof Ou=="function"?Ou(e):[],a;if(on){a={};for(var l=0;l<o.length;l++)a["$"+o[l]]=o[l]}for(var c in e)Lr(e,c)&&(r&&String(Number(c))===c&&c<e.length||on&&a["$"+c]instanceof Symbol||(Fy.call(/[^\w$]/,c)?i.push(t(c,e)+": "+t(e[c],e)):i.push(c+": "+t(e[c],e))));if(typeof Ou=="function")for(var h=0;h<o.length;h++)By.call(e,o[h])&&i.push("["+t(o[h])+"]: "+t(e[o[h]],e));return i}s(Bs,"arrObjKeys")});var Xu=N((LI,Uy)=>{"use strict";f();var Wy=Se(),an=le(),d7=jy(),m7=Qe(),Hs=Wy("%WeakMap%",!0),Xs=Wy("%Map%",!0),y7=an("WeakMap.prototype.get",!0),g7=an("WeakMap.prototype.set",!0),v7=an("WeakMap.prototype.has",!0),b7=an("Map.prototype.get",!0),C7=an("Map.prototype.set",!0),x7=an("Map.prototype.has",!0),Hu=s(function(e,t){for(var r=e,i;(i=r.next)!==null;r=i)if(i.key===t)return r.next=i.next,i.next=e.next,e.next=i,i},"listGetNode"),S7=s(function(e,t){var r=Hu(e,t);return r&&r.value},"listGet"),P7=s(function(e,t,r){var i=Hu(e,t);i?i.value=r:e.next={key:t,next:e.next,value:r}},"listSet"),M7=s(function(e,t){return!!Hu(e,t)},"listHas");Uy.exports=s(function(){var t,r,i,n={assert:function(o){if(!n.has(o))throw new m7("Side channel does not contain "+d7(o))},get:function(o){if(Hs&&o&&(typeof o=="object"||typeof o=="function")){if(t)return y7(t,o)}else if(Xs){if(r)return b7(r,o)}else if(i)return S7(i,o)},has:function(o){if(Hs&&o&&(typeof o=="object"||typeof o=="function")){if(t)return v7(t,o)}else if(Xs){if(r)return x7(r,o)}else if(i)return M7(i,o);return!1},set:function(o,a){Hs&&o&&(typeof o=="object"||typeof o=="function")?(t||(t=new Hs),g7(t,o,a)):Xs?(r||(r=new Xs),C7(r,o,a)):(i||(i={key:{},next:null}),P7(i,o,a))}};return n},"getSideChannel")});var Zy=N((AI,zy)=>{"use strict";f();var w7=gu(),Co=Xu()(),tr=Qe(),Yu={assert:function(e,t){if(!e||typeof e!="object"&&typeof e!="function")throw new tr("`O` is not an object");if(typeof t!="string")throw new tr("`slot` must be a string");if(Co.assert(e),!Yu.has(e,t))throw new tr("`"+t+"` is not present on `O`")},get:function(e,t){if(!e||typeof e!="object"&&typeof e!="function")throw new tr("`O` is not an object");if(typeof t!="string")throw new tr("`slot` must be a string");var r=Co.get(e);return r&&r["$"+t]},has:function(e,t){if(!e||typeof e!="object"&&typeof e!="function")throw new tr("`O` is not an object");if(typeof t!="string")throw new tr("`slot` must be a string");var r=Co.get(e);return!!r&&w7(r,"$"+t)},set:function(e,t,r){if(!e||typeof e!="object"&&typeof e!="function")throw new tr("`O` is not an object");if(typeof t!="string")throw new tr("`slot` must be a string");var i=Co.get(e);i||(i={},Co.set(e,i)),i["$"+t]=r}};Object.freeze&&Object.freeze(Yu);zy.exports=Yu});var Jy=N((RI,$y)=>{"use strict";f();var xo=Zy(),T7=SyntaxError,qy=typeof StopIteration=="object"?StopIteration:null;$y.exports=s(function(t){if(!qy)throw new T7("this environment lacks StopIteration");xo.set(t,"[[Done]]",!1);var r={next:s(function(){var n=xo.get(this,"[[Iterator]]"),o=xo.get(n,"[[Done]]");try{return{done:o,value:o?void 0:n.next()}}catch(a){if(xo.set(n,"[[Done]]",!0),a!==qy)throw a;return{done:!0,value:void 0}}},"next")};return xo.set(r,"[[Iterator]]",t),r},"getStopIterationIterator")});var ju=N((BI,Ky)=>{f();var I7={}.toString;Ky.exports=Array.isArray||function(e){return I7.call(e)=="[object Array]"}});var Wu=N((VI,Qy)=>{"use strict";f();var E7=String.prototype.valueOf,_7=s(function(t){try{return E7.call(t),!0}catch{return!1}},"tryStringObject"),L7=Object.prototype.toString,O7="[object String]",D7=_r()();Qy.exports=s(function(t){return typeof t=="string"?!0:typeof t!="object"?!1:D7?_7(t):L7.call(t)===O7},"isString")});var zu=N((YI,rg)=>{"use strict";f();var Uu=typeof Map=="function"&&Map.prototype?Map:null,A7=typeof Set=="function"&&Set.prototype?Set:null,Ys;Uu||(Ys=s(function(t){return!1},"isMap"));var eg=Uu?Map.prototype.has:null,tg=A7?Set.prototype.has:null;!Ys&&!eg&&(Ys=s(function(t){return!1},"isMap"));rg.exports=Ys||s(function(t){if(!t||typeof t!="object")return!1;try{if(eg.call(t),tg)try{tg.call(t)}catch{return!0}return t instanceof Uu}catch{}return!1},"isMap")});var qu=N((UI,og)=>{"use strict";f();var N7=typeof Map=="function"&&Map.prototype?Map:null,Zu=typeof Set=="function"&&Set.prototype?Set:null,js;Zu||(js=s(function(t){return!1},"isSet"));var ig=N7?Map.prototype.has:null,ng=Zu?Set.prototype.has:null;!js&&!ng&&(js=s(function(t){return!1},"isSet"));og.exports=js||s(function(t){if(!t||typeof t!="object")return!1;try{if(ng.call(t),ig)try{ig.call(t)}catch{return!0}return t instanceof Zu}catch{}return!1},"isSet")});var gg=N((qI,zs)=>{"use strict";f();var ag=Eu(),sg=Jy();ws()()||ho()()?(Ws=Symbol.iterator,zs.exports=s(function(t){if(t!=null&&typeof t[Ws]<"u")return t[Ws]();if(ag(t))return Array.prototype[Ws].call(t)},"getIterator")):(lg=ju(),cg=Wu(),$u=Se(),ug=$u("%Map%",!0),pg=$u("%Set%",!0),he=le(),Ju=he("Array.prototype.push"),Ku=he("String.prototype.charCodeAt"),hg=he("String.prototype.slice"),fg=s(function(t,r){var i=t.length;if(r+1>=i)return r+1;var n=Ku(t,r);if(n<55296||n>56319)return r+1;var o=Ku(t,r+1);return o<56320||o>57343?r+1:r+2},"advanceStringIndex"),Us=s(function(t){var r=0;return{next:s(function(){var n=r>=t.length,o;return n||(o=t[r],r+=1),{done:n,value:o}},"next")}},"getArrayIterator"),Qu=s(function(t,r){if(lg(t)||ag(t))return Us(t);if(cg(t)){var i=0;return{next:s(function(){var o=fg(t,i),a=hg(t,i,o);return i=o,{done:o>t.length,value:a}},"next")}}if(r&&typeof t["_es6-shim iterator_"]<"u")return t["_es6-shim iterator_"]()},"getNonCollectionIterator"),!ug&&!pg?zs.exports=s(function(t){if(t!=null)return Qu(t,!0)},"getIterator"):(dg=zu(),mg=qu(),tp=he("Map.prototype.forEach",!0),ep=he("Set.prototype.forEach",!0),(typeof b>"u"||!b.versions||!b.versions.node)&&(rp=he("Map.prototype.iterator",!0),ip=he("Set.prototype.iterator",!0)),np=he("Map.prototype.@@iterator",!0)||he("Map.prototype._es6-shim iterator_",!0),op=he("Set.prototype.@@iterator",!0)||he("Set.prototype._es6-shim iterator_",!0),yg=s(function(t){if(dg(t)){if(rp)return sg(rp(t));if(np)return np(t);if(tp){var r=[];return tp(t,function(n,o){Ju(r,[o,n])}),Us(r)}}if(mg(t)){if(ip)return sg(ip(t));if(op)return op(t);if(ep){var i=[];return ep(t,function(n){Ju(i,n)}),Us(i)}}},"getCollectionIterator"),zs.exports=s(function(t){return yg(t)||Qu(t)},"getIterator")));var Ws,lg,cg,$u,ug,pg,he,Ju,Ku,hg,fg,Us,Qu,dg,mg,tp,ep,rp,ip,np,op,yg});var ap=N((KI,bg)=>{"use strict";f();var vg=s(function(e){return e!==e},"numberIsNaN");bg.exports=s(function(t,r){return t===0&&r===0?1/t===1/r:!!(t===r||vg(t)&&vg(r))},"is")});var sp=N((eE,Cg)=>{"use strict";f();var R7=ap();Cg.exports=s(function(){return typeof Object.is=="function"?Object.is:R7},"getPolyfill")});var Sg=N((nE,xg)=>{"use strict";f();var k7=sp(),F7=Er();xg.exports=s(function(){var t=k7();return F7(Object,{is:t},{is:s(function(){return Object.is!==t},"testObjectIs")}),t},"shimObjectIs")});var Tg=N((sE,wg)=>{"use strict";f();var B7=Er(),G7=ii(),V7=ap(),Pg=sp(),H7=Sg(),Mg=G7(Pg(),Object);B7(Mg,{getPolyfill:Pg,implementation:V7,shim:H7});wg.exports=Mg});var cp=N((cE,Lg)=>{"use strict";f();var X7=ii(),_g=le(),Y7=Se(),lp=Y7("%ArrayBuffer%",!0),Zs=_g("ArrayBuffer.prototype.byteLength",!0),j7=_g("Object.prototype.toString"),Ig=!!lp&&!Zs&&new lp(0).slice,Eg=!!Ig&&X7(Ig);Lg.exports=s(Zs||Eg?function(t){if(!t||typeof t!="object")return!1;try{return Zs?Zs(t):Eg(t,0),!0}catch{return!1}}:lp?function(t){return j7(t)==="[object ArrayBuffer]"}:function(t){return!1},"isArrayBuffer")});var Dg=N((hE,Og)=>{"use strict";f();var W7=Date.prototype.getDay,U7=s(function(t){try{return W7.call(t),!0}catch{return!1}},"tryDateGetDayCall"),z7=Object.prototype.toString,Z7="[object Date]",q7=_r()();Og.exports=s(function(t){return typeof t!="object"||t===null?!1:q7?U7(t):z7.call(t)===Z7},"isDateObject")});var Fg=N((mE,kg)=>{"use strict";f();var up=le(),Ag=_r()(),Ng,Rg,pp,hp;Ag&&(Ng=up("Object.prototype.hasOwnProperty"),Rg=up("RegExp.prototype.exec"),pp={},qs=s(function(){throw pp},"throwRegexMarker"),hp={toString:qs,valueOf:qs},typeof Symbol.toPrimitive=="symbol"&&(hp[Symbol.toPrimitive]=qs));var qs,$7=up("Object.prototype.toString"),J7=Object.getOwnPropertyDescriptor,K7="[object RegExp]";kg.exports=s(Ag?function(t){if(!t||typeof t!="object")return!1;var r=J7(t,"lastIndex"),i=r&&Ng(r,"value");if(!i)return!1;try{Rg(t,hp)}catch(n){return n===pp}}:function(t){return!t||typeof t!="object"&&typeof t!="function"?!1:$7(t)===K7},"isRegex")});var Vg=N((vE,Gg)=>{"use strict";f();var Q7=le(),Bg=Q7("SharedArrayBuffer.prototype.byteLength",!0);Gg.exports=s(Bg?function(t){if(!t||typeof t!="object")return!1;try{return Bg(t),!0}catch{return!1}}:function(t){return!1},"isSharedArrayBuffer")});var Xg=N((xE,Hg)=>{"use strict";f();var tC=Number.prototype.toString,eC=s(function(t){try{return tC.call(t),!0}catch{return!1}},"tryNumberObject"),rC=Object.prototype.toString,iC="[object Number]",nC=_r()();Hg.exports=s(function(t){return typeof t=="number"?!0:typeof t!="object"?!1:nC?eC(t):rC.call(t)===iC},"isNumberObject")});var Wg=N((ME,jg)=>{"use strict";f();var Yg=le(),oC=Yg("Boolean.prototype.toString"),aC=Yg("Object.prototype.toString"),sC=s(function(t){try{return oC(t),!0}catch{return!1}},"booleanBrandCheck"),lC="[object Boolean]",cC=_r()();jg.exports=s(function(t){return typeof t=="boolean"?!0:t===null||typeof t!="object"?!1:cC&&Symbol.toStringTag in t?sC(t):aC(t)===lC},"isBoolean")});var qg=N((IE,fp)=>{"use strict";f();var uC=Object.prototype.toString,pC=ws()();pC?(Ug=Symbol.prototype.toString,zg=/^Symbol\(.*\)$/,Zg=s(function(t){return typeof t.valueOf()!="symbol"?!1:zg.test(Ug.call(t))},"isRealSymbolObject"),fp.exports=s(function(t){if(typeof t=="symbol")return!0;if(uC.call(t)!=="[object Symbol]")return!1;try{return Zg(t)}catch{return!1}},"isSymbol")):fp.exports=s(function(t){return!1},"isSymbol");var Ug,zg,Zg});var Kg=N((LE,Jg)=>{"use strict";f();var $g=typeof BigInt<"u"&&BigInt;Jg.exports=s(function(){return typeof $g=="function"&&typeof BigInt=="function"&&typeof $g(42)=="bigint"&&typeof BigInt(42)=="bigint"},"hasNativeBigInts")});var e0=N((AE,dp)=>{"use strict";f();var hC=Kg()();hC?(Qg=BigInt.prototype.valueOf,t0=s(function(t){try{return Qg.call(t),!0}catch{}return!1},"tryBigIntObject"),dp.exports=s(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:t0(t)},"isBigInt")):dp.exports=s(function(t){return!1},"isBigInt");var Qg,t0});var i0=N((kE,r0)=>{"use strict";f();var fC=Wu(),dC=Xg(),mC=Wg(),yC=qg(),gC=e0();r0.exports=s(function(t){if(t==null||typeof t!="object"&&typeof t!="function")return null;if(fC(t))return"String";if(dC(t))return"Number";if(mC(t))return"Boolean";if(yC(t))return"Symbol";if(gC(t))return"BigInt"},"whichBoxedPrimitive")});var a0=N((GE,o0)=>{"use strict";f();var $s=typeof WeakMap=="function"&&WeakMap.prototype?WeakMap:null,n0=typeof WeakSet=="function"&&WeakSet.prototype?WeakSet:null,Js;$s||(Js=s(function(t){return!1},"isWeakMap"));var yp=$s?$s.prototype.has:null,mp=n0?n0.prototype.has:null;!Js&&!yp&&(Js=s(function(t){return!1},"isWeakMap"));o0.exports=Js||s(function(t){if(!t||typeof t!="object")return!1;try{if(yp.call(t,yp),mp)try{mp.call(t,mp)}catch{return!0}return t instanceof $s}catch{}return!1},"isWeakMap")});var l0=N((XE,vp)=>{"use strict";f();var vC=Se(),s0=le(),bC=vC("%WeakSet%",!0),gp=s0("WeakSet.prototype.has",!0);gp?(Ks=s0("WeakMap.prototype.has",!0),vp.exports=s(function(t){if(!t||typeof t!="object")return!1;try{if(gp(t,gp),Ks)try{Ks(t,Ks)}catch{return!0}return t instanceof bC}catch{}return!1},"isWeakSet")):vp.exports=s(function(t){return!1},"isWeakSet");var Ks});var u0=N((WE,c0)=>{"use strict";f();var CC=zu(),xC=qu(),SC=a0(),PC=l0();c0.exports=s(function(t){if(t&&typeof t=="object"){if(CC(t))return"Map";if(xC(t))return"Set";if(SC(t))return"WeakMap";if(PC(t))return"WeakSet"}return!1},"whichCollection")});var d0=N((ZE,f0)=>{"use strict";f();var h0=Function.prototype.toString,sn=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,Cp,Qs;if(typeof sn=="function"&&typeof Object.defineProperty=="function")try{Cp=Object.defineProperty({},"length",{get:function(){throw Qs}}),Qs={},sn(function(){throw 42},null,Cp)}catch(e){e!==Qs&&(sn=null)}else sn=null;var MC=/^\s*class\b/,xp=s(function(t){try{var r=h0.call(t);return MC.test(r)}catch{return!1}},"isES6ClassFunction"),bp=s(function(t){try{return xp(t)?!1:(h0.call(t),!0)}catch{return!1}},"tryFunctionToStr"),tl=Object.prototype.toString,wC="[object Object]",TC="[object Function]",IC="[object GeneratorFunction]",EC="[object HTMLAllCollection]",_C="[object HTML document.all class]",LC="[object HTMLCollection]",OC=typeof Symbol=="function"&&!!Symbol.toStringTag,DC=!(0 in[,]),Sp=s(function(){return!1},"isDocumentDotAll");typeof document=="object"&&(p0=document.all,tl.call(p0)===tl.call(document.all)&&(Sp=s(function(t){if((DC||!t)&&(typeof t>"u"||typeof t=="object"))try{var r=tl.call(t);return(r===EC||r===_C||r===LC||r===wC)&&t("")==null}catch{}return!1},"isDocumentDotAll")));var p0;f0.exports=s(sn?function(t){if(Sp(t))return!0;if(!t||typeof t!="function"&&typeof t!="object")return!1;try{sn(t,null,Cp)}catch(r){if(r!==Qs)return!1}return!xp(t)&&bp(t)}:function(t){if(Sp(t))return!0;if(!t||typeof t!="function"&&typeof t!="object")return!1;if(OC)return bp(t);if(xp(t))return!1;var r=tl.call(t);return r!==TC&&r!==IC&&!/^\[object HTML/.test(r)?!1:bp(t)},"isCallable")});var g0=N((JE,y0)=>{"use strict";f();var AC=d0(),NC=Object.prototype.toString,m0=Object.prototype.hasOwnProperty,RC=s(function(t,r,i){for(var n=0,o=t.length;n<o;n++)m0.call(t,n)&&(i==null?r(t[n],n,t):r.call(i,t[n],n,t))},"forEachArray"),kC=s(function(t,r,i){for(var n=0,o=t.length;n<o;n++)i==null?r(t.charAt(n),n,t):r.call(i,t.charAt(n),n,t)},"forEachString"),FC=s(function(t,r,i){for(var n in t)m0.call(t,n)&&(i==null?r(t[n],n,t):r.call(i,t[n],n,t))},"forEachObject"),BC=s(function(t,r,i){if(!AC(r))throw new TypeError("iterator must be a function");var n;arguments.length>=3&&(n=i),NC.call(t)==="[object Array]"?RC(t,r,n):typeof t=="string"?kC(t,r,n):FC(t,r,n)},"forEach");y0.exports=BC});var b0=N((t_,v0)=>{"use strict";f();v0.exports=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]});var x0=N((r_,C0)=>{"use strict";f();var Pp=b0(),GC=typeof globalThis>"u"?global:globalThis;C0.exports=s(function(){for(var t=[],r=0;r<Pp.length;r++)typeof GC[Pp[r]]=="function"&&(t[t.length]=Pp[r]);return t},"availableTypedArrays")});var T0=N((o_,w0)=>{"use strict";f();var rl=g0(),VC=x0(),S0=ii(),Tp=le(),el=Ds(),HC=Tp("Object.prototype.toString"),M0=_r()(),P0=typeof globalThis>"u"?global:globalThis,wp=VC(),Ip=Tp("String.prototype.slice"),Mp=Object.getPrototypeOf,XC=Tp("Array.prototype.indexOf",!0)||s(function(t,r){for(var i=0;i<t.length;i+=1)if(t[i]===r)return i;return-1},"indexOf"),il={__proto__:null};M0&&el&&Mp?rl(wp,function(e){var t=new P0[e];if(Symbol.toStringTag in t){var r=Mp(t),i=el(r,Symbol.toStringTag);if(!i){var n=Mp(r);i=el(n,Symbol.toStringTag)}il["$"+e]=S0(i.get)}}):rl(wp,function(e){var t=new P0[e],r=t.slice||t.set;r&&(il["$"+e]=S0(r))});var YC=s(function(t){var r=!1;return rl(il,function(i,n){if(!r)try{"$"+i(t)===n&&(r=Ip(n,1))}catch{}}),r},"tryAllTypedArrays"),jC=s(function(t){var r=!1;return rl(il,function(i,n){if(!r)try{i(t),r=Ip(n,1)}catch{}}),r},"tryAllSlices");w0.exports=s(function(t){if(!t||typeof t!="object")return!1;if(!M0){var r=Ip(HC(t),8,-1);return XC(wp,r)>-1?r:r!=="Object"?!1:jC(t)}return el?YC(t):null},"whichTypedArray")});var _0=N((l_,E0)=>{"use strict";f();var WC=le(),I0=WC("ArrayBuffer.prototype.byteLength",!0),UC=cp();E0.exports=s(function(t){return UC(t)?I0?I0(t):t.byteLength:NaN},"byteLength")});var t2=N((p_,Q0)=>{"use strict";f();var $0=ay(),Ge=le(),L0=Cy(),zC=Se(),ln=gg(),ZC=Xu(),O0=Tg(),D0=Eu(),A0=ju(),N0=cp(),R0=Dg(),k0=Fg(),F0=Vg(),B0=Ms(),G0=i0(),V0=u0(),H0=T0(),X0=_0(),Y0=Ge("SharedArrayBuffer.prototype.byteLength",!0),j0=Ge("Date.prototype.getTime"),Ep=Object.getPrototypeOf,W0=Ge("Object.prototype.toString"),ol=zC("%Set%",!0),_p=Ge("Map.prototype.has",!0),al=Ge("Map.prototype.get",!0),U0=Ge("Map.prototype.size",!0),sl=Ge("Set.prototype.add",!0),J0=Ge("Set.prototype.delete",!0),ll=Ge("Set.prototype.has",!0),nl=Ge("Set.prototype.size",!0);function z0(e,t,r,i){for(var n=ln(e),o;(o=n.next())&&!o.done;)if(Pe(t,o.value,r,i))return J0(e,o.value),!0;return!1}s(z0,"setHasEqualElement");function K0(e){if(typeof e>"u")return null;if(typeof e!="object")return typeof e=="symbol"?!1:typeof e=="string"||typeof e=="number"?+e==+e:!0}s(K0,"findLooseMatchingPrimitives");function qC(e,t,r,i,n,o){var a=K0(r);if(a!=null)return a;var l=al(t,a),c=$0({},n,{strict:!1});return typeof l>"u"&&!_p(t,a)||!Pe(i,l,c,o)?!1:!_p(e,a)&&Pe(i,l,c,o)}s(qC,"mapMightHaveLoosePrim");function $C(e,t,r){var i=K0(r);return i!=null?i:ll(t,i)&&!ll(e,i)}s($C,"setMightHaveLoosePrim");function Z0(e,t,r,i,n,o){for(var a=ln(e),l,c;(l=a.next())&&!l.done;)if(c=l.value,Pe(r,c,n,o)&&Pe(i,al(t,c),n,o))return J0(e,c),!0;return!1}s(Z0,"mapHasEqualEntry");function Pe(e,t,r,i){var n=r||{};if(n.strict?O0(e,t):e===t)return!0;var o=G0(e),a=G0(t);if(o!==a)return!1;if(!e||!t||typeof e!="object"&&typeof t!="object")return n.strict?O0(e,t):e==t;var l=i.has(e),c=i.has(t),h;if(l&&c){if(i.get(e)===i.get(t))return!0}else h={};return l||i.set(e,h),c||i.set(t,h),QC(e,t,n,i)}s(Pe,"internalDeepEqual");function q0(e){return!e||typeof e!="object"||typeof e.length!="number"||typeof e.copy!="function"||typeof e.slice!="function"||e.length>0&&typeof e[0]!="number"?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))}s(q0,"isBuffer");function JC(e,t,r,i){if(nl(e)!==nl(t))return!1;for(var n=ln(e),o=ln(t),a,l,c;(a=n.next())&&!a.done;)if(a.value&&typeof a.value=="object")c||(c=new ol),sl(c,a.value);else if(!ll(t,a.value)){if(r.strict||!$C(e,t,a.value))return!1;c||(c=new ol),sl(c,a.value)}if(c){for(;(l=o.next())&&!l.done;)if(l.value&&typeof l.value=="object"){if(!z0(c,l.value,r.strict,i))return!1}else if(!r.strict&&!ll(e,l.value)&&!z0(c,l.value,r.strict,i))return!1;return nl(c)===0}return!0}s(JC,"setEquiv");function KC(e,t,r,i){if(U0(e)!==U0(t))return!1;for(var n=ln(e),o=ln(t),a,l,c,h,d,m;(a=n.next())&&!a.done;)if(h=a.value[0],d=a.value[1],h&&typeof h=="object")c||(c=new ol),sl(c,h);else if(m=al(t,h),typeof m>"u"&&!_p(t,h)||!Pe(d,m,r,i)){if(r.strict||!qC(e,t,h,d,r,i))return!1;c||(c=new ol),sl(c,h)}if(c){for(;(l=o.next())&&!l.done;)if(h=l.value[0],m=l.value[1],h&&typeof h=="object"){if(!Z0(c,e,h,m,r,i))return!1}else if(!r.strict&&(!e.has(h)||!Pe(al(e,h),m,r,i))&&!Z0(c,e,h,m,$0({},r,{strict:!1}),i))return!1;return nl(c)===0}return!0}s(KC,"mapEquiv");function QC(e,t,r,i){var n,o;if(typeof e!=typeof t||e==null||t==null||W0(e)!==W0(t)||D0(e)!==D0(t))return!1;var a=A0(e),l=A0(t);if(a!==l)return!1;var c=e instanceof Error,h=t instanceof Error;if(c!==h||(c||h)&&(e.name!==t.name||e.message!==t.message))return!1;var d=k0(e),m=k0(t);if(d!==m||(d||m)&&(e.source!==t.source||L0(e)!==L0(t)))return!1;var y=R0(e),x=R0(t);if(y!==x||(y||x)&&j0(e)!==j0(t)||r.strict&&Ep&&Ep(e)!==Ep(t))return!1;var S=H0(e),P=H0(t);if(S!==P)return!1;if(S||P){if(e.length!==t.length)return!1;for(n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}var g=q0(e),C=q0(t);if(g!==C)return!1;if(g||C){if(e.length!==t.length)return!1;for(n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}var T=N0(e),M=N0(t);if(T!==M)return!1;if(T||M)return X0(e)!==X0(t)?!1:typeof Uint8Array=="function"&&Pe(new Uint8Array(e),new Uint8Array(t),r,i);var I=F0(e),_=F0(t);if(I!==_)return!1;if(I||_)return Y0(e)!==Y0(t)?!1:typeof Uint8Array=="function"&&Pe(new Uint8Array(e),new Uint8Array(t),r,i);if(typeof e!=typeof t)return!1;var O=B0(e),k=B0(t);if(O.length!==k.length)return!1;for(O.sort(),k.sort(),n=O.length-1;n>=0;n--)if(O[n]!=k[n])return!1;for(n=O.length-1;n>=0;n--)if(o=O[n],!Pe(e[o],t[o],r,i))return!1;var B=V0(e),R=V0(t);return B!==R?!1:B==="Set"||R==="Set"?JC(e,t,r,i):B==="Map"?KC(e,t,r,i):!0}s(QC,"objEquiv");Q0.exports=s(function(t,r,i){return Pe(t,r,i,ZC())},"deepEqual")});var y2=N(K=>{"use strict";f();Object.defineProperty(K,"__esModule",{value:!0});function t6(e){return e&&e.__esModule?e:{default:e}}s(t6,"_interopRequireDefault");var e6=Object.defineProperty,et=s((e,t)=>e6(e,"name",{value:t,configurable:!0}),"__name"),r6=t2(),i6=t6(r6),Mo,e2=(Mo=class{constructor(t){this.direction=!1,this.compareProperties=!0;var r,i,n;this.precision=10**-((r=t==null?void 0:t.precision)!=null?r: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,r){if(t.type!==r.type||!So(t,r))return!1;switch(t.type){case"Point":return this.compareCoord(t.coordinates,r.coordinates);case"LineString":return this.compareLine(t.coordinates,r.coordinates);case"Polygon":return this.comparePolygon(t,r);case"GeometryCollection":return this.compareGeometryCollection(t,r);case"Feature":return this.compareFeature(t,r);case"FeatureCollection":return this.compareFeatureCollection(t,r);default:if(t.type.startsWith("Multi")){let i=Lp(t),n=Lp(r);return i.every(o=>n.some(a=>this.compare(o,a)))}}return!1}compareCoord(t,r){return t.length===r.length&&t.every((i,n)=>Math.abs(i-r[n])<this.precision)}compareLine(t,r,i=0,n=!1){if(!So(t,r))return!1;let o=t,a=r;if(n&&!this.compareCoord(o[0],a[0])){let c=this.fixStartIndex(a,o);if(c)a=c;else return!1}let l=this.compareCoord(o[i],a[i]);return this.direction||l?this.comparePath(o,a):this.compareCoord(o[i],a[a.length-(1+i)])?this.comparePath(o.slice().reverse(),a):!1}fixStartIndex(t,r){let i,n=-1;for(let o=0;o<t.length;o++)if(this.compareCoord(t[o],r[0])){n=o;break}return n>=0&&(i=[].concat(t.slice(n,t.length),t.slice(1,n+1))),i}comparePath(t,r){return t.every((i,n)=>this.compareCoord(i,r[n]))}comparePolygon(t,r){if(this.compareLine(t.coordinates[0],r.coordinates[0],1,!0)){let i=t.coordinates.slice(1,t.coordinates.length),n=r.coordinates.slice(1,r.coordinates.length);return i.every(o=>n.some(a=>this.compareLine(o,a,1,!0)))}return!1}compareGeometryCollection(t,r){return So(t.geometries,r.geometries)&&this.compareBBox(t,r)&&t.geometries.every((i,n)=>this.compare(i,r.geometries[n]))}compareFeature(t,r){return t.id===r.id&&(this.compareProperties?i6.default.call(void 0,t.properties,r.properties):!0)&&this.compareBBox(t,r)&&this.compare(t.geometry,r.geometry)}compareFeatureCollection(t,r){return So(t.features,r.features)&&this.compareBBox(t,r)&&t.features.every((i,n)=>this.compare(i,r.features[n]))}compareBBox(t,r){return!t.bbox&&!r.bbox||(t.bbox&&r.bbox?this.compareCoord(t.bbox,r.bbox):!1)}},s(Mo,"_GeojsonEquality"),Mo);et(e2,"GeojsonEquality");var n6=e2;function So(e,t){return e.coordinates?e.coordinates.length===t.coordinates.length:e.length===t.length}s(So,"sameLength");et(So,"sameLength");function Lp(e){return e.coordinates.map(t=>({type:e.type.replace("Multi",""),coordinates:t}))}s(Lp,"explode");et(Lp,"explode");var ee=63710088e-1,Dp={centimeters:ee*100,centimetres:ee*100,degrees:360/(2*Math.PI),feet:ee*3.28084,inches:ee*39.37,kilometers:ee/1e3,kilometres:ee/1e3,meters:ee,metres:ee,miles:ee/1609.344,millimeters:ee*1e3,millimetres:ee*1e3,nauticalmiles:ee/1852,radians:1,yards:ee*1.0936},Op={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 er(e,t,r={}){let i={type:"Feature"};return(r.id===0||r.id)&&(i.id=r.id),r.bbox&&(i.bbox=r.bbox),i.properties=t||{},i.geometry=e,i}s(er,"feature");et(er,"feature");function r2(e,t,r={}){switch(e){case"Point":return cl(t).geometry;case"LineString":return pl(t).geometry;case"Polygon":return ul(t).geometry;case"MultiPoint":return Np(t).geometry;case"MultiLineString":return Ap(t).geometry;case"MultiPolygon":return Rp(t).geometry;default:throw new Error(e+" is invalid")}}s(r2,"geometry");et(r2,"geometry");function cl(e,t,r={}){if(!e)throw new Error("coordinates is required");if(!Array.isArray(e))throw new Error("coordinates must be an Array");if(e.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Po(e[0])||!Po(e[1]))throw new Error("coordinates must contain numbers");return er({type:"Point",coordinates:e},t,r)}s(cl,"point");et(cl,"point");function i2(e,t,r={}){return wo(e.map(i=>cl(i,t)),r)}s(i2,"points");et(i2,"points");function ul(e,t,r={}){for(let n of e){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 er({type:"Polygon",coordinates:e},t,r)}s(ul,"polygon");et(ul,"polygon");function n2(e,t,r={}){return wo(e.map(i=>ul(i,t)),r)}s(n2,"polygons");et(n2,"polygons");function pl(e,t,r={}){if(e.length<2)throw new Error("coordinates must be an array of two or more positions");return er({type:"LineString",coordinates:e},t,r)}s(pl,"lineString");et(pl,"lineString");function o2(e,t,r={}){return wo(e.map(i=>pl(i,t)),r)}s(o2,"lineStrings");et(o2,"lineStrings");function wo(e,t={}){let r={type:"FeatureCollection"};return t.id&&(r.id=t.id),t.bbox&&(r.bbox=t.bbox),r.features=e,r}s(wo,"featureCollection");et(wo,"featureCollection");function Ap(e,t,r={}){return er({type:"MultiLineString",coordinates:e},t,r)}s(Ap,"multiLineString");et(Ap,"multiLineString");function Np(e,t,r={}){return er({type:"MultiPoint",coordinates:e},t,r)}s(Np,"multiPoint");et(Np,"multiPoint");function Rp(e,t,r={}){return er({type:"MultiPolygon",coordinates:e},t,r)}s(Rp,"multiPolygon");et(Rp,"multiPolygon");function a2(e,t,r={}){return er({type:"GeometryCollection",geometries:e},t,r)}s(a2,"geometryCollection");et(a2,"geometryCollection");function s2(e,t=0){if(t&&!(t>=0))throw new Error("precision must be a positive number");let r=Math.pow(10,t||0);return Math.round(e*r)/r}s(s2,"round");et(s2,"round");function kp(e,t="kilometers"){let r=Dp[t];if(!r)throw new Error(t+" units is invalid");return e*r}s(kp,"radiansToLength");et(kp,"radiansToLength");function hl(e,t="kilometers"){let r=Dp[t];if(!r)throw new Error(t+" units is invalid");return e/r}s(hl,"lengthToRadians");et(hl,"lengthToRadians");function l2(e,t){return Fp(hl(e,t))}s(l2,"lengthToDegrees");et(l2,"lengthToDegrees");function c2(e){let t=e%360;return t<0&&(t+=360),t}s(c2,"bearingToAzimuth");et(c2,"bearingToAzimuth");function Fp(e){return e%(2*Math.PI)*180/Math.PI}s(Fp,"radiansToDegrees");et(Fp,"radiansToDegrees");function u2(e){return e%360*Math.PI/180}s(u2,"degreesToRadians");et(u2,"degreesToRadians");function p2(e,t="kilometers",r="kilometers"){if(!(e>=0))throw new Error("length must be a positive number");return kp(hl(e,t),r)}s(p2,"convertLength");et(p2,"convertLength");function h2(e,t="meters",r="kilometers"){if(!(e>=0))throw new Error("area must be a positive number");let i=Op[t];if(!i)throw new Error("invalid original units");let n=Op[r];if(!n)throw new Error("invalid final units");return e/i*n}s(h2,"convertArea");et(h2,"convertArea");function Po(e){return!isNaN(e)&&e!==null&&!Array.isArray(e)}s(Po,"isNumber");et(Po,"isNumber");function f2(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}s(f2,"isObject");et(f2,"isObject");function d2(e){if(!e)throw new Error("bbox is required");if(!Array.isArray(e))throw new Error("bbox must be an Array");if(e.length!==4&&e.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");e.forEach(t=>{if(!Po(t))throw new Error("bbox must only contain numbers")})}s(d2,"validateBBox");et(d2,"validateBBox");function m2(e){if(!e)throw new Error("id is required");if(["string","number"].indexOf(typeof e)===-1)throw new Error("id must be a number or a string")}s(m2,"validateId");et(m2,"validateId");K.GeojsonEquality=n6;K.areaFactors=Op;K.bearingToAzimuth=c2;K.convertArea=h2;K.convertLength=p2;K.degreesToRadians=u2;K.earthRadius=ee;K.factors=Dp;K.feature=er;K.featureCollection=wo;K.geometry=r2;K.geometryCollection=a2;K.isNumber=Po;K.isObject=f2;K.lengthToDegrees=l2;K.lengthToRadians=hl;K.lineString=pl;K.lineStrings=o2;K.multiLineString=Ap;K.multiPoint=Np;K.multiPolygon=Rp;K.point=cl;K.points=i2;K.polygon=ul;K.polygons=n2;K.radiansToDegrees=Fp;K.radiansToLength=kp;K.round=s2;K.validateBBox=d2;K.validateId=m2});var I2=N(Tt=>{"use strict";f();Object.defineProperty(Tt,"__esModule",{value:!0});var o6=Object.defineProperty,Rt=s((e,t)=>o6(e,"name",{value:t,configurable:!0}),"__name"),Ht=y2();function cn(e,t,r){if(e!==null)for(var i,n,o,a,l,c,h,d=0,m=0,y,x=e.type,S=x==="FeatureCollection",P=x==="Feature",g=S?e.features.length:1,C=0;C<g;C++){h=S?e.features[C].geometry:P?e.geometry:e,y=h?h.type==="GeometryCollection":!1,l=y?h.geometries.length:1;for(var T=0;T<l;T++){var M=0,I=0;if(a=y?h.geometries[T]:h,a!==null){c=a.coordinates;var _=a.type;switch(d=r&&(_==="Polygon"||_==="MultiPolygon")?1:0,_){case null:break;case"Point":if(t(c,m,C,M,I)===!1)return!1;m++,M++;break;case"LineString":case"MultiPoint":for(i=0;i<c.length;i++){if(t(c[i],m,C,M,I)===!1)return!1;m++,_==="MultiPoint"&&M++}_==="LineString"&&M++;break;case"Polygon":case"MultiLineString":for(i=0;i<c.length;i++){for(n=0;n<c[i].length-d;n++){if(t(c[i][n],m,C,M,I)===!1)return!1;m++}_==="MultiLineString"&&M++,_==="Polygon"&&I++}_==="Polygon"&&M++;break;case"MultiPolygon":for(i=0;i<c.length;i++){for(I=0,n=0;n<c[i].length;n++){for(o=0;o<c[i][n].length-d;o++){if(t(c[i][n][o],m,C,M,I)===!1)return!1;m++}I++}M++}break;case"GeometryCollection":for(i=0;i<a.geometries.length;i++)if(cn(a.geometries[i],t,r)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}s(cn,"coordEach");Rt(cn,"coordEach");function g2(e,t,r,i){var n=r;return cn(e,function(o,a,l,c,h){a===0&&r===void 0?n=o:n=t(n,o,a,l,c,h)},i),n}s(g2,"coordReduce");Rt(g2,"coordReduce");function Bp(e,t){var r;switch(e.type){case"FeatureCollection":for(r=0;r<e.features.length&&t(e.features[r].properties,r)!==!1;r++);break;case"Feature":t(e.properties,0);break}}s(Bp,"propEach");Rt(Bp,"propEach");function v2(e,t,r){var i=r;return Bp(e,function(n,o){o===0&&r===void 0?i=n:i=t(i,n,o)}),i}s(v2,"propReduce");Rt(v2,"propReduce");function Gp(e,t){if(e.type==="Feature")t(e,0);else if(e.type==="FeatureCollection")for(var r=0;r<e.features.length&&t(e.features[r],r)!==!1;r++);}s(Gp,"featureEach");Rt(Gp,"featureEach");function b2(e,t,r){var i=r;return Gp(e,function(n,o){o===0&&r===void 0?i=n:i=t(i,n,o)}),i}s(b2,"featureReduce");Rt(b2,"featureReduce");function C2(e){var t=[];return cn(e,function(r){t.push(r)}),t}s(C2,"coordAll");Rt(C2,"coordAll");function fl(e,t){var r,i,n,o,a,l,c,h,d,m,y=0,x=e.type==="FeatureCollection",S=e.type==="Feature",P=x?e.features.length:1;for(r=0;r<P;r++){for(l=x?e.features[r].geometry:S?e.geometry:e,h=x?e.features[r].properties:S?e.properties:{},d=x?e.features[r].bbox:S?e.bbox:void 0,m=x?e.features[r].id:S?e.id:void 0,c=l?l.type==="GeometryCollection":!1,a=c?l.geometries.length:1,n=0;n<a;n++){if(o=c?l.geometries[n]:l,o===null){if(t(null,y,h,d,m)===!1)return!1;continue}switch(o.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(t(o,y,h,d,m)===!1)return!1;break}case"GeometryCollection":{for(i=0;i<o.geometries.length;i++)if(t(o.geometries[i],y,h,d,m)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}y++}}s(fl,"geomEach");Rt(fl,"geomEach");function x2(e,t,r){var i=r;return fl(e,function(n,o,a,l,c){o===0&&r===void 0?i=n:i=t(i,n,o,a,l,c)}),i}s(x2,"geomReduce");Rt(x2,"geomReduce");function To(e,t){fl(e,function(r,i,n,o,a){var l=r===null?null:r.type;switch(l){case null:case"Point":case"LineString":case"Polygon":return t(Ht.feature.call(void 0,r,n,{bbox:o,id:a}),i,0)===!1?!1:void 0}var c;switch(l){case"MultiPoint":c="Point";break;case"MultiLineString":c="LineString";break;case"MultiPolygon":c="Polygon";break}for(var h=0;h<r.coordinates.length;h++){var d=r.coordinates[h],m={type:c,coordinates:d};if(t(Ht.feature.call(void 0,m,n),i,h)===!1)return!1}})}s(To,"flattenEach");Rt(To,"flattenEach");function S2(e,t,r){var i=r;return To(e,function(n,o,a){o===0&&a===0&&r===void 0?i=n:i=t(i,n,o,a)}),i}s(S2,"flattenReduce");Rt(S2,"flattenReduce");function Vp(e,t){To(e,function(r,i,n){var o=0;if(r.geometry){var a=r.geometry.type;if(!(a==="Point"||a==="MultiPoint")){var l,c=0,h=0,d=0;if(cn(r,function(m,y,x,S,P){if(l===void 0||i>c||S>h||P>d){l=m,c=i,h=S,d=P,o=0;return}var g=Ht.lineString.call(void 0,[l,m],r.properties);if(t(g,i,n,P,o)===!1)return!1;o++,l=m})===!1)return!1}}})}s(Vp,"segmentEach");Rt(Vp,"segmentEach");function P2(e,t,r){var i=r,n=!1;return Vp(e,function(o,a,l,c,h){n===!1&&r===void 0?i=o:i=t(i,o,a,l,c,h),n=!0}),i}s(P2,"segmentReduce");Rt(P2,"segmentReduce");function Hp(e,t){if(!e)throw new Error("geojson is required");To(e,function(r,i,n){if(r.geometry!==null){var o=r.geometry.type,a=r.geometry.coordinates;switch(o){case"LineString":if(t(r,i,n,0,0)===!1)return!1;break;case"Polygon":for(var l=0;l<a.length;l++)if(t(Ht.lineString.call(void 0,a[l],r.properties),i,n,l)===!1)return!1;break}}})}s(Hp,"lineEach");Rt(Hp,"lineEach");function M2(e,t,r){var i=r;return Hp(e,function(n,o,a,l){o===0&&r===void 0?i=n:i=t(i,n,o,a,l)}),i}s(M2,"lineReduce");Rt(M2,"lineReduce");function w2(e,t){if(t=t||{},!Ht.isObject.call(void 0,t))throw new Error("options is invalid");var r=t.featureIndex||0,i=t.multiFeatureIndex||0,n=t.geometryIndex||0,o=t.segmentIndex||0,a=t.properties,l;switch(e.type){case"FeatureCollection":r<0&&(r=e.features.length+r),a=a||e.features[r].properties,l=e.features[r].geometry;break;case"Feature":a=a||e.properties,l=e.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":l=e;break;default:throw new Error("geojson is invalid")}if(l===null)return null;var c=l.coordinates;switch(l.type){case"Point":case"MultiPoint":return null;case"LineString":return o<0&&(o=c.length+o-1),Ht.lineString.call(void 0,[c[o],c[o+1]],a,t);case"Polygon":return n<0&&(n=c.length+n),o<0&&(o=c[n].length+o-1),Ht.lineString.call(void 0,[c[n][o],c[n][o+1]],a,t);case"MultiLineString":return i<0&&(i=c.length+i),o<0&&(o=c[i].length+o-1),Ht.lineString.call(void 0,[c[i][o],c[i][o+1]],a,t);case"MultiPolygon":return i<0&&(i=c.length+i),n<0&&(n=c[i].length+n),o<0&&(o=c[i][n].length-o-1),Ht.lineString.call(void 0,[c[i][n][o],c[i][n][o+1]],a,t)}throw new Error("geojson is invalid")}s(w2,"findSegment");Rt(w2,"findSegment");function T2(e,t){if(t=t||{},!Ht.isObject.call(void 0,t))throw new Error("options is invalid");var r=t.featureIndex||0,i=t.multiFeatureIndex||0,n=t.geometryIndex||0,o=t.coordIndex||0,a=t.properties,l;switch(e.type){case"FeatureCollection":r<0&&(r=e.features.length+r),a=a||e.features[r].properties,l=e.features[r].geometry;break;case"Feature":a=a||e.properties,l=e.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":l=e;break;default:throw new Error("geojson is invalid")}if(l===null)return null;var c=l.coordinates;switch(l.type){case"Point":return Ht.point.call(void 0,c,a,t);case"MultiPoint":return i<0&&(i=c.length+i),Ht.point.call(void 0,c[i],a,t);case"LineString":return o<0&&(o=c.length+o),Ht.point.call(void 0,c[o],a,t);case"Polygon":return n<0&&(n=c.length+n),o<0&&(o=c[n].length+o),Ht.point.call(void 0,c[n][o],a,t);case"MultiLineString":return i<0&&(i=c.length+i),o<0&&(o=c[i].length+o),Ht.point.call(void 0,c[i][o],a,t);case"MultiPolygon":return i<0&&(i=c.length+i),n<0&&(n=c[i].length+n),o<0&&(o=c[i][n].length-o),Ht.point.call(void 0,c[i][n][o],a,t)}throw new Error("geojson is invalid")}s(T2,"findPoint");Rt(T2,"findPoint");Tt.coordAll=C2;Tt.coordEach=cn;Tt.coordReduce=g2;Tt.featureEach=Gp;Tt.featureReduce=b2;Tt.findPoint=T2;Tt.findSegment=w2;Tt.flattenEach=To;Tt.flattenReduce=S2;Tt.geomEach=fl;Tt.geomReduce=x2;Tt.lineEach=Hp;Tt.lineReduce=M2;Tt.propEach=Bp;Tt.propReduce=v2;Tt.segmentEach=Vp;Tt.segmentReduce=P2});var E2=N(dl=>{"use strict";f();Object.defineProperty(dl,"__esModule",{value:!0});var a6=Object.defineProperty,s6=s((e,t)=>a6(e,"name",{value:t,configurable:!0}),"__name"),l6=I2();function Xp(e,t={}){if(e.bbox!=null&&t.recompute!==!0)return e.bbox;let r=[1/0,1/0,-1/0,-1/0];return l6.coordEach.call(void 0,e,i=>{r[0]>i[0]&&(r[0]=i[0]),r[1]>i[1]&&(r[1]=i[1]),r[2]<i[0]&&(r[2]=i[0]),r[3]<i[1]&&(r[3]=i[1])}),r}s(Xp,"bbox");s6(Xp,"bbox");var c6=Xp;dl.bbox=Xp;dl.default=c6});var A2=N((w_,Yp)=>{f();var Ve=Im(),L2=uu(),O2=Fm(),un=E2().default,u6=O2.featureEach,P_=O2.coordEach,M_=L2.polygon,_2=L2.featureCollection;function D2(e){var t=new Ve(e);return t.insert=function(r){if(r.type!=="Feature")throw new Error("invalid feature");return r.bbox=r.bbox?r.bbox:un(r),Ve.prototype.insert.call(this,r)},t.load=function(r){var i=[];return Array.isArray(r)?r.forEach(function(n){if(n.type!=="Feature")throw new Error("invalid features");n.bbox=n.bbox?n.bbox:un(n),i.push(n)}):u6(r,function(n){if(n.type!=="Feature")throw new Error("invalid features");n.bbox=n.bbox?n.bbox:un(n),i.push(n)}),Ve.prototype.load.call(this,i)},t.remove=function(r,i){if(r.type!=="Feature")throw new Error("invalid feature");return r.bbox=r.bbox?r.bbox:un(r),Ve.prototype.remove.call(this,r,i)},t.clear=function(){return Ve.prototype.clear.call(this)},t.search=function(r){var i=Ve.prototype.search.call(this,this.toBBox(r));return _2(i)},t.collides=function(r){return Ve.prototype.collides.call(this,this.toBBox(r))},t.all=function(){var r=Ve.prototype.all.call(this);return _2(r)},t.toJSON=function(){return Ve.prototype.toJSON.call(this)},t.fromJSON=function(r){return Ve.prototype.fromJSON.call(this,r)},t.toBBox=function(r){var i;if(r.bbox)i=r.bbox;else if(Array.isArray(r)&&r.length===4)i=r;else if(Array.isArray(r)&&r.length===6)i=[r[0],r[1],r[3],r[4]];else if(r.type==="Feature")i=un(r);else if(r.type==="FeatureCollection")i=un(r);else throw new Error("invalid geojson");return{minX:i[0],minY:i[1],maxX:i[2],maxY:i[3]}},t}s(D2,"geojsonRbush");Yp.exports=D2;Yp.exports.default=D2});var Yv=N((Qo,On)=>{f();var e8=200,Sv="__lodash_hash_undefined__",r8=800,i8=16,Pv=9007199254740991,Mv="[object Arguments]",n8="[object Array]",o8="[object AsyncFunction]",a8="[object Boolean]",s8="[object Date]",l8="[object Error]",wv="[object Function]",c8="[object GeneratorFunction]",u8="[object Map]",p8="[object Number]",h8="[object Null]",Tv="[object Object]",f8="[object Proxy]",d8="[object RegExp]",m8="[object Set]",y8="[object String]",g8="[object Undefined]",v8="[object WeakMap]",b8="[object ArrayBuffer]",C8="[object DataView]",x8="[object Float32Array]",S8="[object Float64Array]",P8="[object Int8Array]",M8="[object Int16Array]",w8="[object Int32Array]",T8="[object Uint8Array]",I8="[object Uint8ClampedArray]",E8="[object Uint16Array]",_8="[object Uint32Array]",L8=/[\\^$.*+?()[\]{}|]/g,O8=/^\[object .+?Constructor\]$/,D8=/^(?:0|[1-9]\d*)$/,ct={};ct[x8]=ct[S8]=ct[P8]=ct[M8]=ct[w8]=ct[T8]=ct[I8]=ct[E8]=ct[_8]=!0;ct[Mv]=ct[n8]=ct[b8]=ct[a8]=ct[C8]=ct[s8]=ct[l8]=ct[wv]=ct[u8]=ct[p8]=ct[Tv]=ct[d8]=ct[m8]=ct[y8]=ct[v8]=!1;var Iv=typeof global=="object"&&global&&global.Object===Object&&global,A8=typeof self=="object"&&self&&self.Object===Object&&self,ra=Iv||A8||Function("return this")(),Ev=typeof Qo=="object"&&Qo&&!Qo.nodeType&&Qo,ta=Ev&&typeof On=="object"&&On&&!On.nodeType&&On,_v=ta&&ta.exports===Ev,Rh=_v&&Iv.process,fv=function(){try{var e=ta&&ta.require&&ta.require("util").types;return e||Rh&&Rh.binding&&Rh.binding("util")}catch{}}(),dv=fv&&fv.isTypedArray;function Lv(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}s(Lv,"apply");function N8(e,t){for(var r=-1,i=Array(e);++r<e;)i[r]=t(r);return i}s(N8,"baseTimes");function R8(e){return function(t){return e(t)}}s(R8,"baseUnary");function k8(e,t){return e==null?void 0:e[t]}s(k8,"getValue");function F8(e,t){return function(r){return e(t(r))}}s(F8,"overArg");var B8=Array.prototype,G8=Function.prototype,Ol=Object.prototype,kh=ra["__core-js_shared__"],Dl=G8.toString,fr=Ol.hasOwnProperty,mv=function(){var e=/[^.]+$/.exec(kh&&kh.keys&&kh.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),Ov=Ol.toString,V8=Dl.call(Object),H8=RegExp("^"+Dl.call(fr).replace(L8,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),_l=_v?ra.Buffer:void 0,yv=ra.Symbol,gv=ra.Uint8Array,vv=_l?_l.allocUnsafe:void 0,Dv=F8(Object.getPrototypeOf,Object),bv=Object.create,X8=Ol.propertyIsEnumerable,Y8=B8.splice,Si=yv?yv.toStringTag:void 0,Ll=function(){try{var e=Yh(Object,"defineProperty");return e({},"",{}),e}catch{}}(),j8=_l?_l.isBuffer:void 0,Cv=Math.max,W8=Date.now,Av=Yh(ra,"Map"),ea=Yh(Object,"create"),U8=function(){function e(){}return s(e,"object"),function(t){if(!hr(t))return{};if(bv)return bv(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}}();function Pi(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var i=e[t];this.set(i[0],i[1])}}s(Pi,"Hash");function z8(){this.__data__=ea?ea(null):{},this.size=0}s(z8,"hashClear");function Z8(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}s(Z8,"hashDelete");function q8(e){var t=this.__data__;if(ea){var r=t[e];return r===Sv?void 0:r}return fr.call(t,e)?t[e]:void 0}s(q8,"hashGet");function $8(e){var t=this.__data__;return ea?t[e]!==void 0:fr.call(t,e)}s($8,"hashHas");function J8(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=ea&&t===void 0?Sv:t,this}s(J8,"hashSet");Pi.prototype.clear=z8;Pi.prototype.delete=Z8;Pi.prototype.get=q8;Pi.prototype.has=$8;Pi.prototype.set=J8;function dr(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var i=e[t];this.set(i[0],i[1])}}s(dr,"ListCache");function K8(){this.__data__=[],this.size=0}s(K8,"listCacheClear");function Q8(e){var t=this.__data__,r=Al(t,e);if(r<0)return!1;var i=t.length-1;return r==i?t.pop():Y8.call(t,r,1),--this.size,!0}s(Q8,"listCacheDelete");function t9(e){var t=this.__data__,r=Al(t,e);return r<0?void 0:t[r][1]}s(t9,"listCacheGet");function e9(e){return Al(this.__data__,e)>-1}s(e9,"listCacheHas");function r9(e,t){var r=this.__data__,i=Al(r,e);return i<0?(++this.size,r.push([e,t])):r[i][1]=t,this}s(r9,"listCacheSet");dr.prototype.clear=K8;dr.prototype.delete=Q8;dr.prototype.get=t9;dr.prototype.has=e9;dr.prototype.set=r9;function Dn(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var i=e[t];this.set(i[0],i[1])}}s(Dn,"MapCache");function i9(){this.size=0,this.__data__={hash:new Pi,map:new(Av||dr),string:new Pi}}s(i9,"mapCacheClear");function n9(e){var t=Rl(this,e).delete(e);return this.size-=t?1:0,t}s(n9,"mapCacheDelete");function o9(e){return Rl(this,e).get(e)}s(o9,"mapCacheGet");function a9(e){return Rl(this,e).has(e)}s(a9,"mapCacheHas");function s9(e,t){var r=Rl(this,e),i=r.size;return r.set(e,t),this.size+=r.size==i?0:1,this}s(s9,"mapCacheSet");Dn.prototype.clear=i9;Dn.prototype.delete=n9;Dn.prototype.get=o9;Dn.prototype.has=a9;Dn.prototype.set=s9;function An(e){var t=this.__data__=new dr(e);this.size=t.size}s(An,"Stack");function l9(){this.__data__=new dr,this.size=0}s(l9,"stackClear");function c9(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}s(c9,"stackDelete");function u9(e){return this.__data__.get(e)}s(u9,"stackGet");function p9(e){return this.__data__.has(e)}s(p9,"stackHas");function h9(e,t){var r=this.__data__;if(r instanceof dr){var i=r.__data__;if(!Av||i.length<e8-1)return i.push([e,t]),this.size=++r.size,this;r=this.__data__=new Dn(i)}return r.set(e,t),this.size=r.size,this}s(h9,"stackSet");An.prototype.clear=l9;An.prototype.delete=c9;An.prototype.get=u9;An.prototype.has=p9;An.prototype.set=h9;function f9(e,t){var r=Vh(e),i=!r&&Gh(e),n=!r&&!i&&Bv(e),o=!r&&!i&&!n&&Vv(e),a=r||i||n||o,l=a?N8(e.length,String):[],c=l.length;for(var h in e)(t||fr.call(e,h))&&!(a&&(h=="length"||n&&(h=="offset"||h=="parent")||o&&(h=="buffer"||h=="byteLength"||h=="byteOffset")||kv(h,c)))&&l.push(h);return l}s(f9,"arrayLikeKeys");function Fh(e,t,r){(r!==void 0&&!kl(e[t],r)||r===void 0&&!(t in e))&&Hh(e,t,r)}s(Fh,"assignMergeValue");function d9(e,t,r){var i=e[t];(!(fr.call(e,t)&&kl(i,r))||r===void 0&&!(t in e))&&Hh(e,t,r)}s(d9,"assignValue");function Al(e,t){for(var r=e.length;r--;)if(kl(e[r][0],t))return r;return-1}s(Al,"assocIndexOf");function Hh(e,t,r){t=="__proto__"&&Ll?Ll(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}s(Hh,"baseAssignValue");var m9=I9();function Nl(e){return e==null?e===void 0?g8:h8:Si&&Si in Object(e)?E9(e):N9(e)}s(Nl,"baseGetTag");function xv(e){return ia(e)&&Nl(e)==Mv}s(xv,"baseIsArguments");function y9(e){if(!hr(e)||D9(e))return!1;var t=Wh(e)?H8:O8;return t.test(B9(e))}s(y9,"baseIsNative");function g9(e){return ia(e)&&Gv(e.length)&&!!ct[Nl(e)]}s(g9,"baseIsTypedArray");function v9(e){if(!hr(e))return A9(e);var t=Fv(e),r=[];for(var i in e)i=="constructor"&&(t||!fr.call(e,i))||r.push(i);return r}s(v9,"baseKeysIn");function Xh(e,t,r,i,n){e!==t&&m9(t,function(o,a){if(n||(n=new An),hr(o))b9(e,t,a,r,Xh,i,n);else{var l=i?i(Bh(e,a),o,a+"",e,t,n):void 0;l===void 0&&(l=o),Fh(e,a,l)}},Hv)}s(Xh,"baseMerge");function b9(e,t,r,i,n,o,a){var l=Bh(e,r),c=Bh(t,r),h=a.get(c);if(h){Fh(e,r,h);return}var d=o?o(l,c,r+"",e,t,a):void 0,m=d===void 0;if(m){var y=Vh(c),x=!y&&Bv(c),S=!y&&!x&&Vv(c);d=c,y||x||S?Vh(l)?d=l:G9(l)?d=M9(l):x?(m=!1,d=x9(c,!0)):S?(m=!1,d=P9(c,!0)):d=[]:V9(c)||Gh(c)?(d=l,Gh(l)?d=H9(l):(!hr(l)||Wh(l))&&(d=_9(c))):m=!1}m&&(a.set(c,d),n(d,c,i,o,a),a.delete(c)),Fh(e,r,d)}s(b9,"baseMergeDeep");function Nv(e,t){return k9(R9(e,t,Xv),e+"")}s(Nv,"baseRest");var C9=Ll?function(e,t){return Ll(e,"toString",{configurable:!0,enumerable:!1,value:j9(t),writable:!0})}:Xv;function x9(e,t){if(t)return e.slice();var r=e.length,i=vv?vv(r):new e.constructor(r);return e.copy(i),i}s(x9,"cloneBuffer");function S9(e){var t=new e.constructor(e.byteLength);return new gv(t).set(new gv(e)),t}s(S9,"cloneArrayBuffer");function P9(e,t){var r=t?S9(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}s(P9,"cloneTypedArray");function M9(e,t){var r=-1,i=e.length;for(t||(t=Array(i));++r<i;)t[r]=e[r];return t}s(M9,"copyArray");function w9(e,t,r,i){var n=!r;r||(r={});for(var o=-1,a=t.length;++o<a;){var l=t[o],c=i?i(r[l],e[l],l,r,e):void 0;c===void 0&&(c=e[l]),n?Hh(r,l,c):d9(r,l,c)}return r}s(w9,"copyObject");function T9(e){return Nv(function(t,r){var i=-1,n=r.length,o=n>1?r[n-1]:void 0,a=n>2?r[2]:void 0;for(o=e.length>3&&typeof o=="function"?(n--,o):void 0,a&&L9(r[0],r[1],a)&&(o=n<3?void 0:o,n=1),t=Object(t);++i<n;){var l=r[i];l&&e(t,l,i,o)}return t})}s(T9,"createAssigner");function I9(e){return function(t,r,i){for(var n=-1,o=Object(t),a=i(t),l=a.length;l--;){var c=a[e?l:++n];if(r(o[c],c,o)===!1)break}return t}}s(I9,"createBaseFor");function Rv(e,t,r,i,n,o){return hr(e)&&hr(t)&&(o.set(t,e),Xh(e,t,void 0,Rv,o),o.delete(t)),e}s(Rv,"customDefaultsMerge");function Rl(e,t){var r=e.__data__;return O9(t)?r[typeof t=="string"?"string":"hash"]:r.map}s(Rl,"getMapData");function Yh(e,t){var r=k8(e,t);return y9(r)?r:void 0}s(Yh,"getNative");function E9(e){var t=fr.call(e,Si),r=e[Si];try{e[Si]=void 0;var i=!0}catch{}var n=Ov.call(e);return i&&(t?e[Si]=r:delete e[Si]),n}s(E9,"getRawTag");function _9(e){return typeof e.constructor=="function"&&!Fv(e)?U8(Dv(e)):{}}s(_9,"initCloneObject");function kv(e,t){var r=typeof e;return t=t==null?Pv:t,!!t&&(r=="number"||r!="symbol"&&D8.test(e))&&e>-1&&e%1==0&&e<t}s(kv,"isIndex");function L9(e,t,r){if(!hr(r))return!1;var i=typeof t;return(i=="number"?jh(r)&&kv(t,r.length):i=="string"&&t in r)?kl(r[t],e):!1}s(L9,"isIterateeCall");function O9(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}s(O9,"isKeyable");function D9(e){return!!mv&&mv in e}s(D9,"isMasked");function Fv(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||Ol;return e===r}s(Fv,"isPrototype");function A9(e){var t=[];if(e!=null)for(var r in Object(e))t.push(r);return t}s(A9,"nativeKeysIn");function N9(e){return Ov.call(e)}s(N9,"objectToString");function R9(e,t,r){return t=Cv(t===void 0?e.length-1:t,0),function(){for(var i=arguments,n=-1,o=Cv(i.length-t,0),a=Array(o);++n<o;)a[n]=i[t+n];n=-1;for(var l=Array(t+1);++n<t;)l[n]=i[n];return l[t]=r(a),Lv(e,this,l)}}s(R9,"overRest");function Bh(e,t){if(!(t==="constructor"&&typeof e[t]=="function")&&t!="__proto__")return e[t]}s(Bh,"safeGet");var k9=F9(C9);function F9(e){var t=0,r=0;return function(){var i=W8(),n=i8-(i-r);if(r=i,n>0){if(++t>=r8)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}s(F9,"shortOut");function B9(e){if(e!=null){try{return Dl.call(e)}catch{}try{return e+""}catch{}}return""}s(B9,"toSource");function kl(e,t){return e===t||e!==e&&t!==t}s(kl,"eq");var Gh=xv(function(){return arguments}())?xv:function(e){return ia(e)&&fr.call(e,"callee")&&!X8.call(e,"callee")},Vh=Array.isArray;function jh(e){return e!=null&&Gv(e.length)&&!Wh(e)}s(jh,"isArrayLike");function G9(e){return ia(e)&&jh(e)}s(G9,"isArrayLikeObject");var Bv=j8||W9;function Wh(e){if(!hr(e))return!1;var t=Nl(e);return t==wv||t==c8||t==o8||t==f8}s(Wh,"isFunction");function Gv(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=Pv}s(Gv,"isLength");function hr(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}s(hr,"isObject");function ia(e){return e!=null&&typeof e=="object"}s(ia,"isObjectLike");function V9(e){if(!ia(e)||Nl(e)!=Tv)return!1;var t=Dv(e);if(t===null)return!0;var r=fr.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&Dl.call(r)==V8}s(V9,"isPlainObject");var Vv=dv?R8(dv):g9;function H9(e){return w9(e,Hv(e))}s(H9,"toPlainObject");var X9=Nv(function(e){return e.push(void 0,Rv),Lv(Y9,void 0,e)});function Hv(e){return jh(e)?f9(e,!0):v9(e)}s(Hv,"keysIn");var Y9=T9(function(e,t,r,i){Xh(e,t,r,i)});function j9(e){return function(){return e}}s(j9,"constant");function Xv(e){return e}s(Xv,"identity");function W9(){return!1}s(W9,"stubFalse");On.exports=X9});var Cb=N((bk,ha)=>{"use strict";f();var hx=!1,Ii=!1,fb=!0,db=!1,p={},mb=!1;typeof ha<"u"&&ha.exports?(ha.exports=p,mb=!0):typeof document<"u"?window.ClipperLib=p:self.ClipperLib=p;var Zl;mb?(_t="chrome",Zl="Netscape"):(_t=navigator.userAgent.toString().toLowerCase(),Zl=navigator.appName);var _t,z={};_t.indexOf("chrome")!=-1&&_t.indexOf("chromium")==-1?z.chrome=1:z.chrome=0;_t.indexOf("chromium")!=-1?z.chromium=1:z.chromium=0;_t.indexOf("safari")!=-1&&_t.indexOf("chrome")==-1&&_t.indexOf("chromium")==-1?z.safari=1:z.safari=0;_t.indexOf("firefox")!=-1?z.firefox=1:z.firefox=0;_t.indexOf("firefox/17")!=-1?z.firefox17=1:z.firefox17=0;_t.indexOf("firefox/15")!=-1?z.firefox15=1:z.firefox15=0;_t.indexOf("firefox/3")!=-1?z.firefox3=1:z.firefox3=0;_t.indexOf("opera")!=-1?z.opera=1:z.opera=0;_t.indexOf("msie 10")!=-1?z.msie10=1:z.msie10=0;_t.indexOf("msie 9")!=-1?z.msie9=1:z.msie9=0;_t.indexOf("msie 8")!=-1?z.msie8=1:z.msie8=0;_t.indexOf("msie 7")!=-1?z.msie7=1:z.msie7=0;_t.indexOf("msie ")!=-1?z.msie=1:z.msie=0;p.biginteger_used=null;var Ur,fx=0xdeadbeefcafe,pb=(fx&16777215)==15715070;function L(e,t,r){p.biginteger_used=1,e!=null&&(typeof e=="number"&&typeof t>"u"?this.fromInt(e):typeof e=="number"?this.fromNumber(e,t,r):t==null&&typeof e!="string"?this.fromString(e,256):this.fromString(e,t))}s(L,"BigInteger");function q(){return new L(null)}s(q,"nbi");function dx(e,t,r,i,n,o){for(;--o>=0;){var a=t*this[e++]+r[i]+n;n=Math.floor(a/67108864),r[i++]=a&67108863}return n}s(dx,"am1");function mx(e,t,r,i,n,o){for(var a=t&32767,l=t>>15;--o>=0;){var c=this[e]&32767,h=this[e++]>>15,d=l*c+h*a;c=a*c+((d&32767)<<15)+r[i]+(n&1073741823),n=(c>>>30)+(d>>>15)+l*h+(n>>>30),r[i++]=c&1073741823}return n}s(mx,"am2");function yx(e,t,r,i,n,o){for(var a=t&16383,l=t>>14;--o>=0;){var c=this[e]&16383,h=this[e++]>>14,d=l*c+h*a;c=a*c+((d&16383)<<14)+r[i]+n,n=(c>>28)+(d>>14)+l*h,r[i++]=c&268435455}return n}s(yx,"am3");pb&&Zl=="Microsoft Internet Explorer"?(L.prototype.am=mx,Ur=30):pb&&Zl!="Netscape"?(L.prototype.am=dx,Ur=26):(L.prototype.am=yx,Ur=28);L.prototype.DB=Ur;L.prototype.DM=(1<<Ur)-1;L.prototype.DV=1<<Ur;var af=52;L.prototype.FV=Math.pow(2,af);L.prototype.F1=af-Ur;L.prototype.F2=2*Ur-af;var gx="0123456789abcdefghijklmnopqrstuvwxyz",$l=new Array,kn,me;kn=48;for(me=0;me<=9;++me)$l[kn++]=me;kn=97;for(me=10;me<36;++me)$l[kn++]=me;kn=65;for(me=10;me<36;++me)$l[kn++]=me;function hb(e){return gx.charAt(e)}s(hb,"int2char");function yb(e,t){var r=$l[e.charCodeAt(t)];return r==null?-1:r}s(yb,"intAt");function vx(e){for(var t=this.t-1;t>=0;--t)e[t]=this[t];e.t=this.t,e.s=this.s}s(vx,"bnpCopyTo");function bx(e){this.t=1,this.s=e<0?-1:0,e>0?this[0]=e:e<-1?this[0]=e+this.DV:this.t=0}s(bx,"bnpFromInt");function Wr(e){var t=q();return t.fromInt(e),t}s(Wr,"nbv");function Cx(e,t){var r;if(t==16)r=4;else if(t==8)r=3;else if(t==256)r=8;else if(t==2)r=1;else if(t==32)r=5;else if(t==4)r=2;else{this.fromRadix(e,t);return}this.t=0,this.s=0;for(var i=e.length,n=!1,o=0;--i>=0;){var a=r==8?e[i]&255:yb(e,i);if(a<0){e.charAt(i)=="-"&&(n=!0);continue}n=!1,o==0?this[this.t++]=a:o+r>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+=r,o>=this.DB&&(o-=this.DB)}r==8&&e[0]&128&&(this.s=-1,o>0&&(this[this.t-1]|=(1<<this.DB-o)-1<<o)),this.clamp(),n&&L.ZERO.subTo(this,this)}s(Cx,"bnpFromString");function xx(){for(var e=this.s&this.DM;this.t>0&&this[this.t-1]==e;)--this.t}s(xx,"bnpClamp");function Sx(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(e==16)t=4;else if(e==8)t=3;else if(e==2)t=1;else if(e==32)t=5;else if(e==4)t=2;else return this.toRadix(e);var r=(1<<t)-1,i,n=!1,o="",a=this.t,l=this.DB-a*this.DB%t;if(a-- >0)for(l<this.DB&&(i=this[a]>>l)>0&&(n=!0,o=hb(i));a>=0;)l<t?(i=(this[a]&(1<<l)-1)<<t-l,i|=this[--a]>>(l+=this.DB-t)):(i=this[a]>>(l-=t)&r,l<=0&&(l+=this.DB,--a)),i>0&&(n=!0),n&&(o+=hb(i));return n?o:"0"}s(Sx,"bnToString");function Px(){var e=q();return L.ZERO.subTo(this,e),e}s(Px,"bnNegate");function Mx(){return this.s<0?this.negate():this}s(Mx,"bnAbs");function wx(e){var t=this.s-e.s;if(t!=0)return t;var r=this.t;if(t=r-e.t,t!=0)return this.s<0?-t:t;for(;--r>=0;)if((t=this[r]-e[r])!=0)return t;return 0}s(wx,"bnCompareTo");function Jl(e){var t=1,r;return(r=e>>>16)!=0&&(e=r,t+=16),(r=e>>8)!=0&&(e=r,t+=8),(r=e>>4)!=0&&(e=r,t+=4),(r=e>>2)!=0&&(e=r,t+=2),(r=e>>1)!=0&&(e=r,t+=1),t}s(Jl,"nbits");function Tx(){return this.t<=0?0:this.DB*(this.t-1)+Jl(this[this.t-1]^this.s&this.DM)}s(Tx,"bnBitLength");function Ix(e,t){var r;for(r=this.t-1;r>=0;--r)t[r+e]=this[r];for(r=e-1;r>=0;--r)t[r]=0;t.t=this.t+e,t.s=this.s}s(Ix,"bnpDLShiftTo");function Ex(e,t){for(var r=e;r<this.t;++r)t[r-e]=this[r];t.t=Math.max(this.t-e,0),t.s=this.s}s(Ex,"bnpDRShiftTo");function _x(e,t){var r=e%this.DB,i=this.DB-r,n=(1<<i)-1,o=Math.floor(e/this.DB),a=this.s<<r&this.DM,l;for(l=this.t-1;l>=0;--l)t[l+o+1]=this[l]>>i|a,a=(this[l]&n)<<r;for(l=o-1;l>=0;--l)t[l]=0;t[o]=a,t.t=this.t+o+1,t.s=this.s,t.clamp()}s(_x,"bnpLShiftTo");function Lx(e,t){t.s=this.s;var r=Math.floor(e/this.DB);if(r>=this.t){t.t=0;return}var i=e%this.DB,n=this.DB-i,o=(1<<i)-1;t[0]=this[r]>>i;for(var a=r+1;a<this.t;++a)t[a-r-1]|=(this[a]&o)<<n,t[a-r]=this[a]>>i;i>0&&(t[this.t-r-1]|=(this.s&o)<<n),t.t=this.t-r,t.clamp()}s(Lx,"bnpRShiftTo");function Ox(e,t){for(var r=0,i=0,n=Math.min(e.t,this.t);r<n;)i+=this[r]-e[r],t[r++]=i&this.DM,i>>=this.DB;if(e.t<this.t){for(i-=e.s;r<this.t;)i+=this[r],t[r++]=i&this.DM,i>>=this.DB;i+=this.s}else{for(i+=this.s;r<e.t;)i-=e[r],t[r++]=i&this.DM,i>>=this.DB;i-=e.s}t.s=i<0?-1:0,i<-1?t[r++]=this.DV+i:i>0&&(t[r++]=i),t.t=r,t.clamp()}s(Ox,"bnpSubTo");function Dx(e,t){var r=this.abs(),i=e.abs(),n=r.t;for(t.t=n+i.t;--n>=0;)t[n]=0;for(n=0;n<i.t;++n)t[n+r.t]=r.am(0,i[n],t,n,0,r.t);t.s=0,t.clamp(),this.s!=e.s&&L.ZERO.subTo(t,t)}s(Dx,"bnpMultiplyTo");function Ax(e){for(var t=this.abs(),r=e.t=2*t.t;--r>=0;)e[r]=0;for(r=0;r<t.t-1;++r){var i=t.am(r,t[r],e,2*r,0,1);(e[r+t.t]+=t.am(r+1,2*t[r],e,2*r+1,i,t.t-r-1))>=t.DV&&(e[r+t.t]-=t.DV,e[r+t.t+1]=1)}e.t>0&&(e[e.t-1]+=t.am(r,t[r],e,2*r,0,1)),e.s=0,e.clamp()}s(Ax,"bnpSquareTo");function Nx(e,t,r){var i=e.abs();if(!(i.t<=0)){var n=this.abs();if(n.t<i.t){t!=null&&t.fromInt(0),r!=null&&this.copyTo(r);return}r==null&&(r=q());var o=q(),a=this.s,l=e.s,c=this.DB-Jl(i[i.t-1]);c>0?(i.lShiftTo(c,o),n.lShiftTo(c,r)):(i.copyTo(o),n.copyTo(r));var h=o.t,d=o[h-1];if(d!=0){var m=d*(1<<this.F1)+(h>1?o[h-2]>>this.F2:0),y=this.FV/m,x=(1<<this.F1)/m,S=1<<this.F2,P=r.t,g=P-h,C=t==null?q():t;for(o.dlShiftTo(g,C),r.compareTo(C)>=0&&(r[r.t++]=1,r.subTo(C,r)),L.ONE.dlShiftTo(h,C),C.subTo(o,o);o.t<h;)o[o.t++]=0;for(;--g>=0;){var T=r[--P]==d?this.DM:Math.floor(r[P]*y+(r[P-1]+S)*x);if((r[P]+=o.am(0,T,r,g,0,h))<T)for(o.dlShiftTo(g,C),r.subTo(C,r);r[P]<--T;)r.subTo(C,r)}t!=null&&(r.drShiftTo(h,t),a!=l&&L.ZERO.subTo(t,t)),r.t=h,r.clamp(),c>0&&r.rShiftTo(c,r),a<0&&L.ZERO.subTo(r,r)}}}s(Nx,"bnpDivRemTo");function Rx(e){var t=q();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(L.ZERO)>0&&e.subTo(t,t),t}s(Rx,"bnMod");function Ei(e){this.m=e}s(Ei,"Classic");function kx(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e}s(kx,"cConvert");function Fx(e){return e}s(Fx,"cRevert");function Bx(e){e.divRemTo(this.m,null,e)}s(Bx,"cReduce");function Gx(e,t,r){e.multiplyTo(t,r),this.reduce(r)}s(Gx,"cMulTo");function Vx(e,t){e.squareTo(t),this.reduce(t)}s(Vx,"cSqrTo");Ei.prototype.convert=kx;Ei.prototype.revert=Fx;Ei.prototype.reduce=Bx;Ei.prototype.mulTo=Gx;Ei.prototype.sqrTo=Vx;function Hx(){if(this.t<1)return 0;var e=this[0];if(!(e&1))return 0;var t=e&3;return t=t*(2-(e&15)*t)&15,t=t*(2-(e&255)*t)&255,t=t*(2-((e&65535)*t&65535))&65535,t=t*(2-e*t%this.DV)%this.DV,t>0?this.DV-t:-t}s(Hx,"bnpInvDigit");function _i(e){this.m=e,this.mp=e.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<<e.DB-15)-1,this.mt2=2*e.t}s(_i,"Montgomery");function Xx(e){var t=q();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(L.ZERO)>0&&this.m.subTo(t,t),t}s(Xx,"montConvert");function Yx(e){var t=q();return e.copyTo(t),this.reduce(t),t}s(Yx,"montRevert");function jx(e){for(;e.t<=this.mt2;)e[e.t++]=0;for(var t=0;t<this.m.t;++t){var r=e[t]&32767,i=r*this.mpl+((r*this.mph+(e[t]>>15)*this.mpl&this.um)<<15)&e.DM;for(r=t+this.m.t,e[r]+=this.m.am(0,i,e,t,0,this.m.t);e[r]>=e.DV;)e[r]-=e.DV,e[++r]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)}s(jx,"montReduce");function Wx(e,t){e.squareTo(t),this.reduce(t)}s(Wx,"montSqrTo");function Ux(e,t,r){e.multiplyTo(t,r),this.reduce(r)}s(Ux,"montMulTo");_i.prototype.convert=Xx;_i.prototype.revert=Yx;_i.prototype.reduce=jx;_i.prototype.mulTo=Ux;_i.prototype.sqrTo=Wx;function zx(){return(this.t>0?this[0]&1:this.s)==0}s(zx,"bnpIsEven");function Zx(e,t){if(e>4294967295||e<1)return L.ONE;var r=q(),i=q(),n=t.convert(this),o=Jl(e)-1;for(n.copyTo(r);--o>=0;)if(t.sqrTo(r,i),(e&1<<o)>0)t.mulTo(i,n,r);else{var a=r;r=i,i=a}return t.revert(r)}s(Zx,"bnpExp");function qx(e,t){var r;return e<256||t.isEven()?r=new Ei(t):r=new _i(t),this.exp(e,r)}s(qx,"bnModPowInt");L.prototype.copyTo=vx;L.prototype.fromInt=bx;L.prototype.fromString=Cx;L.prototype.clamp=xx;L.prototype.dlShiftTo=Ix;L.prototype.drShiftTo=Ex;L.prototype.lShiftTo=_x;L.prototype.rShiftTo=Lx;L.prototype.subTo=Ox;L.prototype.multiplyTo=Dx;L.prototype.squareTo=Ax;L.prototype.divRemTo=Nx;L.prototype.invDigit=Hx;L.prototype.isEven=zx;L.prototype.exp=Zx;L.prototype.toString=Sx;L.prototype.negate=Px;L.prototype.abs=Mx;L.prototype.compareTo=wx;L.prototype.bitLength=Tx;L.prototype.mod=Rx;L.prototype.modPowInt=qx;L.ZERO=Wr(0);L.ONE=Wr(1);function $x(){var e=q();return this.copyTo(e),e}s($x,"bnClone");function Jx(){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]}s(Jx,"bnIntValue");function Kx(){return this.t==0?this.s:this[0]<<24>>24}s(Kx,"bnByteValue");function Qx(){return this.t==0?this.s:this[0]<<16>>16}s(Qx,"bnShortValue");function tS(e){return Math.floor(Math.LN2*this.DB/Math.log(e))}s(tS,"bnpChunkSize");function eS(){return this.s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1}s(eS,"bnSigNum");function rS(e){if(e==null&&(e=10),this.signum()==0||e<2||e>36)return"0";var t=this.chunkSize(e),r=Math.pow(e,t),i=Wr(r),n=q(),o=q(),a="";for(this.divRemTo(i,n,o);n.signum()>0;)a=(r+o.intValue()).toString(e).substr(1)+a,n.divRemTo(i,n,o);return o.intValue().toString(e)+a}s(rS,"bnpToRadix");function iS(e,t){this.fromInt(0),t==null&&(t=10);for(var r=this.chunkSize(t),i=Math.pow(t,r),n=!1,o=0,a=0,l=0;l<e.length;++l){var c=yb(e,l);if(c<0){e.charAt(l)=="-"&&this.signum()==0&&(n=!0);continue}a=t*a+c,++o>=r&&(this.dMultiply(i),this.dAddOffset(a,0),o=0,a=0)}o>0&&(this.dMultiply(Math.pow(t,o)),this.dAddOffset(a,0)),n&&L.ZERO.subTo(this,this)}s(iS,"bnpFromRadix");function nS(e,t,r){if(typeof t=="number")if(e<2)this.fromInt(1);else for(this.fromNumber(e,r),this.testBit(e-1)||this.bitwiseTo(L.ONE.shiftLeft(e-1),sf,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(L.ONE.shiftLeft(e-1),this);else{var i=new Array,n=e&7;i.length=(e>>3)+1,t.nextBytes(i),n>0?i[0]&=(1<<n)-1:i[0]=0,this.fromString(i,256)}}s(nS,"bnpFromNumber");function oS(){var e=this.t,t=new Array;t[0]=this.s;var r=this.DB-e*this.DB%8,i,n=0;if(e-- >0)for(r<this.DB&&(i=this[e]>>r)!=(this.s&this.DM)>>r&&(t[n++]=i|this.s<<this.DB-r);e>=0;)r<8?(i=(this[e]&(1<<r)-1)<<8-r,i|=this[--e]>>(r+=this.DB-8)):(i=this[e]>>(r-=8)&255,r<=0&&(r+=this.DB,--e)),i&128&&(i|=-256),n==0&&(this.s&128)!=(i&128)&&++n,(n>0||i!=this.s)&&(t[n++]=i);return t}s(oS,"bnToByteArray");function aS(e){return this.compareTo(e)==0}s(aS,"bnEquals");function sS(e){return this.compareTo(e)<0?this:e}s(sS,"bnMin");function lS(e){return this.compareTo(e)>0?this:e}s(lS,"bnMax");function cS(e,t,r){var i,n,o=Math.min(e.t,this.t);for(i=0;i<o;++i)r[i]=t(this[i],e[i]);if(e.t<this.t){for(n=e.s&this.DM,i=o;i<this.t;++i)r[i]=t(this[i],n);r.t=this.t}else{for(n=this.s&this.DM,i=o;i<e.t;++i)r[i]=t(n,e[i]);r.t=e.t}r.s=t(this.s,e.s),r.clamp()}s(cS,"bnpBitwiseTo");function uS(e,t){return e&t}s(uS,"op_and");function pS(e){var t=q();return this.bitwiseTo(e,uS,t),t}s(pS,"bnAnd");function sf(e,t){return e|t}s(sf,"op_or");function hS(e){var t=q();return this.bitwiseTo(e,sf,t),t}s(hS,"bnOr");function gb(e,t){return e^t}s(gb,"op_xor");function fS(e){var t=q();return this.bitwiseTo(e,gb,t),t}s(fS,"bnXor");function vb(e,t){return e&~t}s(vb,"op_andnot");function dS(e){var t=q();return this.bitwiseTo(e,vb,t),t}s(dS,"bnAndNot");function mS(){for(var e=q(),t=0;t<this.t;++t)e[t]=this.DM&~this[t];return e.t=this.t,e.s=~this.s,e}s(mS,"bnNot");function yS(e){var t=q();return e<0?this.rShiftTo(-e,t):this.lShiftTo(e,t),t}s(yS,"bnShiftLeft");function gS(e){var t=q();return e<0?this.lShiftTo(-e,t):this.rShiftTo(e,t),t}s(gS,"bnShiftRight");function vS(e){if(e==0)return-1;var t=0;return e&65535||(e>>=16,t+=16),e&255||(e>>=8,t+=8),e&15||(e>>=4,t+=4),e&3||(e>>=2,t+=2),e&1||++t,t}s(vS,"lbit");function bS(){for(var e=0;e<this.t;++e)if(this[e]!=0)return e*this.DB+vS(this[e]);return this.s<0?this.t*this.DB:-1}s(bS,"bnGetLowestSetBit");function CS(e){for(var t=0;e!=0;)e&=e-1,++t;return t}s(CS,"cbit");function xS(){for(var e=0,t=this.s&this.DM,r=0;r<this.t;++r)e+=CS(this[r]^t);return e}s(xS,"bnBitCount");function SS(e){var t=Math.floor(e/this.DB);return t>=this.t?this.s!=0:(this[t]&1<<e%this.DB)!=0}s(SS,"bnTestBit");function PS(e,t){var r=L.ONE.shiftLeft(e);return this.bitwiseTo(r,t,r),r}s(PS,"bnpChangeBit");function MS(e){return this.changeBit(e,sf)}s(MS,"bnSetBit");function wS(e){return this.changeBit(e,vb)}s(wS,"bnClearBit");function TS(e){return this.changeBit(e,gb)}s(TS,"bnFlipBit");function IS(e,t){for(var r=0,i=0,n=Math.min(e.t,this.t);r<n;)i+=this[r]+e[r],t[r++]=i&this.DM,i>>=this.DB;if(e.t<this.t){for(i+=e.s;r<this.t;)i+=this[r],t[r++]=i&this.DM,i>>=this.DB;i+=this.s}else{for(i+=this.s;r<e.t;)i+=e[r],t[r++]=i&this.DM,i>>=this.DB;i+=e.s}t.s=i<0?-1:0,i>0?t[r++]=i:i<-1&&(t[r++]=this.DV+i),t.t=r,t.clamp()}s(IS,"bnpAddTo");function ES(e){var t=q();return this.addTo(e,t),t}s(ES,"bnAdd");function _S(e){var t=q();return this.subTo(e,t),t}s(_S,"bnSubtract");function LS(e){var t=q();return this.multiplyTo(e,t),t}s(LS,"bnMultiply");function OS(){var e=q();return this.squareTo(e),e}s(OS,"bnSquare");function DS(e){var t=q();return this.divRemTo(e,t,null),t}s(DS,"bnDivide");function AS(e){var t=q();return this.divRemTo(e,null,t),t}s(AS,"bnRemainder");function NS(e){var t=q(),r=q();return this.divRemTo(e,t,r),new Array(t,r)}s(NS,"bnDivideAndRemainder");function RS(e){this[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()}s(RS,"bnpDMultiply");function kS(e,t){if(e!=0){for(;this.t<=t;)this[this.t++]=0;for(this[t]+=e;this[t]>=this.DV;)this[t]-=this.DV,++t>=this.t&&(this[this.t++]=0),++this[t]}}s(kS,"bnpDAddOffset");function fa(){}s(fa,"NullExp");function bb(e){return e}s(bb,"nNop");function FS(e,t,r){e.multiplyTo(t,r)}s(FS,"nMulTo");function BS(e,t){e.squareTo(t)}s(BS,"nSqrTo");fa.prototype.convert=bb;fa.prototype.revert=bb;fa.prototype.mulTo=FS;fa.prototype.sqrTo=BS;function GS(e){return this.exp(e,new fa)}s(GS,"bnPow");function VS(e,t,r){var i=Math.min(this.t+e.t,t);for(r.s=0,r.t=i;i>0;)r[--i]=0;var n;for(n=r.t-this.t;i<n;++i)r[i+this.t]=this.am(0,e[i],r,i,0,this.t);for(n=Math.min(e.t,t);i<n;++i)this.am(0,e[i],r,i,0,t-i);r.clamp()}s(VS,"bnpMultiplyLowerTo");function HS(e,t,r){--t;var i=r.t=this.t+e.t-t;for(r.s=0;--i>=0;)r[i]=0;for(i=Math.max(t-this.t,0);i<e.t;++i)r[this.t+i-t]=this.am(t-i,e[i],r,0,0,this.t+i-t);r.clamp(),r.drShiftTo(1,r)}s(HS,"bnpMultiplyUpperTo");function Fn(e){this.r2=q(),this.q3=q(),L.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e),this.m=e}s(Fn,"Barrett");function XS(e){if(e.s<0||e.t>2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=q();return e.copyTo(t),this.reduce(t),t}s(XS,"barrettConvert");function YS(e){return e}s(YS,"barrettRevert");function jS(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)}s(jS,"barrettReduce");function WS(e,t){e.squareTo(t),this.reduce(t)}s(WS,"barrettSqrTo");function US(e,t,r){e.multiplyTo(t,r),this.reduce(r)}s(US,"barrettMulTo");Fn.prototype.convert=XS;Fn.prototype.revert=YS;Fn.prototype.reduce=jS;Fn.prototype.mulTo=US;Fn.prototype.sqrTo=WS;function zS(e,t){var r=e.bitLength(),i,n=Wr(1),o;if(r<=0)return n;r<18?i=1:r<48?i=3:r<144?i=4:r<768?i=5:i=6,r<8?o=new Ei(t):t.isEven()?o=new Fn(t):o=new _i(t);var a=new Array,l=3,c=i-1,h=(1<<i)-1;if(a[1]=o.convert(this),i>1){var d=q();for(o.sqrTo(a[1],d);l<=h;)a[l]=q(),o.mulTo(d,a[l-2],a[l]),l+=2}var m=e.t-1,y,x=!0,S=q(),P;for(r=Jl(e[m])-1;m>=0;){for(r>=c?y=e[m]>>r-c&h:(y=(e[m]&(1<<r+1)-1)<<c-r,m>0&&(y|=e[m-1]>>this.DB+r-c)),l=i;!(y&1);)y>>=1,--l;if((r-=l)<0&&(r+=this.DB,--m),x)a[y].copyTo(n),x=!1;else{for(;l>1;)o.sqrTo(n,S),o.sqrTo(S,n),l-=2;l>0?o.sqrTo(n,S):(P=n,n=S,S=P),o.mulTo(S,a[y],n)}for(;m>=0&&!(e[m]&1<<r);)o.sqrTo(n,S),P=n,n=S,S=P,--r<0&&(r=this.DB-1,--m)}return o.revert(n)}s(zS,"bnModPow");function ZS(e){var t=this.s<0?this.negate():this.clone(),r=e.s<0?e.negate():e.clone();if(t.compareTo(r)<0){var i=t;t=r,r=i}var n=t.getLowestSetBit(),o=r.getLowestSetBit();if(o<0)return t;for(n<o&&(o=n),o>0&&(t.rShiftTo(o,t),r.rShiftTo(o,r));t.signum()>0;)(n=t.getLowestSetBit())>0&&t.rShiftTo(n,t),(n=r.getLowestSetBit())>0&&r.rShiftTo(n,r),t.compareTo(r)>=0?(t.subTo(r,t),t.rShiftTo(1,t)):(r.subTo(t,r),r.rShiftTo(1,r));return o>0&&r.lShiftTo(o,r),r}s(ZS,"bnGCD");function qS(e){if(e<=0)return 0;var t=this.DV%e,r=this.s<0?e-1:0;if(this.t>0)if(t==0)r=this[0]%e;else for(var i=this.t-1;i>=0;--i)r=(t*r+this[i])%e;return r}s(qS,"bnpModInt");function $S(e){var t=e.isEven();if(this.isEven()&&t||e.signum()==0)return L.ZERO;for(var r=e.clone(),i=this.clone(),n=Wr(1),o=Wr(0),a=Wr(0),l=Wr(1);r.signum()!=0;){for(;r.isEven();)r.rShiftTo(1,r),t?((!n.isEven()||!o.isEven())&&(n.addTo(this,n),o.subTo(e,o)),n.rShiftTo(1,n)):o.isEven()||o.subTo(e,o),o.rShiftTo(1,o);for(;i.isEven();)i.rShiftTo(1,i),t?((!a.isEven()||!l.isEven())&&(a.addTo(this,a),l.subTo(e,l)),a.rShiftTo(1,a)):l.isEven()||l.subTo(e,l),l.rShiftTo(1,l);r.compareTo(i)>=0?(r.subTo(i,r),t&&n.subTo(a,n),o.subTo(l,o)):(i.subTo(r,i),t&&a.subTo(n,a),l.subTo(o,l))}if(i.compareTo(L.ONE)!=0)return L.ZERO;if(l.compareTo(e)>=0)return l.subtract(e);if(l.signum()<0)l.addTo(e,l);else return l;return l.signum()<0?l.add(e):l}s($S,"bnModInverse");var zt=[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],JS=(1<<26)/zt[zt.length-1];function KS(e){var t,r=this.abs();if(r.t==1&&r[0]<=zt[zt.length-1]){for(t=0;t<zt.length;++t)if(r[0]==zt[t])return!0;return!1}if(r.isEven())return!1;for(t=1;t<zt.length;){for(var i=zt[t],n=t+1;n<zt.length&&i<JS;)i*=zt[n++];for(i=r.modInt(i);t<n;)if(i%zt[t++]==0)return!1}return r.millerRabin(e)}s(KS,"bnIsProbablePrime");function QS(e){var t=this.subtract(L.ONE),r=t.getLowestSetBit();if(r<=0)return!1;var i=t.shiftRight(r);e=e+1>>1,e>zt.length&&(e=zt.length);for(var n=q(),o=0;o<e;++o){n.fromInt(zt[Math.floor(Math.random()*zt.length)]);var a=n.modPow(i,this);if(a.compareTo(L.ONE)!=0&&a.compareTo(t)!=0){for(var l=1;l++<r&&a.compareTo(t)!=0;)if(a=a.modPowInt(2,this),a.compareTo(L.ONE)==0)return!1;if(a.compareTo(t)!=0)return!1}}return!0}s(QS,"bnpMillerRabin");L.prototype.chunkSize=tS;L.prototype.toRadix=rS;L.prototype.fromRadix=iS;L.prototype.fromNumber=nS;L.prototype.bitwiseTo=cS;L.prototype.changeBit=PS;L.prototype.addTo=IS;L.prototype.dMultiply=RS;L.prototype.dAddOffset=kS;L.prototype.multiplyLowerTo=VS;L.prototype.multiplyUpperTo=HS;L.prototype.modInt=qS;L.prototype.millerRabin=QS;L.prototype.clone=$x;L.prototype.intValue=Jx;L.prototype.byteValue=Kx;L.prototype.shortValue=Qx;L.prototype.signum=eS;L.prototype.toByteArray=oS;L.prototype.equals=aS;L.prototype.min=sS;L.prototype.max=lS;L.prototype.and=pS;L.prototype.or=hS;L.prototype.xor=fS;L.prototype.andNot=dS;L.prototype.not=mS;L.prototype.shiftLeft=yS;L.prototype.shiftRight=gS;L.prototype.getLowestSetBit=bS;L.prototype.bitCount=xS;L.prototype.testBit=SS;L.prototype.setBit=MS;L.prototype.clearBit=wS;L.prototype.flipBit=TS;L.prototype.add=ES;L.prototype.subtract=_S;L.prototype.multiply=LS;L.prototype.divide=DS;L.prototype.remainder=AS;L.prototype.divideAndRemainder=NS;L.prototype.modPow=zS;L.prototype.modInverse=$S;L.prototype.pow=GS;L.prototype.gcd=ZS;L.prototype.isProbablePrime=KS;L.prototype.square=OS;var U=L;U.prototype.IsNegative=function(){return this.compareTo(U.ZERO)==-1};U.op_Equality=function(e,t){return e.compareTo(t)==0};U.op_Inequality=function(e,t){return e.compareTo(t)!=0};U.op_GreaterThan=function(e,t){return e.compareTo(t)>0};U.op_LessThan=function(e,t){return e.compareTo(t)<0};U.op_Addition=function(e,t){return new U(e).add(new U(t))};U.op_Subtraction=function(e,t){return new U(e).subtract(new U(t))};U.Int128Mul=function(e,t){return new U(e).multiply(new U(t))};U.op_Division=function(e,t){return e.divide(t)};U.prototype.ToDouble=function(){return parseFloat(this.toString())};typeof ql>"u"&&(ql=s(function(e,t){var r;if(typeof Object.getOwnPropertyNames>"u"){for(r in t.prototype)(typeof e.prototype[r]>"u"||e.prototype[r]==Object.prototype[r])&&(e.prototype[r]=t.prototype[r]);for(r in t)typeof e[r]>"u"&&(e[r]=t[r]);e.$baseCtor=t}else{for(var i=Object.getOwnPropertyNames(t.prototype),n=0;n<i.length;n++)typeof Object.getOwnPropertyDescriptor(e.prototype,i[n])>"u"&&Object.defineProperty(e.prototype,i[n],Object.getOwnPropertyDescriptor(t.prototype,i[n]));for(r in t)typeof e[r]>"u"&&(e[r]=t[r]);e.$baseCtor=t}},"Inherit"));var ql;p.Path=function(){return[]};p.Paths=function(){return[]};p.DoublePoint=function(){var e=arguments;this.X=0,this.Y=0,e.length==1?(this.X=e[0].X,this.Y=e[0].Y):e.length==2&&(this.X=e[0],this.Y=e[1])};p.DoublePoint0=function(){this.X=0,this.Y=0};p.DoublePoint1=function(e){this.X=e.X,this.Y=e.Y};p.DoublePoint2=function(e,t){this.X=e,this.Y=t};p.PolyNode=function(){this.m_Parent=null,this.m_polygon=new p.Path,this.m_Index=0,this.m_jointype=0,this.m_endtype=0,this.m_Childs=[],this.IsOpen=!1};p.PolyNode.prototype.IsHoleNode=function(){for(var e=!0,t=this.m_Parent;t!==null;)e=!e,t=t.m_Parent;return e};p.PolyNode.prototype.ChildCount=function(){return this.m_Childs.length};p.PolyNode.prototype.Contour=function(){return this.m_polygon};p.PolyNode.prototype.AddChild=function(e){var t=this.m_Childs.length;this.m_Childs.push(e),e.m_Parent=this,e.m_Index=t};p.PolyNode.prototype.GetNext=function(){return this.m_Childs.length>0?this.m_Childs[0]:this.GetNextSiblingUp()};p.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]};p.PolyNode.prototype.Childs=function(){return this.m_Childs};p.PolyNode.prototype.Parent=function(){return this.m_Parent};p.PolyNode.prototype.IsHole=function(){return this.IsHoleNode()};p.PolyTree=function(){this.m_AllPolys=[],p.PolyNode.call(this)};p.PolyTree.prototype.Clear=function(){for(var e=0,t=this.m_AllPolys.length;e<t;e++)this.m_AllPolys[e]=null;this.m_AllPolys.length=0,this.m_Childs.length=0};p.PolyTree.prototype.GetFirst=function(){return this.m_Childs.length>0?this.m_Childs[0]:null};p.PolyTree.prototype.Total=function(){return this.m_AllPolys.length};ql(p.PolyTree,p.PolyNode);p.Math_Abs_Int64=p.Math_Abs_Int32=p.Math_Abs_Double=function(e){return Math.abs(e)};p.Math_Max_Int32_Int32=function(e,t){return Math.max(e,t)};z.msie||z.opera||z.safari?p.Cast_Int32=function(e){return e|0}:p.Cast_Int32=function(e){return~~e};z.chrome?p.Cast_Int64=function(e){return e<-2147483648||e>2147483647?e<0?Math.ceil(e):Math.floor(e):~~e}:z.firefox&&typeof Number.toInteger=="function"?p.Cast_Int64=function(e){return Number.toInteger(e)}:z.msie7||z.msie8?p.Cast_Int64=function(e){return parseInt(e,10)}:z.msie?p.Cast_Int64=function(e){return e<-2147483648||e>2147483647?e<0?Math.ceil(e):Math.floor(e):e|0}:p.Cast_Int64=function(e){return e<0?Math.ceil(e):Math.floor(e)};p.Clear=function(e){e.length=0};p.PI=3.141592653589793;p.PI2=2*3.141592653589793;p.IntPoint=function(){var e=arguments,t=e.length;if(this.X=0,this.Y=0,Ii)if(this.Z=0,t==3)this.X=e[0],this.Y=e[1],this.Z=e[2];else if(t==2)this.X=e[0],this.Y=e[1],this.Z=0;else if(t==1)if(e[0]instanceof p.DoublePoint){var r=e[0];this.X=p.Clipper.Round(r.X),this.Y=p.Clipper.Round(r.Y),this.Z=0}else{var i=e[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=e[0],this.Y=e[1];else if(t==1)if(e[0]instanceof p.DoublePoint){var r=e[0];this.X=p.Clipper.Round(r.X),this.Y=p.Clipper.Round(r.Y)}else{var i=e[0];this.X=i.X,this.Y=i.Y}else this.X=0,this.Y=0};p.IntPoint.op_Equality=function(e,t){return e.X==t.X&&e.Y==t.Y};p.IntPoint.op_Inequality=function(e,t){return e.X!=t.X||e.Y!=t.Y};Ii?(p.IntPoint0=function(){this.X=0,this.Y=0,this.Z=0},p.IntPoint1=function(e){this.X=e.X,this.Y=e.Y,this.Z=e.Z},p.IntPoint1dp=function(e){this.X=p.Clipper.Round(e.X),this.Y=p.Clipper.Round(e.Y),this.Z=0},p.IntPoint2=function(e,t){this.X=e,this.Y=t,this.Z=0},p.IntPoint3=function(e,t,r){this.X=e,this.Y=t,this.Z=r}):(p.IntPoint0=function(){this.X=0,this.Y=0},p.IntPoint1=function(e){this.X=e.X,this.Y=e.Y},p.IntPoint1dp=function(e){this.X=p.Clipper.Round(e.X),this.Y=p.Clipper.Round(e.Y)},p.IntPoint2=function(e,t){this.X=e,this.Y=t});p.IntRect=function(){var e=arguments,t=e.length;t==4?(this.left=e[0],this.top=e[1],this.right=e[2],this.bottom=e[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)};p.IntRect0=function(){this.left=0,this.top=0,this.right=0,this.bottom=0};p.IntRect1=function(e){this.left=e.left,this.top=e.top,this.right=e.right,this.bottom=e.bottom};p.IntRect4=function(e,t,r,i){this.left=e,this.top=t,this.right=r,this.bottom=i};p.ClipType={ctIntersection:0,ctUnion:1,ctDifference:2,ctXor:3};p.PolyType={ptSubject:0,ptClip:1};p.PolyFillType={pftEvenOdd:0,pftNonZero:1,pftPositive:2,pftNegative:3};p.JoinType={jtSquare:0,jtRound:1,jtMiter:2};p.EndType={etOpenSquare:0,etOpenRound:1,etOpenButt:2,etClosedLine:3,etClosedPolygon:4};db&&(p.EndType_={etSquare:0,etRound:1,etButt:2,etClosed:3});p.EdgeSide={esLeft:0,esRight:1};p.Direction={dRightToLeft:0,dLeftToRight:1};p.TEdge=function(){this.Bot=new p.IntPoint,this.Curr=new p.IntPoint,this.Top=new p.IntPoint,this.Delta=new p.IntPoint,this.Dx=0,this.PolyTyp=p.PolyType.ptSubject,this.Side=p.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};p.IntersectNode=function(){this.Edge1=null,this.Edge2=null,this.Pt=new p.IntPoint};p.MyIntersectNodeSort=function(){};p.MyIntersectNodeSort.Compare=function(e,t){return t.Pt.Y-e.Pt.Y};p.LocalMinima=function(){this.Y=0,this.LeftBound=null,this.RightBound=null,this.Next=null};p.Scanbeam=function(){this.Y=0,this.Next=null};p.OutRec=function(){this.Idx=0,this.IsHole=!1,this.IsOpen=!1,this.FirstLeft=null,this.Pts=null,this.BottomPt=null,this.PolyNode=null};p.OutPt=function(){this.Idx=0,this.Pt=new p.IntPoint,this.Next=null,this.Prev=null};p.Join=function(){this.OutPt1=null,this.OutPt2=null,this.OffPt=new p.IntPoint};p.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};p.ClipperBase.horizontal=-9007199254740992;p.ClipperBase.Skip=-2;p.ClipperBase.Unassigned=-1;p.ClipperBase.tolerance=1e-20;hx?(p.ClipperBase.loRange=46340,p.ClipperBase.hiRange=46340):(p.ClipperBase.loRange=47453132,p.ClipperBase.hiRange=0xfffffffffffff);p.ClipperBase.near_zero=function(e){return e>-p.ClipperBase.tolerance&&e<p.ClipperBase.tolerance};p.ClipperBase.IsHorizontal=function(e){return e.Delta.Y===0};p.ClipperBase.prototype.PointIsVertex=function(e,t){var r=t;do{if(p.IntPoint.op_Equality(r.Pt,e))return!0;r=r.Next}while(r!=t);return!1};p.ClipperBase.prototype.PointOnLineSegment=function(e,t,r,i){return i?e.X==t.X&&e.Y==t.Y||e.X==r.X&&e.Y==r.Y||e.X>t.X==e.X<r.X&&e.Y>t.Y==e.Y<r.Y&&U.op_Equality(U.Int128Mul(e.X-t.X,r.Y-t.Y),U.Int128Mul(r.X-t.X,e.Y-t.Y)):e.X==t.X&&e.Y==t.Y||e.X==r.X&&e.Y==r.Y||e.X>t.X==e.X<r.X&&e.Y>t.Y==e.Y<r.Y&&(e.X-t.X)*(r.Y-t.Y)==(r.X-t.X)*(e.Y-t.Y)};p.ClipperBase.prototype.PointOnPolygon=function(e,t,r){for(var i=t;;){if(this.PointOnLineSegment(e,i.Pt,i.Next.Pt,r))return!0;if(i=i.Next,i==t)break}return!1};p.ClipperBase.prototype.SlopesEqual=p.ClipperBase.SlopesEqual=function(){var e=arguments,t=e.length,r,i,n,o,a,l,c;return t==3?(r=e[0],i=e[1],c=e[2],c?U.op_Equality(U.Int128Mul(r.Delta.Y,i.Delta.X),U.Int128Mul(r.Delta.X,i.Delta.Y)):p.Cast_Int64(r.Delta.Y*i.Delta.X)==p.Cast_Int64(r.Delta.X*i.Delta.Y)):t==4?(n=e[0],o=e[1],a=e[2],c=e[3],c?U.op_Equality(U.Int128Mul(n.Y-o.Y,o.X-a.X),U.Int128Mul(n.X-o.X,o.Y-a.Y)):p.Cast_Int64((n.Y-o.Y)*(o.X-a.X))-p.Cast_Int64((n.X-o.X)*(o.Y-a.Y))===0):(n=e[0],o=e[1],a=e[2],l=e[3],c=e[4],c?U.op_Equality(U.Int128Mul(n.Y-o.Y,a.X-l.X),U.Int128Mul(n.X-o.X,a.Y-l.Y)):p.Cast_Int64((n.Y-o.Y)*(a.X-l.X))-p.Cast_Int64((n.X-o.X)*(a.Y-l.Y))===0)};p.ClipperBase.SlopesEqual3=function(e,t,r){return r?U.op_Equality(U.Int128Mul(e.Delta.Y,t.Delta.X),U.Int128Mul(e.Delta.X,t.Delta.Y)):p.Cast_Int64(e.Delta.Y*t.Delta.X)==p.Cast_Int64(e.Delta.X*t.Delta.Y)};p.ClipperBase.SlopesEqual4=function(e,t,r,i){return i?U.op_Equality(U.Int128Mul(e.Y-t.Y,t.X-r.X),U.Int128Mul(e.X-t.X,t.Y-r.Y)):p.Cast_Int64((e.Y-t.Y)*(t.X-r.X))-p.Cast_Int64((e.X-t.X)*(t.Y-r.Y))===0};p.ClipperBase.SlopesEqual5=function(e,t,r,i,n){return n?U.op_Equality(U.Int128Mul(e.Y-t.Y,r.X-i.X),U.Int128Mul(e.X-t.X,r.Y-i.Y)):p.Cast_Int64((e.Y-t.Y)*(r.X-i.X))-p.Cast_Int64((e.X-t.X)*(r.Y-i.Y))===0};p.ClipperBase.prototype.Clear=function(){this.DisposeLocalMinimaList();for(var e=0,t=this.m_edges.length;e<t;++e){for(var r=0,i=this.m_edges[e].length;r<i;++r)this.m_edges[e][r]=null;p.Clear(this.m_edges[e])}p.Clear(this.m_edges),this.m_UseFullRange=!1,this.m_HasOpenPaths=!1};p.ClipperBase.prototype.DisposeLocalMinimaList=function(){for(;this.m_MinimaList!==null;){var e=this.m_MinimaList.Next;this.m_MinimaList=null,this.m_MinimaList=e}this.m_CurrentLM=null};p.ClipperBase.prototype.RangeTest=function(e,t){t.Value?(e.X>p.ClipperBase.hiRange||e.Y>p.ClipperBase.hiRange||-e.X>p.ClipperBase.hiRange||-e.Y>p.ClipperBase.hiRange)&&p.Error("Coordinate outside allowed range in RangeTest()."):(e.X>p.ClipperBase.loRange||e.Y>p.ClipperBase.loRange||-e.X>p.ClipperBase.loRange||-e.Y>p.ClipperBase.loRange)&&(t.Value=!0,this.RangeTest(e,t))};p.ClipperBase.prototype.InitEdge=function(e,t,r,i){e.Next=t,e.Prev=r,e.Curr.X=i.X,e.Curr.Y=i.Y,e.OutIdx=-1};p.ClipperBase.prototype.InitEdge2=function(e,t){e.Curr.Y>=e.Next.Curr.Y?(e.Bot.X=e.Curr.X,e.Bot.Y=e.Curr.Y,e.Top.X=e.Next.Curr.X,e.Top.Y=e.Next.Curr.Y):(e.Top.X=e.Curr.X,e.Top.Y=e.Curr.Y,e.Bot.X=e.Next.Curr.X,e.Bot.Y=e.Next.Curr.Y),this.SetDx(e),e.PolyTyp=t};p.ClipperBase.prototype.FindNextLocMin=function(e){for(var t;;){for(;p.IntPoint.op_Inequality(e.Bot,e.Prev.Bot)||p.IntPoint.op_Equality(e.Curr,e.Top);)e=e.Next;if(e.Dx!=p.ClipperBase.horizontal&&e.Prev.Dx!=p.ClipperBase.horizontal)break;for(;e.Prev.Dx==p.ClipperBase.horizontal;)e=e.Prev;for(t=e;e.Dx==p.ClipperBase.horizontal;)e=e.Next;if(e.Top.Y!=e.Prev.Bot.Y){t.Prev.Bot.X<e.Bot.X&&(e=t);break}}return e};p.ClipperBase.prototype.ProcessBound=function(e,t){var r=e,i=e,n,o;if(e.Dx==p.ClipperBase.horizontal&&(t?o=e.Prev.Bot.X:o=e.Next.Bot.X,e.Bot.X!=o&&this.ReverseHorizontal(e)),i.OutIdx!=p.ClipperBase.Skip)if(t){for(;i.Top.Y==i.Next.Bot.Y&&i.Next.OutIdx!=p.ClipperBase.Skip;)i=i.Next;if(i.Dx==p.ClipperBase.horizontal&&i.Next.OutIdx!=p.ClipperBase.Skip){for(n=i;n.Prev.Dx==p.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(;e!=i;)e.NextInLML=e.Next,e.Dx==p.ClipperBase.horizontal&&e!=r&&e.Bot.X!=e.Prev.Top.X&&this.ReverseHorizontal(e),e=e.Next;e.Dx==p.ClipperBase.horizontal&&e!=r&&e.Bot.X!=e.Prev.Top.X&&this.ReverseHorizontal(e),i=i.Next}else{for(;i.Top.Y==i.Prev.Bot.Y&&i.Prev.OutIdx!=p.ClipperBase.Skip;)i=i.Prev;if(i.Dx==p.ClipperBase.horizontal&&i.Prev.OutIdx!=p.ClipperBase.Skip){for(n=i;n.Next.Dx==p.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(;e!=i;)e.NextInLML=e.Prev,e.Dx==p.ClipperBase.horizontal&&e!=r&&e.Bot.X!=e.Next.Top.X&&this.ReverseHorizontal(e),e=e.Prev;e.Dx==p.ClipperBase.horizontal&&e!=r&&e.Bot.X!=e.Next.Top.X&&this.ReverseHorizontal(e),i=i.Prev}if(i.OutIdx==p.ClipperBase.Skip){if(e=i,t){for(;e.Top.Y==e.Next.Bot.Y;)e=e.Next;for(;e!=i&&e.Dx==p.ClipperBase.horizontal;)e=e.Prev}else{for(;e.Top.Y==e.Prev.Bot.Y;)e=e.Prev;for(;e!=i&&e.Dx==p.ClipperBase.horizontal;)e=e.Next}if(e==i)t?i=e.Next:i=e.Prev;else{t?e=i.Next:e=i.Prev;var a=new p.LocalMinima;a.Next=null,a.Y=e.Bot.Y,a.LeftBound=null,a.RightBound=e,a.RightBound.WindDelta=0,i=this.ProcessBound(a.RightBound,t),this.InsertLocalMinima(a)}}return i};p.ClipperBase.prototype.AddPath=function(e,t,r){fb?!r&&t==p.PolyType.ptClip&&p.Error("AddPath: Open paths must be subject."):r||p.Error("AddPath: Open paths have been disabled.");var i=e.length-1;if(r)for(;i>0&&p.IntPoint.op_Equality(e[i],e[0]);)--i;for(;i>0&&p.IntPoint.op_Equality(e[i],e[i-1]);)--i;if(r&&i<2||!r&&i<1)return!1;for(var n=new Array,o=0;o<=i;o++)n.push(new p.TEdge);var a=!0;n[1].Curr.X=e[1].X,n[1].Curr.Y=e[1].Y;var l={Value:this.m_UseFullRange};this.RangeTest(e[0],l),this.m_UseFullRange=l.Value,l.Value=this.m_UseFullRange,this.RangeTest(e[i],l),this.m_UseFullRange=l.Value,this.InitEdge(n[0],n[1],n[i],e[0]),this.InitEdge(n[i],n[0],n[i-1],e[i]);for(var o=i-1;o>=1;--o)l.Value=this.m_UseFullRange,this.RangeTest(e[o],l),this.m_UseFullRange=l.Value,this.InitEdge(n[o],n[o+1],n[o-1],e[o]);for(var c=n[0],h=c,d=c;;){if(p.IntPoint.op_Equality(h.Curr,h.Next.Curr)){if(h==h.Next)break;h==c&&(c=h.Next),h=this.RemoveEdge(h),d=h;continue}if(h.Prev==h.Next)break;if(r&&p.ClipperBase.SlopesEqual(h.Prev.Curr,h.Curr,h.Next.Curr,this.m_UseFullRange)&&(!this.PreserveCollinear||!this.Pt2IsBetweenPt1AndPt3(h.Prev.Curr,h.Curr,h.Next.Curr))){h==c&&(c=h.Next),h=this.RemoveEdge(h),h=h.Prev,d=h;continue}if(h=h.Next,h==d)break}if(!r&&h==h.Next||r&&h.Prev==h.Next)return!1;r||(this.m_HasOpenPaths=!0,c.Prev.OutIdx=p.ClipperBase.Skip);var m=c;h=c;do this.InitEdge2(h,t),h=h.Next,a&&h.Curr.Y!=c.Curr.Y&&(a=!1);while(h!=c);if(a){if(r)return!1;h.Prev.OutIdx=p.ClipperBase.Skip,h.Prev.Bot.X<h.Prev.Top.X&&this.ReverseHorizontal(h.Prev);var y=new p.LocalMinima;for(y.Next=null,y.Y=h.Bot.Y,y.LeftBound=null,y.RightBound=h,y.RightBound.Side=p.EdgeSide.esRight,y.RightBound.WindDelta=0;h.Next.OutIdx!=p.ClipperBase.Skip;)h.NextInLML=h.Next,h.Bot.X!=h.Prev.Top.X&&this.ReverseHorizontal(h),h=h.Next;return this.InsertLocalMinima(y),this.m_edges.push(n),!0}this.m_edges.push(n);for(var x,S=null;h=this.FindNextLocMin(h),h!=S;){S==null&&(S=h);var y=new p.LocalMinima;y.Next=null,y.Y=h.Bot.Y,h.Dx<h.Prev.Dx?(y.LeftBound=h.Prev,y.RightBound=h,x=!1):(y.LeftBound=h,y.RightBound=h.Prev,x=!0),y.LeftBound.Side=p.EdgeSide.esLeft,y.RightBound.Side=p.EdgeSide.esRight,r?y.LeftBound.Next==y.RightBound?y.LeftBound.WindDelta=-1:y.LeftBound.WindDelta=1:y.LeftBound.WindDelta=0,y.RightBound.WindDelta=-y.LeftBound.WindDelta,h=this.ProcessBound(y.LeftBound,x);var P=this.ProcessBound(y.RightBound,!x);y.LeftBound.OutIdx==p.ClipperBase.Skip?y.LeftBound=null:y.RightBound.OutIdx==p.ClipperBase.Skip&&(y.RightBound=null),this.InsertLocalMinima(y),x||(h=P)}return!0};p.ClipperBase.prototype.AddPaths=function(e,t,r){for(var i=!1,n=0,o=e.length;n<o;++n)this.AddPath(e[n],t,r)&&(i=!0);return i};p.ClipperBase.prototype.Pt2IsBetweenPt1AndPt3=function(e,t,r){return p.IntPoint.op_Equality(e,r)||p.IntPoint.op_Equality(e,t)||p.IntPoint.op_Equality(r,t)?!1:e.X!=r.X?t.X>e.X==t.X<r.X:t.Y>e.Y==t.Y<r.Y};p.ClipperBase.prototype.RemoveEdge=function(e){e.Prev.Next=e.Next,e.Next.Prev=e.Prev;var t=e.Next;return e.Prev=null,t};p.ClipperBase.prototype.SetDx=function(e){e.Delta.X=e.Top.X-e.Bot.X,e.Delta.Y=e.Top.Y-e.Bot.Y,e.Delta.Y===0?e.Dx=p.ClipperBase.horizontal:e.Dx=e.Delta.X/e.Delta.Y};p.ClipperBase.prototype.InsertLocalMinima=function(e){if(this.m_MinimaList===null)this.m_MinimaList=e;else if(e.Y>=this.m_MinimaList.Y)e.Next=this.m_MinimaList,this.m_MinimaList=e;else{for(var t=this.m_MinimaList;t.Next!==null&&e.Y<t.Next.Y;)t=t.Next;e.Next=t.Next,t.Next=e}};p.ClipperBase.prototype.PopLocalMinima=function(){this.m_CurrentLM!==null&&(this.m_CurrentLM=this.m_CurrentLM.Next)};p.ClipperBase.prototype.ReverseHorizontal=function(e){var t=e.Top.X;e.Top.X=e.Bot.X,e.Bot.X=t,Ii&&(t=e.Top.Z,e.Top.Z=e.Bot.Z,e.Bot.Z=t)};p.ClipperBase.prototype.Reset=function(){if(this.m_CurrentLM=this.m_MinimaList,this.m_CurrentLM!=null)for(var e=this.m_MinimaList;e!=null;){var t=e.LeftBound;t!=null&&(t.Curr.X=t.Bot.X,t.Curr.Y=t.Bot.Y,t.Side=p.EdgeSide.esLeft,t.OutIdx=p.ClipperBase.Unassigned),t=e.RightBound,t!=null&&(t.Curr.X=t.Bot.X,t.Curr.Y=t.Bot.Y,t.Side=p.EdgeSide.esRight,t.OutIdx=p.ClipperBase.Unassigned),e=e.Next}};p.Clipper=function(e){typeof e>"u"&&(e=0),this.m_PolyOuts=null,this.m_ClipType=p.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=p.PolyFillType.pftEvenOdd,this.m_SubjFillType=p.PolyFillType.pftEvenOdd,this.m_Joins=null,this.m_GhostJoins=null,this.m_UsingPolyTree=!1,this.ReverseSolution=!1,this.StrictlySimple=!1,p.ClipperBase.call(this),this.m_Scanbeam=null,this.m_ActiveEdges=null,this.m_SortedEdges=null,this.m_IntersectList=new Array,this.m_IntersectNodeComparer=p.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&e)!==0,this.StrictlySimple=(2&e)!==0,this.PreserveCollinear=(4&e)!==0,Ii&&(this.ZFillFunction=null)};p.Clipper.ioReverseSolution=1;p.Clipper.ioStrictlySimple=2;p.Clipper.ioPreserveCollinear=4;p.Clipper.prototype.Clear=function(){this.m_edges.length!==0&&(this.DisposeAllPolyPts(),p.ClipperBase.prototype.Clear.call(this))};p.Clipper.prototype.DisposeScanbeamList=function(){for(;this.m_Scanbeam!==null;){var e=this.m_Scanbeam.Next;this.m_Scanbeam=null,this.m_Scanbeam=e}};p.Clipper.prototype.Reset=function(){p.ClipperBase.prototype.Reset.call(this),this.m_Scanbeam=null,this.m_ActiveEdges=null,this.m_SortedEdges=null;for(var e=this.m_MinimaList;e!==null;)this.InsertScanbeam(e.Y),e=e.Next};p.Clipper.prototype.InsertScanbeam=function(e){if(this.m_Scanbeam===null)this.m_Scanbeam=new p.Scanbeam,this.m_Scanbeam.Next=null,this.m_Scanbeam.Y=e;else if(e>this.m_Scanbeam.Y){var t=new p.Scanbeam;t.Y=e,t.Next=this.m_Scanbeam,this.m_Scanbeam=t}else{for(var r=this.m_Scanbeam;r.Next!==null&&e<=r.Next.Y;)r=r.Next;if(e==r.Y)return;var t=new p.Scanbeam;t.Y=e,t.Next=r.Next,r.Next=t}};p.Clipper.prototype.Execute=function(){var e=arguments,t=e.length,r=e[1]instanceof p.PolyTree;if(t==4&&!r){var i=e[0],n=e[1],o=e[2],a=e[3];if(this.m_ExecuteLocked)return!1;this.m_HasOpenPaths&&p.Error("Error: PolyTree struct is need for open path clipping."),this.m_ExecuteLocked=!0,p.Clear(n),this.m_SubjFillType=o,this.m_ClipFillType=a,this.m_ClipType=i,this.m_UsingPolyTree=!1;try{var l=this.ExecuteInternal();l&&this.BuildResult(n)}finally{this.DisposeAllPolyPts(),this.m_ExecuteLocked=!1}return l}else if(t==4&&r){var i=e[0],c=e[1],o=e[2],a=e[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 l=this.ExecuteInternal();l&&this.BuildResult2(c)}finally{this.DisposeAllPolyPts(),this.m_ExecuteLocked=!1}return l}else if(t==2&&!r){var i=e[0],n=e[1];return this.Execute(i,n,p.PolyFillType.pftEvenOdd,p.PolyFillType.pftEvenOdd)}else if(t==2&&r){var i=e[0],c=e[1];return this.Execute(i,c,p.PolyFillType.pftEvenOdd,p.PolyFillType.pftEvenOdd)}};p.Clipper.prototype.FixHoleLinkage=function(e){if(!(e.FirstLeft===null||e.IsHole!=e.FirstLeft.IsHole&&e.FirstLeft.Pts!==null)){for(var t=e.FirstLeft;t!==null&&(t.IsHole==e.IsHole||t.Pts===null);)t=t.FirstLeft;e.FirstLeft=t}};p.Clipper.prototype.ExecuteInternal=function(){try{if(this.Reset(),this.m_CurrentLM===null)return!1;var e=this.PopScanbeam();do{if(this.InsertLocalMinimaIntoAEL(e),p.Clear(this.m_GhostJoins),this.ProcessHorizontals(!1),this.m_Scanbeam===null)break;var t=this.PopScanbeam();if(!this.ProcessIntersections(e,t))return!1;this.ProcessEdgesAtTopOfScanbeam(t),e=t}while(this.m_Scanbeam!==null||this.m_CurrentLM!==null);for(var r=0,i=this.m_PolyOuts.length;r<i;r++){var n=this.m_PolyOuts[r];n.Pts===null||n.IsOpen||(n.IsHole^this.ReverseSolution)==this.Area(n)>0&&this.ReversePolyPtLinks(n.Pts)}this.JoinCommonEdges();for(var r=0,i=this.m_PolyOuts.length;r<i;r++){var n=this.m_PolyOuts[r];n.Pts!==null&&!n.IsOpen&&this.FixupOutPolygon(n)}return this.StrictlySimple&&this.DoSimplePolygons(),!0}finally{p.Clear(this.m_Joins),p.Clear(this.m_GhostJoins)}};p.Clipper.prototype.PopScanbeam=function(){var e=this.m_Scanbeam.Y,t=this.m_Scanbeam;return this.m_Scanbeam=this.m_Scanbeam.Next,t=null,e};p.Clipper.prototype.DisposeAllPolyPts=function(){for(var e=0,t=this.m_PolyOuts.length;e<t;++e)this.DisposeOutRec(e);p.Clear(this.m_PolyOuts)};p.Clipper.prototype.DisposeOutRec=function(e){var t=this.m_PolyOuts[e];t.Pts!==null&&this.DisposeOutPts(t.Pts),t=null,this.m_PolyOuts[e]=null};p.Clipper.prototype.DisposeOutPts=function(e){if(e!==null){var t=null;for(e.Prev.Next=null;e!==null;)t=e,e=e.Next,t=null}};p.Clipper.prototype.AddJoin=function(e,t,r){var i=new p.Join;i.OutPt1=e,i.OutPt2=t,i.OffPt.X=r.X,i.OffPt.Y=r.Y,this.m_Joins.push(i)};p.Clipper.prototype.AddGhostJoin=function(e,t){var r=new p.Join;r.OutPt1=e,r.OffPt.X=t.X,r.OffPt.Y=t.Y,this.m_GhostJoins.push(r)};Ii&&(p.Clipper.prototype.SetZ=function(e,t){e.Z=0,this.ZFillFunction!==null&&(t.OutIdx<0?this.ZFillFunction(t.Bot,t.Top,e):this.ZFillFunction(t.Top,t.Bot,e))});p.Clipper.prototype.InsertLocalMinimaIntoAEL=function(e){for(;this.m_CurrentLM!==null&&this.m_CurrentLM.Y==e;){var t=this.m_CurrentLM.LeftBound,r=this.m_CurrentLM.RightBound;this.PopLocalMinima();var i=null;if(t===null?(this.InsertEdgeIntoAEL(r,null),this.SetWindingCount(r),this.IsContributing(r)&&(i=this.AddOutPt(r,r.Bot))):r==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(r,t),this.SetWindingCount(t),r.WindCnt=t.WindCnt,r.WindCnt2=t.WindCnt2,this.IsContributing(t)&&(i=this.AddLocalMinPoly(t,r,t.Bot)),this.InsertScanbeam(t.Top.Y)),r!=null&&(p.ClipperBase.IsHorizontal(r)?this.AddEdgeToSEL(r):this.InsertScanbeam(r.Top.Y)),!(t==null||r==null)){if(i!==null&&p.ClipperBase.IsHorizontal(r)&&this.m_GhostJoins.length>0&&r.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,r.Bot,r.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&&p.ClipperBase.SlopesEqual(t.PrevInAEL,t,this.m_UseFullRange)&&t.WindDelta!==0&&t.PrevInAEL.WindDelta!==0){var l=this.AddOutPt(t.PrevInAEL,t.Bot);this.AddJoin(i,l,t.Top)}if(t.NextInAEL!=r){if(r.OutIdx>=0&&r.PrevInAEL.OutIdx>=0&&p.ClipperBase.SlopesEqual(r.PrevInAEL,r,this.m_UseFullRange)&&r.WindDelta!==0&&r.PrevInAEL.WindDelta!==0){var l=this.AddOutPt(r.PrevInAEL,r.Bot);this.AddJoin(i,l,r.Top)}var c=t.NextInAEL;if(c!==null)for(;c!=r;)this.IntersectEdges(r,c,t.Curr,!1),c=c.NextInAEL}}}};p.Clipper.prototype.InsertEdgeIntoAEL=function(e,t){if(this.m_ActiveEdges===null)e.PrevInAEL=null,e.NextInAEL=null,this.m_ActiveEdges=e;else if(t===null&&this.E2InsertsBeforeE1(this.m_ActiveEdges,e))e.PrevInAEL=null,e.NextInAEL=this.m_ActiveEdges,this.m_ActiveEdges.PrevInAEL=e,this.m_ActiveEdges=e;else{for(t===null&&(t=this.m_ActiveEdges);t.NextInAEL!==null&&!this.E2InsertsBeforeE1(t.NextInAEL,e);)t=t.NextInAEL;e.NextInAEL=t.NextInAEL,t.NextInAEL!==null&&(t.NextInAEL.PrevInAEL=e),e.PrevInAEL=t,t.NextInAEL=e}};p.Clipper.prototype.E2InsertsBeforeE1=function(e,t){return t.Curr.X==e.Curr.X?t.Top.Y>e.Top.Y?t.Top.X<p.Clipper.TopX(e,t.Top.Y):e.Top.X>p.Clipper.TopX(t,e.Top.Y):t.Curr.X<e.Curr.X};p.Clipper.prototype.IsEvenOddFillType=function(e){return e.PolyTyp==p.PolyType.ptSubject?this.m_SubjFillType==p.PolyFillType.pftEvenOdd:this.m_ClipFillType==p.PolyFillType.pftEvenOdd};p.Clipper.prototype.IsEvenOddAltFillType=function(e){return e.PolyTyp==p.PolyType.ptSubject?this.m_ClipFillType==p.PolyFillType.pftEvenOdd:this.m_SubjFillType==p.PolyFillType.pftEvenOdd};p.Clipper.prototype.IsContributing=function(e){var t,r;switch(e.PolyTyp==p.PolyType.ptSubject?(t=this.m_SubjFillType,r=this.m_ClipFillType):(t=this.m_ClipFillType,r=this.m_SubjFillType),t){case p.PolyFillType.pftEvenOdd:if(e.WindDelta===0&&e.WindCnt!=1)return!1;break;case p.PolyFillType.pftNonZero:if(Math.abs(e.WindCnt)!=1)return!1;break;case p.PolyFillType.pftPositive:if(e.WindCnt!=1)return!1;break;default:if(e.WindCnt!=-1)return!1;break}switch(this.m_ClipType){case p.ClipType.ctIntersection:switch(r){case p.PolyFillType.pftEvenOdd:case p.PolyFillType.pftNonZero:return e.WindCnt2!==0;case p.PolyFillType.pftPositive:return e.WindCnt2>0;default:return e.WindCnt2<0}case p.ClipType.ctUnion:switch(r){case p.PolyFillType.pftEvenOdd:case p.PolyFillType.pftNonZero:return e.WindCnt2===0;case p.PolyFillType.pftPositive:return e.WindCnt2<=0;default:return e.WindCnt2>=0}case p.ClipType.ctDifference:if(e.PolyTyp==p.PolyType.ptSubject)switch(r){case p.PolyFillType.pftEvenOdd:case p.PolyFillType.pftNonZero:return e.WindCnt2===0;case p.PolyFillType.pftPositive:return e.WindCnt2<=0;default:return e.WindCnt2>=0}else switch(r){case p.PolyFillType.pftEvenOdd:case p.PolyFillType.pftNonZero:return e.WindCnt2!==0;case p.PolyFillType.pftPositive:return e.WindCnt2>0;default:return e.WindCnt2<0}case p.ClipType.ctXor:if(e.WindDelta===0)switch(r){case p.PolyFillType.pftEvenOdd:case p.PolyFillType.pftNonZero:return e.WindCnt2===0;case p.PolyFillType.pftPositive:return e.WindCnt2<=0;default:return e.WindCnt2>=0}else return!0}return!0};p.Clipper.prototype.SetWindingCount=function(e){for(var t=e.PrevInAEL;t!==null&&(t.PolyTyp!=e.PolyTyp||t.WindDelta===0);)t=t.PrevInAEL;if(t===null)e.WindCnt=e.WindDelta===0?1:e.WindDelta,e.WindCnt2=0,t=this.m_ActiveEdges;else if(e.WindDelta===0&&this.m_ClipType!=p.ClipType.ctUnion)e.WindCnt=1,e.WindCnt2=t.WindCnt2,t=t.NextInAEL;else if(this.IsEvenOddFillType(e)){if(e.WindDelta===0){for(var r=!0,i=t.PrevInAEL;i!==null;)i.PolyTyp==t.PolyTyp&&i.WindDelta!==0&&(r=!r),i=i.PrevInAEL;e.WindCnt=r?0:1}else e.WindCnt=e.WindDelta;e.WindCnt2=t.WindCnt2,t=t.NextInAEL}else t.WindCnt*t.WindDelta<0?Math.abs(t.WindCnt)>1?t.WindDelta*e.WindDelta<0?e.WindCnt=t.WindCnt:e.WindCnt=t.WindCnt+e.WindDelta:e.WindCnt=e.WindDelta===0?1:e.WindDelta:e.WindDelta===0?e.WindCnt=t.WindCnt<0?t.WindCnt-1:t.WindCnt+1:t.WindDelta*e.WindDelta<0?e.WindCnt=t.WindCnt:e.WindCnt=t.WindCnt+e.WindDelta,e.WindCnt2=t.WindCnt2,t=t.NextInAEL;if(this.IsEvenOddAltFillType(e))for(;t!=e;)t.WindDelta!==0&&(e.WindCnt2=e.WindCnt2===0?1:0),t=t.NextInAEL;else for(;t!=e;)e.WindCnt2+=t.WindDelta,t=t.NextInAEL};p.Clipper.prototype.AddEdgeToSEL=function(e){this.m_SortedEdges===null?(this.m_SortedEdges=e,e.PrevInSEL=null,e.NextInSEL=null):(e.NextInSEL=this.m_SortedEdges,e.PrevInSEL=null,this.m_SortedEdges.PrevInSEL=e,this.m_SortedEdges=e)};p.Clipper.prototype.CopyAELToSEL=function(){var e=this.m_ActiveEdges;for(this.m_SortedEdges=e;e!==null;)e.PrevInSEL=e.PrevInAEL,e.NextInSEL=e.NextInAEL,e=e.NextInAEL};p.Clipper.prototype.SwapPositionsInAEL=function(e,t){if(!(e.NextInAEL==e.PrevInAEL||t.NextInAEL==t.PrevInAEL)){if(e.NextInAEL==t){var r=t.NextInAEL;r!==null&&(r.PrevInAEL=e);var i=e.PrevInAEL;i!==null&&(i.NextInAEL=t),t.PrevInAEL=i,t.NextInAEL=e,e.PrevInAEL=t,e.NextInAEL=r}else if(t.NextInAEL==e){var r=e.NextInAEL;r!==null&&(r.PrevInAEL=t);var i=t.PrevInAEL;i!==null&&(i.NextInAEL=e),e.PrevInAEL=i,e.NextInAEL=t,t.PrevInAEL=e,t.NextInAEL=r}else{var r=e.NextInAEL,i=e.PrevInAEL;e.NextInAEL=t.NextInAEL,e.NextInAEL!==null&&(e.NextInAEL.PrevInAEL=e),e.PrevInAEL=t.PrevInAEL,e.PrevInAEL!==null&&(e.PrevInAEL.NextInAEL=e),t.NextInAEL=r,t.NextInAEL!==null&&(t.NextInAEL.PrevInAEL=t),t.PrevInAEL=i,t.PrevInAEL!==null&&(t.PrevInAEL.NextInAEL=t)}e.PrevInAEL===null?this.m_ActiveEdges=e:t.PrevInAEL===null&&(this.m_ActiveEdges=t)}};p.Clipper.prototype.SwapPositionsInSEL=function(e,t){if(!(e.NextInSEL===null&&e.PrevInSEL===null)&&!(t.NextInSEL===null&&t.PrevInSEL===null)){if(e.NextInSEL==t){var r=t.NextInSEL;r!==null&&(r.PrevInSEL=e);var i=e.PrevInSEL;i!==null&&(i.NextInSEL=t),t.PrevInSEL=i,t.NextInSEL=e,e.PrevInSEL=t,e.NextInSEL=r}else if(t.NextInSEL==e){var r=e.NextInSEL;r!==null&&(r.PrevInSEL=t);var i=t.PrevInSEL;i!==null&&(i.NextInSEL=e),e.PrevInSEL=i,e.NextInSEL=t,t.PrevInSEL=e,t.NextInSEL=r}else{var r=e.NextInSEL,i=e.PrevInSEL;e.NextInSEL=t.NextInSEL,e.NextInSEL!==null&&(e.NextInSEL.PrevInSEL=e),e.PrevInSEL=t.PrevInSEL,e.PrevInSEL!==null&&(e.PrevInSEL.NextInSEL=e),t.NextInSEL=r,t.NextInSEL!==null&&(t.NextInSEL.PrevInSEL=t),t.PrevInSEL=i,t.PrevInSEL!==null&&(t.PrevInSEL.NextInSEL=t)}e.PrevInSEL===null?this.m_SortedEdges=e:t.PrevInSEL===null&&(this.m_SortedEdges=t)}};p.Clipper.prototype.AddLocalMaxPoly=function(e,t,r){this.AddOutPt(e,r),t.WindDelta==0&&this.AddOutPt(t,r),e.OutIdx==t.OutIdx?(e.OutIdx=-1,t.OutIdx=-1):e.OutIdx<t.OutIdx?this.AppendPolygon(e,t):this.AppendPolygon(t,e)};p.Clipper.prototype.AddLocalMinPoly=function(e,t,r){var i,n,o;if(p.ClipperBase.IsHorizontal(t)||e.Dx>t.Dx?(i=this.AddOutPt(e,r),t.OutIdx=e.OutIdx,e.Side=p.EdgeSide.esLeft,t.Side=p.EdgeSide.esRight,n=e,n.PrevInAEL==t?o=t.PrevInAEL:o=n.PrevInAEL):(i=this.AddOutPt(t,r),e.OutIdx=t.OutIdx,e.Side=p.EdgeSide.esRight,t.Side=p.EdgeSide.esLeft,n=t,n.PrevInAEL==e?o=e.PrevInAEL:o=n.PrevInAEL),o!==null&&o.OutIdx>=0&&p.Clipper.TopX(o,r.Y)==p.Clipper.TopX(n,r.Y)&&p.ClipperBase.SlopesEqual(n,o,this.m_UseFullRange)&&n.WindDelta!==0&&o.WindDelta!==0){var a=this.AddOutPt(o,r);this.AddJoin(i,a,n.Top)}return i};p.Clipper.prototype.CreateOutRec=function(){var e=new p.OutRec;return e.Idx=-1,e.IsHole=!1,e.IsOpen=!1,e.FirstLeft=null,e.Pts=null,e.BottomPt=null,e.PolyNode=null,this.m_PolyOuts.push(e),e.Idx=this.m_PolyOuts.length-1,e};p.Clipper.prototype.AddOutPt=function(e,t){var r=e.Side==p.EdgeSide.esLeft;if(e.OutIdx<0){var i=this.CreateOutRec();i.IsOpen=e.WindDelta===0;var n=new p.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(e,i),Ii&&(p.IntPoint.op_Equality(t,e.Bot)?(n.Pt.X=e.Bot.X,n.Pt.Y=e.Bot.Y,n.Pt.Z=e.Bot.Z):p.IntPoint.op_Equality(t,e.Top)?(n.Pt.X=e.Top.X,n.Pt.Y=e.Top.Y,n.Pt.Z=e.Top.Z):this.SetZ(n.Pt,e)),e.OutIdx=i.Idx,n}else{var i=this.m_PolyOuts[e.OutIdx],o=i.Pts;if(r&&p.IntPoint.op_Equality(t,o.Pt))return o;if(!r&&p.IntPoint.op_Equality(t,o.Prev.Pt))return o.Prev;var n=new p.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,r&&(i.Pts=n),Ii&&(p.IntPoint.op_Equality(t,e.Bot)?(n.Pt.X=e.Bot.X,n.Pt.Y=e.Bot.Y,n.Pt.Z=e.Bot.Z):p.IntPoint.op_Equality(t,e.Top)?(n.Pt.X=e.Top.X,n.Pt.Y=e.Top.Y,n.Pt.Z=e.Top.Z):this.SetZ(n.Pt,e)),n}};p.Clipper.prototype.SwapPoints=function(e,t){var r=new p.IntPoint(e.Value);e.Value.X=t.Value.X,e.Value.Y=t.Value.Y,t.Value.X=r.X,t.Value.Y=r.Y};p.Clipper.prototype.HorzSegmentsOverlap=function(e,t,r,i){return e.X>r.X==e.X<i.X||t.X>r.X==t.X<i.X||r.X>e.X==r.X<t.X||i.X>e.X==i.X<t.X||e.X==r.X&&t.X==i.X?!0:e.X==i.X&&t.X==r.X};p.Clipper.prototype.InsertPolyPtBetween=function(e,t,r){var i=new p.OutPt;return i.Pt.X=r.X,i.Pt.Y=r.Y,t==e.Next?(e.Next=i,t.Prev=i,i.Next=t,i.Prev=e):(t.Next=i,e.Prev=i,i.Next=e,i.Prev=t),i};p.Clipper.prototype.SetHoleState=function(e,t){for(var r=!1,i=e.PrevInAEL;i!==null;)i.OutIdx>=0&&i.WindDelta!=0&&(r=!r,t.FirstLeft===null&&(t.FirstLeft=this.m_PolyOuts[i.OutIdx])),i=i.PrevInAEL;r&&(t.IsHole=!0)};p.Clipper.prototype.GetDx=function(e,t){return e.Y==t.Y?p.ClipperBase.horizontal:(t.X-e.X)/(t.Y-e.Y)};p.Clipper.prototype.FirstIsBottomPt=function(e,t){for(var r=e.Prev;p.IntPoint.op_Equality(r.Pt,e.Pt)&&r!=e;)r=r.Prev;var i=Math.abs(this.GetDx(e.Pt,r.Pt));for(r=e.Next;p.IntPoint.op_Equality(r.Pt,e.Pt)&&r!=e;)r=r.Next;var n=Math.abs(this.GetDx(e.Pt,r.Pt));for(r=t.Prev;p.IntPoint.op_Equality(r.Pt,t.Pt)&&r!=t;)r=r.Prev;var o=Math.abs(this.GetDx(t.Pt,r.Pt));for(r=t.Next;p.IntPoint.op_Equality(r.Pt,t.Pt)&&r!=t;)r=r.Next;var a=Math.abs(this.GetDx(t.Pt,r.Pt));return i>=o&&i>=a||n>=o&&n>=a};p.Clipper.prototype.GetBottomPt=function(e){for(var t=null,r=e.Next;r!=e;)r.Pt.Y>e.Pt.Y?(e=r,t=null):r.Pt.Y==e.Pt.Y&&r.Pt.X<=e.Pt.X&&(r.Pt.X<e.Pt.X?(t=null,e=r):r.Next!=e&&r.Prev!=e&&(t=r)),r=r.Next;if(t!==null)for(;t!=r;)for(this.FirstIsBottomPt(r,t)||(e=t),t=t.Next;p.IntPoint.op_Inequality(t.Pt,e.Pt);)t=t.Next;return e};p.Clipper.prototype.GetLowermostRec=function(e,t){e.BottomPt===null&&(e.BottomPt=this.GetBottomPt(e.Pts)),t.BottomPt===null&&(t.BottomPt=this.GetBottomPt(t.Pts));var r=e.BottomPt,i=t.BottomPt;return r.Pt.Y>i.Pt.Y?e:r.Pt.Y<i.Pt.Y?t:r.Pt.X<i.Pt.X?e:r.Pt.X>i.Pt.X||r.Next==r?t:i.Next==i||this.FirstIsBottomPt(r,i)?e:t};p.Clipper.prototype.Param1RightOfParam2=function(e,t){do if(e=e.FirstLeft,e==t)return!0;while(e!==null);return!1};p.Clipper.prototype.GetOutRec=function(e){for(var t=this.m_PolyOuts[e];t!=this.m_PolyOuts[t.Idx];)t=this.m_PolyOuts[t.Idx];return t};p.Clipper.prototype.AppendPolygon=function(e,t){var r=this.m_PolyOuts[e.OutIdx],i=this.m_PolyOuts[t.OutIdx],n;this.Param1RightOfParam2(r,i)?n=i:this.Param1RightOfParam2(i,r)?n=r:n=this.GetLowermostRec(r,i);var o=r.Pts,a=o.Prev,l=i.Pts,c=l.Prev,h;e.Side==p.EdgeSide.esLeft?(t.Side==p.EdgeSide.esLeft?(this.ReversePolyPtLinks(l),l.Next=o,o.Prev=l,a.Next=c,c.Prev=a,r.Pts=c):(c.Next=o,o.Prev=c,l.Prev=a,a.Next=l,r.Pts=l),h=p.EdgeSide.esLeft):(t.Side==p.EdgeSide.esRight?(this.ReversePolyPtLinks(l),a.Next=c,c.Prev=a,l.Next=o,o.Prev=l):(a.Next=l,l.Prev=a,o.Prev=c,c.Next=o),h=p.EdgeSide.esRight),r.BottomPt=null,n==i&&(i.FirstLeft!=r&&(r.FirstLeft=i.FirstLeft),r.IsHole=i.IsHole),i.Pts=null,i.BottomPt=null,i.FirstLeft=r;var d=e.OutIdx,m=t.OutIdx;e.OutIdx=-1,t.OutIdx=-1;for(var y=this.m_ActiveEdges;y!==null;){if(y.OutIdx==m){y.OutIdx=d,y.Side=h;break}y=y.NextInAEL}i.Idx=r.Idx};p.Clipper.prototype.ReversePolyPtLinks=function(e){if(e!==null){var t,r;t=e;do r=t.Next,t.Next=t.Prev,t.Prev=r,t=r;while(t!=e)}};p.Clipper.SwapSides=function(e,t){var r=e.Side;e.Side=t.Side,t.Side=r};p.Clipper.SwapPolyIndexes=function(e,t){var r=e.OutIdx;e.OutIdx=t.OutIdx,t.OutIdx=r};p.Clipper.prototype.IntersectEdges=function(e,t,r,i){var n=!i&&e.NextInLML===null&&e.Top.X==r.X&&e.Top.Y==r.Y,o=!i&&t.NextInLML===null&&t.Top.X==r.X&&t.Top.Y==r.Y,a=e.OutIdx>=0,l=t.OutIdx>=0;if(fb&&(e.WindDelta===0||t.WindDelta===0)){e.WindDelta===0&&t.WindDelta===0?(n||o)&&a&&l&&this.AddLocalMaxPoly(e,t,r):e.PolyTyp==t.PolyTyp&&e.WindDelta!=t.WindDelta&&this.m_ClipType==p.ClipType.ctUnion?e.WindDelta===0?l&&(this.AddOutPt(e,r),a&&(e.OutIdx=-1)):a&&(this.AddOutPt(t,r),l&&(t.OutIdx=-1)):e.PolyTyp!=t.PolyTyp&&(e.WindDelta===0&&Math.abs(t.WindCnt)==1&&(this.m_ClipType!=p.ClipType.ctUnion||t.WindCnt2===0)?(this.AddOutPt(e,r),a&&(e.OutIdx=-1)):t.WindDelta===0&&Math.abs(e.WindCnt)==1&&(this.m_ClipType!=p.ClipType.ctUnion||e.WindCnt2===0)&&(this.AddOutPt(t,r),l&&(t.OutIdx=-1))),n&&(e.OutIdx<0?this.DeleteFromAEL(e):p.Error("Error intersecting polylines")),o&&(t.OutIdx<0?this.DeleteFromAEL(t):p.Error("Error intersecting polylines"));return}if(e.PolyTyp==t.PolyTyp)if(this.IsEvenOddFillType(e)){var c=e.WindCnt;e.WindCnt=t.WindCnt,t.WindCnt=c}else e.WindCnt+t.WindDelta===0?e.WindCnt=-e.WindCnt:e.WindCnt+=t.WindDelta,t.WindCnt-e.WindDelta===0?t.WindCnt=-t.WindCnt:t.WindCnt-=e.WindDelta;else this.IsEvenOddFillType(t)?e.WindCnt2=e.WindCnt2===0?1:0:e.WindCnt2+=t.WindDelta,this.IsEvenOddFillType(e)?t.WindCnt2=t.WindCnt2===0?1:0:t.WindCnt2-=e.WindDelta;var h,d,m,y;e.PolyTyp==p.PolyType.ptSubject?(h=this.m_SubjFillType,m=this.m_ClipFillType):(h=this.m_ClipFillType,m=this.m_SubjFillType),t.PolyTyp==p.PolyType.ptSubject?(d=this.m_SubjFillType,y=this.m_ClipFillType):(d=this.m_ClipFillType,y=this.m_SubjFillType);var x,S;switch(h){case p.PolyFillType.pftPositive:x=e.WindCnt;break;case p.PolyFillType.pftNegative:x=-e.WindCnt;break;default:x=Math.abs(e.WindCnt);break}switch(d){case p.PolyFillType.pftPositive:S=t.WindCnt;break;case p.PolyFillType.pftNegative:S=-t.WindCnt;break;default:S=Math.abs(t.WindCnt);break}if(a&&l)n||o||x!==0&&x!=1||S!==0&&S!=1||e.PolyTyp!=t.PolyTyp&&this.m_ClipType!=p.ClipType.ctXor?this.AddLocalMaxPoly(e,t,r):(this.AddOutPt(e,r),this.AddOutPt(t,r),p.Clipper.SwapSides(e,t),p.Clipper.SwapPolyIndexes(e,t));else if(a)(S===0||S==1)&&(this.AddOutPt(e,r),p.Clipper.SwapSides(e,t),p.Clipper.SwapPolyIndexes(e,t));else if(l)(x===0||x==1)&&(this.AddOutPt(t,r),p.Clipper.SwapSides(e,t),p.Clipper.SwapPolyIndexes(e,t));else if((x===0||x==1)&&(S===0||S==1)&&!n&&!o){var P,g;switch(m){case p.PolyFillType.pftPositive:P=e.WindCnt2;break;case p.PolyFillType.pftNegative:P=-e.WindCnt2;break;default:P=Math.abs(e.WindCnt2);break}switch(y){case p.PolyFillType.pftPositive:g=t.WindCnt2;break;case p.PolyFillType.pftNegative:g=-t.WindCnt2;break;default:g=Math.abs(t.WindCnt2);break}if(e.PolyTyp!=t.PolyTyp)this.AddLocalMinPoly(e,t,r);else if(x==1&&S==1)switch(this.m_ClipType){case p.ClipType.ctIntersection:P>0&&g>0&&this.AddLocalMinPoly(e,t,r);break;case p.ClipType.ctUnion:P<=0&&g<=0&&this.AddLocalMinPoly(e,t,r);break;case p.ClipType.ctDifference:(e.PolyTyp==p.PolyType.ptClip&&P>0&&g>0||e.PolyTyp==p.PolyType.ptSubject&&P<=0&&g<=0)&&this.AddLocalMinPoly(e,t,r);break;case p.ClipType.ctXor:this.AddLocalMinPoly(e,t,r);break}else p.Clipper.SwapSides(e,t)}n!=o&&(n&&e.OutIdx>=0||o&&t.OutIdx>=0)&&(p.Clipper.SwapSides(e,t),p.Clipper.SwapPolyIndexes(e,t)),n&&this.DeleteFromAEL(e),o&&this.DeleteFromAEL(t)};p.Clipper.prototype.DeleteFromAEL=function(e){var t=e.PrevInAEL,r=e.NextInAEL;t===null&&r===null&&e!=this.m_ActiveEdges||(t!==null?t.NextInAEL=r:this.m_ActiveEdges=r,r!==null&&(r.PrevInAEL=t),e.NextInAEL=null,e.PrevInAEL=null)};p.Clipper.prototype.DeleteFromSEL=function(e){var t=e.PrevInSEL,r=e.NextInSEL;t===null&&r===null&&e!=this.m_SortedEdges||(t!==null?t.NextInSEL=r:this.m_SortedEdges=r,r!==null&&(r.PrevInSEL=t),e.NextInSEL=null,e.PrevInSEL=null)};p.Clipper.prototype.UpdateEdgeIntoAEL=function(e){e.NextInLML===null&&p.Error("UpdateEdgeIntoAEL: invalid call");var t=e.PrevInAEL,r=e.NextInAEL;return e.NextInLML.OutIdx=e.OutIdx,t!==null?t.NextInAEL=e.NextInLML:this.m_ActiveEdges=e.NextInLML,r!==null&&(r.PrevInAEL=e.NextInLML),e.NextInLML.Side=e.Side,e.NextInLML.WindDelta=e.WindDelta,e.NextInLML.WindCnt=e.WindCnt,e.NextInLML.WindCnt2=e.WindCnt2,e=e.NextInLML,e.Curr.X=e.Bot.X,e.Curr.Y=e.Bot.Y,e.PrevInAEL=t,e.NextInAEL=r,p.ClipperBase.IsHorizontal(e)||this.InsertScanbeam(e.Top.Y),e};p.Clipper.prototype.ProcessHorizontals=function(e){for(var t=this.m_SortedEdges;t!==null;)this.DeleteFromSEL(t),this.ProcessHorizontal(t,e),t=this.m_SortedEdges};p.Clipper.prototype.GetHorzDirection=function(e,t){e.Bot.X<e.Top.X?(t.Left=e.Bot.X,t.Right=e.Top.X,t.Dir=p.Direction.dLeftToRight):(t.Left=e.Top.X,t.Right=e.Bot.X,t.Dir=p.Direction.dRightToLeft)};p.Clipper.prototype.PrepareHorzJoins=function(e,t){var r=this.m_PolyOuts[e.OutIdx].Pts;e.Side!=p.EdgeSide.esLeft&&(r=r.Prev),t&&(p.IntPoint.op_Equality(r.Pt,e.Top)?this.AddGhostJoin(r,e.Bot):this.AddGhostJoin(r,e.Top))};p.Clipper.prototype.ProcessHorizontal=function(e,t){var r={Dir:null,Left:null,Right:null};this.GetHorzDirection(e,r);for(var i=r.Dir,n=r.Left,o=r.Right,a=e,l=null;a.NextInLML!==null&&p.ClipperBase.IsHorizontal(a.NextInLML);)a=a.NextInLML;for(a.NextInLML===null&&(l=this.GetMaximaPair(a));;){for(var c=e==a,h=this.GetNextInAEL(e,i);h!==null&&!(h.Curr.X==e.Top.X&&e.NextInLML!==null&&h.Dx<e.NextInLML.Dx);){var d=this.GetNextInAEL(h,i);if(i==p.Direction.dLeftToRight&&h.Curr.X<=o||i==p.Direction.dRightToLeft&&h.Curr.X>=n){if(e.OutIdx>=0&&e.WindDelta!=0&&this.PrepareHorzJoins(e,t),h==l&&c){i==p.Direction.dLeftToRight?this.IntersectEdges(e,h,h.Top,!1):this.IntersectEdges(h,e,h.Top,!1),l.OutIdx>=0&&p.Error("ProcessHorizontal error");return}else if(i==p.Direction.dLeftToRight){var m=new p.IntPoint(h.Curr.X,e.Curr.Y);this.IntersectEdges(e,h,m,!0)}else{var m=new p.IntPoint(h.Curr.X,e.Curr.Y);this.IntersectEdges(h,e,m,!0)}this.SwapPositionsInAEL(e,h)}else if(i==p.Direction.dLeftToRight&&h.Curr.X>=o||i==p.Direction.dRightToLeft&&h.Curr.X<=n)break;h=d}if(e.OutIdx>=0&&e.WindDelta!==0&&this.PrepareHorzJoins(e,t),e.NextInLML!==null&&p.ClipperBase.IsHorizontal(e.NextInLML)){e=this.UpdateEdgeIntoAEL(e),e.OutIdx>=0&&this.AddOutPt(e,e.Bot);var r={Dir:i,Left:n,Right:o};this.GetHorzDirection(e,r),i=r.Dir,n=r.Left,o=r.Right}else break}if(e.NextInLML!==null)if(e.OutIdx>=0){var y=this.AddOutPt(e,e.Top);if(e=this.UpdateEdgeIntoAEL(e),e.WindDelta===0)return;var x=e.PrevInAEL,d=e.NextInAEL;if(x!==null&&x.Curr.X==e.Bot.X&&x.Curr.Y==e.Bot.Y&&x.WindDelta!==0&&x.OutIdx>=0&&x.Curr.Y>x.Top.Y&&p.ClipperBase.SlopesEqual(e,x,this.m_UseFullRange)){var S=this.AddOutPt(x,e.Bot);this.AddJoin(y,S,e.Top)}else if(d!==null&&d.Curr.X==e.Bot.X&&d.Curr.Y==e.Bot.Y&&d.WindDelta!==0&&d.OutIdx>=0&&d.Curr.Y>d.Top.Y&&p.ClipperBase.SlopesEqual(e,d,this.m_UseFullRange)){var S=this.AddOutPt(d,e.Bot);this.AddJoin(y,S,e.Top)}}else e=this.UpdateEdgeIntoAEL(e);else l!==null?l.OutIdx>=0?(i==p.Direction.dLeftToRight?this.IntersectEdges(e,l,e.Top,!1):this.IntersectEdges(l,e,e.Top,!1),l.OutIdx>=0&&p.Error("ProcessHorizontal error")):(this.DeleteFromAEL(e),this.DeleteFromAEL(l)):(e.OutIdx>=0&&this.AddOutPt(e,e.Top),this.DeleteFromAEL(e))};p.Clipper.prototype.GetNextInAEL=function(e,t){return t==p.Direction.dLeftToRight?e.NextInAEL:e.PrevInAEL};p.Clipper.prototype.IsMinima=function(e){return e!==null&&e.Prev.NextInLML!=e&&e.Next.NextInLML!=e};p.Clipper.prototype.IsMaxima=function(e,t){return e!==null&&e.Top.Y==t&&e.NextInLML===null};p.Clipper.prototype.IsIntermediate=function(e,t){return e.Top.Y==t&&e.NextInLML!==null};p.Clipper.prototype.GetMaximaPair=function(e){var t=null;return p.IntPoint.op_Equality(e.Next.Top,e.Top)&&e.Next.NextInLML===null?t=e.Next:p.IntPoint.op_Equality(e.Prev.Top,e.Top)&&e.Prev.NextInLML===null&&(t=e.Prev),t!==null&&(t.OutIdx==-2||t.NextInAEL==t.PrevInAEL&&!p.ClipperBase.IsHorizontal(t))?null:t};p.Clipper.prototype.ProcessIntersections=function(e,t){if(this.m_ActiveEdges==null)return!0;try{if(this.BuildIntersectList(e,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,p.Error("ProcessIntersections error")}return this.m_SortedEdges=null,!0};p.Clipper.prototype.BuildIntersectList=function(e,t){if(this.m_ActiveEdges!==null){var r=this.m_ActiveEdges;for(this.m_SortedEdges=r;r!==null;)r.PrevInSEL=r.PrevInAEL,r.NextInSEL=r.NextInAEL,r.Curr.X=p.Clipper.TopX(r,t),r=r.NextInAEL;for(var i=!0;i&&this.m_SortedEdges!==null;){for(i=!1,r=this.m_SortedEdges;r.NextInSEL!==null;){var n=r.NextInSEL,o=new p.IntPoint;if(r.Curr.X>n.Curr.X){!this.IntersectPoint(r,n,o)&&r.Curr.X>n.Curr.X+1&&p.Error("Intersection error"),o.Y>e&&(o.Y=e,Math.abs(r.Dx)>Math.abs(n.Dx)?o.X=p.Clipper.TopX(n,e):o.X=p.Clipper.TopX(r,e));var a=new p.IntersectNode;a.Edge1=r,a.Edge2=n,a.Pt.X=o.X,a.Pt.Y=o.Y,this.m_IntersectList.push(a),this.SwapPositionsInSEL(r,n),i=!0}else r=n}if(r.PrevInSEL!==null)r.PrevInSEL.NextInSEL=null;else break}this.m_SortedEdges=null}};p.Clipper.prototype.EdgesAdjacent=function(e){return e.Edge1.NextInSEL==e.Edge2||e.Edge1.PrevInSEL==e.Edge2};p.Clipper.IntersectNodeSort=function(e,t){return t.Pt.Y-e.Pt.Y};p.Clipper.prototype.FixupIntersectionOrder=function(){this.m_IntersectList.sort(this.m_IntersectNodeComparer),this.CopyAELToSEL();for(var e=this.m_IntersectList.length,t=0;t<e;t++){if(!this.EdgesAdjacent(this.m_IntersectList[t])){for(var r=t+1;r<e&&!this.EdgesAdjacent(this.m_IntersectList[r]);)r++;if(r==e)return!1;var i=this.m_IntersectList[t];this.m_IntersectList[t]=this.m_IntersectList[r],this.m_IntersectList[r]=i}this.SwapPositionsInSEL(this.m_IntersectList[t].Edge1,this.m_IntersectList[t].Edge2)}return!0};p.Clipper.prototype.ProcessIntersectList=function(){for(var e=0,t=this.m_IntersectList.length;e<t;e++){var r=this.m_IntersectList[e];this.IntersectEdges(r.Edge1,r.Edge2,r.Pt,!0),this.SwapPositionsInAEL(r.Edge1,r.Edge2)}this.m_IntersectList.length=0};var tP=s(function(e){return e<0?Math.ceil(e-.5):Math.round(e)},"R1"),eP=s(function(e){return e<0?Math.ceil(e-.5):Math.floor(e+.5)},"R2"),rP=s(function(e){return e<0?-Math.round(Math.abs(e)):Math.round(e)},"R3"),iP=s(function(e){return e<0?(e-=.5,e<-2147483648?Math.ceil(e):e|0):(e+=.5,e>2147483647?Math.floor(e):e|0)},"R4");z.msie?p.Clipper.Round=tP:z.chromium?p.Clipper.Round=rP:z.safari?p.Clipper.Round=iP:p.Clipper.Round=eP;p.Clipper.TopX=function(e,t){return t==e.Top.Y?e.Top.X:e.Bot.X+p.Clipper.Round(e.Dx*(t-e.Bot.Y))};p.Clipper.prototype.IntersectPoint=function(e,t,r){r.X=0,r.Y=0;var i,n;if(p.ClipperBase.SlopesEqual(e,t,this.m_UseFullRange)||e.Dx==t.Dx)return t.Bot.Y>e.Bot.Y?(r.X=t.Bot.X,r.Y=t.Bot.Y):(r.X=e.Bot.X,r.Y=e.Bot.Y),!1;if(e.Delta.X===0)r.X=e.Bot.X,p.ClipperBase.IsHorizontal(t)?r.Y=t.Bot.Y:(n=t.Bot.Y-t.Bot.X/t.Dx,r.Y=p.Clipper.Round(r.X/t.Dx+n));else if(t.Delta.X===0)r.X=t.Bot.X,p.ClipperBase.IsHorizontal(e)?r.Y=e.Bot.Y:(i=e.Bot.Y-e.Bot.X/e.Dx,r.Y=p.Clipper.Round(r.X/e.Dx+i));else{i=e.Bot.X-e.Bot.Y*e.Dx,n=t.Bot.X-t.Bot.Y*t.Dx;var o=(n-i)/(e.Dx-t.Dx);r.Y=p.Clipper.Round(o),Math.abs(e.Dx)<Math.abs(t.Dx)?r.X=p.Clipper.Round(e.Dx*o+i):r.X=p.Clipper.Round(t.Dx*o+n)}if(r.Y<e.Top.Y||r.Y<t.Top.Y){if(e.Top.Y>t.Top.Y)return r.Y=e.Top.Y,r.X=p.Clipper.TopX(t,e.Top.Y),r.X<e.Top.X;r.Y=t.Top.Y,Math.abs(e.Dx)<Math.abs(t.Dx)?r.X=p.Clipper.TopX(e,r.Y):r.X=p.Clipper.TopX(t,r.Y)}return!0};p.Clipper.prototype.ProcessEdgesAtTopOfScanbeam=function(e){for(var t=this.m_ActiveEdges;t!==null;){var r=this.IsMaxima(t,e);if(r){var i=this.GetMaximaPair(t);r=i===null||!p.ClipperBase.IsHorizontal(i)}if(r){var n=t.PrevInAEL;this.DoMaxima(t),n===null?t=this.m_ActiveEdges:t=n.NextInAEL}else{if(this.IsIntermediate(t,e)&&p.ClipperBase.IsHorizontal(t.NextInLML)?(t=this.UpdateEdgeIntoAEL(t),t.OutIdx>=0&&this.AddOutPt(t,t.Bot),this.AddEdgeToSEL(t)):(t.Curr.X=p.Clipper.TopX(t,e),t.Curr.Y=e),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,e)){var o=null;t.OutIdx>=0&&(o=this.AddOutPt(t,t.Top)),t=this.UpdateEdgeIntoAEL(t);var n=t.PrevInAEL,l=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&&p.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(l!==null&&l.Curr.X==t.Bot.X&&l.Curr.Y==t.Bot.Y&&o!==null&&l.OutIdx>=0&&l.Curr.Y>l.Top.Y&&p.ClipperBase.SlopesEqual(t,l,this.m_UseFullRange)&&t.WindDelta!==0&&l.WindDelta!==0){var a=this.AddOutPt(l,t.Bot);this.AddJoin(o,a,t.Top)}}t=t.NextInAEL}};p.Clipper.prototype.DoMaxima=function(e){var t=this.GetMaximaPair(e);if(t===null){e.OutIdx>=0&&this.AddOutPt(e,e.Top),this.DeleteFromAEL(e);return}for(var r=e.NextInAEL,i=!0;r!==null&&r!=t;)this.IntersectEdges(e,r,e.Top,!0),this.SwapPositionsInAEL(e,r),r=e.NextInAEL;e.OutIdx==-1&&t.OutIdx==-1?(this.DeleteFromAEL(e),this.DeleteFromAEL(t)):e.OutIdx>=0&&t.OutIdx>=0?this.IntersectEdges(e,t,e.Top,!1):i&&e.WindDelta===0?(e.OutIdx>=0&&(this.AddOutPt(e,e.Top),e.OutIdx=-1),this.DeleteFromAEL(e),t.OutIdx>=0&&(this.AddOutPt(t,e.Top),t.OutIdx=-1),this.DeleteFromAEL(t)):p.Error("DoMaxima error")};p.Clipper.ReversePaths=function(e){for(var t=0,r=e.length;t<r;t++)e[t].reverse()};p.Clipper.Orientation=function(e){return p.Clipper.Area(e)>=0};p.Clipper.prototype.PointCount=function(e){if(e===null)return 0;var t=0,r=e;do t++,r=r.Next;while(r!=e);return t};p.Clipper.prototype.BuildResult=function(e){p.Clear(e);for(var t=0,r=this.m_PolyOuts.length;t<r;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),l=0;l<o;l++)a[l]=n.Pt,n=n.Prev;e.push(a)}}}};p.Clipper.prototype.BuildResult2=function(e){e.Clear();for(var t=0,r=this.m_PolyOuts.length;t<r;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 p.PolyNode;e.m_AllPolys.push(o),i.PolyNode=o,o.m_polygon.length=n;for(var a=i.Pts.Prev,l=0;l<n;l++)o.m_polygon[l]=a.Pt,a=a.Prev}}for(var t=0,r=this.m_PolyOuts.length;t<r;t++){var i=this.m_PolyOuts[t];i.PolyNode!==null&&(i.IsOpen?(i.PolyNode.IsOpen=!0,e.AddChild(i.PolyNode)):i.FirstLeft!==null&&i.FirstLeft.PolyNode!=null?i.FirstLeft.PolyNode.AddChild(i.PolyNode):e.AddChild(i.PolyNode))}};p.Clipper.prototype.FixupOutPolygon=function(e){var t=null;e.BottomPt=null;for(var r=e.Pts;;){if(r.Prev==r||r.Prev==r.Next){this.DisposeOutPts(r),e.Pts=null;return}if(p.IntPoint.op_Equality(r.Pt,r.Next.Pt)||p.IntPoint.op_Equality(r.Pt,r.Prev.Pt)||p.ClipperBase.SlopesEqual(r.Prev.Pt,r.Pt,r.Next.Pt,this.m_UseFullRange)&&(!this.PreserveCollinear||!this.Pt2IsBetweenPt1AndPt3(r.Prev.Pt,r.Pt,r.Next.Pt))){t=null;var i=r;r.Prev.Next=r.Next,r.Next.Prev=r.Prev,r=r.Prev,i=null}else{if(r==t)break;t===null&&(t=r),r=r.Next}}e.Pts=r};p.Clipper.prototype.DupOutPt=function(e,t){var r=new p.OutPt;return r.Pt.X=e.Pt.X,r.Pt.Y=e.Pt.Y,r.Idx=e.Idx,t?(r.Next=e.Next,r.Prev=e,e.Next.Prev=r,e.Next=r):(r.Prev=e.Prev,r.Next=e,e.Prev.Next=r,e.Prev=r),r};p.Clipper.prototype.GetOverlap=function(e,t,r,i,n){return e<t?r<i?(n.Left=Math.max(e,r),n.Right=Math.min(t,i)):(n.Left=Math.max(e,i),n.Right=Math.min(t,r)):r<i?(n.Left=Math.max(t,r),n.Right=Math.min(e,i)):(n.Left=Math.max(t,i),n.Right=Math.min(e,r)),n.Left<n.Right};p.Clipper.prototype.JoinHorz=function(e,t,r,i,n,o){var a=e.Pt.X>t.Pt.X?p.Direction.dRightToLeft:p.Direction.dLeftToRight,l=r.Pt.X>i.Pt.X?p.Direction.dRightToLeft:p.Direction.dLeftToRight;if(a==l)return!1;if(a==p.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),t=this.DupOutPt(e,!o),p.IntPoint.op_Inequality(t.Pt,n)&&(e=t,e.Pt.X=n.X,e.Pt.Y=n.Y,t=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),t=this.DupOutPt(e,o),p.IntPoint.op_Inequality(t.Pt,n)&&(e=t,e.Pt.X=n.X,e.Pt.Y=n.Y,t=this.DupOutPt(e,o))}if(l==p.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),i=this.DupOutPt(r,!o),p.IntPoint.op_Inequality(i.Pt,n)&&(r=i,r.Pt.X=n.X,r.Pt.Y=n.Y,i=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),i=this.DupOutPt(r,o),p.IntPoint.op_Inequality(i.Pt,n)&&(r=i,r.Pt.X=n.X,r.Pt.Y=n.Y,i=this.DupOutPt(r,o))}return a==p.Direction.dLeftToRight==o?(e.Prev=r,r.Next=e,t.Next=i,i.Prev=t):(e.Next=r,r.Prev=e,t.Prev=i,i.Next=t),!0};p.Clipper.prototype.JoinPoints=function(e,t,r){var i=e.OutPt1,n=new p.OutPt,o=e.OutPt2,a=new p.OutPt,l=e.OutPt1.Pt.Y==e.OffPt.Y;if(l&&p.IntPoint.op_Equality(e.OffPt,e.OutPt1.Pt)&&p.IntPoint.op_Equality(e.OffPt,e.OutPt2.Pt)){for(n=e.OutPt1.Next;n!=i&&p.IntPoint.op_Equality(n.Pt,e.OffPt);)n=n.Next;var c=n.Pt.Y>e.OffPt.Y;for(a=e.OutPt2.Next;a!=o&&p.IntPoint.op_Equality(a.Pt,e.OffPt);)a=a.Next;var h=a.Pt.Y>e.OffPt.Y;return c==h?!1:c?(n=this.DupOutPt(i,!1),a=this.DupOutPt(o,!0),i.Prev=o,o.Next=i,n.Next=a,a.Prev=n,e.OutPt1=i,e.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,e.OutPt1=i,e.OutPt2=n,!0)}else if(l){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 d={Left:null,Right:null};if(!this.GetOverlap(i.Pt.X,n.Pt.X,o.Pt.X,a.Pt.X,d))return!1;var m=d.Left,y=d.Right,x=new p.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),e.OutPt1=i,e.OutPt2=o,this.JoinHorz(i,n,o,a,x,S)}else{for(n=i.Next;p.IntPoint.op_Equality(n.Pt,i.Pt)&&n!=i;)n=n.Next;var P=n.Pt.Y>i.Pt.Y||!p.ClipperBase.SlopesEqual(i.Pt,n.Pt,e.OffPt,this.m_UseFullRange);if(P){for(n=i.Prev;p.IntPoint.op_Equality(n.Pt,i.Pt)&&n!=i;)n=n.Prev;if(n.Pt.Y>i.Pt.Y||!p.ClipperBase.SlopesEqual(i.Pt,n.Pt,e.OffPt,this.m_UseFullRange))return!1}for(a=o.Next;p.IntPoint.op_Equality(a.Pt,o.Pt)&&a!=o;)a=a.Next;var g=a.Pt.Y>o.Pt.Y||!p.ClipperBase.SlopesEqual(o.Pt,a.Pt,e.OffPt,this.m_UseFullRange);if(g){for(a=o.Prev;p.IntPoint.op_Equality(a.Pt,o.Pt)&&a!=o;)a=a.Prev;if(a.Pt.Y>o.Pt.Y||!p.ClipperBase.SlopesEqual(o.Pt,a.Pt,e.OffPt,this.m_UseFullRange))return!1}return n==i||a==o||n==a||t==r&&P==g?!1:P?(n=this.DupOutPt(i,!1),a=this.DupOutPt(o,!0),i.Prev=o,o.Next=i,n.Next=a,a.Prev=n,e.OutPt1=i,e.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,e.OutPt1=i,e.OutPt2=n,!0)}};p.Clipper.GetBounds=function(e){for(var t=0,r=e.length;t<r&&e[t].length==0;)t++;if(t==r)return new p.IntRect(0,0,0,0);var i=new p.IntRect;for(i.left=e[t][0].X,i.right=i.left,i.top=e[t][0].Y,i.bottom=i.top;t<r;t++)for(var n=0,o=e[t].length;n<o;n++)e[t][n].X<i.left?i.left=e[t][n].X:e[t][n].X>i.right&&(i.right=e[t][n].X),e[t][n].Y<i.top?i.top=e[t][n].Y:e[t][n].Y>i.bottom&&(i.bottom=e[t][n].Y);return i};p.Clipper.prototype.GetBounds2=function(e){var t=e,r=new p.IntRect;for(r.left=e.Pt.X,r.right=e.Pt.X,r.top=e.Pt.Y,r.bottom=e.Pt.Y,e=e.Next;e!=t;)e.Pt.X<r.left&&(r.left=e.Pt.X),e.Pt.X>r.right&&(r.right=e.Pt.X),e.Pt.Y<r.top&&(r.top=e.Pt.Y),e.Pt.Y>r.bottom&&(r.bottom=e.Pt.Y),e=e.Next;return r};p.Clipper.PointInPolygon=function(e,t){var r=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==e.Y&&(a.X==e.X||n.Y==e.Y&&a.X>e.X==n.X<e.X))return-1;if(n.Y<e.Y!=a.Y<e.Y){if(n.X>=e.X)if(a.X>e.X)r=1-r;else{var l=(n.X-e.X)*(a.Y-e.Y)-(a.X-e.X)*(n.Y-e.Y);if(l==0)return-1;l>0==a.Y>n.Y&&(r=1-r)}else if(a.X>e.X){var l=(n.X-e.X)*(a.Y-e.Y)-(a.X-e.X)*(n.Y-e.Y);if(l==0)return-1;l>0==a.Y>n.Y&&(r=1-r)}}n=a}return r};p.Clipper.prototype.PointInPolygon=function(e,t){for(var r=0,i=t;;){var n=t.Pt.X,o=t.Pt.Y,a=t.Next.Pt.X,l=t.Next.Pt.Y;if(l==e.Y&&(a==e.X||o==e.Y&&a>e.X==n<e.X))return-1;if(o<e.Y!=l<e.Y){if(n>=e.X)if(a>e.X)r=1-r;else{var c=(n-e.X)*(l-e.Y)-(a-e.X)*(o-e.Y);if(c==0)return-1;c>0==l>o&&(r=1-r)}else if(a>e.X){var c=(n-e.X)*(l-e.Y)-(a-e.X)*(o-e.Y);if(c==0)return-1;c>0==l>o&&(r=1-r)}}if(t=t.Next,i==t)break}return r};p.Clipper.prototype.Poly2ContainsPoly1=function(e,t){var r=e;do{var i=this.PointInPolygon(r.Pt,t);if(i>=0)return i!=0;r=r.Next}while(r!=e);return!0};p.Clipper.prototype.FixupFirstLefts1=function(e,t){for(var r=0,i=this.m_PolyOuts.length;r<i;r++){var n=this.m_PolyOuts[r];n.Pts!==null&&n.FirstLeft==e&&this.Poly2ContainsPoly1(n.Pts,t.Pts)&&(n.FirstLeft=t)}};p.Clipper.prototype.FixupFirstLefts2=function(e,t){for(var r=0,i=this.m_PolyOuts,n=i.length,o=i[r];r<n;r++,o=i[r])o.FirstLeft==e&&(o.FirstLeft=t)};p.Clipper.ParseFirstLeft=function(e){for(;e!=null&&e.Pts==null;)e=e.FirstLeft;return e};p.Clipper.prototype.JoinCommonEdges=function(){for(var e=0,t=this.m_Joins.length;e<t;e++){var r=this.m_Joins[e],i=this.GetOutRec(r.OutPt1.Idx),n=this.GetOutRec(r.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(r,i,n))if(i==n){if(i.Pts=r.OutPt1,i.BottomPt=null,n=this.CreateOutRec(),n.Pts=r.OutPt2,this.UpdateOutPtIdxs(n),this.m_UsingPolyTree)for(var a=0,l=this.m_PolyOuts.length;a<l-1;a++){var c=this.m_PolyOuts[a];c.Pts==null||p.Clipper.ParseFirstLeft(c.FirstLeft)!=i||c.IsHole==i.IsHole||this.Poly2ContainsPoly1(c.Pts,r.OutPt2)&&(c.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)}}};p.Clipper.prototype.UpdateOutPtIdxs=function(e){var t=e.Pts;do t.Idx=e.Idx,t=t.Prev;while(t!=e.Pts)};p.Clipper.prototype.DoSimplePolygons=function(){for(var e=0;e<this.m_PolyOuts.length;){var t=this.m_PolyOuts[e++],r=t.Pts;if(r!==null)do{for(var i=r.Next;i!=t.Pts;){if(p.IntPoint.op_Equality(r.Pt,i.Pt)&&i.Next!=r&&i.Prev!=r){var n=r.Prev,o=i.Prev;r.Prev=o,o.Next=r,i.Prev=n,n.Next=i,t.Pts=r;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=r}i=i.Next}r=r.Next}while(r!=t.Pts)}};p.Clipper.Area=function(e){var t=e.length;if(t<3)return 0;for(var r=0,i=0,n=t-1;i<t;++i)r+=(e[n].X+e[i].X)*(e[n].Y-e[i].Y),n=i;return-r*.5};p.Clipper.prototype.Area=function(e){var t=e.Pts;if(t==null)return 0;var r=0;do r=r+(t.Prev.Pt.X+t.Pt.X)*(t.Prev.Pt.Y-t.Pt.Y),t=t.Next;while(t!=e.Pts);return r*.5};db&&(p.Clipper.OffsetPaths=function(e,t,r,i,n){var o=new p.Paths,a=new p.ClipperOffset(n,n);return a.AddPaths(e,r,i),a.Execute(o,t),o});p.Clipper.SimplifyPolygon=function(e,t){var r=new Array,i=new p.Clipper(0);return i.StrictlySimple=!0,i.AddPath(e,p.PolyType.ptSubject,!0),i.Execute(p.ClipType.ctUnion,r,t,t),r};p.Clipper.SimplifyPolygons=function(e,t){typeof t>"u"&&(t=p.PolyFillType.pftEvenOdd);var r=new Array,i=new p.Clipper(0);return i.StrictlySimple=!0,i.AddPaths(e,p.PolyType.ptSubject,!0),i.Execute(p.ClipType.ctUnion,r,t,t),r};p.Clipper.DistanceSqrd=function(e,t){var r=e.X-t.X,i=e.Y-t.Y;return r*r+i*i};p.Clipper.DistanceFromLineSqrd=function(e,t,r){var i=t.Y-r.Y,n=r.X-t.X,o=i*t.X+n*t.Y;return o=i*e.X+n*e.Y-o,o*o/(i*i+n*n)};p.Clipper.SlopesNearCollinear=function(e,t,r,i){return p.Clipper.DistanceFromLineSqrd(t,e,r)<i};p.Clipper.PointsAreClose=function(e,t,r){var i=e.X-t.X,n=e.Y-t.Y;return i*i+n*n<=r};p.Clipper.ExcludeOp=function(e){var t=e.Prev;return t.Next=e.Next,e.Next.Prev=t,t.Idx=0,t};p.Clipper.CleanPolygon=function(e,t){typeof t>"u"&&(t=1.415);var r=e.length;if(r==0)return new Array;for(var i=new Array(r),n=0;n<r;++n)i[n]=new p.OutPt;for(var n=0;n<r;++n)i[n].Pt=e[n],i[n].Next=i[(n+1)%r],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;)p.Clipper.PointsAreClose(a.Pt,a.Prev.Pt,o)?(a=p.Clipper.ExcludeOp(a),r--):p.Clipper.PointsAreClose(a.Prev.Pt,a.Next.Pt,o)?(p.Clipper.ExcludeOp(a.Next),a=p.Clipper.ExcludeOp(a),r-=2):p.Clipper.SlopesNearCollinear(a.Prev.Pt,a.Pt,a.Next.Pt,o)?(a=p.Clipper.ExcludeOp(a),r--):(a.Idx=1,a=a.Next);r<3&&(r=0);for(var l=new Array(r),n=0;n<r;++n)l[n]=new p.IntPoint(a.Pt),a=a.Next;return i=null,l};p.Clipper.CleanPolygons=function(e,t){for(var r=new Array(e.length),i=0,n=e.length;i<n;i++)r[i]=p.Clipper.CleanPolygon(e[i],t);return r};p.Clipper.Minkowski=function(e,t,r,i){var n=i?1:0,o=e.length,a=t.length,l=new Array;if(r)for(var c=0;c<a;c++){for(var h=new Array(o),d=0,m=e.length,y=e[d];d<m;d++,y=e[d])h[d]=new p.IntPoint(t[c].X+y.X,t[c].Y+y.Y);l.push(h)}else for(var c=0;c<a;c++){for(var h=new Array(o),d=0,m=e.length,y=e[d];d<m;d++,y=e[d])h[d]=new p.IntPoint(t[c].X-y.X,t[c].Y-y.Y);l.push(h)}for(var x=new Array,c=0;c<a-1+n;c++)for(var d=0;d<o;d++){var S=new Array;S.push(l[c%a][d%o]),S.push(l[(c+1)%a][d%o]),S.push(l[(c+1)%a][(d+1)%o]),S.push(l[c%a][(d+1)%o]),p.Clipper.Orientation(S)||S.reverse(),x.push(S)}var P=new p.Clipper(0);return P.AddPaths(x,p.PolyType.ptSubject,!0),P.Execute(p.ClipType.ctUnion,l,p.PolyFillType.pftNonZero,p.PolyFillType.pftNonZero),l};p.Clipper.MinkowskiSum=function(){var e=arguments,t=e.length;if(t==3){var r=e[0],i=e[1],n=e[2];return p.Clipper.Minkowski(r,i,!0,n)}else if(t==4){for(var r=e[0],o=e[1],a=e[2],n=e[3],l=new p.Clipper,c,h=0,d=o.length;h<d;++h){var c=p.Clipper.Minkowski(r,o[h],!0,n);l.AddPaths(c,p.PolyType.ptSubject,!0)}n&&l.AddPaths(o,p.PolyType.ptClip,!0);var m=new p.Paths;return l.Execute(p.ClipType.ctUnion,m,a,a),m}};p.Clipper.MinkowskiDiff=function(e,t,r){return p.Clipper.Minkowski(e,t,!1,r)};p.Clipper.PolyTreeToPaths=function(e){var t=new Array;return p.Clipper.AddPolyNodeToPaths(e,p.Clipper.NodeType.ntAny,t),t};p.Clipper.AddPolyNodeToPaths=function(e,t,r){var i=!0;switch(t){case p.Clipper.NodeType.ntOpen:return;case p.Clipper.NodeType.ntClosed:i=!e.IsOpen;break;default:break}e.m_polygon.length>0&&i&&r.push(e.m_polygon);for(var n=0,o=e.Childs(),a=o.length,l=o[n];n<a;n++,l=o[n])p.Clipper.AddPolyNodeToPaths(l,t,r)};p.Clipper.OpenPathsFromPolyTree=function(e){for(var t=new p.Paths,r=0,i=e.ChildCount();r<i;r++)e.Childs()[r].IsOpen&&t.push(e.Childs()[r].m_polygon);return t};p.Clipper.ClosedPathsFromPolyTree=function(e){var t=new p.Paths;return p.Clipper.AddPolyNodeToPaths(e,p.Clipper.NodeType.ntClosed,t),t};ql(p.Clipper,p.ClipperBase);p.Clipper.NodeType={ntAny:0,ntOpen:1,ntClosed:2};p.ClipperOffset=function(e,t){typeof e>"u"&&(e=2),typeof t>"u"&&(t=p.ClipperOffset.def_arc_tolerance),this.m_destPolys=new p.Paths,this.m_srcPoly=new p.Path,this.m_destPoly=new p.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 p.IntPoint,this.m_polyNodes=new p.PolyNode,this.MiterLimit=e,this.ArcTolerance=t,this.m_lowest.X=-1};p.ClipperOffset.two_pi=6.28318530717959;p.ClipperOffset.def_arc_tolerance=.25;p.ClipperOffset.prototype.Clear=function(){p.Clear(this.m_polyNodes.Childs()),this.m_lowest.X=-1};p.ClipperOffset.Round=p.Clipper.Round;p.ClipperOffset.prototype.AddPath=function(e,t,r){var i=e.length-1;if(!(i<0)){var n=new p.PolyNode;if(n.m_jointype=t,n.m_endtype=r,r==p.EndType.etClosedLine||r==p.EndType.etClosedPolygon)for(;i>0&&p.IntPoint.op_Equality(e[0],e[i]);)i--;n.m_polygon.push(e[0]);for(var o=0,a=0,l=1;l<=i;l++)p.IntPoint.op_Inequality(n.m_polygon[o],e[l])&&(o++,n.m_polygon.push(e[l]),(e[l].Y>n.m_polygon[a].Y||e[l].Y==n.m_polygon[a].Y&&e[l].X<n.m_polygon[a].X)&&(a=o));if(!(r==p.EndType.etClosedPolygon&&o<2||r!=p.EndType.etClosedPolygon&&o<0)&&(this.m_polyNodes.AddChild(n),r==p.EndType.etClosedPolygon))if(this.m_lowest.X<0)this.m_lowest=new p.IntPoint(0,a);else{var c=this.m_polyNodes.Childs()[this.m_lowest.X].m_polygon[this.m_lowest.Y];(n.m_polygon[a].Y>c.Y||n.m_polygon[a].Y==c.Y&&n.m_polygon[a].X<c.X)&&(this.m_lowest=new p.IntPoint(this.m_polyNodes.ChildCount()-1,a))}}};p.ClipperOffset.prototype.AddPaths=function(e,t,r){for(var i=0,n=e.length;i<n;i++)this.AddPath(e[i],t,r)};p.ClipperOffset.prototype.FixOrientations=function(){if(this.m_lowest.X>=0&&!p.Clipper.Orientation(this.m_polyNodes.Childs()[this.m_lowest.X].m_polygon))for(var e=0;e<this.m_polyNodes.ChildCount();e++){var t=this.m_polyNodes.Childs()[e];(t.m_endtype==p.EndType.etClosedPolygon||t.m_endtype==p.EndType.etClosedLine&&p.Clipper.Orientation(t.m_polygon))&&t.m_polygon.reverse()}else for(var e=0;e<this.m_polyNodes.ChildCount();e++){var t=this.m_polyNodes.Childs()[e];t.m_endtype==p.EndType.etClosedLine&&!p.Clipper.Orientation(t.m_polygon)&&t.m_polygon.reverse()}};p.ClipperOffset.GetUnitNormal=function(e,t){var r=t.X-e.X,i=t.Y-e.Y;if(r==0&&i==0)return new p.DoublePoint(0,0);var n=1/Math.sqrt(r*r+i*i);return r*=n,i*=n,new p.DoublePoint(i,-r)};p.ClipperOffset.prototype.DoOffset=function(e){if(this.m_destPolys=new Array,this.m_delta=e,p.ClipperBase.near_zero(e)){for(var t=0;t<this.m_polyNodes.ChildCount();t++){var r=this.m_polyNodes.Childs()[t];r.m_endtype==p.EndType.etClosedPolygon&&this.m_destPolys.push(r.m_polygon)}return}this.MiterLimit>2?this.m_miterLim=2/(this.MiterLimit*this.MiterLimit):this.m_miterLim=.5;var i;this.ArcTolerance<=0?i=p.ClipperOffset.def_arc_tolerance:this.ArcTolerance>Math.abs(e)*p.ClipperOffset.def_arc_tolerance?i=Math.abs(e)*p.ClipperOffset.def_arc_tolerance:i=this.ArcTolerance;var n=3.14159265358979/Math.acos(1-i/Math.abs(e));this.m_sin=Math.sin(p.ClipperOffset.two_pi/n),this.m_cos=Math.cos(p.ClipperOffset.two_pi/n),this.m_StepsPerRad=n/p.ClipperOffset.two_pi,e<0&&(this.m_sin=-this.m_sin);for(var t=0;t<this.m_polyNodes.ChildCount();t++){var r=this.m_polyNodes.Childs()[t];this.m_srcPoly=r.m_polygon;var o=this.m_srcPoly.length;if(!(o==0||e<=0&&(o<3||r.m_endtype!=p.EndType.etClosedPolygon))){if(this.m_destPoly=new Array,o==1){if(r.m_jointype==p.JoinType.jtRound)for(var a=1,l=0,c=1;c<=n;c++){this.m_destPoly.push(new p.IntPoint(p.ClipperOffset.Round(this.m_srcPoly[0].X+a*e),p.ClipperOffset.Round(this.m_srcPoly[0].Y+l*e)));var h=a;a=a*this.m_cos-this.m_sin*l,l=h*this.m_sin+l*this.m_cos}else for(var a=-1,l=-1,c=0;c<4;++c)this.m_destPoly.push(new p.IntPoint(p.ClipperOffset.Round(this.m_srcPoly[0].X+a*e),p.ClipperOffset.Round(this.m_srcPoly[0].Y+l*e))),a<0?a=1:l<0?l=1:a=-1;this.m_destPolys.push(this.m_destPoly);continue}this.m_normals.length=0;for(var c=0;c<o-1;c++)this.m_normals.push(p.ClipperOffset.GetUnitNormal(this.m_srcPoly[c],this.m_srcPoly[c+1]));if(r.m_endtype==p.EndType.etClosedLine||r.m_endtype==p.EndType.etClosedPolygon?this.m_normals.push(p.ClipperOffset.GetUnitNormal(this.m_srcPoly[o-1],this.m_srcPoly[0])):this.m_normals.push(new p.DoublePoint(this.m_normals[o-2])),r.m_endtype==p.EndType.etClosedPolygon){for(var d=o-1,c=0;c<o;c++)d=this.OffsetPoint(c,d,r.m_jointype);this.m_destPolys.push(this.m_destPoly)}else if(r.m_endtype==p.EndType.etClosedLine){for(var d=o-1,c=0;c<o;c++)d=this.OffsetPoint(c,d,r.m_jointype);this.m_destPolys.push(this.m_destPoly),this.m_destPoly=new Array;for(var m=this.m_normals[o-1],c=o-1;c>0;c--)this.m_normals[c]=new p.DoublePoint(-this.m_normals[c-1].X,-this.m_normals[c-1].Y);this.m_normals[0]=new p.DoublePoint(-m.X,-m.Y),d=0;for(var c=o-1;c>=0;c--)d=this.OffsetPoint(c,d,r.m_jointype);this.m_destPolys.push(this.m_destPoly)}else{for(var d=0,c=1;c<o-1;++c)d=this.OffsetPoint(c,d,r.m_jointype);var y;if(r.m_endtype==p.EndType.etOpenButt){var c=o-1;y=new p.IntPoint(p.ClipperOffset.Round(this.m_srcPoly[c].X+this.m_normals[c].X*e),p.ClipperOffset.Round(this.m_srcPoly[c].Y+this.m_normals[c].Y*e)),this.m_destPoly.push(y),y=new p.IntPoint(p.ClipperOffset.Round(this.m_srcPoly[c].X-this.m_normals[c].X*e),p.ClipperOffset.Round(this.m_srcPoly[c].Y-this.m_normals[c].Y*e)),this.m_destPoly.push(y)}else{var c=o-1;d=o-2,this.m_sinA=0,this.m_normals[c]=new p.DoublePoint(-this.m_normals[c].X,-this.m_normals[c].Y),r.m_endtype==p.EndType.etOpenSquare?this.DoSquare(c,d):this.DoRound(c,d)}for(var c=o-1;c>0;c--)this.m_normals[c]=new p.DoublePoint(-this.m_normals[c-1].X,-this.m_normals[c-1].Y);this.m_normals[0]=new p.DoublePoint(-this.m_normals[1].X,-this.m_normals[1].Y),d=o-1;for(var c=d-1;c>0;--c)d=this.OffsetPoint(c,d,r.m_jointype);r.m_endtype==p.EndType.etOpenButt?(y=new p.IntPoint(p.ClipperOffset.Round(this.m_srcPoly[0].X-this.m_normals[0].X*e),p.ClipperOffset.Round(this.m_srcPoly[0].Y-this.m_normals[0].Y*e)),this.m_destPoly.push(y),y=new p.IntPoint(p.ClipperOffset.Round(this.m_srcPoly[0].X+this.m_normals[0].X*e),p.ClipperOffset.Round(this.m_srcPoly[0].Y+this.m_normals[0].Y*e)),this.m_destPoly.push(y)):(d=1,this.m_sinA=0,r.m_endtype==p.EndType.etOpenSquare?this.DoSquare(0,1):this.DoRound(0,1)),this.m_destPolys.push(this.m_destPoly)}}}};p.ClipperOffset.prototype.Execute=function(){var e=arguments,t=e[0]instanceof p.PolyTree;if(t){var r=e[0],i=e[1];r.Clear(),this.FixOrientations(),this.DoOffset(i);var n=new p.Clipper(0);if(n.AddPaths(this.m_destPolys,p.PolyType.ptSubject,!0),i>0)n.Execute(p.ClipType.ctUnion,r,p.PolyFillType.pftPositive,p.PolyFillType.pftPositive);else{var o=p.Clipper.GetBounds(this.m_destPolys),a=new p.Path;if(a.push(new p.IntPoint(o.left-10,o.bottom+10)),a.push(new p.IntPoint(o.right+10,o.bottom+10)),a.push(new p.IntPoint(o.right+10,o.top-10)),a.push(new p.IntPoint(o.left-10,o.top-10)),n.AddPath(a,p.PolyType.ptSubject,!0),n.ReverseSolution=!0,n.Execute(p.ClipType.ctUnion,r,p.PolyFillType.pftNegative,p.PolyFillType.pftNegative),r.ChildCount()==1&&r.Childs()[0].ChildCount()>0){var l=r.Childs()[0];r.Childs()[0]=l.Childs()[0];for(var c=1;c<l.ChildCount();c++)r.AddChild(l.Childs()[c])}else r.Clear()}}else{var r=e[0],i=e[1];p.Clear(r),this.FixOrientations(),this.DoOffset(i);var n=new p.Clipper(0);if(n.AddPaths(this.m_destPolys,p.PolyType.ptSubject,!0),i>0)n.Execute(p.ClipType.ctUnion,r,p.PolyFillType.pftPositive,p.PolyFillType.pftPositive);else{var o=p.Clipper.GetBounds(this.m_destPolys),a=new p.Path;a.push(new p.IntPoint(o.left-10,o.bottom+10)),a.push(new p.IntPoint(o.right+10,o.bottom+10)),a.push(new p.IntPoint(o.right+10,o.top-10)),a.push(new p.IntPoint(o.left-10,o.top-10)),n.AddPath(a,p.PolyType.ptSubject,!0),n.ReverseSolution=!0,n.Execute(p.ClipType.ctUnion,r,p.PolyFillType.pftNegative,p.PolyFillType.pftNegative),r.length>0&&r.splice(0,1)}}};p.ClipperOffset.prototype.OffsetPoint=function(e,t,r){if(this.m_sinA=this.m_normals[t].X*this.m_normals[e].Y-this.m_normals[e].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 p.IntPoint(p.ClipperOffset.Round(this.m_srcPoly[e].X+this.m_normals[t].X*this.m_delta),p.ClipperOffset.Round(this.m_srcPoly[e].Y+this.m_normals[t].Y*this.m_delta))),this.m_destPoly.push(new p.IntPoint(this.m_srcPoly[e])),this.m_destPoly.push(new p.IntPoint(p.ClipperOffset.Round(this.m_srcPoly[e].X+this.m_normals[e].X*this.m_delta),p.ClipperOffset.Round(this.m_srcPoly[e].Y+this.m_normals[e].Y*this.m_delta)));else switch(r){case p.JoinType.jtMiter:{var i=1+(this.m_normals[e].X*this.m_normals[t].X+this.m_normals[e].Y*this.m_normals[t].Y);i>=this.m_miterLim?this.DoMiter(e,t,i):this.DoSquare(e,t);break}case p.JoinType.jtSquare:this.DoSquare(e,t);break;case p.JoinType.jtRound:this.DoRound(e,t);break}return t=e,t};p.ClipperOffset.prototype.DoSquare=function(e,t){var r=Math.tan(Math.atan2(this.m_sinA,this.m_normals[t].X*this.m_normals[e].X+this.m_normals[t].Y*this.m_normals[e].Y)/4);this.m_destPoly.push(new p.IntPoint(p.ClipperOffset.Round(this.m_srcPoly[e].X+this.m_delta*(this.m_normals[t].X-this.m_normals[t].Y*r)),p.ClipperOffset.Round(this.m_srcPoly[e].Y+this.m_delta*(this.m_normals[t].Y+this.m_normals[t].X*r)))),this.m_destPoly.push(new p.IntPoint(p.ClipperOffset.Round(this.m_srcPoly[e].X+this.m_delta*(this.m_normals[e].X+this.m_normals[e].Y*r)),p.ClipperOffset.Round(this.m_srcPoly[e].Y+this.m_delta*(this.m_normals[e].Y-this.m_normals[e].X*r))))};p.ClipperOffset.prototype.DoMiter=function(e,t,r){var i=this.m_delta/r;this.m_destPoly.push(new p.IntPoint(p.ClipperOffset.Round(this.m_srcPoly[e].X+(this.m_normals[t].X+this.m_normals[e].X)*i),p.ClipperOffset.Round(this.m_srcPoly[e].Y+(this.m_normals[t].Y+this.m_normals[e].Y)*i)))};p.ClipperOffset.prototype.DoRound=function(e,t){for(var r=Math.atan2(this.m_sinA,this.m_normals[t].X*this.m_normals[e].X+this.m_normals[t].Y*this.m_normals[e].Y),i=p.Cast_Int32(p.ClipperOffset.Round(this.m_StepsPerRad*Math.abs(r))),n=this.m_normals[t].X,o=this.m_normals[t].Y,a,l=0;l<i;++l)this.m_destPoly.push(new p.IntPoint(p.ClipperOffset.Round(this.m_srcPoly[e].X+n*this.m_delta),p.ClipperOffset.Round(this.m_srcPoly[e].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 p.IntPoint(p.ClipperOffset.Round(this.m_srcPoly[e].X+this.m_normals[e].X*this.m_delta),p.ClipperOffset.Round(this.m_srcPoly[e].Y+this.m_normals[e].Y*this.m_delta)))};p.Error=function(e){try{throw new Error(e)}catch(t){alert(t.message)}};p.JS={};p.JS.AreaOfPolygon=function(e,t){return t||(t=1),p.Clipper.Area(e)/(t*t)};p.JS.AreaOfPolygons=function(e,t){t||(t=1);for(var r=0,i=0;i<e.length;i++)r+=p.Clipper.Area(e[i]);return r/(t*t)};p.JS.BoundsOfPath=function(e,t){return p.JS.BoundsOfPaths([e],t)};p.JS.BoundsOfPaths=function(e,t){t||(t=1);var r=p.Clipper.GetBounds(e);return r.left/=t,r.bottom/=t,r.right/=t,r.top/=t,r};p.JS.Clean=function(i,t){if(!(i instanceof Array))return[];var r=i[0]instanceof Array,i=p.JS.Clone(i);if(typeof t!="number"||t===null)return p.Error("Delta is not a number in Clean()."),i;if(i.length===0||i.length==1&&i[0].length===0||t<0)return i;r||(i=[i]);for(var n=i.length,o,a,l,c,h,d,m,y=[],x=0;x<n;x++)if(a=i[x],o=a.length,o!==0){if(o<3){l=a,y.push(l);continue}for(l=a,c=t*t,h=a[0],d=1,m=1;m<o;m++)(a[m].X-h.X)*(a[m].X-h.X)+(a[m].Y-h.Y)*(a[m].Y-h.Y)<=c||(l[d]=a[m],h=a[m],d++);h=a[d-1],(a[0].X-h.X)*(a[0].X-h.X)+(a[0].Y-h.Y)*(a[0].Y-h.Y)<=c&&d--,d<o&&l.splice(d,o-d),l.length&&y.push(l)}return!r&&y.length?y=y[0]:!r&&y.length===0?y=[]:r&&y.length===0&&(y=[[]]),y};p.JS.Clone=function(e){if(!(e instanceof Array))return[];if(e.length===0)return[];if(e.length==1&&e[0].length===0)return[[]];var t=e[0]instanceof Array;t||(e=[e]);var r=e.length,i,n,o,a,l=new Array(r);for(n=0;n<r;n++){for(i=e[n].length,a=new Array(i),o=0;o<i;o++)a[o]={X:e[n][o].X,Y:e[n][o].Y};l[n]=a}return t||(l=l[0]),l};p.JS.Lighten=function(e,t){if(!(e instanceof Array))return[];if(typeof t!="number"||t===null)return p.Error("Tolerance is not a number in Lighten()."),p.JS.Clone(e);if(e.length===0||e.length==1&&e[0].length===0||t<0)return p.JS.Clone(e);e[0]instanceof Array||(e=[e]);var r,i,n,o,a,l,c,h,d,m,y,x,S,P,g,C,T,M=e.length,I=t*t,_=[];for(r=0;r<M;r++)if(n=e[r],l=n.length,l!=0){for(o=0;o<1e6;o++){for(a=[],l=n.length,n[l-1].X!=n[0].X||n[l-1].Y!=n[0].Y?(x=1,n.push({X:n[0].X,Y:n[0].Y}),l=n.length):x=0,y=[],i=0;i<l-2;i++)c=n[i],d=n[i+1],h=n[i+2],C=c.X,T=c.Y,S=h.X-C,P=h.Y-T,(S!==0||P!==0)&&(g=((d.X-C)*S+(d.Y-T)*P)/(S*S+P*P),g>1?(C=h.X,T=h.Y):g>0&&(C+=S*g,T+=P*g)),S=d.X-C,P=d.Y-T,m=S*S+P*P,m<=I&&(y[i+1]=1,i++);for(a.push({X:n[0].X,Y:n[0].Y}),i=1;i<l-1;i++)y[i]||a.push({X:n[i].X,Y:n[i].Y});if(a.push({X:n[l-1].X,Y:n[l-1].Y}),x&&n.pop(),y.length)n=a;else break}l=a.length,a[l-1].X==a[0].X&&a[l-1].Y==a[0].Y&&a.pop(),a.length>2&&_.push(a)}return!e[0]instanceof Array&&(_=_[0]),typeof _>"u"&&(_=[[]]),_};p.JS.PerimeterOfPath=function(e,t,r){if(typeof e>"u")return 0;var i=Math.sqrt,n=0,o,a,l=0,c=0,h=0,d=0,m=e.length;if(m<2)return 0;for(t&&(e[m]=e[0],m++);--m;)o=e[m],l=o.X,c=o.Y,a=e[m-1],h=a.X,d=a.Y,n+=i((l-h)*(l-h)+(c-d)*(c-d));return t&&e.pop(),n/r};p.JS.PerimeterOfPaths=function(e,t,r){r||(r=1);for(var i=0,n=0;n<e.length;n++)i+=p.JS.PerimeterOfPath(e[n],t,r);return i};p.JS.ScaleDownPath=function(e,t){var r,i;for(t||(t=1),r=e.length;r--;)i=e[r],i.X=i.X/t,i.Y=i.Y/t};p.JS.ScaleDownPaths=function(e,t){var r,i,n,o=Math.round;for(t||(t=1),r=e.length;r--;)for(i=e[r].length;i--;)n=e[r][i],n.X=n.X/t,n.Y=n.Y/t};p.JS.ScaleUpPath=function(e,t){var r,i,n=Math.round;for(t||(t=1),r=e.length;r--;)i=e[r],i.X=n(i.X*t),i.Y=n(i.Y*t)};p.JS.ScaleUpPaths=function(e,t){var r,i,n,o=Math.round;for(t||(t=1),r=e.length;r--;)for(i=e[r].length;i--;)n=e[r][i],n.X=o(n.X*t),n.Y=o(n.Y*t)};p.ExPolygons=function(){return[]};p.ExPolygon=function(){this.outer=null,this.holes=null};p.JS.AddOuterPolyNodeToExPolygons=function(e,t){var r=new p.ExPolygon;r.outer=e.Contour();var i=e.Childs(),n=i.length;r.holes=new Array(n);var o,a,l,c,h,d;for(l=0;l<n;l++)for(o=i[l],r.holes[l]=o.Contour(),c=0,h=o.Childs(),d=h.length;c<d;c++)a=h[c],p.JS.AddOuterPolyNodeToExPolygons(a,t);t.push(r)};p.JS.ExPolygonsToPaths=function(e){var t,r,i,n,o=new p.Paths;for(t=0,i=e.length;t<i;t++)for(o.push(e[t].outer),r=0,n=e[t].holes.length;r<n;r++)o.push(e[t].holes[r]);return o};p.JS.PolyTreeToExPolygons=function(e){var t=new p.ExPolygons,r,i,n,o;for(i=0,n=e.Childs(),o=n.length;i<o;i++)r=n[i],p.JS.AddOuterPolyNodeToExPolygons(r,t);return t};ha.exports=p});var Gn=N((Sf,Pf)=>{f();var Mf=s(function(){this._tweens={},this._tweensAddedDuringUpdate={}},"_Group");Mf.prototype={getAll:function(){return Object.keys(this._tweens).map(function(e){return this._tweens[e]}.bind(this))},removeAll:function(){this._tweens={}},add:function(e){this._tweens[e.getId()]=e,this._tweensAddedDuringUpdate[e.getId()]=e},remove:function(e){delete this._tweens[e.getId()],delete this._tweensAddedDuringUpdate[e.getId()]},update:function(e,t){var r=Object.keys(this._tweens);if(r.length===0)return!1;for(e=e!==void 0?e:it.now();r.length>0;){this._tweensAddedDuringUpdate={};for(var i=0;i<r.length;i++){var n=this._tweens[r[i]];n&&n.update(e)===!1&&(n._isPlaying=!1,t||delete this._tweens[r[i]])}r=Object.keys(this._tweensAddedDuringUpdate)}return!0}};var it=new Mf;it.Group=Mf;it._nextId=0;it.nextId=function(){return it._nextId++};typeof self>"u"&&typeof b<"u"&&b.hrtime?it.now=function(){var e=b.hrtime();return e[0]*1e3+e[1]/1e6}:typeof self<"u"&&self.performance!==void 0&&self.performance.now!==void 0?it.now=self.performance.now.bind(self.performance):Date.now!==void 0?it.now=Date.now:it.now=function(){return new Date().getTime()};it.Tween=function(e,t){this._object=e,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=it.Easing.Linear.None,this._interpolationFunction=it.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||it,this._id=it.nextId()};it.Tween.prototype={getId:function(){return this._id},isPlaying:function(){return this._isPlaying},to:function(e,t){return this._valuesEnd=e,t!==void 0&&(this._duration=t),this},duration:s(function(t){return this._duration=t,this},"duration"),start:function(e){this._group.add(this),this._isPlaying=!0,this._onStartCallbackFired=!1,this._startTime=e!==void 0?typeof e=="string"?it.now()+parseFloat(e):e:it.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 e=0,t=this._chainedTweens.length;e<t;e++)this._chainedTweens[e].stop()},group:function(e){return this._group=e,this},delay:function(e){return this._delayTime=e,this},repeat:function(e){return this._repeat=e,this},repeatDelay:function(e){return this._repeatDelayTime=e,this},yoyo:function(e){return this._yoyo=e,this},easing:function(e){return this._easingFunction=e,this},interpolation:function(e){return this._interpolationFunction=e,this},chain:function(){return this._chainedTweens=arguments,this},onStart:function(e){return this._onStartCallback=e,this},onUpdate:function(e){return this._onUpdateCallback=e,this},onRepeat:s(function(t){return this._onRepeatCallback=t,this},"onRepeat"),onComplete:function(e){return this._onCompleteCallback=e,this},onStop:function(e){return this._onStopCallback=e,this},update:function(e){var t,r,i;if(e<this._startTime)return!0;this._onStartCallbackFired===!1&&(this._onStartCallback!==null&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),r=(e-this._startTime)/this._duration,r=this._duration===0||r>1?1:r,i=this._easingFunction(r);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,r),r===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=e+this._repeatDelayTime:this._startTime=e+this._delayTime,this._onRepeatCallback!==null&&this._onRepeatCallback(this._object),!0}else{this._onCompleteCallback!==null&&this._onCompleteCallback(this._object);for(var l=0,c=this._chainedTweens.length;l<c;l++)this._chainedTweens[l].start(this._startTime+this._duration);return!1}return!0}};it.Easing={Linear:{None:function(e){return e}},Quadratic:{In:function(e){return e*e},Out:function(e){return e*(2-e)},InOut:function(e){return(e*=2)<1?.5*e*e:-.5*(--e*(e-2)-1)}},Cubic:{In:function(e){return e*e*e},Out:function(e){return--e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e:.5*((e-=2)*e*e+2)}},Quartic:{In:function(e){return e*e*e*e},Out:function(e){return 1- --e*e*e*e},InOut:function(e){return(e*=2)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2)}},Quintic:{In:function(e){return e*e*e*e*e},Out:function(e){return--e*e*e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2)}},Sinusoidal:{In:function(e){return 1-Math.cos(e*Math.PI/2)},Out:function(e){return Math.sin(e*Math.PI/2)},InOut:function(e){return .5*(1-Math.cos(Math.PI*e))}},Exponential:{In:function(e){return e===0?0:Math.pow(1024,e-1)},Out:function(e){return e===1?1:1-Math.pow(2,-10*e)},InOut:function(e){return e===0?0:e===1?1:(e*=2)<1?.5*Math.pow(1024,e-1):.5*(-Math.pow(2,-10*(e-1))+2)}},Circular:{In:function(e){return 1-Math.sqrt(1-e*e)},Out:function(e){return Math.sqrt(1- --e*e)},InOut:function(e){return(e*=2)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1)}},Elastic:{In:function(e){return e===0?0:e===1?1:-Math.pow(2,10*(e-1))*Math.sin((e-1.1)*5*Math.PI)},Out:function(e){return e===0?0:e===1?1:Math.pow(2,-10*e)*Math.sin((e-.1)*5*Math.PI)+1},InOut:function(e){return e===0?0:e===1?1:(e*=2,e<1?-.5*Math.pow(2,10*(e-1))*Math.sin((e-1.1)*5*Math.PI):.5*Math.pow(2,-10*(e-1))*Math.sin((e-1.1)*5*Math.PI)+1)}},Back:{In:function(e){var t=1.70158;return e*e*((t+1)*e-t)},Out:function(e){var t=1.70158;return--e*e*((t+1)*e+t)+1},InOut:function(e){var t=2.5949095;return(e*=2)<1?.5*(e*e*((t+1)*e-t)):.5*((e-=2)*e*((t+1)*e+t)+2)}},Bounce:{In:function(e){return 1-it.Easing.Bounce.Out(1-e)},Out:function(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375},InOut:function(e){return e<.5?it.Easing.Bounce.In(e*2)*.5:it.Easing.Bounce.Out(e*2-1)*.5+.5}}};it.Interpolation={Linear:function(e,t){var r=e.length-1,i=r*t,n=Math.floor(i),o=it.Interpolation.Utils.Linear;return t<0?o(e[0],e[1],i):t>1?o(e[r],e[r-1],r-i):o(e[n],e[n+1>r?r:n+1],i-n)},Bezier:function(e,t){for(var r=0,i=e.length-1,n=Math.pow,o=it.Interpolation.Utils.Bernstein,a=0;a<=i;a++)r+=n(1-t,i-a)*n(t,a)*e[a]*o(i,a);return r},CatmullRom:function(e,t){var r=e.length-1,i=r*t,n=Math.floor(i),o=it.Interpolation.Utils.CatmullRom;return e[0]===e[r]?(t<0&&(n=Math.floor(i=r*(1+t))),o(e[(n-1+r)%r],e[n],e[(n+1)%r],e[(n+2)%r],i-n)):t<0?e[0]-(o(e[0],e[0],e[1],e[1],-i)-e[0]):t>1?e[r]-(o(e[r],e[r],e[r-1],e[r-1],i-r)-e[r]):o(e[n?n-1:0],e[n],e[r<n+1?r:n+1],e[r<n+2?r:n+2],i-n)},Utils:{Linear:function(e,t,r){return(t-e)*r+e},Bernstein:function(e,t){var r=it.Interpolation.Utils.Factorial;return r(e)/r(t)/r(e-t)},Factorial:function(){var e=[1];return function(t){var r=1;if(e[t])return e[t];for(var i=t;i>1;i--)r*=i;return e[t]=r,r}}(),CatmullRom:function(e,t,r,i,n){var o=(r-e)*.5,a=(i-t)*.5,l=n*n,c=n*l;return(2*t-2*r+o+a)*c+(-3*t+3*r-2*o-a)*l+o*n+t}}};(function(e){typeof define=="function"&&define.amd?define([],function(){return it}):typeof Pf<"u"&&typeof Sf=="object"?Pf.exports=it:e!==void 0&&(e.TWEEN=it)})(Sf)});f();f();var zc=new WeakMap,Bt,qc=class qc{constructor(t){w(this,Bt,void 0);E(this,Bt,t),zc.set(this,t)}get mapName(){return u(this,Bt).mapName}get mapCenter(){return u(this,Bt).mapCenter}get organizationId(){return u(this,Bt).organizationId}get outdoorViewToken(){return u(this,Bt).outdoorViewToken}getByType(t){switch(t){case"space":return u(this,Bt).spaces;case"door":return u(this,Bt).doors;case"floor":return u(this,Bt).floors;case"connection":return u(this,Bt).connections;case"object":return u(this,Bt).objects;case"point-of-interest":return u(this,Bt).pointsOfInterest;case"annotation":return u(this,Bt).annotations;default:return[]}}getById(t,r){return u(this,Bt).getById(t,r)}};Bt=new WeakMap,s(qc,"MapData");var Uc=qc,Zc=Uc;f();f();f();var _3={logState:0,log(...e){this.logState<=0&&console.log("[MappedInJS]",...e)},warn(...e){this.logState<=1&&console.warn("[MappedInJS]",...e)},error(...e){this.logState<=2&&console.error("[MappedInJS]",...e)},assert(...e){console.assert(...e)},time(e){console.time(e)},timeEnd(e){console.timeEnd(e)}},X=_3;f();var mm=["connection.json","manifest.geojson","map.geojson","node.geojson","styles.json","mapstack.geojson"];var ym=globalThis.fetch,gm,PM=(gm=b==null?void 0:b.env)==null?void 0:gm.npm_package_version;function $c(){if(ym==null)throw new Error("fetch is not available in your environment. Pass your own function into `setFetchFn` (node-fetch, etc)");return ym}s($c,"isomorphicFetch");async function Jc(e,t){return new Promise(async(r,i)=>{try{let{url:n}=await L3(e,t),o=await $c()(n).then(l=>l.arrayBuffer()),a=new Uint8Array(o);r(a)}catch(n){i(n)}})}s(Jc,"downloadMVF");function vm(e){return e.endsWith("/")?e:`${e}/`}s(vm,"normalizeUrl");async function L3(e,t){let r=`${e.bundleBaseUri?vm(e.bundleBaseUri):"https://app.mappedin.com/"}api/venue/${e.mapId}/mvf`,i=await $c()(r,{headers:{Authorization:`Bearer ${t}`}});if(!i.ok)throw new Error(`${i.status} ${i.statusText}`);return i.json()}s(L3,"getMakerBundleURL");async function ds(e){let t=`${e.authBaseUri?vm(e.authBaseUri):"https://auth-maker.mappedin.com/"}api-key/token`,r=await $c()(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:e.key,secret:e.secret})});if(!r.ok)throw new Error(`${r.status} ${r.statusText}`);return r.json()}s(ds,"getAccessToken");function Kc(e){let t=new TextDecoder,r=t.decode.bind(t);try{let i={"connection.json":JSON.parse(r(e["connection.json"])),"manifest.geojson":JSON.parse(r(e["manifest.geojson"])),"styles.json":JSON.parse(r(e["styles.json"])),"map.geojson":JSON.parse(r(e["map.geojson"])),"mapstack.geojson":JSON.parse(r(e["mapstack.geojson"])),"node.geojson":JSON.parse(r(e["node.geojson"])),obstruction:{},space:{},entrance:{},annotation:{}};if(e.annotation!=null){let l=Object.keys(e.annotation);for(let c of l){let h=c.replace(/\.json|\.geojson/g,"");i.annotation[h]=JSON.parse(r(e.annotation[c]))}}let n=Object.keys(e.space);for(let l of n){let c=l.replace(/\.json|\.geojson/g,"");i.space[c]=JSON.parse(r(e.space[l]))}let o=Object.keys(e.obstruction);for(let l of o){let c=l.replace(/\.json|\.geojson/g,"");i.obstruction[c]=JSON.parse(r(e.obstruction[l]))}let a=Object.keys(e.entrance);for(let l of a){let c=l.replace(/\.json|\.geojson/g,"");i.entrance[c]=JSON.parse(r(e.entrance[l]))}return i}catch(i){throw X.error(i),new Error("MVF parsing failed! Probably encountered a bad file.")}}s(Kc,"parseMVF");function O3(e){if(e==null||typeof e!="object")return!1;for(let t of mm)if(e[t][Symbol.toStringTag]!=="Uint8Array")return!1;return!0}s(O3,"validateStaticMVFFiles");async function Qc(e){return new Promise(async(t,r)=>{try{if(e==null||typeof e!="object")throw new Error("Error parsing data! Unzipping failed.");if(e[Symbol.toStringTag]!=="Uint8Array")throw new Error("Unexpected file type! Unzipping failed.");let n=(await import("./browser-7SS6EBDE.js")).unzipSync(e);if(!O3(n))throw new Error("MVF is missing some expect static files. Unzipping failed.");let o={"connection.json":n["connection.json"],"manifest.geojson":n["manifest.geojson"],"node.geojson":n["node.geojson"],"map.geojson":n["map.geojson"],"mapstack.geojson":n["mapstack.geojson"],"styles.json":n["styles.json"],space:{},obstruction:{},entrance:{}},a=Object.keys(n);for(let l of a){if(n[l].length===0)continue;let c=l.split("/");if(c.length<0)throw new Error("Encounted a file with no name! Unzipping failed.");if(c.length>2)throw new Error("Encountered unexpected nesting in MVF! Unzipping failed.");if(c.length!==1)if(c[0]==="image"){X.warn("MVF unzipping encountered an image. Ignoring as this case has not been implemented.");continue}else o[c[0]]==null&&(o[c[0]]={}),o[c[0]][c[1]]=n[l]}t(o)}catch(i){r(i)}})}s(Qc,"unzipMVF");f();f();f();f();var Wt=63710088e-1,bm={centimeters:Wt*100,centimetres:Wt*100,degrees:Wt/111325,feet:Wt*3.28084,inches:Wt*39.37,kilometers:Wt/1e3,kilometres:Wt/1e3,meters:Wt,metres:Wt,miles:Wt/1609.344,millimeters:Wt*1e3,millimetres:Wt*1e3,nauticalmiles:Wt/1852,radians:1,yards:Wt*1.0936},IM={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/Wt,yards:1.0936133};function wr(e,t,r){r===void 0&&(r={});var i={type:"Feature"};return(r.id===0||r.id)&&(i.id=r.id),r.bbox&&(i.bbox=r.bbox),i.properties=t||{},i.geometry=e,i}s(wr,"feature");function xe(e,t,r){if(r===void 0&&(r={}),!e)throw new Error("coordinates is required");if(!Array.isArray(e))throw new Error("coordinates must be an Array");if(e.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!tu(e[0])||!tu(e[1]))throw new Error("coordinates must contain numbers");var i={type:"Point",coordinates:e};return wr(i,t,r)}s(xe,"point");function Ke(e,t,r){if(r===void 0&&(r={}),e.length<2)throw new Error("coordinates must be an array of two or more positions");var i={type:"LineString",coordinates:e};return wr(i,t,r)}s(Ke,"lineString");function ao(e,t){t===void 0&&(t={});var r={type:"FeatureCollection"};return t.id&&(r.id=t.id),t.bbox&&(r.bbox=t.bbox),r.features=e,r}s(ao,"featureCollection");function Cm(e,t){t===void 0&&(t="kilometers");var r=bm[t];if(!r)throw new Error(t+" units is invalid");return e*r}s(Cm,"radiansToLength");function xm(e,t){t===void 0&&(t="kilometers");var r=bm[t];if(!r)throw new Error(t+" units is invalid");return e/r}s(xm,"lengthToRadians");function so(e){var t=e%(2*Math.PI);return t*180/Math.PI}s(so,"radiansToDegrees");function te(e){var t=e%360;return t*Math.PI/180}s(te,"degreesToRadians");function tu(e){return!isNaN(e)&&e!==null&&!Array.isArray(e)}s(tu,"isNumber");function Fe(e){if(!e)throw new Error("coord is required");if(!Array.isArray(e)){if(e.type==="Feature"&&e.geometry!==null&&e.geometry.type==="Point")return e.geometry.coordinates;if(e.type==="Point")return e.coordinates}if(Array.isArray(e)&&e.length>=2&&!Array.isArray(e[0])&&!Array.isArray(e[1]))return e;throw new Error("coord must be GeoJSON Point or an Array of numbers")}s(Fe,"getCoord");function se(e){if(Array.isArray(e))return e;if(e.type==="Feature"){if(e.geometry!==null)return e.geometry.coordinates}else if(e.coordinates)return e.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}s(se,"getCoords");function Sm(e,t){return e.type==="FeatureCollection"?"FeatureCollection":e.type==="GeometryCollection"?"GeometryCollection":e.type==="Feature"&&e.geometry!==null?e.geometry.type:e.type}s(Sm,"getType");function D3(e,t,r){r===void 0&&(r={});for(var i=Fe(e),n=se(t),o=0;o<n.length-1;o++){var a=!1;if(r.ignoreEndVertices&&(o===0&&(a="start"),o===n.length-2&&(a="end"),o===0&&o+1===n.length-1&&(a="both")),A3(n[o],n[o+1],i,a,typeof r.epsilon>"u"?null:r.epsilon))return!0}return!1}s(D3,"booleanPointOnLine");function A3(e,t,r,i,n){var o=r[0],a=r[1],l=e[0],c=e[1],h=t[0],d=t[1],m=r[0]-l,y=r[1]-c,x=h-l,S=d-c,P=m*S-y*x;if(n!==null){if(Math.abs(P)>n)return!1}else if(P!==0)return!1;if(i){if(i==="start")return Math.abs(x)>=Math.abs(S)?x>0?l<o&&o<=h:h<=o&&o<l:S>0?c<a&&a<=d:d<=a&&a<c;if(i==="end")return Math.abs(x)>=Math.abs(S)?x>0?l<=o&&o<h:h<o&&o<=l:S>0?c<=a&&a<d:d<a&&a<=c;if(i==="both")return Math.abs(x)>=Math.abs(S)?x>0?l<o&&o<h:h<o&&o<l:S>0?c<a&&a<d:d<a&&a<c}else return Math.abs(x)>=Math.abs(S)?x>0?l<=o&&o<=h:h<=o&&o<=l:S>0?c<=a&&a<=d:d<=a&&a<=c;return!1}s(A3,"isPointOnLineSegment");var Pm=D3;f();f();f();function ms(e,t,r){if(e!==null)for(var i,n,o,a,l,c,h,d=0,m=0,y,x=e.type,S=x==="FeatureCollection",P=x==="Feature",g=S?e.features.length:1,C=0;C<g;C++){h=S?e.features[C].geometry:P?e.geometry:e,y=h?h.type==="GeometryCollection":!1,l=y?h.geometries.length:1;for(var T=0;T<l;T++){var M=0,I=0;if(a=y?h.geometries[T]:h,a!==null){c=a.coordinates;var _=a.type;switch(d=r&&(_==="Polygon"||_==="MultiPolygon")?1:0,_){case null:break;case"Point":if(t(c,m,C,M,I)===!1)return!1;m++,M++;break;case"LineString":case"MultiPoint":for(i=0;i<c.length;i++){if(t(c[i],m,C,M,I)===!1)return!1;m++,_==="MultiPoint"&&M++}_==="LineString"&&M++;break;case"Polygon":case"MultiLineString":for(i=0;i<c.length;i++){for(n=0;n<c[i].length-d;n++){if(t(c[i][n],m,C,M,I)===!1)return!1;m++}_==="MultiLineString"&&M++,_==="Polygon"&&I++}_==="Polygon"&&M++;break;case"MultiPolygon":for(i=0;i<c.length;i++){for(I=0,n=0;n<c[i].length;n++){for(o=0;o<c[i][n].length-d;o++){if(t(c[i][n][o],m,C,M,I)===!1)return!1;m++}I++}M++}break;case"GeometryCollection":for(i=0;i<a.geometries.length;i++)if(ms(a.geometries[i],t,r)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}s(ms,"coordEach");function eu(e,t){if(e.type==="Feature")t(e,0);else if(e.type==="FeatureCollection")for(var r=0;r<e.features.length&&t(e.features[r],r)!==!1;r++);}s(eu,"featureEach");function N3(e,t){var r,i,n,o,a,l,c,h,d,m,y=0,x=e.type==="FeatureCollection",S=e.type==="Feature",P=x?e.features.length:1;for(r=0;r<P;r++){for(l=x?e.features[r].geometry:S?e.geometry:e,h=x?e.features[r].properties:S?e.properties:{},d=x?e.features[r].bbox:S?e.bbox:void 0,m=x?e.features[r].id:S?e.id:void 0,c=l?l.type==="GeometryCollection":!1,a=c?l.geometries.length:1,n=0;n<a;n++){if(o=c?l.geometries[n]:l,o===null){if(t(null,y,h,d,m)===!1)return!1;continue}switch(o.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(t(o,y,h,d,m)===!1)return!1;break}case"GeometryCollection":{for(i=0;i<o.geometries.length;i++)if(t(o.geometries[i],y,h,d,m)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}y++}}s(N3,"geomEach");function lo(e,t){N3(e,function(r,i,n,o,a){var l=r===null?null:r.type;switch(l){case null:case"Point":case"LineString":case"Polygon":return t(wr(r,n,{bbox:o,id:a}),i,0)===!1?!1:void 0}var c;switch(l){case"MultiPoint":c="Point";break;case"MultiLineString":c="LineString";break;case"MultiPolygon":c="Polygon";break}for(var h=0;h<r.coordinates.length;h++){var d=r.coordinates[h],m={type:c,coordinates:d};if(t(wr(m,n),i,h)===!1)return!1}})}s(lo,"flattenEach");function R3(e,t){lo(e,function(r,i,n){var o=0;if(r.geometry){var a=r.geometry.type;if(!(a==="Point"||a==="MultiPoint")){var l,c=0,h=0,d=0;if(ms(r,function(m,y,x,S,P){if(l===void 0||i>c||S>h||P>d){l=m,c=i,h=S,d=P,o=0;return}var g=Ke([l,m],r.properties);if(t(g,i,n,P,o)===!1)return!1;o++,l=m})===!1)return!1}}})}s(R3,"segmentEach");function Mm(e,t,r){var i=r,n=!1;return R3(e,function(o,a,l,c,h){n===!1&&r===void 0?i=o:i=t(i,o,a,l,c,h),n=!0}),i}s(Mm,"segmentReduce");function ru(e){var t=[1/0,1/0,-1/0,-1/0];return ms(e,function(r){t[0]>r[0]&&(t[0]=r[0]),t[1]>r[1]&&(t[1]=r[1]),t[2]<r[0]&&(t[2]=r[0]),t[3]<r[1]&&(t[3]=r[1])}),t}s(ru,"bbox");ru.default=ru;var wm=ru;function k3(e,t){t===void 0&&(t={});var r=wm(e),i=(r[0]+r[2])/2,n=(r[1]+r[3])/2;return xe([i,n],t.properties,t)}s(k3,"center");var Tm=k3;f();f();function F3(e,t,r){r===void 0&&(r={});var i=Fe(e),n=Fe(t),o=te(n[1]-i[1]),a=te(n[0]-i[0]),l=te(i[1]),c=te(n[1]),h=Math.pow(Math.sin(o/2),2)+Math.pow(Math.sin(a/2),2)*Math.cos(l)*Math.cos(c);return Cm(2*Math.atan2(Math.sqrt(h),Math.sqrt(1-h)),r.units)}s(F3,"distance");var Tr=F3;function ys(e,t){return t===void 0&&(t={}),Mm(e,function(r,i){var n=i.geometry.coordinates;return r+Tr(n[0],n[1],t)},0)}s(ys,"length");f();f();f();function gs(e,t,r){if(r===void 0&&(r={}),r.final===!0)return B3(e,t);var i=Fe(e),n=Fe(t),o=te(i[0]),a=te(n[0]),l=te(i[1]),c=te(n[1]),h=Math.sin(a-o)*Math.cos(c),d=Math.cos(l)*Math.sin(c)-Math.sin(l)*Math.cos(c)*Math.cos(a-o);return so(Math.atan2(h,d))}s(gs,"bearing");function B3(e,t){var r=gs(t,e);return r=(r+180)%360,r}s(B3,"calculateFinalBearing");f();function vs(e,t,r,i){i===void 0&&(i={});var n=Fe(e),o=te(n[0]),a=te(n[1]),l=te(r),c=xm(t,i.units),h=Math.asin(Math.sin(a)*Math.cos(c)+Math.cos(a)*Math.sin(c)*Math.cos(l)),d=o+Math.atan2(Math.sin(l)*Math.sin(c)*Math.cos(a),Math.cos(c)-Math.sin(a)*Math.sin(h)),m=so(d),y=so(h);return xe([m,y],i.properties)}s(vs,"destination");f();f();function G3(e){if(!e)throw new Error("geojson is required");var t=[];return lo(e,function(r){V3(r,t)}),ao(t)}s(G3,"lineSegment");function V3(e,t){var r=[],i=e.geometry;if(i!==null){switch(i.type){case"Polygon":r=se(i);break;case"LineString":r=[se(i)]}r.forEach(function(n){var o=H3(n,e.properties);o.forEach(function(a){a.id=t.length,t.push(a)})})}}s(V3,"lineSegmentFeature");function H3(e,t){var r=[];return e.reduce(function(i,n){var o=Ke([i,n],t);return o.bbox=X3(i,n),r.push(o),n}),r}s(H3,"createSegments");function X3(e,t){var r=e[0],i=e[1],n=t[0],o=t[1],a=r<n?r:n,l=i<o?i:o,c=r>n?r:n,h=i>o?i:o;return[a,l,c,h]}s(X3,"bbox");var iu=G3;var R2=Cr(A2(),1);function p6(e,t){var r={},i=[];if(e.type==="LineString"&&(e=wr(e)),t.type==="LineString"&&(t=wr(t)),e.type==="Feature"&&t.type==="Feature"&&e.geometry!==null&&t.geometry!==null&&e.geometry.type==="LineString"&&t.geometry.type==="LineString"&&e.geometry.coordinates.length===2&&t.geometry.coordinates.length===2){var n=N2(e,t);return n&&i.push(n),ao(i)}var o=(0,R2.default)();return o.load(iu(t)),eu(iu(e),function(a){eu(o.search(a),function(l){var c=N2(a,l);if(c){var h=se(c).join(",");r[h]||(r[h]=!0,i.push(c))}})}),ao(i)}s(p6,"lineIntersect");function N2(e,t){var r=se(e),i=se(t);if(r.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=r[0][0],o=r[0][1],a=r[1][0],l=r[1][1],c=i[0][0],h=i[0][1],d=i[1][0],m=i[1][1],y=(m-h)*(a-n)-(d-c)*(l-o),x=(d-c)*(o-h)-(m-h)*(n-c),S=(a-n)*(o-h)-(l-o)*(n-c);if(y===0)return null;var P=x/y,g=S/y;if(P>=0&&P<=1&&g>=0&&g<=1){var C=n+P*(a-n),T=o+P*(l-o);return xe([C,T])}return null}s(N2,"intersects");var k2=p6;function h6(e,t,r){r===void 0&&(r={});var i=xe([1/0,1/0],{dist:1/0}),n=0;return lo(e,function(o){for(var a=se(o),l=0;l<a.length-1;l++){var c=xe(a[l]);c.properties.dist=Tr(t,c,r);var h=xe(a[l+1]);h.properties.dist=Tr(t,h,r);var d=Tr(c,h,r),m=Math.max(c.properties.dist,h.properties.dist),y=gs(c,h),x=vs(t,m,y+90,r),S=vs(t,m,y-90,r),P=k2(Ke([x.geometry.coordinates,S.geometry.coordinates]),Ke([c.geometry.coordinates,h.geometry.coordinates])),g=null;P.features.length>0&&(g=P.features[0],g.properties.dist=Tr(t,g,r),g.properties.location=n+Tr(c,g,r)),c.properties.dist<i.properties.dist&&(i=c,i.properties.index=l,i.properties.location=n),h.properties.dist<i.properties.dist&&(i=h,i.properties.index=l+1,i.properties.location=n+d),g&&g.properties.dist<i.properties.dist&&(i=g,i.properties.index=l),n+=d}}),i}s(h6,"nearestPointOnLine");var Io=h6;function f6(e,t,r){var i=se(r);if(Sm(r)!=="LineString")throw new Error("line must be a LineString");var n=Io(r,e),o=Io(r,t),a;n.properties.index<=o.properties.index?a=[n,o]:a=[o,n];for(var l=[a[0].geometry.coordinates],c=a[0].properties.index+1;c<a[1].properties.index+1;c++)l.push(i[c]);return l.push(a[1].geometry.coordinates),Ke(l,r.properties)}s(f6,"lineSlice");var jp=f6;var d6=1e-7;function Wp(e){return{type:"Point",coordinates:e}}s(Wp,"point");function m6(e,t){let{coordinates:r}=t.geometry,{coordinates:i}=e.geometry,n=r.map(o=>Io(e,Wp(o)));return i.reduce((o,a)=>{let l=jp(Wp(a),n[0],e),c=jp(Wp(a),n[1],e),h=ys(l)<ys(c)?l:c;return h.properties={...e.properties,entrances:[]},o.concat([h])},[])}s(m6,"splitObstructionByEntrance");function Up(e,t){return t.reduce((r,i)=>{let n={epsilon:d6},o=r.findIndex(l=>Pm(Tm(i),l,n)),a=r[o];if(a){let[l,c]=m6(a,i);r.splice(o,1,l,c)}return r},[e])}s(Up,"splitObstructionByAllEntrances");f();f();f();f();var zp=[0,4,6,8,10],vt=s(()=>{let e=new Array(16).fill(0),t=Math.random()*4294967296;for(let i=0;i<e.length;i++)i>0&&!(i&3)&&(t=Math.random()*4294967296),e[i]=t>>>((i&3)<<3)&255;let r=e.map(i=>i.toString(16).padStart(2,"0"));return r[6]="4"+r[6][1],r[8]=["8","9","a","b"].includes(r[7][0])?r[7]:"a"+r[7][1],zp.map((i,n)=>r.slice(i,n===zp.length-1?void 0:zp[n+1]).join("")).join("-")},"randomId");var pn=class pn{__type=pn.__type;id=vt();latitude;longitude;floorId;static is(t){return t.__type===pn.__type}constructor(t,r,i){this.latitude=t,this.longitude=r,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(){}};s(pn,"Coordinate"),v(pn,"__type","coordinate");var Zp=pn,$=Zp;f();f();f();f();var qp=class qp{id;constructor(t){this.id=t}};s(qp,"BaseMetaData");var ni=qp;var _o,hn,Eo=class Eo extends ni{constructor(r){super(String(vt()));w(this,_o,{});w(this,hn,void 0);E(this,hn,r.mvfData)}static is(r){return r.__type===Eo.__type}get url(){return u(this,hn).url}get name(){return u(this,hn).displayName}toJSON(){return{id:this.id,url:this.url,name:this.name}}destroy(){for(let r of globalThis.Object.keys(u(this,_o)))delete u(this,_o)[r]}};_o=new WeakMap,hn=new WeakMap,s(Eo,"Hyperlink"),v(Eo,"__type","hyperlink");var $p=Eo,ml=$p;var Jp=class Jp{id;constructor(t,r){var n;this.id=t;let i=(n=r==null?void 0:r.links)!=null?n:[];i.length>0&&(this.links=i.map(o=>new ml({mvfData:o})))}links=[]};s(Jp,"BaseMapData");var It=Jp;var oi,rr,ai,Ar,fn=class fn extends It{constructor(r,i){super(i.mvfData.properties.id,i.mvfData.properties.details);v(this,"__type",fn.__type);w(this,oi,void 0);w(this,rr,void 0);w(this,ai,void 0);w(this,Ar,void 0);E(this,rr,{}),E(this,Ar,i.mvfData),E(this,oi,r),E(this,ai,i.floorId)}static is(r){return r.__type===fn.__type}get name(){var r,i;return(i=(r=u(this,Ar).properties.details)==null?void 0:r.name)!=null?i:""}get description(){var r,i;return(i=(r=u(this,Ar).properties.details)==null?void 0:r.description)!=null?i:""}get images(){var r,i;return(i=(r=u(this,Ar).properties.details)==null?void 0:r.images)!=null?i:[]}get floor(){let r=u(this,oi).getById("floor",u(this,ai));if(r==null)throw new Error(`Floor ${u(this,ai)} not found!`);return r}get center(){if(u(this,rr).center==null){let[[r,i],[n,o]]=u(this,Ar).geometry.coordinates,a=(r+n)/2,l=(i+o)/2;u(this,rr).center=new $(l,a,u(this,ai))}return u(this,rr).center}get isExterior(){var n;let r=u(this,oi).obstructionIdByEntranceId[this.id],i=u(this,oi).getMVFFeatureById("obstruction",r);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 r of Object.keys(u(this,rr)))delete u(this,rr)[r]}};oi=new WeakMap,rr=new WeakMap,ai=new WeakMap,Ar=new WeakMap,s(fn,"Door"),v(fn,"__type","door");var Kp=fn,Nr=Kp;f();var Lo,si,Rr,nr,dn=class dn extends It{constructor(r,i){super(i.mvfData.properties.id,i.mvfData.properties.details);v(this,"__type",dn.__type);w(this,Lo,void 0);w(this,si,void 0);w(this,Rr,{});w(this,nr,void 0);E(this,Lo,r),E(this,si,i.floorId),E(this,nr,i.mvfData)}static is(r){return r.__type===dn.__type}get name(){var i,n;let{properties:r}=u(this,nr);return(n=(i=r.details)==null?void 0:i.name)!=null?n:r.externalId}get type(){return g6(u(this,nr).properties.kind)}get description(){var r,i;return(i=(r=u(this,nr).properties.details)==null?void 0:r.description)!=null?i:""}get images(){var r,i;return(i=(r=u(this,nr).properties.details)==null?void 0:r.images)!=null?i:[]}get floor(){let r=u(this,Lo).getById("floor",u(this,si));if(r==null)throw new Error(`Floor ${u(this,si)} not found!`);return r}get center(){var r;if(u(this,Rr).center==null){let[i,n]=(r=u(this,nr).properties.center)!=null?r:[0,0];u(this,Rr).center=new $(n,i,u(this,si))}return u(this,Rr).center}toJSON(){return{id:this.id,name:this.name,type:this.type,floor:this.floor.id,center:this.center.toJSON()}}destroy(){for(let r of Object.keys(u(this,Rr)))delete u(this,Rr)[r]}};Lo=new WeakMap,si=new WeakMap,Rr=new WeakMap,nr=new WeakMap,s(dn,"Space"),v(dn,"__type","space");var Qp=dn,y6=["room","hallway","exterior","void","connection.stairs","connection.elevator","poi"];function g6(e){if(e==null||e==="default")return"room";let t=e.toLowerCase();return y6.includes(t)?t:"room"}s(g6,"validateSpaceType");var Me=Qp;f();var He,ft,yn,mn=class mn extends It{constructor(r,i){super(i.mvfData.id);v(this,"__type",mn.__type);w(this,He,void 0);w(this,ft,{});w(this,yn,void 0);E(this,He,r),E(this,yn,i.mvfData)}static is(r){return r.__type===mn.__type}get name(){return u(this,yn).externalId}get elevation(){return u(this,yn).elevation}get spaces(){if(u(this,ft).spaces==null){let r=u(this,He).spaces.filter(i=>i.floor.id===this.id);u(this,ft).spaces=r}return u(this,ft).spaces}get objects(){if(u(this,ft).objects==null){let r=u(this,He).objects.filter(i=>i.floor.id===this.id);u(this,ft).objects=r}return u(this,ft).objects}get connections(){if(u(this,ft).connections==null){let r=u(this,He).connections.filter(i=>i.floors.includes(this));u(this,ft).connections=r}return u(this,ft).connections}get doors(){if(u(this,ft).doors==null){let r=u(this,He).doors.filter(i=>i.floor.id===this.id);u(this,ft).doors=r}return u(this,ft).doors}get annotations(){if(u(this,ft).annotations==null){let r=u(this,He).annotations.filter(i=>i.floor.id===this.id);u(this,ft).annotations=r}return u(this,ft).annotations}get pois(){if(u(this,ft).pois==null){let r=u(this,He).pointsOfInterest.filter(i=>i.floor.id===this.id);u(this,ft).pois=r}return u(this,ft).pois}toJSON(){return{id:this.id,name:this.name,elevation:this.elevation,spaces:this.spaces.map(r=>r.id),objects:this.objects.map(r=>r.id),connections:this.connections.map(r=>r.id),doors:this.doors.map(r=>r.id),annotations:this.annotations.map(r=>r.id),pois:this.pois.map(r=>r.id)}}destroy(){for(let r of globalThis.Object.keys(u(this,ft)))delete u(this,ft)[r]}};He=new WeakMap,ft=new WeakMap,yn=new WeakMap,s(mn,"Floor"),v(mn,"__type","floor");var th=mn,yl=th;f();f();f();var eh=s(e=>e!=null,"notNull");f();function kr(e){let t;if(Me.is(e)||Nr.is(e)||we.is(e))t=e.center;else if(Fr.is(e)||gn.is(e))t=e.coordinate;else if($.is(e))t=e;else return;return t}s(kr,"getCoordinateFromStuffs");var Oo,or,ar,vn=class vn extends It{constructor(r,i){let n=Object.values(i.mvfDataByFloorId)[0];super(n.properties.id,n.properties.details);v(this,"__type",vn.__type);w(this,Oo,void 0);w(this,or,void 0);w(this,ar,void 0);E(this,or,{}),E(this,Oo,r),E(this,ar,i.mvfDataByFloorId)}static is(r){return r.__type===vn.__type}get name(){var r,i;return(i=(r=Object.values(u(this,ar))[0].properties.details)==null?void 0:r.name)!=null?i:""}get description(){var r,i;return(i=(r=Object.values(u(this,ar))[0].properties.details)==null?void 0:r.description)!=null?i:""}get images(){var r,i;return(i=(r=Object.values(u(this,ar))[0].properties.details)==null?void 0:r.images)!=null?i:[]}get type(){var r,i;return(i=(r=Object.values(u(this,ar))[0].properties.kind)==null?void 0:r.split(".")[1])!=null?i:"unknown"}get coordinates(){return u(this,or).coordinates==null&&(u(this,or).coordinates=Object.entries(u(this,ar)).map(([r,i])=>new $(i.geometry.coordinates[1],i.geometry.coordinates[0],r))),u(this,or).coordinates}get floors(){return this.coordinates.map(r=>r.floorId?u(this,Oo).getById("floor",r.floorId):void 0).filter(eh)}toJSON(){return{id:this.id,name:this.name,type:this.type,coordinates:this.coordinates.map(r=>r.toJSON()),floors:this.floors.map(r=>r.id)}}destroy(){for(let r of Object.keys(u(this,or)))delete u(this,or)[r]}};Oo=new WeakMap,or=new WeakMap,ar=new WeakMap,s(vn,"Connection"),v(vn,"__type","connection");var rh=vn,Br=rh;f();var Do,li,Gr,sr,bn=class bn extends It{constructor(r,i){super(i.mvfData.properties.id,i.mvfData.properties.details);v(this,"__type",bn.__type);w(this,Do,void 0);w(this,li,void 0);w(this,Gr,{});w(this,sr,void 0);E(this,Do,r),E(this,li,i.floorId),E(this,sr,i.mvfData)}static is(r){return r.__type===bn.__type}get name(){var r,i;return(i=(r=u(this,sr).properties.details)==null?void 0:r.name)!=null?i:""}get description(){var r,i;return(i=(r=u(this,sr).properties.details)==null?void 0:r.description)!=null?i:""}get images(){var r,i;return(i=(r=u(this,sr).properties.details)==null?void 0:r.images)!=null?i:[]}get type(){let r=u(this,sr).properties.kind;return r==null&&(r="object"),r==="Desks"&&(r="desk"),r.toLowerCase()}get floor(){let r=u(this,Do).getById("floor",u(this,li));if(r==null)throw new Error(`Floor ${u(this,li)} not found!`);return r}get center(){var r;if(u(this,Gr).center==null){let[i,n]=(r=u(this,sr).properties.center)!=null?r:[0,0];u(this,Gr).center=new $(n,i,u(this,li))}return u(this,Gr).center}toJSON(){return{id:this.id,name:this.name,type:this.type,floor:this.floor.id,center:this.center.toJSON()}}destroy(){for(let r of globalThis.Object.keys(u(this,Gr)))u(this,Gr)[r]=null}};Do=new WeakMap,li=new WeakMap,Gr=new WeakMap,sr=new WeakMap,s(bn,"MapObject"),v(bn,"__type","object");var ih=bn,we=ih;f();f();var No,Cn,Ao=class Ao extends ni{constructor(r){super(String(vt()));w(this,No,{});w(this,Cn,void 0);E(this,Cn,r.mvfData)}static is(r){return r.__type===Ao.__type}get url(){return u(this,Cn).url}get name(){return u(this,Cn).altText}toJSON(){return{id:this.id,url:this.url,name:this.name}}destroy(){for(let r of globalThis.Object.keys(u(this,No)))delete u(this,No)[r]}};No=new WeakMap,Cn=new WeakMap,s(Ao,"Image"),v(Ao,"__type","image");var nh=Ao,gl=nh;var Ro,ci,Te,Vr,xn=class xn extends It{constructor(r,i){super(i.mvfData.properties.id,i.mvfData.properties.details);v(this,"__type",xn.__type);w(this,Ro,void 0);w(this,ci,void 0);w(this,Te,{});w(this,Vr,void 0);E(this,Ro,r),E(this,Vr,i.mvfData),E(this,ci,i.floorId)}static is(r){return r.__type===xn.__type}get name(){var r,i;return(i=(r=u(this,Vr).properties.details)==null?void 0:r.name)!=null?i:""}get description(){var r,i;return(i=(r=u(this,Vr).properties.details)==null?void 0:r.description)!=null?i:""}get images(){var r,i;if(u(this,Te).images==null){let n=(i=(r=u(this,Vr).properties.details)==null?void 0:r.images)!=null?i:[];u(this,Te).images=n.map(o=>new gl({mvfData:o}))}return u(this,Te).images}get floor(){let r=u(this,Ro).getById("floor",u(this,ci));if(r==null)throw new Error(`Floor ${u(this,ci)} not found!`);return r}get coordinate(){var r;if(u(this,Te).coordinate==null){let[i,n]=(r=u(this,Vr).geometry.coordinates)!=null?r:[0,0];u(this,Te).coordinate=new $(n,i,u(this,ci))}return u(this,Te).coordinate}toJSON(){return{id:this.id,name:this.name,floor:this.floor.id,coordinate:this.coordinate.toJSON()}}destroy(){for(let r in u(this,Te))u(this,Te)[r]=null}};Ro=new WeakMap,ci=new WeakMap,Te=new WeakMap,Vr=new WeakMap,s(xn,"PointOfInterest"),v(xn,"__type","point-of-interest");var oh=xn,Fr=oh;f();var ko,ui,Hr,Pn,Fo,sh,Sn=class Sn extends It{constructor(r,i){super(i.mvfData.properties.id);w(this,Fo);v(this,"__type",Sn.__type);w(this,ko,void 0);w(this,ui,void 0);w(this,Hr,{});w(this,Pn,void 0);E(this,ko,r),E(this,ui,i.floorId),E(this,Pn,i.mvfData)}static is(r){return r.__type===Sn.__type}get group(){return j(this,Fo,sh).call(this).group}get type(){return j(this,Fo,sh).call(this).type}get coordinate(){if(u(this,Hr).coordinate==null){let[r,i]=u(this,Pn).geometry.coordinates;u(this,Hr).coordinate=new $(i,r,u(this,ui))}return u(this,Hr).coordinate}get floor(){let r=u(this,ko).getById("floor",u(this,ui));if(r==null)throw new Error(`Floor ${u(this,ui)} not found!`);return r}toJSON(){return{id:this.id,group:this.group,type:this.type,coordinate:this.coordinate.toJSON()}}destroy(){for(let r of Object.keys(u(this,Hr)))delete u(this,Hr)[r]}};ko=new WeakMap,ui=new WeakMap,Hr=new WeakMap,Pn=new WeakMap,Fo=new WeakSet,sh=s(function(){let[r,i]=u(this,Pn).properties.symbolId.split("--");return{group:r,type:i}},"#getGroupAndTypeFromSymbolId"),s(Sn,"Annotation"),v(Sn,"__type","annotation");var ah=Sn,gn=ah;f();f();var wn,Ie,pi,Tn,Mn=class Mn extends It{constructor(r,i){super(i.mvfData.properties.id);v(this,"__type",Mn.__type);w(this,wn,void 0);w(this,Ie,{});w(this,pi,void 0);w(this,Tn,void 0);E(this,wn,r),E(this,pi,i.floorId),E(this,Tn,i.mvfData)}static is(r){return r.__type===Mn.__type}get floor(){let r=u(this,wn).getById("floor",u(this,pi));if(r==null)throw new Error(`Floor ${u(this,pi)} not found!`);return r}get coordinate(){if(u(this,Ie).coordinate==null){let[r,i]=u(this,Tn).geometry.coordinates;u(this,Ie).coordinate=new $(i,r,u(this,pi))}return u(this,Ie).coordinate}get neighbors(){if(u(this,Ie).neighbours==null){let r=u(this,Tn).properties.neighbors.map(i=>{let n=u(this,wn).getById("node",i.id);if(n==null)throw new Error(`Node ${i.id} not found!`);return n});u(this,Ie).neighbours=r}return u(this,Ie).neighbours}toJSON(){return{id:this.id,floor:this.floor.id,coordinate:this.coordinate.toJSON(),neighbors:this.neighbors.map(r=>r.id)}}destroy(){for(let r of Object.keys(u(this,Ie)))delete u(this,Ie)[r]}};wn=new WeakMap,Ie=new WeakMap,pi=new WeakMap,Tn=new WeakMap,s(Mn,"Node"),v(Mn,"__type","node");var lh=Mn,F2=lh;var v6=s((e,t)=>{var m,y;let r={},i={},n={},o={},a={},l={},c={},h={},d=globalThis.Object.keys(e.space);for(let x of d){let S=e.space[x];if(S!=null)for(let P of S.features){h[P.properties.id]=x,a[P.properties.id]=P;for(let g of P.properties.destinationNodes)n[g]==null&&(n[g]=[]),n[g].push(P.properties.id);if(P.properties.kind==="desk-entrance"&&(o[P.properties.externalId]==null&&(o[P.properties.externalId]=[]),o[P.properties.externalId].push(...P.properties.destinationNodes)),!["void","desk-entrance"].includes((m=P.properties.kind)!=null?m:"")){if((y=P.properties.kind)!=null&&y.includes("connection")){let g=`${P.geometry.coordinates[1]}-${P.geometry.coordinates[0]}`;l[g]==null&&(l[g]=[]),l[g].push(P.properties.id);continue}if(P.properties.kind==="poi"){let g=new Fr(t,{floorId:x,mvfData:P});i[P.properties.id]=g}else{let g=new Me(t,{floorId:x,mvfData:P});r[P.properties.id]=g}}}}for(let x in l){let S=l[x],P={};for(let C of S){let T=h[C],M=a[C];P[T]=M}let g=new Br(t,{mvfDataByFloorId:P});c[g.id]=g}return{spacesById:r,poisById:i,connectionsById:c,spaceIdsByDestinationNodeId:n,objectEntranceNodeIdsByObstructionId:o,mvfSpacesById:a,connectionIdsByLatLon:l}},"processMVFSpaces"),b6=s((e,t)=>{let r={},i={};for(let n of e["node.geojson"].features){i[n.properties.id]=n;let o=new F2(t,{mvfData:n,floorId:n.properties.map});r[n.properties.id]=o}return{nodesById:r,mvfNodesById:i}},"processMVFNodes"),C6=s((e,t)=>{let r={},i={},n={},o=globalThis.Object.keys(e.obstruction);for(let a of o){let l=e.obstruction[a];if(l!=null)for(let c of l.features){i[c.properties.id]=c;for(let d of c.properties.entrances)n[d]=c.properties.id;if(c.properties.kind==="Wall")continue;let h=new we(t,{floorId:a,mvfData:c});r[c.properties.id]=h}}return{objectsById:r,mvfObstructionById:i,obstructionIdByEntranceId:n}},"processMVFObstructions"),x6=s((e,t)=>{let r={},i={};for(let n of e["map.geojson"]){i[n.id]=n;let o=new yl(t,{mvfData:n});r[n.id]=o}return{floorsById:r,mvfMapsById:i}},"processMVFMaps"),S6=s((e,t)=>{let r={},i=e["connection.json"].reduce((n,o)=>(o.nodes.forEach(a=>n[a]=o),r[o.id]=o,n),{});return{mvfConnectionsById:r,mvfConnectionsByNodeId:i}},"processMVFConnections"),P6=s((e,t)=>{let r={},i={},n=globalThis.Object.keys(e.entrance);for(let o of n){let a=e.entrance[o];if(a!=null)for(let l of a.features){i[l.properties.id]=l;let c=new Nr(t,{floorId:o,mvfData:l});r[l.properties.id]=c}}return{doorsById:r,mvfEntrancesById:i}},"processMVFEntrances"),M6=s((e,t)=>{let r={},i={};if(e.annotation==null)return{annotationsById:r,mvfAnnotationsById:i};let n=globalThis.Object.keys(e.annotation);for(let o of n){let a=e.annotation[o];if(a!=null)for(let l of a.features){i[l.properties.id]=l;let c=new gn(t,{floorId:o,mvfData:l});r[l.properties.id]=c}}return{annotationsById:r,mvfAnnotationsById:i}},"processMVFAnnotations"),B2=s((e,t)=>{let{spacesById:r,spaceIdsByDestinationNodeId:i,poisById:n,mvfSpacesById:o,objectEntranceNodeIdsByObstructionId:a,connectionsById:l,connectionIdsByLatLon:c}=v6(e,t),{nodesById:h,mvfNodesById:d}=b6(e,t),{objectsById:m,mvfObstructionById:y,obstructionIdByEntranceId:x}=C6(e,t),{floorsById:S,mvfMapsById:P}=x6(e,t),{mvfConnectionsById:g,mvfConnectionsByNodeId:C}=S6(e,t),{doorsById:T,mvfEntrancesById:M}=P6(e,t),{annotationsById:I,mvfAnnotationsById:_}=M6(e,t);return{spacesById:r,nodesById:h,objectsById:m,floorsById:S,connectionsById:l,doorsById:T,poisById:n,annotationsById:I,spaceIdsByDestinationNodeId:i,objectEntranceNodeIdsByObstructionId:a,obstructionIdByEntranceId:x,connectionIdsByLatLon:c,mvfSpacesById:o,mvfNodesById:d,mvfObstructionById:y,mvfMapsById:P,mvfConnectionsById:g,mvfConnectionsByNodeId:C,mvfEntrancesById:M,mvfAnnotationsById:_}},"createDataFromMVF");var rt,hi,fi,di,mi,yi,gi,vi,bi,Go,Vo,Ho,Xo,Yo,jo,Wo,Uo,ch=class ch{constructor(t,r){w(this,rt,{});v(this,"mvf");v(this,"outdoorViewToken");v(this,"spaceIdsByDestinationNodeId");v(this,"objectEntranceNodeIdsByObstructionId");v(this,"obstructionIdByEntranceId");w(this,hi,void 0);w(this,fi,void 0);w(this,di,void 0);w(this,mi,void 0);w(this,yi,void 0);w(this,gi,void 0);w(this,vi,void 0);w(this,bi,void 0);w(this,Go,void 0);w(this,Vo,void 0);w(this,Ho,void 0);w(this,Xo,void 0);w(this,Yo,void 0);w(this,jo,void 0);w(this,Wo,void 0);w(this,Uo,void 0);this.mvf=t,this.outdoorViewToken=r;let i=B2(t,this);E(this,hi,i.nodesById),E(this,fi,i.spacesById),E(this,di,i.floorsById),E(this,mi,i.connectionsById),E(this,yi,i.objectsById),E(this,gi,i.doorsById),E(this,vi,i.poisById),E(this,bi,i.annotationsById),E(this,Go,i.mvfAnnotationsById),E(this,Vo,i.mvfConnectionsById),E(this,Ho,i.mvfConnectionsByNodeId),E(this,Xo,i.mvfEntrancesById),E(this,Yo,i.mvfNodesById),E(this,jo,i.mvfObstructionById),E(this,Wo,i.mvfSpacesById),E(this,Uo,i.mvfMapsById),this.spaceIdsByDestinationNodeId=i.spaceIdsByDestinationNodeId,this.objectEntranceNodeIdsByObstructionId=i.objectEntranceNodeIdsByObstructionId,this.obstructionIdByEntranceId=i.obstructionIdByEntranceId}get mapName(){return this.mvf["manifest.geojson"].features[0].properties.name}get organizationId(){var t;return(t=this.mvf["manifest.geojson"].features[0].properties.org_id)!=null?t:""}get mapCenter(){return new $(this.mvf["manifest.geojson"].features[0].geometry.coordinates[1],this.mvf["manifest.geojson"].features[0].geometry.coordinates[0])}get spaces(){return u(this,rt).spaces==null&&(u(this,rt).spaces=globalThis.Object.values(u(this,fi))),u(this,rt).spaces}get objects(){return u(this,rt).objects==null&&(u(this,rt).objects=globalThis.Object.values(u(this,yi))),u(this,rt).objects}get connections(){return u(this,rt).connections==null&&(u(this,rt).connections=globalThis.Object.values(u(this,mi))),u(this,rt).connections}get floors(){return u(this,rt).floors==null&&(u(this,rt).floors=globalThis.Object.values(u(this,di))),u(this,rt).floors}get doors(){return u(this,rt).doors==null&&(u(this,rt).doors=globalThis.Object.values(u(this,gi))),u(this,rt).doors}get pointsOfInterest(){return u(this,rt).pointsOfInterest==null&&(u(this,rt).pointsOfInterest=globalThis.Object.values(u(this,vi))),u(this,rt).pointsOfInterest}get annotations(){return u(this,rt).annotations==null&&(u(this,rt).annotations=globalThis.Object.values(u(this,bi))),u(this,rt).annotations}get nodes(){return u(this,rt).nodes==null&&(u(this,rt).nodes=globalThis.Object.values(u(this,hi))),u(this,rt).nodes}getById(t,r){switch(t){case"space":return u(this,fi)[r];case"floor":return u(this,di)[r];case"node":return u(this,hi)[r];case"door":return u(this,gi)[r];case"connection":return u(this,mi)[r];case"object":return u(this,yi)[r];case"point-of-interest":return u(this,vi)[r];case"annotation":return u(this,bi)[r];default:throw new Error(`Unknown type: ${t}`)}}getMapDataById(t){var r,i,n,o,a,l,c;return(c=(l=(a=(o=(n=(i=(r=u(this,fi)[t])!=null?r:u(this,di)[t])!=null?i:u(this,hi)[t])!=null?n:u(this,gi)[t])!=null?o:u(this,mi)[t])!=null?a:u(this,yi)[t])!=null?l:u(this,vi)[t])!=null?c:u(this,bi)[t]}getMVFFeatureById(t,r){switch(t){case"space":return u(this,Wo)[r];case"node":return u(this,Yo)[r];case"obstruction":return u(this,jo)[r];case"map":return u(this,Uo)[r];case"connection":return u(this,Vo)[r];case"entrance":return u(this,Xo)[r];case"annotation":return u(this,Go)[r];default:throw new Error(`Unknown MVF feature type: ${t}`)}}getMVFFeatureByNodeId(t,r){switch(t){case"connection":return u(this,Ho)[r];default:throw new Error(`Unsupported MVF feature type: ${t}`)}}destroy(){for(let t of globalThis.Object.keys(u(this,rt)))u(this,rt)[t]=null}};rt=new WeakMap,hi=new WeakMap,fi=new WeakMap,di=new WeakMap,mi=new WeakMap,yi=new WeakMap,gi=new WeakMap,vi=new WeakMap,bi=new WeakMap,Go=new WeakMap,Vo=new WeakMap,Ho=new WeakMap,Xo=new WeakMap,Yo=new WeakMap,jo=new WeakMap,Wo=new WeakMap,Uo=new WeakMap,s(ch,"MapDataInternal");var Bo=ch;f();f();f();f();var uh=class uh{_subscribers={};publish(t,r){!this._subscribers||!this._subscribers[t]||this._subscribers[t].forEach(function(i){typeof i=="function"&&i(r)})}on(t,r){this._subscribers||(this._subscribers={}),this._subscribers[t]=this._subscribers[t]||[],this._subscribers[t].push(r)}off(t,r){if(!this._subscribers||this._subscribers[t]==null)return;let i=this._subscribers[t].indexOf(r);i!==-1&&this._subscribers[t].splice(i,1)}destroy(){this._subscribers={}}};s(uh,"PubSub");var st=uh;f();f();f();f();f();(function(){typeof globalThis!="object"&&(Object.defineProperty(Object.prototype,"__magic__",{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__)})();f();f();var ph=class ph extends Ce{visible=!0;type="geometry-group";userData={entityId:"",entities3D:new Set,opacity:1,dirty:!0};setVisible(t){this.visible=t,this.dispatchEvent({type:"childremoved",child:this})}getOpacity(){return this.userData.opacity}setOpacity(t){this.userData.opacity=t}constructor(t){super(),this.userData.entityId=t}};s(ph,"GeometryGroupObject3D");var fe=ph;f();var hh=class hh extends Ce{};s(hh,"Geometry2DObject3D");var In=hh,fh=class fh{id;get type(){return this.components[0].type}get parent(){return this.object3d.parent}positionDirty=!0;object3d=new In;components;disposed=!1;constructor(t,r){this.id=t.id||vt(),this.components=[t],this.object3d=new In,this.object3d.position.copy(r),this.object3d.userData.entityId=this.id,this.object3d.userData.type=this.type}worldPosition=new Y;get position(){return this.object3d.getWorldPosition(this.worldPosition),this.worldPosition}};s(fh,"Geometry2D");var Ee=fh;f();var dh=class dh extends Ce{userData={entityId:"",type:"geometry"}};s(dh,"Geometry3DObject3D");var Xe=dh,mh=class mh{id=vt();components;get object3d(){return this.components[0].mesh}get parent(){var t;return(t=this.components[0].mesh)==null?void 0:t.parent}get type(){return this.components[0].type}constructor(t,r){this.components=[t,r]}};s(mh,"Geometry3D");var St=mh;var zo=class zo extends Ce{childrenIds=new Set;type="group-container";userData={entityId:"",entities2D:new Set,dirty:!0};components=[];constructor(t){super(),this.userData.entityId=t}addEntity(t){t instanceof zo?(this.childrenIds.add(t.userData.entityId),this.add(t)):t instanceof Ee?(this.childrenIds.add(t.id),this.add(t.object3d),this.userData.entities2D.add(t.id)):t instanceof fe?(this.childrenIds.add(t.userData.entityId),this.add(t)):t instanceof St&&t.object3d&&(this.childrenIds.add(t.id),this.add(t.object3d)),this.dispatchEvent({type:"childadded",child:this})}removeEntity(t){t instanceof zo?(this.childrenIds.delete(t.userData.entityId),this.remove(t)):t instanceof Ee?(this.childrenIds.delete(t.id),this.userData.entities2D.delete(t.id),this.remove(t.object3d)):t instanceof fe?(this.childrenIds.delete(t.userData.entityId),this.remove(t)):t instanceof St&&t.object3d&&(this.childrenIds.delete(t.id),this.add(t.object3d)),this.dispatchEvent({type:"childremoved",child:this})}setVisible(t){this.visible=t,this.dispatchEvent({type:"childremoved",child:this})}setAltitude(t){this.position.z=t,this.dispatchEvent({type:"childremoved",child:this})}get altitude(){return this.position.z}};s(zo,"GroupContainerObject3D");var re=zo;f();var G2=!1;function V2(){G2=!0}s(V2,"enableTestMode");var yh=class yh{backgroundAlpha=1;backgroundColor=new Mt;width=0;height=0;options={};renderer;constructor(t,r=2){try{this.options=t;let i={canvas:t.canvas,alpha:t.alpha||!1,stencil:!1,antialias:typeof t.antialias=="boolean"?t.antialias:!0,outputColorSpace:Zi,powerPreference:"high-performance",preserveDrawingBuffer:!0};G2?(this.renderer={setSize:()=>{},state:{reset:()=>{}},properties:{get:()=>{}},getSize:()=>({width:window.innerWidth,height:innerHeight}),getDrawingBufferSize:()=>({width:window.innerWidth,height:innerHeight}),getClearAlpha:()=>1,getClearColor:()=>new Mt,autoUpdate:!0,shadowMap:{autoUpdate:!0},getContext:()=>({getContextAttributes(){return{alpha:!0,antialias:!1,depth:!0,stencil:!1}}}),setRenderTarget:()=>{},setClearColor:()=>{},clear:()=>{},render:()=>{},domElement:document.createElement("canvas"),capabilities:{isWebGL2:!0}},this.renderer.domElement.style.width="1920px",Object.defineProperty(this.renderer.domElement,"clientWidth",{value:1920}),this.renderer.domElement.style.height="1080px",Object.defineProperty(this.renderer.domElement,"clientHeight",{value:1080})):this.renderer=r===2?new im(i):new nm(i),this.backgroundColor=new Mt,this.backgroundAlpha=1}catch(i){X.error(i),t.onWebGLRendererError&&t.onWebGLRendererError(i)}}destroy(){this.renderer&&this.renderer.dispose()}render(t,r){this.renderer&&(this.renderer.state.reset(),r.layers.enable(0),r.layers.enable(1),this.renderer.autoClear=!1,this.renderer.setRenderTarget(null),this.renderer.render(t,r),this.renderer.state.reset())}clear(){this.renderer&&(this.renderer.setClearColor(this.backgroundColor,this.backgroundAlpha),this.renderer.clear())}setBufferSize(t,r){b.env.NODE_ENV==="test"||!this.renderer||(this.width=t,this.height=r,this.renderer.setSize(t,r,!1))}setBackgroundColor(t,r){this.backgroundColor=t,this.backgroundAlpha=r}domElement(){var t;return(t=this.renderer)==null?void 0:t.domElement}};s(yh,"Renderer");var vl=yh;f();f();var gh=class gh{percentExpanded=0;activeId="";gap=20;dirty=!0};s(gh,"StackComponent");var En=gh;f();var Xr=63710088e-1,H2=-85.051129,X2=85.051129,bl=1e4,vh={chain:"chain",cancel:"cancel"},bh=Math.PI*2,Zo=100,Y2=1e4,Ch=0,xh=22;var Sh=["change","pan-start","pan-end","rotate-start","rotate-end","zoom-start","zoom-end","multi-start","multi-end","multi-cancel","pedestal-start","pedestal-change","pedestal-end","user-pan-start","user-pedestal-start","user-rotate-start","user-dolly-start","user-zoom-start","user-tilt-start","user-pan-end","user-pedestal-end","user-rotate-end","user-dolly-end","user-zoom-end","user-tilt-end","position-updated","zoom-updated","tilt-updated","rotation-updated"];f();var qo="mappedin";f();function Yr(){return typeof window>"u"?1:Math.min(window.devicePixelRatio,2)}s(Yr,"getPixelRatio");function Cl(e,t,r,i){let n=e*(Math.PI/180),o=i/Xr,a=e+o*180/Math.PI,l=r/Xr/Math.cos(n),c=t+l*180/Math.PI;return{lat:a,lon:c}}s(Cl,"cartesianToGeographic");function xl(e,t,r,i){let n=r*(Math.PI/180),o=i*(Math.PI/180),a=e*(Math.PI/180),l=t*(Math.PI/180),c=n-a,h=o-l,d=Xr*h*Math.cos(a),m=Xr*c;return{x:d,y:m}}s(xl,"geographicToCartesian");var Ph=s((e,t=[])=>{var r;if(e.children&&e.visible)for(let i of e.children){if(i.visible)if((r=i.userData)!=null&&r.entities3D&&i.type==="geometry-group"){t.push(i.userData.entityId);for(let n of i.userData.entities3D.values())t.push(n)}else(i.type==="group-container"&&i.components[0]instanceof En||i.type==="custom-geometry"||i instanceof Xe)&&t.push(i.userData.entityId);Ph(i,t)}return t},"extract3DEntitiesFromTree"),Mh=s((e,t)=>{var r;if(e.children&&e.visible&&!((r=e.userData)!=null&&r.hidden))for(let i of e.children)i.visible&&i instanceof In&&t.add(i.userData.entityId),Mh(i,t);return t},"extractEntitiesFromTree");function wh(e,t){for(let r in t){if(t[r]==null){e[r]=void 0;continue}typeof t[r]=="object"?wh(e[r],t[r]):e[r]=t[r]}return e}s(wh,"mergeObjects");function W2(e,t,r,i){let n={translateX:e.x,translateY:e.y,translateZ:e.z,scale:e.meterInMercatorCoordinateUnits()},o=new ti,a=new Y(n.scale,-n.scale,n.scale),l=new ti().makeTranslation(n.translateX,n.translateY,n.translateZ).scale(a);return{id:qo,type:"custom",renderingMode:"3d",render:(c,h)=>{if(o.fromArray(h),r.elevation>0){let d=dm.fromLngLat(e.toLngLat(),r.elevation);l.makeTranslation(n.translateX,n.translateY,-d.z).scale(a)}t.projectionMatrix=o.multiply(l),i()}}}s(W2,"createCustomLayer");function w6(e){return fetch(e,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({grant_type:"client_credentials"})})}s(w6,"fetchToken");async function U2(e){let t=await w6(e),{access_token:r}=await t.json();return{"x-mappedin-tiles-key":r}}s(U2,"getRequestHeaders");function z2(e,t=0){let r=3735928559^t,i=1103547991^t;for(let n=0,o;n<e.length;n++)o=e.charCodeAt(n),r=Math.imul(r^o,2654435761),i=Math.imul(i^o,1597334677);return r=Math.imul(r^r>>>16,2246822507)^Math.imul(i^i>>>13,3266489909),i=Math.imul(i^i>>>16,2246822507)^Math.imul(r^r>>>13,3266489909),4294967296*(2097151&i)+(r>>>0)}s(z2,"cyrb53");var T6=s(e=>e,"linearEase");function Ut(e,t,r,i,n,o=T6){e=Math.max(t,Math.min(e,r));let a=(e-Math.min(t,r))/Math.abs(r-t),l=o(a);return i+l*(n-i)}s(Ut,"interpolate");function Th(e,t,r){let i=e*(Math.PI/180)/2,n=t/2;return r*Math.tan(i)/n}s(Th,"getProjectionScaleFactor");function Sl(e,t){let r;return typeof t=="string"||typeof t=="number"?(r=e.entity2DMap.get(t),r==null&&(r=e.entity3DMap.get(t))):typeof(t==null?void 0:t.id)=="string"||typeof(t==null?void 0:t.id)=="number"?(r=e.entity2DMap.get(t.id),r==null&&(r=e.entity3DMap.get(t.id))):r=t,r}s(Sl,"getGeometryByGeometryId");function Z2(e){return new fm(new Wc(e[0][0],e[0][1]),new Wc(e[1][0],e[1][1])).getCenter().toArray()}s(Z2,"getBoundingBoxCenter");f();f();var q2=`"use strict";(()=>{function _(n,e){return e.x+e.w<n.x+n.w&&e.x>n.x&&e.y>n.y&&e.y+e.h<n.y+n.h}function A(n,e){let[t,o]=e;return t>=n.x&&t<=n.x+n.w&&o>=n.y&&o<=n.y+n.h}function j(n,e){let t=e.x,o=e.y,i=e.x+e.w,l=e.y+e.h,c=n.x,f=n.y,k=n.x+n.w,P=n.y+n.h;return t<k&&c<i&&o<P&&f<l}function a(n,e){for(let t=0;t<e.length;t++)n.push(e[t])}var w=4,s=class{x;y;w;h;userData;constructor(e,t,o,i,l){let c=typeof window>"u"?2:window.devicePixelRatio;this.userData=typeof l>"u"?null:l,this.x=e-w,this.y=t-w,this.w=o+w*Math.min(c,2),this.h=i+w*Math.min(c,2)}contains(e){return e===this?!1:_(this,e)}intersects(e){return j(this,e)}intersectsPoint(e){return A(this,e)}draw(e){e.fillStyle="rgba(123,222,26, 0.5)",e.fillRect(this.x,this.y,this.w,this.h)}};var x=class n{topLeft;topRight;bottomLeft;bottomRight;divided=!1;boundary;capacity=16;objects=[];parent;constructor(e,t){this.parent=t,this.boundary=e}getSize(){return this.divided?this.objects.length+this.topLeft.getSize()+this.topRight.getSize()+this.bottomLeft.getSize()+this.bottomRight.getSize():this.objects.length}subdivide(){let{x:e,y:t,w:o,h:i}=this.boundary;this.topLeft=new n(new s(e,t,o/2,i/2),this),this.topRight=new n(new s(e+o/2,t,o/2,i/2),this),this.bottomLeft=new n(new s(e,t+i/2,o/2,i/2),this),this.bottomRight=new n(new s(e+o/2,t+i/2,o/2,i/2),this),this.divided=!0}queryRect(e){let t=[];if(this.boundary.intersects(e))t.push(...this.objects);else return[];return this.divided&&(a(t,this.topLeft.queryRect(e)),a(t,this.topRight.queryRect(e)),a(t,this.bottomLeft.queryRect(e)),a(t,this.bottomRight.queryRect(e))),t}queryPoint(e){let t=[];if(this.boundary.intersectsPoint(e))t.push(...this.objects);else return[];return this.divided&&(a(t,this.topLeft.queryPoint(e)),a(t,this.topRight.queryPoint(e)),a(t,this.bottomLeft.queryPoint(e)),a(t,this.bottomRight.queryPoint(e))),t}insert(e){return this.boundary.contains(e)?this.objects.length<this.capacity?(this.objects.push(e),!0):(this.divided||this.subdivide(),(this.topLeft.insert(e)||this.topRight.insert(e)||this.bottomLeft.insert(e)||this.bottomRight.insert(e))===!1&&this.objects.push(e),!0):!1}drawObjects(e){this.objects.forEach(t=>t.draw(e)),this.divided&&(this.topLeft.drawObjects(e),this.topRight.drawObjects(e),this.bottomLeft.drawObjects(e),this.bottomRight.drawObjects(e))}draw(e){e.rect(this.boundary.x,this.boundary.y,this.boundary.w,this.boundary.h),this.divided&&(this.topLeft.draw(e),this.topRight.draw(e),this.bottomLeft.draw(e),this.bottomRight.draw(e)),e.strokeStyle="black",e.lineWidth=4,e.stroke()}};var d=200,I=10;function q(n,e,t,o="-1"){let i=1/0,l=1/0,c=-1/0,f=-1/0,k=new s(-I,0,5,t),P=new s(-I,0,e,5),X=new s(e-5,0,e+I,t),O=new s(0,t-5,e,t+I),K=[k,P,X,O],N=new s(-d,-d,e+d*2,t+d*2);for(let r of n)for(let b=0;b<r.bboxes.length;b++){let{boundingBox:R}=r.bboxes[b],[h,T,u,p]=R,[S,m,B,W]=[r.y-h,r.y+T,r.x-u,r.x+p],L=B,v=S,E=W-B,M=m-S;i=Math.min(i,L)-d,l=Math.min(l,v)-d,c=Math.max(c,L+E)+d,f=Math.max(f,v+M)+d,r.bboxes[b].boundingRect=new s(L,v,E,M)}let g={msgId:o,colliders:new Array(n.length),debug:[]},C=new x(new s(i,l,c-i,f-l)),y;for(let r=0;r<n.length;r++)if(y=n[r],g.colliders[r]=[-1,!1],y.enabled){let[b,R,h]=[1/0,-1,void 0];for(let{index:T,boundingRect:u}of y.bboxes){let p=[];if(p=C.queryRect(u).filter(m=>u.intersects(m)),y.shouldCollideWithScreenEdges&&K.forEach(m=>{u.intersects(m)&&p.push(m)}),p.length<=b&&(h=u,R=T,b=p.length),p.length===0){C.insert(u),g.colliders[r]=[T,!N.contains(u),u];break}}y.rank===5&&h!=null&&(C.insert(h),g.colliders[r]=[R,!N.contains(h),h])}else g.colliders[r]=[-1,!1];return g}function z(n){let e=n[0].map(t=>{let o=t[0].map((i,l)=>({index:l,boundingBox:[i[0],i[1],i[2],i[3]]}));return{enabled:t[1]===1,rank:t[2]===1?5:0,x:t[3],y:t[4],bboxes:o}});return{msgId:"-1",totalWidth:n[3],totalHeight:n[2],colliders:e,devicePixelRatio:n[1]}}self.onmessage=n=>{let e=z(n.data);self.postMessage(q(e.colliders,e.totalWidth,e.totalHeight,e.msgId))};})();
5
- `;f();f();f();f();f();function $2(e,t){return t.x+t.w<e.x+e.w&&t.x>e.x&&t.y>e.y&&t.y+t.h<e.y+e.h}s($2,"contains");f();function J2(e,t){let[r,i]=t;return r>=e.x&&r<=e.x+e.w&&i>=e.y&&i<=e.y+e.h}s(J2,"intersectPoint");f();function K2(e,t){let r=t.x,i=t.y,n=t.x+t.w,o=t.y+t.h,a=e.x,l=e.y,c=e.x+e.w,h=e.y+e.h;return r<c&&a<n&&i<h&&l<o}s(K2,"intersects");f();function lr(e,t){for(let r=0;r<t.length;r++)e.push(t[r])}s(lr,"appendItems");f();var Pl=4,Ih=class Ih{x;y;w;h;userData;constructor(t,r,i,n,o){let a=typeof window>"u"?2:window.devicePixelRatio;this.userData=typeof o>"u"?null:o,this.x=t-Pl,this.y=r-Pl,this.w=i+Pl*Math.min(a,2),this.h=n+Pl*Math.min(a,2)}contains(t){return t===this?!1:$2(this,t)}intersects(t){return K2(this,t)}intersectsPoint(t){return J2(this,t)}draw(t){t.fillStyle="rgba(123,222,26, 0.5)",t.fillRect(this.x,this.y,this.w,this.h)}};s(Ih,"Rectangle");var Et=Ih;var Ci=class Ci{topLeft;topRight;bottomLeft;bottomRight;divided=!1;boundary;capacity=16;objects=[];parent;constructor(t,r){this.parent=r,this.boundary=t}getSize(){return this.divided?this.objects.length+this.topLeft.getSize()+this.topRight.getSize()+this.bottomLeft.getSize()+this.bottomRight.getSize():this.objects.length}subdivide(){let{x:t,y:r,w:i,h:n}=this.boundary;this.topLeft=new Ci(new Et(t,r,i/2,n/2),this),this.topRight=new Ci(new Et(t+i/2,r,i/2,n/2),this),this.bottomLeft=new Ci(new Et(t,r+n/2,i/2,n/2),this),this.bottomRight=new Ci(new Et(t+i/2,r+n/2,i/2,n/2),this),this.divided=!0}queryRect(t){let r=[];if(this.boundary.intersects(t))r.push(...this.objects);else return[];return this.divided&&(lr(r,this.topLeft.queryRect(t)),lr(r,this.topRight.queryRect(t)),lr(r,this.bottomLeft.queryRect(t)),lr(r,this.bottomRight.queryRect(t))),r}queryPoint(t){let r=[];if(this.boundary.intersectsPoint(t))r.push(...this.objects);else return[];return this.divided&&(lr(r,this.topLeft.queryPoint(t)),lr(r,this.topRight.queryPoint(t)),lr(r,this.bottomLeft.queryPoint(t)),lr(r,this.bottomRight.queryPoint(t))),r}insert(t){return this.boundary.contains(t)?this.objects.length<this.capacity?(this.objects.push(t),!0):(this.divided||this.subdivide(),(this.topLeft.insert(t)||this.topRight.insert(t)||this.bottomLeft.insert(t)||this.bottomRight.insert(t))===!1&&this.objects.push(t),!0):!1}drawObjects(t){this.objects.forEach(r=>r.draw(t)),this.divided&&(this.topLeft.drawObjects(t),this.topRight.drawObjects(t),this.bottomLeft.drawObjects(t),this.bottomRight.drawObjects(t))}draw(t){t.rect(this.boundary.x,this.boundary.y,this.boundary.w,this.boundary.h),this.divided&&(this.topLeft.draw(t),this.topRight.draw(t),this.bottomLeft.draw(t),this.bottomRight.draw(t)),t.strokeStyle="black",t.lineWidth=4,t.stroke()}};s(Ci,"QuadTree");var Ye=Ci;f();f();var Q2=["","","low","medium","high","always-visible"];function tv(e){return Math.min(5,Math.max(2,e))}s(tv,"clampTierNumber");function _n(e){if(typeof e=="number")return tv(e);let t=Q2.indexOf(e);return t===-1?3:t}s(_n,"convertCollisionRankingTierToNumber");function $o(e){let t=tv(e);return Q2[t]}s($o,"convertNumberToCollisionRankingTier");function ev(e,t,r){let i,n,o,a=null,l=0;r||(r={});let c=s(function(){l=r.leading===!1?0:Date.now(),a=null,o=e.apply(i,n),a||(i=n=null)},"later");return function(){let h=Date.now();!l&&r.leading===!1&&(l=h);let d=t-(h-l);return i=globalThis,n=arguments,d<=0||d>t?(a&&(clearTimeout(a),a=null),l=h,o=e.apply(i,n),a||(i=n=null)):!a&&r.trailing!==!1&&(a=setTimeout(c,d)),o}}s(ev,"throttle");function rv(e){return[e.bboxes.map(r=>[r.boundingBox[0],r.boundingBox[1],r.boundingBox[2],r.boundingBox[3]]),e.enabled?1:0,e.rank===5?1:0,e.x,e.y]}s(rv,"packCollider");var xi=!1,I6=150,_h=class _h extends st{worker;debugContext;debugCanvas;dirty=!0;packedMessage=[[],0,0,0];visibleCollidersQTree=new Ye(new Et(0,0,0,0));interactiveCollidersQTree=new Ye(new Et(0,0,0,0));coreState;constructor(t,r,i=new Worker(URL.createObjectURL(new Blob([q2],{type:"text/javascript"})))){super(),this.coreState=r,this.debugCanvas=t,this.debugContext=t.getContext("2d"),this.worker=i,this.worker.onmessage=n=>this.resolve(n),this.postMessage=ev(this._postMessage,I6,!1),xi?this.showCollisionBoxes():this.hideCollisionBoxes()}postMessage;showCollisionBoxes=()=>{xi=!0,this.debugCanvas.style.display="block"};hideCollisionBoxes=()=>{xi=!1,this.debugContext.clearRect(0,0,this.debugCanvas.width,this.debugCanvas.height),this.debugCanvas.style.display="none"};currentMsgId="";working=!1;_postMessage=()=>{this.worker.postMessage(this.packedMessage)};componentArray=[];update=()=>{if(this.dirty){this.packedMessage=[[],0,0,0],this.componentArray=new Array(this.coreState.entity2DIds.size);let t=0,r;for(let i of this.coreState.entity2DIds){let n=this.coreState.entity2DMap.get(i);n&&(r=n.components[0],this.componentArray[t]=r),t++}this.resize(),this.dirty=!1,this.componentArray.sort((i,n)=>n.rank-i.rank)}else this.componentArray.filter(r=>r.collisionDirty===!0).length>0&&this.componentArray.sort((r,i)=>i.rank-r.rank);for(let t=0;t<this.componentArray.length;t++)this.packedMessage&&(this.componentArray[t].collisionDirty||this.packedMessage[0][t]==null?(this.packedMessage[0][t]=rv(this.componentArray[t].toJSON()),this.componentArray[t].collisionDirty=!1):(this.packedMessage[0][t][1]=this.componentArray[t].enabled?1:0,this.packedMessage[0][t][2]=this.componentArray[t].rank===5?1:0,this.packedMessage[0][t][3]=this.componentArray[t].projection.x,this.packedMessage[0][t][4]=this.componentArray[t].projection.y));this.working||this.postMessage()};resize(){this.packedMessage[3]=this.debugCanvas.width,this.packedMessage[2]=this.debugCanvas.height}resolve=t=>{if(this.working=!1,this.dirty||!t.data)return;let r=t.data.colliders,i=-1,n=!1,o,a,l;xi&&(this.visibleCollidersQTree=new Ye(new Et(0,0,this.debugCanvas.width,this.debugCanvas.height))),this.interactiveCollidersQTree=new Ye(new Et(0,0,this.debugCanvas.width,this.debugCanvas.height));for(let c=0;c<this.componentArray.length;c++){let h=this.componentArray[c];r[c]==null||!h.enabled||([i,n,o]=r[c],i!==-1&&!n&&o!=null?(l=new Et(o.x,o.y,o.w,o.h,{entityId:h.id}),xi&&this.visibleCollidersQTree.insert(l),a=this.coreState.entity2DMap.get(h.id),(a==null?void 0:a.components[1])!=null&&this.interactiveCollidersQTree.insert(new Et(o.x,o.y,o.w,o.h,{entityId:h.id})),h.visible===!1&&(h.visible=!0,"visibilityNeedsUpdate"in h&&(h.visibilityNeedsUpdate=!0)),i!==-1&&i!==h.activeStrategyIndex&&(h.activeBoundingBox=l,h.onStrategySelected(i))):(h.visible===!0&&(h.visible=!1,"visibilityNeedsUpdate"in h&&(h.visibilityNeedsUpdate=!0)),i!==-1&&i!==h.activeStrategyIndex&&h.onStrategySelected(i)))}xi&&this.drawDebug(),this.publish("visibility-changed")};drawDebug=()=>{xi&&this.visibleCollidersQTree&&(this.debugContext.clearRect(0,0,this.debugCanvas.width,this.debugCanvas.height),this.debugContext.beginPath(),this.visibleCollidersQTree.drawObjects(this.debugContext))};destroy=()=>{this.worker.terminate()}};s(_h,"CollisionSystem");var Ml=_h;f();f();f();f();var Oh=class Oh{type;event;constructor(t){this.type=0,this.event=t}get timestamp(){return this.event.timeStamp}};s(Oh,"Tap");var wl=Oh,Dh=class Dh{taps=[];add(t){this.lastPointerDown&&t.timestamp-this.lastPointerDown.timestamp<50?this.lastPointerDown.type=1:this.taps.push(t)}get lastPointerDown(){return this.taps.length>=1?this.taps[this.taps.length-1]:void 0}get isSingleTapWithTwoFingers(){var t;return this.isSingleTap&&((t=this.lastPointerDown)==null?void 0:t.type)===1}get isSingleTapWithOneFinger(){var t;return this.isSingleTap&&((t=this.lastPointerDown)==null?void 0:t.type)===0}get isDoubleTapWithOneFinger(){var t,r;return this.isDoubleTap&&((t=this.taps[0])==null?void 0:t.type)===0&&((r=this.taps[1])==null?void 0:r.type)===0}get isSingleTap(){return this.taps.length===1}get isDoubleTap(){return this.taps.length===2}discardOutsideOfWaitWindow(t){this.taps=this.taps.filter(r=>t-r.timestamp<300)}flush(){this.taps=[]}get _taps(){return this.taps}destroy(){this.flush()}};s(Dh,"TapsController");var Tl=Dh;var Ln,Ah=class Ah extends st{constructor(r,i,n,o){super();v(this,"raycaster",new Pr);v(this,"state",{hovered3DEntity:void 0,hovered2DEntity:void 0,lastHover:void 0,containerOffset:[0,0],interaction:{mouseDownStart:void 0,distanceFromMouseDown:void 0,isPanning:!1}});v(this,"coreState");v(this,"camera");v(this,"cameraPlane");v(this,"_quadtree",new Ye(new Et(0,0,0,0)));v(this,"_container");v(this,"cursor","grab");v(this,"hasTouched",!1);w(this,Ln,void 0);v(this,"onPointerMoveRaf",r=>{u(this,Ln)&&cancelAnimationFrame(u(this,Ln)),E(this,Ln,requestAnimationFrame(()=>{this.onPointerMove(r)}))});v(this,"onPointerMove",r=>{r.preventDefault(),this.updateInteractionStateIfPanning(r),(r.pointerType!=="touch"||r.pointerType===void 0&&this.hasTouched)&&this.handleHover(r),this.handleCursor()});v(this,"tapsControl",new Tl);v(this,"onPointerDown",r=>{r.target===this._container&&(this._container.addEventListener("pointerup",this.onPointerUp,!1),this._container.addEventListener("pointercancel",this.onPointerUp,!1),this.state.interaction.mouseDownStart={time:Date.now(),timestamp:r.timeStamp,clientX:r.clientX,clientY:r.clientY},this.state.interaction.distanceFromMouseDown=0,this.handleCursor(),r.pointerType==="touch"&&this.tapsControl.add(new wl(r)))});v(this,"clickTimeout");v(this,"onPointerUp",r=>{this.tapsControl.discardOutsideOfWaitWindow(r.timeStamp),this._container.removeEventListener("pointerup",this.onPointerUp,!1),this._container.removeEventListener("pointercancel",this.onPointerUp,!1),this.updateInteractionStateIfPanning(r);let{mouseDownStart:i}=this.state.interaction;!i||this.state.interaction.distanceFromMouseDown==null||(Date.now()<i.time+300&&(this.tapsControl.isSingleTapWithTwoFingers||this.state.interaction.distanceFromMouseDown<=15)&&(r.pointerType==="touch"?this.tapsControl.isSingleTapWithTwoFingers?(this.publish("singletap-with-twofinger",r),this.flush()):this.tapsControl.isSingleTapWithOneFinger?(this.clickTimeout&&clearTimeout(this.clickTimeout),this.clickTimeout=window.setTimeout(()=>{this.handleClick(r),this.flush()},300)):this.tapsControl.isDoubleTapWithOneFinger&&(this.publish("doubletap-with-onefinger",r),this.flush()):this.handleClick(r)),this.state.interaction.mouseDownStart=void 0,this.state.interaction.distanceFromMouseDown=void 0,this.state.interaction.isPanning=!1,this.handleCursor())});v(this,"dirty3D",!0);v(this,"cachedHitBoxes",[]);v(this,"ndcPoint",new W);v(this,"debugPanel");this.raycaster.layers.enableAll();let{top:a,left:l}=r.getBoundingClientRect();this.state.containerOffset=[a,l],this.camera=n,this._container=r,this.coreState=i,this.cameraPlane=o,this._container.addEventListener("pointerdown",this.onPointerDown,!1),this._container.addEventListener("pointermove",this.onPointerMoveRaf,!1),this._container.classList.add("mappedin-interactive")}updateQuadtree(r){this._quadtree=r}setHovered3DEntityInteractionComponentDirty(){if(this.state.hovered3DEntity){let r=this.state.hovered3DEntity.components[2];r&&(r.dirty=!0)}}flush(){this.tapsControl.flush(),this.clickTimeout!=null&&(clearTimeout(this.clickTimeout),this.clickTimeout=void 0)}handleHover(r){if(this.state.interaction.mouseDownStart)return;let{entity3D:i,entity2D:n,position:o}=this.intersect(r);(this.handle3DEntityHover(i)||this.handle2DEntityHover(n))&&this.publish("hover",{entity2D:this.state.hovered2DEntity,entity3D:this.state.hovered3DEntity,position:o}),this.handleCursor()}handleCursor(){let r=!!(this.state.hovered3DEntity||this.state.hovered2DEntity),i=!!this.state.interaction.mouseDownStart,n=this.state.interaction.isPanning,o=L6(r,n,i);this.cursor!==o&&(this.cursor=o,o==="pointer"?this._container.classList.add("mappedin-interaction-hover"):this._container.classList.remove("mappedin-interaction-hover"))}handle2DEntityHover(r){let i=this.state.hovered2DEntity!==r;return this.state.hovered2DEntity=r,i}handleClick(r){let i=this.intersect(r);this.publish("click",{entity2D:i.entity2D,entity3D:i.entity3D,position:i.position,pointerEvent:{button:r.button}})}get _hitBoxes(){if(this.dirty3D){this.cachedHitBoxes=[];let r;for(let i of this.coreState.threeDEntities)r=this.coreState.entity3DMap.get(i),((r==null?void 0:r.type)==="geometry"||(r==null?void 0:r.type)==="model")&&r.components[2]&&r.components[0].mesh&&!this.cachedHitBoxes.includes(r.components[0].mesh)&&this.cachedHitBoxes.push(r.components[0].mesh);return this.dirty3D=!1,this.cachedHitBoxes}return this.cachedHitBoxes}intersect(r){var y,x;let i=[r.offsetX,r.offsetY],n=this._quadtree.queryPoint(i),[o]=n.filter(S=>S.intersectsPoint(i)),a=this.state.containerOffset[0],l=this.state.containerOffset[1];this.ndcPoint.x=(r.clientX-l)/this._container.clientWidth*2-1,this.ndcPoint.y=-((r.clientY-a)/this._container.clientHeight)*2+1,this.raycaster.setFromCamera(this.ndcPoint,this.camera),this.raycaster.layers.enable(0);let[c]=this.getMouseRayIntersects(),h=this.raycaster.intersectObjects(this._hitBoxes,!0).filter(S=>S.object.visible),[d]=h,m=(y=d==null?void 0:d.instanceId)!=null?y:d==null?void 0:d.batchId;return{entity2D:((x=o==null?void 0:o.userData)==null?void 0:x.entityId)==="watermark"?{id:"watermark"}:this.coreState.entity2DMap.get(o==null?void 0:o.userData.entityId),entity3D:m!=null?this.coreState.entity3DMap.get(d==null?void 0:d.object.userData.entities[m]):this.coreState.entity3DMap.get(d==null?void 0:d.object.userData.entityId),position:c==null?void 0:c.point}}handle3DEntityHover(r){this.state.lastHover!==r&&(this.state.lastHover&&nv(this.state.lastHover,!1),r&&nv(r,!0));let i=this.state.hovered3DEntity!==r;return this.state.hovered3DEntity=r,this.state.lastHover=r,i}updateInteractionStateIfPanning(r){this.state.interaction.mouseDownStart&&(this.state.interaction.distanceFromMouseDown=Math.sqrt(Math.pow(r.clientX-this.state.interaction.mouseDownStart.clientX,2)+Math.pow(r.clientY-this.state.interaction.mouseDownStart.clientY,2)),!this.state.interaction.isPanning&&this.state.interaction.distanceFromMouseDown>15&&(this.state.interaction.isPanning=!0))}getMouseRayIntersects(){return this.raycaster.intersectObjects([this.cameraPlane],!1)}destroy(){this._container.addEventListener("pointermove",this.onPointerMoveRaf,!1),this._container.removeEventListener("pointerdown",this.onPointerDown,!1),this._container.removeEventListener("pointermove",this.onPointerMoveRaf,!1),this._container.removeEventListener("pointerup",this.onPointerUp,!1),this._container.removeEventListener("pointercancel",this.onPointerUp,!1)}enableDebug(){let r=document.createElement("div");r.style.position="absolute",r.style.top="0",r.style.right="0",r.style.zIndex="1",r.style.backgroundColor="white",r.style.padding="10px",document.body.append(r),r.id="interaction-debug-panel",this.debugPanel=r,this.on("doubletap-with-onefinger",()=>{this.queueDebugMessage("doubletap-with-onefinger","#ffadad")}),this.on("singletap-with-twofinger",()=>{this.queueDebugMessage("singletap-with-twofinger","#ffd6a5")}),this.on("click",i=>{var n,o,a;this.queueDebugMessage(`CLICK
1
+ import{h as Qu,i as Tm,j as wm}from"./chunk-TFQ3OMBN.js";import{a as Lr}from"./chunk-5YBN4H5R.js";import{A as lm,B as um,C as cm,D as Y,E as Be,F as pm,Fa as an,G as li,H as rn,I as Se,Ia as xs,J as Mt,Ja as Pm,L as Ir,M as co,Ma as Mm,O as jt,P as hm,Pa as _r,Q as po,R as dm,S as fm,T as nn,W as mm,X as ym,Y as vs,a as gs,ba as gm,c as uo,d as Fe,ea as bs,fa as Cs,ga as vm,ia as ho,m as am,n as sm,oa as bm,pa as Er,qa as Ku,ra as Cm,sa as Ge,ta as Ve,u as si,ua as xm,va as Sm,w as st,x as W,xa as on}from"./chunk-YQZI7WVJ.js";import{a as s,b as N,d as wr,e as v,f as c,g as T,h as E,i as j,j as d,k as b}from"./chunk-JTHM7U3W.js";var Gm=N((hc,dc)=>{d();(function(r,t){typeof hc=="object"&&typeof dc<"u"?dc.exports=t():typeof define=="function"&&define.amd?define(t):(r=r||self).RBush=t()})(hc,function(){"use strict";function r(g,C,w,I,M){s(function _(D,k,B,R,G){for(;R>B;){if(R-B>600){var X=R-B+1,Q=k-B+1,lt=Math.log(X),ht=.5*Math.exp(2*lt/3),yt=.5*Math.sqrt(lt*ht*(X-ht)/X)*(Q-X/2<0?-1:1),At=Math.max(B,Math.floor(k-Q*ht/X+yt)),Ce=Math.min(R,Math.floor(k+(X-Q)*ht/X+yt));_(D,k,At,Ce,G)}var kt=D[k],ct=B,Ct=R;for(t(D,B,k),G(D[R],kt)>0&&t(D,B,R);ct<Ct;){for(t(D,ct,Ct),ct++,Ct--;G(D[ct],kt)<0;)ct++;for(;G(D[Ct],kt)>0;)Ct--}G(D[B],kt)===0?t(D,B,Ct):t(D,++Ct,R),Ct<=k&&(B=Ct+1),k<=Ct&&(R=Ct-1)}},"t")(g,C,w||0,I||g.length-1,M||e)}s(r,"t");function t(g,C,w){var I=g[C];g[C]=g[w],g[w]=I}s(t,"i");function e(g,C){return g<C?-1:g>C?1:0}s(e,"n");var i=s(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,w){if(!w)return C.indexOf(g);for(var I=0;I<C.length;I++)if(w(g,C[I]))return I;return-1}s(n,"e");function o(g,C){a(g,0,g.children.length,C,g)}s(o,"a");function a(g,C,w,I,M){M||(M=S(null)),M.minX=1/0,M.minY=1/0,M.maxX=-1/0,M.maxY=-1/0;for(var _=C;_<w;_++){var D=g.children[_];l(M,g.leaf?I(D):D)}return M}s(a,"h");function l(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}s(l,"o");function u(g,C){return g.minX-C.minX}s(u,"s");function h(g,C){return g.minY-C.minY}s(h,"l");function f(g){return(g.maxX-g.minX)*(g.maxY-g.minY)}s(f,"f");function m(g){return g.maxX-g.minX+(g.maxY-g.minY)}s(m,"u");function y(g,C){return g.minX<=C.minX&&g.minY<=C.minY&&C.maxX<=g.maxX&&C.maxY<=g.maxY}s(y,"m");function x(g,C){return C.minX<=g.maxX&&C.minY<=g.maxY&&C.maxX>=g.minX&&C.maxY>=g.minY}s(x,"c");function S(g){return{children:g,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}s(S,"p");function P(g,C,w,I,M){for(var _=[C,w];_.length;)if(!((w=_.pop())-(C=_.pop())<=I)){var D=C+Math.ceil((w-C)/I/2)*I;r(g,D,C,w,M),_.push(C,D,D,w)}}return s(P,"d"),i.prototype.all=function(){return this._all(this.data,[])},i.prototype.search=function(g){var C=this.data,w=[];if(!x(g,C))return w;for(var I=this.toBBox,M=[];C;){for(var _=0;_<C.children.length;_++){var D=C.children[_],k=C.leaf?I(D):D;x(g,k)&&(C.leaf?w.push(D):y(g,k)?this._all(D,w):M.push(D))}C=M.pop()}return w},i.prototype.collides=function(g){var C=this.data;if(!x(g,C))return!1;for(var w=[];C;){for(var I=0;I<C.children.length;I++){var M=C.children[I],_=C.leaf?this.toBBox(M):M;if(x(g,_)){if(C.leaf||y(g,_))return!0;w.push(M)}}C=w.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 w=this._build(g.slice(),0,g.length-1,0);if(this.data.children.length)if(this.data.height===w.height)this._splitRoot(this.data,w);else{if(this.data.height<w.height){var I=this.data;this.data=w,w=I}this._insert(w,this.data.height-w.height-1,!0)}else this.data=w;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 w,I,M,_=this.data,D=this.toBBox(g),k=[],B=[];_||k.length;){if(_||(_=k.pop(),I=k[k.length-1],w=B.pop(),M=!0),_.leaf){var R=n(g,_.children,C);if(R!==-1)return _.children.splice(R,1),k.push(_),this._condense(k),this}M||_.leaf||!y(_,D)?I?(w++,_=I.children[w],M=!1):_=null:(k.push(_),B.push(w),w=0,I=_,_=_.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 w=[];g;)g.leaf?C.push.apply(C,g.children):w.push.apply(w,g.children),g=w.pop();return C},i.prototype._build=function(g,C,w,I){var M,_=w-C+1,D=this._maxEntries;if(_<=D)return o(M=S(g.slice(C,w+1)),this.toBBox),M;I||(I=Math.ceil(Math.log(_)/Math.log(D)),D=Math.ceil(_/Math.pow(D,I-1))),(M=S([])).leaf=!1,M.height=I;var k=Math.ceil(_/D),B=k*Math.ceil(Math.sqrt(D));P(g,C,w,B,this.compareMinX);for(var R=C;R<=w;R+=B){var G=Math.min(R+B-1,w);P(g,R,G,k,this.compareMinY);for(var X=R;X<=G;X+=k){var Q=Math.min(X+k-1,G);M.children.push(this._build(g,X,Q,I-1))}}return o(M,this.toBBox),M},i.prototype._chooseSubtree=function(g,C,w,I){for(;I.push(C),!C.leaf&&I.length-1!==w;){for(var M=1/0,_=1/0,D=void 0,k=0;k<C.children.length;k++){var B=C.children[k],R=f(B),G=(X=g,Q=B,(Math.max(Q.maxX,X.maxX)-Math.min(Q.minX,X.minX))*(Math.max(Q.maxY,X.maxY)-Math.min(Q.minY,X.minY))-R);G<_?(_=G,M=R<M?R:M,D=B):G===_&&R<M&&(M=R,D=B)}C=D||C.children[0]}var X,Q;return C},i.prototype._insert=function(g,C,w){var I=w?g:this.toBBox(g),M=[],_=this._chooseSubtree(I,this.data,C,M);for(_.children.push(g),l(_,I);C>=0&&M[C].children.length>this._maxEntries;)this._split(M,C),C--;this._adjustParentBBoxes(I,M,C)},i.prototype._split=function(g,C){var w=g[C],I=w.children.length,M=this._minEntries;this._chooseSplitAxis(w,M,I);var _=this._chooseSplitIndex(w,M,I),D=S(w.children.splice(_,w.children.length-_));D.height=w.height,D.leaf=w.leaf,o(w,this.toBBox),o(D,this.toBBox),C?g[C-1].children.push(D):this._splitRoot(w,D)},i.prototype._splitRoot=function(g,C){this.data=S([g,C]),this.data.height=g.height+1,this.data.leaf=!1,o(this.data,this.toBBox)},i.prototype._chooseSplitIndex=function(g,C,w){for(var I,M,_,D,k,B,R,G=1/0,X=1/0,Q=C;Q<=w-C;Q++){var lt=a(g,0,Q,this.toBBox),ht=a(g,Q,w,this.toBBox),yt=(M=lt,_=ht,D=void 0,k=void 0,B=void 0,R=void 0,D=Math.max(M.minX,_.minX),k=Math.max(M.minY,_.minY),B=Math.min(M.maxX,_.maxX),R=Math.min(M.maxY,_.maxY),Math.max(0,B-D)*Math.max(0,R-k)),At=f(lt)+f(ht);yt<G?(G=yt,I=Q,X=At<X?At:X):yt===G&&At<X&&(X=At,I=Q)}return I||w-C},i.prototype._chooseSplitAxis=function(g,C,w){var I=g.leaf?this.compareMinX:u,M=g.leaf?this.compareMinY:h;this._allDistMargin(g,C,w,I)<this._allDistMargin(g,C,w,M)&&g.children.sort(I)},i.prototype._allDistMargin=function(g,C,w,I){g.children.sort(I);for(var M=this.toBBox,_=a(g,0,C,M),D=a(g,w-C,w,M),k=m(_)+m(D),B=C;B<w-C;B++){var R=g.children[B];l(_,g.leaf?M(R):R),k+=m(_)}for(var G=w-C-1;G>=C;G--){var X=g.children[G];l(D,g.leaf?M(X):X),k+=m(D)}return k},i.prototype._adjustParentBBoxes=function(g,C,w){for(var I=w;I>=0;I--)l(C[I],g)},i.prototype._condense=function(g){for(var C=g.length-1,w=void 0;C>=0;C--)g[C].children.length===0?C>0?(w=g[C-1].children).splice(w.indexOf(g[C]),1):this.clear():o(g[C],this.toBBox)},i})});var vc=N(V=>{"use strict";d();Object.defineProperty(V,"__esModule",{value:!0});V.earthRadius=63710088e-1;V.factors={centimeters:V.earthRadius*100,centimetres:V.earthRadius*100,degrees:V.earthRadius/111325,feet:V.earthRadius*3.28084,inches:V.earthRadius*39.37,kilometers:V.earthRadius/1e3,kilometres:V.earthRadius/1e3,meters:V.earthRadius,metres:V.earthRadius,miles:V.earthRadius/1609.344,millimeters:V.earthRadius*1e3,millimetres:V.earthRadius*1e3,nauticalmiles:V.earthRadius/1852,radians:1,yards:V.earthRadius*1.0936};V.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/V.earthRadius,yards:1.0936133};V.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 Ar(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}s(Ar,"feature");V.feature=Ar;function s4(r,t,e){switch(e===void 0&&(e={}),r){case"Point":return fc(t).geometry;case"LineString":return yc(t).geometry;case"Polygon":return mc(t).geometry;case"MultiPoint":return Hm(t).geometry;case"MultiLineString":return Vm(t).geometry;case"MultiPolygon":return Xm(t).geometry;default:throw new Error(r+" is invalid")}}s(s4,"geometry");V.geometry=s4;function fc(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(!ws(r[0])||!ws(r[1]))throw new Error("coordinates must contain numbers");var i={type:"Point",coordinates:r};return Ar(i,t,e)}s(fc,"point");V.point=fc;function l4(r,t,e){return e===void 0&&(e={}),Is(r.map(function(i){return fc(i,t)}),e)}s(l4,"points");V.points=l4;function mc(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 l={type:"Polygon",coordinates:r};return Ar(l,t,e)}s(mc,"polygon");V.polygon=mc;function u4(r,t,e){return e===void 0&&(e={}),Is(r.map(function(i){return mc(i,t)}),e)}s(u4,"polygons");V.polygons=u4;function yc(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 Ar(i,t,e)}s(yc,"lineString");V.lineString=yc;function c4(r,t,e){return e===void 0&&(e={}),Is(r.map(function(i){return yc(i,t)}),e)}s(c4,"lineStrings");V.lineStrings=c4;function Is(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}s(Is,"featureCollection");V.featureCollection=Is;function Vm(r,t,e){e===void 0&&(e={});var i={type:"MultiLineString",coordinates:r};return Ar(i,t,e)}s(Vm,"multiLineString");V.multiLineString=Vm;function Hm(r,t,e){e===void 0&&(e={});var i={type:"MultiPoint",coordinates:r};return Ar(i,t,e)}s(Hm,"multiPoint");V.multiPoint=Hm;function Xm(r,t,e){e===void 0&&(e={});var i={type:"MultiPolygon",coordinates:r};return Ar(i,t,e)}s(Xm,"multiPolygon");V.multiPolygon=Xm;function p4(r,t,e){e===void 0&&(e={});var i={type:"GeometryCollection",geometries:r};return Ar(i,t,e)}s(p4,"geometryCollection");V.geometryCollection=p4;function h4(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}s(h4,"round");V.round=h4;function Ym(r,t){t===void 0&&(t="kilometers");var e=V.factors[t];if(!e)throw new Error(t+" units is invalid");return r*e}s(Ym,"radiansToLength");V.radiansToLength=Ym;function gc(r,t){t===void 0&&(t="kilometers");var e=V.factors[t];if(!e)throw new Error(t+" units is invalid");return r/e}s(gc,"lengthToRadians");V.lengthToRadians=gc;function d4(r,t){return jm(gc(r,t))}s(d4,"lengthToDegrees");V.lengthToDegrees=d4;function f4(r){var t=r%360;return t<0&&(t+=360),t}s(f4,"bearingToAzimuth");V.bearingToAzimuth=f4;function jm(r){var t=r%(2*Math.PI);return t*180/Math.PI}s(jm,"radiansToDegrees");V.radiansToDegrees=jm;function m4(r){var t=r%360;return t*Math.PI/180}s(m4,"degreesToRadians");V.degreesToRadians=m4;function y4(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 Ym(gc(r,t),e)}s(y4,"convertLength");V.convertLength=y4;function g4(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=V.areaFactors[t];if(!i)throw new Error("invalid original units");var n=V.areaFactors[e];if(!n)throw new Error("invalid final units");return r/i*n}s(g4,"convertArea");V.convertArea=g4;function ws(r){return!isNaN(r)&&r!==null&&!Array.isArray(r)}s(ws,"isNumber");V.isNumber=ws;function v4(r){return!!r&&r.constructor===Object}s(v4,"isObject");V.isObject=v4;function b4(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(!ws(t))throw new Error("bbox must only contain numbers")})}s(b4,"validateBBox");V.validateBBox=b4;function C4(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")}s(C4,"validateId");V.validateId=C4});var qm=N(Tt=>{"use strict";d();Object.defineProperty(Tt,"__esModule",{value:!0});var Bt=vc();function go(r,t,e){if(r!==null)for(var i,n,o,a,l,u,h,f=0,m=0,y,x=r.type,S=x==="FeatureCollection",P=x==="Feature",g=S?r.features.length:1,C=0;C<g;C++){h=S?r.features[C].geometry:P?r.geometry:r,y=h?h.type==="GeometryCollection":!1,l=y?h.geometries.length:1;for(var w=0;w<l;w++){var I=0,M=0;if(a=y?h.geometries[w]:h,a!==null){u=a.coordinates;var _=a.type;switch(f=e&&(_==="Polygon"||_==="MultiPolygon")?1:0,_){case null:break;case"Point":if(t(u,m,C,I,M)===!1)return!1;m++,I++;break;case"LineString":case"MultiPoint":for(i=0;i<u.length;i++){if(t(u[i],m,C,I,M)===!1)return!1;m++,_==="MultiPoint"&&I++}_==="LineString"&&I++;break;case"Polygon":case"MultiLineString":for(i=0;i<u.length;i++){for(n=0;n<u[i].length-f;n++){if(t(u[i][n],m,C,I,M)===!1)return!1;m++}_==="MultiLineString"&&I++,_==="Polygon"&&M++}_==="Polygon"&&I++;break;case"MultiPolygon":for(i=0;i<u.length;i++){for(M=0,n=0;n<u[i].length;n++){for(o=0;o<u[i][n].length-f;o++){if(t(u[i][n][o],m,C,I,M)===!1)return!1;m++}M++}I++}break;case"GeometryCollection":for(i=0;i<a.geometries.length;i++)if(go(a.geometries[i],t,e)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}s(go,"coordEach");function x4(r,t,e,i){var n=e;return go(r,function(o,a,l,u,h){a===0&&e===void 0?n=o:n=t(n,o,a,l,u,h)},i),n}s(x4,"coordReduce");function Wm(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}}s(Wm,"propEach");function S4(r,t,e){var i=e;return Wm(r,function(n,o){o===0&&e===void 0?i=n:i=t(i,n,o)}),i}s(S4,"propReduce");function Um(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++);}s(Um,"featureEach");function P4(r,t,e){var i=e;return Um(r,function(n,o){o===0&&e===void 0?i=n:i=t(i,n,o)}),i}s(P4,"featureReduce");function M4(r){var t=[];return go(r,function(e){t.push(e)}),t}s(M4,"coordAll");function bc(r,t){var e,i,n,o,a,l,u,h,f,m,y=0,x=r.type==="FeatureCollection",S=r.type==="Feature",P=x?r.features.length:1;for(e=0;e<P;e++){for(l=x?r.features[e].geometry:S?r.geometry:r,h=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,u=l?l.type==="GeometryCollection":!1,a=u?l.geometries.length:1,n=0;n<a;n++){if(o=u?l.geometries[n]:l,o===null){if(t(null,y,h,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,h,f,m)===!1)return!1;break}case"GeometryCollection":{for(i=0;i<o.geometries.length;i++)if(t(o.geometries[i],y,h,f,m)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}y++}}s(bc,"geomEach");function T4(r,t,e){var i=e;return bc(r,function(n,o,a,l,u){o===0&&e===void 0?i=n:i=t(i,n,o,a,l,u)}),i}s(T4,"geomReduce");function Es(r,t){bc(r,function(e,i,n,o,a){var l=e===null?null:e.type;switch(l){case null:case"Point":case"LineString":case"Polygon":return t(Bt.feature(e,n,{bbox:o,id:a}),i,0)===!1?!1:void 0}var u;switch(l){case"MultiPoint":u="Point";break;case"MultiLineString":u="LineString";break;case"MultiPolygon":u="Polygon";break}for(var h=0;h<e.coordinates.length;h++){var f=e.coordinates[h],m={type:u,coordinates:f};if(t(Bt.feature(m,n),i,h)===!1)return!1}})}s(Es,"flattenEach");function w4(r,t,e){var i=e;return Es(r,function(n,o,a){o===0&&a===0&&e===void 0?i=n:i=t(i,n,o,a)}),i}s(w4,"flattenReduce");function Zm(r,t){Es(r,function(e,i,n){var o=0;if(e.geometry){var a=e.geometry.type;if(!(a==="Point"||a==="MultiPoint")){var l,u=0,h=0,f=0;if(go(e,function(m,y,x,S,P){if(l===void 0||i>u||S>h||P>f){l=m,u=i,h=S,f=P,o=0;return}var g=Bt.lineString([l,m],e.properties);if(t(g,i,n,P,o)===!1)return!1;o++,l=m})===!1)return!1}}})}s(Zm,"segmentEach");function I4(r,t,e){var i=e,n=!1;return Zm(r,function(o,a,l,u,h){n===!1&&e===void 0?i=o:i=t(i,o,a,l,u,h),n=!0}),i}s(I4,"segmentReduce");function zm(r,t){if(!r)throw new Error("geojson is required");Es(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 l=0;l<a.length;l++)if(t(Bt.lineString(a[l],e.properties),i,n,l)===!1)return!1;break}}})}s(zm,"lineEach");function E4(r,t,e){var i=e;return zm(r,function(n,o,a,l){o===0&&e===void 0?i=n:i=t(i,n,o,a,l)}),i}s(E4,"lineReduce");function _4(r,t){if(t=t||{},!Bt.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,l;switch(r.type){case"FeatureCollection":e<0&&(e=r.features.length+e),a=a||r.features[e].properties,l=r.features[e].geometry;break;case"Feature":a=a||r.properties,l=r.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":l=r;break;default:throw new Error("geojson is invalid")}if(l===null)return null;var u=l.coordinates;switch(l.type){case"Point":case"MultiPoint":return null;case"LineString":return o<0&&(o=u.length+o-1),Bt.lineString([u[o],u[o+1]],a,t);case"Polygon":return n<0&&(n=u.length+n),o<0&&(o=u[n].length+o-1),Bt.lineString([u[n][o],u[n][o+1]],a,t);case"MultiLineString":return i<0&&(i=u.length+i),o<0&&(o=u[i].length+o-1),Bt.lineString([u[i][o],u[i][o+1]],a,t);case"MultiPolygon":return i<0&&(i=u.length+i),n<0&&(n=u[i].length+n),o<0&&(o=u[i][n].length-o-1),Bt.lineString([u[i][n][o],u[i][n][o+1]],a,t)}throw new Error("geojson is invalid")}s(_4,"findSegment");function L4(r,t){if(t=t||{},!Bt.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,l;switch(r.type){case"FeatureCollection":e<0&&(e=r.features.length+e),a=a||r.features[e].properties,l=r.features[e].geometry;break;case"Feature":a=a||r.properties,l=r.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":l=r;break;default:throw new Error("geojson is invalid")}if(l===null)return null;var u=l.coordinates;switch(l.type){case"Point":return Bt.point(u,a,t);case"MultiPoint":return i<0&&(i=u.length+i),Bt.point(u[i],a,t);case"LineString":return o<0&&(o=u.length+o),Bt.point(u[o],a,t);case"Polygon":return n<0&&(n=u.length+n),o<0&&(o=u[n].length+o),Bt.point(u[n][o],a,t);case"MultiLineString":return i<0&&(i=u.length+i),o<0&&(o=u[i].length+o),Bt.point(u[i][o],a,t);case"MultiPolygon":return i<0&&(i=u.length+i),n<0&&(n=u[i].length+n),o<0&&(o=u[i][n].length-o),Bt.point(u[i][n][o],a,t)}throw new Error("geojson is invalid")}s(L4,"findPoint");Tt.coordAll=M4;Tt.coordEach=go;Tt.coordReduce=x4;Tt.featureEach=Um;Tt.featureReduce=P4;Tt.findPoint=L4;Tt.findSegment=_4;Tt.flattenEach=Es;Tt.flattenReduce=w4;Tt.geomEach=bc;Tt.geomReduce=T4;Tt.lineEach=zm;Tt.lineReduce=E4;Tt.propEach=Wm;Tt.propReduce=S4;Tt.segmentEach=Zm;Tt.segmentReduce=I4});var Cc=N((qT,Jm)=>{"use strict";d();var $m=Object.prototype.toString;Jm.exports=s(function(t){var e=$m.call(t),i=e==="[object Arguments]";return i||(i=e!=="[object Array]"&&t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&$m.call(t.callee)==="[object Function]"),i},"isArguments")});var a1=N((KT,o1)=>{"use strict";d();var n1;Object.keys||(vo=Object.prototype.hasOwnProperty,xc=Object.prototype.toString,Km=Cc(),Sc=Object.prototype.propertyIsEnumerable,Qm=!Sc.call({toString:null},"toString"),t1=Sc.call(function(){},"prototype"),bo=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],_s=s(function(r){var t=r.constructor;return t&&t.prototype===r},"equalsConstructorPrototype"),e1={$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},r1=function(){if(typeof window>"u")return!1;for(var r in window)try{if(!e1["$"+r]&&vo.call(window,r)&&window[r]!==null&&typeof window[r]=="object")try{_s(window[r])}catch{return!0}}catch{return!0}return!1}(),i1=s(function(r){if(typeof window>"u"||!r1)return _s(r);try{return _s(r)}catch{return!1}},"equalsConstructorPrototypeIfNotBuggy"),n1=s(function(t){var e=t!==null&&typeof t=="object",i=xc.call(t)==="[object Function]",n=Km(t),o=e&&xc.call(t)==="[object String]",a=[];if(!e&&!i&&!n)throw new TypeError("Object.keys called on a non-object");var l=t1&&i;if(o&&t.length>0&&!vo.call(t,0))for(var u=0;u<t.length;++u)a.push(String(u));if(n&&t.length>0)for(var h=0;h<t.length;++h)a.push(String(h));else for(var f in t)!(l&&f==="prototype")&&vo.call(t,f)&&a.push(String(f));if(Qm)for(var m=i1(t),y=0;y<bo.length;++y)!(m&&bo[y]==="constructor")&&vo.call(t,bo[y])&&a.push(bo[y]);return a},"keys"));var vo,xc,Km,Sc,Qm,t1,bo,_s,e1,r1,i1;o1.exports=n1});var Os=N((ew,u1)=>{"use strict";d();var O4=Array.prototype.slice,D4=Cc(),s1=Object.keys,Ls=s1?s(function(t){return s1(t)},"keys"):a1(),l1=Object.keys;Ls.shim=s(function(){if(Object.keys){var t=function(){var e=Object.keys(arguments);return e&&e.length===arguments.length}(1,2);t||(Object.keys=s(function(i){return D4(i)?l1(O4.call(i)):l1(i)},"keys"))}else Object.keys=Ls;return Object.keys||Ls},"shimObjectKeys");u1.exports=Ls});var p1=N((nw,c1)=>{"use strict";d();c1.exports=Error});var d1=N((aw,h1)=>{"use strict";d();h1.exports=EvalError});var m1=N((lw,f1)=>{"use strict";d();f1.exports=RangeError});var g1=N((cw,y1)=>{"use strict";d();y1.exports=ReferenceError});var Pc=N((hw,v1)=>{"use strict";d();v1.exports=SyntaxError});var or=N((fw,b1)=>{"use strict";d();b1.exports=TypeError});var x1=N((yw,C1)=>{"use strict";d();C1.exports=URIError});var Co=N((vw,S1)=>{"use strict";d();S1.exports=s(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 Ds=N((xw,M1)=>{"use strict";d();var P1=typeof Symbol<"u"&&Symbol,A4=Co();M1.exports=s(function(){return typeof P1!="function"||typeof Symbol!="function"||typeof P1("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:A4()},"hasNativeSymbols")});var w1=N((Mw,T1)=>{"use strict";d();var Mc={__proto__:null,foo:{}},N4=Object;T1.exports=s(function(){return{__proto__:Mc}.foo===Mc.foo&&!(Mc instanceof N4)},"hasProto")});var _1=N((Iw,E1)=>{"use strict";d();var R4="Function.prototype.bind called on incompatible ",k4=Object.prototype.toString,F4=Math.max,B4="[object Function]",I1=s(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"),G4=s(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"),V4=s(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");E1.exports=s(function(t){var e=this;if(typeof e!="function"||k4.apply(e)!==B4)throw new TypeError(R4+e);for(var i=G4(arguments,1),n,o=s(function(){if(this instanceof n){var f=e.apply(this,I1(i,arguments));return Object(f)===f?f:this}return e.apply(t,I1(i,arguments))},"binder"),a=F4(0,e.length-i.length),l=[],u=0;u<a;u++)l[u]="$"+u;if(n=Function("binder","return function ("+V4(l,",")+"){ return binder.apply(this,arguments); }")(o),e.prototype){var h=s(function(){},"Empty");h.prototype=e.prototype,n.prototype=new h,h.prototype=null}return n},"bind")});var As=N((Lw,L1)=>{"use strict";d();var H4=_1();L1.exports=Function.prototype.bind||H4});var Tc=N((Dw,O1)=>{"use strict";d();var X4=Function.prototype.call,Y4=Object.prototype.hasOwnProperty,j4=As();O1.exports=j4.call(X4,Y4)});var Me=N((Nw,k1)=>{"use strict";d();var z,W4=p1(),U4=d1(),Z4=m1(),z4=g1(),cn=Pc(),un=or(),q4=x1(),R1=Function,wc=s(function(r){try{return R1('"use strict"; return ('+r+").constructor;")()}catch{}},"getEvalledConstructor"),ci=Object.getOwnPropertyDescriptor;if(ci)try{ci({},"")}catch{ci=null}var Ic=s(function(){throw new un},"throwTypeError"),$4=ci?function(){try{return arguments.callee,Ic}catch{try{return ci(arguments,"callee").get}catch{return Ic}}}():Ic,sn=Ds()(),J4=w1()(),Ot=Object.getPrototypeOf||(J4?function(r){return r.__proto__}:null),ln={},K4=typeof Uint8Array>"u"||!Ot?z:Ot(Uint8Array),pi={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?z:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?z:ArrayBuffer,"%ArrayIteratorPrototype%":sn&&Ot?Ot([][Symbol.iterator]()):z,"%AsyncFromSyncIteratorPrototype%":z,"%AsyncFunction%":ln,"%AsyncGenerator%":ln,"%AsyncGeneratorFunction%":ln,"%AsyncIteratorPrototype%":ln,"%Atomics%":typeof Atomics>"u"?z:Atomics,"%BigInt%":typeof BigInt>"u"?z:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?z:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?z:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?z:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":W4,"%eval%":eval,"%EvalError%":U4,"%Float32Array%":typeof Float32Array>"u"?z:Float32Array,"%Float64Array%":typeof Float64Array>"u"?z:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?z:FinalizationRegistry,"%Function%":R1,"%GeneratorFunction%":ln,"%Int8Array%":typeof Int8Array>"u"?z:Int8Array,"%Int16Array%":typeof Int16Array>"u"?z:Int16Array,"%Int32Array%":typeof Int32Array>"u"?z:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":sn&&Ot?Ot(Ot([][Symbol.iterator]())):z,"%JSON%":typeof JSON=="object"?JSON:z,"%Map%":typeof Map>"u"?z:Map,"%MapIteratorPrototype%":typeof Map>"u"||!sn||!Ot?z:Ot(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?z:Promise,"%Proxy%":typeof Proxy>"u"?z:Proxy,"%RangeError%":Z4,"%ReferenceError%":z4,"%Reflect%":typeof Reflect>"u"?z:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?z:Set,"%SetIteratorPrototype%":typeof Set>"u"||!sn||!Ot?z:Ot(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?z:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":sn&&Ot?Ot(""[Symbol.iterator]()):z,"%Symbol%":sn?Symbol:z,"%SyntaxError%":cn,"%ThrowTypeError%":$4,"%TypedArray%":K4,"%TypeError%":un,"%Uint8Array%":typeof Uint8Array>"u"?z:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?z:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?z:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?z:Uint32Array,"%URIError%":q4,"%WeakMap%":typeof WeakMap>"u"?z:WeakMap,"%WeakRef%":typeof WeakRef>"u"?z:WeakRef,"%WeakSet%":typeof WeakSet>"u"?z:WeakSet};if(Ot)try{null.error}catch(r){D1=Ot(Ot(r)),pi["%Error.prototype%"]=D1}var D1,Q4=s(function r(t){var e;if(t==="%AsyncFunction%")e=wc("async function () {}");else if(t==="%GeneratorFunction%")e=wc("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=wc("async function* () {}");else if(t==="%AsyncGenerator%"){var i=r("%AsyncGeneratorFunction%");i&&(e=i.prototype)}else if(t==="%AsyncIteratorPrototype%"){var n=r("%AsyncGenerator%");n&&Ot&&(e=Ot(n.prototype))}return pi[t]=e,e},"doEval"),A1={__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"]},xo=As(),Ns=Tc(),t5=xo.call(Function.call,Array.prototype.concat),e5=xo.call(Function.apply,Array.prototype.splice),N1=xo.call(Function.call,String.prototype.replace),Rs=xo.call(Function.call,String.prototype.slice),r5=xo.call(Function.call,RegExp.prototype.exec),i5=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,n5=/\\(\\)?/g,o5=s(function(t){var e=Rs(t,0,1),i=Rs(t,-1);if(e==="%"&&i!=="%")throw new cn("invalid intrinsic syntax, expected closing `%`");if(i==="%"&&e!=="%")throw new cn("invalid intrinsic syntax, expected opening `%`");var n=[];return N1(t,i5,function(o,a,l,u){n[n.length]=l?N1(u,n5,"$1"):a||o}),n},"stringToPath"),a5=s(function(t,e){var i=t,n;if(Ns(A1,i)&&(n=A1[i],i="%"+n[0]+"%"),Ns(pi,i)){var o=pi[i];if(o===ln&&(o=Q4(i)),typeof o>"u"&&!e)throw new un("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:n,name:i,value:o}}throw new cn("intrinsic "+t+" does not exist!")},"getBaseIntrinsic");k1.exports=s(function(t,e){if(typeof t!="string"||t.length===0)throw new un("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new un('"allowMissing" argument must be a boolean');if(r5(/^%?[^%]*%?$/,t)===null)throw new cn("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var i=o5(t),n=i.length>0?i[0]:"",o=a5("%"+n+"%",e),a=o.name,l=o.value,u=!1,h=o.alias;h&&(n=h[0],e5(i,t5([0,1],h)));for(var f=1,m=!0;f<i.length;f+=1){var y=i[f],x=Rs(y,0,1),S=Rs(y,-1);if((x==='"'||x==="'"||x==="`"||S==='"'||S==="'"||S==="`")&&x!==S)throw new cn("property names with quotes must have matching quotes");if((y==="constructor"||!m)&&(u=!0),n+="."+y,a="%"+n+"%",Ns(pi,a))l=pi[a];else if(l!=null){if(!(y in l)){if(!e)throw new un("base intrinsic for "+t+" exists, but the property is not available.");return}if(ci&&f+1>=i.length){var P=ci(l,y);m=!!P,m&&"get"in P&&!("originalValue"in P.get)?l=P.get:l=l[y]}else m=Ns(l,y),l=l[y];m&&!u&&(pi[a]=l)}}return l},"GetIntrinsic")});var Fs=N((Fw,F1)=>{"use strict";d();var s5=Me(),ks=s5("%Object.defineProperty%",!0)||!1;if(ks)try{ks({},"a",{value:1})}catch{ks=!1}F1.exports=ks});var Gs=N((Gw,B1)=>{"use strict";d();var l5=Me(),Bs=l5("%Object.getOwnPropertyDescriptor%",!0);if(Bs)try{Bs([],"length")}catch{Bs=null}B1.exports=Bs});var Vs=N((Hw,H1)=>{"use strict";d();var G1=Fs(),u5=Pc(),pn=or(),V1=Gs();H1.exports=s(function(t,e,i){if(!t||typeof t!="object"&&typeof t!="function")throw new pn("`obj` must be an object or a function`");if(typeof e!="string"&&typeof e!="symbol")throw new pn("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new pn("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new pn("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new pn("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new pn("`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,l=arguments.length>6?arguments[6]:!1,u=!!V1&&V1(t,e);if(G1)G1(t,e,{configurable:a===null&&u?u.configurable:!a,enumerable:n===null&&u?u.enumerable:!n,value:i,writable:o===null&&u?u.writable:!o});else if(l||!n&&!o&&!a)t[e]=i;else throw new u5("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},"defineDataProperty")});var Hs=N((jw,Y1)=>{"use strict";d();var Ec=Fs(),X1=s(function(){return!!Ec},"hasPropertyDescriptors");X1.hasArrayLengthDefineBug=s(function(){if(!Ec)return null;try{return Ec([],"length",{value:1}).length!==1}catch{return!0}},"hasArrayLengthDefineBug");Y1.exports=X1});var Nr=N((Zw,Z1)=>{"use strict";d();var c5=Os(),p5=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",h5=Object.prototype.toString,d5=Array.prototype.concat,j1=Vs(),f5=s(function(r){return typeof r=="function"&&h5.call(r)==="[object Function]"},"isFunction"),W1=Hs()(),m5=s(function(r,t,e,i){if(t in r){if(i===!0){if(r[t]===e)return}else if(!f5(i)||!i())return}W1?j1(r,t,e,!0):j1(r,t,e)},"defineProperty"),U1=s(function(r,t){var e=arguments.length>2?arguments[2]:{},i=c5(t);p5&&(i=d5.call(i,Object.getOwnPropertySymbols(t)));for(var n=0;n<i.length;n+=1)m5(r,i[n],t[i[n]],e[i[n]])},"defineProperties");U1.supportsDescriptors=!!W1;Z1.exports=U1});var K1=N(($w,J1)=>{"use strict";d();var y5=Me(),z1=Vs(),g5=Hs()(),q1=Gs(),$1=or(),v5=y5("%Math.floor%");J1.exports=s(function(t,e){if(typeof t!="function")throw new $1("`fn` is not a function");if(typeof e!="number"||e<0||e>4294967295||v5(e)!==e)throw new $1("`length` must be a positive 32-bit integer");var i=arguments.length>2&&!!arguments[2],n=!0,o=!0;if("length"in t&&q1){var a=q1(t,"length");a&&!a.configurable&&(n=!1),a&&!a.writable&&(o=!1)}return(n||o||!i)&&(g5?z1(t,"length",e,!0,!0):z1(t,"length",e)),t},"setFunctionLength")});var hi=N((Qw,Xs)=>{"use strict";d();var _c=As(),Ys=Me(),b5=K1(),C5=or(),e0=Ys("%Function.prototype.apply%"),r0=Ys("%Function.prototype.call%"),i0=Ys("%Reflect.apply%",!0)||_c.call(r0,e0),Q1=Fs(),x5=Ys("%Math.max%");Xs.exports=s(function(t){if(typeof t!="function")throw new C5("a function is required");var e=i0(_c,r0,arguments);return b5(e,1+x5(0,t.length-(arguments.length-1)),!0)},"callBind");var t0=s(function(){return i0(_c,e0,arguments)},"applyBind");Q1?Q1(Xs.exports,"apply",{value:t0}):Xs.exports.apply=t0});var se=N((rI,a0)=>{"use strict";d();var n0=Me(),o0=hi(),S5=o0(n0("String.prototype.indexOf"));a0.exports=s(function(t,e){var i=n0(t,!!e);return typeof i=="function"&&S5(t,".prototype.")>-1?o0(i):i},"callBoundIntrinsic")});var Lc=N((oI,p0)=>{"use strict";d();var P5=Os(),u0=Co()(),c0=se(),s0=Object,M5=c0("Array.prototype.push"),l0=c0("Object.prototype.propertyIsEnumerable"),T5=u0?Object.getOwnPropertySymbols:null;p0.exports=s(function(t,e){if(t==null)throw new TypeError("target must be an object");var i=s0(t);if(arguments.length===1)return i;for(var n=1;n<arguments.length;++n){var o=s0(arguments[n]),a=P5(o),l=u0&&(Object.getOwnPropertySymbols||T5);if(l)for(var u=l(o),h=0;h<u.length;++h){var f=u[h];l0(o,f)&&M5(a,f)}for(var m=0;m<a.length;++m){var y=a[m];if(l0(o,y)){var x=o[y];i[y]=x}}}return i},"assign")});var Dc=N((lI,h0)=>{"use strict";d();var Oc=Lc(),w5=s(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"),I5=s(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");h0.exports=s(function(){return!Object.assign||w5()||I5()?Oc:Object.assign},"getPolyfill")});var f0=N((pI,d0)=>{"use strict";d();var E5=Nr(),_5=Dc();d0.exports=s(function(){var t=_5();return E5(Object,{assign:t},{assign:function(){return Object.assign!==t}}),t},"shimAssign")});var v0=N((fI,g0)=>{"use strict";d();var L5=Nr(),O5=hi(),D5=Lc(),m0=Dc(),A5=f0(),N5=O5.apply(m0()),y0=s(function(t,e){return N5(Object,arguments)},"assign");L5(y0,{getPolyfill:m0,implementation:D5,shim:A5});g0.exports=y0});var C0=N((gI,b0)=>{"use strict";d();var Po=s(function(){return typeof s(function(){},"f").name=="string"},"functionsHaveNames"),So=Object.getOwnPropertyDescriptor;if(So)try{So([],"length")}catch{So=null}Po.functionsHaveConfigurableNames=s(function(){if(!Po()||!So)return!1;var t=So(function(){},"name");return!!t&&!!t.configurable},"functionsHaveConfigurableNames");var R5=Function.prototype.bind;Po.boundFunctionsHaveNames=s(function(){return Po()&&typeof R5=="function"&&s(function(){},"f").bind().name!==""},"boundFunctionsHaveNames");b0.exports=Po});var P0=N((CI,S0)=>{"use strict";d();var x0=Vs(),k5=Hs()(),F5=C0().functionsHaveConfigurableNames(),B5=or();S0.exports=s(function(t,e){if(typeof t!="function")throw new B5("`fn` is not a function");var i=arguments.length>2&&!!arguments[2];return(!i||F5)&&(k5?x0(t,"name",e,!0,!0):x0(t,"name",e)),t},"setFunctionName")});var Ac=N((PI,M0)=>{"use strict";d();var G5=P0(),V5=or(),H5=Object;M0.exports=G5(s(function(){if(this==null||this!==H5(this))throw new V5("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 Nc=N((wI,T0)=>{"use strict";d();var X5=Ac(),Y5=Nr().supportsDescriptors,j5=Object.getOwnPropertyDescriptor;T0.exports=s(function(){if(Y5&&/a/mig.flags==="gim"){var t=j5(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 X5},"getPolyfill")});var E0=N((_I,I0)=>{"use strict";d();var W5=Nr().supportsDescriptors,U5=Nc(),Z5=Object.getOwnPropertyDescriptor,z5=Object.defineProperty,q5=TypeError,w0=Object.getPrototypeOf,$5=/a/;I0.exports=s(function(){if(!W5||!w0)throw new q5("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var t=U5(),e=w0($5),i=Z5(e,"flags");return(!i||i.get!==t)&&z5(e,"flags",{configurable:!0,enumerable:!1,get:t}),t},"shimFlags")});var D0=N((DI,O0)=>{"use strict";d();var J5=Nr(),K5=hi(),Q5=Ac(),_0=Nc(),t7=E0(),L0=K5(_0());J5(L0,{getPolyfill:_0,implementation:Q5,shim:t7});O0.exports=L0});var Rr=N((NI,A0)=>{"use strict";d();var e7=Co();A0.exports=s(function(){return e7()&&!!Symbol.toStringTag},"hasToStringTagShams")});var kc=N((FI,R0)=>{"use strict";d();var r7=Rr()(),i7=se(),Rc=i7("Object.prototype.toString"),js=s(function(t){return r7&&t&&typeof t=="object"&&Symbol.toStringTag in t?!1:Rc(t)==="[object Arguments]"},"isArguments"),N0=s(function(t){return js(t)?!0:t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&Rc(t)!=="[object Array]"&&Rc(t.callee)==="[object Function]"},"isArguments"),n7=function(){return js(arguments)}();js.isLegacyArguments=N0;R0.exports=n7?js:N0});var k0=N(()=>{d()});var ry=N((YI,ey)=>{d();var Uc=typeof Map=="function"&&Map.prototype,Fc=Object.getOwnPropertyDescriptor&&Uc?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,Us=Uc&&Fc&&typeof Fc.get=="function"?Fc.get:null,F0=Uc&&Map.prototype.forEach,Zc=typeof Set=="function"&&Set.prototype,Bc=Object.getOwnPropertyDescriptor&&Zc?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,Zs=Zc&&Bc&&typeof Bc.get=="function"?Bc.get:null,B0=Zc&&Set.prototype.forEach,o7=typeof WeakMap=="function"&&WeakMap.prototype,To=o7?WeakMap.prototype.has:null,a7=typeof WeakSet=="function"&&WeakSet.prototype,wo=a7?WeakSet.prototype.has:null,s7=typeof WeakRef=="function"&&WeakRef.prototype,G0=s7?WeakRef.prototype.deref:null,l7=Boolean.prototype.valueOf,u7=Object.prototype.toString,c7=Function.prototype.toString,p7=String.prototype.match,zc=String.prototype.slice,Fr=String.prototype.replace,h7=String.prototype.toUpperCase,V0=String.prototype.toLowerCase,q0=RegExp.prototype.test,H0=Array.prototype.concat,Xe=Array.prototype.join,d7=Array.prototype.slice,X0=Math.floor,Hc=typeof BigInt=="function"?BigInt.prototype.valueOf:null,Gc=Object.getOwnPropertySymbols,Xc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,hn=typeof Symbol=="function"&&typeof Symbol.iterator=="object",Gt=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===hn||!0)?Symbol.toStringTag:null,$0=Object.prototype.propertyIsEnumerable,Y0=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(r){return r.__proto__}:null);function j0(r,t){if(r===1/0||r===-1/0||r!==r||r&&r>-1e3&&r<1e3||q0.call(/e/,t))return t;var e=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof r=="number"){var i=r<0?-X0(-r):X0(r);if(i!==r){var n=String(i),o=zc.call(t,n.length+1);return Fr.call(n,e,"$&_")+"."+Fr.call(Fr.call(o,/([0-9]{3})/g,"$&_"),/_$/,"")}}return Fr.call(t,e,"$&_")}s(j0,"addNumericSeparator");var Yc=k0(),W0=Yc.custom,U0=K0(W0)?W0:null;ey.exports=s(function r(t,e,i,n){var o=e||{};if(kr(o,"quoteStyle")&&o.quoteStyle!=="single"&&o.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(kr(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=kr(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(kr(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(kr(o,"numericSeparator")&&typeof o.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var l=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 ty(t,o);if(typeof t=="number"){if(t===0)return 1/0/t>0?"0":"-0";var u=String(t);return l?j0(t,u):u}if(typeof t=="bigint"){var h=String(t)+"n";return l?j0(t,h):h}var f=typeof o.depth>"u"?5:o.depth;if(typeof i>"u"&&(i=0),i>=f&&f>0&&typeof t=="object")return jc(t)?"[Array]":"[Object]";var m=O7(o,i);if(typeof n>"u")n=[];else if(Q0(n,t)>=0)return"[Circular]";function y(lt,ht,yt){if(ht&&(n=d7.call(n),n.push(ht)),yt){var At={depth:o.depth};return kr(o,"quoteStyle")&&(At.quoteStyle=o.quoteStyle),r(lt,At,i+1,n)}return r(lt,o,i+1,n)}if(s(y,"inspect"),typeof t=="function"&&!Z0(t)){var x=S7(t),S=Ws(t,y);return"[Function"+(x?": "+x:" (anonymous)")+"]"+(S.length>0?" { "+Xe.call(S,", ")+" }":"")}if(K0(t)){var P=hn?Fr.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):Xc.call(t);return typeof t=="object"&&!hn?Mo(P):P}if(E7(t)){for(var g="<"+V0.call(String(t.nodeName)),C=t.attributes||[],w=0;w<C.length;w++)g+=" "+C[w].name+"="+J0(f7(C[w].value),"double",o);return g+=">",t.childNodes&&t.childNodes.length&&(g+="..."),g+="</"+V0.call(String(t.nodeName))+">",g}if(jc(t)){if(t.length===0)return"[]";var I=Ws(t,y);return m&&!L7(I)?"["+Wc(I,m)+"]":"[ "+Xe.call(I,", ")+" ]"}if(y7(t)){var M=Ws(t,y);return!("cause"in Error.prototype)&&"cause"in t&&!$0.call(t,"cause")?"{ ["+String(t)+"] "+Xe.call(H0.call("[cause]: "+y(t.cause),M),", ")+" }":M.length===0?"["+String(t)+"]":"{ ["+String(t)+"] "+Xe.call(M,", ")+" }"}if(typeof t=="object"&&a){if(U0&&typeof t[U0]=="function"&&Yc)return Yc(t,{depth:f-i});if(a!=="symbol"&&typeof t.inspect=="function")return t.inspect()}if(P7(t)){var _=[];return F0&&F0.call(t,function(lt,ht){_.push(y(ht,t,!0)+" => "+y(lt,t))}),z0("Map",Us.call(t),_,m)}if(w7(t)){var D=[];return B0&&B0.call(t,function(lt){D.push(y(lt,t))}),z0("Set",Zs.call(t),D,m)}if(M7(t))return Vc("WeakMap");if(I7(t))return Vc("WeakSet");if(T7(t))return Vc("WeakRef");if(v7(t))return Mo(y(Number(t)));if(C7(t))return Mo(y(Hc.call(t)));if(b7(t))return Mo(l7.call(t));if(g7(t))return Mo(y(String(t)));if(typeof window<"u"&&t===window)return"{ [object Window] }";if(t===global)return"{ [object globalThis] }";if(!m7(t)&&!Z0(t)){var k=Ws(t,y),B=Y0?Y0(t)===Object.prototype:t instanceof Object||t.constructor===Object,R=t instanceof Object?"":"null prototype",G=!B&&Gt&&Object(t)===t&&Gt in t?zc.call(Br(t),8,-1):R?"Object":"",X=B||typeof t.constructor!="function"?"":t.constructor.name?t.constructor.name+" ":"",Q=X+(G||R?"["+Xe.call(H0.call([],G||[],R||[]),": ")+"] ":"");return k.length===0?Q+"{}":m?Q+"{"+Wc(k,m)+"}":Q+"{ "+Xe.call(k,", ")+" }"}return String(t)},"inspect_");function J0(r,t,e){var i=(e.quoteStyle||t)==="double"?'"':"'";return i+r+i}s(J0,"wrapQuotes");function f7(r){return Fr.call(String(r),/"/g,"&quot;")}s(f7,"quote");function jc(r){return Br(r)==="[object Array]"&&(!Gt||!(typeof r=="object"&&Gt in r))}s(jc,"isArray");function m7(r){return Br(r)==="[object Date]"&&(!Gt||!(typeof r=="object"&&Gt in r))}s(m7,"isDate");function Z0(r){return Br(r)==="[object RegExp]"&&(!Gt||!(typeof r=="object"&&Gt in r))}s(Z0,"isRegExp");function y7(r){return Br(r)==="[object Error]"&&(!Gt||!(typeof r=="object"&&Gt in r))}s(y7,"isError");function g7(r){return Br(r)==="[object String]"&&(!Gt||!(typeof r=="object"&&Gt in r))}s(g7,"isString");function v7(r){return Br(r)==="[object Number]"&&(!Gt||!(typeof r=="object"&&Gt in r))}s(v7,"isNumber");function b7(r){return Br(r)==="[object Boolean]"&&(!Gt||!(typeof r=="object"&&Gt in r))}s(b7,"isBoolean");function K0(r){if(hn)return r&&typeof r=="object"&&r instanceof Symbol;if(typeof r=="symbol")return!0;if(!r||typeof r!="object"||!Xc)return!1;try{return Xc.call(r),!0}catch{}return!1}s(K0,"isSymbol");function C7(r){if(!r||typeof r!="object"||!Hc)return!1;try{return Hc.call(r),!0}catch{}return!1}s(C7,"isBigInt");var x7=Object.prototype.hasOwnProperty||function(r){return r in this};function kr(r,t){return x7.call(r,t)}s(kr,"has");function Br(r){return u7.call(r)}s(Br,"toStr");function S7(r){if(r.name)return r.name;var t=p7.call(c7.call(r),/^function\s*([\w$]+)/);return t?t[1]:null}s(S7,"nameOf");function Q0(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}s(Q0,"indexOf");function P7(r){if(!Us||!r||typeof r!="object")return!1;try{Us.call(r);try{Zs.call(r)}catch{return!0}return r instanceof Map}catch{}return!1}s(P7,"isMap");function M7(r){if(!To||!r||typeof r!="object")return!1;try{To.call(r,To);try{wo.call(r,wo)}catch{return!0}return r instanceof WeakMap}catch{}return!1}s(M7,"isWeakMap");function T7(r){if(!G0||!r||typeof r!="object")return!1;try{return G0.call(r),!0}catch{}return!1}s(T7,"isWeakRef");function w7(r){if(!Zs||!r||typeof r!="object")return!1;try{Zs.call(r);try{Us.call(r)}catch{return!0}return r instanceof Set}catch{}return!1}s(w7,"isSet");function I7(r){if(!wo||!r||typeof r!="object")return!1;try{wo.call(r,wo);try{To.call(r,To)}catch{return!0}return r instanceof WeakSet}catch{}return!1}s(I7,"isWeakSet");function E7(r){return!r||typeof r!="object"?!1:typeof HTMLElement<"u"&&r instanceof HTMLElement?!0:typeof r.nodeName=="string"&&typeof r.getAttribute=="function"}s(E7,"isElement");function ty(r,t){if(r.length>t.maxStringLength){var e=r.length-t.maxStringLength,i="... "+e+" more character"+(e>1?"s":"");return ty(zc.call(r,0,t.maxStringLength),t)+i}var n=Fr.call(Fr.call(r,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,_7);return J0(n,"single",t)}s(ty,"inspectString");function _7(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":"")+h7.call(t.toString(16))}s(_7,"lowbyte");function Mo(r){return"Object("+r+")"}s(Mo,"markBoxed");function Vc(r){return r+" { ? }"}s(Vc,"weakCollectionOf");function z0(r,t,e,i){var n=i?Wc(e,i):Xe.call(e,", ");return r+" ("+t+") {"+n+"}"}s(z0,"collectionOf");function L7(r){for(var t=0;t<r.length;t++)if(Q0(r[t],`
2
+ `)>=0)return!1;return!0}s(L7,"singleLineValues");function O7(r,t){var e;if(r.indent===" ")e=" ";else if(typeof r.indent=="number"&&r.indent>0)e=Xe.call(Array(r.indent+1)," ");else return null;return{base:e,prev:Xe.call(Array(t+1),e)}}s(O7,"getIndent");function Wc(r,t){if(r.length===0)return"";var e=`
3
+ `+t.prev+t.base;return e+Xe.call(r,","+e)+`
4
+ `+t.prev}s(Wc,"indentedJoin");function Ws(r,t){var e=jc(r),i=[];if(e){i.length=r.length;for(var n=0;n<r.length;n++)i[n]=kr(r,n)?t(r[n],r):""}var o=typeof Gc=="function"?Gc(r):[],a;if(hn){a={};for(var l=0;l<o.length;l++)a["$"+o[l]]=o[l]}for(var u in r)kr(r,u)&&(e&&String(Number(u))===u&&u<r.length||hn&&a["$"+u]instanceof Symbol||(q0.call(/[^\w$]/,u)?i.push(t(u,r)+": "+t(r[u],r)):i.push(u+": "+t(r[u],r))));if(typeof Gc=="function")for(var h=0;h<o.length;h++)$0.call(r,o[h])&&i.push("["+t(o[h])+"]: "+t(r[o[h]],r));return i}s(Ws,"arrObjKeys")});var $c=N((UI,ny)=>{"use strict";d();var iy=Me(),dn=se(),D7=ry(),A7=or(),zs=iy("%WeakMap%",!0),qs=iy("%Map%",!0),N7=dn("WeakMap.prototype.get",!0),R7=dn("WeakMap.prototype.set",!0),k7=dn("WeakMap.prototype.has",!0),F7=dn("Map.prototype.get",!0),B7=dn("Map.prototype.set",!0),G7=dn("Map.prototype.has",!0),qc=s(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"),V7=s(function(r,t){var e=qc(r,t);return e&&e.value},"listGet"),H7=s(function(r,t,e){var i=qc(r,t);i?i.value=e:r.next={key:t,next:r.next,value:e}},"listSet"),X7=s(function(r,t){return!!qc(r,t)},"listHas");ny.exports=s(function(){var t,e,i,n={assert:function(o){if(!n.has(o))throw new A7("Side channel does not contain "+D7(o))},get:function(o){if(zs&&o&&(typeof o=="object"||typeof o=="function")){if(t)return N7(t,o)}else if(qs){if(e)return F7(e,o)}else if(i)return V7(i,o)},has:function(o){if(zs&&o&&(typeof o=="object"||typeof o=="function")){if(t)return k7(t,o)}else if(qs){if(e)return G7(e,o)}else if(i)return X7(i,o);return!1},set:function(o,a){zs&&o&&(typeof o=="object"||typeof o=="function")?(t||(t=new zs),R7(t,o,a)):qs?(e||(e=new qs),B7(e,o,a)):(i||(i={key:{},next:null}),H7(i,o,a))}};return n},"getSideChannel")});var ay=N((qI,oy)=>{"use strict";d();var Y7=Tc(),Io=$c()(),ar=or(),Jc={assert:function(r,t){if(!r||typeof r!="object"&&typeof r!="function")throw new ar("`O` is not an object");if(typeof t!="string")throw new ar("`slot` must be a string");if(Io.assert(r),!Jc.has(r,t))throw new ar("`"+t+"` is not present on `O`")},get:function(r,t){if(!r||typeof r!="object"&&typeof r!="function")throw new ar("`O` is not an object");if(typeof t!="string")throw new ar("`slot` must be a string");var e=Io.get(r);return e&&e["$"+t]},has:function(r,t){if(!r||typeof r!="object"&&typeof r!="function")throw new ar("`O` is not an object");if(typeof t!="string")throw new ar("`slot` must be a string");var e=Io.get(r);return!!e&&Y7(e,"$"+t)},set:function(r,t,e){if(!r||typeof r!="object"&&typeof r!="function")throw new ar("`O` is not an object");if(typeof t!="string")throw new ar("`slot` must be a string");var i=Io.get(r);i||(i={},Io.set(r,i)),i["$"+t]=e}};Object.freeze&&Object.freeze(Jc);oy.exports=Jc});var uy=N((JI,ly)=>{"use strict";d();var Eo=ay(),j7=SyntaxError,sy=typeof StopIteration=="object"?StopIteration:null;ly.exports=s(function(t){if(!sy)throw new j7("this environment lacks StopIteration");Eo.set(t,"[[Done]]",!1);var e={next:s(function(){var n=Eo.get(this,"[[Iterator]]"),o=Eo.get(n,"[[Done]]");try{return{done:o,value:o?void 0:n.next()}}catch(a){if(Eo.set(n,"[[Done]]",!0),a!==sy)throw a;return{done:!0,value:void 0}}},"next")};return Eo.set(e,"[[Iterator]]",t),e},"getStopIterationIterator")});var Kc=N((tE,cy)=>{d();var W7={}.toString;cy.exports=Array.isArray||function(r){return W7.call(r)=="[object Array]"}});var Qc=N((rE,py)=>{"use strict";d();var U7=String.prototype.valueOf,Z7=s(function(t){try{return U7.call(t),!0}catch{return!1}},"tryStringObject"),z7=Object.prototype.toString,q7="[object String]",$7=Rr()();py.exports=s(function(t){return typeof t=="string"?!0:typeof t!="object"?!1:$7?Z7(t):z7.call(t)===q7},"isString")});var ep=N((oE,fy)=>{"use strict";d();var tp=typeof Map=="function"&&Map.prototype?Map:null,J7=typeof Set=="function"&&Set.prototype?Set:null,$s;tp||($s=s(function(t){return!1},"isMap"));var dy=tp?Map.prototype.has:null,hy=J7?Set.prototype.has:null;!$s&&!dy&&($s=s(function(t){return!1},"isMap"));fy.exports=$s||s(function(t){if(!t||typeof t!="object")return!1;try{if(dy.call(t),hy)try{hy.call(t)}catch{return!0}return t instanceof tp}catch{}return!1},"isMap")});var ip=N((lE,gy)=>{"use strict";d();var K7=typeof Map=="function"&&Map.prototype?Map:null,rp=typeof Set=="function"&&Set.prototype?Set:null,Js;rp||(Js=s(function(t){return!1},"isSet"));var my=K7?Map.prototype.has:null,yy=rp?Set.prototype.has:null;!Js&&!yy&&(Js=s(function(t){return!1},"isSet"));gy.exports=Js||s(function(t){if(!t||typeof t!="object")return!1;try{if(yy.call(t),my)try{my.call(t)}catch{return!0}return t instanceof rp}catch{}return!1},"isSet")});var _y=N((pE,tl)=>{"use strict";d();var vy=kc(),by=uy();Ds()()||Co()()?(Ks=Symbol.iterator,tl.exports=s(function(t){if(t!=null&&typeof t[Ks]<"u")return t[Ks]();if(vy(t))return Array.prototype[Ks].call(t)},"getIterator")):(Cy=Kc(),xy=Qc(),np=Me(),Sy=np("%Map%",!0),Py=np("%Set%",!0),he=se(),op=he("Array.prototype.push"),ap=he("String.prototype.charCodeAt"),My=he("String.prototype.slice"),Ty=s(function(t,e){var i=t.length;if(e+1>=i)return e+1;var n=ap(t,e);if(n<55296||n>56319)return e+1;var o=ap(t,e+1);return o<56320||o>57343?e+1:e+2},"advanceStringIndex"),Qs=s(function(t){var e=0;return{next:s(function(){var n=e>=t.length,o;return n||(o=t[e],e+=1),{done:n,value:o}},"next")}},"getArrayIterator"),sp=s(function(t,e){if(Cy(t)||vy(t))return Qs(t);if(xy(t)){var i=0;return{next:s(function(){var o=Ty(t,i),a=My(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"),!Sy&&!Py?tl.exports=s(function(t){if(t!=null)return sp(t,!0)},"getIterator"):(wy=ep(),Iy=ip(),lp=he("Map.prototype.forEach",!0),up=he("Set.prototype.forEach",!0),(typeof b>"u"||!b.versions||!b.versions.node)&&(cp=he("Map.prototype.iterator",!0),pp=he("Set.prototype.iterator",!0)),hp=he("Map.prototype.@@iterator",!0)||he("Map.prototype._es6-shim iterator_",!0),dp=he("Set.prototype.@@iterator",!0)||he("Set.prototype._es6-shim iterator_",!0),Ey=s(function(t){if(wy(t)){if(cp)return by(cp(t));if(hp)return hp(t);if(lp){var e=[];return lp(t,function(n,o){op(e,[o,n])}),Qs(e)}}if(Iy(t)){if(pp)return by(pp(t));if(dp)return dp(t);if(up){var i=[];return up(t,function(n){op(i,n)}),Qs(i)}}},"getCollectionIterator"),tl.exports=s(function(t){return Ey(t)||sp(t)},"getIterator")));var Ks,Cy,xy,np,Sy,Py,he,op,ap,My,Ty,Qs,sp,wy,Iy,lp,up,cp,pp,hp,dp,Ey});var fp=N((fE,Oy)=>{"use strict";d();var Ly=s(function(r){return r!==r},"numberIsNaN");Oy.exports=s(function(t,e){return t===0&&e===0?1/t===1/e:!!(t===e||Ly(t)&&Ly(e))},"is")});var mp=N((gE,Dy)=>{"use strict";d();var Q7=fp();Dy.exports=s(function(){return typeof Object.is=="function"?Object.is:Q7},"getPolyfill")});var Ny=N((CE,Ay)=>{"use strict";d();var t6=mp(),e6=Nr();Ay.exports=s(function(){var t=t6();return e6(Object,{is:t},{is:s(function(){return Object.is!==t},"testObjectIs")}),t},"shimObjectIs")});var By=N((PE,Fy)=>{"use strict";d();var r6=Nr(),i6=hi(),n6=fp(),Ry=mp(),o6=Ny(),ky=i6(Ry(),Object);r6(ky,{getPolyfill:Ry,implementation:n6,shim:o6});Fy.exports=ky});var gp=N((TE,Xy)=>{"use strict";d();var a6=hi(),Hy=se(),s6=Me(),yp=s6("%ArrayBuffer%",!0),el=Hy("ArrayBuffer.prototype.byteLength",!0),l6=Hy("Object.prototype.toString"),Gy=!!yp&&!el&&new yp(0).slice,Vy=!!Gy&&a6(Gy);Xy.exports=s(el||Vy?function(t){if(!t||typeof t!="object")return!1;try{return el?el(t):Vy(t,0),!0}catch{return!1}}:yp?function(t){return l6(t)==="[object ArrayBuffer]"}:function(t){return!1},"isArrayBuffer")});var jy=N((EE,Yy)=>{"use strict";d();var u6=Date.prototype.getDay,c6=s(function(t){try{return u6.call(t),!0}catch{return!1}},"tryDateGetDayCall"),p6=Object.prototype.toString,h6="[object Date]",d6=Rr()();Yy.exports=s(function(t){return typeof t!="object"||t===null?!1:d6?c6(t):p6.call(t)===h6},"isDateObject")});var qy=N((OE,zy)=>{"use strict";d();var vp=se(),Wy=Rr()(),Uy,Zy,bp,Cp;Wy&&(Uy=vp("Object.prototype.hasOwnProperty"),Zy=vp("RegExp.prototype.exec"),bp={},rl=s(function(){throw bp},"throwRegexMarker"),Cp={toString:rl,valueOf:rl},typeof Symbol.toPrimitive=="symbol"&&(Cp[Symbol.toPrimitive]=rl));var rl,f6=vp("Object.prototype.toString"),m6=Object.getOwnPropertyDescriptor,y6="[object RegExp]";zy.exports=s(Wy?function(t){if(!t||typeof t!="object")return!1;var e=m6(t,"lastIndex"),i=e&&Uy(e,"value");if(!i)return!1;try{Zy(t,Cp)}catch(n){return n===bp}}:function(t){return!t||typeof t!="object"&&typeof t!="function"?!1:f6(t)===y6},"isRegex")});var Ky=N((NE,Jy)=>{"use strict";d();var g6=se(),$y=g6("SharedArrayBuffer.prototype.byteLength",!0);Jy.exports=s($y?function(t){if(!t||typeof t!="object")return!1;try{return $y(t),!0}catch{return!1}}:function(t){return!1},"isSharedArrayBuffer")});var tg=N((FE,Qy)=>{"use strict";d();var v6=Number.prototype.toString,b6=s(function(t){try{return v6.call(t),!0}catch{return!1}},"tryNumberObject"),C6=Object.prototype.toString,x6="[object Number]",S6=Rr()();Qy.exports=s(function(t){return typeof t=="number"?!0:typeof t!="object"?!1:S6?b6(t):C6.call(t)===x6},"isNumberObject")});var ig=N((VE,rg)=>{"use strict";d();var eg=se(),P6=eg("Boolean.prototype.toString"),M6=eg("Object.prototype.toString"),T6=s(function(t){try{return P6(t),!0}catch{return!1}},"booleanBrandCheck"),w6="[object Boolean]",I6=Rr()();rg.exports=s(function(t){return typeof t=="boolean"?!0:t===null||typeof t!="object"?!1:I6&&Symbol.toStringTag in t?T6(t):M6(t)===w6},"isBoolean")});var sg=N((YE,xp)=>{"use strict";d();var E6=Object.prototype.toString,_6=Ds()();_6?(ng=Symbol.prototype.toString,og=/^Symbol\(.*\)$/,ag=s(function(t){return typeof t.valueOf()!="symbol"?!1:og.test(ng.call(t))},"isRealSymbolObject"),xp.exports=s(function(t){if(typeof t=="symbol")return!0;if(E6.call(t)!=="[object Symbol]")return!1;try{return ag(t)}catch{return!1}},"isSymbol")):xp.exports=s(function(t){return!1},"isSymbol");var ng,og,ag});var cg=N((UE,ug)=>{"use strict";d();var lg=typeof BigInt<"u"&&BigInt;ug.exports=s(function(){return typeof lg=="function"&&typeof BigInt=="function"&&typeof lg(42)=="bigint"&&typeof BigInt(42)=="bigint"},"hasNativeBigInts")});var dg=N((qE,Sp)=>{"use strict";d();var L6=cg()();L6?(pg=BigInt.prototype.valueOf,hg=s(function(t){try{return pg.call(t),!0}catch{}return!1},"tryBigIntObject"),Sp.exports=s(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:hg(t)},"isBigInt")):Sp.exports=s(function(t){return!1},"isBigInt");var pg,hg});var mg=N((KE,fg)=>{"use strict";d();var O6=Qc(),D6=tg(),A6=ig(),N6=sg(),R6=dg();fg.exports=s(function(t){if(t==null||typeof t!="object"&&typeof t!="function")return null;if(O6(t))return"String";if(D6(t))return"Number";if(A6(t))return"Boolean";if(N6(t))return"Symbol";if(R6(t))return"BigInt"},"whichBoxedPrimitive")});var vg=N((e_,gg)=>{"use strict";d();var il=typeof WeakMap=="function"&&WeakMap.prototype?WeakMap:null,yg=typeof WeakSet=="function"&&WeakSet.prototype?WeakSet:null,nl;il||(nl=s(function(t){return!1},"isWeakMap"));var Mp=il?il.prototype.has:null,Pp=yg?yg.prototype.has:null;!nl&&!Mp&&(nl=s(function(t){return!1},"isWeakMap"));gg.exports=nl||s(function(t){if(!t||typeof t!="object")return!1;try{if(Mp.call(t,Mp),Pp)try{Pp.call(t,Pp)}catch{return!0}return t instanceof il}catch{}return!1},"isWeakMap")});var Cg=N((n_,wp)=>{"use strict";d();var k6=Me(),bg=se(),F6=k6("%WeakSet%",!0),Tp=bg("WeakSet.prototype.has",!0);Tp?(ol=bg("WeakMap.prototype.has",!0),wp.exports=s(function(t){if(!t||typeof t!="object")return!1;try{if(Tp(t,Tp),ol)try{ol(t,ol)}catch{return!0}return t instanceof F6}catch{}return!1},"isWeakSet")):wp.exports=s(function(t){return!1},"isWeakSet");var ol});var Sg=N((s_,xg)=>{"use strict";d();var B6=ep(),G6=ip(),V6=vg(),H6=Cg();xg.exports=s(function(t){if(t&&typeof t=="object"){if(B6(t))return"Map";if(G6(t))return"Set";if(V6(t))return"WeakMap";if(H6(t))return"WeakSet"}return!1},"whichCollection")});var wg=N((c_,Tg)=>{"use strict";d();var Mg=Function.prototype.toString,fn=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,Ep,al;if(typeof fn=="function"&&typeof Object.defineProperty=="function")try{Ep=Object.defineProperty({},"length",{get:function(){throw al}}),al={},fn(function(){throw 42},null,Ep)}catch(r){r!==al&&(fn=null)}else fn=null;var X6=/^\s*class\b/,_p=s(function(t){try{var e=Mg.call(t);return X6.test(e)}catch{return!1}},"isES6ClassFunction"),Ip=s(function(t){try{return _p(t)?!1:(Mg.call(t),!0)}catch{return!1}},"tryFunctionToStr"),sl=Object.prototype.toString,Y6="[object Object]",j6="[object Function]",W6="[object GeneratorFunction]",U6="[object HTMLAllCollection]",Z6="[object HTML document.all class]",z6="[object HTMLCollection]",q6=typeof Symbol=="function"&&!!Symbol.toStringTag,$6=!(0 in[,]),Lp=s(function(){return!1},"isDocumentDotAll");typeof document=="object"&&(Pg=document.all,sl.call(Pg)===sl.call(document.all)&&(Lp=s(function(t){if(($6||!t)&&(typeof t>"u"||typeof t=="object"))try{var e=sl.call(t);return(e===U6||e===Z6||e===z6||e===Y6)&&t("")==null}catch{}return!1},"isDocumentDotAll")));var Pg;Tg.exports=s(fn?function(t){if(Lp(t))return!0;if(!t||typeof t!="function"&&typeof t!="object")return!1;try{fn(t,null,Ep)}catch(e){if(e!==al)return!1}return!_p(t)&&Ip(t)}:function(t){if(Lp(t))return!0;if(!t||typeof t!="function"&&typeof t!="object")return!1;if(q6)return Ip(t);if(_p(t))return!1;var e=sl.call(t);return e!==j6&&e!==W6&&!/^\[object HTML/.test(e)?!1:Ip(t)},"isCallable")});var _g=N((d_,Eg)=>{"use strict";d();var J6=wg(),K6=Object.prototype.toString,Ig=Object.prototype.hasOwnProperty,Q6=s(function(t,e,i){for(var n=0,o=t.length;n<o;n++)Ig.call(t,n)&&(i==null?e(t[n],n,t):e.call(i,t[n],n,t))},"forEachArray"),t8=s(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"),e8=s(function(t,e,i){for(var n in t)Ig.call(t,n)&&(i==null?e(t[n],n,t):e.call(i,t[n],n,t))},"forEachObject"),r8=s(function(t,e,i){if(!J6(e))throw new TypeError("iterator must be a function");var n;arguments.length>=3&&(n=i),K6.call(t)==="[object Array]"?Q6(t,e,n):typeof t=="string"?t8(t,e,n):e8(t,e,n)},"forEach");Eg.exports=r8});var Og=N((y_,Lg)=>{"use strict";d();Lg.exports=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]});var Ag=N((v_,Dg)=>{"use strict";d();var Op=Og(),i8=typeof globalThis>"u"?global:globalThis;Dg.exports=s(function(){for(var t=[],e=0;e<Op.length;e++)typeof i8[Op[e]]=="function"&&(t[t.length]=Op[e]);return t},"availableTypedArrays")});var Bg=N((x_,Fg)=>{"use strict";d();var ul=_g(),n8=Ag(),Ng=hi(),Np=se(),ll=Gs(),o8=Np("Object.prototype.toString"),kg=Rr()(),Rg=typeof globalThis>"u"?global:globalThis,Ap=n8(),Rp=Np("String.prototype.slice"),Dp=Object.getPrototypeOf,a8=Np("Array.prototype.indexOf",!0)||s(function(t,e){for(var i=0;i<t.length;i+=1)if(t[i]===e)return i;return-1},"indexOf"),cl={__proto__:null};kg&&ll&&Dp?ul(Ap,function(r){var t=new Rg[r];if(Symbol.toStringTag in t){var e=Dp(t),i=ll(e,Symbol.toStringTag);if(!i){var n=Dp(e);i=ll(n,Symbol.toStringTag)}cl["$"+r]=Ng(i.get)}}):ul(Ap,function(r){var t=new Rg[r],e=t.slice||t.set;e&&(cl["$"+r]=Ng(e))});var s8=s(function(t){var e=!1;return ul(cl,function(i,n){if(!e)try{"$"+i(t)===n&&(e=Rp(n,1))}catch{}}),e},"tryAllTypedArrays"),l8=s(function(t){var e=!1;return ul(cl,function(i,n){if(!e)try{i(t),e=Rp(n,1)}catch{}}),e},"tryAllSlices");Fg.exports=s(function(t){if(!t||typeof t!="object")return!1;if(!kg){var e=Rp(o8(t),8,-1);return a8(Ap,e)>-1?e:e!=="Object"?!1:l8(t)}return ll?s8(t):null},"whichTypedArray")});var Hg=N((M_,Vg)=>{"use strict";d();var u8=se(),Gg=u8("ArrayBuffer.prototype.byteLength",!0),c8=gp();Vg.exports=s(function(t){return c8(t)?Gg?Gg(t):t.byteLength:NaN},"byteLength")});var h2=N((I_,p2)=>{"use strict";d();var l2=v0(),Ye=se(),Xg=D0(),p8=Me(),mn=_y(),h8=$c(),Yg=By(),jg=kc(),Wg=Kc(),Ug=gp(),Zg=jy(),zg=qy(),qg=Ky(),$g=Os(),Jg=mg(),Kg=Sg(),Qg=Bg(),t2=Hg(),e2=Ye("SharedArrayBuffer.prototype.byteLength",!0),r2=Ye("Date.prototype.getTime"),kp=Object.getPrototypeOf,i2=Ye("Object.prototype.toString"),hl=p8("%Set%",!0),Fp=Ye("Map.prototype.has",!0),dl=Ye("Map.prototype.get",!0),n2=Ye("Map.prototype.size",!0),fl=Ye("Set.prototype.add",!0),u2=Ye("Set.prototype.delete",!0),ml=Ye("Set.prototype.has",!0),pl=Ye("Set.prototype.size",!0);function o2(r,t,e,i){for(var n=mn(r),o;(o=n.next())&&!o.done;)if(Te(t,o.value,e,i))return u2(r,o.value),!0;return!1}s(o2,"setHasEqualElement");function c2(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}s(c2,"findLooseMatchingPrimitives");function d8(r,t,e,i,n,o){var a=c2(e);if(a!=null)return a;var l=dl(t,a),u=l2({},n,{strict:!1});return typeof l>"u"&&!Fp(t,a)||!Te(i,l,u,o)?!1:!Fp(r,a)&&Te(i,l,u,o)}s(d8,"mapMightHaveLoosePrim");function f8(r,t,e){var i=c2(e);return i!=null?i:ml(t,i)&&!ml(r,i)}s(f8,"setMightHaveLoosePrim");function a2(r,t,e,i,n,o){for(var a=mn(r),l,u;(l=a.next())&&!l.done;)if(u=l.value,Te(e,u,n,o)&&Te(i,dl(t,u),n,o))return u2(r,u),!0;return!1}s(a2,"mapHasEqualEntry");function Te(r,t,e,i){var n=e||{};if(n.strict?Yg(r,t):r===t)return!0;var o=Jg(r),a=Jg(t);if(o!==a)return!1;if(!r||!t||typeof r!="object"&&typeof t!="object")return n.strict?Yg(r,t):r==t;var l=i.has(r),u=i.has(t),h;if(l&&u){if(i.get(r)===i.get(t))return!0}else h={};return l||i.set(r,h),u||i.set(t,h),g8(r,t,n,i)}s(Te,"internalDeepEqual");function s2(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))}s(s2,"isBuffer");function m8(r,t,e,i){if(pl(r)!==pl(t))return!1;for(var n=mn(r),o=mn(t),a,l,u;(a=n.next())&&!a.done;)if(a.value&&typeof a.value=="object")u||(u=new hl),fl(u,a.value);else if(!ml(t,a.value)){if(e.strict||!f8(r,t,a.value))return!1;u||(u=new hl),fl(u,a.value)}if(u){for(;(l=o.next())&&!l.done;)if(l.value&&typeof l.value=="object"){if(!o2(u,l.value,e.strict,i))return!1}else if(!e.strict&&!ml(r,l.value)&&!o2(u,l.value,e.strict,i))return!1;return pl(u)===0}return!0}s(m8,"setEquiv");function y8(r,t,e,i){if(n2(r)!==n2(t))return!1;for(var n=mn(r),o=mn(t),a,l,u,h,f,m;(a=n.next())&&!a.done;)if(h=a.value[0],f=a.value[1],h&&typeof h=="object")u||(u=new hl),fl(u,h);else if(m=dl(t,h),typeof m>"u"&&!Fp(t,h)||!Te(f,m,e,i)){if(e.strict||!d8(r,t,h,f,e,i))return!1;u||(u=new hl),fl(u,h)}if(u){for(;(l=o.next())&&!l.done;)if(h=l.value[0],m=l.value[1],h&&typeof h=="object"){if(!a2(u,r,h,m,e,i))return!1}else if(!e.strict&&(!r.has(h)||!Te(dl(r,h),m,e,i))&&!a2(u,r,h,m,l2({},e,{strict:!1}),i))return!1;return pl(u)===0}return!0}s(y8,"mapEquiv");function g8(r,t,e,i){var n,o;if(typeof r!=typeof t||r==null||t==null||i2(r)!==i2(t)||jg(r)!==jg(t))return!1;var a=Wg(r),l=Wg(t);if(a!==l)return!1;var u=r instanceof Error,h=t instanceof Error;if(u!==h||(u||h)&&(r.name!==t.name||r.message!==t.message))return!1;var f=zg(r),m=zg(t);if(f!==m||(f||m)&&(r.source!==t.source||Xg(r)!==Xg(t)))return!1;var y=Zg(r),x=Zg(t);if(y!==x||(y||x)&&r2(r)!==r2(t)||e.strict&&kp&&kp(r)!==kp(t))return!1;var S=Qg(r),P=Qg(t);if(S!==P)return!1;if(S||P){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=s2(r),C=s2(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 w=Ug(r),I=Ug(t);if(w!==I)return!1;if(w||I)return t2(r)!==t2(t)?!1:typeof Uint8Array=="function"&&Te(new Uint8Array(r),new Uint8Array(t),e,i);var M=qg(r),_=qg(t);if(M!==_)return!1;if(M||_)return e2(r)!==e2(t)?!1:typeof Uint8Array=="function"&&Te(new Uint8Array(r),new Uint8Array(t),e,i);if(typeof r!=typeof t)return!1;var D=$g(r),k=$g(t);if(D.length!==k.length)return!1;for(D.sort(),k.sort(),n=D.length-1;n>=0;n--)if(D[n]!=k[n])return!1;for(n=D.length-1;n>=0;n--)if(o=D[n],!Te(r[o],t[o],e,i))return!1;var B=Kg(r),R=Kg(t);return B!==R?!1:B==="Set"||R==="Set"?m8(r,t,e,i):B==="Map"?y8(r,t,e,i):!0}s(g8,"objEquiv");p2.exports=s(function(t,e,i){return Te(t,e,i,h8())},"deepEqual")});var E2=N(K=>{"use strict";d();Object.defineProperty(K,"__esModule",{value:!0});function v8(r){return r&&r.__esModule?r:{default:r}}s(v8,"_interopRequireDefault");var b8=Object.defineProperty,rt=s((r,t)=>b8(r,"name",{value:t,configurable:!0}),"__name"),C8=h2(),x8=v8(C8),Oo,d2=(Oo=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||!_o(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=Bp(t),n=Bp(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(!_o(t,e))return!1;let o=t,a=e;if(n&&!this.compareCoord(o[0],a[0])){let u=this.fixStartIndex(a,o);if(u)a=u;else return!1}let l=this.compareCoord(o[i],a[i]);return this.direction||l?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 _o(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?x8.default.call(void 0,t.properties,e.properties):!0)&&this.compareBBox(t,e)&&this.compare(t.geometry,e.geometry)}compareFeatureCollection(t,e){return _o(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)}},s(Oo,"_GeojsonEquality"),Oo);rt(d2,"GeojsonEquality");var S8=d2;function _o(r,t){return r.coordinates?r.coordinates.length===t.coordinates.length:r.length===t.length}s(_o,"sameLength");rt(_o,"sameLength");function Bp(r){return r.coordinates.map(t=>({type:r.type.replace("Multi",""),coordinates:t}))}s(Bp,"explode");rt(Bp,"explode");var te=63710088e-1,Vp={centimeters:te*100,centimetres:te*100,degrees:360/(2*Math.PI),feet:te*3.28084,inches:te*39.37,kilometers:te/1e3,kilometres:te/1e3,meters:te,metres:te,miles:te/1609.344,millimeters:te*1e3,millimetres:te*1e3,nauticalmiles:te/1852,radians:1,yards:te*1.0936},Gp={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 sr(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}s(sr,"feature");rt(sr,"feature");function f2(r,t,e={}){switch(r){case"Point":return yl(t).geometry;case"LineString":return vl(t).geometry;case"Polygon":return gl(t).geometry;case"MultiPoint":return Xp(t).geometry;case"MultiLineString":return Hp(t).geometry;case"MultiPolygon":return Yp(t).geometry;default:throw new Error(r+" is invalid")}}s(f2,"geometry");rt(f2,"geometry");function yl(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(!Lo(r[0])||!Lo(r[1]))throw new Error("coordinates must contain numbers");return sr({type:"Point",coordinates:r},t,e)}s(yl,"point");rt(yl,"point");function m2(r,t,e={}){return Do(r.map(i=>yl(i,t)),e)}s(m2,"points");rt(m2,"points");function gl(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 sr({type:"Polygon",coordinates:r},t,e)}s(gl,"polygon");rt(gl,"polygon");function y2(r,t,e={}){return Do(r.map(i=>gl(i,t)),e)}s(y2,"polygons");rt(y2,"polygons");function vl(r,t,e={}){if(r.length<2)throw new Error("coordinates must be an array of two or more positions");return sr({type:"LineString",coordinates:r},t,e)}s(vl,"lineString");rt(vl,"lineString");function g2(r,t,e={}){return Do(r.map(i=>vl(i,t)),e)}s(g2,"lineStrings");rt(g2,"lineStrings");function Do(r,t={}){let e={type:"FeatureCollection"};return t.id&&(e.id=t.id),t.bbox&&(e.bbox=t.bbox),e.features=r,e}s(Do,"featureCollection");rt(Do,"featureCollection");function Hp(r,t,e={}){return sr({type:"MultiLineString",coordinates:r},t,e)}s(Hp,"multiLineString");rt(Hp,"multiLineString");function Xp(r,t,e={}){return sr({type:"MultiPoint",coordinates:r},t,e)}s(Xp,"multiPoint");rt(Xp,"multiPoint");function Yp(r,t,e={}){return sr({type:"MultiPolygon",coordinates:r},t,e)}s(Yp,"multiPolygon");rt(Yp,"multiPolygon");function v2(r,t,e={}){return sr({type:"GeometryCollection",geometries:r},t,e)}s(v2,"geometryCollection");rt(v2,"geometryCollection");function b2(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}s(b2,"round");rt(b2,"round");function jp(r,t="kilometers"){let e=Vp[t];if(!e)throw new Error(t+" units is invalid");return r*e}s(jp,"radiansToLength");rt(jp,"radiansToLength");function bl(r,t="kilometers"){let e=Vp[t];if(!e)throw new Error(t+" units is invalid");return r/e}s(bl,"lengthToRadians");rt(bl,"lengthToRadians");function C2(r,t){return Wp(bl(r,t))}s(C2,"lengthToDegrees");rt(C2,"lengthToDegrees");function x2(r){let t=r%360;return t<0&&(t+=360),t}s(x2,"bearingToAzimuth");rt(x2,"bearingToAzimuth");function Wp(r){return r%(2*Math.PI)*180/Math.PI}s(Wp,"radiansToDegrees");rt(Wp,"radiansToDegrees");function S2(r){return r%360*Math.PI/180}s(S2,"degreesToRadians");rt(S2,"degreesToRadians");function P2(r,t="kilometers",e="kilometers"){if(!(r>=0))throw new Error("length must be a positive number");return jp(bl(r,t),e)}s(P2,"convertLength");rt(P2,"convertLength");function M2(r,t="meters",e="kilometers"){if(!(r>=0))throw new Error("area must be a positive number");let i=Gp[t];if(!i)throw new Error("invalid original units");let n=Gp[e];if(!n)throw new Error("invalid final units");return r/i*n}s(M2,"convertArea");rt(M2,"convertArea");function Lo(r){return!isNaN(r)&&r!==null&&!Array.isArray(r)}s(Lo,"isNumber");rt(Lo,"isNumber");function T2(r){return r!==null&&typeof r=="object"&&!Array.isArray(r)}s(T2,"isObject");rt(T2,"isObject");function w2(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(!Lo(t))throw new Error("bbox must only contain numbers")})}s(w2,"validateBBox");rt(w2,"validateBBox");function I2(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")}s(I2,"validateId");rt(I2,"validateId");K.GeojsonEquality=S8;K.areaFactors=Gp;K.bearingToAzimuth=x2;K.convertArea=M2;K.convertLength=P2;K.degreesToRadians=S2;K.earthRadius=te;K.factors=Vp;K.feature=sr;K.featureCollection=Do;K.geometry=f2;K.geometryCollection=v2;K.isNumber=Lo;K.isObject=T2;K.lengthToDegrees=C2;K.lengthToRadians=bl;K.lineString=vl;K.lineStrings=g2;K.multiLineString=Hp;K.multiPoint=Xp;K.multiPolygon=Yp;K.point=yl;K.points=m2;K.polygon=gl;K.polygons=y2;K.radiansToDegrees=Wp;K.radiansToLength=jp;K.round=b2;K.validateBBox=w2;K.validateId=I2});var G2=N(wt=>{"use strict";d();Object.defineProperty(wt,"__esModule",{value:!0});var P8=Object.defineProperty,Rt=s((r,t)=>P8(r,"name",{value:t,configurable:!0}),"__name"),Vt=E2();function yn(r,t,e){if(r!==null)for(var i,n,o,a,l,u,h,f=0,m=0,y,x=r.type,S=x==="FeatureCollection",P=x==="Feature",g=S?r.features.length:1,C=0;C<g;C++){h=S?r.features[C].geometry:P?r.geometry:r,y=h?h.type==="GeometryCollection":!1,l=y?h.geometries.length:1;for(var w=0;w<l;w++){var I=0,M=0;if(a=y?h.geometries[w]:h,a!==null){u=a.coordinates;var _=a.type;switch(f=e&&(_==="Polygon"||_==="MultiPolygon")?1:0,_){case null:break;case"Point":if(t(u,m,C,I,M)===!1)return!1;m++,I++;break;case"LineString":case"MultiPoint":for(i=0;i<u.length;i++){if(t(u[i],m,C,I,M)===!1)return!1;m++,_==="MultiPoint"&&I++}_==="LineString"&&I++;break;case"Polygon":case"MultiLineString":for(i=0;i<u.length;i++){for(n=0;n<u[i].length-f;n++){if(t(u[i][n],m,C,I,M)===!1)return!1;m++}_==="MultiLineString"&&I++,_==="Polygon"&&M++}_==="Polygon"&&I++;break;case"MultiPolygon":for(i=0;i<u.length;i++){for(M=0,n=0;n<u[i].length;n++){for(o=0;o<u[i][n].length-f;o++){if(t(u[i][n][o],m,C,I,M)===!1)return!1;m++}M++}I++}break;case"GeometryCollection":for(i=0;i<a.geometries.length;i++)if(yn(a.geometries[i],t,e)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}s(yn,"coordEach");Rt(yn,"coordEach");function _2(r,t,e,i){var n=e;return yn(r,function(o,a,l,u,h){a===0&&e===void 0?n=o:n=t(n,o,a,l,u,h)},i),n}s(_2,"coordReduce");Rt(_2,"coordReduce");function Up(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}}s(Up,"propEach");Rt(Up,"propEach");function L2(r,t,e){var i=e;return Up(r,function(n,o){o===0&&e===void 0?i=n:i=t(i,n,o)}),i}s(L2,"propReduce");Rt(L2,"propReduce");function Zp(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++);}s(Zp,"featureEach");Rt(Zp,"featureEach");function O2(r,t,e){var i=e;return Zp(r,function(n,o){o===0&&e===void 0?i=n:i=t(i,n,o)}),i}s(O2,"featureReduce");Rt(O2,"featureReduce");function D2(r){var t=[];return yn(r,function(e){t.push(e)}),t}s(D2,"coordAll");Rt(D2,"coordAll");function Cl(r,t){var e,i,n,o,a,l,u,h,f,m,y=0,x=r.type==="FeatureCollection",S=r.type==="Feature",P=x?r.features.length:1;for(e=0;e<P;e++){for(l=x?r.features[e].geometry:S?r.geometry:r,h=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,u=l?l.type==="GeometryCollection":!1,a=u?l.geometries.length:1,n=0;n<a;n++){if(o=u?l.geometries[n]:l,o===null){if(t(null,y,h,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,h,f,m)===!1)return!1;break}case"GeometryCollection":{for(i=0;i<o.geometries.length;i++)if(t(o.geometries[i],y,h,f,m)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}y++}}s(Cl,"geomEach");Rt(Cl,"geomEach");function A2(r,t,e){var i=e;return Cl(r,function(n,o,a,l,u){o===0&&e===void 0?i=n:i=t(i,n,o,a,l,u)}),i}s(A2,"geomReduce");Rt(A2,"geomReduce");function Ao(r,t){Cl(r,function(e,i,n,o,a){var l=e===null?null:e.type;switch(l){case null:case"Point":case"LineString":case"Polygon":return t(Vt.feature.call(void 0,e,n,{bbox:o,id:a}),i,0)===!1?!1:void 0}var u;switch(l){case"MultiPoint":u="Point";break;case"MultiLineString":u="LineString";break;case"MultiPolygon":u="Polygon";break}for(var h=0;h<e.coordinates.length;h++){var f=e.coordinates[h],m={type:u,coordinates:f};if(t(Vt.feature.call(void 0,m,n),i,h)===!1)return!1}})}s(Ao,"flattenEach");Rt(Ao,"flattenEach");function N2(r,t,e){var i=e;return Ao(r,function(n,o,a){o===0&&a===0&&e===void 0?i=n:i=t(i,n,o,a)}),i}s(N2,"flattenReduce");Rt(N2,"flattenReduce");function zp(r,t){Ao(r,function(e,i,n){var o=0;if(e.geometry){var a=e.geometry.type;if(!(a==="Point"||a==="MultiPoint")){var l,u=0,h=0,f=0;if(yn(e,function(m,y,x,S,P){if(l===void 0||i>u||S>h||P>f){l=m,u=i,h=S,f=P,o=0;return}var g=Vt.lineString.call(void 0,[l,m],e.properties);if(t(g,i,n,P,o)===!1)return!1;o++,l=m})===!1)return!1}}})}s(zp,"segmentEach");Rt(zp,"segmentEach");function R2(r,t,e){var i=e,n=!1;return zp(r,function(o,a,l,u,h){n===!1&&e===void 0?i=o:i=t(i,o,a,l,u,h),n=!0}),i}s(R2,"segmentReduce");Rt(R2,"segmentReduce");function qp(r,t){if(!r)throw new Error("geojson is required");Ao(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 l=0;l<a.length;l++)if(t(Vt.lineString.call(void 0,a[l],e.properties),i,n,l)===!1)return!1;break}}})}s(qp,"lineEach");Rt(qp,"lineEach");function k2(r,t,e){var i=e;return qp(r,function(n,o,a,l){o===0&&e===void 0?i=n:i=t(i,n,o,a,l)}),i}s(k2,"lineReduce");Rt(k2,"lineReduce");function F2(r,t){if(t=t||{},!Vt.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,l;switch(r.type){case"FeatureCollection":e<0&&(e=r.features.length+e),a=a||r.features[e].properties,l=r.features[e].geometry;break;case"Feature":a=a||r.properties,l=r.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":l=r;break;default:throw new Error("geojson is invalid")}if(l===null)return null;var u=l.coordinates;switch(l.type){case"Point":case"MultiPoint":return null;case"LineString":return o<0&&(o=u.length+o-1),Vt.lineString.call(void 0,[u[o],u[o+1]],a,t);case"Polygon":return n<0&&(n=u.length+n),o<0&&(o=u[n].length+o-1),Vt.lineString.call(void 0,[u[n][o],u[n][o+1]],a,t);case"MultiLineString":return i<0&&(i=u.length+i),o<0&&(o=u[i].length+o-1),Vt.lineString.call(void 0,[u[i][o],u[i][o+1]],a,t);case"MultiPolygon":return i<0&&(i=u.length+i),n<0&&(n=u[i].length+n),o<0&&(o=u[i][n].length-o-1),Vt.lineString.call(void 0,[u[i][n][o],u[i][n][o+1]],a,t)}throw new Error("geojson is invalid")}s(F2,"findSegment");Rt(F2,"findSegment");function B2(r,t){if(t=t||{},!Vt.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,l;switch(r.type){case"FeatureCollection":e<0&&(e=r.features.length+e),a=a||r.features[e].properties,l=r.features[e].geometry;break;case"Feature":a=a||r.properties,l=r.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":l=r;break;default:throw new Error("geojson is invalid")}if(l===null)return null;var u=l.coordinates;switch(l.type){case"Point":return Vt.point.call(void 0,u,a,t);case"MultiPoint":return i<0&&(i=u.length+i),Vt.point.call(void 0,u[i],a,t);case"LineString":return o<0&&(o=u.length+o),Vt.point.call(void 0,u[o],a,t);case"Polygon":return n<0&&(n=u.length+n),o<0&&(o=u[n].length+o),Vt.point.call(void 0,u[n][o],a,t);case"MultiLineString":return i<0&&(i=u.length+i),o<0&&(o=u[i].length+o),Vt.point.call(void 0,u[i][o],a,t);case"MultiPolygon":return i<0&&(i=u.length+i),n<0&&(n=u[i].length+n),o<0&&(o=u[i][n].length-o),Vt.point.call(void 0,u[i][n][o],a,t)}throw new Error("geojson is invalid")}s(B2,"findPoint");Rt(B2,"findPoint");wt.coordAll=D2;wt.coordEach=yn;wt.coordReduce=_2;wt.featureEach=Zp;wt.featureReduce=O2;wt.findPoint=B2;wt.findSegment=F2;wt.flattenEach=Ao;wt.flattenReduce=N2;wt.geomEach=Cl;wt.geomReduce=A2;wt.lineEach=qp;wt.lineReduce=k2;wt.propEach=Up;wt.propReduce=L2;wt.segmentEach=zp;wt.segmentReduce=R2});var V2=N(xl=>{"use strict";d();Object.defineProperty(xl,"__esModule",{value:!0});var M8=Object.defineProperty,T8=s((r,t)=>M8(r,"name",{value:t,configurable:!0}),"__name"),w8=G2();function $p(r,t={}){if(r.bbox!=null&&t.recompute!==!0)return r.bbox;let e=[1/0,1/0,-1/0,-1/0];return w8.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}s($p,"bbox");T8($p,"bbox");var I8=$p;xl.bbox=$p;xl.default=I8});var W2=N((H_,Jp)=>{d();var je=Gm(),X2=vc(),Y2=qm(),gn=V2().default,E8=Y2.featureEach,G_=Y2.coordEach,V_=X2.polygon,H2=X2.featureCollection;function j2(r){var t=new je(r);return t.insert=function(e){if(e.type!=="Feature")throw new Error("invalid feature");return e.bbox=e.bbox?e.bbox:gn(e),je.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:gn(n),i.push(n)}):E8(e,function(n){if(n.type!=="Feature")throw new Error("invalid features");n.bbox=n.bbox?n.bbox:gn(n),i.push(n)}),je.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:gn(e),je.prototype.remove.call(this,e,i)},t.clear=function(){return je.prototype.clear.call(this)},t.search=function(e){var i=je.prototype.search.call(this,this.toBBox(e));return H2(i)},t.collides=function(e){return je.prototype.collides.call(this,this.toBBox(e))},t.all=function(){var e=je.prototype.all.call(this);return H2(e)},t.toJSON=function(){return je.prototype.toJSON.call(this)},t.fromJSON=function(e){return je.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=gn(e);else if(e.type==="FeatureCollection")i=gn(e);else throw new Error("invalid geojson");return{minX:i[0],minY:i[1],maxX:i[2],maxY:i[3]}},t}s(j2,"geojsonRbush");Jp.exports=j2;Jp.exports.default=j2});var ev=N((aa,Bn)=>{d();var bC=200,N3="__lodash_hash_undefined__",CC=800,xC=16,R3=9007199254740991,k3="[object Arguments]",SC="[object Array]",PC="[object AsyncFunction]",MC="[object Boolean]",TC="[object Date]",wC="[object Error]",F3="[object Function]",IC="[object GeneratorFunction]",EC="[object Map]",_C="[object Number]",LC="[object Null]",B3="[object Object]",OC="[object Proxy]",DC="[object RegExp]",AC="[object Set]",NC="[object String]",RC="[object Undefined]",kC="[object WeakMap]",FC="[object ArrayBuffer]",BC="[object DataView]",GC="[object Float32Array]",VC="[object Float64Array]",HC="[object Int8Array]",XC="[object Int16Array]",YC="[object Int32Array]",jC="[object Uint8Array]",WC="[object Uint8ClampedArray]",UC="[object Uint16Array]",ZC="[object Uint32Array]",zC=/[\\^$.*+?()[\]{}|]/g,qC=/^\[object .+?Constructor\]$/,$C=/^(?:0|[1-9]\d*)$/,ut={};ut[GC]=ut[VC]=ut[HC]=ut[XC]=ut[YC]=ut[jC]=ut[WC]=ut[UC]=ut[ZC]=!0;ut[k3]=ut[SC]=ut[FC]=ut[MC]=ut[BC]=ut[TC]=ut[wC]=ut[F3]=ut[EC]=ut[_C]=ut[B3]=ut[DC]=ut[AC]=ut[NC]=ut[kC]=!1;var G3=typeof global=="object"&&global&&global.Object===Object&&global,JC=typeof self=="object"&&self&&self.Object===Object&&self,ua=G3||JC||Function("return this")(),V3=typeof aa=="object"&&aa&&!aa.nodeType&&aa,sa=V3&&typeof Bn=="object"&&Bn&&!Bn.nodeType&&Bn,H3=sa&&sa.exports===V3,Yh=H3&&G3.process,T3=function(){try{var r=sa&&sa.require&&sa.require("util").types;return r||Yh&&Yh.binding&&Yh.binding("util")}catch{}}(),w3=T3&&T3.isTypedArray;function X3(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)}s(X3,"apply");function KC(r,t){for(var e=-1,i=Array(r);++e<r;)i[e]=t(e);return i}s(KC,"baseTimes");function QC(r){return function(t){return r(t)}}s(QC,"baseUnary");function t9(r,t){return r==null?void 0:r[t]}s(t9,"getValue");function e9(r,t){return function(e){return r(t(e))}}s(e9,"overArg");var r9=Array.prototype,i9=Function.prototype,Bl=Object.prototype,jh=ua["__core-js_shared__"],Gl=i9.toString,vr=Bl.hasOwnProperty,I3=function(){var r=/[^.]+$/.exec(jh&&jh.keys&&jh.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""}(),Y3=Bl.toString,n9=Gl.call(Object),o9=RegExp("^"+Gl.call(vr).replace(zC,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),kl=H3?ua.Buffer:void 0,E3=ua.Symbol,_3=ua.Uint8Array,L3=kl?kl.allocUnsafe:void 0,j3=e9(Object.getPrototypeOf,Object),O3=Object.create,a9=Bl.propertyIsEnumerable,s9=r9.splice,Oi=E3?E3.toStringTag:void 0,Fl=function(){try{var r=Jh(Object,"defineProperty");return r({},"",{}),r}catch{}}(),l9=kl?kl.isBuffer:void 0,D3=Math.max,u9=Date.now,W3=Jh(ua,"Map"),la=Jh(Object,"create"),c9=function(){function r(){}return s(r,"object"),function(t){if(!gr(t))return{};if(O3)return O3(t);r.prototype=t;var e=new r;return r.prototype=void 0,e}}();function Di(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])}}s(Di,"Hash");function p9(){this.__data__=la?la(null):{},this.size=0}s(p9,"hashClear");function h9(r){var t=this.has(r)&&delete this.__data__[r];return this.size-=t?1:0,t}s(h9,"hashDelete");function d9(r){var t=this.__data__;if(la){var e=t[r];return e===N3?void 0:e}return vr.call(t,r)?t[r]:void 0}s(d9,"hashGet");function f9(r){var t=this.__data__;return la?t[r]!==void 0:vr.call(t,r)}s(f9,"hashHas");function m9(r,t){var e=this.__data__;return this.size+=this.has(r)?0:1,e[r]=la&&t===void 0?N3:t,this}s(m9,"hashSet");Di.prototype.clear=p9;Di.prototype.delete=h9;Di.prototype.get=d9;Di.prototype.has=f9;Di.prototype.set=m9;function br(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])}}s(br,"ListCache");function y9(){this.__data__=[],this.size=0}s(y9,"listCacheClear");function g9(r){var t=this.__data__,e=Vl(t,r);if(e<0)return!1;var i=t.length-1;return e==i?t.pop():s9.call(t,e,1),--this.size,!0}s(g9,"listCacheDelete");function v9(r){var t=this.__data__,e=Vl(t,r);return e<0?void 0:t[e][1]}s(v9,"listCacheGet");function b9(r){return Vl(this.__data__,r)>-1}s(b9,"listCacheHas");function C9(r,t){var e=this.__data__,i=Vl(e,r);return i<0?(++this.size,e.push([r,t])):e[i][1]=t,this}s(C9,"listCacheSet");br.prototype.clear=y9;br.prototype.delete=g9;br.prototype.get=v9;br.prototype.has=b9;br.prototype.set=C9;function Gn(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])}}s(Gn,"MapCache");function x9(){this.size=0,this.__data__={hash:new Di,map:new(W3||br),string:new Di}}s(x9,"mapCacheClear");function S9(r){var t=Xl(this,r).delete(r);return this.size-=t?1:0,t}s(S9,"mapCacheDelete");function P9(r){return Xl(this,r).get(r)}s(P9,"mapCacheGet");function M9(r){return Xl(this,r).has(r)}s(M9,"mapCacheHas");function T9(r,t){var e=Xl(this,r),i=e.size;return e.set(r,t),this.size+=e.size==i?0:1,this}s(T9,"mapCacheSet");Gn.prototype.clear=x9;Gn.prototype.delete=S9;Gn.prototype.get=P9;Gn.prototype.has=M9;Gn.prototype.set=T9;function Vn(r){var t=this.__data__=new br(r);this.size=t.size}s(Vn,"Stack");function w9(){this.__data__=new br,this.size=0}s(w9,"stackClear");function I9(r){var t=this.__data__,e=t.delete(r);return this.size=t.size,e}s(I9,"stackDelete");function E9(r){return this.__data__.get(r)}s(E9,"stackGet");function _9(r){return this.__data__.has(r)}s(_9,"stackHas");function L9(r,t){var e=this.__data__;if(e instanceof br){var i=e.__data__;if(!W3||i.length<bC-1)return i.push([r,t]),this.size=++e.size,this;e=this.__data__=new Gn(i)}return e.set(r,t),this.size=e.size,this}s(L9,"stackSet");Vn.prototype.clear=w9;Vn.prototype.delete=I9;Vn.prototype.get=E9;Vn.prototype.has=_9;Vn.prototype.set=L9;function O9(r,t){var e=zh(r),i=!e&&Zh(r),n=!e&&!i&&$3(r),o=!e&&!i&&!n&&K3(r),a=e||i||n||o,l=a?KC(r.length,String):[],u=l.length;for(var h in r)(t||vr.call(r,h))&&!(a&&(h=="length"||n&&(h=="offset"||h=="parent")||o&&(h=="buffer"||h=="byteLength"||h=="byteOffset")||z3(h,u)))&&l.push(h);return l}s(O9,"arrayLikeKeys");function Wh(r,t,e){(e!==void 0&&!Yl(r[t],e)||e===void 0&&!(t in r))&&qh(r,t,e)}s(Wh,"assignMergeValue");function D9(r,t,e){var i=r[t];(!(vr.call(r,t)&&Yl(i,e))||e===void 0&&!(t in r))&&qh(r,t,e)}s(D9,"assignValue");function Vl(r,t){for(var e=r.length;e--;)if(Yl(r[e][0],t))return e;return-1}s(Vl,"assocIndexOf");function qh(r,t,e){t=="__proto__"&&Fl?Fl(r,t,{configurable:!0,enumerable:!0,value:e,writable:!0}):r[t]=e}s(qh,"baseAssignValue");var A9=W9();function Hl(r){return r==null?r===void 0?RC:LC:Oi&&Oi in Object(r)?U9(r):K9(r)}s(Hl,"baseGetTag");function A3(r){return ca(r)&&Hl(r)==k3}s(A3,"baseIsArguments");function N9(r){if(!gr(r)||$9(r))return!1;var t=Qh(r)?o9:qC;return t.test(rx(r))}s(N9,"baseIsNative");function R9(r){return ca(r)&&J3(r.length)&&!!ut[Hl(r)]}s(R9,"baseIsTypedArray");function k9(r){if(!gr(r))return J9(r);var t=q3(r),e=[];for(var i in r)i=="constructor"&&(t||!vr.call(r,i))||e.push(i);return e}s(k9,"baseKeysIn");function $h(r,t,e,i,n){r!==t&&A9(t,function(o,a){if(n||(n=new Vn),gr(o))F9(r,t,a,e,$h,i,n);else{var l=i?i(Uh(r,a),o,a+"",r,t,n):void 0;l===void 0&&(l=o),Wh(r,a,l)}},Q3)}s($h,"baseMerge");function F9(r,t,e,i,n,o,a){var l=Uh(r,e),u=Uh(t,e),h=a.get(u);if(h){Wh(r,e,h);return}var f=o?o(l,u,e+"",r,t,a):void 0,m=f===void 0;if(m){var y=zh(u),x=!y&&$3(u),S=!y&&!x&&K3(u);f=u,y||x||S?zh(l)?f=l:ix(l)?f=X9(l):x?(m=!1,f=G9(u,!0)):S?(m=!1,f=H9(u,!0)):f=[]:nx(u)||Zh(u)?(f=l,Zh(l)?f=ox(l):(!gr(l)||Qh(l))&&(f=Z9(u))):m=!1}m&&(a.set(u,f),n(f,u,i,o,a),a.delete(u)),Wh(r,e,f)}s(F9,"baseMergeDeep");function U3(r,t){return tx(Q9(r,t,tv),r+"")}s(U3,"baseRest");var B9=Fl?function(r,t){return Fl(r,"toString",{configurable:!0,enumerable:!1,value:lx(t),writable:!0})}:tv;function G9(r,t){if(t)return r.slice();var e=r.length,i=L3?L3(e):new r.constructor(e);return r.copy(i),i}s(G9,"cloneBuffer");function V9(r){var t=new r.constructor(r.byteLength);return new _3(t).set(new _3(r)),t}s(V9,"cloneArrayBuffer");function H9(r,t){var e=t?V9(r.buffer):r.buffer;return new r.constructor(e,r.byteOffset,r.length)}s(H9,"cloneTypedArray");function X9(r,t){var e=-1,i=r.length;for(t||(t=Array(i));++e<i;)t[e]=r[e];return t}s(X9,"copyArray");function Y9(r,t,e,i){var n=!e;e||(e={});for(var o=-1,a=t.length;++o<a;){var l=t[o],u=i?i(e[l],r[l],l,e,r):void 0;u===void 0&&(u=r[l]),n?qh(e,l,u):D9(e,l,u)}return e}s(Y9,"copyObject");function j9(r){return U3(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&&z9(e[0],e[1],a)&&(o=n<3?void 0:o,n=1),t=Object(t);++i<n;){var l=e[i];l&&r(t,l,i,o)}return t})}s(j9,"createAssigner");function W9(r){return function(t,e,i){for(var n=-1,o=Object(t),a=i(t),l=a.length;l--;){var u=a[r?l:++n];if(e(o[u],u,o)===!1)break}return t}}s(W9,"createBaseFor");function Z3(r,t,e,i,n,o){return gr(r)&&gr(t)&&(o.set(t,r),$h(r,t,void 0,Z3,o),o.delete(t)),r}s(Z3,"customDefaultsMerge");function Xl(r,t){var e=r.__data__;return q9(t)?e[typeof t=="string"?"string":"hash"]:e.map}s(Xl,"getMapData");function Jh(r,t){var e=t9(r,t);return N9(e)?e:void 0}s(Jh,"getNative");function U9(r){var t=vr.call(r,Oi),e=r[Oi];try{r[Oi]=void 0;var i=!0}catch{}var n=Y3.call(r);return i&&(t?r[Oi]=e:delete r[Oi]),n}s(U9,"getRawTag");function Z9(r){return typeof r.constructor=="function"&&!q3(r)?c9(j3(r)):{}}s(Z9,"initCloneObject");function z3(r,t){var e=typeof r;return t=t==null?R3:t,!!t&&(e=="number"||e!="symbol"&&$C.test(r))&&r>-1&&r%1==0&&r<t}s(z3,"isIndex");function z9(r,t,e){if(!gr(e))return!1;var i=typeof t;return(i=="number"?Kh(e)&&z3(t,e.length):i=="string"&&t in e)?Yl(e[t],r):!1}s(z9,"isIterateeCall");function q9(r){var t=typeof r;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?r!=="__proto__":r===null}s(q9,"isKeyable");function $9(r){return!!I3&&I3 in r}s($9,"isMasked");function q3(r){var t=r&&r.constructor,e=typeof t=="function"&&t.prototype||Bl;return r===e}s(q3,"isPrototype");function J9(r){var t=[];if(r!=null)for(var e in Object(r))t.push(e);return t}s(J9,"nativeKeysIn");function K9(r){return Y3.call(r)}s(K9,"objectToString");function Q9(r,t,e){return t=D3(t===void 0?r.length-1:t,0),function(){for(var i=arguments,n=-1,o=D3(i.length-t,0),a=Array(o);++n<o;)a[n]=i[t+n];n=-1;for(var l=Array(t+1);++n<t;)l[n]=i[n];return l[t]=e(a),X3(r,this,l)}}s(Q9,"overRest");function Uh(r,t){if(!(t==="constructor"&&typeof r[t]=="function")&&t!="__proto__")return r[t]}s(Uh,"safeGet");var tx=ex(B9);function ex(r){var t=0,e=0;return function(){var i=u9(),n=xC-(i-e);if(e=i,n>0){if(++t>=CC)return arguments[0]}else t=0;return r.apply(void 0,arguments)}}s(ex,"shortOut");function rx(r){if(r!=null){try{return Gl.call(r)}catch{}try{return r+""}catch{}}return""}s(rx,"toSource");function Yl(r,t){return r===t||r!==r&&t!==t}s(Yl,"eq");var Zh=A3(function(){return arguments}())?A3:function(r){return ca(r)&&vr.call(r,"callee")&&!a9.call(r,"callee")},zh=Array.isArray;function Kh(r){return r!=null&&J3(r.length)&&!Qh(r)}s(Kh,"isArrayLike");function ix(r){return ca(r)&&Kh(r)}s(ix,"isArrayLikeObject");var $3=l9||ux;function Qh(r){if(!gr(r))return!1;var t=Hl(r);return t==F3||t==IC||t==PC||t==OC}s(Qh,"isFunction");function J3(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=R3}s(J3,"isLength");function gr(r){var t=typeof r;return r!=null&&(t=="object"||t=="function")}s(gr,"isObject");function ca(r){return r!=null&&typeof r=="object"}s(ca,"isObjectLike");function nx(r){if(!ca(r)||Hl(r)!=B3)return!1;var t=j3(r);if(t===null)return!0;var e=vr.call(t,"constructor")&&t.constructor;return typeof e=="function"&&e instanceof e&&Gl.call(e)==n9}s(nx,"isPlainObject");var K3=w3?QC(w3):R9;function ox(r){return Y9(r,Q3(r))}s(ox,"toPlainObject");var ax=U3(function(r){return r.push(void 0,Z3),X3(sx,void 0,r)});function Q3(r){return Kh(r)?O9(r,!0):k9(r)}s(Q3,"keysIn");var sx=j9(function(r,t,e,i){$h(r,t,e,i)});function lx(r){return function(){return r}}s(lx,"constant");function tv(r){return r}s(tv,"identity");function ux(){return!1}s(ux,"stubFalse");Bn.exports=ax});var Nv=N((Rk,ba)=>{"use strict";d();var Lx=!1,ki=!1,Iv=!0,Ev=!1,p={},_v=!1;typeof ba<"u"&&ba.exports?(ba.exports=p,_v=!0):typeof document<"u"?window.ClipperLib=p:self.ClipperLib=p;var eu;_v?(_t="chrome",eu="Netscape"):(_t=navigator.userAgent.toString().toLowerCase(),eu=navigator.appName);var _t,Z={};_t.indexOf("chrome")!=-1&&_t.indexOf("chromium")==-1?Z.chrome=1:Z.chrome=0;_t.indexOf("chromium")!=-1?Z.chromium=1:Z.chromium=0;_t.indexOf("safari")!=-1&&_t.indexOf("chrome")==-1&&_t.indexOf("chromium")==-1?Z.safari=1:Z.safari=0;_t.indexOf("firefox")!=-1?Z.firefox=1:Z.firefox=0;_t.indexOf("firefox/17")!=-1?Z.firefox17=1:Z.firefox17=0;_t.indexOf("firefox/15")!=-1?Z.firefox15=1:Z.firefox15=0;_t.indexOf("firefox/3")!=-1?Z.firefox3=1:Z.firefox3=0;_t.indexOf("opera")!=-1?Z.opera=1:Z.opera=0;_t.indexOf("msie 10")!=-1?Z.msie10=1:Z.msie10=0;_t.indexOf("msie 9")!=-1?Z.msie9=1:Z.msie9=0;_t.indexOf("msie 8")!=-1?Z.msie8=1:Z.msie8=0;_t.indexOf("msie 7")!=-1?Z.msie7=1:Z.msie7=0;_t.indexOf("msie ")!=-1?Z.msie=1:Z.msie=0;p.biginteger_used=null;var Kr,Ox=0xdeadbeefcafe,Tv=(Ox&16777215)==15715070;function L(r,t,e){p.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))}s(L,"BigInteger");function q(){return new L(null)}s(q,"nbi");function Dx(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}s(Dx,"am1");function Ax(r,t,e,i,n,o){for(var a=t&32767,l=t>>15;--o>=0;){var u=this[r]&32767,h=this[r++]>>15,f=l*u+h*a;u=a*u+((f&32767)<<15)+e[i]+(n&1073741823),n=(u>>>30)+(f>>>15)+l*h+(n>>>30),e[i++]=u&1073741823}return n}s(Ax,"am2");function Nx(r,t,e,i,n,o){for(var a=t&16383,l=t>>14;--o>=0;){var u=this[r]&16383,h=this[r++]>>14,f=l*u+h*a;u=a*u+((f&16383)<<14)+e[i]+n,n=(u>>28)+(f>>14)+l*h,e[i++]=u&268435455}return n}s(Nx,"am3");Tv&&eu=="Microsoft Internet Explorer"?(L.prototype.am=Ax,Kr=30):Tv&&eu!="Netscape"?(L.prototype.am=Dx,Kr=26):(L.prototype.am=Nx,Kr=28);L.prototype.DB=Kr;L.prototype.DM=(1<<Kr)-1;L.prototype.DV=1<<Kr;var dd=52;L.prototype.FV=Math.pow(2,dd);L.prototype.F1=dd-Kr;L.prototype.F2=2*Kr-dd;var Rx="0123456789abcdefghijklmnopqrstuvwxyz",iu=new Array,Yn,me;Yn=48;for(me=0;me<=9;++me)iu[Yn++]=me;Yn=97;for(me=10;me<36;++me)iu[Yn++]=me;Yn=65;for(me=10;me<36;++me)iu[Yn++]=me;function wv(r){return Rx.charAt(r)}s(wv,"int2char");function Lv(r,t){var e=iu[r.charCodeAt(t)];return e==null?-1:e}s(Lv,"intAt");function kx(r){for(var t=this.t-1;t>=0;--t)r[t]=this[t];r.t=this.t,r.s=this.s}s(kx,"bnpCopyTo");function Fx(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}s(Fx,"bnpFromInt");function Jr(r){var t=q();return t.fromInt(r),t}s(Jr,"nbv");function Bx(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:Lv(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&&L.ZERO.subTo(this,this)}s(Bx,"bnpFromString");function Gx(){for(var r=this.s&this.DM;this.t>0&&this[this.t-1]==r;)--this.t}s(Gx,"bnpClamp");function Vx(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,l=this.DB-a*this.DB%t;if(a-- >0)for(l<this.DB&&(i=this[a]>>l)>0&&(n=!0,o=wv(i));a>=0;)l<t?(i=(this[a]&(1<<l)-1)<<t-l,i|=this[--a]>>(l+=this.DB-t)):(i=this[a]>>(l-=t)&e,l<=0&&(l+=this.DB,--a)),i>0&&(n=!0),n&&(o+=wv(i));return n?o:"0"}s(Vx,"bnToString");function Hx(){var r=q();return L.ZERO.subTo(this,r),r}s(Hx,"bnNegate");function Xx(){return this.s<0?this.negate():this}s(Xx,"bnAbs");function Yx(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}s(Yx,"bnCompareTo");function nu(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}s(nu,"nbits");function jx(){return this.t<=0?0:this.DB*(this.t-1)+nu(this[this.t-1]^this.s&this.DM)}s(jx,"bnBitLength");function Wx(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}s(Wx,"bnpDLShiftTo");function Ux(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}s(Ux,"bnpDRShiftTo");function Zx(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,l;for(l=this.t-1;l>=0;--l)t[l+o+1]=this[l]>>i|a,a=(this[l]&n)<<e;for(l=o-1;l>=0;--l)t[l]=0;t[o]=a,t.t=this.t+o+1,t.s=this.s,t.clamp()}s(Zx,"bnpLShiftTo");function zx(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()}s(zx,"bnpRShiftTo");function qx(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()}s(qx,"bnpSubTo");function $x(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&&L.ZERO.subTo(t,t)}s($x,"bnpMultiplyTo");function Jx(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()}s(Jx,"bnpSquareTo");function Kx(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=q());var o=q(),a=this.s,l=r.s,u=this.DB-nu(i[i.t-1]);u>0?(i.lShiftTo(u,o),n.lShiftTo(u,e)):(i.copyTo(o),n.copyTo(e));var h=o.t,f=o[h-1];if(f!=0){var m=f*(1<<this.F1)+(h>1?o[h-2]>>this.F2:0),y=this.FV/m,x=(1<<this.F1)/m,S=1<<this.F2,P=e.t,g=P-h,C=t==null?q():t;for(o.dlShiftTo(g,C),e.compareTo(C)>=0&&(e[e.t++]=1,e.subTo(C,e)),L.ONE.dlShiftTo(h,C),C.subTo(o,o);o.t<h;)o[o.t++]=0;for(;--g>=0;){var w=e[--P]==f?this.DM:Math.floor(e[P]*y+(e[P-1]+S)*x);if((e[P]+=o.am(0,w,e,g,0,h))<w)for(o.dlShiftTo(g,C),e.subTo(C,e);e[P]<--w;)e.subTo(C,e)}t!=null&&(e.drShiftTo(h,t),a!=l&&L.ZERO.subTo(t,t)),e.t=h,e.clamp(),u>0&&e.rShiftTo(u,e),a<0&&L.ZERO.subTo(e,e)}}}s(Kx,"bnpDivRemTo");function Qx(r){var t=q();return this.abs().divRemTo(r,null,t),this.s<0&&t.compareTo(L.ZERO)>0&&r.subTo(t,t),t}s(Qx,"bnMod");function Fi(r){this.m=r}s(Fi,"Classic");function tS(r){return r.s<0||r.compareTo(this.m)>=0?r.mod(this.m):r}s(tS,"cConvert");function eS(r){return r}s(eS,"cRevert");function rS(r){r.divRemTo(this.m,null,r)}s(rS,"cReduce");function iS(r,t,e){r.multiplyTo(t,e),this.reduce(e)}s(iS,"cMulTo");function nS(r,t){r.squareTo(t),this.reduce(t)}s(nS,"cSqrTo");Fi.prototype.convert=tS;Fi.prototype.revert=eS;Fi.prototype.reduce=rS;Fi.prototype.mulTo=iS;Fi.prototype.sqrTo=nS;function oS(){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}s(oS,"bnpInvDigit");function Bi(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}s(Bi,"Montgomery");function aS(r){var t=q();return r.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),r.s<0&&t.compareTo(L.ZERO)>0&&this.m.subTo(t,t),t}s(aS,"montConvert");function sS(r){var t=q();return r.copyTo(t),this.reduce(t),t}s(sS,"montRevert");function lS(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)}s(lS,"montReduce");function uS(r,t){r.squareTo(t),this.reduce(t)}s(uS,"montSqrTo");function cS(r,t,e){r.multiplyTo(t,e),this.reduce(e)}s(cS,"montMulTo");Bi.prototype.convert=aS;Bi.prototype.revert=sS;Bi.prototype.reduce=lS;Bi.prototype.mulTo=cS;Bi.prototype.sqrTo=uS;function pS(){return(this.t>0?this[0]&1:this.s)==0}s(pS,"bnpIsEven");function hS(r,t){if(r>4294967295||r<1)return L.ONE;var e=q(),i=q(),n=t.convert(this),o=nu(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)}s(hS,"bnpExp");function dS(r,t){var e;return r<256||t.isEven()?e=new Fi(t):e=new Bi(t),this.exp(r,e)}s(dS,"bnModPowInt");L.prototype.copyTo=kx;L.prototype.fromInt=Fx;L.prototype.fromString=Bx;L.prototype.clamp=Gx;L.prototype.dlShiftTo=Wx;L.prototype.drShiftTo=Ux;L.prototype.lShiftTo=Zx;L.prototype.rShiftTo=zx;L.prototype.subTo=qx;L.prototype.multiplyTo=$x;L.prototype.squareTo=Jx;L.prototype.divRemTo=Kx;L.prototype.invDigit=oS;L.prototype.isEven=pS;L.prototype.exp=hS;L.prototype.toString=Vx;L.prototype.negate=Hx;L.prototype.abs=Xx;L.prototype.compareTo=Yx;L.prototype.bitLength=jx;L.prototype.mod=Qx;L.prototype.modPowInt=dS;L.ZERO=Jr(0);L.ONE=Jr(1);function fS(){var r=q();return this.copyTo(r),r}s(fS,"bnClone");function mS(){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]}s(mS,"bnIntValue");function yS(){return this.t==0?this.s:this[0]<<24>>24}s(yS,"bnByteValue");function gS(){return this.t==0?this.s:this[0]<<16>>16}s(gS,"bnShortValue");function vS(r){return Math.floor(Math.LN2*this.DB/Math.log(r))}s(vS,"bnpChunkSize");function bS(){return this.s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1}s(bS,"bnSigNum");function CS(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=Jr(e),n=q(),o=q(),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}s(CS,"bnpToRadix");function xS(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,l=0;l<r.length;++l){var u=Lv(r,l);if(u<0){r.charAt(l)=="-"&&this.signum()==0&&(n=!0);continue}a=t*a+u,++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&&L.ZERO.subTo(this,this)}s(xS,"bnpFromRadix");function SS(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(L.ONE.shiftLeft(r-1),fd,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>r&&this.subTo(L.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)}}s(SS,"bnpFromNumber");function PS(){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}s(PS,"bnToByteArray");function MS(r){return this.compareTo(r)==0}s(MS,"bnEquals");function TS(r){return this.compareTo(r)<0?this:r}s(TS,"bnMin");function wS(r){return this.compareTo(r)>0?this:r}s(wS,"bnMax");function IS(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()}s(IS,"bnpBitwiseTo");function ES(r,t){return r&t}s(ES,"op_and");function _S(r){var t=q();return this.bitwiseTo(r,ES,t),t}s(_S,"bnAnd");function fd(r,t){return r|t}s(fd,"op_or");function LS(r){var t=q();return this.bitwiseTo(r,fd,t),t}s(LS,"bnOr");function Ov(r,t){return r^t}s(Ov,"op_xor");function OS(r){var t=q();return this.bitwiseTo(r,Ov,t),t}s(OS,"bnXor");function Dv(r,t){return r&~t}s(Dv,"op_andnot");function DS(r){var t=q();return this.bitwiseTo(r,Dv,t),t}s(DS,"bnAndNot");function AS(){for(var r=q(),t=0;t<this.t;++t)r[t]=this.DM&~this[t];return r.t=this.t,r.s=~this.s,r}s(AS,"bnNot");function NS(r){var t=q();return r<0?this.rShiftTo(-r,t):this.lShiftTo(r,t),t}s(NS,"bnShiftLeft");function RS(r){var t=q();return r<0?this.lShiftTo(-r,t):this.rShiftTo(r,t),t}s(RS,"bnShiftRight");function kS(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}s(kS,"lbit");function FS(){for(var r=0;r<this.t;++r)if(this[r]!=0)return r*this.DB+kS(this[r]);return this.s<0?this.t*this.DB:-1}s(FS,"bnGetLowestSetBit");function BS(r){for(var t=0;r!=0;)r&=r-1,++t;return t}s(BS,"cbit");function GS(){for(var r=0,t=this.s&this.DM,e=0;e<this.t;++e)r+=BS(this[e]^t);return r}s(GS,"bnBitCount");function VS(r){var t=Math.floor(r/this.DB);return t>=this.t?this.s!=0:(this[t]&1<<r%this.DB)!=0}s(VS,"bnTestBit");function HS(r,t){var e=L.ONE.shiftLeft(r);return this.bitwiseTo(e,t,e),e}s(HS,"bnpChangeBit");function XS(r){return this.changeBit(r,fd)}s(XS,"bnSetBit");function YS(r){return this.changeBit(r,Dv)}s(YS,"bnClearBit");function jS(r){return this.changeBit(r,Ov)}s(jS,"bnFlipBit");function WS(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()}s(WS,"bnpAddTo");function US(r){var t=q();return this.addTo(r,t),t}s(US,"bnAdd");function ZS(r){var t=q();return this.subTo(r,t),t}s(ZS,"bnSubtract");function zS(r){var t=q();return this.multiplyTo(r,t),t}s(zS,"bnMultiply");function qS(){var r=q();return this.squareTo(r),r}s(qS,"bnSquare");function $S(r){var t=q();return this.divRemTo(r,t,null),t}s($S,"bnDivide");function JS(r){var t=q();return this.divRemTo(r,null,t),t}s(JS,"bnRemainder");function KS(r){var t=q(),e=q();return this.divRemTo(r,t,e),new Array(t,e)}s(KS,"bnDivideAndRemainder");function QS(r){this[this.t]=this.am(0,r-1,this,0,0,this.t),++this.t,this.clamp()}s(QS,"bnpDMultiply");function tP(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]}}s(tP,"bnpDAddOffset");function Ca(){}s(Ca,"NullExp");function Av(r){return r}s(Av,"nNop");function eP(r,t,e){r.multiplyTo(t,e)}s(eP,"nMulTo");function rP(r,t){r.squareTo(t)}s(rP,"nSqrTo");Ca.prototype.convert=Av;Ca.prototype.revert=Av;Ca.prototype.mulTo=eP;Ca.prototype.sqrTo=rP;function iP(r){return this.exp(r,new Ca)}s(iP,"bnPow");function nP(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()}s(nP,"bnpMultiplyLowerTo");function oP(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)}s(oP,"bnpMultiplyUpperTo");function jn(r){this.r2=q(),this.q3=q(),L.ONE.dlShiftTo(2*r.t,this.r2),this.mu=this.r2.divide(r),this.m=r}s(jn,"Barrett");function aP(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=q();return r.copyTo(t),this.reduce(t),t}s(aP,"barrettConvert");function sP(r){return r}s(sP,"barrettRevert");function lP(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)}s(lP,"barrettReduce");function uP(r,t){r.squareTo(t),this.reduce(t)}s(uP,"barrettSqrTo");function cP(r,t,e){r.multiplyTo(t,e),this.reduce(e)}s(cP,"barrettMulTo");jn.prototype.convert=aP;jn.prototype.revert=sP;jn.prototype.reduce=lP;jn.prototype.mulTo=cP;jn.prototype.sqrTo=uP;function pP(r,t){var e=r.bitLength(),i,n=Jr(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 Fi(t):t.isEven()?o=new jn(t):o=new Bi(t);var a=new Array,l=3,u=i-1,h=(1<<i)-1;if(a[1]=o.convert(this),i>1){var f=q();for(o.sqrTo(a[1],f);l<=h;)a[l]=q(),o.mulTo(f,a[l-2],a[l]),l+=2}var m=r.t-1,y,x=!0,S=q(),P;for(e=nu(r[m])-1;m>=0;){for(e>=u?y=r[m]>>e-u&h:(y=(r[m]&(1<<e+1)-1)<<u-e,m>0&&(y|=r[m-1]>>this.DB+e-u)),l=i;!(y&1);)y>>=1,--l;if((e-=l)<0&&(e+=this.DB,--m),x)a[y].copyTo(n),x=!1;else{for(;l>1;)o.sqrTo(n,S),o.sqrTo(S,n),l-=2;l>0?o.sqrTo(n,S):(P=n,n=S,S=P),o.mulTo(S,a[y],n)}for(;m>=0&&!(r[m]&1<<e);)o.sqrTo(n,S),P=n,n=S,S=P,--e<0&&(e=this.DB-1,--m)}return o.revert(n)}s(pP,"bnModPow");function hP(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}s(hP,"bnGCD");function dP(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}s(dP,"bnpModInt");function fP(r){var t=r.isEven();if(this.isEven()&&t||r.signum()==0)return L.ZERO;for(var e=r.clone(),i=this.clone(),n=Jr(1),o=Jr(0),a=Jr(0),l=Jr(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()||!l.isEven())&&(a.addTo(this,a),l.subTo(r,l)),a.rShiftTo(1,a)):l.isEven()||l.subTo(r,l),l.rShiftTo(1,l);e.compareTo(i)>=0?(e.subTo(i,e),t&&n.subTo(a,n),o.subTo(l,o)):(i.subTo(e,i),t&&a.subTo(n,a),l.subTo(o,l))}if(i.compareTo(L.ONE)!=0)return L.ZERO;if(l.compareTo(r)>=0)return l.subtract(r);if(l.signum()<0)l.addTo(r,l);else return l;return l.signum()<0?l.add(r):l}s(fP,"bnModInverse");var Ut=[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],mP=(1<<26)/Ut[Ut.length-1];function yP(r){var t,e=this.abs();if(e.t==1&&e[0]<=Ut[Ut.length-1]){for(t=0;t<Ut.length;++t)if(e[0]==Ut[t])return!0;return!1}if(e.isEven())return!1;for(t=1;t<Ut.length;){for(var i=Ut[t],n=t+1;n<Ut.length&&i<mP;)i*=Ut[n++];for(i=e.modInt(i);t<n;)if(i%Ut[t++]==0)return!1}return e.millerRabin(r)}s(yP,"bnIsProbablePrime");function gP(r){var t=this.subtract(L.ONE),e=t.getLowestSetBit();if(e<=0)return!1;var i=t.shiftRight(e);r=r+1>>1,r>Ut.length&&(r=Ut.length);for(var n=q(),o=0;o<r;++o){n.fromInt(Ut[Math.floor(Math.random()*Ut.length)]);var a=n.modPow(i,this);if(a.compareTo(L.ONE)!=0&&a.compareTo(t)!=0){for(var l=1;l++<e&&a.compareTo(t)!=0;)if(a=a.modPowInt(2,this),a.compareTo(L.ONE)==0)return!1;if(a.compareTo(t)!=0)return!1}}return!0}s(gP,"bnpMillerRabin");L.prototype.chunkSize=vS;L.prototype.toRadix=CS;L.prototype.fromRadix=xS;L.prototype.fromNumber=SS;L.prototype.bitwiseTo=IS;L.prototype.changeBit=HS;L.prototype.addTo=WS;L.prototype.dMultiply=QS;L.prototype.dAddOffset=tP;L.prototype.multiplyLowerTo=nP;L.prototype.multiplyUpperTo=oP;L.prototype.modInt=dP;L.prototype.millerRabin=gP;L.prototype.clone=fS;L.prototype.intValue=mS;L.prototype.byteValue=yS;L.prototype.shortValue=gS;L.prototype.signum=bS;L.prototype.toByteArray=PS;L.prototype.equals=MS;L.prototype.min=TS;L.prototype.max=wS;L.prototype.and=_S;L.prototype.or=LS;L.prototype.xor=OS;L.prototype.andNot=DS;L.prototype.not=AS;L.prototype.shiftLeft=NS;L.prototype.shiftRight=RS;L.prototype.getLowestSetBit=FS;L.prototype.bitCount=GS;L.prototype.testBit=VS;L.prototype.setBit=XS;L.prototype.clearBit=YS;L.prototype.flipBit=jS;L.prototype.add=US;L.prototype.subtract=ZS;L.prototype.multiply=zS;L.prototype.divide=$S;L.prototype.remainder=JS;L.prototype.divideAndRemainder=KS;L.prototype.modPow=pP;L.prototype.modInverse=fP;L.prototype.pow=iP;L.prototype.gcd=hP;L.prototype.isProbablePrime=yP;L.prototype.square=qS;var U=L;U.prototype.IsNegative=function(){return this.compareTo(U.ZERO)==-1};U.op_Equality=function(r,t){return r.compareTo(t)==0};U.op_Inequality=function(r,t){return r.compareTo(t)!=0};U.op_GreaterThan=function(r,t){return r.compareTo(t)>0};U.op_LessThan=function(r,t){return r.compareTo(t)<0};U.op_Addition=function(r,t){return new U(r).add(new U(t))};U.op_Subtraction=function(r,t){return new U(r).subtract(new U(t))};U.Int128Mul=function(r,t){return new U(r).multiply(new U(t))};U.op_Division=function(r,t){return r.divide(t)};U.prototype.ToDouble=function(){return parseFloat(this.toString())};typeof ru>"u"&&(ru=s(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 ru;p.Path=function(){return[]};p.Paths=function(){return[]};p.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])};p.DoublePoint0=function(){this.X=0,this.Y=0};p.DoublePoint1=function(r){this.X=r.X,this.Y=r.Y};p.DoublePoint2=function(r,t){this.X=r,this.Y=t};p.PolyNode=function(){this.m_Parent=null,this.m_polygon=new p.Path,this.m_Index=0,this.m_jointype=0,this.m_endtype=0,this.m_Childs=[],this.IsOpen=!1};p.PolyNode.prototype.IsHoleNode=function(){for(var r=!0,t=this.m_Parent;t!==null;)r=!r,t=t.m_Parent;return r};p.PolyNode.prototype.ChildCount=function(){return this.m_Childs.length};p.PolyNode.prototype.Contour=function(){return this.m_polygon};p.PolyNode.prototype.AddChild=function(r){var t=this.m_Childs.length;this.m_Childs.push(r),r.m_Parent=this,r.m_Index=t};p.PolyNode.prototype.GetNext=function(){return this.m_Childs.length>0?this.m_Childs[0]:this.GetNextSiblingUp()};p.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]};p.PolyNode.prototype.Childs=function(){return this.m_Childs};p.PolyNode.prototype.Parent=function(){return this.m_Parent};p.PolyNode.prototype.IsHole=function(){return this.IsHoleNode()};p.PolyTree=function(){this.m_AllPolys=[],p.PolyNode.call(this)};p.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};p.PolyTree.prototype.GetFirst=function(){return this.m_Childs.length>0?this.m_Childs[0]:null};p.PolyTree.prototype.Total=function(){return this.m_AllPolys.length};ru(p.PolyTree,p.PolyNode);p.Math_Abs_Int64=p.Math_Abs_Int32=p.Math_Abs_Double=function(r){return Math.abs(r)};p.Math_Max_Int32_Int32=function(r,t){return Math.max(r,t)};Z.msie||Z.opera||Z.safari?p.Cast_Int32=function(r){return r|0}:p.Cast_Int32=function(r){return~~r};Z.chrome?p.Cast_Int64=function(r){return r<-2147483648||r>2147483647?r<0?Math.ceil(r):Math.floor(r):~~r}:Z.firefox&&typeof Number.toInteger=="function"?p.Cast_Int64=function(r){return Number.toInteger(r)}:Z.msie7||Z.msie8?p.Cast_Int64=function(r){return parseInt(r,10)}:Z.msie?p.Cast_Int64=function(r){return r<-2147483648||r>2147483647?r<0?Math.ceil(r):Math.floor(r):r|0}:p.Cast_Int64=function(r){return r<0?Math.ceil(r):Math.floor(r)};p.Clear=function(r){r.length=0};p.PI=3.141592653589793;p.PI2=2*3.141592653589793;p.IntPoint=function(){var r=arguments,t=r.length;if(this.X=0,this.Y=0,ki)if(this.Z=0,t==3)this.X=r[0],this.Y=r[1],this.Z=r[2];else if(t==2)this.X=r[0],this.Y=r[1],this.Z=0;else if(t==1)if(r[0]instanceof p.DoublePoint){var e=r[0];this.X=p.Clipper.Round(e.X),this.Y=p.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 p.DoublePoint){var e=r[0];this.X=p.Clipper.Round(e.X),this.Y=p.Clipper.Round(e.Y)}else{var i=r[0];this.X=i.X,this.Y=i.Y}else this.X=0,this.Y=0};p.IntPoint.op_Equality=function(r,t){return r.X==t.X&&r.Y==t.Y};p.IntPoint.op_Inequality=function(r,t){return r.X!=t.X||r.Y!=t.Y};ki?(p.IntPoint0=function(){this.X=0,this.Y=0,this.Z=0},p.IntPoint1=function(r){this.X=r.X,this.Y=r.Y,this.Z=r.Z},p.IntPoint1dp=function(r){this.X=p.Clipper.Round(r.X),this.Y=p.Clipper.Round(r.Y),this.Z=0},p.IntPoint2=function(r,t){this.X=r,this.Y=t,this.Z=0},p.IntPoint3=function(r,t,e){this.X=r,this.Y=t,this.Z=e}):(p.IntPoint0=function(){this.X=0,this.Y=0},p.IntPoint1=function(r){this.X=r.X,this.Y=r.Y},p.IntPoint1dp=function(r){this.X=p.Clipper.Round(r.X),this.Y=p.Clipper.Round(r.Y)},p.IntPoint2=function(r,t){this.X=r,this.Y=t});p.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)};p.IntRect0=function(){this.left=0,this.top=0,this.right=0,this.bottom=0};p.IntRect1=function(r){this.left=r.left,this.top=r.top,this.right=r.right,this.bottom=r.bottom};p.IntRect4=function(r,t,e,i){this.left=r,this.top=t,this.right=e,this.bottom=i};p.ClipType={ctIntersection:0,ctUnion:1,ctDifference:2,ctXor:3};p.PolyType={ptSubject:0,ptClip:1};p.PolyFillType={pftEvenOdd:0,pftNonZero:1,pftPositive:2,pftNegative:3};p.JoinType={jtSquare:0,jtRound:1,jtMiter:2};p.EndType={etOpenSquare:0,etOpenRound:1,etOpenButt:2,etClosedLine:3,etClosedPolygon:4};Ev&&(p.EndType_={etSquare:0,etRound:1,etButt:2,etClosed:3});p.EdgeSide={esLeft:0,esRight:1};p.Direction={dRightToLeft:0,dLeftToRight:1};p.TEdge=function(){this.Bot=new p.IntPoint,this.Curr=new p.IntPoint,this.Top=new p.IntPoint,this.Delta=new p.IntPoint,this.Dx=0,this.PolyTyp=p.PolyType.ptSubject,this.Side=p.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};p.IntersectNode=function(){this.Edge1=null,this.Edge2=null,this.Pt=new p.IntPoint};p.MyIntersectNodeSort=function(){};p.MyIntersectNodeSort.Compare=function(r,t){return t.Pt.Y-r.Pt.Y};p.LocalMinima=function(){this.Y=0,this.LeftBound=null,this.RightBound=null,this.Next=null};p.Scanbeam=function(){this.Y=0,this.Next=null};p.OutRec=function(){this.Idx=0,this.IsHole=!1,this.IsOpen=!1,this.FirstLeft=null,this.Pts=null,this.BottomPt=null,this.PolyNode=null};p.OutPt=function(){this.Idx=0,this.Pt=new p.IntPoint,this.Next=null,this.Prev=null};p.Join=function(){this.OutPt1=null,this.OutPt2=null,this.OffPt=new p.IntPoint};p.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};p.ClipperBase.horizontal=-9007199254740992;p.ClipperBase.Skip=-2;p.ClipperBase.Unassigned=-1;p.ClipperBase.tolerance=1e-20;Lx?(p.ClipperBase.loRange=46340,p.ClipperBase.hiRange=46340):(p.ClipperBase.loRange=47453132,p.ClipperBase.hiRange=0xfffffffffffff);p.ClipperBase.near_zero=function(r){return r>-p.ClipperBase.tolerance&&r<p.ClipperBase.tolerance};p.ClipperBase.IsHorizontal=function(r){return r.Delta.Y===0};p.ClipperBase.prototype.PointIsVertex=function(r,t){var e=t;do{if(p.IntPoint.op_Equality(e.Pt,r))return!0;e=e.Next}while(e!=t);return!1};p.ClipperBase.prototype.PointOnLineSegment=function(r,t,e,i){return i?r.X==t.X&&r.Y==t.Y||r.X==e.X&&r.Y==e.Y||r.X>t.X==r.X<e.X&&r.Y>t.Y==r.Y<e.Y&&U.op_Equality(U.Int128Mul(r.X-t.X,e.Y-t.Y),U.Int128Mul(e.X-t.X,r.Y-t.Y)):r.X==t.X&&r.Y==t.Y||r.X==e.X&&r.Y==e.Y||r.X>t.X==r.X<e.X&&r.Y>t.Y==r.Y<e.Y&&(r.X-t.X)*(e.Y-t.Y)==(e.X-t.X)*(r.Y-t.Y)};p.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};p.ClipperBase.prototype.SlopesEqual=p.ClipperBase.SlopesEqual=function(){var r=arguments,t=r.length,e,i,n,o,a,l,u;return t==3?(e=r[0],i=r[1],u=r[2],u?U.op_Equality(U.Int128Mul(e.Delta.Y,i.Delta.X),U.Int128Mul(e.Delta.X,i.Delta.Y)):p.Cast_Int64(e.Delta.Y*i.Delta.X)==p.Cast_Int64(e.Delta.X*i.Delta.Y)):t==4?(n=r[0],o=r[1],a=r[2],u=r[3],u?U.op_Equality(U.Int128Mul(n.Y-o.Y,o.X-a.X),U.Int128Mul(n.X-o.X,o.Y-a.Y)):p.Cast_Int64((n.Y-o.Y)*(o.X-a.X))-p.Cast_Int64((n.X-o.X)*(o.Y-a.Y))===0):(n=r[0],o=r[1],a=r[2],l=r[3],u=r[4],u?U.op_Equality(U.Int128Mul(n.Y-o.Y,a.X-l.X),U.Int128Mul(n.X-o.X,a.Y-l.Y)):p.Cast_Int64((n.Y-o.Y)*(a.X-l.X))-p.Cast_Int64((n.X-o.X)*(a.Y-l.Y))===0)};p.ClipperBase.SlopesEqual3=function(r,t,e){return e?U.op_Equality(U.Int128Mul(r.Delta.Y,t.Delta.X),U.Int128Mul(r.Delta.X,t.Delta.Y)):p.Cast_Int64(r.Delta.Y*t.Delta.X)==p.Cast_Int64(r.Delta.X*t.Delta.Y)};p.ClipperBase.SlopesEqual4=function(r,t,e,i){return i?U.op_Equality(U.Int128Mul(r.Y-t.Y,t.X-e.X),U.Int128Mul(r.X-t.X,t.Y-e.Y)):p.Cast_Int64((r.Y-t.Y)*(t.X-e.X))-p.Cast_Int64((r.X-t.X)*(t.Y-e.Y))===0};p.ClipperBase.SlopesEqual5=function(r,t,e,i,n){return n?U.op_Equality(U.Int128Mul(r.Y-t.Y,e.X-i.X),U.Int128Mul(r.X-t.X,e.Y-i.Y)):p.Cast_Int64((r.Y-t.Y)*(e.X-i.X))-p.Cast_Int64((r.X-t.X)*(e.Y-i.Y))===0};p.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;p.Clear(this.m_edges[r])}p.Clear(this.m_edges),this.m_UseFullRange=!1,this.m_HasOpenPaths=!1};p.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};p.ClipperBase.prototype.RangeTest=function(r,t){t.Value?(r.X>p.ClipperBase.hiRange||r.Y>p.ClipperBase.hiRange||-r.X>p.ClipperBase.hiRange||-r.Y>p.ClipperBase.hiRange)&&p.Error("Coordinate outside allowed range in RangeTest()."):(r.X>p.ClipperBase.loRange||r.Y>p.ClipperBase.loRange||-r.X>p.ClipperBase.loRange||-r.Y>p.ClipperBase.loRange)&&(t.Value=!0,this.RangeTest(r,t))};p.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};p.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};p.ClipperBase.prototype.FindNextLocMin=function(r){for(var t;;){for(;p.IntPoint.op_Inequality(r.Bot,r.Prev.Bot)||p.IntPoint.op_Equality(r.Curr,r.Top);)r=r.Next;if(r.Dx!=p.ClipperBase.horizontal&&r.Prev.Dx!=p.ClipperBase.horizontal)break;for(;r.Prev.Dx==p.ClipperBase.horizontal;)r=r.Prev;for(t=r;r.Dx==p.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};p.ClipperBase.prototype.ProcessBound=function(r,t){var e=r,i=r,n,o;if(r.Dx==p.ClipperBase.horizontal&&(t?o=r.Prev.Bot.X:o=r.Next.Bot.X,r.Bot.X!=o&&this.ReverseHorizontal(r)),i.OutIdx!=p.ClipperBase.Skip)if(t){for(;i.Top.Y==i.Next.Bot.Y&&i.Next.OutIdx!=p.ClipperBase.Skip;)i=i.Next;if(i.Dx==p.ClipperBase.horizontal&&i.Next.OutIdx!=p.ClipperBase.Skip){for(n=i;n.Prev.Dx==p.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==p.ClipperBase.horizontal&&r!=e&&r.Bot.X!=r.Prev.Top.X&&this.ReverseHorizontal(r),r=r.Next;r.Dx==p.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!=p.ClipperBase.Skip;)i=i.Prev;if(i.Dx==p.ClipperBase.horizontal&&i.Prev.OutIdx!=p.ClipperBase.Skip){for(n=i;n.Next.Dx==p.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==p.ClipperBase.horizontal&&r!=e&&r.Bot.X!=r.Next.Top.X&&this.ReverseHorizontal(r),r=r.Prev;r.Dx==p.ClipperBase.horizontal&&r!=e&&r.Bot.X!=r.Next.Top.X&&this.ReverseHorizontal(r),i=i.Prev}if(i.OutIdx==p.ClipperBase.Skip){if(r=i,t){for(;r.Top.Y==r.Next.Bot.Y;)r=r.Next;for(;r!=i&&r.Dx==p.ClipperBase.horizontal;)r=r.Prev}else{for(;r.Top.Y==r.Prev.Bot.Y;)r=r.Prev;for(;r!=i&&r.Dx==p.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 p.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};p.ClipperBase.prototype.AddPath=function(r,t,e){Iv?!e&&t==p.PolyType.ptClip&&p.Error("AddPath: Open paths must be subject."):e||p.Error("AddPath: Open paths have been disabled.");var i=r.length-1;if(e)for(;i>0&&p.IntPoint.op_Equality(r[i],r[0]);)--i;for(;i>0&&p.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 p.TEdge);var a=!0;n[1].Curr.X=r[1].X,n[1].Curr.Y=r[1].Y;var l={Value:this.m_UseFullRange};this.RangeTest(r[0],l),this.m_UseFullRange=l.Value,l.Value=this.m_UseFullRange,this.RangeTest(r[i],l),this.m_UseFullRange=l.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)l.Value=this.m_UseFullRange,this.RangeTest(r[o],l),this.m_UseFullRange=l.Value,this.InitEdge(n[o],n[o+1],n[o-1],r[o]);for(var u=n[0],h=u,f=u;;){if(p.IntPoint.op_Equality(h.Curr,h.Next.Curr)){if(h==h.Next)break;h==u&&(u=h.Next),h=this.RemoveEdge(h),f=h;continue}if(h.Prev==h.Next)break;if(e&&p.ClipperBase.SlopesEqual(h.Prev.Curr,h.Curr,h.Next.Curr,this.m_UseFullRange)&&(!this.PreserveCollinear||!this.Pt2IsBetweenPt1AndPt3(h.Prev.Curr,h.Curr,h.Next.Curr))){h==u&&(u=h.Next),h=this.RemoveEdge(h),h=h.Prev,f=h;continue}if(h=h.Next,h==f)break}if(!e&&h==h.Next||e&&h.Prev==h.Next)return!1;e||(this.m_HasOpenPaths=!0,u.Prev.OutIdx=p.ClipperBase.Skip);var m=u;h=u;do this.InitEdge2(h,t),h=h.Next,a&&h.Curr.Y!=u.Curr.Y&&(a=!1);while(h!=u);if(a){if(e)return!1;h.Prev.OutIdx=p.ClipperBase.Skip,h.Prev.Bot.X<h.Prev.Top.X&&this.ReverseHorizontal(h.Prev);var y=new p.LocalMinima;for(y.Next=null,y.Y=h.Bot.Y,y.LeftBound=null,y.RightBound=h,y.RightBound.Side=p.EdgeSide.esRight,y.RightBound.WindDelta=0;h.Next.OutIdx!=p.ClipperBase.Skip;)h.NextInLML=h.Next,h.Bot.X!=h.Prev.Top.X&&this.ReverseHorizontal(h),h=h.Next;return this.InsertLocalMinima(y),this.m_edges.push(n),!0}this.m_edges.push(n);for(var x,S=null;h=this.FindNextLocMin(h),h!=S;){S==null&&(S=h);var y=new p.LocalMinima;y.Next=null,y.Y=h.Bot.Y,h.Dx<h.Prev.Dx?(y.LeftBound=h.Prev,y.RightBound=h,x=!1):(y.LeftBound=h,y.RightBound=h.Prev,x=!0),y.LeftBound.Side=p.EdgeSide.esLeft,y.RightBound.Side=p.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,h=this.ProcessBound(y.LeftBound,x);var P=this.ProcessBound(y.RightBound,!x);y.LeftBound.OutIdx==p.ClipperBase.Skip?y.LeftBound=null:y.RightBound.OutIdx==p.ClipperBase.Skip&&(y.RightBound=null),this.InsertLocalMinima(y),x||(h=P)}return!0};p.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};p.ClipperBase.prototype.Pt2IsBetweenPt1AndPt3=function(r,t,e){return p.IntPoint.op_Equality(r,e)||p.IntPoint.op_Equality(r,t)||p.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};p.ClipperBase.prototype.RemoveEdge=function(r){r.Prev.Next=r.Next,r.Next.Prev=r.Prev;var t=r.Next;return r.Prev=null,t};p.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=p.ClipperBase.horizontal:r.Dx=r.Delta.X/r.Delta.Y};p.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}};p.ClipperBase.prototype.PopLocalMinima=function(){this.m_CurrentLM!==null&&(this.m_CurrentLM=this.m_CurrentLM.Next)};p.ClipperBase.prototype.ReverseHorizontal=function(r){var t=r.Top.X;r.Top.X=r.Bot.X,r.Bot.X=t,ki&&(t=r.Top.Z,r.Top.Z=r.Bot.Z,r.Bot.Z=t)};p.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=p.EdgeSide.esLeft,t.OutIdx=p.ClipperBase.Unassigned),t=r.RightBound,t!=null&&(t.Curr.X=t.Bot.X,t.Curr.Y=t.Bot.Y,t.Side=p.EdgeSide.esRight,t.OutIdx=p.ClipperBase.Unassigned),r=r.Next}};p.Clipper=function(r){typeof r>"u"&&(r=0),this.m_PolyOuts=null,this.m_ClipType=p.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=p.PolyFillType.pftEvenOdd,this.m_SubjFillType=p.PolyFillType.pftEvenOdd,this.m_Joins=null,this.m_GhostJoins=null,this.m_UsingPolyTree=!1,this.ReverseSolution=!1,this.StrictlySimple=!1,p.ClipperBase.call(this),this.m_Scanbeam=null,this.m_ActiveEdges=null,this.m_SortedEdges=null,this.m_IntersectList=new Array,this.m_IntersectNodeComparer=p.MyIntersectNodeSort.Compare,this.m_ExecuteLocked=!1,this.m_UsingPolyTree=!1,this.m_PolyOuts=new Array,this.m_Joins=new Array,this.m_GhostJoins=new Array,this.ReverseSolution=(1&r)!==0,this.StrictlySimple=(2&r)!==0,this.PreserveCollinear=(4&r)!==0,ki&&(this.ZFillFunction=null)};p.Clipper.ioReverseSolution=1;p.Clipper.ioStrictlySimple=2;p.Clipper.ioPreserveCollinear=4;p.Clipper.prototype.Clear=function(){this.m_edges.length!==0&&(this.DisposeAllPolyPts(),p.ClipperBase.prototype.Clear.call(this))};p.Clipper.prototype.DisposeScanbeamList=function(){for(;this.m_Scanbeam!==null;){var r=this.m_Scanbeam.Next;this.m_Scanbeam=null,this.m_Scanbeam=r}};p.Clipper.prototype.Reset=function(){p.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};p.Clipper.prototype.InsertScanbeam=function(r){if(this.m_Scanbeam===null)this.m_Scanbeam=new p.Scanbeam,this.m_Scanbeam.Next=null,this.m_Scanbeam.Y=r;else if(r>this.m_Scanbeam.Y){var t=new p.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 p.Scanbeam;t.Y=r,t.Next=e.Next,e.Next=t}};p.Clipper.prototype.Execute=function(){var r=arguments,t=r.length,e=r[1]instanceof p.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&&p.Error("Error: PolyTree struct is need for open path clipping."),this.m_ExecuteLocked=!0,p.Clear(n),this.m_SubjFillType=o,this.m_ClipFillType=a,this.m_ClipType=i,this.m_UsingPolyTree=!1;try{var l=this.ExecuteInternal();l&&this.BuildResult(n)}finally{this.DisposeAllPolyPts(),this.m_ExecuteLocked=!1}return l}else if(t==4&&e){var i=r[0],u=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 l=this.ExecuteInternal();l&&this.BuildResult2(u)}finally{this.DisposeAllPolyPts(),this.m_ExecuteLocked=!1}return l}else if(t==2&&!e){var i=r[0],n=r[1];return this.Execute(i,n,p.PolyFillType.pftEvenOdd,p.PolyFillType.pftEvenOdd)}else if(t==2&&e){var i=r[0],u=r[1];return this.Execute(i,u,p.PolyFillType.pftEvenOdd,p.PolyFillType.pftEvenOdd)}};p.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}};p.Clipper.prototype.ExecuteInternal=function(){try{if(this.Reset(),this.m_CurrentLM===null)return!1;var r=this.PopScanbeam();do{if(this.InsertLocalMinimaIntoAEL(r),p.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{p.Clear(this.m_Joins),p.Clear(this.m_GhostJoins)}};p.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};p.Clipper.prototype.DisposeAllPolyPts=function(){for(var r=0,t=this.m_PolyOuts.length;r<t;++r)this.DisposeOutRec(r);p.Clear(this.m_PolyOuts)};p.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};p.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}};p.Clipper.prototype.AddJoin=function(r,t,e){var i=new p.Join;i.OutPt1=r,i.OutPt2=t,i.OffPt.X=e.X,i.OffPt.Y=e.Y,this.m_Joins.push(i)};p.Clipper.prototype.AddGhostJoin=function(r,t){var e=new p.Join;e.OutPt1=r,e.OffPt.X=t.X,e.OffPt.Y=t.Y,this.m_GhostJoins.push(e)};ki&&(p.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))});p.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&&(p.ClipperBase.IsHorizontal(e)?this.AddEdgeToSEL(e):this.InsertScanbeam(e.Top.Y)),!(t==null||e==null)){if(i!==null&&p.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&&p.ClipperBase.SlopesEqual(t.PrevInAEL,t,this.m_UseFullRange)&&t.WindDelta!==0&&t.PrevInAEL.WindDelta!==0){var l=this.AddOutPt(t.PrevInAEL,t.Bot);this.AddJoin(i,l,t.Top)}if(t.NextInAEL!=e){if(e.OutIdx>=0&&e.PrevInAEL.OutIdx>=0&&p.ClipperBase.SlopesEqual(e.PrevInAEL,e,this.m_UseFullRange)&&e.WindDelta!==0&&e.PrevInAEL.WindDelta!==0){var l=this.AddOutPt(e.PrevInAEL,e.Bot);this.AddJoin(i,l,e.Top)}var u=t.NextInAEL;if(u!==null)for(;u!=e;)this.IntersectEdges(e,u,t.Curr,!1),u=u.NextInAEL}}}};p.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}};p.Clipper.prototype.E2InsertsBeforeE1=function(r,t){return t.Curr.X==r.Curr.X?t.Top.Y>r.Top.Y?t.Top.X<p.Clipper.TopX(r,t.Top.Y):r.Top.X>p.Clipper.TopX(t,r.Top.Y):t.Curr.X<r.Curr.X};p.Clipper.prototype.IsEvenOddFillType=function(r){return r.PolyTyp==p.PolyType.ptSubject?this.m_SubjFillType==p.PolyFillType.pftEvenOdd:this.m_ClipFillType==p.PolyFillType.pftEvenOdd};p.Clipper.prototype.IsEvenOddAltFillType=function(r){return r.PolyTyp==p.PolyType.ptSubject?this.m_ClipFillType==p.PolyFillType.pftEvenOdd:this.m_SubjFillType==p.PolyFillType.pftEvenOdd};p.Clipper.prototype.IsContributing=function(r){var t,e;switch(r.PolyTyp==p.PolyType.ptSubject?(t=this.m_SubjFillType,e=this.m_ClipFillType):(t=this.m_ClipFillType,e=this.m_SubjFillType),t){case p.PolyFillType.pftEvenOdd:if(r.WindDelta===0&&r.WindCnt!=1)return!1;break;case p.PolyFillType.pftNonZero:if(Math.abs(r.WindCnt)!=1)return!1;break;case p.PolyFillType.pftPositive:if(r.WindCnt!=1)return!1;break;default:if(r.WindCnt!=-1)return!1;break}switch(this.m_ClipType){case p.ClipType.ctIntersection:switch(e){case p.PolyFillType.pftEvenOdd:case p.PolyFillType.pftNonZero:return r.WindCnt2!==0;case p.PolyFillType.pftPositive:return r.WindCnt2>0;default:return r.WindCnt2<0}case p.ClipType.ctUnion:switch(e){case p.PolyFillType.pftEvenOdd:case p.PolyFillType.pftNonZero:return r.WindCnt2===0;case p.PolyFillType.pftPositive:return r.WindCnt2<=0;default:return r.WindCnt2>=0}case p.ClipType.ctDifference:if(r.PolyTyp==p.PolyType.ptSubject)switch(e){case p.PolyFillType.pftEvenOdd:case p.PolyFillType.pftNonZero:return r.WindCnt2===0;case p.PolyFillType.pftPositive:return r.WindCnt2<=0;default:return r.WindCnt2>=0}else switch(e){case p.PolyFillType.pftEvenOdd:case p.PolyFillType.pftNonZero:return r.WindCnt2!==0;case p.PolyFillType.pftPositive:return r.WindCnt2>0;default:return r.WindCnt2<0}case p.ClipType.ctXor:if(r.WindDelta===0)switch(e){case p.PolyFillType.pftEvenOdd:case p.PolyFillType.pftNonZero:return r.WindCnt2===0;case p.PolyFillType.pftPositive:return r.WindCnt2<=0;default:return r.WindCnt2>=0}else return!0}return!0};p.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!=p.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};p.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)};p.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};p.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)}};p.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)}};p.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)};p.Clipper.prototype.AddLocalMinPoly=function(r,t,e){var i,n,o;if(p.ClipperBase.IsHorizontal(t)||r.Dx>t.Dx?(i=this.AddOutPt(r,e),t.OutIdx=r.OutIdx,r.Side=p.EdgeSide.esLeft,t.Side=p.EdgeSide.esRight,n=r,n.PrevInAEL==t?o=t.PrevInAEL:o=n.PrevInAEL):(i=this.AddOutPt(t,e),r.OutIdx=t.OutIdx,r.Side=p.EdgeSide.esRight,t.Side=p.EdgeSide.esLeft,n=t,n.PrevInAEL==r?o=r.PrevInAEL:o=n.PrevInAEL),o!==null&&o.OutIdx>=0&&p.Clipper.TopX(o,e.Y)==p.Clipper.TopX(n,e.Y)&&p.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};p.Clipper.prototype.CreateOutRec=function(){var r=new p.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};p.Clipper.prototype.AddOutPt=function(r,t){var e=r.Side==p.EdgeSide.esLeft;if(r.OutIdx<0){var i=this.CreateOutRec();i.IsOpen=r.WindDelta===0;var n=new p.OutPt;return i.Pts=n,n.Idx=i.Idx,n.Pt.X=t.X,n.Pt.Y=t.Y,n.Next=n,n.Prev=n,i.IsOpen||this.SetHoleState(r,i),ki&&(p.IntPoint.op_Equality(t,r.Bot)?(n.Pt.X=r.Bot.X,n.Pt.Y=r.Bot.Y,n.Pt.Z=r.Bot.Z):p.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&&p.IntPoint.op_Equality(t,o.Pt))return o;if(!e&&p.IntPoint.op_Equality(t,o.Prev.Pt))return o.Prev;var n=new p.OutPt;return n.Idx=i.Idx,n.Pt.X=t.X,n.Pt.Y=t.Y,n.Next=o,n.Prev=o.Prev,n.Prev.Next=n,o.Prev=n,e&&(i.Pts=n),ki&&(p.IntPoint.op_Equality(t,r.Bot)?(n.Pt.X=r.Bot.X,n.Pt.Y=r.Bot.Y,n.Pt.Z=r.Bot.Z):p.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}};p.Clipper.prototype.SwapPoints=function(r,t){var e=new p.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};p.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};p.Clipper.prototype.InsertPolyPtBetween=function(r,t,e){var i=new p.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};p.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)};p.Clipper.prototype.GetDx=function(r,t){return r.Y==t.Y?p.ClipperBase.horizontal:(t.X-r.X)/(t.Y-r.Y)};p.Clipper.prototype.FirstIsBottomPt=function(r,t){for(var e=r.Prev;p.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;p.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;p.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;p.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};p.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;p.IntPoint.op_Inequality(t.Pt,r.Pt);)t=t.Next;return r};p.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};p.Clipper.prototype.Param1RightOfParam2=function(r,t){do if(r=r.FirstLeft,r==t)return!0;while(r!==null);return!1};p.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};p.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,l=i.Pts,u=l.Prev,h;r.Side==p.EdgeSide.esLeft?(t.Side==p.EdgeSide.esLeft?(this.ReversePolyPtLinks(l),l.Next=o,o.Prev=l,a.Next=u,u.Prev=a,e.Pts=u):(u.Next=o,o.Prev=u,l.Prev=a,a.Next=l,e.Pts=l),h=p.EdgeSide.esLeft):(t.Side==p.EdgeSide.esRight?(this.ReversePolyPtLinks(l),a.Next=u,u.Prev=a,l.Next=o,o.Prev=l):(a.Next=l,l.Prev=a,o.Prev=u,u.Next=o),h=p.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=h;break}y=y.NextInAEL}i.Idx=e.Idx};p.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)}};p.Clipper.SwapSides=function(r,t){var e=r.Side;r.Side=t.Side,t.Side=e};p.Clipper.SwapPolyIndexes=function(r,t){var e=r.OutIdx;r.OutIdx=t.OutIdx,t.OutIdx=e};p.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,l=t.OutIdx>=0;if(Iv&&(r.WindDelta===0||t.WindDelta===0)){r.WindDelta===0&&t.WindDelta===0?(n||o)&&a&&l&&this.AddLocalMaxPoly(r,t,e):r.PolyTyp==t.PolyTyp&&r.WindDelta!=t.WindDelta&&this.m_ClipType==p.ClipType.ctUnion?r.WindDelta===0?l&&(this.AddOutPt(r,e),a&&(r.OutIdx=-1)):a&&(this.AddOutPt(t,e),l&&(t.OutIdx=-1)):r.PolyTyp!=t.PolyTyp&&(r.WindDelta===0&&Math.abs(t.WindCnt)==1&&(this.m_ClipType!=p.ClipType.ctUnion||t.WindCnt2===0)?(this.AddOutPt(r,e),a&&(r.OutIdx=-1)):t.WindDelta===0&&Math.abs(r.WindCnt)==1&&(this.m_ClipType!=p.ClipType.ctUnion||r.WindCnt2===0)&&(this.AddOutPt(t,e),l&&(t.OutIdx=-1))),n&&(r.OutIdx<0?this.DeleteFromAEL(r):p.Error("Error intersecting polylines")),o&&(t.OutIdx<0?this.DeleteFromAEL(t):p.Error("Error intersecting polylines"));return}if(r.PolyTyp==t.PolyTyp)if(this.IsEvenOddFillType(r)){var u=r.WindCnt;r.WindCnt=t.WindCnt,t.WindCnt=u}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 h,f,m,y;r.PolyTyp==p.PolyType.ptSubject?(h=this.m_SubjFillType,m=this.m_ClipFillType):(h=this.m_ClipFillType,m=this.m_SubjFillType),t.PolyTyp==p.PolyType.ptSubject?(f=this.m_SubjFillType,y=this.m_ClipFillType):(f=this.m_ClipFillType,y=this.m_SubjFillType);var x,S;switch(h){case p.PolyFillType.pftPositive:x=r.WindCnt;break;case p.PolyFillType.pftNegative:x=-r.WindCnt;break;default:x=Math.abs(r.WindCnt);break}switch(f){case p.PolyFillType.pftPositive:S=t.WindCnt;break;case p.PolyFillType.pftNegative:S=-t.WindCnt;break;default:S=Math.abs(t.WindCnt);break}if(a&&l)n||o||x!==0&&x!=1||S!==0&&S!=1||r.PolyTyp!=t.PolyTyp&&this.m_ClipType!=p.ClipType.ctXor?this.AddLocalMaxPoly(r,t,e):(this.AddOutPt(r,e),this.AddOutPt(t,e),p.Clipper.SwapSides(r,t),p.Clipper.SwapPolyIndexes(r,t));else if(a)(S===0||S==1)&&(this.AddOutPt(r,e),p.Clipper.SwapSides(r,t),p.Clipper.SwapPolyIndexes(r,t));else if(l)(x===0||x==1)&&(this.AddOutPt(t,e),p.Clipper.SwapSides(r,t),p.Clipper.SwapPolyIndexes(r,t));else if((x===0||x==1)&&(S===0||S==1)&&!n&&!o){var P,g;switch(m){case p.PolyFillType.pftPositive:P=r.WindCnt2;break;case p.PolyFillType.pftNegative:P=-r.WindCnt2;break;default:P=Math.abs(r.WindCnt2);break}switch(y){case p.PolyFillType.pftPositive:g=t.WindCnt2;break;case p.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 p.ClipType.ctIntersection:P>0&&g>0&&this.AddLocalMinPoly(r,t,e);break;case p.ClipType.ctUnion:P<=0&&g<=0&&this.AddLocalMinPoly(r,t,e);break;case p.ClipType.ctDifference:(r.PolyTyp==p.PolyType.ptClip&&P>0&&g>0||r.PolyTyp==p.PolyType.ptSubject&&P<=0&&g<=0)&&this.AddLocalMinPoly(r,t,e);break;case p.ClipType.ctXor:this.AddLocalMinPoly(r,t,e);break}else p.Clipper.SwapSides(r,t)}n!=o&&(n&&r.OutIdx>=0||o&&t.OutIdx>=0)&&(p.Clipper.SwapSides(r,t),p.Clipper.SwapPolyIndexes(r,t)),n&&this.DeleteFromAEL(r),o&&this.DeleteFromAEL(t)};p.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)};p.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)};p.Clipper.prototype.UpdateEdgeIntoAEL=function(r){r.NextInLML===null&&p.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,p.ClipperBase.IsHorizontal(r)||this.InsertScanbeam(r.Top.Y),r};p.Clipper.prototype.ProcessHorizontals=function(r){for(var t=this.m_SortedEdges;t!==null;)this.DeleteFromSEL(t),this.ProcessHorizontal(t,r),t=this.m_SortedEdges};p.Clipper.prototype.GetHorzDirection=function(r,t){r.Bot.X<r.Top.X?(t.Left=r.Bot.X,t.Right=r.Top.X,t.Dir=p.Direction.dLeftToRight):(t.Left=r.Top.X,t.Right=r.Bot.X,t.Dir=p.Direction.dRightToLeft)};p.Clipper.prototype.PrepareHorzJoins=function(r,t){var e=this.m_PolyOuts[r.OutIdx].Pts;r.Side!=p.EdgeSide.esLeft&&(e=e.Prev),t&&(p.IntPoint.op_Equality(e.Pt,r.Top)?this.AddGhostJoin(e,r.Bot):this.AddGhostJoin(e,r.Top))};p.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,l=null;a.NextInLML!==null&&p.ClipperBase.IsHorizontal(a.NextInLML);)a=a.NextInLML;for(a.NextInLML===null&&(l=this.GetMaximaPair(a));;){for(var u=r==a,h=this.GetNextInAEL(r,i);h!==null&&!(h.Curr.X==r.Top.X&&r.NextInLML!==null&&h.Dx<r.NextInLML.Dx);){var f=this.GetNextInAEL(h,i);if(i==p.Direction.dLeftToRight&&h.Curr.X<=o||i==p.Direction.dRightToLeft&&h.Curr.X>=n){if(r.OutIdx>=0&&r.WindDelta!=0&&this.PrepareHorzJoins(r,t),h==l&&u){i==p.Direction.dLeftToRight?this.IntersectEdges(r,h,h.Top,!1):this.IntersectEdges(h,r,h.Top,!1),l.OutIdx>=0&&p.Error("ProcessHorizontal error");return}else if(i==p.Direction.dLeftToRight){var m=new p.IntPoint(h.Curr.X,r.Curr.Y);this.IntersectEdges(r,h,m,!0)}else{var m=new p.IntPoint(h.Curr.X,r.Curr.Y);this.IntersectEdges(h,r,m,!0)}this.SwapPositionsInAEL(r,h)}else if(i==p.Direction.dLeftToRight&&h.Curr.X>=o||i==p.Direction.dRightToLeft&&h.Curr.X<=n)break;h=f}if(r.OutIdx>=0&&r.WindDelta!==0&&this.PrepareHorzJoins(r,t),r.NextInLML!==null&&p.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&&p.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&&p.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 l!==null?l.OutIdx>=0?(i==p.Direction.dLeftToRight?this.IntersectEdges(r,l,r.Top,!1):this.IntersectEdges(l,r,r.Top,!1),l.OutIdx>=0&&p.Error("ProcessHorizontal error")):(this.DeleteFromAEL(r),this.DeleteFromAEL(l)):(r.OutIdx>=0&&this.AddOutPt(r,r.Top),this.DeleteFromAEL(r))};p.Clipper.prototype.GetNextInAEL=function(r,t){return t==p.Direction.dLeftToRight?r.NextInAEL:r.PrevInAEL};p.Clipper.prototype.IsMinima=function(r){return r!==null&&r.Prev.NextInLML!=r&&r.Next.NextInLML!=r};p.Clipper.prototype.IsMaxima=function(r,t){return r!==null&&r.Top.Y==t&&r.NextInLML===null};p.Clipper.prototype.IsIntermediate=function(r,t){return r.Top.Y==t&&r.NextInLML!==null};p.Clipper.prototype.GetMaximaPair=function(r){var t=null;return p.IntPoint.op_Equality(r.Next.Top,r.Top)&&r.Next.NextInLML===null?t=r.Next:p.IntPoint.op_Equality(r.Prev.Top,r.Top)&&r.Prev.NextInLML===null&&(t=r.Prev),t!==null&&(t.OutIdx==-2||t.NextInAEL==t.PrevInAEL&&!p.ClipperBase.IsHorizontal(t))?null:t};p.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,p.Error("ProcessIntersections error")}return this.m_SortedEdges=null,!0};p.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=p.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 p.IntPoint;if(e.Curr.X>n.Curr.X){!this.IntersectPoint(e,n,o)&&e.Curr.X>n.Curr.X+1&&p.Error("Intersection error"),o.Y>r&&(o.Y=r,Math.abs(e.Dx)>Math.abs(n.Dx)?o.X=p.Clipper.TopX(n,r):o.X=p.Clipper.TopX(e,r));var a=new p.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}};p.Clipper.prototype.EdgesAdjacent=function(r){return r.Edge1.NextInSEL==r.Edge2||r.Edge1.PrevInSEL==r.Edge2};p.Clipper.IntersectNodeSort=function(r,t){return t.Pt.Y-r.Pt.Y};p.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};p.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 vP=s(function(r){return r<0?Math.ceil(r-.5):Math.round(r)},"R1"),bP=s(function(r){return r<0?Math.ceil(r-.5):Math.floor(r+.5)},"R2"),CP=s(function(r){return r<0?-Math.round(Math.abs(r)):Math.round(r)},"R3"),xP=s(function(r){return r<0?(r-=.5,r<-2147483648?Math.ceil(r):r|0):(r+=.5,r>2147483647?Math.floor(r):r|0)},"R4");Z.msie?p.Clipper.Round=vP:Z.chromium?p.Clipper.Round=CP:Z.safari?p.Clipper.Round=xP:p.Clipper.Round=bP;p.Clipper.TopX=function(r,t){return t==r.Top.Y?r.Top.X:r.Bot.X+p.Clipper.Round(r.Dx*(t-r.Bot.Y))};p.Clipper.prototype.IntersectPoint=function(r,t,e){e.X=0,e.Y=0;var i,n;if(p.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,p.ClipperBase.IsHorizontal(t)?e.Y=t.Bot.Y:(n=t.Bot.Y-t.Bot.X/t.Dx,e.Y=p.Clipper.Round(e.X/t.Dx+n));else if(t.Delta.X===0)e.X=t.Bot.X,p.ClipperBase.IsHorizontal(r)?e.Y=r.Bot.Y:(i=r.Bot.Y-r.Bot.X/r.Dx,e.Y=p.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=p.Clipper.Round(o),Math.abs(r.Dx)<Math.abs(t.Dx)?e.X=p.Clipper.Round(r.Dx*o+i):e.X=p.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=p.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=p.Clipper.TopX(r,e.Y):e.X=p.Clipper.TopX(t,e.Y)}return!0};p.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||!p.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)&&p.ClipperBase.IsHorizontal(t.NextInLML)?(t=this.UpdateEdgeIntoAEL(t),t.OutIdx>=0&&this.AddOutPt(t,t.Bot),this.AddEdgeToSEL(t)):(t.Curr.X=p.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,l=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&&p.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(l!==null&&l.Curr.X==t.Bot.X&&l.Curr.Y==t.Bot.Y&&o!==null&&l.OutIdx>=0&&l.Curr.Y>l.Top.Y&&p.ClipperBase.SlopesEqual(t,l,this.m_UseFullRange)&&t.WindDelta!==0&&l.WindDelta!==0){var a=this.AddOutPt(l,t.Bot);this.AddJoin(o,a,t.Top)}}t=t.NextInAEL}};p.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)):p.Error("DoMaxima error")};p.Clipper.ReversePaths=function(r){for(var t=0,e=r.length;t<e;t++)r[t].reverse()};p.Clipper.Orientation=function(r){return p.Clipper.Area(r)>=0};p.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};p.Clipper.prototype.BuildResult=function(r){p.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),l=0;l<o;l++)a[l]=n.Pt,n=n.Prev;r.push(a)}}}};p.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 p.PolyNode;r.m_AllPolys.push(o),i.PolyNode=o,o.m_polygon.length=n;for(var a=i.Pts.Prev,l=0;l<n;l++)o.m_polygon[l]=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))}};p.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(p.IntPoint.op_Equality(e.Pt,e.Next.Pt)||p.IntPoint.op_Equality(e.Pt,e.Prev.Pt)||p.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};p.Clipper.prototype.DupOutPt=function(r,t){var e=new p.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};p.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};p.Clipper.prototype.JoinHorz=function(r,t,e,i,n,o){var a=r.Pt.X>t.Pt.X?p.Direction.dRightToLeft:p.Direction.dLeftToRight,l=e.Pt.X>i.Pt.X?p.Direction.dRightToLeft:p.Direction.dLeftToRight;if(a==l)return!1;if(a==p.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),p.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),p.IntPoint.op_Inequality(t.Pt,n)&&(r=t,r.Pt.X=n.X,r.Pt.Y=n.Y,t=this.DupOutPt(r,o))}if(l==p.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),p.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),p.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==p.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};p.Clipper.prototype.JoinPoints=function(r,t,e){var i=r.OutPt1,n=new p.OutPt,o=r.OutPt2,a=new p.OutPt,l=r.OutPt1.Pt.Y==r.OffPt.Y;if(l&&p.IntPoint.op_Equality(r.OffPt,r.OutPt1.Pt)&&p.IntPoint.op_Equality(r.OffPt,r.OutPt2.Pt)){for(n=r.OutPt1.Next;n!=i&&p.IntPoint.op_Equality(n.Pt,r.OffPt);)n=n.Next;var u=n.Pt.Y>r.OffPt.Y;for(a=r.OutPt2.Next;a!=o&&p.IntPoint.op_Equality(a.Pt,r.OffPt);)a=a.Next;var h=a.Pt.Y>r.OffPt.Y;return u==h?!1:u?(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(l){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 p.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;p.IntPoint.op_Equality(n.Pt,i.Pt)&&n!=i;)n=n.Next;var P=n.Pt.Y>i.Pt.Y||!p.ClipperBase.SlopesEqual(i.Pt,n.Pt,r.OffPt,this.m_UseFullRange);if(P){for(n=i.Prev;p.IntPoint.op_Equality(n.Pt,i.Pt)&&n!=i;)n=n.Prev;if(n.Pt.Y>i.Pt.Y||!p.ClipperBase.SlopesEqual(i.Pt,n.Pt,r.OffPt,this.m_UseFullRange))return!1}for(a=o.Next;p.IntPoint.op_Equality(a.Pt,o.Pt)&&a!=o;)a=a.Next;var g=a.Pt.Y>o.Pt.Y||!p.ClipperBase.SlopesEqual(o.Pt,a.Pt,r.OffPt,this.m_UseFullRange);if(g){for(a=o.Prev;p.IntPoint.op_Equality(a.Pt,o.Pt)&&a!=o;)a=a.Prev;if(a.Pt.Y>o.Pt.Y||!p.ClipperBase.SlopesEqual(o.Pt,a.Pt,r.OffPt,this.m_UseFullRange))return!1}return n==i||a==o||n==a||t==e&&P==g?!1:P?(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)}};p.Clipper.GetBounds=function(r){for(var t=0,e=r.length;t<e&&r[t].length==0;)t++;if(t==e)return new p.IntRect(0,0,0,0);var i=new p.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};p.Clipper.prototype.GetBounds2=function(r){var t=r,e=new p.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};p.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 l=(n.X-r.X)*(a.Y-r.Y)-(a.X-r.X)*(n.Y-r.Y);if(l==0)return-1;l>0==a.Y>n.Y&&(e=1-e)}else if(a.X>r.X){var l=(n.X-r.X)*(a.Y-r.Y)-(a.X-r.X)*(n.Y-r.Y);if(l==0)return-1;l>0==a.Y>n.Y&&(e=1-e)}}n=a}return e};p.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,l=t.Next.Pt.Y;if(l==r.Y&&(a==r.X||o==r.Y&&a>r.X==n<r.X))return-1;if(o<r.Y!=l<r.Y){if(n>=r.X)if(a>r.X)e=1-e;else{var u=(n-r.X)*(l-r.Y)-(a-r.X)*(o-r.Y);if(u==0)return-1;u>0==l>o&&(e=1-e)}else if(a>r.X){var u=(n-r.X)*(l-r.Y)-(a-r.X)*(o-r.Y);if(u==0)return-1;u>0==l>o&&(e=1-e)}}if(t=t.Next,i==t)break}return e};p.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};p.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)}};p.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)};p.Clipper.ParseFirstLeft=function(r){for(;r!=null&&r.Pts==null;)r=r.FirstLeft;return r};p.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,l=this.m_PolyOuts.length;a<l-1;a++){var u=this.m_PolyOuts[a];u.Pts==null||p.Clipper.ParseFirstLeft(u.FirstLeft)!=i||u.IsHole==i.IsHole||this.Poly2ContainsPoly1(u.Pts,e.OutPt2)&&(u.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)}}};p.Clipper.prototype.UpdateOutPtIdxs=function(r){var t=r.Pts;do t.Idx=r.Idx,t=t.Prev;while(t!=r.Pts)};p.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(p.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)}};p.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};p.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};Ev&&(p.Clipper.OffsetPaths=function(r,t,e,i,n){var o=new p.Paths,a=new p.ClipperOffset(n,n);return a.AddPaths(r,e,i),a.Execute(o,t),o});p.Clipper.SimplifyPolygon=function(r,t){var e=new Array,i=new p.Clipper(0);return i.StrictlySimple=!0,i.AddPath(r,p.PolyType.ptSubject,!0),i.Execute(p.ClipType.ctUnion,e,t,t),e};p.Clipper.SimplifyPolygons=function(r,t){typeof t>"u"&&(t=p.PolyFillType.pftEvenOdd);var e=new Array,i=new p.Clipper(0);return i.StrictlySimple=!0,i.AddPaths(r,p.PolyType.ptSubject,!0),i.Execute(p.ClipType.ctUnion,e,t,t),e};p.Clipper.DistanceSqrd=function(r,t){var e=r.X-t.X,i=r.Y-t.Y;return e*e+i*i};p.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)};p.Clipper.SlopesNearCollinear=function(r,t,e,i){return p.Clipper.DistanceFromLineSqrd(t,r,e)<i};p.Clipper.PointsAreClose=function(r,t,e){var i=r.X-t.X,n=r.Y-t.Y;return i*i+n*n<=e};p.Clipper.ExcludeOp=function(r){var t=r.Prev;return t.Next=r.Next,r.Next.Prev=t,t.Idx=0,t};p.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 p.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;)p.Clipper.PointsAreClose(a.Pt,a.Prev.Pt,o)?(a=p.Clipper.ExcludeOp(a),e--):p.Clipper.PointsAreClose(a.Prev.Pt,a.Next.Pt,o)?(p.Clipper.ExcludeOp(a.Next),a=p.Clipper.ExcludeOp(a),e-=2):p.Clipper.SlopesNearCollinear(a.Prev.Pt,a.Pt,a.Next.Pt,o)?(a=p.Clipper.ExcludeOp(a),e--):(a.Idx=1,a=a.Next);e<3&&(e=0);for(var l=new Array(e),n=0;n<e;++n)l[n]=new p.IntPoint(a.Pt),a=a.Next;return i=null,l};p.Clipper.CleanPolygons=function(r,t){for(var e=new Array(r.length),i=0,n=r.length;i<n;i++)e[i]=p.Clipper.CleanPolygon(r[i],t);return e};p.Clipper.Minkowski=function(r,t,e,i){var n=i?1:0,o=r.length,a=t.length,l=new Array;if(e)for(var u=0;u<a;u++){for(var h=new Array(o),f=0,m=r.length,y=r[f];f<m;f++,y=r[f])h[f]=new p.IntPoint(t[u].X+y.X,t[u].Y+y.Y);l.push(h)}else for(var u=0;u<a;u++){for(var h=new Array(o),f=0,m=r.length,y=r[f];f<m;f++,y=r[f])h[f]=new p.IntPoint(t[u].X-y.X,t[u].Y-y.Y);l.push(h)}for(var x=new Array,u=0;u<a-1+n;u++)for(var f=0;f<o;f++){var S=new Array;S.push(l[u%a][f%o]),S.push(l[(u+1)%a][f%o]),S.push(l[(u+1)%a][(f+1)%o]),S.push(l[u%a][(f+1)%o]),p.Clipper.Orientation(S)||S.reverse(),x.push(S)}var P=new p.Clipper(0);return P.AddPaths(x,p.PolyType.ptSubject,!0),P.Execute(p.ClipType.ctUnion,l,p.PolyFillType.pftNonZero,p.PolyFillType.pftNonZero),l};p.Clipper.MinkowskiSum=function(){var r=arguments,t=r.length;if(t==3){var e=r[0],i=r[1],n=r[2];return p.Clipper.Minkowski(e,i,!0,n)}else if(t==4){for(var e=r[0],o=r[1],a=r[2],n=r[3],l=new p.Clipper,u,h=0,f=o.length;h<f;++h){var u=p.Clipper.Minkowski(e,o[h],!0,n);l.AddPaths(u,p.PolyType.ptSubject,!0)}n&&l.AddPaths(o,p.PolyType.ptClip,!0);var m=new p.Paths;return l.Execute(p.ClipType.ctUnion,m,a,a),m}};p.Clipper.MinkowskiDiff=function(r,t,e){return p.Clipper.Minkowski(r,t,!1,e)};p.Clipper.PolyTreeToPaths=function(r){var t=new Array;return p.Clipper.AddPolyNodeToPaths(r,p.Clipper.NodeType.ntAny,t),t};p.Clipper.AddPolyNodeToPaths=function(r,t,e){var i=!0;switch(t){case p.Clipper.NodeType.ntOpen:return;case p.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,l=o[n];n<a;n++,l=o[n])p.Clipper.AddPolyNodeToPaths(l,t,e)};p.Clipper.OpenPathsFromPolyTree=function(r){for(var t=new p.Paths,e=0,i=r.ChildCount();e<i;e++)r.Childs()[e].IsOpen&&t.push(r.Childs()[e].m_polygon);return t};p.Clipper.ClosedPathsFromPolyTree=function(r){var t=new p.Paths;return p.Clipper.AddPolyNodeToPaths(r,p.Clipper.NodeType.ntClosed,t),t};ru(p.Clipper,p.ClipperBase);p.Clipper.NodeType={ntAny:0,ntOpen:1,ntClosed:2};p.ClipperOffset=function(r,t){typeof r>"u"&&(r=2),typeof t>"u"&&(t=p.ClipperOffset.def_arc_tolerance),this.m_destPolys=new p.Paths,this.m_srcPoly=new p.Path,this.m_destPoly=new p.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 p.IntPoint,this.m_polyNodes=new p.PolyNode,this.MiterLimit=r,this.ArcTolerance=t,this.m_lowest.X=-1};p.ClipperOffset.two_pi=6.28318530717959;p.ClipperOffset.def_arc_tolerance=.25;p.ClipperOffset.prototype.Clear=function(){p.Clear(this.m_polyNodes.Childs()),this.m_lowest.X=-1};p.ClipperOffset.Round=p.Clipper.Round;p.ClipperOffset.prototype.AddPath=function(r,t,e){var i=r.length-1;if(!(i<0)){var n=new p.PolyNode;if(n.m_jointype=t,n.m_endtype=e,e==p.EndType.etClosedLine||e==p.EndType.etClosedPolygon)for(;i>0&&p.IntPoint.op_Equality(r[0],r[i]);)i--;n.m_polygon.push(r[0]);for(var o=0,a=0,l=1;l<=i;l++)p.IntPoint.op_Inequality(n.m_polygon[o],r[l])&&(o++,n.m_polygon.push(r[l]),(r[l].Y>n.m_polygon[a].Y||r[l].Y==n.m_polygon[a].Y&&r[l].X<n.m_polygon[a].X)&&(a=o));if(!(e==p.EndType.etClosedPolygon&&o<2||e!=p.EndType.etClosedPolygon&&o<0)&&(this.m_polyNodes.AddChild(n),e==p.EndType.etClosedPolygon))if(this.m_lowest.X<0)this.m_lowest=new p.IntPoint(0,a);else{var u=this.m_polyNodes.Childs()[this.m_lowest.X].m_polygon[this.m_lowest.Y];(n.m_polygon[a].Y>u.Y||n.m_polygon[a].Y==u.Y&&n.m_polygon[a].X<u.X)&&(this.m_lowest=new p.IntPoint(this.m_polyNodes.ChildCount()-1,a))}}};p.ClipperOffset.prototype.AddPaths=function(r,t,e){for(var i=0,n=r.length;i<n;i++)this.AddPath(r[i],t,e)};p.ClipperOffset.prototype.FixOrientations=function(){if(this.m_lowest.X>=0&&!p.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==p.EndType.etClosedPolygon||t.m_endtype==p.EndType.etClosedLine&&p.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==p.EndType.etClosedLine&&!p.Clipper.Orientation(t.m_polygon)&&t.m_polygon.reverse()}};p.ClipperOffset.GetUnitNormal=function(r,t){var e=t.X-r.X,i=t.Y-r.Y;if(e==0&&i==0)return new p.DoublePoint(0,0);var n=1/Math.sqrt(e*e+i*i);return e*=n,i*=n,new p.DoublePoint(i,-e)};p.ClipperOffset.prototype.DoOffset=function(r){if(this.m_destPolys=new Array,this.m_delta=r,p.ClipperBase.near_zero(r)){for(var t=0;t<this.m_polyNodes.ChildCount();t++){var e=this.m_polyNodes.Childs()[t];e.m_endtype==p.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=p.ClipperOffset.def_arc_tolerance:this.ArcTolerance>Math.abs(r)*p.ClipperOffset.def_arc_tolerance?i=Math.abs(r)*p.ClipperOffset.def_arc_tolerance:i=this.ArcTolerance;var n=3.14159265358979/Math.acos(1-i/Math.abs(r));this.m_sin=Math.sin(p.ClipperOffset.two_pi/n),this.m_cos=Math.cos(p.ClipperOffset.two_pi/n),this.m_StepsPerRad=n/p.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!=p.EndType.etClosedPolygon))){if(this.m_destPoly=new Array,o==1){if(e.m_jointype==p.JoinType.jtRound)for(var a=1,l=0,u=1;u<=n;u++){this.m_destPoly.push(new p.IntPoint(p.ClipperOffset.Round(this.m_srcPoly[0].X+a*r),p.ClipperOffset.Round(this.m_srcPoly[0].Y+l*r)));var h=a;a=a*this.m_cos-this.m_sin*l,l=h*this.m_sin+l*this.m_cos}else for(var a=-1,l=-1,u=0;u<4;++u)this.m_destPoly.push(new p.IntPoint(p.ClipperOffset.Round(this.m_srcPoly[0].X+a*r),p.ClipperOffset.Round(this.m_srcPoly[0].Y+l*r))),a<0?a=1:l<0?l=1:a=-1;this.m_destPolys.push(this.m_destPoly);continue}this.m_normals.length=0;for(var u=0;u<o-1;u++)this.m_normals.push(p.ClipperOffset.GetUnitNormal(this.m_srcPoly[u],this.m_srcPoly[u+1]));if(e.m_endtype==p.EndType.etClosedLine||e.m_endtype==p.EndType.etClosedPolygon?this.m_normals.push(p.ClipperOffset.GetUnitNormal(this.m_srcPoly[o-1],this.m_srcPoly[0])):this.m_normals.push(new p.DoublePoint(this.m_normals[o-2])),e.m_endtype==p.EndType.etClosedPolygon){for(var f=o-1,u=0;u<o;u++)f=this.OffsetPoint(u,f,e.m_jointype);this.m_destPolys.push(this.m_destPoly)}else if(e.m_endtype==p.EndType.etClosedLine){for(var f=o-1,u=0;u<o;u++)f=this.OffsetPoint(u,f,e.m_jointype);this.m_destPolys.push(this.m_destPoly),this.m_destPoly=new Array;for(var m=this.m_normals[o-1],u=o-1;u>0;u--)this.m_normals[u]=new p.DoublePoint(-this.m_normals[u-1].X,-this.m_normals[u-1].Y);this.m_normals[0]=new p.DoublePoint(-m.X,-m.Y),f=0;for(var u=o-1;u>=0;u--)f=this.OffsetPoint(u,f,e.m_jointype);this.m_destPolys.push(this.m_destPoly)}else{for(var f=0,u=1;u<o-1;++u)f=this.OffsetPoint(u,f,e.m_jointype);var y;if(e.m_endtype==p.EndType.etOpenButt){var u=o-1;y=new p.IntPoint(p.ClipperOffset.Round(this.m_srcPoly[u].X+this.m_normals[u].X*r),p.ClipperOffset.Round(this.m_srcPoly[u].Y+this.m_normals[u].Y*r)),this.m_destPoly.push(y),y=new p.IntPoint(p.ClipperOffset.Round(this.m_srcPoly[u].X-this.m_normals[u].X*r),p.ClipperOffset.Round(this.m_srcPoly[u].Y-this.m_normals[u].Y*r)),this.m_destPoly.push(y)}else{var u=o-1;f=o-2,this.m_sinA=0,this.m_normals[u]=new p.DoublePoint(-this.m_normals[u].X,-this.m_normals[u].Y),e.m_endtype==p.EndType.etOpenSquare?this.DoSquare(u,f):this.DoRound(u,f)}for(var u=o-1;u>0;u--)this.m_normals[u]=new p.DoublePoint(-this.m_normals[u-1].X,-this.m_normals[u-1].Y);this.m_normals[0]=new p.DoublePoint(-this.m_normals[1].X,-this.m_normals[1].Y),f=o-1;for(var u=f-1;u>0;--u)f=this.OffsetPoint(u,f,e.m_jointype);e.m_endtype==p.EndType.etOpenButt?(y=new p.IntPoint(p.ClipperOffset.Round(this.m_srcPoly[0].X-this.m_normals[0].X*r),p.ClipperOffset.Round(this.m_srcPoly[0].Y-this.m_normals[0].Y*r)),this.m_destPoly.push(y),y=new p.IntPoint(p.ClipperOffset.Round(this.m_srcPoly[0].X+this.m_normals[0].X*r),p.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==p.EndType.etOpenSquare?this.DoSquare(0,1):this.DoRound(0,1)),this.m_destPolys.push(this.m_destPoly)}}}};p.ClipperOffset.prototype.Execute=function(){var r=arguments,t=r[0]instanceof p.PolyTree;if(t){var e=r[0],i=r[1];e.Clear(),this.FixOrientations(),this.DoOffset(i);var n=new p.Clipper(0);if(n.AddPaths(this.m_destPolys,p.PolyType.ptSubject,!0),i>0)n.Execute(p.ClipType.ctUnion,e,p.PolyFillType.pftPositive,p.PolyFillType.pftPositive);else{var o=p.Clipper.GetBounds(this.m_destPolys),a=new p.Path;if(a.push(new p.IntPoint(o.left-10,o.bottom+10)),a.push(new p.IntPoint(o.right+10,o.bottom+10)),a.push(new p.IntPoint(o.right+10,o.top-10)),a.push(new p.IntPoint(o.left-10,o.top-10)),n.AddPath(a,p.PolyType.ptSubject,!0),n.ReverseSolution=!0,n.Execute(p.ClipType.ctUnion,e,p.PolyFillType.pftNegative,p.PolyFillType.pftNegative),e.ChildCount()==1&&e.Childs()[0].ChildCount()>0){var l=e.Childs()[0];e.Childs()[0]=l.Childs()[0];for(var u=1;u<l.ChildCount();u++)e.AddChild(l.Childs()[u])}else e.Clear()}}else{var e=r[0],i=r[1];p.Clear(e),this.FixOrientations(),this.DoOffset(i);var n=new p.Clipper(0);if(n.AddPaths(this.m_destPolys,p.PolyType.ptSubject,!0),i>0)n.Execute(p.ClipType.ctUnion,e,p.PolyFillType.pftPositive,p.PolyFillType.pftPositive);else{var o=p.Clipper.GetBounds(this.m_destPolys),a=new p.Path;a.push(new p.IntPoint(o.left-10,o.bottom+10)),a.push(new p.IntPoint(o.right+10,o.bottom+10)),a.push(new p.IntPoint(o.right+10,o.top-10)),a.push(new p.IntPoint(o.left-10,o.top-10)),n.AddPath(a,p.PolyType.ptSubject,!0),n.ReverseSolution=!0,n.Execute(p.ClipType.ctUnion,e,p.PolyFillType.pftNegative,p.PolyFillType.pftNegative),e.length>0&&e.splice(0,1)}}};p.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 p.IntPoint(p.ClipperOffset.Round(this.m_srcPoly[r].X+this.m_normals[t].X*this.m_delta),p.ClipperOffset.Round(this.m_srcPoly[r].Y+this.m_normals[t].Y*this.m_delta))),this.m_destPoly.push(new p.IntPoint(this.m_srcPoly[r])),this.m_destPoly.push(new p.IntPoint(p.ClipperOffset.Round(this.m_srcPoly[r].X+this.m_normals[r].X*this.m_delta),p.ClipperOffset.Round(this.m_srcPoly[r].Y+this.m_normals[r].Y*this.m_delta)));else switch(e){case p.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 p.JoinType.jtSquare:this.DoSquare(r,t);break;case p.JoinType.jtRound:this.DoRound(r,t);break}return t=r,t};p.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 p.IntPoint(p.ClipperOffset.Round(this.m_srcPoly[r].X+this.m_delta*(this.m_normals[t].X-this.m_normals[t].Y*e)),p.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 p.IntPoint(p.ClipperOffset.Round(this.m_srcPoly[r].X+this.m_delta*(this.m_normals[r].X+this.m_normals[r].Y*e)),p.ClipperOffset.Round(this.m_srcPoly[r].Y+this.m_delta*(this.m_normals[r].Y-this.m_normals[r].X*e))))};p.ClipperOffset.prototype.DoMiter=function(r,t,e){var i=this.m_delta/e;this.m_destPoly.push(new p.IntPoint(p.ClipperOffset.Round(this.m_srcPoly[r].X+(this.m_normals[t].X+this.m_normals[r].X)*i),p.ClipperOffset.Round(this.m_srcPoly[r].Y+(this.m_normals[t].Y+this.m_normals[r].Y)*i)))};p.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=p.Cast_Int32(p.ClipperOffset.Round(this.m_StepsPerRad*Math.abs(e))),n=this.m_normals[t].X,o=this.m_normals[t].Y,a,l=0;l<i;++l)this.m_destPoly.push(new p.IntPoint(p.ClipperOffset.Round(this.m_srcPoly[r].X+n*this.m_delta),p.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 p.IntPoint(p.ClipperOffset.Round(this.m_srcPoly[r].X+this.m_normals[r].X*this.m_delta),p.ClipperOffset.Round(this.m_srcPoly[r].Y+this.m_normals[r].Y*this.m_delta)))};p.Error=function(r){try{throw new Error(r)}catch(t){alert(t.message)}};p.JS={};p.JS.AreaOfPolygon=function(r,t){return t||(t=1),p.Clipper.Area(r)/(t*t)};p.JS.AreaOfPolygons=function(r,t){t||(t=1);for(var e=0,i=0;i<r.length;i++)e+=p.Clipper.Area(r[i]);return e/(t*t)};p.JS.BoundsOfPath=function(r,t){return p.JS.BoundsOfPaths([r],t)};p.JS.BoundsOfPaths=function(r,t){t||(t=1);var e=p.Clipper.GetBounds(r);return e.left/=t,e.bottom/=t,e.right/=t,e.top/=t,e};p.JS.Clean=function(i,t){if(!(i instanceof Array))return[];var e=i[0]instanceof Array,i=p.JS.Clone(i);if(typeof t!="number"||t===null)return p.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,l,u,h,f,m,y=[],x=0;x<n;x++)if(a=i[x],o=a.length,o!==0){if(o<3){l=a,y.push(l);continue}for(l=a,u=t*t,h=a[0],f=1,m=1;m<o;m++)(a[m].X-h.X)*(a[m].X-h.X)+(a[m].Y-h.Y)*(a[m].Y-h.Y)<=u||(l[f]=a[m],h=a[m],f++);h=a[f-1],(a[0].X-h.X)*(a[0].X-h.X)+(a[0].Y-h.Y)*(a[0].Y-h.Y)<=u&&f--,f<o&&l.splice(f,o-f),l.length&&y.push(l)}return!e&&y.length?y=y[0]:!e&&y.length===0?y=[]:e&&y.length===0&&(y=[[]]),y};p.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,l=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};l[n]=a}return t||(l=l[0]),l};p.JS.Lighten=function(r,t){if(!(r instanceof Array))return[];if(typeof t!="number"||t===null)return p.Error("Tolerance is not a number in Lighten()."),p.JS.Clone(r);if(r.length===0||r.length==1&&r[0].length===0||t<0)return p.JS.Clone(r);r[0]instanceof Array||(r=[r]);var e,i,n,o,a,l,u,h,f,m,y,x,S,P,g,C,w,I=r.length,M=t*t,_=[];for(e=0;e<I;e++)if(n=r[e],l=n.length,l!=0){for(o=0;o<1e6;o++){for(a=[],l=n.length,n[l-1].X!=n[0].X||n[l-1].Y!=n[0].Y?(x=1,n.push({X:n[0].X,Y:n[0].Y}),l=n.length):x=0,y=[],i=0;i<l-2;i++)u=n[i],f=n[i+1],h=n[i+2],C=u.X,w=u.Y,S=h.X-C,P=h.Y-w,(S!==0||P!==0)&&(g=((f.X-C)*S+(f.Y-w)*P)/(S*S+P*P),g>1?(C=h.X,w=h.Y):g>0&&(C+=S*g,w+=P*g)),S=f.X-C,P=f.Y-w,m=S*S+P*P,m<=M&&(y[i+1]=1,i++);for(a.push({X:n[0].X,Y:n[0].Y}),i=1;i<l-1;i++)y[i]||a.push({X:n[i].X,Y:n[i].Y});if(a.push({X:n[l-1].X,Y:n[l-1].Y}),x&&n.pop(),y.length)n=a;else break}l=a.length,a[l-1].X==a[0].X&&a[l-1].Y==a[0].Y&&a.pop(),a.length>2&&_.push(a)}return!r[0]instanceof Array&&(_=_[0]),typeof _>"u"&&(_=[[]]),_};p.JS.PerimeterOfPath=function(r,t,e){if(typeof r>"u")return 0;var i=Math.sqrt,n=0,o,a,l=0,u=0,h=0,f=0,m=r.length;if(m<2)return 0;for(t&&(r[m]=r[0],m++);--m;)o=r[m],l=o.X,u=o.Y,a=r[m-1],h=a.X,f=a.Y,n+=i((l-h)*(l-h)+(u-f)*(u-f));return t&&r.pop(),n/e};p.JS.PerimeterOfPaths=function(r,t,e){e||(e=1);for(var i=0,n=0;n<r.length;n++)i+=p.JS.PerimeterOfPath(r[n],t,e);return i};p.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};p.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};p.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)};p.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)};p.ExPolygons=function(){return[]};p.ExPolygon=function(){this.outer=null,this.holes=null};p.JS.AddOuterPolyNodeToExPolygons=function(r,t){var e=new p.ExPolygon;e.outer=r.Contour();var i=r.Childs(),n=i.length;e.holes=new Array(n);var o,a,l,u,h,f;for(l=0;l<n;l++)for(o=i[l],e.holes[l]=o.Contour(),u=0,h=o.Childs(),f=h.length;u<f;u++)a=h[u],p.JS.AddOuterPolyNodeToExPolygons(a,t);t.push(e)};p.JS.ExPolygonsToPaths=function(r){var t,e,i,n,o=new p.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};p.JS.PolyTreeToExPolygons=function(r){var t=new p.ExPolygons,e,i,n,o;for(i=0,n=r.Childs(),o=n.length;i<o;i++)e=n[i],p.JS.AddOuterPolyNodeToExPolygons(e,t);return t};ba.exports=p});var Un=N((Od,Dd)=>{d();var Ad=s(function(){this._tweens={},this._tweensAddedDuringUpdate={}},"_Group");Ad.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:ot.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 ot=new Ad;ot.Group=Ad;ot._nextId=0;ot.nextId=function(){return ot._nextId++};typeof self>"u"&&typeof b<"u"&&b.hrtime?ot.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?ot.now=self.performance.now.bind(self.performance):Date.now!==void 0?ot.now=Date.now:ot.now=function(){return new Date().getTime()};ot.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=ot.Easing.Linear.None,this._interpolationFunction=ot.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||ot,this._id=ot.nextId()};ot.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:s(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"?ot.now()+parseFloat(r):r:ot.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:s(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 l=0,u=this._chainedTweens.length;l<u;l++)this._chainedTweens[l].start(this._startTime+this._duration);return!1}return!0}};ot.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-ot.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?ot.Easing.Bounce.In(r*2)*.5:ot.Easing.Bounce.Out(r*2-1)*.5+.5}}};ot.Interpolation={Linear:function(r,t){var e=r.length-1,i=e*t,n=Math.floor(i),o=ot.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=ot.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=ot.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=ot.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,l=n*n,u=n*l;return(2*t-2*e+o+a)*u+(-3*t+3*e-2*o-a)*l+o*n+t}}};(function(r){typeof define=="function"&&define.amd?define([],function(){return ot}):typeof Dd<"u"&&typeof Od=="object"?Dd.exports=ot:r!==void 0&&(r.TWEEN=ot)})(Od)});d();d();var ec=new WeakMap,Ft,ic=class ic{constructor(t){T(this,Ft,void 0);E(this,Ft,t),ec.set(this,t)}get mapName(){return c(this,Ft).mapName}get mapCenter(){return c(this,Ft).mapCenter}get organizationId(){return c(this,Ft).organizationId}get outdoorViewToken(){return c(this,Ft).outdoorViewToken}getByType(t){switch(t){case"space":return c(this,Ft).spaces;case"door":return c(this,Ft).doors;case"floor":return c(this,Ft).floors;case"connection":return c(this,Ft).connections;case"object":return c(this,Ft).objects;case"point-of-interest":return c(this,Ft).pointsOfInterest;case"annotation":return c(this,Ft).annotations;default:return[]}}getById(t,e){return c(this,Ft).getById(t,e)}};Ft=new WeakMap,s(ic,"MapData");var tc=ic,rc=tc;d();d();d();var Zb={logState: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)}},H=Zb;d();var Im=["connection.json","manifest.geojson","map.geojson","node.geojson","styles.json","mapstack.geojson"];var Em=globalThis.fetch,_m,GM=(_m=b==null?void 0:b.env)==null?void 0:_m.npm_package_version;function nc(){if(Em==null)throw new Error("fetch is not available in your environment. Pass your own function into `setFetchFn` (node-fetch, etc)");return Em}s(nc,"isomorphicFetch");async function oc(r,t){return new Promise(async(e,i)=>{try{let{url:n}=await zb(r,t),o=await nc()(n).then(l=>l.arrayBuffer()),a=new Uint8Array(o);e(a)}catch(n){i(n)}})}s(oc,"downloadMVF");function Lm(r){return r.endsWith("/")?r:`${r}/`}s(Lm,"normalizeUrl");async function zb(r,t){let e=`${r.bundleBaseUri?Lm(r.bundleBaseUri):"https://app.mappedin.com/"}api/venue/${r.mapId}${r.viewId?`-${r.viewId}`:""}/mvf`,i=await nc()(e,{headers:{Authorization:`Bearer ${t}`}});if(!i.ok)throw new Error(`${i.status} ${i.statusText}`);return i.json()}s(zb,"getMakerBundleURL");async function Ss(r){let t=`${r.authBaseUri?Lm(r.authBaseUri):"https://auth-maker.mappedin.com/"}api-key/token`,e=await nc()(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:r.key,secret:r.secret})});if(!e.ok)throw new Error(`${e.status} ${e.statusText}`);return e.json()}s(Ss,"getAccessToken");function ac(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"])),"styles.json":JSON.parse(e(r["styles.json"])),"map.geojson":JSON.parse(e(r["map.geojson"])),"mapstack.geojson":JSON.parse(e(r["mapstack.geojson"])),"node.geojson":JSON.parse(e(r["node.geojson"])),obstruction:{},space:{},entrance:{},annotation:{}};if(r.annotation!=null){let l=Object.keys(r.annotation);for(let u of l){let h=u.replace(/\.json|\.geojson/g,"");i.annotation[h]=JSON.parse(e(r.annotation[u]))}}let n=Object.keys(r.space);for(let l of n){let u=l.replace(/\.json|\.geojson/g,"");i.space[u]=JSON.parse(e(r.space[l]))}let o=Object.keys(r.obstruction);for(let l of o){let u=l.replace(/\.json|\.geojson/g,"");i.obstruction[u]=JSON.parse(e(r.obstruction[l]))}let a=Object.keys(r.entrance);for(let l of a){let u=l.replace(/\.json|\.geojson/g,"");i.entrance[u]=JSON.parse(e(r.entrance[l]))}return i}catch(i){throw H.error(i),new Error("MVF parsing failed! Probably encountered a bad file.")}}s(ac,"parseMVF");function qb(r){if(r==null||typeof r!="object")return!1;for(let t of Im)if(r[t][Symbol.toStringTag]!=="Uint8Array")return!1;return!0}s(qb,"validateStaticMVFFiles");async function sc(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-VZNENOMI.js")).unzipSync(r);if(!qb(n))throw new Error("MVF is missing some expect static files. Unzipping failed.");let o={"connection.json":n["connection.json"],"manifest.geojson":n["manifest.geojson"],"node.geojson":n["node.geojson"],"map.geojson":n["map.geojson"],"mapstack.geojson":n["mapstack.geojson"],"styles.json":n["styles.json"],space:{},obstruction:{},entrance:{}},a=Object.keys(n);for(let l of a){if(n[l].length===0)continue;let u=l.split("/");if(u.length<0)throw new Error("Encounted a file with no name! Unzipping failed.");if(u.length>2)throw new Error("Encountered unexpected nesting in MVF! Unzipping failed.");if(u.length!==1)if(u[0]==="image"){H.warn("MVF unzipping encountered an image. Ignoring as this case has not been implemented.");continue}else o[u[0]]==null&&(o[u[0]]={}),o[u[0]][u[1]]=n[l]}t(o)}catch(i){e(i)}})}s(sc,"unzipMVF");d();d();d();d();var Wt=63710088e-1,Om={centimeters:Wt*100,centimetres:Wt*100,degrees:Wt/111325,feet:Wt*3.28084,inches:Wt*39.37,kilometers:Wt/1e3,kilometres:Wt/1e3,meters:Wt,metres:Wt,miles:Wt/1609.344,millimeters:Wt*1e3,millimetres:Wt*1e3,nauticalmiles:Wt/1852,radians:1,yards:Wt*1.0936},YM={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/Wt,yards:1.0936133};function Or(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}s(Or,"feature");function Pe(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(!lc(r[0])||!lc(r[1]))throw new Error("coordinates must contain numbers");var i={type:"Point",coordinates:r};return Or(i,t,e)}s(Pe,"point");function nr(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 Or(i,t,e)}s(nr,"lineString");function fo(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}s(fo,"featureCollection");function Dm(r,t){t===void 0&&(t="kilometers");var e=Om[t];if(!e)throw new Error(t+" units is invalid");return r*e}s(Dm,"radiansToLength");function Am(r,t){t===void 0&&(t="kilometers");var e=Om[t];if(!e)throw new Error(t+" units is invalid");return r/e}s(Am,"lengthToRadians");function mo(r){var t=r%(2*Math.PI);return t*180/Math.PI}s(mo,"radiansToDegrees");function Qt(r){var t=r%360;return t*Math.PI/180}s(Qt,"degreesToRadians");function lc(r){return!isNaN(r)&&r!==null&&!Array.isArray(r)}s(lc,"isNumber");function He(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")}s(He,"getCoord");function ae(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")}s(ae,"getCoords");function Nm(r,t){return r.type==="FeatureCollection"?"FeatureCollection":r.type==="GeometryCollection"?"GeometryCollection":r.type==="Feature"&&r.geometry!==null?r.geometry.type:r.type}s(Nm,"getType");function $b(r,t,e){e===void 0&&(e={});for(var i=He(r),n=ae(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")),Jb(n[o],n[o+1],i,a,typeof e.epsilon>"u"?null:e.epsilon))return!0}return!1}s($b,"booleanPointOnLine");function Jb(r,t,e,i,n){var o=e[0],a=e[1],l=r[0],u=r[1],h=t[0],f=t[1],m=e[0]-l,y=e[1]-u,x=h-l,S=f-u,P=m*S-y*x;if(n!==null){if(Math.abs(P)>n)return!1}else if(P!==0)return!1;if(i){if(i==="start")return Math.abs(x)>=Math.abs(S)?x>0?l<o&&o<=h:h<=o&&o<l:S>0?u<a&&a<=f:f<=a&&a<u;if(i==="end")return Math.abs(x)>=Math.abs(S)?x>0?l<=o&&o<h:h<o&&o<=l:S>0?u<=a&&a<f:f<a&&a<=u;if(i==="both")return Math.abs(x)>=Math.abs(S)?x>0?l<o&&o<h:h<o&&o<l:S>0?u<a&&a<f:f<a&&a<u}else return Math.abs(x)>=Math.abs(S)?x>0?l<=o&&o<=h:h<=o&&o<=l:S>0?u<=a&&a<=f:f<=a&&a<=u;return!1}s(Jb,"isPointOnLineSegment");var Rm=$b;d();d();d();function Ps(r,t,e){if(r!==null)for(var i,n,o,a,l,u,h,f=0,m=0,y,x=r.type,S=x==="FeatureCollection",P=x==="Feature",g=S?r.features.length:1,C=0;C<g;C++){h=S?r.features[C].geometry:P?r.geometry:r,y=h?h.type==="GeometryCollection":!1,l=y?h.geometries.length:1;for(var w=0;w<l;w++){var I=0,M=0;if(a=y?h.geometries[w]:h,a!==null){u=a.coordinates;var _=a.type;switch(f=e&&(_==="Polygon"||_==="MultiPolygon")?1:0,_){case null:break;case"Point":if(t(u,m,C,I,M)===!1)return!1;m++,I++;break;case"LineString":case"MultiPoint":for(i=0;i<u.length;i++){if(t(u[i],m,C,I,M)===!1)return!1;m++,_==="MultiPoint"&&I++}_==="LineString"&&I++;break;case"Polygon":case"MultiLineString":for(i=0;i<u.length;i++){for(n=0;n<u[i].length-f;n++){if(t(u[i][n],m,C,I,M)===!1)return!1;m++}_==="MultiLineString"&&I++,_==="Polygon"&&M++}_==="Polygon"&&I++;break;case"MultiPolygon":for(i=0;i<u.length;i++){for(M=0,n=0;n<u[i].length;n++){for(o=0;o<u[i][n].length-f;o++){if(t(u[i][n][o],m,C,I,M)===!1)return!1;m++}M++}I++}break;case"GeometryCollection":for(i=0;i<a.geometries.length;i++)if(Ps(a.geometries[i],t,e)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}s(Ps,"coordEach");function uc(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++);}s(uc,"featureEach");function Kb(r,t){var e,i,n,o,a,l,u,h,f,m,y=0,x=r.type==="FeatureCollection",S=r.type==="Feature",P=x?r.features.length:1;for(e=0;e<P;e++){for(l=x?r.features[e].geometry:S?r.geometry:r,h=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,u=l?l.type==="GeometryCollection":!1,a=u?l.geometries.length:1,n=0;n<a;n++){if(o=u?l.geometries[n]:l,o===null){if(t(null,y,h,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,h,f,m)===!1)return!1;break}case"GeometryCollection":{for(i=0;i<o.geometries.length;i++)if(t(o.geometries[i],y,h,f,m)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}y++}}s(Kb,"geomEach");function yo(r,t){Kb(r,function(e,i,n,o,a){var l=e===null?null:e.type;switch(l){case null:case"Point":case"LineString":case"Polygon":return t(Or(e,n,{bbox:o,id:a}),i,0)===!1?!1:void 0}var u;switch(l){case"MultiPoint":u="Point";break;case"MultiLineString":u="LineString";break;case"MultiPolygon":u="Polygon";break}for(var h=0;h<e.coordinates.length;h++){var f=e.coordinates[h],m={type:u,coordinates:f};if(t(Or(m,n),i,h)===!1)return!1}})}s(yo,"flattenEach");function Qb(r,t){yo(r,function(e,i,n){var o=0;if(e.geometry){var a=e.geometry.type;if(!(a==="Point"||a==="MultiPoint")){var l,u=0,h=0,f=0;if(Ps(e,function(m,y,x,S,P){if(l===void 0||i>u||S>h||P>f){l=m,u=i,h=S,f=P,o=0;return}var g=nr([l,m],e.properties);if(t(g,i,n,P,o)===!1)return!1;o++,l=m})===!1)return!1}}})}s(Qb,"segmentEach");function km(r,t,e){var i=e,n=!1;return Qb(r,function(o,a,l,u,h){n===!1&&e===void 0?i=o:i=t(i,o,a,l,u,h),n=!0}),i}s(km,"segmentReduce");function cc(r){var t=[1/0,1/0,-1/0,-1/0];return Ps(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}s(cc,"bbox");cc.default=cc;var Fm=cc;function t4(r,t){t===void 0&&(t={});var e=Fm(r),i=(e[0]+e[2])/2,n=(e[1]+e[3])/2;return Pe([i,n],t.properties,t)}s(t4,"center");var Bm=t4;d();d();function e4(r,t,e){e===void 0&&(e={});var i=He(r),n=He(t),o=Qt(n[1]-i[1]),a=Qt(n[0]-i[0]),l=Qt(i[1]),u=Qt(n[1]),h=Math.pow(Math.sin(o/2),2)+Math.pow(Math.sin(a/2),2)*Math.cos(l)*Math.cos(u);return Dm(2*Math.atan2(Math.sqrt(h),Math.sqrt(1-h)),e.units)}s(e4,"distance");var Dr=e4;function Ms(r,t){return t===void 0&&(t={}),km(r,function(e,i){var n=i.geometry.coordinates;return e+Dr(n[0],n[1],t)},0)}s(Ms,"length");d();d();d();function Ts(r,t,e){if(e===void 0&&(e={}),e.final===!0)return r4(r,t);var i=He(r),n=He(t),o=Qt(i[0]),a=Qt(n[0]),l=Qt(i[1]),u=Qt(n[1]),h=Math.sin(a-o)*Math.cos(u),f=Math.cos(l)*Math.sin(u)-Math.sin(l)*Math.cos(u)*Math.cos(a-o);return mo(Math.atan2(h,f))}s(Ts,"bearing");function r4(r,t){var e=Ts(t,r);return e=(e+180)%360,e}s(r4,"calculateFinalBearing");d();function ui(r,t,e,i){i===void 0&&(i={});var n=He(r),o=Qt(n[0]),a=Qt(n[1]),l=Qt(e),u=Am(t,i.units),h=Math.asin(Math.sin(a)*Math.cos(u)+Math.cos(a)*Math.sin(u)*Math.cos(l)),f=o+Math.atan2(Math.sin(l)*Math.sin(u)*Math.cos(a),Math.cos(u)-Math.sin(a)*Math.sin(h)),m=mo(f),y=mo(h);return Pe([m,y],i.properties)}s(ui,"destination");d();d();function i4(r){if(!r)throw new Error("geojson is required");var t=[];return yo(r,function(e){n4(e,t)}),fo(t)}s(i4,"lineSegment");function n4(r,t){var e=[],i=r.geometry;if(i!==null){switch(i.type){case"Polygon":e=ae(i);break;case"LineString":e=[ae(i)]}e.forEach(function(n){var o=o4(n,r.properties);o.forEach(function(a){a.id=t.length,t.push(a)})})}}s(n4,"lineSegmentFeature");function o4(r,t){var e=[];return r.reduce(function(i,n){var o=nr([i,n],t);return o.bbox=a4(i,n),e.push(o),n}),e}s(o4,"createSegments");function a4(r,t){var e=r[0],i=r[1],n=t[0],o=t[1],a=e<n?e:n,l=i<o?i:o,u=e>n?e:n,h=i>o?i:o;return[a,l,u,h]}s(a4,"bbox");var pc=i4;var Z2=wr(W2(),1);function _8(r,t){var e={},i=[];if(r.type==="LineString"&&(r=Or(r)),t.type==="LineString"&&(t=Or(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=U2(r,t);return n&&i.push(n),fo(i)}var o=(0,Z2.default)();return o.load(pc(t)),uc(pc(r),function(a){uc(o.search(a),function(l){var u=U2(a,l);if(u){var h=ae(u).join(",");e[h]||(e[h]=!0,i.push(u))}})}),fo(i)}s(_8,"lineIntersect");function U2(r,t){var e=ae(r),i=ae(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],l=e[1][1],u=i[0][0],h=i[0][1],f=i[1][0],m=i[1][1],y=(m-h)*(a-n)-(f-u)*(l-o),x=(f-u)*(o-h)-(m-h)*(n-u),S=(a-n)*(o-h)-(l-o)*(n-u);if(y===0)return null;var P=x/y,g=S/y;if(P>=0&&P<=1&&g>=0&&g<=1){var C=n+P*(a-n),w=o+P*(l-o);return Pe([C,w])}return null}s(U2,"intersects");var z2=_8;function L8(r,t,e){e===void 0&&(e={});var i=Pe([1/0,1/0],{dist:1/0}),n=0;return yo(r,function(o){for(var a=ae(o),l=0;l<a.length-1;l++){var u=Pe(a[l]);u.properties.dist=Dr(t,u,e);var h=Pe(a[l+1]);h.properties.dist=Dr(t,h,e);var f=Dr(u,h,e),m=Math.max(u.properties.dist,h.properties.dist),y=Ts(u,h),x=ui(t,m,y+90,e),S=ui(t,m,y-90,e),P=z2(nr([x.geometry.coordinates,S.geometry.coordinates]),nr([u.geometry.coordinates,h.geometry.coordinates])),g=null;P.features.length>0&&(g=P.features[0],g.properties.dist=Dr(t,g,e),g.properties.location=n+Dr(u,g,e)),u.properties.dist<i.properties.dist&&(i=u,i.properties.index=l,i.properties.location=n),h.properties.dist<i.properties.dist&&(i=h,i.properties.index=l+1,i.properties.location=n+f),g&&g.properties.dist<i.properties.dist&&(i=g,i.properties.index=l),n+=f}}),i}s(L8,"nearestPointOnLine");var No=L8;function O8(r,t,e){var i=ae(e);if(Nm(e)!=="LineString")throw new Error("line must be a LineString");var n=No(e,r),o=No(e,t),a;n.properties.index<=o.properties.index?a=[n,o]:a=[o,n];for(var l=[a[0].geometry.coordinates],u=a[0].properties.index+1;u<a[1].properties.index+1;u++)l.push(i[u]);return l.push(a[1].geometry.coordinates),nr(l,e.properties)}s(O8,"lineSlice");var Kp=O8;var D8=1e-7;function Qp(r){return{type:"Point",coordinates:r}}s(Qp,"point");function A8(r,t){let{coordinates:e}=t.geometry,{coordinates:i}=r.geometry,n=e.map(o=>No(r,Qp(o)));return i.reduce((o,a)=>{let l=Kp(Qp(a),n[0],r),u=Kp(Qp(a),n[1],r),h=Ms(l)<Ms(u)?l:u;return h.properties={...r.properties,entrances:[]},o.concat([h])},[])}s(A8,"splitObstructionByEntrance");function th(r,t){return t.reduce((e,i)=>{let n={epsilon:D8},o=e.findIndex(l=>Rm(Bm(i),l,n)),a=e[o];if(a){let[l,u]=A8(a,i);e.splice(o,1,l,u)}return e},[r])}s(th,"splitObstructionByAllEntrances");d();d();d();d();var eh=[0,4,6,8,10],vt=s(()=>{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],eh.map((i,n)=>e.slice(i,n===eh.length-1?void 0:eh[n+1]).join("")).join("-")},"randomId");var vn=class vn{__type=vn.__type;id=vt();latitude;longitude;floorId;static is(t){return t.__type===vn.__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(){}};s(vn,"Coordinate"),v(vn,"__type","coordinate");var rh=vn,$=rh;d();d();d();d();var ih=class ih{id;constructor(t){this.id=t}};s(ih,"BaseMetaData");var di=ih;var ko,bn,Ro=class Ro extends di{constructor(e){super(String(vt()));T(this,ko,{});T(this,bn,void 0);E(this,bn,e.mvfData)}static is(e){return e.__type===Ro.__type}get url(){return c(this,bn).url}get name(){return c(this,bn).displayName}toJSON(){return{id:this.id,url:this.url,name:this.name}}destroy(){for(let e of globalThis.Object.keys(c(this,ko)))delete c(this,ko)[e]}};ko=new WeakMap,bn=new WeakMap,s(Ro,"Hyperlink"),v(Ro,"__type","hyperlink");var nh=Ro,Sl=nh;var oh=class oh{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 Sl({mvfData:o})))}links=[]};s(oh,"BaseMapData");var It=oh;var fi,lr,mi,Gr,Cn=class Cn extends It{constructor(e,i){super(i.mvfData.properties.id,i.mvfData.properties.details);v(this,"__type",Cn.__type);T(this,fi,void 0);T(this,lr,void 0);T(this,mi,void 0);T(this,Gr,void 0);E(this,lr,{}),E(this,Gr,i.mvfData),E(this,fi,e),E(this,mi,i.floorId)}static is(e){return e.__type===Cn.__type}get name(){var e,i;return(i=(e=c(this,Gr).properties.details)==null?void 0:e.name)!=null?i:""}get description(){var e,i;return(i=(e=c(this,Gr).properties.details)==null?void 0:e.description)!=null?i:""}get images(){var e,i;return(i=(e=c(this,Gr).properties.details)==null?void 0:e.images)!=null?i:[]}get floor(){let e=c(this,fi).getById("floor",c(this,mi));if(e==null)throw new Error(`Floor ${c(this,mi)} not found!`);return e}get center(){if(c(this,lr).center==null){let[[e,i],[n,o]]=c(this,Gr).geometry.coordinates,a=(e+n)/2,l=(i+o)/2;c(this,lr).center=new $(l,a,c(this,mi))}return c(this,lr).center}get isExterior(){var n;let e=c(this,fi).obstructionIdByEntranceId[this.id],i=c(this,fi).getMVFFeatureById("obstruction",e);return(n=i==null?void 0:i.properties.footprintComponent)!=null?n:!1}toJSON(){return{id:this.id,name:this.name,floor:this.floor.id,center:this.center.toJSON()}}destroy(){for(let e of Object.keys(c(this,lr)))delete c(this,lr)[e]}};fi=new WeakMap,lr=new WeakMap,mi=new WeakMap,Gr=new WeakMap,s(Cn,"Door"),v(Cn,"__type","door");var ah=Cn,Vr=ah;d();var Fo,yi,Hr,ur,xn=class xn extends It{constructor(e,i){super(i.mvfData.properties.id,i.mvfData.properties.details);v(this,"__type",xn.__type);T(this,Fo,void 0);T(this,yi,void 0);T(this,Hr,{});T(this,ur,void 0);E(this,Fo,e),E(this,yi,i.floorId),E(this,ur,i.mvfData)}static is(e){return e.__type===xn.__type}get name(){var i,n;let{properties:e}=c(this,ur);return(n=(i=e.details)==null?void 0:i.name)!=null?n:e.externalId}get type(){return R8(c(this,ur).properties.kind)}get description(){var e,i;return(i=(e=c(this,ur).properties.details)==null?void 0:e.description)!=null?i:""}get images(){var e,i;return(i=(e=c(this,ur).properties.details)==null?void 0:e.images)!=null?i:[]}get floor(){let e=c(this,Fo).getById("floor",c(this,yi));if(e==null)throw new Error(`Floor ${c(this,yi)} not found!`);return e}get center(){var e;if(c(this,Hr).center==null){let[i,n]=(e=c(this,ur).properties.center)!=null?e:[0,0];c(this,Hr).center=new $(n,i,c(this,yi))}return c(this,Hr).center}toJSON(){return{id:this.id,name:this.name,type:this.type,floor:this.floor.id,center:this.center.toJSON()}}destroy(){for(let e of Object.keys(c(this,Hr)))delete c(this,Hr)[e]}};Fo=new WeakMap,yi=new WeakMap,Hr=new WeakMap,ur=new WeakMap,s(xn,"Space"),v(xn,"__type","space");var sh=xn,N8=["room","hallway","exterior","void","connection.stairs","connection.elevator","poi"];function R8(r){if(r==null||r==="default")return"room";let t=r.toLowerCase();return N8.includes(t)?t:"room"}s(R8,"validateSpaceType");var we=sh;d();var We,dt,Pn,Sn=class Sn extends It{constructor(e,i){super(i.mvfData.id);v(this,"__type",Sn.__type);T(this,We,void 0);T(this,dt,{});T(this,Pn,void 0);E(this,We,e),E(this,Pn,i.mvfData)}static is(e){return e.__type===Sn.__type}get name(){return c(this,Pn).externalId}get elevation(){return c(this,Pn).elevation}get spaces(){if(c(this,dt).spaces==null){let e=c(this,We).spaces.filter(i=>i.floor.id===this.id);c(this,dt).spaces=e}return c(this,dt).spaces}get objects(){if(c(this,dt).objects==null){let e=c(this,We).objects.filter(i=>i.floor.id===this.id);c(this,dt).objects=e}return c(this,dt).objects}get connections(){if(c(this,dt).connections==null){let e=c(this,We).connections.filter(i=>i.floors.includes(this));c(this,dt).connections=e}return c(this,dt).connections}get doors(){if(c(this,dt).doors==null){let e=c(this,We).doors.filter(i=>i.floor.id===this.id);c(this,dt).doors=e}return c(this,dt).doors}get annotations(){if(c(this,dt).annotations==null){let e=c(this,We).annotations.filter(i=>i.floor.id===this.id);c(this,dt).annotations=e}return c(this,dt).annotations}get pois(){if(c(this,dt).pois==null){let e=c(this,We).pointsOfInterest.filter(i=>i.floor.id===this.id);c(this,dt).pois=e}return c(this,dt).pois}toJSON(){return{id:this.id,name:this.name,elevation:this.elevation,spaces:this.spaces.map(e=>e.id),objects:this.objects.map(e=>e.id),connections:this.connections.map(e=>e.id),doors:this.doors.map(e=>e.id),annotations:this.annotations.map(e=>e.id),pois:this.pois.map(e=>e.id)}}destroy(){for(let e of globalThis.Object.keys(c(this,dt)))delete c(this,dt)[e]}};We=new WeakMap,dt=new WeakMap,Pn=new WeakMap,s(Sn,"Floor"),v(Sn,"__type","floor");var lh=Sn,Pl=lh;d();d();d();var uh=s(r=>r!=null,"notNull");d();function Xr(r){let t;if(we.is(r)||Vr.is(r)||Ie.is(r))t=r.center;else if(Yr.is(r)||Mn.is(r))t=r.coordinate;else if($.is(r))t=r;else return;return t}s(Xr,"getCoordinateFromStuffs");var Bo,cr,pr,Tn=class Tn extends It{constructor(e,i){let n=Object.values(i.mvfDataByFloorId)[0];super(n.properties.id,n.properties.details);v(this,"__type",Tn.__type);T(this,Bo,void 0);T(this,cr,void 0);T(this,pr,void 0);E(this,cr,{}),E(this,Bo,e),E(this,pr,i.mvfDataByFloorId)}static is(e){return e.__type===Tn.__type}get name(){var e,i;return(i=(e=Object.values(c(this,pr))[0].properties.details)==null?void 0:e.name)!=null?i:""}get description(){var e,i;return(i=(e=Object.values(c(this,pr))[0].properties.details)==null?void 0:e.description)!=null?i:""}get images(){var e,i;return(i=(e=Object.values(c(this,pr))[0].properties.details)==null?void 0:e.images)!=null?i:[]}get type(){var e,i;return(i=(e=Object.values(c(this,pr))[0].properties.kind)==null?void 0:e.split(".")[1])!=null?i:"unknown"}get coordinates(){return c(this,cr).coordinates==null&&(c(this,cr).coordinates=Object.entries(c(this,pr)).map(([e,i])=>new $(i.geometry.coordinates[1],i.geometry.coordinates[0],e))),c(this,cr).coordinates}get floors(){return this.coordinates.map(e=>e.floorId?c(this,Bo).getById("floor",e.floorId):void 0).filter(uh)}toJSON(){return{id:this.id,name:this.name,type:this.type,coordinates:this.coordinates.map(e=>e.toJSON()),floors:this.floors.map(e=>e.id)}}destroy(){for(let e of Object.keys(c(this,cr)))delete c(this,cr)[e]}};Bo=new WeakMap,cr=new WeakMap,pr=new WeakMap,s(Tn,"Connection"),v(Tn,"__type","connection");var ch=Tn,jr=ch;d();var Go,gi,Wr,hr,wn=class wn extends It{constructor(e,i){super(i.mvfData.properties.id,i.mvfData.properties.details);v(this,"__type",wn.__type);T(this,Go,void 0);T(this,gi,void 0);T(this,Wr,{});T(this,hr,void 0);E(this,Go,e),E(this,gi,i.floorId),E(this,hr,i.mvfData)}static is(e){return e.__type===wn.__type}get name(){var e,i;return(i=(e=c(this,hr).properties.details)==null?void 0:e.name)!=null?i:""}get description(){var e,i;return(i=(e=c(this,hr).properties.details)==null?void 0:e.description)!=null?i:""}get images(){var e,i;return(i=(e=c(this,hr).properties.details)==null?void 0:e.images)!=null?i:[]}get type(){let e=c(this,hr).properties.kind;return e==null&&(e="object"),e==="Desks"&&(e="desk"),e.toLowerCase()}get floor(){let e=c(this,Go).getById("floor",c(this,gi));if(e==null)throw new Error(`Floor ${c(this,gi)} not found!`);return e}get center(){var e;if(c(this,Wr).center==null){let[i,n]=(e=c(this,hr).properties.center)!=null?e:[0,0];c(this,Wr).center=new $(n,i,c(this,gi))}return c(this,Wr).center}toJSON(){return{id:this.id,name:this.name,type:this.type,floor:this.floor.id,center:this.center.toJSON()}}destroy(){for(let e of globalThis.Object.keys(c(this,Wr)))c(this,Wr)[e]=null}};Go=new WeakMap,gi=new WeakMap,Wr=new WeakMap,hr=new WeakMap,s(wn,"MapObject"),v(wn,"__type","object");var ph=wn,Ie=ph;d();d();var Ho,In,Vo=class Vo extends di{constructor(e){super(String(vt()));T(this,Ho,{});T(this,In,void 0);E(this,In,e.mvfData)}static is(e){return e.__type===Vo.__type}get url(){return c(this,In).url}get name(){return c(this,In).altText}toJSON(){return{id:this.id,url:this.url,name:this.name}}destroy(){for(let e of globalThis.Object.keys(c(this,Ho)))delete c(this,Ho)[e]}};Ho=new WeakMap,In=new WeakMap,s(Vo,"Image"),v(Vo,"__type","image");var hh=Vo,Ml=hh;var Xo,vi,Ee,Ur,En=class En extends It{constructor(e,i){super(i.mvfData.properties.id,i.mvfData.properties.details);v(this,"__type",En.__type);T(this,Xo,void 0);T(this,vi,void 0);T(this,Ee,{});T(this,Ur,void 0);E(this,Xo,e),E(this,Ur,i.mvfData),E(this,vi,i.floorId)}static is(e){return e.__type===En.__type}get name(){var e,i;return(i=(e=c(this,Ur).properties.details)==null?void 0:e.name)!=null?i:""}get description(){var e,i;return(i=(e=c(this,Ur).properties.details)==null?void 0:e.description)!=null?i:""}get images(){var e,i;if(c(this,Ee).images==null){let n=(i=(e=c(this,Ur).properties.details)==null?void 0:e.images)!=null?i:[];c(this,Ee).images=n.map(o=>new Ml({mvfData:o}))}return c(this,Ee).images}get floor(){let e=c(this,Xo).getById("floor",c(this,vi));if(e==null)throw new Error(`Floor ${c(this,vi)} not found!`);return e}get coordinate(){var e;if(c(this,Ee).coordinate==null){let[i,n]=(e=c(this,Ur).geometry.coordinates)!=null?e:[0,0];c(this,Ee).coordinate=new $(n,i,c(this,vi))}return c(this,Ee).coordinate}toJSON(){return{id:this.id,name:this.name,floor:this.floor.id,coordinate:this.coordinate.toJSON()}}destroy(){for(let e in c(this,Ee))c(this,Ee)[e]=null}};Xo=new WeakMap,vi=new WeakMap,Ee=new WeakMap,Ur=new WeakMap,s(En,"PointOfInterest"),v(En,"__type","point-of-interest");var dh=En,Yr=dh;d();var Yo,bi,Zr,Ln,jo,mh,_n=class _n extends It{constructor(e,i){super(i.mvfData.properties.id);T(this,jo);v(this,"__type",_n.__type);T(this,Yo,void 0);T(this,bi,void 0);T(this,Zr,{});T(this,Ln,void 0);E(this,Yo,e),E(this,bi,i.floorId),E(this,Ln,i.mvfData)}static is(e){return e.__type===_n.__type}get group(){return j(this,jo,mh).call(this).group}get type(){return j(this,jo,mh).call(this).type}get coordinate(){if(c(this,Zr).coordinate==null){let[e,i]=c(this,Ln).geometry.coordinates;c(this,Zr).coordinate=new $(i,e,c(this,bi))}return c(this,Zr).coordinate}get floor(){let e=c(this,Yo).getById("floor",c(this,bi));if(e==null)throw new Error(`Floor ${c(this,bi)} not found!`);return e}toJSON(){return{id:this.id,group:this.group,type:this.type,coordinate:this.coordinate.toJSON()}}destroy(){for(let e of Object.keys(c(this,Zr)))delete c(this,Zr)[e]}};Yo=new WeakMap,bi=new WeakMap,Zr=new WeakMap,Ln=new WeakMap,jo=new WeakSet,mh=s(function(){let[e,i]=c(this,Ln).properties.symbolId.split("--");return{group:e,type:i}},"#getGroupAndTypeFromSymbolId"),s(_n,"Annotation"),v(_n,"__type","annotation");var fh=_n,Mn=fh;d();d();var Dn,_e,Ci,An,On=class On extends It{constructor(e,i){super(i.mvfData.properties.id);v(this,"__type",On.__type);T(this,Dn,void 0);T(this,_e,{});T(this,Ci,void 0);T(this,An,void 0);E(this,Dn,e),E(this,Ci,i.floorId),E(this,An,i.mvfData)}static is(e){return e.__type===On.__type}get floor(){let e=c(this,Dn).getById("floor",c(this,Ci));if(e==null)throw new Error(`Floor ${c(this,Ci)} not found!`);return e}get coordinate(){if(c(this,_e).coordinate==null){let[e,i]=c(this,An).geometry.coordinates;c(this,_e).coordinate=new $(i,e,c(this,Ci))}return c(this,_e).coordinate}get neighbors(){if(c(this,_e).neighbours==null){let e=c(this,An).properties.neighbors.map(i=>{let n=c(this,Dn).getById("node",i.id);if(n==null)throw new Error(`Node ${i.id} not found!`);return n});c(this,_e).neighbours=e}return c(this,_e).neighbours}toJSON(){return{id:this.id,floor:this.floor.id,coordinate:this.coordinate.toJSON(),neighbors:this.neighbors.map(e=>e.id)}}destroy(){for(let e of Object.keys(c(this,_e)))delete c(this,_e)[e]}};Dn=new WeakMap,_e=new WeakMap,Ci=new WeakMap,An=new WeakMap,s(On,"Node"),v(On,"__type","node");var yh=On,q2=yh;var k8=s((r,t)=>{var m,y;let e={},i={},n={},o={},a={},l={},u={},h={},f=globalThis.Object.keys(r.space);for(let x of f){let S=r.space[x];if(S!=null)for(let P of S.features){h[P.properties.id]=x,a[P.properties.id]=P;for(let g of P.properties.destinationNodes)n[g]==null&&(n[g]=[]),n[g].push(P.properties.id);if(P.properties.kind==="desk-entrance"&&(o[P.properties.externalId]==null&&(o[P.properties.externalId]=[]),o[P.properties.externalId].push(...P.properties.destinationNodes)),!["void","desk-entrance"].includes((m=P.properties.kind)!=null?m:"")){if((y=P.properties.kind)!=null&&y.includes("connection")){let g=`${P.geometry.coordinates[1]}-${P.geometry.coordinates[0]}`;l[g]==null&&(l[g]=[]),l[g].push(P.properties.id);continue}if(P.properties.kind==="poi"){let g=new Yr(t,{floorId:x,mvfData:P});i[P.properties.id]=g}else{let g=new we(t,{floorId:x,mvfData:P});e[P.properties.id]=g}}}}for(let x in l){let S=l[x],P={};for(let C of S){let w=h[C],I=a[C];P[w]=I}let g=new jr(t,{mvfDataByFloorId:P});u[g.id]=g}return{spacesById:e,poisById:i,connectionsById:u,spaceIdsByDestinationNodeId:n,objectEntranceNodeIdsByObstructionId:o,mvfSpacesById:a,connectionIdsByLatLon:l}},"processMVFSpaces"),F8=s((r,t)=>{let e={},i={};for(let n of r["node.geojson"].features){i[n.properties.id]=n;let o=new q2(t,{mvfData:n,floorId:n.properties.map});e[n.properties.id]=o}return{nodesById:e,mvfNodesById:i}},"processMVFNodes"),B8=s((r,t)=>{let e={},i={},n={},o=globalThis.Object.keys(r.obstruction);for(let a of o){let l=r.obstruction[a];if(l!=null)for(let u of l.features){i[u.properties.id]=u;for(let f of u.properties.entrances)n[f]=u.properties.id;if(u.properties.kind==="Wall")continue;let h=new Ie(t,{floorId:a,mvfData:u});e[u.properties.id]=h}}return{objectsById:e,mvfObstructionById:i,obstructionIdByEntranceId:n}},"processMVFObstructions"),G8=s((r,t)=>{let e={},i={};for(let n of r["map.geojson"]){i[n.id]=n;let o=new Pl(t,{mvfData:n});e[n.id]=o}return{floorsById:e,mvfMapsById:i}},"processMVFMaps"),V8=s((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"),H8=s((r,t)=>{let e={},i={},n=globalThis.Object.keys(r.entrance);for(let o of n){let a=r.entrance[o];if(a!=null)for(let l of a.features){i[l.properties.id]=l;let u=new Vr(t,{floorId:o,mvfData:l});e[l.properties.id]=u}}return{doorsById:e,mvfEntrancesById:i}},"processMVFEntrances"),X8=s((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 l of a.features){i[l.properties.id]=l;let u=new Mn(t,{floorId:o,mvfData:l});e[l.properties.id]=u}}return{annotationsById:e,mvfAnnotationsById:i}},"processMVFAnnotations"),$2=s((r,t)=>{let{spacesById:e,spaceIdsByDestinationNodeId:i,poisById:n,mvfSpacesById:o,objectEntranceNodeIdsByObstructionId:a,connectionsById:l,connectionIdsByLatLon:u}=k8(r,t),{nodesById:h,mvfNodesById:f}=F8(r,t),{objectsById:m,mvfObstructionById:y,obstructionIdByEntranceId:x}=B8(r,t),{floorsById:S,mvfMapsById:P}=G8(r,t),{mvfConnectionsById:g,mvfConnectionsByNodeId:C}=V8(r,t),{doorsById:w,mvfEntrancesById:I}=H8(r,t),{annotationsById:M,mvfAnnotationsById:_}=X8(r,t);return{spacesById:e,nodesById:h,objectsById:m,floorsById:S,connectionsById:l,doorsById:w,poisById:n,annotationsById:M,spaceIdsByDestinationNodeId:i,objectEntranceNodeIdsByObstructionId:a,obstructionIdByEntranceId:x,connectionIdsByLatLon:u,mvfSpacesById:o,mvfNodesById:f,mvfObstructionById:y,mvfMapsById:P,mvfConnectionsById:g,mvfConnectionsByNodeId:C,mvfEntrancesById:I,mvfAnnotationsById:_}},"createDataFromMVF");var it,xi,Si,Pi,Mi,Ti,wi,Ii,Ei,Uo,Zo,zo,qo,$o,Jo,Ko,Qo,gh=class gh{constructor(t,e){T(this,it,{});v(this,"mvf");v(this,"outdoorViewToken");v(this,"spaceIdsByDestinationNodeId");v(this,"objectEntranceNodeIdsByObstructionId");v(this,"obstructionIdByEntranceId");T(this,xi,void 0);T(this,Si,void 0);T(this,Pi,void 0);T(this,Mi,void 0);T(this,Ti,void 0);T(this,wi,void 0);T(this,Ii,void 0);T(this,Ei,void 0);T(this,Uo,void 0);T(this,Zo,void 0);T(this,zo,void 0);T(this,qo,void 0);T(this,$o,void 0);T(this,Jo,void 0);T(this,Ko,void 0);T(this,Qo,void 0);this.mvf=t,this.outdoorViewToken=e;let i=$2(t,this);E(this,xi,i.nodesById),E(this,Si,i.spacesById),E(this,Pi,i.floorsById),E(this,Mi,i.connectionsById),E(this,Ti,i.objectsById),E(this,wi,i.doorsById),E(this,Ii,i.poisById),E(this,Ei,i.annotationsById),E(this,Uo,i.mvfAnnotationsById),E(this,Zo,i.mvfConnectionsById),E(this,zo,i.mvfConnectionsByNodeId),E(this,qo,i.mvfEntrancesById),E(this,$o,i.mvfNodesById),E(this,Jo,i.mvfObstructionById),E(this,Ko,i.mvfSpacesById),E(this,Qo,i.mvfMapsById),this.spaceIdsByDestinationNodeId=i.spaceIdsByDestinationNodeId,this.objectEntranceNodeIdsByObstructionId=i.objectEntranceNodeIdsByObstructionId,this.obstructionIdByEntranceId=i.obstructionIdByEntranceId}get mapName(){return this.mvf["manifest.geojson"].features[0].properties.name}get organizationId(){var t;return(t=this.mvf["manifest.geojson"].features[0].properties.org_id)!=null?t:""}get mapCenter(){return new $(this.mvf["manifest.geojson"].features[0].geometry.coordinates[1],this.mvf["manifest.geojson"].features[0].geometry.coordinates[0])}get spaces(){return c(this,it).spaces==null&&(c(this,it).spaces=globalThis.Object.values(c(this,Si))),c(this,it).spaces}get objects(){return c(this,it).objects==null&&(c(this,it).objects=globalThis.Object.values(c(this,Ti))),c(this,it).objects}get connections(){return c(this,it).connections==null&&(c(this,it).connections=globalThis.Object.values(c(this,Mi))),c(this,it).connections}get floors(){return c(this,it).floors==null&&(c(this,it).floors=globalThis.Object.values(c(this,Pi))),c(this,it).floors}get doors(){return c(this,it).doors==null&&(c(this,it).doors=globalThis.Object.values(c(this,wi))),c(this,it).doors}get pointsOfInterest(){return c(this,it).pointsOfInterest==null&&(c(this,it).pointsOfInterest=globalThis.Object.values(c(this,Ii))),c(this,it).pointsOfInterest}get annotations(){return c(this,it).annotations==null&&(c(this,it).annotations=globalThis.Object.values(c(this,Ei))),c(this,it).annotations}get nodes(){return c(this,it).nodes==null&&(c(this,it).nodes=globalThis.Object.values(c(this,xi))),c(this,it).nodes}getById(t,e){switch(t){case"space":return c(this,Si)[e];case"floor":return c(this,Pi)[e];case"node":return c(this,xi)[e];case"door":return c(this,wi)[e];case"connection":return c(this,Mi)[e];case"object":return c(this,Ti)[e];case"point-of-interest":return c(this,Ii)[e];case"annotation":return c(this,Ei)[e];default:throw new Error(`Unknown type: ${t}`)}}getMapDataById(t){var e,i,n,o,a,l,u;return(u=(l=(a=(o=(n=(i=(e=c(this,Si)[t])!=null?e:c(this,Pi)[t])!=null?i:c(this,xi)[t])!=null?n:c(this,wi)[t])!=null?o:c(this,Mi)[t])!=null?a:c(this,Ti)[t])!=null?l:c(this,Ii)[t])!=null?u:c(this,Ei)[t]}getMVFFeatureById(t,e){switch(t){case"space":return c(this,Ko)[e];case"node":return c(this,$o)[e];case"obstruction":return c(this,Jo)[e];case"map":return c(this,Qo)[e];case"connection":return c(this,Zo)[e];case"entrance":return c(this,qo)[e];case"annotation":return c(this,Uo)[e];default:throw new Error(`Unknown MVF feature type: ${t}`)}}getMVFFeatureByNodeId(t,e){switch(t){case"connection":return c(this,zo)[e];default:throw new Error(`Unsupported MVF feature type: ${t}`)}}destroy(){for(let t of globalThis.Object.keys(c(this,it)))c(this,it)[t]=null}};it=new WeakMap,xi=new WeakMap,Si=new WeakMap,Pi=new WeakMap,Mi=new WeakMap,Ti=new WeakMap,wi=new WeakMap,Ii=new WeakMap,Ei=new WeakMap,Uo=new WeakMap,Zo=new WeakMap,zo=new WeakMap,qo=new WeakMap,$o=new WeakMap,Jo=new WeakMap,Ko=new WeakMap,Qo=new WeakMap,s(gh,"MapDataInternal");var Wo=gh;d();d();d();d();var vh=class vh{_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={}}};s(vh,"PubSub");var nt=vh;d();d();d();d();d();(function(){typeof globalThis!="object"&&(Object.defineProperty(Object.prototype,"__magic__",{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__)})();d();d();var bh=class bh extends Se{visible=!0;type="geometry-group";components;userData={entityId:"",entities3D:new Set,opacity:1,dirty:!0,outlineDirty:!0};setVisible(t){this.visible=t,this.dispatchEvent({type:"childremoved",child:this})}getOpacity(){return this.userData.opacity}setOpacity(t){this.userData.opacity=t}constructor(t,e){super(),this.components=[e],this.userData.entityId=t}};s(bh,"GeometryGroupObject3D");var de=bh;d();var Ch=class Ch extends Se{};s(Ch,"Geometry2DObject3D");var Nn=Ch,xh=class xh{id;get type(){return this.components[0].type}get parent(){return this.object3d.parent}positionDirty=!0;object3d=new Nn;components;disposed=!1;constructor(t,e){this.id=t.id||vt(),this.components=[t],this.object3d=new Nn,this.object3d.position.copy(e),this.object3d.userData.entityId=this.id,this.object3d.userData.type=this.type}worldPosition=new Y;get position(){return this.object3d.getWorldPosition(this.worldPosition),this.worldPosition}};s(xh,"Geometry2D");var Le=xh;d();var Sh=class Sh extends Se{userData={entityId:"",type:"geometry"}};s(Sh,"Geometry3DObject3D");var Ue=Sh,Ph=class Ph{id=vt();components;get object3d(){return this.components[0].mesh}get parent(){var t;return(t=this.components[0].mesh)==null?void 0:t.parent}get type(){return this.components[0].type}constructor(t,e){this.components=[t,e]}};s(Ph,"Geometry3D");var St=Ph;var ta=class ta extends Se{childrenIds=new Set;type="group-container";userData={entityId:"",entities2D:new Set,dirty:!0};components=[];constructor(t){super(),this.userData.entityId=t}addEntity(t){t instanceof ta?(this.childrenIds.add(t.userData.entityId),this.add(t)):t instanceof Le?(this.childrenIds.add(t.id),this.add(t.object3d),this.userData.entities2D.add(t.id)):t instanceof de?(this.childrenIds.add(t.userData.entityId),this.add(t)):t instanceof St&&t.object3d&&(this.childrenIds.add(t.id),this.add(t.object3d)),this.dispatchEvent({type:"childadded",child:this})}removeEntity(t){t instanceof ta?(this.childrenIds.delete(t.userData.entityId),this.remove(t)):t instanceof Le?(this.childrenIds.delete(t.id),this.userData.entities2D.delete(t.id),this.remove(t.object3d)):t instanceof de?(this.childrenIds.delete(t.userData.entityId),this.remove(t)):t instanceof St&&t.object3d&&(this.childrenIds.delete(t.id),this.add(t.object3d)),this.dispatchEvent({type:"childremoved",child:this})}setVisible(t){this.visible=t,this.dispatchEvent({type:"childremoved",child:this})}setAltitude(t){this.position.z=t,this.dispatchEvent({type:"childremoved",child:this})}get altitude(){return this.position.z}};s(ta,"GroupContainerObject3D");var ee=ta;d();var J2=!1;function K2(){J2=!0}s(K2,"enableTestMode");var Mh=class Mh{backgroundAlpha=1;backgroundColor=new Mt;width=0;height=0;options={};renderer;constructor(t,e=2){try{this.options=t;let i={canvas:t.canvas,alpha:t.alpha||!1,stencil:!1,antialias:typeof t.antialias=="boolean"?t.antialias:!0,outputColorSpace:si,powerPreference:"high-performance",preserveDrawingBuffer:!0};J2?(this.renderer={setSize:()=>{},state:{reset:()=>{}},properties:{get:()=>{}},getSize:()=>({width:window.innerWidth,height:innerHeight}),getDrawingBufferSize:()=>({width:window.innerWidth,height:innerHeight}),getClearAlpha:()=>1,getClearColor:()=>new Mt,autoUpdate:!0,shadowMap:{autoUpdate:!0},getContext:()=>({getContextAttributes(){return{alpha:!0,antialias:!1,depth:!0,stencil:!1}}}),setRenderTarget:()=>{},setClearColor:()=>{},clear:()=>{},render:()=>{},domElement:document.createElement("canvas"),capabilities:{isWebGL2:!0}},this.renderer.domElement.style.width="1920px",Object.defineProperty(this.renderer.domElement,"clientWidth",{value:1920}),this.renderer.domElement.style.height="1080px",Object.defineProperty(this.renderer.domElement,"clientHeight",{value:1080})):this.renderer=e===2?new mm(i):new ym(i),this.backgroundColor=new Mt,this.backgroundAlpha=1}catch(i){H.error(i),t.onWebGLRendererError&&t.onWebGLRendererError(i)}}destroy(){this.renderer&&this.renderer.dispose()}render(t,e){this.renderer&&(this.renderer.state.reset(),e.layers.enable(0),e.layers.enable(1),this.renderer.autoClear=!1,this.renderer.setRenderTarget(null),this.renderer.render(t,e),this.renderer.state.reset())}clear(){this.renderer&&(this.renderer.setClearColor(this.backgroundColor,this.backgroundAlpha),this.renderer.clear())}setBufferSize(t,e){b.env.NODE_ENV==="test"||!this.renderer||(this.width=t,this.height=e,this.renderer.setSize(t,e,!1))}setBackgroundColor(t,e){this.backgroundColor=t,this.backgroundAlpha=e}domElement(){var t;return(t=this.renderer)==null?void 0:t.domElement}};s(Mh,"Renderer");var Tl=Mh;d();d();var Th=class Th{percentExpanded=0;activeId="";gap=20;dirty=!0};s(Th,"StackComponent");var Rn=Th;d();var zr=63710088e-1,Q2=-85.051129,t3=85.051129,wl=1e4,wh={chain:"chain",cancel:"cancel"},Ih=Math.PI*2,ea=100,e3=1e4,Eh=0,_h=22;var Lh=["change","pan-start","pan-end","rotate-start","rotate-end","zoom-start","zoom-end","multi-start","multi-end","multi-cancel","pedestal-start","pedestal-change","pedestal-end","user-pan-start","user-pedestal-start","user-rotate-start","user-dolly-start","user-zoom-start","user-tilt-start","user-pan-end","user-pedestal-end","user-rotate-end","user-dolly-end","user-zoom-end","user-tilt-end","position-updated","zoom-updated","tilt-updated","rotation-updated"];d();var ra="mappedin";d();function qr(){return typeof window>"u"?1:Math.min(window.devicePixelRatio,2)}s(qr,"getPixelRatio");function Il(r,t,e,i){let n=r*(Math.PI/180),o=i/zr,a=r+o*180/Math.PI,l=e/zr/Math.cos(n),u=t+l*180/Math.PI;return{lat:a,lon:u}}s(Il,"cartesianToGeographic");function El(r,t,e,i){let n=e*(Math.PI/180),o=i*(Math.PI/180),a=r*(Math.PI/180),l=t*(Math.PI/180),u=n-a,h=o-l,f=zr*h*Math.cos(a),m=zr*u;return{x:f,y:m}}s(El,"geographicToCartesian");var Oh=s((r,t=[])=>{var e;if(r.children&&r.visible)for(let i of r.children){if(i.visible)if((e=i.userData)!=null&&e.entities3D&&i.type==="geometry-group"){t.push(i.userData.entityId);for(let n of i.userData.entities3D.values())t.push(n)}else(i.type==="group-container"&&i.components[0]instanceof Rn||i.type==="custom-geometry"||i instanceof Ue)&&t.push(i.userData.entityId);Oh(i,t)}return t},"extract3DEntitiesFromTree"),Dh=s((r,t)=>{var e;if(r.children&&r.visible&&!((e=r.userData)!=null&&e.hidden))for(let i of r.children)i.visible&&i instanceof Nn&&t.add(i.userData.entityId),Dh(i,t);return t},"extractEntitiesFromTree");function Ah(r,t){for(let e in t){if(t[e]==null){r[e]=void 0;continue}typeof t[e]=="object"?Ah(r[e],t[e]):r[e]=t[e]}return r}s(Ah,"mergeObjects");function i3(r,t,e,i){let n={translateX:r.x,translateY:r.y,translateZ:r.z,scale:r.meterInMercatorCoordinateUnits()},o=new li,a=new Y(n.scale,-n.scale,n.scale),l=new li().makeTranslation(n.translateX,n.translateY,n.translateZ).scale(a);return{id:ra,type:"custom",renderingMode:"3d",render:(u,h)=>{if(o.fromArray(h),e.elevation>0){let f=wm.fromLngLat(r.toLngLat(),e.elevation);l.makeTranslation(n.translateX,n.translateY,-f.z).scale(a)}t.projectionMatrix=o.multiply(l),i()}}}s(i3,"createCustomLayer");function Y8(r){return fetch(r,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({grant_type:"client_credentials"})})}s(Y8,"fetchToken");async function n3(r){let t=await Y8(r),{access_token:e}=await t.json();return{"x-mappedin-tiles-key":e}}s(n3,"getRequestHeaders");function o3(r,t=0){let e=3735928559^t,i=1103547991^t;for(let n=0,o;n<r.length;n++)o=r.charCodeAt(n),e=Math.imul(e^o,2654435761),i=Math.imul(i^o,1597334677);return e=Math.imul(e^e>>>16,2246822507)^Math.imul(i^i>>>13,3266489909),i=Math.imul(i^i>>>16,2246822507)^Math.imul(e^e>>>13,3266489909),4294967296*(2097151&i)+(e>>>0)}s(o3,"cyrb53");var j8=s(r=>r,"linearEase");function le(r,t,e,i,n,o=j8){r=Math.max(t,Math.min(r,e));let a=(r-Math.min(t,e))/Math.abs(e-t),l=o(a);return i+l*(n-i)}s(le,"interpolate");function Nh(r,t,e){let i=r*(Math.PI/180)/2,n=t/2;return e*Math.tan(i)/n}s(Nh,"getProjectionScaleFactor");function _l(r,t){let e;return typeof t=="string"||typeof t=="number"?(e=r.entity2DMap.get(t),e==null&&(e=r.entity3DMap.get(t))):typeof(t==null?void 0:t.id)=="string"||typeof(t==null?void 0:t.id)=="number"?(e=r.entity2DMap.get(t.id),e==null&&(e=r.entity3DMap.get(t.id))):e=t,e}s(_l,"getGeometryByGeometryId");function a3(r){return new Tm(new Qu(r[0][0],r[0][1]),new Qu(r[1][0],r[1][1])).getCenter().toArray()}s(a3,"getBoundingBoxCenter");d();d();var s3=`"use strict";(()=>{function _(n,e){return e.x+e.w<n.x+n.w&&e.x>n.x&&e.y>n.y&&e.y+e.h<n.y+n.h}function A(n,e){let[t,o]=e;return t>=n.x&&t<=n.x+n.w&&o>=n.y&&o<=n.y+n.h}function j(n,e){let t=e.x,o=e.y,i=e.x+e.w,l=e.y+e.h,c=n.x,f=n.y,k=n.x+n.w,P=n.y+n.h;return t<k&&c<i&&o<P&&f<l}function a(n,e){for(let t=0;t<e.length;t++)n.push(e[t])}var w=4,s=class{x;y;w;h;userData;constructor(e,t,o,i,l){let c=typeof window>"u"?2:window.devicePixelRatio;this.userData=typeof l>"u"?null:l,this.x=e-w,this.y=t-w,this.w=o+w*Math.min(c,2),this.h=i+w*Math.min(c,2)}contains(e){return e===this?!1:_(this,e)}intersects(e){return j(this,e)}intersectsPoint(e){return A(this,e)}draw(e){e.fillStyle="rgba(123,222,26, 0.5)",e.fillRect(this.x,this.y,this.w,this.h)}};var x=class n{topLeft;topRight;bottomLeft;bottomRight;divided=!1;boundary;capacity=16;objects=[];parent;constructor(e,t){this.parent=t,this.boundary=e}getSize(){return this.divided?this.objects.length+this.topLeft.getSize()+this.topRight.getSize()+this.bottomLeft.getSize()+this.bottomRight.getSize():this.objects.length}subdivide(){let{x:e,y:t,w:o,h:i}=this.boundary;this.topLeft=new n(new s(e,t,o/2,i/2),this),this.topRight=new n(new s(e+o/2,t,o/2,i/2),this),this.bottomLeft=new n(new s(e,t+i/2,o/2,i/2),this),this.bottomRight=new n(new s(e+o/2,t+i/2,o/2,i/2),this),this.divided=!0}queryRect(e){let t=[];if(this.boundary.intersects(e))t.push(...this.objects);else return[];return this.divided&&(a(t,this.topLeft.queryRect(e)),a(t,this.topRight.queryRect(e)),a(t,this.bottomLeft.queryRect(e)),a(t,this.bottomRight.queryRect(e))),t}queryPoint(e){let t=[];if(this.boundary.intersectsPoint(e))t.push(...this.objects);else return[];return this.divided&&(a(t,this.topLeft.queryPoint(e)),a(t,this.topRight.queryPoint(e)),a(t,this.bottomLeft.queryPoint(e)),a(t,this.bottomRight.queryPoint(e))),t}insert(e){return this.boundary.contains(e)?this.objects.length<this.capacity?(this.objects.push(e),!0):(this.divided||this.subdivide(),(this.topLeft.insert(e)||this.topRight.insert(e)||this.bottomLeft.insert(e)||this.bottomRight.insert(e))===!1&&this.objects.push(e),!0):!1}drawObjects(e){this.objects.forEach(t=>t.draw(e)),this.divided&&(this.topLeft.drawObjects(e),this.topRight.drawObjects(e),this.bottomLeft.drawObjects(e),this.bottomRight.drawObjects(e))}draw(e){e.rect(this.boundary.x,this.boundary.y,this.boundary.w,this.boundary.h),this.divided&&(this.topLeft.draw(e),this.topRight.draw(e),this.bottomLeft.draw(e),this.bottomRight.draw(e)),e.strokeStyle="black",e.lineWidth=4,e.stroke()}};var d=200,I=10;function q(n,e,t,o="-1"){let i=1/0,l=1/0,c=-1/0,f=-1/0,k=new s(-I,0,5,t),P=new s(-I,0,e,5),X=new s(e-5,0,e+I,t),O=new s(0,t-5,e,t+I),K=[k,P,X,O],N=new s(-d,-d,e+d*2,t+d*2);for(let r of n)for(let b=0;b<r.bboxes.length;b++){let{boundingBox:R}=r.bboxes[b],[h,T,u,p]=R,[S,m,B,W]=[r.y-h,r.y+T,r.x-u,r.x+p],L=B,v=S,E=W-B,M=m-S;i=Math.min(i,L)-d,l=Math.min(l,v)-d,c=Math.max(c,L+E)+d,f=Math.max(f,v+M)+d,r.bboxes[b].boundingRect=new s(L,v,E,M)}let g={msgId:o,colliders:new Array(n.length),debug:[]},C=new x(new s(i,l,c-i,f-l)),y;for(let r=0;r<n.length;r++)if(y=n[r],g.colliders[r]=[-1,!1],y.enabled){let[b,R,h]=[1/0,-1,void 0];for(let{index:T,boundingRect:u}of y.bboxes){let p=[];if(p=C.queryRect(u).filter(m=>u.intersects(m)),y.shouldCollideWithScreenEdges&&K.forEach(m=>{u.intersects(m)&&p.push(m)}),p.length<=b&&(h=u,R=T,b=p.length),p.length===0){C.insert(u),g.colliders[r]=[T,!N.contains(u),u];break}}y.rank===5&&h!=null&&(C.insert(h),g.colliders[r]=[R,!N.contains(h),h])}else g.colliders[r]=[-1,!1];return g}function z(n){let e=n[0].map(t=>{let o=t[0].map((i,l)=>({index:l,boundingBox:[i[0],i[1],i[2],i[3]]}));return{enabled:t[1]===1,rank:t[2]===1?5:0,x:t[3],y:t[4],bboxes:o}});return{msgId:"-1",totalWidth:n[3],totalHeight:n[2],colliders:e,devicePixelRatio:n[1]}}self.onmessage=n=>{let e=z(n.data);self.postMessage(q(e.colliders,e.totalWidth,e.totalHeight,e.msgId))};})();
5
+ `;d();d();d();d();d();function l3(r,t){return t.x+t.w<r.x+r.w&&t.x>r.x&&t.y>r.y&&t.y+t.h<r.y+r.h}s(l3,"contains");d();function u3(r,t){let[e,i]=t;return e>=r.x&&e<=r.x+r.w&&i>=r.y&&i<=r.y+r.h}s(u3,"intersectPoint");d();function c3(r,t){let e=t.x,i=t.y,n=t.x+t.w,o=t.y+t.h,a=r.x,l=r.y,u=r.x+r.w,h=r.y+r.h;return e<u&&a<n&&i<h&&l<o}s(c3,"intersects");d();function dr(r,t){for(let e=0;e<t.length;e++)r.push(t[e])}s(dr,"appendItems");d();var Ll=4,Rh=class Rh{x;y;w;h;userData;constructor(t,e,i,n,o){let a=typeof window>"u"?2:window.devicePixelRatio;this.userData=typeof o>"u"?null:o,this.x=t-Ll,this.y=e-Ll,this.w=i+Ll*Math.min(a,2),this.h=n+Ll*Math.min(a,2)}contains(t){return t===this?!1:l3(this,t)}intersects(t){return c3(this,t)}intersectsPoint(t){return u3(this,t)}draw(t){t.fillStyle="rgba(123,222,26, 0.5)",t.fillRect(this.x,this.y,this.w,this.h)}};s(Rh,"Rectangle");var Et=Rh;var _i=class _i{topLeft;topRight;bottomLeft;bottomRight;divided=!1;boundary;capacity=16;objects=[];parent;constructor(t,e){this.parent=e,this.boundary=t}getSize(){return this.divided?this.objects.length+this.topLeft.getSize()+this.topRight.getSize()+this.bottomLeft.getSize()+this.bottomRight.getSize():this.objects.length}subdivide(){let{x:t,y:e,w:i,h:n}=this.boundary;this.topLeft=new _i(new Et(t,e,i/2,n/2),this),this.topRight=new _i(new Et(t+i/2,e,i/2,n/2),this),this.bottomLeft=new _i(new Et(t,e+n/2,i/2,n/2),this),this.bottomRight=new _i(new Et(t+i/2,e+n/2,i/2,n/2),this),this.divided=!0}queryRect(t){let e=[];if(this.boundary.intersects(t))e.push(...this.objects);else return[];return this.divided&&(dr(e,this.topLeft.queryRect(t)),dr(e,this.topRight.queryRect(t)),dr(e,this.bottomLeft.queryRect(t)),dr(e,this.bottomRight.queryRect(t))),e}queryPoint(t){let e=[];if(this.boundary.intersectsPoint(t))e.push(...this.objects);else return[];return this.divided&&(dr(e,this.topLeft.queryPoint(t)),dr(e,this.topRight.queryPoint(t)),dr(e,this.bottomLeft.queryPoint(t)),dr(e,this.bottomRight.queryPoint(t))),e}insert(t){return this.boundary.contains(t)?this.objects.length<this.capacity?(this.objects.push(t),!0):(this.divided||this.subdivide(),(this.topLeft.insert(t)||this.topRight.insert(t)||this.bottomLeft.insert(t)||this.bottomRight.insert(t))===!1&&this.objects.push(t),!0):!1}drawObjects(t){this.objects.forEach(e=>e.draw(t)),this.divided&&(this.topLeft.drawObjects(t),this.topRight.drawObjects(t),this.bottomLeft.drawObjects(t),this.bottomRight.drawObjects(t))}draw(t){t.rect(this.boundary.x,this.boundary.y,this.boundary.w,this.boundary.h),this.divided&&(this.topLeft.draw(t),this.topRight.draw(t),this.bottomLeft.draw(t),this.bottomRight.draw(t)),t.strokeStyle="black",t.lineWidth=4,t.stroke()}};s(_i,"QuadTree");var Ze=_i;d();d();var p3=["","","low","medium","high","always-visible"];function h3(r){return Math.min(5,Math.max(2,r))}s(h3,"clampTierNumber");function kn(r){if(typeof r=="number")return h3(r);let t=p3.indexOf(r);return t===-1?3:t}s(kn,"convertCollisionRankingTierToNumber");function ia(r){let t=h3(r);return p3[t]}s(ia,"convertNumberToCollisionRankingTier");function d3(r,t,e){let i,n,o,a=null,l=0;e||(e={});let u=s(function(){l=e.leading===!1?0:Date.now(),a=null,o=r.apply(i,n),a||(i=n=null)},"later");return function(){let h=Date.now();!l&&e.leading===!1&&(l=h);let f=t-(h-l);return i=globalThis,n=arguments,f<=0||f>t?(a&&(clearTimeout(a),a=null),l=h,o=r.apply(i,n),a||(i=n=null)):!a&&e.trailing!==!1&&(a=setTimeout(u,f)),o}}s(d3,"throttle");function f3(r){return[r.bboxes.map(e=>[e.boundingBox[0],e.boundingBox[1],e.boundingBox[2],e.boundingBox[3]]),r.enabled?1:0,r.rank===5?1:0,r.x,r.y]}s(f3,"packCollider");var Li=!1,W8=150,Fh=class Fh extends nt{worker;debugContext;debugCanvas;dirty=!0;packedMessage=[[],0,0,0];visibleCollidersQTree=new Ze(new Et(0,0,0,0));interactiveCollidersQTree=new Ze(new Et(0,0,0,0));coreState;constructor(t,e,i=new Worker(URL.createObjectURL(new Blob([s3],{type:"text/javascript"})))){super(),this.coreState=e,this.debugCanvas=t,this.debugContext=t.getContext("2d"),this.worker=i,this.worker.onmessage=n=>this.resolve(n),this.postMessage=d3(this._postMessage,W8,!1),Li?this.showCollisionBoxes():this.hideCollisionBoxes()}postMessage;showCollisionBoxes=()=>{Li=!0,this.debugCanvas.style.display="block"};hideCollisionBoxes=()=>{Li=!1,this.debugContext.clearRect(0,0,this.debugCanvas.width,this.debugCanvas.height),this.debugCanvas.style.display="none"};currentMsgId="";working=!1;_postMessage=()=>{this.worker.postMessage(this.packedMessage)};componentArray=[];update=()=>{if(this.dirty){this.packedMessage=[[],0,0,0],this.componentArray=new Array(this.coreState.entity2DIds.size);let t=0,e;for(let i of this.coreState.entity2DIds){let n=this.coreState.entity2DMap.get(i);n&&(e=n.components[0],this.componentArray[t]=e),t++}this.resize(),this.dirty=!1,this.componentArray.sort((i,n)=>n.rank-i.rank)}else this.componentArray.filter(e=>e.collisionDirty===!0).length>0&&this.componentArray.sort((e,i)=>i.rank-e.rank);for(let t=0;t<this.componentArray.length;t++)this.packedMessage&&(this.componentArray[t].collisionDirty||this.packedMessage[0][t]==null?(this.packedMessage[0][t]=f3(this.componentArray[t].toJSON()),this.componentArray[t].collisionDirty=!1):(this.packedMessage[0][t][1]=this.componentArray[t].enabled?1:0,this.packedMessage[0][t][2]=this.componentArray[t].rank===5?1:0,this.packedMessage[0][t][3]=this.componentArray[t].projection.x,this.packedMessage[0][t][4]=this.componentArray[t].projection.y));this.working||this.postMessage()};resize(){this.packedMessage[3]=this.debugCanvas.width,this.packedMessage[2]=this.debugCanvas.height}resolve=t=>{if(this.working=!1,this.dirty||!t.data)return;let e=t.data.colliders,i=-1,n=!1,o,a,l;Li&&(this.visibleCollidersQTree=new Ze(new Et(0,0,this.debugCanvas.width,this.debugCanvas.height))),this.interactiveCollidersQTree=new Ze(new Et(0,0,this.debugCanvas.width,this.debugCanvas.height));for(let u=0;u<this.componentArray.length;u++){let h=this.componentArray[u];e[u]==null||!h.enabled||([i,n,o]=e[u],i!==-1&&!n&&o!=null?(l=new Et(o.x,o.y,o.w,o.h,{entityId:h.id}),Li&&this.visibleCollidersQTree.insert(l),a=this.coreState.entity2DMap.get(h.id),(a==null?void 0:a.components[1])!=null&&this.interactiveCollidersQTree.insert(new Et(o.x,o.y,o.w,o.h,{entityId:h.id})),h.visible===!1&&(h.visible=!0,"visibilityNeedsUpdate"in h&&(h.visibilityNeedsUpdate=!0)),i!==-1&&i!==h.activeStrategyIndex&&(h.activeBoundingBox=l,h.onStrategySelected(i))):(h.visible===!0&&(h.visible=!1,"visibilityNeedsUpdate"in h&&(h.visibilityNeedsUpdate=!0)),i!==-1&&i!==h.activeStrategyIndex&&h.onStrategySelected(i)))}Li&&this.drawDebug(),this.publish("visibility-changed")};drawDebug=()=>{Li&&this.visibleCollidersQTree&&(this.debugContext.clearRect(0,0,this.debugCanvas.width,this.debugCanvas.height),this.debugContext.beginPath(),this.visibleCollidersQTree.drawObjects(this.debugContext))};destroy=()=>{this.worker.terminate()}};s(Fh,"CollisionSystem");var Ol=Fh;d();d();d();d();var Gh=class Gh{type;event;constructor(t){this.type=0,this.event=t}get timestamp(){return this.event.timeStamp}};s(Gh,"Tap");var Dl=Gh,Vh=class Vh{taps=[];add(t){this.lastPointerDown&&t.timestamp-this.lastPointerDown.timestamp<50?this.lastPointerDown.type=1:this.taps.push(t)}get lastPointerDown(){return this.taps.length>=1?this.taps[this.taps.length-1]:void 0}get isSingleTapWithTwoFingers(){var t;return this.isSingleTap&&((t=this.lastPointerDown)==null?void 0:t.type)===1}get isSingleTapWithOneFinger(){var t;return this.isSingleTap&&((t=this.lastPointerDown)==null?void 0:t.type)===0}get isDoubleTapWithOneFinger(){var t,e;return this.isDoubleTap&&((t=this.taps[0])==null?void 0:t.type)===0&&((e=this.taps[1])==null?void 0:e.type)===0}get isSingleTap(){return this.taps.length===1}get isDoubleTap(){return this.taps.length===2}discardOutsideOfWaitWindow(t){this.taps=this.taps.filter(e=>t-e.timestamp<300)}flush(){this.taps=[]}get _taps(){return this.taps}destroy(){this.flush()}};s(Vh,"TapsController");var Al=Vh;var Fn,Hh=class Hh extends nt{constructor(e,i,n,o){super();v(this,"raycaster",new _r);v(this,"state",{hovered3DEntity:void 0,hovered2DEntity:void 0,lastHover:void 0,containerOffset:[0,0],interaction:{mouseDownStart:void 0,distanceFromMouseDown:void 0,isPanning:!1}});v(this,"coreState");v(this,"camera");v(this,"cameraPlane");v(this,"_quadtree",new Ze(new Et(0,0,0,0)));v(this,"_container");v(this,"cursor","grab");v(this,"touchesCount",0);v(this,"hasTouched",!1);T(this,Fn,void 0);v(this,"onPointerMoveRaf",e=>{c(this,Fn)&&cancelAnimationFrame(c(this,Fn)),E(this,Fn,requestAnimationFrame(()=>{this.onPointerMove(e)}))});v(this,"onPointerMove",e=>{e.preventDefault(),this.updateInteractionStateIfPanning(e),(e.pointerType!=="touch"||e.pointerType===void 0&&this.hasTouched)&&this.handleHover(e),this.handleCursor()});v(this,"tapsControl",new Al);v(this,"onPointerDown",e=>{e.target===this._container&&(this._container.addEventListener("pointerup",this.onPointerUp,!1),this._container.addEventListener("pointercancel",this.onPointerUp,!1),this.state.interaction.mouseDownStart={time:Date.now(),timestamp:e.timeStamp,clientX:e.clientX,clientY:e.clientY},this.state.interaction.distanceFromMouseDown=0,this.handleCursor(),e.pointerType==="touch"&&(this.tapsControl.add(new Dl(e)),this.touchesCount=Math.max(0,this.touchesCount+1)))});v(this,"clickTimeout");v(this,"onPointerUp",e=>{this.tapsControl.discardOutsideOfWaitWindow(e.timeStamp),this.touchesCount=Math.max(0,this.touchesCount-1),this.touchesCount===0&&(this._container.removeEventListener("pointerup",this.onPointerUp,!1),this._container.removeEventListener("pointercancel",this.onPointerUp,!1)),this.updateInteractionStateIfPanning(e);let{mouseDownStart:i}=this.state.interaction;!i||this.state.interaction.distanceFromMouseDown==null||(Date.now()<i.time+300&&(this.tapsControl.isSingleTapWithTwoFingers||this.state.interaction.distanceFromMouseDown<=15)&&(e.pointerType==="touch"?this.tapsControl.isSingleTapWithTwoFingers?(this.publish("singletap-with-twofinger",e),this.flush()):this.tapsControl.isSingleTapWithOneFinger&&this.touchesCount===0?(this.clickTimeout&&clearTimeout(this.clickTimeout),this.clickTimeout=window.setTimeout(()=>{this.handleClick(e),this.flush()},300)):this.tapsControl.isDoubleTapWithOneFinger&&(this.publish("doubletap-with-onefinger",e),this.flush()):this.handleClick(e)),this.state.interaction.mouseDownStart=void 0,this.state.interaction.distanceFromMouseDown=void 0,this.state.interaction.isPanning=!1,this.handleCursor())});v(this,"dirty3D",!0);v(this,"cachedHitBoxes",[]);v(this,"ndcPoint",new W);v(this,"debugPanel");this.raycaster.layers.enableAll();let{top:a,left:l}=e.getBoundingClientRect();this.state.containerOffset=[a,l],this.camera=n,this._container=e,this.coreState=i,this.cameraPlane=o,this._container.addEventListener("pointerdown",this.onPointerDown,!1),this._container.addEventListener("pointermove",this.onPointerMoveRaf,!1),this._container.classList.add("mappedin-interactive")}updateQuadtree(e){this._quadtree=e}setHovered3DEntityInteractionComponentDirty(){if(this.state.hovered3DEntity){let e=this.state.hovered3DEntity.components[2];e&&(e.dirty=!0)}}flush(){this.tapsControl.flush(),this.clickTimeout!=null&&(clearTimeout(this.clickTimeout),this.clickTimeout=void 0)}handleHover(e){if(this.state.interaction.mouseDownStart)return;let{entity3D:i,entity2D:n,position:o}=this.intersect(e);(this.handle3DEntityHover(i)||this.handle2DEntityHover(n))&&this.publish("hover",{entity2D:this.state.hovered2DEntity,entity3D:this.state.hovered3DEntity,position:o}),this.handleCursor()}handleCursor(){let e=!!(this.state.hovered3DEntity||this.state.hovered2DEntity),i=!!this.state.interaction.mouseDownStart,n=this.state.interaction.isPanning,o=z8(e,n,i);this.cursor!==o&&(this.cursor=o,o==="pointer"?this._container.classList.add("mappedin-interaction-hover"):this._container.classList.remove("mappedin-interaction-hover"))}handle2DEntityHover(e){let i=this.state.hovered2DEntity!==e;return this.state.hovered2DEntity=e,i}handleClick(e){let i=this.intersect(e);this.publish("click",{entity2D:i.entity2D,entity3D:i.entity3D,position:i.position,pointerEvent:{button:e.button}})}get _hitBoxes(){if(this.dirty3D){this.cachedHitBoxes=[];let e;for(let i of this.coreState.threeDEntities)e=this.coreState.entity3DMap.get(i),((e==null?void 0:e.type)==="geometry"||(e==null?void 0:e.type)==="model")&&e.components[2]&&e.components[0].mesh&&!this.cachedHitBoxes.includes(e.components[0].mesh)&&this.cachedHitBoxes.push(e.components[0].mesh);return this.dirty3D=!1,this.cachedHitBoxes}return this.cachedHitBoxes}intersect(e){var y,x;let i=[e.offsetX,e.offsetY],n=this._quadtree.queryPoint(i),[o]=n.filter(S=>S.intersectsPoint(i)),a=this.state.containerOffset[0],l=this.state.containerOffset[1];this.ndcPoint.x=(e.clientX-l)/this._container.clientWidth*2-1,this.ndcPoint.y=-((e.clientY-a)/this._container.clientHeight)*2+1,this.raycaster.setFromCamera(this.ndcPoint,this.camera),this.raycaster.layers.enable(0);let[u]=this.getMouseRayIntersects(),h=this.raycaster.intersectObjects(this._hitBoxes,!0).filter(S=>S.object.visible),[f]=h,m=(y=f==null?void 0:f.instanceId)!=null?y:f==null?void 0:f.batchId;return{entity2D:((x=o==null?void 0:o.userData)==null?void 0:x.entityId)==="watermark"?{id:"watermark"}:this.coreState.entity2DMap.get(o==null?void 0:o.userData.entityId),entity3D:m!=null?this.coreState.entity3DMap.get(f==null?void 0:f.object.userData.entities[m]):this.coreState.entity3DMap.get(f==null?void 0:f.object.userData.entityId),position:u==null?void 0:u.point}}handle3DEntityHover(e){this.state.lastHover!==e&&(this.state.lastHover&&y3(this.state.lastHover,!1),e&&y3(e,!0));let i=this.state.hovered3DEntity!==e;return this.state.hovered3DEntity=e,this.state.lastHover=e,i}updateInteractionStateIfPanning(e){this.state.interaction.mouseDownStart&&(this.state.interaction.distanceFromMouseDown=Math.sqrt(Math.pow(e.clientX-this.state.interaction.mouseDownStart.clientX,2)+Math.pow(e.clientY-this.state.interaction.mouseDownStart.clientY,2)),!this.state.interaction.isPanning&&this.state.interaction.distanceFromMouseDown>15&&(this.state.interaction.isPanning=!0))}getMouseRayIntersects(){return this.raycaster.intersectObjects([this.cameraPlane],!1)}destroy(){this._container.removeEventListener("pointerdown",this.onPointerDown,!1),this._container.removeEventListener("pointermove",this.onPointerMoveRaf,!1),this._container.removeEventListener("pointerup",this.onPointerUp,!1),this._container.removeEventListener("pointercancel",this.onPointerUp,!1)}enableDebug(){let e=document.createElement("div");e.style.position="absolute",e.style.top="0",e.style.right="0",e.style.zIndex="1",e.style.backgroundColor="white",e.style.padding="10px",document.body.append(e),e.id="interaction-debug-panel",this.debugPanel=e,this.on("doubletap-with-onefinger",()=>{this.queueDebugMessage("doubletap-with-onefinger","#ffadad")}),this.on("singletap-with-twofinger",()=>{this.queueDebugMessage("singletap-with-twofinger","#ffd6a5")}),this.on("click",i=>{var n,o,a;this.queueDebugMessage(`CLICK
6
6
  3D: ${(n=i.entity3D)==null?void 0:n.id}
7
7
  2D: ${(o=i.entity2D)==null?void 0:o.id}
8
8
  Pos: ${(a=i.position)==null?void 0:a.toArray().join(", ")}`,"#fdffb6")}),this.on("hover",i=>{var n,o,a;this.queueDebugMessage(`HOVER
9
9
  3D: ${(n=i.entity3D)==null?void 0:n.id}
10
10
  2D: ${(o=i.entity2D)==null?void 0:o.id}
11
- Pos: ${(a=i.position)==null?void 0:a.toArray().join(", ")}`,"#caffbf")})}get _state(){return this.state}queueDebugMessage(r,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=r,(o=this.debugPanel)==null||o.prepend(n),setTimeout(()=>{n.style.opacity="0",setTimeout(()=>{n.remove()},500)},2500)}getCursor(){return this.cursor}};Ln=new WeakMap,s(Ah,"InteractionSystem");var Jo=Ah;function nv(e,t){let r=e.components[2];r&&(r.hover=t,r.dirty=!0)}s(nv,"updateHover");function L6(e,t,r){return t?"grabbing":e?"pointer":r?"grabbing":"grab"}s(L6,"processCursor");f();f();f();function Il(e){"@babel/helpers - typeof";return Il=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},Il(e)}s(Il,"_typeof");var O6=/^\s+/,D6=/\s+$/;function F(e,t){if(e=e||"",t=t||{},e instanceof F)return e;if(!(this instanceof F))return new F(e,t);var r=A6(e);this._originalInput=e,this._r=r.r,this._g=r.g,this._b=r.b,this._a=r.a,this._roundA=Math.round(100*this._a)/100,this._format=t.format||r.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=r.ok}s(F,"tinycolor");F.prototype={isDark:s(function(){return this.getBrightness()<128},"isDark"),isLight:s(function(){return!this.isDark()},"isLight"),isValid:s(function(){return this._ok},"isValid"),getOriginalInput:s(function(){return this._originalInput},"getOriginalInput"),getFormat:s(function(){return this._format},"getFormat"),getAlpha:s(function(){return this._a},"getAlpha"),getBrightness:s(function(){var t=this.toRgb();return(t.r*299+t.g*587+t.b*114)/1e3},"getBrightness"),getLuminance:s(function(){var t=this.toRgb(),r,i,n,o,a,l;return r=t.r/255,i=t.g/255,n=t.b/255,r<=.03928?o=r/12.92:o=Math.pow((r+.055)/1.055,2.4),i<=.03928?a=i/12.92:a=Math.pow((i+.055)/1.055,2.4),n<=.03928?l=n/12.92:l=Math.pow((n+.055)/1.055,2.4),.2126*o+.7152*a+.0722*l},"getLuminance"),setAlpha:s(function(t){return this._a=pv(t),this._roundA=Math.round(100*this._a)/100,this},"setAlpha"),toHsv:s(function(){var t=av(this._r,this._g,this._b);return{h:t.h*360,s:t.s,v:t.v,a:this._a}},"toHsv"),toHsvString:s(function(){var t=av(this._r,this._g,this._b),r=Math.round(t.h*360),i=Math.round(t.s*100),n=Math.round(t.v*100);return this._a==1?"hsv("+r+", "+i+"%, "+n+"%)":"hsva("+r+", "+i+"%, "+n+"%, "+this._roundA+")"},"toHsvString"),toHsl:s(function(){var t=ov(this._r,this._g,this._b);return{h:t.h*360,s:t.s,l:t.l,a:this._a}},"toHsl"),toHslString:s(function(){var t=ov(this._r,this._g,this._b),r=Math.round(t.h*360),i=Math.round(t.s*100),n=Math.round(t.l*100);return this._a==1?"hsl("+r+", "+i+"%, "+n+"%)":"hsla("+r+", "+i+"%, "+n+"%, "+this._roundA+")"},"toHslString"),toHex:s(function(t){return sv(this._r,this._g,this._b,t)},"toHex"),toHexString:s(function(t){return"#"+this.toHex(t)},"toHexString"),toHex8:s(function(t){return F6(this._r,this._g,this._b,this._a,t)},"toHex8"),toHex8String:s(function(t){return"#"+this.toHex8(t)},"toHex8String"),toRgb:s(function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},"toRgb"),toRgbString:s(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:s(function(){return{r:Math.round(pt(this._r,255)*100)+"%",g:Math.round(pt(this._g,255)*100)+"%",b:Math.round(pt(this._b,255)*100)+"%",a:this._a}},"toPercentageRgb"),toPercentageRgbString:s(function(){return this._a==1?"rgb("+Math.round(pt(this._r,255)*100)+"%, "+Math.round(pt(this._g,255)*100)+"%, "+Math.round(pt(this._b,255)*100)+"%)":"rgba("+Math.round(pt(this._r,255)*100)+"%, "+Math.round(pt(this._g,255)*100)+"%, "+Math.round(pt(this._b,255)*100)+"%, "+this._roundA+")"},"toPercentageRgbString"),toName:s(function(){return this._a===0?"transparent":this._a<1?!1:q6[sv(this._r,this._g,this._b,!0)]||!1},"toName"),toFilter:s(function(t){var r="#"+lv(this._r,this._g,this._b,this._a),i=r,n=this._gradientType?"GradientType = 1, ":"";if(t){var o=F(t);i="#"+lv(o._r,o._g,o._b,o._a)}return"progid:DXImageTransform.Microsoft.gradient("+n+"startColorstr="+r+",endColorstr="+i+")"},"toFilter"),toString:s(function(t){var r=!!t;t=t||this._format;var i=!1,n=this._a<1&&this._a>=0,o=!r&&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:s(function(){return F(this.toString())},"clone"),_applyModification:s(function(t,r){var i=t.apply(null,[this].concat([].slice.call(r)));return this._r=i._r,this._g=i._g,this._b=i._b,this.setAlpha(i._a),this},"_applyModification"),lighten:s(function(){return this._applyModification(H6,arguments)},"lighten"),brighten:s(function(){return this._applyModification(X6,arguments)},"brighten"),darken:s(function(){return this._applyModification(Y6,arguments)},"darken"),desaturate:s(function(){return this._applyModification(B6,arguments)},"desaturate"),saturate:s(function(){return this._applyModification(G6,arguments)},"saturate"),greyscale:s(function(){return this._applyModification(V6,arguments)},"greyscale"),spin:s(function(){return this._applyModification(j6,arguments)},"spin"),_applyCombination:s(function(t,r){return t.apply(null,[this].concat([].slice.call(r)))},"_applyCombination"),analogous:s(function(){return this._applyCombination(z6,arguments)},"analogous"),complement:s(function(){return this._applyCombination(W6,arguments)},"complement"),monochromatic:s(function(){return this._applyCombination(Z6,arguments)},"monochromatic"),splitcomplement:s(function(){return this._applyCombination(U6,arguments)},"splitcomplement"),triad:s(function(){return this._applyCombination(cv,[3])},"triad"),tetrad:s(function(){return this._applyCombination(cv,[4])},"tetrad")};F.fromRatio=function(e,t){if(Il(e)=="object"){var r={};for(var i in e)e.hasOwnProperty(i)&&(i==="a"?r[i]=e[i]:r[i]=Ko(e[i]));e=r}return F(e,t)};function A6(e){var t={r:0,g:0,b:0},r=1,i=null,n=null,o=null,a=!1,l=!1;return typeof e=="string"&&(e=Q6(e)),Il(e)=="object"&&(pr(e.r)&&pr(e.g)&&pr(e.b)?(t=N6(e.r,e.g,e.b),a=!0,l=String(e.r).substr(-1)==="%"?"prgb":"rgb"):pr(e.h)&&pr(e.s)&&pr(e.v)?(i=Ko(e.s),n=Ko(e.v),t=k6(e.h,i,n),a=!0,l="hsv"):pr(e.h)&&pr(e.s)&&pr(e.l)&&(i=Ko(e.s),o=Ko(e.l),t=R6(e.h,i,o),a=!0,l="hsl"),e.hasOwnProperty("a")&&(r=e.a)),r=pv(r),{ok:a,format:e.format||l,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:r}}s(A6,"inputToRGB");function N6(e,t,r){return{r:pt(e,255)*255,g:pt(t,255)*255,b:pt(r,255)*255}}s(N6,"rgbToRgb");function ov(e,t,r){e=pt(e,255),t=pt(t,255),r=pt(r,255);var i=Math.max(e,t,r),n=Math.min(e,t,r),o,a,l=(i+n)/2;if(i==n)o=a=0;else{var c=i-n;switch(a=l>.5?c/(2-i-n):c/(i+n),i){case e:o=(t-r)/c+(t<r?6:0);break;case t:o=(r-e)/c+2;break;case r:o=(e-t)/c+4;break}o/=6}return{h:o,s:a,l}}s(ov,"rgbToHsl");function R6(e,t,r){var i,n,o;e=pt(e,360),t=pt(t,100),r=pt(r,100);function a(h,d,m){return m<0&&(m+=1),m>1&&(m-=1),m<1/6?h+(d-h)*6*m:m<1/2?d:m<2/3?h+(d-h)*(2/3-m)*6:h}if(s(a,"hue2rgb"),t===0)i=n=o=r;else{var l=r<.5?r*(1+t):r+t-r*t,c=2*r-l;i=a(c,l,e+1/3),n=a(c,l,e),o=a(c,l,e-1/3)}return{r:i*255,g:n*255,b:o*255}}s(R6,"hslToRgb");function av(e,t,r){e=pt(e,255),t=pt(t,255),r=pt(r,255);var i=Math.max(e,t,r),n=Math.min(e,t,r),o,a,l=i,c=i-n;if(a=i===0?0:c/i,i==n)o=0;else{switch(i){case e:o=(t-r)/c+(t<r?6:0);break;case t:o=(r-e)/c+2;break;case r:o=(e-t)/c+4;break}o/=6}return{h:o,s:a,v:l}}s(av,"rgbToHsv");function k6(e,t,r){e=pt(e,360)*6,t=pt(t,100),r=pt(r,100);var i=Math.floor(e),n=e-i,o=r*(1-t),a=r*(1-n*t),l=r*(1-(1-n)*t),c=i%6,h=[r,a,o,o,l,r][c],d=[l,r,r,a,o,o][c],m=[o,o,l,r,r,a][c];return{r:h*255,g:d*255,b:m*255}}s(k6,"hsvToRgb");function sv(e,t,r,i){var n=[Le(Math.round(e).toString(16)),Le(Math.round(t).toString(16)),Le(Math.round(r).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("")}s(sv,"rgbToHex");function F6(e,t,r,i,n){var o=[Le(Math.round(e).toString(16)),Le(Math.round(t).toString(16)),Le(Math.round(r).toString(16)),Le(hv(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("")}s(F6,"rgbaToHex");function lv(e,t,r,i){var n=[Le(hv(i)),Le(Math.round(e).toString(16)),Le(Math.round(t).toString(16)),Le(Math.round(r).toString(16))];return n.join("")}s(lv,"rgbaToArgbHex");F.equals=function(e,t){return!e||!t?!1:F(e).toRgbString()==F(t).toRgbString()};F.random=function(){return F.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function B6(e,t){t=t===0?0:t||10;var r=F(e).toHsl();return r.s-=t/100,r.s=El(r.s),F(r)}s(B6,"_desaturate");function G6(e,t){t=t===0?0:t||10;var r=F(e).toHsl();return r.s+=t/100,r.s=El(r.s),F(r)}s(G6,"_saturate");function V6(e){return F(e).desaturate(100)}s(V6,"_greyscale");function H6(e,t){t=t===0?0:t||10;var r=F(e).toHsl();return r.l+=t/100,r.l=El(r.l),F(r)}s(H6,"_lighten");function X6(e,t){t=t===0?0:t||10;var r=F(e).toRgb();return r.r=Math.max(0,Math.min(255,r.r-Math.round(255*-(t/100)))),r.g=Math.max(0,Math.min(255,r.g-Math.round(255*-(t/100)))),r.b=Math.max(0,Math.min(255,r.b-Math.round(255*-(t/100)))),F(r)}s(X6,"_brighten");function Y6(e,t){t=t===0?0:t||10;var r=F(e).toHsl();return r.l-=t/100,r.l=El(r.l),F(r)}s(Y6,"_darken");function j6(e,t){var r=F(e).toHsl(),i=(r.h+t)%360;return r.h=i<0?360+i:i,F(r)}s(j6,"_spin");function W6(e){var t=F(e).toHsl();return t.h=(t.h+180)%360,F(t)}s(W6,"_complement");function cv(e,t){if(isNaN(t)||t<=0)throw new Error("Argument to polyad must be a positive number");for(var r=F(e).toHsl(),i=[F(e)],n=360/t,o=1;o<t;o++)i.push(F({h:(r.h+o*n)%360,s:r.s,l:r.l}));return i}s(cv,"polyad");function U6(e){var t=F(e).toHsl(),r=t.h;return[F(e),F({h:(r+72)%360,s:t.s,l:t.l}),F({h:(r+216)%360,s:t.s,l:t.l})]}s(U6,"_splitcomplement");function z6(e,t,r){t=t||6,r=r||30;var i=F(e).toHsl(),n=360/r,o=[F(e)];for(i.h=(i.h-(n*t>>1)+720)%360;--t;)i.h=(i.h+n)%360,o.push(F(i));return o}s(z6,"_analogous");function Z6(e,t){t=t||6;for(var r=F(e).toHsv(),i=r.h,n=r.s,o=r.v,a=[],l=1/t;t--;)a.push(F({h:i,s:n,v:o})),o=(o+l)%1;return a}s(Z6,"_monochromatic");F.mix=function(e,t,r){r=r===0?0:r||50;var i=F(e).toRgb(),n=F(t).toRgb(),o=r/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(e,t){var r=F(e),i=F(t);return(Math.max(r.getLuminance(),i.getLuminance())+.05)/(Math.min(r.getLuminance(),i.getLuminance())+.05)};F.isReadable=function(e,t,r){var i=F.readability(e,t),n,o;switch(o=!1,n=t8(r),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(e,t,r){var i=null,n=0,o,a,l,c;r=r||{},a=r.includeFallbackColors,l=r.level,c=r.size;for(var h=0;h<t.length;h++)o=F.readability(e,t[h]),o>n&&(n=o,i=F(t[h]));return F.isReadable(e,i,{level:l,size:c})||!a?i:(r.includeFallbackColors=!1,F.mostReadable(e,["#fff","#000"],r))};var Nh=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"},q6=F.hexNames=$6(Nh);function $6(e){var t={};for(var r in e)e.hasOwnProperty(r)&&(t[e[r]]=r);return t}s($6,"flip");function pv(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}s(pv,"boundAlpha");function pt(e,t){J6(e)&&(e="100%");var r=K6(e);return e=Math.min(t,Math.max(0,parseFloat(e))),r&&(e=parseInt(e*t,10)/100),Math.abs(e-t)<1e-6?1:e%t/parseFloat(t)}s(pt,"bound01");function El(e){return Math.min(1,Math.max(0,e))}s(El,"clamp01");function ce(e){return parseInt(e,16)}s(ce,"parseIntFromHex");function J6(e){return typeof e=="string"&&e.indexOf(".")!=-1&&parseFloat(e)===1}s(J6,"isOnePointZero");function K6(e){return typeof e=="string"&&e.indexOf("%")!=-1}s(K6,"isPercentage");function Le(e){return e.length==1?"0"+e:""+e}s(Le,"pad2");function Ko(e){return e<=1&&(e=e*100+"%"),e}s(Ko,"convertToPercentage");function hv(e){return Math.round(parseFloat(e)*255).toString(16)}s(hv,"convertDecimalToHex");function uv(e){return ce(e)/255}s(uv,"convertHexToDecimal");var _e=function(){var e="[-\\+]?\\d+%?",t="[-\\+]?\\d*\\.\\d+%?",r="(?:"+t+")|(?:"+e+")",i="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?",n="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?";return{CSS_UNIT:new RegExp(r),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 pr(e){return!!_e.CSS_UNIT.exec(e)}s(pr,"isValidCSSUnit");function Q6(e){e=e.replace(O6,"").replace(D6,"").toLowerCase();var t=!1;if(Nh[e])e=Nh[e],t=!0;else if(e=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var r;return(r=_e.rgb.exec(e))?{r:r[1],g:r[2],b:r[3]}:(r=_e.rgba.exec(e))?{r:r[1],g:r[2],b:r[3],a:r[4]}:(r=_e.hsl.exec(e))?{h:r[1],s:r[2],l:r[3]}:(r=_e.hsla.exec(e))?{h:r[1],s:r[2],l:r[3],a:r[4]}:(r=_e.hsv.exec(e))?{h:r[1],s:r[2],v:r[3]}:(r=_e.hsva.exec(e))?{h:r[1],s:r[2],v:r[3],a:r[4]}:(r=_e.hex8.exec(e))?{r:ce(r[1]),g:ce(r[2]),b:ce(r[3]),a:uv(r[4]),format:t?"name":"hex8"}:(r=_e.hex6.exec(e))?{r:ce(r[1]),g:ce(r[2]),b:ce(r[3]),format:t?"name":"hex"}:(r=_e.hex4.exec(e))?{r:ce(r[1]+""+r[1]),g:ce(r[2]+""+r[2]),b:ce(r[3]+""+r[3]),a:uv(r[4]+""+r[4]),format:t?"name":"hex8"}:(r=_e.hex3.exec(e))?{r:ce(r[1]+""+r[1]),g:ce(r[2]+""+r[2]),b:ce(r[3]+""+r[3]),format:t?"name":"hex"}:!1}s(Q6,"stringInputToObject");function t8(e){var t,r;return e=e||{level:"AA",size:"small"},t=(e.level||"AA").toUpperCase(),r=(e.size||"small").toLowerCase(),t!=="AA"&&t!=="AAA"&&(t="AA"),r!=="small"&&r!=="large"&&(r="small"),{level:t,size:r}}s(t8,"validateWCAG2Parms");var Uh=Cr(Yv());var Nn={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}}},U9={lightOnDark:{...Nn,text:{...Nn.text,foregroundColor:"white",backgroundColor:"#333"},marker:{...Nn.marker,foregroundColor:{active:"white",inactive:void 0},backgroundColor:{active:"#333",inactive:void 0}}},darkOnLight:{...Nn,text:{...Nn.text,foregroundColor:"#333",backgroundColor:"white"},marker:{...Nn.marker,foregroundColor:{active:"#333",inactive:void 0},backgroundColor:{active:"white",inactive:void 0}}}},z9="LOW_PRIORITY",jv=4,Z9=6,q9=20,$9=2.5,J9=2,K9="cover",Wv=.5,Q9=6.5,Uv={heightAbovePolygon:0,appearance:U9.darkOnLight};var Mi=class Mi{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 W;_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,r,i){var o,a;if(this.id=(o=r.id)!=null?o:vt(),this.options=(0,Uh.default)({},r,Uv),this.text=t,this.dp=(l=1)=>l*i.pixelRatio,typeof r.rank=="string")this.rank=_n(r.rank),this.initialRank=this.rank;else if(r.rank!=null&&r.rank>0)this.rank=r.rank,this.initialRank=r.rank;else{let l=Math.trunc(b.env.NODE_ENV==="test"?Mi.testId:Mi.testId*10)/10;Mi.testId+=.001,this.rank=l,this.initialRank=l}let n=(0,Uh.default)({},this.options.appearance,Uv.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||q9,iconPadding:(a=n.marker.iconPadding)!=null?a:J9,iconFit:n.marker.iconFit||K9,iconVisibilityThreshold:n.marker.iconVisibilityThreshold==null?Wv:n.marker.iconVisibilityThreshold}},this.calculateMarkerSize()}calculateMarkerSize(){let{iconVisibilityThreshold:t=Wv}=this.appearance.marker,r=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(Q9)),this.totalMarkerSize=Math.ceil((this.markerSize+$9)/r)}get strategies(){let{width:t,height:r}=this.dimensions,{margin:i}=this.appearance;this.calculateMarkerSize();let n=Math.max(Z9,i),o=this.iconVisible?n/2:0,a=[{name:"RIGHT",getBoundingBox:()=>{let l=Math.max(this.totalMarkerSize,r);return[l/2+n,l/2+n,this.totalMarkerSize/2+n,this.totalMarkerSize/2+t+n]},onStrategySelected:()=>{this.newStyle.textAlign="left",this.newStyle.pinVisibility=1,this.newStyle.top=-r/2,this.newStyle.left=this.totalMarkerSize/2+jv,this.newStyle.textLabelVisible=!0}},{name:"LEFT",getBoundingBox:()=>{let l=Math.max(this.totalMarkerSize,r);return[l/2+n,l/2+n,this.totalMarkerSize/2+t+n,this.totalMarkerSize/2+n]},onStrategySelected:()=>{this.newStyle.textAlign="right",this.newStyle.pinVisibility=1,this.newStyle.top=-r/2,this.newStyle.left=-t-this.totalMarkerSize/2-jv,this.newStyle.textLabelVisible=!0}},{name:"TOP",getBoundingBox:()=>{let l=this.dp();return[r+this.totalMarkerSize/2/l+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-r/2,this.newStyle.left=-t/2}},{name:z9,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 r=this.strategies[t];r&&r.onStrategySelected(this),this.currentStrategyIndex=t;let i=this.style;this.style=this.newStyle,this.newStyle=i,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,r)=>({index:r,boundingBox:t.getBoundingBox()})),shouldCollideWithScreenEdges:!1}}destroy(){}};s(Mi,"LabelComponent"),v(Mi,"testId",0);var zh=Mi,je=zh;f();var na,oa,Zh=class Zh{constructor(t){v(this,"mesh");v(this,"outline");v(this,"type","geometry");v(this,"instanceIndex",-1);v(this,"geometry");v(this,"material");v(this,"feature");v(this,"color",new Mt);v(this,"topColor",new Mt);v(this,"position",new Y);w(this,na,0);w(this,oa,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)}setOutlineColor(t){if(!this.outline||!this.outline.material)return;let r=Array.isArray(this.outline.material)?this.outline.material:[this.outline.material];for(let i of r)i.color.set(t),i.needsUpdate=!0}setColor(t,r){this.color.set(t),this.topColor.set(r),this.material&&(this.material.setColor(this.instanceIndex,this.color,this.topColor),this.material.needsColorUpdate=!0)}get altitude(){return u(this,na)}set altitude(t){this.mesh&&(this.mesh.position.z=t,E(this,na,t))}get opacity(){return u(this,oa)}set opacity(t){var r,i;if(this.material){((r=this.material.userData)==null?void 0:r.originalOpacity)===void 0&&(this.material.userData={...this.material.userData,originalOpacity:this.material.opacity});let n=Ut(t,0,(i=this.material.userData)==null?void 0:i.originalOpacity,0,1);this.material.opacity=n,this.material.transparent=n<1,this.outline&&(this.outline.visible=n>.5),this.material.needsUpdate=!0}E(this,oa,t)}};na=new WeakMap,oa=new WeakMap,s(Zh,"MeshComponent");var We=Zh;var qh=class qh extends st{constructor(){super()}interpolators=new Map;addEntity3D(t,r){let[i,n,o,a]=r[1];this.interpolators.set(t,l=>Ut(l,i,n,o,a))}addEntity2D(t,r){let[i,n,o]=r[1];this.interpolators.set(t,a=>a<i?n:o)}addAny(t,r){this.interpolators.set(t,r)}update=t=>{for(let[r,i]of this.interpolators)r instanceof We?r.setOpacity(i(t)):r instanceof je?r.enabled=i(t):i(t)};destroy(){this.interpolators.clear()}};s(qh,"ZoomInterpolationSystem");var Fl=qh;f();var wi=class wi{id;type="marker";rank=0;initialRank=0;options={};projection=new W;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,r={}){if(this.id=(r==null?void 0:r.id)||vt(),this.options=r,typeof r.rank=="string")this.rank=_n(r.rank);else if(r.rank!=null&&r.rank>0)this.rank=r.rank;else{let n=Math.trunc(b.env.NODE_ENV==="test"?wi.testId:wi.testId*10)/10;wi.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,r){if(t!=null&&r!=null)this.dimensions={width:t,height:r};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,r=!1)=>{if(this.currentStrategyIndex===t||r)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:r}=this.dimensions;return[{name:"center",getBoundingBox:()=>{let i=r/2,n=r/2,o=t/2,a=t/2;switch(this.options.anchor){case"top":{i=r,n=0;break}case"bottom":{i=0,n=r;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,r)=>({index:r,boundingBox:t.getBoundingBox()})),shouldCollideWithScreenEdges:!1}}destroy(){}};s(wi,"MarkerComponent"),v(wi,"testId",0);var de=wi;f();f();f();f();f();var $h=class $h{hover=!1;dirty=!1};s($h,"InteractionComponent");var aa=$h;function Ue(e,t,r){if(t!==void 0){if(e.type==="model"||e.type==="path"||e.type==="marker"||e.type==="label"||e.type==="geometry")return t===!0?(e instanceof Ee&&e.components[1]===void 0&&(e.components[1]=new aa,e.components[1].dirty=!0),e instanceof St&&e.components[2]===void 0&&(e.components[2]=new aa,e.components[2].dirty=!0),!0):(e instanceof Ee?e.components[1]=void 0:e instanceof St&&(e.components[2]=void 0),!0);if(e.type==="geometry-group"){let i;for(let n of e.userData.entities3D.values())i=r.entity3DMap.get(n),Ue(i,t,r);return!0}}return!1}s(Ue,"updateInteractivity");function zv(e,t){t!==void 0&&(e.type==="path"||e.type==="geometry")&&(t.color!==void 0&&(e.components[1].color=t.color),t.topColor!==void 0&&(e.components[1].topColor=t.topColor),e.components[1].dirty=!0)}s(zv,"updateColor");function Jh(e,t,r){t!==void 0&&(e.type==="label"||e.type==="marker"?(e.object3d.position.copy(r(t[1],t[0],t[2]||0)),e.positionDirty=!0):e.type==="custom-geometry"&&e.components[0].position.copy(r(t[1],t[0],t[2]||0)))}s(Jh,"updatePosition");function Kh(e,t){var r;return t!==void 0&&(e.type==="marker"||e.type==="label"||e.type==="custom-geometry")&&e.parent!==t?((r=e.parent)==null||r.removeEntity(e),t.addEntity(e),!0):!1}s(Kh,"updateParent");function Zv(e,t){t!==void 0&&(e.type==="marker"||e.type==="label")&&(e.components[0].enabled=t)}s(Zv,"updateEnabled");function qv(e,t){if(t!==void 0&&e.type==="path"){let r=e.components[0];t.completeFraction!==void 0&&(r.completeFraction=t.completeFraction)}}s(qv,"updatePath");function $v(e,t){if(t!==void 0&&e.type==="marker"){let r=e.components[0];if(t.contentHTML!==void 0)return r.containerEl.innerHTML=t.contentHTML,!0}return!1}s($v,"updateMarker");function Jv(e,t){return t!==void 0&&(e.type==="marker"||e.type==="label")?(e.components[0].rank=_n(t),!0):!1}s(Jv,"updateRank");function Kv(e,t){var r,i,n;if(t!==void 0&&e.type==="label"){let o=e.components[0];t.text!==void 0&&(o.text=t.text,o.dirty=!0),((r=t.options)==null?void 0:r.appearance)!==void 0&&Object.keys((i=t.options)==null?void 0:i.appearance).length>0&&(wh(o.appearance,((n=t.options)==null?void 0:n.appearance)||{}),o.dirty=!0)}}s(Kv,"updateLabel");function Qv(e,t){t!==void 0&&e.type==="geometry"&&(e.components[1].hoverColor=t,e.components[1].dirty=!0)}s(Qv,"updateHoverColor");function Rn(e,t){return t!==void 0?(e.type==="model"||e.type==="path"||e.type==="geometry"||e.type==="custom-geometry"?(e.components[1].visible=t,e.components[1].dirty=!0):(e.type==="group-container"||e.type==="geometry-group")&&e.setVisible(t),!0):!1}s(Rn,"updateVisibility");function tb(e,t,r){if(r!==void 0&&e.type==="geometry-group"){e.setOpacity(r);for(let i of e.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=r,n.components[1].dirty=!0)}}}s(tb,"updateOpacity");function Qh(e,t){t!==void 0&&(e.type==="model"||e.type==="path"||e.type==="geometry"||e.type==="custom-geometry"?(e.components[1].altitude=t,e.components[1].dirty=!0):e.type==="group-container"&&e.setAltitude(t))}s(Qh,"updateAltitude");var Ti,ze,Bl,Gl,eb,la,Vl,Hl,rb,Xl,ib,ca,Yl,ua,pa,jl,ef=class ef{constructor(t){w(this,Gl);w(this,Hl);w(this,Xl);w(this,Ti,null);w(this,ze,void 0);v(this,"getCurrentSceneGLTF",async t=>{let r={onlyVisible:!0,binary:!0,light:!0,scale:1,...t},i=await j(this,Gl,eb).call(this),n=u(this,Bl).call(this,r),o=await i.parseAsync(n,{trs:!1,maxTextureSize:1/0,onlyVisible:r.onlyVisible,binary:r.binary,scale:r.scale}),a;if(o instanceof ArrayBuffer)a=new Blob([o],{type:"application/octet-stream"});else{let l=JSON.stringify(o,null,2);a=new Blob([l],{type:"text/plain"})}return a});w(this,Bl,s(t=>{let{scale:r,light:i,onlyVisible:n}=t,o=new us,a=new Ne().setFromObject(u(this,ze).entityScene);if(u(this,la).call(this,u(this,ze).entityScene,o,n),i){let l=new fs(16777215,.3*Math.PI);l.position.set(0,Math.max(a.max.x,a.max.y)*r*.5,a.max.y*r*4),l.lookAt(0,0,-1),l.target.position.set(0,0,-1),l.add(l.target),o.add(l)}return o},"#getExportedScene"));w(this,la,s((t,r,i)=>{t.material&&(t instanceof hs?j(this,Hl,rb).call(this,t).forEach(n=>r.add(n)):t instanceof oo&&r.add(j(this,Xl,ib).call(this,t))),t.children.forEach(n=>{(!i||n.visible)&&u(this,la).call(this,n,r,i)})},"#processObject3D"));w(this,Vl,s((t,r,i)=>{let n=new um({color:new Mt(t),metalness:0});return n.opacity=r,n.transparent=i,n},"#createStandardMaterial"));w(this,ca,s(t=>{let{geometry:r,material:i,position:n,rotation:o,quaternion:a,scale:l}=t;if(!(r!=null&&r.isBufferGeometry))return t;let c=r.attributes.position,h=r.attributes.normal,d=r.attributes.uv;return u(this,Yl).call(this,c,h),u(this,pa).call(this,n,l,o,a),d&&u(this,jl).call(this,d),i!=null&&i.map&&r.type==="PlaneGeometry"&&(t.side=eo),t},"#convertGeometry"));w(this,Yl,s((t,r)=>{let i=new Y,n=new Y;for(let o=0;o<t.count;o++)i.fromBufferAttribute(t,o),u(this,ua).call(this,i),t.setXYZ(o,i.x,i.y,i.z),r&&(n.fromBufferAttribute(r,o),u(this,ua).call(this,n),r.setXYZ(o,n.x,n.y,n.z))},"#convertAttributes"));w(this,ua,s(t=>{let r=t.y;t.y=t.z,t.z=-r},"#convertVector"));w(this,pa,s((t,r,i,n)=>{let o=t.y;t.y=t.z,t.z=-o;let a=r.y;if(r.y=r.z,r.z=a,i instanceof qi)i.order="YXZ",i.set(i.x,i.y,i.z,i.order);else{let l=n.y;n.set(n.x,n.z,-l,n.w)}},"#convertObjectProperties"));w(this,jl,s(t=>{for(let r=0;r<t.count;r++){let i=t.getX(r),n=t.getY(r);t.setXY(r,i,n)}},"#convertUVs"));E(this,ze,t),u(this,ze).entityScene=t.entityScene,u(this,ze).entity3DMap=t.entity3DMap}destroy(){E(this,Ti,null)}};Ti=new WeakMap,ze=new WeakMap,Bl=new WeakMap,Gl=new WeakSet,eb=s(async function(){if(!u(this,Ti)){let{GLTFExporter:t}=await import("./GLTFExporter-TMSWNHZO.js");E(this,Ti,new t)}return u(this,Ti)},"#getGLTFExporter"),la=new WeakMap,Vl=new WeakMap,Hl=new WeakSet,rb=s(function(t){var a,l;let r=[],n=((a=t.userData)!=null&&a.entities?Object.values((l=t.userData)==null?void 0:l.entities):[]).map(c=>u(this,ze).entity3DMap.get(c)),o=new Map;return n.forEach(c=>{var x;if(!c||!(c instanceof St))return;let h=c.components[1],d=c.components[2];if(!h.visible||h.opacity===0)return;let y=`${d!=null&&d.hover?h.hoverColor||u(this,ze).hoverColor:h.color}-${h.opacity}-${Number(h.visible)}`;o.has(y)||o.set(y,[]),(x=o.get(y))==null||x.push(c)}),o.forEach((c,h)=>{let[d,m,y]=h.split("-"),x=c.reduce((C,T)=>{let M=T.components[0];if(M.type==="custom-geometry")return C;let I=M==null?void 0:M.geometry;return I&&C.push(I),C},[]),S=u(this,Vl).call(this,d,Number(m),t.material.transparent),P=Mr(x,!0),g=new Ft(P,S);g.position.copy(t.position),g.rotation.copy(t.rotation),g.scale.copy(t.scale),g.visible=!!y,u(this,pa).call(this,g.position,g.scale,g.rotation,g.quaternion),r.push(u(this,ca).call(this,g))}),r},"#processBatchedMesh"),Xl=new WeakSet,ib=s(function(t){let r=t.geometry.clone(),i=t.material,n=new xr({color:i.color,side:eo});n.opacity=i.opacity,n.transparent=i.transparent;let o=new oo(r,n);return o.position.copy(t.position),o.rotation.copy(t.rotation),o.scale.copy(t.scale),o.visible=t.visible,u(this,ca).call(this,o)},"#processLineSegments"),ca=new WeakMap,Yl=new WeakMap,ua=new WeakMap,pa=new WeakMap,jl=new WeakMap,s(ef,"ExporterSystem");var sa=ef;f();var nb="#ffffff";var rf=class rf{initialColor=nb;color=nb;topColor;hoverColor;dirty=!0;visible=!0;opacity=1;width=.1;height=.1;altitude=0;join="round";cap="round";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}};s(rf,"StyleComponent");var jr=rf;f();f();f();f();var Wl={top:0,bottom:0,left:0,right:0};f();f();f();f();var nf=class nf extends om{_width;_height;constructor(t){let i=t;super(new Float32Array(t*8),2,t,qd,Zd),this._width=8,this._height=i}setColor(t,r,i){let n=this.image.data,o=t*8;n[o]=r.r,n[o+1]=r.g,n[o+2]=r.b,n[o+4]=i.r,n[o+5]=i.g,n[o+6]=i.b,this.needsUpdate=!0}};s(nf,"BatchedPropertiesTexture");var Ul=nf;var ob=`#define LAMBERT
11
+ 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}};Fn=new WeakMap,s(Hh,"InteractionSystem");var na=Hh;function y3(r,t){let e=r.components[2];e&&(e.hover=t,e.dirty=!0)}s(y3,"updateHover");function z8(r,t,e){return t?"grabbing":r?"pointer":e?"grabbing":"grab"}s(z8,"processCursor");d();d();d();function Nl(r){"@babel/helpers - typeof";return Nl=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},Nl(r)}s(Nl,"_typeof");var q8=/^\s+/,$8=/\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=J8(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}s(F,"tinycolor");F.prototype={isDark:s(function(){return this.getBrightness()<128},"isDark"),isLight:s(function(){return!this.isDark()},"isLight"),isValid:s(function(){return this._ok},"isValid"),getOriginalInput:s(function(){return this._originalInput},"getOriginalInput"),getFormat:s(function(){return this._format},"getFormat"),getAlpha:s(function(){return this._a},"getAlpha"),getBrightness:s(function(){var t=this.toRgb();return(t.r*299+t.g*587+t.b*114)/1e3},"getBrightness"),getLuminance:s(function(){var t=this.toRgb(),e,i,n,o,a,l;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?l=n/12.92:l=Math.pow((n+.055)/1.055,2.4),.2126*o+.7152*a+.0722*l},"getLuminance"),setAlpha:s(function(t){return this._a=P3(t),this._roundA=Math.round(100*this._a)/100,this},"setAlpha"),toHsv:s(function(){var t=v3(this._r,this._g,this._b);return{h:t.h*360,s:t.s,v:t.v,a:this._a}},"toHsv"),toHsvString:s(function(){var t=v3(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:s(function(){var t=g3(this._r,this._g,this._b);return{h:t.h*360,s:t.s,l:t.l,a:this._a}},"toHsl"),toHslString:s(function(){var t=g3(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:s(function(t){return b3(this._r,this._g,this._b,t)},"toHex"),toHexString:s(function(t){return"#"+this.toHex(t)},"toHexString"),toHex8:s(function(t){return eC(this._r,this._g,this._b,this._a,t)},"toHex8"),toHex8String:s(function(t){return"#"+this.toHex8(t)},"toHex8String"),toRgb:s(function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},"toRgb"),toRgbString:s(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:s(function(){return{r:Math.round(pt(this._r,255)*100)+"%",g:Math.round(pt(this._g,255)*100)+"%",b:Math.round(pt(this._b,255)*100)+"%",a:this._a}},"toPercentageRgb"),toPercentageRgbString:s(function(){return this._a==1?"rgb("+Math.round(pt(this._r,255)*100)+"%, "+Math.round(pt(this._g,255)*100)+"%, "+Math.round(pt(this._b,255)*100)+"%)":"rgba("+Math.round(pt(this._r,255)*100)+"%, "+Math.round(pt(this._g,255)*100)+"%, "+Math.round(pt(this._b,255)*100)+"%, "+this._roundA+")"},"toPercentageRgbString"),toName:s(function(){return this._a===0?"transparent":this._a<1?!1:dC[b3(this._r,this._g,this._b,!0)]||!1},"toName"),toFilter:s(function(t){var e="#"+C3(this._r,this._g,this._b,this._a),i=e,n=this._gradientType?"GradientType = 1, ":"";if(t){var o=F(t);i="#"+C3(o._r,o._g,o._b,o._a)}return"progid:DXImageTransform.Microsoft.gradient("+n+"startColorstr="+e+",endColorstr="+i+")"},"toFilter"),toString:s(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:s(function(){return F(this.toString())},"clone"),_applyModification:s(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:s(function(){return this._applyModification(oC,arguments)},"lighten"),brighten:s(function(){return this._applyModification(aC,arguments)},"brighten"),darken:s(function(){return this._applyModification(sC,arguments)},"darken"),desaturate:s(function(){return this._applyModification(rC,arguments)},"desaturate"),saturate:s(function(){return this._applyModification(iC,arguments)},"saturate"),greyscale:s(function(){return this._applyModification(nC,arguments)},"greyscale"),spin:s(function(){return this._applyModification(lC,arguments)},"spin"),_applyCombination:s(function(t,e){return t.apply(null,[this].concat([].slice.call(e)))},"_applyCombination"),analogous:s(function(){return this._applyCombination(pC,arguments)},"analogous"),complement:s(function(){return this._applyCombination(uC,arguments)},"complement"),monochromatic:s(function(){return this._applyCombination(hC,arguments)},"monochromatic"),splitcomplement:s(function(){return this._applyCombination(cC,arguments)},"splitcomplement"),triad:s(function(){return this._applyCombination(x3,[3])},"triad"),tetrad:s(function(){return this._applyCombination(x3,[4])},"tetrad")};F.fromRatio=function(r,t){if(Nl(r)=="object"){var e={};for(var i in r)r.hasOwnProperty(i)&&(i==="a"?e[i]=r[i]:e[i]=oa(r[i]));r=e}return F(r,t)};function J8(r){var t={r:0,g:0,b:0},e=1,i=null,n=null,o=null,a=!1,l=!1;return typeof r=="string"&&(r=gC(r)),Nl(r)=="object"&&(yr(r.r)&&yr(r.g)&&yr(r.b)?(t=K8(r.r,r.g,r.b),a=!0,l=String(r.r).substr(-1)==="%"?"prgb":"rgb"):yr(r.h)&&yr(r.s)&&yr(r.v)?(i=oa(r.s),n=oa(r.v),t=tC(r.h,i,n),a=!0,l="hsv"):yr(r.h)&&yr(r.s)&&yr(r.l)&&(i=oa(r.s),o=oa(r.l),t=Q8(r.h,i,o),a=!0,l="hsl"),r.hasOwnProperty("a")&&(e=r.a)),e=P3(e),{ok:a,format:r.format||l,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}}s(J8,"inputToRGB");function K8(r,t,e){return{r:pt(r,255)*255,g:pt(t,255)*255,b:pt(e,255)*255}}s(K8,"rgbToRgb");function g3(r,t,e){r=pt(r,255),t=pt(t,255),e=pt(e,255);var i=Math.max(r,t,e),n=Math.min(r,t,e),o,a,l=(i+n)/2;if(i==n)o=a=0;else{var u=i-n;switch(a=l>.5?u/(2-i-n):u/(i+n),i){case r:o=(t-e)/u+(t<e?6:0);break;case t:o=(e-r)/u+2;break;case e:o=(r-t)/u+4;break}o/=6}return{h:o,s:a,l}}s(g3,"rgbToHsl");function Q8(r,t,e){var i,n,o;r=pt(r,360),t=pt(t,100),e=pt(e,100);function a(h,f,m){return m<0&&(m+=1),m>1&&(m-=1),m<1/6?h+(f-h)*6*m:m<1/2?f:m<2/3?h+(f-h)*(2/3-m)*6:h}if(s(a,"hue2rgb"),t===0)i=n=o=e;else{var l=e<.5?e*(1+t):e+t-e*t,u=2*e-l;i=a(u,l,r+1/3),n=a(u,l,r),o=a(u,l,r-1/3)}return{r:i*255,g:n*255,b:o*255}}s(Q8,"hslToRgb");function v3(r,t,e){r=pt(r,255),t=pt(t,255),e=pt(e,255);var i=Math.max(r,t,e),n=Math.min(r,t,e),o,a,l=i,u=i-n;if(a=i===0?0:u/i,i==n)o=0;else{switch(i){case r:o=(t-e)/u+(t<e?6:0);break;case t:o=(e-r)/u+2;break;case e:o=(r-t)/u+4;break}o/=6}return{h:o,s:a,v:l}}s(v3,"rgbToHsv");function tC(r,t,e){r=pt(r,360)*6,t=pt(t,100),e=pt(e,100);var i=Math.floor(r),n=r-i,o=e*(1-t),a=e*(1-n*t),l=e*(1-(1-n)*t),u=i%6,h=[e,a,o,o,l,e][u],f=[l,e,e,a,o,o][u],m=[o,o,l,e,e,a][u];return{r:h*255,g:f*255,b:m*255}}s(tC,"hsvToRgb");function b3(r,t,e,i){var n=[De(Math.round(r).toString(16)),De(Math.round(t).toString(16)),De(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("")}s(b3,"rgbToHex");function eC(r,t,e,i,n){var o=[De(Math.round(r).toString(16)),De(Math.round(t).toString(16)),De(Math.round(e).toString(16)),De(M3(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("")}s(eC,"rgbaToHex");function C3(r,t,e,i){var n=[De(M3(i)),De(Math.round(r).toString(16)),De(Math.round(t).toString(16)),De(Math.round(e).toString(16))];return n.join("")}s(C3,"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 rC(r,t){t=t===0?0:t||10;var e=F(r).toHsl();return e.s-=t/100,e.s=Rl(e.s),F(e)}s(rC,"_desaturate");function iC(r,t){t=t===0?0:t||10;var e=F(r).toHsl();return e.s+=t/100,e.s=Rl(e.s),F(e)}s(iC,"_saturate");function nC(r){return F(r).desaturate(100)}s(nC,"_greyscale");function oC(r,t){t=t===0?0:t||10;var e=F(r).toHsl();return e.l+=t/100,e.l=Rl(e.l),F(e)}s(oC,"_lighten");function aC(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)}s(aC,"_brighten");function sC(r,t){t=t===0?0:t||10;var e=F(r).toHsl();return e.l-=t/100,e.l=Rl(e.l),F(e)}s(sC,"_darken");function lC(r,t){var e=F(r).toHsl(),i=(e.h+t)%360;return e.h=i<0?360+i:i,F(e)}s(lC,"_spin");function uC(r){var t=F(r).toHsl();return t.h=(t.h+180)%360,F(t)}s(uC,"_complement");function x3(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}s(x3,"polyad");function cC(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})]}s(cC,"_splitcomplement");function pC(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}s(pC,"_analogous");function hC(r,t){t=t||6;for(var e=F(r).toHsv(),i=e.h,n=e.s,o=e.v,a=[],l=1/t;t--;)a.push(F({h:i,s:n,v:o})),o=(o+l)%1;return a}s(hC,"_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=vC(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,l,u;e=e||{},a=e.includeFallbackColors,l=e.level,u=e.size;for(var h=0;h<t.length;h++)o=F.readability(r,t[h]),o>n&&(n=o,i=F(t[h]));return F.isReadable(r,i,{level:l,size:u})||!a?i:(e.includeFallbackColors=!1,F.mostReadable(r,["#fff","#000"],e))};var Xh=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"},dC=F.hexNames=fC(Xh);function fC(r){var t={};for(var e in r)r.hasOwnProperty(e)&&(t[r[e]]=e);return t}s(fC,"flip");function P3(r){return r=parseFloat(r),(isNaN(r)||r<0||r>1)&&(r=1),r}s(P3,"boundAlpha");function pt(r,t){mC(r)&&(r="100%");var e=yC(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)}s(pt,"bound01");function Rl(r){return Math.min(1,Math.max(0,r))}s(Rl,"clamp01");function ue(r){return parseInt(r,16)}s(ue,"parseIntFromHex");function mC(r){return typeof r=="string"&&r.indexOf(".")!=-1&&parseFloat(r)===1}s(mC,"isOnePointZero");function yC(r){return typeof r=="string"&&r.indexOf("%")!=-1}s(yC,"isPercentage");function De(r){return r.length==1?"0"+r:""+r}s(De,"pad2");function oa(r){return r<=1&&(r=r*100+"%"),r}s(oa,"convertToPercentage");function M3(r){return Math.round(parseFloat(r)*255).toString(16)}s(M3,"convertDecimalToHex");function S3(r){return ue(r)/255}s(S3,"convertHexToDecimal");var Oe=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 yr(r){return!!Oe.CSS_UNIT.exec(r)}s(yr,"isValidCSSUnit");function gC(r){r=r.replace(q8,"").replace($8,"").toLowerCase();var t=!1;if(Xh[r])r=Xh[r],t=!0;else if(r=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var e;return(e=Oe.rgb.exec(r))?{r:e[1],g:e[2],b:e[3]}:(e=Oe.rgba.exec(r))?{r:e[1],g:e[2],b:e[3],a:e[4]}:(e=Oe.hsl.exec(r))?{h:e[1],s:e[2],l:e[3]}:(e=Oe.hsla.exec(r))?{h:e[1],s:e[2],l:e[3],a:e[4]}:(e=Oe.hsv.exec(r))?{h:e[1],s:e[2],v:e[3]}:(e=Oe.hsva.exec(r))?{h:e[1],s:e[2],v:e[3],a:e[4]}:(e=Oe.hex8.exec(r))?{r:ue(e[1]),g:ue(e[2]),b:ue(e[3]),a:S3(e[4]),format:t?"name":"hex8"}:(e=Oe.hex6.exec(r))?{r:ue(e[1]),g:ue(e[2]),b:ue(e[3]),format:t?"name":"hex"}:(e=Oe.hex4.exec(r))?{r:ue(e[1]+""+e[1]),g:ue(e[2]+""+e[2]),b:ue(e[3]+""+e[3]),a:S3(e[4]+""+e[4]),format:t?"name":"hex8"}:(e=Oe.hex3.exec(r))?{r:ue(e[1]+""+e[1]),g:ue(e[2]+""+e[2]),b:ue(e[3]+""+e[3]),format:t?"name":"hex"}:!1}s(gC,"stringInputToObject");function vC(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}}s(vC,"validateWCAG2Parms");var td=wr(ev());var Hn={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}}},cx={lightOnDark:{...Hn,text:{...Hn.text,foregroundColor:"white",backgroundColor:"#333"},marker:{...Hn.marker,foregroundColor:{active:"white",inactive:void 0},backgroundColor:{active:"#333",inactive:void 0}}},darkOnLight:{...Hn,text:{...Hn.text,foregroundColor:"#333",backgroundColor:"white"},marker:{...Hn.marker,foregroundColor:{active:"#333",inactive:void 0},backgroundColor:{active:"white",inactive:void 0}}}},px="LOW_PRIORITY",rv=4,hx=6,dx=20,fx=2.5,mx=2,yx="cover",iv=.5,gx=6.5,nv={heightAbovePolygon:0,appearance:cx.darkOnLight};var Ai=class Ai{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 W;_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:vt(),this.options=(0,td.default)({},e,nv),this.text=t,this.dp=(l=1)=>l*i.pixelRatio,typeof e.rank=="string")this.rank=kn(e.rank),this.initialRank=this.rank;else if(e.rank!=null&&e.rank>0)this.rank=e.rank,this.initialRank=e.rank;else{let l=Math.trunc(b.env.NODE_ENV==="test"?Ai.testId:Ai.testId*10)/10;Ai.testId+=.001,this.rank=l,this.initialRank=l}let n=(0,td.default)({},this.options.appearance,nv.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||dx,iconPadding:(a=n.marker.iconPadding)!=null?a:mx,iconFit:n.marker.iconFit||yx,iconVisibilityThreshold:n.marker.iconVisibilityThreshold==null?iv:n.marker.iconVisibilityThreshold}},this.calculateMarkerSize()}calculateMarkerSize(){let{iconVisibilityThreshold:t=iv}=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(gx)),this.totalMarkerSize=Math.ceil((this.markerSize+fx)/e)}get strategies(){let{width:t,height:e}=this.dimensions,{margin:i}=this.appearance;this.calculateMarkerSize();let n=Math.max(hx,i),o=this.iconVisible?n/2:0,a=[{name:"RIGHT",getBoundingBox:()=>{let l=Math.max(this.totalMarkerSize,e);return[l/2+n,l/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+rv,this.newStyle.textLabelVisible=!0}},{name:"LEFT",getBoundingBox:()=>{let l=Math.max(this.totalMarkerSize,e);return[l/2+n,l/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-rv,this.newStyle.textLabelVisible=!0}},{name:"TOP",getBoundingBox:()=>{let l=this.dp();return[e+this.totalMarkerSize/2/l+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:px,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.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(){}};s(Ai,"LabelComponent"),v(Ai,"testId",0);var ed=Ai,ze=ed;d();var pa,ha,rd=class rd{constructor(t){v(this,"mesh");v(this,"outline");v(this,"type","geometry");v(this,"instanceIndex",-1);v(this,"geometry");v(this,"material");v(this,"feature");v(this,"color",new Mt);v(this,"topColor",new Mt);v(this,"position",new Y);T(this,pa,0);T(this,ha,1);v(this,"texturesVisible",!1);this.feature=t}get visible(){return this.mesh?this.mesh.getVisibleAt(this.instanceIndex):!1}set visible(t){this.mesh&&this.mesh.setVisibleAt(this.instanceIndex,t)}setOpacity(t){this.mesh&&(this.material&&(this.material.opacity=t,this.material.transparent=t<1),this.outline&&(t<.5?this.outline.visible=!1:this.outline.visible=!0),t===0?this.mesh.visible=!1:this.mesh.visible=!0)}setColor(t,e){this.color.set(t),this.topColor.set(e),this.material&&this.material.setColor(this.instanceIndex,this.color,this.topColor)}get altitude(){return c(this,pa)}set altitude(t){this.mesh&&(this.mesh.position.z=t,E(this,pa,t))}get opacity(){return c(this,ha)}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,ha,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}showTextures(){this.material&&(this.material.showTextures(this.instanceIndex),this.texturesVisible=!0)}hideTextures(){this.material&&(this.material.hideTextures(this.instanceIndex),this.texturesVisible=!1)}};pa=new WeakMap,ha=new WeakMap,s(rd,"MeshComponent");var qe=rd;var id=class id extends nt{constructor(){super()}interpolators=new Map;addEntity3D(t,e){let[i,n,o,a]=e[1];this.interpolators.set(t,l=>le(l,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 qe?e.setOpacity(i(t)):e instanceof ze?e.enabled=i(t):i(t)};destroy(){this.interpolators.clear()}};s(id,"ZoomInterpolationSystem");var jl=id;d();var Ni=class Ni{id;type="marker";rank=0;initialRank=0;options={};projection=new W;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)||vt(),this.options=e,typeof e.rank=="string")this.rank=kn(e.rank);else if(e.rank!=null&&e.rank>0)this.rank=e.rank;else{let n=Math.trunc(b.env.NODE_ENV==="test"?Ni.testId:Ni.testId*10)/10;Ni.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(){}};s(Ni,"MarkerComponent"),v(Ni,"testId",0);var fe=Ni;d();d();d();d();d();var nd=class nd{hover=!1;dirty=!1};s(nd,"InteractionComponent");var da=nd;function $e(r,t,e){if(t!==void 0){if(r.type==="model"||r.type==="path"||r.type==="marker"||r.type==="label"||r.type==="geometry")return t===!0?(r instanceof Le&&r.components[1]===void 0&&(r.components[1]=new da,r.components[1].dirty=!0),r instanceof St&&r.components[2]===void 0&&(r.components[2]=new da,r.components[2].dirty=!0),!0):(r instanceof Le?r.components[1]=void 0:r instanceof St&&(r.components[2]=void 0),!0);if(r.type==="geometry-group"){let i;for(let n of r.userData.entities3D.values())i=e.entity3DMap.get(n),$e(i,t,e);return!0}}return!1}s($e,"updateInteractivity");function av(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}s(av,"updateGroupColor");function sv(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)}s(sv,"updateColor");function od(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)))}s(od,"updatePosition");function ad(r,t){var e;return t!==void 0&&(r.type==="marker"||r.type==="label"||r.type==="custom-geometry")&&r.parent!==t?((e=r.parent)==null||e.removeEntity(r),t.addEntity(r),!0):!1}s(ad,"updateParent");function lv(r,t){t!==void 0&&(r.type==="marker"||r.type==="label")&&(r.components[0].enabled=t)}s(lv,"updateEnabled");function uv(r,t){if(t!==void 0&&r.type==="path"){let e=r.components[0];t.completeFraction!==void 0&&(e.completeFraction=t.completeFraction)}}s(uv,"updatePath");function cv(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}s(cv,"updateMarker");function pv(r,t){return t!==void 0&&(r.type==="marker"||r.type==="label")?(r.components[0].rank=kn(t),!0):!1}s(pv,"updateRank");function hv(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&&(Ah(o.appearance,((n=t.options)==null?void 0:n.appearance)||{}),o.dirty=!0)}}s(hv,"updateLabel");function dv(r,t){t!==void 0&&r.type==="geometry"&&(r.components[1].hoverColor=t,r.components[1].dirty=!0)}s(dv,"updateHoverColor");function Xn(r,t){return t!==void 0?(r.type==="model"||r.type==="path"||r.type==="geometry"||r.type==="custom-geometry"?(r.components[1].visible=t,r.components[1].dirty=!0):(r.type==="group-container"||r.type==="geometry-group")&&r.setVisible(t),!0):!1}s(Xn,"updateVisibility");function fv(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)}}}s(fv,"updateOpacity");function sd(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))}s(sd,"updateAltitude");var Ri,Je,Wl,Ul,mv,ma,Zl,zl,yv,ql,gv,ya,$l,ga,va,Jl,ud=class ud{constructor(t){T(this,Ul);T(this,zl);T(this,ql);T(this,Ri,null);T(this,Je,void 0);v(this,"getCurrentSceneGLTF",async t=>{let e={onlyVisible:!0,binary:!0,light:!0,scale:1,...t},i=await j(this,Ul,mv).call(this),n=c(this,Wl).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 l=JSON.stringify(o,null,2);a=new Blob([l],{type:"text/plain"})}return a});T(this,Wl,s(t=>{let{scale:e,light:i,onlyVisible:n}=t,o=new vs,a=new Be().setFromObject(c(this,Je).entityScene);if(c(this,ma).call(this,c(this,Je).entityScene,o,n),i){let l=new xs(16777215,.3*Math.PI);l.position.set(0,Math.max(a.max.x,a.max.y)*e*.5,a.max.y*e*4),l.lookAt(0,0,-1),l.target.position.set(0,0,-1),l.add(l.target),o.add(l)}return o},"#getExportedScene"));T(this,ma,s((t,e,i)=>{t.material&&(t instanceof Cs?j(this,zl,yv).call(this,t).forEach(n=>e.add(n)):t instanceof ho&&e.add(j(this,ql,gv).call(this,t))),t.children.forEach(n=>{(!i||n.visible)&&c(this,ma).call(this,n,e,i)})},"#processObject3D"));T(this,Zl,s((t,e,i)=>{let n=new Sm({color:new Mt(t),metalness:0});return n.opacity=e,n.transparent=i,n},"#createStandardMaterial"));T(this,ya,s(t=>{let{geometry:e,material:i,position:n,rotation:o,quaternion:a,scale:l}=t;if(!(e!=null&&e.isBufferGeometry))return t;let u=e.attributes.position,h=e.attributes.normal,f=e.attributes.uv;return c(this,$l).call(this,u,h),c(this,va).call(this,n,l,o,a),f&&c(this,Jl).call(this,f),i!=null&&i.map&&e.type==="PlaneGeometry"&&(t.side=uo),t},"#convertGeometry"));T(this,$l,s((t,e)=>{let i=new Y,n=new Y;for(let o=0;o<t.count;o++)i.fromBufferAttribute(t,o),c(this,ga).call(this,i),t.setXYZ(o,i.x,i.y,i.z),e&&(n.fromBufferAttribute(e,o),c(this,ga).call(this,n),e.setXYZ(o,n.x,n.y,n.z))},"#convertAttributes"));T(this,ga,s(t=>{let e=t.y;t.y=t.z,t.z=-e},"#convertVector"));T(this,va,s((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 rn)i.order="YXZ",i.set(i.x,i.y,i.z,i.order);else{let l=n.y;n.set(n.x,n.z,-l,n.w)}},"#convertObjectProperties"));T(this,Jl,s(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,Je,t),c(this,Je).entityScene=t.entityScene,c(this,Je).entity3DMap=t.entity3DMap}destroy(){E(this,Ri,null)}};Ri=new WeakMap,Je=new WeakMap,Wl=new WeakMap,Ul=new WeakSet,mv=s(async function(){if(!c(this,Ri)){let{GLTFExporter:t}=await import("./GLTFExporter-IXIGSGM3.js");E(this,Ri,new t)}return c(this,Ri)},"#getGLTFExporter"),ma=new WeakMap,Zl=new WeakMap,zl=new WeakSet,yv=s(function(t){var a,l;let e=[],n=((a=t.userData)!=null&&a.entities?Object.values((l=t.userData)==null?void 0:l.entities):[]).map(u=>c(this,Je).entity3DMap.get(u)),o=new Map;return n.forEach(u=>{var x;if(!u||!(u instanceof St))return;let h=u.components[1],f=u.components[2];if(!h.visible||h.opacity===0)return;let y=`${f!=null&&f.hover?h.hoverColor||c(this,Je).hoverColor:h.color}-${h.opacity}-${Number(h.visible)}`;o.has(y)||o.set(y,[]),(x=o.get(y))==null||x.push(u)}),o.forEach((u,h)=>{let[f,m,y]=h.split("-"),x=u.reduce((C,w)=>{let I=w.components[0];if(I.type==="custom-geometry")return C;let M=I==null?void 0:I.geometry;return M&&C.push(M),C},[]),S=c(this,Zl).call(this,f,Number(m),t.material.transparent),P=Lr(x,!0),g=new jt(P,S);g.position.copy(t.position),g.rotation.copy(t.rotation),g.scale.copy(t.scale),g.visible=!!y,c(this,va).call(this,g.position,g.scale,g.rotation,g.quaternion),e.push(c(this,ya).call(this,g))}),e},"#processBatchedMesh"),ql=new WeakSet,gv=s(function(t){let e=t.geometry.clone(),i=t.material,n=new Ir({color:i.color,side:uo});n.opacity=i.opacity,n.transparent=i.transparent;let o=new ho(e,n);return o.position.copy(t.position),o.rotation.copy(t.rotation),o.scale.copy(t.scale),o.visible=t.visible,c(this,ya).call(this,o)},"#processLineSegments"),ya=new WeakMap,$l=new WeakMap,ga=new WeakMap,va=new WeakMap,Jl=new WeakMap,s(ud,"ExporterSystem");var fa=ud;d();var vv="#ffffff";var cd=class cd{initialColor=vv;color=vv;topColor;topTexture;texture;hoverColor;dirty=!0;visible=!0;opacity=1;width=.1;height=.1;altitude=0;join="round";cap="round";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}};s(cd,"StyleComponent");var $r=cd;d();d();d();d();var Kl={top:0,bottom:0,left:0,right:0};d();d();d();d();var pd=class pd extends gm{_width;_height;_propertiesLength;constructor(t){let e=t,i=3,n=i*4;super(new Float32Array(t*n),i,t,sm,am),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}};s(pd,"BatchedPropertiesTexture");var Ql=pd;var bv=`#define LAMBERT
12
12
  varying vec3 vViewPosition;
13
13
  varying vec4 vPosition;
14
+ varying vec2 vUv;
14
15
  varying vec4 finalPosition;
15
16
  varying vec3 vWorldPosition;
16
17
  varying vec3 worldNormal;
@@ -55,9 +56,10 @@ void main() {
55
56
  #include <fog_vertex>
56
57
  // vertex normal relative to world space
57
58
  worldNormal = normal;
59
+ vUv = uv;
58
60
  // world position
59
61
  vWorldPosition = (modelMatrix * vec4(position, 1.0)).xyz;
60
- }`;var ab=`#define LAMBERT
62
+ }`;var Cv=`#define LAMBERT
61
63
  uniform vec3 diffuse;
62
64
  uniform vec3 emissive;
63
65
  uniform float opacity;
@@ -66,9 +68,12 @@ uniform float uPercentToDarkenGradient;
66
68
  uniform float uMinSideAlpha;
67
69
  uniform float uMaxSideAlpha;
68
70
  uniform float uFullGradientStart;
69
- uniform highp sampler2D propertiesTex;
71
+ uniform highp sampler2D uPropertiesTexture;
72
+ uniform highp sampler2D uTopTexture;
73
+ uniform highp sampler2D uTexture;
70
74
  varying float vBatchId;
71
75
 
76
+ varying vec2 vUv;
72
77
  varying vec3 vWorldPosition;
73
78
  varying vec3 worldNormal;
74
79
 
@@ -107,11 +112,22 @@ void main() {
107
112
  float angle = degrees(acos(abs(dot(surfaceNormal, vec3(0.0, 0.0, 1.0)))));
108
113
 
109
114
  int idx = int(vBatchId) * 1;
110
- vec3 diffuse = vec3(texelFetch(propertiesTex, ivec2(0, idx), 0).rgb);
115
+ vec3 diffuse = vec3(texelFetch(uPropertiesTexture, ivec2(0, idx), 0).rgb);
116
+ bool shouldShowTexture = texelFetch(uPropertiesTexture, ivec2(2, idx), 0).r == 1.0;
117
+
118
+ if (shouldShowTexture) {
119
+ diffuse = texture2D(uTexture, vUv).rgb;
120
+ }
111
121
 
112
122
  // if this is a fragment facing upwards, use topColor
113
123
  if (angle == 0.0) {
114
- diffuse = vec3(texelFetch(propertiesTex, ivec2(1, idx), 0).rgb);
124
+ bool shouldShowTopTexture = texelFetch(uPropertiesTexture, ivec2(2, idx), 0).g == 1.0;
125
+
126
+ if (shouldShowTopTexture) {
127
+ diffuse = texture2D(uTopTexture, vUv).rgb;
128
+ } else {
129
+ diffuse = vec3(texelFetch(uPropertiesTexture, ivec2(1, idx), 0).rgb);
130
+ }
115
131
  }
116
132
 
117
133
  vec4 diffuseColor = vec4(diffuse, opacity);
@@ -154,7 +170,7 @@ void main() {
154
170
  #include <premultiplied_alpha_fragment>
155
171
  #include <dithering_fragment>
156
172
  }
157
- `;var rx=.15,ix=.4,nx=-.05,ox=1,ax=.1,of=class of extends Ji{needsColorUpdate=!0;propertiesTex;constructor(t,r){super(t);let i=new Ul(r);this.propertiesTex=i,this.onBeforeCompile=n=>{n.vertexShader=ob,n.fragmentShader=ab,n.uniforms.uPercentToDarkenGradient={value:ix},n.uniforms.uTopOfGradient={value:rx},n.uniforms.uMinSideAlpha={value:nx},n.uniforms.uMaxSideAlpha={value:ox},n.uniforms.uFullGradientStart={value:ax},n.uniforms.propertiesTex={value:i}}}setColor(t,r,i){this.propertiesTex.setColor(t,r,i)}dispose(){super.dispose(),this.propertiesTex.dispose()}};s(of,"BatchedStandardMaterial");var zl=of;var sx=80;function sb(e,t){var l,c;let r=0;for(let h of e)r+=((c=(l=h.components[0])==null?void 0:l.geometry)==null?void 0:c.attributes.position.count)||0;let i=new Mt(t.color),n=new zl({color:i,side:eo,opacity:t.opacity||1,transparent:t.opacity!==void 0?t.opacity<1:!1},e.length),o=new hs(e.length,r,0,n);o.userData={entities:{}};let a;for(let h of e)a=h.components[0],a.mesh=o,a.material=n,a.instanceIndex=o.addGeometry(a.geometry),o.userData.entities[a.instanceIndex]=h.id,n.setColor(a.instanceIndex,i,t.topColor?new Mt(t.topColor):i);return o.perObjectFrustumCulled=!0,o.matrixAutoUpdate=!1,o}s(sb,"batchGeometries");function lb(e,t){t.polygonOffset=!0,t.polygonOffsetFactor=1,t.polygonOffsetUnits=1;let r=new lm(e,sx),i=new am({linewidth:2,color:t.color,userData:{initialColor:t.color.getHexString()}});return new oo(r,i)}s(lb,"createOutlines");f();var lx="gray",cx=.1;function cb(e,t,r){let{color:i=lx,opacity:n=1,altitude:o=0,height:a=cx}=r||{};Array.isArray(n)&&(n=1);let l={min:{x:1/0,y:1/0,z:o},max:{x:-1/0,y:-1/0,z:a+o}},c=new Re,h=e.geometry.coordinates[0].map(x=>{let S=t(x[1],x[0]);return l.min.x=Math.min(l.min.x,S.x),l.min.y=Math.min(l.min.y,S.y),l.max.x=Math.max(l.max.x,S.x),l.max.y=Math.max(l.max.y,S.y),S});c.moveTo(h[0].x,h[0].y),h.slice(1).forEach(x=>c.lineTo(x.x,x.y)),c.lineTo(h[0].x,h[0].y);let d=e.geometry.coordinates.slice(1);c.holes=d.map(x=>{let S=x.map(g=>t(g[1],g[0])),P=new Sr;return P.moveTo(S[0].x,S[0].y),S.slice(1).forEach(g=>P.lineTo(g.x,g.y)),P.lineTo(S[0].x,S[0].y),P});let m={bevelEnabled:!1,depth:a},y=new ke(c,m);return y.translate(0,0,o||0),y.userData={style:{color:i,opacity:n}},y}s(cb,"renderPolygonGeometry");f();var ux="gray",px=.1;function ub(e,t,r){let{color:i=ux,opacity:n=1,altitude:o=0,height:a=px}=r||{};Array.isArray(n)&&(n=1);let l={min:{x:1/0,y:1/0,z:o},max:{x:-1/0,y:-1/0,z:a+o}},c={bevelEnabled:!1,depth:a},h=[];e.geometry.coordinates.forEach(m=>{let y=new Re,x=m[0].map(g=>{let C=t(g[1],g[0]);return l.min.x=Math.min(l.min.x,C.x),l.min.y=Math.min(l.min.y,C.y),l.max.x=Math.max(l.max.x,C.x),l.max.y=Math.max(l.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(M=>t(M[1],M[0])),T=new Sr;return T.moveTo(C[0].x,C[0].y),C.slice(1).forEach(M=>T.lineTo(M.x,M.y)),T.lineTo(C[0].x,C[0].y),T});let P=new ke(y,c);h.push(P)});let d=Mr(h);return d.translate(0,0,o||0),d.userData={style:{color:i,opacity:n}},d}s(ub,"renderMultiPolygonGeometry");f();f();var lf=Cr(Cb());function xb(e){this.name="JSClipperError",this.message=e,this.stack=new Error().stack}s(xb,"JSClipperError");xb.prototype=Error.prototype;lf.default.Error=function(e){throw new xb(e)};var ie=lf.default;var nP="gray",cf=new ie.ClipperOffset,Zt=100;function Sb(e,t,r){let{color:i=nP,opacity:n=1,width:o=1,join:a="round",cap:l="round",height:c=.01,altitude:h=0}=r||{};Array.isArray(n)&&(n=0);let d=[];for(let P=0;P<e.geometry.coordinates.length-1;P++){let g=t(e.geometry.coordinates[P][1],e.geometry.coordinates[P][0]),C=t(e.geometry.coordinates[P+1][1],e.geometry.coordinates[P+1][0]);d.push([g,C])}cf.AddPaths(d.map(P=>P.map(g=>({X:g.x*Zt,Y:g.y*Zt}))),a==="round"?ie.JoinType.jsRound:a==="miter"?ie.JoinType.jsMiter:ie.JoinType.jsSquare,l==="round"?ie.EndType.etOpenRound:l==="butt"?ie.EndType.etOpenButt:ie.EndType.etOpenSquare);let m=new ie.PolyTree;cf.Execute(m,o/2*Zt);let y=[],x={bevelEnabled:!1,depth:c};for(let P of m.m_AllPolys){let g=new Re;if(P.IsHole())continue;let C=P.m_polygon;g.moveTo(C[0].X/Zt,C[0].Y/Zt),C.slice(1).forEach(T=>g.lineTo(T.X/Zt,T.Y/Zt)),g.lineTo(C[0].X/Zt,C[0].Y/Zt),g.holes=P.m_Childs.map(T=>{let M=new Sr,I=T.m_polygon;return M.moveTo(I[0].X/Zt,I[0].Y/Zt),I.slice(1).forEach(_=>M.lineTo(_.X/Zt,_.Y/Zt)),M.lineTo(I[0].X/Zt,I[0].Y/Zt),M}),y.push(new ke(g,x))}let S=Mr(y);return S.translate(0,0,h||0),S.userData={style:{color:i,opacity:n}},cf.Clear(),S}s(Sb,"renderLineStringGeometry");f();var qt=100,oP=.22,aP=.01;function Pb(e,t,r={}){let{width:i=oP,height:n=aP,color:o="gray",opacity:a=1,altitude:l=0}=r,c={min:{x:1/0,y:1/0,z:l},max:{x:-1/0,y:-1/0,z:l+n}},h={bevelEnabled:!1,depth:n},d=new ie.ClipperOffset,m=e.geometry.coordinates.map(P=>P.map(g=>t(g[1],g[0])));d.AddPaths(m.map(P=>P.map(g=>({X:g.x*qt,Y:g.y*qt}))),ie.JoinType.jsMiter,ie.EndType.etOpenRound);let y=new ie.PolyTree;d.Execute(y,i/2*qt);let x=[];for(let P of y.m_AllPolys){let g=new Re;if(P.IsHole())continue;c.min.x=Math.min(c.min.x,P.m_polygon[0].X),c.min.y=Math.min(c.min.y,P.m_polygon[0].Y),c.max.x=Math.max(c.max.x,P.m_polygon[0].X),c.max.y=Math.max(c.max.y,P.m_polygon[0].Y);let C=P.m_polygon;g.moveTo(C[0].X/qt,C[0].Y/qt),C.slice(1).forEach(T=>g.lineTo(T.X/qt,T.Y/qt)),g.lineTo(C[0].X/qt,C[0].Y/qt),g.holes=P.m_Childs.map(T=>{let M=new Sr,I=T.m_polygon;return M.moveTo(I[0].X/qt,I[0].Y/qt),I.slice(1).forEach(_=>M.lineTo(_.X/qt,_.Y/qt)),M.lineTo(I[0].X/qt,I[0].Y/qt),M}),x.push(new ke(g,h))}let S=Mr(x);return S.translate(0,0,l||0),S.userData={style:{color:o,opacity:a}},d.Clear(),S}s(Pb,"renderMultiLineStringGeometry");f();var da,ma,uf=class uf{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 Mt);v(this,"position",new Y);w(this,da,0);w(this,ma,1);this.feature=t}setOpacity(){}setColor(){}get altitude(){return u(this,da)}set altitude(t){this.mesh&&(this.mesh.position.z=t,E(this,da,t))}get opacity(){return u(this,ma)}set opacity(t){var r,i;if(this.mesh){for(let n of this.mesh.children)if(n instanceof ps){((r=n.userData)==null?void 0:r.originalOpacity)===void 0&&(n.userData.originalOpacity=n.material.opacity);let o=Ut(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,ma,t)}};da=new WeakMap,ma=new WeakMap,s(uf,"ModelComponent");var Kl=uf;function sP(e){let{color:t,opacity:r,topColor:i}=e;return`${t}${r}${i||""}`}s(sP,"generateIndex");var lP=1e4,pf=class pf{state;convertTo3DMapPosition;loader;constructor(t,r){this.state=t,this.convertTo3DMapPosition=r}async getGLTFLoader(){if(this.loader)return;let{GLTFLoader:t}=await import("./GLTFLoader-NIXX5K7V.js");this.loader=new t}createEntityFromFeature(t,r,i){let n=new We(r),o=new St(n,new jr(i));return o.id=t,o}createModelFromFeature(t,r,i){let n=new Kl(r),o=new St(n,new jr(i));return o.id=t,o}populateEntityMesh(t,r){let i=t.components[0];i.geometry=r}async populateModelGroup(t,r,i){let n=new ti,o=new qi,a=new Kd,l=new Y,c=new Xe;return this.loader||await this.getGLTFLoader(),this.loader.load(r,h=>{var y,x,S,P,g,C;h.scene.traverse(T=>{let M=T;if("isMesh"in M&&M.isMesh===!0){let I=new ps(M.geometry,M.material,t.size);I.userData={entities:{}},c.add(I),i.add(c)}});let d=0,m;for(let T of t.values()){m=this.state.entity3DMap.get(T);let M=m.components[0],I=m.components[0].feature;M.mesh=c,M.instanceIndex=d;let{x:_,y:O,z:k}=this.convertTo3DMapPosition(I.geometry.coordinates[1],I.geometry.coordinates[0],0);M.position.set(_,O,k),o.set(((y=I.properties.rotation)==null?void 0:y[0])||0,((x=I.properties.rotation)==null?void 0:x[1])||0,((S=I.properties.rotation)==null?void 0:S[2])||0),l.set(((P=I.properties.scale)==null?void 0:P[0])||1,((g=I.properties.scale)==null?void 0:g[1])||1,((C=I.properties.scale)==null?void 0:C[2])||1),a.setFromEuler(o),n.compose(M.position,a,l),c.children.forEach(B=>{let R=B;R.setMatrixAt(d,n),R.userData.entities[d]=m.id}),d++}}),c}populateEntityGroup(t){let r,i,n,o;for(let a of t.values())o=this.state.entity3DMap.get(a),o.components[0]instanceof We&&(i=o.components[0].feature,n=o.components[1],i.geometry.type==="Polygon"?(r=cb(i,this.convertTo3DMapPosition,n),this.populateEntityMesh(o,r)):i.geometry.type==="MultiPolygon"?(r=ub(i,this.convertTo3DMapPosition,n),this.populateEntityMesh(o,r)):i.geometry.type==="LineString"?(r=Sb(i,this.convertTo3DMapPosition,n),this.populateEntityMesh(o,r)):i.geometry.type==="MultiLineString"&&(r=Pb(i,this.convertTo3DMapPosition,n),this.populateEntityMesh(o,r)));return t}optimize(t){if(t.visible&&(t instanceof fe||t instanceof re)){for(let n of t.children)this.optimize(n);if(t instanceof re||t.userData.dirty===!1)return;let r={};if(!t.userData.modelURL&&t.userData.dirty)try{this.populateEntityGroup(t.userData.entities3D)}catch(n){X.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 l=o.components[0],c=o.components[1];if(l instanceof We){n++,n>=lP&&(n=0,i++);let h=sP(c)+i;r[h]===void 0&&(r[h]={style:c,entities:[]}),r[h].entities.push(o)}else l.mesh&&l.mesh.parent!==t&&t.add(l.mesh)}for(let a in r){let l=sb(r[a].entities,r[a].style),c=lb(l.geometry,l.material);for(let h of r[a].entities)h.components[0].outline=c;t.add(l),t.add(c),t.userData.dirty=!1}}}}update(){this.optimize(this.state.entityScene)}};s(pf,"MeshCreationAndOptimizationSystem");var Ql=pf;f();var hf=class hf{state;dirty=!0;domTree;constructor(t,r){this.state=t,this.domTree=r}update(){if(this.dirty){let t;for(let r of Array.from(this.domTree.children))if(t=this.state.entity2DMap.get(r.userData.entityId),t){let i=t.components[0];(!i.enabled||!i.visible||!this.state.entity2DIds.has(r.userData.entityId))&&this.domTree.removeChild(r)}else this.domTree.removeChild(r);for(let r of this.state.entity2DIds)if(t=this.state.entity2DMap.get(r),t){let i=t.components[0];i instanceof de&&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}}};s(hf,"DOMVisibilitySystem");var tc=hf;f();var ff=class ff{state;project;constructor(t,r){this.state=t,this.project=r}update(){let t;for(let r of this.state.entity2DIds)t=this.state.entity2DMap.get(r),t&&this.project(t.components[0].projection,t.position)}};s(ff,"TwoDProjectionSystem");var ec=ff;f();f();var cP=s(function(){let t,r;return i=>{if((!r||!r)&&(t=document.createElement("canvas"),t.width=500*i,t.height=500*i,t.style.width="500px",t.style.height="500px",r=t.getContext("2d")),!r)throw new Error("Could not get 2D context");return{measureCanvas:t,measureCanvasContext:r}}},"createMeasureCanvasContext")(),Mb=s(({text:e,size:t,maxWidth:r,pixelRatio:i,maxLines:n=2,lineHeight:o=1.2,options:a={strokeText:!0}})=>{let l=`bold ${t*i}px 'InterUI-Regular', Helvetica Neue, Arial, sans-serif`,{measureCanvasContext:c}=cP(i);c.font=l;let h=[],d=e.split(" "),m=0,y=0,x=0;for(;y<d.length;){let C=d[y];if(m===n&&m>0){h[m-1]+="...";break}if(h[m]==null&&(h[m]=C,y++),d.length===1){h[m]=C;break}if(d[y]==null)break;let{width:T}=c.measureText(h[m]+" "+d[y]);T<=r*i?(h[m]+=" "+d[y],y++):m++}h.forEach(C=>{let{width:T}=c.measureText(C);x=Math.max(T,x)});let S=t*i*o,P=h.length*S;return{maxWidth:x,maxHeight:P,lines:h.length,draw:(C,T,M)=>{h.length===1?(a.strokeText&&C.strokeText(h[0],T,M),C.fillText(h[0],T,M)):(a.strokeText&&(C.strokeText(h[0],T,M-S/2),C.strokeText(h[1],T,M+S/2)),C.fillText(h[0],T,M-S/2),C.fillText(h[1],T,M+S/2))}}},"shaveText");var uP=4.5,pP=2.5,hP=2,fP=5,ya=2.5;var df=class df{dirty=!1;state;colliderContext;colliderCanvas;constructor(t,r){this.state=t,this.colliderCanvas=r,this.colliderContext=r.getContext("2d")}pinCache={};imagePromiseCache={};imageDimensionsCache={};textCache={};update=(t,r,i)=>{let n=(t-r)/(i-r),o=this.state.pixelRatio;this.colliderContext.clearRect(0,0,this.colliderCanvas.width,this.colliderCanvas.height);let a,l,c,h,d,m;for(let y of this.state.entity2DIds)if(m=this.state.entity2DMap.get(y),m!=null&&m.components[0]instanceof je&&!m.disposed){if(d=m.components[0],l=d.appearance.marker.foregroundColor,c=d.appearance.marker.backgroundColor,h=d.markerSize,a=`${l.active}-${l.inactive}-${c.active}-${c.inactive}-${h}`,this.pinCache[a]||this.prepare(d,a,this.colliderContext),d.appearance.marker.icon&&!d.imageHash&&this.cacheImage(d),this.textCache[d.id]==null||d.dirty||this.dirty){d.dirty=!1,d.collisionDirty=!0,this.textCache[d.id]={};let{textDrawFn:x,width:S,height:P}=this.processText(d.text,d.appearance.text.size,d.appearance.text.maxWidth,d.appearance.text.numLines,d.appearance.text.lineHeight);["left","center","right"].forEach(C=>{this.textCache[d.id][C]=this.textToCanvas(x,d.appearance.text.size,C,S,P,d.appearance.text.foregroundColor,d.appearance.text.backgroundColor)}),d.dimensions={width:Math.ceil(S/o),height:Math.ceil(P/o)},d.currentStrategyIndex===-1&&(d.currentStrategyIndex=0);let g=d.strategies[d.currentStrategyIndex];if(g){g.onStrategySelected(d);let C=d.style;d.style=d.newStyle,d.newStyle=C}}d.visible&&d.enabled&&(d.zoomProportion=n,this.draw(d,a,this.colliderContext))}this.dirty=!1};processText=(t,r,i,n,o)=>{let a=this.state.pixelRatio,{draw:l,maxWidth:c,maxHeight:h}=Mb({text:t,size:r,pixelRatio:a,maxWidth:i,maxLines:n,lineHeight:o});return{textDrawFn:l,width:c+ya*a*2,height:h+ya*a*2}};textToCanvas=(t,r,i,n,o,a,l)=>{let c=this.state.pixelRatio,h,d=n,m=o;window.OffscreenCanvas!=null?h=new OffscreenCanvas(d,m):(h=document.createElement("canvas"),h.width=d,h.height=m,h.style.width=d+"px",h.style.height=m+"px");let y=h.getContext("2d");if(!y)return;y.textAlign=i,y.font=`bold ${r*c}px 'InterUI-Regular', Helvetica Neue, Arial, sans-serif`,y.textBaseline="middle",y.lineJoin="miter",y.miterLimit=2,y.strokeStyle="white",y.lineWidth=ya*c,y.fillStyle=a,y.strokeStyle=l;let x=i==="left"?0:i==="center"?d/2:d-ya*c/2;return t(y,x,(m+ya*c/2)/2),h};cacheImage=t=>{if(!t.appearance.marker.icon)return;let r=z2(t.appearance.marker.icon);if(t.imageHash=r,!this.imagePromiseCache[r]){let i=["png","jpg","jpeg"],n=t.appearance.marker.icon.split("?")[0],o=i.some(l=>n.endsWith(l)),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[r]=a}}};createPinCanvas=(t,r,i,n)=>{let o,a=this.state.pixelRatio,l=t.totalMarkerSize*2*a;window.OffscreenCanvas!=null?o=new OffscreenCanvas(l,l):(o=document.createElement("canvas"),o.width=l,o.height=l,o.style.width=l/a+"px",o.style.height=l/a+"px");let c=o.getContext("2d");return c.shadowColor="rgba(0,0,0,0.3)",c.shadowOffsetY=hP*a,c.shadowBlur=fP*a,c.beginPath(),c.arc(l/2,l/2,r/2+pP*a/2,0,2*Math.PI),c.fillStyle=i,c.fill(),c.beginPath(),c.arc(l/2,l/2,r/2,0,2*Math.PI),c.shadowColor="transparent",c.fillStyle=n,c.fill(),o};prepare=(t,r,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:uP*n,t.appearance.marker.backgroundColor.inactive,t.appearance.marker.foregroundColor.inactive);this.pinCache[r]=[o,a]};draw(t,r,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,l=t.style.pinVisibility===1?this.pinCache[r][0]:this.pinCache[r][1];if(i.drawImage(l,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 c=this.imagePromiseCache[t.imageHash],h=(t.appearance.marker.iconSize-t.appearance.marker.iconPadding)*n,{iconFit:d}=t.appearance.marker,m=h,y=h,x=`${t.imageHash}_${d}`;if(this.imageDimensionsCache[x])m=this.imageDimensionsCache[x].width,y=this.imageDimensionsCache[x].height;else{let S=c.width*n,P=c.height*n;if(d==="contain"){let g=Math.sqrt(S**2+P**2),C=h/g;m=S*C,y=P*C}if(d==="cover"){let g=h/S,C=h/P,T=Math.max(g,C);m=S*T,y=P*T}}i.save(),i.beginPath(),i.arc(o,a,h/2,0,2*Math.PI),i.closePath(),i.clip(),i.drawImage(c,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()}};s(df,"TwoDDrawSystem");var rc=df;f();function dP(e,t){let r=e.components[2],i=e.components[1];return r!=null&&r.hover?[i.hoverColor||t,i.hoverColor||t]:[i.color,i.topColor||i.color]}s(dP,"processColor");var mf=class mf{state;constructor(t){this.state=t}update(){var n,o,a;let t,r,i;for(let l of this.state.threeDEntities)if(i=this.state.entity3DMap.get(l),i instanceof St&&(i.type==="geometry"||i.type==="custom-geometry")&&((n=i.components[1])!=null&&n.dirty||(o=i.components[2])!=null&&o.dirty)){t=i.components[0],r=i.components[1];let c=dP(i,this.state.hoverColor);t.setColor(c[0],c[1]),r.visible!==t.visible&&(t.visible=r.visible),r.altitude!==t.altitude&&(t.altitude=r.altitude),r.opacity!==t.opacity&&(t.opacity=r.opacity),r.dirty=!1,i.components[2]&&(i.components[2].dirty=!1)}else(i==null?void 0:i.type)==="model"&&((a=i.components[1])!=null&&a.dirty)&&(t=i.components[0],r=i.components[1],r.opacity!==t.opacity&&(t.opacity=r.opacity),r.dirty=!1)}};s(mf,"DrawSystem");var ic=mf;f();var yf=class yf extends st{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,r;for(let i of this.state.entity2DIds)t=this.state.entity2DMap.get(i),t&&(r=t.components[0],r instanceof je&&r.visibilityNeedsUpdate&&(r.visible?this.animating.set(r,r.opacity):(r.opacity=0,r.visibilityNeedsUpdate=!1)));this.startTime=performance.now(),this.publish("animate:2d")};playAnimations;_playAnimations(){let t=performance.now();for(let[r,i]of this.animating.entries()){let n=(t-this.startTime)/this.duration;r.opacity=Ut(n,0,1,i,1),t-this.startTime>=this.duration&&(r.visible=!0,r.visibilityNeedsUpdate=!1,this.animating.delete(r))}this.publish("draw:2d"),this.animating.size>0&&this.publish("animate:2d")}};s(yf,"TwoDVisibilitySystem");var nc=yf;f();var gf=class gf extends st{state;renderer;mode;scene;cameraObject;viewCamera;systems;constructor(t,r,i,n,o,a,l){super(),this.renderer=t,this.state=r,this.mode=i,this.scene=n,this.cameraObject=o,this.viewCamera=a,this.systems=l,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 r;if(((r=this.renderer)==null?void 0:r.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(),Mh(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=[],Ph(this.state.entityScene,this.state.threeDEntities),this.threeDdirty=!1,this.systems.interactionSystem.dirty3D=!0,this.systems.panBoundsSystem.dirty=!0),this.systems.meshOptimizationSystem.update(),this.systems.customGeometrySystem.update(),this.systems.outlineInterpolationSystem.update(this.systems.cameraSystem.getZoomLevel(),this.systems.cameraSystem.zoomDirty),this.systems.panBoundsSystem.update(),this.systems.stackSystem.update(),this.systems.drawSystem.update(),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.nextFrame=requestAnimationFrame(()=>{this.systems.collisionSystem.update()}),this.systems.cameraSystem.dirty=!1,this.systems.cameraSystem.zoomDirty=!1};destroy(){this.frameId&&cancelAnimationFrame(this.frameId),this.twoDFrameId&&cancelAnimationFrame(this.twoDFrameId),this.animationFrameId&&cancelAnimationFrame(this.animationFrameId),this.nextFrame&&cancelAnimationFrame(this.nextFrame),this.state.entity2DIds.clear(),this.state.threeDEntities=[],this.systems.domVisiblitySystem.dirty=!0,this.systems.collisionSystem.dirty=!0,this.update(),this.systems.collisionSystem.off("visibility-changed",this.updateEntities2D),this.systems.twoDVisiblitySystem.off("draw:2d",this.drawEntities2D),this.systems.twoDVisiblitySystem.off("animate:2d",this.animate2D)}};s(gf,"RenderSystem");var oc=gf;f();function Bn(e,t,r=!1){let i=null,n=0;return function(...o){n++,n===1&&r===!0&&e.apply(this,o);let a=s(()=>{(!r||n>1)&&e.apply(this,o),i=null,n=0},"later");clearTimeout(i),i=setTimeout(a,t)}}s(Bn,"debounce");f();var vf=`attribute float pathDistance;
173
+ `;var Cx=.15,xx=.4,Sx=-.05,Px=1,Mx=.1,hd=class hd extends on{propertiesTexture;uniforms={uTopTexture:{value:null},uTexture:{value:null}};constructor(t,e){super(t),this.propertiesTexture=new Ql(e),this.onBeforeCompile=i=>{let n=this.uniforms.uTopTexture,o=this.uniforms.uTexture;this.uniforms=i.uniforms,i.vertexShader=bv,i.fragmentShader=Cv,Object.assign(this.uniforms,{uPercentToDarkenGradient:{value:xx},uTopOfGradient:{value:Cx},uMinSideAlpha:{value:Sx},uMaxSideAlpha:{value:Px},uFullGradientStart:{value:Mx},uPropertiesTexture:{value:this.propertiesTexture},uTopTexture:n,uTexture:o})}}get texture(){return this.uniforms.uTexture.value}set texture(t){t.wrapS=Fe,t.wrapT=Fe,t.colorSpace=si,this.uniforms.uTexture.value=t}get topTexture(){return this.uniforms.uTopTexture.value}set topTexture(t){t.wrapS=Fe,t.wrapT=Fe,t.colorSpace=si,this.uniforms.uTopTexture.value=t}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()}};s(hd,"BatchedStandardMaterial");var tu=hd;var Tx=80;function xv(r,t){var l,u;let e=0;for(let h of r)e+=((u=(l=h.components[0])==null?void 0:l.geometry)==null?void 0:u.attributes.position.count)||0;let i=new Mt(t.color),n=new tu({color:i,side:uo,opacity:t.opacity||1,transparent:t.opacity!==void 0?t.opacity<1:!1},r.length),o=new Cs(r.length,e,0,n);o.userData={entities:{}};let a;for(let h of r)a=h.components[0],a.mesh=o,a.material=n,a.instanceIndex=o.addGeometry(a.geometry),o.userData.entities[a.instanceIndex]=h.id,n.setColor(a.instanceIndex,i,t.topColor?new Mt(t.topColor):i);return o.perObjectFrustumCulled=!0,o.matrixAutoUpdate=!1,o}s(xv,"batchGeometries");function Sv(r,t){t.polygonOffset=!0,t.polygonOffsetFactor=1,t.polygonOffsetUnits=1;let e=new Cm(r,Tx),i=new vm({linewidth:2,color:t.color,userData:{initialColor:t.color.getHexString()}});return new ho(e,i)}s(Sv,"createOutlines");d();var wx="gray",Ix=.1;function Pv(r,t,e){let{color:i=wx,opacity:n=1,altitude:o=0,height:a=Ix}=e||{};Array.isArray(n)&&(n=1);let l={min:{x:1/0,y:1/0,z:o},max:{x:-1/0,y:-1/0,z:a+o}},u=new Ge,h=r.geometry.coordinates[0].map(x=>{let S=t(x[1],x[0]);return l.min.x=Math.min(l.min.x,S.x),l.min.y=Math.min(l.min.y,S.y),l.max.x=Math.max(l.max.x,S.x),l.max.y=Math.max(l.max.y,S.y),S});u.moveTo(h[0].x,h[0].y),h.slice(1).forEach(x=>u.lineTo(x.x,x.y)),u.lineTo(h[0].x,h[0].y);let f=r.geometry.coordinates.slice(1);u.holes=f.map(x=>{let S=x.map(g=>t(g[1],g[0])),P=new Er;return P.moveTo(S[0].x,S[0].y),S.slice(1).forEach(g=>P.lineTo(g.x,g.y)),P.lineTo(S[0].x,S[0].y),P});let m={bevelEnabled:!1,depth:a},y=new Ve(u,m);return y.translate(0,0,o||0),y.userData={style:{color:i,opacity:n}},y}s(Pv,"renderPolygonGeometry");d();var Ex="gray",_x=.1;function Mv(r,t,e){let{color:i=Ex,opacity:n=1,altitude:o=0,height:a=_x}=e||{};Array.isArray(n)&&(n=1);let l={min:{x:1/0,y:1/0,z:o},max:{x:-1/0,y:-1/0,z:a+o}},u={bevelEnabled:!1,depth:a},h=[];r.geometry.coordinates.forEach(m=>{let y=new Ge,x=m[0].map(g=>{let C=t(g[1],g[0]);return l.min.x=Math.min(l.min.x,C.x),l.min.y=Math.min(l.min.y,C.y),l.max.x=Math.max(l.max.x,C.x),l.max.y=Math.max(l.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(I=>t(I[1],I[0])),w=new Er;return w.moveTo(C[0].x,C[0].y),C.slice(1).forEach(I=>w.lineTo(I.x,I.y)),w.lineTo(C[0].x,C[0].y),w});let P=new Ve(y,u);h.push(P)});let f=Lr(h);return f.translate(0,0,o||0),f.userData={style:{color:i,opacity:n}},f}s(Mv,"renderMultiPolygonGeometry");d();d();var md=wr(Nv());function Rv(r){this.name="JSClipperError",this.message=r,this.stack=new Error().stack}s(Rv,"JSClipperError");Rv.prototype=Error.prototype;md.default.Error=function(r){throw new Rv(r)};var re=md.default;var SP="gray",yd=new re.ClipperOffset,Zt=100;function kv(r,t,e){let{color:i=SP,opacity:n=1,width:o=1,join:a="round",cap:l="round",height:u=.01,altitude:h=0}=e||{};Array.isArray(n)&&(n=0);let f=[];for(let P=0;P<r.geometry.coordinates.length-1;P++){let g=t(r.geometry.coordinates[P][1],r.geometry.coordinates[P][0]),C=t(r.geometry.coordinates[P+1][1],r.geometry.coordinates[P+1][0]);f.push([g,C])}yd.AddPaths(f.map(P=>P.map(g=>({X:g.x*Zt,Y:g.y*Zt}))),a==="round"?re.JoinType.jsRound:a==="miter"?re.JoinType.jsMiter:re.JoinType.jsSquare,l==="round"?re.EndType.etOpenRound:l==="butt"?re.EndType.etOpenButt:re.EndType.etOpenSquare);let m=new re.PolyTree;yd.Execute(m,o/2*Zt);let y=[],x={bevelEnabled:!1,depth:u};for(let P of m.m_AllPolys){let g=new Ge;if(P.IsHole())continue;let C=P.m_polygon;g.moveTo(C[0].X/Zt,C[0].Y/Zt),C.slice(1).forEach(w=>g.lineTo(w.X/Zt,w.Y/Zt)),g.lineTo(C[0].X/Zt,C[0].Y/Zt),g.holes=P.m_Childs.map(w=>{let I=new Er,M=w.m_polygon;return I.moveTo(M[0].X/Zt,M[0].Y/Zt),M.slice(1).forEach(_=>I.lineTo(_.X/Zt,_.Y/Zt)),I.lineTo(M[0].X/Zt,M[0].Y/Zt),I}),y.push(new Ve(g,x))}let S=Lr(y);return S.translate(0,0,h||0),S.userData={style:{color:i,opacity:n}},yd.Clear(),S}s(kv,"renderLineStringGeometry");d();var zt=100,PP=.22,MP=.01;function Fv(r,t,e={}){let{width:i=PP,height:n=MP,color:o="gray",opacity:a=1,altitude:l=0}=e,u={min:{x:1/0,y:1/0,z:l},max:{x:-1/0,y:-1/0,z:l+n}},h={bevelEnabled:!1,depth:n},f=new re.ClipperOffset,m=r.geometry.coordinates.map(P=>P.map(g=>t(g[1],g[0])));f.AddPaths(m.map(P=>P.map(g=>({X:g.x*zt,Y:g.y*zt}))),re.JoinType.jsMiter,re.EndType.etOpenRound);let y=new re.PolyTree;f.Execute(y,i/2*zt);let x=[];for(let P of y.m_AllPolys){let g=new Ge;if(P.IsHole())continue;u.min.x=Math.min(u.min.x,P.m_polygon[0].X),u.min.y=Math.min(u.min.y,P.m_polygon[0].Y),u.max.x=Math.max(u.max.x,P.m_polygon[0].X),u.max.y=Math.max(u.max.y,P.m_polygon[0].Y);let C=P.m_polygon;g.moveTo(C[0].X/zt,C[0].Y/zt),C.slice(1).forEach(w=>g.lineTo(w.X/zt,w.Y/zt)),g.lineTo(C[0].X/zt,C[0].Y/zt),g.holes=P.m_Childs.map(w=>{let I=new Er,M=w.m_polygon;return I.moveTo(M[0].X/zt,M[0].Y/zt),M.slice(1).forEach(_=>I.lineTo(_.X/zt,_.Y/zt)),I.lineTo(M[0].X/zt,M[0].Y/zt),I}),x.push(new Ve(g,h))}let S=Lr(x);return S.translate(0,0,l||0),S.userData={style:{color:o,opacity:a}},f.Clear(),S}s(Fv,"renderMultiLineStringGeometry");d();var xa,Sa,gd=class gd{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 Mt);v(this,"position",new Y);T(this,xa,0);T(this,Sa,1);this.feature=t}setOpacity(){}setColor(){}get altitude(){return c(this,xa)}set altitude(t){this.mesh&&(this.mesh.position.z=t,E(this,xa,t))}get opacity(){return c(this,Sa)}set opacity(t){var e,i;if(this.mesh){for(let n of this.mesh.children)if(n instanceof bs){((e=n.userData)==null?void 0:e.originalOpacity)===void 0&&(n.userData.originalOpacity=n.material.opacity);let o=le(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,Sa,t)}};xa=new WeakMap,Sa=new WeakMap,s(gd,"ModelComponent");var ou=gd;function TP(r){let{color:t,opacity:e,topColor:i,texture:n,topTexture:o}=r;return`${t}${e}${i||""}${n||""}${o||""}`}s(TP,"generateIndex");var wP=1e4,vd=class vd{state;convertTo3DMapPosition;loader;constructor(t,e){this.state=t,this.convertTo3DMapPosition=e}async getGLTFLoader(){if(this.loader)return;let{GLTFLoader:t}=await import("./GLTFLoader-J36XXUE2.js");this.loader=new t}createEntityFromFeature(t,e,i){let n=new qe(e),o=new St(n,new $r(i));return o.id=t,o}createModelFromFeature(t,e,i){let n=new ou(e),o=new St(n,new $r(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 li,o=new rn,a=new cm,l=new Y,u=new Ue;return this.loader||await this.getGLTFLoader(),this.loader.load(e,h=>{var y,x,S,P,g,C;h.scene.traverse(w=>{let I=w;if("isMesh"in I&&I.isMesh===!0){let M=new bs(I.geometry,I.material,t.size);M.userData={entities:{}},u.add(M),i.add(u)}});let f=0,m;for(let w of t.values()){m=this.state.entity3DMap.get(w);let I=m.components[0],M=m.components[0].feature;I.mesh=u,I.instanceIndex=f;let{x:_,y:D,z:k}=this.convertTo3DMapPosition(M.geometry.coordinates[1],M.geometry.coordinates[0],0);I.position.set(_,D,k),o.set(((y=M.properties.rotation)==null?void 0:y[0])||0,((x=M.properties.rotation)==null?void 0:x[1])||0,((S=M.properties.rotation)==null?void 0:S[2])||0),l.set(((P=M.properties.scale)==null?void 0:P[0])||1,((g=M.properties.scale)==null?void 0:g[1])||1,((C=M.properties.scale)==null?void 0:C[2])||1),a.setFromEuler(o),n.compose(I.position,a,l),u.children.forEach(B=>{let R=B;R.setMatrixAt(f,n),R.userData.entities[f]=m.id}),f++}}),u}populateEntityGroup(t){let e,i,n,o;for(let a of t.values())o=this.state.entity3DMap.get(a),o.components[0]instanceof qe&&(i=o.components[0].feature,n=o.components[1],i.geometry.type==="Polygon"?(e=Pv(i,this.convertTo3DMapPosition,n),this.populateEntityMesh(o,e)):i.geometry.type==="MultiPolygon"?(e=Mv(i,this.convertTo3DMapPosition,n),this.populateEntityMesh(o,e)):i.geometry.type==="LineString"?(e=kv(i,this.convertTo3DMapPosition,n),this.populateEntityMesh(o,e)):i.geometry.type==="MultiLineString"&&(e=Fv(i,this.convertTo3DMapPosition,n),this.populateEntityMesh(o,e)));return t}optimize(t){if(t.visible&&(t instanceof de||t instanceof ee)){for(let n of t.children)this.optimize(n);if(t instanceof ee||t.userData.dirty===!1)return;let e={};if(!t.userData.modelURL&&t.userData.dirty)try{this.populateEntityGroup(t.userData.entities3D)}catch(n){H.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 l=o.components[0],u=o.components[1];if(l instanceof qe){n++,n>=wP&&(n=0,i++);let h=TP(u)+i;e[h]===void 0&&(e[h]={style:u,entities:[]}),e[h].entities.push(o)}else l.mesh&&l.mesh.parent!==t&&t.add(l.mesh)}for(let a in e){let l=xv(e[a].entities,e[a].style);t.add(l),t.userData.outlineDirty=!0,t.userData.dirty=!1}}}}update(){this.optimize(this.state.entityScene)}};s(vd,"MeshCreationAndOptimizationSystem");var au=vd;d();var bd=class bd{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 fe&&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}}};s(bd,"DOMVisibilitySystem");var su=bd;d();var Cd=class Cd{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)}};s(Cd,"TwoDProjectionSystem");var lu=Cd;d();d();var IP=s(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")(),Bv=s(({text:r,size:t,maxWidth:e,pixelRatio:i,maxLines:n=2,lineHeight:o=1.2,options:a={strokeText:!0}})=>{let l=`bold ${t*i}px 'InterUI-Regular', Helvetica Neue, Arial, sans-serif`,{measureCanvasContext:u}=IP(i);u.font=l;let h=[],f=r.split(" "),m=0,y=0,x=0;for(;y<f.length;){let C=f[y];if(m===n&&m>0){h[m-1]+="...";break}if(h[m]==null&&(h[m]=C,y++),f.length===1){h[m]=C;break}if(f[y]==null)break;let{width:w}=u.measureText(h[m]+" "+f[y]);w<=e*i?(h[m]+=" "+f[y],y++):m++}h.forEach(C=>{let{width:w}=u.measureText(C);x=Math.max(w,x)});let S=t*i*o,P=h.length*S;return{maxWidth:x,maxHeight:P,lines:h.length,draw:(C,w,I)=>{h.length===1?(a.strokeText&&C.strokeText(h[0],w,I),C.fillText(h[0],w,I)):(a.strokeText&&(C.strokeText(h[0],w,I-S/2),C.strokeText(h[1],w,I+S/2)),C.fillText(h[0],w,I-S/2),C.fillText(h[1],w,I+S/2))}}},"shaveText");var EP=4.5,_P=2.5,LP=2,OP=5,Pa=2.5;var xd=class xd{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,l,u,h,f,m;for(let y of this.state.entity2DIds)if(m=this.state.entity2DMap.get(y),m!=null&&m.components[0]instanceof ze&&!m.disposed){if(f=m.components[0],l=f.appearance.marker.foregroundColor,u=f.appearance.marker.backgroundColor,h=f.markerSize,a=`${l.active}-${l.inactive}-${u.active}-${u.inactive}-${h}`,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:P}=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,P,f.appearance.text.foregroundColor,f.appearance.text.backgroundColor)}),f.dimensions={width:Math.ceil(S/o),height:Math.ceil(P/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:l,maxWidth:u,maxHeight:h}=Bv({text:t,size:e,pixelRatio:a,maxWidth:i,maxLines:n,lineHeight:o});return{textDrawFn:l,width:u+Pa*a*2,height:h+Pa*a*2}};textToCanvas=(t,e,i,n,o,a,l)=>{let u=this.state.pixelRatio,h,f=n,m=o;window.OffscreenCanvas!=null?h=new OffscreenCanvas(f,m):(h=document.createElement("canvas"),h.width=f,h.height=m,h.style.width=f+"px",h.style.height=m+"px");let y=h.getContext("2d");if(!y)return;y.textAlign=i,y.font=`bold ${e*u}px 'InterUI-Regular', Helvetica Neue, Arial, sans-serif`,y.textBaseline="middle",y.lineJoin="miter",y.miterLimit=2,y.strokeStyle="white",y.lineWidth=Pa*u,y.fillStyle=a,y.strokeStyle=l;let x=i==="left"?0:i==="center"?f/2:f-Pa*u/2;return t(y,x,(m+Pa*u/2)/2),h};cacheImage=t=>{if(!t.appearance.marker.icon)return;let e=o3(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(l=>n.endsWith(l)),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,l=t.totalMarkerSize*2*a;window.OffscreenCanvas!=null?o=new OffscreenCanvas(l,l):(o=document.createElement("canvas"),o.width=l,o.height=l,o.style.width=l/a+"px",o.style.height=l/a+"px");let u=o.getContext("2d");return u.shadowColor="rgba(0,0,0,0.3)",u.shadowOffsetY=LP*a,u.shadowBlur=OP*a,u.beginPath(),u.arc(l/2,l/2,e/2+_P*a/2,0,2*Math.PI),u.fillStyle=i,u.fill(),u.beginPath(),u.arc(l/2,l/2,e/2,0,2*Math.PI),u.shadowColor="transparent",u.fillStyle=n,u.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:EP*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,l=t.style.pinVisibility===1?this.pinCache[e][0]:this.pinCache[e][1];if(i.drawImage(l,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 u=this.imagePromiseCache[t.imageHash],h=(t.appearance.marker.iconSize-t.appearance.marker.iconPadding)*n,{iconFit:f}=t.appearance.marker,m=h,y=h,x=`${t.imageHash}_${f}`;if(this.imageDimensionsCache[x])m=this.imageDimensionsCache[x].width,y=this.imageDimensionsCache[x].height;else{let S=u.width*n,P=u.height*n;if(f==="contain"){let g=Math.sqrt(S**2+P**2),C=h/g;m=S*C,y=P*C}if(f==="cover"){let g=h/S,C=h/P,w=Math.max(g,C);m=S*w,y=P*w}}i.save(),i.beginPath(),i.arc(o,a,h/2,0,2*Math.PI),i.closePath(),i.clip(),i.drawImage(u,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()}};s(xd,"TwoDDrawSystem");var uu=xd;d();d();var Qr=class Qr{loader;constructor(){this.loader=new an}static getInstance(){return Qr.instance||(Qr.instance=new Qr),Qr.instance}getLoader(){return this.loader}};s(Qr,"TextureLoaderSingleton"),v(Qr,"instance");var Sd=Qr,cu=Sd.getInstance();function DP(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]}s(DP,"processColor");var Ma,Pd,Md=class Md extends nt{constructor(e){super();T(this,Ma);v(this,"state");v(this,"textureCache",new Map);this.state=e}update(){var a,l,u;let e,i,n,o;for(let h of this.state.threeDEntities)if(o=this.state.entity3DMap.get(h),o instanceof St&&(o.type==="geometry"||o.type==="custom-geometry")&&((a=o.components[1])!=null&&a.dirty||(l=o.components[2])!=null&&l.dirty)){e=o.components[0],i=o.components[1],n=o.components[2];let f=DP(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&&j(this,Ma,Pd).call(this,i.texture,e,"texture"),i.topTexture!==e.topTexture&&j(this,Ma,Pd).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"&&((u=o.components[1])!=null&&u.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()}};Ma=new WeakSet,Pd=s(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}cu.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,()=>{H.error(`Failed to load texture: ${e}`)})}},"#loadTexture"),s(Md,"DrawSystem");var pu=Md;d();var Td=class Td extends nt{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 ze&&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=le(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")}};s(Td,"TwoDVisibilitySystem");var hu=Td;d();var wd=class wd extends nt{state;renderer;mode;scene;cameraObject;viewCamera;systems;constructor(t,e,i,n,o,a,l){super(),this.renderer=t,this.state=e,this.mode=i,this.scene=n,this.cameraObject=o,this.viewCamera=a,this.systems=l,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(),Dh(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=[],Oh(this.state.entityScene,this.state.threeDEntities),this.threeDdirty=!1,this.systems.interactionSystem.dirty3D=!0,this.systems.panBoundsSystem.dirty=!0,this.systems.outlineInterpolationSystem.geometries3DDirty=!0),this.systems.meshOptimizationSystem.update(),this.systems.customGeometrySystem.update(),this.systems.panBoundsSystem.update(),this.systems.stackSystem.update(),this.systems.drawSystem.update(),this.systems.outlineInterpolationSystem.update(this.systems.cameraSystem.getZoomLevel(),this.systems.cameraSystem.zoomDirty),this.systems.cameraSystem.postRender(),this.systems.domVisiblitySystem.update(),this.systems.domMutationSystem.update(),this.systems.twoDProjectionSystem.update(),this.systems.twoDDrawSystem.update(this.systems.cameraSystem.getZoomAltitude(),this.systems.cameraSystem.getZoomScaledMin(),this.systems.cameraSystem.getZoomScaledMax()),this.systems.domDrawSystem.update(this.systems.cameraSystem.isUserInteracting()),this.systems.watermarkSystem.update(),this.nextFrame=requestAnimationFrame(()=>{this.systems.collisionSystem.update()}),this.systems.cameraSystem.dirty=!1,this.systems.cameraSystem.zoomDirty=!1};destroy(){this.frameId&&cancelAnimationFrame(this.frameId),this.twoDFrameId&&cancelAnimationFrame(this.twoDFrameId),this.animationFrameId&&cancelAnimationFrame(this.animationFrameId),this.nextFrame&&cancelAnimationFrame(this.nextFrame),this.state.entity2DIds.clear(),this.state.threeDEntities=[],this.systems.domVisiblitySystem.dirty=!0,this.systems.collisionSystem.dirty=!0,this.update(),this.systems.collisionSystem.off("visibility-changed",this.updateEntities2D),this.systems.twoDVisiblitySystem.off("draw:2d",this.drawEntities2D),this.systems.twoDVisiblitySystem.off("animate:2d",this.animate2D)}};s(wd,"RenderSystem");var du=wd;d();function Wn(r,t,e=!1){let i=null,n=0;return function(...o){n++,n===1&&e===!0&&r.apply(this,o);let a=s(()=>{(!e||n>1)&&r.apply(this,o),i=null,n=0},"later");clearTimeout(i),i=setTimeout(a,t)}}s(Wn,"debounce");d();var Id=`attribute float pathDistance;
158
174
  attribute vec3 pathNormal;
159
175
  attribute vec3 pathTangent;
160
176
 
@@ -238,7 +254,7 @@ void main() {
238
254
 
239
255
  radius = mix(nearRadius, farRadius, zoomLevel);
240
256
  }
241
- `;var bf=`#define ARROW_FADING_POINT 0.15
257
+ `;var Ed=`#define ARROW_FADING_POINT 0.15
242
258
 
243
259
  uniform float complete;
244
260
  uniform float nearRadius;
@@ -459,7 +475,7 @@ void main(void) {
459
475
  gl_FragColor = vec4(color, opacity * opacityMultiplier);
460
476
  }
461
477
  #include <colorspace_fragment>
462
- }`;var wb="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 vP=new Ki,zr,ga,Cf=class Cf{constructor(t,r){v(this,"points");v(this,"type","path");v(this,"mesh",new Xe);v(this,"material");v(this,"geometry");v(this,"outline");v(this,"feature");v(this,"options");v(this,"altitudeAdjustment",1);w(this,zr,1);v(this,"position",new Y);w(this,ga,0);var ji,Wi,Ui;this.points=t;let i=(ji=r==null?void 0:r.nearRadius)!=null?ji:.18,n=!0,o=(Wi=r==null?void 0:r.farRadius)!=null?Wi:.2,a=375,l=1e4,c=(Ui=r==null?void 0:r.color)!=null?Ui:"#ff834c",h="blue",d=!1,m=!0,y=!0,x=!1;this.options={nearRadius:i,farRadius:o,color:c};let P=i/2+.15,g=0;this.points[0].z+=P;for(let J=1;J<this.points.length;++J){this.points[J].z+=P;let xt=this.points[J].x-this.points[J-1].x,gt=this.points[J].y-this.points[J-1].y,pe=this.points[J].z-this.points[J-1].z;g+=Math.sqrt(xt*xt+gt*gt+pe*pe)}let C=P-.1;this.points.push(this.points[this.points.length-1].clone().setZ(C)),this.points.unshift(this.points[0].clone().setZ(C));let T=new $d;x&&(T=vP.load(wb),T.colorSpace=Zi);let M=new Mt(c),I=new Mt(h),_={vertexes:{type:"f",value:1},resolution:{type:"v2",value:new W(1,1)},cameraParameters:{type:"v2",value:new W(1e3,0)},complete:{type:"f",value:n?0:1},color:{type:"c",value:M},pathLength:{type:"f",value:g},nearRadius:{type:"f",value:i},farRadius:{type:"f",value:o},nearZoom:{type:"f",value:a},farZoom:{type:"f",value:l},pulseColor:{type:"c",value:I},pulse:{type:"f",value:0},pulseLength:{type:"f",value:.075},pathIsVertical:{type:"b",value:!1},arrowAnimationTimer:{type:"f",value:0},arrowTexture:{type:"t",value:T},displayArrowsOnPath:{type:"b",value:d},flattenFactor:{type:"f",value:m?.05:1},showPulse:{type:"b",value:y},opacityMultiplier:{type:"f",value:1}},O=new sm(this.points);O.curveType="catmullrom",O.tension=0;let k=30,B=8,R=k*this.points.length,G=new cm(O,R,i,B,!1),H=new Float32Array(G.attributes.position.count);for(let J=this.points.length;J<H.length;J++)H[J]=J;G.setAttribute("vertexIndex",new io(H,1));let Q=new Float32Array(G.attributes.position.count),lt=new io(Q,1);for(let J=0;J<=R;J++)for(let xt=0;xt<=B;++xt)lt.setX(J*(B+1)+xt,J/R);G.setAttribute("pathDistance",lt);let ht=new Float32Array(G.attributes.normal.count*3),yt=new io(ht,3);for(let J=0;J<R;J++){let xt=G.tangents[J];for(let gt=0;gt<=B;++gt)yt.setXYZ(J*(B+1)+gt,xt.x,xt.y,xt.z)}G.setAttribute("pathTangent",yt);let At=new Float32Array(G.attributes.normal.count*3),ve=new io(At,3);for(let J=0;J<R;J++){let xt=G.tangents[J];var kt,ut,Ct;kt=-xt.x*xt.z,ut=-xt.y*xt.z,Ct=1-xt.z*xt.z;let gt=Math.sqrt(kt*kt+ut*ut+Ct*Ct);gt===0&&(gt=1);let pe=kt/gt,zi=ut/gt,Kn=Ct/gt;for(let Kr=0;Kr<=B;++Kr)ve.setXYZ(J*(B+1)+Kr,pe,zi,Kn)}G.setAttribute("pathNormal",ve),this.geometry=G;let Je=new no({uniforms:_,vertexShader:vf,fragmentShader:bf});Je.transparent=!0,Je.alphaTest=.5,_.resolution.value.x=1,_.resolution.value.y=1,_.vertexes.value=H.length,_.arrowTexture.value.wrapS=ro,_.arrowTexture.value.wrapT=ro,_.arrowTexture.value.anisotropy=16,_.complete.value=u(this,zr);let be=new Ft(G,Je),ae=be.clone(),jt={..._,opacityMultiplier:{type:"f",value:.25}};jt.complete.value=1,ae.material=new no({uniforms:jt,vertexShader:vf,fragmentShader:bf}),ae.material.transparent=!0,ae.material.alphaTest=.5,ae.material.depthWrite=!1,ae.material.depthTest=!1,ae.renderOrder=1,jt.resolution.value.x=1,jt.resolution.value.y=1,jt.vertexes.value=H.length,jt.arrowTexture.value.wrapS=ro,jt.arrowTexture.value.wrapT=ro,jt.arrowTexture.value.anisotropy=16,jt.complete.value=u(this,zr),this.mesh.add(be),this.mesh.add(ae),G.computeBoundingBox(),G.boundingBox.getCenter(this.position),this.material=Je}setColor(){}setOpacity(){}set completeFraction(t){E(this,zr,t),this.mesh.children.forEach(r=>{r.material.uniforms.complete.value=u(this,zr),r.material.needsUpdate=!0})}get completeFraction(){return u(this,zr)}set visible(t){this.mesh&&(this.mesh.visible=t)}get visible(){return this.mesh?this.mesh.visible:!1}get altitude(){return u(this,ga)}set altitude(t){this.mesh.position.z=t,E(this,ga,t)}set complete(t){this.material.uniforms.complete.value=t,this.material.needsUpdate=!0}};zr=new WeakMap,ga=new WeakMap,s(Cf,"PathComponent");var ac=Cf;f();var xf=class xf{rendererState;constructor(t){this.rendererState=t}update(){let t;for(let r of this.rendererState.threeDEntities)if(t=this.rendererState.entity3DMap.get(r),t instanceof re&&t.components[0]){let i=t.components[0];if(i.dirty){for(let n of t.children)(n instanceof fe||n instanceof re)&&(n.userData.entityId!==t.components[0].activeId?n.setVisible(!1):n.setVisible(!0));i.dirty=!1}}}};s(xf,"StackSystem");var sc=xf;f();f();var Ca=Cr(Gn());f();f();f();var Tb=s((e,t)=>(t-e+Math.PI)%(Math.PI*2)+Math.PI*2%(Math.PI*2)-Math.PI,"differenceBetweenAngles"),Ib=s((e,t)=>new W(e.clientX-t.offsetLeft,e.clientY-t.offsetTop),"getTouchPos"),wf=s((e,t)=>Math.atan2(t.y-e.y,t.x-e.x),"angle"),va=s((e,t)=>Math.sqrt((t.y-e.y)**2+(t.x-e.x)**2),"distance"),Tf=s((e,t)=>new W((e.x+t.x)/2,(e.y+t.y)/2),"average"),If=s(e=>{let t=0,{wheelDelta:r,detail:i}=e;return r!==void 0?t=r:i!==void 0&&(t=-i),t},"getScrollDelta");var Ef=class Ef{input1;input2;lastAngle;lastDistance;totalDistance;first;second;constructor(t,r){this.input1=t,this.input2=r,this.lastAngle=wf(t,r),this.lastDistance=va(t,r),this.totalDistance=0,this.first=t,this.second=r}update(t,r){let i=va(t,r);this.input1=t,this.input2=r;let n=wf(t,r);this.lastAngle=n,this.lastDistance=i,this.totalDistance+=(va(this.first,t)+va(this.second,r))/2,this.first=Tf(this.first,t),this.second=Tf(this.second,r)}};s(Ef,"InputSet");var lc=Ef;f();var _f=class _f{touch;camera;cameraPlane;viewCoordinate;snapHolderMatrix;snapCamera;cameraPosition;raycaster;worldCoordinate;snapshotted=!1;constructor(t,r,i){this.touch=t,this.camera=r,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 W(this.viewCoordinate.x,this.viewCoordinate.y);this.raycaster=this.raycaster||new Pr,this.raycaster.setFromCamera(t,this.snapCamera);let r=this.raycaster.intersectObject(this.cameraPlane,!0);this.worldCoordinate=r&&r.length>0?r[0].point:null,this.snapshotted=!0}updateAnchorState(t,r){this.camera=t,this.snapCamera=t.clone(),this.snapHolderMatrix=t.matrixWorld.clone(),this.updateViewCoordinate(r),this.snapshotCameraState()}updateViewCoordinate(t){this.viewCoordinate={x:t.x,y:t.y}}reUnproject(){var i,n;let t=new W(this.viewCoordinate.x,this.viewCoordinate.y);(i=this.raycaster)==null||i.setFromCamera(t,this.snapCamera);let r=(n=this.raycaster)==null?void 0:n.intersectObject(this.cameraPlane,!0)[0];return r?r.point:void 0}};s(_f,"TouchAnchor");var ba=_f;var Li,cc,Lf=class Lf extends st{constructor(r,i,n,o,a){super();v(this,"dirty",!1);v(this,"zoomDirty",!1);v(this,"zoomSpeed",5);v(this,"rotateSpeed",100);v(this,"enabled",!0);v(this,"enableZoom",!0);v(this,"enablePan",!0);v(this,"enablePedestal",!1);v(this,"maxPedestal",1/0);v(this,"minPedestal",0);v(this,"enableRotate",!0);v(this,"minZoomAltitude",5);v(this,"maxZoomAltitude",1e4);v(this,"initialMinZoom",5);v(this,"initialMaxZoom",1e4);v(this,"ignoreZoomLimits",!1);v(this,"minExpandedZoom",5);v(this,"maxExpandedZoom",1e5);v(this,"zoomFactor",1);v(this,"panBounds",{min:new 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:cs.RIGHT,ZOOM:cs.MIDDLE,PAN:cs.LEFT});v(this,"camera");v(this,"scene");v(this,"renderer");v(this,"elevation");v(this,"orbit");v(this,"cameraPlane");v(this,"raycaster",new Pr);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 hm(!0));v(this,"coords",{mouse:new W,rotateStart:new W,rotateEnd:new W,rotateDelta:new W,panStart:new Y,panCameraStart:new Y,panEnd:new Y,panDelta:new Y,initialShiftPos:new W,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",r=>{this.raycaster.setFromCamera(r,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",(r,i)=>{isNaN(r)||isNaN(i)||(this.setPosition(this.orbit.position.x+r,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",()=>Ca.default.getAll().some(r=>r._mMapAnimation));v(this,"isCameraMoving",()=>this.state!==-1);v(this,"setPosition",(r,i)=>{if(isNaN(r)||isNaN(i))return;this.state===-1&&this.publish("pan-start");let n=r-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 l=Math.atan2(o,n),c={x:Math.cos(l)*this.panBounds.radius+this.panBounds.center.x,y:Math.sin(l)*this.panBounds.radius+this.panBounds.center.y};this.orbit.position.x=c.x,this.orbit.position.y=c.y}else this.orbit.position.x=r,this.orbit.position.y=i;this.publish("position-updated"),this.publish("change"),this.state===-1&&this.publish("pan-end"),this.dirty=!0});v(this,"tilt",r=>{if(isNaN(r))return;this.state===-1&&this.publish("rotate-start");let i=this.stayInsideBounds?Math.max(Math.min(r+this.getTilt(),this.maxTilt),this.minTilt):r+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",(r,i,n)=>{let o=this.getZoomAltitude();this.animateCamera({zoom:o/1.5},r,i,n)});v(this,"zoomOut",(r,i,n)=>{let o=this.getZoomAltitude();this.animateCamera({zoom:o*1.5},r,i,n)});v(this,"getRotation",()=>this.orbit.rotation.z);v(this,"cancelAnimation",()=>{let r=Array.from(this.tweens),i=r[r.length-1];i.state===7&&this.publish("multi-cancel",{zooming:!0,rotating:!0,tilting:!0}),this.completeTween(i)});v(this,"animateCamera",(r,i,n,o,a,l)=>{let c={mode:vh.cancel,...l},h={},d={},m=this.getPosition();if(r.position!=null&&(r.position.x!==void 0&&(h.x=m.x,d.x=r.position.x),r.position.y!==void 0&&(h.y=m.y,d.y=r.position.y),r.position.z!==void 0&&(h.z=m.z,d.z=r.position.z)),r.zoom!==void 0&&(h.zoom=this.stayInsideBounds?Math.min(Math.max(this.getZoomAltitude(),this.getZoomScaledMin()),this.getZoomScaledMax()):this.getZoomAltitude(),this.viewState==="multi_floor"||!this.stayInsideBounds?d.zoom=r.zoom:d.zoom=Math.min(Math.max(r.zoom,this.getZoomScaledMin()),this.getZoomScaledMax())),r.rotation!==void 0){let M=h.rotation=this.getRotation(),I=r.rotation%(2*Math.PI),_=I-M;if(Math.abs(_)>Math.PI){let O=_<0?1:-1;d.rotation=I+2*Math.PI*O}else d.rotation=I}r.tilt!==void 0&&(h.tilt=this.getTilt(),this.viewState==="multi_floor"||!this.stayInsideBounds?d.tilt=r.tilt:d.tilt=Math.max(Math.min(r.tilt,this.maxTilt),this.minTilt));let y=h.zoom!==d.zoom,x=h.rotation!==d.rotation,S=h.tilt!==d.tilt,P=new Ca.default.Tween(h).to(d,b.env.TESTING?0:i).onUpdate(M=>{this.setMulti({x:M.x,y:M.y,z:M.z},M.zoom,M.rotation,M.tilt)}).onComplete(()=>{this.completeTween(P),this.publish("multi-end",{zooming:y,rotating:x,tilting:S}),o&&o()}).onStart(()=>{this.state!==7&&(this.state=7,P.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],T=!1;return C!=null&&(c.mode===vh.chain?(T=!0,C.chain(P)):(this.completeTween(C),typeof a=="function"&&a(),C=null)),this.tweens.add(P),n?P.easing(n):P.easing(Ca.default.Easing.Quadratic.In),!r.doNotAutoStart&&!T&&(P.start(),this.publish("change")),P._mMapAnimation=!0,P});v(this,"setMulti",(r,i,n,o,a=!0)=>{this.state===-1&&this.publish("multi-start");let l=!1;r!=null&&(r.x!==void 0&&!isNaN(r.x)&&(this.orbit.position.x=r.x,l=!0),r.y!==void 0&&!isNaN(r.y)&&(this.orbit.position.y=r.y,l=!0),r.z!==void 0&&!isNaN(r.z)&&(this.setPedestal(r.z,!0),l=!0)),l&&this.publish("position-updated");let c={zooming:!1,tilting:!!i,rotating:!1};if(i!==void 0&&!isNaN(i)){let h=this.stayInsideBounds?Math.min(Math.max(i,this.getZoomScaledMin()),this.getZoomScaledMax()):i;h!==this.camera.position.z&&(c.zooming=!0,this.camera.position.z=h,this.publish("zoom-updated"),this.zoomDirty=!0,this.viewState==="multi_floor"?i>bl&&(this.camera.near=i-bl,this.camera.far=i+bl):(this.camera.near=i/Zo,this.camera.far=i*Zo),this.camera.updateProjectionMatrix())}if(n!==void 0&&!isNaN(n)&&n!==this.orbit.rotation.z&&(c.rotating=!0,this.orbit.rotation.z=n,this.publish("rotation-updated")),o!==void 0&&!isNaN(o)){let h=this.stayInsideBounds?Math.max(Math.min(o,this.maxTilt),this.minTilt):o;h!==this.elevation.rotation.x&&(c.tilting=!0,this.elevation.rotation.x=h,this.publish("tilt-updated"))}a&&this.publish("change"),this.state===-1&&this.publish("multi-end",c)});v(this,"getZoomScaledMin",()=>this.minZoomAltitude*this.zoomFactor);v(this,"getZoomScaledMax",()=>{let r=this.minZoomAltitude*this.zoomFactor;return Math.max(this.maxZoomAltitude,r)});v(this,"setRotation",(r,i)=>{if(isNaN(r))return;this.state===-1&&!i&&this.publish("rotate-start");let n=r%bh;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",r=>{if(isNaN(r))return;this.state===-1&&this.publish("zoom-start");let i=this.stayInsideBounds?Math.min(Math.max(r,this.getZoomScaledMin()),this.getZoomScaledMax()):r;i!==this.camera.position.z&&(this.camera.position.z=i,this.publish("zoom-updated"),this.zoomDirty=!0),this.camera.near=i/Zo,this.camera.far=i*Zo,this.camera.updateProjectionMatrix(),this.publish("change"),this.state===-1&&this.publish("zoom-end"),this.dirty=!0});v(this,"setZoomLevel",r=>{this.setZoomAltitude(this.convertZoomLevelToAltitude(r))});v(this,"getZoomAltitude",()=>this.camera.position.z);v(this,"getZoomLevel",()=>this.convertAltitudeToZoomLevel(this.getZoomAltitude()));v(this,"rotate",r=>{if(isNaN(r))return;this.state===-1&&this.publish("rotate-start");let i=(this.orbit.rotation.z+r)%bh;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",(r,i)=>{if(isNaN(r))return;this.state===-1&&!i&&this.publish("rotate-start");let n=this.stayInsideBounds?Math.max(Math.min(r,this.maxTilt),this.minTilt):r;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",r=>{this.cameraPlane.position.z=r});v(this,"zoom",r=>{if(isNaN(r))return;this.state===-1&&this.publish("zoom-start");let i=this.getZoomAltitude()-r;this.camera.position.z=this.stayInsideBounds?Math.min(Math.max(i,this.minZoomAltitude*this.zoomFactor),this.maxZoomAltitude*this.zoomFactor):i,this.publish("zoom-updated"),this.zoomDirty=!0,this.publish("change"),this.state===-1&&this.publish("zoom-end")});v(this,"expandZoomLimits",(r,i)=>{i||(i=1.2),r*i>this.maxZoomAltitude&&(this.maxZoomAltitude=Math.min(r*i,this.maxExpandedZoom)),r/i<this.minZoomAltitude&&(this.minZoomAltitude=Math.max(r/i,this.minExpandedZoom))});v(this,"restrictZoomLimits",(r,i)=>{i||(i=1.2),r*i>this.initialMaxZoom&&r*i<this.maxZoomAltitude&&(this.maxZoomAltitude=Math.max(this.getZoomAltitude(),r*i)),r/i<this.initialMinZoom&&r/i>this.minZoomAltitude&&(this.minZoomAltitude=Math.min(this.getZoomAltitude(),r/i))});v(this,"getProjectionScaleFactor",(r,i,n)=>Th(r,i,n));v(this,"update",()=>{Ca.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",(r,i=!1)=>{typeof r=="number"&&!isNaN(r)&&(this.orbit.position.z=r,i&&(this.publishPedestalChangeEvent(r),this.publish("change")),this.dirty=!0)});v(this,"dispose",()=>{for(let r of Sh)r.endsWith("start")?this.off(r,this.setUserInteracting):r.endsWith("end")&&this.off(r,this.unsetUserInteracting);this.removeEventListeners(),this.scene.remove(this.cameraPlane)});v(this,"createCameraPlane",()=>{let r=new $i(1e10,1e10),i=new xr({color:0,visible:!1}),n=new Ft(r,i);return this.scene.add(n),n});v(this,"addEventListeners",()=>{let{domElement:r}=this.renderer;for(let i of Sh)i.endsWith("start")?this.on(i,this.setUserInteracting):i.endsWith("end")&&this.on(i,this.unsetUserInteracting);r.addEventListener("contextmenu",this.onContextMenu,!1),r.addEventListener("mousedown",this.onMouseDown,!1),r.addEventListener("wheel",this.onMouseWheel,{passive:!1}),r.addEventListener("touchstart",this.onTouchStart,!1),r.addEventListener("touchend",this.onTouchEnd,!1),r.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:r}=this.renderer;r.removeEventListener("contextmenu",this.onContextMenu,!1),r.removeEventListener("mousedown",this.onMouseDown,!1),r.removeEventListener("wheel",this.onMouseWheel,!1),r.removeEventListener("touchstart",this.onTouchStart,!1),r.removeEventListener("touchend",this.onTouchEnd,!1),r.removeEventListener("touchmove",this.onTouchMove,!1),r.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",r=>{r.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",r=>{if(this.enabled!==!1)if(r.preventDefault(),this.mouseToScene(r),this.state===0){if(this.enableRotate===!1)return;this.handleMouseMoveRotate(r)}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(r)});v(this,"onTouchStart",r=>{if(this.enabled!==!1){switch(this.updateTouchOrigin(),this.touchToScene(r),r.touches.length){case 1:this.enablePedestal?(this.handleTouchStartPedestal(r),this.state=9):this.enablePan&&(this.handleTouchStartPan(r),this.state=6);break;case 2:this.touch.inputs=new lc(this.touch.touches[0],this.touch.touches[1]);break;default:this.state=-1}this.state}});v(this,"onTouchMove",r=>{if(this.enabled!==!1)switch(this.touchToScene(r),r.touches.length){case 2:r.preventDefault(),r.stopPropagation();let i={...this.touch.inputs.first},n={...this.touch.inputs.second},o=new W(this.touch.touches[0].x,this.touch.touches[0].y),a=new W(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(r);else if(this.state===5)this.handleTouchMoveDolly();else if(this.state!==5&&this.touch.inputs.totalDistance>.05){let l=i.y<o.y&&n.y<a.y,c=i.y>o.y&&n.y>a.y;this.enableRotate&&this.state!==4&&(c||l)?(this.handleTouchStartTilt(r),this.state=4):(this.handleTouchStartDolly(),this.state=5)}break;case 1:(this.enablePedestal||this.enablePan)&&(r.preventDefault(),r.stopPropagation()),this.enablePedestal&&this.state===9?this.handleTouchMovePedestal(r):this.enablePan&&this.state===6&&this.handleTouchMovePan(r);break;default:this.state=-1}});v(this,"onTouchEnd",()=>{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}this.state=-1}});v(this,"handleTouchMovePan",r=>{let i=Object.hasOwn(r,"x")?new W(r.x,r.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 r=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 W(this.touch.touches[0].x-r/2,this.touch.touches[0].y-i/2);this.coords.floorAnchor=this.raycastToFloor(n),this.orbit.updateMatrixWorld(),this.touch.anchor1=new ba(this.touch.touches[0],this.camera,this.cameraPlane),this.touch.anchor2=new ba(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 r=this.raycastToFloor(this.coords.mouse);this.coords.panEnd.set(r.x,r.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",r=>{this.coords.rotateStart.set(r.touches[1].clientX,r.touches[1].clientY),this.publish("user-tilt-start"),this.publish("rotate-start")});v(this,"handleTouchMovePedestal",r=>{this.handleMouseMovePedestal(r.touches[0])});v(this,"handleTouchMoveTilt",r=>{this.coords.rotateEnd.set(r.touches[1].clientX,r.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 r=this.touch.inputs.first,i=this.touch.inputs.second;this.touch.anchor1.viewCoordinate={x:r.x,y:r.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,r),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",r=>{let i=Object.hasOwn(r,"x")?new W(r.x,r.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",r=>{this.handleMouseDownPedestal(r.touches[0])});v(this,"onMouseDown",r=>{if(this.enabled!==!1){if(this.mouseToScene(r),r.preventDefault(),this.state===3&&this.publish("zoom-end"),r.button===this.MOUSE_BUTTONS.ORBIT){if(this.enableRotate===!1)return;this.handleMouseDownRotate(r),this.state=0}else r.button===this.MOUSE_BUTTONS.PAN&&(this.enablePan?(this.handleMouseDownPan(),this.state=2):this.enablePedestal&&(this.handleMouseDownPedestal(r),this.state=8));this.state!==-1&&this.addMouseEventListeners()}});v(this,"onMouseWheel",r=>{this.enabled===!1||this.enableZoom===!1||this.state!==-1&&this.state!==3||(r.preventDefault(),r.stopPropagation(),this.mouseToScene(r),this.canScrollZoom(r)&&(this.lastWheelTime=this.clock.getElapsedTime(),this.publishUserZoomEvent()),this.state!==3&&this.canScrollZoom(r)&&(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(r))});v(this,"handleMouseWheel",r=>{if(this.publish("zoom-start"),!this.canScrollZoom(r)){this.lastWheelTime>0&&this.publish("zoom-end"),this.lastWheelTime=0,this.state=-1;return}let i=this.getZoomAltitude(),n=i-If(r)*i/Y2*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",r=>{this.orbit.updateMatrixWorld();let i=new qi;i.setFromRotationMatrix(r,"ZYX");let n=(r.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 l=new Y;l.setFromMatrixPosition(r),l.sub(a),this.enablePan&&this.setPosition(l.x,l.y),this.enableZoom&&this.setZoomAltitude(n),this.enableRotate&&this.setRotation(o)});v(this,"makeTransformFromTouchAnchors",(r,i)=>{this.orbit.updateMatrixWorld(),this.camera.updateProjectionMatrix();let n=this.camera.projectionMatrix.clone(),o=r.worldCoordinate,a=i.worldCoordinate,l=r.reUnproject(),c=i.reUnproject();if(!l||!c||!o||!a)return null;let h=r.viewCoordinate,d=i.viewCoordinate,m=a.x-o.x,y=a.y-o.y,x=Math.atan2(y,m),S=c.x-l.x,P=c.y-l.y,g=Math.atan2(P,S),C=Tb(x,g),T=new ti;T.makeRotationZ(-C);let M=T.clone();M.multiply(r.snapHolderMatrix);let I=s((T3,I3,E3)=>T3.elements[(I3-1)*4+E3-1],"m"),_=I(n,1,1)*I(M,1,1)-h.x*I(n,3,4)*I(M,3,1),O=I(n,1,1)*I(M,1,2)-h.x*I(n,3,4)*I(M,3,2),k=I(n,1,1)*I(M,1,3)-h.x*I(n,3,4)*I(M,3,3),B=o.x*_+o.y*O+o.z*k,R=I(n,2,2)*I(M,2,1)-h.y*I(n,3,4)*I(M,3,1),G=I(n,2,2)*I(M,2,2)-h.y*I(n,3,4)*I(M,3,2),H=I(n,2,2)*I(M,2,3)-h.y*I(n,3,4)*I(M,3,3),Q=o.x*R+o.y*G+o.z*H,lt=I(n,1,1)*I(M,1,1)-d.x*I(n,3,4)*I(M,3,1),ht=I(n,1,1)*I(M,1,2)-d.x*I(n,3,4)*I(M,3,2),yt=I(n,1,1)*I(M,1,3)-d.x*I(n,3,4)*I(M,3,3),At=a.x*lt+a.y*ht+a.z*yt,ve=I(n,2,2)*I(M,2,1)-d.y*I(n,3,4)*I(M,3,1),kt=I(n,2,2)*I(M,2,2)-d.y*I(n,3,4)*I(M,3,2),ut=I(n,2,2)*I(M,2,3)-d.y*I(n,3,4)*I(M,3,3),Ct=a.x*ve+a.y*kt+a.z*ut,Je=Math.abs(lt-_),be=Math.abs(ht-O),ae=Math.abs(yt-k),jt=Math.abs(lt-R),ji=Math.abs(ht-G),Wi=Math.abs(yt-H),Ui=Math.abs(ve-_),J=Math.abs(kt-O),xt=Math.abs(ut-k),gt=Math.abs(ve-R),pe=Math.abs(kt-G),zi=Math.abs(ut-H),Kn=Math.min(Je+be+ae,jt+ji+Wi),Kr=Math.min(Ui+J+xt,gt+pe+zi);Kn<Kr&&(lt=ve,ht=kt,yt=ut,At=Ct);let Nt=R*k-_*H,Qr=G*k-O*H,as=Q*k-B*H,Qn=lt*H-R*yt,to=ht*H-G*yt,ss=At*H-Q*yt,x3=(ss*Qr-as*to)/(Qn*Qr-Nt*to),S3=(ss*Nt-as*Qn)/(to*Nt-Qr*Qn),Wd=G*_-O*R,P3=H*_-k*R,M3=Q*_-B*R,Ud=ht*R-G*lt,w3=yt*R-H*lt,zd=((At*R-Q*lt)*Wd-M3*Ud)/(w3*Wd-P3*Ud),ls=M.clone();return ls.elements[12]=x3,ls.elements[13]=S3,ls.elements[14]=zd,zd>0?ls:null});v(this,"updateTouchOrigin",()=>{let r=this.renderer.domElement;this.touch.origin.offsetLeft=r.getBoundingClientRect().left,this.touch.origin.offsetTop=r.getBoundingClientRect().top});v(this,"touchToScene",r=>{this.touch.touches=[];for(let i=0,n=r.touches.length;i<n;i++){let o=r.touches[i],a=Ib(o,this.touch.origin);this.touch.touches.push(new W(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",r=>{let i=If(r),n=this.getZoomAltitude();return!(i<0&&n===this.getZoomScaledMax()||i>0&&n===this.getZoomScaledMin())});v(this,"mouseToScene",r=>{let i=this.getMousePos(r);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",r=>({x:r.offsetX,y:r.offsetY}));v(this,"handleMouseDownRotate",r=>{this.coords.rotateStart.set(r.clientX,r.clientY),this.publish("rotate-start"),this.publish("user-rotate-start")});v(this,"handleMouseDownPan",()=>{let r=this.raycastToFloor(this.coords.mouse);this.coords.panStart.set(r.x,r.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",r=>{let i=new W(r.clientX,r.clientY);this.coords.initialShiftPos=i,this.coords.initialPedestal=this.getPedestal(),this.pedestalScaleFactor=Th(this.camera.fov,this.renderer.domElement.clientHeight,this.getZoomAltitude()),this.publish("pedestal-start"),this.publish("user-pedestal-start")});v(this,"handleMouseMovePedestal",r=>{let i={x:r.clientX,y:r.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",r=>{this.coords.rotateEnd.set(r.clientX,r.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",Bn(()=>{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",r=>{this.publish("pedestal-change",{pedestal:r,scrolledToTop:this.scrolledToTop,scrolledToBottom:this.scrolledToBottom,scrollPercent:this.scrollPercent})});v(this,"convertAltitudeToZoomLevel",r=>{let[,i]=this.center,o=r*2*Math.tan(at.degToRad(this.camera.fov)/2)/this.options.canvasHeight,a=Math.cos(at.degToRad(i))*2*Math.PI*Xr/o;return at.clamp(Math.log2(a/512),Ch,xh)});v(this,"convertZoomLevelToAltitude",r=>{let[,i]=this.center,n=at.clamp(r,Ch,xh),o=Math.pow(2,n),a=at.clamp(i,H2,X2),l=o*512;return Math.cos(at.degToRad(a))*Math.PI*2*Xr/l*this.options.canvasHeight/2/Math.tan(at.degToRad(this.camera.fov)/2)});v(this,"completeTween",r=>{r.isPlaying?r.stop():r.end(),this.tweens.delete(r)});w(this,Li,{PIXELS:"pixels",PORTIONS:"portions"});w(this,cc,["top","bottom","left","right"]);v(this,"getCameraFrameForPoints",(r,i,n,o,a=!0,{canvasWidth:l,canvasHeight:c},h=this.minZoomAltitude,d=this.maxZoomAltitude)=>{Number.isFinite(n)&&(n=1),Number.isFinite(i)&&(i=1),h=Math.max(this.cameraPlane.position.z,h);let m={position:this.getPosition(),zoom:h};if(r==null||r.length===0)return m;o||(o={top:0,bottom:0,left:0,right:0,type:u(this,Li).PIXELS});for(let Nt of u(this,cc))typeof o[Nt]!="number"&&(o[Nt]=0);if(o.type||(o.type=u(this,Li).PIXELS),o.type===u(this,Li).PORTIONS&&(o={top:o.top*c,bottom:o.bottom*c,left:o.left*l,right:o.right*l,type:u(this,Li).PIXELS}),o.left+o.right>=l||o.top+o.bottom>=c)return m;this.orbit.updateMatrixWorld();let y=this.camera.matrixWorldInverse,x=this.camera.fov*(Math.PI/180)/2,S=x*n,g=Math.atan(Math.tan(x)*(l/c))*i;if(r.length===1){let Nt=r[0].clone();Nt.applyMatrix4(y);let Qr=h*Math.tan(g)*2,as=h*Math.tan(S)*2,Qn=(o.left-o.right)/2/l,to=(o.top-o.bottom)/2/c,ss=new Y(-Qn*Qr,to*as,0);return Nt.add(ss),Nt.applyMatrix4(this.camera.matrixWorld),m.position.x=Nt.x,m.position.y=Nt.y,m.position.z=Nt.z,m.zoom=Math.max(m.zoom,m.position.z),m}let C=new Y(1/0,1/0,1/0),T=new Y(-1/0,-1/0,-1/0),M=new Ne().setFromPoints(r),I;for(let Nt=0,Qr=r.length;Nt<Qr;Nt++)I=r[Nt].clone(),I.applyMatrix4(y),C.min(I),T.max(I);let _=T.x-C.x,O=T.y-C.y,k=l-o.left-o.right,B=c-o.top-o.bottom,R=(T.x+C.x)/2,G=(T.y+C.y)/2,H=_/k,Q=O/B,lt=h,ht=d,yt=lt*Math.tan(g)*2,At=ht*Math.tan(g)*2,ve=yt/l,kt=At/l,ut=Math.max(H,Q);a&&(ut=Math.min(Math.max(ut,ve),kt));let Ct=k*ut,Je=B*ut,be={min:{x:R-Ct/2-o.left*ut,y:G-Je/2-o.bottom*ut},max:{x:R+Ct/2+o.right*ut,y:G+Je/2+o.top*ut}},ae=(be.min.x+be.max.x)/2,jt=(be.min.y+be.max.y)/2,ji=M.getCenter(new Y),Wi=Math.abs(ae-be.min.x),Ui=Math.abs(jt-be.min.y),J=Wi/Math.tan(g),xt=Ui/Math.tan(S),gt=new Y;gt.set(ae,jt,T.z+Math.max(J,xt)),gt.applyMatrix4(this.camera.matrixWorld);let pe=new Y;pe.set(ae,jt,T.z),pe.applyMatrix4(this.camera.matrixWorld);let zi=new Y().subVectors(pe,gt),Kn=(ji.z-gt.z)/zi.z,Kr=new Y().copy(gt).add(zi.clone().multiplyScalar(Kn));return m.position=Kr,pe.set(m.position.x,m.position.y,m.position.z),gt.sub(pe),m.zoom=gt.length(),m});this.camera=r,this.renderer=n,this.rendererState=o,this.scene=i,this.options=a,this.elevation=r.parent,this.orbit=this.elevation.parent,this.cameraPlane=this.createCameraPlane(),this.zoomStart=r.position.z,a.mode!=="outdoors-overlay"&&this.addEventListeners()}get maxZoomLevel(){return this.convertAltitudeToZoomLevel(this.minZoomAltitude)}setMaxZoomLevel(r){this.minZoomAltitude=this.convertZoomLevelToAltitude(r)}get minZoomLevel(){return this.convertAltitudeToZoomLevel(this.maxZoomAltitude)}setMinZoomLevel(r){this.maxZoomAltitude=this.convertZoomLevelToAltitude(r)}get scrollPercent(){let r=this.minPedestal,i=this.maxPedestal,n=this.getPedestal();return n=Math.min(n,i),n=Math.max(n,r),(n-r)/(i-r)*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,l,c;let r=this.getPosition(),{lat:i,lon:n}=Cl((a=(o=this.rendererState.center)==null?void 0:o[1])!=null?a:0,(c=(l=this.rendererState.center)==null?void 0:l[0])!=null?c:0,r.x,r.y);return[n,i]}setCenter(r,i,n=0){var l,c,h,d;let{x:o,y:a}=xl((c=(l=this.rendererState.center)==null?void 0:l[1])!=null?c:0,(d=(h=this.rendererState.center)==null?void 0:h[0])!=null?d:0,i,r);return new Y(o,a,n)}focusOn(r,{insetsPadding:i},n={}){var g;let o=(g=n.changeZoom)!=null?g:!0,a=n.curve,l=1,c=1,h=n.callback,d=n.cancelledCallback,m=n.minZoom!==void 0?n.minZoom:this.minZoomAltitude,y=n.maxZoom!==void 0?n.maxZoom:this.maxZoomAltitude,x=this.options.canvasWidth,S=this.options.canvasHeight,P;if(n.duration!==void 0?P=n.duration:b.env.TESTING==="true"?P=0:P=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},P,a,()=>{let C=n.padding||i,T=this.getCameraFrameForPoints(r,l,c,C,o,{canvasWidth:x,canvasHeight:S},m,y);this.animateCamera({position:T.position,tilt:this.getTilt(),rotation:this.getRotation(),zoom:T.zoom},P,a,h,d)});else{let C=n.padding||i,T=this.getCameraFrameForPoints(r,l,c,C,o,{canvasWidth:x,canvasHeight:S},m,y);this.animateCamera({position:T.position,tilt:this.getTilt(),rotation:this.getRotation(),zoom:T.zoom},P,a,h,d)}else{let C=n.padding||i,T=this.getCameraFrameForPoints(r,l,c,C,o,{canvasHeight:S,canvasWidth:x},m,y);this.animateCamera({position:T.position,tilt:n.tilt,rotation:n.rotation,zoom:T.zoom},P,a,h,d)}}resize(r,i){this.options.canvasWidth=r,this.options.canvasHeight=i}};Li=new WeakMap,cc=new WeakMap,s(Lf,"CameraSystem");var xa=Lf;f();var CP=300,Of=class Of{state;constructor(t){this.state=t}update(t){var o;let r,i,n;for(let a of this.state.entity2DIds)r=this.state.entity2DMap.get(a),r&&(i=r.components[0],n=r.components[1],i instanceof de&&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:CP,easing:"ease-in-out",fill:"forwards"}),i.visibilityNeedsUpdate=!1)))}};s(Of,"DOMDrawSystem");var uc=Of;f();var Df=class Df extends st{state;dirty=!0;domTree;observers=new Map;constructor(t,r){super(),this.state=t,this.domTree=r}setupObserver(){var r;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),(r=t.components[0].options)!=null&&r.dynamicResize)){let o=new ResizeObserver(this.updateDimensions);o.observe(i),this.observers.set(i.userData.entityId,o)}}}updateDimensions=t=>{t.forEach(r=>{let i=r.target,n=i.getAttribute("data-marker-id");if(n){let o=this.state.entity2DMap.get(n);if(o&&o.components[0]instanceof de&&i.firstElementChild){let{width:a,height:l}=i.firstElementChild.getBoundingClientRect();o.components[0].updateDimensions(a,l)}}}),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()}};s(Df,"DOMResizeSystem");var pc=Df;f();var Sa=Cr(Gn());var xP=0,SP=22,PP=0,MP=90,_b={linear:Sa.default.Easing.Linear.None,"ease-in":Sa.default.Easing.Quadratic.In,"ease-out":Sa.default.Easing.Quadratic.Out,"ease-in-out":Sa.default.Easing.Quadratic.InOut},ne,tt,Oi,Pa,Af=class Af{constructor(t,r,i,n){w(this,ne,void 0);w(this,tt,void 0);w(this,Oi,void 0);w(this,Pa,void 0);E(this,ne,t),E(this,tt,r),E(this,Oi,i),E(this,Pa,n),u(this,tt).cameraSystem.on("pedestal-change",({pedestal:o})=>{u(this,ne).map&&(u(this,ne).map.transform.elevation=o,u(this,ne).map.transform.minElevationForCurrentTile=o,u(this,ne).map.triggerRepaint()),u(this,tt).cameraSystem.setCameraPlaneElevation(o),u(this,Pa).position.z=o})}get center(){return u(this,tt).cameraSystem.center}setCenter(t){let r=u(this,tt).cameraSystem.setCenter(t[0],t[1]);u(this,tt).cameraSystem.setPosition(r.x,r.y)}get zoomLevel(){return u(this,tt).cameraSystem.getZoomLevel()}setZoomLevel(t){u(this,tt).cameraSystem.setZoomLevel(t)}get maxZoomLevel(){return u(this,tt).cameraSystem.maxZoomLevel}get minZoomLevel(){return u(this,tt).cameraSystem.minZoomLevel}setMinZoomLevel(t){var i;let r=Math.max(xP,t);u(this,tt).cameraSystem.setMinZoomLevel(r),(i=u(this,ne).map)==null||i.setMinZoom(r)}setMaxZoomLevel(t){var i;let r=Math.min(SP,t);(i=u(this,ne).map)==null||i.setMaxZoom(r),u(this,tt).cameraSystem.setMaxZoomLevel(r)}get maxPitch(){return at.radToDeg(u(this,tt).cameraSystem.maxTilt)}get minPitch(){return at.radToDeg(u(this,tt).cameraSystem.minTilt)}setMinPitch(t){var i;let r=Math.max(PP,t);(i=u(this,ne).map)==null||i.setMinPitch(r),u(this,tt).cameraSystem.minTilt=at.degToRad(r)}setMaxPitch(t){var i;let r=Math.min(MP,t);(i=u(this,ne).map)==null||i.setMaxPitch(r),u(this,tt).cameraSystem.maxTilt=at.degToRad(r)}get bearing(){return at.radToDeg(u(this,tt).cameraSystem.getRotation())}setBearing(t){u(this,tt).cameraSystem.setRotation(at.degToRad(t))}get pitch(){return at.radToDeg(u(this,tt).cameraSystem.getTilt())}setPitch(t){u(this,tt).cameraSystem.setTilt(at.degToRad(t))}get elevation(){return u(this,tt).cameraSystem.getPedestal()}setElevation(t){u(this,tt).cameraSystem.setPedestal(t,!0)}get insetsPadding(){return u(this,Oi).insetsPadding}setInsetPadding(t){u(this,Oi).center&&(u(this,Oi).insetsPadding=t?{...t}:Wl)}animateTo(t){let r=t.center?u(this,ne).convertTo3DMapPosition(t.center[1],t.center[0],0):void 0,i=t.zoomLevel!==void 0?u(this,tt).cameraSystem.convertZoomLevelToAltitude(t.zoomLevel):void 0,n=t.bearing!==void 0?at.degToRad(t.bearing):void 0,o=t.pitch!==void 0?at.degToRad(t.pitch):void 0;return new Promise(a=>{u(this,tt).cameraSystem.animateCamera({position:r,zoom:i,rotation:n,tilt:o},t.duration||0,_b[t.easing||"ease-in-out"],a,a)})}focusOn(t,r){return new Promise(i=>{u(this,tt).cameraSystem.focusOn(t.map(n=>u(this,ne).convertTo3DMapPosition(n[1],n[0],n[2]||0)),{insetsPadding:(r==null?void 0:r.padding)||this.insetsPadding},{changeZoom:!0,updateZoomLimits:r==null?void 0:r.updateZoomLimits,minZoom:(r==null?void 0:r.maxZoomLevel)===void 0?void 0:u(this,tt).cameraSystem.convertZoomLevelToAltitude(r.maxZoomLevel),maxZoom:(r==null?void 0:r.minZoomLevel)===void 0?void 0:u(this,tt).cameraSystem.convertZoomLevelToAltitude(r.minZoomLevel),padding:(r==null?void 0:r.padding)||{top:0,left:0,bottom:0,right:0},curve:_b[(r==null?void 0:r.easing)||"ease-in-out"],rotation:r!=null&&r.bearing?at.degToRad(r.bearing):void 0,tilt:r!=null&&r.pitch?at.degToRad(r.pitch):void 0,duration:r==null?void 0:r.duration,callback:i,cancelledCallback:i})})}};ne=new WeakMap,tt=new WeakMap,Oi=new WeakMap,Pa=new WeakMap,s(Af,"Camera");var hc=Af;f();function Lb(e){e&&(e.map&&(e.map.dispose(),e.map=void 0),e.dispose())}s(Lb,"scrubMaterial");function mr(e){for(let t=e.children.length-1;t>=0;t--)mr(e.children[t]);"geometry"in e&&e.geometry&&e.geometry.dispose(),e.parent&&e.parent.remove(e),"material"in e&&Array.isArray(e.material)?e.material.forEach(function(t){Lb(t)}):"material"in e&&typeof e.material<"u"&&Lb(e.material)}s(mr,"destroyObject3D");f();var Ob="data:image/png;base64,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";var Db="data:image/png;base64,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";var Ab=`uniform vec4 uSize;
478
+ }`;var Gv="data:image/png;base64,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";var kP=new an,ti,Ta,_d=class _d{constructor(t,e){v(this,"points");v(this,"type","path");v(this,"mesh",new Ue);v(this,"material");v(this,"geometry");v(this,"outline");v(this,"feature");v(this,"options");v(this,"altitudeAdjustment",1);T(this,ti,1);v(this,"position",new Y);T(this,Ta,0);var Ki,Qi,tn;this.points=t;let i=(Ki=e==null?void 0:e.nearRadius)!=null?Ki:.2,n=!0,o=(Qi=e==null?void 0:e.farRadius)!=null?Qi:.4,a=5,l=1e3,u=(tn=e==null?void 0:e.color)!=null?tn:"#ff834c",h="blue",f=!1,m=!0,y=!0,x=!1;this.options={nearRadius:i,farRadius:o,color:u};let P=i/2+.15,g=0;this.points[0].z+=P;for(let J=1;J<this.points.length;++J){this.points[J].z+=P;let xt=this.points[J].x-this.points[J-1].x,gt=this.points[J].y-this.points[J-1].y,pe=this.points[J].z-this.points[J-1].z;g+=Math.sqrt(xt*xt+gt*gt+pe*pe)}let C=P-.1;this.points.push(this.points[this.points.length-1].clone().setZ(C)),this.points.unshift(this.points[0].clone().setZ(C));let w=new lm;x&&(w=kP.load(Gv),w.colorSpace=si);let I=new Mt(u),M=new Mt(h),_={vertexes:{type:"f",value:1},resolution:{type:"v2",value:new W(1,1)},cameraParameters:{type:"v2",value:new W(a,0)},complete:{type:"f",value:n?0:1},color:{type:"c",value:I},pathLength:{type:"f",value:g},nearRadius:{type:"f",value:i},farRadius:{type:"f",value:o},nearZoom:{type:"f",value:a},farZoom:{type:"f",value:l},pulseColor:{type:"c",value:M},pulse:{type:"f",value:0},pulseLength:{type:"f",value:.075},pathIsVertical:{type:"b",value:!1},arrowAnimationTimer:{type:"f",value:0},arrowTexture:{type:"t",value:w},displayArrowsOnPath:{type:"b",value:f},flattenFactor:{type:"f",value:m?.05:1},showPulse:{type:"b",value:y},opacityMultiplier:{type:"f",value:1}},D=new bm(this.points);D.curveType="catmullrom",D.tension=0;let k=30,B=8,R=k*this.points.length,G=new xm(D,R,i,B,!1),X=new Float32Array(G.attributes.position.count);for(let J=this.points.length;J<X.length;J++)X[J]=J;G.setAttribute("vertexIndex",new co(X,1));let Q=new Float32Array(G.attributes.position.count),lt=new co(Q,1);for(let J=0;J<=R;J++)for(let xt=0;xt<=B;++xt)lt.setX(J*(B+1)+xt,J/R);G.setAttribute("pathDistance",lt);let ht=new Float32Array(G.attributes.normal.count*3),yt=new co(ht,3);for(let J=0;J<R;J++){let xt=G.tangents[J];for(let gt=0;gt<=B;++gt)yt.setXYZ(J*(B+1)+gt,xt.x,xt.y,xt.z)}G.setAttribute("pathTangent",yt);let At=new Float32Array(G.attributes.normal.count*3),Ce=new co(At,3);for(let J=0;J<R;J++){let xt=G.tangents[J];var kt,ct,Ct;kt=-xt.x*xt.z,ct=-xt.y*xt.z,Ct=1-xt.z*xt.z;let gt=Math.sqrt(kt*kt+ct*ct+Ct*Ct);gt===0&&(gt=1);let pe=kt/gt,en=ct/gt,ao=Ct/gt;for(let oi=0;oi<=B;++oi)Ce.setXYZ(J*(B+1)+oi,pe,en,ao)}G.setAttribute("pathNormal",Ce),this.geometry=G;let rr=new po({uniforms:_,vertexShader:Id,fragmentShader:Ed});rr.transparent=!0,rr.alphaTest=.5,_.resolution.value.x=1,_.resolution.value.y=1,_.vertexes.value=X.length,_.arrowTexture.value.wrapS=Fe,_.arrowTexture.value.wrapT=Fe,_.arrowTexture.value.anisotropy=16,_.complete.value=c(this,ti);let xe=new jt(G,rr),oe=xe.clone(),Yt={..._,opacityMultiplier:{type:"f",value:.25}};Yt.complete.value=1,oe.material=new po({uniforms:Yt,vertexShader:Id,fragmentShader:Ed}),oe.material.transparent=!0,oe.material.alphaTest=.5,oe.material.depthWrite=!1,oe.material.depthTest=!1,oe.renderOrder=1,Yt.resolution.value.x=1,Yt.resolution.value.y=1,Yt.vertexes.value=X.length,Yt.arrowTexture.value.wrapS=Fe,Yt.arrowTexture.value.wrapT=Fe,Yt.arrowTexture.value.anisotropy=16,Yt.complete.value=c(this,ti),this.mesh.add(xe),this.mesh.add(oe),G.computeBoundingBox(),G.boundingBox.getCenter(this.position),this.material=rr}setColor(){}setOpacity(){}set completeFraction(t){E(this,ti,t),this.mesh.children.forEach(e=>{e.material.uniforms.complete.value=c(this,ti),e.material.needsUpdate=!0})}get completeFraction(){return c(this,ti)}set visible(t){this.mesh&&(this.mesh.visible=t)}get visible(){return this.mesh?this.mesh.visible:!1}get altitude(){return c(this,Ta)}set altitude(t){this.mesh.position.z=t,E(this,Ta,t)}set complete(t){this.material.uniforms.complete.value=t,this.material.needsUpdate=!0}};ti=new WeakMap,Ta=new WeakMap,s(_d,"PathComponent");var fu=_d;d();var Ld=class Ld{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 ee&&t.components[0]){let i=t.components[0];if(i.dirty){for(let n of t.children)(n instanceof de||n instanceof ee)&&(n.userData.entityId!==t.components[0].activeId?n.setVisible(!1):n.setVisible(!0));i.dirty=!1}}}};s(Ld,"StackSystem");var mu=Ld;d();d();var Ea=wr(Un());d();d();d();var Vv=s((r,t)=>(t-r+Math.PI)%(Math.PI*2)+Math.PI*2%(Math.PI*2)-Math.PI,"differenceBetweenAngles"),Hv=s((r,t)=>new W(r.clientX-t.offsetLeft,r.clientY-t.offsetTop),"getTouchPos"),Nd=s((r,t)=>Math.atan2(t.y-r.y,t.x-r.x),"angle"),wa=s((r,t)=>Math.sqrt((t.y-r.y)**2+(t.x-r.x)**2),"distance"),Rd=s((r,t)=>new W((r.x+t.x)/2,(r.y+t.y)/2),"average"),kd=s(r=>{let t=0,{wheelDelta:e,detail:i}=r;return e!==void 0?t=e:i!==void 0&&(t=-i),t},"getScrollDelta");var Fd=class Fd{input1;input2;lastAngle;lastDistance;totalDistance;first;second;constructor(t,e){this.input1=t,this.input2=e,this.lastAngle=Nd(t,e),this.lastDistance=wa(t,e),this.totalDistance=0,this.first=t,this.second=e}update(t,e){let i=wa(t,e);this.input1=t,this.input2=e;let n=Nd(t,e);this.lastAngle=n,this.lastDistance=i,this.totalDistance+=(wa(this.first,t)+wa(this.second,e))/2,this.first=Rd(this.first,t),this.second=Rd(this.second,e)}};s(Fd,"InputSet");var yu=Fd;d();var Bd=class Bd{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 W(this.viewCoordinate.x,this.viewCoordinate.y);this.raycaster=this.raycaster||new _r,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 W(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}};s(Bd,"TouchAnchor");var Ia=Bd;var Gi,gu,Gd=class Gd extends nt{constructor(e,i,n,o,a){super();v(this,"dirty",!1);v(this,"zoomDirty",!1);v(this,"zoomSpeed",5);v(this,"rotateSpeed",100);v(this,"enabled",!0);v(this,"enableZoom",!0);v(this,"enablePan",!0);v(this,"enablePedestal",!1);v(this,"maxPedestal",1/0);v(this,"minPedestal",0);v(this,"enableRotate",!0);v(this,"minZoomAltitude",5);v(this,"maxZoomAltitude",1e4);v(this,"initialMinZoom",5);v(this,"initialMaxZoom",1e4);v(this,"ignoreZoomLimits",!1);v(this,"minExpandedZoom",5);v(this,"maxExpandedZoom",1e5);v(this,"zoomFactor",1);v(this,"panBounds",{min:new 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:gs.RIGHT,ZOOM:gs.MIDDLE,PAN:gs.LEFT});v(this,"camera");v(this,"scene");v(this,"renderer");v(this,"elevation");v(this,"orbit");v(this,"cameraPlane");v(this,"raycaster",new _r);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 Mm(!0));v(this,"coords",{mouse:new W,rotateStart:new W,rotateEnd:new W,rotateDelta:new W,panStart:new Y,panCameraStart:new Y,panEnd:new Y,panDelta:new Y,initialShiftPos:new W,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",()=>Ea.default.getAll().some(e=>e._mMapAnimation));v(this,"isCameraMoving",()=>this.state!==-1);v(this,"setPosition",(e,i)=>{if(isNaN(e)||isNaN(i))return;this.state===-1&&this.publish("pan-start");let n=e-this.panBounds.center.x,o=i-this.panBounds.center.y,a=Math.sqrt(n*n+o*o);if(this.stayInsideBounds&&a>this.panBounds.radius){let l=Math.atan2(o,n),u={x:Math.cos(l)*this.panBounds.radius+this.panBounds.center.x,y:Math.sin(l)*this.panBounds.radius+this.panBounds.center.y};this.orbit.position.x=u.x,this.orbit.position.y=u.y}else this.orbit.position.x=e,this.orbit.position.y=i;this.publish("position-updated"),this.publish("change"),this.state===-1&&this.publish("pan-end"),this.dirty=!0});v(this,"tilt",e=>{if(isNaN(e))return;this.state===-1&&this.publish("rotate-start");let i=this.stayInsideBounds?Math.max(Math.min(e+this.getTilt(),this.maxTilt),this.minTilt):e+this.getTilt();i!==this.elevation.rotation.x&&(this.elevation.rotation.x=i,this.publish("tilt-updated")),this.publish("change"),this.state===-1&&this.publish("rotate-end")});v(this,"zoomIn",(e,i,n)=>{let o=this.getZoomAltitude();this.animateCamera({zoom:o/1.5},e,i,n)});v(this,"zoomOut",(e,i,n)=>{let o=this.getZoomAltitude();this.animateCamera({zoom:o*1.5},e,i,n)});v(this,"getRotation",()=>this.orbit.rotation.z);v(this,"cancelAnimation",()=>{let e=Array.from(this.tweens),i=e[e.length-1];i.state===7&&this.publish("multi-cancel",{zooming:!0,rotating:!0,tilting:!0}),this.completeTween(i)});v(this,"animateCamera",(e,i,n,o,a,l)=>{let u={mode:wh.cancel,...l},h={},f={},m=this.getPosition();if(e.position!=null&&(e.position.x!==void 0&&(h.x=m.x,f.x=e.position.x),e.position.y!==void 0&&(h.y=m.y,f.y=e.position.y),e.position.z!==void 0&&(h.z=m.z,f.z=e.position.z)),e.zoom!==void 0&&(h.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 I=h.rotation=this.getRotation(),M=e.rotation%(2*Math.PI),_=M-I;if(Math.abs(_)>Math.PI){let D=_<0?1:-1;f.rotation=M+2*Math.PI*D}else f.rotation=M}e.tilt!==void 0&&(h.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=h.zoom!==f.zoom,x=h.rotation!==f.rotation,S=h.tilt!==f.tilt,P=new Ea.default.Tween(h).to(f,b.env.TESTING?0:i).onUpdate(I=>{this.setMulti({x:I.x,y:I.y,z:I.z},I.zoom,I.rotation,I.tilt)}).onComplete(()=>{this.completeTween(P),this.publish("multi-end",{zooming:y,rotating:x,tilting:S}),o&&o()}).onStart(()=>{this.state!==7&&(this.state=7,P.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],w=!1;return C!=null&&(u.mode===wh.chain?(w=!0,C.chain(P)):(this.completeTween(C),typeof a=="function"&&a(),C=null)),this.tweens.add(P),n?P.easing(n):P.easing(Ea.default.Easing.Quadratic.In),!e.doNotAutoStart&&!w&&(P.start(),this.publish("change")),P._mMapAnimation=!0,P});v(this,"setMulti",(e,i,n,o,a=!0)=>{this.state===-1&&this.publish("multi-start");let l=!1;e!=null&&(e.x!==void 0&&!isNaN(e.x)&&(this.orbit.position.x=e.x,l=!0),e.y!==void 0&&!isNaN(e.y)&&(this.orbit.position.y=e.y,l=!0),e.z!==void 0&&!isNaN(e.z)&&(this.setPedestal(e.z,!0),l=!0)),l&&this.publish("position-updated");let u={zooming:!1,tilting:!!i,rotating:!1};if(i!==void 0&&!isNaN(i)){let h=this.stayInsideBounds?Math.min(Math.max(i,this.getZoomScaledMin()),this.getZoomScaledMax()):i;h!==this.camera.position.z&&(u.zooming=!0,this.camera.position.z=h,this.publish("zoom-updated"),this.zoomDirty=!0,this.viewState==="multi_floor"?i>wl&&(this.camera.near=i-wl,this.camera.far=i+wl):(this.camera.near=i/ea,this.camera.far=i*ea),this.camera.updateProjectionMatrix())}if(n!==void 0&&!isNaN(n)&&n!==this.orbit.rotation.z&&(u.rotating=!0,this.orbit.rotation.z=n,this.publish("rotation-updated")),o!==void 0&&!isNaN(o)){let h=this.stayInsideBounds?Math.max(Math.min(o,this.maxTilt),this.minTilt):o;h!==this.elevation.rotation.x&&(u.tilting=!0,this.elevation.rotation.x=h,this.publish("tilt-updated"))}a&&this.publish("change"),this.state===-1&&this.publish("multi-end",u)});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%Ih;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/ea,this.camera.far=i*ea,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)%Ih;i!==this.orbit.rotation.z&&(this.orbit.rotation.z=i,this.publish("rotation-updated")),this.publish("change"),this.state===-1&&this.publish("rotate-end")});v(this,"setTilt",(e,i)=>{if(isNaN(e))return;this.state===-1&&!i&&this.publish("rotate-start");let n=this.stayInsideBounds?Math.max(Math.min(e,this.maxTilt),this.minTilt):e;n!==this.elevation.rotation.x&&(this.elevation.rotation.x=n,i||this.publish("tilt-updated")),i||this.publish("change"),this.state===-1&&!i&&this.publish("rotate-end"),this.dirty=!0});v(this,"getTilt",()=>this.elevation.rotation.x);v(this,"setCameraPlaneElevation",e=>{this.cameraPlane.position.z=e});v(this,"zoom",e=>{if(isNaN(e))return;this.state===-1&&this.publish("zoom-start");let i=this.getZoomAltitude()-e;this.camera.position.z=this.stayInsideBounds?Math.min(Math.max(i,this.minZoomAltitude*this.zoomFactor),this.maxZoomAltitude*this.zoomFactor):i,this.publish("zoom-updated"),this.zoomDirty=!0,this.publish("change"),this.state===-1&&this.publish("zoom-end")});v(this,"expandZoomLimits",(e,i)=>{i||(i=1.2),e*i>this.maxZoomAltitude&&(this.maxZoomAltitude=Math.min(e*i,this.maxExpandedZoom)),e/i<this.minZoomAltitude&&(this.minZoomAltitude=Math.max(e/i,this.minExpandedZoom))});v(this,"restrictZoomLimits",(e,i)=>{i||(i=1.2),e*i>this.initialMaxZoom&&e*i<this.maxZoomAltitude&&(this.maxZoomAltitude=Math.max(this.getZoomAltitude(),e*i)),e/i<this.initialMinZoom&&e/i>this.minZoomAltitude&&(this.minZoomAltitude=Math.min(this.getZoomAltitude(),e/i))});v(this,"getProjectionScaleFactor",(e,i,n)=>Nh(e,i,n));v(this,"update",()=>{Ea.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 Lh)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 nn(1e10,1e10),i=new Ir({color:0,visible:!1}),n=new jt(e,i);return this.scene.add(n),n});v(this,"addEventListeners",()=>{let{domElement:e}=this.renderer;for(let i of Lh)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 yu(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 W(this.touch.touches[0].x,this.touch.touches[0].y),a=new W(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 l=i.y<o.y&&n.y<a.y,u=i.y>o.y&&n.y>a.y;this.enableRotate&&this.state!==4&&(u||l)?(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 W(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 W(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 Ia(this.touch.touches[0],this.camera,this.cameraPlane),this.touch.anchor2=new Ia(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 W(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-kd(e)*i/e3*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 rn;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 l=new Y;l.setFromMatrixPosition(e),l.sub(a),this.enablePan&&this.setPosition(l.x,l.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,l=e.reUnproject(),u=i.reUnproject();if(!l||!u||!o||!a)return null;let h=e.viewCoordinate,f=i.viewCoordinate,m=a.x-o.x,y=a.y-o.y,x=Math.atan2(y,m),S=u.x-l.x,P=u.y-l.y,g=Math.atan2(P,S),C=Vv(x,g),w=new li;w.makeRotationZ(-C);let I=w.clone();I.multiply(e.snapHolderMatrix);let M=s((jb,Wb,Ub)=>jb.elements[(Wb-1)*4+Ub-1],"m"),_=M(n,1,1)*M(I,1,1)-h.x*M(n,3,4)*M(I,3,1),D=M(n,1,1)*M(I,1,2)-h.x*M(n,3,4)*M(I,3,2),k=M(n,1,1)*M(I,1,3)-h.x*M(n,3,4)*M(I,3,3),B=o.x*_+o.y*D+o.z*k,R=M(n,2,2)*M(I,2,1)-h.y*M(n,3,4)*M(I,3,1),G=M(n,2,2)*M(I,2,2)-h.y*M(n,3,4)*M(I,3,2),X=M(n,2,2)*M(I,2,3)-h.y*M(n,3,4)*M(I,3,3),Q=o.x*R+o.y*G+o.z*X,lt=M(n,1,1)*M(I,1,1)-f.x*M(n,3,4)*M(I,3,1),ht=M(n,1,1)*M(I,1,2)-f.x*M(n,3,4)*M(I,3,2),yt=M(n,1,1)*M(I,1,3)-f.x*M(n,3,4)*M(I,3,3),At=a.x*lt+a.y*ht+a.z*yt,Ce=M(n,2,2)*M(I,2,1)-f.y*M(n,3,4)*M(I,3,1),kt=M(n,2,2)*M(I,2,2)-f.y*M(n,3,4)*M(I,3,2),ct=M(n,2,2)*M(I,2,3)-f.y*M(n,3,4)*M(I,3,3),Ct=a.x*Ce+a.y*kt+a.z*ct,rr=Math.abs(lt-_),xe=Math.abs(ht-D),oe=Math.abs(yt-k),Yt=Math.abs(lt-R),Ki=Math.abs(ht-G),Qi=Math.abs(yt-X),tn=Math.abs(Ce-_),J=Math.abs(kt-D),xt=Math.abs(ct-k),gt=Math.abs(Ce-R),pe=Math.abs(kt-G),en=Math.abs(ct-X),ao=Math.min(rr+xe+oe,Yt+Ki+Qi),oi=Math.min(tn+J+xt,gt+pe+en);ao<oi&&(lt=Ce,ht=kt,yt=ct,At=Ct);let Nt=R*k-_*X,ai=G*k-D*X,fs=Q*k-B*X,so=lt*X-R*yt,lo=ht*X-G*yt,ms=At*X-Q*yt,Gb=(ms*ai-fs*lo)/(so*ai-Nt*lo),Vb=(ms*Nt-fs*so)/(lo*Nt-ai*so),im=G*_-D*R,Hb=X*_-k*R,Xb=Q*_-B*R,nm=ht*R-G*lt,Yb=yt*R-X*lt,om=((At*R-Q*lt)*im-Xb*nm)/(Yb*im-Hb*nm),ys=I.clone();return ys.elements[12]=Gb,ys.elements[13]=Vb,ys.elements[14]=om,om>0?ys:null});v(this,"updateTouchOrigin",()=>{let e=this.renderer.domElement;this.touch.origin.offsetLeft=e.getBoundingClientRect().left,this.touch.origin.offsetTop=e.getBoundingClientRect().top});v(this,"touchToScene",e=>{this.touch.touches=[];for(let i=0,n=e.touches.length;i<n;i++){let o=e.touches[i],a=Hv(o,this.touch.origin);this.touch.touches.push(new W(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=kd(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 W(e.clientX,e.clientY);this.coords.initialShiftPos=i,this.coords.initialPedestal=this.getPedestal(),this.pedestalScaleFactor=Nh(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",Wn(()=>{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(st.degToRad(this.camera.fov)/2)/this.options.canvasHeight,a=Math.cos(st.degToRad(i))*2*Math.PI*zr/o;return st.clamp(Math.log2(a/512),Eh,_h)});v(this,"convertZoomLevelToAltitude",e=>{let[,i]=this.center,n=st.clamp(e,Eh,_h),o=Math.pow(2,n),a=st.clamp(i,Q2,t3),l=o*512;return Math.cos(st.degToRad(a))*Math.PI*2*zr/l*this.options.canvasHeight/2/Math.tan(st.degToRad(this.camera.fov)/2)});v(this,"completeTween",e=>{e.isPlaying?e.stop():e.end(),this.tweens.delete(e)});T(this,Gi,{PIXELS:"pixels",PORTIONS:"portions"});T(this,gu,["top","bottom","left","right"]);v(this,"getCameraFrameForPoints",(e,i,n,o,a=!0,{canvasWidth:l,canvasHeight:u},h=this.minZoomAltitude,f=this.maxZoomAltitude)=>{Number.isFinite(n)&&(n=1),Number.isFinite(i)&&(i=1),h=Math.max(this.cameraPlane.position.z,h);let m={position:this.getPosition(),zoom:h};if(e==null||e.length===0)return m;o||(o={top:0,bottom:0,left:0,right:0,type:c(this,Gi).PIXELS});for(let Nt of c(this,gu))typeof o[Nt]!="number"&&(o[Nt]=0);if(o.type||(o.type=c(this,Gi).PIXELS),o.type===c(this,Gi).PORTIONS&&(o={top:o.top*u,bottom:o.bottom*u,left:o.left*l,right:o.right*l,type:c(this,Gi).PIXELS}),o.left+o.right>=l||o.top+o.bottom>=u)return m;this.orbit.updateMatrixWorld();let y=this.camera.matrixWorldInverse,x=this.camera.fov*(Math.PI/180)/2,S=x*n,g=Math.atan(Math.tan(x)*(l/u))*i;if(e.length===1){let Nt=e[0].clone();Nt.applyMatrix4(y);let ai=h*Math.tan(g)*2,fs=h*Math.tan(S)*2,so=(o.left-o.right)/2/l,lo=(o.top-o.bottom)/2/u,ms=new Y(-so*ai,lo*fs,0);return Nt.add(ms),Nt.applyMatrix4(this.camera.matrixWorld),m.position.x=Nt.x,m.position.y=Nt.y,m.position.z=Nt.z,m.zoom=Math.max(m.zoom,m.position.z),m}let C=new Y(1/0,1/0,1/0),w=new Y(-1/0,-1/0,-1/0),I=new Be().setFromPoints(e),M;for(let Nt=0,ai=e.length;Nt<ai;Nt++)M=e[Nt].clone(),M.applyMatrix4(y),C.min(M),w.max(M);let _=w.x-C.x,D=w.y-C.y,k=l-o.left-o.right,B=u-o.top-o.bottom,R=(w.x+C.x)/2,G=(w.y+C.y)/2,X=_/k,Q=D/B,lt=h,ht=f,yt=lt*Math.tan(g)*2,At=ht*Math.tan(g)*2,Ce=yt/l,kt=At/l,ct=Math.max(X,Q);a&&(ct=Math.min(Math.max(ct,Ce),kt));let Ct=k*ct,rr=B*ct,xe={min:{x:R-Ct/2-o.left*ct,y:G-rr/2-o.bottom*ct},max:{x:R+Ct/2+o.right*ct,y:G+rr/2+o.top*ct}},oe=(xe.min.x+xe.max.x)/2,Yt=(xe.min.y+xe.max.y)/2,Ki=I.getCenter(new Y),Qi=Math.abs(oe-xe.min.x),tn=Math.abs(Yt-xe.min.y),J=Qi/Math.tan(g),xt=tn/Math.tan(S),gt=new Y;gt.set(oe,Yt,w.z+Math.max(J,xt)),gt.applyMatrix4(this.camera.matrixWorld);let pe=new Y;pe.set(oe,Yt,w.z),pe.applyMatrix4(this.camera.matrixWorld);let en=new Y().subVectors(pe,gt),ao=(Ki.z-gt.z)/en.z,oi=new Y().copy(gt).add(en.clone().multiplyScalar(ao));return m.position=oi,pe.set(m.position.x,m.position.y,m.position.z),gt.sub(pe),m.zoom=gt.length(),m});this.camera=e,this.renderer=n,this.rendererState=o,this.scene=i,this.options=a,this.elevation=e.parent,this.orbit=this.elevation.parent,this.cameraPlane=this.createCameraPlane(),this.zoomStart=e.position.z,a.mode!=="outdoors-overlay"&&this.addEventListeners()}get maxZoomLevel(){return this.convertAltitudeToZoomLevel(this.minZoomAltitude)}setMaxZoomLevel(e){this.minZoomAltitude=this.convertZoomLevelToAltitude(e)}get minZoomLevel(){return this.convertAltitudeToZoomLevel(this.maxZoomAltitude)}setMinZoomLevel(e){this.maxZoomAltitude=this.convertZoomLevelToAltitude(e)}get scrollPercent(){let e=this.minPedestal,i=this.maxPedestal,n=this.getPedestal();return n=Math.min(n,i),n=Math.max(n,e),(n-e)/(i-e)*100}get scrolledToBottom(){return this.minPedestal===0||Math.floor(this.getPedestal())<=this.minPedestal}get scrolledToTop(){return this.maxPedestal===0||Math.ceil(this.getPedestal())>=this.maxPedestal}get center(){var o,a,l,u;let e=this.getPosition(),{lat:i,lon:n}=Il((a=(o=this.rendererState.center)==null?void 0:o[1])!=null?a:0,(u=(l=this.rendererState.center)==null?void 0:l[0])!=null?u:0,e.x,e.y);return[n,i]}setCenter(e,i,n=0){var l,u,h,f;let{x:o,y:a}=El((u=(l=this.rendererState.center)==null?void 0:l[1])!=null?u:0,(f=(h=this.rendererState.center)==null?void 0:h[0])!=null?f:0,i,e);return new Y(o,a,n)}focusOn(e,{insetsPadding:i},n={}){var g;let o=(g=n.changeZoom)!=null?g:!0,a=n.curve,l=1,u=1,h=n.callback,f=n.cancelledCallback,m=n.minZoom!==void 0?n.minZoom:this.minZoomAltitude,y=n.maxZoom!==void 0?n.maxZoom:this.maxZoomAltitude,x=this.options.canvasWidth,S=this.options.canvasHeight,P;if(n.duration!==void 0?P=n.duration:b.env.TESTING==="true"?P=0:P=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},P,a,()=>{let C=n.padding||i,w=this.getCameraFrameForPoints(e,l,u,C,o,{canvasWidth:x,canvasHeight:S},m,y);this.animateCamera({position:w.position,tilt:this.getTilt(),rotation:this.getRotation(),zoom:w.zoom},P,a,h,f)});else{let C=n.padding||i,w=this.getCameraFrameForPoints(e,l,u,C,o,{canvasWidth:x,canvasHeight:S},m,y);this.animateCamera({position:w.position,tilt:this.getTilt(),rotation:this.getRotation(),zoom:w.zoom},P,a,h,f)}else{let C=n.padding||i,w=this.getCameraFrameForPoints(e,l,u,C,o,{canvasHeight:S,canvasWidth:x},m,y);this.animateCamera({position:w.position,tilt:n.tilt,rotation:n.rotation,zoom:w.zoom},P,a,h,f)}}resize(e,i){this.options.canvasWidth=e,this.options.canvasHeight=i}};Gi=new WeakMap,gu=new WeakMap,s(Gd,"CameraSystem");var _a=Gd;d();var BP=300,Vd=class Vd{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 fe&&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:BP,easing:"ease-in-out",fill:"forwards"}),i.visibilityNeedsUpdate=!1)))}};s(Vd,"DOMDrawSystem");var vu=Vd;d();var Hd=class Hd extends nt{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 fe&&i.firstElementChild){let{width:a,height:l}=i.firstElementChild.getBoundingClientRect();o.components[0].updateDimensions(a,l)}}}),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()}};s(Hd,"DOMResizeSystem");var bu=Hd;d();var La=wr(Un());var GP=0,VP=22,HP=0,XP=90,Yv={linear:La.default.Easing.Linear.None,"ease-in":La.default.Easing.Quadratic.In,"ease-out":La.default.Easing.Quadratic.Out,"ease-in-out":La.default.Easing.Quadratic.InOut},ie,tt,Vi,Oa,Xd=class Xd{constructor(t,e,i,n){T(this,ie,void 0);T(this,tt,void 0);T(this,Vi,void 0);T(this,Oa,void 0);E(this,ie,t),E(this,tt,e),E(this,Vi,i),E(this,Oa,n),c(this,tt).cameraSystem.on("pedestal-change",({pedestal:o})=>{c(this,ie).map&&(c(this,ie).map.transform.elevation=o,c(this,ie).map.transform.minElevationForCurrentTile=o,c(this,ie).map.triggerRepaint()),c(this,tt).cameraSystem.setCameraPlaneElevation(o),c(this,Oa).position.z=o})}get center(){return c(this,tt).cameraSystem.center}setCenter(t){let e=c(this,tt).cameraSystem.setCenter(t[0],t[1]);c(this,tt).cameraSystem.setPosition(e.x,e.y)}get zoomLevel(){return c(this,tt).cameraSystem.getZoomLevel()}setZoomLevel(t){c(this,tt).cameraSystem.setZoomLevel(t)}get maxZoomLevel(){return c(this,tt).cameraSystem.maxZoomLevel}get minZoomLevel(){return c(this,tt).cameraSystem.minZoomLevel}setMinZoomLevel(t){var i;let e=Math.max(GP,t);c(this,tt).cameraSystem.setMinZoomLevel(e),(i=c(this,ie).map)==null||i.setMinZoom(e)}setMaxZoomLevel(t){var i;let e=Math.min(VP,t);(i=c(this,ie).map)==null||i.setMaxZoom(e),c(this,tt).cameraSystem.setMaxZoomLevel(e)}get maxPitch(){return st.radToDeg(c(this,tt).cameraSystem.maxTilt)}get minPitch(){return st.radToDeg(c(this,tt).cameraSystem.minTilt)}setMinPitch(t){var i;let e=Math.max(HP,t);(i=c(this,ie).map)==null||i.setMinPitch(e),c(this,tt).cameraSystem.minTilt=st.degToRad(e)}setMaxPitch(t){var i;let e=Math.min(XP,t);(i=c(this,ie).map)==null||i.setMaxPitch(e),c(this,tt).cameraSystem.maxTilt=st.degToRad(e)}get bearing(){return st.radToDeg(c(this,tt).cameraSystem.getRotation())}setBearing(t){c(this,tt).cameraSystem.setRotation(st.degToRad(t))}get pitch(){return st.radToDeg(c(this,tt).cameraSystem.getTilt())}setPitch(t){c(this,tt).cameraSystem.setTilt(st.degToRad(t))}get elevation(){return c(this,tt).cameraSystem.getPedestal()}setElevation(t){c(this,tt).cameraSystem.setPedestal(t,!0)}get insetsPadding(){return c(this,Vi).insetsPadding}setInsetPadding(t){c(this,Vi).center&&(c(this,Vi).insetsPadding=t?{...t}:Kl)}animateTo(t){let e=t.center?c(this,ie).convertTo3DMapPosition(t.center[1],t.center[0],0):void 0,i=t.zoomLevel!==void 0?c(this,tt).cameraSystem.convertZoomLevelToAltitude(t.zoomLevel):void 0,n=t.bearing!==void 0?st.degToRad(t.bearing):void 0,o=t.pitch!==void 0?st.degToRad(t.pitch):void 0;return new Promise(a=>{c(this,tt).cameraSystem.animateCamera({position:e,zoom:i,rotation:n,tilt:o},t.duration||0,Yv[t.easing||"ease-in-out"],a,a)})}focusOn(t,e){return new Promise(i=>{c(this,tt).cameraSystem.focusOn(t.map(n=>c(this,ie).convertTo3DMapPosition(n[1],n[0],n[2]||0)),{insetsPadding:(e==null?void 0:e.padding)||this.insetsPadding},{changeZoom:!0,updateZoomLimits:e==null?void 0:e.updateZoomLimits,minZoom:(e==null?void 0:e.maxZoomLevel)===void 0?void 0:c(this,tt).cameraSystem.convertZoomLevelToAltitude(e.maxZoomLevel),maxZoom:(e==null?void 0:e.minZoomLevel)===void 0?void 0:c(this,tt).cameraSystem.convertZoomLevelToAltitude(e.minZoomLevel),padding:(e==null?void 0:e.padding)||{top:0,left:0,bottom:0,right:0},curve:Yv[(e==null?void 0:e.easing)||"ease-in-out"],rotation:e!=null&&e.bearing?st.degToRad(e.bearing):void 0,tilt:e!=null&&e.pitch?st.degToRad(e.pitch):void 0,duration:e==null?void 0:e.duration,callback:i,cancelledCallback:i})})}};ie=new WeakMap,tt=new WeakMap,Vi=new WeakMap,Oa=new WeakMap,s(Xd,"Camera");var Cu=Xd;d();function jv(r){r&&(r.map&&(r.map.dispose(),r.map=void 0),r.dispose())}s(jv,"scrubMaterial");function Cr(r){for(let t=r.children.length-1;t>=0;t--)Cr(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){jv(t)}):"material"in r&&typeof r.material<"u"&&jv(r.material)}s(Cr,"destroyObject3D");d();var Wv=`uniform vec4 uSize;
463
479
  varying vec2 vUv;
464
480
  void main() {
465
481
  vUv = uv;
@@ -471,7 +487,7 @@ void main() {
471
487
  // Apply left .w and top .z offset
472
488
  transformed += vec2(uSize.w, -uSize.z) * 2.0;
473
489
  gl_Position = vec4(transformed, 1.0, 1.0);
474
- }`;var Nb=`varying vec2 vUv;
490
+ }`;var Uv=`varying vec2 vUv;
475
491
  uniform sampler2D uTexture;
476
492
  uniform float uOpacity;
477
493
  void main() {
@@ -481,10 +497,19 @@ void main() {
481
497
  #else
482
498
  gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
483
499
  #endif
484
- }`;f();var Rb=!1,Ma={padding:16,scale:1,iconOnly:!1,position:"bottom-left",onClick:()=>{window!=null&&window.open("https://www.mappedin.com")}},yr,Di,Xt,dc,Ai,wa,Ta,Nf=class Nf{constructor(t,r,i,n){v(this,"options");w(this,yr,new Ft);w(this,Di,void 0);w(this,Xt,void 0);w(this,dc,{logo:Ob,"logo-icon-slate":Db});w(this,Ai,void 0);w(this,wa,0);w(this,Ta,0);v(this,"getPositionAlignedCanvasCoordinates",(t,r)=>({"top-left":{x:0,y:0},"top-right":{x:t,y:0},"bottom-left":{x:0,y:r},"bottom-right":{x:t,y:r},center:{x:t/2,y:r/2},top:{x:t/2,y:0},bottom:{x:t/2,y:r},left:{x:0,y:r/2},right:{x:t,y:r/2}})[this.options.position]);v(this,"getPositionAlignedPadding",()=>{var i,n,o,a;let t=this.options.padding;if(typeof t=="number")return{"top-left":{x:t,y:t},"top-right":{x:-t,y:t},"bottom-left":{x:t,y:-t},"bottom-right":{x:-t,y:-t},center:{x:0,y:0},top:{x:0,y:t},bottom:{x:0,y:-t},left:{x:t,y:0},right:{x:-t,y:0}}[this.options.position];let r={top:(i=t.top)!=null?i:0,right:(n=t.right)!=null?n:0,bottom:(o=t.bottom)!=null?o:0,left:(a=t.left)!=null?a:0};return{x:r.left-r.right,y:r.top-r.bottom}});var a,l,c,h,d;this.options={position:(a=n==null?void 0:n.position)!=null?a:Ma.position,padding:(l=n==null?void 0:n.padding)!=null?l:Ma.padding,scale:(c=n==null?void 0:n.scale)!=null?c:Ma.scale,iconOnly:(h=n==null?void 0:n.iconOnly)!=null?h:Ma.iconOnly,onClick:(d=n==null?void 0:n.onClick)!=null?d:Ma.onClick};let o=this.options.iconOnly?"logo-icon-slate":"logo";new Ki().load(u(this,dc)[o],m=>{m.colorSpace=Zi,E(this,Di,m);let y=new $i(2,2,1,1);E(this,Xt,new no({uniforms:{uTexture:{value:m},uSize:{value:new Jd(1,1,0,0)},uOpacity:{value:.6}},vertexShader:Ab,fragmentShader:Nb,depthWrite:!1,depthTest:!1,defines:{debug:Rb},wireframe:Rb,transparent:!0,visible:!0})),E(this,yr,new Ft(y,u(this,Xt))),u(this,yr).position.set(0,0,-1),u(this,yr).frustumCulled=!1,u(this,yr).renderOrder=-1;let x=new tm(1,1,1),S=new Ft(x,new xr({transparent:!0,opacity:0,depthTest:!1,depthWrite:!1}));S.layers.set(1),u(this,yr).add(S),t.add(u(this,yr)),this.resize(r,i)})}setSize(t,r){u(this,Xt)&&(u(this,Xt).uniforms.uSize.value.x=t,u(this,Xt).uniforms.uSize.value.y=r)}setXY(t,r){u(this,Xt)&&(u(this,Xt).uniforms.uSize.value.w=t,u(this,Xt).uniforms.uSize.value.z=r)}getPositionAlignedOffset(t,r){return{"top-left":{x:0,y:0},"top-right":{x:-t,y:0},"bottom-left":{x:0,y:-r},"bottom-right":{x:-t,y:-r},center:{x:-(t/2),y:-(r/2)},top:{x:-(t/2),y:0},bottom:{x:-(t/2),y:-r},left:{x:0,y:-(r/2)},right:{x:-t,y:-(r/2)}}[this.options.position]}clampWithWarning(t,r,i,n){return r>=i?(X.warn(`Watermark ${n} does not fit within given space.`),r):t<r||t>i?(X.warn(`Watermark ${n} must be between ${r} and ${i}.`),at.clamp(t,r,i)):t}show(){if(!u(this,Xt)){X.warn("Watermark material is not initialized.");return}u(this,Xt).visible=!0,this.resize(u(this,wa),u(this,Ta))}hide(){if(!u(this,Xt)){X.warn("Watermark material is not initialized.");return}u(this,Xt).visible=!1,E(this,Ai,void 0)}insertIntoQuadTree(t){u(this,Ai)!=null&&typeof this.options.onClick=="function"&&t.insert(u(this,Ai))}resize(t,r){if(!u(this,Di)||!u(this,Xt)){X.warn("Cannot resize Watermark. It is not initialized.");return}E(this,wa,t),E(this,Ta,r);let i=this.options.scale,n=u(this,Di).image.width/u(this,Di).image.height,o=this.options.iconOnly?15:75,a=this.options.iconOnly?25:150,l=this.clampWithWarning(a*i,o,t,"width"),c=l/n,h=this.getPositionAlignedCanvasCoordinates(t,r),d=this.getPositionAlignedPadding(),m=this.getPositionAlignedOffset(l,c),y=this.clampWithWarning(h.x+d.x+m.x,0,t-l,"x"),x=this.clampWithWarning(h.y+d.y+m.y,0,r-c,"y");this.setSize(l/t,c/r),this.setXY(y/t,x/r),E(this,Ai,new Et(y,x,l,c,{entityId:"watermark"}))}};yr=new WeakMap,Di=new WeakMap,Xt=new WeakMap,dc=new WeakMap,Ai=new WeakMap,wa=new WeakMap,Ta=new WeakMap,s(Nf,"WatermarkSystem");var fc=Nf;f();var Rf=100,kf=class kf{currentTotalBoundingBox;state;cameraSystem;dirty=!1;constructor(t,r){this.state=t,this.cameraSystem=r}update(){if(this.dirty){this.currentTotalBoundingBox==null&&(this.currentTotalBoundingBox=new Ne,this.state.entityScene.children.length===0?this.currentTotalBoundingBox.setFromCenterAndSize(new Y(0,0,0),new Y(Rf*2,Rf*2,0)):(this.currentTotalBoundingBox.setFromObject(this.state.entityScene),this.currentTotalBoundingBox.expandByScalar(Rf))),this.currentTotalBoundingBox.expandByObject(this.state.entityScene);for(let t of this.state.entity2DMap.values())t.positionDirty===!0&&(this.currentTotalBoundingBox.expandByPoint(t.position),t.positionDirty=!1);this.cameraSystem.panBounds={center:this.currentTotalBoundingBox.getCenter(new Y),min:this.currentTotalBoundingBox.min,max:this.currentTotalBoundingBox.max,radius:this.currentTotalBoundingBox.getBoundingSphere(new Qd).radius},this.cameraSystem.dirty=!0,this.dirty=!1}}};s(kf,"PanBoundsSystem");var mc=kf;f();var Ff="\xA9 Mappedin",Bf=["top-left","top-right","bottom-left","bottom-right"],AP=640,NP=s(()=>`<svg xmlns='http://www.w3.org/2000/svg' width='15' height='15' fill-rule='evenodd' viewBox='0 0 20 20'>
500
+ }`;d();var Zv=4.291666666666667,zv=15,qv=25,$v=43/60;d();var Jv=["horizontal","icon"],WP=new Map([[Jv[0],`<svg viewBox="0 0 206 48">
501
+ <path d="M27.2678 14.2261H22.3187C21.0695 14.2261 20.4695 14.7801 20.4695 15.9852V31.142L10.3966 15.5591C9.69665 14.4784 9.2475 14.2773 7.8475 14.2261H2.97462C1.67462 14.2261 1.07631 14.7801 1.07631 15.9852V44.7665C1.07631 45.9716 1.67462 46.5256 2.97462 46.5256H7.92377C9.22207 46.5256 9.82207 45.9716 9.82207 44.7665V29.6847L19.9441 45.1926C20.695 46.3244 21.095 46.5256 22.4933 46.5256H27.2933C28.5916 46.5256 29.1916 45.9716 29.1916 44.7665V15.9852C29.1407 14.7801 28.5424 14.2261 27.2678 14.2261Z"/>
502
+ <path d="M5.44915 10.9602C8.45863 10.9602 10.8983 8.50669 10.8983 5.48011C10.8983 2.45353 8.45863 0 5.44915 0C2.43967 0 0 2.45353 0 5.48011C0 8.50669 2.43967 10.9602 5.44915 10.9602Z"/>
503
+ <path d="M61.7899 25.0449C63.2306 23.1903 65.078 22.2051 67.556 22.2051C72.0526 22.2051 74.7611 25.3347 74.7611 29.4511V39.2489C74.8187 39.7125 74.5306 39.9443 74.0695 39.9443H72.5136C72.0526 39.9443 71.7645 39.7125 71.8221 39.2489V29.5091C71.8221 27.1909 69.9187 25.2187 67.4984 25.2187C65.1339 25.2187 63.2323 27.1329 63.2323 29.2773V39.2489C63.2899 39.7125 63.0018 39.9443 62.5407 39.9443H60.9831C60.5221 39.9443 60.2916 39.7125 60.2916 39.2489V29.4511C60.2916 27.1329 58.3899 25.2187 56.0255 25.2187C53.7204 25.2187 51.7594 27.075 51.7594 29.2773V39.3068C51.817 39.7705 51.5289 40.0023 51.0102 40.0023H49.5119C49.0509 40.0023 48.7628 39.7705 48.7628 39.3068V23.25C48.7051 22.7864 48.9933 22.4966 49.5119 22.4966H50.9526C51.356 22.4966 51.5289 22.6704 51.5289 23.0182V24.2352C52.7407 22.9602 54.239 22.2648 56.0255 22.2648C58.4475 22.2068 60.3492 23.192 61.7899 25.0466V25.0449ZM77.1255 31.2477C77.1255 26.3216 81.1018 22.2051 86.1187 22.2051C88.539 22.2051 90.6136 23.1903 92.3441 25.1608V23.1903C92.3441 22.7267 92.5746 22.5528 93.0357 22.5528H94.4187C94.8797 22.5528 95.1102 22.7847 95.1102 23.3062V39.3648C95.1102 39.8284 94.8797 40.0602 94.4187 40.0602H93.0357C92.5746 40.0602 92.3441 39.8284 92.3441 39.4227V37.4523C90.6712 39.3648 88.5967 40.35 86.1746 40.35C81.1018 40.2341 77.1238 36.1773 77.1238 31.2477H77.1255ZM92.1136 31.2477C92.1136 27.8284 89.4611 25.2187 86.0594 25.2187C82.7746 25.2187 80.1221 27.8864 80.1221 31.2477C80.1221 34.6687 82.7746 37.2784 86.1187 37.2784C86.9062 37.2789 87.6861 37.1232 88.4138 36.8202C89.1414 36.5173 89.8026 36.0731 90.3593 35.513C90.9161 34.9528 91.3577 34.2878 91.6587 33.556C91.9597 32.8241 92.1143 32.0397 92.1136 31.2477ZM100.992 37.3943V46.3807C101.049 46.8443 100.761 47.1341 100.298 47.1341H98.7424C98.2814 47.1341 97.9933 46.9023 97.9933 46.3807V23.1903C97.9933 22.7267 98.2238 22.4369 98.7424 22.4369H100.183C100.646 22.379 100.934 22.6687 100.934 23.0744V24.9869C102.605 23.0744 104.68 22.1472 107.044 22.1472C112.002 22.1472 116.037 26.2619 116.037 31.1898C116.037 36.1176 112.059 40.2341 107.044 40.2341C104.622 40.2341 102.603 39.3068 100.992 37.3943ZM106.987 25.2187C103.7 25.2187 101.049 27.8864 101.049 31.2477C101.049 34.6687 103.7 37.2784 107.044 37.2784C110.446 37.2784 113.039 34.6108 113.039 31.2477C113.039 27.8864 110.388 25.2187 106.987 25.2187ZM121.11 37.3943V46.3807C121.168 46.8443 120.88 47.1341 120.419 47.1341H118.861C118.4 47.1341 118.112 46.9023 118.112 46.3807V23.1903C118.112 22.7267 118.342 22.4369 118.861 22.4369H120.302C120.764 22.379 121.053 22.6687 121.053 23.0744V24.9869C122.724 23.0744 124.798 22.1472 127.163 22.1472C132.12 22.1472 136.156 26.2619 136.156 31.1898C136.156 36.1176 132.178 40.2341 127.163 40.2341C124.742 40.2341 122.781 39.3068 121.11 37.3943ZM127.105 25.2187C123.819 25.2187 121.168 27.8864 121.168 31.2477C121.168 34.6687 123.819 37.2784 127.163 37.2784C130.564 37.2784 133.158 34.6108 133.158 31.2477C133.158 27.8864 130.507 25.2187 127.107 25.2187H127.105ZM153.97 32.3506H141.054C141.342 35.2483 143.995 37.4523 147.164 37.4523C148.893 37.4523 150.393 37.0466 151.719 36.0597C152.007 35.8858 152.295 35.7699 152.353 35.7699C152.583 35.7699 152.756 35.8858 152.929 36.1773L153.505 37.1625C153.622 37.3364 153.68 37.4523 153.68 37.5682C153.68 37.8 153.507 38.0318 153.103 38.3216C151.258 39.5966 149.183 40.292 146.992 40.292C141.688 40.292 137.883 36.3511 137.883 31.2477C137.883 26.204 141.803 22.2051 146.703 22.2051C151.546 22.2051 154.717 25.7983 154.717 31.0176C154.717 31.5972 154.717 32.3506 153.968 32.3506H153.97ZM141.056 30.0324H151.72C151.432 26.8432 149.473 24.929 146.648 24.929C145.241 24.8904 143.875 25.3995 142.833 26.3501C141.791 27.3007 141.154 28.6194 141.056 30.0307V30.0324ZM156.332 31.2477C156.332 26.3216 160.31 22.2051 165.326 22.2051C167.748 22.2051 169.707 23.1324 171.32 25.0449V16.2324C171.263 15.7687 171.551 15.479 172.012 15.479H173.57C174.031 15.479 174.319 15.7108 174.319 16.2324V39.3068C174.319 39.7705 174.088 40.0023 173.57 40.0023H172.129C171.666 40.0602 171.378 39.7705 171.378 39.3648V37.3943C169.649 39.3068 167.632 40.292 165.268 40.292C160.31 40.2341 156.332 36.1773 156.332 31.2477ZM171.264 31.2477C171.264 27.8284 168.612 25.2187 165.21 25.2187C161.924 25.2187 159.273 27.8864 159.273 31.2477C159.273 34.6687 161.924 37.2784 165.268 37.2784C166.057 37.2838 166.839 37.1316 167.569 36.8304C168.299 36.5292 168.962 36.0852 169.52 35.5241C170.077 34.963 170.519 34.296 170.818 33.5619C171.117 32.8277 171.268 32.0411 171.263 31.2477H171.264ZM177.72 19.0739C177.715 18.8594 177.754 18.646 177.833 18.4468C177.912 18.2476 178.031 18.0667 178.182 17.915C178.333 17.7633 178.512 17.6439 178.71 17.5642C178.909 17.4845 179.121 17.446 179.334 17.4511C179.546 17.4507 179.756 17.4923 179.952 17.5737C180.148 17.6551 180.326 17.7746 180.476 17.9254C180.626 18.0762 180.745 18.2553 180.826 18.4523C180.907 18.6494 180.948 18.8606 180.948 19.0739C180.953 19.2884 180.914 19.5017 180.835 19.7009C180.756 19.9001 180.637 20.081 180.486 20.2327C180.335 20.3845 180.156 20.5038 179.957 20.5835C179.759 20.6633 179.547 20.7017 179.334 20.6966C178.412 20.7545 177.72 20.0591 177.72 19.0739ZM177.836 39.2489V23.1903C177.836 22.7267 178.066 22.4369 178.527 22.4369H180.083C180.544 22.4369 180.832 22.6687 180.775 23.1903V39.2489C180.832 39.7125 180.544 39.9443 180.083 39.9443H178.527C178.066 39.9443 177.836 39.7125 177.836 39.2489ZM186.944 23.0165V24.1756C188.212 22.8426 189.71 22.2051 191.497 22.2051C195.937 22.2051 198.646 25.2767 198.646 29.3932V39.2489C198.703 39.7125 198.415 39.9443 197.954 39.9443H196.398C195.936 39.9443 195.705 39.7125 195.705 39.2489V29.4511C195.705 27.1329 193.803 25.2187 191.439 25.2187C189.134 25.2187 187.175 27.075 187.175 29.2773V39.3068C187.232 39.7705 186.944 40.0023 186.424 40.0023H184.868C184.407 40.0023 184.119 39.7705 184.119 39.3068V23.1903C184.061 22.7267 184.349 22.4949 184.868 22.4949H186.309C186.712 22.4949 186.944 22.6687 186.944 23.0165Z"/>
504
+ <path d="M204 40C205.115 40 206 39.0857 206 38V37.9886C206 36.9029 205.126 36 204 36C202.885 36 202 36.9143 202 38V38.0114C202 39.0971 202.874 40 204 40ZM204 39.7829C202.989 39.7829 202.23 38.9829 202.23 38.0114V38C202.23 37.0286 203 36.2171 204 36.2171C205.011 36.2171 205.77 37.0171 205.77 37.9886V38C205.77 38.9714 205 39.7829 204 39.7829ZM203.218 38.9714H203.609V38.2743H204.034L204.517 38.9714H204.989L204.448 38.2057C204.724 38.1257 204.92 37.92 204.92 37.5886C204.92 37.1657 204.586 36.9486 204.138 36.9486H203.218V38.9714ZM203.609 37.9543V37.2914H204.103C204.368 37.2914 204.517 37.4057 204.517 37.6229C204.517 37.8171 204.368 37.9543 204.103 37.9543H203.609Z"/>
505
+ </svg>`],[Jv[1],`<svg viewBox="0 0 43 60">
506
+ <path d="M14.0291 7.06645C14.0291 10.9691 10.8885 14.1329 7.01453 14.1329C3.14051 14.1329 0 10.9691 0 7.06645C0 3.16376 3.14051 0 7.01453 0C10.8885 0 14.0291 3.16376 14.0291 7.06645Z"/>
507
+ <path d="M28.7335 18.3468H35.1045C36.7455 18.3468 37.5178 19.0599 37.5821 20.6158V57.7309C37.5821 59.2868 36.8099 60 35.1367 60H28.9588C27.1569 60 26.642 59.7406 25.6767 58.282L12.6452 38.282V57.7309C12.6452 59.2868 11.8729 60 10.1997 60H3.82873C2.15554 60 1.3833 59.2868 1.3833 57.7309V20.6158C1.3833 19.0599 2.15554 18.3468 3.82873 18.3468H10.1032C11.9051 18.4116 12.4843 18.671 13.3852 20.0648L26.3524 40.162V20.6158C26.3524 19.0599 27.1247 18.3468 28.7335 18.3468Z"/>
508
+ <path d="M41.5 60C42.3362 60 43 59.3143 43 58.5V58.4914C43 57.6771 42.3448 57 41.5 57C40.6638 57 40 57.6857 40 58.5V58.5086C40 59.3229 40.6552 60 41.5 60ZM41.5 59.8371C40.7414 59.8371 40.1724 59.2371 40.1724 58.5086V58.5C40.1724 57.7714 40.75 57.1629 41.5 57.1629C42.2586 57.1629 42.8276 57.7629 42.8276 58.4914V58.5C42.8276 59.2286 42.25 59.8371 41.5 59.8371ZM40.9138 59.2286H41.2069V58.7057H41.5259L41.8879 59.2286H42.2414L41.8362 58.6543C42.0431 58.5943 42.1897 58.44 42.1897 58.1914C42.1897 57.8743 41.9397 57.7114 41.6034 57.7114H40.9138V59.2286ZM41.2069 58.4657V57.9686H41.5776C41.7759 57.9686 41.8879 58.0543 41.8879 58.2171C41.8879 58.3629 41.7759 58.4657 41.5776 58.4657H41.2069Z"/>
509
+ </svg>`]]),UP=/<svg([^>]*)>/g;function Kv(r,t,e,i){let n=WP.get(r);return n?n.replace(UP,`<svg$1 width="${e}" height="${i}" xmlns="http://www.w3.org/2000/svg" style="fill: ${t};">`):""}s(Kv,"getLogoIcon");var Qv=!1,Zn={padding:16,scale:1,iconOnly:!1,position:"bottom-left",color:"dark",onClick:()=>{window!=null&&window.open("https://www.mappedin.com")}},zn,Da,ye,Ht,Hi,Ke,xr,ge,Ae,Yd=class Yd{constructor(t,e,i,n,o){v(this,"options");T(this,zn,void 0);T(this,Da,void 0);T(this,ye,void 0);T(this,Ht,void 0);T(this,Hi,void 0);T(this,Ke,0);T(this,xr,0);T(this,ge,0);T(this,Ae,0);v(this,"dirty",!0);v(this,"getPositionAlignedCanvasCoordinates",(t,e)=>({"top-left":{x:0,y:0},"top-right":{x:t,y:0},"bottom-left":{x:0,y:e},"bottom-right":{x:t,y:e},center:{x:t/2,y:e/2},top:{x:t/2,y:0},bottom:{x:t/2,y:e},left:{x:0,y:e/2},right:{x:t,y:e/2}})[this.options.position]);v(this,"getPositionAlignedPadding",()=>{var i,n,o,a;let t=this.options.padding;if(typeof t=="number")return{"top-left":{x:t,y:t},"top-right":{x:-t,y:t},"bottom-left":{x:t,y:-t},"bottom-right":{x:-t,y:-t},center:{x:0,y:0},top:{x:0,y:t},bottom:{x:0,y:-t},left:{x:t,y:0},right:{x:-t,y:0}}[this.options.position];let e={top:(i=t.top)!=null?i:0,right:(n=t.right)!=null?n:0,bottom:(o=t.bottom)!=null?o:0,left:(a=t.left)!=null?a:0};return{x:e.left-e.right,y:e.top-e.bottom}});var a,l,u,h,f,m;this.options={position:(a=o==null?void 0:o.position)!=null?a:Zn.position,padding:(l=o==null?void 0:o.padding)!=null?l:Zn.padding,scale:(u=o==null?void 0:o.scale)!=null?u:Zn.scale,iconOnly:(h=o==null?void 0:o.iconOnly)!=null?h:Zn.iconOnly,color:(f=o==null?void 0:o.color)!=null?f:Zn.color,onClick:(m=o==null?void 0:o.onClick)!=null?m:Zn.onClick},E(this,Da,t),E(this,zn,n),E(this,ge,e),E(this,Ae,i)}get color(){return this.options.color==="light"?"white":"#293136"}get iconName(){return this.options.iconOnly?"icon":"horizontal"}get minWidth(){return this.options.iconOnly?zv:75}get defaultWidth(){return this.options.iconOnly?qv:150}get aspectRatio(){return this.options.iconOnly?$v:Zv}get icon(){return Kv(this.iconName,this.color,c(this,Ke)*c(this,zn).pixelRatio,c(this,xr)*c(this,zn).pixelRatio)}setSize(t,e){c(this,Ht)&&(c(this,Ht).uniforms.uSize.value.x=t,c(this,Ht).uniforms.uSize.value.y=e)}setXY(t,e){c(this,Ht)&&(c(this,Ht).uniforms.uSize.value.w=t,c(this,Ht).uniforms.uSize.value.z=e)}getPositionAlignedOffset(t,e){return{"top-left":{x:0,y:0},"top-right":{x:-t,y:0},"bottom-left":{x:0,y:-e},"bottom-right":{x:-t,y:-e},center:{x:-(t/2),y:-(e/2)},top:{x:-(t/2),y:0},bottom:{x:-(t/2),y:-e},left:{x:0,y:-(e/2)},right:{x:-t,y:-(e/2)}}[this.options.position]}clampWithWarning(t,e,i,n){return e>=i?(H.warn(`Watermark ${n} does not fit within given space.`),e):t<e||t>i?(H.warn(`Watermark ${n} must be between ${e} and ${i}.`),st.clamp(t,e,i)):t}show(){if(!c(this,Ht)){H.warn("Watermark material is not initialized.");return}c(this,Ht).visible=!0,this.resize(c(this,ge),c(this,Ae))}hide(){if(!c(this,Ht)){H.warn("Watermark material is not initialized.");return}c(this,Ht).visible=!1,E(this,Hi,void 0)}insertIntoQuadTree(t){c(this,Hi)!=null&&typeof this.options.onClick=="function"&&t.insert(c(this,Hi))}render(){let t=this.clampWithWarning(this.defaultWidth*this.options.scale,this.minWidth,c(this,ge),"width");E(this,Ke,t),E(this,xr,c(this,Ke)/this.aspectRatio),cu.getLoader().load(`data:image/svg+xml;base64,${btoa(this.icon)}`,e=>{if(E(this,Ht,new po({uniforms:{uTexture:{value:e},uSize:{value:new um(0,0,0,0)},uOpacity:{value:.7}},vertexShader:Wv,fragmentShader:Uv,depthWrite:!1,depthTest:!1,defines:{debug:Qv},wireframe:Qv,transparent:!0,visible:!0})),c(this,ye))c(this,ye).material=c(this,Ht),c(this,ye).material.needsUpdate=!0;else{let i=new nn(2,2,1,1);E(this,ye,new jt(i,c(this,Ht))),c(this,ye).position.set(0,0,-1),c(this,ye).frustumCulled=!1,c(this,ye).renderOrder=-1;let n=new hm(1,1,1),o=new jt(n,new Ir({transparent:!0,opacity:0,depthTest:!1,depthWrite:!1}));o.layers.set(1),c(this,ye).add(o),c(this,Da).add(c(this,ye))}this.resize(c(this,ge),c(this,Ae))})}resize(t,e){E(this,ge,t),E(this,Ae,e);let i=this.getPositionAlignedCanvasCoordinates(c(this,ge),c(this,Ae)),n=this.getPositionAlignedPadding(),o=this.getPositionAlignedOffset(c(this,Ke),c(this,xr)),a=this.clampWithWarning(i.x+n.x+o.x,0,c(this,ge)-c(this,Ke),"x"),l=this.clampWithWarning(i.y+n.y+o.y,0,c(this,Ae)-c(this,xr),"y");this.setSize(c(this,Ke)/c(this,ge),c(this,xr)/c(this,Ae)),this.setXY(a/c(this,ge),l/c(this,Ae)),E(this,Hi,new Et(a,l,c(this,Ke),c(this,xr),{entityId:"watermark"}))}update(){this.dirty&&(this.render(),this.dirty=!1)}};zn=new WeakMap,Da=new WeakMap,ye=new WeakMap,Ht=new WeakMap,Hi=new WeakMap,Ke=new WeakMap,xr=new WeakMap,ge=new WeakMap,Ae=new WeakMap,s(Yd,"WatermarkSystem");var xu=Yd;d();var jd=100,Wd=class Wd{currentTotalBoundingBox;state;cameraSystem;dirty=!1;constructor(t,e){this.state=t,this.cameraSystem=e}update(){if(this.dirty){this.currentTotalBoundingBox==null&&(this.currentTotalBoundingBox=new Be,this.state.entityScene.children.length===0?this.currentTotalBoundingBox.setFromCenterAndSize(new Y(0,0,0),new Y(jd*2,jd*2,0)):(this.currentTotalBoundingBox.setFromObject(this.state.entityScene),this.currentTotalBoundingBox.expandByScalar(jd))),this.currentTotalBoundingBox.expandByObject(this.state.entityScene);for(let t of this.state.entity2DMap.values())t.positionDirty===!0&&(this.currentTotalBoundingBox.expandByPoint(t.position),t.positionDirty=!1);this.cameraSystem.panBounds={center:this.currentTotalBoundingBox.getCenter(new Y),min:this.currentTotalBoundingBox.min,max:this.currentTotalBoundingBox.max,radius:this.currentTotalBoundingBox.getBoundingSphere(new pm).radius},this.cameraSystem.dirty=!0,this.dirty=!1}}};s(Wd,"PanBoundsSystem");var Su=Wd;d();var Ud="\xA9 Mappedin",Zd=["top-left","top-right","bottom-left","bottom-right"],qP=640,$P=s(()=>`<svg xmlns='http://www.w3.org/2000/svg' width='15' height='15' fill-rule='evenodd' viewBox='0 0 20 20'>
485
510
  <circle cx='10' cy='10' r='5.9' style='fill:rgba(255,255,255,1);'/>
486
511
  <path style='fill:rgba(0,0,0,0.7);' d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/>
487
- </svg>`,"getAttributionButtonIcon"),kb={position:"bottom-right"},Gf=class Gf{controlContainerEl;controlPositions;compact=void 0;attribContainerEl;attribInnerEl;attribButtonEl;attribHTML=Ff;constructor(t){this.controlContainerEl=document.createElement("div"),this.controlContainerEl.classList.add("mappedin-control-container"),t.appendChild(this.controlContainerEl),this.controlPositions=Bf.reduce((r,i)=>{let n=document.createElement("div");return n.classList.add(`mappedin-ctrl-${i}`),this.controlContainerEl.appendChild(n),r[i]=n,r},{})}addAttributionControl(t=kb){let r=Bf.includes(t.position)?t.position:kb.position;this.attribContainerEl=document.createElement("details"),this.attribContainerEl.classList.add("mappedin-ctrl-attrib",`mappedin-ctrl-attrib-${r}`),this.attribContainerEl.open=!0,this.attribContainerEl.tabIndex=0,this.attribContainerEl.ariaLabel="Attribution",this.controlPositions[r].appendChild(this.attribContainerEl),this.attribButtonEl=document.createElement("summary"),this.attribButtonEl.addEventListener("click",this.toggleAttribution),this.attribButtonEl.classList.add("mappedin-ctrl-attrib-button"),this.attribButtonEl.title="Toggle attribution",this.attribButtonEl.ariaLabel="Toggle attribution",this.attribButtonEl.tabIndex=0,this.attribButtonEl.innerHTML=NP(),this.attribContainerEl.appendChild(this.attribButtonEl),this.attribInnerEl=document.createElement("div"),this.attribInnerEl.classList.add("mappedin-ctrl-attrib-inner"),this.attribInnerEl.innerHTML=Ff,this.attribContainerEl.appendChild(this.attribInnerEl)}toggleAttribution=t=>{this.attribContainerEl!=null&&(t.preventDefault(),this.attribContainerEl.classList.contains("mappedin-compact")&&(this.attribContainerEl.classList.contains("mappedin-compact-show")?(this.attribContainerEl.removeAttribute("open"),this.attribContainerEl.classList.remove("mappedin-compact-show")):(this.attribContainerEl.classList.add("mappedin-compact-show"),this.attribContainerEl.setAttribute("open",""))))};updateAttribution(t){if(!t.style||!this.attribInnerEl||!this.attribContainerEl)return;let r=[Ff],i=t.style.sourceCaches;for(let o in i){let a=i[o];if(a.used||a.usedForTerrain){let l=a.getSource();l.attribution&&r.indexOf(l.attribution)<0&&r.push(l.attribution)}}r=r.filter(o=>String(o).trim()),r.sort((o,a)=>o.length-a.length),r=r.filter((o,a)=>{for(let l=a+1;l<r.length;l++)if(r[l].indexOf(o)>=0)return!1;return!0});let n=r.join(" ");n!==this.attribHTML&&(this.attribHTML=n,r.length?(this.attribInnerEl.innerHTML=this.attribHTML,this.attribContainerEl.classList.remove("outdoor-attrib-empty")):this.attribContainerEl.classList.add("mappedin-attrib-empty"),this.resizeAttribution(t.getCanvasContainer().offsetWidth))}resizeAttribution(t){this.attribContainerEl&&(t<=AP||this.compact?this.compact===!1?this.attribContainerEl.setAttribute("open",""):!this.attribContainerEl.classList.contains("mappedin-compact")&&!this.attribContainerEl.classList.contains("mappedin-attrib-empty")&&(this.attribContainerEl.setAttribute("open",""),this.attribContainerEl.classList.add("mappedin-compact","mappedin-compact-show")):(this.attribContainerEl.setAttribute("open",""),this.attribContainerEl.classList.contains("mappedin-compact")&&this.attribContainerEl.classList.remove("mappedin-compact","mappedin-compact-show")))}destroyAttributionControl(){this.attribButtonEl&&this.attribButtonEl.removeEventListener("click",this.toggleAttribution),this.attribContainerEl&&(this.attribContainerEl.remove(),this.attribContainerEl=void 0,this.attribInnerEl=void 0,this.attribButtonEl=void 0)}resize(t){this.resizeAttribution(t)}updateData(t){this.updateAttribution(t)}destroy(){this.destroyAttributionControl(),this.controlContainerEl.remove(),this.compact=void 0}};s(Gf,"HTMLControlsSystem");var yc=Gf;f();var Ea,Vf=class Vf{constructor(t,r){v(this,"mesh");v(this,"type","custom-geometry");v(this,"dirty",!0);v(this,"feature");v(this,"builder");v(this,"outline");v(this,"color",new Mt);w(this,Ea,0);this.mesh=new Xe,this.feature=t,this.builder=r}get visible(){return this.mesh.visible}set visible(t){this.mesh.visible=t}setOpacity(){}setColor(){}get position(){var t;return(t=this.mesh)==null?void 0:t.position}get altitude(){return u(this,Ea)}set altitude(t){this.mesh&&(this.mesh.position.z=t,E(this,Ea,t))}};Ea=new WeakMap,s(Vf,"CustomGeometryComponent");var Ia=Vf;f();var Hf=class Hf{state;constructor(t){this.state=t}update(){let t,r;for(let i of this.state.threeDEntities){let n=this.state.entity3DMap.get(i);(n==null?void 0:n.type)==="custom-geometry"&&(t=n.components[0],r=n.components[1],t.dirty&&r.visible!==!1&&(t.builder.setup(t.mesh),t.mesh.traverse(o=>{o.userData={entityId:i,type:"custom-geometry"}}),t.dirty=!1),r.visible!==!1&&t.builder.update(t.mesh))}}};s(Hf,"CustomGeometrySystem");var gc=Hf;f();f();var Xf=class Xf{rendererState;dirty=!0;constructor(t){this.rendererState=t}update(t,r=!1){if((r&&t>=16&&t<=19||this.dirty)&&this.rendererState.threeDEntities.length>0){let n=Ut(t,16,19,0,30),o;for(let a of this.rendererState.threeDEntities)if(o=this.rendererState.entity3DMap.get(a),(o==null?void 0:o.type)==="geometry-group"){let l=o.userData.entities3D.values().next().value,c=this.rendererState.entity3DMap.get(l);if((c==null?void 0:c.type)==="geometry"){let h=c.components[0],d=c.components[1];if(d.visible!==!1&&h.outline&&h.outline.visible){let m=F(d.initialColor).darken(n).toRgbString();h.setOutlineColor(m)}}}}this.dirty=!1}};s(Xf,"OutlineInterpolationSystem");var vc=Xf;f();var Vn,_a,Yf=class Yf{constructor(t){v(this,"dirty",!0);v(this,"map");v(this,"stylesheetId","");v(this,"userHiddenLayers",[]);v(this,"hiddenLayersInStyle",[]);v(this,"centerPoint");w(this,Vn,s(async()=>{if(!this.map||!this.dirty||!this.hiddenLayersInStyle||this.hiddenLayersInStyle.length===0)return;let t=[],r=this.map.project(this.centerPoint),i=this.map.queryRenderedFeatures(r,{layers:this.hiddenLayersInStyle});for(var n of i)t.push(["!=",["id"],n.id]);t.length>0&&(this.hiddenLayersInStyle.forEach(o=>{this.map.setFilter(o,["all",...t])}),this.dirty=!1)},"#handleRender"));w(this,_a,s(t=>{var r,i,n;if(this.map&&t&&t.dataType==="style"&&t.type==="styledata"&&((r=this.userHiddenLayers)!=null&&r.length)){let o=(n=(i=t==null?void 0:t.style)==null?void 0:i.stylesheet)==null?void 0:n.id;(!o||o!==this.stylesheetId)&&(this.stylesheetId=o,this.filterStylesInMap(),this.dirty=!0)}},"#handleStyleChange"));t&&(this.map=t,this.map.on("styledata",u(this,_a)),this.map.on("render",u(this,Vn)))}hideLayersUnderPoint(t,r){this.centerPoint=t,this.userHiddenLayers=this.userHiddenLayers.concat(r),this.dirty=!0,this.filterStylesInMap(),u(this,Vn).call(this)}filterStylesInMap(){this.map&&(this.hiddenLayersInStyle=this.userHiddenLayers.filter(t=>this.map.getLayer(t)))}destroy(){this.map&&(this.map.off("styledata",u(this,_a)),this.map.off("render",u(this,Vn)))}};Vn=new WeakMap,_a=new WeakMap,s(Yf,"OutdoorLayers");var bc=Yf;var Gb=new Pr,zf=18,Zf=0,qf=0;var kP=at.radToDeg(.698132),oe,Dt,La,Hn,Zr,Ni,Ri,ki,Xn,Oa,Wf,A,nt,De,dt,Ze,ye,D,Da,bt,mt,Cc,Vb,xc,Hb,Sc,Xb,Fi,Aa,Na,Yn,Pc,Ra,ka,Fa,jn,ue,Oe,Ba,Uf,$t,Jt,Jf=class Jf extends st{constructor(r,i={}){var y,x,S,P,g,C,T,M,I,_;super();w(this,Oa);w(this,Cc);w(this,xc);w(this,Sc);w(this,ue);w(this,Ba);v(this,"options");v(this,"container");w(this,oe,void 0);w(this,Dt,void 0);w(this,La,void 0);w(this,Hn,void 0);w(this,Zr,void 0);w(this,Ni,void 0);w(this,Ri,void 0);w(this,ki,void 0);w(this,Xn,void 0);v(this,"rendererDomElement");w(this,A,{entity3DMap:new Map,entity2DMap:new Map,entity2DIds:new Set,threeDEntities:[],entityScene:new re("__scene"),hoverColor:"red",insetsPadding:Wl,shouldMeasureCanvas:!0,pixelRatio:Yr()});v(this,"camera");w(this,nt,void 0);w(this,De,void 0);w(this,dt,void 0);w(this,Ze,void 0);w(this,ye,void 0);w(this,D,{});w(this,Da,window.matchMedia("screen and (min-resolution: 2dppx)"));v(this,"map");w(this,bt,s(()=>{u(this,D).renderSystem.twoDdirty=!0},"#invalidate2DEntities"));w(this,mt,s(()=>{u(this,D).renderSystem.threeDdirty=!0},"#invalidate3DEntities"));w(this,Fi,"standalone");w(this,Aa,s(r=>Math.trunc(r*10)/10,"#round10"));w(this,Na,s(()=>{u(this,D).twoDDrawSystem.dirty=!0,j(this,Oa,Wf).call(this,Yr()),this.render()},"#handlePixelRatioChange"));w(this,Yn,s(()=>{E(this,Ni,this.rendererDomElement.clientWidth),E(this,Ri,this.rendererDomElement.clientHeight),j(this,Oa,Wf).call(this,Yr()),u(this,jn).call(this),j(this,Sc,Xb).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),this.render()},"#handleWindowResize"));w(this,Pc,s(()=>{this.renderSync()},"#renderFull"));w(this,Ra,new Y);w(this,ka,s((r,i)=>{let n=this.mode==="standalone"?u(this,Dt):this.viewCamera;if(u(this,Dt).position.z+this.camera.elevation>i.z){u(this,Ra).copy(i);let o=u(this,Ra).project(n),a=(o.x+1)/2*this.canvasWidth-0/2,l=(-o.y+1)/2*this.canvasHeight-0/2,c=u(this,Aa).call(this,a),h=u(this,Aa).call(this,l);r.x=c,r.y=h}else r.x=-1e3,r.y=-1e3},"#project"));w(this,Fa,s((r,i)=>{u(this,ye).setBufferSize(r,i),u(this,Dt).aspect=r/i,u(this,Dt).updateProjectionMatrix(),u(this,Dt).updateMatrixWorld(!0),u(this,Hn).x=r,u(this,Hn).y=i},"#setBufferSize"));w(this,jn,s(()=>{var a;let r=E(this,Ni,this.rendererDomElement.clientWidth),i=E(this,Ri,this.rendererDomElement.clientHeight),n=Math.floor(r*this.resolutionScale),o=Math.floor(i*this.resolutionScale);u(this,Fa).call(this,n,o),(a=this.map)==null||a.resize(),u(this,A).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",(r,i)=>{var c;let n=r/this.canvasWidth*2-1,o=-(i/this.canvasHeight)*2+1,a=new W(n,o);Gb.setFromCamera(a,u(this,Dt).clone());let l=(c=Gb.intersectObject(u(this,Zr),!1)[0])==null?void 0:c.point;return l!=null?this.convert3DMapPositionToCoordinate(l):void 0});v(this,"projectCoordinateToScreenXY",r=>{let i=this.convertTo3DMapPosition(r[1],r[0],r[2]||0),n=new W;return u(this,ka).call(this,n,i),{x:n.x,y:n.y}});v(this,"convertTo3DMapPosition",(r,i,n=0,o)=>{var c,h,d,m;let{x:a,y:l}=xl((h=(c=u(this,A).center)==null?void 0:c[1])!=null?h:0,(m=(d=u(this,A).center)==null?void 0:d[0])!=null?m:0,r,i);return o?(o.set(a,l,n),o):new Y(a,l,n)});v(this,"convert3DMapPositionToCoordinate",r=>{var o,a,l,c;let{lat:i,lon:n}=Cl((a=(o=u(this,A).center)==null?void 0:o[1])!=null?a:0,(c=(l=u(this,A).center)==null?void 0:l[0])!=null?c:0,r.x,r.y);return[n,i]});v(this,"setBackgroundColor",(r,i)=>{u(this,ye).setBackgroundColor(r,i)});v(this,"hideOutdoorLayersUnderPoint",(r,i)=>{!this.map||(i==null?void 0:i.length)===0||(u(this,D).outdoorLayersSystem.hideLayersUnderPoint(r,i),this.render())});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)});w(this,$t,Bn(()=>{this.publish("user-interaction-start",void 0)},0,!0));w(this,Jt,Bn(()=>{this.publish("user-interaction-end",void 0)},0,!0));v(this,"on",(r,i)=>{super.on(r,i),r==="outdoor-view-loaded"&&this.mode==="standalone"&&(X.warn('"outdoor-view-loaded" was subscribed to but outdoor view is disabled. The event has been triggered immediately. Enable outdoor view or remove the listener.'),this.publish("outdoor-view-loaded"))});v(this,"off",(r,i)=>{super.off(r,i)});v(this,"getCursor",()=>u(this,D).interactionSystem.getCursor());v(this,"destroy",()=>{u(this,D).cameraSystem.off("user-dolly-start",u(this,$t)),u(this,D).cameraSystem.off("user-pan-start",u(this,$t)),u(this,D).cameraSystem.off("user-rotate-start",u(this,$t)),u(this,D).cameraSystem.off("user-zoom-start",u(this,$t)),u(this,D).cameraSystem.off("user-tilt-start",u(this,$t)),u(this,D).cameraSystem.off("user-pedestal-start",u(this,$t)),u(this,D).cameraSystem.off("user-dolly-end",u(this,Jt)),u(this,D).cameraSystem.off("user-pan-end",u(this,Jt)),u(this,D).cameraSystem.off("user-rotate-end",u(this,Jt)),u(this,D).cameraSystem.off("user-zoom-end",u(this,Jt)),u(this,D).cameraSystem.off("user-tilt-end",u(this,Jt)),u(this,D).cameraSystem.off("user-pedestal-end",u(this,Jt)),u(this,D).renderSystem.off("measure-canvas",u(this,jn)),this.remove("__scene"),u(this,bt).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).cameraSystem.dispose(),u(this,D).exporterSystem.destroy(),u(this,D).outdoorLayersSystem.destroy(),window.removeEventListener("resize",u(this,Yn),!1),u(this,Da).removeEventListener("change",u(this,Na)),u(this,ki)&&u(this,ki).disconnect(),this._subscribers={},u(this,ye).destroy(),u(this,oe).traverse(r=>{mr(r),"dispose"in r&&typeof r.dispose=="function"&&r.dispose()}),E(this,oe,void 0),u(this,D).htmlControlsSystem.destroy(),u(this,D).collisionSystem.destroy(),u(this,D).domMutationSystem.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,Ze)),this.container.removeChild(u(this,nt)),E(this,ye,void 0)});(i.mode==="outdoors-interleaved"||i.mode==="outdoors-overlay")&&i.map&&(E(this,Fi,i.mode),this.map=i.map),u(this,A).entityScene.addEventListener("childadded",()=>{u(this,mt).call(this),u(this,bt).call(this)}),u(this,A).entityScene.addEventListener("childremoved",()=>{u(this,mt).call(this),u(this,bt).call(this)}),u(this,A).entity3DMap.set(u(this,A).entityScene.userData.entityId,u(this,A).entityScene),i.center&&(u(this,A).center=i.center?[...i.center]:[0,0]),this.options=i,this.container=r,j(this,Cc,Vb).call(this),j(this,xc,Hb).call(this),u(this,D).htmlControlsSystem=new yc(this.container),u(this,Fi)!=="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,ye,new vl({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,bt).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,oe,new us),u(this,oe).add(u(this,A).entityScene);let n=window.__THREE_DEVTOOLS__;b.env.NODE_ENV==="dev"&&typeof n<"u"&&(n.dispatchEvent(new CustomEvent("observe",{detail:u(this,oe)})),n.dispatchEvent(new CustomEvent("observe",{detail:u(this,ye)}))),E(this,Dt,new rm(kP,this.aspect,50,1e5)),E(this,La,new em),u(this,Dt).renderOrder=999;let o=new Ce;o.add(u(this,Dt)),E(this,Xn,new Ce),u(this,Xn).add(o),u(this,oe).add(u(this,Xn)),u(this,Dt).updateProjectionMatrix(),u(this,Dt).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,ye).domElement(),E(this,Hn,new W);let a=new $i(1e6,1e6),l=new xr({color:0,visible:!1});E(this,Zr,new Ft(a,l)),u(this,oe).add(u(this,Zr)),(S=i.gl)!=null&&S.canvas||r.appendChild(this.rendererDomElement),window.addEventListener("resize",u(this,Yn),!1),u(this,Da).addEventListener("change",u(this,Na)),typeof ResizeObserver=="function"&&((P=b.env)==null?void 0:P.NODE_ENV)!=="test"&&(E(this,ki,new ResizeObserver(Bn(()=>{u(this,Yn).call(this)},0))),(g=u(this,ki))==null||g.observe(r)),r.classList.add("mappedin-map"),this.rendererDomElement.style.width=(C=globalThis.MappedinDebug)!=null&&C.TEST_IOS?"1080px":"100%",this.rendererDomElement.style.height=(T=globalThis.MappedinDebug)!=null&&T.TEST_IOS?"1920px":"100%",E(this,Ni,this.rendererDomElement.clientWidth),E(this,Ri,this.rendererDomElement.clientHeight),this.rendererDomElement.style.touchAction="manipulation";let c=this.canvasWidth,h=this.canvasHeight;u(this,D).watermarkSystem=new fc(u(this,Dt),c,h,i==null?void 0:i.watermark),u(this,A).shouldMeasureCanvas=!0,u(this,A).pixelRatio=this.resolutionScale,u(this,Fa).call(this,Math.floor(c*this.resolutionScale),Math.floor(h*this.resolutionScale));let d=new fs(16777215,.3*Math.PI);d.position.set(-150,-150,350),u(this,oe).add(d);let m=new pm(16777215,.741*Math.PI);u(this,oe).add(m),u(this,D).cameraSystem=new xa(u(this,Dt),u(this,oe),u(this,ye).renderer,u(this,A),{mode:this.mode,canvasHeight:h,canvasWidth:c}),u(this,D).cameraSystem.on("user-dolly-start",u(this,$t)),u(this,D).cameraSystem.on("user-pan-start",u(this,$t)),u(this,D).cameraSystem.on("user-rotate-start",u(this,$t)),u(this,D).cameraSystem.on("user-zoom-start",u(this,$t)),u(this,D).cameraSystem.on("user-tilt-start",u(this,$t)),u(this,D).cameraSystem.on("user-pedestal-start",u(this,$t)),u(this,D).cameraSystem.on("user-dolly-end",u(this,Jt)),u(this,D).cameraSystem.on("user-pan-end",u(this,Jt)),u(this,D).cameraSystem.on("user-rotate-end",u(this,Jt)),u(this,D).cameraSystem.on("user-zoom-end",u(this,Jt)),u(this,D).cameraSystem.on("user-tilt-end",u(this,Jt)),u(this,D).cameraSystem.on("user-pedestal-end",u(this,Jt)),u(this,D).cameraSystem.on("change",()=>{this.publish("camera-change",this.camera),this.render()}),u(this,D).panBoundsSystem=new mc(u(this,A),u(this,D).cameraSystem),this.camera=new hc(this,u(this,D),u(this,A),u(this,Zr)),this.camera.setZoomLevel((M=i.zoomLevel)!=null?M:zf),this.camera.setBearing((I=i.bearing)!=null?I:qf),this.camera.setPitch((_=i.pitch)!=null?_:Zf),this.camera.setMaxZoomLevel(22),u(this,D).domVisiblitySystem=new tc(u(this,A),u(this,Ze)),u(this,D).domMutationSystem=new pc(u(this,A),u(this,Ze)),u(this,D).domMutationSystem.on("dimensions-update",()=>{u(this,D).collisionSystem.dirty=!0,this.render()}),u(this,D).domDrawSystem=new uc(u(this,A)),u(this,D).collisionSystem=new Ml(u(this,De),u(this,A)),u(this,D).twoDDrawSystem=new rc(u(this,A),u(this,dt)),u(this,D).interactionSystem=new Jo(this.rendererDomElement,u(this,A),u(this,Dt),u(this,Zr)),u(this,D).interactionSystem.on("hover",this.render),u(this,D).interactionSystem.on("click",O=>{var k,B,R,G;if(((k=O.entity2D)==null?void 0:k.id)==="watermark"&&typeof u(this,D).watermarkSystem.options.onClick=="function"){u(this,D).watermarkSystem.options.onClick();return}this.publish("click",{coordinate:this.convert3DMapPositionToCoordinate(O.position),geometry:O.entity3D?[(B=O.entity3D)==null?void 0:B.id]:[],markers:((R=O.entity2D)==null?void 0:R.components[0])instanceof de?[O.entity2D.id]:[],labels:((G=O.entity2D)==null?void 0:G.components[0])instanceof je?[O.entity2D.id]:[],pointerEvent:O.pointerEvent})}),u(this,D).interactionSystem.on("hover",O=>{var k,B,R,G;O.position&&((k=O.entity2D)==null?void 0:k.id)!=="watermark"&&this.publish("hover",{coordinate:this.convert3DMapPositionToCoordinate(O.position),geometry:O.entity3D?[(B=O.entity3D)==null?void 0:B.id]:[],markers:((R=O.entity2D)==null?void 0:R.components[0])instanceof de?[O.entity2D.id]:[],labels:((G=O.entity2D)==null?void 0:G.components[0])instanceof je?[O.entity2D.id]:[]})}),u(this,D).twoDVisiblitySystem=new nc(u(this,A)),u(this,D).drawSystem=new ic(u(this,A)),u(this,D).stackSystem=new sc(u(this,A)),u(this,D).twoDProjectionSystem=new ec(u(this,A),u(this,ka)),u(this,D).zoomInterpolationSystem=new Fl,u(this,D).exporterSystem=new sa(u(this,A)),u(this,D).meshOptimizationSystem=new Ql(u(this,A),this.convertTo3DMapPosition),u(this,D).customGeometrySystem=new gc(u(this,A)),u(this,D).outlineInterpolationSystem=new vc(u(this,A)),u(this,D).renderSystem=new oc(u(this,ye),u(this,A),this.mode,u(this,oe),u(this,Dt),this.viewCamera,u(this,D)),u(this,D).renderSystem.on("measure-canvas",u(this,jn)),u(this,D).outdoorLayersSystem=new bc(this.map),u(this,Pc).call(this)}get viewCamera(){return u(this,La)}get canvasWidth(){return u(this,Ni)}get canvasHeight(){return u(this,Ri)}get resolutionScale(){var r,i;return(i=(r=this.map)==null?void 0:r.getPixelRatio())!=null?i:Yr()}get aspect(){return this.canvasWidth/this.canvasHeight}get mode(){return u(this,Fi)}addGroupContainer(r,i,n){var o;if(u(this,A).entity3DMap.has(r))X.error(`Group container with ID '${r}' already exists. The group container cannot be added.`);else{let a=new re(r);a.addEventListener("childadded",()=>{u(this,mt).call(this),u(this,bt).call(this)}),a.addEventListener("childremoved",()=>{u(this,mt).call(this),u(this,bt).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),u(this,A).entity3DMap.set(r,a),(o=j(this,ue,Oe).call(this,n))==null||o.addEntity(a),u(this,mt).call(this),this.render()}return{id:r,type:"group-container"}}addStackContainer(r,i,n){var o;if(u(this,A).entity3DMap.has(r))X.error(`Stack container with ID '${r}' already exists. The stack container cannot be added.`);else{let a=new re(r);a.addEventListener("childadded",()=>{u(this,mt).call(this),u(this,bt).call(this)}),a.addEventListener("childremoved",()=>{u(this,mt).call(this),u(this,bt).call(this)}),a.components[0]=new En,(i==null?void 0:i.visible)!==void 0&&(a.visible=i.visible),u(this,A).entity3DMap.set(r,a),(o=j(this,ue,Oe).call(this,n))==null||o.addEntity(a)}return{id:r,type:"stack-container"}}addCustomGeometry(r,i,n,o,a){var l;if(u(this,A).entity3DMap.has(r))X.error(`Custom geometry with ID '${r}' already exists. The custom geometry cannot be added.`);else{let c=new Ia(i,n),h=new St(c,new jr(o));h.id=r,c.mesh.userData={entityId:r,type:"custom-geometry"},u(this,A).entity3DMap.set(h.id,h),(l=j(this,ue,Oe).call(this,a))==null||l.addEntity(h),this.render()}return{id:r,type:"custom-geometry"}}addGeometryGroup(r,i,n,o){var a,l;if(u(this,A).entity3DMap.has(r))X.error(`Geometry group with ID '${r}' already exists. The geometry group cannot be added.`);else{let c=new fe(r);c.addEventListener("childadded",()=>{u(this,mt).call(this),u(this,bt).call(this)}),c.addEventListener("childremoved",()=>{u(this,mt).call(this),u(this,bt).call(this)}),c.userData.dirty=!0,u(this,A).entity3DMap.set(r,c);for(let h of i.features){if(!["Polygon","MultiPolygon","LineString","MultiLineString"].includes(h.geometry.type))continue;let d=h.id||h.properties.id||vt(),m=u(this,D).meshOptimizationSystem.createEntityFromFeature(d,h,n);u(this,A).entity3DMap.set(d,m),c.userData.entities3D.add(d)}c.setVisible((a=n==null?void 0:n.visible)!=null?a:!0),(l=j(this,ue,Oe).call(this,o))==null||l.addEntity(c),u(this,mt).call(this),this.render()}return{id:r,type:"geometry-group"}}addModelGroup(r,i,n,o){var a;if(u(this,A).entity3DMap.has(r))X.error(`Model group with ID '${r}' already exists. The model group cannot be added.`);else{let l=new fe(r);l.addEventListener("childadded",()=>{u(this,mt).call(this),u(this,bt).call(this)}),l.addEventListener("childremoved",()=>{u(this,mt).call(this),u(this,bt).call(this)}),l.userData.dirty=!0,l.userData.modelURL=n.url;for(let c of i.features){let h=c.id||c.properties.id||vt(),d=u(this,D).meshOptimizationSystem.createModelFromFeature(h,c,n);u(this,A).entity3DMap.set(h,d),l.userData.entities3D.add(h)}u(this,A).entity3DMap.set(r,l),(a=j(this,ue,Oe).call(this,o))==null||a.addEntity(l),u(this,mt).call(this),this.render()}return{id:r,type:"geometry-group"}}addMarker2D(r,i,n,o){var l;let a=n==null?void 0:n.id;if(a===void 0||!u(this,A).entity2DMap.has(a)){let c=j(this,Ba,Uf).call(this,r,new de(i,n));c.id=a||String(c.id),a=c.id,(n==null?void 0:n.interactive)!=null&&Ue(c,n==null?void 0:n.interactive,u(this,A)),(l=j(this,ue,Oe).call(this,o))==null||l.addEntity(c),this.render()}else X.error(`Marker2D with ID '${a}' already exists. The marker cannot be added.`);return{id:a,type:"marker"}}addLabel2D(r,i,n,o){var l;let a=n==null?void 0:n.id;if(a===void 0||!u(this,A).entity2DMap.has(a)){let c=j(this,Ba,Uf).call(this,r,new je(i,n||{},u(this,A)));c.id=a||String(c.id),a=c.id,(n==null?void 0:n.interactive)!=null&&Ue(c,n==null?void 0:n.interactive,u(this,A)),(l=j(this,ue,Oe).call(this,o))==null||l.addEntity(c),u(this,bt).call(this),this.render()}else X.error(`Label2D with ID '${a}' already exists. The label cannot be added.`);return{id:a,type:"label"}}addPath(r,i={},n){var l;let o=new ac(r.features.map(c=>c.geometry.coordinates).map(c=>this.convertTo3DMapPosition(c[1],c[0],c[2]||0)),i),a=new St(o,new jr);return a.id=(i==null?void 0:i.id)||vt(),o.mesh.userData={entityId:a.id,type:"path"},u(this,A).entity3DMap.set(a.id,a),(i==null?void 0:i.interactive)!=null&&Ue(a,i==null?void 0:i.interactive,u(this,A)),(l=j(this,ue,Oe).call(this,n))==null||l.addEntity(a),u(this,mt).call(this),this.render(),{id:a.id,type:"path"}}updateStackState(r,i){let n;(typeof r=="string"||typeof r=="number")&&(n=u(this,A).entity3DMap.get(r)),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(r){let i;if(typeof r=="string"||typeof r=="number"?(i=u(this,A).entity2DMap.get(r),i==null&&(i=u(this,A).entity3DMap.get(r))):typeof r.id=="string"||typeof r.id=="number"?(i=u(this,A).entity2DMap.get(r.id),i==null&&(i=u(this,A).entity3DMap.get(r.id))):i=r,i!=null){if(i.type==="custom-geometry")u(this,A).entity3DMap.delete(i.id),i.object3d&&mr(i.object3d);else if(i.type==="group-container"){u(this,A).entity3DMap.delete(i.userData.entityId);for(let n of i.childrenIds.values())this.remove(n),i.userData.entities2D.delete(n);mr(i)}else if(i.type==="geometry-group"){u(this,A).entity3DMap.delete(i.userData.entityId);for(let n of i.userData.entities3D.values())this.remove(n),i.userData.entities3D.delete(n);mr(i)}else i.type==="geometry"||i.type==="model"||i.type==="path"?(i.object3d&&mr(i.object3d),i.components[0].outline&&mr(i.components[0].outline),u(this,A).entity3DMap.delete(i.id)):(i.type==="marker"||i.type==="label")&&(i.object3d&&mr(i.object3d),i.type==="label"&&delete u(this,D).twoDDrawSystem.textCache[i.id],u(this,A).entity2DMap.delete(i.id));u(this,mt).call(this),u(this,bt).call(this),this.render()}}getScene(){return this.getState("__scene")}getCurrentSceneGLTF(r){return u(this,D).exporterSystem.getCurrentSceneGLTF(r)}getBoundingBox(r){if(this.renderSync(),r==null){let n=new Ne;n.setFromObject(u(this,A).entityScene);let o=n.min,a=n.max;return[this.convert3DMapPositionToCoordinate(o),this.convert3DMapPositionToCoordinate(a)]}let i=Sl(u(this,A),r);if((i==null?void 0:i.type)==="geometry"&&(i==null?void 0:i.object3d)!=null){let n=new Ne;return n.setFromObject(i.object3d),[this.convert3DMapPositionToCoordinate(n.min),this.convert3DMapPositionToCoordinate(n.max)]}else if(((i==null?void 0:i.type)==="geometry-group"||(i==null?void 0:i.type)==="group-container")&&(i==null?void 0:i.userData.entityId)!=null){let n=new Ne;return n.setFromObject(i),[this.convert3DMapPositionToCoordinate(n.min),this.convert3DMapPositionToCoordinate(n.max)]}}getState(r){var n;if(r==null)return{type:"map-view",hoverColor:u(this,A).hoverColor};let i=Sl(u(this,A),r);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 a of i.userData.entities3D.values()){let l=this.getState(a);(l.type==="geometry"||l.type==="model")&&o.push(l)}return{id:i.userData.entityId,type:"geometry-group",visible:i.visible,opacity:i.getOpacity(),interactive:Array.from(i.userData.entities3D.values()).map(a=>u(this,A).entity3DMap.get(a)).every(a=>a.components[2]!=null),children:Array.from(i.userData.entities3D.values()).map(a=>this.getState(a)).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,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,l=a==null?void 0:a.userData.entityId;return{id:i.id,type:"label",text:o.text||"",parent:{id:l,type:a==null?void 0:a.type},position:this.convert3DMapPositionToCoordinate(i.position),enabled:o.enabled,initialRank:$o(o.initialRank),options:{rank:$o(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,l=a==null?void 0:a.userData.entityId;return{id:i.id,type:"marker",enabled:o.enabled,parent:{id:l,type:a==null?void 0:a.type},position:this.convert3DMapPositionToCoordinate(i.position),element:o.containerEl,initialRank:$o(o.initialRank),options:{rank:$o(o.rank),interactive:i.components[1]!=null||!1}}}else if((i==null?void 0:i.type)==="geometry"){let{color:o,hoverColor:a,initialColor:l,topColor:c}=i.components[1],h=i.components[0],d=i.components[1];return{id:i.id,type:"geometry",color:o,topColor:c,initialColor:l,hoverColor:a,visible:d.visible,position:this.convert3DMapPositionToCoordinate(h.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],l=i.components[1];return{id:i.id,type:"path",position:this.convert3DMapPositionToCoordinate(o.position),visible:l.visible,interactive:a!=null,completeFraction:o.completeFraction}}else return}}setState(r,i){var o,a,l;if(typeof r=="object"&&"hoverColor"in r&&i==null){u(this,A).hoverColor=(o=r.hoverColor)!=null?o:u(this,A).hoverColor;return}let n=Sl(u(this,A),r);if(n!=null){if(n.type==="custom-geometry"){let c=u(this,A).entity3DMap.get(n.id);if(c instanceof St&&c.components[0]instanceof Ia){let h=i;Rn(n,h.visible),Qh(n,h.altitude),Jh(n,h.position,this.convertTo3DMapPosition),Kh(n,j(this,ue,Oe).call(this,h.parent,!1))}}else if(n.type==="model"||n.type==="path"){let c=i;Ue(n,c.interactive,u(this,A))&&u(this,mt).call(this),n.type==="path"&&(c=c,qv(n,c),Rn(n,c.visible))}else if(n.type==="group-container"){let c=i;Rn(n,c.visible)&&(u(this,D).outlineInterpolationSystem.dirty=!0),Qh(n,c.altitude)}else if(n.type==="geometry-group"){let c=i;Rn(n,c.visible)&&(u(this,D).outlineInterpolationSystem.dirty=!0),tb(n,u(this,A),c.opacity),Ue(n,c.interactive,u(this,A))&&(u(this,mt).call(this),u(this,bt).call(this))}else if(n.type==="geometry"){if(n.components[0]instanceof We){let c=i;Rn(n,c.visible)&&(u(this,D).outlineInterpolationSystem.dirty=!0),zv(n,c),Qv(n,c.hoverColor),Ue(n,c.interactive,u(this,A))}u(this,mt).call(this)}else if(n.type==="label"||n.type==="marker"){let c=i;Kv(n,i),$v(n,i)&&u(this,bt).call(this),Jv(n,(a=c.options)==null?void 0:a.rank)&&u(this,bt).call(this),Jh(n,c.position,this.convertTo3DMapPosition),Kh(n,j(this,ue,Oe).call(this,c.parent,!1))&&(u(this,bt).call(this),u(this,D).panBoundsSystem.dirty=!0),Zv(n,c.enabled),Ue(n,(l=c.options)==null?void 0:l.interactive,u(this,A))&&u(this,bt).call(this)}this.render()}}getCenter(r){let i=Array.isArray(r)?r:this.getBoundingBox(r);return i?Z2(i):void 0}getSystems(){return u(this,D)}getInternalState(){return u(this,A)}};oe=new WeakMap,Dt=new WeakMap,La=new WeakMap,Hn=new WeakMap,Zr=new WeakMap,Ni=new WeakMap,Ri=new WeakMap,ki=new WeakMap,Xn=new WeakMap,Oa=new WeakSet,Wf=s(function(r){var i;u(this,Fi)!=="outdoors-overlay"&&((i=this.map)==null||i.setPixelRatio(r)),u(this,A).pixelRatio=this.resolutionScale},"#setResolutionScale"),A=new WeakMap,nt=new WeakMap,De=new WeakMap,dt=new WeakMap,Ze=new WeakMap,ye=new WeakMap,D=new WeakMap,Da=new WeakMap,bt=new WeakMap,mt=new WeakMap,Cc=new WeakSet,Vb=s(function(){E(this,nt,document.createElement("div")),u(this,nt).classList.add("mappedin__smart-collision-engine__container"),E(this,De,document.createElement("canvas")),u(this,De).classList.add("mappedin__smart-collision-engine-debug__container"),this.container.appendChild(u(this,nt)),E(this,dt,document.createElement("canvas")),u(this,dt).classList.add("mappedin__smart-collision-engine__container"),u(this,dt).width=u(this,nt).clientWidth*this.resolutionScale,u(this,dt).height=u(this,nt).clientHeight*this.resolutionScale,u(this,dt).style.width=u(this,nt).clientWidth+"px",u(this,dt).style.height=u(this,nt).clientHeight+"px",u(this,nt).appendChild(u(this,De)),u(this,nt).appendChild(u(this,dt)),u(this,De).width=u(this,nt).clientWidth,u(this,De).height=u(this,nt).clientHeight,u(this,dt).width=u(this,nt).clientWidth*this.resolutionScale,u(this,dt).height=u(this,nt).clientHeight*this.resolutionScale,u(this,dt).style.width=u(this,nt).clientWidth+"px",u(this,dt).style.height=u(this,nt).clientHeight+"px"},"#renderEntity2DContainer"),xc=new WeakSet,Hb=s(function(){E(this,Ze,document.createElement("div")),u(this,Ze).classList.add("mappedin-2d-entities"),Object.assign(u(this,Ze).style,{position:"absolute",top:"0",left:"0",bottom:"0",right:"0",pointerEvents:"none","transform-style":"preserve-3d"}),this.container.appendChild(u(this,Ze))},"#renderEntityDOMContainer"),Sc=new WeakSet,Xb=s(function(){u(this,dt).width=u(this,nt).clientWidth*this.resolutionScale,u(this,dt).height=u(this,nt).clientHeight*this.resolutionScale,u(this,dt).style.width=u(this,nt).clientWidth+"px",u(this,dt).style.height=u(this,nt).clientHeight+"px",u(this,De).width=u(this,nt).clientWidth,u(this,De).height=u(this,nt).clientHeight,u(this,dt).width=u(this,nt).clientWidth*this.resolutionScale,u(this,dt).height=u(this,nt).clientHeight*this.resolutionScale,u(this,dt).style.width=u(this,nt).clientWidth+"px",u(this,dt).style.height=u(this,nt).clientHeight+"px",u(this,D).collisionSystem.dirty=!0},"#resizeCollisionCanvas"),Fi=new WeakMap,Aa=new WeakMap,Na=new WeakMap,Yn=new WeakMap,Pc=new WeakMap,Ra=new WeakMap,ka=new WeakMap,Fa=new WeakMap,jn=new WeakMap,ue=new WeakSet,Oe=s(function(r,i=!0){if(!r)return i?u(this,A).entityScene:void 0;if(typeof r=="string"||typeof r=="number"){let n=u(this,A).entity3DMap.get(r);return n instanceof re?n:(X.warn("Parent is not a valid container, adding to scene"),i?u(this,A).entityScene:void 0)}else if(r.type==="group-container"){let n=u(this,A).entity3DMap.get(r.id);if(n instanceof re)return n}return i?u(this,A).entityScene:void 0},"#getParentContainer"),Ba=new WeakSet,Uf=s(function(r,i,n){let o=new Ee(i,this.convertTo3DMapPosition(r[1],r[0],r[2]||n||0));return u(this,A).entity2DMap.set(o.id,o),o},"#createEntity2D"),$t=new WeakMap,Jt=new WeakMap,s(Jf,"Core");var jf=Jf,$f=jf;f();var FP="https://tiles-cdn.mappedin.com/styles/mappedin/style.json",BP="https://auth.mappedin.com/oauth2/token";async function Yb(e,t){var r,i,n,o,a;if((r=t==null?void 0:t.outdoorView)!=null&&r.enabled&&((i=t==null?void 0:t.outdoorView)!=null&&i.headers)){let{Map:l,MercatorCoordinate:c}=await import("./outdoor-context-v4-2K6NTFX7.js"),h=t.outdoorView.headers;h==null&&(h=await U2(BP));let d=t.center||[0,0],m=new l({container:e,style:t.outdoorView.style||FP,center:d,attributionControl:!1,zoom:(n=t.zoomLevel)!=null?n:zf,pitch:(o=t.pitch)!=null?o:Zf,bearing:(a=t.bearing)!=null?a:qf,transformRequest:M=>{var I;return{url:M,headers:(I=t.outdoorView)==null?void 0:I.headers}},trackResize:!1,pixelRatio:Yr(),antialias:typeof t.antialias=="boolean"?t.antialias:!0});m.touchZoomRotate.disable(),m.doubleClickZoom.disable(),m.scrollZoom.disable(),m.dragPan.disable(),m.keyboard.disable(),m.boxZoom.disable(),m.dragRotate.disable();let y=m.painter.context.gl,x=new $f(e,{center:d,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",M=>{S.center=M.center,S.zoom=M.zoomLevel,S.bearing=-M.bearing,S.pitch=M.pitch,m.jumpTo(S)});let P=c.fromLngLat(d,0),g=W2(P,x.viewCamera,x.camera,()=>{x.renderSync()});m.on("style.load",async()=>{m&&(m.addLayer(g),x.renderSync())});let C=!1;m.on("idle",()=>{m&&(C||(x.publish("outdoor-view-loaded"),C=!0))});let T=s(M=>{M&&(M.sourceDataType==="metadata"||M.sourceDataType==="visibility"||M.dataType==="style"||M.type==="terrain")&&x.getSystems().htmlControlsSystem.updateData(m)},"updateData");return m.on("styledata",M=>{m&&M&&M.dataType==="style"&&M.type==="styledata"&&(C=!1),T(M)}),m.on("sourcedata",T),m.on("terrain",T),m.on("error",M=>{X.warn(M)}),x}else return new $f(e,t)}s(Yb,"createRenderer");f();f();var Wn=class Wn{id;text;__type=Wn.__type;static is(t){return t.__type===Wn.__type}constructor(t,r){this.id=t,this.text=r}};s(Wn,"Label"),v(Wn,"__type","Label");var qr=Wn;f();var Un=class Un{id;__type=Un.__type;contentEl;update;static is(t){return t.__type===Un.__type}constructor(t,r,i){this.id=t,this.contentEl=r,this.update=i}};s(Un,"Marker"),v(Un,"__type","Marker");var Bi=Un;f();var Kf=class Kf{id;__type;constructor(t){this.id=t,this.__type="Path"}};s(Kf,"Path");var Ga=Kf;f();var $r,Qf=class Qf{constructor(t){w(this,$r,void 0);E(this,$r,t)}get center(){return u(this,$r).center}get bearing(){return u(this,$r).bearing}get pitch(){return u(this,$r).pitch}get zoomLevel(){return u(this,$r).zoomLevel}};$r=new WeakMap,s(Qf,"CameraTransform");var Va=Qf;f();f();f();var GP=new Map([["search-16x16",`<svg viewBox="0 0 16 16">
512
+ </svg>`,"getAttributionButtonIcon"),tb={position:"bottom-right"},zd=class zd{controlContainerEl;controlPositions;compact=void 0;attribContainerEl;attribInnerEl;attribButtonEl;attribHTML=Ud;constructor(t){this.controlContainerEl=document.createElement("div"),this.controlContainerEl.classList.add("mappedin-control-container"),t.appendChild(this.controlContainerEl),this.controlPositions=Zd.reduce((e,i)=>{let n=document.createElement("div");return n.classList.add(`mappedin-ctrl-${i}`),this.controlContainerEl.appendChild(n),e[i]=n,e},{})}addAttributionControl(t=tb){let e=Zd.includes(t.position)?t.position:tb.position;this.attribContainerEl=document.createElement("details"),this.attribContainerEl.classList.add("mappedin-ctrl-attrib",`mappedin-ctrl-attrib-${e}`),this.attribContainerEl.open=!0,this.attribContainerEl.tabIndex=0,this.attribContainerEl.ariaLabel="Attribution",this.controlPositions[e].appendChild(this.attribContainerEl),this.attribButtonEl=document.createElement("summary"),this.attribButtonEl.addEventListener("click",this.toggleAttribution),this.attribButtonEl.classList.add("mappedin-ctrl-attrib-button"),this.attribButtonEl.title="Toggle attribution",this.attribButtonEl.ariaLabel="Toggle attribution",this.attribButtonEl.tabIndex=0,this.attribButtonEl.innerHTML=$P(),this.attribContainerEl.appendChild(this.attribButtonEl),this.attribInnerEl=document.createElement("div"),this.attribInnerEl.classList.add("mappedin-ctrl-attrib-inner"),this.attribInnerEl.innerHTML=Ud,this.attribContainerEl.appendChild(this.attribInnerEl)}toggleAttribution=t=>{this.attribContainerEl!=null&&(t.preventDefault(),this.attribContainerEl.classList.contains("mappedin-compact")&&(this.attribContainerEl.classList.contains("mappedin-compact-show")?(this.attribContainerEl.removeAttribute("open"),this.attribContainerEl.classList.remove("mappedin-compact-show")):(this.attribContainerEl.classList.add("mappedin-compact-show"),this.attribContainerEl.setAttribute("open",""))))};updateAttribution(t){if(!t.style||!this.attribInnerEl||!this.attribContainerEl)return;let e=[Ud],i=t.style.sourceCaches;for(let o in i){let a=i[o];if(a.used||a.usedForTerrain){let l=a.getSource();l.attribution&&e.indexOf(l.attribution)<0&&e.push(l.attribution)}}e=e.filter(o=>String(o).trim()),e.sort((o,a)=>o.length-a.length),e=e.filter((o,a)=>{for(let l=a+1;l<e.length;l++)if(e[l].indexOf(o)>=0)return!1;return!0});let n=e.join(" ");n!==this.attribHTML&&(this.attribHTML=n,e.length?(this.attribInnerEl.innerHTML=this.attribHTML,this.attribContainerEl.classList.remove("outdoor-attrib-empty")):this.attribContainerEl.classList.add("mappedin-attrib-empty"),this.resizeAttribution(t.getCanvasContainer().offsetWidth))}resizeAttribution(t){this.attribContainerEl&&(t<=qP||this.compact?this.compact===!1?this.attribContainerEl.setAttribute("open",""):!this.attribContainerEl.classList.contains("mappedin-compact")&&!this.attribContainerEl.classList.contains("mappedin-attrib-empty")&&(this.attribContainerEl.setAttribute("open",""),this.attribContainerEl.classList.add("mappedin-compact","mappedin-compact-show")):(this.attribContainerEl.setAttribute("open",""),this.attribContainerEl.classList.contains("mappedin-compact")&&this.attribContainerEl.classList.remove("mappedin-compact","mappedin-compact-show")))}destroyAttributionControl(){this.attribButtonEl&&this.attribButtonEl.removeEventListener("click",this.toggleAttribution),this.attribContainerEl&&(this.attribContainerEl.remove(),this.attribContainerEl=void 0,this.attribInnerEl=void 0,this.attribButtonEl=void 0)}resize(t){this.resizeAttribution(t)}updateData(t){this.updateAttribution(t)}destroy(){this.destroyAttributionControl(),this.controlContainerEl.remove(),this.compact=void 0}};s(zd,"HTMLControlsSystem");var Pu=zd;d();var Na,qd=class qd{constructor(t,e){v(this,"mesh");v(this,"type","custom-geometry");v(this,"dirty",!0);v(this,"feature");v(this,"builder");v(this,"outline");v(this,"color",new Mt);T(this,Na,0);this.mesh=new Ue,this.feature=t,this.builder=e}get visible(){return this.mesh.visible}set visible(t){this.mesh.visible=t}setOpacity(){}setColor(){}get position(){var t;return(t=this.mesh)==null?void 0:t.position}get altitude(){return c(this,Na)}set altitude(t){this.mesh&&(this.mesh.position.z=t,E(this,Na,t))}};Na=new WeakMap,s(qd,"CustomGeometryComponent");var Aa=qd;d();var $d=class $d{state;constructor(t){this.state=t}update(){let t,e;for(let i of this.state.threeDEntities){let n=this.state.entity3DMap.get(i);(n==null?void 0:n.type)==="custom-geometry"&&(t=n.components[0],e=n.components[1],t.dirty&&e.visible!==!1&&(t.builder.setup(t.mesh),t.mesh.traverse(o=>{o.userData={entityId:i,type:"custom-geometry"}}),t.dirty=!1),e.visible!==!1&&t.builder.update(t.mesh))}}};s($d,"CustomGeometrySystem");var Mu=$d;d();d();var Jd=class Jd{rendererState;dirty=!0;geometries3DDirty=!0;constructor(t){this.rendererState=t}update(t,e=!1){var o,a;let i=e&&t>=16&&t<=19,n;if(this.geometries3DDirty){for(let l of this.rendererState.threeDEntities)if(n=this.rendererState.entity3DMap.get(l),n&&n.type==="geometry-group"&&n.userData.modelURL===void 0&&n.userData.dirty===!1&&n.userData.outlineDirty===!0){let u=n.children[0];if(n.children.length>0){let h=Sv(u.geometry,u.material);h.userData.outlineOfEntityId=n.userData.entityId;for(let f of n.userData.entities3D.values()){let m=this.rendererState.entity3DMap.get(f);(m==null?void 0:m.type)==="geometry"&&(m.components[0].outline=h)}(o=n.parent)==null||o.add(h),n.userData.outlineDirty=!1}this.dirty=!0}this.geometries3DDirty=!1}if((i||this.dirty)&&this.rendererState.threeDEntities.length>0){let l=le(t,16,19,0,30),u;for(let h of this.rendererState.threeDEntities)if(u=this.rendererState.entity3DMap.get(h),(u==null?void 0:u.type)==="geometry-group"&&u.components[0]!=null){let f=u.components[0].color,m=F(f).darken(l).toRgbString(),y=(a=u.parent)==null?void 0:a.children.find(x=>x.userData.outlineOfEntityId===u.userData.entityId);if(y){let x=Array.isArray(y.material)?y.material:[y.material];for(let S of x)S.color.equals(m)||(S.color.set(m),S.needsUpdate=!0)}}}this.dirty=!1}};s(Jd,"OutlineInterpolationSystem");var Tu=Jd;d();var qn,Ra,Kd=class Kd{constructor(t){v(this,"dirty",!0);v(this,"map");v(this,"stylesheetId","");v(this,"userHiddenLayers",[]);v(this,"hiddenLayersInStyle",[]);v(this,"centerPoint");T(this,qn,s(async()=>{if(!this.map||!this.dirty||!this.hiddenLayersInStyle||this.hiddenLayersInStyle.length===0)return;let t=[],e=this.map.project(this.centerPoint),i=this.map.queryRenderedFeatures(e,{layers:this.hiddenLayersInStyle});for(var n of i)t.push(["!=",["id"],n.id]);t.length>0&&(this.hiddenLayersInStyle.forEach(o=>{this.map.setFilter(o,["all",...t])}),this.dirty=!1)},"#handleRender"));T(this,Ra,s(t=>{var e,i,n;if(this.map&&t&&t.dataType==="style"&&t.type==="styledata"&&((e=this.userHiddenLayers)!=null&&e.length)){let o=(n=(i=t==null?void 0:t.style)==null?void 0:i.stylesheet)==null?void 0:n.id;(!o||o!==this.stylesheetId)&&(this.stylesheetId=o,this.filterStylesInMap(),this.dirty=!0)}},"#handleStyleChange"));t&&(this.map=t,this.map.on("styledata",c(this,Ra)),this.map.on("render",c(this,qn)))}hideLayersUnderPoint(t,e){this.centerPoint=t,this.userHiddenLayers=this.userHiddenLayers.concat(e),this.dirty=!0,this.filterStylesInMap(),c(this,qn).call(this)}filterStylesInMap(){this.map&&(this.hiddenLayersInStyle=this.userHiddenLayers.filter(t=>this.map.getLayer(t)))}destroy(){this.map&&(this.map.off("styledata",c(this,Ra)),this.map.off("render",c(this,qn)))}};qn=new WeakMap,Ra=new WeakMap,s(Kd,"OutdoorLayers");var wu=Kd;d();var KP="#ffffff",Qd=class Qd{color=KP;topColor;opacity=1;constructor(t={}){var e,i;this.color=(e=t==null?void 0:t.color)!=null?e:this.color,this.topColor=t==null?void 0:t.topColor,this.opacity=(i=t==null?void 0:t.opacity)!=null?i:this.opacity}};s(Qd,"GeometryGroupStyleComponent");var ka=Qd;var ib=new _r,nf=18,of=0,af=0;var QP=st.radToDeg(.698132),ne,Dt,Fa,$n,ei,Xi,Yi,ji,Jn,Ba,ef,A,at,Re,ft,Qe,ve,O,Ga,bt,mt,Iu,nb,Eu,ob,_u,ab,Wi,Va,Ha,Kn,Lu,Xa,Ya,ja,Qn,ce,Ne,Wa,rf,qt,$t,lf=class lf extends nt{constructor(e,i={}){var y,x,S,P,g,C,w,I,M,_;super();T(this,Ba);T(this,Iu);T(this,Eu);T(this,_u);T(this,ce);T(this,Wa);v(this,"options");v(this,"container");T(this,ne,void 0);T(this,Dt,void 0);T(this,Fa,void 0);T(this,$n,void 0);T(this,ei,void 0);T(this,Xi,void 0);T(this,Yi,void 0);T(this,ji,void 0);T(this,Jn,void 0);v(this,"rendererDomElement");T(this,A,{entity3DMap:new Map,entity2DMap:new Map,entity2DIds:new Set,threeDEntities:[],entityScene:new ee("__scene"),hoverColor:"red",insetsPadding:Kl,shouldMeasureCanvas:!0,pixelRatio:qr()});v(this,"camera");T(this,at,void 0);T(this,Re,void 0);T(this,ft,void 0);T(this,Qe,void 0);T(this,ve,void 0);T(this,O,{});T(this,Ga,window.matchMedia("screen and (min-resolution: 2dppx)"));v(this,"map");T(this,bt,s(()=>{c(this,O).renderSystem.twoDdirty=!0},"#invalidate2DEntities"));T(this,mt,s(()=>{c(this,O).renderSystem.threeDdirty=!0},"#invalidate3DEntities"));T(this,Wi,"standalone");T(this,Va,s(e=>Math.trunc(e*10)/10,"#round10"));T(this,Ha,s(()=>{c(this,O).twoDDrawSystem.dirty=!0,j(this,Ba,ef).call(this,qr()),c(this,O).watermarkSystem.dirty=!0,this.render()},"#handlePixelRatioChange"));T(this,Kn,s(()=>{E(this,Xi,this.rendererDomElement.clientWidth),E(this,Yi,this.rendererDomElement.clientHeight),j(this,Ba,ef).call(this,qr()),c(this,Qn).call(this),j(this,_u,ab).call(this),c(this,O).cameraSystem.resize(this.canvasWidth,this.canvasHeight),c(this,O).cameraSystem.dirty=!0,c(this,O).watermarkSystem.resize(this.canvasWidth,this.canvasHeight),c(this,O).htmlControlsSystem.resize(this.canvasWidth),this.render()},"#handleWindowResize"));T(this,Lu,s(()=>{this.renderSync()},"#renderFull"));T(this,Xa,new Y);T(this,Ya,s((e,i)=>{let n=this.mode==="standalone"?c(this,Dt):this.viewCamera;if(c(this,Dt).position.z+this.camera.elevation>i.z){c(this,Xa).copy(i);let o=c(this,Xa).project(n),a=(o.x+1)/2*this.canvasWidth-0/2,l=(-o.y+1)/2*this.canvasHeight-0/2,u=c(this,Va).call(this,a),h=c(this,Va).call(this,l);e.x=u,e.y=h}else e.x=-1e3,e.y=-1e3},"#project"));T(this,ja,s((e,i)=>{c(this,ve).setBufferSize(e,i),c(this,Dt).aspect=e/i,c(this,Dt).updateProjectionMatrix(),c(this,Dt).updateMatrixWorld(!0),c(this,$n).x=e,c(this,$n).y=i},"#setBufferSize"));T(this,Qn,s(()=>{var a;let e=E(this,Xi,this.rendererDomElement.clientWidth),i=E(this,Yi,this.rendererDomElement.clientHeight),n=Math.floor(e*this.resolutionScale),o=Math.floor(i*this.resolutionScale);c(this,ja).call(this,n,o),(a=this.map)==null||a.resize(),c(this,A).shouldMeasureCanvas=!1},"#measureCanvas"));v(this,"showCollisionBoxes",()=>{c(this,O).collisionSystem.showCollisionBoxes(),this.render()});v(this,"hideCollisionBoxes",()=>{c(this,O).collisionSystem.hideCollisionBoxes(),this.render()});v(this,"projectScreenXYToCoordinate",(e,i)=>{var u;let n=e/this.canvasWidth*2-1,o=-(i/this.canvasHeight)*2+1,a=new W(n,o);ib.setFromCamera(a,c(this,Dt).clone());let l=(u=ib.intersectObject(c(this,ei),!1)[0])==null?void 0:u.point;return l!=null?this.convert3DMapPositionToCoordinate(l):void 0});v(this,"projectCoordinateToScreenXY",e=>{let i=this.convertTo3DMapPosition(e[1],e[0],e[2]||0),n=new W;return c(this,Ya).call(this,n,i),{x:n.x,y:n.y}});v(this,"convertTo3DMapPosition",(e,i,n=0,o)=>{var u,h,f,m;let{x:a,y:l}=El((h=(u=c(this,A).center)==null?void 0:u[1])!=null?h:0,(m=(f=c(this,A).center)==null?void 0:f[0])!=null?m:0,e,i);return o?(o.set(a,l,n),o):new Y(a,l,n)});v(this,"convert3DMapPositionToCoordinate",e=>{var o,a,l,u;let{lat:i,lon:n}=Il((a=(o=c(this,A).center)==null?void 0:o[1])!=null?a:0,(u=(l=c(this,A).center)==null?void 0:l[0])!=null?u:0,e.x,e.y);return[n,i]});v(this,"setBackgroundColor",(e,i)=>{c(this,ve).setBackgroundColor(e,i)});v(this,"hideOutdoorLayersUnderPoint",(e,i)=>{!this.map||(i==null?void 0:i.length)===0||(c(this,O).outdoorLayersSystem.hideLayersUnderPoint(e,i),this.render())});v(this,"render",()=>{c(this,O).renderSystem!=null&&(this.map&&(this.mode==="outdoors-interleaved"||this.mode==="outdoors-overlay")?this.map.triggerRepaint():c(this,O).renderSystem.update())});v(this,"renderSync",()=>{c(this,O).renderSystem.update(!0)});T(this,qt,Wn(()=>{this.publish("user-interaction-start",void 0)},0,!0));T(this,$t,Wn(()=>{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"&&(H.warn(`"${e}" was subscribed to but outdoor view is disabled. The event has been triggered immediately. Enable outdoor view or remove the listener.`),this.publish(e))});v(this,"off",(e,i)=>{super.off(e,i)});v(this,"getCursor",()=>c(this,O).interactionSystem.getCursor());v(this,"destroy",()=>{c(this,O).cameraSystem.off("user-dolly-start",c(this,qt)),c(this,O).cameraSystem.off("user-pan-start",c(this,qt)),c(this,O).cameraSystem.off("user-rotate-start",c(this,qt)),c(this,O).cameraSystem.off("user-zoom-start",c(this,qt)),c(this,O).cameraSystem.off("user-tilt-start",c(this,qt)),c(this,O).cameraSystem.off("user-pedestal-start",c(this,qt)),c(this,O).cameraSystem.off("user-dolly-end",c(this,$t)),c(this,O).cameraSystem.off("user-pan-end",c(this,$t)),c(this,O).cameraSystem.off("user-rotate-end",c(this,$t)),c(this,O).cameraSystem.off("user-zoom-end",c(this,$t)),c(this,O).cameraSystem.off("user-tilt-end",c(this,$t)),c(this,O).cameraSystem.off("user-pedestal-end",c(this,$t)),c(this,O).renderSystem.off("measure-canvas",c(this,Qn)),this.remove("__scene"),c(this,bt).call(this),c(this,mt).call(this),this.renderSync(),c(this,O).renderSystem.destroy(),c(this,O).zoomInterpolationSystem.destroy(),c(this,O).renderSystem.destroy(),c(this,O).cameraSystem.off("change",this.render),c(this,O).cameraSystem.dispose(),c(this,O).exporterSystem.destroy(),c(this,O).outdoorLayersSystem.destroy(),c(this,O).drawSystem.destroy(),window.removeEventListener("resize",c(this,Kn),!1),c(this,Ga).removeEventListener("change",c(this,Ha)),c(this,ji)&&c(this,ji).disconnect(),this._subscribers={},c(this,ve).destroy(),c(this,ne).traverse(e=>{Cr(e),"dispose"in e&&typeof e.dispose=="function"&&e.dispose()}),E(this,ne,void 0),c(this,O).htmlControlsSystem.destroy(),c(this,O).collisionSystem.destroy(),c(this,O).domMutationSystem.destroy(),E(this,O,void 0),this.map&&(this.map.transform.getElevation=void 0,this.map.remove()),this.container.contains(this.rendererDomElement)&&this.container.removeChild(this.rendererDomElement),this.container.removeChild(c(this,Qe)),this.container.removeChild(c(this,at)),E(this,ve,void 0)});(i.mode==="outdoors-interleaved"||i.mode==="outdoors-overlay")&&i.map&&(E(this,Wi,i.mode),this.map=i.map),c(this,A).entityScene.addEventListener("childadded",()=>{c(this,mt).call(this),c(this,bt).call(this)}),c(this,A).entityScene.addEventListener("childremoved",()=>{c(this,mt).call(this),c(this,bt).call(this)}),c(this,A).entity3DMap.set(c(this,A).entityScene.userData.entityId,c(this,A).entityScene),i.center&&(c(this,A).center=i.center?[...i.center]:[0,0]),this.options=i,this.container=e,j(this,Iu,nb).call(this),j(this,Eu,ob).call(this),c(this,O).htmlControlsSystem=new Pu(this.container),c(this,Wi)!=="outdoors-overlay"&&c(this,O).htmlControlsSystem.addAttributionControl(this.options.attribution),window.MappedinDebug||(window.MappedinDebug={}),b.env.NODE_ENV==="test"&&(window.MappedinDebug.mapViewCoreInstance=this),E(this,ve,new Tl({antialias:typeof i.antialias=="boolean"?i.antialias:!0,alpha:!1,canvas:this.mode!=="standalone"?(y=i.gl)==null?void 0:y.canvas:void 0,onWebGLContextCreationError:i.onWebGLContextCreationError,onWebGLContextLost:()=>{typeof i.onWebGLContextLost=="function"&&i.onWebGLContextLost()},onWebGLContextRestored:()=>{i.onWebGLContextRestored&&i.onWebGLContextRestored(),c(this,bt).call(this),c(this,mt).call(this),this.render()},onWebGLRendererError:i.onWebGLRendererError,backgroundColor:i.backgroundColor||"#ffffff",backgroundAlpha:(x=i.backgroundAlpha)!=null?x:1})),E(this,ne,new vs),c(this,ne).add(c(this,A).entityScene);let n=window.__THREE_DEVTOOLS__;b.env.NODE_ENV==="dev"&&typeof n<"u"&&(n.dispatchEvent(new CustomEvent("observe",{detail:c(this,ne)})),n.dispatchEvent(new CustomEvent("observe",{detail:c(this,ve)}))),E(this,Dt,new fm(QP,this.aspect,50,1e5)),E(this,Fa,new dm),c(this,Dt).renderOrder=999;let o=new Se;o.add(c(this,Dt)),E(this,Jn,new Se),c(this,Jn).add(o),c(this,ne).add(c(this,Jn)),c(this,Dt).updateProjectionMatrix(),c(this,Dt).updateMatrixWorld(!0),this.referenceMap={scale:1,latitude:0,longitude:0,getNorth:()=>0,georeference:[{target:{x:0,y:0}},{target:{x:0,y:0}},{target:{x:0,y:0}},{target:{x:0,y:0}}]},this.rendererDomElement=c(this,ve).domElement(),E(this,$n,new W);let a=new nn(1e6,1e6),l=new Ir({color:0,visible:!1});E(this,ei,new jt(a,l)),c(this,ne).add(c(this,ei)),(S=i.gl)!=null&&S.canvas||e.appendChild(this.rendererDomElement),window.addEventListener("resize",c(this,Kn),!1),c(this,Ga).addEventListener("change",c(this,Ha)),typeof ResizeObserver=="function"&&((P=b.env)==null?void 0:P.NODE_ENV)!=="test"&&(E(this,ji,new ResizeObserver(Wn(()=>{c(this,Kn).call(this)},0))),(g=c(this,ji))==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=(w=globalThis.MappedinDebug)!=null&&w.TEST_IOS?"1920px":"100%",E(this,Xi,this.rendererDomElement.clientWidth),E(this,Yi,this.rendererDomElement.clientHeight),this.rendererDomElement.style.touchAction="manipulation";let u=this.canvasWidth,h=this.canvasHeight;c(this,O).watermarkSystem=new xu(c(this,Dt),u,h,c(this,A),i==null?void 0:i.watermark),c(this,A).shouldMeasureCanvas=!0,c(this,A).pixelRatio=this.resolutionScale,c(this,ja).call(this,Math.floor(u*this.resolutionScale),Math.floor(h*this.resolutionScale));let f=new xs(16777215,.3*Math.PI);f.position.set(-150,-150,350),c(this,ne).add(f);let m=new Pm(16777215,.741*Math.PI);c(this,ne).add(m),c(this,O).cameraSystem=new _a(c(this,Dt),c(this,ne),c(this,ve).renderer,c(this,A),{mode:this.mode,canvasHeight:h,canvasWidth:u}),c(this,O).cameraSystem.on("user-dolly-start",c(this,qt)),c(this,O).cameraSystem.on("user-pan-start",c(this,qt)),c(this,O).cameraSystem.on("user-rotate-start",c(this,qt)),c(this,O).cameraSystem.on("user-zoom-start",c(this,qt)),c(this,O).cameraSystem.on("user-tilt-start",c(this,qt)),c(this,O).cameraSystem.on("user-pedestal-start",c(this,qt)),c(this,O).cameraSystem.on("user-dolly-end",c(this,$t)),c(this,O).cameraSystem.on("user-pan-end",c(this,$t)),c(this,O).cameraSystem.on("user-rotate-end",c(this,$t)),c(this,O).cameraSystem.on("user-zoom-end",c(this,$t)),c(this,O).cameraSystem.on("user-tilt-end",c(this,$t)),c(this,O).cameraSystem.on("user-pedestal-end",c(this,$t)),c(this,O).cameraSystem.on("change",()=>{this.publish("camera-change",this.camera),this.render()}),c(this,O).panBoundsSystem=new Su(c(this,A),c(this,O).cameraSystem),this.camera=new Cu(this,c(this,O),c(this,A),c(this,ei)),this.camera.setZoomLevel((I=i.zoomLevel)!=null?I:nf),this.camera.setBearing((M=i.bearing)!=null?M:af),this.camera.setPitch((_=i.pitch)!=null?_:of),this.camera.setMaxZoomLevel(22),c(this,O).domVisiblitySystem=new su(c(this,A),c(this,Qe)),c(this,O).domMutationSystem=new bu(c(this,A),c(this,Qe)),c(this,O).domMutationSystem.on("dimensions-update",()=>{c(this,O).collisionSystem.dirty=!0,this.render()}),c(this,O).domDrawSystem=new vu(c(this,A)),c(this,O).collisionSystem=new Ol(c(this,Re),c(this,A)),c(this,O).twoDDrawSystem=new uu(c(this,A),c(this,ft)),c(this,O).interactionSystem=new na(this.rendererDomElement,c(this,A),c(this,Dt),c(this,ei)),c(this,O).interactionSystem.on("hover",this.render),c(this,O).interactionSystem.on("click",D=>{var k,B,R,G;if(((k=D.entity2D)==null?void 0:k.id)==="watermark"&&typeof c(this,O).watermarkSystem.options.onClick=="function"){c(this,O).watermarkSystem.options.onClick();return}this.publish("click",{coordinate:this.convert3DMapPositionToCoordinate(D.position),geometry:D.entity3D?[(B=D.entity3D)==null?void 0:B.id]:[],markers:((R=D.entity2D)==null?void 0:R.components[0])instanceof fe?[D.entity2D.id]:[],labels:((G=D.entity2D)==null?void 0:G.components[0])instanceof ze?[D.entity2D.id]:[],pointerEvent:D.pointerEvent})}),c(this,O).interactionSystem.on("hover",D=>{var k,B,R,G;D.position&&((k=D.entity2D)==null?void 0:k.id)!=="watermark"&&this.publish("hover",{coordinate:this.convert3DMapPositionToCoordinate(D.position),geometry:D.entity3D?[(B=D.entity3D)==null?void 0:B.id]:[],markers:((R=D.entity2D)==null?void 0:R.components[0])instanceof fe?[D.entity2D.id]:[],labels:((G=D.entity2D)==null?void 0:G.components[0])instanceof ze?[D.entity2D.id]:[]})}),c(this,O).twoDVisiblitySystem=new hu(c(this,A)),c(this,O).drawSystem=new pu(c(this,A)),c(this,O).drawSystem.on("texture-loaded",this.render),c(this,O).stackSystem=new mu(c(this,A)),c(this,O).twoDProjectionSystem=new lu(c(this,A),c(this,Ya)),c(this,O).zoomInterpolationSystem=new jl,c(this,O).exporterSystem=new fa(c(this,A)),c(this,O).meshOptimizationSystem=new au(c(this,A),this.convertTo3DMapPosition),c(this,O).customGeometrySystem=new Mu(c(this,A)),c(this,O).outlineInterpolationSystem=new Tu(c(this,A)),c(this,O).renderSystem=new du(c(this,ve),c(this,A),this.mode,c(this,ne),c(this,Dt),this.viewCamera,c(this,O)),c(this,O).renderSystem.on("measure-canvas",c(this,Qn)),c(this,O).outdoorLayersSystem=new wu(this.map),c(this,Lu).call(this)}get viewCamera(){return c(this,Fa)}get canvasWidth(){return c(this,Xi)}get canvasHeight(){return c(this,Yi)}get resolutionScale(){var e,i;return(i=(e=this.map)==null?void 0:e.getPixelRatio())!=null?i:qr()}get aspect(){return this.canvasWidth/this.canvasHeight}get mode(){return c(this,Wi)}addGroupContainer(e,i,n){var o;if(c(this,A).entity3DMap.has(e))H.error(`Group container with ID '${e}' already exists. The group container cannot be added.`);else{let a=new ee(e);a.addEventListener("childadded",()=>{c(this,mt).call(this),c(this,bt).call(this)}),a.addEventListener("childremoved",()=>{c(this,mt).call(this),c(this,bt).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),c(this,A).entity3DMap.set(e,a),(o=j(this,ce,Ne).call(this,n))==null||o.addEntity(a),c(this,mt).call(this),this.render()}return{id:e,type:"group-container"}}addStackContainer(e,i,n){var o;if(c(this,A).entity3DMap.has(e))H.error(`Stack container with ID '${e}' already exists. The stack container cannot be added.`);else{let a=new ee(e);a.addEventListener("childadded",()=>{c(this,mt).call(this),c(this,bt).call(this)}),a.addEventListener("childremoved",()=>{c(this,mt).call(this),c(this,bt).call(this)}),a.components[0]=new Rn,(i==null?void 0:i.visible)!==void 0&&(a.visible=i.visible),c(this,A).entity3DMap.set(e,a),(o=j(this,ce,Ne).call(this,n))==null||o.addEntity(a)}return{id:e,type:"stack-container"}}addCustomGeometry(e,i,n,o,a){var l;if(c(this,A).entity3DMap.has(e))H.error(`Custom geometry with ID '${e}' already exists. The custom geometry cannot be added.`);else{let u=new Aa(i,n),h=new St(u,new $r(o));h.id=e,u.mesh.userData={entityId:e,type:"custom-geometry"},c(this,A).entity3DMap.set(h.id,h),(l=j(this,ce,Ne).call(this,a))==null||l.addEntity(h),this.render()}return{id:e,type:"custom-geometry"}}addGeometryGroup(e,i,n,o){var a,l;if(c(this,A).entity3DMap.has(e))H.error(`Geometry group with ID '${e}' already exists. The geometry group cannot be added.`);else{let u=new de(e,new ka(n));u.addEventListener("childadded",()=>{c(this,mt).call(this),c(this,bt).call(this)}),u.addEventListener("childremoved",()=>{c(this,mt).call(this),c(this,bt).call(this)}),u.userData.dirty=!0,c(this,A).entity3DMap.set(e,u);for(let h of i.features){if(!["Polygon","MultiPolygon","LineString","MultiLineString"].includes(h.geometry.type))continue;let f=h.id||h.properties.id||vt(),m=c(this,O).meshOptimizationSystem.createEntityFromFeature(f,h,n);c(this,A).entity3DMap.set(f,m),u.userData.entities3D.add(f)}u.setVisible((a=n==null?void 0:n.visible)!=null?a:!0),(l=j(this,ce,Ne).call(this,o))==null||l.addEntity(u),c(this,mt).call(this),this.render()}return c(this,O).outlineInterpolationSystem.dirty=!0,{id:e,type:"geometry-group"}}addModelGroup(e,i,n,o){var a;if(c(this,A).entity3DMap.has(e))H.error(`Model group with ID '${e}' already exists. The model group cannot be added.`);else{let l=new de(e,new ka(n));l.addEventListener("childadded",()=>{c(this,mt).call(this),c(this,bt).call(this)}),l.addEventListener("childremoved",()=>{c(this,mt).call(this),c(this,bt).call(this)}),l.userData.dirty=!0,l.userData.modelURL=n.url;for(let u of i.features){let h=u.id||u.properties.id||vt(),f=c(this,O).meshOptimizationSystem.createModelFromFeature(h,u,n);c(this,A).entity3DMap.set(h,f),l.userData.entities3D.add(h)}c(this,A).entity3DMap.set(e,l),(a=j(this,ce,Ne).call(this,o))==null||a.addEntity(l),c(this,mt).call(this),this.render()}return{id:e,type:"geometry-group"}}addMarker2D(e,i,n,o){var l;let a=n==null?void 0:n.id;if(a===void 0||!c(this,A).entity2DMap.has(a)){let u=j(this,Wa,rf).call(this,e,new fe(i,n));u.id=a||String(u.id),a=u.id,(n==null?void 0:n.interactive)!=null&&$e(u,n==null?void 0:n.interactive,c(this,A)),(l=j(this,ce,Ne).call(this,o))==null||l.addEntity(u),this.render()}else H.error(`Marker2D with ID '${a}' already exists. The marker cannot be added.`);return{id:a,type:"marker"}}addLabel2D(e,i,n,o){var l;let a=n==null?void 0:n.id;if(a===void 0||!c(this,A).entity2DMap.has(a)){let u=j(this,Wa,rf).call(this,e,new ze(i,n||{},c(this,A)));u.id=a||String(u.id),a=u.id,(n==null?void 0:n.interactive)!=null&&$e(u,n==null?void 0:n.interactive,c(this,A)),(l=j(this,ce,Ne).call(this,o))==null||l.addEntity(u),c(this,bt).call(this),this.render()}else H.error(`Label2D with ID '${a}' already exists. The label cannot be added.`);return{id:a,type:"label"}}addPath(e,i={},n){var l;let o=new fu(e.features.map(u=>u.geometry.coordinates).map(u=>this.convertTo3DMapPosition(u[1],u[0],u[2]||0)),i),a=new St(o,new $r);return a.id=(i==null?void 0:i.id)||vt(),o.mesh.userData={entityId:a.id,type:"path"},c(this,A).entity3DMap.set(a.id,a),(i==null?void 0:i.interactive)!=null&&$e(a,i==null?void 0:i.interactive,c(this,A)),(l=j(this,ce,Ne).call(this,n))==null||l.addEntity(a),c(this,mt).call(this),this.render(),{id:a.id,type:"path"}}updateStackState(e,i){let n;(typeof e=="string"||typeof e=="number")&&(n=c(this,A).entity3DMap.get(e)),n!=null&&n.components[0]&&(typeof i.activeId<"u"&&(n.components[0].activeId=i.activeId),typeof i.expandedFactor<"u"&&(n.components[0].percentExpanded=i.expandedFactor),n.components[0].dirty=!0,this.render())}remove(e){let i;if(typeof e=="string"||typeof e=="number"?(i=c(this,A).entity2DMap.get(e),i==null&&(i=c(this,A).entity3DMap.get(e))):typeof e.id=="string"||typeof e.id=="number"?(i=c(this,A).entity2DMap.get(e.id),i==null&&(i=c(this,A).entity3DMap.get(e.id))):i=e,i!=null){if(i.type==="custom-geometry")c(this,A).entity3DMap.delete(i.id),i.object3d&&Cr(i.object3d);else if(i.type==="group-container"){c(this,A).entity3DMap.delete(i.userData.entityId);for(let n of i.childrenIds.values())this.remove(n),i.userData.entities2D.delete(n);Cr(i)}else if(i.type==="geometry-group"){c(this,A).entity3DMap.delete(i.userData.entityId);for(let n of i.userData.entities3D.values())this.remove(n),i.userData.entities3D.delete(n);Cr(i)}else i.type==="geometry"||i.type==="model"||i.type==="path"?(i.object3d&&Cr(i.object3d),i.components[0].outline&&Cr(i.components[0].outline),c(this,A).entity3DMap.delete(i.id)):(i.type==="marker"||i.type==="label")&&(i.object3d&&Cr(i.object3d),i.type==="label"&&delete c(this,O).twoDDrawSystem.textCache[i.id],c(this,A).entity2DMap.delete(i.id));c(this,mt).call(this),c(this,bt).call(this),this.render()}}getScene(){return this.getState("__scene")}getCurrentSceneGLTF(e){return c(this,O).exporterSystem.getCurrentSceneGLTF(e)}getBoundingBox(e){if(this.renderSync(),e==null){let n=new Be;n.setFromObject(c(this,A).entityScene);let o=n.min,a=n.max;return[this.convert3DMapPositionToCoordinate(o),this.convert3DMapPositionToCoordinate(a)]}let i=_l(c(this,A),e);if((i==null?void 0:i.type)==="geometry"&&(i==null?void 0:i.object3d)!=null){let n=new Be;return n.setFromObject(i.object3d),[this.convert3DMapPositionToCoordinate(n.min),this.convert3DMapPositionToCoordinate(n.max)]}else if(((i==null?void 0:i.type)==="geometry-group"||(i==null?void 0:i.type)==="group-container")&&(i==null?void 0:i.userData.entityId)!=null){let n=new Be;return n.setFromObject(i),[this.convert3DMapPositionToCoordinate(n.min),this.convert3DMapPositionToCoordinate(n.max)]}}getState(e){var n;if(e==null)return{type:"map-view",hoverColor:c(this,A).hoverColor};let i=_l(c(this,A),e);if((i==null?void 0:i.type)==="custom-geometry"){let o=i.components[0],a=i.components[1];return{id:i.id,type:"custom-geometry",visible:a.visible,altitude:a.altitude,parent:(n=i.parent)==null?void 0:n.userData.entityId,position:this.convert3DMapPositionToCoordinate(o.position)}}else if((i==null?void 0:i.type)==="geometry-group"){let o=[];for(let l of i.userData.entities3D.values()){let u=this.getState(l);(u.type==="geometry"||u.type==="model")&&o.push(u)}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,interactive:Array.from(i.userData.entities3D.values()).map(l=>c(this,A).entity3DMap.get(l)).every(l=>l.components[2]!=null),children:Array.from(i.userData.entities3D.values()).map(l=>this.getState(l)).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,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,l=a==null?void 0:a.userData.entityId;return{id:i.id,type:"label",text:o.text||"",parent:{id:l,type:a==null?void 0:a.type},position:this.convert3DMapPositionToCoordinate(i.position),enabled:o.enabled,initialRank:ia(o.initialRank),options:{rank:ia(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,l=a==null?void 0:a.userData.entityId;return{id:i.id,type:"marker",enabled:o.enabled,parent:{id:l,type:a==null?void 0:a.type},position:this.convert3DMapPositionToCoordinate(i.position),element:o.containerEl,initialRank:ia(o.initialRank),options:{rank:ia(o.rank),interactive:i.components[1]!=null||!1}}}else if((i==null?void 0:i.type)==="geometry"){let{color:o,hoverColor:a,initialColor:l,topColor:u}=i.components[1],h=i.components[0],f=i.components[1];return{id:i.id,type:"geometry",color:o,topColor:u,initialColor:l,hoverColor:a,visible:f.visible,position:this.convert3DMapPositionToCoordinate(h.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],l=i.components[1];return{id:i.id,type:"path",position:this.convert3DMapPositionToCoordinate(o.position),visible:l.visible,interactive:a!=null,completeFraction:o.completeFraction}}else return}}setState(e,i){var o,a,l;if(typeof e=="object"&&"hoverColor"in e&&i==null){c(this,A).hoverColor=(o=e.hoverColor)!=null?o:c(this,A).hoverColor;return}let n=_l(c(this,A),e);if(n!=null){if(n.type==="custom-geometry"){let u=c(this,A).entity3DMap.get(n.id);if(u instanceof St&&u.components[0]instanceof Aa){let h=i;Xn(n,h.visible),sd(n,h.altitude),od(n,h.position,this.convertTo3DMapPosition),ad(n,j(this,ce,Ne).call(this,h.parent,!1))}}else if(n.type==="model"||n.type==="path"){let u=i;$e(n,u.interactive,c(this,A))&&c(this,mt).call(this),n.type==="path"&&(u=u,uv(n,u),Xn(n,u.visible))}else if(n.type==="group-container"){let u=i;Xn(n,u.visible)&&(c(this,O).outlineInterpolationSystem.dirty=!0),sd(n,u.altitude)}else if(n.type==="geometry-group"){let u=i;Xn(n,u.visible)&&(c(this,O).outlineInterpolationSystem.dirty=!0),av(n,c(this,A),u)&&(c(this,O).outlineInterpolationSystem.dirty=!0),fv(n,c(this,A),u.opacity),$e(n,u.interactive,c(this,A))&&(c(this,mt).call(this),c(this,bt).call(this))}else if(n.type==="geometry"){if(n.components[0]instanceof qe){let u=i;Xn(n,u.visible)&&(c(this,O).outlineInterpolationSystem.dirty=!0),sv(n,u),dv(n,u.hoverColor),$e(n,u.interactive,c(this,A))}c(this,mt).call(this)}else if(n.type==="label"||n.type==="marker"){let u=i;hv(n,i),cv(n,i)&&c(this,bt).call(this),pv(n,(a=u.options)==null?void 0:a.rank)&&c(this,bt).call(this),od(n,u.position,this.convertTo3DMapPosition),ad(n,j(this,ce,Ne).call(this,u.parent,!1))&&(c(this,bt).call(this),c(this,O).panBoundsSystem.dirty=!0),lv(n,u.enabled),$e(n,(l=u.options)==null?void 0:l.interactive,c(this,A))&&c(this,bt).call(this)}this.render()}}getCenter(e){let i=Array.isArray(e)?e:this.getBoundingBox(e);return i?a3(i):void 0}getSystems(){return c(this,O)}getInternalState(){return c(this,A)}};ne=new WeakMap,Dt=new WeakMap,Fa=new WeakMap,$n=new WeakMap,ei=new WeakMap,Xi=new WeakMap,Yi=new WeakMap,ji=new WeakMap,Jn=new WeakMap,Ba=new WeakSet,ef=s(function(e){var i;c(this,Wi)!=="outdoors-overlay"&&((i=this.map)==null||i.setPixelRatio(e)),c(this,A).pixelRatio=this.resolutionScale},"#setResolutionScale"),A=new WeakMap,at=new WeakMap,Re=new WeakMap,ft=new WeakMap,Qe=new WeakMap,ve=new WeakMap,O=new WeakMap,Ga=new WeakMap,bt=new WeakMap,mt=new WeakMap,Iu=new WeakSet,nb=s(function(){E(this,at,document.createElement("div")),c(this,at).classList.add("mappedin__smart-collision-engine__container"),E(this,Re,document.createElement("canvas")),c(this,Re).classList.add("mappedin__smart-collision-engine-debug__container"),this.container.appendChild(c(this,at)),E(this,ft,document.createElement("canvas")),c(this,ft).classList.add("mappedin__smart-collision-engine__container"),c(this,ft).width=c(this,at).clientWidth*this.resolutionScale,c(this,ft).height=c(this,at).clientHeight*this.resolutionScale,c(this,ft).style.width=c(this,at).clientWidth+"px",c(this,ft).style.height=c(this,at).clientHeight+"px",c(this,at).appendChild(c(this,Re)),c(this,at).appendChild(c(this,ft)),c(this,Re).width=c(this,at).clientWidth,c(this,Re).height=c(this,at).clientHeight,c(this,ft).width=c(this,at).clientWidth*this.resolutionScale,c(this,ft).height=c(this,at).clientHeight*this.resolutionScale,c(this,ft).style.width=c(this,at).clientWidth+"px",c(this,ft).style.height=c(this,at).clientHeight+"px"},"#renderEntity2DContainer"),Eu=new WeakSet,ob=s(function(){E(this,Qe,document.createElement("div")),c(this,Qe).classList.add("mappedin-2d-entities"),Object.assign(c(this,Qe).style,{position:"absolute",top:"0",left:"0",bottom:"0",right:"0",pointerEvents:"none","transform-style":"preserve-3d"}),this.container.appendChild(c(this,Qe))},"#renderEntityDOMContainer"),_u=new WeakSet,ab=s(function(){c(this,ft).width=c(this,at).clientWidth*this.resolutionScale,c(this,ft).height=c(this,at).clientHeight*this.resolutionScale,c(this,ft).style.width=c(this,at).clientWidth+"px",c(this,ft).style.height=c(this,at).clientHeight+"px",c(this,Re).width=c(this,at).clientWidth,c(this,Re).height=c(this,at).clientHeight,c(this,ft).width=c(this,at).clientWidth*this.resolutionScale,c(this,ft).height=c(this,at).clientHeight*this.resolutionScale,c(this,ft).style.width=c(this,at).clientWidth+"px",c(this,ft).style.height=c(this,at).clientHeight+"px",c(this,O).collisionSystem.dirty=!0},"#resizeCollisionCanvas"),Wi=new WeakMap,Va=new WeakMap,Ha=new WeakMap,Kn=new WeakMap,Lu=new WeakMap,Xa=new WeakMap,Ya=new WeakMap,ja=new WeakMap,Qn=new WeakMap,ce=new WeakSet,Ne=s(function(e,i=!0){if(!e)return i?c(this,A).entityScene:void 0;if(typeof e=="string"||typeof e=="number"){let n=c(this,A).entity3DMap.get(e);return n instanceof ee?n:(H.warn("Parent is not a valid container, adding to scene"),i?c(this,A).entityScene:void 0)}else if(e.type==="group-container"){let n=c(this,A).entity3DMap.get(e.id);if(n instanceof ee)return n}return i?c(this,A).entityScene:void 0},"#getParentContainer"),Wa=new WeakSet,rf=s(function(e,i,n){let o=new Le(i,this.convertTo3DMapPosition(e[1],e[0],e[2]||n||0));return c(this,A).entity2DMap.set(o.id,o),o},"#createEntity2D"),qt=new WeakMap,$t=new WeakMap,s(lf,"Core");var tf=lf,sf=tf;d();var tM="https://tiles-cdn.mappedin.com/styles/mappedin/style.json",eM="https://auth.mappedin.com/oauth2/token";async function sb(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:l,MercatorCoordinate:u}=await import("./outdoor-context-v4-P6FPVSAJ.js"),h=t.outdoorView.headers;h==null&&(h=await n3(eM));let f=t.center||[0,0],m=new l({container:r,style:t.outdoorView.style||tM,center:f,attributionControl:!1,zoom:(n=t.zoomLevel)!=null?n:nf,pitch:(o=t.pitch)!=null?o:of,bearing:(a=t.bearing)!=null?a:af,transformRequest:M=>{var _;return{url:M,headers:(_=t.outdoorView)==null?void 0:_.headers}},trackResize:!1,pixelRatio:qr(),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 sf(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",M=>{S.center=M.center,S.zoom=M.zoomLevel,S.bearing=-M.bearing,S.pitch=M.pitch,m.jumpTo(S)});let P=u.fromLngLat(f,0),g=i3(P,x.viewCamera,x.camera,()=>{x.renderSync()});m.on("style.load",async()=>{m&&(m.addLayer(g),x.renderSync())});let C=!1,w=!1;m.on("idle",()=>{m&&(C||(x.publish("outdoor-view-loaded"),C=!0),w||(x.publish("outdoor-style-loaded"),w=!0))});let I=s(M=>{M&&(M.sourceDataType==="metadata"||M.sourceDataType==="visibility"||M.dataType==="style"||M.type==="terrain")&&x.getSystems().htmlControlsSystem.updateData(m)},"updateData");return m.on("styledata",M=>{m&&M&&M.dataType==="style"&&M.type==="styledata"&&(w=!1),I(M)}),m.on("sourcedata",I),m.on("terrain",I),m.on("error",M=>{H.warn(M)}),x}else return new sf(r,t)}s(sb,"createRenderer");d();d();var to=class to{id;text;__type=to.__type;static is(t){return t.__type===to.__type}constructor(t,e){this.id=t,this.text=e}};s(to,"Label"),v(to,"__type","Label");var ri=to;d();var eo=class eo{id;__type=eo.__type;contentEl;update;static is(t){return t.__type===eo.__type}constructor(t,e,i){this.id=t,this.contentEl=e,this.update=i}};s(eo,"Marker"),v(eo,"__type","Marker");var Ui=eo;d();var uf=class uf{id;__type;constructor(t){this.id=t,this.__type="Path"}};s(uf,"Path");var Ua=uf;d();var ii,cf=class cf{constructor(t){T(this,ii,void 0);E(this,ii,t)}get center(){return c(this,ii).center}get bearing(){return c(this,ii).bearing}get pitch(){return c(this,ii).pitch}get zoomLevel(){return c(this,ii).zoomLevel}};ii=new WeakMap,s(cf,"CameraTransform");var Za=cf;d();d();d();var rM=new Map([["search-16x16",`<svg viewBox="0 0 16 16">
488
513
  <path
489
514
  fillRule="evenodd"
490
515
  clipRule="evenodd"
@@ -678,8 +703,8 @@ void main() {
678
703
  d="M9.10678 11.2433C9.07993 11.2167 9.04367 11.2018 9.00589 11.2018C8.9681 11.2018 8.93184 11.2167 8.90499 11.2433L6.82999 13.3183C5.86928 14.279 4.24785 14.3808 3.18714 13.3183C2.12464 12.2558 2.22642 10.6362 3.18714 9.67546L5.26214 7.60046C5.31749 7.5451 5.31749 7.45403 5.26214 7.39868L4.55142 6.68796C4.52457 6.66138 4.48832 6.64646 4.45053 6.64646C4.41274 6.64646 4.37649 6.66138 4.34964 6.68796L2.27464 8.76296C0.763923 10.2737 0.763923 12.7183 2.27464 14.2272C3.78535 15.7362 6.22999 15.738 7.73892 14.2272L9.81392 12.1522C9.86928 12.0969 9.86928 12.0058 9.81392 11.9505L9.10678 11.2433ZM13.7246 2.77903C12.2139 1.26832 9.76928 1.26832 8.26035 2.77903L6.18357 4.85403C6.15698 4.88088 6.14207 4.91714 6.14207 4.95493C6.14207 4.99271 6.15698 5.02897 6.18357 5.05582L6.89249 5.76475C6.94785 5.8201 7.03892 5.8201 7.09428 5.76475L9.16928 3.68975C10.13 2.72903 11.7514 2.62725 12.8121 3.68975C13.8746 4.75225 13.7729 6.37189 12.8121 7.3326L10.7371 9.4076C10.7106 9.43445 10.6956 9.47071 10.6956 9.5085C10.6956 9.54628 10.7106 9.58254 10.7371 9.60939L11.4479 10.3201C11.5032 10.3755 11.5943 10.3755 11.6496 10.3201L13.7246 8.2451C15.2336 6.73439 15.2336 4.28975 13.7246 2.77903ZM9.75142 6.00939C9.72457 5.9828 9.68832 5.96789 9.65053 5.96789C9.61275 5.96789 9.57649 5.9828 9.54964 6.00939L5.50499 10.0522C5.47841 10.0791 5.46349 10.1154 5.46349 10.1531C5.46349 10.1909 5.47841 10.2272 5.50499 10.254L6.21214 10.9612C6.26749 11.0165 6.35857 11.0165 6.41392 10.9612L10.4568 6.91832C10.5121 6.86296 10.5121 6.77189 10.4568 6.71653L9.75142 6.00939Z"
679
704
  stroke="none"
680
705
  />
681
- </svg>`]]),VP=/<svg([^>]*)>/g;function jb(e,t,r){let i=GP.get(e);return i?i.replace(VP,`<svg$1 style="fill:${t}; width:${r}px; height:${r}px">`):""}s(jb,"getStyledIcon");var HP=s(e=>`
682
- <div class="pin-shadow" style="background: ${e}"></div>
706
+ </svg>`]]),iM=/<svg([^>]*)>/g;function lb(r,t,e){let i=rM.get(r);return i?i.replace(iM,`<svg$1 style="fill:${t}; width:${e}px; height:${e}px">`):""}s(lb,"getStyledIcon");var nM=s(r=>`
707
+ <div class="pin-shadow" style="background: ${r}"></div>
683
708
  <svg width="${20*.9}px" height="${48*.9}px" viewBox="0 0 20 48">
684
709
  <path
685
710
  d="M1.37965 29.3246C1.5778 31.2167 2.27661 33.0694 3.83078 33.775C4.0998 37.1861 4.7451 40.2227 5.65918 42.4784C6.14556 43.6787 6.72883 44.71 7.41453 45.4578C8.10027 46.2056 8.97065 46.7527 9.99989 46.7527C11.0292 46.7527 11.8995 46.2055 12.585 45.4576C13.2706 44.7098 13.8536 43.6785 14.3398 42.4783C15.2536 40.2226 15.8988 37.186 16.1688 33.7752C17.7232 33.0697 18.422 31.2169 18.6201 29.3247C18.8386 27.2385 18.5165 24.6502 17.6475 22.0285L17.6473 22.0278C16.9657 19.9761 16.0319 18.1622 14.9848 16.7474C17.0884 15.1587 18.4471 12.5964 18.4471 9.7152C18.4471 4.93539 14.6967 1 9.99966 1C5.30272 1 1.54993 4.93527 1.54993 9.7152C1.54993 12.5961 2.90839 15.1583 5.01167 16.747C3.9635 18.1625 3.03185 19.977 2.3522 22.0286C1.48319 24.6503 1.16118 27.2385 1.37965 29.3246Z"
@@ -688,8 +713,8 @@ void main() {
688
713
  strokeWidth="2"
689
714
  />
690
715
  </svg>
691
- `,"getDeparturePin"),XP=s(e=>`
692
- <div class="pin-shadow" style="background: ${e}"></div>
716
+ `,"getDeparturePin"),oM=s(r=>`
717
+ <div class="pin-shadow" style="background: ${r}"></div>
693
718
  <svg width="36" height="42" viewBox="-2 -2 40 46">
694
719
  <path
695
720
  d="M35.8372 5.86776C35.6765 7.92448 34.2625 10.158 32.0612 11.8292C30.0929 13.3235 25.8269 15.6292 19.3114 14.3438C13.6237 13.219 9.78333 15.5569 7.88708 21.2934L13.4303 39.7879C13.6151 40.4267 13.2536 41.0955 12.6189 41.2903C12.5064 41.3225 12.39 41.3385 12.2735 41.3385C11.7412 41.3385 11.2712 40.989 11.1166 40.4789L5.54093 21.88C5.47265 21.7474 5.43047 21.6028 5.41239 21.4542L1.07409 6.97696C0.975678 6.80825 0.921449 6.61744 0.913417 6.42263L0.053779 3.56251C-0.0406172 3.2552 -0.0104927 2.92379 0.142154 2.64058C0.29279 2.35738 0.549874 2.14649 0.857157 2.05411C1.16646 1.96172 1.49786 1.99587 1.77906 2.15052C2.06025 2.30317 2.26912 2.56226 2.35951 2.87155L2.51215 3.39375C3.55453 2.22081 4.87615 1.32902 6.35237 0.798742C10.1685 -0.631292 15.2377 -0.117113 19.5763 2.14846C22.2435 3.53834 29.0241 6.57524 34.2141 4.63904C34.5998 4.49845 35.0316 4.56272 35.361 4.81178C35.6884 5.06083 35.8673 5.45801 35.8372 5.86776Z"
@@ -702,15 +727,15 @@ void main() {
702
727
  fill={color}
703
728
  />
704
729
  </svg>
705
- `,"getDestinationPin"),td="#722ED1",ed="#1890FF",rd=s(({type:e="departure",destinationColor:t=td,departureColor:r=ed})=>`<div class="dropped-pin-wrapper">
706
- ${e==="departure"?HP(r):XP(t)}
707
- </div>`,"DroppedPin"),YP=s(e=>{switch(e){case"default":return 28;case"selection":return 28;case"navigation":return 32}},"getSize"),Wb=s(({type:e="stairs",color:t="#722ED1",direction:r="up"})=>{let i=YP("default"),n=i/2+2;return`<div style="position: relative; width: 56px;" class="mappedin-connection-marker">
708
- ${r!=null?`<div style="position: absolute; top: 0px; left:${i*.9}px; zIndex: -1">
730
+ `,"getDestinationPin"),pf="#722ED1",hf="#1890FF",df=s(({type:r="departure",destinationColor:t=pf,departureColor:e=hf})=>`<div class="dropped-pin-wrapper">
731
+ ${r==="departure"?nM(e):oM(t)}
732
+ </div>`,"DroppedPin"),aM=s(r=>{switch(r){case"default":return 28;case"selection":return 28;case"navigation":return 32}},"getSize"),ub=s(({type:r="stairs",color:t="#722ED1",direction:e="up"})=>{let i=aM("default"),n=i/2+2;return`<div style="position: relative; width: 56px;" class="mappedin-connection-marker">
733
+ ${e!=null?`<div style="position: absolute; top: 0px; left:${i*.9}px; zIndex: -1">
709
734
  <div class="bouncey">
710
735
  <div class="connection-circle"
711
736
  role="button"
712
737
  style="background: #595959; width: ${i}px; height: ${i}px;">
713
- <div class="${r==="up"?"":"arrow--down"}">
738
+ <div class="${e==="up"?"":"arrow--down"}">
714
739
  <svg viewBox="0 0 16 16" style="fill: white; width: ${n}px; height: ${n}px">
715
740
  <path
716
741
  fillRule="evenodd"
@@ -727,9 +752,9 @@ void main() {
727
752
  role="button"
728
753
  style="background:${t}; width:${i}px; height:${i}px;"
729
754
  >
730
- ${jb("connection-"+e+"-16x16","white",n)||""}
755
+ ${lb("connection-"+r+"-16x16","white",n)||""}
731
756
  </div>
732
- </div>`},"ConnectionMarker");f();var id=s(async e=>new Promise(t=>setTimeout(t,e)),"ms");var Mc={createMarkers:{departure:!0,destination:!0,connection:!0},pathOptions:{color:"#40A9FF",nearRadius:.25,farRadius:.25*4,displayArrowsOnPath:!1},polygons:{departure:"#40A9FF"}},gr,vr,Gi,Yt,Jr,Tc,Ub,Ha,nd=class nd{constructor(t){w(this,Tc);w(this,gr,void 0);w(this,vr,new Map);w(this,Gi,void 0);w(this,Yt,void 0);w(this,Jr,Mc);v(this,"draw",async(t,r={})=>{var l,c,h;if(t.coordinates.length<2){X.warn("Directions must have at least 2 coordinates");return}u(this,gr)&&this.clear();let i={pathOptions:{...Mc.pathOptions,...r.pathOptions},createMarkers:{...Mc.createMarkers,...r.createMarkers},polygons:{...Mc.polygons,...r.polygons}};E(this,Jr,i),E(this,gr,t);let n=t.coordinates[0],o=t.coordinates[t.coordinates.length-1],a=u(this,Yt).getMapData()[Object.keys(u(this,Yt).getMapData())[0]];if(n.floorId&&u(this,Yt).setFloor(a.getById("floor",n.floorId)),(l=u(this,Jr).createMarkers)!=null&&l.departure){let d=u(this,Yt).Markers.add(n,rd({type:"departure"}),{anchor:"top",rank:"always-visible"});u(this,vr).set(d,void 0)}if(await id(500),!!u(this,gr)&&(E(this,Gi,u(this,Yt).Paths.add(t.coordinates,u(this,Jr).pathOptions)),await id(1e3),!!u(this,gr))){if((c=u(this,Jr).createMarkers)!=null&&c.destination){let d=u(this,Yt).Markers.add(o,rd({type:"destination"}),{anchor:"top",rank:"always-visible"});u(this,vr).set(d,void 0)}(h=u(this,Jr).createMarkers)!=null&&h.connection&&(t.instructions.filter(m=>j(this,Tc,Ub).call(this,m.action)).forEach(m=>{let y=u(this,Yt).Markers.add(m.coordinate,Wb({type:m.action.connectionType,color:m.action.type==="ExitConnection"?ed:td,direction:m.action.direction}),{interactive:!0,anchor:"top",rank:"always-visible"});u(this,vr).set(y,m)}),u(this,Yt).on("click",u(this,Ha)))}});w(this,Ha,s(t=>{if(t.markers.length>0){let r=u(this,vr).get(t.markers[0]);r!=null&&r.action.toFloor&&u(this,Yt).setFloor(r.action.toFloor)}},"#handleClick"));v(this,"clear",()=>{u(this,gr)&&(u(this,vr).forEach((t,r)=>{u(this,Yt).Markers.remove(r)}),u(this,vr).clear(),u(this,Gi)&&(u(this,Yt).Paths.remove(u(this,Gi)),E(this,Gi,void 0)),u(this,Yt).off("click",u(this,Ha)),E(this,gr,void 0))});E(this,Yt,t)}};gr=new WeakMap,vr=new WeakMap,Gi=new WeakMap,Yt=new WeakMap,Jr=new WeakMap,Tc=new WeakSet,Ub=s(function(t){return t!=null&&["TakeConnection","ExitConnection"].includes(t.type)},"#isVortexAction"),Ha=new WeakMap,s(nd,"Navigation");var wc=nd;f();f();f();var jP=new Map([["search-16x16",`<svg viewBox="0 0 16 16">
757
+ </div>`},"ConnectionMarker");d();var cb=s(async r=>new Promise(t=>setTimeout(t,r)),"ms");var Ou={createMarkers:{departure:!0,destination:!0,connection:!0},pathOptions:{color:"#40A9FF",nearRadius:.25,farRadius:.25*4,displayArrowsOnPath:!1},polygons:{departure:"#40A9FF"}},Sr,Pr,Zi,Xt,ni,Au,pb,za,ff=class ff{constructor(t){T(this,Au);T(this,Sr,void 0);T(this,Pr,new Map);T(this,Zi,void 0);T(this,Xt,void 0);T(this,ni,Ou);v(this,"draw",async(t,e={})=>{var l,u,h;if(t.coordinates.length<2){H.warn("Directions must have at least 2 coordinates");return}c(this,Sr)&&this.clear();let i={pathOptions:{...Ou.pathOptions,...e.pathOptions},createMarkers:{...Ou.createMarkers,...e.createMarkers},polygons:{...Ou.polygons,...e.polygons}};E(this,ni,i),E(this,Sr,t);let n=t.coordinates[0],o=t.coordinates[t.coordinates.length-1],a=c(this,Xt).getMapData()[Object.keys(c(this,Xt).getMapData())[0]];if(n.floorId&&c(this,Xt).setFloor(a.getById("floor",n.floorId)),(l=c(this,ni).createMarkers)!=null&&l.departure){let f=c(this,Xt).Markers.add(n,df({type:"departure"}),{anchor:"top",rank:"always-visible"});c(this,Pr).set(f,void 0)}if(await cb(500),!!c(this,Sr)&&(E(this,Zi,await c(this,Xt).Paths.add(t.coordinates,c(this,ni).pathOptions)),!!c(this,Sr))){if((u=c(this,ni).createMarkers)!=null&&u.destination){let f=c(this,Xt).Markers.add(o,df({type:"destination"}),{anchor:"top",rank:"always-visible"});c(this,Pr).set(f,void 0)}(h=c(this,ni).createMarkers)!=null&&h.connection&&(t.instructions.filter(m=>j(this,Au,pb).call(this,m.action)).forEach(m=>{let y=c(this,Xt).Markers.add(m.coordinate,ub({type:m.action.connectionType,color:m.action.type==="ExitConnection"?hf:pf,direction:m.action.direction}),{interactive:!0,anchor:"top",rank:"always-visible"});c(this,Pr).set(y,m)}),c(this,Xt).on("click",c(this,za)))}});T(this,za,s(t=>{if(t.markers.length>0){let e=c(this,Pr).get(t.markers[0]);e!=null&&e.action.toFloor&&c(this,Xt).setFloor(e.action.toFloor)}},"#handleClick"));v(this,"clear",()=>{c(this,Sr)&&(c(this,Pr).forEach((t,e)=>{c(this,Xt).Markers.remove(e)}),c(this,Pr).clear(),c(this,Zi)&&(c(this,Xt).Paths.remove(c(this,Zi)),E(this,Zi,void 0)),c(this,Xt).off("click",c(this,za)),E(this,Sr,void 0))});E(this,Xt,t)}};Sr=new WeakMap,Pr=new WeakMap,Zi=new WeakMap,Xt=new WeakMap,ni=new WeakMap,Au=new WeakSet,pb=s(function(t){return t!=null&&["TakeConnection","ExitConnection"].includes(t.type)},"#isVortexAction"),za=new WeakMap,s(ff,"Navigation");var Du=ff;d();d();d();var sM=new Map([["search-16x16",`<svg viewBox="0 0 16 16">
733
758
  <path
734
759
  fillRule="evenodd"
735
760
  clipRule="evenodd"
@@ -922,4 +947,4 @@ void main() {
922
947
  d="M9.10678 11.2433C9.07993 11.2167 9.04367 11.2018 9.00589 11.2018C8.9681 11.2018 8.93184 11.2167 8.90499 11.2433L6.82999 13.3183C5.86928 14.279 4.24785 14.3808 3.18714 13.3183C2.12464 12.2558 2.22642 10.6362 3.18714 9.67546L5.26214 7.60046C5.31749 7.5451 5.31749 7.45403 5.26214 7.39868L4.55142 6.68796C4.52457 6.66138 4.48832 6.64646 4.45053 6.64646C4.41274 6.64646 4.37649 6.66138 4.34964 6.68796L2.27464 8.76296C0.763923 10.2737 0.763923 12.7183 2.27464 14.2272C3.78535 15.7362 6.22999 15.738 7.73892 14.2272L9.81392 12.1522C9.86928 12.0969 9.86928 12.0058 9.81392 11.9505L9.10678 11.2433ZM13.7246 2.77903C12.2139 1.26832 9.76928 1.26832 8.26035 2.77903L6.18357 4.85403C6.15698 4.88088 6.14207 4.91714 6.14207 4.95493C6.14207 4.99271 6.15698 5.02897 6.18357 5.05582L6.89249 5.76475C6.94785 5.8201 7.03892 5.8201 7.09428 5.76475L9.16928 3.68975C10.13 2.72903 11.7514 2.62725 12.8121 3.68975C13.8746 4.75225 13.7729 6.37189 12.8121 7.3326L10.7371 9.4076C10.7106 9.43445 10.6956 9.47071 10.6956 9.5085C10.6956 9.54628 10.7106 9.58254 10.7371 9.60939L11.4479 10.3201C11.5032 10.3755 11.5943 10.3755 11.6496 10.3201L13.7246 8.2451C15.2336 6.73439 15.2336 4.28975 13.7246 2.77903ZM9.75142 6.00939C9.72457 5.9828 9.68832 5.96789 9.65053 5.96789C9.61275 5.96789 9.57649 5.9828 9.54964 6.00939L5.50499 10.0522C5.47841 10.0791 5.46349 10.1154 5.46349 10.1531C5.46349 10.1909 5.47841 10.2272 5.50499 10.254L6.21214 10.9612C6.26749 11.0165 6.35857 11.0165 6.41392 10.9612L10.4568 6.91832C10.5121 6.86296 10.5121 6.77189 10.4568 6.71653L9.75142 6.00939Z"
923
948
  stroke="none"
924
949
  />
925
- </svg>`]]),WP=/<svg([^>]*)>/g;function zb(e,t,r){let i=jP.get(e);return i?i.replace(WP,`<svg$1 xmlns="http://www.w3.org/2000/svg" style="fill:${t}; width:${r}px; height:${r}px">`):""}s(zb,"getStyledIcon");var Vi,zn,Xa,od,Ec,Zb,_c,qb,Ya,ad,Lc,$b,sd=class sd{constructor(t,r){w(this,Xa);w(this,Ec);w(this,_c);w(this,Ya);w(this,Lc);w(this,Vi,void 0);w(this,zn,void 0);v(this,"colors",{default:"#3D5676",connection:"#128387",washroom:"#3161B4",point:"#AD468F"});E(this,Vi,t),E(this,zn,r)}auto(){let t=u(this,zn)[Object.keys(u(this,zn))[0]];[...t.getByType("connection"),...t.getByType("point-of-interest"),...t.getByType("space")].forEach(r=>{r.__type==="connection"?r.coordinates.forEach(i=>{u(this,Vi).Labels.add(i,r.name,j(this,Xa,od).call(this,r))}):(r.__type==="space"&&r.name!==""&&u(this,Vi).updateState(r,{interactive:!0,hoverColor:"#F0F0F0"}),u(this,Vi).Labels.add(r,r.name,j(this,Xa,od).call(this,r)))})}};Vi=new WeakMap,zn=new WeakMap,Xa=new WeakSet,od=s(function(t){let r=zb(j(this,Ec,Zb).call(this,t),"white",12);return{appearance:{text:{foregroundColor:j(this,Ya,ad).call(this,t)},marker:{foregroundColor:{active:j(this,Ya,ad).call(this,t)},icon:r,iconSize:12}},interactive:!0,rank:j(this,Lc,$b).call(this,t)}},"#generatLabelAppearance"),Ec=new WeakSet,Zb=s(function(t){return t.__type==="connection"?j(this,_c,qb).call(this,t.type):t.name.includes("Washroom")?"washroom-14x14":t.__type==="point-of-interest"?"point-of-interest-12x12":""},"#getIconName"),_c=new WeakSet,qb=s(function(t){let r="";switch(t){case"elevator":r="connection-elevator-12x12";break;case"escalator":r="connection-escalator-12x12";break;case"stairs":r="connection-stairs-12x12";break}return r},"#attemptIconNameForConnection"),Ya=new WeakSet,ad=s(function(t){return t.__type==="connection"?this.colors.connection:t.__type==="point-of-interest"?this.colors.point:"name"in t&&t.name.includes("Washroom")?this.colors.washroom:this.colors.default},"#getLabelColor"),Lc=new WeakSet,$b=s(function(t){return t.__type==="connection"?"high":(t.__type==="point-of-interest","medium")},"#getDefaultLabelRank"),s(sd,"Labels");var Ic=sd;var ld=class ld{Labels;constructor(t,r){this.Labels=new Ic(t,r)}auto=()=>{this.Labels.auto()}};s(ld,"DefaultTheme");var Oc=ld;f();var Pt,cd=class cd{constructor(t){w(this,Pt,void 0);v(this,"setMinZoomLevel",t=>{u(this,Pt).camera.setMinZoomLevel(t)});v(this,"setMaxZoomLevel",t=>{u(this,Pt).camera.setMaxZoomLevel(t)});E(this,Pt,t)}setScreenOffsets(t){u(this,Pt).camera.setInsetPadding(t)}focusOn(t,r){var o;let i=[],n=Array.isArray(t)?t:[t];for(let a of n)if(Br.is(a)){let l;for(l of a.coordinates)i.push([l.longitude,l.latitude])}else{let l=kr(a);if(l){let c=0;l.floorId&&(c=((o=u(this,Pt).getState(l.floorId))==null?void 0:o.altitude)||0),i.push([l.longitude,l.latitude,c])}}return u(this,Pt).camera.focusOn(i,{pitch:r==null?void 0:r.pitch,bearing:r==null?void 0:r.bearing,padding:r==null?void 0:r.screenOffsets,maxZoomLevel:r==null?void 0:r.maxZoomLevel,minZoomLevel:r==null?void 0:r.minZoomLevel,duration:r==null?void 0:r.duration,updateZoomLimits:!1,easing:r==null?void 0:r.easing})}animateTo(t,r){var h;let{center:i,zoomLevel:n,bearing:o,pitch:a}=t,l=i!=null?i:this.center,c=[l.longitude,l.latitude];return u(this,Pt).camera.animateTo({center:c,zoomLevel:n!=null?n:this.zoomLevel,bearing:o!=null?o:this.bearing,pitch:a!=null?a:this.pitch,duration:(h=r==null?void 0:r.duration)!=null?h:600,easing:r==null?void 0:r.easing})}set(t){let{center:r=this.center,zoomLevel:i=this.zoomLevel,bearing:n=this.bearing,pitch:o=this.pitch}=t,a=[r.longitude,r.latitude];u(this,Pt).camera.setCenter(a),u(this,Pt).camera.setZoomLevel(i),u(this,Pt).camera.setBearing(n),u(this,Pt).camera.setPitch(o)}get center(){let t=u(this,Pt).camera.center;return new $(t[1],t[0],void 0)}get zoomLevel(){return u(this,Pt).camera.zoomLevel}get pitch(){return u(this,Pt).camera.pitch}get bearing(){let t=u(this,Pt).camera.bearing;return(t<0?t+360:t)%360}get minZoomLevel(){return u(this,Pt).camera.minZoomLevel}get maxZoomLevel(){return u(this,Pt).camera.maxZoomLevel}};Pt=new WeakMap,s(cd,"Camera");var ja=cd;f();f();f();f();f();f();f();f();function ud(e){let t=+this._x.call(null,e),r=+this._y.call(null,e);return Jb(this.cover(t,r),t,r,e)}s(ud,"default");function Jb(e,t,r,i){if(isNaN(t)||isNaN(r))return e;var n,o=e._root,a={data:i},l=e._x0,c=e._y0,h=e._x1,d=e._y1,m,y,x,S,P,g,C,T;if(!o)return e._root=a,e;for(;o.length;)if((P=t>=(m=(l+h)/2))?l=m:h=m,(g=r>=(y=(c+d)/2))?c=y:d=y,n=o,!(o=o[C=g<<1|P]))return n[C]=a,e;if(x=+e._x.call(null,o.data),S=+e._y.call(null,o.data),t===x&&r===S)return a.next=o,n?n[C]=a:e._root=a,e;do n=n?n[C]=new Array(4):e._root=new Array(4),(P=t>=(m=(l+h)/2))?l=m:h=m,(g=r>=(y=(c+d)/2))?c=y:d=y;while((C=g<<1|P)===(T=(S>=y)<<1|x>=m));return n[T]=o,n[C]=a,e}s(Jb,"add");function Kb(e){var t,r,i=e.length,n,o,a=new Array(i),l=new Array(i),c=1/0,h=1/0,d=-1/0,m=-1/0;for(r=0;r<i;++r)isNaN(n=+this._x.call(null,t=e[r]))||isNaN(o=+this._y.call(null,t))||(a[r]=n,l[r]=o,n<c&&(c=n),n>d&&(d=n),o<h&&(h=o),o>m&&(m=o));if(c>d||h>m)return this;for(this.cover(c,h).cover(d,m),r=0;r<i;++r)Jb(this,a[r],l[r],e[r]);return this}s(Kb,"addAll");f();function pd(e,t){if(isNaN(e=+e)||isNaN(t=+t))return this;var r=this._x0,i=this._y0,n=this._x1,o=this._y1;if(isNaN(r))n=(r=Math.floor(e))+1,o=(i=Math.floor(t))+1;else{for(var a=n-r||1,l=this._root,c,h;r>e||e>=n||i>t||t>=o;)switch(h=(t<i)<<1|e<r,c=new Array(4),c[h]=l,l=c,a*=2,h){case 0:n=r+a,o=i+a;break;case 1:r=n-a,o=i+a;break;case 2:n=r+a,i=o-a;break;case 3:r=n-a,i=o-a;break}this._root&&this._root.length&&(this._root=l)}return this._x0=r,this._y0=i,this._x1=n,this._y1=o,this}s(pd,"default");f();function hd(){var e=[];return this.visit(function(t){if(!t.length)do e.push(t.data);while(t=t.next)}),e}s(hd,"default");f();function fd(e){return arguments.length?this.cover(+e[0][0],+e[0][1]).cover(+e[1][0],+e[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}s(fd,"default");f();f();function Lt(e,t,r,i,n){this.node=e,this.x0=t,this.y0=r,this.x1=i,this.y1=n}s(Lt,"default");function dd(e,t,r){var i,n=this._x0,o=this._y0,a,l,c,h,d=this._x1,m=this._y1,y=[],x=this._root,S,P;for(x&&y.push(new Lt(x,n,o,d,m)),r==null?r=1/0:(n=e-r,o=t-r,d=e+r,m=t+r,r*=r);S=y.pop();)if(!(!(x=S.node)||(a=S.x0)>d||(l=S.y0)>m||(c=S.x1)<n||(h=S.y1)<o))if(x.length){var g=(a+c)/2,C=(l+h)/2;y.push(new Lt(x[3],g,C,c,h),new Lt(x[2],a,C,g,h),new Lt(x[1],g,l,c,C),new Lt(x[0],a,l,g,C)),(P=(t>=C)<<1|e>=g)&&(S=y[y.length-1],y[y.length-1]=y[y.length-1-P],y[y.length-1-P]=S)}else{var T=e-+this._x.call(null,x.data),M=t-+this._y.call(null,x.data),I=T*T+M*M;if(I<r){var _=Math.sqrt(r=I);n=e-_,o=t-_,d=e+_,m=t+_,i=x.data}}return i}s(dd,"default");f();function md(e){if(isNaN(d=+this._x.call(null,e))||isNaN(m=+this._y.call(null,e)))return this;var t,r=this._root,i,n,o,a=this._x0,l=this._y0,c=this._x1,h=this._y1,d,m,y,x,S,P,g,C;if(!r)return this;if(r.length)for(;;){if((S=d>=(y=(a+c)/2))?a=y:c=y,(P=m>=(x=(l+h)/2))?l=x:h=x,t=r,!(r=r[g=P<<1|S]))return this;if(!r.length)break;(t[g+1&3]||t[g+2&3]||t[g+3&3])&&(i=t,C=g)}for(;r.data!==e;)if(n=r,!(r=r.next))return this;return(o=r.next)&&delete r.next,n?(o?n.next=o:delete n.next,this):t?(o?t[g]=o:delete t[g],(r=t[0]||t[1]||t[2]||t[3])&&r===(t[3]||t[2]||t[1]||t[0])&&!r.length&&(i?i[C]=r:this._root=r),this):(this._root=o,this)}s(md,"default");function Qb(e){for(var t=0,r=e.length;t<r;++t)this.remove(e[t]);return this}s(Qb,"removeAll");f();function yd(){return this._root}s(yd,"default");f();function gd(){var e=0;return this.visit(function(t){if(!t.length)do++e;while(t=t.next)}),e}s(gd,"default");f();function vd(e){var t=[],r,i=this._root,n,o,a,l,c;for(i&&t.push(new Lt(i,this._x0,this._y0,this._x1,this._y1));r=t.pop();)if(!e(i=r.node,o=r.x0,a=r.y0,l=r.x1,c=r.y1)&&i.length){var h=(o+l)/2,d=(a+c)/2;(n=i[3])&&t.push(new Lt(n,h,d,l,c)),(n=i[2])&&t.push(new Lt(n,o,d,h,c)),(n=i[1])&&t.push(new Lt(n,h,a,l,d)),(n=i[0])&&t.push(new Lt(n,o,a,h,d))}return this}s(vd,"default");f();function bd(e){var t=[],r=[],i;for(this._root&&t.push(new Lt(this._root,this._x0,this._y0,this._x1,this._y1));i=t.pop();){var n=i.node;if(n.length){var o,a=i.x0,l=i.y0,c=i.x1,h=i.y1,d=(a+c)/2,m=(l+h)/2;(o=n[0])&&t.push(new Lt(o,a,l,d,m)),(o=n[1])&&t.push(new Lt(o,d,l,c,m)),(o=n[2])&&t.push(new Lt(o,a,m,d,h)),(o=n[3])&&t.push(new Lt(o,d,m,c,h))}r.push(i)}for(;i=r.pop();)e(i.node,i.x0,i.y0,i.x1,i.y1);return this}s(bd,"default");f();function t3(e){return e[0]}s(t3,"defaultX");function Cd(e){return arguments.length?(this._x=e,this):this._x}s(Cd,"default");f();function e3(e){return e[1]}s(e3,"defaultY");function xd(e){return arguments.length?(this._y=e,this):this._y}s(xd,"default");function Wa(e,t,r){var i=new Sd(t==null?t3:t,r==null?e3:r,NaN,NaN,NaN,NaN);return e==null?i:i.addAll(e)}s(Wa,"quadtree");function Sd(e,t,r,i,n,o){this._x=e,this._y=t,this._x0=r,this._y0=i,this._x1=n,this._y1=o,this._root=void 0}s(Sd,"Quadtree");function r3(e){for(var t={data:e.data},r=t;e=e.next;)r=r.next={data:e.data};return t}s(r3,"leaf_copy");var Kt=Wa.prototype=Sd.prototype;Kt.copy=function(){var e=new Sd(this._x,this._y,this._x0,this._y0,this._x1,this._y1),t=this._root,r,i;if(!t)return e;if(!t.length)return e._root=r3(t),e;for(r=[{source:t,target:e._root=new Array(4)}];t=r.pop();)for(var n=0;n<4;++n)(i=t.source[n])&&(i.length?r.push({source:i,target:t.target[n]=new Array(4)}):t.target[n]=r3(i));return e};Kt.add=ud;Kt.addAll=Kb;Kt.cover=pd;Kt.data=hd;Kt.extent=fd;Kt.find=dd;Kt.remove=md;Kt.removeAll=Qb;Kt.root=yd;Kt.size=gd;Kt.visit=vd;Kt.visitAfter=bd;Kt.x=Cd;Kt.y=xd;f();f();var Pd=class Pd{origin;destination;distance;angle;weight;constructor({origin:t,destination:r,distance:i=0,angle:n=0,pathWeight:o=0}){this.origin=t,this.destination=r,this.distance=i,this.angle=n;let a=o||0;if(this.weight=a>=0?this.distance+a:0,isNaN(this.angle))throw new Error("nan angle")}};s(Pd,"Edge");var Hi=Pd;f();f();f();f();function Zn([e,t],[r,i]){let n=t-i,o=e-r;return(Math.atan2(o,n)+Math.PI*3)%(Math.PI*2)}s(Zn,"getAngle");f();var UP=63710088e-1;function Xi(e,t){let[r,i]=e.map(d=>d*Math.PI/180),[n,o]=t.map(d=>d*Math.PI/180),a=o-i,l=n-r,c=Math.sin(a/2)*Math.sin(a/2)+Math.cos(i)*Math.cos(o)*Math.sin(l/2)*Math.sin(l/2),h=2*Math.atan2(Math.sqrt(c),Math.sqrt(1-c));return UP*h}s(Xi,"getDistance");f();f();function Dc(e,t,r,i){let[n,o]=e,[a,l]=t,[c,h]=r,[d,m]=i;if(o===l&&n===a||h===m&&c===d)return null;let y=(d-c)*(l-o)-(m-h)*(a-n);if(y===0)return null;let x=((m-h)*(n-c)-(d-c)*(o-h))/y,S=((l-o)*(n-c)-(a-n)*(o-h))/y;if(x<0||x>1||S<0||S>1)return null;let P=o+x*(l-o);return[n+x*(a-n),P]}s(Dc,"getLineIntersection");f();function Md(e,t,r){if(e[1]===t[1])return[[e[0],e[1]+r],[t[0],t[1]+r]];if(e[0]===t[0])return[[e[0]+r,e[1]],[t[0]+r,t[1]]];let n=-1/((t[1]-e[1])/(t[0]-e[0])),o=r*Math.sqrt(1/(1+n*n)),a=n*o;return[[e[0]+a,e[1]+o],[t[0]+a,t[1]+o]]}s(Md,"getOffsetLine");function i3(e,t,r=[],i=0){let n=!0;return r.forEach(o=>{let a=e.geometry.coordinates,l=t.geometry.coordinates;if(i>0){let c=Md(a,l,-i),h=Md(a,l,i);if(Dc(c[0],c[1],o[0],o[1])||Dc(h[0],h[1],o[0],o[1])){n=!1;return}}else if(Dc(a,l,o[0],o[1])){n=!1;return}}),n}s(i3,"hasLineOfSight");f();var zP=63710088e-1;function n3(e,t){let r=1/zP,i=t*Math.PI/180;return e*r*(180/Math.PI)/Math.cos(i)}s(n3,"metersToDegreesLongitude");var wd=class wd{edges;nodesById;nodesByGroup=new Map;constructor({nodes:t,groupBy:r}){this.edges={};let{features:i}=t;this.nodesById=i.reduce((n,o)=>(n[o.properties.id]=o,n),{});for(let n in this.nodesById)this.nodesById.hasOwnProperty(n)&&(this.nodesById[n].properties.neighbors=this.nodesById[n].properties.neighbors.filter(({id:o})=>!!this.nodesById[o]));i.forEach(n=>{let o=r==="default"?r:n.properties[r];this.nodesByGroup.has(o)||this.nodesByGroup.set(o,[]),this.nodesByGroup.get(o).push(n),this.edges[n.properties.id]=n.properties.neighbors.map(({id:a,weight:l})=>{let c=this.nodesById[a];return new Hi({origin:n,destination:c,distance:Xi(n.geometry.coordinates,c.geometry.coordinates),angle:Zn(n.geometry.coordinates,c.geometry.coordinates),pathWeight:l})})})}aStar({originIds:t,destinationNodeIds:r,excludedNodeIds:i}){let n=t.map(h=>this.nodesById[h]).filter(h=>h),o=r.map(h=>this.nodesById[h]).filter(h=>h);if(n.length===0||o.length===0)return[];let a=[],l={},c={};for(n.forEach(h=>{let d=this.getShortestEuclideanDistance(h,o);a.push({origin:h,priority:d}),l[h.properties.id]=null,c[h.properties.id]=0}),a.sort((h,d)=>h.priority-d.priority);a.length>0;){let h=a[0];if(o.includes(h.origin)){let d=[],m=l[h.origin.properties.id];for(;m!=null;){d.push(m);let y=l[m.origin.properties.id];y!=null?m=y:m=null}return d.reverse()}for(let d of this.edges[h.origin.properties.id]){if(i&&i.has(d.destination.properties.id))continue;let m=c[h.origin.properties.id]+d.weight;if(c[d.destination.properties.id]==null||m<c[d.destination.properties.id]){c[d.destination.properties.id]=m;let y=m+this.getShortestEuclideanDistance(d.destination,o);a.push({origin:d.destination,priority:y}),l[d.destination.properties.id]=d}}a.splice(0,1),a.sort((d,m)=>d.priority-m.priority)}return[]}getShortestEuclideanDistance(t,r){return r.reduce((i,n)=>{let o=Xi(t.geometry.coordinates,n.geometry.coordinates);return Math.min(i,o)},Number.MAX_VALUE)}};s(wd,"NavigationGraph");var Ac=wd;var ZP=.75,Td=class Td{groupBy;graph;geometryEdgesByMapId=new Map;cache={nodeTreesByGroup:new Map};constructor({nodes:t,obstructions:r,groupBy:i="default"}){this.groupBy=i,this.graph=new Ac({nodes:t,groupBy:this.groupBy}),r&&r.features.forEach(n=>{let o=n.geometry.coordinates.length===1?n.geometry.coordinates[0]:n.geometry.coordinates,a=this.groupBy==="default"?this.groupBy:n.properties[this.groupBy];this.geometryEdgesByMapId.has(a)||this.geometryEdgesByMapId.set(a,[]),o.forEach((l,c)=>{this.geometryEdgesByMapId.get(a).push([l,o[c+1]||o[0]])})})}findNearestNode=t=>{var n;let r=this.groupBy==="default"?this.groupBy:t.properties[this.groupBy];if(!this.cache.nodeTreesByGroup.has(r)){let o=(n=this.graph.nodesByGroup.get(r))!=null?n:[],a=Wa();a.x(l=>l.geometry.coordinates[1]),a.y(l=>l.geometry.coordinates[0]),a.addAll(o),this.cache.nodeTreesByGroup.set(r,a)}return this.cache.nodeTreesByGroup.get(r).find(t.geometry.coordinates[1],t.geometry.coordinates[0])||null};getDirections({originIds:t,destinationNodeIds:r,excludedNodeIds:i,simplify:n}){var l,c;let o=(l=n==null?void 0:n.enabled)!=null?l:!0,a=this.graph.aStar({originIds:t,destinationNodeIds:r,excludedNodeIds:new Set(i)});if(a.length===0)return{type:"FeatureCollection",features:[]};if(o){let h=n3((c=n==null?void 0:n.bufferRadius)!=null?c:ZP,a[0].origin.geometry.coordinates[1]);a=this.simplifyAllSteps(a,h)}return this.generatePath(a)}generatePath=t=>{let{destination:r}=t[t.length-1],i={type:"FeatureCollection",features:[]};for(let o=0;o<t.length;o++){let{origin:a}=t[o],l={id:a.properties.id,angle:t[o].angle,distance:t[o].distance};this.groupBy!=="default"&&(l.groupBy=a.properties[this.groupBy]),i.features.push({type:"Feature",geometry:{type:"Point",coordinates:[a.geometry.coordinates[0],a.geometry.coordinates[1]]},properties:l})}let n={id:r.properties.id};return this.groupBy!=="default"&&(n.groupBy=r.properties[this.groupBy]),i.features.push({type:"Feature",geometry:{type:"Point",coordinates:[r.geometry.coordinates[0],r.geometry.coordinates[1]]},properties:n}),i};simplifyAllSteps(t,r){var c,h;let i=[],n=[t[0]];for(let d=1;d<t.length;d++){if(this.groupBy!=="default"&&t[d].origin.properties[this.groupBy]!==t[d-1].origin.properties[this.groupBy]){let m=t[d-1].origin.properties[this.groupBy],y=(c=this.geometryEdgesByMapId.get(m))!=null?c:[];i.push(...this.simplifySteps(n,y,r)),n=[t[d]]}n.push(t[d])}let o=t[t.length-1],a=this.groupBy==="default"?this.groupBy:o.origin.properties[this.groupBy],l=(h=this.geometryEdgesByMapId.get(a))!=null?h:[];return i.push(...this.simplifySteps(n,l,r)),i}simplifySteps(t,r,i){if(t.length<3)return t;let n=[t[0]],o=1;for(let a=o+2;a<t.length;a++)if(!i3(t[o].origin,t[a].origin,r,i)){let l=a-1;n.push(new Hi({...t[o],destination:t[l].origin,distance:Xi(t[o].origin.geometry.coordinates,t[l].origin.geometry.coordinates),angle:Zn(t[o].origin.geometry.coordinates,t[l].origin.geometry.coordinates)})),o=l}return n.push(new Hi({...t[o],destination:t[t.length-1].origin,distance:Xi(t[o].origin.geometry.coordinates,t[t.length-1].origin.geometry.coordinates),angle:Zn(t[o].origin.geometry.coordinates,t[t.length-1].origin.geometry.coordinates)}),t[t.length-1]),n}getDistance=(t,r)=>Xi(t,r);getAngle=(t,r)=>Zn(t,r)};s(Td,"Navigator");var Ua=Td;f();function qn(e){return[e.longitude,e.latitude]}s(qn,"convertCoordinateToPosition");function qP(e){return new Map(e.map(t=>{let{properties:r}=t,{id:i}=r;return[i,t]}))}s(qP,"getEntranceMap");var Id=s((e,t)=>{let r=qP(t),i={type:"Feature",properties:{},geometry:{type:"MultiLineString",coordinates:[]}};for(let n of e){let o=[n.geometry.coordinates],a=(n.properties.entrances||[]).reduce((l,c)=>(r.has(c)&&l.push(r.get(c)),l),[]);a.length&&(o=Up(n,a).map(l=>l.geometry.coordinates)),i.geometry.coordinates.push(...o)}return i},"cutEntracesFromLineStrings");function o3(e,t){let r={options:{}};if(!r.options)throw new Error("options should exist");return e.appearance&&(r.options.appearance=e.appearance),e.rank!=null&&(e.rank==="initial"?r.options.rank=t.initialRank||2:r.options.rank=e.rank),e.enabled!==void 0&&(r.enabled=e.enabled),e.interactive!==null&&(r.options.interactive=e.interactive),r}s(o3,"translateLabelStateToGeojsonCore");function a3(e,t){let r={options:{}};if(!r.options)throw new Error("options should exist");return e.rank!=null&&(e.rank==="initial"?r.options.rank=t.initialRank||2:r.options.rank=e.rank),e.enabled!==void 0&&(r.enabled=e.enabled),e.interactive!==null&&(r.options.interactive=e.interactive),r}s(a3,"translateMarkerStateToGeojsonCore");function s3(e,t){let r={};return t==null||(e.color&&(e.color==="initial"?r.color=t.initialColor:r.color=e.color),e.hoverColor&&(r.hoverColor=e.hoverColor),e.interactive!==void 0&&(r.interactive=e.interactive)),r}s(s3,"translateSpaceStateToGeojsonCore");function l3(e,t){return((t-e+Math.PI)%(Math.PI*2)+Math.PI*2)%(Math.PI*2)-Math.PI}s(l3,"differenceBetweenAngles");function c3(e,t){let r="Left";return e<=-Math.PI/4?r="Right":e<=-t?r="SlightRight":e<=t?r="Straight":e<=Math.PI/4?r="SlightLeft":r="Left",r}s(c3,"getRelativeBearing");function u3(e){let t={};for(let r in e){let i=e[r];if(i!=null){if("polygons"in i)for(let n of i.polygons)t[n]=i;else if("lineStrings"in i)for(let n of i.lineStrings)t[n]=i;else if("points"in i)for(let n of i.points)t[n]=i}}return t}s(u3,"extractStyleMap");function Ed(e,t){return e.reduce((r,i)=>{let n=t[i.properties.id];return n==null||(r.has(n)||r.set(n,[]),r.get(n).push(i)),r},new Map)}s(Ed,"groupGeometryByStyle");var p3=Math.PI*.1,Qt,qe,ge,kc,h3,za,_d,Fc,f3,Ld=class Ld{constructor(t,r){w(this,kc);w(this,za);w(this,Fc);w(this,Qt,{});w(this,qe,void 0);w(this,ge,void 0);E(this,qe,r),E(this,ge,t.features),E(this,qe,r),E(this,ge,t.features)}get coordinates(){return u(this,Qt).coordinates?u(this,Qt).coordinates:(u(this,Qt).coordinates=u(this,ge).map(t=>new $(t.geometry.coordinates[1],t.geometry.coordinates[0],t.properties.groupBy)),u(this,Qt).coordinates)}get distance(){return u(this,Qt).distance?u(this,Qt).distance:(u(this,Qt).distance=u(this,ge).reduce((t,r)=>t+(r.properties.distance||0),0),u(this,Qt).distance)}get instructions(){if(u(this,ge).length<2)return[];if(u(this,Qt).instructions)return u(this,Qt).instructions;let t=[],r=0;for(let i=0;i<u(this,ge).length;i++){let n=u(this,ge)[i],o=u(this,ge)[i-1],a=u(this,ge)[i+1],l=new $(n.geometry.coordinates[1],n.geometry.coordinates[0],n.properties.groupBy),c=j(this,kc,h3).call(this,{prevDirection:o,direction:n,nextDirection:a});r+=(o==null?void 0:o.properties.distance)||0;for(let h of c)h&&(t.push({action:h,distance:r,coordinate:l}),r=0)}return u(this,Qt).instructions=t,u(this,Qt).instructions}};Qt=new WeakMap,qe=new WeakMap,ge=new WeakMap,kc=new WeakSet,h3=s(function(t){let{prevDirection:r,direction:i,nextDirection:n}=t,o=r&&u(this,qe).getById("floor",r.properties.groupBy),a=u(this,qe).getById("floor",i.properties.groupBy),l=n&&u(this,qe).getById("floor",n.properties.groupBy),c=[];if(r||c.push({type:"Departure"}),l&&a.id!==l.id){let h=u(this,qe).getMVFFeatureByNodeId("connection",i.properties.id);c.push(j(this,za,_d).call(this,"TakeConnection",a,l,h==null?void 0:h.type))}else if(o&&o.id!==a.id){let h=u(this,qe).getMVFFeatureByNodeId("connection",i.properties.id);c.push(j(this,za,_d).call(this,"ExitConnection",a,o,h==null?void 0:h.type))}else c.push(j(this,Fc,f3).call(this,r,i));return n||c.push({type:"Arrival"}),c},"#getActions"),za=new WeakSet,_d=s(function(t,r,i,n){let o=r.elevation-i.elevation,a="none";return o>0?a="down":o<0&&(a="up"),{type:t,fromFloor:r,toFloor:i,direction:a,connectionType:n!=null?n:"stairs"}},"#createConnectionAction"),Fc=new WeakSet,f3=s(function(t,r){let i=t?-l3(t.properties.angle,r.properties.angle):0;return Math.abs(i)>=p3?{type:"Turn",bearing:c3(i,p3),referencePosition:"At"}:null},"#createTurnAction"),s(Ld,"Directions");var Nc=Ld,Od=class Od{navigator;connections;constructor({nodes:t,obstructions:r,connections:i,groupBy:n}){this.navigator=new Ua({nodes:t,obstructions:this.createObstructionCollection(r),groupBy:n}),this.connections=i}getDirections=(t,r,i,n)=>{let{accessible:o,smoothing:{enabled:a,radius:l}}=i,c=t.flatMap(x=>this.getNodesFromTarget(x,n)),h=r.flatMap(x=>this.getNodesFromTarget(x,n)),d=this.getExcludedNodeIds(o).filter(x=>!c.includes(x)&&!h.includes(x)),m=this.navigator.getDirections({originIds:c,destinationNodeIds:h,excludedNodeIds:d,simplify:{enabled:a,bufferRadius:l}});this.addCoordinateDirections(m,t,r);let y=new Nc(m,n);if(!(y.distance===0&&new Set([...c,...h]).size===c.length+h.length))return y};getExcludedNodeIds=t=>t?this.connections.reduce((r,i)=>i.accessible?r:r.concat(i.nodes),[]):[];addCoordinateDirections=(t,[r],[i])=>{if(t.features.length){if($.is(r)){let n=this.createDirectionFeature(r,this.navigator.getAngle([r.longitude,r.latitude],t.features[0].geometry.coordinates),this.navigator.getDistance([r.longitude,r.latitude],t.features[0].geometry.coordinates));t.features.splice(0,0,n)}if($.is(i)){let n=this.createDirectionFeature(i,0,0),o=t.features[t.features.length-1];o.properties.distance=this.navigator.getDistance(o.geometry.coordinates,[i.longitude,i.latitude]),o.properties.angle=this.navigator.getAngle(o.geometry.coordinates,[i.longitude,i.latitude]),t.features.push(n)}}};getNodesFromTarget=(t,r)=>{if($.is(t)){let i=this.navigator.findNearestNode(this.createCoordinateFeature(t));return i?[i.properties.id]:[]}else if(Fr.is(t)){let i=this.navigator.findNearestNode(this.createCoordinateFeature(t.coordinate));return i?[i.properties.id]:[]}else if(Nr.is(t)){let i=this.navigator.findNearestNode(this.createCoordinateFeature(t.center));return i?[i.properties.id]:[]}else if(Me.is(t)){let i=r==null?void 0:r.getMVFFeatureById("space",t.id);return i==null?[]:i.properties.destinationNodes}else{if(Br.is(t))return t.coordinates.reduce((i,n)=>{let o=this.navigator.findNearestNode(this.createCoordinateFeature(n));return o&&i.push(o.properties.id),i},[]);if(we.is(t)){let i=r==null?void 0:r.objectEntranceNodeIdsByObstructionId[t.id];return i!=null?i:[]}else return[]}};createObstructionCollection(t){return{type:"FeatureCollection",features:Object.entries(t).reduce((r,[i,n])=>r.concat(n.features.map(o=>(o.properties.map=i,o))),[])}}createCoordinateFeature=t=>({type:"Feature",geometry:{type:"Point",coordinates:[t.longitude,t.latitude]},properties:{map:t.floorId}});createDirectionFeature=(t,r,i)=>({type:"Feature",geometry:{type:"Point",coordinates:[t.longitude,t.latitude]},properties:{groupBy:t.floorId,id:t.id,angle:r,distance:i}})};s(Od,"DirectionsInternal");var Rc=Od;f();var $n,Dd=class Dd{constructor({currentMapGetter:t}){w(this,$n,void 0);E(this,$n,t)}get currentMap(){return u(this,$n).call(this)}async getCurrentSceneGLTF(t){let r=u(this,$n).call(this);return r?r==null?void 0:r.Exporter.getCurrentSceneGLTF(t):(X.error("There is no map to export. Please load a map first."),new Blob)}};$n=new WeakMap,s(Dd,"Exporter");var Za=Dd;f();var $e,$a,Ad=class Ad{constructor({currentMapGetter:t}){w(this,$e,new Map);w(this,$a,void 0);E(this,$a,t)}get currentMap(){return u(this,$a).call(this)}getById(t){return u(this,$e).get(t)}add(t,r,i){let n=kr(t);if(!n)throw new Error("get coordinate failed");let o=this.currentMap;if(!o)throw new Error("currentMap should exist");let a=o.Labels.add(qn(n),r,{...i,floorId:n.floorId,rank:(i==null?void 0:i.rank)||"medium"}),l=new qr(a.id.toString(),r);return u(this,$e).set(l.id,{label:l,entityId:l.id}),l}all(){var r;let t=[];return(r=this.currentMap)==null||r.Labels.all({onCreate:(i,n)=>{let o=new qr(i.toString(),n);u(this,$e).set(o.id,{label:o,entityId:o.id}),t.push(o)}}),t}remove(t){var i;let r=u(this,$e).get(t.id);r&&((i=this.currentMap)==null||i.Labels.remove(r.entityId),u(this,$e).delete(t.id.toString()))}removeAll(){let t=[];return u(this,$e).forEach(({label:r})=>{this.remove(r),t.push(r),u(this,$e).delete(r.id.toString())}),t}};$e=new WeakMap,$a=new WeakMap,s(Ad,"Labels");var qa=Ad;f();f();var d3={altitude:0,height:1,color:"#ffffff",opacity:1,width:.15},Nd=class Nd{id;name;elevation;containerId;loaded=!1;styleMap={};obstructions;entrances;spaces;renderer;options;layers=new Map;constructor(t,r,i,n,o,a){this.id=r.id,this.options=n;let l=i.addGroupContainer(this.id,{visible:!1},t);this.containerId=l.id.toString(),this.name=r.externalId,this.elevation=r.elevation,o!=null&&a!=null&&(this.styleMap=a,this.spaces=o.space[this.id],this.entrances=o.entrance[this.id],this.obstructions=o.obstruction[this.id]),this.renderer=i}load=()=>{var t,r;if(this.loaded||this.obstructions==null&&this.spaces==null)return this;if(this.loaded=!0,this.spaces!=null&&this.spaces.features.length>0){let i=this.spaces.features.filter(l=>{var c;return l.geometry.type==="Polygon"&&((c=l.properties.kind)==null?void 0:c.toLowerCase())!=="void"}),n=Ed(i,this.styleMap),o=this.renderer.addGroupContainer(`spaces-${this.id}`,{},this.id),a=0;for(let[l,c]of n)this.renderer.addGeometryGroup(`Spaces-${this.id}-${a}`,{features:c},l,o),a++;this.layers.set("Spaces",o.id.toString())}if(this.obstructions!=null&&this.obstructions.features.length>0){let i=this.obstructions.features.filter(y=>y.geometry.type==="Polygon"&&y.properties.kind==="object"),n=Ed(i,this.styleMap),o=this.renderer.addGroupContainer(`objects-${this.id}`,{},this.id),a=0;for(let[y,x]of n)this.renderer.addGeometryGroup(`Objects-${this.id}-${a}`,{features:x},y,o),a++;this.layers.set("Objects",o.id.toString());let l=this.obstructions.features.filter(y=>y.geometry.type==="LineString"&&y.properties.kind==="Wall"&&y.properties.footprintComponent===!1),c=this.obstructions.features.filter(y=>y.geometry.type==="LineString"&&y.properties.kind==="Wall"&&y.properties.footprintComponent===!0),h=this.entrances,d=d3,m=d3;if(l!=null&&l.length>0){let y=this.styleMap[(t=l[0].properties)==null?void 0:t.id];y!=null&&(d={...y}),m=d,this.options.wallTopColor!=null&&(d.topColor=this.options.wallTopColor);let x=this.renderer.addGeometryGroup(`Walls-${this.id}`,{features:[Id(l,(h==null?void 0:h.features)||[])]},d,this.id);this.layers.set("Walls",x.id.toString())}if(c!=null&&c.length>0){let y=this.styleMap[(r=c[0].properties)==null?void 0:r.id];y!=null&&(m={...y}),this.options.wallTopColor!=null&&(m.topColor=this.options.wallTopColor);let x=this.renderer.addGeometryGroup(`ExteriorWalls-${this.id}`,{features:[Id(c,(h==null?void 0:h.features)||[])]},m,this.id);this.layers.set("ExteriorWalls",x.id.toString())}}return this.renderer.render(),this}};s(Nd,"FloorObject");var Bc=Nd;var Yi=Cr(Gn());f();var Ja=Cr(Gn());var Gc=30,$P=1e3,Jn,Ka,Rd=class Rd extends st{constructor(r,i){super();this.api=r;this.core=i;w(this,Jn,void 0);w(this,Ka,0);v(this,"includedFloors",[]);v(this,"expanded",!1);i.on("camera-change",n=>{var l;let o=Math.floor(n.elevation/Gc),a=(l=this.includedFloors[o])==null?void 0:l.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,Ka)}set percentExpanded(r){let i=Ut(r,0,1,0,Gc);this.includedFloors.forEach((n,o)=>{this.core.setState(n.containerId,{visible:!0,altitude:i*o})}),E(this,Ka,r)}animateToCurrentFloor(){let r=this.includedFloors.indexOf(this.api.currentFloor)*Gc;new Ja.default.Tween({elevation:this.core.camera.elevation}).to({elevation:r},1e3).easing(Ja.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(r){return this.includedFloors=this.api.floors.filter(i=>!(r!=null&&r.excludeFloorIds.includes(i.id))),this.includedFloors.length<=1?Promise.resolve():this.animate("expand")}collapse(){return this.expanded===!0?this.animate("collapse"):Promise.resolve()}animate(r){u(this,Jn)&&u(this,Jn).stop();let i=this.includedFloors.indexOf(this.api.currentFloor)*Gc;return new Promise(n=>{E(this,Jn,new Ja.default.Tween({percentExpanded:this.percentExpanded}).to({percentExpanded:r==="expand"?1:"0"},$P).easing(Ja.default.Easing.Quadratic.Out).onUpdate(({percentExpanded:o})=>{this.core.camera.setElevation(i*o),this.percentExpanded=o,this.core.render()}).onComplete(()=>{this.expanded=r==="expand",this.includedFloors.forEach(o=>{this.core.setState(o.containerId,{visible:r==="collapse"?o.id===this.api.currentFloorId:!0})}),this.core.getSystems().cameraSystem.enablePedestal=r==="expand",this.core.getSystems().cameraSystem.enablePan=r==="collapse",n(),this.publish(r==="expand"?"expanded":"collapsed")}).onStart(()=>{this.includedFloors.forEach(o=>{this.core.setState(o.containerId,{visible:!0})})}).start()),this.core.render()})}};Jn=new WeakMap,Ka=new WeakMap,s(Rd,"StackedMaps");var Vc=Rd;var JP={linear:Yi.default.Easing.Linear.None,"ease-in":Yi.default.Easing.Quadratic.In,"ease-out":Yi.default.Easing.Quadratic.Out,"ease-in-out":Yi.default.Easing.Quadratic.InOut},kd=class kd extends st{floors;currentFloorId="";id;renderer;mvf;styleMap;StackedMaps;animations=new Map;get currentFloor(){return this.floors.find(t=>t.id===this.currentFloorId)}setFloor(t,r){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:r,floorId:this.currentFloor.id})}}cancelAnimation(t){let r=this.animations.get(t);r&&(r.tween.stop(),r.resolver(),this.animations.delete(t))}Markers={add:(t,r,i={})=>{let{floorId:n,...o}=i,a=i!=null&&i.floorId?this.floors.find(l=>l.id===i.floorId):this.floors[0];return this.renderer.addMarker2D(t,r,o,a.id)},remove:t=>{this.renderer.remove(t)},getContentEl:t=>{let r=this.renderer.getState(t);if((r==null?void 0:r.type)==="marker")return r.element},removeAll:()=>{},setPosition:(t,r,i)=>{let n=this.renderer.getState(t);if(!n){X.error(`Failed to retrieve state for Marker with id "${t}".`);return}if(n.type!=="marker"){X.error(`Geometry with id "${t}" is not of type "marker".`);return}this.renderer.setState(n,{position:r,parent:i!=null?i:this.currentFloorId})},animateTo:(t,r,i,n)=>{let o=this.renderer.getState(t);if(!o)return X.error(`Failed to retrieve state for Marker with id "${t}".`),Promise.resolve();if(o.type!=="marker")return X.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 l;new Yi.default.Tween({lon:o.position[0],lat:o.position[1]}).to({lon:r[0],lat:r[1]},a.duration).easing(JP[a.easing]).onUpdate(({lon:h,lat:d})=>{this.Markers.setPosition(t,[h,d],i),this.renderer.render()}).onComplete(()=>{l()}).start();let c=new Promise(h=>{l=h});return this.renderer.render(),c}};Exporter={getCurrentSceneGLTF:async t=>this.renderer.getCurrentSceneGLTF(t)};Labels={all:({onCreate:t})=>{let r=0;for(let i of Object.entries(this.mvf.space)){let[n,o]=i;o&&(o.features.forEach(a=>{var d,m;let l=(d=this.styleMap[a.properties.id])==null?void 0:d.showImage,c=(m=a.properties.details)==null?void 0:m.images,h;if(l&&c&&c.length>0&&(h={marker:{icon:c[0].url}}),a.properties.center&&a.properties.externalId!==""){let y=this.renderer.addLabel2D(a.properties.center,a.properties.externalId,{id:a.properties.id,appearance:h},n);t(y.id,a.properties.externalId)}}),r++)}},add:(t,r,i={})=>{let{floorId:n,...o}=i,a=i!=null&&i.floorId?this.floors.find(c=>c.id===(i==null?void 0:i.floorId)):this.floors[0],l=this.renderer.addLabel2D(t,r,o,a.containerId);if(!l)throw new Error("label creating failed");return l},remove:t=>{this.renderer.remove(t)},removeAll:()=>{}};Paths={add:(t,r)=>{let i=[],n=t[0].floorId||"root",o=0;for(let l of t){let{floorId:c="root",latitude:h,longitude:d}=l;c!==n&&(o++,n=c),i[o]==null&&i.push({floorId:c,coordinates:[]}),i[o].coordinates.push([d,h])}let a=i.map(({floorId:l,coordinates:c})=>this.renderer.addPath({type:"FeatureCollection",features:c.map(h=>({type:"Feature",properties:{},geometry:{type:"Point",coordinates:h}}))},r,l));return new Yi.default.Tween({fraction:0}).to({fraction:1},1e3).onUpdate(({fraction:l})=>{a.forEach(c=>{this.renderer.setState(c.id,{completeFraction:l})})}).start(),a},remove:t=>{t.forEach(r=>{this.renderer.remove(r)})}};constructor(t,r,i,n={},o){super(),this.renderer=o,this.id=t,this.renderer.addGroupContainer(t,{},"root"),this.StackedMaps=new Vc(this,this.renderer),this.mvf=r,this.styleMap=i,this.floors=this.mvf["map.geojson"].sort((a,l)=>a.elevation-l.elevation).map(a=>{var c,h;if(t!=="outdoors-container"&&((c=r.space[a.id])==null?void 0:c.features.length)===0&&((h=r.obstruction[a.id])==null?void 0:h.features.length)===0)return;let l=new Bc(t,a,this.renderer,n,r,i);return l.load(),l}).filter(Boolean),this.setFloor(this.floors[0].id)}};s(kd,"GeojsonApiMapObject");var Qa=kd;f();var Ae,es,Fd=class Fd{constructor({currentMapGetter:t}){w(this,Ae,new Map);w(this,es,void 0);E(this,es,t)}get currentMap(){return u(this,es).call(this)}getById(t){return u(this,Ae).get(t)}add(t,r,i){let n=kr(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(qn(n),r,{...i,floorId:n.floorId,rank:(i==null?void 0:i.rank)||"medium",dynamicResize:(i==null?void 0:i.dynamicResize)||!1}),l=o.Markers.getContentEl(a.toString());if(!l)throw new Error("marker component should exist");let c=new Bi(a.toString(),l,()=>{});return u(this,Ae).set(c.id,{marker:c,entityId:a.toString()}),c}remove(t){var i;let r=u(this,Ae).get(t.id);r&&((i=this.currentMap)==null||i.Markers.remove(r.entityId),u(this,Ae).delete(t.id.toString()))}removeAll(){let t=[];return u(this,Ae).forEach(({marker:r})=>{this.remove(r),t.push(r),u(this,Ae).delete(r.id.toString())}),t}setPosition(t,r){var a;let i=kr(r);if(!i){X.error("Cannot determine coordinate from target.");return}let n=this.currentMap;if(!n){X.error("Cannot determine the current map.");return}let o=u(this,Ae).get(t.id);if(!o){X.error(`Cannot find the Marker with id "${t.id}".`);return}n.Markers.setPosition(o.entityId,qn(i),(a=i.floorId)!=null?a:n.currentFloorId)}animateTo(t,r,i){var l;let n=kr(r);if(!n)return X.error("Cannot determine coordinate from target."),Promise.resolve();let o=this.currentMap;if(!o)return X.error("Cannot determine the current map."),Promise.resolve();let a=u(this,Ae).get(t.id);return a?o.Markers.animateTo(a.entityId,qn(n),(l=n.floorId)!=null?l:o.currentFloorId,i):(X.error(`Cannot find the Marker with id "${t.id}".`),Promise.resolve())}};Ae=new WeakMap,es=new WeakMap,s(Fd,"Markers");var ts=Fd;f();var br,is,Bd=class Bd{constructor({currentMapGetter:t}){w(this,br,new Map);w(this,is,void 0);E(this,is,t)}get currentMap(){return u(this,is).call(this)}getById(t){return u(this,br).get(t)}add(t,r){let i=this.currentMap;if(!i)throw new Error("currentMap should exist");let n=i.Paths.add(t,r),o=new Ga(vt());return u(this,br).set(o.id,{path:o,entityIds:n.map(a=>a.id.toString())}),o}remove(t){var i;let r=u(this,br).get(t.id);r&&((i=this.currentMap)==null||i.Paths.remove(r.entityIds),u(this,br).delete(t.id.toString()))}removeAll(){let t=[];return u(this,br).forEach(({path:r})=>{this.remove(r),t.push(r),u(this,br).delete(r.id.toString())}),t}};br=new WeakMap,is=new WeakMap,s(Bd,"Paths");var rs=Bd;f();var Hc=Cr(Gn());f();var m3="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAkklEQVRoge3awQ3AIAxD0VAMYf+F0yUixbL8JshXuLSwIqJCwDc9QBeZEOy9p2doAQDTM7TQ2cg5Z3qGFjpHS2YjDiGDe+/0DC0cwkYpJKdnaIFMkY1kymzEIVQcwsYhbPDem56hhc5GHELGIWwcwsYhbJS+2R1CxSFsdH5iO4SMr97Y6FxPqxytVVV+HcTEIWx+9mcIqHSOm9QAAAAASUVORK5CYII=";f();var y3=s((e,t,r=0)=>{if(Math.abs(e)>=Math.PI)throw new Error("Sector angle too wide!");let i=r/Math.tan(e/2),n=r/Math.sin(e/2),o=n+t,a=10,l=new Re;l.moveTo(n*Math.cos(e/2)-i,n*Math.sin(e/2));for(let c=0;c<a;c++)l.lineTo(o*Math.cos(e/2-e/a*c)-i,o*Math.sin(e/2-e/a*c));for(let c=0;c<a;c++)l.lineTo(r*Math.cos(Math.PI/-2+Math.PI/a*c),r*Math.sin(Math.PI/-2+Math.PI/a*c));return new ke(l,{depth:.1,bevelEnabled:!1,UVGenerator:QP(t)})},"createSectorGeometry"),Gd=s((e,t,r)=>{let n=Math.sqrt(Math.pow(e,2)+Math.pow(t,2))/r;return n>1?n=1:n<0&&(n=0),new W(0,n)},"generateRadialUV"),QP=s(e=>({generateTopUV:(t,r,i,n,o)=>{let a=r[i*3],l=r[i*3+1],c=r[n*3],h=r[n*3+1],d=r[o*3],m=r[o*3+1];return[Gd(a,l,e),Gd(c,h,e),Gd(d,m,e)]},generateSideWallUV:()=>[new W(0,1),new W(0,1),new W(0,1),new W(0,1)]}),"radialUVGenerator");var Vd="#2266ff",tM=.7,eM=.3;function g3(){let e=new Ji({color:Vd,opacity:tM,transparent:!0,depthTest:!1,depthWrite:!1}),t=y3(Math.PI/6,C3,b3);new Ki().load(m3,i=>{e.alphaMap=i,e.needsUpdate=!0});let r=new Ft(t,e);return r.position.z=-.05,r.renderOrder=3,r}s(g3,"createBearingCone");var v3=s(()=>{let e=new jc(.5,.5,.05,32),t=new Ji({transparent:!0,color:Vd,opacity:eM,depthTest:!1,depthWrite:!1}),r=new Ft(e,t);r.scale.set(0,0,.05),r.renderOrder=2;let i=new jc(Hd,Hd,.05,32),n=new Ji({transparent:!0,color:Vd,depthTest:!1,depthWrite:!1}),o=new Ft(i,n);return o.renderOrder=3,r.rotation.x=Math.PI/2,o.rotation.x=Math.PI/2,{baseMesh:r,middleMesh:o}},"createBlueDot");var rM={enableHighAccuracy:!0},iM=500,nM=150,oM=150,aM=0,sM=5,lM=5,cM=30,b3=.4,C3=1.25,Hd=.35,Xd=class Xd extends st{constructor(r,i){super();this.core=r;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:r=>{let{baseMesh:i,middleMesh:n}=v3(),o=g3();r.add(i),r.add(n),r.add(o)},update:this.updateGeometryPerFrame},{visible:!1},"outdoors-container"),this.watcherId=navigator.geolocation.watchPosition(this.onPositionUpdate,this.onPositionError,rM)}updateGeometryPerFrame=r=>{var c;let[i,n,o]=r.children,{accuracy:a,heading:l}=((c=this.currentGeolocation)==null?void 0:c.coords)||{};a!=null&&(this.scaleAnimation&&this.scaleAnimation.stop(),this.scaleAnimation=new Hc.default.Tween({scale:i.scale.x}).to({scale:Ut(a,lM,cM,aM,sM)},nM).onUpdate(({scale:h})=>{i.scale.set(h,1,h)}).start()),l!=null?(o.visible=!0,this.rotationAnimation&&this.rotationAnimation.stop(),this.rotationAnimation=new Hc.default.Tween({rotation:i.scale.x}).to({rotation:at.degToRad(l)},oM).onUpdate(({rotation:h})=>{o.rotation.z=h}).start()):o.visible=!1};onPositionUpdate=r=>{var i;if(this.currentGeolocation=r,this.geometry){let n=this.core.getState(this.geometry);n.visible===!1&&this.core.setState(this.geometry,{position:[r.coords.longitude,r.coords.latitude],visible:!0}),this.positionAnimation&&this.positionAnimation.stop(),n=this.core.getState(this.geometry);let o;if(r.coords.floorLevel!==void 0){let a=(i=this.geoJSONApi.currentMap)==null?void 0:i.floors[r.coords.floorLevel];o=a==null?void 0:a.id}this.positionAnimation=new Hc.default.Tween(n.position).to([r.coords.longitude,r.coords.latitude],iM).onUpdate(a=>{if(this.geometry){let l={position:a};o==null&&n.parent!=="outdoors-container"?l.parent="outdoors-container":n.parent!==o&&(l.parent=o,this.publish("floor-change",{reason:"blue-dot-floor-change",floorId:o})),this.core.setState(this.geometry,l)}}).start(),this.core.render()}};onPositionError=r=>{switch(r.code){case r.PERMISSION_DENIED:X.error("Geolocation permission denied by the user.",r);break;case r.POSITION_UNAVAILABLE:X.error("Geolocation position unavailable.",r);break;case r.TIMEOUT:X.error("Geolocation request timed out.",r);break;default:X.error("An unknown geolocation error occurred.",r);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}};s(Xd,"BlueDot");var Xc=Xd;var Yd=class Yd{core;outdoors;mapObjects=[];id;mapDataExternal={};mapsByFloorId={};mapData;currentMap;directions;mapView;Camera;Labels;Markers;Paths;Exporter;Navigation;BlueDot;constructor(t,r){this.core=t,this.mapView=r,this.Camera=new ja(this.core),this.id=this.core.addGroupContainer("root").id.toString(),this.outdoors=new Qa("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 Va(this.Camera);this.core.on("camera-change",()=>{this.mapView.publish("camera-change",i)});let n=s(l=>c=>{var S,P;let h=[],d=[];c.labels.forEach(g=>{let C=this.Labels.getById(g.toString());C&&h.push(C.label)}),c.markers.forEach(g=>{let C=this.Markers.getById(g.toString());C&&d.push(C.marker)});let m=c.geometry[0],y;m&&(y=(S=this.getMapData())==null?void 0:S.getById("space",m)),y||(y=(P=this.getMapData())==null?void 0:P.getById("object",m));let x={coordinate:new $(c.coordinate[1],c.coordinate[0]),spaces:y&&Me.is(y)?[y]:[],objects:y&&we.is(y)?[y]:[],markers:d,labels:h,floors:[]};"pointerEvent"in c&&(x.pointerEvent=c.pointerEvent),this.mapView.publish(l,x)},"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("user-interaction-start",()=>{this.mapView.publish("user-interaction-start")}),this.core.on("user-interaction-end",()=>{this.mapView.publish("user-interaction-end")});let o=s(()=>this.currentMap,"currentMapGetter");this.Markers=new ts({currentMapGetter:o}),this.Labels=new qa({currentMapGetter:o}),this.Exporter=new Za({currentMapGetter:o}),this.Paths=new rs({currentMapGetter:o}),this.Navigation=new wc(r),this.BlueDot=new Xc(this.core,this),this.BlueDot.on("floor-change",l=>{this.setFloor(l.floorId,"blue-dot-floor-change")});let a=new Oc(r,this.mapDataExternal);this.auto=a.auto}updateState(t,r){var n;if(t==="walls"){(n=this.currentMap)==null||n.floors.forEach(o=>{var c,h;let a=o.layers.get("Walls"),l=o.layers.get("ExteriorWalls");a&&((c=this.core.getState(a))==null||c.children.forEach(d=>{this.core.setState(d.id,r)})),l&&((h=this.core.getState(l))==null||h.children.forEach(d=>{this.core.setState(d.id,r)}))});return}let i=typeof t=="string"?this.getMapDataObject(t):t;if(i){if(qr.is(i))return this.core.setState(i.id,o3({...r,type:"label"},this.core.getState(i.id)));if(Bi.is(i))return this.core.setState(i.id,a3({...r,type:"marker"},this.core.getState(i.id)));(Me.is(i)||we.is(i))&&this.core.setState(i.id,s3({...r,type:"geometry"},this.core.getState(i.id)))}}getMapDataObject(t){var r;return(r=this.getMapData())==null?void 0:r.getMapDataById(t)}update=()=>{this.core.render()};getMapData(){return this.mapData}expand(t){var r;return(r=this.currentMap)==null?void 0:r.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,r){return new Promise(i=>{var y,x,S;let n=zc.get(t);if(!n){X.error("error exists"),i(t);return}this.mapDataExternal[t.mapName]=t;let{mvf:o}=n,a=o["manifest.geojson"].features[0].geometry.coordinates;this.Camera.set({center:new $(a[0],a[1])});let l=u3(o["styles.json"]||{}),c=o["manifest.geojson"].features[0].properties.name,h=new Qa(`mapObject-${c}`,o,l,r,this.core),d=this.core.getBoundingBox(h.currentFloor.id),m=(x=(y=r==null?void 0:r.outdoorView)==null?void 0:y.layersHiddenByGeometry)!=null?x:[];if(m.length>0){let P=(S=this.core.getCenter(d))!=null?S:a;this.core.hideOutdoorLayersUnderPoint(P,m)}this.mapObjects.push(h),o["map.geojson"].forEach(P=>{this.mapsByFloorId[P.id]=h}),h.StackedMaps.on("expanded",()=>{this.mapView.publish("expanded")}),h.StackedMaps.on("collapsed",()=>{this.mapView.publish("collapsed")}),h.on("floor-change-start",()=>{this.mapView.publish("floor-change-start",{floor:this.currentFloor})}),h.on("floor-change",P=>{this.mapView.publish("floor-change",{reason:P.reason,floor:this.currentFloor})}),this.currentMap=h,this.mapData=n,this.directions=new Rc({nodes:this.currentMap.mvf["node.geojson"],obstructions:this.currentMap.mvf.obstruction,connections:this.currentMap.mvf["connection.json"],groupBy:"map"}),r!=null&&r.zoomLevel||this.core.camera.focusOn(d,{duration:0,padding:{top:.05*this.core.canvasHeight,left:.05*this.core.canvasWidth,right:.05*this.core.canvasWidth,bottom:.05*this.core.canvasHeight}}),i(t)})}setFloor(t,r){if(!this.currentMap)throw new Error("mappObject should exist atm");this.currentMap.setFloor(typeof t=="string"?t:t.id,r)}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 r=(n=this.mapData)==null?void 0:n.getById("floor",t);if(!r)throw new Error("Missing currentFloor");return r}getState(t){var n;let r=typeof t=="string"?t:t.id,i=this.core.getState(r);if(i){if(i.type==="geometry")return{type:"geometry",interactive:i.interactive,hoverColor:i.hoverColor,color:i.color};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 $(i.position[1],i.position[0],o.toString())}}}}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,r,i)=>{if(!this.directions)throw new Error("You have to call .addMap() before you can get directions");let{accessible:n=!1,smoothing:o=!0}=i||{},a=Array.isArray(t)?t:[t],l=Array.isArray(r)?r:[r],c=typeof o=="object"?o.enabled:o,h=typeof o=="object"?o.radius:void 0,d={accessible:n,smoothing:{enabled:c!=null?c:!0,radius:h!=null?h:.75}};return this.directions.getDirections(a,l,d,this.mapData)};createCoordinate(t,r,i){return new $(t,r,(i==null?void 0:i.id)||this.currentFloor.id)}createCoordinateFromScreenCoordinate(t,r,i){let n=this.core.projectScreenXYToCoordinate(t,r);return n?new $(n[1],n[0],(i==null?void 0:i.id)||this.currentFloor.id):void 0}auto(){this.Labels.all()}Outdoor={setStyle:t=>{var r,i;(r=this.core.map)==null||r.setStyle(t),(i=this.core.map)==null||i.moveLayer(qo)}};get __core(){return this.core}destroy(){this.core.destroy()}};s(Yd,"GeoJsonApi");var ns=Yd;var os,ot,jd=class jd extends st{constructor(r){super();w(this,os,{});w(this,ot,void 0);v(this,"Camera");v(this,"Labels");v(this,"Markers");v(this,"Paths");v(this,"Exporter");v(this,"Navigation");v(this,"BlueDot");v(this,"update",()=>{u(this,ot).core.render()});v(this,"getDirections",(r,i,n)=>u(this,ot).getDirections(r,i,n));v(this,"Outdoor",{setStyle:r=>{u(this,ot).Outdoor.setStyle(r)}});v(this,"on",(r,i)=>{super.on(r,i)});v(this,"off",(r,i)=>{super.off(r,i)});E(this,ot,new ns(r,this)),this.Camera=u(this,ot).Camera,E(this,os,u(this,ot).mapDataExternal),this.Markers=u(this,ot).Markers,this.Labels=u(this,ot).Labels,this.Exporter=u(this,ot).Exporter,this.Paths=u(this,ot).Paths,this.Navigation=u(this,ot).Navigation,this.BlueDot=u(this,ot).BlueDot,this.auto=u(this,ot).auto}updateState(r,i){return u(this,ot).updateState(r,i)}getMapData(){return u(this,os)}expand(r){return u(this,ot).expand(r)}collapse(){return u(this,ot).collapse()}addMap(r,i){return u(this,ot).addMap(r,i)}setFloor(r){u(this,ot).setFloor(r)}get currentFloor(){return u(this,ot).currentFloor}getState(r){return u(this,ot).getState(r)}setHoverColor(r){u(this,ot).setHoverColor(r)}getHoverColor(){return u(this,ot).getHoverColor()}createCoordinate(r,i,n){return u(this,ot).createCoordinate(r,i,n)}createCoordinateFromScreenCoordinate(r,i,n){return u(this,ot).createCoordinateFromScreenCoordinate(r,i,n)}auto(){this.Labels.all()}get __core(){return u(this,ot).core}destroy(){u(this,ot).destroy()}};os=new WeakMap,ot=new WeakMap,s(jd,"MapView");var Yc=jd;var uM={auto:!0,debug:!1,pitch:45,bearing:0,antialiasing:{enabled:!0}},cU=s(async(e,t)=>{let r;if(t){let{access_token:o}=await ds(t);r=o}let i=new Bo(e,r);return new Zc(i)},"hydrateMapDataFromMVF"),uU=s(async e=>{let t={emitAnalyticsEvents:!0,...e},r;if("accessToken"in t)r=t.accessToken;else{let{access_token:c}=await ds(t);r=c}let i=await Jc(t,r),n=await Qc(i),o=Kc(n);typeof e.onMVFParsed=="function"&&e.onMVFParsed(o);let a=new Bo(o,r);return new Zc(a)},"getMapData"),pM=s(async(e,t,r)=>{var a,l,c,h;let i={...uM,...r!=null?r:{},outdoorView:{token:t.outdoorViewToken,layersHiddenByGeometry:["building","building-top"],...r==null?void 0:r.outdoorView}},n=await Yb(e,{center:[t.mapCenter.longitude,t.mapCenter.latitude],bearing:i.bearing,pitch:i.pitch,zoomLevel:i.zoomLevel,outdoorView:(a=i.outdoorView)!=null&&a.token?{headers:{"x-mappedin-tiles-key":(l=i.outdoorView)==null?void 0:l.token},style:(c=i.outdoorView)==null?void 0:c.style,enabled:!0}:void 0,watermark:i.watermark,attribution:i.attribution,antialias:typeof i.antialiasing=="boolean"?i.antialiasing:!!((h=i.antialiasing)!=null&&h.enabled)}),o=new Yc(n);return await o.addMap(t,i),o},"show3dMapGeojson"),pU=pM;export{gn as Annotation,Br as Connection,$ as Coordinate,Nr as Door,yl as Floor,ml as Hyperlink,gl as Image,we as MapObject,Fr as PointOfInterest,Me as Space,V2 as enableTestMode,uU as getMapData,cU as hydrateMapDataFromMVF,Kc as parseMVF,pU as show3dMap,pM as show3dMapGeojson,Qc as unzipMVF};
950
+ </svg>`]]),lM=/<svg([^>]*)>/g;function hb(r,t,e){let i=sM.get(r);return i?i.replace(lM,`<svg$1 xmlns="http://www.w3.org/2000/svg" style="fill:${t}; width:${e}px; height:${e}px">`):""}s(hb,"getStyledIcon");var zi,ro,qa,mf,Ru,db,ku,fb,$a,yf,Fu,mb,gf=class gf{constructor(t,e){T(this,qa);T(this,Ru);T(this,ku);T(this,$a);T(this,Fu);T(this,zi,void 0);T(this,ro,void 0);v(this,"colors",{default:"#3D5676",connection:"#128387",washroom:"#3161B4",point:"#AD468F"});E(this,zi,t),E(this,ro,e)}auto(){let t=c(this,ro)[Object.keys(c(this,ro))[0]];[...t.getByType("connection"),...t.getByType("point-of-interest"),...t.getByType("space")].forEach(e=>{e.__type==="connection"?e.coordinates.forEach(i=>{c(this,zi).Labels.add(i,e.name,j(this,qa,mf).call(this,e))}):(e.__type==="space"&&e.name!==""&&c(this,zi).updateState(e,{interactive:!0,hoverColor:"#F0F0F0"}),c(this,zi).Labels.add(e,e.name,j(this,qa,mf).call(this,e)))})}};zi=new WeakMap,ro=new WeakMap,qa=new WeakSet,mf=s(function(t){let e=hb(j(this,Ru,db).call(this,t),"white",12);return{appearance:{text:{foregroundColor:j(this,$a,yf).call(this,t)},marker:{foregroundColor:{active:j(this,$a,yf).call(this,t)},icon:e,iconSize:12}},interactive:!0,rank:j(this,Fu,mb).call(this,t)}},"#generatLabelAppearance"),Ru=new WeakSet,db=s(function(t){return t.__type==="connection"?j(this,ku,fb).call(this,t.type):t.name.includes("Washroom")?"washroom-14x14":t.__type==="point-of-interest"?"point-of-interest-12x12":""},"#getIconName"),ku=new WeakSet,fb=s(function(t){let e="";switch(t){case"elevator":e="connection-elevator-12x12";break;case"escalator":e="connection-escalator-12x12";break;case"stairs":e="connection-stairs-12x12";break}return e},"#attemptIconNameForConnection"),$a=new WeakSet,yf=s(function(t){return t.__type==="connection"?this.colors.connection:t.__type==="point-of-interest"?this.colors.point:"name"in t&&t.name.includes("Washroom")?this.colors.washroom:this.colors.default},"#getLabelColor"),Fu=new WeakSet,mb=s(function(t){return t.__type==="connection"?"high":(t.__type==="point-of-interest","medium")},"#getDefaultLabelRank"),s(gf,"Labels");var Nu=gf;var vf=class vf{Labels;constructor(t,e){this.Labels=new Nu(t,e)}auto=()=>{this.Labels.auto()}};s(vf,"DefaultTheme");var Bu=vf;d();var Pt,bf=class bf{constructor(t){T(this,Pt,void 0);v(this,"setMinZoomLevel",t=>{c(this,Pt).camera.setMinZoomLevel(t)});v(this,"setMaxZoomLevel",t=>{c(this,Pt).camera.setMaxZoomLevel(t)});E(this,Pt,t)}setScreenOffsets(t){c(this,Pt).camera.setInsetPadding(t)}focusOn(t,e){var o;let i=[],n=Array.isArray(t)?t:[t];for(let a of n)if(jr.is(a)){let l;for(l of a.coordinates)i.push([l.longitude,l.latitude])}else{let l=Xr(a);if(l){let u=0;l.floorId&&(u=((o=c(this,Pt).getState(l.floorId))==null?void 0:o.altitude)||0),i.push([l.longitude,l.latitude,u])}}return c(this,Pt).camera.focusOn(i,{pitch:e==null?void 0:e.pitch,bearing:e==null?void 0:e.bearing,padding:e==null?void 0:e.screenOffsets,maxZoomLevel:e==null?void 0:e.maxZoomLevel,minZoomLevel:e==null?void 0:e.minZoomLevel,duration:e==null?void 0:e.duration,updateZoomLimits:!1,easing:e==null?void 0:e.easing})}animateTo(t,e){var h;let{center:i,zoomLevel:n,bearing:o,pitch:a}=t,l=i!=null?i:this.center,u=[l.longitude,l.latitude];return c(this,Pt).camera.animateTo({center:u,zoomLevel:n!=null?n:this.zoomLevel,bearing:o!=null?o:this.bearing,pitch:a!=null?a:this.pitch,duration:(h=e==null?void 0:e.duration)!=null?h:600,easing:e==null?void 0:e.easing})}set(t){let{center:e=this.center,zoomLevel:i=this.zoomLevel,bearing:n=this.bearing,pitch:o=this.pitch}=t,a=[e.longitude,e.latitude];c(this,Pt).camera.setCenter(a),c(this,Pt).camera.setZoomLevel(i),c(this,Pt).camera.setBearing(n),c(this,Pt).camera.setPitch(o)}get center(){let t=c(this,Pt).camera.center;return new $(t[1],t[0],void 0)}get zoomLevel(){return c(this,Pt).camera.zoomLevel}get pitch(){return c(this,Pt).camera.pitch}get bearing(){let t=c(this,Pt).camera.bearing;return(t<0?t+360:t)%360}get minZoomLevel(){return c(this,Pt).camera.minZoomLevel}get maxZoomLevel(){return c(this,Pt).camera.maxZoomLevel}};Pt=new WeakMap,s(bf,"Camera");var Ja=bf;d();d();d();d();d();d();d();d();function Cf(r){let t=+this._x.call(null,r),e=+this._y.call(null,r);return yb(this.cover(t,e),t,e,r)}s(Cf,"default");function yb(r,t,e,i){if(isNaN(t)||isNaN(e))return r;var n,o=r._root,a={data:i},l=r._x0,u=r._y0,h=r._x1,f=r._y1,m,y,x,S,P,g,C,w;if(!o)return r._root=a,r;for(;o.length;)if((P=t>=(m=(l+h)/2))?l=m:h=m,(g=e>=(y=(u+f)/2))?u=y:f=y,n=o,!(o=o[C=g<<1|P]))return n[C]=a,r;if(x=+r._x.call(null,o.data),S=+r._y.call(null,o.data),t===x&&e===S)return a.next=o,n?n[C]=a:r._root=a,r;do n=n?n[C]=new Array(4):r._root=new Array(4),(P=t>=(m=(l+h)/2))?l=m:h=m,(g=e>=(y=(u+f)/2))?u=y:f=y;while((C=g<<1|P)===(w=(S>=y)<<1|x>=m));return n[w]=o,n[C]=a,r}s(yb,"add");function gb(r){var t,e,i=r.length,n,o,a=new Array(i),l=new Array(i),u=1/0,h=1/0,f=-1/0,m=-1/0;for(e=0;e<i;++e)isNaN(n=+this._x.call(null,t=r[e]))||isNaN(o=+this._y.call(null,t))||(a[e]=n,l[e]=o,n<u&&(u=n),n>f&&(f=n),o<h&&(h=o),o>m&&(m=o));if(u>f||h>m)return this;for(this.cover(u,h).cover(f,m),e=0;e<i;++e)yb(this,a[e],l[e],r[e]);return this}s(gb,"addAll");d();function xf(r,t){if(isNaN(r=+r)||isNaN(t=+t))return this;var e=this._x0,i=this._y0,n=this._x1,o=this._y1;if(isNaN(e))n=(e=Math.floor(r))+1,o=(i=Math.floor(t))+1;else{for(var a=n-e||1,l=this._root,u,h;e>r||r>=n||i>t||t>=o;)switch(h=(t<i)<<1|r<e,u=new Array(4),u[h]=l,l=u,a*=2,h){case 0:n=e+a,o=i+a;break;case 1:e=n-a,o=i+a;break;case 2:n=e+a,i=o-a;break;case 3:e=n-a,i=o-a;break}this._root&&this._root.length&&(this._root=l)}return this._x0=e,this._y0=i,this._x1=n,this._y1=o,this}s(xf,"default");d();function Sf(){var r=[];return this.visit(function(t){if(!t.length)do r.push(t.data);while(t=t.next)}),r}s(Sf,"default");d();function Pf(r){return arguments.length?this.cover(+r[0][0],+r[0][1]).cover(+r[1][0],+r[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}s(Pf,"default");d();d();function Lt(r,t,e,i,n){this.node=r,this.x0=t,this.y0=e,this.x1=i,this.y1=n}s(Lt,"default");function Mf(r,t,e){var i,n=this._x0,o=this._y0,a,l,u,h,f=this._x1,m=this._y1,y=[],x=this._root,S,P;for(x&&y.push(new Lt(x,n,o,f,m)),e==null?e=1/0:(n=r-e,o=t-e,f=r+e,m=t+e,e*=e);S=y.pop();)if(!(!(x=S.node)||(a=S.x0)>f||(l=S.y0)>m||(u=S.x1)<n||(h=S.y1)<o))if(x.length){var g=(a+u)/2,C=(l+h)/2;y.push(new Lt(x[3],g,C,u,h),new Lt(x[2],a,C,g,h),new Lt(x[1],g,l,u,C),new Lt(x[0],a,l,g,C)),(P=(t>=C)<<1|r>=g)&&(S=y[y.length-1],y[y.length-1]=y[y.length-1-P],y[y.length-1-P]=S)}else{var w=r-+this._x.call(null,x.data),I=t-+this._y.call(null,x.data),M=w*w+I*I;if(M<e){var _=Math.sqrt(e=M);n=r-_,o=t-_,f=r+_,m=t+_,i=x.data}}return i}s(Mf,"default");d();function Tf(r){if(isNaN(f=+this._x.call(null,r))||isNaN(m=+this._y.call(null,r)))return this;var t,e=this._root,i,n,o,a=this._x0,l=this._y0,u=this._x1,h=this._y1,f,m,y,x,S,P,g,C;if(!e)return this;if(e.length)for(;;){if((S=f>=(y=(a+u)/2))?a=y:u=y,(P=m>=(x=(l+h)/2))?l=x:h=x,t=e,!(e=e[g=P<<1|S]))return this;if(!e.length)break;(t[g+1&3]||t[g+2&3]||t[g+3&3])&&(i=t,C=g)}for(;e.data!==r;)if(n=e,!(e=e.next))return this;return(o=e.next)&&delete e.next,n?(o?n.next=o:delete n.next,this):t?(o?t[g]=o:delete t[g],(e=t[0]||t[1]||t[2]||t[3])&&e===(t[3]||t[2]||t[1]||t[0])&&!e.length&&(i?i[C]=e:this._root=e),this):(this._root=o,this)}s(Tf,"default");function vb(r){for(var t=0,e=r.length;t<e;++t)this.remove(r[t]);return this}s(vb,"removeAll");d();function wf(){return this._root}s(wf,"default");d();function If(){var r=0;return this.visit(function(t){if(!t.length)do++r;while(t=t.next)}),r}s(If,"default");d();function Ef(r){var t=[],e,i=this._root,n,o,a,l,u;for(i&&t.push(new Lt(i,this._x0,this._y0,this._x1,this._y1));e=t.pop();)if(!r(i=e.node,o=e.x0,a=e.y0,l=e.x1,u=e.y1)&&i.length){var h=(o+l)/2,f=(a+u)/2;(n=i[3])&&t.push(new Lt(n,h,f,l,u)),(n=i[2])&&t.push(new Lt(n,o,f,h,u)),(n=i[1])&&t.push(new Lt(n,h,a,l,f)),(n=i[0])&&t.push(new Lt(n,o,a,h,f))}return this}s(Ef,"default");d();function _f(r){var t=[],e=[],i;for(this._root&&t.push(new Lt(this._root,this._x0,this._y0,this._x1,this._y1));i=t.pop();){var n=i.node;if(n.length){var o,a=i.x0,l=i.y0,u=i.x1,h=i.y1,f=(a+u)/2,m=(l+h)/2;(o=n[0])&&t.push(new Lt(o,a,l,f,m)),(o=n[1])&&t.push(new Lt(o,f,l,u,m)),(o=n[2])&&t.push(new Lt(o,a,m,f,h)),(o=n[3])&&t.push(new Lt(o,f,m,u,h))}e.push(i)}for(;i=e.pop();)r(i.node,i.x0,i.y0,i.x1,i.y1);return this}s(_f,"default");d();function bb(r){return r[0]}s(bb,"defaultX");function Lf(r){return arguments.length?(this._x=r,this):this._x}s(Lf,"default");d();function Cb(r){return r[1]}s(Cb,"defaultY");function Of(r){return arguments.length?(this._y=r,this):this._y}s(Of,"default");function Ka(r,t,e){var i=new Df(t==null?bb:t,e==null?Cb:e,NaN,NaN,NaN,NaN);return r==null?i:i.addAll(r)}s(Ka,"quadtree");function Df(r,t,e,i,n,o){this._x=r,this._y=t,this._x0=e,this._y0=i,this._x1=n,this._y1=o,this._root=void 0}s(Df,"Quadtree");function xb(r){for(var t={data:r.data},e=t;r=r.next;)e=e.next={data:r.data};return t}s(xb,"leaf_copy");var Jt=Ka.prototype=Df.prototype;Jt.copy=function(){var r=new Df(this._x,this._y,this._x0,this._y0,this._x1,this._y1),t=this._root,e,i;if(!t)return r;if(!t.length)return r._root=xb(t),r;for(e=[{source:t,target:r._root=new Array(4)}];t=e.pop();)for(var n=0;n<4;++n)(i=t.source[n])&&(i.length?e.push({source:i,target:t.target[n]=new Array(4)}):t.target[n]=xb(i));return r};Jt.add=Cf;Jt.addAll=gb;Jt.cover=xf;Jt.data=Sf;Jt.extent=Pf;Jt.find=Mf;Jt.remove=Tf;Jt.removeAll=vb;Jt.root=wf;Jt.size=If;Jt.visit=Ef;Jt.visitAfter=_f;Jt.x=Lf;Jt.y=Of;d();d();var Af=class Af{origin;destination;distance;angle;weight;constructor({origin:t,destination:e,distance:i=0,angle:n=0,pathWeight:o=0}){this.origin=t,this.destination=e,this.distance=i,this.angle=n;let a=o||0;if(this.weight=a>=0?this.distance+a:0,isNaN(this.angle))throw new Error("nan angle")}};s(Af,"Edge");var qi=Af;d();d();d();d();function Mr([r,t],[e,i]){let n=t-i,o=r-e;return(Math.atan2(o,n)+Math.PI*3)%(Math.PI*2)}s(Mr,"getAngle");d();var uM=63710088e-1;function $i(r,t){let[e,i]=r.map(f=>f*Math.PI/180),[n,o]=t.map(f=>f*Math.PI/180),a=o-i,l=n-e,u=Math.sin(a/2)*Math.sin(a/2)+Math.cos(i)*Math.cos(o)*Math.sin(l/2)*Math.sin(l/2),h=2*Math.atan2(Math.sqrt(u),Math.sqrt(1-u));return uM*h}s($i,"getDistance");d();d();function Gu(r,t,e,i){let[n,o]=r,[a,l]=t,[u,h]=e,[f,m]=i;if(o===l&&n===a||h===m&&u===f)return null;let y=(f-u)*(l-o)-(m-h)*(a-n);if(y===0)return null;let x=((m-h)*(n-u)-(f-u)*(o-h))/y,S=((l-o)*(n-u)-(a-n)*(o-h))/y;if(x<0||x>1||S<0||S>1)return null;let P=o+x*(l-o);return[n+x*(a-n),P]}s(Gu,"getLineIntersection");d();function Nf(r,t,e,i){let n=ui(r,e/1e3,i),o=ui(t,e/1e3,i);return[n.geometry.coordinates,o.geometry.coordinates]}s(Nf,"getOffsetLine");d();function Rf(r){let t=r*(180/Math.PI);return t=t%360,t>180?t-=360:t<-180&&(t+=360),Object.is(t,-0)?0:t}s(Rf,"radToDegNormalized");function Sb(r,t,e=[],i=0){let n=!0,o=r.geometry.coordinates,a=t.geometry.coordinates,l=Rf(Mr(o,a)-Math.PI/2),u=Rf(Mr(o,a)+Math.PI/2);return e.forEach(h=>{if(i>0){let f=Nf(o,a,i,l),m=Nf(o,a,i,u);if(Gu(f[0],f[1],h[0],h[1])||Gu(m[0],m[1],h[0],h[1])){n=!1;return}}else if(Gu(o,a,h[0],h[1])){n=!1;return}}),n}s(Sb,"hasLineOfSight");var kf=class kf{edges;nodesById;nodesByGroup=new Map;constructor({nodes:t,groupBy:e}){this.edges={};let{features:i}=t;this.nodesById=i.reduce((n,o)=>(n[o.properties.id]=o,n),{});for(let n in this.nodesById)this.nodesById.hasOwnProperty(n)&&(this.nodesById[n].properties.neighbors=this.nodesById[n].properties.neighbors.filter(({id:o})=>!!this.nodesById[o]));i.forEach(n=>{let o=e==="default"?e:n.properties[e];this.nodesByGroup.has(o)||this.nodesByGroup.set(o,[]),this.nodesByGroup.get(o).push(n),this.edges[n.properties.id]=n.properties.neighbors.map(({id:a,weight:l})=>{let u=this.nodesById[a];return new qi({origin:n,destination:u,distance:$i(n.geometry.coordinates,u.geometry.coordinates),angle:Mr(n.geometry.coordinates,u.geometry.coordinates),pathWeight:l})})})}aStar({originIds:t,destinationNodeIds:e,excludedNodeIds:i}){let n=t.map(h=>this.nodesById[h]).filter(h=>h),o=e.map(h=>this.nodesById[h]).filter(h=>h);if(n.length===0||o.length===0)return[];let a=[],l={},u={};for(n.forEach(h=>{let f=this.getShortestEuclideanDistance(h,o);a.push({origin:h,priority:f}),l[h.properties.id]=null,u[h.properties.id]=0}),a.sort((h,f)=>h.priority-f.priority);a.length>0;){let h=a[0];if(o.includes(h.origin)){let f=[],m=l[h.origin.properties.id];for(;m!=null;){f.push(m);let y=l[m.origin.properties.id];y!=null?m=y:m=null}return f.reverse()}for(let f of this.edges[h.origin.properties.id]){if(i&&i.has(f.destination.properties.id))continue;let m=u[h.origin.properties.id]+f.weight;if(u[f.destination.properties.id]==null||m<u[f.destination.properties.id]){u[f.destination.properties.id]=m;let y=m+this.getShortestEuclideanDistance(f.destination,o);a.push({origin:f.destination,priority:y}),l[f.destination.properties.id]=f}}a.splice(0,1),a.sort((f,m)=>f.priority-m.priority)}return[]}getShortestEuclideanDistance(t,e){return e.reduce((i,n)=>{let o=$i(t.geometry.coordinates,n.geometry.coordinates);return Math.min(i,o)},Number.MAX_VALUE)}};s(kf,"NavigationGraph");var Vu=kf;var cM=.4,Ff=class Ff{groupBy;graph;geometryEdgesByMapId=new Map;cache={nodeTreesByGroup:new Map};constructor({nodes:t,obstructions:e,groupBy:i="default"}){this.groupBy=i,this.graph=new Vu({nodes:t,groupBy:this.groupBy}),e&&e.features.forEach(n=>{let o=n.geometry.coordinates.length===1?n.geometry.coordinates[0]:n.geometry.coordinates,a=this.groupBy==="default"?this.groupBy:n.properties[this.groupBy];this.geometryEdgesByMapId.has(a)||this.geometryEdgesByMapId.set(a,[]),o.forEach((l,u)=>{this.geometryEdgesByMapId.get(a).push([l,o[u+1]||o[0]])})})}findNearestNode=t=>{var n;let e=this.groupBy==="default"?this.groupBy:t.properties[this.groupBy];if(!this.cache.nodeTreesByGroup.has(e)){let o=(n=this.graph.nodesByGroup.get(e))!=null?n:[],a=Ka();a.x(l=>l.geometry.coordinates[1]),a.y(l=>l.geometry.coordinates[0]),a.addAll(o),this.cache.nodeTreesByGroup.set(e,a)}return this.cache.nodeTreesByGroup.get(e).find(t.geometry.coordinates[1],t.geometry.coordinates[0])||null};getDirections({originIds:t,destinationNodeIds:e,excludedNodeIds:i,simplify:n}){var l,u;let o=(l=n==null?void 0:n.enabled)!=null?l:!0,a=this.graph.aStar({originIds:t,destinationNodeIds:e,excludedNodeIds:new Set(i)});return a.length===0?{type:"FeatureCollection",features:[]}:(o&&(a=this.simplifyAllSteps(a,(u=n==null?void 0:n.bufferRadius)!=null?u:cM)),this.generatePath(a))}generatePath=t=>{let{destination:e}=t[t.length-1],i={type:"FeatureCollection",features:[]};for(let o=0;o<t.length;o++){let{origin:a}=t[o],l={id:a.properties.id,angle:t[o].angle,distance:t[o].distance};this.groupBy!=="default"&&(l.groupBy=a.properties[this.groupBy]),i.features.push({type:"Feature",geometry:{type:"Point",coordinates:[a.geometry.coordinates[0],a.geometry.coordinates[1]]},properties:l})}let n={id:e.properties.id};return this.groupBy!=="default"&&(n.groupBy=e.properties[this.groupBy]),i.features.push({type:"Feature",geometry:{type:"Point",coordinates:[e.geometry.coordinates[0],e.geometry.coordinates[1]]},properties:n}),i};simplifyAllSteps(t,e){var u,h;let i=[],n=[t[0]];for(let f=1;f<t.length;f++){if(this.groupBy!=="default"&&t[f].origin.properties[this.groupBy]!==t[f-1].origin.properties[this.groupBy]){let m=t[f-1].origin.properties[this.groupBy],y=(u=this.geometryEdgesByMapId.get(m))!=null?u:[];i.push(...this.simplifySteps(n,y,e)),n=[t[f]]}n.push(t[f])}let o=t[t.length-1],a=this.groupBy==="default"?this.groupBy:o.origin.properties[this.groupBy],l=(h=this.geometryEdgesByMapId.get(a))!=null?h:[];return i.push(...this.simplifySteps(n,l,e)),i}simplifySteps(t,e,i){if(t.length<3)return t;let n=[t[0]],o=1;for(let a=o+2;a<t.length;a++)if(!Sb(t[o].origin,t[a].origin,e,i)){let l=a-1;n.push(new qi({...t[o],destination:t[l].origin,distance:$i(t[o].origin.geometry.coordinates,t[l].origin.geometry.coordinates),angle:Mr(t[o].origin.geometry.coordinates,t[l].origin.geometry.coordinates)})),o=l}return n.push(new qi({...t[o],destination:t[t.length-1].origin,distance:$i(t[o].origin.geometry.coordinates,t[t.length-1].origin.geometry.coordinates),angle:Mr(t[o].origin.geometry.coordinates,t[t.length-1].origin.geometry.coordinates)}),t[t.length-1]),n}getDistance=(t,e)=>$i(t,e);getAngle=(t,e)=>Mr(t,e)};s(Ff,"Navigator");var Qa=Ff;d();function io(r){return[r.longitude,r.latitude]}s(io,"convertCoordinateToPosition");function pM(r){return new Map(r.map(t=>{let{properties:e}=t,{id:i}=e;return[i,t]}))}s(pM,"getEntranceMap");var Bf=s((r,t)=>{let e=pM(t),i={type:"Feature",properties:{id:r[0].properties.id},geometry:{type:"MultiLineString",coordinates:[]}};for(let n of r){let o=[n.geometry.coordinates],a=(n.properties.entrances||[]).reduce((l,u)=>(e.has(u)&&l.push(e.get(u)),l),[]);a.length&&(o=th(n,a).map(l=>l.geometry.coordinates)),i.geometry.coordinates.push(...o)}return i},"cutEntracesFromLineStrings");function Pb(r,t){let e={options:{}};if(!e.options)throw new Error("options should exist");return r.appearance&&(e.options.appearance=r.appearance),r.rank!=null&&(r.rank==="initial"?e.options.rank=t.initialRank||2:e.options.rank=r.rank),r.enabled!==void 0&&(e.enabled=r.enabled),r.interactive!==null&&(e.options.interactive=r.interactive),e}s(Pb,"translateLabelStateToGeojsonCore");function Mb(r,t){let e={options:{}};if(!e.options)throw new Error("options should exist");return r.rank!=null&&(r.rank==="initial"?e.options.rank=t.initialRank||2:e.options.rank=r.rank),r.enabled!==void 0&&(e.enabled=r.enabled),r.interactive!==null&&(e.options.interactive=r.interactive),e}s(Mb,"translateMarkerStateToGeojsonCore");function Tb(r,t){let e={};return t==null||(r.color&&(r.color==="initial"?e.color=t.initialColor:e.color=r.color),r.hoverColor&&(e.hoverColor=r.hoverColor),r.interactive!==void 0&&(e.interactive=r.interactive)),e}s(Tb,"translateSpaceStateToGeojsonCore");function wb(r,t){return((t-r+Math.PI)%(Math.PI*2)+Math.PI*2)%(Math.PI*2)-Math.PI}s(wb,"differenceBetweenAngles");function Ib(r,t){let e="Left";return r<=-Math.PI/4?e="Right":r<=-t?e="SlightRight":r<=t?e="Straight":r<=Math.PI/4?e="SlightLeft":e="Left",e}s(Ib,"getRelativeBearing");function Eb(r){let t={};for(let e in r){let i=r[e];if(i!=null){if(i.id=e,"polygons"in i)for(let n of i.polygons)t[n]=i;else if("lineStrings"in i)for(let n of i.lineStrings)t[n]=i;else if("points"in i)for(let n of i.points)t[n]=i}}return t}s(Eb,"extractStyleMap");function Gf(r,t){return r.reduce((e,i)=>{let n=t[i.properties.id];return n==null||(e.has(n)||e.set(n,[]),e.get(n).push(i)),e},new Map)}s(Gf,"groupGeometryByStyle");var _b=Math.PI*.1,Kt,tr,be,Yu,Lb,ts,Vf,ju,Ob,Hf=class Hf{constructor(t,e){T(this,Yu);T(this,ts);T(this,ju);T(this,Kt,{});T(this,tr,void 0);T(this,be,void 0);E(this,tr,e),E(this,be,t.features),E(this,tr,e),E(this,be,t.features)}get coordinates(){return c(this,Kt).coordinates?c(this,Kt).coordinates:(c(this,Kt).coordinates=c(this,be).map(t=>new $(t.geometry.coordinates[1],t.geometry.coordinates[0],t.properties.groupBy)),c(this,Kt).coordinates)}get distance(){return c(this,Kt).distance?c(this,Kt).distance:(c(this,Kt).distance=c(this,be).reduce((t,e)=>t+(e.properties.distance||0),0),c(this,Kt).distance)}get instructions(){if(c(this,be).length<2)return[];if(c(this,Kt).instructions)return c(this,Kt).instructions;let t=[],e=0;for(let i=0;i<c(this,be).length;i++){let n=c(this,be)[i],o=c(this,be)[i-1],a=c(this,be)[i+1],l=new $(n.geometry.coordinates[1],n.geometry.coordinates[0],n.properties.groupBy),u=j(this,Yu,Lb).call(this,{prevDirection:o,direction:n,nextDirection:a});e+=(o==null?void 0:o.properties.distance)||0;for(let h of u)h&&(t.push({action:h,distance:e,coordinate:l}),e=0)}return c(this,Kt).instructions=t,c(this,Kt).instructions}};Kt=new WeakMap,tr=new WeakMap,be=new WeakMap,Yu=new WeakSet,Lb=s(function(t){let{prevDirection:e,direction:i,nextDirection:n}=t,o=e&&c(this,tr).getById("floor",e.properties.groupBy),a=c(this,tr).getById("floor",i.properties.groupBy),l=n&&c(this,tr).getById("floor",n.properties.groupBy),u=[];if(e||u.push({type:"Departure"}),l&&a.id!==l.id){let h=c(this,tr).getMVFFeatureByNodeId("connection",i.properties.id);u.push(j(this,ts,Vf).call(this,"TakeConnection",a,l,h==null?void 0:h.type))}else if(o&&o.id!==a.id){let h=c(this,tr).getMVFFeatureByNodeId("connection",i.properties.id);u.push(j(this,ts,Vf).call(this,"ExitConnection",a,o,h==null?void 0:h.type))}else u.push(j(this,ju,Ob).call(this,e,i));return n||u.push({type:"Arrival"}),u},"#getActions"),ts=new WeakSet,Vf=s(function(t,e,i,n){let o=e.elevation-i.elevation,a="none";return o>0?a="down":o<0&&(a="up"),{type:t,fromFloor:e,toFloor:i,direction:a,connectionType:n!=null?n:"stairs"}},"#createConnectionAction"),ju=new WeakSet,Ob=s(function(t,e){let i=t?-wb(t.properties.angle,e.properties.angle):0;return Math.abs(i)>=_b?{type:"Turn",bearing:Ib(i,_b),referencePosition:"At"}:null},"#createTurnAction"),s(Hf,"Directions");var Hu=Hf,Xf=class Xf{navigator;connections;constructor({nodes:t,obstructions:e,connections:i,groupBy:n}){this.navigator=new Qa({nodes:t,obstructions:this.createObstructionCollection(e),groupBy:n}),this.connections=i}getDirections=(t,e,i,n)=>{let{accessible:o,smoothing:{enabled:a,radius:l}}=i,u=t.flatMap(x=>this.getNodesFromTarget(x,n)),h=e.flatMap(x=>this.getNodesFromTarget(x,n)),f=this.getExcludedNodeIds(o).filter(x=>!u.includes(x)&&!h.includes(x)),m=this.navigator.getDirections({originIds:u,destinationNodeIds:h,excludedNodeIds:f,simplify:{enabled:a,bufferRadius:l}});this.addCoordinateDirections(m,t,e);let y=new Hu(m,n);if(!(y.distance===0&&new Set([...u,...h]).size===u.length+h.length))return y};getExcludedNodeIds=t=>t?this.connections.reduce((e,i)=>i.accessible?e:e.concat(i.nodes),[]):[];addCoordinateDirections=(t,[e],[i])=>{if(t.features.length){if($.is(e)){let n=this.createDirectionFeature(e,this.navigator.getAngle([e.longitude,e.latitude],t.features[0].geometry.coordinates),this.navigator.getDistance([e.longitude,e.latitude],t.features[0].geometry.coordinates));t.features.splice(0,0,n)}if($.is(i)){let n=this.createDirectionFeature(i,0,0),o=t.features[t.features.length-1];o.properties.distance=this.navigator.getDistance(o.geometry.coordinates,[i.longitude,i.latitude]),o.properties.angle=this.navigator.getAngle(o.geometry.coordinates,[i.longitude,i.latitude]),t.features.push(n)}}};getNodesFromTarget=(t,e)=>{if($.is(t)){let i=this.navigator.findNearestNode(this.createCoordinateFeature(t));return i?[i.properties.id]:[]}else if(Yr.is(t)){let i=this.navigator.findNearestNode(this.createCoordinateFeature(t.coordinate));return i?[i.properties.id]:[]}else if(Vr.is(t)){let i=this.navigator.findNearestNode(this.createCoordinateFeature(t.center));return i?[i.properties.id]:[]}else if(we.is(t)){let i=e==null?void 0:e.getMVFFeatureById("space",t.id);return i==null?[]:i.properties.destinationNodes}else{if(jr.is(t))return t.coordinates.reduce((i,n)=>{let o=this.navigator.findNearestNode(this.createCoordinateFeature(n));return o&&i.push(o.properties.id),i},[]);if(Ie.is(t)){let i=e==null?void 0:e.objectEntranceNodeIdsByObstructionId[t.id];return i!=null?i:[]}else return[]}};createObstructionCollection(t){return{type:"FeatureCollection",features:Object.entries(t).reduce((e,[i,n])=>e.concat(n.features.map(o=>(o.properties.map=i,o))),[])}}createCoordinateFeature=t=>({type:"Feature",geometry:{type:"Point",coordinates:[t.longitude,t.latitude]},properties:{map:t.floorId}});createDirectionFeature=(t,e,i)=>({type:"Feature",geometry:{type:"Point",coordinates:[t.longitude,t.latitude]},properties:{groupBy:t.floorId,id:t.id,angle:e,distance:i}})};s(Xf,"DirectionsInternal");var Xu=Xf;d();var no,Yf=class Yf{constructor({currentMapGetter:t}){T(this,no,void 0);E(this,no,t)}get currentMap(){return c(this,no).call(this)}async getCurrentSceneGLTF(t){let e=c(this,no).call(this);return e?e==null?void 0:e.Exporter.getCurrentSceneGLTF(t):(H.error("There is no map to export. Please load a map first."),new Blob)}};no=new WeakMap,s(Yf,"Exporter");var es=Yf;d();var er,is,jf=class jf{constructor({currentMapGetter:t}){T(this,er,new Map);T(this,is,void 0);E(this,is,t)}get currentMap(){return c(this,is).call(this)}getById(t){return c(this,er).get(t)}add(t,e,i){let n=Xr(t);if(!n)throw new Error("get coordinate failed");let o=this.currentMap;if(!o)throw new Error("currentMap should exist");let a=o.Labels.add(io(n),e,{...i,floorId:n.floorId,rank:(i==null?void 0:i.rank)||"medium"}),l=new ri(a.id.toString(),e);return c(this,er).set(l.id,{label:l,entityId:l.id}),l}all(){var e;let t=[];return(e=this.currentMap)==null||e.Labels.all({onCreate:(i,n)=>{let o=new ri(i.toString(),n);c(this,er).set(o.id,{label:o,entityId:o.id}),t.push(o)}}),t}remove(t){var i;let e=c(this,er).get(t.id);e&&((i=this.currentMap)==null||i.Labels.remove(e.entityId),c(this,er).delete(t.id.toString()))}removeAll(){let t=[];return c(this,er).forEach(({label:e})=>{this.remove(e),t.push(e),c(this,er).delete(e.id.toString())}),t}};er=new WeakMap,is=new WeakMap,s(jf,"Labels");var rs=jf;d();d();var Db={altitude:0,height:1,color:"#ffffff",opacity:1,width:.15},Wf=class Wf{id;name;elevation;containerId;loaded=!1;styleMap={};obstructions;entrances;spaces;renderer;options;layers=new Map;constructor(t,e,i,n,o,a){this.id=e.id,this.options=n;let l=i.addGroupContainer(this.id,{visible:!1},t);this.containerId=l.id.toString(),this.name=e.externalId,this.elevation=e.elevation,o!=null&&a!=null&&(this.styleMap=a,this.spaces=o.space[this.id],this.entrances=o.entrance[this.id],this.obstructions=o.obstruction[this.id]),this.renderer=i}load=()=>{var t,e;if(this.loaded||this.obstructions==null&&this.spaces==null)return this;if(this.loaded=!0,this.spaces!=null&&this.spaces.features.length>0){let i=this.spaces.features.filter(l=>{var u;return l.geometry.type==="Polygon"&&((u=l.properties.kind)==null?void 0:u.toLowerCase())!=="void"}),n=Gf(i,this.styleMap),o=this.renderer.addGroupContainer(`spaces-${this.id}`,{},this.id),a=0;for(let[l,u]of n){let h=this.renderer.addGeometryGroup(`Spaces-${this.id}-${a}`,{features:u},l,o);a++;let f=h.id.toString();this.layers.set(l.id||f,h.id.toString())}}if(this.obstructions!=null&&this.obstructions.features.length>0){let i=this.obstructions.features.filter(y=>y.geometry.type==="Polygon"&&y.properties.kind==="object"),n=Gf(i,this.styleMap),o=this.renderer.addGroupContainer(`objects-${this.id}`,{},this.id),a=0;for(let[y,x]of n){let S=this.renderer.addGeometryGroup(`Objects-${this.id}-${a}`,{features:x},y,o);a++;let P=S.id.toString();this.layers.set(y.id||P,P)}let l=this.obstructions.features.filter(y=>y.geometry.type==="LineString"&&y.properties.kind==="Wall"&&y.properties.footprintComponent===!1),u=this.obstructions.features.filter(y=>y.geometry.type==="LineString"&&y.properties.kind==="Wall"&&y.properties.footprintComponent===!0),h=this.entrances,f=Db,m=Db;if(l!=null&&l.length>0){let y=this.styleMap[(t=l[0].properties)==null?void 0:t.id];y!=null&&(f={...y}),m=f,this.options.wallTopColor!=null&&(f.topColor=this.options.wallTopColor);let x=this.renderer.addGeometryGroup(`Walls-${this.id}`,{features:[Bf(l,(h==null?void 0:h.features)||[])]},f,this.id),S=x.id.toString();this.layers.set(f.id||S,x.id.toString())}if(u!=null&&u.length>0){let y=this.styleMap[(e=u[0].properties)==null?void 0:e.id];y!=null&&(m={...y,id:y.id+"-exterior"}),this.options.wallTopColor!=null&&(m.topColor=this.options.wallTopColor);let x=this.renderer.addGeometryGroup(`ExteriorWalls-${this.id}`,{features:[Bf(u,(h==null?void 0:h.features)||[])]},m,this.id),S=x.id.toString();this.layers.set(m.id||S,x.id.toString())}}return this.renderer.render(),this}};s(Wf,"FloorObject");var Wu=Wf;var Ji=wr(Un());d();var ns=wr(Un());var Uu=30,hM=1e3,oo,os,Uf=class Uf extends nt{constructor(e,i){super();this.api=e;this.core=i;T(this,oo,void 0);T(this,os,0);v(this,"includedFloors",[]);v(this,"expanded",!1);i.on("camera-change",n=>{var l;let o=Math.floor(n.elevation/Uu),a=(l=this.includedFloors[o])==null?void 0:l.id;this.expanded&&a&&a!==this.api.currentFloorId&&(this.api.currentFloorId=this.includedFloors[o].id,this.api.publish("floor-change",{reason:"elevation-change",floorId:this.api.currentFloorId}))})}get percentExpanded(){return c(this,os)}set percentExpanded(e){let i=le(e,0,1,0,Uu);this.includedFloors.forEach((n,o)=>{this.core.setState(n.containerId,{visible:!0,altitude:i*o})}),E(this,os,e)}animateToCurrentFloor(){let e=this.includedFloors.indexOf(this.api.currentFloor)*Uu;new ns.default.Tween({elevation:this.core.camera.elevation}).to({elevation:e},1e3).easing(ns.default.Easing.Quadratic.Out).onUpdate(({elevation:i})=>{this.core.camera.setElevation(i),this.core.render()}).onComplete(()=>{this.api.publish("floor-change",{reason:"",floorId:this.api.currentFloorId})}).start(),this.core.render()}expand(e){return this.includedFloors=this.api.floors.filter(i=>!(e!=null&&e.excludeFloorIds.includes(i.id))),this.includedFloors.length<=1?Promise.resolve():this.animate("expand")}collapse(){return this.expanded===!0?this.animate("collapse"):Promise.resolve()}animate(e){c(this,oo)&&c(this,oo).stop();let i=this.includedFloors.indexOf(this.api.currentFloor)*Uu;return new Promise(n=>{E(this,oo,new ns.default.Tween({percentExpanded:this.percentExpanded}).to({percentExpanded:e==="expand"?1:"0"},hM).easing(ns.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()})}};oo=new WeakMap,os=new WeakMap,s(Uf,"StackedMaps");var Zu=Uf;var dM={linear:Ji.default.Easing.Linear.None,"ease-in":Ji.default.Easing.Quadratic.In,"ease-out":Ji.default.Easing.Quadratic.Out,"ease-in-out":Ji.default.Easing.Quadratic.InOut},Zf=class Zf extends nt{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))}Markers={add:(t,e,i={})=>{let{floorId:n,...o}=i,a=i!=null&&i.floorId?this.floors.find(l=>l.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){H.error(`Failed to retrieve state for Marker with id "${t}".`);return}if(n.type!=="marker"){H.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 H.error(`Failed to retrieve state for Marker with id "${t}".`),Promise.resolve();if(o.type!=="marker")return H.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 l;new Ji.default.Tween({lon:o.position[0],lat:o.position[1]}).to({lon:e[0],lat:e[1]},a.duration).easing(dM[a.easing]).onUpdate(({lon:h,lat:f})=>{this.Markers.setPosition(t,[h,f],i),this.renderer.render()}).onComplete(()=>{l()}).start();let u=new Promise(h=>{l=h});return this.renderer.render(),u}};Exporter={getCurrentSceneGLTF:async t=>this.renderer.getCurrentSceneGLTF(t)};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 l=(f=this.styleMap[a.properties.id])==null?void 0:f.showImage,u=(m=a.properties.details)==null?void 0:m.images,h;if(l&&u&&u.length>0&&(h={marker:{icon:u[0].url}}),a.properties.center&&a.properties.externalId!==""){let y=this.renderer.addLabel2D(a.properties.center,a.properties.externalId,{id:a.properties.id,appearance:h},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(u=>u.id===(i==null?void 0:i.floorId)):this.floors[0],l=this.renderer.addLabel2D(t,e,o,a.containerId);if(!l)throw new Error("label creating failed");return l},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 u of t){let{floorId:h="root",latitude:f,longitude:m}=u;h!==o&&(a++,o=h),n[a]==null&&n.push({floorId:h,coordinates:[]}),n[a].coordinates.push([m,f])}let l=n.map(({floorId:u,coordinates:h})=>this.renderer.addPath({type:"FeatureCollection",features:h.map(f=>({type:"Feature",properties:{},geometry:{type:"Point",coordinates:f}}))},e,u));new Ji.default.Tween({fraction:0}).to({fraction:1},(e==null?void 0:e.drawDuration)||1e3).onUpdate(({fraction:u})=>{l.forEach(h=>{this.renderer.setState(h.id,{completeFraction:u})})}).onComplete(()=>{i(l)}).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 Zu(this,this.renderer),this.mvf=e,this.styleMap=i,this.floors=this.mvf["map.geojson"].sort((a,l)=>a.elevation-l.elevation).map(a=>{var u,h;if(t!=="outdoors-container"&&((u=e.space[a.id])==null?void 0:u.features.length)===0&&((h=e.obstruction[a.id])==null?void 0:h.features.length)===0)return;let l=new Wu(t,a,this.renderer,n,e,i);return l.load(),l}).filter(Boolean),this.setFloor(this.floors[0].id)}};s(Zf,"GeojsonApiMapObject");var as=Zf;d();var ke,ls,zf=class zf{constructor({currentMapGetter:t}){T(this,ke,new Map);T(this,ls,void 0);E(this,ls,t)}get currentMap(){return c(this,ls).call(this)}getById(t){return c(this,ke).get(t)}add(t,e,i){let n=Xr(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(io(n),e,{...i,floorId:n.floorId,rank:(i==null?void 0:i.rank)||"medium",dynamicResize:(i==null?void 0:i.dynamicResize)||!1}),l=o.Markers.getContentEl(a.toString());if(!l)throw new Error("marker component should exist");let u=new Ui(a.toString(),l,()=>{});return c(this,ke).set(u.id,{marker:u,entityId:a.toString()}),u}remove(t){var i;let e=c(this,ke).get(t.id);e&&((i=this.currentMap)==null||i.Markers.remove(e.entityId),c(this,ke).delete(t.id.toString()))}removeAll(){let t=[];return c(this,ke).forEach(({marker:e})=>{this.remove(e),t.push(e),c(this,ke).delete(e.id.toString())}),t}setPosition(t,e){var a;let i=Xr(e);if(!i){H.error("Cannot determine coordinate from target.");return}let n=this.currentMap;if(!n){H.error("Cannot determine the current map.");return}let o=c(this,ke).get(t.id);if(!o){H.error(`Cannot find the Marker with id "${t.id}".`);return}n.Markers.setPosition(o.entityId,io(i),(a=i.floorId)!=null?a:n.currentFloorId)}animateTo(t,e,i){var l;let n=Xr(e);if(!n)return H.error("Cannot determine coordinate from target."),Promise.resolve();let o=this.currentMap;if(!o)return H.error("Cannot determine the current map."),Promise.resolve();let a=c(this,ke).get(t.id);return a?o.Markers.animateTo(a.entityId,io(n),(l=n.floorId)!=null?l:o.currentFloorId,i):(H.error(`Cannot find the Marker with id "${t.id}".`),Promise.resolve())}};ke=new WeakMap,ls=new WeakMap,s(zf,"Markers");var ss=zf;d();var Tr,cs,qf=class qf{constructor({currentMapGetter:t}){T(this,Tr,new Map);T(this,cs,void 0);E(this,cs,t)}get currentMap(){return c(this,cs).call(this)}getById(t){return c(this,Tr).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 Ua(vt());return c(this,Tr).set(o.id,{path:o,entityIds:n.map(a=>a.id.toString())}),o}remove(t){var i;let e=c(this,Tr).get(t.id);e&&((i=this.currentMap)==null||i.Paths.remove(e.entityIds),c(this,Tr).delete(t.id.toString()))}removeAll(){let t=[];return c(this,Tr).forEach(({path:e})=>{this.remove(e),t.push(e),c(this,Tr).delete(e.id.toString())}),t}};Tr=new WeakMap,cs=new WeakMap,s(qf,"Paths");var us=qf;d();var zu=wr(Un());d();var Ab="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAkklEQVRoge3awQ3AIAxD0VAMYf+F0yUixbL8JshXuLSwIqJCwDc9QBeZEOy9p2doAQDTM7TQ2cg5Z3qGFjpHS2YjDiGDe+/0DC0cwkYpJKdnaIFMkY1kymzEIVQcwsYhbPDem56hhc5GHELGIWwcwsYhbJS+2R1CxSFsdH5iO4SMr97Y6FxPqxytVVV+HcTEIWx+9mcIqHSOm9QAAAAASUVORK5CYII=";d();var Nb=s((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,l=new Ge;l.moveTo(n*Math.cos(r/2)-i,n*Math.sin(r/2));for(let u=0;u<a;u++)l.lineTo(o*Math.cos(r/2-r/a*u)-i,o*Math.sin(r/2-r/a*u));for(let u=0;u<a;u++)l.lineTo(e*Math.cos(Math.PI/-2+Math.PI/a*u),e*Math.sin(Math.PI/-2+Math.PI/a*u));return new Ve(l,{depth:.1,bevelEnabled:!1,UVGenerator:mM(t)})},"createSectorGeometry"),$f=s((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 W(0,n)},"generateRadialUV"),mM=s(r=>({generateTopUV:(t,e,i,n,o)=>{let a=e[i*3],l=e[i*3+1],u=e[n*3],h=e[n*3+1],f=e[o*3],m=e[o*3+1];return[$f(a,l,r),$f(u,h,r),$f(f,m,r)]},generateSideWallUV:()=>[new W(0,1),new W(0,1),new W(0,1),new W(0,1)]}),"radialUVGenerator");var Jf="#2266ff",yM=.7,gM=.3;function Rb(){let r=new on({color:Jf,opacity:yM,transparent:!0,depthTest:!1,depthWrite:!1}),t=Nb(Math.PI/6,Bb,Fb);new an().load(Ab,i=>{r.alphaMap=i,r.needsUpdate=!0});let e=new jt(t,r);return e.position.z=-.05,e.renderOrder=3,e}s(Rb,"createBearingCone");var kb=s(()=>{let r=new Ku(.5,.5,.05,32),t=new on({transparent:!0,color:Jf,opacity:gM,depthTest:!1,depthWrite:!1}),e=new jt(r,t);e.scale.set(0,0,.05),e.renderOrder=2;let i=new Ku(Kf,Kf,.05,32),n=new on({transparent:!0,color:Jf,depthTest:!1,depthWrite:!1}),o=new jt(i,n);return o.renderOrder=3,e.rotation.x=Math.PI/2,o.rotation.x=Math.PI/2,{baseMesh:e,middleMesh:o}},"createBlueDot");var vM={enableHighAccuracy:!0},bM=500,CM=150,xM=150,SM=0,PM=5,MM=5,TM=30,Fb=.4,Bb=1.25,Kf=.35,Qf=class Qf extends nt{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}=kb(),o=Rb();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,vM)}updateGeometryPerFrame=e=>{var u;let[i,n,o]=e.children,{accuracy:a,heading:l}=((u=this.currentGeolocation)==null?void 0:u.coords)||{};a!=null&&(this.scaleAnimation&&this.scaleAnimation.stop(),this.scaleAnimation=new zu.default.Tween({scale:i.scale.x}).to({scale:le(a,MM,TM,SM,PM)},CM).onUpdate(({scale:h})=>{i.scale.set(h,1,h)}).start()),l!=null?(o.visible=!0,this.rotationAnimation&&this.rotationAnimation.stop(),this.rotationAnimation=new zu.default.Tween({rotation:i.scale.x}).to({rotation:st.degToRad(l)},xM).onUpdate(({rotation:h})=>{o.rotation.z=h}).start()):o.visible=!1};onPositionUpdate=e=>{var i;if(this.currentGeolocation=e,this.geometry){let n=this.core.getState(this.geometry);n.visible===!1&&this.core.setState(this.geometry,{position:[e.coords.longitude,e.coords.latitude],visible:!0}),this.positionAnimation&&this.positionAnimation.stop(),n=this.core.getState(this.geometry);let o;if(e.coords.floorLevel!==void 0){let a=(i=this.geoJSONApi.currentMap)==null?void 0:i.floors[e.coords.floorLevel];o=a==null?void 0:a.id}this.positionAnimation=new zu.default.Tween(n.position).to([e.coords.longitude,e.coords.latitude],bM).onUpdate(a=>{if(this.geometry){let l={position:a};o==null&&n.parent!=="outdoors-container"?l.parent="outdoors-container":n.parent!==o&&(l.parent=o,this.publish("floor-change",{reason:"blue-dot-floor-change",floorId:o})),this.core.setState(this.geometry,l)}}).start(),this.core.render()}};onPositionError=e=>{switch(e.code){case e.PERMISSION_DENIED:H.error("Geolocation permission denied by the user.",e);break;case e.POSITION_UNAVAILABLE:H.error("Geolocation position unavailable.",e);break;case e.TIMEOUT:H.error("Geolocation request timed out.",e);break;default:H.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}};s(Qf,"BlueDot");var qu=Qf;d();var ps,tm=class tm{constructor({currentMapGetter:t}){T(this,ps,void 0);E(this,ps,t)}get currentMap(){return c(this,ps).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 l=a.layers.get(o);(i=this.currentMap)==null||i.renderer.setState(l,{color:t[o].color})}if(a.layers.has(o+"-exterior")&&"color"in t[o]){let l=a.layers.get(o+"-exterior");(n=this.currentMap)==null||n.renderer.setState(l,{color:t[o].color})}}}};ps=new WeakMap,s(tm,"Style");var $u=tm;var em=class em{core;outdoors;mapObjects=[];id;mapDataExternal={};mapsByFloorId={};mapData;currentMap;directions;mapView;Camera;Labels;Markers;Paths;Exporter;Navigation;BlueDot;Style;constructor(t,e){this.core=t,this.mapView=e,this.Camera=new Ja(this.core),this.id=this.core.addGroupContainer("root").id.toString(),this.outdoors=new as("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 Za(this.Camera);this.core.on("camera-change",()=>{this.mapView.publish("camera-change",i)});let n=s(l=>u=>{var S,P;let h=[],f=[];u.labels.forEach(g=>{let C=this.Labels.getById(g.toString());C&&h.push(C.label)}),u.markers.forEach(g=>{let C=this.Markers.getById(g.toString());C&&f.push(C.marker)});let m=u.geometry[0],y;m&&(y=(S=this.getMapData())==null?void 0:S.getById("space",m)),y||(y=(P=this.getMapData())==null?void 0:P.getById("object",m));let x={coordinate:new $(u.coordinate[1],u.coordinate[0]),spaces:y&&we.is(y)?[y]:[],objects:y&&Ie.is(y)?[y]:[],markers:f,labels:h,floors:[]};"pointerEvent"in u&&(x.pointerEvent=u.pointerEvent),this.mapView.publish(l,x)},"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=s(()=>this.currentMap,"currentMapGetter");this.Markers=new ss({currentMapGetter:o}),this.Labels=new rs({currentMapGetter:o}),this.Exporter=new es({currentMapGetter:o}),this.Paths=new us({currentMapGetter:o}),this.Navigation=new Du(e),this.BlueDot=new qu(this.core,this),this.BlueDot.on("floor-change",l=>{this.setFloor(l.floorId,"blue-dot-floor-change")}),this.Style=new $u({currentMapGetter:o});let a=new Bu(e,this.mapDataExternal);this.auto=a.auto}updateState(t,e){var n;if(t==="walls"){(n=this.currentMap)==null||n.floors.forEach(o=>{var u,h;let a=o.layers.get("Walls"),l=o.layers.get("Walls-exterior");a&&((u=this.core.getState(a))==null||u.children.forEach(f=>{this.core.setState(f.id,e)})),l&&((h=this.core.getState(l))==null||h.children.forEach(f=>{this.core.setState(f.id,e)}))});return}let i=typeof t=="string"?this.getMapDataObject(t):t;if(i){if(ri.is(i))return this.core.setState(i.id,Pb({...e,type:"label"},this.core.getState(i.id)));if(Ui.is(i))return this.core.setState(i.id,Mb({...e,type:"marker"},this.core.getState(i.id)));(we.is(i)||Ie.is(i))&&this.core.setState(i.id,Tb({...e,type:"geometry"},this.core.getState(i.id)))}}getMapDataObject(t){var e;return(e=this.getMapData())==null?void 0:e.getMapDataById(t)}update=()=>{this.core.render()};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=ec.get(t);if(!n){H.error("error exists"),i(t);return}this.mapDataExternal[t.mapName]=t;let{mvf:o}=n,a=o["manifest.geojson"].features[0].geometry.coordinates;this.Camera.set({center:new $(a[0],a[1])});let l=Eb(o["styles.json"]||{}),u=o["manifest.geojson"].features[0].properties.name,h=new as(`mapObject-${u}`,o,l,e,this.core),f=this.core.getBoundingBox(h.currentFloor.id),m=(x=(y=e==null?void 0:e.outdoorView)==null?void 0:y.layersHiddenByGeometry)!=null?x:[];if(m.length>0){let P=(S=this.core.getCenter(f))!=null?S:a;this.core.hideOutdoorLayersUnderPoint(P,m)}this.mapObjects.push(h),o["map.geojson"].forEach(P=>{this.mapsByFloorId[P.id]=h}),h.StackedMaps.on("expanded",()=>{this.mapView.publish("expanded")}),h.StackedMaps.on("collapsed",()=>{this.mapView.publish("collapsed")}),h.on("floor-change-start",()=>{this.mapView.publish("floor-change-start",{floor:this.currentFloor})}),h.on("floor-change",P=>{this.mapView.publish("floor-change",{reason:P.reason,floor:this.currentFloor})}),this.currentMap=h,this.mapData=n,this.directions=new Xu({nodes:this.currentMap.mvf["node.geojson"],obstructions:this.currentMap.mvf.obstruction,connections:this.currentMap.mvf["connection.json"],groupBy:"map"}),e!=null&&e.zoomLevel||this.core.camera.focusOn(f,{duration:0,padding:{top:.05*this.core.canvasHeight,left:.05*this.core.canvasWidth,right:.05*this.core.canvasWidth,bottom:.05*this.core.canvasHeight}}),i(t)})}setFloor(t,e){if(!this.currentMap)throw new Error("mappObject should exist atm");this.currentMap.setFloor(typeof t=="string"?t:t.id,e)}get currentFloor(){var i,n;let t=(i=this.currentMap)==null?void 0:i.currentFloor.id;if(!t)throw new Error("Missing currentFloor object from GeoJsonApi");let e=(n=this.mapData)==null?void 0:n.getById("floor",t);if(!e)throw new Error("Missing currentFloor");return e}getState(t){var n;let e=typeof t=="string"?t:t.id,i=this.core.getState(e);if(i){if(i.type==="geometry")return{type:"geometry",interactive:i.interactive,hoverColor:i.hoverColor,color:i.color};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 $(i.position[1],i.position[0],o.toString())}}}}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{accessible:n=!1,smoothing:o=!0}=i||{},a=Array.isArray(t)?t:[t],l=Array.isArray(e)?e:[e],u=typeof o=="object"?o.enabled:o,h=typeof o=="object"?o.radius:void 0,f={accessible:n,smoothing:{enabled:u!=null?u:!0,radius:h!=null?h:.75}};return this.directions.getDirections(a,l,f,this.mapData)};createCoordinate(t,e,i){return new $(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 $(n[1],n[0],(i==null?void 0:i.id)||this.currentFloor.id):void 0}auto(){this.Labels.all()}Outdoor={setStyle:t=>{var e,i;(e=this.core.map)==null||e.setStyle(t),(i=this.core.map)==null||i.moveLayer(ra)}};get __core(){return this.core}destroy(){this.core.destroy()}};s(em,"GeoJsonApi");var hs=em;var ds,et,rm=class rm extends nt{constructor(e){super();T(this,ds,{});T(this,et,void 0);v(this,"Camera");v(this,"Labels");v(this,"Markers");v(this,"Paths");v(this,"Exporter");v(this,"Navigation");v(this,"BlueDot");v(this,"Style");v(this,"update",()=>{c(this,et).core.render()});v(this,"getDirections",(e,i,n)=>c(this,et).getDirections(e,i,n));v(this,"Outdoor");v(this,"on",(e,i)=>{super.on(e,i)});v(this,"off",(e,i)=>{super.off(e,i)});let i=new hs(e,this);E(this,et,i),this.Camera=c(this,et).Camera,E(this,ds,c(this,et).mapDataExternal),this.Markers=c(this,et).Markers,this.Labels=c(this,et).Labels,this.Exporter=c(this,et).Exporter,this.Paths=c(this,et).Paths,this.Navigation=c(this,et).Navigation,this.BlueDot=c(this,et).BlueDot,this.Style=c(this,et).Style,this.auto=c(this,et).auto,this.Outdoor={setStyle:n=>{c(this,et).Outdoor.setStyle(n)},get map(){return i.core.map}}}updateState(e,i){return c(this,et).updateState(e,i)}getMapData(){return c(this,ds)}expand(e){return c(this,et).expand(e)}collapse(){return c(this,et).collapse()}addMap(e,i){return c(this,et).addMap(e,i)}setFloor(e){c(this,et).setFloor(e)}get currentFloor(){return c(this,et).currentFloor}getState(e){return c(this,et).getState(e)}setHoverColor(e){c(this,et).setHoverColor(e)}getHoverColor(){return c(this,et).getHoverColor()}createCoordinate(e,i,n){return c(this,et).createCoordinate(e,i,n)}createCoordinateFromScreenCoordinate(e,i,n){return c(this,et).createCoordinateFromScreenCoordinate(e,i,n)}auto(){this.Labels.all()}get __core(){return c(this,et).core}destroy(){c(this,et).destroy()}};ds=new WeakMap,et=new WeakMap,s(rm,"MapView");var Ju=rm;var wM={auto:!0,debug:!1,pitch:45,bearing:0,antialiasing:{enabled:!0}},WU=s(async(r,t)=>{let e;if(t){let{access_token:o}=await Ss(t);e=o}let i=new Wo(r,e);return new rc(i)},"hydrateMapDataFromMVF"),UU=s(async r=>{let t={emitAnalyticsEvents:!0,...r},e;if("accessToken"in t)e=t.accessToken;else{let{access_token:u}=await Ss(t);e=u}let i=await oc(t,e),n=await sc(i),o=ac(n);typeof r.onMVFParsed=="function"&&r.onMVFParsed(o);let a=new Wo(o,e);return new rc(a)},"getMapData"),IM=s(async(r,t,e)=>{var a,l,u,h;let i={...wM,...e!=null?e:{},outdoorView:{token:t.outdoorViewToken,layersHiddenByGeometry:["building","building-top"],...e==null?void 0:e.outdoorView}},n=await sb(r,{center:[t.mapCenter.longitude,t.mapCenter.latitude],bearing:i.bearing,pitch:i.pitch,zoomLevel:i.zoomLevel,outdoorView:(a=i.outdoorView)!=null&&a.token?{headers:{"x-mappedin-tiles-key":(l=i.outdoorView)==null?void 0:l.token},style:(u=i.outdoorView)==null?void 0:u.style,enabled:!0}:void 0,watermark:i.watermark,attribution:i.attribution,antialias:typeof i.antialiasing=="boolean"?i.antialiasing:!!((h=i.antialiasing)!=null&&h.enabled)}),o=new Ju(n);return await o.addMap(t,i),o},"show3dMapGeojson"),ZU=IM;export{Mn as Annotation,jr as Connection,$ as Coordinate,Vr as Door,Pl as Floor,Sl as Hyperlink,Ml as Image,Ie as MapObject,Yr as PointOfInterest,we as Space,K2 as enableTestMode,UU as getMapData,WU as hydrateMapDataFromMVF,ac as parseMVF,ZU as show3dMap,IM as show3dMapGeojson,sc as unzipMVF};