@mappedin/mappedin-js 6.16.0 → 6.17.1

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.
@@ -0,0 +1 @@
1
+ import{$a as bd,$b as $d,Aa as od,Ab as Dc,Ba as sd,Bb as Pc,C as pc,Ca as On,Cb as qs,D as Ch,Da as ad,Db as Gd,Ea as bi,Eb as Nd,Fa as ld,Fb as Ic,Gb as Bd,Ha as cd,Hb as kd,I as Dn,Ia as Ws,Ib as Oc,J as fc,Ja as ud,Jb as zd,K as wh,Ka as hd,Kb as an,La as dd,Lb as Js,Ma as md,Mb as Lc,Na as Ec,Nb as Ud,Oa as pd,Ob as Hd,Pa as fd,Pb as Ac,Q as gc,Qa as vi,Qb as Vd,Ra as gd,Rb as ao,S as yc,Sa as js,Sb as Rc,Ta as Cc,Tb as Qs,Ua as yd,Ub as Wd,Va as Zs,Vb as _c,W as Kh,Wa as oo,Wb as jd,Xa as Gr,Xb as Zd,Y as to,Ya as Xs,Yb as Xd,Za as on,Zb as Yd,_a as sn,ac as qd,b as xh,ba as ro,bc as Jd,cb as vd,cc as Qd,d as $,da as no,db as Ys,dc as vr,e as ai,ea as ed,eb as xd,ec as Kd,f as qi,fa as td,fb as so,fc as lt,g as li,ga as rd,gb as Sd,gc as em,h as Cs,ha as ks,hb as Md,hc as Ks,i as ye,ia as nd,ib as wc,ic as xr,j as uc,ja as id,jb as Ed,jc as tm,k as ws,ka as xc,kb as Cd,kc as Qe,l as Ts,la as Sc,lb as wd,lc as mt,m as Ds,ma as Nt,mb as Td,mc as Ne,n as Tn,na as Te,nb as Dd,o as Sh,oa as yi,ob as Pd,p as Mh,pa as zs,pb as Id,qa as io,qb as Od,r as Eh,rb as Ld,s as hc,sa as Je,sb as Ln,t as Ps,ta as Ot,tb as $s,ua as _r,ub as Bt,v as dc,va as Mc,vb as Ad,w as en,wa as Fr,wb as Rd,xa as Us,xb as _d,y as mc,ya as Hs,yb as Tc,z as Or,za as Vs,zb as Fd}from"./chunk-RTTZ7LHQ.js";import{a as Xt}from"./chunk-43W5ISDI.js";import{$ as jt,A as Ah,Ba as mi,C as Pn,E as it,F as Wt,G as Ls,Ga as Uh,H as As,Ha as Hh,I as Rh,Ia as Vh,J as Lr,Ja as Wh,K as ci,Ka as pi,La as jh,M as _h,Ma as fi,N as de,Na as gi,O as he,Oa as vt,Pa as Gs,Qa as Zh,Ra as eo,S as Fh,T as Gh,Ta as rn,U as Ki,Ua as Xh,V as ui,W as k,X as qe,Y as Nh,Z as we,_ as Ar,a as v,aa as me,b as D,ba as Bh,bb as Ns,c as Is,ca as Pt,d as Os,da as It,e as Th,ea as In,eb as vc,f as br,fa as tn,fb as Bs,g as Dh,ga as pe,gb as Yh,h as Ph,ha as hi,i as Ji,ja as Zt,ka as kh,kb as $h,la as bc,ma as Rs,mb as nn,na as Rr,o as Qi,ob as qh,pb as Jh,r as Ih,rb as Qh,s as Oh,u as Lh,va as Pe,wa as zh,xa as di,ya as _s,za as Fs}from"./chunk-PUC4BMPX.js";import{a as V,b as Ce,c as Ms,e as yr,f as Lg,g as Es,h as p,i as c,j as A,k as _,l as te}from"./chunk-IGHVNMJ3.js";var gp=yr((pu,fu)=>{v();(function(i,r){typeof pu=="object"&&typeof fu<"u"?fu.exports=r():typeof define=="function"&&define.amd?define(r):(i=i||self).RBush=r()})(pu,function(){"use strict";function i(y,g,S,M,E){(function w(R,I,T,C,F){for(;C>T;){if(C-T>600){var L=C-T+1,N=I-T+1,z=Math.log(L),Y=.5*Math.exp(2*z/3),G=.5*Math.sqrt(z*Y*(L-Y)/L)*(N-L/2<0?-1:1),q=Math.max(T,Math.floor(I-N*Y/L+G)),le=Math.min(C,Math.floor(I+(L-N)*Y/L+G));w(R,I,q,le,F)}var Q=R[I],K=T,B=C;for(r(R,T,I),F(R[C],Q)>0&&r(R,T,C);K<B;){for(r(R,K,B),K++,B--;F(R[K],Q)<0;)K++;for(;F(R[B],Q)>0;)B--}F(R[T],Q)===0?r(R,T,B):r(R,++B,C),B<=I&&(T=B+1),I<=B&&(C=B-1)}})(y,g,S||0,M||y.length-1,E||e)}function r(y,g,S){var M=y[g];y[g]=y[S],y[S]=M}function e(y,g){return y<g?-1:y>g?1:0}var t=function(y){y===void 0&&(y=9),this._maxEntries=Math.max(4,y),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function n(y,g,S){if(!S)return g.indexOf(y);for(var M=0;M<g.length;M++)if(S(y,g[M]))return M;return-1}function o(y,g){s(y,0,y.children.length,g,y)}function s(y,g,S,M,E){E||(E=b(null)),E.minX=1/0,E.minY=1/0,E.maxX=-1/0,E.maxY=-1/0;for(var w=g;w<S;w++){var R=y.children[w];a(E,y.leaf?M(R):R)}return E}function a(y,g){return y.minX=Math.min(y.minX,g.minX),y.minY=Math.min(y.minY,g.minY),y.maxX=Math.max(y.maxX,g.maxX),y.maxY=Math.max(y.maxY,g.maxY),y}function l(y,g){return y.minX-g.minX}function u(y,g){return y.minY-g.minY}function m(y){return(y.maxX-y.minX)*(y.maxY-y.minY)}function h(y){return y.maxX-y.minX+(y.maxY-y.minY)}function d(y,g){return y.minX<=g.minX&&y.minY<=g.minY&&g.maxX<=y.maxX&&g.maxY<=y.maxY}function f(y,g){return g.minX<=y.maxX&&g.minY<=y.maxY&&g.maxX>=y.minX&&g.maxY>=y.minY}function b(y){return{children:y,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function x(y,g,S,M,E){for(var w=[g,S];w.length;)if(!((S=w.pop())-(g=w.pop())<=M)){var R=g+Math.ceil((S-g)/M/2)*M;i(y,R,g,S,E),w.push(g,R,R,S)}}return t.prototype.all=function(){return this._all(this.data,[])},t.prototype.search=function(y){var g=this.data,S=[];if(!f(y,g))return S;for(var M=this.toBBox,E=[];g;){for(var w=0;w<g.children.length;w++){var R=g.children[w],I=g.leaf?M(R):R;f(y,I)&&(g.leaf?S.push(R):d(y,I)?this._all(R,S):E.push(R))}g=E.pop()}return S},t.prototype.collides=function(y){var g=this.data;if(!f(y,g))return!1;for(var S=[];g;){for(var M=0;M<g.children.length;M++){var E=g.children[M],w=g.leaf?this.toBBox(E):E;if(f(y,w)){if(g.leaf||d(y,w))return!0;S.push(E)}}g=S.pop()}return!1},t.prototype.load=function(y){if(!y||!y.length)return this;if(y.length<this._minEntries){for(var g=0;g<y.length;g++)this.insert(y[g]);return this}var S=this._build(y.slice(),0,y.length-1,0);if(this.data.children.length)if(this.data.height===S.height)this._splitRoot(this.data,S);else{if(this.data.height<S.height){var M=this.data;this.data=S,S=M}this._insert(S,this.data.height-S.height-1,!0)}else this.data=S;return this},t.prototype.insert=function(y){return y&&this._insert(y,this.data.height-1),this},t.prototype.clear=function(){return this.data=b([]),this},t.prototype.remove=function(y,g){if(!y)return this;for(var S,M,E,w=this.data,R=this.toBBox(y),I=[],T=[];w||I.length;){if(w||(w=I.pop(),M=I[I.length-1],S=T.pop(),E=!0),w.leaf){var C=n(y,w.children,g);if(C!==-1)return w.children.splice(C,1),I.push(w),this._condense(I),this}E||w.leaf||!d(w,R)?M?(S++,w=M.children[S],E=!1):w=null:(I.push(w),T.push(S),S=0,M=w,w=w.children[0])}return this},t.prototype.toBBox=function(y){return y},t.prototype.compareMinX=function(y,g){return y.minX-g.minX},t.prototype.compareMinY=function(y,g){return y.minY-g.minY},t.prototype.toJSON=function(){return this.data},t.prototype.fromJSON=function(y){return this.data=y,this},t.prototype._all=function(y,g){for(var S=[];y;)y.leaf?g.push.apply(g,y.children):S.push.apply(S,y.children),y=S.pop();return g},t.prototype._build=function(y,g,S,M){var E,w=S-g+1,R=this._maxEntries;if(w<=R)return o(E=b(y.slice(g,S+1)),this.toBBox),E;M||(M=Math.ceil(Math.log(w)/Math.log(R)),R=Math.ceil(w/Math.pow(R,M-1))),(E=b([])).leaf=!1,E.height=M;var I=Math.ceil(w/R),T=I*Math.ceil(Math.sqrt(R));x(y,g,S,T,this.compareMinX);for(var C=g;C<=S;C+=T){var F=Math.min(C+T-1,S);x(y,C,F,I,this.compareMinY);for(var L=C;L<=F;L+=I){var N=Math.min(L+I-1,F);E.children.push(this._build(y,L,N,M-1))}}return o(E,this.toBBox),E},t.prototype._chooseSubtree=function(y,g,S,M){for(;M.push(g),!g.leaf&&M.length-1!==S;){for(var E=1/0,w=1/0,R=void 0,I=0;I<g.children.length;I++){var T=g.children[I],C=m(T),F=(L=y,N=T,(Math.max(N.maxX,L.maxX)-Math.min(N.minX,L.minX))*(Math.max(N.maxY,L.maxY)-Math.min(N.minY,L.minY))-C);F<w?(w=F,E=C<E?C:E,R=T):F===w&&C<E&&(E=C,R=T)}g=R||g.children[0]}var L,N;return g},t.prototype._insert=function(y,g,S){var M=S?y:this.toBBox(y),E=[],w=this._chooseSubtree(M,this.data,g,E);for(w.children.push(y),a(w,M);g>=0&&E[g].children.length>this._maxEntries;)this._split(E,g),g--;this._adjustParentBBoxes(M,E,g)},t.prototype._split=function(y,g){var S=y[g],M=S.children.length,E=this._minEntries;this._chooseSplitAxis(S,E,M);var w=this._chooseSplitIndex(S,E,M),R=b(S.children.splice(w,S.children.length-w));R.height=S.height,R.leaf=S.leaf,o(S,this.toBBox),o(R,this.toBBox),g?y[g-1].children.push(R):this._splitRoot(S,R)},t.prototype._splitRoot=function(y,g){this.data=b([y,g]),this.data.height=y.height+1,this.data.leaf=!1,o(this.data,this.toBBox)},t.prototype._chooseSplitIndex=function(y,g,S){for(var M,E,w,R,I,T,C,F=1/0,L=1/0,N=g;N<=S-g;N++){var z=s(y,0,N,this.toBBox),Y=s(y,N,S,this.toBBox),G=(E=z,w=Y,R=void 0,I=void 0,T=void 0,C=void 0,R=Math.max(E.minX,w.minX),I=Math.max(E.minY,w.minY),T=Math.min(E.maxX,w.maxX),C=Math.min(E.maxY,w.maxY),Math.max(0,T-R)*Math.max(0,C-I)),q=m(z)+m(Y);G<F?(F=G,M=N,L=q<L?q:L):G===F&&q<L&&(L=q,M=N)}return M||S-g},t.prototype._chooseSplitAxis=function(y,g,S){var M=y.leaf?this.compareMinX:l,E=y.leaf?this.compareMinY:u;this._allDistMargin(y,g,S,M)<this._allDistMargin(y,g,S,E)&&y.children.sort(M)},t.prototype._allDistMargin=function(y,g,S,M){y.children.sort(M);for(var E=this.toBBox,w=s(y,0,g,E),R=s(y,S-g,S,E),I=h(w)+h(R),T=g;T<S-g;T++){var C=y.children[T];a(w,y.leaf?E(C):C),I+=h(w)}for(var F=S-g-1;F>=g;F--){var L=y.children[F];a(R,y.leaf?E(L):L),I+=h(R)}return I},t.prototype._adjustParentBBoxes=function(y,g,S){for(var M=S;M>=0;M--)a(g[M],y)},t.prototype._condense=function(y){for(var g=y.length-1,S=void 0;g>=0;g--)y[g].children.length===0?g>0?(S=y[g-1].children).splice(S.indexOf(y[g]),1):this.clear():o(y[g],this.toBBox)},t})});var xu=yr(ne=>{"use strict";v();Object.defineProperty(ne,"__esModule",{value:!0});ne.earthRadius=63710088e-1;ne.factors={centimeters:ne.earthRadius*100,centimetres:ne.earthRadius*100,degrees:ne.earthRadius/111325,feet:ne.earthRadius*3.28084,inches:ne.earthRadius*39.37,kilometers:ne.earthRadius/1e3,kilometres:ne.earthRadius/1e3,meters:ne.earthRadius,metres:ne.earthRadius,miles:ne.earthRadius/1609.344,millimeters:ne.earthRadius*1e3,millimetres:ne.earthRadius*1e3,nauticalmiles:ne.earthRadius/1852,radians:1,yards:ne.earthRadius*1.0936};ne.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/ne.earthRadius,yards:1.0936133};ne.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 gn(i,r,e){e===void 0&&(e={});var t={type:"Feature"};return(e.id===0||e.id)&&(t.id=e.id),e.bbox&&(t.bbox=e.bbox),t.properties=r||{},t.geometry=i,t}ne.feature=gn;function lb(i,r,e){switch(e===void 0&&(e={}),i){case"Point":return gu(r).geometry;case"LineString":return bu(r).geometry;case"Polygon":return yu(r).geometry;case"MultiPoint":return bp(r).geometry;case"MultiLineString":return yp(r).geometry;case"MultiPolygon":return vp(r).geometry;default:throw new Error(i+" is invalid")}}ne.geometry=lb;function gu(i,r,e){if(e===void 0&&(e={}),!i)throw new Error("coordinates is required");if(!Array.isArray(i))throw new Error("coordinates must be an Array");if(i.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Xa(i[0])||!Xa(i[1]))throw new Error("coordinates must contain numbers");var t={type:"Point",coordinates:i};return gn(t,r,e)}ne.point=gu;function cb(i,r,e){return e===void 0&&(e={}),Ya(i.map(function(t){return gu(t,r)}),e)}ne.points=cb;function yu(i,r,e){e===void 0&&(e={});for(var t=0,n=i;t<n.length;t++){var o=n[t];if(o.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var s=0;s<o[o.length-1].length;s++)if(o[o.length-1][s]!==o[0][s])throw new Error("First and last Position are not equivalent.")}var a={type:"Polygon",coordinates:i};return gn(a,r,e)}ne.polygon=yu;function ub(i,r,e){return e===void 0&&(e={}),Ya(i.map(function(t){return yu(t,r)}),e)}ne.polygons=ub;function bu(i,r,e){if(e===void 0&&(e={}),i.length<2)throw new Error("coordinates must be an array of two or more positions");var t={type:"LineString",coordinates:i};return gn(t,r,e)}ne.lineString=bu;function hb(i,r,e){return e===void 0&&(e={}),Ya(i.map(function(t){return bu(t,r)}),e)}ne.lineStrings=hb;function Ya(i,r){r===void 0&&(r={});var e={type:"FeatureCollection"};return r.id&&(e.id=r.id),r.bbox&&(e.bbox=r.bbox),e.features=i,e}ne.featureCollection=Ya;function yp(i,r,e){e===void 0&&(e={});var t={type:"MultiLineString",coordinates:i};return gn(t,r,e)}ne.multiLineString=yp;function bp(i,r,e){e===void 0&&(e={});var t={type:"MultiPoint",coordinates:i};return gn(t,r,e)}ne.multiPoint=bp;function vp(i,r,e){e===void 0&&(e={});var t={type:"MultiPolygon",coordinates:i};return gn(t,r,e)}ne.multiPolygon=vp;function db(i,r,e){e===void 0&&(e={});var t={type:"GeometryCollection",geometries:i};return gn(t,r,e)}ne.geometryCollection=db;function mb(i,r){if(r===void 0&&(r=0),r&&!(r>=0))throw new Error("precision must be a positive number");var e=Math.pow(10,r||0);return Math.round(i*e)/e}ne.round=mb;function xp(i,r){r===void 0&&(r="kilometers");var e=ne.factors[r];if(!e)throw new Error(r+" units is invalid");return i*e}ne.radiansToLength=xp;function vu(i,r){r===void 0&&(r="kilometers");var e=ne.factors[r];if(!e)throw new Error(r+" units is invalid");return i/e}ne.lengthToRadians=vu;function pb(i,r){return Sp(vu(i,r))}ne.lengthToDegrees=pb;function fb(i){var r=i%360;return r<0&&(r+=360),r}ne.bearingToAzimuth=fb;function Sp(i){var r=i%(2*Math.PI);return r*180/Math.PI}ne.radiansToDegrees=Sp;function gb(i){var r=i%360;return r*Math.PI/180}ne.degreesToRadians=gb;function yb(i,r,e){if(r===void 0&&(r="kilometers"),e===void 0&&(e="kilometers"),!(i>=0))throw new Error("length must be a positive number");return xp(vu(i,r),e)}ne.convertLength=yb;function bb(i,r,e){if(r===void 0&&(r="meters"),e===void 0&&(e="kilometers"),!(i>=0))throw new Error("area must be a positive number");var t=ne.areaFactors[r];if(!t)throw new Error("invalid original units");var n=ne.areaFactors[e];if(!n)throw new Error("invalid final units");return i/t*n}ne.convertArea=bb;function Xa(i){return!isNaN(i)&&i!==null&&!Array.isArray(i)}ne.isNumber=Xa;function vb(i){return!!i&&i.constructor===Object}ne.isObject=vb;function xb(i){if(!i)throw new Error("bbox is required");if(!Array.isArray(i))throw new Error("bbox must be an Array");if(i.length!==4&&i.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");i.forEach(function(r){if(!Xa(r))throw new Error("bbox must only contain numbers")})}ne.validateBBox=xb;function Sb(i){if(!i)throw new Error("id is required");if(["string","number"].indexOf(typeof i)===-1)throw new Error("id must be a number or a string")}ne.validateId=Sb});var Tp=yr(rt=>{"use strict";v();Object.defineProperty(rt,"__esModule",{value:!0});var gt=xu();function Uo(i,r,e){if(i!==null)for(var t,n,o,s,a,l,u,m=0,h=0,d,f=i.type,b=f==="FeatureCollection",x=f==="Feature",y=b?i.features.length:1,g=0;g<y;g++){u=b?i.features[g].geometry:x?i.geometry:i,d=u?u.type==="GeometryCollection":!1,a=d?u.geometries.length:1;for(var S=0;S<a;S++){var M=0,E=0;if(s=d?u.geometries[S]:u,s!==null){l=s.coordinates;var w=s.type;switch(m=e&&(w==="Polygon"||w==="MultiPolygon")?1:0,w){case null:break;case"Point":if(r(l,h,g,M,E)===!1)return!1;h++,M++;break;case"LineString":case"MultiPoint":for(t=0;t<l.length;t++){if(r(l[t],h,g,M,E)===!1)return!1;h++,w==="MultiPoint"&&M++}w==="LineString"&&M++;break;case"Polygon":case"MultiLineString":for(t=0;t<l.length;t++){for(n=0;n<l[t].length-m;n++){if(r(l[t][n],h,g,M,E)===!1)return!1;h++}w==="MultiLineString"&&M++,w==="Polygon"&&E++}w==="Polygon"&&M++;break;case"MultiPolygon":for(t=0;t<l.length;t++){for(E=0,n=0;n<l[t].length;n++){for(o=0;o<l[t][n].length-m;o++){if(r(l[t][n][o],h,g,M,E)===!1)return!1;h++}E++}M++}break;case"GeometryCollection":for(t=0;t<s.geometries.length;t++)if(Uo(s.geometries[t],r,e)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function Mb(i,r,e,t){var n=e;return Uo(i,function(o,s,a,l,u){s===0&&e===void 0?n=o:n=r(n,o,s,a,l,u)},t),n}function Mp(i,r){var e;switch(i.type){case"FeatureCollection":for(e=0;e<i.features.length&&r(i.features[e].properties,e)!==!1;e++);break;case"Feature":r(i.properties,0);break}}function Eb(i,r,e){var t=e;return Mp(i,function(n,o){o===0&&e===void 0?t=n:t=r(t,n,o)}),t}function Ep(i,r){if(i.type==="Feature")r(i,0);else if(i.type==="FeatureCollection")for(var e=0;e<i.features.length&&r(i.features[e],e)!==!1;e++);}function Cb(i,r,e){var t=e;return Ep(i,function(n,o){o===0&&e===void 0?t=n:t=r(t,n,o)}),t}function wb(i){var r=[];return Uo(i,function(e){r.push(e)}),r}function Su(i,r){var e,t,n,o,s,a,l,u,m,h,d=0,f=i.type==="FeatureCollection",b=i.type==="Feature",x=f?i.features.length:1;for(e=0;e<x;e++){for(a=f?i.features[e].geometry:b?i.geometry:i,u=f?i.features[e].properties:b?i.properties:{},m=f?i.features[e].bbox:b?i.bbox:void 0,h=f?i.features[e].id:b?i.id:void 0,l=a?a.type==="GeometryCollection":!1,s=l?a.geometries.length:1,n=0;n<s;n++){if(o=l?a.geometries[n]:a,o===null){if(r(null,d,u,m,h)===!1)return!1;continue}switch(o.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(r(o,d,u,m,h)===!1)return!1;break}case"GeometryCollection":{for(t=0;t<o.geometries.length;t++)if(r(o.geometries[t],d,u,m,h)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}d++}}function Tb(i,r,e){var t=e;return Su(i,function(n,o,s,a,l){o===0&&e===void 0?t=n:t=r(t,n,o,s,a,l)}),t}function $a(i,r){Su(i,function(e,t,n,o,s){var a=e===null?null:e.type;switch(a){case null:case"Point":case"LineString":case"Polygon":return r(gt.feature(e,n,{bbox:o,id:s}),t,0)===!1?!1:void 0}var l;switch(a){case"MultiPoint":l="Point";break;case"MultiLineString":l="LineString";break;case"MultiPolygon":l="Polygon";break}for(var u=0;u<e.coordinates.length;u++){var m=e.coordinates[u],h={type:l,coordinates:m};if(r(gt.feature(h,n),t,u)===!1)return!1}})}function Db(i,r,e){var t=e;return $a(i,function(n,o,s){o===0&&s===0&&e===void 0?t=n:t=r(t,n,o,s)}),t}function Cp(i,r){$a(i,function(e,t,n){var o=0;if(e.geometry){var s=e.geometry.type;if(!(s==="Point"||s==="MultiPoint")){var a,l=0,u=0,m=0;if(Uo(e,function(h,d,f,b,x){if(a===void 0||t>l||b>u||x>m){a=h,l=t,u=b,m=x,o=0;return}var y=gt.lineString([a,h],e.properties);if(r(y,t,n,x,o)===!1)return!1;o++,a=h})===!1)return!1}}})}function Pb(i,r,e){var t=e,n=!1;return Cp(i,function(o,s,a,l,u){n===!1&&e===void 0?t=o:t=r(t,o,s,a,l,u),n=!0}),t}function wp(i,r){if(!i)throw new Error("geojson is required");$a(i,function(e,t,n){if(e.geometry!==null){var o=e.geometry.type,s=e.geometry.coordinates;switch(o){case"LineString":if(r(e,t,n,0,0)===!1)return!1;break;case"Polygon":for(var a=0;a<s.length;a++)if(r(gt.lineString(s[a],e.properties),t,n,a)===!1)return!1;break}}})}function Ib(i,r,e){var t=e;return wp(i,function(n,o,s,a){o===0&&e===void 0?t=n:t=r(t,n,o,s,a)}),t}function Ob(i,r){if(r=r||{},!gt.isObject(r))throw new Error("options is invalid");var e=r.featureIndex||0,t=r.multiFeatureIndex||0,n=r.geometryIndex||0,o=r.segmentIndex||0,s=r.properties,a;switch(i.type){case"FeatureCollection":e<0&&(e=i.features.length+e),s=s||i.features[e].properties,a=i.features[e].geometry;break;case"Feature":s=s||i.properties,a=i.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":a=i;break;default:throw new Error("geojson is invalid")}if(a===null)return null;var l=a.coordinates;switch(a.type){case"Point":case"MultiPoint":return null;case"LineString":return o<0&&(o=l.length+o-1),gt.lineString([l[o],l[o+1]],s,r);case"Polygon":return n<0&&(n=l.length+n),o<0&&(o=l[n].length+o-1),gt.lineString([l[n][o],l[n][o+1]],s,r);case"MultiLineString":return t<0&&(t=l.length+t),o<0&&(o=l[t].length+o-1),gt.lineString([l[t][o],l[t][o+1]],s,r);case"MultiPolygon":return t<0&&(t=l.length+t),n<0&&(n=l[t].length+n),o<0&&(o=l[t][n].length-o-1),gt.lineString([l[t][n][o],l[t][n][o+1]],s,r)}throw new Error("geojson is invalid")}function Lb(i,r){if(r=r||{},!gt.isObject(r))throw new Error("options is invalid");var e=r.featureIndex||0,t=r.multiFeatureIndex||0,n=r.geometryIndex||0,o=r.coordIndex||0,s=r.properties,a;switch(i.type){case"FeatureCollection":e<0&&(e=i.features.length+e),s=s||i.features[e].properties,a=i.features[e].geometry;break;case"Feature":s=s||i.properties,a=i.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":a=i;break;default:throw new Error("geojson is invalid")}if(a===null)return null;var l=a.coordinates;switch(a.type){case"Point":return gt.point(l,s,r);case"MultiPoint":return t<0&&(t=l.length+t),gt.point(l[t],s,r);case"LineString":return o<0&&(o=l.length+o),gt.point(l[o],s,r);case"Polygon":return n<0&&(n=l.length+n),o<0&&(o=l[n].length+o),gt.point(l[n][o],s,r);case"MultiLineString":return t<0&&(t=l.length+t),o<0&&(o=l[t].length+o),gt.point(l[t][o],s,r);case"MultiPolygon":return t<0&&(t=l.length+t),n<0&&(n=l[t].length+n),o<0&&(o=l[t][n].length-o),gt.point(l[t][n][o],s,r)}throw new Error("geojson is invalid")}rt.coordAll=wb;rt.coordEach=Uo;rt.coordReduce=Mb;rt.featureEach=Ep;rt.featureReduce=Cb;rt.findPoint=Lb;rt.findSegment=Ob;rt.flattenEach=$a;rt.flattenReduce=Db;rt.geomEach=Su;rt.geomReduce=Tb;rt.lineEach=wp;rt.lineReduce=Ib;rt.propEach=Mp;rt.propReduce=Eb;rt.segmentEach=Cp;rt.segmentReduce=Pb});var Ap=yr(be=>{"use strict";v();Object.defineProperty(be,"__esModule",{value:!0});var _t=63710088e-1,Eu={centimeters:_t*100,centimetres:_t*100,degrees:360/(2*Math.PI),feet:_t*3.28084,inches:_t*39.37,kilometers:_t/1e3,kilometres:_t/1e3,meters:_t,metres:_t,miles:_t/1609.344,millimeters:_t*1e3,millimetres:_t*1e3,nauticalmiles:_t/1852,radians:1,yards:_t*1.0936},Mu={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 yn(i,r,e={}){let t={type:"Feature"};return(e.id===0||e.id)&&(t.id=e.id),e.bbox&&(t.bbox=e.bbox),t.properties=r||{},t.geometry=i,t}function Ab(i,r,e={}){switch(i){case"Point":return Cu(r).geometry;case"LineString":return Tu(r).geometry;case"Polygon":return wu(r).geometry;case"MultiPoint":return Pp(r).geometry;case"MultiLineString":return Dp(r).geometry;case"MultiPolygon":return Ip(r).geometry;default:throw new Error(i+" is invalid")}}function Cu(i,r,e={}){if(!i)throw new Error("coordinates is required");if(!Array.isArray(i))throw new Error("coordinates must be an Array");if(i.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!qa(i[0])||!qa(i[1]))throw new Error("coordinates must contain numbers");return yn({type:"Point",coordinates:i},r,e)}function Rb(i,r,e={}){return Ja(i.map(t=>Cu(t,r)),e)}function wu(i,r,e={}){for(let n of i){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 yn({type:"Polygon",coordinates:i},r,e)}function _b(i,r,e={}){return Ja(i.map(t=>wu(t,r)),e)}function Tu(i,r,e={}){if(i.length<2)throw new Error("coordinates must be an array of two or more positions");return yn({type:"LineString",coordinates:i},r,e)}function Fb(i,r,e={}){return Ja(i.map(t=>Tu(t,r)),e)}function Ja(i,r={}){let e={type:"FeatureCollection"};return r.id&&(e.id=r.id),r.bbox&&(e.bbox=r.bbox),e.features=i,e}function Dp(i,r,e={}){return yn({type:"MultiLineString",coordinates:i},r,e)}function Pp(i,r,e={}){return yn({type:"MultiPoint",coordinates:i},r,e)}function Ip(i,r,e={}){return yn({type:"MultiPolygon",coordinates:i},r,e)}function Gb(i,r,e={}){return yn({type:"GeometryCollection",geometries:i},r,e)}function Nb(i,r=0){if(r&&!(r>=0))throw new Error("precision must be a positive number");let e=Math.pow(10,r||0);return Math.round(i*e)/e}function Op(i,r="kilometers"){let e=Eu[r];if(!e)throw new Error(r+" units is invalid");return i*e}function Du(i,r="kilometers"){let e=Eu[r];if(!e)throw new Error(r+" units is invalid");return i/e}function Bb(i,r){return Lp(Du(i,r))}function kb(i){let r=i%360;return r<0&&(r+=360),r}function zb(i){return i=i%360,i>180?i-360:i<-180?i+360:i}function Lp(i){return i%(2*Math.PI)*180/Math.PI}function Ub(i){return i%360*Math.PI/180}function Hb(i,r="kilometers",e="kilometers"){if(!(i>=0))throw new Error("length must be a positive number");return Op(Du(i,r),e)}function Vb(i,r="meters",e="kilometers"){if(!(i>=0))throw new Error("area must be a positive number");let t=Mu[r];if(!t)throw new Error("invalid original units");let n=Mu[e];if(!n)throw new Error("invalid final units");return i/t*n}function qa(i){return!isNaN(i)&&i!==null&&!Array.isArray(i)}function Wb(i){return i!==null&&typeof i=="object"&&!Array.isArray(i)}function jb(i){if(!i)throw new Error("bbox is required");if(!Array.isArray(i))throw new Error("bbox must be an Array");if(i.length!==4&&i.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");i.forEach(r=>{if(!qa(r))throw new Error("bbox must only contain numbers")})}function Zb(i){if(!i)throw new Error("id is required");if(["string","number"].indexOf(typeof i)===-1)throw new Error("id must be a number or a string")}be.areaFactors=Mu;be.azimuthToBearing=zb;be.bearingToAzimuth=kb;be.convertArea=Vb;be.convertLength=Hb;be.degreesToRadians=Ub;be.earthRadius=_t;be.factors=Eu;be.feature=yn;be.featureCollection=Ja;be.geometry=Ab;be.geometryCollection=Gb;be.isNumber=qa;be.isObject=Wb;be.lengthToDegrees=Bb;be.lengthToRadians=Du;be.lineString=Tu;be.lineStrings=Fb;be.multiLineString=Dp;be.multiPoint=Pp;be.multiPolygon=Ip;be.point=Cu;be.points=Rb;be.polygon=wu;be.polygons=_b;be.radiansToDegrees=Lp;be.radiansToLength=Op;be.round=Nb;be.validateBBox=jb;be.validateId=Zb});var Np=yr(nt=>{"use strict";v();Object.defineProperty(nt,"__esModule",{value:!0});var yt=Ap();function Ho(i,r,e){if(i!==null)for(var t,n,o,s,a,l,u,m=0,h=0,d,f=i.type,b=f==="FeatureCollection",x=f==="Feature",y=b?i.features.length:1,g=0;g<y;g++){u=b?i.features[g].geometry:x?i.geometry:i,d=u?u.type==="GeometryCollection":!1,a=d?u.geometries.length:1;for(var S=0;S<a;S++){var M=0,E=0;if(s=d?u.geometries[S]:u,s!==null){l=s.coordinates;var w=s.type;switch(m=e&&(w==="Polygon"||w==="MultiPolygon")?1:0,w){case null:break;case"Point":if(r(l,h,g,M,E)===!1)return!1;h++,M++;break;case"LineString":case"MultiPoint":for(t=0;t<l.length;t++){if(r(l[t],h,g,M,E)===!1)return!1;h++,w==="MultiPoint"&&M++}w==="LineString"&&M++;break;case"Polygon":case"MultiLineString":for(t=0;t<l.length;t++){for(n=0;n<l[t].length-m;n++){if(r(l[t][n],h,g,M,E)===!1)return!1;h++}w==="MultiLineString"&&M++,w==="Polygon"&&E++}w==="Polygon"&&M++;break;case"MultiPolygon":for(t=0;t<l.length;t++){for(E=0,n=0;n<l[t].length;n++){for(o=0;o<l[t][n].length-m;o++){if(r(l[t][n][o],h,g,M,E)===!1)return!1;h++}E++}M++}break;case"GeometryCollection":for(t=0;t<s.geometries.length;t++)if(Ho(s.geometries[t],r,e)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function Xb(i,r,e,t){var n=e;return Ho(i,function(o,s,a,l,u){s===0&&e===void 0?n=o:n=r(n,o,s,a,l,u)},t),n}function Rp(i,r){var e;switch(i.type){case"FeatureCollection":for(e=0;e<i.features.length&&r(i.features[e].properties,e)!==!1;e++);break;case"Feature":r(i.properties,0);break}}function Yb(i,r,e){var t=e;return Rp(i,function(n,o){o===0&&e===void 0?t=n:t=r(t,n,o)}),t}function _p(i,r){if(i.type==="Feature")r(i,0);else if(i.type==="FeatureCollection")for(var e=0;e<i.features.length&&r(i.features[e],e)!==!1;e++);}function $b(i,r,e){var t=e;return _p(i,function(n,o){o===0&&e===void 0?t=n:t=r(t,n,o)}),t}function qb(i){var r=[];return Ho(i,function(e){r.push(e)}),r}function Pu(i,r){var e,t,n,o,s,a,l,u,m,h,d=0,f=i.type==="FeatureCollection",b=i.type==="Feature",x=f?i.features.length:1;for(e=0;e<x;e++){for(a=f?i.features[e].geometry:b?i.geometry:i,u=f?i.features[e].properties:b?i.properties:{},m=f?i.features[e].bbox:b?i.bbox:void 0,h=f?i.features[e].id:b?i.id:void 0,l=a?a.type==="GeometryCollection":!1,s=l?a.geometries.length:1,n=0;n<s;n++){if(o=l?a.geometries[n]:a,o===null){if(r(null,d,u,m,h)===!1)return!1;continue}switch(o.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(r(o,d,u,m,h)===!1)return!1;break}case"GeometryCollection":{for(t=0;t<o.geometries.length;t++)if(r(o.geometries[t],d,u,m,h)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}d++}}function Jb(i,r,e){var t=e;return Pu(i,function(n,o,s,a,l){o===0&&e===void 0?t=n:t=r(t,n,o,s,a,l)}),t}function Qa(i,r){Pu(i,function(e,t,n,o,s){var a=e===null?null:e.type;switch(a){case null:case"Point":case"LineString":case"Polygon":return r(yt.feature.call(void 0,e,n,{bbox:o,id:s}),t,0)===!1?!1:void 0}var l;switch(a){case"MultiPoint":l="Point";break;case"MultiLineString":l="LineString";break;case"MultiPolygon":l="Polygon";break}for(var u=0;u<e.coordinates.length;u++){var m=e.coordinates[u],h={type:l,coordinates:m};if(r(yt.feature.call(void 0,h,n),t,u)===!1)return!1}})}function Qb(i,r,e){var t=e;return Qa(i,function(n,o,s){o===0&&s===0&&e===void 0?t=n:t=r(t,n,o,s)}),t}function Fp(i,r){Qa(i,function(e,t,n){var o=0;if(e.geometry){var s=e.geometry.type;if(!(s==="Point"||s==="MultiPoint")){var a,l=0,u=0,m=0;if(Ho(e,function(h,d,f,b,x){if(a===void 0||t>l||b>u||x>m){a=h,l=t,u=b,m=x,o=0;return}var y=yt.lineString.call(void 0,[a,h],e.properties);if(r(y,t,n,x,o)===!1)return!1;o++,a=h})===!1)return!1}}})}function Kb(i,r,e){var t=e,n=!1;return Fp(i,function(o,s,a,l,u){n===!1&&e===void 0?t=o:t=r(t,o,s,a,l,u),n=!0}),t}function Gp(i,r){if(!i)throw new Error("geojson is required");Qa(i,function(e,t,n){if(e.geometry!==null){var o=e.geometry.type,s=e.geometry.coordinates;switch(o){case"LineString":if(r(e,t,n,0,0)===!1)return!1;break;case"Polygon":for(var a=0;a<s.length;a++)if(r(yt.lineString.call(void 0,s[a],e.properties),t,n,a)===!1)return!1;break}}})}function ev(i,r,e){var t=e;return Gp(i,function(n,o,s,a){o===0&&e===void 0?t=n:t=r(t,n,o,s,a)}),t}function tv(i,r){if(r=r||{},!yt.isObject.call(void 0,r))throw new Error("options is invalid");var e=r.featureIndex||0,t=r.multiFeatureIndex||0,n=r.geometryIndex||0,o=r.segmentIndex||0,s=r.properties,a;switch(i.type){case"FeatureCollection":e<0&&(e=i.features.length+e),s=s||i.features[e].properties,a=i.features[e].geometry;break;case"Feature":s=s||i.properties,a=i.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":a=i;break;default:throw new Error("geojson is invalid")}if(a===null)return null;var l=a.coordinates;switch(a.type){case"Point":case"MultiPoint":return null;case"LineString":return o<0&&(o=l.length+o-1),yt.lineString.call(void 0,[l[o],l[o+1]],s,r);case"Polygon":return n<0&&(n=l.length+n),o<0&&(o=l[n].length+o-1),yt.lineString.call(void 0,[l[n][o],l[n][o+1]],s,r);case"MultiLineString":return t<0&&(t=l.length+t),o<0&&(o=l[t].length+o-1),yt.lineString.call(void 0,[l[t][o],l[t][o+1]],s,r);case"MultiPolygon":return t<0&&(t=l.length+t),n<0&&(n=l[t].length+n),o<0&&(o=l[t][n].length-o-1),yt.lineString.call(void 0,[l[t][n][o],l[t][n][o+1]],s,r)}throw new Error("geojson is invalid")}function rv(i,r){if(r=r||{},!yt.isObject.call(void 0,r))throw new Error("options is invalid");var e=r.featureIndex||0,t=r.multiFeatureIndex||0,n=r.geometryIndex||0,o=r.coordIndex||0,s=r.properties,a;switch(i.type){case"FeatureCollection":e<0&&(e=i.features.length+e),s=s||i.features[e].properties,a=i.features[e].geometry;break;case"Feature":s=s||i.properties,a=i.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":a=i;break;default:throw new Error("geojson is invalid")}if(a===null)return null;var l=a.coordinates;switch(a.type){case"Point":return yt.point.call(void 0,l,s,r);case"MultiPoint":return t<0&&(t=l.length+t),yt.point.call(void 0,l[t],s,r);case"LineString":return o<0&&(o=l.length+o),yt.point.call(void 0,l[o],s,r);case"Polygon":return n<0&&(n=l.length+n),o<0&&(o=l[n].length+o),yt.point.call(void 0,l[n][o],s,r);case"MultiLineString":return t<0&&(t=l.length+t),o<0&&(o=l[t].length+o),yt.point.call(void 0,l[t][o],s,r);case"MultiPolygon":return t<0&&(t=l.length+t),n<0&&(n=l[t].length+n),o<0&&(o=l[t][n].length-o),yt.point.call(void 0,l[t][n][o],s,r)}throw new Error("geojson is invalid")}nt.coordAll=qb;nt.coordEach=Ho;nt.coordReduce=Xb;nt.featureEach=_p;nt.featureReduce=$b;nt.findPoint=rv;nt.findSegment=tv;nt.flattenEach=Qa;nt.flattenReduce=Qb;nt.geomEach=Pu;nt.geomReduce=Jb;nt.lineEach=Gp;nt.lineReduce=ev;nt.propEach=Rp;nt.propReduce=Yb;nt.segmentEach=Fp;nt.segmentReduce=Kb});var kp=yr(Ka=>{"use strict";v();Object.defineProperty(Ka,"__esModule",{value:!0});var nv=Np();function Bp(i,r={}){if(i.bbox!=null&&r.recompute!==!0)return i.bbox;let e=[1/0,1/0,-1/0,-1/0];return nv.coordEach.call(void 0,i,t=>{e[0]>t[0]&&(e[0]=t[0]),e[1]>t[1]&&(e[1]=t[1]),e[2]<t[0]&&(e[2]=t[0]),e[3]<t[1]&&(e[3]=t[1])}),e}var iv=Bp;Ka.bbox=Bp;Ka.default=iv});var Wp=yr((dD,Iu)=>{v();var Er=gp(),Up=xu(),Hp=Tp(),Ai=kp().default,ov=Hp.featureEach,uD=Hp.coordEach,hD=Up.polygon,zp=Up.featureCollection;function Vp(i){var r=new Er(i);return r.insert=function(e){if(e.type!=="Feature")throw new Error("invalid feature");return e.bbox=e.bbox?e.bbox:Ai(e),Er.prototype.insert.call(this,e)},r.load=function(e){var t=[];return Array.isArray(e)?e.forEach(function(n){if(n.type!=="Feature")throw new Error("invalid features");n.bbox=n.bbox?n.bbox:Ai(n),t.push(n)}):ov(e,function(n){if(n.type!=="Feature")throw new Error("invalid features");n.bbox=n.bbox?n.bbox:Ai(n),t.push(n)}),Er.prototype.load.call(this,t)},r.remove=function(e,t){if(e.type!=="Feature")throw new Error("invalid feature");return e.bbox=e.bbox?e.bbox:Ai(e),Er.prototype.remove.call(this,e,t)},r.clear=function(){return Er.prototype.clear.call(this)},r.search=function(e){var t=Er.prototype.search.call(this,this.toBBox(e));return zp(t)},r.collides=function(e){return Er.prototype.collides.call(this,this.toBBox(e))},r.all=function(){var e=Er.prototype.all.call(this);return zp(e)},r.toJSON=function(){return Er.prototype.toJSON.call(this)},r.fromJSON=function(e){return Er.prototype.fromJSON.call(this,e)},r.toBBox=function(e){var t;if(e.bbox)t=e.bbox;else if(Array.isArray(e)&&e.length===4)t=e;else if(Array.isArray(e)&&e.length===6)t=[e[0],e[1],e[3],e[4]];else if(e.type==="Feature")t=Ai(e);else if(e.type==="FeatureCollection")t=Ai(e);else throw new Error("invalid geojson");return{minX:t[0],minY:t[1],maxX:t[2],maxY:t[3]}},r}Iu.exports=Vp;Iu.exports.default=Vp});var Ku=yr((PL,Yl)=>{v();(function(){"use strict";function i(s,a){var l=s.x-a.x,u=s.y-a.y;return l*l+u*u}function r(s,a,l){var u=a.x,m=a.y,h=l.x-u,d=l.y-m;if(h!==0||d!==0){var f=((s.x-u)*h+(s.y-m)*d)/(h*h+d*d);f>1?(u=l.x,m=l.y):f>0&&(u+=h*f,m+=d*f)}return h=s.x-u,d=s.y-m,h*h+d*d}function e(s,a){for(var l=s[0],u=[l],m,h=1,d=s.length;h<d;h++)m=s[h],i(m,l)>a&&(u.push(m),l=m);return l!==m&&u.push(m),u}function t(s,a,l,u,m){for(var h=u,d,f=a+1;f<l;f++){var b=r(s[f],s[a],s[l]);b>h&&(d=f,h=b)}h>u&&(d-a>1&&t(s,a,d,u,m),m.push(s[d]),l-d>1&&t(s,d,l,u,m))}function n(s,a){var l=s.length-1,u=[s[0]];return t(s,0,l,a,u),u.push(s[l]),u}function o(s,a,l){if(s.length<=2)return s;var u=a!==void 0?a*a:1;return s=l?s:e(s,u),s=n(s,u),s}typeof define=="function"&&define.amd?define(function(){return o}):typeof Yl<"u"?(Yl.exports=o,Yl.exports.default=o):typeof self<"u"?self.simplify=o:window.simplify=o})()});var gg=yr((mh,ph)=>{v();(function(i,r){typeof mh=="object"&&typeof ph<"u"?ph.exports=r():typeof define=="function"&&define.amd?define(r):(i=i||self,i.TinyQueue=r())})(mh,function(){"use strict";var i=function(t,n){if(t===void 0&&(t=[]),n===void 0&&(n=r),this.data=t,this.length=this.data.length,this.compare=n,this.length>0)for(var o=(this.length>>1)-1;o>=0;o--)this._down(o)};i.prototype.push=function(t){this.data.push(t),this.length++,this._up(this.length-1)},i.prototype.pop=function(){if(this.length!==0){var t=this.data[0],n=this.data.pop();return this.length--,this.length>0&&(this.data[0]=n,this._down(0)),t}},i.prototype.peek=function(){return this.data[0]},i.prototype._up=function(t){for(var n=this,o=n.data,s=n.compare,a=o[t];t>0;){var l=t-1>>1,u=o[l];if(s(a,u)>=0)break;o[t]=u,t=l}o[t]=a},i.prototype._down=function(t){for(var n=this,o=n.data,s=n.compare,a=this.length>>1,l=o[t];t<a;){var u=(t<<1)+1,m=o[u],h=u+1;if(h<this.length&&s(o[h],m)<0&&(u=h,m=o[h]),s(m,l)>=0)break;o[t]=m,t=u}o[t]=l};function r(e,t){return e<t?-1:e>t?1:0}return i})});var bg=yr((VR,fh)=>{"use strict";v();var sc=gg();sc.default&&(sc=sc.default);fh.exports=yg;fh.exports.default=yg;function yg(i,r,e){r=r||1;for(var t,n,o,s,a=0;a<i[0].length;a++){var l=i[0][a];(!a||l[0]<t)&&(t=l[0]),(!a||l[1]<n)&&(n=l[1]),(!a||l[0]>o)&&(o=l[0]),(!a||l[1]>s)&&(s=l[1])}var u=o-t,m=s-n,h=Math.min(u,m),d=h/2;if(h===0){var f=[t,n];return f.distance=0,f}for(var b=new sc(void 0,sx),x=t;x<o;x+=h)for(var y=n;y<s;y+=h)b.push(new Cn(x+d,y+d,d,i));var g=lx(i),S=new Cn(t+u/2,n+m/2,0,i);S.d>g.d&&(g=S);for(var M=b.length;b.length;){var E=b.pop();E.d>g.d&&(g=E,e&&console.log("found best %d after %d probes",Math.round(1e4*E.d)/1e4,M)),!(E.max-g.d<=r)&&(d=E.h/2,b.push(new Cn(E.x-d,E.y-d,d,i)),b.push(new Cn(E.x+d,E.y-d,d,i)),b.push(new Cn(E.x-d,E.y+d,d,i)),b.push(new Cn(E.x+d,E.y+d,d,i)),M+=4)}e&&(console.log("num probes: "+M),console.log("best distance: "+g.d));var w=[g.x,g.y];return w.distance=g.d,w}function sx(i,r){return r.max-i.max}function Cn(i,r,e,t){this.x=i,this.y=r,this.h=e,this.d=ax(i,r,t),this.max=this.d+this.h*Math.SQRT2}function ax(i,r,e){for(var t=!1,n=1/0,o=0;o<e.length;o++)for(var s=e[o],a=0,l=s.length,u=l-1;a<l;u=a++){var m=s[a],h=s[u];m[1]>r!=h[1]>r&&i<(h[0]-m[0])*(r-m[1])/(h[1]-m[1])+m[0]&&(t=!t),n=Math.min(n,cx(i,r,m,h))}return n===0?0:(t?1:-1)*Math.sqrt(n)}function lx(i){for(var r=0,e=0,t=0,n=i[0],o=0,s=n.length,a=s-1;o<s;a=o++){var l=n[o],u=n[a],m=l[0]*u[1]-u[0]*l[1];e+=(l[0]+u[0])*m,t+=(l[1]+u[1])*m,r+=m*3}return r===0?new Cn(n[0][0],n[0][1],0,i):new Cn(e/r,t/r,0,i)}function cx(i,r,e,t){var n=e[0],o=e[1],s=t[0]-n,a=t[1]-o;if(s!==0||a!==0){var l=((i-n)*s+(r-o)*a)/(s*s+a*a);l>1?(n=t[0],o=t[1]):l>0&&(n+=s*l,o+=a*l)}return s=i-n,a=r-o,s*s+a*a}});v();v();globalThis.MappedinDebug||(globalThis.MappedinDebug={});globalThis.MappedinDebug.__idleCallbackInteractionState={isInteracting:!1,interactionCheckers:[],pendingCallbacks:[],registerInteractionChecker:function(i){this.interactionCheckers.push(i)},unregisterInteractionChecker:function(i){let r;for(let e=this.interactionCheckers.length-1;e>=0;e--)if(r=this.interactionCheckers[e],r===i){this.interactionCheckers.splice(e,1);break}},checkInteraction:function(){let i=!1;for(let r=0;r<this.interactionCheckers.length;r++)if(i=this.interactionCheckers[r](),i)return!0;return!1},addPendingCallback:function(i,r){this.pendingCallbacks.push({callback:i,timeoutId:r}),this.scheduleDeferredCheck()},scheduleDeferredCheck:function(){var i=this;this.checkTimeoutId||(this.checkTimeoutId=setTimeout(function r(){if(i.checkInteraction())i.checkTimeoutId=setTimeout(r,16);else{i.checkTimeoutId=null;var e=i.pendingCallbacks.slice();i.pendingCallbacks=[];let t;for(let n=0;n<e.length;n++)if(t=e[n],t&&t.callback)try{t.callback()}catch(o){}}},16))},removePendingCallback:function(i){let r;for(let e=this.pendingCallbacks.length-1;e>=0;e--)if(r=this.pendingCallbacks[e],r.timeoutId===i){this.pendingCallbacks.splice(e,1);break}}};globalThis.requestIdleCallback=globalThis.requestIdleCallback||function(i){var o,s;var r=performance.now(),e,t=!1,n=function(){if(!t){t=!0;try{i({didTimeout:!1,timeRemaining:function(){return Math.max(0,50-(performance.now()-r))}})}catch(a){}}};return(s=(o=globalThis.MappedinDebug)==null?void 0:o.__idleCallbackInteractionState)!=null&&s.checkInteraction()?(e=Date.now()+Math.random(),globalThis.MappedinDebug.__idleCallbackInteractionState.addPendingCallback(n,e),e):(e=setTimeout(n,0),e)};globalThis.cancelIdleCallback=globalThis.cancelIdleCallback||function(i){var r,e;clearTimeout(i),(e=(r=globalThis.MappedinDebug)==null?void 0:r.__idleCallbackInteractionState)==null||e.removePendingCallback(i)};v();v();(function(){typeof globalThis!="object"&&(Object.defineProperty(Object.prototype,"__magic__",{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__)})();var rm="data:image/jpeg;base64,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gAAEAAgEAggEEEEEEEFSCCCCCCAQASCSQWJJJJLEkkkkkgkkEgEgEgAAEAAgEAggEEEEEH5AQQQQVBBAIAAJBIJJJLEkkkkliSSSSSQSSCQSAAAQAQQCCCCCCCCCpBBBBBUEEEAgAAkEgkkksSSSSSWJJJJJJBJIJBIAABABBAIIIIIIIIKg/LCAQCACAAAACQCQSCQSASSASCQCQAAAAAAQCAQAQCAQAQQCACAAAACQCQSCQSASSASCQCQAAAAAAQCAQAQCAQfPgAAAAAAAAAAAAAAkAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAkAAAAAAAAAAAAAAgAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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bpu3bpum6bpum6bpum6bpu3TdN03bpum6bpum6bt03TdN03TdN03TdN03TdN03TduysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysmzKzKzKybMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrJT+2lKUpSlKUpSlKUpSlKUpSlKUpSlKUpSlKUpSn9tKUpSlKUpSlKUpSlKUpSlKUpSlKUpSlKUpT/wDrA//EAB0RAAMBAAMBAQEAAAAAAAAAAAABERIwQFAgkMD/2gAIAQIBAT8A/COlKioqKioqKi+zSoqKioqL59Ro0aKyvpVlZWaNFXiVGkaNFZWV9CsrNGjRpFXepo0V8c69Zo0u1pGilfVnJWaNF+NFXNUaNFfmU0aReamkaNPzNM19VlZWaKysrK/XrKzTNGjRWaKyv+u0/8QAHREBAQACAQUAAAAAAAAAAAAAEQBAUCAQITCQwP/aAAgBAwEBPwD1NkRER07eYiIiNMRERGARERGgIiNAREZRERoCIjiYBERqiIwiI1REcCIiIiIjbkREREREfXZ//9k=";v();var Fc=class i extends Error{constructor(e){super(e);p(this,"name","AssertionError");Error.captureStackTrace&&Error.captureStackTrace(this,i)}};function nm(i,r){if(i==null){let e;if(r!=null&&r.customMessage)e=r.customMessage;else{let o=r!=null&&r.valueName?"'".concat(r.valueName,"'"):"value";e="Expected ".concat(o," to be defined, but received ").concat(i)}let t=(r==null?void 0:r.errorClass)||Fc,n=new t(e);throw(r==null?void 0:r.captureStackTrace)!==!1&&Error.captureStackTrace&&Error.captureStackTrace(n,nm),n}}function Gc(i,r,e){if(nm(i),(i==null?void 0:i.type)!==r){let t="Expected type ".concat(r," but got ").concat(i==null?void 0:i.type);throw new Error(e!=null?e:t)}}v();v();var im=!1;function Rg(){im=!0}function om(){return im}var ea=class{constructor(r){p(this,"backgroundAlpha",1);p(this,"backgroundColor",new me);p(this,"width",0);p(this,"height",0);p(this,"options",{});p(this,"renderer");p(this,"enabledLayers",new Set([0,1]));p(this,"matricesUpdatedThisFrame",!1);p(this,"handleWebGLContextCreationError",r=>{var e,t;(t=(e=this.options).onWebGLContextCreationError)==null||t.call(e,r)});p(this,"handleWebGLContextLost",r=>{var e,t;(t=(e=this.options).onWebGLContextLost)==null||t.call(e,r)});p(this,"handleWebGLContextRestored",r=>{var e,t;(t=(e=this.options).onWebGLContextRestored)==null||t.call(e,r)});var e,t,n,o,s;try{this.options=r,om()?(this.renderer={setSize:()=>{},state:{reset:()=>{}},properties:{get:()=>{}},getSize:()=>({width:window.innerWidth,height:innerHeight}),getDrawingBufferSize:()=>({width:window.innerWidth,height:innerHeight}),getClearAlpha:()=>1,getClearColor:()=>new me,autoUpdate:!0,shadowMap:{autoUpdate:!0},getContext:()=>({getContextAttributes(){return{alpha:!0,antialias:!1,depth:!0,stencil:!1}}}),readRenderTargetPixelsAsync:()=>Promise.resolve([]),setRenderTarget:()=>{},setClearColor:()=>{},clear:()=>{},render:()=>{},clearStencil:()=>{},clearDepth:()=>{},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=new Qh({canvas:r.canvas,alpha:r.alpha||!1,stencil:!0,antialias:typeof r.antialias=="boolean"?r.antialias:!0,powerPreference:"high-performance",preserveDrawingBuffer:!0}),this.renderer.localClippingEnabled=!0),this.backgroundColor=new me((e=r.backgroundColor)!=null?e:"#ffffff"),this.backgroundAlpha=(t=r.backgroundAlpha)!=null?t:1}catch(a){$.error(a),r.onWebGLRendererError&&r.onWebGLRendererError(a)}(n=this.domElement())==null||n.addEventListener("webglcontextlost",this.handleWebGLContextLost),(o=this.domElement())==null||o.addEventListener("webglcontextrestored",this.handleWebGLContextRestored),(s=this.domElement())==null||s.addEventListener("webglcontextcreationerror",this.handleWebGLContextCreationError)}destroy(){var r,e,t,n,o;this.renderer&&((e=(r=this.renderer).dispose)==null||e.call(r)),(t=this.domElement())==null||t.removeEventListener("webglcontextlost",this.handleWebGLContextLost),(n=this.domElement())==null||n.removeEventListener("webglcontextrestored",this.handleWebGLContextRestored),(o=this.domElement())==null||o.removeEventListener("webglcontextcreationerror",this.handleWebGLContextCreationError)}startFrame(){this.matricesUpdatedThisFrame=!1}updateMatricesIfNeeded(r){this.matricesUpdatedThisFrame||(r.updateMatrixWorld(),this.matricesUpdatedThisFrame=!0)}renderScene(r,e){this.renderer&&(this.updateMatricesIfNeeded(r),this.renderer.render(r,e))}renderFullScene(r,e){if(this.renderer){this.renderer.state.reset(),this.updateMatricesIfNeeded(r),this.renderer.clearStencil(),this.renderer.setRenderTarget(null),this.renderer.autoClear=!1,e.layers.disableAll();for(let t of this.enabledLayers.values())e.layers.enable(t);this.renderer.render(r,e),this.renderer.clearDepth(),e.layers.disableAll(),e.layers.enable(Je.ALWAYS_ON_TOP_PATHS),this.renderer.render(r,e),this.renderer.clearStencil(),this.renderer.state.reset()}}clear(){this.renderer&&(this.renderer.setClearColor(this.backgroundColor,this.backgroundAlpha),this.renderer.clear())}setBufferSize(r,e){D.env.NODE_ENV==="test"||!this.renderer||(this.width=r,this.height=e,this.renderer.setSize(r,e,!1))}setBackgroundColor(r,e){this.backgroundColor=r,this.backgroundAlpha=e}domElement(){var r;return(r=this.renderer)==null?void 0:r.domElement}};v();v();v();v();v();v();v();function sm(i,r){return r.x+r.w<i.x+i.w&&r.x>i.x&&r.y>i.y&&r.y+r.h<i.y+i.h}v();function am(i,r){let[e,t]=r;return e>=i.x&&e<=i.x+i.w&&t>=i.y&&t<=i.y+i.h}v();function lm(i,r){let e=r.x,t=r.y,n=r.x+r.w,o=r.y+r.h,s=i.x,a=i.y,l=i.x+i.w,u=i.y+i.h;return e<l&&s<n&&t<u&&a<o}v();function Nr(i,r){for(let e=0;e<r.length;e++)i.push(r[e])}v();var pt=class{constructor(r,e,t,n,o){p(this,"x");p(this,"y");p(this,"w");p(this,"h");p(this,"userData");this.userData=typeof o>"u"?null:o,this.x=r,this.y=e,this.w=t,this.h=n}contains(r){return r===this?!1:sm(this,r)}intersects(r){return lm(this,r)}intersectsPoint(r){return am(this,r)}draw(r){r.fillStyle="rgba(123,222,26, 0.8)",r.fillRect(this.x,this.y,this.w,this.h)}};var lo=class i{constructor(r,e){p(this,"topLeft");p(this,"topRight");p(this,"bottomLeft");p(this,"bottomRight");p(this,"divided",!1);p(this,"boundary");p(this,"capacity",16);p(this,"objects",[]);p(this,"parent");this.parent=e,this.boundary=r}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:r,y:e,w:t,h:n}=this.boundary;this.topLeft=new i(new pt(r,e,t/2,n/2),this),this.topRight=new i(new pt(r+t/2,e,t/2,n/2),this),this.bottomLeft=new i(new pt(r,e+n/2,t/2,n/2),this),this.bottomRight=new i(new pt(r+t/2,e+n/2,t/2,n/2),this),this.divided=!0}queryRect(r){let e=[];if(this.boundary.intersects(r))e.push(...this.objects);else return[];return this.divided&&(Nr(e,this.topLeft.queryRect(r)),Nr(e,this.topRight.queryRect(r)),Nr(e,this.bottomLeft.queryRect(r)),Nr(e,this.bottomRight.queryRect(r))),e}queryPoint(r){let e=[];if(this.boundary.intersectsPoint(r))e.push(...this.objects);else return[];return this.divided&&(Nr(e,this.topLeft.queryPoint(r)),Nr(e,this.topRight.queryPoint(r)),Nr(e,this.bottomLeft.queryPoint(r)),Nr(e,this.bottomRight.queryPoint(r))),e}insert(r){return(this.parent?!this.boundary.contains(r):!this.boundary.intersects(r))?!1:this.objects.length<this.capacity?(this.objects.push(r),!0):(this.divided||this.subdivide(),(this.topLeft.insert(r)||this.topRight.insert(r)||this.bottomLeft.insert(r)||this.bottomRight.insert(r))===!1&&this.objects.push(r),!0)}drawObjects(r){this.objects.forEach(e=>e.draw(r)),this.divided&&(this.topLeft.drawObjects(r),this.topRight.drawObjects(r),this.bottomLeft.drawObjects(r),this.bottomRight.drawObjects(r))}draw(r){r.rect(this.boundary.x,this.boundary.y,this.boundary.w,this.boundary.h),this.divided&&(this.topLeft.draw(r),this.topRight.draw(r),this.bottomLeft.draw(r),this.bottomRight.draw(r)),r.strokeStyle="black",r.lineWidth=4,r.stroke()}};v();v();var ta=class{constructor(r){p(this,"type");p(this,"event");this.type=0,this.event=r}get timestamp(){return this.event.timeStamp}},ra=class{constructor(){p(this,"taps",[])}add(r){this.lastPointerDown&&r.timestamp-this.lastPointerDown.timestamp<50?this.lastPointerDown.type=1:this.taps.push(r)}get lastPointerDown(){return this.taps.length>=1?this.taps[this.taps.length-1]:void 0}get isSingleTapWithTwoFingers(){var r;return this.isSingleTap&&((r=this.lastPointerDown)==null?void 0:r.type)===1}get isSingleTapWithOneFinger(){var r;return this.isSingleTap&&((r=this.lastPointerDown)==null?void 0:r.type)===0}get isDoubleTapWithOneFinger(){var r,e;return this.isDoubleTap&&((r=this.taps[0])==null?void 0:r.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(r){this.taps=this.taps.filter(e=>r-e.timestamp<300)}flush(){this.taps=[]}get _taps(){return this.taps}destroy(){this.flush()}};v();function Bc(i){let r=new Set;for(let e of i){let t=e.object;for(;t.visible&&t.parent&&t.parent.visible===!0&&!r.has(t.parent);)t=t.parent,t instanceof Ne&&t.type==="group-container"&&t.visible&&t.components[0]&&r.add(t)}return Array.from(r)}v();function kc(i,r){if(i==null||r==null)return i===r;if(i.length!==r.length)return!1;for(let e=0;e<i.length;e++)if(i[e]!==r[e])return!1;return!0}var co=class extends ye{constructor(e,t,n,o,s){super();p(this,"raycaster",new nn);p(this,"state",{hovered3DEntity:void 0,hovered2DEntities:new Set,hovered3DContainers:void 0,lastHover:void 0,interaction:{mouseDownStart:void 0,distanceFromMouseDown:void 0,isPanning:!1}});p(this,"coreState");p(this,"camera");p(this,"worldPlane");p(this,"_quadtree",new lo(new pt(0,0,0,0)));p(this,"_container");p(this,"lastPointerEvent");p(this,"cursor","grab");p(this,"touchesCount",0);p(this,"isUserMovingCamera");p(this,"hasTouched",!1);p(this,"onPointerMove",Cs(e=>{e&&(e.preventDefault(),this.updateInteractionStateIfPanning(e),(e.pointerType!=="touch"||e.pointerType===void 0&&this.hasTouched)&&this.handleHover(e),this.handleCursor())},D.env.NODE_ENV==="test"?0:16,{leading:!0}));p(this,"tapsControl",new ra);p(this,"onPointerDown",e=>{e.target===this._container&&(this._container.addEventListener("pointerup",this.onPointerUp,{capture:!1,signal:this.signal}),this._container.addEventListener("pointercancel",this.onPointerUp,{capture:!1,signal:this.signal}),this.state.interaction.mouseDownStart={time:Date.now(),timestamp:e.timeStamp,offsetX:e.offsetX,offsetY:e.offsetY},this.lastPointerEvent=e,this.state.interaction.distanceFromMouseDown=0,this.handleCursor(),e.pointerType==="touch"&&(this.tapsControl.add(new ta(e)),this.touchesCount=Math.max(0,this.touchesCount+1)))});p(this,"clickTimeout");p(this,"onPointerUp",e=>{this.tapsControl.discardOutsideOfWaitWindow(e.timeStamp),this.lastPointerEvent=e,this.touchesCount=Math.max(0,this.touchesCount-1),this.touchesCount===0&&(this._container.removeEventListener("pointerup",this.onPointerUp,{capture:!1}),this._container.removeEventListener("pointercancel",this.onPointerUp,{capture:!1})),this.updateInteractionStateIfPanning(e);let{mouseDownStart:t}=this.state.interaction;!t||this.state.interaction.distanceFromMouseDown==null||(Date.now()<t.time+300&&(this.tapsControl.isSingleTapWithTwoFingers||this.state.interaction.distanceFromMouseDown<=15)&&(e.pointerType==="touch"&&!this.isUserMovingCamera()?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())});p(this,"dirty3D",!0);p(this,"cachedHitBoxes",{entities:[]});p(this,"ndcPoint",new he);p(this,"debugPanel");this.isUserMovingCamera=s,this.raycaster.layers.enableAll(),this.raycaster.layers.disable(1),this.camera=n,this._container=e,this.coreState=t,this.worldPlane=o,this._container.addEventListener("pointerdown",this.onPointerDown,{capture:!1,signal:this.signal}),this._container.addEventListener("pointermove",this.onPointerMove,{capture:!1,signal:this.signal}),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)}}getThreeDIntersectsFromXY(e){this.raycaster.setFromCamera(e,this.camera),this.raycaster.layers.enable(Je.GEOMETRY);let t=this.raycaster.intersectObjects(this._hitBoxes.entities,!0).filter(o=>{var s,a;return((s=o.object)==null?void 0:s.name)==="worldPlane"||((a=o.object)==null?void 0:a.visible)}),n=t.findIndex(o=>{var s;return((s=o.object)==null?void 0:s.name)==="worldPlane"});return n!==-1&&t.push(t.splice(n,1)[0]),t}getGroupContainerIntersectsFromXY(e){let t=this.getThreeDIntersectsFromXY(e),n;return t!=null&&t.length>0&&(n=Bc(t)),n}flush(){this.tapsControl.flush(),this.clickTimeout!=null&&(clearTimeout(this.clickTimeout),this.clickTimeout=void 0)}handleHover(e){let t=e||this.lastPointerEvent;if((t==null?void 0:t.pointerType)==="touch"||this.state.interaction.mouseDownStart||!t||this.isUserMovingCamera())return;let{entity3D:n,entity2D:o,position:s,groupContainers:a}=this.intersect(t);(this.detect3DEntityHover(n)||this.detect2DEntityHover(o)||this.detect3DContainerHover(a))&&(this.state.hovered3DEntity=n,this.state.lastHover=n,this.state.hovered2DEntities=new Set(o.map(l=>l.id)),this.state.hovered3DContainers=a,this.publish("hover",{entity2D:o,entity3D:this.state.hovered3DEntity,position:s,groupContainers:a})),this.handleCursor()}handleCursor(){var s;let e=!!(this.state.hovered3DEntity&&((s=this.state.hovered3DEntity)!=null&&s.components[2])||this.state.hovered2DEntities.size>0),t=!!this.state.interaction.mouseDownStart,n=this.state.interaction.isPanning,o=Gg(e,n,t);this.cursor!==o&&(this.cursor=o,o==="pointer"?this._container.classList.add("mappedin-interaction-hover"):this._container.classList.remove("mappedin-interaction-hover"))}detect2DEntityHover(e){if(e.length!==this.state.hovered2DEntities.size)return!0;for(let t=0;t<e.length;t++)if(!this.state.hovered2DEntities.has(e[t].id))return!0;return!1}handleClick(e){let t=this.intersect(e);this.publish("click",{entity2D:t.entity2D,entity3D:t.entity3D,position:t.position,groupContainers:t.groupContainers,pointerEvent:{button:e.button}})}get _hitBoxes(){if(this.dirty3D){this.cachedHitBoxes.entities=[];let e;for(let t of this.coreState.geometry3DIdsInScene)e=this.coreState.geometry3DMap.get(t),((e==null?void 0:e.type)==="geometry"||(e==null?void 0:e.type)==="model"||(e==null?void 0:e.type)==="path"||(e==null?void 0:e.type)==="custom-geometry")&&e.components[0].mesh&&!this.cachedHitBoxes.entities.includes(e.components[0].mesh)&&this.cachedHitBoxes.entities.push(e.components[0].mesh);return this.dirty3D=!1,this.cachedHitBoxes.entities.push(this.worldPlane),this.cachedHitBoxes}return this.cachedHitBoxes}intersect(e){var S,M,E,w,R,I,T;let{offsetX:t,offsetY:n}=e,o=[t,n],a=this._quadtree.queryPoint(o).filter(C=>C.intersectsPoint(o));this.ndcPoint.x=t/this._container.clientWidth*2-1,this.ndcPoint.y=-(n/this._container.clientHeight)*2+1;let l=this.getThreeDIntersectsFromXY(this.ndcPoint),u=(S=l[0])==null?void 0:S.point,m=[],h=[],d=[];for(let C of l){if(["worldPlane","hole-fill-mesh"].includes(C.object.name)||!(C.object instanceof pe)||((M=C.object.material)==null?void 0:M.colorWrite)===!1)continue;let F=(E=C.object.userData)==null?void 0:E.entityId;if(F){let L=this.coreState.geometry3DMap.get(F),N=L==null?void 0:L.components[7];if((N==null?void 0:N.verticalOffset)!=null&&C.point.z>N.verticalOffset)continue}d.push(C),C.object.material.depthTest===!1?m.push(C):h.push(C)}let f=(R=(w=m[0])!=null?w:h[0])!=null?R:void 0,b,x;if(f!=null){let C=(I=f==null?void 0:f.instanceId)!=null?I:f==null?void 0:f.batchId;b=C!=null&&(f!=null&&f.object.userData.entities)?this.coreState.geometry3DMap.get(f==null?void 0:f.object.userData.entities[C]):this.coreState.geometry3DMap.get(f==null?void 0:f.object.userData.entityId),b!=null&&b.components[2]&&(x=b)}let y=Bc(d),g=[];for(let C of a)if(((T=C==null?void 0:C.userData)==null?void 0:T.entityId)==="watermark")g.push({id:"watermark"});else{let F=this.coreState.geometry2DMap.get(C==null?void 0:C.userData.entityId);F&&g.push(F)}return Ng(g),{entity2D:g,entity3D:x,position:u,groupContainers:y.length>0?y:void 0}}detect3DEntityHover(e){return this.state.lastHover!==e&&(this.state.lastHover&&hm(this.state.lastHover,!1,this.coreState),e&&hm(e,!0,this.coreState)),this.state.hovered3DEntity!==e}detect3DContainerHover(e){return!kc(this.state.hovered3DContainers,e)}updateInteractionStateIfPanning(e){this.state.interaction.mouseDownStart&&(this.state.interaction.distanceFromMouseDown=Math.sqrt(Math.pow(e.offsetX-this.state.interaction.mouseDownStart.offsetX,2)+Math.pow(e.offsetY-this.state.interaction.mouseDownStart.offsetY,2)),!this.state.interaction.isPanning&&this.state.interaction.distanceFromMouseDown>15&&(this.state.interaction.isPanning=!0))}getMouseRayIntersects(){return this.raycaster.intersectObjects([this.worldPlane],!1)}destroy(){this._container.removeEventListener("pointerdown",this.onPointerDown,{capture:!1}),this._container.removeEventListener("pointermove",this.onPointerMove,{capture:!1}),this._container.removeEventListener("pointerup",this.onPointerUp,{capture:!1}),this._container.removeEventListener("pointercancel",this.onPointerUp,{capture:!1}),super.destroy()}enableDebug(){let e=document.createElement("div");e.style.position="absolute",e.style.top="0",e.style.right="0",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",t=>{var n,o,s;this.queueDebugMessage("CLICK \n3D: ".concat((n=t.entity3D)==null?void 0:n.id," \n2D: ").concat((o=t.entity2D)==null?void 0:o.map(a=>a.id).join(", ")," \nPos: ").concat((s=t.position)==null?void 0:s.toArray().join(", ")),"#fdffb6")}),this.on("hover",t=>{var n,o,s;this.queueDebugMessage("HOVER \n3D: ".concat((n=t.entity3D)==null?void 0:n.id," \n2D: ").concat((o=t.entity2D)==null?void 0:o.map(a=>a.id).join(", ")," \nPos: ").concat((s=t.position)==null?void 0:s.toArray().join(", ")),"#caffbf")})}get _state(){return this.state}queueDebugMessage(e,t){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=t,n.textContent=e,(o=this.debugPanel)==null||o.prepend(n),setTimeout(()=>{n.style.opacity="0",setTimeout(()=>{n.remove()},500)},2500)}getCursor(){return this.cursor}};function hm(i,r,e){var s;let t=i.components[2];t&&t.hover!==!0&&(t.hover=r?"user-interaction":!1,t.dirty=!0);let n=(s=i.components[0].textMesh)==null?void 0:s.userData.entityId;if(!n)return;let o=e.geometry3DMap.get(n);(o==null?void 0:o.type)==="text3d"&&(o.components[1].hoverByPolygon=r,o.components[1].dirty=!0)}function Gg(i,r,e){return r?"grabbing":i?"pointer":e?"grabbing":"grab"}function Ng(i){if(i.length<=1)return;let r=[],e=[],t=[];for(let o=0;o<i.length;o++){let s=i[o];s.components?s.type==="marker"?r.push(s):e.push(s):t.push(s)}if(r.length>1){let o,s;r.sort((a,l)=>{o=a.components[0],s=l.components[0];let u=o.projection.y,m=s.projection.y;return u!==m?m-u:o.markerContainer.compareDocumentPosition(s.markerContainer)&Node.DOCUMENT_POSITION_FOLLOWING?1:-1})}if(e.length>1){let o=[];for(let s=0;s<e.length;s++){let a=e[s],l=a.components[0];o.push({entity:a,y:l.projection.y,idx:s})}o.sort((s,a)=>s.y!==a.y?a.y-s.y:a.idx-s.idx);for(let s=0;s<o.length;s++)e[s]=o[s].entity}let n=0;for(let o=0;o<r.length;o++)i[n++]=r[o];for(let o=0;o<e.length;o++)i[n++]=e[o];for(let o=0;o<t.length;o++)i[n++]=t[o]}v();v();v();var dm=new we;function uo(i,r=!0){var m,h;let e=new tn,t=(m=i.mesh)==null?void 0:m.geometry;if(!t||!((h=i.batchedProps)!=null&&h.range))return;let n=i.batchedProps.range,o=n.start,s=n.count,a=t.getAttribute("position");if(a){let d=new Float32Array(s*3);for(let f=0;f<s;f++){let b=o+f;d[f*3]=a.array[b*3],d[f*3+1]=a.array[b*3+1],d[f*3+2]=a.array[b*3+2]}e.setAttribute("position",new It(d,3))}let l=t.getAttribute("normal");if(l){let d=new Float32Array(s*3);for(let f=0;f<s;f++){let b=o+f;d[f*3]=l.array[b*3],d[f*3+1]=l.array[b*3+1],d[f*3+2]=l.array[b*3+2]}e.setAttribute("normal",new It(d,3))}let u=t.getAttribute("uv");if(u){let d=new Float32Array(s*2);for(let f=0;f<s;f++){let b=o+f;d[f*2]=u.array[b*2],d[f*2+1]=u.array[b*2+1]}e.setAttribute("uv",new It(d,2))}if(t.index){let d=t.index,f=new Uint32Array(s);for(let b=0;b<s;b++)f[b]=d.array[o+b];e.setIndex(new It(f,1))}if(r&&i.instanceIndex!==-1&&i.mesh)try{i.mesh.getMatrixAt(i.instanceIndex,dm),e.applyMatrix4(dm)}catch(d){$.error(d)}return e}function mm(i,r,e){let t=uo(i,!1);if(!t||!i.mesh)return;i.mesh.getMatrixAt(i.instanceIndex,e),i.mesh.deleteInstance(i.instanceIndex),i.mesh.optimize();let n=r.addGeometry(t);r.addInstance(n),r.setMatrixAt(n,e);let o=r.getGeometryIdAt(n),s=r.getGeometryRangeAt(o);return s&&i.batchedProps&&(i.batchedProps.range=s),t.dispose(),n}function pm(i,r){if(r===0)return;let e=i.getAttribute("position");for(let t=0;t<e.count;t++)e.setZ(t,e.getZ(t)+r);e.needsUpdate=!0}var An,ln,na,xi,fm,mo,ia,gm,oa,sa,po,fo,aa,ho=class{constructor(r){A(this,xi);A(this,An,null);A(this,ln);p(this,"getCurrentSceneGLTF",async r=>{let e=V({onlyVisible:!0,binary:!0,light:!0,scale:1},r),t=await te(this,xi,fm).call(this),n=c(this,na).call(this,e),o=await t.parseAsync(n,{trs:!1,maxTextureSize:1/0,onlyVisible:e.onlyVisible,binary:e.binary,scale:e.scale}),s;if(o instanceof ArrayBuffer)s=new Blob([o],{type:"application/octet-stream"});else{let a=JSON.stringify(o,null,2);s=new Blob([a],{type:"text/plain"})}return s});A(this,na,r=>{let{scale:e,light:t,onlyVisible:n}=r,o=new Rr,s=new qe().setFromObject(c(this,ln).geometryScene);if(c(this,mo).call(this,c(this,ln).geometryScene,o,n),t){let a=new Bs(16777215,.3*Math.PI);a.position.set(0,Math.max(s.max.x,s.max.y)*e*.5,s.max.y*e*4),a.lookAt(0,0,-1),a.target.position.set(0,0,-1),a.add(a.target),o.add(a)}return o});A(this,mo,(r,e,t)=>{r.material&&r instanceof _s&&te(this,xi,gm).call(this,r).forEach(n=>e.add(n)),r.children.forEach(n=>{(!t||n.visible)&&c(this,mo).call(this,n,e,t)})});A(this,ia,(r,e,t)=>{let n=new eo({color:new me(r),metalness:0});return n.opacity=e,n.transparent=t,n});A(this,oa,r=>{let{geometry:e,material:t,position:n,rotation:o,quaternion:s,scale:a}=r;if(!(e!=null&&e.isBufferGeometry))return r;let l=e.attributes.position,u=e.attributes.normal,m=e.attributes.uv;return c(this,sa).call(this,l,u),c(this,fo).call(this,n,a,o,s),m&&c(this,aa).call(this,m),t!=null&&t.map&&e.type==="PlaneGeometry"&&(r.side=br),r});A(this,sa,(r,e)=>{let t=new k,n=new k;for(let o=0;o<r.count;o++)t.fromBufferAttribute(r,o),c(this,po).call(this,t),r.setXYZ(o,t.x,t.y,t.z),e&&(n.fromBufferAttribute(e,o),c(this,po).call(this,n),e.setXYZ(o,n.x,n.y,n.z))});A(this,po,r=>{let e=r.y;r.y=r.z,r.z=-e});A(this,fo,(r,e,t,n)=>{let o=r.y;r.y=r.z,r.z=-o;let s=e.y;if(e.y=e.z,e.z=s,t instanceof Ar)t.order="YXZ",t.set(t.x,t.y,t.z,t.order);else{let a=n.y;n.set(n.x,n.z,-a,n.w)}});A(this,aa,r=>{for(let e=0;e<r.count;e++){let t=r.getX(e),n=r.getY(e);r.setXY(e,t,n)}});_(this,ln,r)}destroy(){_(this,An,null)}};An=new WeakMap,ln=new WeakMap,na=new WeakMap,xi=new WeakSet,fm=async function(){if(!c(this,An)){let{GLTFExporter:r}=await import("./GLTFExporter-CXO2YAF3.js");_(this,An,new r)}return c(this,An)},mo=new WeakMap,ia=new WeakMap,gm=function(r){var a,l;let e=[],n=((a=r.userData)!=null&&a.entities?Object.values((l=r.userData)==null?void 0:l.entities):[]).map(u=>c(this,ln).geometry3DMap.get(u)),o=new Map;r.updateWorldMatrix(!0,!1);let s=new k;return r.getWorldPosition(s),n.forEach(u=>{var b;if(!u||!(u instanceof Te))return;let m=u.components[1],h=u.components[2];if(!m.visible||m instanceof xr&&m.opacity===0||m instanceof oo||m instanceof Xs)return;let d=h!=null&&h.hover?m.hoverColor||c(this,ln).hoverColor:m.color,f="".concat(d,"-").concat(m.opacity,"-").concat(Number(m.visible));o.has(f)||o.set(f,[]),(b=o.get(f))==null||b.push(u)}),o.forEach((u,m)=>{let[h,d,f]=m.split("-"),b=u.reduce((S,M)=>{if(M.type==="custom-geometry")return S;let E=M.components[0];if("geometry"in E&&E.geometry instanceof tn){let w=E.geometry.clone();pm(w,s.z),S.push(w)}else if(E instanceof Qe&&E.batchedProps){let w=uo(E);w&&(pm(w,s.z),S.push(w))}return S},[]);if(b.length===0){$.error("No geometries found for batched mesh");return}let x=c(this,ia).call(this,h,Number(d),r.material.transparent),y=Xt(b,!0);if(!y){$.error("No merged geometry found for batched mesh");return}let g=new pe(y,x);g.position.copy(r.position),g.rotation.copy(r.rotation),g.scale.copy(r.scale),g.visible=!!f,c(this,fo).call(this,g.position,g.scale,g.rotation,g.quaternion),e.push(c(this,oa).call(this,g))}),e},oa=new WeakMap,sa=new WeakMap,po=new WeakMap,fo=new WeakMap,aa=new WeakMap;v();v();var Bg="gray",kg=.1,go=100,Uc=new vr.ClipperOffset;function zg(i,r){Uc.Clear(),r/=2;let e=i.map(n=>({X:n.x*go,Y:n.y*go}));Uc.AddPath(e,vr.JoinType.jtMiter,vr.EndType.etClosedPolygon);let t=new vr.Paths;return Uc.Execute(t,r*go),t.length?t.map(o=>o.map(s=>({x:s.X/go,y:s.Y/go}))):[i]}function ca(i,r,e){var f,b,x,y,g;let{color:t=Bg,opacity:n=1,altitude:o=0,height:s=kg}=e||{};Array.isArray(n)&&(n=1);let a={min:{x:1/0,y:1/0,z:o},max:{x:-1/0,y:-1/0,z:s+o},center:{x:0,y:0,z:(s+o)/2}},u=i.geometry.coordinates[0].map(S=>{let M=r(S[1],S[0]);return a.min.x=Math.min(a.min.x,M.x),a.min.y=Math.min(a.min.y,M.y),a.max.x=Math.max(a.max.x,M.x),a.max.y=Math.max(a.max.y,M.y),M});((b=(f=i.properties)==null?void 0:f.style)==null?void 0:b.edgeOffset)!=null&&i.properties.style.edgeOffset!==0||((x=i.properties)==null?void 0:x.image)!=null?u=zg(u,((g=(y=i.properties)==null?void 0:y.style)==null?void 0:g.edgeOffset)||0):u=[u];let m=[];for(let S of u){let M=new fi;M.moveTo(S[0].x,S[0].y),S.slice(1).forEach(I=>M.lineTo(I.x,I.y)),M.lineTo(S[0].x,S[0].y);let E=i.geometry.coordinates.slice(1);M.holes=E.map(I=>{let T=I.map(F=>r(F[1],F[0])),C=new pi;return C.moveTo(T[0].x,T[0].y),T.slice(1).forEach(F=>C.lineTo(F.x,F.y)),C.lineTo(T[0].x,T[0].y),C});let w=io(e==null?void 0:e.bevel,s),R=new gi(M,w);R.userData={style:{color:t,opacity:n},usedBevelSettings:w},m.push(R)}if(m.length===1)return m[0];let h=Xt(m);m.forEach(S=>S.dispose());let d=io(e==null?void 0:e.bevel,s);return h.userData={style:{color:t,opacity:n},usedBevelSettings:d,_split:!0},h}v();var Ug="gray",Hg=.1;function ua(i,r,e){let{color:t=Ug,opacity:n=1,altitude:o=0,height:s=Hg}=e||{};Array.isArray(n)&&(n=1);let a={min:{x:1/0,y:1/0,z:o},max:{x:-1/0,y:-1/0,z:s+o}},l=io(e==null?void 0:e.bevel,s),u=[];i.geometry.coordinates.forEach(h=>{let d=new fi,f=h[0].map(y=>{let g=r(y[1],y[0]);return a.min.x=Math.min(a.min.x,g.x),a.min.y=Math.min(a.min.y,g.y),a.max.x=Math.max(a.max.x,g.x),a.max.y=Math.max(a.max.y,g.y),g});d.moveTo(f[0].x,f[0].y),f.slice(1).forEach(y=>d.lineTo(y.x,y.y)),d.lineTo(f[0].x,f[0].y);let b=h.slice(1);d.holes=b.map(y=>{let g=y.map(M=>r(M[1],M[0])),S=new pi;return S.moveTo(g[0].x,g[0].y),g.slice(1).forEach(M=>S.lineTo(M.x,M.y)),S.lineTo(g[0].x,g[0].y),S});let x=new gi(d,l);u.push(x)});let m=Xt(u);return u.forEach(h=>h.dispose()),m.userData={style:{color:t,opacity:n},usedBevelSettings:l},m}v();var xt=100,Vg=.22,Wg=.01;function ym(i,r,e={}){let{width:t=Vg,height:n=Wg,color:o="gray",opacity:s=1,altitude:a=0}=e,l={min:{x:1/0,y:1/0,z:a},max:{x:-1/0,y:-1/0,z:a+n}},u={bevelEnabled:!1,depth:n},m=new vr.ClipperOffset,h=i.geometry.coordinates.map(x=>x.map(y=>r(y[1],y[0])));m.AddPaths(h.map(x=>x.map(y=>({X:y.x*xt,Y:y.y*xt}))),vr.JoinType.jsMiter,vr.EndType.etOpenRound);let d=new vr.PolyTree;m.Execute(d,t/2*xt);let f=[];for(let x of d.m_AllPolys){let y=new fi;if(x.IsHole())continue;l.min.x=Math.min(l.min.x,x.m_polygon[0].X),l.min.y=Math.min(l.min.y,x.m_polygon[0].Y),l.max.x=Math.max(l.max.x,x.m_polygon[0].X),l.max.y=Math.max(l.max.y,x.m_polygon[0].Y);let g=x.m_polygon;y.moveTo(g[0].X/xt,g[0].Y/xt),g.slice(1).forEach(S=>y.lineTo(S.X/xt,S.Y/xt)),y.lineTo(g[0].X/xt,g[0].Y/xt),y.holes=x.m_Childs.map(S=>{let M=new pi,E=S.m_polygon;return M.moveTo(E[0].X/xt,E[0].Y/xt),E.slice(1).forEach(w=>M.lineTo(w.X/xt,w.Y/xt)),M.lineTo(E[0].X/xt,E[0].Y/xt),M}),f.push(new gi(y,u))}let b=Xt(f);return b.translate(0,0,a||0),b.userData={style:{color:o,opacity:s}},m.Clear(),b}function jg(i){let r=i[1],e=i[6],{opacity:t}=r!=null?r:{},{texture:n,topTexture:o}=e!=null?e:{};return"".concat(t).concat((n==null?void 0:n.path)||"").concat((o==null?void 0:o.path)||"")}var ha=class extends ye{constructor(e,t){super();p(this,"state");p(this,"convertTo3DMapPosition");this.state=e,this.convertTo3DMapPosition=t}createEntityFromFeature(e,t,n){var m,h,d,f,b;let o=new Qe(t),s=(m=t==null?void 0:t.properties)==null?void 0:m.bevel,a=n&&"bevel"in n?n.bevel:void 0,l;a?l=V(V({},s),a):s&&(l=s);let u=new Te(o,new xr(Ce(V({},n),{url:(d=(h=t.properties)==null?void 0:h.image)==null?void 0:d.path,bevel:l})));if(n!=null&&n.outline){let x=(f=this.state.outlinesOptions)==null?void 0:f.darkenFactor;u.components[3]=new xd(wd(n.color,x))}return n!=null&&n.focusable&&(u.components[4]=new Ld),((b=t.properties)==null?void 0:b.textures)!=null&&Array.isArray(t.properties.textures)&&t.properties.textures.length>0?u.components[6]=new Ln(t.properties.textures.find(x=>x.face==="side"),t.properties.textures.find(x=>x.face==="top")):(n!=null&&"texture"in n&&n.texture!=null||n!=null&&"topTexture"in n&&n.topTexture!=null)&&(u.components[6]=new Ln(n.texture,n.topTexture)),u.id=e,u}populateEntityMesh(e,t){let n=e.components[0];n.geometry=t,n.batchedProps={range:{start:0,count:1/0,indexCount:1/0,indexStart:0,vertexCount:1/0,vertexStart:0,reservedVertexCount:1/0,reservedIndexCount:1/0},geometryId:-1,positionCount:t.attributes.position.count},n.currentHeight=e.components[1].height,n.dirty=!1}populateEntityGroup(e){var a;let t,n,o,s;for(let l of e.values())if(s=this.state.geometry3DMap.get(l),s.components[0]instanceof Qe){n=s.components[0].feature,o=s.components[1];try{n.geometry.type==="Polygon"?(t=ca(n,this.convertTo3DMapPosition,o),(a=n.properties)!=null&&a.textures&&n.properties.textures.length>0&&Td(t,n.properties.textures,this.state.naturalBearing,this.convertTo3DMapPosition),this.populateEntityMesh(s,t)):n.geometry.type==="MultiPolygon"?(t=ua(n,this.convertTo3DMapPosition,o),this.populateEntityMesh(s,t)):n.geometry.type==="LineString"?(t=Kd(n,this.convertTo3DMapPosition,o),this.populateEntityMesh(s,t)):n.geometry.type==="MultiLineString"&&(t=ym(n,this.convertTo3DMapPosition,o),this.populateEntityMesh(s,t))}catch(u){$.warn("Failed to create mesh for entity ".concat(l,":"),u)}}return e}update(){var e;for(let t of this.state.geometryGroupIdsToLoad.values()){let n=this.state.geometry3DMap.get(t);if(n instanceof mt&&n.userData.dirty&&!n.userData.modelURL){try{this.populateEntityGroup(n.userData.entities3D)}catch(a){$.warn(a)}let o,s={};for(let a of n.userData.entities3D.values()){o=this.state.geometry3DMap.get(a);let l=o==null?void 0:o.components[0];if((o==null?void 0:o.type)==="geometry"){let u=jg(o.components);s[u]===void 0&&(s[u]={style:o.components[1],entities:[]}),s[u].entities.push(o)}else l&&"mesh"in l&&l.mesh&&((e=l.mesh)==null?void 0:e.parent)!==n&&n.add(l.mesh)}for(let a in s){let l=Cd(s[a].entities,s[a].style);l.layers.enable(Ot.SHOULD_CAST_SHADOWS),n.add(l)}for(let a of n.userData.entities3D.values())if(o=this.state.geometry3DMap.get(a),o!=null&&o.entities2D.size>0)for(let l of o.entities2D.values())l&&(o.attach(l),this.publish("geometry-2d-added"));this.publish("geometry-group-added"),n.userData.dirty=!1,n.userData.localCenter=void 0}}return Promise.resolve()}};v();var da=new qe,bm=new k;function Zg(i,r){let e=i.components[2],t=i.components[1];return e!=null&&e.hover?[t.hoverColor||r,t.hoverColor||r]:[t.color,t.topColor||t.color]}var ma=class{constructor(r,e,t){p(this,"state");p(this,"transparencyChanged",!1);p(this,"convertTo3DMapPosition");p(this,"convert3DMapPositionToCoordinate");p(this,"endFrame",()=>{this.transparencyChanged=!1});this.convertTo3DMapPosition=e,this.convert3DMapPositionToCoordinate=t,this.state=r}determineTextureVisiblity(r,e,t){let n=so(r);((n==null?void 0:n.texture)!=null||(n==null?void 0:n.topTexture)!=null)&&(t!=null&&t.hover&&n.texturesVisible?n.hideTextures(r.instanceIndex):n.texturesVisible||n.showTextures(r.instanceIndex),e.texture==null&&n.removeSideTexture(r.instanceIndex),e.topTexture==null&&n.removeTopTexture(r.instanceIndex))}update(){var t,n,o,s,a,l,u,m,h,d,f,b,x,y,g,S,M,E,w,R;let r,e;for(let I of this.state.geometry3DsInScene)if((I.type==="geometry"||I.type==="custom-geometry")&&((t=I.components[1])!=null&&t.dirty||(n=I.components[2])!=null&&n.dirty)){let T=I.components[0],C=I.components[1];e=I.components[2];let F=Zg(I,this.state.hoverColor);T.setColor(F[0],F[1]);let L=so(T);if(C.visible!==T.visible&&(T.visible=C.visible,T instanceof Qe&&T.textMesh)){let z=this.state.geometry3DMap.get(T.textMesh.userData.entityId);(z==null?void 0:z.type)==="text3d"&&z.components[0].polygonEntityId!=null&&(z.components[0].visible=C.visible)}C.altitude!==T.altitude&&(T.altitude=C.altitude);let N=C.opacity*vi(I);if(L&&T.mesh&&T.type==="geometry"&&N!==T.opacity){if(L.opacity=N,L.transparent=N<1,T.imageMesh){let z=Array.isArray(T.imageMesh.material)?T.imageMesh.material:[T.imageMesh.material];for(let Y of z)Y.opacity=N}N===0?(T.mesh.layers.disable(Ot.SHOULD_CAST_SHADOWS),this.transparencyChanged=!0):T.opacity===0&&N!==0&&(T.mesh.layers.enable(Ot.SHOULD_CAST_SHADOWS),this.transparencyChanged=!0),T.opacity=N}if(C.renderOrder!==T.renderOrder&&(T.renderOrder=C.renderOrder),L&&Md(L,C.side,N),L&&(L.setEffectRange(C.effectStart,C.effectDistance),L.setVisualEffect(C.darkenAmount,C.darkenUseDepth,C.desaturateAmount,C.desaturateUseDepth,C.washOutAmount,C.washOutUseDepth)),T instanceof Qe&&C.shading!=null&&(((o=C.shading)==null?void 0:o.start)!==(L==null?void 0:L.getGradientShading().start)||((s=C.shading)==null?void 0:s.end)!==(L==null?void 0:L.getGradientShading().end)||((a=C.shading)==null?void 0:a.intensity)!==(L==null?void 0:L.getGradientShading().intensity))&&(L==null||L.setGradientShading((u=(l=C.shading)==null?void 0:l.start)!=null?u:0,(h=(m=C.shading)==null?void 0:m.end)!=null?h:0,(f=(d=C.shading)==null?void 0:d.intensity)!=null?f:0)),C.dirty=!1,T instanceof Qe){let z=I.components[6];z instanceof Ln&&this.determineTextureVisiblity(T,z,e)}I.components[2]&&(I.components[2].dirty=!1)}else if((I==null?void 0:I.type)==="image"&&((b=I.components[1])!=null&&b.dirty)){r=I.components[0];let T=I.components[1];T.visible!==r.visible&&(r.visible=T.visible),T.dirty=!1}else if((I==null?void 0:I.type)==="text3d"&&((x=I.components[1])!=null&&x.dirty)){r=I.components[0];let T=I.components[1],C=r.polygonEntityId!=null;T.visible!=null&&T.visible!==r.visible&&(r.visible=T.visible);let{textMesh:F}=r;if(F)if(Object.assign(F,T.getState()),C){let L=(y=T.hoverColor)!=null?y:this.state.text3dHoverColor;F.color=T.hoverByPolygon?L:(g=T.color)!=null?g:Gr.color,F.outlineColor=T.hoverByPolygon?L:(S=T.outlineColor)!=null?S:Gr.outlineColor,F.strokeColor=T.hoverByPolygon?L:(M=T.strokeColor)!=null?M:Gr.strokeColor}else F.color=(E=T.color)!=null?E:Gr.color,F.outlineColor=(w=T.outlineColor)!=null?w:Gr.outlineColor,F.strokeColor=(R=T.strokeColor)!=null?R:Gr.strokeColor;T.dirty=!1}else if((I==null?void 0:I.type)==="geometry-group"&&(I==null?void 0:I.userData.dirty)===!1&&(I!=null&&I.userData.positionDirty)){let T=I;if(T.userData.localCenter||(da.makeEmpty(),da.setFromObject(T),yi(da)&&(da.getCenter(bm),T.userData.localCenter=bm.clone())),!T.userData.centroid&&T.userData.localCenter){let C=this.convert3DMapPositionToCoordinate(T.userData.localCenter);T.userData.centroid=[C[0],C[1]]}if(T.userData.centroid&&T.userData.localCenter){let C=this.convertTo3DMapPosition(T.userData.centroid);T.position.x+=C.x-T.userData.localCenter.x,T.position.y+=C.y-T.userData.localCenter.y,T.userData.localCenter.set(C.x,C.y,T.userData.localCenter.z),T.userData.positionDirty=!1}}}};v();var pa=class extends ye{constructor(e,t,n,o,s,a,l){super();p(this,"state");p(this,"renderer");p(this,"mode");p(this,"scene");p(this,"cameraObject");p(this,"viewCamera");p(this,"systems");p(this,"twoDdirty",!0);p(this,"threeDdirty",!0);p(this,"frameId",null);p(this,"update",(e=!1)=>{var t;if(((t=this.renderer)==null?void 0:t.renderer)==null)return Promise.resolve();if(e){this.renderer.startFrame();let n=this.commitRenderState();return this.paint(),n}else return this.frameId?Promise.resolve():new Promise((n,o)=>{this.frameId=requestAnimationFrame(()=>{var s,a;return((s=this.renderer)==null?void 0:s.renderer)==null?n():this.mode==="standalone"?(this.renderer.startFrame(),(a=this.commitRenderState())==null?void 0:a.then(()=>{this.paint(),n()}).catch(l=>{o(l)})):n()})})});p(this,"commitRenderState",()=>{try{let e=[];this.frameId=null,this.publish("pre-render"),this.state.internalTweenGroup.update(),this.state.externalTweenGroup.update(),(this.mode==="outdoors-interleaved"||this.mode==="standalone")&&this.systems.cameraSystem.update(),this.state.shouldMeasureCanvas&&(this.state.shouldMeasureCanvas=!1,this.publish("measure-canvas")),this.twoDdirty&&(this.state.geometry2DIdsInScene.clear(),this.state.geometry2DsInScene.clear(),dd(this.state.geometryScene,this.state.geometry2DMap,this.state.geometry2DIdsInScene,this.state.geometry2DsInScene),this.systems.twoDEntitySystem.syncTwoDEntities(),this.systems.twoDEntitySystem.markDirty(),this.twoDdirty=!1),this.threeDdirty&&(this.state.geometry3DIdsInScene.clear(),this.state.geometry3DsInScene.clear(),this.state.geometryGroupIdsToLoad.clear(),hd(this.state.geometryScene,this.state.geometry3DMap,this.state.geometry3DIdsInScene,this.state.geometry3DsInScene,this.state.geometryGroupIdsToLoad),this.systems.interactionSystem.dirty3D=!0,this.systems.outlineInterpolationSystem.geometries3DDirty=!0,this.systems.geometryInFocusSystem.focusablesDirty=!0,this.systems.shadowsSystem&&(this.systems.shadowsSystem.needsRender=!0),this.threeDdirty=!1);let t=this.systems.meshOptimizationSystem.update();t&&e.push(t);let n=this.systems.modelSystem.update();return n&&e.push(n),this.systems.borderSystem.update(),this.systems.meshDetachmentSystem.update(),this.systems.meshModificationSystem.update(),this.systems.renderOrderSystem.update(),this.systems.clippingPlaneSystem.update(),this.systems.imageSystem.update(this.systems.cameraSystem.getRotation(),this.systems.cameraSystem.isCameraMoving(),this.systems.cameraSystem.lastCameraStoppedMovingTime()),e.push(this.systems.text3DSystem.update(this.systems.cameraSystem.getRotation())),this.systems.customGeometrySystem.update(),this.systems.panBoundsSystem.update(),this.systems.geometryInFocusSystem.update(this.systems.cameraSystem.isCameraMoving(),this.systems.cameraSystem.lastCameraStoppedMovingTime()),this.systems.outlineInterpolationSystem.update(this.systems.cameraSystem.getZoomLevel(),this.systems.cameraSystem.zoomDirty),this.systems.pathSystem.update(this.systems.cameraSystem.minZoomAltitude,this.systems.cameraSystem.maxZoomAltitude,this.systems.cameraSystem.getZoomAltitude()),this.systems.cameraSystem.postRender(),this.systems.occlusion2DSystem.update(),this.systems.watermarkSystem.insertIntoQuadTree(this.systems.twoDEntitySystem.interactiveCollidersQTree),this.systems.interactionSystem.updateQuadtree(this.systems.twoDEntitySystem.interactiveCollidersQTree),this.systems.twoDEntitySystem.updateWatermark({width:this.systems.watermarkSystem.width,height:this.systems.watermarkSystem.height,position:this.systems.watermarkSystem.options.position}),this.systems.twoDEntitySystem.update(this.systems.cameraSystem.getZoomLevel(),this.systems.cameraSystem.isUserInteracting(),this.systems.cameraSystem.isCameraMoving(),this.systems.imageSystem.currentImageScreenBBoxes),this.systems.watermarkSystem.update(),this.systems.textureSystem.update(),this.systems.pluginSystem.update(this.state),this.systems.drawSystem.update(),this.systems.geometryDisposalSystem.update(),this.systems.maskingSystem.update(),this.systems.cameraSystem.dirty=!1,this.systems.cameraSystem.zoomDirty=!1,this.systems.cameraSystem.rotationDirty=!1,this.systems.shadowsSystem&&((this.systems.modelSystem.transparencyChanged||this.systems.drawSystem.transparencyChanged)&&(this.systems.shadowsSystem.needsRender=!0),this.systems.shadowsSystem.update(this.systems.cameraSystem.getZoomLevel(),this.systems.cameraSystem.getPedestal())),this.systems.modelSystem.endFrame(),this.systems.drawSystem.endFrame(),this.systems.cameraSystem.stateDirty&&(this.publish("camera-state-change"),this.systems.cameraSystem.stateDirty=!1),this.publish("post-render"),Promise.all(e)}catch(e){return Promise.reject(e)}});this.renderer=e,this.state=t,this.mode=n,this.scene=o,this.cameraObject=s,this.viewCamera=a,this.systems=l,this.systems.cameraSystem.on("pan-start",()=>this.systems.twoDEntitySystem.collidersNeedRecomputing=!1,{signal:this.signal}),this.systems.cameraSystem.on("zoom-start",()=>this.systems.twoDEntitySystem.collidersNeedRecomputing=!1,{signal:this.signal}),this.systems.cameraSystem.on("zoom-end",()=>this.systems.twoDEntitySystem.collidersNeedRecomputing=!0,{signal:this.signal}),this.systems.cameraSystem.on("rotate-start",()=>this.systems.twoDEntitySystem.collidersNeedRecomputing=!1,{signal:this.signal}),this.systems.cameraSystem.on("rotate-end",()=>this.systems.twoDEntitySystem.collidersNeedRecomputing=!0,{signal:this.signal})}paint(){var t;if(!((t=this.renderer)!=null&&t.renderer))return;this.mode==="standalone"&&this.renderer.clear();let e=!this.state.useStandaloneCamera&&this.mode!=="standalone";e&&(this.viewCamera.matrixWorld.copy(this.cameraObject.matrixWorld),this.viewCamera.matrixWorldInverse.copy(this.cameraObject.matrixWorldInverse),this.viewCamera.projectionMatrix.multiply(this.cameraObject.matrixWorld)),this.renderer.renderFullScene(this.scene,e?this.viewCamera:this.cameraObject),e&&(this.viewCamera.projectionMatrix.multiply(this.cameraObject.matrixWorldInverse),this.viewCamera.matrixWorldInverse.identity())}destroy(){this.frameId&&cancelAnimationFrame(this.frameId),this.systems.twoDEntitySystem.cancelPendingFrames(),this.state.geometry2DIdsInScene.clear(),this.state.geometry3DIdsInScene.clear(),this.systems.twoDEntitySystem.markDirty(),this.update(),super.destroy()}};v();import{z as ae}from"zod";v();import{z as fa}from"zod";var Si=fa.object({type:fa.enum(["Point"]),coordinates:fa.array(fa.number()).min(2).max(3)});var Xg=ae.object({interactive:ae.boolean().optional(),id:ae.string().optional(),width:ae.union([ae.number(),ae.object({on:ae.literal("zoom-level").optional(),input:ae.array(ae.number()).nonempty(),output:ae.array(ae.number()).nonempty(),easing:ae.string().optional()})]).optional(),accentColor:ae.string().optional(),displayArrowsOnPath:ae.boolean().optional(),animateArrowsOnPath:ae.boolean().optional(),visibleThroughGeometry:ae.boolean().optional(),dashed:ae.boolean().optional(),smoothingTension:ae.number().optional(),smoothingCornerRadius:ae.number().optional(),dashLength:ae.number().optional(),dashGap:ae.number().optional(),dashRelativeToWidth:ae.boolean().optional(),dashSize:ae.number().optional(),gapSize:ae.number().optional(),dashAbsolute:ae.boolean().optional(),dashMeters:ae.number().optional(),gapMeters:ae.number().optional(),__EXPERIMENTAL_GEOMETRY:ae.enum(["tube","ribbon"]).optional(),__EXPERIMENTAL_ENDCAP_EXTENSION:ae.tuple([ae.number(),ae.number()]).optional(),__EXPERIMENTAL_BILLBOARDING:ae.boolean().optional(),__EXPERIMENTAL_BORDER:ae.object({enabled:ae.boolean(),color:ae.string(),width:ae.number().optional()}).optional(),__EXPERIMENTAL_PREVENT_SELF_OVERLAP:ae.boolean().optional()}),Yg=ae.object({type:ae.enum(["Feature"]),geometry:Si,properties:ae.object({parentId:ae.any().optional()})});function vm(i,r){ae.object({features:ae.array(Yg)}).parse(i),Xg.parse(r)}var yo,cn=class{constructor(r,e){p(this,"type","path");p(this,"mesh",new Nt);p(this,"material");p(this,"geometry");p(this,"outline");p(this,"feature");p(this,"options");p(this,"width",{on:"zoom-level",input:[17,22],output:[.8,.4]});p(this,"breakpoint",0);p(this,"altitudeBreakpoints");p(this,"accentColor","blue");p(this,"completeFraction",1);p(this,"altitudeAdjustment",1);p(this,"displayArrowsOnPath",!1);p(this,"animateArrowsOnPath",!1);p(this,"visibleThroughGeometry",!1);p(this,"highlightStartFraction",0);p(this,"highlightEndFraction",0);p(this,"highlightCompleteFraction",1);p(this,"highlightWidthMultiplier",1.1);p(this,"highlightColor","red");p(this,"xrayOpacity",.25);p(this,"dashed",!1);p(this,"smoothingTension",Fr.tension);p(this,"smoothingCornerRadius",Fr.cornerRadius);p(this,"dashLength",.1);p(this,"dashGap",.1);p(this,"dashRelativeToWidth",!1);p(this,"dashSize",3);p(this,"gapSize",2);p(this,"dashAbsolute",!1);p(this,"dashMeters",1);p(this,"gapMeters",.5);p(this,"__EXPERIMENTAL_GEOMETRY","tube");p(this,"__EXPERIMENTAL_ENDCAP_EXTENSION",[.5,.5]);p(this,"__EXPERIMENTAL_BILLBOARDING",!1);p(this,"__EXPERIMENTAL_BORDER");p(this,"__EXPERIMENTAL_PREVENT_SELF_OVERLAP",!1);p(this,"isVertical",!1);p(this,"dirty",!0);p(this,"materialDirty",!0);p(this,"position",new k);A(this,yo,0);var t,n,o,s,a,l,u,m,h,d,f,b,x,y,g,S,M,E,w,R,I;this.feature=r,this.options=e||{},this.width=(t=e==null?void 0:e.width)!=null?t:this.width,this.accentColor=(n=e==null?void 0:e.accentColor)!=null?n:this.accentColor,this.displayArrowsOnPath=(o=e==null?void 0:e.displayArrowsOnPath)!=null?o:this.displayArrowsOnPath,this.animateArrowsOnPath=(s=e==null?void 0:e.animateArrowsOnPath)!=null?s:this.animateArrowsOnPath,this.visibleThroughGeometry=(a=e==null?void 0:e.visibleThroughGeometry)!=null?a:this.visibleThroughGeometry,this.dashed=(l=e==null?void 0:e.dashed)!=null?l:this.dashed,this.xrayOpacity=(u=e==null?void 0:e.xrayOpacity)!=null?u:this.xrayOpacity,this.smoothingTension=(m=e==null?void 0:e.smoothingTension)!=null?m:Fr.tension,this.smoothingCornerRadius=(h=e==null?void 0:e.smoothingCornerRadius)!=null?h:Fr.cornerRadius,this.dashLength=(d=e==null?void 0:e.dashLength)!=null?d:this.dashLength,this.dashGap=(f=e==null?void 0:e.dashGap)!=null?f:this.dashGap,this.dashRelativeToWidth=(b=e==null?void 0:e.dashRelativeToWidth)!=null?b:this.dashRelativeToWidth,this.dashSize=(x=e==null?void 0:e.dashSize)!=null?x:this.dashSize,this.gapSize=(y=e==null?void 0:e.gapSize)!=null?y:this.gapSize,this.dashAbsolute=(g=e==null?void 0:e.dashAbsolute)!=null?g:this.dashAbsolute,this.dashMeters=(S=e==null?void 0:e.dashMeters)!=null?S:this.dashMeters,this.gapMeters=(M=e==null?void 0:e.gapMeters)!=null?M:this.gapMeters,this.__EXPERIMENTAL_GEOMETRY=(E=e==null?void 0:e.__EXPERIMENTAL_GEOMETRY)!=null?E:"tube",this.__EXPERIMENTAL_ENDCAP_EXTENSION=(w=e==null?void 0:e.__EXPERIMENTAL_ENDCAP_EXTENSION)!=null?w:[.5,.5],this.__EXPERIMENTAL_BILLBOARDING=(R=e==null?void 0:e.__EXPERIMENTAL_BILLBOARDING)!=null?R:!1,this.__EXPERIMENTAL_BORDER=e==null?void 0:e.__EXPERIMENTAL_BORDER,this.__EXPERIMENTAL_PREVENT_SELF_OVERLAP=(I=e==null?void 0:e.__EXPERIMENTAL_PREVENT_SELF_OVERLAP)!=null?I:!1}setColor(){}setOpacity(){}set visible(r){this.mesh&&(this.mesh.visible=r)}get visible(){return this.mesh?this.mesh.visible:!1}get altitude(){return c(this,yo)}set altitude(r){this.mesh&&(this.mesh.position.z=r,_(this,yo,r))}set complete(r){this.material&&(this.material.uniforms.complete.value=r,this.material.needsUpdate=!0)}};yo=new WeakMap;v();v();v();function Mi(i,r,e){return i.type==="portion"?{top:i.top*e,left:i.left*r,bottom:i.bottom*e,right:i.right*r,type:"pixel"}:i}v();v();v();var xm=(i,r)=>(r-i+Math.PI)%(Math.PI*2)+Math.PI*2%(Math.PI*2)-Math.PI,Sm=(i,r)=>new he(i.clientX-r.offsetLeft,i.clientY-r.offsetTop),Hc=(i,r)=>Math.atan2(r.y-i.y,r.x-i.x),bo=(i,r)=>Math.sqrt((r.y-i.y)**2+(r.x-i.x)**2),Vc=(i,r)=>new he((i.x+r.x)/2,(i.y+r.y)/2),Wc=i=>{let r=0,{wheelDelta:e,detail:t}=i;return e!==void 0?r=e:t!==void 0&&(r=-t),r};var ga=class{constructor(r,e){p(this,"input1");p(this,"input2");p(this,"lastAngle");p(this,"lastDistance");p(this,"totalDistance");p(this,"first");p(this,"second");this.input1=r,this.input2=e,this.lastAngle=Hc(r,e),this.lastDistance=bo(r,e),this.totalDistance=0,this.first=r,this.second=e}update(r,e){let t=bo(r,e);this.input1=r,this.input2=e;let n=Hc(r,e);this.lastAngle=n,this.lastDistance=t,this.totalDistance+=(bo(this.first,r)+bo(this.second,e))/2,this.first=Vc(this.first,r),this.second=Vc(this.second,e)}};v();var vo=class{constructor(r,e,t){p(this,"touch");p(this,"camera");p(this,"cameraPlane");p(this,"viewCoordinate");p(this,"snapHolderMatrix");p(this,"snapCamera");p(this,"cameraPosition");p(this,"raycaster");p(this,"worldCoordinate");p(this,"snapshotted",!1);this.touch=r,this.camera=e,this.cameraPlane=t,this.viewCoordinate={x:r.x,y:r.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 r=new he(this.viewCoordinate.x,this.viewCoordinate.y);this.raycaster=this.raycaster||new nn,this.raycaster.setFromCamera(r,this.snapCamera);let e=this.raycaster.intersectObject(this.cameraPlane,!0);this.worldCoordinate=e&&e.length>0?e[0].point:null,this.snapshotted=!0}updateAnchorState(r,e){this.camera=r,this.snapCamera=r.clone(),this.snapHolderMatrix=r.matrixWorld.clone(),this.updateViewCoordinate(e),this.snapshotCameraState()}updateViewCoordinate(r){this.viewCoordinate={x:r.x,y:r.y}}reUnproject(){var t,n;let r=new he(this.viewCoordinate.x,this.viewCoordinate.y);(t=this.raycaster)==null||t.setFromCamera(r,this.snapCamera);let e=(n=this.raycaster)==null?void 0:n.intersectObject(this.cameraPlane,!0)[0];return e?e.point:void 0}};var Yt={};Lg(Yt,{BLOCK_MERCATOR_ZOOM_LEVEL:()=>qg,CLIPPING_RADIUS:()=>xo,CONTROL_OPTIONS:()=>$g,DEFAULT_ANIMATION_DURATION:()=>$c,DEFAULT_BEARING:()=>ty,DEFAULT_MAX_ZOOM_LEVEL:()=>Kg,DEFAULT_MIN_ZOOM_LEVEL:()=>Jc,DEFAULT_PITCH:()=>ey,DEFAULT_ZOOM_LEVEL:()=>Qg,EVENTS:()=>qc,MAPLIBRE_TILE_SIZE:()=>ya,MAX_LAT:()=>Zc,MAX_MERCATOR_ZOOM_LEVEL:()=>va,MIN_LAT:()=>jc,MIN_MERCATOR_ZOOM_LEVEL:()=>ba,ROOM_MERCATOR_ZOOM_LEVEL:()=>Jg,TWO_PI:()=>Xc,WHEEL_ZOOM_MULTIPLIER:()=>Yc,ZRANGE:()=>Ei});v();var ya=512,jc=-85.051129,Zc=85.051129,xo=1e4,$g={chain:"chain",cancel:"cancel"},Xc=Math.PI*2,Ei=100,Yc=1e4,ba=0,va=24,qg=17,Jg=20,$c=200,qc=["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"],Qg=18,Jc=12,Kg=22,ey=0,ty=0;v();v();var Rn=class extends Error{};Rn.prototype.name="InvalidTokenError";function ry(i){return decodeURIComponent(atob(i).replace(/(.)/g,(r,e)=>{let t=e.charCodeAt(0).toString(16).toUpperCase();return t.length<2&&(t="0"+t),"%"+t}))}function ny(i){let r=i.replace(/-/g,"+").replace(/_/g,"/");switch(r.length%4){case 0:break;case 2:r+="==";break;case 3:r+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return ry(r)}catch(e){return atob(r)}}function Mm(i,r){if(typeof i!="string")throw new Rn("Invalid token specified: must be a string");r||(r={});let e=r.header===!0?0:1,t=i.split(".")[e];if(typeof t!="string")throw new Rn("Invalid token specified: missing part #".concat(e+1));let n;try{n=ny(t)}catch(o){throw new Rn("Invalid token specified: invalid base64 for part #".concat(e+1," (").concat(o.message,")"))}try{return JSON.parse(n)}catch(o){throw new Rn("Invalid token specified: invalid json for part #".concat(e+1," (").concat(o.message,")"))}}v();function tr(i,r,e,t){return(i<r||i>e)&&$.warn(t),Math.min(e,Math.max(r,i))}function lE(i){var e,t;let r=Mm(i);if(r.sub==null)throw new Error("Access token is missing sub claim.");return{sub:r.sub,aud:typeof r.aud=="string"?[r.aud]:(e=r.aud)!=null?e:[],capabilities:(t=r.capabilities)!=null?t:{}}}function Br(i){return i*(Math.PI/180)}function Em(i){return i*(180/Math.PI)}function xa(i,r){let e=Math.pow(10,r);return Math.sign(i)*Math.round(Math.abs(i)*e)/e}function Cm(i,r){return(i%r+r)%r}function wm(i,r){let e=Cm(i,Math.PI*2),t=Cm(r,Math.PI*2),n=t-e,o=t+(n>Math.PI?-Math.PI*2:n<-Math.PI?Math.PI*2:0);return{start:e,end:o}}function cE(){return typeof window<"u"&&window!==null}function Tm(i,r){let[e,t]=i,[n,o]=r,s=Br(n-e),a=Br(o-t);return Math.sqrt(s*s+a*a)*Or}function ft(i,r){let[e,t]=i.map(m=>Br(m)),[n,o]=r.map(m=>Br(m)),s=o-t,l=(n-e)*Math.cos((t+o)/2),u=s;return Math.sqrt(l*l+u*u)*Or}function Qc(i,r){return Math.sqrt(Math.pow(i.x-r.x,2)+Math.pow(i.y-r.y,2))}function Sa(i){let r=Br(i),t=Math.cos(r)*Or;function n(s,a){let l=Br(s[0]),u=Br(s[1]),m=l*t,h=u*Or;return a?(a.x=m,a.y=h,a):{x:m,y:h}}return{toCartesian:n,toGeographic:(s,a)=>{let l=Em(s/t),u=Em(a/Or);return{lon:l,lat:u}}}}var Ma=!1,iy=!1;var Ea,_n=class extends ye{constructor(e,t,n,o,s){super();p(this,"dirty",!1);p(this,"zoomDirty",!1);p(this,"rotationDirty",!1);p(this,"panDirty",!1);p(this,"stateDirty",!1);A(this,Ea,Jc);p(this,"zoomSpeed",5);p(this,"rotateSpeed",100);p(this,"enabled",!0);p(this,"enableZoom",!0);p(this,"enablePan",!0);p(this,"enablePedestal",!1);p(this,"maxPedestal",1/0);p(this,"minPedestal",0);p(this,"enableRotate",!0);p(this,"minZoomAltitude",0);p(this,"maxZoomAltitude",1/0);p(this,"ignoreZoomLimits",!1);p(this,"zoomFactor",1);p(this,"panBounds",{min:new k(1/0,1/0),max:new k(-1/0,-1/0),center:new k(0,0,0),radius:1/0});p(this,"minTilt",0);p(this,"maxTilt",1.2);p(this,"MOUSE_BUTTONS",{ORBIT:Is.RIGHT,ZOOM:Is.MIDDLE,PAN:Is.LEFT});p(this,"camera");p(this,"scene");p(this,"renderer");p(this,"elevation");p(this,"orbit");p(this,"cameraPlane");p(this,"raycaster",new nn);p(this,"rendererState");p(this,"options");p(this,"state",-1);p(this,"intersection");p(this,"viewState",null);p(this,"tweens",new Map);p(this,"clock",new $h(!0));p(this,"coords",{mouse:new he,rotateStart:new he,rotateEnd:new he,rotateDelta:new he,panStart:new k,panCameraStart:new k,panEnd:new k,panDelta:new k,initialShiftPos:new he,initialPedestal:0,floorAnchor:new k});p(this,"touch",{origin:{offsetLeft:0,offsetTop:0},touches:[],anchor1:null,anchor2:null,inputs:null});p(this,"scrollTimer",null);p(this,"lastWheelTime",0);p(this,"resetZoom",!1);p(this,"zoomStart");p(this,"pedestalScaleFactor",1);p(this,"isUserZooming",!1);p(this,"stayInsideBounds",!0);p(this,"userInteracting",!1);p(this,"cameraMoving",!1);p(this,"lastCameraMoveTime",Date.now());p(this,"raycastToFloor",e=>{this.raycaster.setFromCamera(e,this.camera);let t=this.raycaster.intersectObject(this.cameraPlane,!1)[0];return t?t.point:new k});p(this,"isUserInteracting",()=>this.userInteracting);p(this,"getPosition",()=>new k(this.orbit.position.x,this.orbit.position.y,this.orbit.position.z));p(this,"getPedestal",()=>this.orbit.position.z);p(this,"pan",(e,t)=>{isNaN(e)||isNaN(t)||(this.setPosition(this.orbit.position.x+e,this.orbit.position.y+t),this.publish("position-updated"))});p(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"))});p(this,"isCameraMoving",()=>this.cameraMoving);p(this,"lastCameraStoppedMovingTime",()=>this.lastCameraMoveTime);p(this,"setPosition",(e,t)=>{e===void 0||t===void 0||isNaN(e)||isNaN(t)||(this.state===-1&&this.publish("pan-start"),this.updateCameraPosition(e,t),this.publish("position-updated"),this.publish("change"),this.state===-1&&this.publish("pan-end"),this.dirty=!0,this.stateDirty=!0)});p(this,"updateCameraPosition",(e,t)=>{let n=e-this.panBounds.center.x,o=t-this.panBounds.center.y,s=Math.sqrt(n*n+o*o);if(this.stayInsideBounds&&s>this.panBounds.radius){let a=Math.atan2(o,n),l={x:Math.cos(a)*this.panBounds.radius+this.panBounds.center.x,y:Math.sin(a)*this.panBounds.radius+this.panBounds.center.y};this.orbit.position.x=l.x,this.orbit.position.y=l.y}else this.orbit.position.x=e,this.orbit.position.y=t});p(this,"tilt",e=>{if(isNaN(e))return;this.state===-1&&this.publish("rotate-start");let t=this.stayInsideBounds?Math.max(Math.min(e+this.getTilt(),this.maxTilt),this.minTilt):e+this.getTilt();t!==this.elevation.rotation.x&&(this.elevation.rotation.x=t,this.publish("tilt-updated")),this.publish("change"),this.state===-1&&this.publish("rotate-end"),this.stateDirty=!0});p(this,"zoomIn",(e,t,n)=>{let o=this.getZoomAltitude();this.animateCamera({zoom:o/1.5},e,t,n)});p(this,"zoomOut",(e,t,n)=>{let o=this.getZoomAltitude();this.animateCamera({zoom:o*1.5},e,t,n)});p(this,"getRotation",()=>(-this.orbit.rotation.z+Math.PI*2)%(Math.PI*2));p(this,"cancelAnimation",()=>{let e=Array.from(this.tweens.keys());if(e.length<1)return;let t=e[e.length-1];t.state===7&&this.publish("multi-cancel",{zooming:!0,rotating:!0,tilting:!0}),this.completeTween(t),this.state===7&&(this.state=-1)});p(this,"animateCamera",(e,t,n,o,s,a)=>{let l=V({interruptible:!0},a),u={},m={},h=this.getPosition();if(e.position!=null&&(e.position.x!==void 0&&(u.x=h.x,m.x=e.position.x),e.position.y!==void 0&&(u.y=h.y,m.y=e.position.y),e.position.z!==void 0&&(u.z=h.z,m.z=e.position.z)),e.zoom!==void 0&&(u.zoom=this.stayInsideBounds?Math.min(Math.max(this.getZoomAltitude(),this.getZoomScaledMin()),this.getZoomScaledMax()):this.getZoomAltitude(),this.viewState==="multi_floor"||!this.stayInsideBounds?m.zoom=e.zoom:m.zoom=Math.min(Math.max(e.zoom,this.getZoomScaledMin()),this.getZoomScaledMax())),e.rotation!==void 0){let{start:M,end:E}=wm(this.getRotation(),e.rotation);u.rotation=M,m.rotation=E}e.tilt!==void 0&&(u.tilt=this.getTilt(),this.viewState==="multi_floor"||!this.stayInsideBounds?m.tilt=e.tilt:m.tilt=Math.max(Math.min(e.tilt,this.maxTilt),this.minTilt));let d=u.zoom!==m.zoom,f=u.rotation!==m.rotation,b=u.tilt!==m.tilt,x=new wh(u).to(m,D.env.TESTING?0:t).onUpdate(M=>{this.setMulti({x:M.x,y:M.y,z:M.z},M.zoom,M.rotation,M.tilt)}).onComplete(()=>{this.completeTween(x),this.publish("multi-end",{zooming:d,rotating:f,tilting:b}),o&&o()}).onStart(()=>{this.state!==7&&(this.state=7,x.state=7,this.publish("multi-start",{zooming:d,rotating:f,tilting:b})),this.publish("change")});this.rendererState.internalTweenGroup.add(x);let y=Array.from(this.tweens.entries()),g=y[y.length-1],S=!1;return g!=null&&(g[1].interruptible?(typeof g[1].cancelledCallback=="function"&&g[1].cancelledCallback(),this.completeTween(g[0])):(S=!0,g[0].chain(x))),this.tweens.set(x,{cancelledCallback:s,interruptible:l.interruptible}),n?x.easing(n):x.easing(Dn.Quadratic.In),!e.doNotAutoStart&&!S&&(x.start(),this.publish("change")),x.cameraAnimation=!0,x});p(this,"setMulti",(e,t,n,o,s=!0)=>{this.state===-1&&this.publish("multi-start");let a=!1;e!=null&&(e.x!==void 0&&!isNaN(e.x)&&e.y!==void 0&&!isNaN(e.y)&&(this.updateCameraPosition(e.x,e.y),a=!0),e.z!==void 0&&!isNaN(e.z)&&(this.setPedestal(e.z,!0,!1),a=!0)),a&&this.publish("position-updated");let l={zooming:!1,tilting:!!t,rotating:!1};if(t!==void 0&&!isNaN(t)){let u=this.stayInsideBounds?Math.min(Math.max(t,this.getZoomScaledMin()),this.getZoomScaledMax()):t;u!==this.camera.position.z&&(l.zooming=!0,this.camera.position.z=u,this.publish("zoom-updated"),this.zoomDirty=!0,this.viewState==="multi_floor"?t>xo&&(this.camera.near=t-xo,this.camera.far=t+xo):(this.camera.near=t/Ei,this.camera.far=t*Ei),this.camera.updateProjectionMatrix())}if(n!==void 0&&!isNaN(n)&&n!==this.getRotation()&&(l.rotating=!0,this.orbit.rotation.z=-n,this.publish("rotation-updated")),o!==void 0&&!isNaN(o)){let u=this.stayInsideBounds?Math.max(Math.min(o,this.maxTilt),this.minTilt):o;u!==this.elevation.rotation.x&&(l.tilting=!0,this.elevation.rotation.x=u,this.publish("tilt-updated"))}s&&this.publish("change"),this.state===-1&&this.publish("multi-end",l),this.stateDirty=!0});p(this,"getZoomScaledMin",()=>this.minZoomAltitude*this.zoomFactor);p(this,"getZoomScaledMax",()=>{let e=this.minZoomAltitude*this.zoomFactor;return Math.max(this.maxZoomAltitude,e)});p(this,"setRotation",(e,t)=>{if(isNaN(e))return;this.state===-1&&!t&&this.publish("rotate-start");let n=-(e%Xc);n!==this.orbit.rotation.z&&(this.orbit.rotation.z=n,t||this.publish("rotation-updated")),t||this.publish("change"),this.state===-1&&!t&&this.publish("rotate-end"),this.dirty=!0,this.rotationDirty=!0,t||(this.stateDirty=!0)});p(this,"setZoomAltitude",e=>{if(isNaN(e))return;this.state===-1&&this.publish("zoom-start");let t=this.stayInsideBounds?Math.min(Math.max(e,this.getZoomScaledMin()),this.getZoomScaledMax()):e;t!==this.camera.position.z&&(this.camera.position.z=t,this.publish("zoom-updated"),this.zoomDirty=!0),this.camera.near=t/Ei,this.camera.far=t*Ei,this.camera.updateProjectionMatrix(),this.publish("change"),this.state===-1&&this.publish("zoom-end"),this.dirty=!0,this.stateDirty=!0});p(this,"setZoomLevel",e=>{this.setZoomAltitude(this.convertZoomLevelToAltitude(e))});p(this,"getZoomAltitude",()=>this.camera.position.z);p(this,"getZoomLevel",()=>this.convertAltitudeToZoomLevel(this.getZoomAltitude()));p(this,"setTilt",(e,t)=>{if(isNaN(e))return;this.state===-1&&!t&&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,t||this.publish("tilt-updated")),t||this.publish("change"),this.state===-1&&!t&&this.publish("rotate-end"),this.dirty=!0,t||(this.stateDirty=!0)});p(this,"getTilt",()=>this.elevation.rotation.x);p(this,"setCameraPlaneElevation",e=>{this.cameraPlane.position.z=e});p(this,"zoom",e=>{if(isNaN(e))return;this.state===-1&&this.publish("zoom-start");let t=this.getZoomAltitude()-e;this.camera.position.z=this.stayInsideBounds?Math.min(Math.max(t,this.minZoomAltitude*this.zoomFactor),this.maxZoomAltitude*this.zoomFactor):t,this.publish("zoom-updated"),this.zoomDirty=!0,this.publish("change"),this.state===-1&&this.publish("zoom-end"),this.stateDirty=!0});p(this,"getProjectionScaleFactor",(e,t,n)=>Ec(e,t,n));p(this,"update",()=>{this.orbit.updateMatrixWorld(),this.lastWheelTime>0&&this.state===3&&this.clock.getElapsedTime()-this.lastWheelTime>.2&&(this.lastWheelTime=0,this.state=-1,this.publish("zoom-end"),this.removeMouseMoveEventListeners())});p(this,"setPedestal",(e,t=!1,n=!0)=>{typeof e=="number"&&!isNaN(e)&&(this.orbit.position.z=e,t&&(this.publishPedestalChangeEvent(e),this.publish("pedestal-change",{pedestal:e})),this.publish("change"),this.dirty=!0,n&&(this.stateDirty=!0))});p(this,"dispose",()=>{this.scene.remove(this.cameraPlane),this.destroy()});p(this,"createCameraPlane",()=>{let e=Ma?2e3:1e10,t=Ma?100:1,n=new vt(e,e,t,t),o=new Pt({color:0,wireframe:Ma,visible:Ma}),s=new pe(n,o);return this.scene.add(s),s});p(this,"addEventListeners",()=>{let{domElement:e}=this.renderer;for(let t of qc)t.endsWith("start")?(this.on(t,this.setCameraMoving),t.startsWith("user")&&this.on(t,this.setUserInteracting)):(t.endsWith("end")||t.endsWith("cancel"))&&(this.on(t,this.unsetCameraMoving),t.startsWith("user")&&this.on(t,this.unsetUserInteracting));e.addEventListener("contextmenu",this.onContextMenu,{capture:!1,signal:this.signal}),e.addEventListener("mousedown",this.onMouseDown,{capture:!1,signal:this.signal}),e.addEventListener("wheel",this.onMouseWheel,{capture:!1,passive:!1,signal:this.signal}),e.addEventListener("touchstart",this.onTouchStart,{capture:!1,signal:this.signal}),e.addEventListener("touchend",this.onTouchEnd,{capture:!1,signal:this.signal}),e.addEventListener("touchmove",this.onTouchMove,{capture:!1,signal:this.signal})});p(this,"addMouseEventListeners",()=>{this.addMouseMoveEventListeners(),window.addEventListener("mouseup",this.onMouseUp,{capture:!1,signal:this.signal}),window.addEventListener("mouseout",this.onMouseUp,{capture:!1,signal:this.signal})});p(this,"addMouseMoveEventListeners",()=>{this.renderer.domElement.addEventListener("mousemove",this.onMouseMove,{capture:!1,signal:this.signal})});p(this,"removeMouseMoveEventListeners",()=>{this.renderer.domElement.removeEventListener("mousemove",this.onMouseMove,{capture:!1})});p(this,"removeMouseUpEventListeners",()=>{this.renderer.domElement.removeEventListener("mousemove",this.onMouseMove,{capture:!1}),window.removeEventListener("mouseup",this.onMouseUp,{capture:!1}),window.removeEventListener("mouseout",this.onMouseUp,{capture:!1})});p(this,"onContextMenu",e=>{e.preventDefault()});p(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,this.panDirty=!1}});p(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)});p(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 ga(this.touch.touches[0],this.touch.touches[1]);break;default:this.state=-1}this.state}});p(this,"onTouchMove",e=>{if(this.enabled!==!1)switch(this.touchToScene(e),e.touches.length){case 2:e.preventDefault(),e.stopPropagation();let t=V({},this.touch.inputs.first),n=V({},this.touch.inputs.second),o=new he(this.touch.touches[0].x,this.touch.touches[0].y),s=new he(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 a=t.y<o.y&&n.y<s.y,l=t.y>o.y&&n.y>s.y;this.enableRotate&&this.state!==4&&(l||a)?(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}});p(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}});p(this,"handleTouchMovePan",e=>{let t=Object.hasOwn(e,"x")?new he(e.x,e.y):this.touch.touches[0],n=this.raycastToFloor(t);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"),this.panDirty=!0});p(this,"handleTouchStartDolly",()=>{let e=this.touch.touches[0].x-this.touch.touches[1].x,t=this.touch.touches[0].y-this.touch.touches[1].y;this.zoomStart=this.getZoomAltitude();let n=new he(this.touch.touches[0].x-e/2,this.touch.touches[0].y-t/2);this.coords.floorAnchor=this.raycastToFloor(n),this.orbit.updateMatrixWorld(),this.touch.anchor1=new vo(this.touch.touches[0],this.camera,this.cameraPlane),this.touch.anchor2=new vo(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("zoom-start"),this.publish("multi-start")});p(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"),this.panDirty=!0});p(this,"handleTouchStartTilt",e=>{this.coords.rotateStart.set(e.touches[1].clientX,e.touches[1].clientY),this.publish("user-tilt-start"),this.publish("rotate-start")});p(this,"handleTouchMovePedestal",e=>{this.handleMouseMovePedestal(e.touches[0])});p(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)});p(this,"handleTouchMoveDolly",()=>{let e=this.touch.inputs.first,t=this.touch.inputs.second;this.touch.anchor1.viewCoordinate={x:e.x,y:e.y},this.touch.anchor2.viewCoordinate={x:t.x,y:t.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,t)});p(this,"handleTouchEnd",()=>{this.state===4||this.state===5?this.publish("multi-end"):this.state===6&&this.publish("pan-end"),this.panDirty=!1});p(this,"handleTouchStartPan",e=>{let t=Object.hasOwn(e,"x")?new he(e.x,e.y):this.touch.touches[0],n=this.raycastToFloor(t);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")});p(this,"handleTouchStartPedestal",e=>{this.handleMouseDownPedestal(e.touches[0])});p(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||e.button===this.MOUSE_BUTTONS.ZOOM)&&(this.enablePan?(this.handleMouseDownPan(),this.state=2):this.enablePedestal&&(this.handleMouseDownPedestal(e),this.state=8));this.state!==-1&&this.addMouseEventListeners()}});p(this,"onMouseWheel",e=>{this.enabled===!1||this.enableZoom===!1||this.state!==-1&&this.state!==3&&this.state!==7||(this.state===7&&this.cancelAnimation(),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))});p(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 t=this.getZoomAltitude(),n=t-Wc(e)*t/Yc*this.zoomSpeed;if(this.setZoomAltitude(n),this.enablePan){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")});p(this,"setCameraFromTransformMatrix",e=>{this.orbit.updateMatrixWorld();let t=new Ar;t.setFromRotationMatrix(e,"ZYX");let n=(e.elements[14]-this.cameraPlane.position.z)/Math.cos(t.x),o=t.z,s=new k(0,0,1);s.applyEuler(t),s.setLength(n);let a=new k;a.setFromMatrixPosition(e),a.sub(s),this.enablePan&&this.setPosition(a.x,a.y),this.enableZoom&&this.setZoomAltitude(n),this.enableRotate&&this.setRotation(-o)});p(this,"makeTransformFromTouchAnchors",(e,t)=>{this.orbit.updateMatrixWorld(),this.camera.updateProjectionMatrix();let n=this.camera.projectionMatrix.clone(),o=e.worldCoordinate,s=t.worldCoordinate,a=e.reUnproject(),l=t.reUnproject();if(!a||!l||!o||!s)return null;let u=e.viewCoordinate,m=t.viewCoordinate,h=s.x-o.x,d=s.y-o.y,f=Math.atan2(d,h),b=l.x-a.x,x=l.y-a.y,y=Math.atan2(x,b),g=xm(f,y),S=new we;S.makeRotationZ(-g);let M=S.clone();M.multiply(e.snapHolderMatrix);let E=(Ae,ee,H)=>Ae.elements[(ee-1)*4+H-1],w=E(n,1,1)*E(M,1,1)-u.x*E(n,3,4)*E(M,3,1),R=E(n,1,1)*E(M,1,2)-u.x*E(n,3,4)*E(M,3,2),I=E(n,1,1)*E(M,1,3)-u.x*E(n,3,4)*E(M,3,3),T=o.x*w+o.y*R+o.z*I,C=E(n,2,2)*E(M,2,1)-u.y*E(n,3,4)*E(M,3,1),F=E(n,2,2)*E(M,2,2)-u.y*E(n,3,4)*E(M,3,2),L=E(n,2,2)*E(M,2,3)-u.y*E(n,3,4)*E(M,3,3),N=o.x*C+o.y*F+o.z*L,z=E(n,1,1)*E(M,1,1)-m.x*E(n,3,4)*E(M,3,1),Y=E(n,1,1)*E(M,1,2)-m.x*E(n,3,4)*E(M,3,2),G=E(n,1,1)*E(M,1,3)-m.x*E(n,3,4)*E(M,3,3),q=s.x*z+s.y*Y+s.z*G,le=E(n,2,2)*E(M,2,1)-m.y*E(n,3,4)*E(M,3,1),Q=E(n,2,2)*E(M,2,2)-m.y*E(n,3,4)*E(M,3,2),K=E(n,2,2)*E(M,2,3)-m.y*E(n,3,4)*E(M,3,3),B=s.x*le+s.y*Q+s.z*K,j=Math.abs(z-w),U=Math.abs(Y-R),ce=Math.abs(G-I),xe=Math.abs(z-C),ue=Math.abs(Y-F),ze=Math.abs(G-L),Re=Math.abs(le-w),Se=Math.abs(Q-R),Me=Math.abs(K-I),De=Math.abs(le-C),Ue=Math.abs(Q-F),Ye=Math.abs(K-L),Ut=Math.min(j+U+ce,xe+ue+ze),je=Math.min(Re+Se+Me,De+Ue+Ye);Ut<je&&(z=le,Y=Q,G=K,q=B);let ge=C*I-w*L,mr=F*I-R*L,pr=N*I-T*L,Jr=z*L-C*G,Kt=Y*L-F*G,Ht=q*L-N*G,Ft=(Ht*mr-pr*Kt)/(Jr*mr-ge*Kt),Qr=(Ht*ge-pr*Jr)/(Kt*ge-mr*Jr),Pr=F*w-R*C,Kr=L*w-I*C,oi=N*w-T*C,fr=Y*C-F*z,gr=G*C-L*z,er=((q*C-N*z)*Pr-oi*fr)/(gr*Pr-Kr*fr),$e=M.clone();return $e.elements[12]=Ft,$e.elements[13]=Qr,$e.elements[14]=er,er>0?$e:null});p(this,"updateTouchOrigin",()=>{let e=this.renderer.domElement;this.touch.origin.offsetLeft=e.getBoundingClientRect().left,this.touch.origin.offsetTop=e.getBoundingClientRect().top});p(this,"touchToScene",e=>{this.touch.touches=[];for(let t=0,n=e.touches.length;t<n;t++){let o=e.touches[t],s=Sm(o,this.touch.origin);this.touch.touches.push(new he(s.x/this.renderer.domElement.width*this.rendererState.pixelRatio*2-1,-(s.y/this.renderer.domElement.height*this.rendererState.pixelRatio)*2+1))}this.coords.mouse=this.touch.touches[0]});p(this,"canScrollZoom",e=>{let t=Wc(e),n=this.getZoomAltitude();return!(t<0&&n===this.getZoomScaledMax()||t>0&&n===this.getZoomScaledMin())});p(this,"mouseToScene",e=>{let t=this.getMousePos(e);return this.coords.mouse.x=t.x/this.renderer.domElement.width*this.rendererState.pixelRatio*2-1,this.coords.mouse.y=-(t.y/this.renderer.domElement.height*this.rendererState.pixelRatio)*2+1,this.coords.mouse});p(this,"getMousePos",e=>({x:e.offsetX,y:e.offsetY}));p(this,"handleMouseDownRotate",e=>{this.coords.rotateStart.set(e.clientX,e.clientY),this.publish("rotate-start"),this.publish("user-rotate-start")});p(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")});p(this,"handleMouseDownPedestal",e=>{let t=new he(e.clientX,e.clientY);this.coords.initialShiftPos=t,this.coords.initialPedestal=this.getPedestal(),this.pedestalScaleFactor=Ec(this.camera.fov,this.renderer.domElement.clientHeight,this.getZoomAltitude()),this.publish("pedestal-start"),this.publish("user-pedestal-start")});p(this,"handleMouseMovePedestal",e=>{let t={x:e.clientX,y:e.clientY},n=this.coords.initialPedestal+this.pedestalScaleFactor*(t.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)});p(this,"handleMouseMoveRotate",e=>{this.coords.rotateEnd.set(e.clientX,e.clientY),this.coords.rotateDelta.subVectors(this.coords.rotateEnd,this.coords.rotateStart),this.setRotation(this.getRotation()+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")});p(this,"publishUserZoomDebounced",li(()=>{this.isUserZooming=!1,this.publish("user-zoom-end")},250));p(this,"publishUserZoomEvent",()=>{this.isUserZooming?this.publishUserZoomDebounced():(this.publish("user-zoom-start"),this.isUserZooming=!0,this.publishUserZoomDebounced())});p(this,"setCameraMoving",()=>{this.cameraMoving=!0});p(this,"unsetCameraMoving",()=>{this.cameraMoving=!1,this.lastCameraMoveTime=Date.now()});p(this,"setUserInteracting",()=>{this.userInteracting=!0});p(this,"unsetUserInteracting",()=>{this.userInteracting=!1});p(this,"publishPedestalChangeEvent",e=>{this.publish("pedestal-change",{pedestal:e,scrolledToTop:this.scrolledToTop,scrolledToBottom:this.scrolledToBottom,scrollPercent:this.scrollPercent})});p(this,"convertAltitudeToZoomLevel",e=>{let[,t]=this.center,n=this.computeMetersPerPixelFromAltitude(e),o=Math.cos(de.degToRad(t))*2*Math.PI*Or/n;return de.clamp(Math.log2(o/512),ba,va)});p(this,"convertZoomLevelToAltitude",e=>this.computeMetersPerPixelFromZoomLevel(e)*this.options.canvasHeight/2/Math.tan(de.degToRad(this.camera.fov)/2));p(this,"completeTween",e=>{e.isPlaying()&&e.stop(),this.rendererState.internalTweenGroup.remove(e),this.tweens.delete(e)});p(this,"debugContainer",new jt);this.camera=e,this.renderer=n,this.rendererState=o,this.scene=t,this.options=s,this.elevation=e.parent,this.orbit=this.elevation.parent,this.cameraPlane=this.createCameraPlane(),this.zoomStart=e.position.z,s.mode!=="outdoors-overlay"&&this.addEventListeners()}get maxZoomLevel(){return this.convertAltitudeToZoomLevel(this.minZoomAltitude)}setMaxZoomLevel(e){this.minZoomAltitude=this.convertZoomLevelToAltitude(e),this.stateDirty=!0}get defaultMinZoomLevel(){return c(this,Ea)}get minZoomLevel(){return this.convertAltitudeToZoomLevel(this.maxZoomAltitude)}setMinZoomLevel(e){this.maxZoomAltitude=this.convertZoomLevelToAltitude(e),this.stateDirty=!0}get scrollPercent(){let e=this.minPedestal,t=this.maxPedestal,n=this.getPedestal();return n=Math.min(n,t),n=Math.max(n,e),(n-e)/(t-e)*100}get fov(){return this.camera.fov}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,s,a,l;let e=this.getPosition(),{lat:t,lon:n}=Hs((s=(o=this.rendererState.center)==null?void 0:o[1])!=null?s:0,(l=(a=this.rendererState.center)==null?void 0:a[0])!=null?l:0,e.x,e.y);return[n,t]}setCenter(e,t){var s,a,l,u;let{x:n,y:o}=Vs((a=(s=this.rendererState.center)==null?void 0:s[1])!=null?a:0,(u=(l=this.rendererState.center)==null?void 0:l[0])!=null?u:0,t,e);this.setPosition(n,o)}get isAnimating(){return this.rendererState.internalTweenGroup.getAll().some(e=>e.cameraAnimation)}getCameraFrameForCoordinates(e,t){var d,f;let n=t.minZoom!==void 0?t.minZoom:this.minZoomAltitude,o=t.maxZoom!==void 0?t.maxZoom:this.maxZoomAltitude,s=this.options.canvasWidth,a=this.options.canvasHeight,l=this.getRotation(),u=this.getTilt(),m=this.getPosition();this.setRotation((d=t.rotation)!=null?d:l,!0),this.setTilt((f=t.tilt)!=null?f:u,!0);let h=Kc(e,{canvasWidth:s,canvasHeight:a,paddingOption:t.padding,verticalPadding:t.verticalPadding,minZoom:n,maxZoom:o,position:m,camera:this.camera,orbit:this.orbit});return this.setRotation(l,!0),this.setTilt(u,!0),{center:h.position,zoomLevel:this.convertAltitudeToZoomLevel(h.zoom)}}focusOn(e,t){if(iy){this.debugContainer&&lt(this.debugContainer);let y=new hi(4,4,4),g=new Pt({color:65280,depthTest:!1}),S=new Pe(y,g,e.length),M=new we;e.forEach((E,w)=>{M.setPosition(E),S.setMatrixAt(w,M)}),S.instanceMatrix.needsUpdate=!0,this.debugContainer.add(S),this.scene.add(this.debugContainer)}let n=t.curve,o=t.callback,s=t.cancelledCallback,a=t.minZoom!==void 0?t.minZoom:this.minZoomAltitude,l=t.maxZoom!==void 0?t.maxZoom:this.maxZoomAltitude,u=this.options.canvasWidth,m=this.options.canvasHeight,h;t.duration!==void 0?h=t.duration:D.env.TESTING==="true"?h=0:h=$c;let d=t.padding,f=this.getRotation(),b=this.getTilt();t.rotation!=null&&this.setRotation(t.rotation),t.tilt!=null&&this.setTilt(t.tilt);let x=Kc(e,{canvasHeight:m,paddingOption:d,canvasWidth:u,minZoom:a,maxZoom:l,camera:this.camera,orbit:this.orbit,position:this.getPosition(),verticalPadding:t.verticalPadding});this.setRotation(f),this.setTilt(b),this.animateCamera({position:x.position,tilt:t.tilt,rotation:t.rotation,zoom:x.zoom},h,n,o,s,t)}resize(e,t){this.options.canvasWidth=e,this.options.canvasHeight=t}computeMetersPerPixelFromZoomLevel(e){let[,t]=this.center,n=de.clamp(e,ba,va),o=Math.pow(2,n),s=de.clamp(t,jc,Zc),a=o*512;return Math.cos(de.degToRad(s))*Math.PI*2*Or/a}computeMetersPerPixelFromAltitude(e){return e*2*Math.tan(de.degToRad(this.camera.fov)/2)/this.options.canvasHeight}getCurrentMetersPerPixel(){return this.computeMetersPerPixelFromAltitude(this.getZoomAltitude())}};Ea=new WeakMap,p(_n,"CAMERA_FRAME_PADDING_SIDES",["top","bottom","left","right"]);function Kc(i,{canvasWidth:r,orbit:e,paddingOption:t,verticalPadding:n=0,canvasHeight:o,minZoom:s,maxZoom:a,camera:l,position:u}){let m={zoom:s,position:u};if(i.length===0)return m;for(let ge of _n.CAMERA_FRAME_PADDING_SIDES)typeof t[ge]!="number"&&(t[ge]=0);let h=Mi(t,r,o);if(h.left+h.right>=r||h.top+h.bottom>=o)return m;e.updateMatrixWorld();let d=l.matrixWorldInverse,f=l.fov*(Math.PI/180)/2,b=f,y=Math.atan(Math.tan(f)*(r/o)),g=new k(1/0,1/0,1/0),S=new k(-1/0,-1/0,-1/0),M=new qe,E=new k;for(let ge=0,mr=i.length;ge<mr;ge++)E.copy(i[ge]),M.expandByPoint(E),E.applyMatrix4(d),g.min(E),S.max(E),E.copy(i[ge]),E.z-=n,E.applyMatrix4(d),g.min(E),S.max(E),E.copy(i[ge]),E.z+=n,E.applyMatrix4(d),g.min(E),S.max(E);let w=S.x-g.x,R=S.y-g.y,I=r-h.left-h.right,T=o-h.top-h.bottom,C=(S.x+g.x)/2,F=(S.y+g.y)/2,L=w/I,N=R/T,z=s,Y=a,G=z*Math.tan(y)*2,q=Y*Math.tan(y)*2,le=G/r,Q=q/r,K=Math.max(L,N);K=de.clamp(K,le,Q);let B=I*K,j=T*K,U={min:{x:C-B/2-h.left*K,y:F-j/2-h.bottom*K},max:{x:C+B/2+h.right*K,y:F+j/2+h.top*K}},ce=(U.min.x+U.max.x)/2,xe=(U.min.y+U.max.y)/2,ue=M.getCenter(new k),ze=Math.abs(ce-U.min.x),Re=Math.abs(xe-U.min.y),Se=ze/Math.tan(y),Me=Re/Math.tan(b),De=new k;De.set(ce,xe,S.z+Math.max(Se,Me)),De.applyMatrix4(l.matrixWorld);let Ue=new k;Ue.set(ce,xe,S.z),Ue.applyMatrix4(l.matrixWorld);let Ye=new k().subVectors(Ue,De),Ut=(ue.z-De.z)/Ye.z,je=new k().copy(De).add(Ye.clone().multiplyScalar(Ut));return Ue.set(je.x,je.y,je.z),De.sub(Ue),{position:je,zoom:De.length()}}v();import{z as Le}from"zod";var oy=Le.object({rotation:Le.array(Le.number()).length(3).optional(),altitude:Le.number().optional(),scale:Le.array(Le.number()).length(3).optional(),interactive:Le.boolean().optional(),verticalOffset:Le.number().optional(),id:Le.union([Le.number(),Le.string()]).optional()}),sy=Le.object({type:Le.enum(["Feature"]),geometry:Si,properties:oy}),ay=Le.object({type:Le.enum(["FeatureCollection"]),features:Le.array(sy)}),ly=Le.object({color:Le.string()}),cy=Le.object({url:Le.string(),color:Le.string().optional(),opacity:Le.number().optional(),material:Le.record(Le.string(),ly).optional()});function Dm(i,r,e){Le.union([Le.number(),Le.string()]).parse(i),ay.parse(r),cy.parse(e)}var So,Mo,Eo,Co,wo,un=class{constructor(r){p(this,"mesh");p(this,"type","model");p(this,"positionDirty",!0);p(this,"outline");p(this,"geometry");p(this,"material");p(this,"feature");p(this,"instanceIndex",-1);p(this,"instancingDisabled",!1);A(this,So,!0);p(this,"color",new me);p(this,"clippingPlane");p(this,"position",new k);A(this,Mo,0);A(this,Eo,1);A(this,Co,Je.GEOMETRY);A(this,wo,!1);this.feature=r}get visible(){return c(this,So)}set visible(r){_(this,So,r)}get modelScene(){var r;return this.clippingPlane?(r=this.mesh)==null?void 0:r.children.find(e=>e.name!=="hole-fill-mesh"):this.mesh}get altitude(){return c(this,Mo)}set altitude(r){_(this,Mo,r)}get opacity(){return c(this,Eo)}set opacity(r){_(this,Eo,r)}get renderOrder(){return c(this,Co)}set renderOrder(r){_(this,Co,r)}get visibleThroughGeometry(){return c(this,wo)}set visibleThroughGeometry(r){_(this,wo,r)}};So=new WeakMap,Mo=new WeakMap,Eo=new WeakMap,Co=new WeakMap,wo=new WeakMap;v();v();var Fn={container:{position:"absolute",top:"0",left:"0",width:"100%",height:"100%",pointerEvents:"none",zIndex:"9998"},focusOnBox:{position:"absolute",border:"2px solid orange",backgroundColor:"transparent",pointerEvents:"none"},getFocusOnTransformBox:{position:"absolute",border:"2px dashed cyan",backgroundColor:"rgba(0, 255, 255, 0.1)",pointerEvents:"none"},animateToBox:{position:"absolute",width:"12px",height:"12px",border:"2px solid lime",backgroundColor:"rgba(0, 255, 0, 0.3)",borderRadius:"50%",transform:"translate(-50%, -50%)",pointerEvents:"none"},label:{position:"absolute",fontSize:"10px",fontFamily:"monospace",color:"white",backgroundColor:"rgba(0, 0, 0, 0.7)",padding:"2px 4px",borderRadius:"2px",whiteSpace:"nowrap"}},eu={container:{position:"absolute",top:"0",left:"0",width:"100%",height:"100%",pointerEvents:"none",zIndex:"9999"},top:{position:"absolute",top:"0",left:"0",right:"0",backgroundColor:"rgba(255, 0, 0, 0.2)",borderBottom:"2px dashed rgba(255, 0, 0, 0.6)"},bottom:{position:"absolute",bottom:"0",left:"0",right:"0",backgroundColor:"rgba(0, 255, 0, 0.2)",borderTop:"2px dashed rgba(0, 255, 0, 0.6)"},left:{position:"absolute",top:"0",bottom:"0",left:"0",backgroundColor:"rgba(0, 0, 255, 0.2)",borderRight:"2px dashed rgba(0, 0, 255, 0.6)"},right:{position:"absolute",top:"0",bottom:"0",right:"0",backgroundColor:"rgba(255, 255, 0, 0.2)",borderLeft:"2px dashed rgba(255, 255, 0, 0.6)"},label:{position:"absolute",fontSize:"10px",fontFamily:"monospace",color:"white",backgroundColor:"rgba(0, 0, 0, 0.7)",padding:"2px 4px",borderRadius:"2px"}},rr,Ci,nr,Lt,Ke,et,ct,Gn,Nn,wi,Bn,kn,St,At,hn,zn,Ie,Pm,Im,Om,Lm,To,Am,Rm,Ca,Do,wa=class{constructor(r,e){A(this,Ie);A(this,rr);A(this,Ci);A(this,nr,!1);A(this,Lt,null);A(this,Ke,null);A(this,et,null);A(this,ct,null);A(this,Gn,null);A(this,Nn,null);A(this,wi,null);A(this,Bn,null);A(this,kn,!1);A(this,St,null);A(this,At,null);A(this,hn,null);A(this,zn,null);_(this,rr,r),_(this,Ci,e)}showCameraTargets(){c(this,nr)||(_(this,nr,!0),te(this,Ie,Pm).call(this),te(this,Ie,Om).call(this))}hideCameraTargets(){c(this,nr)&&(_(this,nr,!1),te(this,Ie,Lm).call(this),te(this,Ie,Im).call(this))}setFocusOnPointCloud(r){c(this,nr)&&(_(this,Gn,r.map(e=>e.clone())),te(this,Ie,To).call(this))}setGetFocusOnTransformPointCloud(r){c(this,nr)&&(_(this,Nn,r.map(e=>e.clone())),te(this,Ie,To).call(this))}setAnimateToPosition(r){c(this,nr)&&(_(this,wi,r.clone()),te(this,Ie,To).call(this))}showScreenOffsets(){c(this,kn)||(_(this,kn,!0),te(this,Ie,Am).call(this))}hideScreenOffsets(){c(this,kn)&&(_(this,kn,!1),te(this,Ie,Rm).call(this))}destroy(){this.hideCameraTargets(),this.hideScreenOffsets()}};rr=new WeakMap,Ci=new WeakMap,nr=new WeakMap,Lt=new WeakMap,Ke=new WeakMap,et=new WeakMap,ct=new WeakMap,Gn=new WeakMap,Nn=new WeakMap,wi=new WeakMap,Bn=new WeakMap,kn=new WeakMap,St=new WeakMap,At=new WeakMap,hn=new WeakMap,zn=new WeakMap,Ie=new WeakSet,Pm=function(){let r=c(this,rr).container;if(!r)return;_(this,Lt,document.createElement("div")),c(this,Lt).dataset.debugCameraTargets="true",Object.assign(c(this,Lt).style,Fn.container),_(this,Ke,document.createElement("div")),c(this,Ke).dataset.debugType="focusOn",Object.assign(c(this,Ke).style,Fn.focusOnBox),c(this,Ke).style.display="none";let e=document.createElement("span");Object.assign(e.style,Fn.label),e.style.top="-20px",e.style.left="0",e.style.color="orange",e.textContent="focusOn",c(this,Ke).appendChild(e),_(this,et,document.createElement("div")),c(this,et).dataset.debugType="getFocusOnTransform",Object.assign(c(this,et).style,Fn.getFocusOnTransformBox),c(this,et).style.display="none";let t=document.createElement("span");Object.assign(t.style,Fn.label),t.style.top="-20px",t.style.left="0",t.style.color="cyan",t.textContent="getFocusOnTransform",c(this,et).appendChild(t),_(this,ct,document.createElement("div")),c(this,ct).dataset.debugType="animateTo",Object.assign(c(this,ct).style,Fn.animateToBox),c(this,ct).style.display="none";let n=document.createElement("span");Object.assign(n.style,Fn.label),n.style.top="-20px",n.style.left="50%",n.style.transform="translateX(-50%)",n.style.color="lime",n.textContent="animateTo",c(this,ct).appendChild(n),c(this,Lt).appendChild(c(this,Ke)),c(this,Lt).appendChild(c(this,et)),c(this,Lt).appendChild(c(this,ct)),r.appendChild(c(this,Lt))},Im=function(){c(this,Lt)&&(c(this,Lt).remove(),_(this,Lt,null)),_(this,Ke,null),_(this,et,null),_(this,ct,null)},Om=function(){_(this,Bn,c(this,rr).on("post-render",()=>{te(this,Ie,To).call(this)}))},Lm=function(){c(this,Bn)!==null&&(c(this,Bn).call(this),_(this,Bn,null))},To=function(){if(!c(this,nr)||!c(this,Lt))return;let r=new he;if(c(this,Ke)&&c(this,Gn)&&c(this,Gn).length>0){let e=1/0,t=1/0,n=-1/0,o=-1/0;for(let s of c(this,Gn))c(this,rr).project(r,s),r.x!==-1e3&&(e=Math.min(e,r.x),t=Math.min(t,r.y),n=Math.max(n,r.x),o=Math.max(o,r.y));e!==1/0?(c(this,Ke).style.display="block",c(this,Ke).style.left="".concat(e,"px"),c(this,Ke).style.top="".concat(t,"px"),c(this,Ke).style.width="".concat(n-e,"px"),c(this,Ke).style.height="".concat(o-t,"px")):c(this,Ke).style.display="none"}else c(this,Ke)&&(c(this,Ke).style.display="none");if(c(this,et)&&c(this,Nn)&&c(this,Nn).length>0){let e=1/0,t=1/0,n=-1/0,o=-1/0;for(let s of c(this,Nn))c(this,rr).project(r,s),r.x!==-1e3&&(e=Math.min(e,r.x),t=Math.min(t,r.y),n=Math.max(n,r.x),o=Math.max(o,r.y));e!==1/0?(c(this,et).style.display="block",c(this,et).style.left="".concat(e,"px"),c(this,et).style.top="".concat(t,"px"),c(this,et).style.width="".concat(n-e,"px"),c(this,et).style.height="".concat(o-t,"px")):c(this,et).style.display="none"}else c(this,et)&&(c(this,et).style.display="none");c(this,ct)&&c(this,wi)?(c(this,rr).project(r,c(this,wi)),r.x!==-1e3?(c(this,ct).style.display="block",c(this,ct).style.left="".concat(r.x,"px"),c(this,ct).style.top="".concat(r.y,"px")):c(this,ct).style.display="none"):c(this,ct)&&(c(this,ct).style.display="none")},Am=function(){let r=c(this,rr).container;if(!r)return;_(this,St,document.createElement("div")),c(this,St).dataset.debugScreenOffsets="true",Object.assign(c(this,St).style,eu.container);let e=t=>{let n=document.createElement("div");n.dataset.debugOffset=t,Object.assign(n.style,eu[t]);let o=document.createElement("span");switch(Object.assign(o.style,eu.label),o.dataset.debugLabel=t,t){case"top":o.style.bottom="4px",o.style.left="50%",o.style.transform="translateX(-50%)";break;case"bottom":o.style.top="4px",o.style.left="50%",o.style.transform="translateX(-50%)";break;case"left":o.style.right="4px",o.style.top="50%",o.style.transform="translateY(-50%)";break;case"right":o.style.left="4px",o.style.top="50%",o.style.transform="translateY(-50%)";break}return n.appendChild(o),n};_(this,At,{top:e("top"),bottom:e("bottom"),left:e("left"),right:e("right")}),c(this,St).appendChild(c(this,At).top),c(this,St).appendChild(c(this,At).bottom),c(this,St).appendChild(c(this,At).left),c(this,St).appendChild(c(this,At).right),r.appendChild(c(this,St)),te(this,Ie,Ca).call(this),_(this,zn,c(this,Ci).on("padding-change",()=>{te(this,Ie,Ca).call(this)})),_(this,hn,new ResizeObserver(()=>{te(this,Ie,Ca).call(this)})),c(this,hn).observe(r)},Rm=function(){c(this,zn)&&(c(this,zn).call(this),_(this,zn,null)),c(this,hn)&&(c(this,hn).disconnect(),_(this,hn,null)),c(this,St)&&(c(this,St).remove(),_(this,St,null)),_(this,At,null)},Ca=function(){if(!c(this,At)||!c(this,St))return;let r=c(this,Ci).insetsPadding,e=c(this,rr).container,t=e.clientWidth,n=e.clientHeight,o=Mi(r,t,n),s=c(this,At).top,a=s.querySelector("[data-debug-label]");o.top>0?(s.style.height="".concat(o.top,"px"),s.style.display="block",a&&(a.textContent="top: ".concat(te(this,Ie,Do).call(this,r.top,r.type)))):s.style.display="none";let l=c(this,At).bottom,u=l.querySelector("[data-debug-label]");o.bottom>0?(l.style.height="".concat(o.bottom,"px"),l.style.display="block",u&&(u.textContent="bottom: ".concat(te(this,Ie,Do).call(this,r.bottom,r.type)))):l.style.display="none";let m=c(this,At).left,h=m.querySelector("[data-debug-label]");o.left>0?(m.style.height="",m.style.top="".concat(o.top,"px"),m.style.bottom="".concat(o.bottom,"px"),m.style.width="".concat(o.left,"px"),m.style.display="block",h&&(h.textContent="left: ".concat(te(this,Ie,Do).call(this,r.left,r.type)))):m.style.display="none";let d=c(this,At).right,f=d.querySelector("[data-debug-label]");o.right>0?(d.style.height="",d.style.top="".concat(o.top,"px"),d.style.bottom="".concat(o.bottom,"px"),d.style.width="".concat(o.right,"px"),d.style.display="block",f&&(f.textContent="right: ".concat(te(this,Ie,Do).call(this,r.right,r.type)))):d.style.display="none"},Do=function(r,e){return e==="portion"?"".concat((r*100).toFixed(1),"%"):"".concat(r,"px")};var uy=0,hy=90,dy=(D.env.NODE_ENV==="test",!1),Ta={linear:Dn.Linear.None,"ease-in":Dn.Quadratic.In,"ease-out":Dn.Quadratic.Out,"ease-in-out":Dn.Quadratic.InOut},my=-50,X,ie,Sr,$t,Po,Io,ru,Da=class extends ye{constructor(e,t,n){super();A(this,Io);A(this,X);A(this,ie);A(this,Sr);A(this,$t);A(this,Po);_(this,X,e),_(this,ie,t),_(this,Sr,n),_(this,$t,new wa(e,this)),c(this,X).map&&c(this,X).map.transform.setMinElevationForCurrentTile(my),c(this,ie).cameraSystem.on("pedestal-change",({pedestal:o})=>{var s;c(this,ie).cameraSystem.setCameraPlaneElevation(o),c(this,X).mode==="outdoors-overlay"&&typeof((s=c(this,X).map)==null?void 0:s.setCenterElevation)=="function"&&c(this,X).map.setCenterElevation(c(this,ie).cameraSystem.getPedestal())})}get center(){var e,t;return c(this,X).mode==="outdoors-overlay"&&c(this,X).map?(t=(e=c(this,X).map).getCenter)==null?void 0:t.call(e).toArray():c(this,ie).cameraSystem.center}setCenter(e){var t;if(c(this,X).mode==="outdoors-overlay"&&c(this,X).map){(t=c(this,X).map)==null||t.setCenter(e),c(this,ie).interactionSystem.handleHover();return}c(this,ie).cameraSystem.setCenter(e[0],e[1]),c(this,ie).interactionSystem.handleHover()}get zoomLevel(){var e;return c(this,X).mode==="outdoors-overlay"&&c(this,X).map?(e=c(this,X).map)==null?void 0:e.getZoom():c(this,ie).cameraSystem.getZoomLevel()}setZoomLevel(e){var t;c(this,X).mode==="outdoors-overlay"&&c(this,X).map&&((t=c(this,X).map)==null||t.setZoom(e)),c(this,ie).cameraSystem.setZoomLevel(tr(e,this.minZoomLevel,this.maxZoomLevel,"zoomLevel was clamped to minZoomLevel/maxZoomLevel bounds. Use mapView.Camera.setMinZoomLevel() and mapView.Camera.setMaxZoomLevel() to adjust limits."))}getState(){return{zoomLevel:this.zoomLevel,minZoomLevel:this.minZoomLevel,maxZoomLevel:this.maxZoomLevel,minPitch:this.minPitch,maxPitch:this.maxPitch,autoMinZoomLevel:this.autoMinZoomLevel,panMode:this.panMode,screenOffsets:this.insetsPadding,center:this.center,bearing:this.bearing,pitch:this.pitch,elevation:this.elevation}}get isAnimating(){return c(this,ie).cameraSystem.isAnimating}cancelAnimation(){c(this,ie).cameraSystem.cancelAnimation()}get maxZoomLevel(){return c(this,ie).cameraSystem.maxZoomLevel}get minZoomLevel(){return c(this,ie).cameraSystem.minZoomLevel}setAutoMinZoomLevel(e){c(this,ie).panBoundsSystem.autoMinZoomLevel=e,e&&(c(this,ie).panBoundsSystem.dirty=!0,c(this,ie).panBoundsSystem.update())}get autoMinZoomLevel(){return c(this,ie).panBoundsSystem.autoMinZoomLevel}setMinZoomLevel(e,t=!1){var o;t&&this.setAutoMinZoomLevel(!1);let n=tr(e,Yt.MIN_MERCATOR_ZOOM_LEVEL,this.maxZoomLevel,"setMinZoomLevel was clamped. minZoomLevel must be between ".concat(Yt.MIN_MERCATOR_ZOOM_LEVEL," and maxZoomLevel."));c(this,ie).cameraSystem.setMinZoomLevel(n),this.zoomLevel<n&&this.setZoomLevel(n),(o=c(this,X).map)==null||o.setMinZoom(n)}setMaxZoomLevel(e){var n;let t=tr(e,this.minZoomLevel,Yt.MAX_MERCATOR_ZOOM_LEVEL,"setMaxZoomLevel was clamped. maxZoomLevel must be between minZoomLevel and ".concat(Yt.MAX_MERCATOR_ZOOM_LEVEL,"."));c(this,ie).cameraSystem.setMaxZoomLevel(t),this.zoomLevel>t&&this.setZoomLevel(t),(n=c(this,X).map)==null||n.setMaxZoom(t)}get maxPitch(){var e,t;return c(this,X).mode==="outdoors-overlay"&&c(this,X).map?(t=(e=c(this,X).map)==null?void 0:e.getMaxPitch)==null?void 0:t.call(e):de.radToDeg(c(this,ie).cameraSystem.maxTilt)}get minPitch(){var e,t;return c(this,X).mode==="outdoors-overlay"&&c(this,X).map?(t=(e=c(this,X).map)==null?void 0:e.getMinPitch)==null?void 0:t.call(e):de.radToDeg(c(this,ie).cameraSystem.minTilt)}setMinPitch(e){var n;let t=Math.max(uy,e);(n=c(this,X).map)==null||n.setMinPitch(t),c(this,ie).cameraSystem.minTilt=de.degToRad(t)}setMaxPitch(e){var n;let t=Math.min(hy,e);(n=c(this,X).map)==null||n.setMaxPitch(t),c(this,ie).cameraSystem.maxTilt=de.degToRad(t)}get bearing(){var e;return c(this,X).mode==="outdoors-overlay"&&c(this,X).map?(e=c(this,X).map)==null?void 0:e.getBearing():de.radToDeg(c(this,ie).cameraSystem.getRotation())}setBearing(e){var t;if(c(this,X).mode==="outdoors-overlay"&&c(this,X).map){(t=c(this,X).map)==null||t.setBearing(e);return}c(this,ie).cameraSystem.setRotation(de.degToRad(e))}get pitch(){var e;return c(this,X).mode==="outdoors-overlay"&&c(this,X).map?(e=c(this,X).map)==null?void 0:e.getPitch():de.radToDeg(c(this,ie).cameraSystem.getTilt())}setPitch(e){var t;if(c(this,X).mode==="outdoors-overlay"&&c(this,X).map){(t=c(this,X).map)==null||t.setPitch(e);return}c(this,ie).cameraSystem.setTilt(de.degToRad(tr(e,this.minPitch,this.maxPitch,"pitch was clamped to minPitch/maxPitch bounds. Use mapView.Camera.setMinPitch() and mapView.Camera.setMaxPitch() to adjust limits.")))}get elevation(){return c(this,ie).cameraSystem.getPedestal()}setElevation(e){c(this,ie).cameraSystem.setPedestal(e,!0)}animateElevation(e,t){return c(this,Po)&&c(this,Po).stop(),new Promise(n=>{var o;c(this,ie).cameraSystem.animateCamera({position:{z:e}},(t==null?void 0:t.duration)||300,Ta[(t==null?void 0:t.easing)||"ease-in-out"],n,n,{interruptible:(o=t==null?void 0:t.interruptible)!=null?o:!0})})}get insetsPadding(){return c(this,Sr).insetsPadding}get panMode(){return c(this,ie).cameraSystem.enablePan===!1&&c(this,ie).cameraSystem.enablePedestal===!0?"elevation":"default"}setPanMode(e){if(e!=="default"&&e!=="elevation")throw new Error("Invalid pan mode");e!==this.panMode&&(e==="default"?(c(this,ie).cameraSystem.enablePan=!0,c(this,ie).cameraSystem.enablePedestal=!1):(c(this,ie).cameraSystem.enablePan=!1,c(this,ie).cameraSystem.enablePedestal=!0))}setInsetPadding(e){c(this,Sr).insetsPadding=Object.assign({},c(this,Sr).insetsPadding,e),this.publish("padding-change",{padding:c(this,Sr).insetsPadding})}animateTo(e){var a,l,u,m,h,d;let t=e.center?c(this,X).convertTo3DMapPosition(e.center[1],e.center[0],e.center[2]||this.elevation):void 0;if(t&&c(this,$t).setAnimateToPosition(t),c(this,X).mode==="outdoors-overlay"&&c(this,X).map)return(d=c(this,X).map)==null||d.flyTo({center:(a=e.center)!=null?a:this.center,zoom:(l=e.zoomLevel)!=null?l:this.zoomLevel,bearing:(u=e.bearing)!=null?u:this.bearing,pitch:(m=e.pitch)!=null?m:this.pitch,duration:(h=e.duration)!=null?h:600}),Promise.resolve();let n=e.zoomLevel!==void 0?c(this,ie).cameraSystem.convertZoomLevelToAltitude(tr(e.zoomLevel,this.minZoomLevel,this.maxZoomLevel,"zoomLevel was clamped to minZoomLevel/maxZoomLevel bounds. Use mapView.Camera.setMinZoomLevel() and mapView.Camera.setMaxZoomLevel() to adjust limits.")):void 0,o=e.bearing!==void 0?de.degToRad(e.bearing):void 0,s=e.pitch!==void 0?de.degToRad(tr(e.pitch,this.minPitch,this.maxPitch,"pitch was clamped to minPitch/maxPitch bounds. Use mapView.Camera.setMinPitch() and mapView.Camera.setMaxPitch() to adjust limits.")):void 0;return new Promise(f=>{var b;c(this,ie).cameraSystem.animateCamera({position:t,zoom:n,rotation:o,tilt:s},e.duration||0,Ta[e.easing||"ease-in-out"],()=>{c(this,ie).interactionSystem.handleHover(),f()},f,{interruptible:(b=e==null?void 0:e.interruptible)!=null?b:!0})})}getCameraFrameForCoordinates(e,t){let n=te(this,Io,ru).call(this,t||{},()=>Promise.resolve()),{pointCloud:o}=_m(e,c(this,X),c(this,Sr).geometry3DMap);if(o.length===0)return $.error("No valid coordinates found in targets:",e),{center:this.center,zoomLevel:this.zoomLevel};c(this,$t).setGetFocusOnTransformPointCloud(o);let{center:s,zoomLevel:a}=c(this,ie).cameraSystem.getCameraFrameForCoordinates(o,n);return{center:c(this,X).convert3DMapPositionToCoordinate(s),zoomLevel:a}}focusOn(e,t){var a,l,u,m;let{pointCloud:n,geoBounds:o,firstPosition:s}=_m(e,c(this,X),c(this,Sr).geometry3DMap);return n.length===0?($.error("No valid coordinates found in targets:",e),Promise.resolve()):(c(this,$t).setFocusOnPointCloud(n),c(this,X).mode==="outdoors-overlay"&&c(this,X).map?(n.length===1&&s?(a=c(this,X).map)==null||a.flyTo({center:[s[0],s[1]],duration:(t==null?void 0:t.duration)||c(this,X).map.getBearing(),animate:!0,bearing:(t==null?void 0:t.bearing)===void 0?c(this,X).map.getBearing():t==null?void 0:t.bearing,pitch:(t==null?void 0:t.pitch)===void 0?c(this,X).map.getPitch():t==null?void 0:t.pitch,zoom:(t==null?void 0:t.maxZoomLevel)||c(this,X).map.getMaxZoom()}):(dy&&py(c(this,X),o),(m=c(this,X).map)==null||m.fitBounds(o,{duration:(l=t==null?void 0:t.duration)!=null?l:Yt.DEFAULT_ANIMATION_DURATION,bearing:(t==null?void 0:t.bearing)===void 0?c(this,X).map.getBearing():t==null?void 0:t.bearing,pitch:(t==null?void 0:t.pitch)===void 0?c(this,X).map.getPitch():t==null?void 0:t.pitch,maxZoom:(u=t==null?void 0:t.maxZoomLevel)!=null?u:c(this,X).map.getMaxZoom()})),c(this,ie).interactionSystem.handleHover(),Promise.resolve()):new Promise(h=>{c(this,ie).cameraSystem.focusOn(n,te(this,Io,ru).call(this,t||{},h))}))}showCameraTargetsDebug(){c(this,$t).showCameraTargets()}hideCameraTargetsDebug(){c(this,$t).hideCameraTargets()}showScreenOffsetsDebug(){c(this,$t).showScreenOffsets()}hideScreenOffsetsDebug(){c(this,$t).hideScreenOffsets()}destroy(){c(this,$t).destroy(),super.destroy()}};X=new WeakMap,ie=new WeakMap,Sr=new WeakMap,$t=new WeakMap,Po=new WeakMap,Io=new WeakSet,ru=function(e,t){var n;return{minZoom:(e==null?void 0:e.maxZoomLevel)===void 0?void 0:c(this,ie).cameraSystem.convertZoomLevelToAltitude(tr(e.maxZoomLevel,this.minZoomLevel,this.maxZoomLevel,"maxZoomLevel was clamped to minZoomLevel/maxZoomLevel bounds. Use mapView.Camera.setMaxZoomLevel() to adjust limits.")),maxZoom:(e==null?void 0:e.minZoomLevel)===void 0?void 0:c(this,ie).cameraSystem.convertZoomLevelToAltitude(tr(e.minZoomLevel,this.minZoomLevel,this.maxZoomLevel,"minZoomLevel was clamped to minZoomLevel/maxZoomLevel bounds. Use mapView.Camera.setMinZoomLevel() to adjust limits.")),padding:e!=null&&e.padding?Object.assign({},zs,e==null?void 0:e.padding):this.insetsPadding,curve:Ta[(e==null?void 0:e.easing)||"ease-in-out"],rotation:(e==null?void 0:e.bearing)===void 0?void 0:de.degToRad(e.bearing),tilt:(e==null?void 0:e.pitch)!==void 0?de.degToRad(tr(e.pitch,this.minPitch,this.maxPitch,"pitch was clamped to minPitch/maxPitch bounds. Use mapView.Camera.setMinPitch() and mapView.Camera.setMaxPitch() to adjust limits.")):void 0,duration:e==null?void 0:e.duration,callback:()=>{c(this,ie).interactionSystem.handleHover(),t()},cancelledCallback:t,interruptible:(n=e==null?void 0:e.interruptible)!=null?n:!0,verticalPadding:e==null?void 0:e.verticalPadding}};function tu(i,r){i[0]=Math.min(i[0],r[0]),i[1]=Math.min(i[1],r[1]),i[2]=Math.max(i[2],r[0]),i[3]=Math.max(i[3],r[1])}function _m(i,r,e){var a;let t=[],n=[1/0,1/0,-1/0,-1/0],o=null;if(!i||!Array.isArray(i)||i.length===0)return{pointCloud:t,geoBounds:n,firstPosition:o};let s=r.getSystems().renderSystem;for(let l of i)if(typeof l=="string"){(s.threeDdirty||s.twoDdirty)&&r.renderSync();let u=e.get(l);if(!u){$.error("Entity not found with id:",l);continue}let m=new qe;ad(r,"userData"in u&&(a=u.userData.entityId)!=null?a:u.id,t,m,u instanceof Ne?u.position.z:void 0);let h=r.convert3DMapPositionToCoordinate(m.min),d=r.convert3DMapPositionToCoordinate(m.max);tu(n,h),tu(n,d),o||(o=r.convert3DMapPositionToCoordinate(m.getCenter(new k)))}else t.push(r.convertTo3DMapPosition(l[1],l[0],l[2]||0)),tu(n,l),o||(o=l);return{pointCloud:t,geoBounds:n,firstPosition:o}}function py(i,r){var t,n,o,s;let e=[[r[0],r[1]],[r[0],r[3]],[r[2],r[3]],[r[2],r[1]],[r[0],r[1]]];(t=i.map)!=null&&t.getLayer("bounds-outline")&&i.map.removeLayer("bounds-outline"),(n=i.map)!=null&&n.getSource("bounds-source")&&i.map.removeSource("bounds-source"),(o=i.map)==null||o.addSource("bounds-source",{type:"geojson",data:{type:"Feature",properties:{},geometry:{type:"LineString",coordinates:e}}}),(s=i.map)==null||s.addLayer({id:"bounds-outline",type:"line",source:"bounds-source",layout:{},paint:{"line-color":"#FF0000","line-width":2,"line-opacity":.8}})}v();v();var Fm="uniform vec4 uSize;\nvarying vec2 vUv;\nvoid main() {\n vUv = uv;\n // Scale the position by the size of the quad\n // and shift to top left corner for 0,0\n vec2 transformed = position.xy * uSize.xy - vec2(1.0, -1.0);\n // Apply width .x and height .y of image\n transformed += vec2(uSize.x, -uSize.y);\n // Apply left .w and top .z offset\n transformed += vec2(uSize.w, -uSize.z) * 2.0;\n gl_Position = vec4(transformed, 1.0, 1.0);\n}";v();var Gm="varying vec2 vUv;\nuniform sampler2D uTexture;\nuniform float uOpacity;\nvoid main() {\n #ifndef debug\n vec4 texture = texture2D(uTexture, vUv);\n gl_FragColor = vec4(texture.rgb, texture.a * uOpacity);\n #else\n gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);\n #endif\n}";v();var Nm=4.291666666666667,Bm=15,km=25,zm=43/60;v();var Um=["horizontal","icon"],fy=new Map([[Um[0],'<svg viewBox="0 0 206 48">\n <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"/>\n <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"/>\n <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"/>\n <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"/>\n </svg>'],[Um[1],'<svg viewBox="0 0 43 60">\n <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"/>\n <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"/>\n <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"/>\n </svg>']]),gy=/<svg([^>]*)>/g;function Hm(i,r,e,t){let n=fy.get(i);return n?n.replace(gy,'<svg$1 width="'.concat(e,'" height="').concat(t,'" xmlns="http://www.w3.org/2000/svg" style="fill: ').concat(r,';">')):""}v();var Un=class Un{constructor(){p(this,"loader");this.loader=new Ns}static getInstance(){return Un.instance||(Un.instance=new Un),Un.instance}getLoader(){return this.loader}load(r){return new Promise((e,t)=>{this.loader.load(r,e,void 0,t)})}};p(Un,"instance");var nu=Un,dn=nu.getInstance();var Vm=!1,Oe,kr,Ti,tt,Mt,Hn,ir,Mr,Pa=class extends ye{constructor(e,t,n){super();A(this,Oe,{padding:16,scale:1,iconOnly:!1,position:"bottom-left",color:"dark",onClick:()=>{window!=null&&window.open("https://www.mappedin.com")},interactive:!0,visible:!0});A(this,kr);A(this,Ti);A(this,tt);A(this,Mt);A(this,Hn);A(this,ir,0);A(this,Mr,0);p(this,"dirty",!0);p(this,"getPositionAlignedCanvasCoordinates",(e,t)=>({"top-left":{x:0,y:0},"top-right":{x:e,y:0},"bottom-left":{x:0,y:t},"bottom-right":{x:e,y:t},center:{x:e/2,y:t/2},top:{x:e/2,y:0},bottom:{x:e/2,y:t},left:{x:0,y:t/2},right:{x:e,y:t/2}})[c(this,Oe).position]);p(this,"getPositionAlignedPadding",()=>{var n,o,s,a;let e=c(this,Oe).padding;if(typeof e=="number")return{"top-left":{x:e,y:e},"top-right":{x:-e,y:e},"bottom-left":{x:e,y:-e},"bottom-right":{x:-e,y:-e},center:{x:0,y:0},top:{x:0,y:e},bottom:{x:0,y:-e},left:{x:e,y:0},right:{x:-e,y:0}}[c(this,Oe).position];let t={top:(n=e.top)!=null?n:0,right:(o=e.right)!=null?o:0,bottom:(s=e.bottom)!=null?s:0,left:(a=e.left)!=null?a:0};return{x:t.left-t.right,y:t.top-t.bottom}});n&&Object.entries(n).forEach(([o,s])=>{s!==void 0&&(c(this,Oe)[o]=s)}),_(this,Ti,e),_(this,kr,t)}get color(){return c(this,Oe).color==="light"?"white":"#293136"}get iconName(){return c(this,Oe).iconOnly?"icon":"horizontal"}get minWidth(){return c(this,Oe).iconOnly?Bm:75}get defaultWidth(){return c(this,Oe).iconOnly?km:150}get aspectRatio(){return c(this,Oe).iconOnly?zm:Nm}get options(){return V({},c(this,Oe))}set options(e){var t,n;_(this,Oe,{padding:e.padding||c(this,Oe).padding,position:e.position||c(this,Oe).position,iconOnly:e.iconOnly||c(this,Oe).iconOnly,color:e.color||c(this,Oe).color,scale:e.scale||c(this,Oe).scale,onClick:c(this,Oe).onClick,interactive:(t=e.interactive)!=null?t:c(this,Oe).interactive,visible:(n=e.visible)!=null?n:c(this,Oe).visible})}get icon(){return Hm(this.iconName,this.color,c(this,ir)*c(this,kr).pixelRatio,c(this,Mr)*c(this,kr).pixelRatio)}setSize(e,t){c(this,Mt)&&(c(this,Mt).uniforms.uSize.value.x=e,c(this,Mt).uniforms.uSize.value.y=t)}setXY(e,t){c(this,Mt)&&(c(this,Mt).uniforms.uSize.value.w=e,c(this,Mt).uniforms.uSize.value.z=t)}get width(){return c(this,ir)}get height(){return c(this,Mr)}getPositionAlignedOffset(e,t){return{"top-left":{x:0,y:0},"top-right":{x:-e,y:0},"bottom-left":{x:0,y:-t},"bottom-right":{x:-e,y:-t},center:{x:-(e/2),y:-(t/2)},top:{x:-(e/2),y:0},bottom:{x:-(e/2),y:-t},left:{x:0,y:-(t/2)},right:{x:-e,y:-(t/2)}}[c(this,Oe).position]}insertIntoQuadTree(e){c(this,Hn)!=null&&typeof c(this,Oe).onClick=="function"&&c(this,Oe).interactive&&e.insert(c(this,Hn))}resize(e,t){if(c(this,Oe).visible!==!0)return;let n=this.getPositionAlignedCanvasCoordinates(e,t),o=this.getPositionAlignedPadding(),s=this.getPositionAlignedOffset(c(this,ir),c(this,Mr)),a=Math.min(e-c(this,ir),Math.max(0,n.x+o.x+s.x)),l=Math.min(t-c(this,Mr),Math.max(0,n.y+o.y+s.y));this.setSize(c(this,ir)/e,c(this,Mr)/t),this.setXY(a/e,l/t),_(this,Hn,new pt(a,l,c(this,ir),c(this,Mr),{entityId:"watermark"}))}update(){this.dirty&&(c(this,Oe).visible===!0?(_(this,ir,Math.min(c(this,kr).canvasWidth,Math.max(this.minWidth,this.defaultWidth*c(this,Oe).scale))),_(this,Mr,c(this,ir)/this.aspectRatio),dn.getLoader().load("data:image/svg+xml;base64,".concat(btoa(this.icon)),e=>{if(_(this,Mt,new Zt({uniforms:{uTexture:{value:e},uSize:{value:new Gh(0,0,0,0)},uOpacity:{value:.7}},vertexShader:Fm,fragmentShader:Gm,depthWrite:!1,depthTest:!1,defines:{debug:Vm},wireframe:Vm,transparent:!0,visible:!0})),c(this,tt))c(this,tt).visible=!0,c(this,tt).material=c(this,Mt),c(this,tt).material.needsUpdate=!0;else{let t=new vt(2,2,1,1);_(this,tt,new pe(t,c(this,Mt))),c(this,tt).position.set(0,0,-1),c(this,tt).frustumCulled=!1,c(this,tt).renderOrder=999;let n=new hi(1,1,1),o=new pe(n,new Pt({transparent:!0,opacity:0,depthTest:!1,depthWrite:!1}));o.frustumCulled=!1,o.layers.set(1),c(this,tt).add(o),c(this,Ti).add(c(this,tt))}this.resize(c(this,kr).canvasWidth,c(this,kr).canvasHeight),this.publish("texture-loaded")})):c(this,tt)&&(c(this,tt).visible=!1),this.dirty=!1)}destroy(){c(this,tt)&&(c(this,Ti).remove(c(this,tt)),lt(c(this,tt))),_(this,tt,void 0),c(this,Mt)&&c(this,Mt).dispose(),_(this,Mt,void 0),_(this,Hn,void 0)}};Oe=new WeakMap,kr=new WeakMap,Ti=new WeakMap,tt=new WeakMap,Mt=new WeakMap,Hn=new WeakMap,ir=new WeakMap,Mr=new WeakMap;v();var Ia=100,vy=!1,La=class extends ye{constructor(e,t){super();p(this,"currentTotalBoundingBox");p(this,"state");p(this,"cameraSystem");p(this,"debugMesh",null);p(this,"dirty",!0);p(this,"autoMinZoomLevel",!0);this.state=e,this.cameraSystem=t}expandBoundsIfOutside(e){if(this.currentTotalBoundingBox==null){this.dirty=!0;return}this.currentTotalBoundingBox.containsPoint(e)||(this.dirty=!0)}update(){if(this.dirty){this.currentTotalBoundingBox==null&&(this.currentTotalBoundingBox=new qe,this.state.geometryScene.children.length===0?this.currentTotalBoundingBox.setFromCenterAndSize(new k(0,0,0),new k(Ia*2,Ia*2,0)):(this.currentTotalBoundingBox.setFromObject(this.state.geometryScene),this.currentTotalBoundingBox.expandByScalar(Ia)));let e=new qe().setFromObject(this.state.geometryScene);this.currentTotalBoundingBox.union(e);let t=e.getSize(new k),n=Math.max(t.x,t.y,t.z);for(let s of this.state.geometry2DMap.values())s.positionDirty===!0&&(this.currentTotalBoundingBox.expandByPoint(s.position),s.positionDirty=!1);let o=Oa.copy(this.currentTotalBoundingBox).expandByScalar(Math.max(n,Ia)).getBoundingSphere(xy).radius;if(this.cameraSystem.panBounds={center:this.currentTotalBoundingBox.getCenter(new k),min:Oa.min,max:Oa.max,radius:o},this.publish("update"),this.cameraSystem.dirty=!0,this.dirty=!1,vy&&this.state.geometryScene.parent instanceof Rr){this.debugMesh&&(this.state.geometryScene.parent.remove(this.debugMesh),this.debugMesh=null),this.debugMesh=new jt,this.debugMesh.add(new pe(new Gs(this.cameraSystem.panBounds.radius),new Pt({color:16711680,transparent:!0,opacity:.2}))),this.debugMesh.position.copy(this.cameraSystem.panBounds.center),this.state.geometryScene.parent.add(this.debugMesh);let s=new k;Oa.getSize(s);let a=new hi(s.x,s.y,s.z),l=new Pt({color:65280,wireframe:!0,transparent:!0,opacity:.5}),u=new pe(a,l);u.position.copy(this.currentTotalBoundingBox.getCenter(new k)),this.debugMesh.add(u)}}}},Oa=new qe,xy=new Nh;v();var iu="\xA9 Mappedin",Sy="https://info.mappedin.com/feedback",su=["top-left","top-right","bottom-left","bottom-right"],My=640,Ey=()=>"<svg xmlns='http://www.w3.org/2000/svg' width='15' height='15' fill-rule='evenodd' viewBox='0 0 20 20'>\n <circle cx='10' cy='10' r='5.9' style='fill:rgba(255,255,255,1);'/>\n <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'/>\n </svg>",ou={custom:[],position:"bottom-right",feedback:!0},Di,Aa=class{constructor(r,e={}){p(this,"controlContainerEl");p(this,"controlPositions");p(this,"compact");A(this,Di);p(this,"attribContainerEl");p(this,"attribInnerEl");p(this,"attribButtonEl");p(this,"feedbackLinkEl");p(this,"attribHTML",iu);p(this,"customAttributions",[]);p(this,"toggleAttribution",r=>{this.attribContainerEl!=null&&(r.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",""))))});_(this,Di,!!e.outdoorEnabled),this.controlContainerEl=document.createElement("div"),this.controlContainerEl.classList.add("mappedin-control-container"),r.appendChild(this.controlContainerEl),this.controlPositions=su.reduce((t,n)=>{let o=document.createElement("div");return o.classList.add("mappedin-ctrl-".concat(n)),this.controlContainerEl.appendChild(o),t[n]=o,t},{})}addAttributionControl(r=ou){var n;let e=r.position&&su.includes(r.position)?r.position:ou.position;this.attribContainerEl=document.createElement("details"),this.attribContainerEl.classList.add("mappedin-ctrl-attrib","mappedin-ctrl-attrib-".concat(e)),this.attribContainerEl.open=!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=Ey(),this.attribContainerEl.appendChild(this.attribButtonEl),this.attribInnerEl=document.createElement("div"),this.attribInnerEl.classList.add("mappedin-ctrl-attrib-inner"),this.attribHTML=c(this,Di)?iu:"",this.attribInnerEl.innerHTML=this.attribHTML,this.attribContainerEl.appendChild(this.attribInnerEl),((n=r.feedback)!=null?n:ou.feedback)&&(this.feedbackLinkEl=document.createElement("a"),this.feedbackLinkEl.href=Sy,this.feedbackLinkEl.target="_blank",this.feedbackLinkEl.rel="noopener",this.feedbackLinkEl.textContent="Provide Feedback",this.feedbackLinkEl.classList.add("mappedin-ctrl-attrib-inner"),this.feedbackLinkEl.classList.add("mappedin-ctrl-attrib-inner-bold"),this.attribContainerEl.appendChild(this.feedbackLinkEl)),r.custom&&(this.customAttributions=r.custom),this.updateAttributionDisplay()}updateAttribution(r){if(!r.style||!this.attribInnerEl||!this.attribContainerEl)return;let e=c(this,Di)?[iu]:[],t=r.style.sourceCaches;for(let n in t){let o=t[n];if(o.used||o.usedForTerrain){let s=o.getSource();s.attribution&&e.indexOf(s.attribution)<0&&e.push(s.attribution)}}e=e.filter(n=>String(n).trim()),e=e.filter((n,o)=>{for(let s=o+1;s<e.length;s++)if(e[s].indexOf(n)>=0)return!1;return!0}),this.attribHTML=e.join(" "),this.updateAttributionDisplay()}updateAttributionDisplay(){let r=[...new Set([this.attribHTML,...this.customAttributions])].filter(Boolean).join(" ");this.attribInnerEl&&(this.attribInnerEl.innerHTML=r)}resizeAttribution(r){this.attribContainerEl&&(r<=My||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(r){this.resizeAttribution(r)}updateData(r){this.updateAttribution(r)}destroy(){this.destroyAttributionControl(),this.controlContainerEl.remove(),this.compact=void 0}};Di=new WeakMap;v();var Oo,Lo,Pi=class{constructor(r,e){p(this,"mesh");p(this,"type","custom-geometry");p(this,"dirty",!0);p(this,"feature");p(this,"builder");p(this,"outline");A(this,Oo,1);p(this,"color",new me);A(this,Lo,0);this.mesh=new Nt,this.feature=r,this.builder=e}get visible(){return this.mesh.visible}set visible(r){this.mesh.visible=r}set opacity(r){_(this,Oo,r)}get opacity(){return c(this,Oo)}setColor(r){this.color.set(r)}get position(){var r;return(r=this.mesh)==null?void 0:r.position}get altitude(){return c(this,Lo)}set altitude(r){this.mesh&&(this.mesh.position.z=r,_(this,Lo,r))}get renderOrder(){return this.mesh?this.mesh.renderOrder:0}set renderOrder(r){this.mesh&&(this.mesh.renderOrder=r)}};Oo=new WeakMap,Lo=new WeakMap;v();var Ra=class{constructor(r,e){p(this,"state");p(this,"convertTo3DMapPosition");this.state=r,this.convertTo3DMapPosition=e}update(){let r,e;for(let t of this.state.geometry3DsInScene)(t==null?void 0:t.type)==="custom-geometry"&&(r=t.components[0],e=t.components[1],r.dirty&&e.visible!==!1&&(r.position.copy(this.convertTo3DMapPosition(r.feature.geometry.coordinates[1],r.feature.geometry.coordinates[0],e.altitude)),r.builder.setup(r.mesh),r.mesh.traverse(n=>{n.userData=Ce(V({},n.userData),{entityId:t.id,type:"custom-geometry"})}),r.dirty=!1),e.visible!==!1&&r.builder.update(r.mesh))}};v();v();function Ao(i){return i.children.some(r=>r.userData.isOutline)}function Wm(i){return i.children.find(r=>r.userData.isOutline)}function Ro(i,r){var t;let e=i.userData.entities3D.values().next().value;return e?((t=r.geometry3DMap.get(e))==null?void 0:t.components[3])!==void 0:!1}function jm(i,r,e,t,n){let s=i.getAttribute("position").array,a=1/0,l=-1/0;for(let m=0;m<r.count;m++){let d=(r.start+m)*3,f=s[d+2];a=Math.min(a,f),l=Math.max(l,f)}let u=l-a;if(!n||n.thickness===0||u===0)for(let m=0;m<r.count;m++){let d=(r.start+m)*3,f=s[d+2];Math.abs(f-l)<1e-4?s[d+2]=Math.max(e+t,2e-4+t):s[d+2]=t}else{let m=n.thickness,h=a+m,d=a+m,f=l-m,b=l-m,x=t-m,y=t,g=t,S=t+e,M=t+e,E=t+e+m;for(let w=0;w<r.count;w++){let I=(r.start+w)*3,T=s[I+2],C;if(T<=h){let F=m>0?(T-a)/m:0;C=x+F*(y-x)}else if(T>=b){let F=m>0?(T-b)/m:0;C=M+F*(E-M)}else{let F=f-d,L=F>0?(T-d)/F:0;C=g+L*(S-g)}s[I+2]=C}}i.attributes.position.needsUpdate=!0}v();v();var Zm="// Modified from https://github.com/mrdoob/three.js/blob/dev/src/renderers/shaders/ShaderLib/linedashed.glsl.js\nuniform float scale;\nattribute float lineDistance;\n\nvarying float vLineDistance;\nattribute float visibility;\nvarying vec4 v_color;\nvarying vec4 vWorldPosition;\n\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n\nvoid main() {\n\n vLineDistance = scale * lineDistance;\n v_color = color;\n\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphinstance_vertex>\n #include <morphcolor_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <project_vertex>\n vWorldPosition = modelMatrix * vec4(transformed, 1.0);\n if (visibility < 0.5) {\n gl_Position = vec4(-2.0, -2.0, -2.0, 1.0);\n }\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <fog_vertex>\n\n}";v();var Xm="// Modified from https://github.com/mrdoob/three.js/blob/dev/src/renderers/shaders/ShaderLib/linedashed.glsl.js\nuniform vec3 diffuse;\nuniform float opacity;\n\nuniform float dashSize;\nuniform float totalSize;\n\nuniform float effectStart;\nuniform float effectDistance;\nuniform float darkenAmount;\nuniform float darkenUseDepth;\nuniform float desaturateAmount;\nuniform float desaturateUseDepth;\nuniform float washOutAmount;\nuniform float washOutUseDepth;\n\nvarying float vLineDistance;\nvarying vec4 v_color;\nvarying vec4 vWorldPosition;\n\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\n\nvoid main() {\n\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n\n if ( mod( vLineDistance, totalSize ) > dashSize ) {\n\n discard;\n\n }\n\n vec3 outgoingLight = vec3( 0.0 );\n\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n\n outgoingLight = diffuseColor.rgb; // simple shader\n\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n\n // Depth-based visual effects (mirrors batched-lambert-fragment-with-shadows.glsl)\n if(effectDistance > 0.0) {\n float t = clamp((effectStart - vWorldPosition.z) / effectDistance, 0.0, 1.0);\n float fade = pow(t, 0.65) * 0.9;\n\n // Desaturate towards grayscale\n float luma = dot(gl_FragColor.rgb, vec3(0.299, 0.587, 0.114));\n float dsFade = desaturateUseDepth > 0.5 ? fade : 1.0;\n gl_FragColor.rgb = mix(gl_FragColor.rgb, vec3(luma), desaturateAmount * dsFade);\n\n // Darken towards #333333\n float dkFade = darkenUseDepth > 0.5 ? fade : 1.0;\n gl_FragColor.rgb = mix(gl_FragColor.rgb, vec3(0.2), darkenAmount * dkFade);\n\n // Wash out towards white\n float woFade = washOutUseDepth > 0.5 ? fade : 1.0;\n gl_FragColor.rgb = mix(gl_FragColor.rgb, vec3(1.0), washOutAmount * woFade);\n }\n\n // Discard alpha lower than 0.01 to avoid opacity fighting\n if (v_color.a <= 0.01) { \n discard;\n }\n}\n";var _o=class extends Fs{constructor(e){super(e);p(this,"effectUniforms",{effectStart:{value:0},effectDistance:{value:0},darkenAmount:{value:0},darkenUseDepth:{value:1},desaturateAmount:{value:0},desaturateUseDepth:{value:1},washOutAmount:{value:0},washOutUseDepth:{value:0}});this.onBeforeCompile=t=>{t.vertexShader=Zm,t.fragmentShader=Xm;let n=this.effectUniforms.effectStart,o=this.effectUniforms.effectDistance,s=this.effectUniforms.darkenAmount,a=this.effectUniforms.darkenUseDepth,l=this.effectUniforms.desaturateAmount,u=this.effectUniforms.desaturateUseDepth,m=this.effectUniforms.washOutAmount,h=this.effectUniforms.washOutUseDepth;this.effectUniforms=t.uniforms,Object.assign(this.effectUniforms,{effectStart:n,effectDistance:o,darkenAmount:s,darkenUseDepth:a,desaturateAmount:l,desaturateUseDepth:u,washOutAmount:m,washOutUseDepth:h})}}setEffectRange(e,t){this.effectUniforms.effectStart.value=e,this.effectUniforms.effectDistance.value=t}getEffectRange(){return{start:this.effectUniforms.effectStart.value,distance:this.effectUniforms.effectDistance.value}}setVisualEffect(e,t,n,o,s,a){this.effectUniforms.darkenAmount.value=e,this.effectUniforms.darkenUseDepth.value=t?1:0,this.effectUniforms.desaturateAmount.value=n,this.effectUniforms.desaturateUseDepth.value=o?1:0,this.effectUniforms.washOutAmount.value=s,this.effectUniforms.washOutUseDepth.value=a?1:0}getVisualEffect(){return{darkenAmount:this.effectUniforms.darkenAmount.value,darkenUseDepth:this.effectUniforms.darkenUseDepth.value,desaturateAmount:this.effectUniforms.desaturateAmount.value,desaturateUseDepth:this.effectUniforms.desaturateUseDepth.value,washOutAmount:this.effectUniforms.washOutAmount.value,washOutUseDepth:this.effectUniforms.washOutUseDepth.value}}};v();var or,Vn,mn,pn,Fo,au,Wn=class{constructor(){A(this,Fo);A(this,or,[]);A(this,Vn,!1);A(this,mn);A(this,pn)}get size(){return c(this,or).length}add(r){c(this,or).push(r),c(this,Vn)||te(this,Fo,au).call(this)}onComplete(r){_(this,mn,r)}clearOnComplete(){_(this,mn,void 0)}clearAll(){_(this,or,[]),_(this,Vn,!1),_(this,mn,void 0),c(this,pn)!==void 0&&(cancelIdleCallback(c(this,pn)),_(this,pn,void 0))}};or=new WeakMap,Vn=new WeakMap,mn=new WeakMap,pn=new WeakMap,Fo=new WeakSet,au=function(){_(this,Vn,!0),_(this,pn,requestIdleCallback(r=>{let e=0;for(;c(this,or).length>0&&r.timeRemaining()>2;){let t=c(this,or).shift();t&&(t(),e++)}if(e===0&&c(this,or).length>0&&r.timeRemaining()<2){let t=c(this,or).shift();t&&t()}_(this,pn,void 0),c(this,or).length>0?te(this,Fo,au).call(this):(_(this,Vn,!1),c(this,mn)&&c(this,mn).call(this))},{timeout:3e3}))};var Dy=80,jn,Ii,Fa,Ga,_a=class extends ye{constructor(e,t){var n;super();p(this,"rendererState");p(this,"maxOpacity");p(this,"outlineOpacitiesDirty",!0);p(this,"useIdleFramesOnly",!0);A(this,jn,!0);A(this,Ii,-1/0);p(this,"idleBuildQueue",new Wn);p(this,"idleComputeBoundingSphereQueue",new Wn);A(this,Fa,new Map);A(this,Ga,()=>{this.publish("needs-render")});this.rendererState=e,this.maxOpacity=(n=t==null?void 0:t.maxOpacity)!=null?n:1,this.idleBuildQueue.onComplete(c(this,Ga))}get geometries3DDirty(){return c(this,jn)}set geometries3DDirty(e){_(this,jn,e)}buildOutlines(e){var d;let t=[];for(let f of e.userData.entities3D.values()){let b=this.rendererState.geometry3DMap.get(f);if(b instanceof Te&&b.type==="geometry"&&b.components[3]&&b.components[3].dirty===!0&&b.components[0].material!=null){let x=b.components[0].geometry,y=!1;x||(x=uo(b.components[0]),y=!0);let g=b.components[1];t.push([b.components[3],new jh(x,(d=g.bevel)!=null&&d.enabled?1:Dy)]),y&&(x==null||x.dispose(),x=void 0)}}if(t.length===0)return;let n=Xt(t.map(f=>f[1]),!1);if(n==null)return;let o=n.getAttribute("position"),s=new Float32Array(o.count*4),a=new It(s,4);n.setAttribute("color",a);let l=new Uint8Array(o.count);l.fill(0);let u=new It(l,1,!1);n.setAttribute("visibility",u);let m=0;for(let f=0;f<t.length;f++){let[b,x]=t[f],y=x.getAttribute("position").count;b.edgeColors=a,b.edgeVisibility=u,b.geometry=n,b.ranges={count:y,start:m},m+=y,x.dispose()}let h=new mi(n,new _o({vertexColors:!0,linewidth:1,transparent:!0,opacity:1,side:Os}));h.userData.isOutline=!0,e.add(h)}update(e,t=!0){var o;if(this.geometries3DDirty){for(let s of this.rendererState.geometry3DsInScene)s.type==="geometry-group"&&Ro(s,this.rendererState)&&!Ao(s)&&s.userData.entities3D.size>0&&(this.useIdleFramesOnly?this.idleBuildQueue.add(()=>this.buildOutlines(s)):this.buildOutlines(s));_(this,jn,!1),this.outlineOpacitiesDirty=!0}for(let s of this.rendererState.geometry3DsInScene)if(s.type==="geometry"&&s.components[3]&&s.components[3].dirty===!0&&s.components[0].material!=null&&s.parentObject3D instanceof mt){let a=s.components[3].geometry;if(!a)continue;let l=s.components[3];if(!l)continue;let u=l.enabled&&s.components[1].visible;if(l.visible!==u&&(l.visible=u),!l.visible)continue;let m=l.edgeColors;if(!m||!l.ranges)continue;let h=new me(l.color);for(let x=0;x<l.ranges.count;x++){let y=l.ranges.start+x;m.setXYZ(y,h.r,h.g,h.b)}let d=s.components[1].height,f=s.components[1].altitude,b=(o=s.components[1])==null?void 0:o.bevel;jm(a,l.ranges,d,f,b),a.attributes.color.needsUpdate=!0,this.idleComputeBoundingSphereQueue.add(()=>a.computeBoundingSphere()),l.dirty=!1}else if(s.type==="geometry-group"&&Ao(s)){let a=Wm(s);if(!a)continue;let l=a.material;if(!(l instanceof _o))continue;let u;for(let d of s.userData.entities3D.values()){u=d;break}if(u==null)continue;let m=this.rendererState.geometry3DMap.get(u);if(!m||m.type!=="geometry")continue;let h=m.components[1];l.setEffectRange(h.effectStart,h.effectDistance),l.setVisualEffect(h.darkenAmount,h.darkenUseDepth,h.desaturateAmount,h.desaturateUseDepth,h.washOutAmount,h.washOutUseDepth)}let n=t?pc(e,16,19,0,this.maxOpacity):c(this,Ii);if((n!==c(this,Ii)||this.outlineOpacitiesDirty)&&this.rendererState.geometry3DsInScene.size>0){for(let s of this.rendererState.geometry3DsInScene)if(s.type==="geometry"&&s.components[0]instanceof Qe){let a=s.components[3];if(a&&a.edgeColors&&a.geometry&&a.visible){let l=Math.min(n,s.components[1].opacity*vi(s));if(a.currentOpacity!==l){for(let u=0;u<a.ranges.count;u++){let m=a.ranges.start+u;a.edgeColors.setW(m,l)}a.geometry.attributes.color.needsUpdate=!0}}}}_(this,Ii,n),_(this,jn,!1),this.outlineOpacitiesDirty=!1}destroy(){c(this,Fa).clear(),this.idleBuildQueue.clearAll(),this.idleComputeBoundingSphereQueue.clearAll()}};jn=new WeakMap,Ii=new WeakMap,Fa=new WeakMap,Ga=new WeakMap;v();v();var Py=(()=>{let i;return{getDeviceType(){if(i)return i;let{userAgent:r,platform:e,maxTouchPoints:t}=window.navigator,n=/(iphone|ipod|ipad)/i.test(r),o=e==="iPad"||e.indexOf("Mac")===0&&t>0&&!window.MSStream,s=/android/i.test(r);return i={isIpad:o,isMobile:s||n||o,isIOS:n,isAndroid:s,isSafari12:/Version\/12.+Safari/.test(r),isFirefox:/Firefox/.test(r),isWindows:/windows/i.test(r)},i},_reset(){i=void 0}}})(),Ym=Py.getDeviceType,$m=(()=>{let i,r,e;function t(){if(r!==void 0)return r;i||(i=document.createElement("canvas"));let o=i.getContext("webgl")||i.getContext("experimental-webgl");if(!o)return r;try{let s=Ym().isFirefox?null:o.getExtension("WEBGL_debug_renderer_info");return r=s?o.getParameter(s.UNMASKED_RENDERER_WEBGL):o.getParameter(o.RENDERER),r}catch(s){let a=new Error("Failed getting device info");throw a.name="FailedGettingDeviceInfo",a}}function n(){var s,a;if(!Ym().isWindows)return!1;if(e!==void 0)return e;let o=(a=(s=Iy())==null?void 0:s.toLowerCase())!=null?a:"";return e=o.includes("intel")&&(o.includes("uhd")||o.includes("iris")),e}return{getInfo:t,shouldDisableOffscreenCanvas:n,_setCanvas(o){i=o,r=void 0,e=void 0}}})(),Iy=$m.getInfo,qm=$m.shouldDisableOffscreenCanvas;v();import{z as Rt}from"zod";var Na=class extends pe{constructor(){super(...arguments);p(this,"userData",{entityId:""})}},Oy=Rt.object({flipImageToFaceCamera:Rt.boolean().optional(),url:Rt.string(),maxImageSize:Rt.number().positive().optional()}),Ly=Rt.object({type:Rt.enum(["Feature"]),properties:Rt.object({width:Rt.number(),height:Rt.number(),rotation:Rt.number().min(0).max(360).optional(),verticalOffset:Rt.number().optional()}),geometry:Si});function Jm(i,r,e){Rt.union([Rt.number(),Rt.string()]).parse(i),Ly.parse(r),Oy.parse(e)}var Ba=class{constructor(r){p(this,"mesh",new Nt);p(this,"imageMesh");p(this,"outline");p(this,"type","image");p(this,"instanceIndex",-1);p(this,"geometry");p(this,"material");p(this,"feature");p(this,"position",new k);this.feature=r}get visible(){var r,e;return(e=(r=this.mesh)==null?void 0:r.visible)!=null?e:!1}set visible(r){this.mesh&&(this.mesh.visible=r)}};v();function lu(i,r){return{x:i.x*Math.cos(r)-i.y*Math.sin(r),y:i.x*Math.sin(r)+i.y*Math.cos(r)}}function Ay(i,r){return i.map(e=>lu(e,r))}function Ry(i){let r=1/0,e=1/0,t=-1/0,n=-1/0;for(let o of i)r=Math.min(r,o.x),e=Math.min(e,o.y),t=Math.max(t,o.x),n=Math.max(n,o.y);return{minX:r,minY:e,maxX:t,maxY:n}}function _y(i,r){let e=!1;for(let t=0,n=r.length-1;t<r.length;n=t++){let o=r[t].x,s=r[t].y,a=r[n].x,l=r[n].y;s>i.y!=l>i.y&&i.x<(a-o)*(i.y-s)/(l-s)+o&&(e=!e)}return e}function Qm(i,r,e,t,n){for(let o=0;o<n;o++)for(let s=0;s<t;s++)if(i[e+o][r+s]!==1)return!1;return!0}function Fy(i,r,e){let t=i.maxX-i.minX,n=i.maxY-i.minY,o,s,a=V({},i);return t/n>r?(s=n/e,o=s*r,a.minX+=(t-o*e)/2):(o=t/e,s=o/r,a.minY+=(n-s*e)/2),{dx:o,dy:s,gridBounds:a}}function Gy(i,r,e,t,n){let o=Array(e).fill(0).map(()=>Array(e).fill(0));for(let s=0;s<e;s++)for(let a=0;a<e;a++){let l={x:r.minX+a*t,y:r.minY+s*n};_y(l,i)&&(o[s][a]=1)}return o}function Ny(i,r){let e=Array(r).fill(0).map(()=>Array(r).fill(0));for(let t=0;t<r;t++)for(let n=0;n<r;n++)if(i[t][n]===1){let o=0;for(let s=1;s<=Math.min(r-n,r-t)&&Qm(i,n,t,s,s);s++)o=s;e[t][n]=o}return e}function By(i,r,e,t,n,o){let s=0,a=0,l=0;for(let u=0;u<t;u++)for(let m=0;m<t;m++)if(i[u][m]===1){let h=Math.pow(r[u][m],2),d=e.minX+m*n,f=e.minY+u*o;s+=h,a+=d*h,l+=f*h}return{x:a/s,y:l/s}}function ky(i,r,e,t,n,o,s){let a=-1/0,l=null,u=i.length,m=Math.sqrt(Math.pow(r.maxX-r.minX,2)+Math.pow(r.maxY-r.minY,2));for(let h=0;h<u;h++)for(let d=0;d<u;d++)if(i[h][d]===1)for(let f=1;f<=u-d;f++){let b=f;if(!(b>u-h)&&Qm(i,d,h,f,b)){let x=f*b,y=r.minX+(d+f/2)*e,g=r.minY+(h+b/2)*t,S={x:y,y:g},E=Math.sqrt(Math.pow(S.x-n.x,2)+Math.pow(S.y-n.y,2))/m,w=x*(1-o)-E*o*x;w>a&&(a=w,l={center:S,width:f*e*s,height:f*t*s})}}return l}function cu(i,r,e,t={}){let{scaleFactor:n=.9,centerPriority:o=.5,resolution:s=100,minimumSizeRatio:a=.5}=t,l=Br(e),u=i.width/i.height,m=Ay(r,l),h=Ry(m),{dx:d,dy:f,gridBounds:b}=Fy(h,u,s),x=Gy(m,b,s,d,f),y=Ny(x,s),g=By(x,y,b,s,d,f),S=ky(x,b,d,f,g,o,n);return!S||S.width<i.width*a||S.height<i.height*a?i:Ce(V({},S),{center:lu(S.center,-l),rotation:e,polygonCenter:lu(g,-l)})}v();var Et={HIGH:1,MEDIUM:.5,LOW:.25,VERY_LOW:.125},sr={[Et.HIGH]:2048,[Et.MEDIUM]:1024,[Et.LOW]:512,[Et.VERY_LOW]:256},Km={[sr[Et.HIGH]]:65280,[sr[Et.MEDIUM]]:16776960,[sr[Et.LOW]]:16753920,[sr[Et.VERY_LOW]]:16711680},ka={HIGH:50,MEDIUM:100,LOW:250},ep="https://resize-worker.mappedin.com",tp=["cdn.mappedin.com","cdn.eu.mappedin.com"],uu=["resize-worker.mappedin.com","resize-worker-staging.mappedin.net"],hu=.01,za=1024;v();function Go(i){try{let e=new URL(i).hostname;return tp.includes(e)||uu.includes(e)}catch(r){return!1}}function zy(i){try{let r=new URL(i);return uu.includes(r.hostname)}catch(r){return!1}}function rp(i,r){return zy(i)?i.replace(/\/resize:fit:\d+:\d+:(\d+)\//,"/resize:fit:".concat(r,":").concat(r,":$1/")):"".concat(ep,"/resize:fit:").concat(r,":").concat(r,":0/plain/").concat(i)}function No(i){return i<=ka.HIGH?sr[Et.HIGH]:i<=ka.MEDIUM?sr[Et.MEDIUM]:i<=ka.LOW?sr[Et.LOW]:sr[Et.VERY_LOW]}function Bo(i,r){return Go(i)?i:"".concat(i,"|").concat(r!=null?r:za)}function Ua(i,r){i.color=new me(16777215),i.emissive=new me(Km[r]),i.emissiveIntensity=.5,i.needsUpdate=!0}function Ha(i){i.color=new me(16777215),i.emissive=new me(0),i.emissiveIntensity=0,i.needsUpdate=!0}var ko=Math.PI*2,Uy=Math.PI/2,Hy=Math.PI*1.5,Vy=xa(Uy,2),Wy=xa(Hy,2),Va=class extends ye{constructor(e,t,n,o=0,s=0,a={},l){super();p(this,"rendererState");p(this,"convertTo3DMapPosition");p(this,"projectToScreen");p(this,"initialBearing",0);p(this,"naturalBearing",0);p(this,"imagePlacementOptions");p(this,"cameraFrustum",new di);p(this,"transformImageRequest");p(this,"cameraWorldPosition",new k);p(this,"debug",{lod:!1,imageContainers:!1});p(this,"cache",new Map);p(this,"currentImageScreenBBoxes",[]);p(this,"viewProjectionMatrix",new we);p(this,"lastLODUpdateTime",-1);this.rendererState=e,this.convertTo3DMapPosition=t,this.projectToScreen=n,this.initialBearing=o,this.naturalBearing=s,this.imagePlacementOptions=a,this.transformImageRequest=l}get debugLOD(){return this.debug.lod}set debugLOD(e){let t=this.debug.lod!==e;this.debug.lod=e,t&&(e?this.applyDebugLODColors():this.resetDebugLODColors())}createImageMesh(e,t,n,o=0,s,a,l=za){var w,R,I,T;let u={width:n.width,height:n.height,center:this.convertTo3DMapPosition(s),rotation:(w=n.rotation)!=null?w:0},m=(R=this.imagePlacementOptions.mode)!=null?R:"default",h=(()=>{switch(m){case"fit-nearest-90":let C=(this.initialBearing-this.naturalBearing+360)%180;return C>=45&&C<=135?cu(u,a,u.rotation+90,this.imagePlacementOptions):u;case"fit-initial-bearing":return cu(u,a,this.initialBearing,this.imagePlacementOptions);case"default":case"none":default:return u}})();if(this.debug.imageContainers&&h.polygonCenter){let C=new pe(new Gs(1),new rn({color:65280}));C.position.set(h.polygonCenter.x,h.polygonCenter.y,o),this.rendererState.geometryScene.add(C)}let d=new rn({transparent:!0,depthWrite:!1,side:br}),f=new vt(h.width,h.height),b=new Na(f);b.visible=!1,b.renderOrder=Je.IMAGE_MESH;let x=Go(t),y=o+hu,g=this.rendererState.cameraObject.position.z,S=Math.abs(g-y),M=x?No(S):l,E=Bo(t,l);if(this.cache.has(E)||this.cache.set(E,{lod:M,texture:null,pendingFetch:null,pendingFetchLOD:null,isResizable:x}),(T=(I=this.getOrDownloadImage(E,t,M))==null?void 0:I.then(C=>{d.map=C,d.needsUpdate=!0,d.map.colorSpace=Pn,b.visible=!0,this.publish("image-loaded")}))==null||T.catch(C=>{$.error("Failed to load image in createImageMesh",{cacheKey:E,url:t,error:C})}),b.userData.entityId=e,b.material=d,this.debug.imageContainers){let C=new pe(new vt(n.width,n.height),new rn({color:"gray"}));b.add(C);let F=new Jh;b.add(F),F.scale.set(10,10,10)}return b.position.set(h.center.x,h.center.y,o+hu),b.rotation.z=(-de.degToRad(h.rotation)+ko)%ko,b}getOrDownloadImage(e,t,n=sr[Et.VERY_LOW]){let o=this.cache.get(e);if(!o){$.error("Cache entry must exist before calling getOrDownloadImage",{cacheKey:e,url:t});return}if(o.texture&&o.lod===n)return Promise.resolve(o.texture);if(o.pendingFetch&&o.pendingFetchLOD===n)return o.pendingFetch;if(o.pendingFetch&&o.pendingFetchLOD!==n)return;if(!o.isResizable&&o.texture)return Promise.resolve(o.texture);let s=o.texture;o.texture=null;let a=o.isResizable?rp(t,n):t,l=m=>new Promise((h,d)=>{dn.getLoader().load(m,f=>{try{o.isResizable?(f.colorSpace=Pn,o.texture=f):o.texture=this.createCappedTexture(f,n),o.lod=n,o.pendingFetch=null,o.pendingFetchLOD=null,s==null||s.dispose(),h(o.texture)}catch(b){$.error("Failed to process image texture",{url:t,error:b}),o.pendingFetch=null,o.pendingFetchLOD=null,s==null||s.dispose(),d(b)}},void 0,f=>{$.error("Failed to load image",{url:t,error:f}),o.pendingFetch=null,o.pendingFetchLOD=null,s==null||s.dispose(),d(f)})}),u=this.transformImageRequest?this.transformImageRequest(a).then(m=>l(m.url)):l(a);return o.pendingFetch=u,o.pendingFetchLOD=n,u}createCappedTexture(e,t){let n=e.image,o=n instanceof HTMLImageElement?n.naturalWidth:n.width,s=n instanceof HTMLImageElement?n.naturalHeight:n.height,a=Math.max(o,s);if(a<=t)return e.colorSpace=Pn,e;e.dispose();let l=t/a,u=Math.max(1,Math.floor(o*l)),m=Math.max(1,Math.floor(s*l)),h;typeof window<"u"&&window.OffscreenCanvas!=null&&!qm()?h=new OffscreenCanvas(u,m):(h=document.createElement("canvas"),h.width=u,h.height=m);let d=h.getContext("2d");if(!d)throw new Error("Failed to get 2D context for texture capping");d.drawImage(n,0,0,u,m);let f=new Uh(h);return f.colorSpace=Pn,f.needsUpdate=!0,f}updateLODIfNeeded(e,t,n,o){var d,f;let s=Bo(e,o),a=this.cache.get(s);if(!(a!=null&&a.isResizable))return;let l=Math.abs(this.cameraWorldPosition.z-n.z),u=No(l);this.debug.lod&&Ua(t.material,u);let m=t.material,h=m.map!==a.texture;a.lod===u&&!h&&!a.pendingFetch||(f=(d=this.getOrDownloadImage(s,e,u))==null?void 0:d.then(b=>{m.map!==b&&(m.map=b,m.needsUpdate=!0,this.publish("image-loaded"))}))==null||f.catch(b=>{$.error("Failed to load image in updateLODIfNeeded",{cacheKey:s,url:e,error:b})})}applyDebugLODColors(){var e,t,n,o;this.rendererState.cameraObject.getWorldPosition(this.cameraWorldPosition);for(let s of this.rendererState.geometry3DsInScene)if(s.type==="image"){let a=s.components[0],l=s.components[1];if(((e=a==null?void 0:a.imageMesh)==null?void 0:e.material)instanceof rn){let u=l==null?void 0:l.url;if(u&&Go(u)){let m=Math.abs(this.cameraWorldPosition.z-a.imageMesh.position.z),h=No(m);Ua(a.imageMesh.material,h)}else Ha(a.imageMesh.material)}}else if(s.type==="geometry"){let a=s.components[0];if(((t=a==null?void 0:a.imageMesh)==null?void 0:t.material)instanceof rn){let l=(o=(n=a.feature.properties)==null?void 0:n.image)==null?void 0:o.path;if(l&&Go(l)){let u=Math.abs(this.cameraWorldPosition.z-a.imageMesh.position.z),m=No(u);Ua(a.imageMesh.material,m)}else Ha(a.imageMesh.material)}}}resetDebugLODColors(){var e;for(let t of this.rendererState.geometry3DsInScene){let n;t.type==="image"?n=t.components[0]:t.type==="geometry"&&(n=t.components[0]),((e=n==null?void 0:n.imageMesh)==null?void 0:e.material)instanceof rn&&Ha(n.imageMesh.material)}}flipIfNeeded(e,t){if(e.imageMesh==null)return;let n=-t,o=e.imageMesh.rotation.z,s=xa((o-n+ko)%ko,2);if(s>Vy&&s<Wy){let a=e.imageMesh.matrixWorldAutoUpdate===!1;a&&Ws(e.imageMesh),e.imageMesh.rotation.z=(o+Math.PI)%ko,e.imageMesh.updateMatrixWorld(),a&&ud(e.imageMesh)}}update(e,t,n){var l,u,m,h,d,f,b;this.currentImageScreenBBoxes=[],this.viewProjectionMatrix.identity().multiply(this.rendererState.cameraObject.projectionMatrix).multiply(this.rendererState.cameraObject.matrixWorldInverse),this.cameraFrustum.setFromProjectionMatrix(this.viewProjectionMatrix),this.rendererState.cameraObject.getWorldPosition(this.cameraWorldPosition);let o=!t&&n!==this.lastLODUpdateTime;o&&(this.lastLODUpdateTime=n);let s,a;for(let x of this.rendererState.geometry3DsInScene)if(x.type==="image"){if(s=x.components[0],a=x.components[1],a.url&&s.imageMesh==null){let y=this.convertTo3DMapPosition(s.feature.geometry.coordinates),g={x:y.x,y:y.y};s.imageMesh=this.createImageMesh(x.id,a.url,s.feature.properties,s.feature.properties.verticalOffset,s.feature.geometry.coordinates,[g],a.maxImageSize),s.mesh.add(s.imageMesh),s.position.copy(s.imageMesh.position)}if(s.imageMesh){if(o&&a.url&&this.updateLODIfNeeded(a.url,s.imageMesh,s.position,a.maxImageSize),a.url&&!s.imageMesh.visible){let y=Bo(a.url,a.maxImageSize),g=this.cache.get(y);if(g!=null&&g.texture){let S=s.imageMesh.material;S.map!==g.texture&&(S.map=g.texture,S.needsUpdate=!0),s.imageMesh.visible=!0}}a.flipImageToFaceCamera&&this.flipIfNeeded(s,e),s.imageMesh.material instanceof rn&&a.dirty&&s.imageMesh.material.opacity!==a.opacity&&(s.imageMesh.material.opacity=a.opacity)}}else if((x==null?void 0:x.type)==="geometry"){if(s=x.components[0],a=x.components[1],a.showImage&&((l=s.feature.properties)!=null&&l.image)&&s.imageMesh==null&&s.visible&&s.mesh!=null&&s.mesh.parent!=null&&((u=s.feature.properties)==null?void 0:u.image.position)!=null&&s.feature.geometry.coordinates!=null&&s.feature.geometry.coordinates.length>0){let y=s.feature.geometry.coordinates[0].map(S=>{let M=this.convertTo3DMapPosition(S);return{x:M.x,y:M.y}}),g=this.createImageMesh(x.id,(m=s.feature.properties)==null?void 0:m.image.path,(h=s.feature.properties)==null?void 0:h.image,a.height+a.altitude,(d=s.feature.properties)==null?void 0:d.image.position,y,a.maxImageSize);s.mesh.parent.add(g),s.imageMesh=g}if(s.imageMesh){let y=(b=(f=s.feature.properties)==null?void 0:f.image)==null?void 0:b.path;if(o&&y&&this.updateLODIfNeeded(y,s.imageMesh,s.imageMesh.position,a.maxImageSize),!s.visible)s.imageMesh.visible=!1;else if(a.showImage&&!s.imageMesh.visible)if(y){let g=Bo(y,a.maxImageSize),S=this.cache.get(g);if(S!=null&&S.texture){let M=s.imageMesh.material;M.map!==S.texture&&(M.map=S.texture,M.needsUpdate=!0),s.imageMesh.visible=!0}}else s.imageMesh.visible=!0;else!a.showImage&&s.imageMesh.visible&&(s.imageMesh.visible=!1);a.flipImageToFaceCamera&&this.flipIfNeeded(s,e),a.enableImageCollisions===!0&&this.updateImageScreenBBoxes(s)}}}destroy(){var e;for(let t of this.cache.values())(e=t.texture)==null||e.dispose();this.cache.clear(),super.destroy()}updateImageScreenBBoxes(e){if(e.imageMesh==null)return;let t=e.imageMesh.geometry.boundingBox;if(t==null&&(e.imageMesh.geometry.computeBoundingBox(),t=e.imageMesh.geometry.boundingBox),t){let n=new k;if(e.imageMesh.getWorldPosition(n),!this.cameraFrustum.containsPoint(n))return;let o=new he;this.projectToScreen(o,n);let s=[new k(t.min.x,t.min.y,t.min.z),new k(t.max.x,t.min.y,t.min.z),new k(t.min.x,t.max.y,t.min.z),new k(t.max.x,t.max.y,t.min.z),new k(t.min.x,t.min.y,t.max.z),new k(t.max.x,t.min.y,t.max.z),new k(t.min.x,t.max.y,t.max.z),new k(t.max.x,t.max.y,t.max.z)],a=[];for(let f of s){let b=f.clone().applyMatrix4(e.imageMesh.matrixWorld),x=new he;this.projectToScreen(x,b),a.push(x)}let l=1/0,u=1/0,m=-1/0,h=-1/0;for(let f of a)l=Math.min(l,f.x),u=Math.min(u,f.y),m=Math.max(m,f.x),h=Math.max(h,f.y);let d=new pt(o.x,o.y,m-l,h-u);this.currentImageScreenBBoxes.push(d)}else $.warn("Bounding box for imageMesh does not exist.")}};v();v();function du(i){let r=1/0,e=1/0,t=-1/0,n=-1/0;for(let o of i)o.x<r&&(r=o.x),o.x>t&&(t=o.x),o.y<e&&(e=o.y),o.y>n&&(n=o.y);return{minX:r,minY:e,maxX:t,maxY:n}}function jy(i,r){return!(i.maxX<r.minX||i.minX>r.maxX||i.maxY<r.minY||i.minY>r.maxY)}function Zy(i,r){if(!jy(i,r))return 0;let e=Math.max(i.minX,r.minX),t=Math.min(i.maxX,r.maxX),n=Math.max(i.minY,r.minY),o=Math.min(i.maxY,r.maxY),s=t-e,a=o-n;return s*a}function np(i,r){let e=Zy(i,r);if(e===0)return 0;let t=r.maxX-r.minX,n=r.maxY-r.minY,o=t*n;return o===0?0:e/o}v();function Xy(i){let r=0;for(let e=1;e<i.length;e++)(i[e].y<i[r].y||i[e].y===i[r].y&&i[e].x<i[r].x)&&(r=e);return r}function Yy(i,r){let e=[...i];return e.sort((t,n)=>{let o=t.point.x-r.x,s=t.point.y-r.y,a=n.point.x-r.x,l=n.point.y-r.y,u=o*l-s*a;if(u===0){let m=o*o+s*s,h=a*a+l*l;return m-h}return u>0?-1:1}),e}function $y(i,r){let e=[r];for(let t=0;t<i.length;t++){for(;e.length>1;){let n=e[e.length-2].point,o=e[e.length-1].point,s=i[t].point,a=o.x-n.x,l=o.y-n.y,u=s.x-o.x,m=s.y-o.y;if(a*m-l*u<=0)e.pop();else break}e.push(i[t])}return e}function ip(i){if(i.length<3)return i.map((o,s)=>({point:o,index:s}));let r=Xy(i),e=i.map((o,s)=>({point:o,index:s})),t=e[r];e.splice(r,1);let n=Yy(e,t.point);return $y(n,t)}function zo(i,r,e,t){if(i.length===0)return[];let n=[],o=i[i.length-1],s=r*o.x+e*o.y+t;for(let a=0;a<i.length;a++){let l=i[a],u=r*l.x+e*l.y+t;if(u>=0){if(s<0){let m=s/(s-u);n.push({x:o.x+m*(l.x-o.x),y:o.y+m*(l.y-o.y)})}n.push(l)}else if(s>=0){let m=s/(s-u);n.push({x:o.x+m*(l.x-o.x),y:o.y+m*(l.y-o.y)})}o=l,s=u}return n}v();function qy(i,r){let e=document.createElement("div");return e.id="focus-bbox-".concat(i),e.style.position="absolute",e.style.pointerEvents="none",e.style.overflow="hidden",e.style.zIndex="1000",r.appendChild(e),e}function Jy(i,r){let e=r.maxX-r.minX,t=r.maxY-r.minY;i.style.left=r.minX+"px",i.style.top=r.minY+"px",i.style.width=e+"px",i.style.height=t+"px"}function Qy(i,r){r?(i.style.border="2px solid green",i.style.backgroundColor="rgba(0, 255, 0, 0.1)"):(i.style.border="2px solid red",i.style.backgroundColor="rgba(255, 0, 0, 0.1)")}function Ky(i){let r=i.querySelector(".entity-id-label");return r||(r=document.createElement("div"),r.className="entity-id-label",r.style.position="absolute",r.style.top="0",r.style.left="0",r.style.padding="2px 4px",r.style.color="white",r.style.fontSize="10px",r.style.fontWeight="bold",r.style.fontFamily="monospace",r.style.zIndex="1001",i.appendChild(r)),r}function eb(i){let r=i.querySelector(".score-label");return r||(r=document.createElement("div"),r.className="score-label",r.style.position="absolute",r.style.bottom="0",r.style.right="0",r.style.padding="2px 4px",r.style.color="white",r.style.fontSize="12px",r.style.fontWeight="bold",r.style.fontFamily="monospace",r.style.zIndex="1001",i.appendChild(r)),r}function tb(i,r,e,t,n){t?i.style.backgroundColor="green":i.style.backgroundColor="red",i.textContent=e,n!==void 0?(r.style.backgroundColor=t?"green":"red",r.textContent=n.toFixed(3)):(r.style.backgroundColor=t?"green":"red",r.textContent="")}function op(i,r){for(let[e,t]of i)r.has(e)||(t.remove(),i.delete(e))}function sp(i,r,e,t,n,o){var u;let s=e.get(i);s||(s=qy(i,t),e.set(i,s)),Jy(s,(u=r.clippedScreenBBox)!=null?u:r.screenBBox),Qy(s,n);let a=Ky(s),l=eb(s);return tb(a,l,i,n,o),s}function ap(){let i=document.createElement("div");return Object.assign(i.style,{position:"absolute",top:"0",left:"0",width:"100%",height:"100%",pointerEvents:"none",overflow:"hidden"}),document.body.append(i),i}function lp(i,r){let e=document.createElement("div");e.style.position="absolute",e.style.top=i.minY+"px",e.style.left=i.minX+"px",e.style.width=i.maxX-i.minX+"px",e.style.height=i.maxY-i.minY+"px",e.style.border="2px solid gray",e.style.backgroundColor="rgba(128, 128, 128, 0.1)",e.style.pointerEvents="none",r.append(e);let t=document.createElement("div");t.textContent="viewfinder",t.style.position="absolute",t.style.top="0",t.style.left="0",t.style.padding="2px 4px",t.style.backgroundColor="gray",t.style.color="white",t.style.fontSize="12px",t.style.fontWeight="bold",t.style.fontFamily="monospace",t.style.zIndex="1001",e.appendChild(t);let n=document.createElement("div");return n.textContent="",n.style.position="absolute",n.style.bottom="0",n.style.right="0",n.style.padding="2px 4px",n.style.backgroundColor="gray",n.style.color="white",n.style.fontSize="12px",n.style.fontWeight="bold",n.style.fontFamily="monospace",n.style.zIndex="1001",e.appendChild(n),{squareEl:e,labelEl:t,scoreLabelEl:n}}function cp(i,r){i.textContent=r}function up(i,r){r!==void 0?i.textContent="Score: ".concat(r.toFixed(3)):i.textContent=""}v();function hp(i,r,e){if(!i.visible)return;let t=i;if(t.isMesh||t.isLine||t.isPoints){let n=t.geometry;if(n!=null&&n.isBufferGeometry){let o=n.attributes.position;if(o)for(let s=0;s<o.count;s++)e.fromBufferAttribute(o,s),e.applyMatrix4(i.matrixWorld),r.push(e.clone())}}for(let n of i.children)hp(n,r,e)}function dp(i,r){let e=[];return i instanceof jt&&hp(i,e,r),e}var Oi=.001;function mp(i){if(i.length===0)return[];let r=[],e=i[i.length-1],t=e.w>Oi;for(let n=0;n<i.length;n++){let o=i[n],s=o.w>Oi;if(s){if(!t){let a=(Oi-e.w)/(o.w-e.w);r.push({x:e.x+a*(o.x-e.x),y:e.y+a*(o.y-e.y),z:e.z+a*(o.z-e.z),w:Oi})}r.push(o)}else if(t){let a=(Oi-e.w)/(o.w-e.w);r.push({x:e.x+a*(o.x-e.x),y:e.y+a*(o.y-e.y),z:e.z+a*(o.z-e.z),w:Oi})}e=o,t=s}return r}function pp(i,r,e){if(i.length===0)return[];let t=i;return t=zo(t,1,0,0),t=zo(t,-1,0,r),t=zo(t,0,1,0),t=zo(t,0,-1,e),t}v();var Wa=class{constructor(){p(this,"bbox");p(this,"center");p(this,"el",null);p(this,"labelEl",null);p(this,"scoreLabelEl",null)}create(r,e,t,n,o){this.labelEl&&(this.labelEl.remove(),this.labelEl=null),this.scoreLabelEl&&(this.scoreLabelEl.remove(),this.scoreLabelEl=null),this.el&&(this.el.remove(),this.el=null);let s=Mi(t,r,e),a=s.left,l=s.top,u=r-s.left-s.right,m=e-s.top-s.bottom,h=new he(a+u/2,l+m/2),f=u/2*(2-2/1.2)/2,b=Math.max(a,h.x-f),x=Math.min(r-s.right,h.x+f),y=Math.max(l,h.y-f),g=Math.min(e-s.bottom,h.y+f),S=(b+x)/2,M=(y+g)/2;if(this.bbox={minX:b,maxX:x,minY:y,maxY:g},this.center=new he(S,M),n&&o){let{squareEl:E,labelEl:w,scoreLabelEl:R}=lp(this.bbox,o);this.el=E,this.labelEl=w,this.scoreLabelEl=R}}updateLabel(r){this.labelEl&&cp(this.labelEl,r)}updateScore(r){this.scoreLabelEl&&up(this.scoreLabelEl,r)}destroy(){this.labelEl&&(this.labelEl.remove(),this.labelEl=null),this.scoreLabelEl&&(this.scoreLabelEl.remove(),this.scoreLabelEl=null),this.el&&(this.el.remove(),this.el=null)}};var rb=250,fn,ja=class extends ye{constructor(e,t){super();p(this,"cameraDirty",!0);p(this,"focusablesDirty",!0);p(this,"state");p(this,"camera");p(this,"cameraFrustum",new di);p(this,"viewProjectionMatrix",new we);p(this,"tempScreenPos",new k);p(this,"debugEl",null);p(this,"collisions",new Map);p(this,"focusableEntities",new Map);p(this,"debug",!1);p(this,"debugBBoxElements",new Map);p(this,"viewfinder",new Wa);p(this,"screenBoundsMap",new Map);p(this,"screenDiagonal",1);A(this,fn);p(this,"update",(e=!1,t=Date.now())=>{this.focusablesDirty&&this.updateFocusableEntities(),!e&&(Date.now()-t>rb||(c(this,fn)&&cancelAnimationFrame(c(this,fn)),_(this,fn,requestAnimationFrame(()=>{this.updateRaf()}))))});this.state=e,this.camera=t,this.resize()}resize(){this.screenDiagonal=Math.sqrt(this.state.canvasWidth*this.state.canvasWidth+this.state.canvasHeight*this.state.canvasHeight),this.createViewfinder()}createViewfinder(){this.debugEl&&this.debugEl.remove();for(let e of this.debugBBoxElements.values())e.remove();this.debugBBoxElements.clear(),this.debug&&(this.debugEl=ap()),this.viewfinder.create(this.state.canvasWidth,this.state.canvasHeight,this.state.insetsPadding,this.debug,this.debugEl)}simplifyVertices(e){return e.length<3?e:ip(e).map(t=>e[t.index])}computeScreenSpaceBounds(e){let{vertices:t,boundingBox:n}=e;if(t==null||t.length<3||n==null||n.isEmpty()||!this.cameraFrustum.intersectsBox(n))return;let o=this.camera.projectionMatrix.elements,s=t.map(h=>({x:o[0]*h.x+o[4]*h.y+o[8]*h.z+o[12],y:o[1]*h.x+o[5]*h.y+o[9]*h.z+o[13],z:o[2]*h.x+o[6]*h.y+o[10]*h.z+o[14],w:o[3]*h.x+o[7]*h.y+o[11]*h.z+o[15]})),a=mp(s);if(a.length<3)return;let l=1/0,u=[];for(let h of a){let d=h.x/h.w,f=h.y/h.w;u.push({x:(d+1)/2*this.state.canvasWidth,y:(-f+1)/2*this.state.canvasHeight}),h.w<l&&(l=h.w)}let m=pp(u,this.state.canvasWidth,this.state.canvasHeight);if(!(m.length<=0))return{screenBBox:du(u),clippedScreenBBox:this.debug?du(m):void 0,closestZ:l}}updateFocusableEntities(){var t;this.focusableEntities.clear();let e;for(let n of this.state.geometry3DsInScene){if(n==null)continue;let o;if(n.type==="group-container"||n.type==="geometry-group")o=n.visible;else{let s=n.components[1];o=(t=s==null?void 0:s.visible)!=null?t:!0}if(o&&(e=n.type==="group-container"?n.components[1]:n.components[4],e!==void 0&&e.type==="focusable")){let s=String(n.type==="group-container"?n.userData.entityId:n.id);if(e.dirty===!0){let a=null;n instanceof jt?a=n:"object3d"in n&&n.object3d instanceof jt&&(a=n.object3d),a&&(e.vertices=this.simplifyVertices(dp(a,this.tempScreenPos)),e.boundingBox=new qe().setFromObject(a),e.dirty=!1)}this.focusableEntities.set(s,e)}}this.focusablesDirty=!1}updateRaf(){if(this.focusableEntities.size===0){this.publish("geometry-in-focus",[]);return}this.cameraDirty&&this.compute()}updateDebugBBoxes(e,t){if(!(!this.debug||!this.debugEl)){op(this.debugBBoxElements,e);for(let[n,o]of e){let s=t.has(n),a=this.collisions.get(n);sp(n,o,this.debugBBoxElements,this.debugEl,s,a)}}}compute(){if(this.collisions.clear(),this.screenBoundsMap.clear(),!this.viewfinder.center)return;this.viewProjectionMatrix.copy(this.camera.projectionMatrix),this.cameraFrustum.setFromProjectionMatrix(this.viewProjectionMatrix);let e=[];for(let[n,o]of this.focusableEntities){let s=this.computeScreenSpaceBounds(o);if(!s)continue;this.screenBoundsMap.set(n,s);let{screenBBox:a}=s,l=np(a,this.viewfinder.bbox);if(l>0){e.push(n);let u=(a.minX+a.maxX)/2,m=(a.minY+a.maxY)/2,h=u-this.viewfinder.center.x,d=m-this.viewfinder.center.y,b=1/(1+Math.sqrt(h*h+d*d)/this.screenDiagonal),x=1/(1+Math.abs(s.closestZ)),y=b*.5+l*.35+x*.15;this.collisions.set(n,y)}}let t=Array.from(this.collisions,([n,o])=>({entityId:n,score:o})).sort((n,o)=>o.score-n.score).map(({entityId:n})=>n);if(this.debug){let n=t[0];this.viewfinder.updateLabel(n||"viewfinder");let o=n?this.collisions.get(n):void 0;this.viewfinder.updateScore(o);let s=new Set(e);this.updateDebugBBoxes(this.screenBoundsMap,s)}this.publish("geometry-in-focus",t),this.cameraDirty=!1}showDebug(){this.debug||(this.debug=!0,this.cameraDirty=!0,this.createViewfinder())}hideDebug(){this.debug&&(this.debug=!1,this.createViewfinder())}destroy(){c(this,fn)&&cancelAnimationFrame(c(this,fn)),this.debugEl&&this.debugEl.remove();for(let e of this.debugBBoxElements.values())e.remove();this.debugBBoxElements.clear(),this.collisions.clear(),this.focusableEntities.clear(),this.viewfinder.destroy()}};fn=new WeakMap;v();v();v();v();v();function Za(i){if(!i)throw new Error("coord is required");if(!Array.isArray(i)){if(i.type==="Feature"&&i.geometry!==null&&i.geometry.type==="Point")return i.geometry.coordinates;if(i.type==="Point")return i.coordinates}if(Array.isArray(i)&&i.length>=2&&!Array.isArray(i[0])&&!Array.isArray(i[1]))return i;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function Zn(i){if(Array.isArray(i))return i;if(i.type==="Feature"){if(i.geometry!==null)return i.geometry.coordinates}else if(i.coordinates)return i.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function Li(i){return i.type==="Feature"?i.geometry:i}function HT(i,r){return i.type==="FeatureCollection"?"FeatureCollection":i.type==="GeometryCollection"?"GeometryCollection":i.type==="Feature"&&i.geometry!==null?i.geometry.type:i.type}function zr(i,r,e){if(e===void 0&&(e={}),!i)throw new Error("point is required");if(!r)throw new Error("polygon is required");var t=Za(i),n=Li(r),o=n.type,s=r.bbox,a=n.coordinates;if(s&&nb(t,s)===!1)return!1;o==="Polygon"&&(a=[a]);for(var l=!1,u=0;u<a.length&&!l;u++)if(fp(t,a[u][0],e.ignoreBoundary)){for(var m=!1,h=1;h<a[u].length&&!m;)fp(t,a[u][h],!e.ignoreBoundary)&&(m=!0),h++;m||(l=!0)}return l}function fp(i,r,e){var t=!1;r[0][0]===r[r.length-1][0]&&r[0][1]===r[r.length-1][1]&&(r=r.slice(0,r.length-1));for(var n=0,o=r.length-1;n<r.length;o=n++){var s=r[n][0],a=r[n][1],l=r[o][0],u=r[o][1],m=i[1]*(s-l)+a*(l-i[0])+u*(i[0]-s)===0&&(s-i[0])*(l-i[0])<=0&&(a-i[1])*(u-i[1])<=0;if(m)return!e;var h=a>i[1]!=u>i[1]&&i[0]<(l-s)*(i[1]-a)/(u-a)+s;h&&(t=!t)}return t}function nb(i,r){return r[0]<=i[0]&&r[1]<=i[1]&&r[2]>=i[0]&&r[3]>=i[1]}v();v();function ib(i){if(!i)throw new Error("geojson is required");var r=[];return en(i,function(e){ob(e,r)}),Tn(r)}function ob(i,r){var e=[],t=i.geometry;if(t!==null){switch(t.type){case"Polygon":e=Zn(t);break;case"LineString":e=[Zn(t)]}e.forEach(function(n){var o=sb(n,i.properties);o.forEach(function(s){s.id=r.length,r.push(s)})})}}function sb(i,r){var e=[];return i.reduce(function(t,n){var o=Ds([t,n],r);return o.bbox=ab(t,n),e.push(o),n}),e}function ab(i,r){var e=i[0],t=i[1],n=r[0],o=r[1],s=e<n?e:n,a=t<o?t:o,l=e>n?e:n,u=t>o?t:o;return[s,a,l,u]}var mu=ib;var Zp=Es(Wp(),1);function sv(i,r){var e={},t=[];if(i.type==="LineString"&&(i=uc(i)),r.type==="LineString"&&(r=uc(r)),i.type==="Feature"&&r.type==="Feature"&&i.geometry!==null&&r.geometry!==null&&i.geometry.type==="LineString"&&r.geometry.type==="LineString"&&i.geometry.coordinates.length===2&&r.geometry.coordinates.length===2){var n=jp(i,r);return n&&t.push(n),Tn(t)}var o=(0,Zp.default)();return o.load(mu(r)),dc(mu(i),function(s){dc(o.search(s),function(a){var l=jp(s,a);if(l){var u=Zn(l).join(",");e[u]||(e[u]=!0,t.push(l))}})}),Tn(t)}function jp(i,r){var e=Zn(i),t=Zn(r);if(e.length!==2)throw new Error("<intersects> line1 must only contain 2 coordinates");if(t.length!==2)throw new Error("<intersects> line2 must only contain 2 coordinates");var n=e[0][0],o=e[0][1],s=e[1][0],a=e[1][1],l=t[0][0],u=t[0][1],m=t[1][0],h=t[1][1],d=(h-u)*(s-n)-(m-l)*(a-o),f=(m-l)*(o-u)-(h-u)*(n-l),b=(s-n)*(o-u)-(a-o)*(n-l);if(d===0)return null;var x=f/d,y=b/d;if(x>=0&&x<=1&&y>=0&&y<=1){var g=n+x*(s-n),S=o+x*(a-o);return ws([g,S])}return null}var el=sv;v();function tl(i,r){r===void 0&&(r={});var e=Li(i);switch(!r.properties&&i.type==="Feature"&&(r.properties=i.properties),e.type){case"Polygon":return av(e,r);case"MultiPolygon":return lv(e,r);default:throw new Error("invalid poly")}}function av(i,r){r===void 0&&(r={});var e=Li(i),t=e.coordinates,n=r.properties?r.properties:i.type==="Feature"?i.properties:{};return Xp(t,n)}function lv(i,r){r===void 0&&(r={});var e=Li(i),t=e.coordinates,n=r.properties?r.properties:i.type==="Feature"?i.properties:{},o=[];return t.forEach(function(s){o.push(Xp(s,n))}),Tn(o)}function Xp(i,r){return i.length>1?Sh(i,r):Ds(i[0],r)}function cv(i,r){var e=!0;return en(i,function(t){en(r,function(n){if(e===!1)return!1;e=uv(t.geometry,n.geometry)})}),e}function uv(i,r){switch(i.type){case"Point":switch(r.type){case"Point":return!pv(i.coordinates,r.coordinates);case"LineString":return!Yp(r,i);case"Polygon":return!zr(i,r)}break;case"LineString":switch(r.type){case"Point":return!Yp(i,r);case"LineString":return!hv(i,r);case"Polygon":return!$p(r,i)}break;case"Polygon":switch(r.type){case"Point":return!zr(r,i);case"LineString":return!$p(i,r);case"Polygon":return!dv(r,i)}}return!1}function Yp(i,r){for(var e=0;e<i.coordinates.length-1;e++)if(mv(i.coordinates[e],i.coordinates[e+1],r.coordinates))return!0;return!1}function hv(i,r){var e=el(i,r);return e.features.length>0}function $p(i,r){for(var e=0,t=r.coordinates;e<t.length;e++){var n=t[e];if(zr(n,i))return!0}var o=el(r,tl(i));return o.features.length>0}function dv(i,r){for(var e=0,t=i.coordinates[0];e<t.length;e++){var n=t[e];if(zr(n,r))return!0}for(var o=0,s=r.coordinates[0];o<s.length;o++){var a=s[o];if(zr(a,i))return!0}var l=el(tl(i),tl(r));return l.features.length>0}function mv(i,r,e){var t=e[0]-i[0],n=e[1]-i[1],o=r[0]-i[0],s=r[1]-i[1],a=t*s-n*o;return a!==0?!1:Math.abs(o)>=Math.abs(s)?o>0?i[0]<=e[0]&&e[0]<=r[0]:r[0]<=e[0]&&e[0]<=i[0]:s>0?i[1]<=e[1]&&e[1]<=r[1]:r[1]<=e[1]&&e[1]<=i[1]}function pv(i,r){return i[0]===r[0]&&i[1]===r[1]}var qp=cv;function Ou(i,r){var e=!1;return en(i,function(t){en(r,function(n){if(e===!0)return!0;e=!qp(t.geometry,n.geometry)})}),e}var fv=5e3,Lu="outdoor-system-debug-container",Jp=!1,Ur,ot,Vo,Ri,Hr,Cr,qt,_i,Wo,Fi,nl,il,ar,Au,jo,Xn,Qp,ol,sl,Kp,ef,rl=class extends ye{constructor(e){super();A(this,ar);A(this,Ur,!0);A(this,ot);p(this,"idleQueue",new Wn);A(this,Vo,"");A(this,Ri,new Set);A(this,Hr,new Set);A(this,Cr);A(this,qt,null);A(this,_i,!1);A(this,Wo,e=>{if(!c(this,ot))throw new Error("Map not initialized");let n=[[e[0],e[1]],[e[2],e[1]],[e[2],e[3]],[e[0],e[3]]].map(u=>c(this,ot).project(u)),o=Math.max(...n.map(u=>u.x)),s=Math.min(...n.map(u=>u.x)),a=Math.max(...n.map(u=>u.y)),l=Math.min(...n.map(u=>u.y));return[new xc(s,l),new xc(o,a)]});A(this,Fi,(e,t)=>{if(!c(this,ot))return;let n=c(this,ot).on(e,t);n!=null&&n.unsubscribe&&this.onAbort(()=>n.unsubscribe())});A(this,nl,()=>{c(this,qt)&&(clearTimeout(c(this,qt)),_(this,qt,null),_(this,Ur,!1))});A(this,il,()=>{c(this,qt)&&(clearTimeout(c(this,qt)),_(this,qt,null)),_(this,qt,setTimeout(()=>{c(this,nl).call(this)},fv))});A(this,jo,async()=>{if(Jp&&c(this,Cr)&&te(this,ar,ef).call(this),!(!c(this,ot)||!c(this,_i))&&c(this,Ur)&&!(!c(this,Hr)||c(this,Hr).size===0)&&(c(this,ar,Qp)&&c(this,ol).call(this),c(this,Cr))){let e=new Set;this.idleQueue.onComplete(()=>{c(this,Xn).length>0&&(c(this,Hr).forEach(t=>{var n;(n=c(this,ot))==null||n.setFilter(t,["all",...c(this,Xn)])}),_(this,Ur,!1)),_(this,Xn,[])});for(let t of c(this,Cr)){let n=mc(t),o=c(this,Wo).call(this,n),s=c(this,ot).queryRenderedFeatures(o,{layers:Array.from(c(this,Hr))});for(let a of s)a.id==null||e.has(a.id)||this.idleQueue.add(()=>{if(a.geometry!=null&&"coordinates"in a.geometry){let l;if(a.geometry.type==="Polygon"?l=Ts(a.geometry.coordinates):a.geometry.type==="MultiPolygon"&&(l=Mh(a.geometry.coordinates)),!l)return;Ou(t,l)&&a.id!=null&&(e.add(a.id),c(this,Xn).push(["!=",["id"],a.id]))}})}}});A(this,Xn,[]);A(this,ol,()=>{this.idleQueue.clearAll()});A(this,sl,e=>{var t,n;if(c(this,ot)&&e&&e.dataType==="style"&&e.type==="styledata"&&c(this,Ri).size>0){let o=(n=(t=e==null?void 0:e.style)==null?void 0:t.stylesheet)==null?void 0:n.id;(!o||o!==c(this,Vo))&&(_(this,Vo,o),te(this,ar,Au).call(this),_(this,Ur,!0))}});e&&(_(this,ot,e),c(this,Fi).call(this,"styledata",c(this,sl)),c(this,Fi).call(this,"render",c(this,jo)),_(this,_i,c(this,ot).loaded()),c(this,Fi).call(this,"load",()=>{_(this,_i,!0)})),Jp&&te(this,ar,Kp).call(this)}hideLayersIntersectingPolygons(e,t){c(this,qt)&&clearTimeout(c(this,qt)),c(this,il).call(this),_(this,Cr,e.reduce((n,o)=>{if(o.geometry.type==="Polygon"){let s=Ts(o.geometry.coordinates);n.push(s)}else o.geometry.type==="MultiPolygon"&&n.push(...o.geometry.coordinates.map(s=>Ts(s)));return n},[]));for(let n of t)c(this,Ri).add(n);_(this,Ur,!0),te(this,ar,Au).call(this),c(this,jo).call(this)}destroy(){this.idleQueue.clearAll(),super.destroy()}};Ur=new WeakMap,ot=new WeakMap,Vo=new WeakMap,Ri=new WeakMap,Hr=new WeakMap,Cr=new WeakMap,qt=new WeakMap,_i=new WeakMap,Wo=new WeakMap,Fi=new WeakMap,nl=new WeakMap,il=new WeakMap,ar=new WeakSet,Au=function(){if(_(this,Hr,new Set),c(this,ot))for(let e of c(this,Ri))c(this,ot).getLayer(e)&&c(this,Hr).add(e)},jo=new WeakMap,Xn=new WeakMap,Qp=function(){return this.idleQueue.size!==0},ol=new WeakMap,sl=new WeakMap,Kp=function(){if(!document.getElementById(Lu)&&c(this,ot)){let e=document.createElement("div");e.id=Lu,e.style.position="absolute",e.style.top="0",e.style.left="0",e.style.bottom="0",e.style.right="0",e.style.pointerEvents="none",e.style.zIndex="1000",c(this,ot).getContainer().appendChild(e)}},ef=function(){let e=document.getElementById(Lu);if(!e||!c(this,Cr)||!c(this,ot))return;let t=e.querySelectorAll('[id^="polygon-box-"]');for(let n=0;n<t.length;n++)t[n].remove();for(let n=0;n<c(this,Cr).length;n++){let o=c(this,Cr)[n],s=mc(o),a=c(this,Wo).call(this,s),l=document.createElement("div");l.id="polygon-box-".concat(n),l.style.position="absolute",e.appendChild(l);let u=[Math.min(a[0].x,a[1].x),Math.min(a[0].y,a[1].y)],m=[Math.max(a[0].x,a[1].x),Math.max(a[0].y,a[1].y)];l.style.top=u[1]+"px",l.style.left=u[0]+"px",l.style.width=m[0]-u[0]+"px",l.style.height=m[1]-u[1]+"px",l.style.border="2px solid ".concat(c(this,Ur)?"red":"blue")}};v();v();v();v();var al=class extends tn{constructor(e,t={}){var g;super();p(this,"tangentData");p(this,"parameters");Object.defineProperty(this,"type",{value:"RibbonGeometry"}),this.parameters={path:e};let n=(g=t.segments)!=null?g:64,o=new k,s=new k,a=new k(0,0,1),l=(n+1)*2,u=new Float32Array(l*3),m=new Float32Array(l*3),h=new Float32Array(l*2),d=new Float32Array(l),f=[];this.tangentData=new Float32Array((n+1)*3);let b=0,x=0,y=0;for(let S=0;S<=n;S++){let M=S/n;e.getPointAt(M,o),e.getTangentAt(M,s);let E=S*3;this.tangentData[E]=s.x,this.tangentData[E+1]=s.y,this.tangentData[E+2]=s.z,u[b++]=o.x,u[b++]=o.y,u[b++]=o.z,u[b++]=o.x,u[b++]=o.y,u[b++]=o.z,d[y++]=-1,d[y++]=1,h[x++]=0,h[x++]=M,h[x++]=1,h[x++]=M;let w=S*2*3;m[w]=a.x,m[w+1]=a.y,m[w+2]=a.z,m[w+3]=a.x,m[w+4]=a.y,m[w+5]=a.z}for(let S=0;S<n;S++){let M=S*2;f.push(M,M+2,M+1),f.push(M+1,M+2,M+3)}this.setIndex(f),this.setAttribute("position",new In(u,3)),this.setAttribute("normal",new In(m,3)),this.setAttribute("uv",new In(h,2)),this.setAttribute("side",new In(d,1))}};v();var ll=class extends Vh{constructor(e,t,n=!1){super();p(this,"innerCurve");p(this,"tStart");p(this,"tEnd");this.innerCurve=e,n&&t>=4?(this.tStart=1/(t-1),this.tEnd=(t-2)/(t-1)):(this.tStart=0,this.tEnd=1)}get points(){return this.innerCurve.points}get tension(){return this.innerCurve.tension}get isTrimmed(){return this.tStart!==0||this.tEnd!==1}getPoint(e,t=new k){let n=this.tStart+e*(this.tEnd-this.tStart);return this.innerCurve.getPoint(n,t)}};v();var cl="attribute float pathDistance;\nattribute vec3 pathNormal;\nattribute vec3 pathTangent;\nattribute float side;\n\n\nuniform vec2 uvScale;\nuniform float vertexes;\nuniform float complete;\nuniform float nearRadius;\nuniform float farRadius;\nuniform float nearZoom;\nuniform float farZoom;\nuniform float pulse;\nuniform float pulseLength;\nuniform bool pathIsVertical;\nuniform bool displayArrowsOnPath;\nuniform vec2 cameraParameters;\nuniform bool isRibbon;\nuniform bool billboarded;\nuniform mat4 cameraViewMatrix;\n\nvarying float zoomLevel;\nvarying float radius;\nvarying vec2 fragTexcoord;\nvarying float fragTopTextureU;\nvarying float fragPathDistance;\n\nuniform float highlightStartFraction;\nuniform float highlightEndFraction;\nuniform float highlightCompleteFraction;\nuniform float highlightWidthMultiplier;\nuniform vec3 highlightColor;\n\nfloat flattenFactor = 0.0;\n\n// Map the x value from the range [xMin, xMax] to the range [yMin, yMax] using\n// linear interpolation/extrapolation.\n//\n// This performs a pure linear mapping y = mx + b where\n// 'm = (yMax - yMin) / (xMax - xMin)',\n// 'b = -xMin * (yMax - yMin) / (xMax - xMin) + yMin'.\nfloat remap(float x, float xMin, float xMax, float yMin, float yMax) {\n return (x - xMin) / (xMax - xMin) * (yMax - yMin) + yMin;\n}\n\n// Map the x value from [xMin, xMax] to the range [yMin, yMax] using linear\n// interpolation, clamping result values outside [yMin, yMax].\nfloat clampRemap(float x, float xMin, float xMax, float yMin, float yMax) {\n return clamp(remap(x, xMin, xMax, yMin, yMax), yMin, yMax);\n}\n\nvoid main() {\n fragPathDistance = pathDistance;\n\n vec3 adjustedPosition = position;\n zoomLevel = clampRemap(cameraParameters.x, nearZoom, farZoom, 0.0, 1.0);\n\n // Only apply normal-based expansion for TubeGeometry\n // Ribbons have normal=(0,0,1) which would shift them up incorrectly\n if (!isRibbon) {\n float expansionFactor = (farRadius - nearRadius) * zoomLevel;\n adjustedPosition += normal * expansionFactor;\n }\n\n bool isHighlighted = fragPathDistance > highlightStartFraction && fragPathDistance <= (highlightEndFraction * highlightCompleteFraction);\n\n // For TubeGeometry: apply highlight width expansion using normal\n if (!isRibbon && isHighlighted) {\n adjustedPosition += normal * (highlightWidthMultiplier - 1.) / 2.;\n }\n\n // Unified ribbon width handling for both billboarded and non-billboarded\n if (isRibbon) {\n vec3 right;\n\n if (billboarded) {\n // Camera-facing: compute right from view direction\n vec3 viewDir = -vec3(cameraViewMatrix[0][2], cameraViewMatrix[1][2], cameraViewMatrix[2][2]);\n right = cross(pathTangent, viewDir);\n float rightLen = length(right);\n if (rightLen < 0.001) {\n right = cross(pathTangent, vec3(0.0, 0.0, 1.0));\n rightLen = length(right);\n if (rightLen < 0.001) {\n right = cross(pathTangent, vec3(0.0, 1.0, 0.0));\n rightLen = length(right);\n }\n }\n right = right / max(rightLen, 0.001);\n } else {\n // World-space: 90\xB0 CCW rotation of tangent in XY plane \u2192 perpendicular\n right = vec3(-pathTangent.y, pathTangent.x, 0.0);\n float rightLen = length(right);\n if (rightLen > 0.001) {\n right /= rightLen;\n } else {\n // Fallback for nearly vertical paths\n right = vec3(1.0, 0.0, 0.0);\n }\n }\n\n // Apply base half-width (geometry stores centerline only)\n adjustedPosition += right * nearRadius * side;\n\n // Shared: zoom-based expansion\n float expansionFactor = (farRadius - nearRadius) * zoomLevel;\n adjustedPosition += right * expansionFactor * side;\n\n // Shared: highlight width expansion (using right instead of normal)\n if (isHighlighted) {\n float highlightExpansion = nearRadius * (highlightWidthMultiplier - 1.0);\n adjustedPosition += right * highlightExpansion * side;\n }\n }\n\n // For TubeGeometry: flatten the bottom half of the tube\n if (!isRibbon && !pathIsVertical) {\n // We can get an origin point for the cross-section of the path by\n // subtracting the surface normal times the radius, since the surface normal\n // points strictly away from the centre.\n vec3 origin = position - nearRadius * normal;\n\n // Determine how far the path extends \"up\" or \"down\" in the direction of the\n // path normal.\n float height = dot(adjustedPosition - origin, pathNormal);\n\n // For horizontal paths, flatten the bottom half entirely so that it's flat\n // against the floor. This makes the path look nicer when it's\n // semitransparent behind opaque geometry, so you don't see it\n // peeking through.\n float desiredHeight = max(height, 0.0);\n desiredHeight = desiredHeight * flattenFactor;\n float flattenMagnitude = height - desiredHeight;\n adjustedPosition = adjustedPosition - pathNormal * flattenMagnitude;\n }\n\n // Transform the vertices into NDC.\n vec4 mvPosition = modelViewMatrix * vec4(adjustedPosition, 1.0);\n gl_Position = projectionMatrix * mvPosition;\n\n fragTexcoord = uv;\n\n // Compute fragTopTextureU for arrow texture mapping\n if (isRibbon) {\n // For RibbonGeometry: uv.x is already 0-1 across ribbon width\n fragTopTextureU = uv.x;\n } else {\n // For TubeGeometry: compute texture coordinate to handle tube twisting\n // We want the arrow texture to always be on the top of the path\n vec3 bitangent = cross(normal, pathTangent);\n fragTopTextureU = -dot(bitangent, pathNormal) * 0.5 + 0.5;\n if (isHighlighted) {\n fragTopTextureU = -dot(bitangent, pathNormal * highlightWidthMultiplier) * 0.5 + 0.5;\n }\n }\n\n radius = mix(nearRadius, farRadius, zoomLevel);\n}\n";v();var Ru="#define ARROW_FADING_POINT 0.15\n\nuniform float complete;\nuniform float nearRadius;\nuniform float farRadius;\nuniform vec2 resolution;\nuniform vec2 cameraParameters;\nuniform vec3 color;\nuniform float pathLength;\nuniform bool showPulse;\nuniform vec3 pulseColor;\nuniform float pulse;\nuniform float pulseLength;\nuniform bool pathIsVertical;\nuniform bool displayArrowsOnPath;\nuniform float arrowAnimationTimer;\nuniform float opacityMultiplier;\nuniform bool dashed;\nuniform float dashLength;\nuniform float dashGap;\nuniform bool dashRelativeToWidth;\nuniform float dashSize;\nuniform float gapSize;\nuniform bool dashAbsolute;\nuniform float dashMeters;\nuniform float gapMeters;\nuniform sampler2D arrowTexture;\n\nvarying float zoomLevel;\nvarying float radius;\nvarying vec2 fragTexcoord;\nvarying float fragTopTextureU;\nvarying float fragPathDistance;\n\n\nuniform float highlightStartFraction;\nuniform float highlightEndFraction;\nuniform float highlightCompleteFraction;\nuniform vec3 highlightColor;\n\n// Border uniforms for ribbon geometry\nuniform bool borderEnabled;\nuniform vec3 borderColor;\nuniform float borderWidth;\nuniform bool borderUseDarken;\nuniform bool isRibbon;\n\n// Endcap uniforms for ribbon geometry\n// x = start cap enabled (>0), y = end cap enabled (>0)\nuniform vec2 endcapEnabled;\n\n// How long the arrow should be, as a factor of pathRadius. Since we've\n// mostly flattened the top of the path, values near 2.0 (the diameter)\n// will probably look best.\nconst float arrowLength = 2.0;\n\n// How much of a relative margin the arrow texture should have inside the\n// area laid out for it. Useful to pull the arrow away from the edges of the\n// path, which slope down.\nconst float arrowMargin = 0.1;\n\n// How many arrow-lengths of space should be between arrows on a short path.\nconst float arrowSpacingOnShortPath = 6.0;\n\n// How many arrow-lengths of space should be between arrows on a long path.\nconst float arrowSpacingOnLongPath = 7.5;\n\n// How long a path must be to be considered \"long\", as a factor of\n// the path radius.\nconst float longPathLength = 200.;\n\n// How long a path must be to be considered \"short\", as a factor of the\n// path radius.\nconst float shortPathLength = 75.;\n\n// How much of the path's length the fade-in should comprise when going from\n// zero opacity to full opacity.\nconst float completeLength = 0.1;\n\n// Map the x value from the range [xMin, xMax] to the range [yMin, yMax] using\n// linear interpolation/extrapolation.\n//\n// This performs a pure linear mapping 'y = mx + b' where\n// 'm = (yMax - yMin) / (xMax - xMin)',\n// 'b = -xMin * (yMax - yMin) / (xMax - xMin) + yMin'.\nfloat remap(float x, float xMin, float xMax, float yMin, float yMax) {\n return (x - xMin) / (xMax - xMin) * (yMax - yMin) + yMin;\n}\n\n// Map the x value from [xMin, xMax] to the range [yMin, yMax] using linear\n// interpolation, clamping result values outside [yMin, yMax].\nfloat clampRemap(float x, float xMin, float xMax, float yMin, float yMax) {\n return clamp(remap(x, xMin, xMax, yMin, yMax), yMin, yMax);\n}\n\nvoid main(void) {\n // Compute the opacity of the path based on the distance from the current\n // fragment to the 'complete' value as it varies from 0.0 to 1.0.\n // Fragments that are at the 'complete' value or past it will be fully\n // transparent, while fragments that are at 'complete - completeLength'\n // or before it will be fully opaque. However, we adjust the 'complete'\n // value here so that it overshoots by one full 'completeLength', so that\n // the entire path will be opaque when the 'complete' value is at 1.0.\n float completeLocation = complete * (1.0 + completeLength);\n float completeAmount = clampRemap(\n fragPathDistance,\n completeLocation - completeLength,\n completeLocation,\n 0.0,\n 1.0\n );\n float opacity = 1.0 - smoothstep(0.0, 1.0, completeAmount);\n\n // 2020/01/09 Terence Dickson\n // When we render the background and overlay for the mapbox outdoor context\n // behind everything else in single-buffer rendering, the fact that the path\n // writes to the depth buffer means that the background and overlay will not\n // be drawn behind the path even when the path is still fading in. The effect\n // is subtle and is only visible in single-buffer rendering so this quick fix\n // prevents writes to the depth buffer for zero opacity fragments, which gets\n // rid of the most visually-offensive ghosting.\n if (opacity <= 0.0) {\n discard;\n }\n\n\n // Apply rounded endcaps for ribbon geometry using SDF\n // endcapEnabled.x = start cap (>0 enabled), endcapEnabled.y = end cap (>0 enabled)\n // Creates semicircular caps at start and/or end; disabled caps are square\n float startCapOn = step(0.5, endcapEnabled.x);\n float endCapOn = step(0.5, endcapEnabled.y);\n if ((startCapOn > 0.5 || endCapOn > 0.5) && isRibbon) {\n float endcapRadius = radius / pathLength;\n float xDist = abs(fragTexcoord.x - 0.5);\n float scaledXSq = xDist * xDist * 4.0;\n\n // Start cap: only apply SDF when enabled\n float startT = clamp(1.0 - fragPathDistance / endcapRadius, 0.0, 1.0);\n float startSDF = startT * startT + scaledXSq - 1.0;\n float inStartCap = step(fragPathDistance, endcapRadius);\n float outsideStart = inStartCap * step(0.0, startSDF) * startCapOn;\n\n // End cap: only apply SDF when enabled\n float endCapPos = min(completeLocation, 1.0);\n float endCapStart = endCapPos - endcapRadius;\n float endT = clamp(1.0 - (endCapPos - fragPathDistance) / endcapRadius, 0.0, 1.0);\n float endSDF = endT * endT + scaledXSq - 1.0;\n float inEndCap = step(endCapStart, fragPathDistance);\n float outsideEnd = inEndCap * step(0.0, endSDF) * endCapOn;\n\n // Discard if outside semicircle in enabled cap region\n if (max(outsideStart, outsideEnd) > 0.5) discard;\n }\n\n // Push in the texture coordinates so that they ramp up\n // at 'arrowMargin' instead of at zero; this remapping looks somewhat\n // like this:\n // 1 ^ ___\n // | /\n // | /\n // | /\n // | /\n // |___/\n // 0 +---------->\n // 0 ^ 1\n // arrowMargin\n // Making the arrows narrower on the path.\n float u = fragTopTextureU;\n u = clamp(\n u * (1. / (1. - arrowMargin * 2.)) - (1. / (1. - arrowMargin * 2.) - 1.) / 2.,\n 0.0,\n 1.0\n );\n\n float arrowSpacing = clampRemap(\n pathLength,\n shortPathLength * radius,\n longPathLength * radius,\n arrowSpacingOnShortPath,\n arrowSpacingOnLongPath\n );\n\n // Reduce the spacing between arrows when the camera zooms out, as increasing\n // the path radius will increase the arrow size and thus be able to fit\n // fewer arrows on in total, and this secondary movement of the arrows\n // \"zooming off\" the end of the path is unpleasant\n float expandAmount = mix(1.0, farRadius / nearRadius, zoomLevel);\n float effectiveArrowSpacing =\n arrowSpacing * 1.0 / expandAmount +\n arrowMargin * 2.0;\n\n float effectiveArrowLength = arrowLength * radius * (1. - arrowMargin * 2.0);\n\n // Adjust the slope of the vertical texture coordinate so that it goes\n // from 0 to 1 along the length of the arrow plus the spacing between\n // arrows, and adjust its x-intercept so that one arrow moves to the\n // exact position of the next arrow as 'arrowAnimationTimer' goes\n // from 0 to 1\n // Note: Using fragPathDistance (0-1 along path) for RibbonGeometry\n float v = (\n fragPathDistance * (pathLength / effectiveArrowLength)\n - arrowAnimationTimer * (1. + effectiveArrowSpacing)\n );\n\n // Compute a \"looping sawtooth\" wave for determining the vertical texture\n // coordinates of the arrow texture, roughly as follows:\n // 3 ^ /\n // | ___/\n // 2 | /\n // | ___/\n // 1 | /\n // |___/\n // 0 +--------------->\n // 0 ^ ^\n // ^ |_|\n // | effectiveArrowLength\n // |___|\n // effectiveArrowSpacing\n //\n // This is effectively equivalent to this sort of sawtooth wave:\n // ^\n // 1 | / / /\n // |___/ ___/ ___/\n // 0 +--------------->\n //\n // Causing the image of the arrow to repeat, with dead space (the bottom\n // edge of the texture stretched out) between the arrows at the provided\n // spacing. The reason why the \"looping\" design is preferred is because\n // it takes advantage of WebGL's 'GL_REPEAT' texture wrapping behaviour\n // to avoid the discontinuity that can end up causing visual artifacts.\n if (mod(v, (1. + effectiveArrowSpacing)) < 1.) {\n v = v - effectiveArrowSpacing * floor(v / (1. + effectiveArrowSpacing));\n } else {\n v = ceil(v / (1. + effectiveArrowSpacing));\n }\n\n // Use the r-component of the texture to determine whether the arrow covers\n // this fragment or not\n vec2 sampleTexcoord = vec2(u, v);\n float arrowAmount = 0.0;\n vec3 secondColor = pulseColor;\n\n vec3 finalColor = color;\n\n // adjust the color based on the highlight but only if the fragment is within the highlight start and end\n // [Anzor] I added 0.005 to make the highlight transition a little smoother when the width multiplier is too high\n if (fragPathDistance > highlightStartFraction - 0.005 && fragPathDistance <= (highlightEndFraction * highlightCompleteFraction)) {\n finalColor = highlightColor;\n }\n\n // Apply border effect for ribbon geometry\n // fragTexcoord.x: 0\u21921 across ribbon width; edgeDist = distance to nearest edge\n if (borderEnabled && isRibbon) {\n float edgeDist = min(fragTexcoord.x, 1.0 - fragTexcoord.x);\n\n // For endcaps, compute radial distance from semicircle edge instead\n float endcapRadius = radius / pathLength;\n float endCapPos = min(completeLocation, 1.0);\n float endCapStart = endCapPos - endcapRadius;\n\n // Check each cap region independently\n bool inStartRegion = fragPathDistance <= endcapRadius && startCapOn > 0.5;\n bool inEndRegion = fragPathDistance > endCapStart && endCapOn > 0.5;\n\n if (inStartRegion || inEndRegion) {\n float xDist = abs(fragTexcoord.x - 0.5);\n float scaledXSq = xDist * xDist * 4.0;\n\n if (inStartRegion) {\n float startT = 1.0 - fragPathDistance / endcapRadius;\n float r = sqrt(startT * startT + scaledXSq);\n edgeDist = 0.5 * (1.0 - r);\n } else {\n float endT = 1.0 - (endCapPos - fragPathDistance) / endcapRadius;\n float r = sqrt(endT * endT + scaledXSq);\n edgeDist = 0.5 * (1.0 - r);\n }\n }\n\n if (edgeDist < borderWidth) {\n finalColor = borderUseDarken ? finalColor * 0.6 : borderColor;\n }\n }\n\n if (displayArrowsOnPath) {\n arrowAmount = texture2D(arrowTexture, sampleTexcoord).r;\n float delta = 1.0 - abs(fragPathDistance * 2.0 - 1.0);\n secondColor = mix(finalColor, pulseColor, 1.0 - smoothstep(ARROW_FADING_POINT, 0.0, delta));\n }\n\n if (dashed) {\n float effectiveDashLength;\n float effectiveGapLength;\n\n if (dashAbsolute) {\n // Absolute mode: dashMeters/gapMeters are in meters\n // Convert to path-distance fraction using pathLength\n effectiveDashLength = dashMeters / pathLength;\n effectiveGapLength = gapMeters / pathLength;\n } else if (dashRelativeToWidth) {\n // Width-relative mode: dashSize/gapSize are multiples of path width\n // Convert to path-distance fraction using radius\n effectiveDashLength = (dashSize * radius * 2.0) / pathLength;\n effectiveGapLength = (gapSize * radius * 2.0) / pathLength;\n } else {\n // Length-fraction mode: use dashLength/dashGap directly as path fractions\n effectiveDashLength = dashLength;\n effectiveGapLength = dashGap;\n }\n\n float totalLength = effectiveDashLength + effectiveGapLength;\n float numSegments = ceil(1.0 / totalLength);\n float adjustedTotalLength = 1.0 / numSegments;\n float adjustedDashLength = adjustedTotalLength * (effectiveDashLength / totalLength);\n float pattern = mod(fragPathDistance, adjustedTotalLength);\n opacity = pattern < adjustedDashLength ? 1.0 : 0.0;\n }\n\n\n\n if (showPulse) {\n // Add the pulse color to the path by determining how far the current fragment\n // is from 'pulse'\n float pulseLocation = remap(\n pulse,\n 0.0,\n 1.0,\n -pulseLength,\n 1.0 + pulseLength\n );\n float pulseDistance = smoothstep(\n 0.0,\n pulseLength,\n abs(fragPathDistance - pulseLocation)\n );\n\n // Blend the pulse color to the path based on how close this fragment is to\n // the 'pulse' value and whether it's covered by an arrow -- but if it's\n // covered by *both*, then we go back to using the regular path color\n // (making arrows look like \"holes\" when they're overlapping the pulse.)\n float pulseLevel = abs(1.0 - pulseDistance - arrowAmount);\n\n\n gl_FragColor = vec4(mix(finalColor, secondColor, pulseLevel), opacity * opacityMultiplier);\n } else if (displayArrowsOnPath) {\n gl_FragColor = vec4(mix(finalColor, pulseColor, arrowAmount), opacity * opacityMultiplier);\n } else {\n\n gl_FragColor = vec4(finalColor, opacity * opacityMultiplier);\n }\n #include <colorspace_fragment>\n}\n";v();var tf="uniform float complete;\nuniform float nearRadius;\nuniform float farRadius;\nvarying float fragPathDistance;\nconst float completeLength = 0.1;\n\n// Map the x value from the range [xMin, xMax] to the range [yMin, yMax] using\n// linear interpolation/extrapolation.\n//\n// This performs a pure linear mapping 'y = mx + b' where\n// 'm = (yMax - yMin) / (xMax - xMin)',\n// 'b = -xMin * (yMax - yMin) / (xMax - xMin) + yMin'.\nfloat remap(float x, float xMin, float xMax, float yMin, float yMax) {\n return (x - xMin) / (xMax - xMin) * (yMax - yMin) + yMin;\n}\n\n// Map the x value from [xMin, xMax] to the range [yMin, yMax] using linear\n// interpolation, clamping result values outside [yMin, yMax].\nfloat clampRemap(float x, float xMin, float xMax, float yMin, float yMax) {\n return clamp(remap(x, xMin, xMax, yMin, yMax), yMin, yMax);\n}\n\nvoid main(void) {\n // this ensures that the stencil mask moves along with the path above it, to avoid the progress bar effect\n float completeLocation = complete * (1.0 + completeLength);\n float completeAmount = clampRemap(\n fragPathDistance,\n completeLocation - completeLength,\n completeLocation,\n 0.0,\n 1.0\n );\n float opacity = 1.0 - smoothstep(0.0, 1.0, completeAmount);\n\n // 2020/01/09 Terence Dickson\n // When we render the background and overlay for the mapbox outdoor context\n // behind everything else in single-buffer rendering, the fact that the path\n // writes to the depth buffer means that the background and overlay will not\n // be drawn behind the path even when the path is still fading in. The effect\n // is subtle and is only visible in single-buffer rendering so this quick fix\n // prevents writes to the depth buffer for zero opacity fragments, which gets\n // rid of the most visually-offensive ghosting.\n if (opacity <= 0.0) {\n discard;\n }\n\n gl_FragColor = vec4(0.0, 1.0, 0.0, opacity);\n}";var rf="data:image/png;base64,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";v();var ul=new k,hl=new k,Gi=new k,nf=new k,bn=new k,yv=.5,bv=2;function vv(i,r,e){let t=i.x-r.x,n=i.y-r.y,o=i.z-r.z,s=e.x-r.x,a=e.y-r.y,l=e.z-r.z,u=t*s+n*a+o*l,m=Math.sqrt(t*t+n*n+o*o),h=Math.sqrt(s*s+a*a+l*l);if(m===0||h===0)return 0;let d=u/(m*h),f=Math.max(-1,Math.min(1,d));return Math.acos(f)}function sf(i,r=20){if(i.length<3||r<=0)return i;let e=r,t=r/2,n=[i[0]];for(let o=1;o<i.length-1;o++){let s=i[o],a=i[o-1],l=i[o+1],u=s.distanceTo(a),m=s.distanceTo(l);u>e&&(bn.subVectors(s,a).normalize(),Gi.set(s.x-bn.x*t,s.y-bn.y*t,s.z-bn.z*t),n.push(Gi.clone())),n.push(s),m>e&&(bn.subVectors(l,s).normalize(),Gi.set(s.x+bn.x*t,s.y+bn.y*t,s.z+bn.z*t),n.push(Gi.clone()))}return n.push(i[i.length-1]),n}var of=.0025;function af(i,r,e,t=Math.PI*2/3){if(i.length<3||r<=0||e<=0)return i;let n=[i[0]];for(let o=1;o<i.length-1;o++){let s=i[o-1],a=i[o],l=i[o+1],u=a.distanceToSquared(s),m=a.distanceToSquared(l);if(u<of||m<of){n.push(a);continue}if(vv(s,a,l)<t){ul.subVectors(a,s).normalize(),hl.subVectors(l,a).normalize();let d=Math.sqrt(u),f=Math.sqrt(m),b=Math.max(yv,Math.min(bv,r)),x=Math.min(b,d*.5),y=Math.min(b,f*.5);Gi.set(a.x-ul.x*x,a.y-ul.y*x,a.z-ul.z*x),nf.set(a.x+hl.x*y,a.y+hl.y*y,a.z+hl.z*y),n.push(Gi.clone(),nf.clone())}else n.push(a)}return n.push(i[i.length-1]),n}var Yn=8,_u=br,xv=new Ns,dl=new k;function Fu(i,r){i.stencilWrite=r,r&&(i.stencilRef=_r.PATH,i.stencilFunc=Lr,i.stencilZPass=Wt,i.stencilZFail=it,i.stencilFail=it)}function cf(i,r,e){var Gt,Dt,dt,si,Vt,bh,vh;if(i.length<2){let W=new Nt;return W.userData={entityId:"",type:"path"},{mesh:W,material:null,center:new k}}let{breakpoint:t,width:n,accentColor:o,completeFraction:s,isVertical:a,visibleThroughGeometry:l,dashed:u,highlightCompleteFraction:m,highlightStartFraction:h,highlightEndFraction:d,highlightColor:f,highlightWidthMultiplier:b,xrayOpacity:x,__EXPERIMENTAL_BILLBOARDING:y,__EXPERIMENTAL_PREVENT_SELF_OVERLAP:g}=r,{color:S}=e,M=!0,E=0,w=1/0,R=r.displayArrowsOnPath,I=!0,T=R,C=typeof n=="object"?Number(n.output[t])/2:n/2,F=typeof n=="object"?Number((Gt=n.output[t+1])!=null?Gt:n.output[t])/2:n/2,L=r.__EXPERIMENTAL_GEOMETRY==="ribbon",N=L&&y,z=((Dt=e.altitude)!=null?Dt:0)+Sv,Y=0;i[0].z+=z;for(let W=1;W<i.length;++W){i[W].z+=z;let Z=i[W].x-i[W-1].x,Ee=i[W].z-i[W-1].z;if(a)Y+=Math.sqrt(Z*Z+Ee*Ee);else{let Ss=i[W].y-i[W-1].y;Y+=Math.sqrt(Z*Z+Ss*Ss+Ee*Ee)}}let G=i,q=(dt=r.smoothingCornerRadius)!=null?dt:Fr.cornerRadius,le=(si=r.smoothingTension)!=null?si:Fr.tension,Q=q>0&&le>0;Q&&(G=sf(G),G=af(G,q,le));let[K,B]=r.__EXPERIMENTAL_ENDCAP_EXTENSION;if((K>0||B>0)&&!a&&!L){let W=G[0],Z=G[G.length-1],Ee=Q?.01:-.01;G.push(Z.clone().setZ(Z.z+Ee)),G.unshift(W.clone().setZ(W.z+Ee))}if(L&&!a&&G.length>=2){if(K>0){let W=G[0],Z=G[1];dl.subVectors(Z,W).normalize();let Ee=W.clone().addScaledVector(dl,-K);G.unshift(Ee)}if(B>0){let W=G[G.length-1],Z=G[G.length-2];dl.subVectors(W,Z).normalize();let Ee=W.clone().addScaledVector(dl,B);G.push(Ee)}}let U=new Fh;T&&(U=xv.load(rf),U.colorSpace=Pn);let ce=new me(S),xe=new me(o),ue=r.__EXPERIMENTAL_BORDER,ze=(Vt=ue==null?void 0:ue.enabled)!=null?Vt:!1,Re=(ue==null?void 0:ue.color)==="darken",Se=(bh=ue==null?void 0:ue.width)!=null?bh:.1,Me=Re?ce.clone().multiplyScalar(.6):new me((vh=ue==null?void 0:ue.color)!=null?vh:"#000000"),De={vertexes:{type:"f",value:1},resolution:{type:"v2",value:new he(1,1)},cameraParameters:{type:"v2",value:new he(E,0)},complete:{type:"f",value:M?0:1},color:{type:"c",value:ce},pathLength:{type:"f",value:Y},nearRadius:{type:"f",value:C},farRadius:{type:"f",value:F},nearZoom:{type:"f",value:E},farZoom:{type:"f",value:w},pulseColor:{type:"c",value:xe},pulse:{type:"f",value:0},pulseLength:{type:"f",value:.075},pathIsVertical:{type:"b",value:a},arrowAnimationTimer:{type:"f",value:0},arrowTexture:{type:"t",value:U},displayArrowsOnPath:{type:"b",value:R},showPulse:{type:"b",value:I},opacityMultiplier:{type:"f",value:1},dashed:{type:"b",value:u},highlightCompleteFraction:{type:"f",value:m},highlightStartFraction:{type:"f",value:h},highlightEndFraction:{type:"f",value:d},highlightColor:{type:"c",value:new me(f)},highlightWidthMultiplier:{type:"f",value:b},dashLength:{type:"f",value:r.dashLength},dashGap:{type:"f",value:r.dashGap},dashRelativeToWidth:{type:"b",value:r.dashRelativeToWidth},dashSize:{type:"f",value:r.dashSize},gapSize:{type:"f",value:r.gapSize},dashAbsolute:{type:"b",value:r.dashAbsolute},dashMeters:{type:"f",value:r.dashMeters},gapMeters:{type:"f",value:r.gapMeters},isRibbon:{type:"b",value:L},billboarded:{type:"b",value:y},borderEnabled:{type:"b",value:ze},borderColor:{type:"c",value:Me},borderWidth:{type:"f",value:Se},borderUseDarken:{type:"b",value:Re},endcapEnabled:{type:"v2",value:new he(L&&K>0?1:0,L&&B>0?1:0)},cameraViewMatrix:{type:"m4",value:new we}};if(Q&&G.length>=2){let W=G[0],Z=G[1],Ee=G[G.length-1],Ss=G[G.length-2],Dg=W.clone().sub(Z).normalize(),Pg=W.clone().add(Dg.multiplyScalar(lf));G.unshift(Pg);let Ig=Ee.clone().sub(Ss).normalize(),Og=Ee.clone().add(Ig.multiplyScalar(lf));G.push(Og)}let Ue=new Wh(G);Ue.curveType="catmullrom",Ue.tension=Q?le:0;let Ye=L&&Q,Ut=new ll(Ue,G.length,Ye),je=Mv*G.length,ge=L?new al(Ut,{segments:je,billboarded:N}):new Zh(Ut,je,C,Yn,!1),mr=new Float32Array(ge.attributes.position.count),pr=new It(mr,1);if(L)for(let W=0;W<=je;W++){let Z=W/je;pr.setX(W*2,Z),pr.setX(W*2+1,Z)}else for(let W=0;W<=je;W++){let Z=W/je;for(let Ee=0;Ee<=Yn;Ee++)pr.setX(W*(Yn+1)+Ee,Z)}ge.setAttribute("pathDistance",pr);let Jr=new Float32Array(ge.attributes.position.count*3),Kt=new It(Jr,3),Ht,Ft,Qr,Pr,Kr;if(L){let W=ge;for(let Z=0;Z<=je;Z++)Ft=Z*3,Qr=W.tangentData[Ft],Pr=W.tangentData[Ft+1],Kr=W.tangentData[Ft+2],Kt.setXYZ(Z*2,Qr,Pr,Kr),Kt.setXYZ(Z*2+1,Qr,Pr,Kr)}else{let W=ge;for(let Z=0;Z<=je;Z++){Ht=W.tangents[Z];for(let Ee=0;Ee<=Yn;Ee++)Kt.setXYZ(Z*(Yn+1)+Ee,Ht.x,Ht.y,Ht.z)}}ge.setAttribute("pathTangent",Kt);let oi=new Float32Array(ge.attributes.position.count*3),fr=new It(oi,3),gr,Ir,er,$e=new k,Ae=W=>{a?(gr=W.x*W.y,Ir=-1+W.y*W.y,er=W.z*W.y):(gr=-W.x*W.z,Ir=-W.y*W.z,er=1-W.z*W.z);let Z=Math.sqrt(gr*gr+Ir*Ir+er*er);return Z===0&&(Z=1),$e.set(gr/Z,Ir/Z,er/Z),$e},ee={x:0,y:0,z:0};if(L){let W=ge;for(let Z=0;Z<=je;Z++)Ft=Z*3,ee.x=W.tangentData[Ft],ee.y=W.tangentData[Ft+1],ee.z=W.tangentData[Ft+2],Ae(ee),fr.setXYZ(Z*2,$e.x,$e.y,$e.z),fr.setXYZ(Z*2+1,$e.x,$e.y,$e.z)}else{let W=ge;for(let Z=0;Z<=je;Z++){Ht=W.tangents[Z],Ae(Ht);for(let Ee=0;Ee<=Yn;Ee++)fr.setXYZ(Z*(Yn+1)+Ee,$e.x,$e.y,$e.z)}}ge.setAttribute("pathNormal",fr);let H=new Zt({uniforms:De,vertexShader:cl,fragmentShader:Ru,side:_u});H.transparent=!0,H.alphaTest=.5,De.resolution.value.x=1,De.resolution.value.y=1,De.vertexes.value=ge.attributes.position.count,De.arrowTexture.value.wrapS=Ji,De.arrowTexture.value.wrapT=Ji,De.arrowTexture.value.anisotropy=16;let J=new pe(ge,H);J.name="path";let re=J.clone();re.name="xray";let oe=Ce(V({},De),{opacityMultiplier:{type:"f",value:x},pathIsVertical:{type:"b",value:a}});oe.complete.value=1,re.material=new Zt({uniforms:oe,vertexShader:cl,fragmentShader:Ru,side:_u}),re.material.transparent=!0,re.material.alphaTest=.5,re.material.depthWrite=!1,re.material.depthTest=!1,Fu(re.material,g),oe.resolution.value.x=1,oe.resolution.value.y=1,oe.vertexes.value=ge.attributes.position.count,oe.arrowTexture.value.wrapS=Ji,oe.arrowTexture.value.wrapT=Ji,oe.arrowTexture.value.anisotropy=16,oe.complete.value=s,J.userData=re.userData=r.mesh.userData;let se=r.mesh;if(!l){let W=new Zt({uniforms:De,vertexShader:cl,fragmentShader:tf,side:_u}),Z=new pe(ge,W);Z.name="stencil",Z.material.colorWrite=!1,Z.material.stencilWrite=!0,Z.material.stencilRef=_r.PATH,Z.material.stencilFunc=ci,Z.material.stencilZPass=Wt,Z.material.stencilZFail=it,Z.material.stencilFail=it,Z.material.depthWrite=!1,Z.material.depthTest=!0,Z.userData=r.mesh.userData,se.add(Z),se.add(re),re.renderOrder=Je.XRAY_PATH,J.renderOrder=Je.STENCIL_PATH}if(se.add(J),a){let W=new qe().setFromObject(J),Z=new k;W.getCenter(Z),se.children.forEach(Ee=>{Ee.geometry.center(),Ee.position.copy(Z)})}l&&(J.material.stencilWrite=!0,J.material.stencilRef=_r.PATH,J.material.stencilFunc=Lr,J.material.stencilZPass=it,J.material.stencilZFail=it,J.material.stencilFail=it,J.material.needsUpdate=!0,J.layers.disableAll(),J.layers.enable(Je.ALWAYS_ON_TOP_PATHS)),ge.computeBoundingBox();let Ge=new k;return ge.boundingBox.getCenter(Ge),{mesh:se,material:H,center:Ge}}var Sv=.15,Mv=30,lf=.01;var Ev=.5,Zo=class extends ye{constructor(e,t,n,o){super();p(this,"rendererState");p(this,"verticalDistanceDirty",!0);p(this,"convertTo3DMapPosition");p(this,"getParentContainer");p(this,"convertZoomLevelToAltitude");this.rendererState=e,this.convertTo3DMapPosition=t,this.getParentContainer=n,this.convertZoomLevelToAltitude=o}update(e,t,n){let o=!1;for(let s of this.rendererState.geometry3DsInScene)if(s&&s.type==="path"&&s.components[0].type==="path"){let a=s.components[0],l=s.components[1],u=a.isVertical&&this.verticalDistanceDirty;if(!(a instanceof cn))continue;let m=[];if(a.dirty||l.dirty||u){if(a.mesh.parent!=null)for(let h=a.mesh.children.length-1;h>=0;h--)lt(a.mesh.children[0]);if(a.feature.features.length===2&&a.feature.features[0].properties.parentId&&a.feature.features[1].properties.parentId){let h=a.feature.features[0],d=a.feature.features[a.feature.features.length-1],f,b,x=h.geometry.coordinates[2]||0,y=d.geometry.coordinates[2]||0;h.properties.parentId&&(f=this.getParentContainer(h.properties.parentId,!0),f!=null&&f.altitude!=null&&(x+=f.altitude,a.isVertical=!0)),d.properties.parentId&&(b=this.getParentContainer(d.properties.parentId,!0),b!=null&&b.altitude!=null&&(y+=b.altitude,a.isVertical=!0));let g=this.convertTo3DMapPosition(h.geometry.coordinates[1],h.geometry.coordinates[0],x),S=this.convertTo3DMapPosition(d.geometry.coordinates[1],d.geometry.coordinates[0],y);Math.abs(g.z-S.z)>Ev&&f!=null&&f.visible&&b!=null&&b.visible&&(m=[g,S])}else{let h=a.feature.features;for(let d=0;d<h.length;d++)if(d===0||!od(h[d].geometry.coordinates,h[d-1].geometry.coordinates)){let f=this.convertTo3DMapPosition(h[d].geometry.coordinates[1],h[d].geometry.coordinates[0],h[d].geometry.coordinates[2]||0);m.push(f)}}if(m.length>1){let{mesh:h,material:d,center:f}=cf(m,a,{color:l.color,altitude:l.altitude,isVertical:a.isVertical});a.mesh=h,a.material=d,a.position=f}a.dirty&&typeof a.width=="object"&&a.width.on==="zoom-level"&&(a.altitudeBreakpoints=a.width.input.map(h=>this.convertZoomLevelToAltitude(h))),a.dirty=!1}l.dirty&&(a.mesh.children.forEach(h=>{if(h.name==="stencil")return;h.material.uniforms.color.value.set(l.color),h.material.visible=l.visible,h.material.needsUpdate=!0;let d=a.__EXPERIMENTAL_BORDER;(d==null?void 0:d.color)==="darken"&&h.material.uniforms.borderColor.value.copy(h.material.uniforms.color.value).multiplyScalar(.6)}),a.mesh.position.z=l.altitude,l.dirty=!1),a.material&&(a.mesh.children.forEach(h=>{var f,b,x,y,g,S,M,E,w,R;let d=h.material.uniforms;if(h.name==="stencil"){a.materialDirty&&uf(a,h.material);return}if(a.materialDirty&&h.name==="xray"&&d.opacityMultiplier&&(d.opacityMultiplier.value=a.xrayOpacity,Fu(h.material,a.__EXPERIMENTAL_PREVENT_SELF_OVERLAP)),typeof a.width=="object"&&a.width.on==="zoom-level"){a.altitudeBreakpoints&&a.altitudeBreakpoints.length>2&&$.warn("Path width interpolation does not yet support more than 2 breakpoints! This will be added in a future version. Path width will only use the first two breakpoints.");let I=Ch(n,(b=(f=a.altitudeBreakpoints)==null?void 0:f.slice(0,2))!=null?b:[e,t]);a.breakpoint=I,d.nearZoom.value=(y=(x=a.altitudeBreakpoints)==null?void 0:x[I])!=null?y:e,d.farZoom.value=(S=(g=a.altitudeBreakpoints)==null?void 0:g[I+1])!=null?S:t,d.nearRadius.value=Number(a.width.output[I])/2,d.farRadius.value=Number((M=a.width.output[I+1])!=null?M:a.width.output[I])/2}if(d.cameraParameters.value.x=n,d.cameraViewMatrix.value.copy(this.rendererState.cameraObject.matrixWorldInverse),a.materialDirty){d.displayArrowsOnPath.value=a.displayArrowsOnPath,d.pulseColor.value.set(a.accentColor),d.complete.value=a.completeFraction,uf(a,h.material),d.dashed.value=a.dashed,d.dashLength.value=a.dashLength,d.dashGap.value=a.dashGap,d.dashRelativeToWidth.value=a.dashRelativeToWidth,d.dashSize.value=a.dashSize,d.gapSize.value=a.gapSize,d.dashAbsolute.value=a.dashAbsolute,d.dashMeters.value=a.dashMeters,d.gapMeters.value=a.gapMeters;let I=a.__EXPERIMENTAL_BORDER;d.borderEnabled.value=(E=I==null?void 0:I.enabled)!=null?E:!1,d.borderWidth.value=(w=I==null?void 0:I.width)!=null?w:.1,(I==null?void 0:I.color)==="darken"?d.borderColor.value.copy(d.color.value).multiplyScalar(.6):d.borderColor.value.set((R=I==null?void 0:I.color)!=null?R:"#000000"),d.borderUseDarken.value=(I==null?void 0:I.color)==="darken",d.billboarded.value=a.__EXPERIMENTAL_BILLBOARDING;let[T,C]=a.__EXPERIMENTAL_ENDCAP_EXTENSION;d.endcapEnabled.value=new he(T>0?1:0,C>0?1:0),typeof a.width=="number"&&(d.nearZoom.value=e,d.farZoom.value=t,d.nearRadius.value=Number(a.width)/2,d.farRadius.value=Number(a.width)/2)}}),a.displayArrowsOnPath&&a.animateArrowsOnPath&&(a.mesh.children.forEach(h=>{h.name!=="stencil"&&(h.material.uniforms.arrowAnimationTimer.value=performance.now()/3e3,h.material.needsUpdate=!0)}),o=!0),a.materialDirty=!1)}this.verticalDistanceDirty=!1,o&&this.publish("animate:path")}};function uf(i,r){let e=r.uniforms;e.highlightCompleteFraction.value=i.highlightCompleteFraction,e.highlightStartFraction.value=i.highlightStartFraction,e.highlightEndFraction.value=i.highlightEndFraction,e.highlightWidthMultiplier.value=i.highlightWidthMultiplier,e.highlightColor.value.set(i.highlightColor)}v();var He,Ni,lr,pl,ml=class{constructor(r){p(this,"rendererState");p(this,"dirty",!1);A(this,He);A(this,Ni);A(this,lr);A(this,pl,new we);this.rendererState=r}updateOne(r){if(r instanceof Te&&r.components[0]instanceof Qe&&r.components[1]instanceof xr&&r.parentObject3D instanceof mt&&(_(this,He,r.components[0]),_(this,lr,r.components[1]),!c(this,He).detached&&c(this,He).shouldDetach&&c(this,He).mesh!=null&&c(this,He).material!=null&&c(this,He).batchedProps!=null)){_(this,Ni,r.parentObject3D),c(this,He).visible=!1;let e=c(this,lr).color,t=c(this,lr).opacity*vi(r),n=c(this,He).material,o=t!=null?t:1,s=n.clone({color:e,side:Sd(c(this,lr).side,o),opacity:o,transparent:o<1}),a=new tm(1,c(this,He).batchedProps.positionCount,0,s);a.layers.enable(Ot.SHOULD_CAST_SHADOWS);let l=mm(c(this,He),a,c(this,pl));if(l==null)return;a.userData={entities:{0:r.id},detached:!0},c(this,He).instanceIndex=l,s.setColor(c(this,He).instanceIndex,new me(e),c(this,lr).topColor?new me(c(this,lr).topColor):new me(e)),c(this,He).mesh=a,c(this,He).currentHeight=-1,c(this,He).material=s,c(this,Ni).add(a),c(this,He).shouldDetach=!1,c(this,He).detached=!0,c(this,lr).dirty=!0}}update(){if(!this.dirty)return;let r;for(let e of this.rendererState.geometry3DIdsInScene)r=this.rendererState.geometry3DMap.get(e),this.updateOne(r);this.dirty=!1,this.cleanup()}cleanup(){_(this,He,void 0),_(this,Ni,void 0),_(this,lr,void 0)}};He=new WeakMap,Ni=new WeakMap,lr=new WeakMap,pl=new WeakMap;v();v();var vn=new we,Xo=new k,fl=new ui,Yo=new k;function hf(i,r,e){var t;if((t=i.batchedProps)!=null&&t.range&&i.mesh&&i.instanceIndex!==-1){let n=r||1e-4,o=n/Math.max(e,1e-4);return i.mesh.getMatrixAt(i.instanceIndex,vn),vn.decompose(Xo,fl,Yo),Yo.z=o,vn.compose(Xo,fl,Yo),i.mesh.setMatrixAt(i.instanceIndex,vn),i.material&&(i.material.repeatYFactor=o),i.currentHeight=n,!0}return!1}function df(i,r){return i.mesh&&i.instanceIndex!==-1?(i.mesh.getMatrixAt(i.instanceIndex,vn),vn.decompose(Xo,fl,Yo),Xo.z=r,vn.compose(Xo,fl,Yo),i.mesh.setMatrixAt(i.instanceIndex,vn),i.altitude=r,!0):!1}var cr,wr,gl=class{constructor(r){p(this,"rendererState");p(this,"dirty",!1);A(this,cr);A(this,wr);this.rendererState=r}updateOne(r){var e;if(r instanceof Te&&r.type==="geometry"&&((e=r.components[1])!=null&&e.dirty)&&(_(this,cr,r.components[0]),_(this,wr,r.components[1]),r.type==="geometry")){let t=!1;c(this,wr).height!==c(this,cr).currentHeight&&(t=hf(c(this,cr),c(this,wr).height,c(this,wr).initialHeight)),c(this,wr).altitude!==c(this,cr).altitude&&(t=df(c(this,cr),c(this,wr).altitude)),t&&c(this,cr).mesh!=null&&c(this,cr).mesh.computeBoundingSphere()}}update(){for(let r of this.rendererState.geometry3DsInScene)this.updateOne(r);this.cleanup()}cleanup(){_(this,cr,void 0),_(this,wr,void 0)}};cr=new WeakMap,wr=new WeakMap;v();var Cv={showPolygonLabelTextAreaMesh:!1,showEnvMap:!1,showCollisionBoxes:!1,showGeometryInFocus:!1,showImageLOD:!1,showModelInstancingStats:!1,showScreenOffsets:!1,showCameraTargets:!1},yl=class{constructor(r){p(this,"state",Cv);p(this,"core");this.core=r}update(r){let e={};for(let[t,n]of Object.entries(r))t in this.state&&this.state[t]!==r[t]&&(this.state[t]=n,e[t]=n);this.handleUpdate(e)}handleUpdate(r){r.showPolygonLabelTextAreaMesh!=null&&(r.showPolygonLabelTextAreaMesh?this.core.getSystems().text3DSystem.showTextAreaMesh():this.core.getSystems().text3DSystem.hideTextAreaMesh()),r.showEnvMap!=null&&(r.showEnvMap?this.core.setEnvironment("basic"):this.core.setEnvironment(!1)),r.showCollisionBoxes!=null&&(r.showCollisionBoxes?this.core.showCollisionBoxes():this.core.hideCollisionBoxes()),r.showGeometryInFocus!=null&&(r.showGeometryInFocus?this.core.getSystems().geometryInFocusSystem.showDebug():this.core.getSystems().geometryInFocusSystem.hideDebug()),r.showImageLOD!=null&&(this.core.getSystems().imageSystem.debugLOD=r.showImageLOD,this.core.render()),r.showModelInstancingStats!=null&&(r.showModelInstancingStats?this.core.getSystems().modelSystem.showDebug():this.core.getSystems().modelSystem.hideDebug()),r.showScreenOffsets!=null&&(r.showScreenOffsets?this.core.camera.showScreenOffsetsDebug():this.core.camera.hideScreenOffsetsDebug()),r.showCameraTargets!=null&&(r.showCameraTargets?this.core.camera.showCameraTargetsDebug():this.core.camera.hideCameraTargetsDebug())}};v();var $o=9,wv=!1,mf=.1;function Tv(i,r,e){for(let t=0;t<r;t++){let n=(e&16711680)>>16,o=(e&65280)>>8,s=e&255;i[t*3]=n/255,i[t*3+1]=o/255,i[t*3+2]=s/255}}var bl=class{constructor(r,e,t){p(this,"state");p(this,"renderer");p(this,"renderService");p(this,"pickingTexture");p(this,"pickingMaterial");p(this,"pixelBuffer");p(this,"width",0);p(this,"height",0);p(this,"scale",1/2);p(this,"color",1);p(this,"convertTo3DMapPosition");p(this,"destroyed",!1);p(this,"enabled",!1);p(this,"backgroundId",16777215);p(this,"resize",()=>{let r=this.state.pixelRatio;this.width=Math.floor(this.renderer.domElement.width/r*this.scale),this.height=Math.floor(this.renderer.domElement.height/r*this.scale),this.pixelBuffer=new Uint8Array(4*this.width*this.height),this.pickingTexture=new Ki(this.width,this.height,{format:Lh,type:Ih,internalFormat:"RGBA"})});p(this,"shouldShowByXY",(r,e,t)=>{if(this.pixelBuffer==null)return!1;let n=r+(this.height-e-1)*this.width,o=this.pixelBuffer[n*4],s=this.pixelBuffer[n*4+1],a=this.pixelBuffer[n*4+2],l=o<<16|s<<8|a;return l===t||l===this.backgroundId});p(this,"activeOccluders",new Set);p(this,"update",()=>{if(!this.enabled||this.destroyed||(this.activeOccluders.clear(),this.activeOccluders.add(this.backgroundId),!this.pickingTexture||!this.pixelBuffer))return;let r,e;for(let n of this.state.geometry3DsInScene)if((n==null?void 0:n.type)==="group-container"&&n.userData.occluderFeature!=null&&n.userData.occluderId!=null&&(this.activeOccluders.add(n.userData.occluderId),n.userData.occluderDirty)){if(r=n.userData.occluderFeature,r.geometry.type==="Polygon"&&r.geometry.coordinates.length>0){let o=ca(r,this.convertTo3DMapPosition,{color:"white",height:mf});e=this.createOccluderMesh(o,n.userData.occluderId),n.add(e)}else if(r.geometry.type==="MultiPolygon"){let o=ua(r,this.convertTo3DMapPosition,{color:"white",height:mf});e=this.createOccluderMesh(o,n.userData.occluderId),n==null||n.add(e)}n.userData.occluderDirty=!1}this.renderer.setRenderTarget(this.pickingTexture);let t=new me(this.backgroundId);this.renderer.setClearColor(t),this.renderer.clear(),this.state.cameraObject.layers.disableAll(),this.state.cameraObject.layers.enable($o),this.renderService.renderScene(this.state.geometryScene.parent,this.state.cameraObject),this.renderer.setRenderTarget(null),this.state.cameraObject.layers.disable($o),wv?this.renderService.enabledLayers.add($o):this.renderService.enabledLayers.delete($o),this.renderer.readRenderTargetPixelsAsync(this.pickingTexture,0,0,this.width,this.height,this.pixelBuffer).then(()=>{if(!this.destroyed)for(let n of this.state.geometry2DsInScene){let o=n==null?void 0:n.components[2];if(n&&(o==null?void 0:o.id)!=null&&this.activeOccluders.has(o.id)&&(o!=null&&o.enabled)){let s=n.components[0].projection,a=Math.floor(s.x*this.scale),l=Math.floor(s.y*this.scale),u=this.shouldShowByXY(a,l,o.id);n.components[0].isOccluded=!u}else n&&o&&!o.enabled&&(n.components[0].isOccluded=!1)}}).catch(n=>{this.destroyed||$.error(n)})});if(this.state=r,this.convertTo3DMapPosition=e,(t==null?void 0:t.renderer)==null)throw new Error("No Renderer");this.renderService=t,this.renderer=t.renderer,this.resize(),this.pickingMaterial=new Zt({glslVersion:_h,vertexShader:"\n attribute vec3 color;\n varying vec3 vColor;\n void main() {\n vColor = color;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }\n ",fragmentShader:"\n varying vec3 vColor;\n out vec4 fragColor;\n\n void main() {\n fragColor = vec4(vColor, 1.0);\n }\n "})}applyId(r,e){let t=r.attributes.position,n=new Float32Array(t.count*3);Tv(n,t.count,e),r.setAttribute("color",new It(n,3))}createOccluderMesh(r,e){let t=new pe(r,this.pickingMaterial);return t.layers.set($o),this.applyId(t.geometry,e),t.userData.occluderId=e,t}reserveOccluderId(){return this.color++,this.color}enable(){this.enabled=!0}disable(){this.enabled=!1}destroy(){var r;this.destroyed=!0,(r=this.pickingTexture)==null||r.dispose(),this.pickingMaterial.dispose(),this.pickingTexture=void 0,this.pixelBuffer=void 0}};v();var vl=class{constructor(r){this.state=r;p(this,"dirty",!0)}update(){var r;if(this.dirty){for(let e of this.state.geometry3DIdsInScene){let t=this.state.geometry3DMap.get(e);if(t instanceof Te&&t.type==="geometry"&&((r=t.components[0])==null?void 0:r.geometry)!=null){let n=t.components[0];n.geometry&&(n.geometry.dispose(),n.geometry=void 0)}}this.dirty=!1}}};v();var xl=class extends ye{constructor(e){super();p(this,"dirty",!0);p(this,"state");p(this,"texturePromiseCache",new Map);this.state=e}async loadTexture(e){if(this.texturePromiseCache.has(e))return this.texturePromiseCache.get(e);let t=new Promise((n,o)=>{dn.getLoader().load(e,n,void 0,o)});return this.texturePromiseCache.set(e,t),t}update(){for(let e of this.state.geometry3DsInScene){if(!(e instanceof Te))continue;let t=e.components[6];if(!(t instanceof Ln))continue;let n=e.components[0];if(!(n instanceof Qe)||!t.dirty)continue;let o=so(n);o!=null&&(t.texture!=null&&(t.texture.path===""?(o.texture=null,o.hideTextures(n.instanceIndex),t.dirty=!1):this.loadTexture(t.texture.path).then(s=>{s&&(t.textureInstance=s,o.texture=s,o.blendTexture=!0,o.showTextures(n.instanceIndex)),this.publish("texture-added")})),t.topTexture!=null&&(t.topTexture.path===""?(o.topTexture=null,o.hideTextures(n.instanceIndex),t.dirty=!1):this.loadTexture(t.topTexture.path).then(s=>{s&&(t.topTextureInstance=s,o.topTexture=s,o.blendTexture=!0,o.showTextures(n.instanceIndex)),this.publish("texture-added")})),t.dirty=!1)}}destroy(){this.texturePromiseCache.forEach(async e=>{(await e).dispose()}),this.texturePromiseCache.clear()}};v();var Sl=class{constructor(r){p(this,"currentOrder",Je.ALWAYS_ON_TOP_MODELS);p(this,"assignedOrders",new WeakMap);p(this,"state");this.state=r}assignOrder(r){return this.assignedOrders.has(r)?this.assignedOrders.get(r):(this.currentOrder+=1,this.assignedOrders.set(r,this.currentOrder),this.currentOrder)}releaseOrder(r){return this.assignedOrders.delete(r),Je.GEOMETRY}getHighestOrder(){return this.currentOrder}getOrder(r){return this.assignedOrders.get(r)}update(){let r,e;for(let t of this.state.geometry3DsInScene)if(t&&t.type==="model"&&(r=t.components[1],r!=null&&r.renderOrderDirty)){if(e=t.components[0],!e.mesh)continue;if(e.visibleThroughGeometry=r.visibleThroughGeometry,r.visibleThroughGeometry===!0){let n=this.assignOrder(e);e.renderOrder=n,this.applyRenderOrder(e)}else e.renderOrder>Je.GEOMETRY&&(e.renderOrder=this.releaseOrder(e),this.applyRenderOrder(e));r.renderOrderDirty=!1}}applyRenderOrder(r){var n;if(!r.mesh)return;let e=r.renderOrder,t=r.visibleThroughGeometry;if(r.mesh.children[0]instanceof Pe){r.mesh.renderOrder=e;for(let s of r.mesh.children)s instanceof Pe&&(s.renderOrder=e);if((n=r.mesh.userData)==null?void 0:n.detached)for(let s of r.mesh.children)s instanceof Pe&&(Array.isArray(s.material)?s.material.forEach(a=>{a.depthWrite=!t,a.depthTest=!t,t&&(a.transparent=!0),a.needsUpdate=!0}):(s.material.depthWrite=!t,s.material.depthTest=!t,t&&(s.material.transparent=!0),s.material.needsUpdate=!0))}else r.mesh.traverse(o=>{let s=o;"isMesh"in s&&s.isMesh===!0&&s.material&&(s.renderOrder=e,Array.isArray(s.material)?s.material.forEach(a=>{a.depthWrite=!t,a.depthTest=!t,t&&(a.transparent=!0),a.needsUpdate=!0}):(s.material.depthWrite=!t,s.material.depthTest=!t,t&&(s.material.transparent=!0),s.material.needsUpdate=!0))})}};v();var El=class El{constructor(r){p(this,"state");this.state=r}applyMask(r,e,t){this.disableMask(r,e),t.mode==="mask"&&t.maskId!=null&&t.enabled?this.enableMaskProducer(r,e,t):t.mode==="masked-object"&&t.maskId!=null&&t.enabled&&this.enableMaskReciever(r,t)}update(){let r;for(let e of this.state.geometry3DsInScene)(e==null?void 0:e.type)==="geometry-group"&&(!Ro(e,this.state)||Ao(e)&&Ro(e,this.state))&&(r=e.components[0],r!=null&&r.dirty&&(e.traverse(t=>{(t instanceof pe||t instanceof mi)&&t.material instanceof Bh&&r!=null&&!t.userData.detached&&(this.disableMask(t.material,t),this.applyMask(t.material,t,r))}),r.dirty=!1))}enableMaskProducer(r,e,t){r.stencilWrite=!0,r.colorWrite=!1,r.stencilRef=t.maskId,r.stencilFunc=ci,r.stencilZPass=Wt,r.stencilZFail=it,r.stencilFail=it,r.needsUpdate=!0,r.depthWrite=!1,e.userData.originalTransparent===void 0&&(e.userData.originalTransparent=r.transparent),r.transparent=!1,e.layers.disableAll(),e.layers.set(Je.GEOMETRY),e.userData.originalRenderOrder===void 0&&(e.userData.originalRenderOrder=e.renderOrder),e.renderOrder=El.MASK_RENDER_ORDER}enableMaskReciever(r,e){r.stencilWrite=!0,r.stencilRef=e.maskId,r.stencilFunc=e.effect==="reveal"?Rh:Lr,r.stencilZPass=it,r.stencilZFail=it,r.stencilFail=it,r.needsUpdate=!0}disableMask(r,e){r.stencilWrite=!1,r.colorWrite=!0,e.userData.originalTransparent!==void 0&&(r.transparent=e.userData.originalTransparent,delete e.userData.originalTransparent),r.needsUpdate=!0,e.layers.disableAll(),e.layers.set(Je.GEOMETRY),e.userData.originalRenderOrder!==void 0&&(e.renderOrder=e.userData.originalRenderOrder,delete e.userData.originalRenderOrder)}};p(El,"MASK_RENDER_ORDER",-1e3);var Ml=El;v();var pf=1e4,Cl=class{constructor(r){p(this,"rendererState");p(this,"dirty",!1);this.rendererState=r}update(){var n;let r,e,t;for(let o of this.rendererState.geometry3DsInScene)if(e=o.components[0],t=o.components[1],r=o.components[7],o.type==="model"&&r!=null&&(t!=null&&t.EXPERIMENTAL_clippingEnabled)&&(r.dirty&&e.mesh!=null&&(r.plane==null&&(r.plane=new zh(new k(0,0,-1),r.verticalOffset),this.process(e,r)),r.plane.constant!==r.verticalOffset&&(r.plane.constant=r.verticalOffset),r.topColor!=null&&((n=r.holeFillMesh)==null?void 0:n.material)instanceof eo&&r.holeFillMesh.material.color.set(r.topColor),r.topVisible!=null&&r.holeFillMesh!=null&&(r.holeFillMesh.visible=r.topVisible),r.dirty=!1),r.plane!=null&&r.holeFillMesh!=null&&r.topVisible===!0)){let s=r.plane,a=r.holeFillMesh;s.coplanarPoint(a.position),a.lookAt(a.position.x-s.normal.x,a.position.y-s.normal.y,a.position.z-s.normal.z)}}process(r,e){var d;if(r.mesh==null)return;let t=r.mesh.parent,n=[];r.mesh.traverse(f=>{var b;if(f instanceof pe){let x=f.geometry.clone();if(f instanceof Pe){let y=(b=r.instanceIndex)!=null?b:0,g=new we;f.getMatrixAt(y,g),x.applyMatrix4(g)}else f.updateWorldMatrix(!0,!1),x.applyMatrix4(f.matrixWorld);n.push(x),x.computeVertexNormals(),f.material.clippingPlanes=[e.plane]}});let o=Xt(n),s=new Rs,a=new Rs,l=new vt(pf,pf),u=this.createHoleFillGeometry(o,l,e.plane,1);u.name="hole-fill-group";let m=new eo({color:(d=e.topColor)!=null?d:"#E67B5B",clippingPlanes:[],stencilWrite:!0,stencilRef:_r.CLIPPING_BASELINE,stencilFunc:Lr,stencilFail:Wt,stencilZFail:Wt,stencilZPass:Wt}),h=new pe(l,m);h.name="hole-fill-mesh",e.holeFillMesh=h,h.renderOrder=1.1,a.add(u),a.add(r.mesh),s.add(a),s.add(h),t==null||t.add(s),r.mesh=s}createHoleFillGeometry(r,e,t,n=0){let o=new Rs,s=new Pt;s.depthWrite=!1,s.depthTest=!1,s.colorWrite=!1,s.stencilWrite=!0,s.stencilFunc=ci;let a=s.clone();a.side=br,a.stencilRef=_r.CLIPPING_BASELINE,a.stencilFail=Wt,a.stencilZFail=Wt,a.stencilZPass=Wt;let l=new pe(e,a);l.renderOrder=n-.1,o.add(l);let u=s.clone();u.side=Th,u.clippingPlanes=[t],u.stencilFail=Ls,u.stencilZFail=Ls,u.stencilZPass=Ls;let m=new pe(r,u);m.renderOrder=n,o.add(m);let h=s.clone();h.side=Os,h.clippingPlanes=[t],h.stencilFail=As,h.stencilZFail=As,h.stencilZPass=As;let d=new pe(r,h);return d.renderOrder=n,o.add(d),o}};v();var wl=class{constructor(){p(this,"plugins",new Set)}registerPlugin(r){this.plugins.add(r)}unregisterPlugin(r){this.plugins.delete(r)}update(r){for(let e of this.plugins)e.update(r)}};v();var Tl=class{constructor(r){p(this,"type","occlusion2d");p(this,"enabled",!0);p(this,"id");this.id=r}};v();v();v();var ff="varying vec4 vWorldPosition;\n\nvoid main() {\n vWorldPosition = modelMatrix * vec4(position, 1.0);\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}\n\n";v();var Gu="uniform sampler2D shadowMap;\nuniform mat4 lightMatrix;\nuniform float shadowBias;\nuniform float shadowOpacity;\nuniform vec3 baseColor;\nuniform float shadowMapSize;\nuniform float pcfSpread;\nuniform float depthRangeMax;\nuniform bool shadowEnabled;\nvarying vec4 vWorldPosition;\nfloat shadowThreshold = 0.05;\nfloat shadowStrengthMultiplier = 0.6;\n\n/**\n * Interleaved gradient noise for temporal/spatial dithering of shadow samples\n */\nfloat interleavedGradientNoise(vec2 position) {\n vec3 magic = vec3(0.06711056, 0.00583715, 52.9829189);\n return fract(magic.z * fract(dot(position, magic.xy)));\n}\n\n// Compile-time sample count for loop unrolling (injected via material)\n#ifndef PCF_SAMPLES\n#define PCF_SAMPLES 4\n#endif\n\n// Poisson disk samples - only define what we need based on sample count\n#if PCF_SAMPLES <= 4\nconst vec2 poissonDisk[4] = vec2[](\n vec2(-0.94201624, -0.39906216),\n vec2(0.94558609, -0.76890725),\n vec2(-0.094184101, -0.92938870),\n vec2(0.34495938, 0.29387760)\n);\n#elif PCF_SAMPLES <= 8\nconst vec2 poissonDisk[8] = vec2[](\n vec2(-0.94201624, -0.39906216),\n vec2(0.94558609, -0.76890725),\n vec2(-0.094184101, -0.92938870),\n vec2(0.34495938, 0.29387760),\n vec2(-0.91588581, 0.45771432),\n vec2(-0.81544232, -0.87912464),\n vec2(-0.38277543, 0.27676845),\n vec2(0.97484398, 0.75648379)\n);\n#else\nconst vec2 poissonDisk[16] = vec2[](\n vec2(-0.94201624, -0.39906216),\n vec2(0.94558609, -0.76890725),\n vec2(-0.094184101, -0.92938870),\n vec2(0.34495938, 0.29387760),\n vec2(-0.91588581, 0.45771432),\n vec2(-0.81544232, -0.87912464),\n vec2(-0.38277543, 0.27676845),\n vec2(0.97484398, 0.75648379),\n vec2(0.44323325, -0.97511554),\n vec2(0.53742981, -0.47373420),\n vec2(-0.26496911, -0.41893023),\n vec2(0.79197514, 0.19090188),\n vec2(-0.24188840, 0.99706507),\n vec2(-0.81409955, 0.91437590),\n vec2(0.19984126, 0.78641367),\n vec2(0.14383161, -0.14100790)\n);\n#endif\n\n/**\n * Samples the shadow map using PCF (Percentage Closer Filtering)\n * Uses compile-time loop count for GPU optimization\n * @param lightSpacePos Position in light space coordinates\n * @returns Visibility factor (1.0 = fully lit, 0.0 = fully shadowed)\n */\nfloat sampleShadow(vec3 lightSpacePos) {\n float scaledTexelSize = (1.0 / shadowMapSize) * pcfSpread;\n float currentDepth = lightSpacePos.z * depthRangeMax;\n \n // Rotation for temporal stability\n float noise = interleavedGradientNoise(gl_FragCoord.xy) * 6.283185;\n float cosNoise = cos(noise);\n float sinNoise = sin(noise);\n mat2 rotation = mat2(cosNoise, -sinNoise, sinNoise, cosNoise);\n \n float shadow = 0.0;\n \n // Compile-time unrolled loop - GPU can optimize this efficiently\n for(int i = 0; i < PCF_SAMPLES; i++) {\n vec2 offset = rotation * poissonDisk[i] * scaledTexelSize;\n vec2 uv = clamp(lightSpacePos.xy + offset, 0.0, 1.0);\n \n float sampledDepth = texture2D(shadowMap, uv).r;\n shadow += step(sampledDepth + shadowBias, currentDepth);\n }\n \n return 1.0 - shadow / float(PCF_SAMPLES);\n}\n\nvoid main() {\n if (shadowEnabled) {\n // Transform world position to light space\n vec4 shadowCoord = lightMatrix * vWorldPosition;\n vec3 projCoords = shadowCoord.xyz / shadowCoord.w;\n \n // Check if fragment is within shadow map bounds\n bool inBounds = projCoords.x >= 0.0 && projCoords.x <= 1.0 && \n projCoords.y >= 0.0 && projCoords.y <= 1.0 && \n projCoords.z >= 0.0 && projCoords.z <= 1.0;\n \n if (inBounds) { \n float visibility = sampleShadow(projCoords);\n float shadowIntensity = 1.0 - visibility;\n \n if (shadowIntensity > shadowThreshold) {\n float shadowStrength = shadowIntensity * shadowOpacity * shadowStrengthMultiplier;\n gl_FragColor = vec4(baseColor, shadowStrength);\n }\n }\n }\n}\n\n";var Dl=class extends Zt{constructor(){super({vertexShader:ff,fragmentShader:"#define PCF_SAMPLES 4\n"+Gu,uniforms:{shadowMap:{value:null},lightMatrix:{value:new we},shadowBias:{value:8e-5},shadowOpacity:{value:.25},baseColor:{value:new me(8421504)},shadowMapSize:{value:4096},pcfSpread:{value:3.5},depthRangeMax:{value:1},shadowEnabled:{value:!1}},transparent:!0,depthWrite:!1,side:br,stencilWrite:!0,stencilFunc:Lr,stencilRef:_r.UNDERGROUND_MASK,stencilFail:it,stencilZFail:it,stencilZPass:it});p(this,"pcfSampleCount",4)}setShadowUniforms(e,t,n,o,s,a,l,u,m,h){this.uniforms.shadowMap.value=e,this.uniforms.lightMatrix.value.copy(t),this.uniforms.shadowBias.value=n,this.uniforms.shadowOpacity.value=o,this.uniforms.baseColor.value=s,this.uniforms.shadowMapSize.value=a,this.uniforms.pcfSpread.value=l,this.uniforms.depthRangeMax.value=m,this.uniforms.shadowEnabled.value=h,u!==this.pcfSampleCount&&(this.pcfSampleCount=u,this.fragmentShader="#define PCF_SAMPLES ".concat(u,"\n")+Gu,this.needsUpdate=!0)}};var Jt={enabled:!0,debug:!1,baseColor:"#a0a0a0",shadowOpacity:.25,pcfSamples:4,pcfSpread:3,shadowBias:.001,normalBias:.12,shadowMapSize:"auto",sunAzimuth:225,sunElevation:45,visibleAtZoomLevel:18},gf=1e4,Pv=-.05,Iv=999,Ov=4096,Lv=2048,Av=20.5,Rv=19.5,yf=.1,_v=400,Fv=-200,Gv=50,Nv=100,Bv=-50,kv=40,Bi=15,Vr=22,zv=100,Uv=5,Hv=50,Vv=50,Wv=40,jv=5,Zv=.5,Nu=1,bf=1,Xv=5,st=256,Yv=65535,$v=.5,Pl=.1,qv=1e3,Jv=16737792,Qv=.2,vf=.2,Kv=1001,e0=8900331,Bu=!0,Il=class{constructor(r,e,t,n){p(this,"state");p(this,"rendererService");p(this,"depthMaterial");p(this,"cameraOrbit");p(this,"lightCamera");p(this,"shadowRenderTarget");p(this,"lightMatrix",new we);p(this,"currentSnapX",0);p(this,"currentSnapY",0);p(this,"shadowCenter",new k);p(this,"shadowPlane",null);p(this,"shadowPlaneMaterial",null);p(this,"shadowPlaneEnabled",!0);p(this,"visibleAtCurrentZoom",!0);p(this,"zoomOpacityFactor",1);p(this,"lightCameraHelper",null);p(this,"debugEnabled",!1);p(this,"debugGrid",null);p(this,"debugCurrentCell",null);p(this,"debugCurrentCellMaterial",null);p(this,"debugCanvas",null);p(this,"debugCanvasCtx",null);p(this,"debugRenderTarget",null);p(this,"debugDepthMaterial",null);p(this,"debugDepthQuad",null);p(this,"debugDepthScene",null);p(this,"debugDepthCamera",null);p(this,"options");p(this,"internal");p(this,"shadowResolutionSizes",{high:Ov,low:Lv});p(this,"shadowResolutionZoomThresholds",{high:Av,low:Rv});p(this,"debugPixelBuffer",null);p(this,"bias",new we().set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1));p(this,"matrix",new we);p(this,"transparentGeometryVisibilityStateMap",new Map);p(this,"lastZoomLevel",null);p(this,"lastCameraElevation",null);p(this,"needsRender",!0);p(this,"needsCompute",!0);var s,a,l,u,m,h,d,f,b,x,y,g;this.state=r,this.cameraOrbit=t,this.rendererService=e,this.options=Object.freeze({enabled:(s=n==null?void 0:n.enabled)!=null?s:Jt.enabled,debug:(a=n==null?void 0:n.debug)!=null?a:Jt.debug,baseColor:(l=n==null?void 0:n.baseColor)!=null?l:Jt.baseColor,shadowOpacity:(u=n==null?void 0:n.shadowOpacity)!=null?u:Jt.shadowOpacity,pcfSamples:(m=n==null?void 0:n.pcfSamples)!=null?m:Jt.pcfSamples,pcfSpread:(h=n==null?void 0:n.pcfSpread)!=null?h:Jt.pcfSpread,shadowBias:(d=n==null?void 0:n.shadowBias)!=null?d:Jt.shadowBias,normalBias:(f=n==null?void 0:n.normalBias)!=null?f:Jt.normalBias,shadowMapSize:(b=n==null?void 0:n.shadowMapSize)!=null?b:Jt.shadowMapSize,sunAzimuth:(x=n==null?void 0:n.sunAzimuth)!=null?x:Jt.sunAzimuth,sunElevation:(y=n==null?void 0:n.sunElevation)!=null?y:Jt.sunElevation,visibleAtZoomLevel:(g=n==null?void 0:n.visibleAtZoomLevel)!=null?g:Jt.visibleAtZoomLevel});let o=this.options.shadowMapSize==="auto"?this.shadowResolutionSizes.high:this.options.shadowMapSize;this.internal={baseColor:new me(this.options.baseColor),lightOrthoSize:Gv,sunDistance:Nv,groundZPosition:Bv,snapGridSize:kv,currentShadowMapSize:o,currentShadowResolutionMode:(this.options.shadowMapSize==="auto",null),sunDirection:new k,sunAzimuth:this.options.sunAzimuth,sunElevation:this.options.sunElevation},this.updateSunDirection(),this.lightCamera=new vc(-this.internal.lightOrthoSize,this.internal.lightOrthoSize,this.internal.lightOrthoSize,-this.internal.lightOrthoSize,yf,_v),this.lightCamera.layers.disableAll(),this.lightCamera.layers.enable(Ot.SHOULD_CAST_SHADOWS),this.lightCamera.position.copy(this.internal.sunDirection.clone().multiplyScalar(Fv)),this.lightCamera.lookAt(new k(0,0,0)),this.lightCamera.updateMatrixWorld(),this.lightCamera.updateProjectionMatrix(),this.shadowRenderTarget=this.createShadowRenderTarget(o),this.depthMaterial=new Xh,this.depthMaterial.depthPacking=Ah,this.depthMaterial.blending=Dh,this.createShadowPlane(),this.options.debug&&this.setDebugEnabled(!0)}createShadowRenderTarget(r){let e=new Ki(r,r);return e.texture.minFilter=Qi,e.texture.magFilter=Qi,e.texture.generateMipmaps=!1,e.depthBuffer=!0,e.stencilBuffer=!1,e.depthTexture=new Hh(r,r,Oh),e}resizeShadowRenderTarget(r){this.shadowRenderTarget.setSize(r,r),this.shadowRenderTarget.depthTexture&&(this.shadowRenderTarget.depthTexture.image.width=r,this.shadowRenderTarget.depthTexture.image.height=r,this.shadowRenderTarget.depthTexture.needsUpdate=!0)}createShadowPlane(){let r=new vt(gf,gf);r.rotateX(0),this.shadowPlaneMaterial=new Dl,this.shadowPlane=new pe(r,this.shadowPlaneMaterial),this.shadowPlane.position.set(0,0,Pv),this.shadowPlane.renderOrder=Iv,this.shadowPlane.frustumCulled=!1,this.shadowPlane.name="ShadowPlane",this.shadowPlaneEnabled&&this.state.threeJSScene.add(this.shadowPlane)}setShadowPlaneEnabled(r){this.shadowPlaneEnabled!==r&&(this.shadowPlaneEnabled=r,this.shadowPlane&&(r?this.state.threeJSScene.add(this.shadowPlane):this.state.threeJSScene.remove(this.shadowPlane)))}isShadowPlaneEnabled(){return this.shadowPlaneEnabled}updateShadowPlanePosition(){this.shadowPlane&&(this.shadowPlane.position.x=this.shadowCenter.x,this.shadowPlane.position.y=this.shadowCenter.y)}setDebugEnabled(r){this.debugEnabled!==r&&(this.debugEnabled=r,r?this.createDebugHelpers():this.disposeDebugHelpers())}isDebugEnabled(){return this.debugEnabled}createDebugHelpers(){this.debugEnabled=!0,!this.lightCameraHelper&&this.lightCamera&&(this.lightCameraHelper=new qh(this.lightCamera),this.lightCameraHelper.name="ShadowLightCameraHelper",this.state.threeJSScene.add(this.lightCameraHelper)),this.createDebugGrid(),this.createDebugCurrentCell(),this.createDebugCanvas()}createDebugGrid(){if(this.debugGrid)return;let r=this.internal.snapGridSize,e=Xv,t=r*e*2,n=[];for(let a=-e;a<=e;a++){let l=a*r;n.push(l,-t/2,Pl),n.push(l,t/2,Pl)}for(let a=-e;a<=e;a++){let l=a*r;n.push(-t/2,l,Pl),n.push(t/2,l,Pl)}let o=new tn;o.setAttribute("position",new In(n,3));let s=new Fs({color:Yv,transparent:!0,opacity:$v,depthTest:!1});this.debugGrid=new mi(o,s),this.debugGrid.name="ShadowDebugGrid",this.debugGrid.renderOrder=qv,this.debugGrid.frustumCulled=!1,this.state.threeJSScene.add(this.debugGrid)}createDebugCurrentCell(){if(this.debugCurrentCell)return;let r=this.internal.snapGridSize,e=new vt(r,r);this.debugCurrentCellMaterial=new Pt({color:Jv,transparent:!0,opacity:Qv,depthTest:!1,side:2}),this.debugCurrentCell=new pe(e,this.debugCurrentCellMaterial),this.debugCurrentCell.name="ShadowDebugCurrentCell",this.debugCurrentCell.renderOrder=Kv,this.debugCurrentCell.frustumCulled=!1,this.debugCurrentCell.position.set(this.currentSnapX+r/2,this.currentSnapY+r/2,vf),this.state.threeJSScene.add(this.debugCurrentCell)}createDebugCanvas(){if(this.debugCanvas)return;this.debugCanvas=document.createElement("canvas"),this.debugCanvas.width=st,this.debugCanvas.height=st,this.debugCanvas.style.cssText="\n position: fixed;\n bottom: 16px;\n transform: rotate(-270deg);\n left: 16px;\n width: ".concat(st,"px;\n height: ").concat(st,"px;\n border: 2px solid #00ffff;\n border-radius: 4px;\n background: #000;\n z-index: 9999;\n pointer-events: none;\n ");let r=document.createElement("div");if(r.textContent=Bu?"Shadow Depth Map":"Light Camera View",r.style.cssText="\n position: fixed;\n bottom: ".concat(st+20,"px;\n left: 16px;\n color: #00ffff;\n font-family: monospace;\n font-size: 12px;\n z-index: 9999;\n pointer-events: none;\n "),r.id="shadow-debug-label",document.body.appendChild(this.debugCanvas),document.body.appendChild(r),this.debugCanvasCtx=this.debugCanvas.getContext("2d"),this.debugRenderTarget=new Ki(st,st),this.debugRenderTarget.texture.minFilter=Qi,this.debugRenderTarget.texture.magFilter=Qi,Bu){this.debugDepthMaterial=new Zt({uniforms:{depthTexture:{value:this.shadowRenderTarget.depthTexture}},vertexShader:"\n varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }\n ",fragmentShader:"\n uniform sampler2D depthTexture;\n varying vec2 vUv;\n void main() {\n float depth = texture2D(depthTexture, vUv).r;\n // Invert so near is bright, far is dark\n gl_FragColor = vec4(vec3(1.0 - depth), 1.0);\n }\n "});let e=new vt(2,2);this.debugDepthQuad=new pe(e,this.debugDepthMaterial),this.debugDepthScene=new Rr,this.debugDepthScene.add(this.debugDepthQuad),this.debugDepthCamera=new vc(-1,1,1,-1,0,1)}}updateDebugCanvas(){if(!this.debugCanvas||!this.debugCanvasCtx||!this.rendererService.renderer||!this.debugRenderTarget)return;let r=this.rendererService.renderer,e=st*st*4;(!this.debugPixelBuffer||this.debugPixelBuffer.length!==e)&&(this.debugPixelBuffer=new Uint8Array(e)),Bu&&this.debugDepthScene&&this.debugDepthCamera&&this.debugDepthMaterial?(this.debugDepthMaterial.uniforms.depthTexture.value=this.shadowRenderTarget.depthTexture,r.setRenderTarget(this.debugRenderTarget),r.clear(),r.render(this.debugDepthScene,this.debugDepthCamera),r.setRenderTarget(null)):(r.setRenderTarget(this.debugRenderTarget),r.setClearColor(e0,1),r.clear(),r.render(this.state.threeJSScene,this.lightCamera),r.setRenderTarget(null)),r.readRenderTargetPixels(this.debugRenderTarget,0,0,st,st,this.debugPixelBuffer);let t=this.debugCanvasCtx.createImageData(st,st),n=t.data,o,s;for(let a=0;a<st;a++)for(let l=0;l<st;l++)o=((st-1-a)*st+l)*4,s=(a*st+l)*4,n[s]=this.debugPixelBuffer[o],n[s+1]=this.debugPixelBuffer[o+1],n[s+2]=this.debugPixelBuffer[o+2],n[s+3]=255;this.debugCanvasCtx.putImageData(t,0,0)}disposeDebugHelpers(){this.lightCameraHelper&&(this.state.threeJSScene.remove(this.lightCameraHelper),this.lightCameraHelper.dispose(),this.lightCameraHelper=null),this.debugGrid&&(this.state.threeJSScene.remove(this.debugGrid),this.debugGrid.geometry.dispose(),this.debugGrid.material.dispose(),this.debugGrid=null),this.debugCurrentCell&&(this.state.threeJSScene.remove(this.debugCurrentCell),this.debugCurrentCell.geometry.dispose(),this.debugCurrentCell=null),this.debugCurrentCellMaterial&&(this.debugCurrentCellMaterial.dispose(),this.debugCurrentCellMaterial=null),this.debugCanvas&&(this.debugCanvas.remove(),this.debugCanvas=null,this.debugCanvasCtx=null),this.debugPixelBuffer=null,this.debugRenderTarget&&(this.debugRenderTarget.dispose(),this.debugRenderTarget=null),this.debugDepthQuad&&(this.debugDepthQuad.geometry.dispose(),this.debugDepthQuad=null),this.debugDepthMaterial&&(this.debugDepthMaterial.dispose(),this.debugDepthMaterial=null),this.debugDepthScene=null,this.debugDepthCamera=null;let r=document.getElementById("shadow-debug-label");r&&r.remove()}updateDebugHelpers(){if(this.debugEnabled&&(this.lightCameraHelper&&this.lightCameraHelper.update(),this.debugGrid&&this.debugGrid.position.set(this.currentSnapX,this.currentSnapY,0),this.debugCurrentCell)){let r=this.internal.snapGridSize;this.debugCurrentCell.position.set(this.currentSnapX+r/2,this.currentSnapY+r/2,vf)}}updateSunDirection(){let r=this.internal.sunAzimuth*Math.PI/180,e=this.internal.sunElevation*Math.PI/180,t=Math.cos(e);this.internal.sunDirection.set(t*Math.sin(r),t*Math.cos(r),-Math.sin(e)),this.internal.sunDirection.normalize()}updateLightCamera(){this.lightCamera&&(this.lightCamera.left=-this.internal.lightOrthoSize,this.lightCamera.right=this.internal.lightOrthoSize,this.lightCamera.top=this.internal.lightOrthoSize,this.lightCamera.bottom=-this.internal.lightOrthoSize,this.lightCamera.updateProjectionMatrix())}updateLightMatrix(){this.lightCamera.position.copy(this.shadowCenter).add(this.internal.sunDirection.clone().multiplyScalar(-this.internal.sunDistance)),this.lightCamera.lookAt(this.shadowCenter),this.lightCamera.near=yf,this.lightCamera.far=this.internal.sunDistance*2,this.lightCamera.left=-this.internal.lightOrthoSize,this.lightCamera.right=this.internal.lightOrthoSize,this.lightCamera.top=this.internal.lightOrthoSize,this.lightCamera.bottom=-this.internal.lightOrthoSize,this.lightCamera.updateMatrixWorld(!0),this.lightCamera.updateProjectionMatrix(),this.matrix.identity(),this.matrix.multiplyMatrices(this.lightCamera.projectionMatrix,this.lightCamera.matrixWorldInverse),this.lightMatrix.multiplyMatrices(this.bias,this.matrix)}updateAutoSunDistance(r,e){let t=Math.max(Bi,Math.min(Vr,r)),n=(Vr-t)/(Vr-Bi),o=Math.max(e,zv*Math.pow(Uv,n));Math.abs(this.internal.sunDistance-o)>Nu&&(this.internal.sunDistance=o,this.updateSunDirection(),this.needsRender=!0)}updateAutoShadowResolution(r){if(this.options.shadowMapSize!=="auto")return;let e=this.internal.currentShadowResolutionMode;if(this.internal.currentShadowResolutionMode===null?r>=this.shadowResolutionZoomThresholds.high?e="high":e="low":this.internal.currentShadowResolutionMode==="low"?r>=this.shadowResolutionZoomThresholds.high&&(e="high"):this.internal.currentShadowResolutionMode==="high"&&r<=this.shadowResolutionZoomThresholds.low&&(e="low"),e!==this.internal.currentShadowResolutionMode&&e!==null){let t=this.shadowResolutionSizes[e];this.internal.currentShadowResolutionMode=e,this.internal.currentShadowMapSize=t,this.resizeShadowRenderTarget(t),this.needsRender=!0}}updateAutoLightSize(r,e){let t=Math.max(Bi,Math.min(Vr,r)),n=(Vr-t)/(Vr-Bi),o=Math.max(e,Hv*Math.pow(Vv,n));Math.abs(this.internal.lightOrthoSize-o)>Nu&&(this.internal.lightOrthoSize=o,this.updateLightCamera(),this.needsRender=!0)}updateZoomVisibility(r){let e=this.options.visibleAtZoomLevel-bf,t=this.options.visibleAtZoomLevel,n;r>=t?n=1:r<=e?n=0:n=(r-e)/bf;let o=n>0;(o!==this.visibleAtCurrentZoom||n!==this.zoomOpacityFactor)&&(this.visibleAtCurrentZoom=o,this.zoomOpacityFactor=n,this.needsRender=!0)}isVisibleAtCurrentZoom(){return this.visibleAtCurrentZoom}updateAutoSnapGridSize(r){let e=Math.max(Bi,Math.min(Vr,r)),t=(Vr-e)/(Vr-Bi),n=Wv*Math.pow(jv,t);Math.abs(this.internal.snapGridSize-n)>Nu&&(this.internal.snapGridSize=n,this.debugEnabled&&this.recreateDebugGrid())}recreateDebugGrid(){this.debugGrid&&(this.state.threeJSScene.remove(this.debugGrid),this.debugGrid.geometry.dispose(),this.debugGrid.material.dispose(),this.debugGrid=null),this.debugCurrentCell&&(this.state.threeJSScene.remove(this.debugCurrentCell),this.debugCurrentCell.geometry.dispose(),this.debugCurrentCell=null),this.createDebugGrid(),this.createDebugCurrentCell()}renderShadowMap(){var e,t;let r=this.state.threeJSScene.overrideMaterial;this.state.threeJSScene.overrideMaterial=this.depthMaterial,(e=this.rendererService.renderer)==null||e.setRenderTarget(this.shadowRenderTarget),this.rendererService.clear(),this.rendererService.renderScene(this.state.threeJSScene,this.lightCamera),(t=this.rendererService.renderer)==null||t.setRenderTarget(null),this.state.threeJSScene.overrideMaterial=r,this.debugEnabled&&this.updateDebugCanvas()}updateShadowUniforms(){var n;let r=this.options.enabled&&this.visibleAtCurrentZoom,e=this.options.shadowOpacity*this.zoomOpacityFactor,t;for(let o of this.state.geometry3DsInScene)if(t=o.components[0],t!=null&&t.mesh&&((n=t==null?void 0:t.mesh)==null?void 0:n.material)instanceof wc){let s=t.mesh.material;s instanceof wc&&s.setShadowUniforms(this.shadowRenderTarget.depthTexture,this.lightMatrix,this.lightCamera.near,this.lightCamera.far,this.options.shadowBias,e,this.internal.baseColor,this.internal.currentShadowMapSize,this.options.pcfSpread,this.options.pcfSamples,this.internal.sunDirection,this.options.normalBias,this.state.depthRangeFor3D[1],r)}this.shadowPlaneMaterial&&this.shadowPlaneMaterial.setShadowUniforms(this.shadowRenderTarget.depthTexture,this.lightMatrix,this.options.shadowBias,e,this.internal.baseColor,this.internal.currentShadowMapSize,this.options.pcfSpread,this.options.pcfSamples,this.state.depthRangeFor3D[1],r)}zoomOrElevationChanged(r,e){if(this.lastZoomLevel===null||this.lastCameraElevation===null)return this.lastZoomLevel=r,this.lastCameraElevation=e,!0;let t=Math.abs(r-this.lastZoomLevel)>=Zv,n=e!==this.lastCameraElevation;return t||n?(this.lastZoomLevel=r,this.lastCameraElevation=e,!0):!1}updateSnap(){let r=this.cameraOrbit.position.x||0,e=this.cameraOrbit.position.y||0,t=Math.floor(r/this.internal.snapGridSize)*this.internal.snapGridSize,n=Math.floor(e/this.internal.snapGridSize)*this.internal.snapGridSize;(t!==this.currentSnapX||n!==this.currentSnapY)&&(this.currentSnapX=t,this.currentSnapY=n,this.shadowCenter.set(t,n,this.internal.groundZPosition),this.needsRender=!0)}update(r,e){this.updateZoomVisibility(r),(this.needsCompute||this.zoomOrElevationChanged(r,e))&&(this.updateAutoShadowResolution(r),this.updateAutoLightSize(r,e),this.updateAutoSunDistance(r,e),this.updateAutoSnapGridSize(r)),this.updateSnap(),this.needsRender&&(this.updateLightMatrix(),this.visibleAtCurrentZoom&&this.renderShadowMap(),this.updateShadowPlanePosition(),this.updateShadowUniforms()),this.updateDebugHelpers(),this.needsRender=!1,this.needsCompute=!1}destroy(){this.disposeDebugHelpers(),this.shadowPlane&&(this.state.threeJSScene.remove(this.shadowPlane),this.shadowPlane.geometry.dispose(),this.shadowPlane=null),this.shadowPlaneMaterial&&(this.shadowPlaneMaterial.dispose(),this.shadowPlaneMaterial=null),this.shadowRenderTarget&&(this.shadowRenderTarget.dispose(),this.shadowRenderTarget.depthTexture&&this.shadowRenderTarget.depthTexture.dispose()),this.depthMaterial&&this.depthMaterial.dispose(),this.transparentGeometryVisibilityStateMap.clear()}};v();v();var t0=[100,500,2e3,1e4];function qo(i,r){var e,t,n;return i.set(de.degToRad((e=r==null?void 0:r[0])!=null?e:sn[0]),de.degToRad((t=r==null?void 0:r[1])!=null?t:sn[1]),de.degToRad((n=r==null?void 0:r[2])!=null?n:sn[2]))}function Jo(i,r){var e,t,n;return i.set((e=r==null?void 0:r[0])!=null?e:on[0],(t=r==null?void 0:r[1])!=null?t:on[1],(n=r==null?void 0:r[2])!=null?n:on[2])}function Ol(i){var s,a,l,u;let r=i.components[0],e=i.components[1];if(e.opacity!=null&&e.opacity!==r.opacity&&(r.opacity=e.opacity),!(((s=r.mesh)==null?void 0:s.children[0])instanceof Pe)){let m=e.material,h=e.color;if(m||h){let d=xf(h,m);(a=r.mesh)==null||a.traverse(f=>{f instanceof pe&&f.material&&(Array.isArray(f.material)?f.material.forEach(b=>{d[b.name]?(b.color.set(d[b.name].color),b.vertexColors=!1):h&&b.color.set(h)}):d[f.material.name]?(f.material.color.set(d[f.material.name].color),f.material.vertexColors=!1):h&&f.material.color.set(h))})}}let n=(l=r.feature.geometry.coordinates[2])!=null?l:0,o=((u=e.verticalOffset)!=null?u:0)+n;r.altitude!==o&&(r.altitude=o),e.visible!==r.visible&&(r.visible=e.visible),e.visibleThroughGeometry!==r.visibleThroughGeometry&&(r.visibleThroughGeometry=e.visibleThroughGeometry)}function xf(i,r){let e={};if(r)for(let t in r)r[t].color&&(e[t]={color:r[t].color});if(i){let t=["Default","Fabric","Mpdn_Logo","CouchLogo"];for(let n of t)e[n]||(e[n]={color:i})}return e}function Ll(i){i.traverse(r=>{r instanceof Pe&&r.computeBoundingSphere()})}function Sf(i,r=t0){for(let e of r)if(e>i)return e;return i*2}function Al(i){var r,e;for(;i.children.length>0;){let t=i.children[0];if(t instanceof Pe)if((r=t.geometry)==null||r.dispose(),Array.isArray(t.material))for(let n of t.material)n.dispose();else t.material&&t.material.dispose();i.remove(t)}(e=i.parent)==null||e.remove(i)}function Rl(i,r,e,t){var o,s;let n=t||e?xf(e,t):void 0;for(let a of i.children){if(!(a instanceof Pe))continue;let l=Array.isArray(a.material)?(o=a.material[0])==null?void 0:o.name:(s=a.material)==null?void 0:s.name,u=n==null?void 0:n[l],m=u?new me(u.color):e?new me(e):a.userData.originalColor;m&&(a.setColorAt(r,m),a.instanceColor&&(a.instanceColor.needsUpdate=!0))}}function ki(i,r){let e=new Nt;return i.scene.updateWorldMatrix(!0,!0),i.scene.traverse(t=>{var o,s,a;let n=t;if("isMesh"in n&&n.isMesh===!0){let l=n.geometry.clone();l.applyMatrix4(n.matrixWorld);let u=n.material,m;Array.isArray(u)?(m=(o=u[0].color)==null?void 0:o.clone(),u=u.map(f=>{var x;let b=f.clone();return(x=b.color)==null||x.setRGB(1,1,1),b})):(m=(s=u.color)==null?void 0:s.clone(),u=u.clone(),(a=u.color)==null||a.setRGB(1,1,1));let h=new Pe(l,u,r);h.count=0,h.frustumCulled=!1,h.layers.enable(Ot.SHOULD_CAST_SHADOWS),h.userData={entities:{},originalColor:m},e.add(h)}}),e}function ku(i,r){let e=typeof r=="string"?new me(r):r;i.traverse(t=>{let n=t;"isMesh"in n&&n.isMesh===!0&&(Array.isArray(n.material)?n.material.forEach(o=>{"color"in o&&o.color.copy(e)}):"color"in n.material&&n.material.color.copy(e))})}function zu(i,r,e=!1){i.traverse(t=>{let n=t;"isMesh"in n&&n.isMesh===!0&&(Array.isArray(n.material)?n.material.forEach(o=>{(!e||!o.transparent)&&(o.transparent=r<1),o.opacity=r}):((!e||!n.material.transparent)&&(n.material.transparent=r<1),n.material.opacity=r))})}function Mf(i,r){i.traverse(e=>{let t=e;"isMesh"in t&&t.isMesh===!0&&(Array.isArray(t.material)?t.material.forEach(n=>{n.depthWrite=!r,n.depthTest=!r,r&&(n.transparent=!0)}):(t.material.depthWrite=!r,t.material.depthTest=!r,r&&(t.material.transparent=!0)))})}function zi(i,r){i.traverse(e=>{e instanceof Pe&&e.material&&(Array.isArray(e.material)?e.material.forEach(t=>{t.transparent=r<1,t.opacity=r}):(e.material.transparent=r<1,e.material.opacity=r))})}function Uu(i){i.traverse(r=>{var t,n;let e=r;"isMesh"in e&&e.isMesh===!0&&((t=e.geometry)==null||t.dispose(),Array.isArray(e.material)?e.material.forEach(o=>o.dispose()):(n=e.material)==null||n.dispose())})}function Ef(i){i.traverse(r=>{var e;r instanceof Pe&&(r.geometry.dispose(),Array.isArray(r.material)?r.material.forEach(t=>t.dispose()):(e=r.material)==null||e.dispose())})}function xn(i,r){let e=r!==0,t=!1;return i.traverse(n=>{if(!(n instanceof Pe)&&!("isMesh"in n&&n.isMesh))return;let o=n.layers.isEnabled(Ot.SHOULD_CAST_SHADOWS);e&&!o?(n.layers.enable(Ot.SHOULD_CAST_SHADOWS),t=!0):!e&&o&&(n.layers.disable(Ot.SHOULD_CAST_SHADOWS),t=!0)}),t}v();var _l=class{constructor(){p(this,"element",null);p(this,"enabled",!1)}show(){this.enabled||(this.enabled=!0,this.create())}hide(){this.enabled&&(this.enabled=!1,this.element&&(this.element.remove(),this.element=null))}isEnabled(){return this.enabled}create(){this.element=document.createElement("div"),this.element.id="model-debug-ui",this.element.style.cssText="\n position: fixed;\n bottom: 10px;\n left: 10px;\n background: rgba(0, 0, 0, 0.8);\n color: #fff;\n font-family: monospace;\n font-size: 12px;\n padding: 10px;\n border-radius: 5px;\n z-index: 10000;\n max-height: 300px;\n overflow-y: auto;\n min-width: 200px;\n ",document.body.appendChild(this.element)}getActualInstanceCount(r){for(let e of r.mesh.children)if(e.isInstancedMesh)return e.count;return r.count}update(r,e,t){var o,s,a;if(!this.enabled||!this.element)return;let n='<div style="margin-bottom: 5px; font-weight: bold; border-bottom: 1px solid #666; padding-bottom: 5px;">Model Batches</div>';if(r.size===0)n+='<div style="color: #888;">No models loaded</div>';else{let l=0,u=0,m=Array.from(r.keys()).sort((h,d)=>{var x,y;let f=(x=e.get(h))!=null?x:"",b=(y=e.get(d))!=null?y:"";return f.localeCompare(b)});for(let h of m){let d=r.get(h);if(!d||d.size===0)continue;let f=(o=e.get(h))!=null?o:"unknown_".concat(h),b=0;for(let y of d)b+=this.getActualInstanceCount(y);l+=d.size,u+=b,n+='<div style="margin: 6px 0 2px 0;">',n+='<span style="color: #4fc3f7; font-weight: bold;">"'.concat(f,'"</span>'),n+='<span style="color: #aaa;"> ('.concat(b," total, ").concat(d.size," batch").concat(d.size!==1?"es":"",")</span>"),n+="</div>";let x=Array.from(d).sort((y,g)=>y.id.localeCompare(g.id));for(let y of x){let g=this.getActualInstanceCount(y),S=y.count,M=g!==S,E=y.opacity===1?"":" @".concat((y.opacity*100).toFixed(0),"%");n+='<div style="margin-left: 12px; color: #ccc; font-size: 11px;">',n+='<span style="color: #81c784;">'.concat(y.id,"</span>"),M?n+='<span style="color: #e57373;">: '.concat(g," actual / ").concat(S," tracked</span>"):n+='<span style="color: #fff;">: '.concat(g," instance").concat(g!==1?"s":"","</span>"),E&&(n+='<span style="color: #ffb74d;">'.concat(E,"</span>")),n+="</div>"}}n+='<div style="margin-top: 8px; padding-top: 5px; border-top: 1px solid #666; color: #fff;">',n+='Total: <span style="color: #81c784;">'.concat(u," instance").concat(u!==1?"s":"","</span>"),n+=', <span style="color: #e57373;">'.concat(l," draw call").concat(l!==1?"s":"","</span>"),n+="</div>"}if(t.size>0){n+='<div style="margin-top: 8px; border-top: 1px solid #666; padding-top: 5px;">',n+='<div style="margin-bottom: 5px; font-weight: bold; color: #ff9800;">Non-instanced Models</div>',n+='<span style="color: #aaa;">('.concat(t.size," total, ").concat(t.size," draw call").concat(t.size!==1?"s":"",")</span>");let l=new Map;for(let[u,m]of t){let h=(s=l.get(m.urlHash))!=null?s:[];h.push(u),l.set(m.urlHash,h)}for(let[u,m]of l){let h=(a=e.get(u))!=null?a:"unknown_".concat(u);n+='<div style="margin: 6px 0 2px 0;">',n+='<span style="color: #ff9800;">"'.concat(h,'"</span>'),n+='<span style="color: #aaa;"> ('.concat(m.length," model").concat(m.length!==1?"s":"",")</span>"),n+="</div>";for(let d of m)n+='<div style="margin-left: 12px; color: #ccc; font-size: 11px;">'.concat(d,"</div>")}n+="</div>"}this.element.innerHTML=n}destroy(){this.element&&(this.element.remove(),this.element=null)}};var Ui=100,r0=!0,Fl=class extends ye{constructor(e,t){super();p(this,"transparencyChanged",!1);p(this,"state");p(this,"convertTo3DMapPosition");p(this,"loader");p(this,"loadPromises",[]);p(this,"gltfCache",new Map);p(this,"gltfLoadPromises",new Map);p(this,"instanceMap",new Map);p(this,"debugUI");p(this,"modelNames",new Map);p(this,"batchCounter",0);p(this,"batchByMesh",new Map);p(this,"batchesByUrlHash",new Map);p(this,"nonInstancedModels",new Map);p(this,"pendingOpacityChanges",new Map);p(this,"detachedEntityIds",new Set);p(this,"tempMatrix",new we);p(this,"tempQuaternion",new ui);p(this,"tempEuler",new Ar);p(this,"tempScale",new k);p(this,"tempColor",new me);p(this,"endFrame",()=>{this.transparencyChanged=!1});this.state=e,this.convertTo3DMapPosition=t,this.debugUI=new _l}createBatch(e,t,n,o,s){this.batchCounter++;let a={id:"batch_".concat(this.batchCounter),mesh:e,count:0,maxCount:s,opacity:o,urlHash:t,containerId:n};return e.userData.batchId=a.id,this.batchByMesh.set(e,a),this.batchesByUrlHash.has(t)||this.batchesByUrlHash.set(t,new Set),this.batchesByUrlHash.get(t).add(a),a}removeBatch(e){var t,n;this.batchByMesh.delete(e.mesh),(t=this.batchesByUrlHash.get(e.urlHash))==null||t.delete(e),((n=this.batchesByUrlHash.get(e.urlHash))==null?void 0:n.size)===0&&this.batchesByUrlHash.delete(e.urlHash)}getBatchForMesh(e){return this.batchByMesh.get(e)}updateDebugUI(){this.debugUI.update(this.batchesByUrlHash,this.modelNames,this.nonInstancedModels)}showDebug(){this.debugUI.show(),this.updateDebugUI()}hideDebug(){this.debugUI.hide()}async getGLTFLoader(){if(this.loader)return this.loader;let{GLTFLoader:e}=await import("./GLTFLoader-I7TPEHSY.js");return this.loader=new e,this.loader}async getOrLoadGLTF(e,t){let n=this.gltfCache.get(t);if(n)return n;let o=this.gltfLoadPromises.get(t);if(o)return o;let s=await this.getGLTFLoader(),a=new Promise((l,u)=>{let m=d=>{this.gltfCache.set(t,d),this.gltfLoadPromises.delete(t),l(d)},h=d=>{this.gltfLoadPromises.delete(t),u(d)};Dd(e)?s.parse(Pd(e),"",m,h):Id(e)?s.parse(Od(e),"",m,h):s.load(e,m,void 0,h)});return this.gltfLoadPromises.set(t,a),a}createNonInstancedModel(e,t,n,o){var g,S,M,E,w;let s=e.components[0],a=e.components[1],l=s.feature,u=t.scene.clone(!0);u.updateWorldMatrix(!0,!0);let m=new Nt;m.userData={nonInstanced:!0,entityId:String(e.id),type:"model"},u.traverse(R=>{let I=R;if("isMesh"in I&&I.isMesh===!0){let T=I.clone();T.geometry=I.geometry.clone(),T.geometry.applyMatrix4(I.matrixWorld),T.position.set(0,0,0),T.rotation.set(0,0,0),T.scale.set(1,1,1),Array.isArray(I.material)?T.material=I.material.map(C=>C.clone()):T.material=I.material.clone(),T.userData={entityId:String(e.id)},m.add(T)}});let{x:h,y:d}=this.convertTo3DMapPosition(l.geometry.coordinates[1],l.geometry.coordinates[0],0),f=(g=l.geometry.coordinates[2])!=null?g:0,b=((S=a.verticalOffset)!=null?S:0)+f;s.altitude=b,s.position.set(h,d,s.altitude);let x=(M=a.scale)!=null?M:on,y=(E=a.rotation)!=null?E:sn;if(m.position.copy(s.position),m.rotation.set(de.degToRad(y[0]),de.degToRad(y[1]),de.degToRad(y[2])),m.scale.set(x[0],x[1],x[2]),a.color&&ku(m,a.color),a.opacity!=null&&a.opacity!==1&&zu(m,a.opacity),a.visibleThroughGeometry&&Mf(m,!0),!a.EXPERIMENTAL_clippingEnabled){let R=(w=a.opacity)!=null?w:1;xn(m,R)}n.add(m),s.mesh=m,s.instanceIndex=-1,this.nonInstancedModels.set(e.id,{urlHash:o,mesh:m}),this.updateDebugUI()}resizeInstanceContainer(e,t){let n=Sf(e.maxCount),o=ki(t,n),s=e.object.children,a=o.children;for(let u=0;u<s.length;u++){let m=s[u],h=a[u];if(!(!(m instanceof Pe)||!(h instanceof Pe))){for(let d=0;d<e.count;d++)m.getMatrixAt(d,this.tempMatrix),h.setMatrixAt(d,this.tempMatrix),h.userData.entities[d]=m.userData.entities[d],m.instanceColor&&(m.getColorAt(d,this.tempColor),h.setColorAt(d,this.tempColor));h.count=e.count,h.instanceMatrix.needsUpdate=!0}}let l=e.object.parent;return l&&(l.remove(e.object),l.add(o)),e.object=o,e.maxCount=n,e}getOrCreateInstanceContainer(e,t,n){let o=this.instanceMap.get(e);o||(o=new Map,this.instanceMap.set(e,o));let s=o.get(t);if(s){let a=this.getBatchForMesh(s.object);a&&(s.count=a.count)}else{let a=ki(n,Ui);s={object:a,count:0,maxCount:Ui},o.set(t,s);let l=this.createBatch(a,t,e,1,Ui);s.batch=l}return s}createModelFromFeature(e,t,n){let o=new un(t),s=V({},n);t.properties.verticalOffset!=null&&(s.verticalOffset=t.properties.verticalOffset),t.properties.rotation!=null&&(s.rotation=t.properties.rotation),t.properties.scale!=null&&(s.scale=t.properties.scale);let a=new Xs(s);o.instancingDisabled=a.visibleThroughGeometry===!0||a.EXPERIMENTAL_clippingEnabled===!0;let l=new Te(o,a);return l.id=e,a.EXPERIMENTAL_clippingEnabled&&(l.components[7]=new $s),l}async populateModelGroup(e,t,n){var u,m,h,d;let o=qi(t),s=this.getOrLoadGLTF(t,o).then(f=>{var C;let b=n.parent;if(!(b instanceof Ne))return;let x=b.userData.entityId,y=this.getOrCreateInstanceContainer(x,o,f);y.count+e.size>y.maxCount&&(y=this.resizeInstanceContainer(y,f)),y.object.parent||n.add(y.object);let S=new we,M=new Ar,E=new ui,w=new k,R,I,T;for(let F of e.values()){if(T=this.state.geometry3DMap.get(F),!T||(T==null?void 0:T.type)!=="model"||!this.state.geometry3DsInScene.has(T))continue;let L=T.components[0],N=T.components[1];if(L.instanceIndex!=null&&L.instanceIndex>=0||L.instancingDisabled&&L.mesh)continue;if(I=L.feature,L.instancingDisabled){this.createNonInstancedModel(T,f,n,o);continue}let z=N.opacity!=null&&N.opacity!==1;if(z){let q=(C=N.opacity)!=null?C:1,le=Math.round(q*100),Q,K,B=this.batchesByUrlHash.get(o);if(B){for(let U of B)if(U.containerId===b.userData.entityId&&Math.round(U.opacity*100)===le&&U.count<U.maxCount){Q=U,K=U.mesh;break}}if(!Q||!K){let U=ki(f,Ui);U.userData.detached=!0,U.userData.sharedOpacity=q,n.add(U),Q=this.createBatch(U,o,b.userData.entityId,q,Ui),K=U,zi(U,q),xn(U,q)}let j=Q.count;L.mesh=K,L.instanceIndex=j,Q.count++,this.detachedEntityIds.add(T.id)}else L.mesh=y.object,L.instanceIndex=y.count;Ol(T),N.dirty=!1,R=this.convertTo3DMapPosition(I.geometry.coordinates[1],I.geometry.coordinates[0],0),L.position.set(R.x,R.y,L.altitude),qo(M,N.rotation),Jo(w,N.scale),E.setFromEuler(M),S.compose(L.position,E,w);let Y=L.mesh,G=L.instanceIndex;for(let q of Y.children)q instanceof Pe&&(q.setMatrixAt(G,S),q.userData.entities[G]=T.id,q.count=G+1,q.instanceMatrix.needsUpdate=!0);if(Rl(Y,G,N.color,N.material),!z){y.count++;let q=this.getBatchForMesh(y.object);q&&(q.count=y.count)}Ll(L.mesh)}this.publish("model-loaded")});this.loadPromises.push(s);let a=(m=(u=n.parent)==null?void 0:u.userData)==null?void 0:m.entityId,l=(h=this.instanceMap.get(a))==null?void 0:h.get(o);return(d=l==null?void 0:l.object)!=null?d:new Nt}update(){for(let t of this.state.geometryGroupIdsToLoad.values()){let n=this.state.geometry3DMap.get(t);n instanceof mt&&n.userData.dirty&&n.userData.modelURL&&(this.populateModelGroup(n.userData.entities3D,n.userData.modelURL,n),n.userData.dirty=!1,n.userData.localCenter=void 0)}this.updateModelStyles(),this.rebatchDetachedInstances(),this.flushPendingOpacityChanges(),this.updateDebugUI();let e=this.loadPromises;return this.loadPromises=[],Promise.all(e)}rebatchDetachedInstances(){var t,n,o,s;if(!r0||this.detachedEntityIds.size===0)return;let e=new Map;for(let a of this.detachedEntityIds){let l=this.state.geometry3DMap.get(a);if(!l||l.type!=="model")continue;let u=l.components[0],m=l.components[1],h=(t=u.mesh)==null?void 0:t.userData;if(!((n=u.mesh)!=null&&n.parent))continue;let d=(o=m.opacity)!=null?o:1,f=h==null?void 0:h.sharedOpacity;if(Math.round(d*100)===100&&f!==void 0){this.pendingOpacityChanges.set(l.id,{entity:l,targetOpacity:d});continue}if(f!==void 0&&Math.abs(d-f)<=.01)continue;if(f!==void 0&&Math.abs(d-f)>.01){this.pendingOpacityChanges.set(l.id,{entity:l,targetOpacity:d});continue}let x=u.mesh.parent;if(!(x instanceof mt))continue;let y=x.userData.modelURL;if(!y)continue;let g=qi(y),S=(s=m.opacity)!=null?s:1,M=Math.round(S*100);e.has(g)||e.set(g,new Map);let E=e.get(g);E.has(M)||E.set(M,[]),E.get(M).push(l)}for(let[a,l]of e.entries()){let u=this.gltfCache.get(a);if(u)for(let[m,h]of l.entries()){if(h.length<2)continue;let d=m/100;this.createSharedBatchForDetached(h,u,d,a)}}this.publish("batch-changed")}createSharedBatchForDetached(e,t,n,o){var M;if(e.length<2)return;let a=(M=e[0].components[0].mesh)==null?void 0:M.parent;if(!a)return;let l=a.parent,u=l instanceof Ne?l.userData.entityId:"unknown",m=ki(t,e.length);m.userData.detached=!0,m.userData.sharedOpacity=n,a.add(m);let h=this.createBatch(m,o,u,n,e.length);zi(m,n),xn(m,n);let d=new we,f=new Ar,b=new ui,x=new k,y,g,S=0;for(let E of e){let w=E.components[0],R=E.components[1],I=w.mesh;if(I){let T=this.getBatchForMesh(I);T&&this.removeBatch(T),Al(I)}w.mesh=m,w.instanceIndex=S,g=w.feature,y=this.convertTo3DMapPosition(g.geometry.coordinates[1],g.geometry.coordinates[0],0),w.position.set(y.x,y.y,w.altitude),qo(f,R.rotation),Jo(x,R.scale),R.visible===!1&&x.set(0,0,0),b.setFromEuler(f),d.compose(w.position,b,x);for(let T of m.children)T instanceof Pe&&(T.setMatrixAt(S,d),T.userData.entities[S]=E.id,T.count=S+1,T.instanceMatrix.needsUpdate=!0);Rl(m,S,R.color,R.material),S++}h.count=S,Ll(m)}removeInstanceFromBatch(e,t,n){var u;let o=e.count-1,s=e.opacity===1&&((u=t.userData)==null?void 0:u.detached)!==!0;if(e.count===1){if(s){e.count=0;for(let d of t.children)d instanceof Pe&&(d.count=0,d.instanceMatrix.needsUpdate=!0);let m=this.instanceMap.get(e.containerId),h=m==null?void 0:m.get(e.urlHash);h&&h.object===e.mesh&&(h.count=0),this.updateDebugUI();return}this.removeBatch(e),Al(t),this.updateDebugUI();return}for(let m of t.children)if(m instanceof Pe){if(n!==o){m.getMatrixAt(o,this.tempMatrix),m.getColorAt(o,this.tempColor),m.setMatrixAt(n,this.tempMatrix),m.setColorAt(n,this.tempColor);let h=m.userData.entities[o];if(h){m.userData.entities[n]=h;let d=this.state.geometry3DMap.get(h);d&&(d.components[0].instanceIndex=n)}}delete m.userData.entities[o],m.count=o,m.instanceMatrix.needsUpdate=!0,m.instanceColor&&(m.instanceColor.needsUpdate=!0)}e.count=o;let a=this.instanceMap.get(e.containerId),l=a==null?void 0:a.get(e.urlHash);l&&l.object===e.mesh&&(l.count=o),this.updateDebugUI()}updateModelStyles(){var e,t,n,o,s;for(let a of this.state.geometry3DsInScene){if((a==null?void 0:a.type)!=="model")continue;let l=a.components[1],u=a.components[0];if(!l.dirty&&!u.positionDirty)continue;if(u.instancingDisabled){this.updateNonInstancedModelStyle(a),l.dirty=!1,u.positionDirty=!1;continue}let m=(e=u.mesh)==null?void 0:e.userData,h=m==null?void 0:m.detached,d=l.opacity!=null&&l.opacity!==1,f=(t=l.opacity)!=null?t:1,b=m==null?void 0:m.sharedOpacity,x=b!==void 0&&Math.abs(f-b)>.01;if((d&&!h&&u.mesh||x)&&this.pendingOpacityChanges.set(a.id,{entity:a,targetOpacity:f}),Ol(a),this.updateInstanceTransform(a),this.updateInstanceColor(a,l.color,l.material),((o=(n=u.mesh)==null?void 0:n.userData)==null?void 0:o.detached)&&u.mesh){let g=(s=l.opacity)!=null?s:1;zi(u.mesh,g),xn(u.mesh,g)&&(this.transparencyChanged=!0)}l.dirty=!1,u.positionDirty=!1}}flushPendingOpacityChanges(){var o,s;if(this.pendingOpacityChanges.size===0)return;let e=new Map,t=new Map,n=(a,l,u,m,h,d)=>{let f=Math.round(l*100),b="".concat(u,"_").concat(m,"_").concat(f),x=t.get(b);x||(x={entities:[],targetOpacity:l,urlHash:u,containerId:m,gltf:h,parent:d},t.set(b,x)),x.entities.push(a)};for(let{entity:a,targetOpacity:l}of this.pendingOpacityChanges.values()){let u=a.components[0];if(!u.mesh||u.instanceIndex==null)continue;let m=u.mesh,h=this.getBatchForMesh(m),d=m.parent;if(!(d instanceof mt))continue;let f=d.userData.modelURL;if(!f)continue;let b=qi(f),x=this.gltfCache.get(b);if(!x)continue;let y=d.parent,g=y instanceof Ne?y.userData.entityId:"unknown";if(h){let S=e.get(h);S||(S={entities:[],targetOpacity:l},e.set(h,S)),Math.round(S.targetOpacity*100)===Math.round(l*100)?S.entities.push(a):n(a,l,b,g,x,d)}else n(a,l,b,g,x,d)}for(let[a,l]of e){let{entities:u,targetOpacity:m}=l,h=((o=a.mesh.userData)==null?void 0:o.detached)===!0,d=Math.round(m*100)===100;if(u.length===a.count&&h&&!d)a.opacity=m,a.mesh.userData.sharedOpacity=m,zi(a.mesh,m),xn(a.mesh,m)&&(this.transparencyChanged=!0);else{let f=(s=u[0])==null?void 0:s.components[0],b=f==null?void 0:f.mesh,x=b==null?void 0:b.parent;if(x instanceof mt){let y=x.userData.modelURL;if(y){let g=qi(y),S=this.gltfCache.get(g),M=x.parent,E=M instanceof Ne?M.userData.entityId:"unknown";if(S)for(let w of u)n(w,m,g,E,S,x)}}}}for(let a of t.values()){let{entities:l,targetOpacity:u,urlHash:m,containerId:h,gltf:d,parent:f}=a,b=Math.round(u*100);for(let E of l){let w=E.components[0],R=w.mesh,I=this.getBatchForMesh(R),T=w.instanceIndex;I&&T!=null&&T>=0&&this.removeInstanceFromBatch(I,R,T)}let x,y,g=this.batchesByUrlHash.get(m);if(g){for(let E of g)if(E.containerId===h&&Math.round(E.opacity*100)===b&&E.count+l.length<=E.maxCount){x=E,y=E.mesh;break}}if(!x||!y){let E=Math.max(Ui,l.length),w=ki(d,E);w.userData.detached=!0,w.userData.sharedOpacity=u,f.add(w),x=this.createBatch(w,m,h,u,E),y=w,zi(w,u),xn(w,u)&&(this.transparencyChanged=!0)}let S,M;for(let E of l){let w=E.components[0],R=E.components[1],I=x.count;w.mesh=y,w.instanceIndex=I,M=w.feature,S=this.convertTo3DMapPosition(M.geometry.coordinates[1],M.geometry.coordinates[0],0),w.position.set(S.x,S.y,w.altitude),qo(this.tempEuler,R.rotation),Jo(this.tempScale,R.scale),R.visible===!1&&this.tempScale.set(0,0,0),this.tempQuaternion.setFromEuler(this.tempEuler),this.tempMatrix.compose(w.position,this.tempQuaternion,this.tempScale);for(let T of y.children)T instanceof Pe&&(T.setMatrixAt(I,this.tempMatrix),T.userData.entities[I]=E.id,T.count=I+1,T.instanceMatrix.needsUpdate=!0);this.updateInstanceColor(E,R.color,R.material),x.count++,y.userData.detached?this.detachedEntityIds.add(E.id):this.detachedEntityIds.delete(E.id)}Ll(y),this.publish("batch-changed")}this.pendingOpacityChanges.clear(),this.updateDebugUI()}updateInstanceTransform(e){let t=e.components[0],n=e.components[1];if(!t.mesh)return;let o=t.feature,{x:s,y:a}=this.convertTo3DMapPosition(o.geometry.coordinates[1],o.geometry.coordinates[0],0);if(t.position.set(s,a,t.altitude),qo(this.tempEuler,n.rotation),n.visible===!1?this.tempScale.set(0,0,0):Jo(this.tempScale,n.scale),t.instancingDisabled){t.mesh.position.copy(t.position),t.mesh.rotation.set(this.tempEuler.x,this.tempEuler.y,this.tempEuler.z),t.mesh.scale.copy(this.tempScale);return}if(!(t.instanceIndex==null||t.instanceIndex<0)){this.tempQuaternion.setFromEuler(this.tempEuler),this.tempMatrix.compose(t.position,this.tempQuaternion,this.tempScale);for(let l of t.mesh.children)l instanceof Pe&&(l.setMatrixAt(t.instanceIndex,this.tempMatrix),l.instanceMatrix.needsUpdate=!0)}}updateNonInstancedModelStyle(e){var s;let t=e.components[0],n=e.components[1];if(!t.mesh)return;Ol(e),this.updateInstanceTransform(e);let o=(s=n.opacity)!=null?s:1;zu(t.mesh,o,n.visibleThroughGeometry),n.EXPERIMENTAL_clippingEnabled||xn(t.mesh,o)&&(this.transparencyChanged=!0),n.color&&ku(t.mesh,n.color)}updateInstanceColor(e,t,n){let o=e.components[0];!o.mesh||o.instanceIndex==null||o.instanceIndex<0||Rl(o.mesh,o.instanceIndex,t,n)}removeInstance(e){var m,h;let t=e.components[0];if(this.detachedEntityIds.delete(e.id),this.nonInstancedModels.has(e.id)){let d=this.nonInstancedModels.get(e.id);return d!=null&&d.mesh&&(Uu(d.mesh),(m=d.mesh.parent)==null||m.remove(d.mesh)),this.nonInstancedModels.delete(e.id),t.mesh=null,this.updateDebugUI(),!0}if(!t.mesh||t.instanceIndex==null||t.instanceIndex<0)return!0;let n=this.getBatchForMesh(t.mesh);if(!n)return!0;let o=t.instanceIndex,s=n.count-1,a=n.opacity===1&&((h=t.mesh.userData)==null?void 0:h.detached)!==!0;if(n.count===1){if(a){n.count=0;for(let g of t.mesh.children)g instanceof Pe&&(g.count=0,g.instanceMatrix.needsUpdate=!0);let x=this.instanceMap.get(n.containerId),y=x==null?void 0:x.get(n.urlHash);return y&&y.object===n.mesh&&(y.count=0),t.mesh.parent&&t.mesh.parent.remove(t.mesh),t.mesh=null,this.updateDebugUI(),!1}let d=n.urlHash;this.removeBatch(n);let f=this.batchesByUrlHash.get(d),b=!1;if(f){for(let x of f)if(x.count>0){b=!0;break}}return Al(t.mesh),t.mesh=null,this.updateDebugUI(),!b}for(let d of t.mesh.children)if(d instanceof Pe){if(o!==s){d.getMatrixAt(s,this.tempMatrix),d.getColorAt(s,this.tempColor),d.setMatrixAt(o,this.tempMatrix),d.setColorAt(o,this.tempColor);let f=d.userData.entities[s];if(f){d.userData.entities[o]=f;let b=this.state.geometry3DMap.get(f);b?b.components[0].instanceIndex=o:$.warn("[removeInstance] Could not find lastEntity in geometry3DMap:",f)}}delete d.userData.entities[s],d.count=s,d.instanceMatrix.needsUpdate=!0,d.instanceColor&&(d.instanceColor.needsUpdate=!0)}n.count=s;let l=this.instanceMap.get(n.containerId),u=l==null?void 0:l.get(n.urlHash);return u&&u.object===n.mesh&&(u.count=s),t.mesh=null,this.updateDebugUI(),!1}destroy(){var e;this.gltfCache.clear(),this.gltfLoadPromises.clear();for(let t of this.instanceMap.values())for(let n of t.values())Ef(n.object);this.instanceMap.clear(),this.modelNames.clear(),this.batchByMesh.clear(),this.batchesByUrlHash.clear(),this.batchCounter=0;for(let t of this.nonInstancedModels.values())t.mesh&&(Uu(t.mesh),(e=t.mesh.parent)==null||e.remove(t.mesh));this.nonInstancedModels.clear(),this.debugUI.destroy(),this.loadPromises=[],this.loader=void 0}};v();var Wr,Qo,Ve,Ko,jr,Hi,Cf,wf,Gl=class{constructor(r,e,t,n,o={}){A(this,Hi);A(this,Wr);A(this,Qo);A(this,Ve);A(this,Ko,new k);A(this,jr,new he);_(this,Wr,e),_(this,Qo,t),_(this,Ve,new ed(r,t,te(this,Hi,Cf).call(this,n),o))}get pipeline(){return c(this,Ve)}get interactiveCollidersQTree(){return c(this,Ve).collisionSystem.interactiveCollidersQTree}get visibleCollidersQTree(){return c(this,Ve).collisionSystem.visibleCollidersQTree}resize(){c(this,Ve).resize()}syncTwoDEntities(){c(this,Ve).clearEntities(),c(this,Qo).pixelRatio=c(this,Wr).pixelRatio;for(let r of c(this,Wr).geometry2DsInScene)r.syncPosition(),c(this,Ve).addEntity(r.entity2D)}update(r,e,t,n=[]){te(this,Hi,wf).call(this),c(this,Ve).update(r,e,t,n)}markDirty(){c(this,Ve).markDirty()}get collidersNeedRecomputing(){return c(this,Ve).collidersNeedRecomputing}set collidersNeedRecomputing(r){c(this,Ve).collidersNeedRecomputing=r}updateWatermark(r){c(this,Ve).updateWatermark(r)}cancelPendingFrames(){c(this,Ve).cancelPendingFrames()}setCollidersDirty(){c(this,Ve).collisionSystem.collidersDirty=!0}deleteTextCacheEntry(r){delete c(this,Ve).drawSystem.textCache[r]}showCollisionBoxes(){c(this,Ve).showCollisionBoxes()}hideCollisionBoxes(){c(this,Ve).hideCollisionBoxes()}destroy(){c(this,Ve).destroy()}};Wr=new WeakMap,Qo=new WeakMap,Ve=new WeakMap,Ko=new WeakMap,jr=new WeakMap,Hi=new WeakSet,Cf=function(r){return(e,t,n)=>(c(this,Ko).set(e,t,n),c(this,jr).set(0,0),r(c(this,jr),c(this,Ko)),c(this,jr).x===0&&c(this,jr).y===0?null:{x:c(this,jr).x,y:c(this,jr).y})},wf=function(){let r,e;for(let t of c(this,Wr).geometry2DsInScene){e=t.components[0];let n=t.attachedTo?c(this,Wr).geometry3DMap.get(t.attachedTo):void 0;if(n instanceof Te)if(c(this,Wr).geometry3DsInScene.has(n)){if(r=n.components[1],r.dirty||e.attachedDirty){let s=r.height,a=r.altitude;t.setAltitude(s+a),t.syncPosition()}let o=r.visible;e.visible!==o&&(e.visible=o)}else e.visible===!0&&(e.visible=!1);e.attachedDirty=!1}};var Tf=new nn;var{DEFAULT_PITCH:Zu,DEFAULT_BEARING:Xu,DEFAULT_ZOOM_LEVEL:Yu,DEFAULT_MIN_ZOOM_LEVEL:n0,DEFAULT_MAX_ZOOM_LEVEL:i0}=Yt,o0=de.radToDeg(.6435011087932844),_e,Fe,$n,qn,Vi,Sn,Jn,Qn,wt,Vu,P,We,Mn,Ct,Xe,O,Nl,kt,Be,Bl,Kn,Df,Pf,Zr,kl,es,zl,Ul,Wi,ji,Hl,ts,rs,ns,Wu,ei,is,os,Xr,Yr,ju,Vl,fe,Zi,ss,Hu=class extends ye{constructor(e,t={}){var b,x,y,g,S,M,E,w,R,I,T,C,F,L,N,z,Y;super();A(this,wt);p(this,"options");p(this,"container");p(this,"Debug");A(this,_e);A(this,Fe);A(this,$n);A(this,qn);A(this,Vi);A(this,Sn);A(this,Jn);A(this,Qn);p(this,"rendererDomElement");A(this,P,{geometry3DMap:new Map,geometry2DMap:new Map,geometry2DIdsInScene:new Set,geometry3DIdsInScene:new Set,geometryGroupIdsToLoad:new Set,geometry3DsInScene:new Set,geometry2DsInScene:new Set,geometryScene:new Ne("__scene"),hoverColor:"#f6efff",text3dHoverColor:"white",insetsPadding:zs,shouldMeasureCanvas:!0,pixelRatio:this.resolutionScale,canvasWidth:0,canvasHeight:0,internalTweenGroup:new fc,externalTweenGroup:new fc,cameraObject:new bc,naturalBearing:0,containerOffset:[0,0],useStandaloneCamera:!1,directionalLight:new Bs(16777215,.3*Math.PI),ambientLight:new Yh(16777215,.741*Math.PI),renderer:void 0,threeJSScene:new Rr,depthRangeFor3D:[0,1],geometry2DState:{entities:new Set,entityMap:new Map,entityIds:new Set,pixelRatio:1}});p(this,"camera");A(this,We);A(this,Mn);A(this,Ct);A(this,Xe);A(this,O,{});A(this,Nl,window.matchMedia("screen and (min-resolution: 2dppx)"));p(this,"map");A(this,kt,()=>{var e,t;(e=this.signal)!=null&&e.aborted||!((t=c(this,O))!=null&&t.renderSystem)||(c(this,O).renderSystem.twoDdirty=!0)});A(this,Be,()=>{var e,t;(e=this.signal)!=null&&e.aborted||!((t=c(this,O))!=null&&t.renderSystem)||(c(this,O).renderSystem.threeDdirty=!0)});A(this,Bl,()=>{this.map&&(c(this,P).depthRangeFor3D=this.map.painter.depthRangeFor3D)});A(this,Kn,(e,t)=>{e.addEventListener("childadded",t),e.addEventListener("childremoved",t),this.onAbort(()=>{e.removeEventListener("childadded",t),e.removeEventListener("childremoved",t)})});A(this,Zr,"standalone");A(this,kl,()=>{c(this,O).geometryDisposalSystem.dirty=!0,this.render()});A(this,es,e=>Math.trunc(e*10)/10);A(this,zl,()=>{te(this,wt,Vu).call(this,bi()),c(this,P).geometry2DState.pixelRatio=this.resolutionScale,c(this,O).twoDEntitySystem.markDirty(),c(this,ji).call(this,void 0,void 0,!0)});A(this,Ul,()=>{c(this,ji).call(this)});A(this,Wi);A(this,ji,(e,t,n=!1)=>{let o=e!=null?e:this.rendererDomElement.clientWidth,s=t!=null?t:this.rendererDomElement.clientHeight;if((o===0||s===0)&&!n)return;if(c(this,P).canvasWidth=o,c(this,P).canvasHeight=s,c(this,O).twoDEntitySystem.resize(),te(this,wt,Vu).call(this,bi()),c(this,ns).call(this),te(this,wt,Pf).call(this),c(this,O).cameraSystem.resize(this.canvasWidth,this.canvasHeight),c(this,O).cameraSystem.dirty=!0,c(this,O).cameraSystem.stateDirty=!0,this.map!=null){Zs(this.map,this.camera.minZoomLevel,this.camera.maxZoomLevel);let u=this.camera.zoomLevel,m=de.clamp(u,this.camera.minZoomLevel,this.camera.maxZoomLevel);m!==u&&this.camera.setZoomLevel(m)}c(this,O).watermarkSystem.resize(this.canvasWidth,this.canvasHeight),c(this,O).htmlControlsSystem.resize(this.canvasWidth),c(this,O).geometryInFocusSystem.resize(),c(this,O).occlusion2DSystem.resize(),c(this,O).twoDEntitySystem.resize();let{top:a,left:l}=this.container.getBoundingClientRect();c(this,P).containerOffset=[a,l],this.publish("resize"),this.map!=null&&this.publish("camera-change",this.camera),this.render()});A(this,Hl,()=>{this.renderSync()});A(this,ts,new k);p(this,"project",(e,t)=>{if(c(this,Fe).position.z+this.camera.elevation>t.z){c(this,ts).copy(t);let n=c(this,ts).project(c(this,Wi)),o=(n.x+1)/2*this.canvasWidth-0/2,s=(-n.y+1)/2*this.canvasHeight-0/2,a=c(this,es).call(this,o),l=c(this,es).call(this,s);e.x=a,e.y=l,e instanceof k&&(e.z=n.z)}else e.x=-1e3,e.y=-1e3,e instanceof k&&(e.z=1/0)});A(this,rs,(e,t)=>{c(this,Xe).setBufferSize(e,t),c(this,Fe).aspect=e/t,c(this,Fe).updateProjectionMatrix(),c(this,Fe).updateMatrixWorld(!0),c(this,Vi).x=e,c(this,Vi).y=t});A(this,ns,()=>{var s;let e=c(this,P).canvasWidth=this.rendererDomElement.clientWidth,t=c(this,P).canvasHeight=this.rendererDomElement.clientHeight,n=Math.floor(e*this.resolutionScale),o=Math.floor(t*this.resolutionScale);c(this,rs).call(this,n,o),(s=this.map)==null||s.resize(),c(this,P).shouldMeasureCanvas=!1});p(this,"getParentContainer",(e,t=!0)=>{if(!e)return t?c(this,P).geometryScene:void 0;if(typeof e=="string"||typeof e=="number"){let n=c(this,P).geometry3DMap.get(e);return n instanceof Ne?n:($.warn("Parent (".concat(typeof e=="object"?e.id:e,") is not a valid container, adding to scene")),t?c(this,P).geometryScene:void 0)}else if(e.type==="group-container"){let n=c(this,P).geometry3DMap.get(e.id);if(n instanceof Ne)return n}return t?c(this,P).geometryScene:void 0});p(this,"showCollisionBoxes",()=>{c(this,O).twoDEntitySystem.showCollisionBoxes(),this.render()});p(this,"hideCollisionBoxes",()=>{c(this,O).twoDEntitySystem.hideCollisionBoxes(),this.render()});p(this,"projectScreenXYToCoordinate",(e,t,n=!1)=>{var h,d;let o=this.container.getBoundingClientRect(),s=(e-o.left)/c(this,P).canvasWidth*2-1,a=-((t-o.top)/c(this,P).canvasHeight)*2+1,l=new he(s,a),u,m;if(n)Tf.setFromCamera(l,c(this,Fe)),u=(h=Tf.intersectObject(c(this,Sn),!1)[0])==null?void 0:h.point;else{let f=c(this,O).interactionSystem.getThreeDIntersectsFromXY(l);u=(d=f==null?void 0:f[0])==null?void 0:d.point,m=c(this,O).interactionSystem.getGroupContainerIntersectsFromXY(l)}if(u)return{coordinate:this.convert3DMapPositionToCoordinate(u),groupContainers:m}});p(this,"projectCoordinateToScreenXY",e=>{let t=this.convertTo3DMapPosition(e[1],e[0],e[2]||0),n=new he;return this.project(n,t),{x:n.x,y:n.y}});p(this,"convert3DMapPositionToCoordinate",e=>{var o,s,a,l;let{lat:t,lon:n}=Hs((s=(o=c(this,P).center)==null?void 0:o[1])!=null?s:0,(l=(a=c(this,P).center)==null?void 0:a[0])!=null?l:0,e.x,e.y);return[n,t,e.z]});p(this,"setBackgroundColor",(e,t)=>{c(this,Xe).setBackgroundColor(e,t)});p(this,"getMetersPerPixel",()=>c(this,O).cameraSystem.getCurrentMetersPerPixel());p(this,"hideOutdoorLayersIntersectingPolygons",(e,t)=>{c(this,O).outdoorLayersSystem.hideLayersIntersectingPolygons(e,t),this.render()});A(this,ei,new di);A(this,is,new we);A(this,os,e=>{var t;$.error("Render failed: ",e,(t=e.stack)!=null?t:"No stack trace available"),this.publish("render-error",{error:e})});p(this,"render",()=>{var e,t;if(!(((e=c(this,O))==null?void 0:e.renderSystem)==null||(t=this.signal)!=null&&t.aborted))if(this.map&&(this.mode==="outdoors-interleaved"||this.mode==="outdoors-overlay"))this.map.triggerRepaint();else return c(this,O).renderSystem.update().catch(c(this,os))});p(this,"renderSync",()=>{var e;return(e=this.signal)!=null&&e.aborted?Promise.resolve():c(this,O).renderSystem.update(!0).catch(c(this,os))});A(this,Xr,li(()=>{this.publish("user-interaction-start",void 0)},0,!0));A(this,Yr,li(()=>{this.publish("user-interaction-end",void 0),this.render()},0,!0));p(this,"on",(e,t,n)=>{let o=super.on(e,t,n);return["outdoor-view-loaded","outdoor-style-loaded"].includes(e)&&this.mode==="standalone"&&D.env.NODE_ENV!=="test"&&($.warn('"'.concat(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),o()),o});p(this,"off",(e,t)=>{super.off(e,t)});p(this,"getCursor",()=>c(this,O).interactionSystem.getCursor());A(this,Vl,()=>{try{c(this,Zr)!=="outdoors-overlay"&&(this.map&&this.map.remove(),this.container&&this.rendererDomElement&&this.container.contains(this.rendererDomElement)&&this.container.removeChild(this.rendererDomElement)),this.container&&c(this,We)&&this.container.contains(c(this,We))&&this.container.removeChild(c(this,We))}catch(e){$.warn("Error during DOM cleanup, some elements may not have been removed:",e)}});A(this,fe,e=>(this.onAbort(()=>{e&&typeof e=="object"&&("destroy"in e&&typeof e.destroy=="function"?e.destroy():"dispose"in e&&typeof e.dispose=="function"&&e.dispose())}),e));p(this,"destroy",()=>{var e,t,n;!c(this,O)||(e=this.signal)!=null&&e.aborted||(super.destroy(),(t=globalThis.MappedinDebug)!=null&&t.__idleCallbackInteractionState&&(globalThis.MappedinDebug.__idleCallbackInteractionState.unregisterInteractionChecker(c(this,O).cameraSystem.isUserInteracting),globalThis.MappedinDebug.__idleCallbackInteractionState.unregisterInteractionChecker(c(this,O).cameraSystem.isCameraMoving)),this.remove("__scene"),c(this,Xe).destroy(),(n=c(this,_e))==null||n.traverse(o=>{lt(o),"dispose"in o&&typeof o.dispose=="function"&&o.dispose()}),_(this,_e,void 0),_(this,O,void 0),c(this,Vl).call(this),_(this,Xe,void 0))});A(this,Zi,new k);A(this,ss,new k);if(c(this,P).useStandaloneCamera=(b=t.useStandaloneCamera)!=null?b:!1,c(this,P).naturalBearing=(x=t.naturalBearing)!=null?x:0,this.convertTo3DMapPosition=this.convertTo3DMapPosition.bind(this),!e.clientWidth||!e.clientHeight)throw new Error("[MappedinJS] Container width and height must be greater than 0");(t.mode==="outdoors-interleaved"||t.mode==="outdoors-overlay")&&t.map&&(_(this,Zr,t.mode),this.map=t.map),c(this,Kn).call(this,c(this,P).geometryScene,()=>{c(this,Be).call(this),c(this,kt).call(this)}),c(this,P).geometry3DMap.set(c(this,P).geometryScene.userData.entityId,c(this,P).geometryScene),t.center&&(c(this,P).center=t.center?[...t.center]:[0,0]),this.options=t,this.container=e,te(this,wt,Df).call(this),c(this,O).htmlControlsSystem=c(this,fe).call(this,new Aa(this.container,{outdoorEnabled:!!this.map})),c(this,O).maskingSystem=c(this,fe).call(this,new Ml(c(this,P))),c(this,Zr)!=="outdoors-overlay"&&c(this,O).htmlControlsSystem.addAttributionControl(this.options.attribution),window.MappedinDebug||(window.MappedinDebug={}),D.env.NODE_ENV==="test"&&(window.MappedinDebug.mapViewCoreInstance=this),_(this,Xe,new ea({antialias:typeof t.antialias=="boolean"?t.antialias:!0,alpha:!1,canvas:this.mode!=="standalone"?(y=t.gl)==null?void 0:y.canvas:void 0,onWebGLContextCreationError:t.onWebGLContextCreationError,onWebGLContextLost:t.onWebGLContextLost,onWebGLContextRestored:G=>{var q;(q=t.onWebGLContextRestored)==null||q.call(t,G),c(this,kt).call(this),c(this,Be).call(this),this.render()},onWebGLRendererError:t.onWebGLRendererError,backgroundColor:t.backgroundColor||"#ffffff",backgroundAlpha:(g=t.backgroundAlpha)!=null?g:1})),c(this,P).renderer=c(this,Xe).renderer,_(this,_e,c(this,P).threeJSScene),c(this,_e).matrixWorldAutoUpdate=!1,c(this,Zr)!=="standalone"&&c(this,_e).add(gd()),c(this,_e).add(c(this,P).geometryScene);let n=window.__THREE_DEVTOOLS__;D.env.NODE_ENV==="dev"&&typeof n<"u"&&(n.dispatchEvent(new CustomEvent("observe",{detail:c(this,_e)})),n.dispatchEvent(new CustomEvent("observe",{detail:c(this,Xe)}))),_(this,Fe,new bc(o0,this.aspect,50,1e5)),c(this,P).cameraObject=c(this,Fe),_(this,qn,new kh),c(this,qn).matrixWorldAutoUpdate=!1,c(this,Fe).renderOrder=999;let o=new jt;o.add(c(this,Fe)),_(this,Qn,new jt),c(this,Qn).add(o),c(this,_e).add(c(this,Qn)),c(this,Fe).updateProjectionMatrix(),c(this,Fe).updateMatrixWorld(!0),(S=t.__EXPERIMENTAL_shadows)!=null&&S.enabled&&(c(this,O).shadowsSystem=c(this,fe).call(this,new Il(c(this,P),c(this,Xe),c(this,Qn),t.__EXPERIMENTAL_shadows)),this.map&&this.onMapLibreEvent("render",c(this,Bl))),_(this,Wi,this.mode==="standalone"?c(this,Fe):c(this,qn)),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,Xe).domElement(),_(this,Vi,new he);let s=new vt(1e6,1e6),a=new Pt({color:0,visible:!1});_(this,Sn,new pe(s,a)),c(this,Sn).name="worldPlane",c(this,_e).add(c(this,Sn)),(M=t.gl)!=null&&M.canvas||e.appendChild(this.rendererDomElement),window.addEventListener("resize",c(this,Ul),{capture:!1,signal:this.signal}),c(this,Nl).addEventListener("change",c(this,zl),{signal:this.signal}),typeof ResizeObserver=="function"&&((E=D.env)==null?void 0:E.NODE_ENV)!=="test"&&(_(this,Jn,new ResizeObserver(Cs(G=>{c(this,ji).call(this,G[0].contentRect.width,G[0].contentRect.height)},50))),(w=c(this,Jn))==null||w.observe(e),c(this,Jn)&&this.onAbort(()=>{var G;return(G=c(this,Jn))==null?void 0:G.disconnect()})),e.classList.add("mappedin-map"),this.rendererDomElement.style.width=(R=globalThis.MappedinDebug)!=null&&R.TEST_IOS?"1080px":"100%",this.rendererDomElement.style.height=(I=globalThis.MappedinDebug)!=null&&I.TEST_IOS?"1920px":"100%",D.env.NODE_ENV==="test"&&this.rendererDomElement.setAttribute("data-testid","mappedin-canvas"),this.mode!=="outdoors-overlay"&&this.rendererDomElement.tabIndex!==void 0&&this.rendererDomElement.removeAttribute("tabindex"),c(this,P).canvasWidth=this.rendererDomElement.clientWidth,c(this,P).canvasHeight=this.rendererDomElement.clientHeight,this.rendererDomElement.style.touchAction="manipulation";let l=this.canvasWidth,u=this.canvasHeight;c(this,O).watermarkSystem=c(this,fe).call(this,new Pa(c(this,Fe),c(this,P),t==null?void 0:t.watermark)),c(this,O).watermarkSystem.on("texture-loaded",this.render),c(this,P).shouldMeasureCanvas=!0,c(this,P).pixelRatio=this.resolutionScale,c(this,rs).call(this,Math.floor(l*this.resolutionScale),Math.floor(u*this.resolutionScale)),c(this,P).directionalLight.position.set(-150,-150,350),c(this,_e).add(c(this,P).directionalLight),c(this,_e).add(c(this,P).ambientLight),c(this,O).cameraSystem=c(this,fe).call(this,new _n(c(this,Fe),c(this,_e),c(this,Xe).renderer,c(this,P),{mode:this.mode,canvasHeight:u,canvasWidth:l})),(T=globalThis.MappedinDebug)!=null&&T.__idleCallbackInteractionState&&(globalThis.MappedinDebug.__idleCallbackInteractionState.registerInteractionChecker(c(this,O).cameraSystem.isUserInteracting),globalThis.MappedinDebug.__idleCallbackInteractionState.registerInteractionChecker(c(this,O).cameraSystem.isCameraMoving)),c(this,O).cameraSystem.on("user-dolly-start",c(this,Xr),{signal:this.signal}),c(this,O).cameraSystem.on("user-pan-start",c(this,Xr),{signal:this.signal}),c(this,O).cameraSystem.on("user-rotate-start",c(this,Xr),{signal:this.signal}),c(this,O).cameraSystem.on("user-zoom-start",c(this,Xr),{signal:this.signal}),c(this,O).cameraSystem.on("user-tilt-start",c(this,Xr),{signal:this.signal}),c(this,O).cameraSystem.on("user-pedestal-start",c(this,Xr),{signal:this.signal}),c(this,O).cameraSystem.on("user-dolly-end",c(this,Yr),{signal:this.signal}),c(this,O).cameraSystem.on("user-pan-end",c(this,Yr),{signal:this.signal}),c(this,O).cameraSystem.on("user-rotate-end",c(this,Yr),{signal:this.signal}),c(this,O).cameraSystem.on("user-zoom-end",c(this,Yr),{signal:this.signal}),c(this,O).cameraSystem.on("user-tilt-end",c(this,Yr),{signal:this.signal}),c(this,O).cameraSystem.on("user-pedestal-end",c(this,Yr),{signal:this.signal}),c(this,O).cameraSystem.on("change",()=>{this.publish("camera-change",this.camera),c(this,O).geometryInFocusSystem&&(c(this,O).geometryInFocusSystem.cameraDirty=!0),this.render()}),c(this,O).pathSystem=c(this,fe).call(this,new Zo(c(this,P),this.convertTo3DMapPosition,this.getParentContainer,c(this,O).cameraSystem.convertZoomLevelToAltitude)),c(this,O).pathSystem.on("animate:path",this.render,{signal:this.signal}),c(this,O).panBoundsSystem=c(this,fe).call(this,new La(c(this,P),c(this,O).cameraSystem));let m=()=>{let{panBounds:G,fov:q,convertAltitudeToZoomLevel:le}=c(this,O).cameraSystem;if(c(this,O).panBoundsSystem.autoMinZoomLevel){if(G.radius<=0)return;let Q=Math.min(c(this,P).canvasWidth/c(this,P).canvasHeight,1),K=q*Math.PI/180*Q,B=Math.tan(K/2),{radius:j,center:U}=c(this,O).cameraSystem.panBounds,ce=j/B,xe=this.getThreeCamera().getWorldPosition(new k),ue=U.distanceTo(xe),ze=Math.abs(xe.z-U.z),Re=ce*ze/ue,Se=le(Re);fd(Se,this.camera.minZoomLevel)&&this.camera.setMinZoomLevel(Se)}this.publish("pan-bounds-change",c(this,O).cameraSystem.panBounds)};c(this,O).panBoundsSystem.on("update",m,{signal:this.signal}),this.camera=c(this,fe).call(this,new Da(this,c(this,O),c(this,P)));let h=()=>{c(this,O).geometryInFocusSystem&&c(this,O).geometryInFocusSystem.resize(),this.render()};this.camera.on("padding-change",h,{signal:this.signal}),this.camera.setZoomLevel((C=t.zoomLevel)!=null?C:Yu),this.camera.setBearing((F=t.bearing)!=null?F:Xu),this.camera.setPitch((L=t.pitch)!=null?L:Zu),this.camera.setMaxZoomLevel(i0),this.camera.setMinZoomLevel(n0),c(this,P).geometry2DState.pixelRatio=this.resolutionScale,c(this,O).twoDEntitySystem=c(this,fe).call(this,new Gl(this.container,c(this,P),c(this,P).geometry2DState,this.project,{workerUrl:gc||void 0,useCollisionWorker:((N=t.useCollisionWorker)!=null?N:!0)&&((z=t.useWorkers)!=null?z:!0),transformImageRequest:t.transformImageRequest,watermark:{width:0,height:0,position:"bottom-left"}})),c(this,O).interactionSystem=c(this,fe).call(this,new co(this.rendererDomElement,c(this,P),c(this,Fe),c(this,Sn),c(this,O).cameraSystem.isUserInteracting)),c(this,O).interactionSystem.on("doubletap-with-onefinger",G=>{var q;c(this,O).cameraSystem.enableZoom&&this.camera.animateTo({center:(q=this.projectScreenXYToCoordinate(G.clientX,G.clientY))==null?void 0:q.coordinate,zoomLevel:this.camera.zoomLevel+1,duration:Mc,easing:"ease-out"})}),c(this,O).interactionSystem.on("singletap-with-twofinger",()=>{c(this,O).cameraSystem.enableZoom&&this.camera.animateTo({zoomLevel:this.camera.zoomLevel-1,duration:Mc,easing:"ease-out"})}),c(this,O).interactionSystem.on("hover",this.render),c(this,O).interactionSystem.on("click",G=>{var B,j,U,ce,xe,ue,ze,Re,Se;if(G.entity2D.some(Me=>Me.id==="watermark")&&typeof c(this,O).watermarkSystem.options.onClick=="function"&&c(this,O).watermarkSystem.options.interactive){c(this,O).watermarkSystem.options.onClick();return}if(!G.position){$.error("Pointer event outside world-plane");return}let le=G.entity3D?[(B=G.entity3D)==null?void 0:B.id]:[];(ce=(U=(j=G.entity3D)==null?void 0:j.parentObject3D)==null?void 0:U.userData)!=null&&ce.entityId&&le.push((ze=(ue=(xe=G.entity3D)==null?void 0:xe.parentObject3D)==null?void 0:ue.userData)==null?void 0:ze.entityId);let Q=[],K=[];for(let Me of G.entity2D)Me.components&&(Me.components[0]instanceof no?Q.push(Me.id):Me.components[0]instanceof ro&&K.push(Me.id));this.publish("click",{coordinate:this.convert3DMapPositionToCoordinate(G.position),geometry:le,paths:((Re=G.entity3D)==null?void 0:Re.components[0])instanceof cn?[G.entity3D.id]:[],markers:Q,models:((Se=G.entity3D)==null?void 0:Se.components[0])instanceof un?[G.entity3D.id]:[],labels:K,containers:Array.isArray(G.groupContainers)?G.groupContainers.map(Me=>Me.userData.entityId):[],pointerEvent:G.pointerEvent})}),c(this,O).interactionSystem.on("hover",G=>{var Q,K,B;if(!G.position)return;let q=[],le=[];for(let j of G.entity2D)j.components&&(j.components[0]instanceof no?q.push(j.id):j.components[0]instanceof ro&&le.push(j.id));this.publish("hover",{coordinate:this.convert3DMapPositionToCoordinate(G.position),geometry:G.entity3D?[(Q=G.entity3D)==null?void 0:Q.id]:[],paths:((K=G.entity3D)==null?void 0:K.components[0])instanceof cn?[G.entity3D.id]:[],markers:q,models:((B=G.entity3D)==null?void 0:B.components[0])instanceof un?[G.entity3D.id]:[],labels:le,containers:Array.isArray(G.groupContainers)?G.groupContainers.map(j=>j.userData.entityId):[]})}),c(this,O).geometryInFocusSystem=c(this,fe).call(this,new ja(c(this,P),c(this,Wi)));let d=G=>{this.publish("geometry-in-focus",G)};c(this,O).geometryInFocusSystem.on("geometry-in-focus",d,{signal:this.signal}),c(this,O).drawSystem=c(this,fe).call(this,new ma(c(this,P),this.convertTo3DMapPosition,this.convert3DMapPositionToCoordinate)),c(this,O).exporterSystem=c(this,fe).call(this,new ho(c(this,P))),c(this,O).meshOptimizationSystem=c(this,fe).call(this,new ha(c(this,P),this.convertTo3DMapPosition)),c(this,O).meshOptimizationSystem.on("geometry-2d-added",this.render,{signal:this.signal}),c(this,O).meshOptimizationSystem.on("geometry-group-added",c(this,kl),{signal:this.signal}),c(this,O).modelSystem=c(this,fe).call(this,new Fl(c(this,P),this.convertTo3DMapPosition)),c(this,O).modelSystem.on("model-loaded",()=>{c(this,O).shadowsSystem&&(c(this,O).shadowsSystem.needsRender=!0),this.render()},{signal:this.signal}),c(this,O).modelSystem.on("batch-changed",()=>{c(this,O).interactionSystem.dirty3D=!0},{signal:this.signal}),c(this,O).meshDetachmentSystem=c(this,fe).call(this,new ml(c(this,P))),c(this,O).meshModificationSystem=c(this,fe).call(this,new gl(c(this,P))),c(this,O).geometryDisposalSystem=c(this,fe).call(this,new vl(c(this,P))),c(this,O).textureSystem=c(this,fe).call(this,new xl(c(this,P))),c(this,O).textureSystem.on("texture-added",this.render,{signal:this.signal}),c(this,O).borderSystem=c(this,fe).call(this,new em(c(this,P),this.convertTo3DMapPosition)),c(this,O).clippingPlaneSystem=c(this,fe).call(this,new Cl(c(this,P))),c(this,O).renderOrderSystem=c(this,fe).call(this,new Sl(c(this,P))),c(this,O).pluginSystem=c(this,fe).call(this,new wl),c(this,O).customGeometrySystem=c(this,fe).call(this,new Ra(c(this,P),this.convertTo3DMapPosition));let f=typeof t.outlines=="object"?t.outlines:void 0;f&&(c(this,P).outlinesOptions=f),c(this,O).outlineInterpolationSystem=c(this,fe).call(this,new _a(c(this,P),f)),c(this,O).outlineInterpolationSystem.on("needs-render",this.render,{signal:this.signal}),c(this,O).renderSystem=c(this,fe).call(this,new pa(c(this,Xe),c(this,P),this.mode,c(this,_e),c(this,Fe),this.viewCamera,c(this,O))),c(this,O).imageSystem=c(this,fe).call(this,new Va(c(this,P),this.convertTo3DMapPosition,this.project,t.bearing,t.naturalBearing,t.imagePlacementOptions,t.transformImageRequest)),c(this,O).text3DSystem=c(this,fe).call(this,new bd(c(this,P),this.convertTo3DMapPosition,(Y=t.useWorkers)!=null?Y:!0)),c(this,O).text3DSystem.on("render",this.render,{signal:this.signal}),c(this,O).imageSystem.on("image-loaded",this.render,{signal:this.signal}),c(this,O).renderSystem.on("pre-render",()=>this.publish("pre-render"),{signal:this.signal}),c(this,O).renderSystem.on("post-render",()=>this.publish("post-render"),{signal:this.signal}),c(this,O).renderSystem.on("measure-canvas",c(this,ns),{signal:this.signal}),c(this,O).outdoorLayersSystem=c(this,fe).call(this,new rl(this.map)),c(this,O).occlusion2DSystem=c(this,fe).call(this,new bl(c(this,P),this.convertTo3DMapPosition,c(this,Xe))),t.occlusionEnabled&&c(this,O).occlusion2DSystem.enable(),this.Debug=new yl(this),t.environment!==!1&&_(this,$n,te(this,wt,ju).call(this)),c(this,Hl).call(this)}get viewCamera(){return c(this,qn)}get cameraObject(){return c(this,Fe)}get canvasWidth(){return c(this,P).canvasWidth}get canvasHeight(){return c(this,P).canvasHeight}get resolutionScale(){var e,t;return(t=(e=this.map)==null?void 0:e._getClampedPixelRatio(this.canvasWidth,this.canvasHeight))!=null?t:bi()}get aspect(){return this.canvasWidth/this.canvasHeight}get labelsCanvas(){var e;return(e=c(this,Ct))!=null?e:null}get mode(){return c(this,Zr)}addGroupContainer(e,t,n){if(!c(this,P).geometry3DMap.has(e)&&!c(this,P).geometry2DMap.has(e)){let o=new Ne(e);c(this,Kn).call(this,o,()=>{c(this,Be).call(this),c(this,kt).call(this)}),(t==null?void 0:t.visible)!==void 0&&(o.visible=t.visible),(t==null?void 0:t.altitude)!==void 0&&o.setAltitude(t.altitude),(t==null?void 0:t.interactive)!==void 0&&Bt(o,t.interactive,c(this,P)),(t==null?void 0:t.focusable)!==void 0&&Qs(o,t.focusable),(t==null?void 0:t.preloadGeometry)!==void 0&&(o.userData.preloadGeometry=t.preloadGeometry),c(this,P).geometry3DMap.set(e,o);let s=this.getParentContainer(n);s instanceof Ne&&s.addEntity(o),c(this,Be).call(this),this.render()}else $.error("Group container with ID '".concat(e,"' already exists. The group container cannot be added."));return{id:e,type:"group-container"}}addCustomGeometry(e,t,n,o,s){if(c(this,P).geometry3DMap.has(e))$.error("Custom geometry with ID '".concat(e,"' already exists. The custom geometry cannot be added."));else{let a=new Pi(t,n),l=new Te(a,new xr(o));(o==null?void 0:o.interactive)!==void 0&&Bt(l,o.interactive,c(this,P)),l.id=e,a.mesh.userData={entityId:e,type:"custom-geometry"},c(this,P).geometry3DMap.set(l.id,l);let u=this.getParentContainer(s);s&&u instanceof Ne?u.addEntity(l):c(this,P).geometryScene.addEntity(l),c(this,O).panBoundsSystem.dirty=!0,c(this,Be).call(this),this.render()}return{id:e,type:"custom-geometry"}}registerPlugin(e){c(this,O).pluginSystem.registerPlugin(e)}unregisterPlugin(e){c(this,O).pluginSystem.unregisterPlugin(e)}addGeometryGroup(e,t,n,o){var s,a,u;if(!c(this,P).geometry3DMap.has(e)&&!c(this,P).geometry2DMap.has(e)){let m=new mt(e);c(this,Kn).call(this,m,()=>{c(this,Be).call(this),c(this,kt).call(this)}),m.userData.dirty=!0,c(this,P).geometry3DMap.set(e,m);let h=typeof n=="function"?n(t.features[0]):n;(h==null?void 0:h.altitude)!=null&&(m.position.z=h.altitude);for(let f of t.features){if(f.geometry==null||!["Polygon","MultiPolygon","LineString","MultiLineString"].includes(f.geometry.type))continue;let b=(f==null?void 0:f.id)||((s=f==null?void 0:f.properties)==null?void 0:s.id)||ai(),x={color:Ks};if(typeof n=="function")x=(a=n(f))!=null?a:{color:Ks};else{let l=n||{color:Ks},{visible:g,altitude:S}=l;x=Ms(l,["visible","altitude"])}let y=c(this,O).meshOptimizationSystem.createEntityFromFeature(b,f,V({outline:!0},x));c(this,P).geometry3DMap.set(b,y),m.userData.entities3D.add(b),c(this,O).textureSystem.dirty=!0}(h==null?void 0:h.__EXPERIMENTAL_maskEnabled)===!0&&Ac(m,{enabled:h.__EXPERIMENTAL_maskEnabled,maskId:h.__EXPERIMENTAL_maskId,effect:h.__EXPERIMENTAL_maskEffect,mode:h.__EXPERIMENTAL_maskMode}),m.setVisible((u=h==null?void 0:h.visible)!=null?u:!0);let d=this.getParentContainer(o);d instanceof Ne&&d.addEntity(m),c(this,O).panBoundsSystem.dirty=!0,c(this,Be).call(this),this.render()}else $.error("Geometry group with ID '".concat(e,"' already exists. The geometry group cannot be added."));return c(this,O).outlineInterpolationSystem.geometries3DDirty=!0,{id:e,type:"geometry-group"}}addOccluder(e,t){let n=this.getParentContainer(t),o=c(this,O).occlusion2DSystem.reserveOccluderId();return n==null||n.addOccluderFeature(e,o),o}addImage(e,t,n,o){var s;try{Jm(e,t,n)}catch(a){$.error(a);return}if(!c(this,P).geometry3DMap.has(e)&&!c(this,P).geometry2DMap.has(e)){let a=new Ba(t),l=new Te(a,new xr(n));l.id=e||ai(),a.mesh.userData={entityId:l.id,type:"path"},c(this,P).geometry3DMap.set(l.id,l);let u=this.getParentContainer(o);u instanceof Ne&&u.addEntity(l);let m=t.geometry.coordinates;if(m){let h=this.convertTo3DMapPosition(m[1],m[0],(s=m[2])!=null?s:0);c(this,O).panBoundsSystem.expandBoundsIfOutside(h)}c(this,Be).call(this),this.render()}else $.error("Image with ID '".concat(e,"' already exists. The image cannot be added."));return{id:e,type:"image"}}addModelGroup(e,t,n,{parent:o,onComplete:s}={}){var a,l,u,m;try{Dm(e,t,n)}catch(h){$.error(h);return}if(!c(this,P).geometry3DMap.has(e)&&!c(this,P).geometry2DMap.has(e)){let h=new mt(e);c(this,Kn).call(this,h,()=>{c(this,Be).call(this),c(this,kt).call(this)}),c(this,P).geometry3DMap.set(e,h),h.userData.dirty=!0,h.userData.modelURL=n.url;for(let b of t.features){let x=b.id||b.properties.id||ai(),y=c(this,O).modelSystem.createModelFromFeature(x,b,V({},n));(b.properties.interactive!==void 0||n.interactive!=null)&&Bt(y,(a=b.properties.interactive)!=null?a:n.interactive,c(this,P)),n.clippingPlaneZOffset!=null&&(y.components[7]=new $s,y.components[7].verticalOffset=n.clippingPlaneZOffset,n.clippingPlaneTopColor!=null&&(y.components[7].topColor=n.clippingPlaneTopColor),n.clippingPlaneTopVisible!=null&&(y.components[7].topVisible=n.clippingPlaneTopVisible)),y.parentId=h.userData.entityId,c(this,P).geometry3DMap.set(x,y),h.userData.entities3D.add(x)}let d=this.getParentContainer(o);d instanceof Ne&&d.addEntity(h);let f=(l=t.features[0])==null?void 0:l.geometry.coordinates;if(f){let b=this.convertTo3DMapPosition(f[1],f[0],(u=f[2])!=null?u:0);c(this,O).panBoundsSystem.expandBoundsIfOutside(b)}c(this,Be).call(this),(m=this.render())==null||m.then(s)}else $.error("Model group with ID '".concat(e,"' already exists. The model group cannot be added."));return{id:e,type:"geometry-group"}}addMarker2D(e,t,n,o){var a;let s=n==null?void 0:n.id;try{rd(e,t,n||{})}catch(l){$.error(l);return}if(s===void 0||!c(this,P).geometry2DMap.has(s)&&!c(this,P).geometry3DMap.has(s)){let l=te(this,wt,Wu).call(this,e,new no(t,n),n==null?void 0:n.occluderId,n==null?void 0:n.verticalOffset);l.id=s||String(l.id),s=l.id,(n==null?void 0:n.interactive)!=null&&n.interactive!=="pointer-events-auto"&&Bt(l,n==null?void 0:n.interactive,c(this,P)),(n==null?void 0:n.enabled)!=null&&qs(l,n.enabled),(n==null?void 0:n.occlude)!=null&&Ic(l,n.occlude);let u=typeof(n==null?void 0:n.attachTo)=="string"||typeof(n==null?void 0:n.attachTo)=="number"?c(this,P).geometry3DMap.get(n.attachTo):void 0;u instanceof Te&&u.attach(l),(a=this.getParentContainer(o))==null||a.addEntity(l),c(this,O).panBoundsSystem.expandBoundsIfOutside(l.object3d.position),this.render()}else $.error("Marker2D with ID '".concat(s,"' already exists. The marker cannot be added."));return{id:s,type:"marker"}}addText3D(e,t,n,o){var s;if(!c(this,P).geometry3DMap.has(e)&&!c(this,P).geometry2DMap.has(e)){let a=new Ys(Ce(V({},t),{properties:Ce(V({},t.properties),{id:e,content:t.properties.text})})),l=new Te(a,new oo(n==null?void 0:n.appearance));l.id=e,a.mesh.userData.entityId=e.toString(),a.mesh.userData.type="text3d",c(this,P).geometry3DMap.set(e,l);let u=this.getParentContainer(o);u instanceof Ne&&u.addEntity(l);let m=t.geometry.coordinates;if(m){let h=this.convertTo3DMapPosition(m[1],m[0],(s=m[2])!=null?s:0);c(this,O).panBoundsSystem.expandBoundsIfOutside(h)}c(this,Be).call(this),this.render()}else $.error("Text3D with ID '".concat(e,"' already exists. The text3d cannot be added."));return{id:e,type:"text3d"}}labelText3D(e,t,n={}){var u,m;try{if(!t||!e)throw new Error("content and meshGeometryId are required");vd.parse(n)}catch(h){$.error(h);return}let o=c(this,P).geometry3DMap.get(e);if((o==null?void 0:o.type)!=="geometry"){$.error(".labelText3D failed: target incorrect");return}let s=o==null?void 0:o.components[0];if(!s.feature.properties.textArea)return;if(s.textEntityId){let h=c(this,P).geometry3DMap.get(s.textEntityId);if((h==null?void 0:h.type)!=="text3d"){$.error(".labelText3D failed: existing text3d not found");return}return{id:h.id,type:h.type}}let a=new Ys({type:"Feature",geometry:{coordinates:(u=s.feature.properties.textArea)==null?void 0:u.position,type:"Point"},properties:{textArea:s.feature.properties.textArea,content:t,id:ai()}});a.polygonEntityId=e;let l=new Te(a,new oo(n==null?void 0:n.appearance));return s.textEntityId=l.id.toString(),a.mesh.userData.entityId=l.id.toString(),a.mesh.userData.type="text3d",c(this,P).geometry3DMap.set(l.id.toString(),l),n.parentId&&((m=this.getParentContainer(n.parentId))==null||m.addEntity(l)),this.render(),{id:l.id,type:"text3d"}}addLabel2D(e,t,n,o){var a;let s=n==null?void 0:n.id;try{td(e,t,n||{})}catch(l){$.error(l);return}if(s===void 0||!c(this,P).geometry2DMap.has(s)&&!c(this,P).geometry3DMap.has(s)){let l=te(this,wt,Wu).call(this,e,new ro(t,n||{},c(this,P).pixelRatio),n==null?void 0:n.occluderId,n==null?void 0:n.verticalOffset);l.id=s||String(l.id),s=l.id,(n==null?void 0:n.interactive)!=null&&Bt(l,n==null?void 0:n.interactive,c(this,P)),(n==null?void 0:n.enabled)!=null&&qs(l,n.enabled),(n==null?void 0:n.occlude)!=null&&Ic(l,n.occlude);let u=typeof(n==null?void 0:n.attachTo)=="string"||typeof(n==null?void 0:n.attachTo)=="number"?c(this,P).geometry3DMap.get(n.attachTo):void 0;u instanceof Te&&u.attach(l),(a=this.getParentContainer(o))==null||a.addEntity(l),c(this,O).panBoundsSystem.expandBoundsIfOutside(l.object3d.position),c(this,kt).call(this),this.render()}else $.error("Label2D with ID '".concat(s,"' already exists. The label cannot be added."));return{id:s,type:"label"}}addPath(e,t={},n){var l,u;try{vm(e,t||{})}catch(m){$.error(m);return}let o=new cn(e,Xd(t)),s=new Te(o,new xr({color:(l=t==null?void 0:t.color)!=null?l:"#ff834c",altitude:(u=t==null?void 0:t.verticalOffset)!=null?u:.1}));s.id=(t==null?void 0:t.id)||ai(),o.mesh.userData={entityId:s.id,type:"path"},c(this,P).geometry3DMap.set(s.id,s),(t==null?void 0:t.interactive)!=null&&Bt(s,t==null?void 0:t.interactive,c(this,P));let a=this.getParentContainer(n);return a instanceof Ne&&a.addEntity(s),c(this,O).panBoundsSystem.dirty=!0,c(this,Be).call(this),this.render(),{id:s.id,type:"path"}}updateWatermark(e){c(this,O).watermarkSystem.options=e,c(this,O).watermarkSystem.dirty=!0,c(this,O).twoDEntitySystem.setCollidersDirty(),this.render()}remove(e){var n,o,s;let t;if(typeof e=="string"||typeof e=="number"?(t=c(this,P).geometry2DMap.get(e),t==null&&(t=c(this,P).geometry3DMap.get(e))):typeof e.id=="string"||typeof e.id=="number"?(t=c(this,P).geometry2DMap.get(e.id),t==null&&(t=c(this,P).geometry3DMap.get(e.id))):t=e,t!=null){if(t.type==="custom-geometry")c(this,P).geometry3DMap.delete(t.id),t.object3d&&lt(t.object3d);else if(t.type==="group-container"){c(this,P).geometry3DMap.delete(t.userData.entityId);for(let a of t.childrenIds.values())this.remove(a),t.userData.entities2D.delete(a);lt(t)}else if(t.type==="geometry-group"){c(this,P).geometry3DMap.delete(t.userData.entityId);for(let a of t.userData.entities3D.values())this.remove(a),t.userData.entities3D.delete(a);lt(t)}else if(t.type==="geometry"||t.type==="model"||t.type==="path"){let a=t.components[0];if(t.entities2D.size>0){for(let u of t.entities2D.values())this.remove(u);t.removeAllEntities()}let l=(o=(n=t.parentObject3D)==null?void 0:n.userData.entityId)!=null?o:t.parentId;if(l){let u=c(this,P).geometry3DMap.get(l);u instanceof mt&&u.userData.entities3D.delete(t.id)}if(t.type==="model"){if(c(this,O).modelSystem.removeInstance(t)&&t.object3d&&lt(t.object3d),l){let m=c(this,P).geometry3DMap.get(l);if(m instanceof mt&&m.userData.entities3D.size===0){let h=!1;for(let d of m.children)if(d.children.length>0){let f=d.children[0];if(f.isInstancedMesh&&((s=f.count)!=null?s:0)>0){h=!0;break}}h||this.remove(l)}}}else t.object3d&&lt(t.object3d);if(t.type==="geometry"){let u=t.components[3];u&&(u.enabled=!1,u.dirty=!0)}"textMesh"in a&&a.textMesh!=null&&this.remove(a.textMesh.userData.entityId),c(this,P).geometry3DMap.delete(t.id)}else if(t.type==="marker"||t.type==="label"){let a=t.attachedTo;if(a){let l=c(this,P).geometry3DMap.get(a);l instanceof Te&&l.detach(t)}t.object3d&&lt(t.object3d),t.type==="label"&&c(this,O).twoDEntitySystem.deleteTextCacheEntry(t.id),c(this,P).geometry2DMap.delete(t.id)}else if(t.type==="image")t.object3d&&lt(t.object3d),c(this,P).geometry3DMap.delete(t.id);else if(t.type==="text3d"){lt(t.object3d);let{batchedText:a,textMesh:l,polygonEntityId:u}=t.components[0];if(l&&(a&&a.removeText(l),lt(l)),u){c(this,O).text3DSystem.remove(u);let m=c(this,P).geometry3DMap.get(u);(m==null?void 0:m.type)==="geometry"&&(m.components[0].textMesh=void 0,m.components[0].textEntityId=void 0)}c(this,P).geometry3DMap.delete(t.id)}c(this,Be).call(this),c(this,kt).call(this),this.render()}}getScene(){return this.getState("__scene")}getThreeScene(){return c(this,_e)}getThreeCamera(){return c(this,Fe)}async setEnvironment(e){if(c(this,_e))if(e==="basic"){c(this,$n)||_(this,$n,te(this,wt,ju).call(this));let t=await c(this,$n);c(this,_e).environment=t}else c(this,_e).environment=null}getEnvironment(){var e;return(e=c(this,_e))!=null&&e.environment?"basic":!1}getCurrentSceneGLTF(e){return c(this,O).exporterSystem.getCurrentSceneGLTF(e)}getBoundingArea(e){(c(this,O).renderSystem.threeDdirty||c(this,O).renderSystem.twoDdirty)&&this.renderSync();let t=new qe;if(e==null)t.setFromObject(c(this,P).geometryScene);else{let n=On(c(this,P),e);if((n==null?void 0:n.type)==="geometry"&&(n==null?void 0:n.object3d)!=null){let o=n.components[0],s=o instanceof Qe?o.geometry:void 0;o.mesh instanceof _s&&s?(s.computeBoundingBox(),s.boundingBox&&t.union(s.boundingBox)):t.setFromObject(n.object3d)}else((n==null?void 0:n.type)==="geometry-group"||(n==null?void 0:n.type)==="group-container")&&(n==null?void 0:n.userData.entityId)!=null&&t.setFromObject(n)}if(yi(t))return sd(t).map(this.convert3DMapPositionToCoordinate)}hasState(e){return On(c(this,P),e)!=null}getState(e){var n,o,s,a,l,u,m,h,d,f,b,x,y,g,S,M,E,w,R,I,T,C,F,L,N,z,Y,G,q,le,Q,K;if(e==null)return{type:"map-view",hoverColor:c(this,P).hoverColor,text3dHoverColor:c(this,P).text3dHoverColor};let t=On(c(this,P),e);if((t==null?void 0:t.type)==="custom-geometry"){let B=t.components[0],j=t.components[1];return{id:t.id,type:"custom-geometry",visible:j.visible,altitude:j.altitude,parent:(n=t.parentObject3D)==null?void 0:n.userData.entityId,position:this.convert3DMapPositionToCoordinate(B.position)}}else if((t==null?void 0:t.type)==="geometry-group"){let B=Array.from(t.userData.entities3D.values()),j=B==null?void 0:B[0],U=j?this.getState(j):{},ce=c(this,P),xe=this.convert3DMapPositionToCoordinate;return{id:t.userData.entityId,type:"geometry-group",visible:t.visible,altitude:t.position.z,initialColor:U==null?void 0:U.initialColor,color:U==null?void 0:U.color,side:(o=U==null?void 0:U.side)!=null?o:"double",opacity:U==null?void 0:U.opacity,height:U==null?void 0:U.height,texture:U==null?void 0:U.texture,topColor:U==null?void 0:U.topColor,topTexture:U==null?void 0:U.topTexture,interactive:Array.from(t.userData.entities3D.values()).map(ue=>c(this,P).geometry3DMap.get(ue)).every(ue=>ue&&ue.components[2]!=null),children:B,bevel:U==null?void 0:U.bevel,maskId:(s=t.components[0])==null?void 0:s.maskId,maskEnabled:(a=t.components[0])==null?void 0:a.enabled,maskEffect:(l=t.components[0])==null?void 0:l.effect,maskMode:(u=t.components[0])==null?void 0:u.mode,get position(){return Qd(t,ce,xe)}}}else{if((t==null?void 0:t.type)==="group-container")return{id:t.userData.entityId,type:"group-container",visible:t.visible,altitude:(m=t.getWorldPosition(s0).z)!=null?m:0,opacity:t.opacity,interactive:!!t.components[0],children:Array.from(t.childrenIds.values()).map(B=>this.getState(B)).filter(Boolean)};if((t==null?void 0:t.type)==="label"){let B=t.components[0],j=t.object3d.parent,U=j==null?void 0:j.userData.entityId;return{id:t.id,type:"label",text:B.text||"",parent:{id:U,type:j==null?void 0:j.type},position:this.convert3DMapPositionToCoordinate(t.position),enabled:B.enabled,visible:B.visible,initialRank:to(B.initialRank),verticalOffset:t.verticalOffset,options:{rank:to(B.rank),appearance:B.appearance,interactive:t.components[1]!=null,verticalOffset:t.verticalOffset,attachTo:t.attachedTo,occlude:(d=(h=t.components[2])==null?void 0:h.enabled)!=null?d:!1}}}else if((t==null?void 0:t.type)==="marker"){let B=t.components[0],j=t.object3d.parent,U=j==null?void 0:j.userData.entityId;return{id:t.id,type:"marker",enabled:B.enabled,visible:B.visible,placement:B.options.placement,dynamicResize:B.options.dynamicResize,parent:{id:U,type:j==null?void 0:j.type},position:this.convert3DMapPositionToCoordinate(t.position),element:B.containerEl,initialRank:to(B.initialRank),contentHTML:B.contentHtml,options:{rank:to(B.rank),interactive:t.components[1]!=null||!1,verticalOffset:t.verticalOffset,attachTo:t.attachedTo,lowPriorityPin:B.options.lowPriorityPin,occlude:(b=(f=t.components[2])==null?void 0:f.enabled)!=null?b:!1,zIndex:B.options.zIndex}}}else if((t==null?void 0:t.type)==="geometry"){let{color:B,hoverColor:j,initialColor:U,initialTopColor:ce,topColor:xe,altitude:ue}=t.components[1],ze=t.components[0],Re=t.components[4],Se=t.components[1],Me=t.components[6],De=t.components[2],Ue=t.components[3],Ye=t.parentObject3D;return{id:t.id,type:"geometry",opacity:Se.opacity,initialColor:U,color:B,focusable:Re!=null&&Re.vertices!=null&&Re.vertices.length>0,initialTopColor:ce,topColor:xe,side:Se.side,hoverColor:j,hovered:!!(De!=null&&De.hover),height:Se.height,visible:Se.visible,outline:Ue==null?void 0:Ue.enabled,showImage:Se.showImage,texture:(x=Me==null?void 0:Me.texture)==null?void 0:x.path,topTexture:(y=Me==null?void 0:Me.topTexture)==null?void 0:y.path,flipImageToFaceCamera:Se.flipImageToFaceCamera,enableImageCollisions:Se.enableImageCollisions,parent:{id:Ye==null?void 0:Ye.userData.entityId,type:Ye==null?void 0:Ye.type},altitude:ue,bevel:Se.bevel,position:this.convert3DMapPositionToCoordinate(ze.position),interactive:t.components[2]!=null,borderVisible:Se.borderVisible,borderColor:Se.borderColor,borderWidth:Se.borderWidth}}else if((t==null?void 0:t.type)==="model"){let B=t.components[0],j=t.components[1],U=t.components[2],ce=t.components[7],xe=B.feature.geometry.coordinates,ue=[xe[0],xe[1],(g=xe[2])!=null?g:0];return{id:t.id,type:"model",position:ue,interactive:U!=null,material:j.material,parent:(S=t.parentObject3D)!=null&&S.parent?{id:t.parentObject3D.parent.userData.entityId,type:t.parentObject3D.parent.type}:void 0,visible:j.visible,verticalOffset:j.verticalOffset,color:j.color,opacity:j.opacity,rotation:(M=j.rotation)!=null?M:sn,scale:(E=j.scale)!=null?E:on,clippingPlaneZOffset:(w=ce==null?void 0:ce.verticalOffset)!=null?w:j.clippingPlaneZOffset,clippingPlaneTopColor:(R=ce==null?void 0:ce.topColor)!=null?R:j.clippingPlaneTopColor,clippingPlaneTopVisible:(I=ce==null?void 0:ce.topVisible)!=null?I:j.clippingPlaneTopVisible}}else if((t==null?void 0:t.type)==="path"){let B=t.components[0],j=t.components[2],U=t.components[1];return{id:t.id,type:"path",position:this.convert3DMapPositionToCoordinate(B.position),visible:U.visible,interactive:j!=null,completeFraction:B.completeFraction,color:U.color,accentColor:B.accentColor,width:B.width,animateArrowsOnPath:B.animateArrowsOnPath,displayArrowsOnPath:B.displayArrowsOnPath,verticalOffset:U.altitude,highlightCompleteFraction:B.highlightCompleteFraction,highlightStartFraction:B.highlightStartFraction,highlightEndFraction:B.highlightEndFraction,highlightColor:B.highlightColor,highlightWidthMultiplier:B.highlightWidthMultiplier,xrayOpacity:B.xrayOpacity,smoothingTension:B.smoothingTension,smoothingCornerRadius:B.smoothingCornerRadius,dashed:B.dashed,dashLength:B.dashLength,dashGap:B.dashGap,dashRelativeToWidth:B.dashRelativeToWidth,dashSize:B.dashSize,gapSize:B.gapSize,dashAbsolute:B.dashAbsolute,dashMeters:B.dashMeters,gapMeters:B.gapMeters,__EXPERIMENTAL_GEOMETRY:B.__EXPERIMENTAL_GEOMETRY,__EXPERIMENTAL_ENDCAP_EXTENSION:B.__EXPERIMENTAL_ENDCAP_EXTENSION,__EXPERIMENTAL_BILLBOARDING:B.__EXPERIMENTAL_BILLBOARDING,__EXPERIMENTAL_BORDER:B.__EXPERIMENTAL_BORDER,__EXPERIMENTAL_PREVENT_SELF_OVERLAP:B.__EXPERIMENTAL_PREVENT_SELF_OVERLAP}}else if((t==null?void 0:t.type)==="image"){let B=t.components[0];return{id:t.id,type:"image",position:this.convert3DMapPositionToCoordinate(B.position),visible:t.components[1].visible,verticalOffset:(T=B.feature.properties.verticalOffset)!=null?T:0,opacity:t.components[1].opacity,flipImageToFaceCamera:t.components[1].flipImageToFaceCamera,width:(C=B.feature.properties.width)!=null?C:0,height:(F=B.feature.properties.height)!=null?F:0,rotation:(L=B.feature.properties.rotation)!=null?L:0}}else if((t==null?void 0:t.type)==="text3d"&&t.components[0]instanceof Ys){Yd(t);let B=t.components[0],j=t.components[1],{textMesh:U}=B,ce=B.feature.properties,xe=(N=B.mesh)==null?void 0:N.parent;xe instanceof Ne&&((z=xe.children.find(Me=>Me.type==="batchedtext"))==null||z.getWorldPosition(c(this,ss))),c(this,Zi).set(0,0,0);let ue=U?U.getWorldPosition(c(this,Zi)):c(this,Zi),ze=(q=(G=ce.rotation)!=null?G:(Y=ce.textArea)==null?void 0:Y.rotation)!=null?q:0,Re=(Q=(le=ce.content)!=null?le:ce.text)!=null?Q:"";return Object.assign({},Gr,j.getState(),{id:t.id,type:"text3d",position:this.convert3DMapPositionToCoordinate(ue.add(c(this,ss))),visible:(K=B.visible)!=null?K:!1,content:Re,rotation:ze})}else return}}getRenderedState(e){let t=typeof e=="string"||typeof e=="number"?e:e.id,n=On(c(this,P),t);if(n&&n.type==="label")return{textVisible:n.components[0].textVisible}}setState(e,t){var o,s,a,l,u,m,h;if(typeof e=="object"&&t==null){"hoverColor"in e&&(Kh(e.hoverColor)?c(this,P).hoverColor=(o=e.hoverColor)!=null?o:c(this,P).hoverColor:$.warn('Failed to update global hover color. Invalid color "'.concat(e.hoverColor,'".'))),"text3dHoverColor"in e&&(c(this,P).text3dHoverColor=(s=e.text3dHoverColor)!=null?s:c(this,P).text3dHoverColor);return}let n=On(c(this,P),e);if(n!=null){if(n.type==="custom-geometry"){let d=c(this,P).geometry3DMap.get(n.id);if(d instanceof Te&&d.components[0]instanceof Pi){let f=t;an(n,c(this,P),f.visible),ao(n,c(this,P),f.altitude),Dc(n,f.position,this.convertTo3DMapPosition,c(this,O).panBoundsSystem),Pc(n,this.getParentContainer(f.parent,!1)),Bt(n,f.interactive,c(this,P))&&c(this,Be).call(this)}}else if(n.type==="path"){let d=t;Bt(n,d.interactive,c(this,P))&&c(this,Be).call(this),ao(n,c(this,P),d.verticalOffset),Zd(n,c(this,P),d)}else if(n.type==="model"){let d=t;Bt(n,d.interactive,c(this,P))&&c(this,Be).call(this),an(n,c(this,P),d.visible),qd(n,d,this.convertTo3DMapPosition,c(this,O).panBoundsSystem),Jd(n,d)}else if(n.type==="group-container"){let d=t;an(n,c(this,P),d.visible)&&(c(this,O).pathSystem.verticalDistanceDirty=!0,c(this,O).geometryInFocusSystem.focusablesDirty=!0),ao(n,c(this,P),d.altitude)&&(c(this,O).pathSystem.verticalDistanceDirty=!0),Bt(n,d.interactive,c(this,P))&&c(this,Be).call(this),Js(n,c(this,P),d.opacity)&&(c(this,O).outlineInterpolationSystem.outlineOpacitiesDirty=!0),d.preloadGeometry&&n.userData.preloadGeometry!==!0&&(n.userData.preloadGeometry=!0,c(this,O).outlineInterpolationSystem.geometries3DDirty=!0),Qs(n,d.focusable)&&(c(this,O).geometryInFocusSystem.focusablesDirty=!0)}else if(n.type==="geometry-group"){let d=t;an(n,c(this,P),d.visible),Ad(n,c(this,P),d),Rc(n,c(this,P),d.outline),d.height!=null&&Tc(n,c(this,P),d.height),d.altitude!=null&&(n.position.z=d.altitude),Lc(n,c(this,P),d)&&(c(this,O).textureSystem.dirty=!0),Lc(n,c(this,P),d),Rd(n,c(this,P),d.shading),Js(n,c(this,P),d.opacity)&&(c(this,O).outlineInterpolationSystem.outlineOpacitiesDirty=!0),Bt(n,d.interactive,c(this,P))&&(c(this,Be).call(this),c(this,kt).call(this)),_c(n,c(this,P),d.side),Ac(n,{maskId:d.maskId,enabled:d.maskEnabled,effect:d.maskEffect,mode:d.maskMode}),Hd(n,c(this,P),{effectStart:d.effectStart,effectDistance:d.effectDistance,darkenAmount:d.darkenAmount,darkenUseDepth:d.darkenUseDepth,desaturateAmount:d.desaturateAmount,desaturateUseDepth:d.desaturateUseDepth,washOutAmount:d.washOutAmount,washOutUseDepth:d.washOutUseDepth}),d.position!=null&&(n.userData.centroid=[d.position[0],d.position[1]],n.userData.positionDirty=!0)}else if(n.type==="geometry"){if(n.components[0]instanceof Qe){let d=t;if(an(n,c(this,P),d.visible)&&c(this,Be).call(this),Rc(n,c(this,P),d.outline),_d(n,d),Qs(n,d.focusable)&&(c(this,O).geometryInFocusSystem.focusablesDirty=!0),Wd(n,d.renderOrder)&&(c(this,O).meshDetachmentSystem.dirty=!0),Vd(n,d.opacity)&&(c(this,O).meshDetachmentSystem.dirty=!0,c(this,O).interactionSystem.dirty3D=!0,c(this,O).outlineInterpolationSystem.outlineOpacitiesDirty=!0),Oc(n,d.flipImageToFaceCamera),zd(n,d.enableImageCollisions),ao(n,c(this,P),d.altitude)){let f=n.components[1],b=((a=f.altitude)!=null?a:0)+((l=f.height)!=null?l:0);c(this,O).panBoundsSystem.expandBoundsIfOutside(new k(0,0,b)),c(this,O).shadowsSystem&&(c(this,O).shadowsSystem.needsRender=!0)}if(d.height!=null&&Tc(n,c(this,P),d.height)){let f=n.components[1],b=((u=f.altitude)!=null?u:0)+((m=f.height)!=null?m:0);c(this,O).panBoundsSystem.expandBoundsIfOutside(new k(0,0,b)),c(this,O).shadowsSystem&&(c(this,O).shadowsSystem.needsRender=!0)}Ud(n,d)&&(c(this,O).meshDetachmentSystem.dirty=!0,c(this,O).textureSystem.dirty=!0),Fd(n,d,(h=c(this,P).outlinesOptions)==null?void 0:h.darkenFactor),Bd(n,d.hoverColor),Bt(n,d.interactive,c(this,P))&&(c(this,O).interactionSystem.dirty3D=!0),kd(n,d.hovered),_c(n,c(this,P),d.side),jd(n,d)}}else if(n.type==="label"||n.type==="marker"){let d=t;Nd(n,d,c(this,P)),Gd(n,d,c(this,P))&&(c(this,kt).call(this),c(this,O).twoDEntitySystem.markDirty()),Dc(n,d.position,this.convertTo3DMapPosition,c(this,O).panBoundsSystem),Pc(n,this.getParentContainer(d.parent,!1))&&(c(this,kt).call(this),c(this,O).panBoundsSystem.dirty=!0),qs(n,d.enabled),an(n,c(this,P),d.visible)}else if(n.type==="image"){let d=t;an(n,c(this,P),d.visible),Js(n,c(this,P),d.opacity),Oc(n,d.flipImageToFaceCamera)}else if(n.type==="text3d"){let d=t;$d(n,c(this,P),d)}this.render()}}convertTo3DMapPosition(e,t,n=0,o){var l,u,m,h,d;if(Array.isArray(e))return this.convertTo3DMapPosition(e[1],e[0],(l=e[2])!=null?l:n,typeof t=="function"?t:void 0);if(typeof t!="number")throw new Error("convertTo3DMapPosition failed: longitude must be a number");let{x:s,y:a}=Vs((m=(u=c(this,P).center)==null?void 0:u[1])!=null?m:0,(d=(h=c(this,P).center)==null?void 0:h[0])!=null?d:0,e,t);return o?(o.set(s,a,n),o):new k(s,a,n)}get backgroundColor(){return typeof c(this,Xe).backgroundColor=="string"?c(this,Xe).backgroundColor:"#".concat(c(this,Xe).backgroundColor.getHexString())}get backgroundAlpha(){return c(this,Xe).backgroundAlpha}getThreeRenderer(){return c(this,Xe)}getCenter(e){let t=Array.isArray(e)?e:this.getBoundingArea(e);return t?pd(t):void 0}isInView(e){let t=On(c(this,P),e);if(c(this,is).identity().multiply(c(this,Fe).projectionMatrix).multiply(c(this,Fe).matrixWorldInverse),c(this,ei).setFromProjectionMatrix(c(this,is)),t instanceof Sc)return c(this,ei).containsPoint(t.position);if(t instanceof Te){let n=t==null?void 0:t.components[0];if(n instanceof Pi||n instanceof un)return c(this,ei).containsPoint(this.convertTo3DMapPosition(n.feature.geometry.coordinates));if(n instanceof Qe){let o=new qe(this.convertTo3DMapPosition(n.featureBbox[1],n.featureBbox[0],0),this.convertTo3DMapPosition(n.featureBbox[3],n.featureBbox[2],0));return c(this,ei).intersectsBox(o)}}return!1}queryGeometry2DInView(e){let{screenOffsets:t,fullyContains:n}=e!=null?e:{},[o,s,a,l]=yd(this.container,t),u=new pt(o,s,a,l);return c(this,O).twoDEntitySystem.visibleCollidersQTree.queryRect(u).filter(f=>n?u.contains(f):u.intersects(f)).map(f=>c(this,P).geometry2DMap.get(f.userData.entityId)).filter(f=>f!=null).filter(f=>f.components[0]instanceof ro||f.components[0]instanceof no).map(f=>f.id.toString())}onMapLibreEvent(e,t){if(!this.map){$.warn('Tried to add event listener "'.concat(e,'" but MapLibre map is not initialized.'));return}let n=this.map.on(e,t);n!=null&&n.unsubscribe&&this.onAbort(()=>n.unsubscribe())}offMapLibreEvent(e,t){this.map&&this.map.off(e,t)}getSystems(){return c(this,O)}getInternalState(){return c(this,P)}getInternalTweenGroup(){return c(this,P).internalTweenGroup}getExternalTweenGroup(){return c(this,P).externalTweenGroup}computeMinZOffsetBetweenContainers(e,t,n){if(!e||!t)return-1;Gc(e,"group-container"),Gc(t,"group-container"),e.updateMatrixWorld(!0),t.updateMatrixWorld(!0);let o=js(e,this.getThreeCamera()),s=t.clone(!0);Ws(s,!0),s.updateMatrixWorld();let a=js(s,this.getThreeCamera());if(!yi(o)||!yi(a))return-1;let l=0,u;n&&this.container.querySelectorAll(".debug-box").forEach(h=>h.remove());do{if(l>1e4)return-1;if(l+=20,s.setAltitude(l),a.makeEmpty(),js(s,c(this,Fe),a),u=o.intersectsBox(a),n){let m=Cc(o,"blue",this.container),h=Cc(a,u?"red":"green",this.container);m.classList.add("debug-box"),h.classList.add("debug-box")}}while(u);return l}};_e=new WeakMap,Fe=new WeakMap,$n=new WeakMap,qn=new WeakMap,Vi=new WeakMap,Sn=new WeakMap,Jn=new WeakMap,Qn=new WeakMap,wt=new WeakSet,Vu=function(e){var t;c(this,Zr)!=="outdoors-overlay"&&((t=this.map)==null||t.setPixelRatio(e)),c(this,P).pixelRatio=this.resolutionScale},P=new WeakMap,We=new WeakMap,Mn=new WeakMap,Ct=new WeakMap,Xe=new WeakMap,O=new WeakMap,Nl=new WeakMap,kt=new WeakMap,Be=new WeakMap,Bl=new WeakMap,Kn=new WeakMap,Df=function(){_(this,We,document.createElement("div")),c(this,We).classList.add("mappedin__smart-collision-engine__container"),_(this,Mn,document.createElement("canvas")),c(this,Mn).classList.add("mappedin__smart-collision-engine-debug__container"),this.container.appendChild(c(this,We)),_(this,Ct,document.createElement("canvas")),c(this,Ct).classList.add("mappedin__smart-collision-engine__container"),c(this,Ct).width=c(this,We).clientWidth*this.resolutionScale,c(this,Ct).height=c(this,We).clientHeight*this.resolutionScale,c(this,Ct).style.width=c(this,We).clientWidth+"px",c(this,Ct).style.height=c(this,We).clientHeight+"px",c(this,We).appendChild(c(this,Mn)),c(this,We).appendChild(c(this,Ct)),c(this,Mn).width=c(this,We).clientWidth,c(this,Mn).height=c(this,We).clientHeight,c(this,Ct).width=c(this,We).clientWidth*this.resolutionScale,c(this,Ct).height=c(this,We).clientHeight*this.resolutionScale,c(this,Ct).style.width=c(this,We).clientWidth+"px",c(this,Ct).style.height=c(this,We).clientHeight+"px"},Pf=function(){c(this,O).twoDEntitySystem.markDirty()},Zr=new WeakMap,kl=new WeakMap,es=new WeakMap,zl=new WeakMap,Ul=new WeakMap,Wi=new WeakMap,ji=new WeakMap,Hl=new WeakMap,ts=new WeakMap,rs=new WeakMap,ns=new WeakMap,Wu=function(e,t,n,o){let s=new Sc(t,this.convertTo3DMapPosition(e[1],e[0],e[2]||0),o);return s.components[2]=new Tl(n!=null?n:c(this,O).occlusion2DSystem.backgroundId),c(this,P).geometry2DMap.set(s.id,s),s},ei=new WeakMap,is=new WeakMap,os=new WeakMap,Xr=new WeakMap,Yr=new WeakMap,ju=async function(){return dn.load(rm).then(e=>{var t;return c(this,_e)&&((t=c(this,_e).environment)==null||t.dispose(),e.mapping=Ph,c(this,_e).environment=e,this.render()),e})},Vl=new WeakMap,fe=new WeakMap,Zi=new WeakMap,ss=new WeakMap;var s0=new k,ti=Hu;v();function a0(i,r){l0(i,r)(i.getScene(),r),c0(i,r),r.addFolder("Export").add({export:async()=>{let s=await i.getCurrentSceneGLTF({binary:!0}),a=new Blob([s],{type:"application/octet-stream"});var l=document.createElement("a");document.body.appendChild(l),l.style.display="none";let u=window.URL.createObjectURL(a);l.href=u,l.download="scene.glb",l.click(),window.URL.revokeObjectURL(u)}},"export");let n=r.addFolder("Camera"),o={get bearing(){return i.camera.bearing},set bearing(s){i.camera.setBearing(s)},get pitch(){return i.camera.pitch},set pitch(s){i.camera.setPitch(s)},get zoomLevel(){return i.camera.zoomLevel},set zoomLevel(s){i.camera.setZoomLevel(s)}};n.add(o,"bearing",-359,359,1),n.add(o,"pitch",i.camera.minPitch,i.camera.maxPitch,1),n.add(o,"zoomLevel",i.camera.minZoomLevel,i.camera.maxZoomLevel,.1)}function l0(i,r){let e=r;return function t(n,o){let s=o.addFolder("".concat([n.type]," ").concat(n.id.slice(0,16)));if(o.close(),n.type==="geometry"||n.type==="model"||n.type==="path"||n.type==="image"){let a={get height(){let l=i.getState(n.id);return(l==null?void 0:l.type)==="geometry"?l.height:0},set height(l){let u=i.getState(n.id);(u==null?void 0:u.type)==="geometry"&&i.setState(n,{height:l})},set flipImageToFaceCamera(l){let u=i.getState(n.id);(u==null?void 0:u.type)==="image"&&i.setState(n,{flipImageToFaceCamera:l})},get flipImageToFaceCamera(){let l=i.getState(n.id);return(l==null?void 0:l.type)==="image"?l.flipImageToFaceCamera:!1},set visible(l){let u=i.getState(n.id);((u==null?void 0:u.type)==="geometry"||(u==null?void 0:u.type)==="path"||(u==null?void 0:u.type)==="image")&&i.setState(n,{visible:l})},get visible(){let l=i.getState(n.id);return(l==null?void 0:l.type)==="geometry"||(l==null?void 0:l.type)==="path"||(l==null?void 0:l.type)==="image"?l.visible:!1},set outline(l){let u=i.getState(n.id);(u==null?void 0:u.type)==="geometry"&&i.setState(n,{outline:l})},get outline(){let l=i.getState(n.id);return(l==null?void 0:l.type)==="geometry"?l.outline:!1},get opacity(){let l=i.getState(n.id);return(l==null?void 0:l.type)==="geometry"?l.opacity:1},set opacity(l){let u=i.getState(n.id);(u==null?void 0:u.type)==="geometry"&&i.setState(u,{opacity:l})},get color(){let l=i.getState(n.id);return(l==null?void 0:l.type)==="geometry"&&l.color?Ed(l.color).toHexString():"#ffffff"},set color(l){let u=i.getState(n.id);(u==null?void 0:u.type)==="geometry"&&i.setState(u,{color:l})},set interactive(l){let u=i.getState(n.id);((u==null?void 0:u.type)==="geometry"||(u==null?void 0:u.type)==="model"||(u==null?void 0:u.type)==="path")&&(i.setState(n,{interactive:l}),e.controllersRecursive().forEach(m=>m.updateDisplay()))},get interactive(){let l=i.getState(n.id);return(l==null?void 0:l.type)==="geometry"||(l==null?void 0:l.type)==="model"||(l==null?void 0:l.type)==="path"?l.interactive:!1},get completeFraction(){let l=i.getState(n.id);return(l==null?void 0:l.type)==="path"?l.completeFraction:1},set completeFraction(l){let u=i.getState(n.id);(u==null?void 0:u.type)==="path"&&i.setState(u,{completeFraction:l})},focus:()=>{}};s.add(a,"focus").onChange(()=>{let l=i.getState(n.id);(l==null?void 0:l.type)==="model"||(l==null?void 0:l.type)==="path"||(l==null?void 0:l.type)==="image"?i.camera.focusOn([l.position]):(l==null?void 0:l.type)==="geometry"&&i.camera.focusOn(i.getBoundingArea(l))}),s.add(a,"visible"),n.type==="image"?s.add(a,"flipImageToFaceCamera"):(s.add(a,"interactive"),n.type==="path"&&s.add(a,"completeFraction",0,1,.1),n.type!=="model"&&(s.addColor(a,"color"),s.add(a,"outline"))),n.type==="geometry"&&(s.add(a,"height"),s.add(a,"opacity",0,1,.1))}else if(n.type==="marker"){let a={get interactive(){var u;let l=i.getState(n.id);return(l==null?void 0:l.type)==="marker"?(u=l.options)==null?void 0:u.interactive:!1},set interactive(l){let u=i.getState(n.id);(u==null?void 0:u.type)==="marker"&&(i.setState(u,{options:{interactive:l}}),e.controllersRecursive().forEach(m=>m.updateDisplay()))},focus:()=>{}};s.add(a,"focus").onChange(()=>{let l=i.getState(n.id);(l==null?void 0:l.type)==="marker"&&i.camera.focusOn([l.position])}),s.add(a,"interactive")}else if(n.type==="label"){let a={get interactive(){var u;let l=i.getState(n.id);return(l==null?void 0:l.type)==="label"?(u=l.options)==null?void 0:u.interactive:!1},set interactive(l){let u=i.getState(n.id);(u==null?void 0:u.type)==="label"&&(i.setState(u,{options:{interactive:l}}),e.controllersRecursive().forEach(m=>m.updateDisplay()))},get text(){let l=i.getState(n.id);return(l==null?void 0:l.type)==="label"?l.text:""},set text(l){let u=i.getState(n.id);(u==null?void 0:u.type)==="label"&&i.setState(u,{text:l})},get"Text Color"(){var u;let l=i.getState(n.id);return(l==null?void 0:l.type)==="label"?(u=l.options.appearance)==null?void 0:u.textColor:"#000000"},set"Text Color"(l){let u=i.getState(n.id);(u==null?void 0:u.type)==="label"&&i.setState(n.id,{text:a.text,options:{appearance:{textColor:l}}})},get"Text Size"(){var u;let l=i.getState(n.id);return(l==null?void 0:l.type)==="label"?(u=l.options.appearance)==null?void 0:u.textSize:10},set"Text Size"(l){let u=i.getState(n.id);(u==null?void 0:u.type)==="label"&&i.setState(u,{text:a.text,options:{appearance:{textSize:l}}})},get"Icon Size"(){var u;let l=i.getState(n.id);return(l==null?void 0:l.type)==="label"?(u=l.options.appearance)==null?void 0:u.iconSize:10},set"Icon Size"(l){let u=i.getState(n.id);(u==null?void 0:u.type)==="label"&&i.setState(u,{text:a.text,options:{appearance:{iconSize:l}}})},get"Pin Color"(){var u;let l=i.getState(n.id);return(l==null?void 0:l.type)==="label"?(u=l.options.appearance)==null?void 0:u.pinColor:"#000000"},set"Pin Color"(l){let u=i.getState(n.id);(u==null?void 0:u.type)==="label"&&i.setState(u,{text:a.text,options:{appearance:{pinColor:l}}})},get"Pin Color Inactive"(){var u;let l=i.getState(n.id);return(l==null?void 0:l.type)==="label"?(u=l.options.appearance)==null?void 0:u.pinColorInactive:"#000000"},set"Pin Color Inactive"(l){let u=i.getState(n.id);(u==null?void 0:u.type)==="label"&&i.setState(u,{text:a.text,options:{appearance:{pinColorInactive:l}}})},get"Pin Outline Color"(){var u;let l=i.getState(n.id);return(l==null?void 0:l.type)==="label"?(u=l.options.appearance)==null?void 0:u.pinOutlineColor:"#000000"},set"Pin Outline Color"(l){let u=i.getState(n.id);(u==null?void 0:u.type)==="label"&&i.setState(u,{text:a.text,options:{appearance:{pinOutlineColor:l}}})},get"Pin Outline Color Inactive"(){var u;let l=i.getState(n.id);return(l==null?void 0:l.type)==="label"?(u=l.options.appearance)==null?void 0:u.pinOutlineColorInactive:"#000000"},set"Pin Outline Color Inactive"(l){let u=i.getState(n.id);(u==null?void 0:u.type)==="label"&&i.setState(u,{text:a.text,options:{appearance:{pinOutlineColorInactive:l}}})},focus:()=>{}};s.add(a,"focus").onChange(()=>{let l=i.getState(n.id);(l==null?void 0:l.type)==="label"&&i.camera.focusOn([l.position])}),s.add(a,"interactive"),s.add(a,"text"),s.add(a,"Text Size",10,50),s.add(a,"Icon Size",10,50),s.addColor(a,"Text Color"),s.addColor(a,"Active Background Color"),s.addColor(a,"Inactive Background Color"),s.addColor(a,"Active Foreground Color"),s.addColor(a,"Inactive Foreground Color")}else if(n.type==="geometry-group"){let a={get opacity(){let l=i.getState(n.id);return(l==null?void 0:l.type)==="geometry-group"?l.opacity:1},set opacity(l){let u=i.getState(n.id);(u==null?void 0:u.type)==="geometry-group"&&i.setState(n,{opacity:l})},set visible(l){let u=i.getState(n.id);(u==null?void 0:u.type)==="geometry-group"&&i.setState(n,{visible:l})},get visible(){let l=i.getState(n.id);return(l==null?void 0:l.type)==="geometry-group"?l.visible:!1},set outline(l){let u=i.getState(n.id);(u==null?void 0:u.type)==="geometry-group"&&i.setState(n,{outline:l})},get outline(){let l=i.getState(n.id);return(l==null?void 0:l.type)==="geometry-group"?l.outline:!1},set altitude(l){let u=i.getState(n.id);(u==null?void 0:u.type)==="geometry-group"&&i.setState(n,{altitude:l})},get altitude(){let l=i.getState(n.id);return(l==null?void 0:l.type)==="geometry-group"?l.altitude:0},set interactive(l){let u=i.getState(n.id);(u==null?void 0:u.type)==="geometry-group"&&(i.setState(n,{interactive:l}),e.controllersRecursive().forEach(m=>m.updateDisplay()))},get interactive(){let l=i.getState(n.id);return(l==null?void 0:l.type)==="geometry-group"?l.interactive:!1},get shadingStart(){var u,m;let l=i.getState(n.id);return(l==null?void 0:l.type)==="geometry-group"&&(m=(u=l.shading)==null?void 0:u.start)!=null?m:0},set shadingStart(l){let u=i.getState(n.id);(u==null?void 0:u.type)==="geometry-group"&&i.setState(u,{shading:{start:l}})},get shadingEnd(){var u,m;let l=i.getState(n.id);return(l==null?void 0:l.type)==="geometry-group"&&(m=(u=l.shading)==null?void 0:u.end)!=null?m:0},set shadingEnd(l){let u=i.getState(n.id);(u==null?void 0:u.type)==="geometry-group"&&i.setState(u,{shading:{end:l}})},get shadingIntensity(){var u,m;let l=i.getState(n.id);return(l==null?void 0:l.type)==="geometry-group"&&(m=(u=l.shading)==null?void 0:u.intensity)!=null?m:0},set shadingIntensity(l){let u=i.getState(n.id);(u==null?void 0:u.type)==="geometry-group"&&i.setState(u,{shading:{intensity:l}})}};s.add(a,"visible"),s.add(a,"opacity",0,1,.1),s.add(a,"interactive"),s.add(a,"outline"),s.add(a,"altitude",0,100,1),s.add(a,"shadingStart",0,1,.1),s.add(a,"shadingEnd",0,1,.1),s.add(a,"shadingIntensity",0,1,.1)}else if(n.type==="group-container"){let a={set visible(l){let u=i.getState(n.id);(u==null?void 0:u.type)==="group-container"&&i.setState(n,{visible:l})},get visible(){let l=i.getState(n.id);return(l==null?void 0:l.type)==="group-container"?l.visible:!1},set interactive(l){let u=i.getState(n.id);(u==null?void 0:u.type)==="group-container"&&(i.setState(u,{interactive:l}),e.controllersRecursive().forEach(m=>m.updateDisplay()))},get interactive(){let l=i.getState(n.id);return(l==null?void 0:l.type)==="group-container"?l.interactive:!1}};s.add(a,"visible"),s.add(a,"interactive")}if(s.close(),n.children)for(let a of n.children.values())t(a,s)}}function c0(i,r){let e=r.addFolder("Watermark"),t={padding:16,iconOnly:!1,position:"bottom-left",color:"dark",scale:1};e.add(t,"padding",0,100,1),e.add(t,"scale",.5,1.5,.1),e.add(t,"color",["dark","light"]),e.add(t,"position",["top-left","top-right","bottom-left","bottom-right","center","top","bottom","left","right"]),e.add(t,"iconOnly"),e.onChange(()=>{i.updateWatermark(t)})}v();var $u=class extends ye{constructor(e,t){super();p(this,"gl");p(this,"options");p(this,"el",document.createElement("div"));p(this,"core");p(this,"origin");p(this,"map");p(this,"layer");p(this,"handleStyleChange",()=>{!this.map||!this.layer||this.map.getLayer(this.layer.id)||(this.map.addLayer(this.layer),this.core.camera.setMinZoomLevel(this.map.getMinZoom()),this.core.camera.setMaxZoomLevel(this.map.getMaxZoom()),this.core.camera.setMinPitch(this.map.getMinPitch()),this.core.camera.setMaxPitch(this.map.getMaxPitch()))});p(this,"handleMove",()=>{if(!this.map)return;let[e,t]=this.map.getCenter().toArray();this.core.getSystems().cameraSystem.setCenter(e,t),this.core.getSystems().cameraSystem.setZoomLevel(this.map.getZoom()),this.core.getSystems().cameraSystem.setRotation(de.degToRad(this.map.getBearing())),this.core.getSystems().cameraSystem.setTilt(de.degToRad(this.map.getPitch()))});p(this,"handleError",e=>{$.warn(e)});this.origin=e,this.options=t}onAdd(e){this.origin=this.origin||e.getCenter().toArray(),this.gl=e.painter.context.gl,this.core=new ti(e._container,Ce(V({},this.options),{center:this.origin,zoomLevel:e.getZoom(),pitch:e.getPitch(),bearing:e.getBearing(),gl:this.gl,map:e,mode:"outdoors-overlay"})),this.map=e,this.core.camera.setMinZoomLevel(e.getMinZoom()),this.core.camera.setMaxZoomLevel(e.getMaxZoom()),this.core.camera.setMinPitch(e.getMinPitch()),this.core.camera.setMaxPitch(e.getMaxPitch()),this.map.on("error",this.handleError);let t=ks.fromLngLat(this.origin,0);return this.layer=Us(t,this.core.viewCamera,()=>{this.core.renderSync()}),this.map.on("styledata",this.handleStyleChange),this.map.on("move",this.handleMove),this.handleStyleChange(),this.el}onRemove(){this.map&&(this.map.off("styledata",this.handleStyleChange),this.map.off("move",this.handleMove),this.map.off("error",this.handleError),this.layer&&this.map.removeLayer(this.layer.id)),this.layer=void 0,this.map=void 0,this.core&&this.core.destroy(),this.core=void 0}};v();v();v();v();v();v();var Tt=class{constructor({origin:r,destination:e,distance:t=0,angle:n=0,pathWeight:o=0,multiplicativeDistanceWeightScaling:s=!0}){p(this,"origin");p(this,"destination");p(this,"distance");p(this,"angle");p(this,"weight");if(this.origin=r,this.destination=e,this.distance=t,this.angle=n,this.weight=o||0,s?r.properties.floor===e.properties.floor&&(this.weight=(this.weight>=0?this.distance*this.weight:0)+this.distance):r.properties.map===e.properties.map&&(this.weight=this.weight>=0?this.distance+this.weight:0),isNaN(this.angle))throw new Error("Invalid angle: Expected a numeric value, but received NaN.")}};v();v();v();v();v();function ut([i,r],[e,t]){let n=r-t,o=i-e;return(Math.atan2(o,n)+Math.PI*3)%(Math.PI*2)}v();v();function Wl(i,r,e,t){let[n,o]=i,[s,a]=r,[l,u]=e,[m,h]=t;if(o===a&&n===s||u===h&&l===m)return null;let d=(m-l)*(a-o)-(h-u)*(s-n);if(d===0)return null;let f=((h-u)*(n-l)-(m-l)*(o-u))/d,b=((a-o)*(n-l)-(s-n)*(o-u))/d;if(f<0||f>1||b<0||b>1)return null;let x=o+f*(a-o);return[n+f*(s-n),x]}v();v();function jl(i,r,e,t){t===void 0&&(t={});var n=Za(i),o=Ps(n[0]),s=Ps(n[1]),a=Ps(e),l=Eh(r,t.units),u=Math.asin(Math.sin(s)*Math.cos(l)+Math.cos(s)*Math.sin(l)*Math.cos(a)),m=o+Math.atan2(Math.sin(a)*Math.sin(l)*Math.cos(s),Math.cos(l)-Math.sin(s)*Math.sin(u)),h=hc(m),d=hc(u);return ws([h,d],t.properties)}function qu(i,r,e,t){let n=jl(i,e/1e3,t),o=jl(r,e/1e3,t);return[n.geometry.coordinates,o.geometry.coordinates]}v();function Ju(i){let r=i*(180/Math.PI);return r=r%360,r>180?r-=360:r<-180&&(r+=360),Object.is(r,-0)?0:r}var If=111e3;function ur(i,r,e=[],t=0){let n=!0,o=i.geometry.coordinates,s=r.geometry.coordinates,a=Ju(ut(o,s)-Math.PI/2),l=Ju(ut(o,s)+Math.PI/2),u=t/If,m=t/(If*Math.cos(o[1]*Math.PI/180)),h=Math.min(o[1],s[1])-u,d=Math.max(o[1],s[1])+u,f=Math.min(o[0],s[0])-m,b=Math.max(o[0],s[0])+m;for(let x of e)if(!(Math.max(x[0][1],x[1][1])<h||Math.min(x[0][1],x[1][1])>d||Math.max(x[0][0],x[1][0])<f||Math.min(x[0][0],x[1][0])>b)){if(t>0){let y=qu(o,s,t,a),g=qu(o,s,t,l);if(Wl(y[0],y[1],x[0],x[1])||Wl(g[0],g[1],x[0],x[1]))return n=!1,!1}else if(Wl(o,s,x[0],x[1]))return n=!1,!1}return n}v();function Of(i,r=.5){let[e,t]=i,n=(e.x+t.x)/2,o=(e.y+t.y)/2,s=t.x-e.x,l=-(t.y-e.y),u=s,m=Math.sqrt(l*l+u*u),h=l/m,d=u/m,f={x:n+h*r,y:o+d*r},b={x:n-h*r,y:o-d*r};return[f,b]}var as=.4,ri,ht,Qu,Lf,Af,Rf,_f,Ff,Gf,Xl,Zl=class{constructor({nodes:r,groupBy:e,multiplicativeDistanceWeightScaling:t}){A(this,ht);p(this,"edges",{});p(this,"nodesById");p(this,"nodesByGroup",new Map);A(this,ri);p(this,"hasLineOfSight",(r,e,t=[],n=as)=>ur({type:"Feature",properties:{id:"origin",neighbors:[]},geometry:{type:"Point",coordinates:r}},{type:"Feature",properties:{id:"destination",neighbors:[]},geometry:{type:"Point",coordinates:e}},t,n)===!0);A(this,Xl,(r,e)=>{let t=0;for(let n of e)(!n[c(this,ri)]||n[c(this,ri)]===r.properties[c(this,ri)])&&zr(r.geometry.coordinates,n.geometry.geometry)&&(t+=Math.max(0,n.cost));return t});_(this,ri,e);let{features:n}=r;this.nodesById=te(this,ht,Lf).call(this,n),te(this,ht,Af).call(this),te(this,ht,Rf).call(this,n,e,{multiplicativeDistanceWeightScaling:t})}getShortestEuclideanDistance(r,e){return e.reduce((t,n)=>{let o=Tm(r.geometry.coordinates,n.geometry.coordinates);return Math.min(t,o)},Number.MAX_VALUE)}dijkstraFindWithinTravelDistance(r,e,t,n,o,s){var f;let a=this.nodesById[r];if(!a)return[];let l=[],u={},m={},h=new Set,d=[];for(l.push({node:a,distance:0}),u[a.properties.id]=null,m[a.properties.id]=0;l.length>0;){l.sort((g,S)=>g.distance-S.distance);let b=l.shift();if(!b)break;let x=b.node,y=b.distance;if(!h.has(x.properties.id)){if(h.add(x.properties.id),d.length>=s)break;x.properties.id!=null&&t.includes((f=x.properties.id)==null?void 0:f.toString())&&(o?this.hasLineOfSight(a.geometry.coordinates,x.geometry.coordinates,n)&&d.push({feature:x,distance:y}):d.push({feature:x,distance:y}));for(let g of this.edges[x.properties.id]){let S=g.destination,M=y+g.distance,E=m[x.properties.id]+g.weight;M>e||h.has(S.properties.id)||m[S.properties.id]!==void 0&&E>=m[S.properties.id]||(m[S.properties.id]=E,u[S.properties.id]=g,l.push({node:S,distance:M}))}}}return d.sort((b,x)=>b.distance-x.distance)}aStar({originIds:r,destinationNodeIds:e,disabledConnectionNodeIds:t,zones:n,overrideEdgeWeights:o,disabledNodeIds:s}){var d;let a=te(this,ht,Qu).call(this,r),l=te(this,ht,Qu).call(this,e);if(a.length===0||l.length===0)return[];let{frontier:u,cameFrom:m,costSoFar:h}=te(this,ht,_f).call(this,a,l);for(;u.length>0;){let f=u.shift();if(!f)break;if(te(this,ht,Ff).call(this,f.origin,l))return te(this,ht,Gf).call(this,m,f.origin.properties.id);for(let b of this.edges[f.origin.properties.id]){let x=(d=o==null?void 0:o.get(b))!=null?d:b.weight,y=b.destination.properties.map!==b.origin.properties.map,g=t==null?void 0:t.has(b.destination.properties.id);if(t!=null&&t.has(b.origin.properties.id)&&(y||g)||s!=null&&s.has(b.origin.properties.id))continue;let S=h[f.origin.properties.id]+x+c(this,Xl).call(this,b.destination,n);if(S!==1/0&&(h[b.destination.properties.id]==null||S<h[b.destination.properties.id])){let M=S+this.getShortestEuclideanDistance(b.destination,l);h[b.destination.properties.id]=S,m[b.destination.properties.id]=b,u.push({origin:b.destination,priority:M})}}u.sort((b,x)=>b.priority-x.priority)}return[]}};ri=new WeakMap,ht=new WeakSet,Qu=function(r){return r.map(e=>this.nodesById[e]).filter(Boolean)},Lf=function(r){return r.reduce((e,t)=>(e[t.properties.id]=t,e),{})},Af=function(){for(let r in this.nodesById)this.nodesById.hasOwnProperty(r)&&(this.nodesById[r].properties.neighbors=this.nodesById[r].properties.neighbors.filter(({id:e})=>!!this.nodesById[e]))},Rf=function(r,e,t){r.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:s,weight:a})=>{let l=this.nodesById[s],u=ft(n.geometry.coordinates,l.geometry.coordinates),m=ut(n.geometry.coordinates,l.geometry.coordinates);return new Tt({origin:n,destination:l,pathWeight:a,distance:u,angle:m,multiplicativeDistanceWeightScaling:t==null?void 0:t.multiplicativeDistanceWeightScaling})})})},_f=function(r,e){let t=[],n={},o={};return r.forEach(s=>{let a=this.getShortestEuclideanDistance(s,e);t.push({origin:s,priority:a}),n[s.properties.id]=null,o[s.properties.id]=0}),t.sort((s,a)=>s.priority-a.priority),{frontier:t,cameFrom:n,costSoFar:o}},Ff=function(r,e){return e.some(t=>t.properties.id===r.properties.id)},Gf=function(r,e){let t=[],n=r[e];for(;n;)t.push(n),n=r[n.origin.properties.id];return t.reverse()},Xl=new WeakMap;v();function u0(i,r,e,t){let n=e[i].origin,o=r===e.length?t:e[r].origin;return ft(n.geometry.coordinates,o.geometry.coordinates)}function Nf(i,r,e,t=as){if(i.length<3)return i;let n=1e-4,o=i.length,s=new Set;for(let d=0;d<o;d++)i[d].origin.properties.preventSmoothing&&s.add(d);let a=i[o-1].destination,l=new Array(o+1).fill(null).map(()=>({cost:1/0,prev:-1}));l[0]={cost:0,prev:-1};for(let d=0;d<o;d++){let f=!0;if(l[d].cost!==1/0){for(let b=d+1;b<=o;b++){let x=b===o?a:i[b].origin;if(ft(i[d].origin.geometry.coordinates,x.geometry.coordinates)<.01)continue;let g=b===d+1&&b<o&&s.has(b),S=b===d+1&&s.has(d);if(!g&&!S&&!ur(i[d].origin,x,r,t))continue;if(b>d+1){let I=!1;for(let T=d+1;T<b;T++)if(s.has(T)){I=!0;break}if(I)continue}let M=u0(d,b,i,a),w=(b-d-1)*n,R=l[d].cost+M-w;R<l[b].cost&&(l[b]={cost:R,prev:d},f=!1)}f&&l[d+1].cost===1/0&&(l[d+1].cost=l[d].cost,l[d+1].prev=d)}}let u=[],m=o;for(;m!==-1;)u.unshift(m),m=l[m].prev===-1?m-1:l[m].prev;let h=[];for(let d=0;d<u.length-1;d++){let f=u[d],b=u[d+1],x=i[f].origin,y=b===o?a:i[b].origin;h.push(new Tt({origin:x,destination:y,distance:ft(x.geometry.coordinates,y.geometry.coordinates),angle:ut(x.geometry.coordinates,y.geometry.coordinates),multiplicativeDistanceWeightScaling:e}))}return h}v();var zf=Es(Ku());v();var Bf=xh("Navigator");function $l(i,r,e){if(i==null||i[r]==null)return!1;let t=1<<e;return(i[r]&t)!==0}v();var h0=.5;function kf(i,r,e,t,n,o){var b,x;if(!((x=(b=i==null?void 0:i.geoJSON)==null?void 0:b.geometry)!=null&&x.coordinates))return null;let[s,a]=Of(t,h0),l=s,u=a;if(n){let y=Math.sqrt(Math.pow(s.x-n.x,2)+Math.pow(s.y-n.y,2));Math.sqrt(Math.pow(a.x-n.x,2)+Math.pow(a.y-n.y,2))<y&&(l=a,u=s)}let m=o(l.x,l.y),h=o(u.x,u.y),d={type:"Feature",geometry:{type:"Point",coordinates:[m.lon,m.lat]},properties:{id:"".concat(r,"_buffer_entry"),map:e,neighbors:[],preventSmoothing:!0}},f={type:"Feature",geometry:{type:"Point",coordinates:[h.lon,h.lat]},properties:{id:"".concat(r,"_buffer_exit"),map:e,neighbors:[],preventSmoothing:!0}};return{entryNode:d,exitNode:f,entryMeters:l,exitMeters:u}}function $r(i){var r;return(r=i.properties.floor)!=null?r:i.properties.map}function Uf(i,r,e,t){var T;let n=[i[0].origin];for(let C=0;C<i.length;C++)n.push(i[C].destination);let o=new Map,s=new Map;for(let C=0;C<n.length;C++)o.set(n[C].properties.id,n[C]),s.set(C,n[C]);let a=n[0].geometry.coordinates[1],{toCartesian:l,toGeographic:u}=Sa(a),m=n.map((C,F)=>{let L={x:0,y:0,nodeId:C.properties.id,originalIndex:F};return l(C.geometry.coordinates,L),L}),h=new Set,d=new Map,f=new Set;for(let C=0;C<n.length;C++){let F=r(n[C].properties.id);if(F&&(h.add(C),d.set(C,F)),C<n.length-1){let L=$r(n[C]),N=$r(n[C+1]);L!==N&&(f.add(C),f.add(C+1),C>0&&f.add(C-1))}}if(i.length<3&&h.size===0)return i;let b=i.length>=3?(0,zf.default)(m,.7,!1):m,x=new Set;for(let C=0;C<b.length;C++)x.add(b[C].originalIndex);let y=[];for(let C of h)x.has(C)||y.push(C);let g=b.slice(),S=.25;for(let C of f){if(x.has(C))continue;let F=s.get(C);if(!F)continue;let L=-1;for(let N=0;N<g.length-1;N++)if(g[N].originalIndex<C&&g[N+1].originalIndex>C){L=N+1;break}if(L!==-1){let N={x:0,y:0,nodeId:F.properties.id,originalIndex:C};l(F.geometry.coordinates,N),g.splice(L,0,N)}}for(let C of y){let F=s.get(C);if(!F)continue;let L=-1;for(let N=0;N<g.length-1;N++)if(g[N].originalIndex<C&&g[N+1].originalIndex>C){L=N+1;break}if(L!==-1){let N={x:0,y:0,nodeId:F.properties.id,originalIndex:C};l(F.geometry.coordinates,N);let z=Qc(N,g[L-1]),Y=Qc(N,g[L]);z<S?g[L-1]=N:Y<S?g[L]=N:g.splice(L,0,N)}}let M=[],E={x:0,y:0},w={x:0,y:0},R=new Map;for(let C=0;C<g.length;C++)R.set(g[C].originalIndex,C);for(let C of h){let F=s.get(C);if(!F)continue;let L=d.get(C);if(!L)continue;let N=(T=R.get(C))!=null?T:-1;if(N!==-1){let z;N>0&&(z={x:g[N-1].x,y:g[N-1].y});let Y=L.geoJSON.geometry.coordinates;l(Y[0],E),l(Y[1],w);let G=[E,w],q=F.properties.id,le=$r(F)||"test-floor",Q=kf(L,q,le,G,z,u);if(Q){let K={x:Q.entryMeters.x,y:Q.entryMeters.y,nodeId:Q.entryNode.properties.id,originalIndex:C-.5},B={x:Q.exitMeters.x,y:Q.exitMeters.y,nodeId:Q.exitNode.properties.id,originalIndex:C+.5};o.set(Q.entryNode.properties.id,Q.entryNode),o.set(Q.exitNode.properties.id,Q.exitNode),M.push(K,B)}}}if(g.push(...M),g.sort((C,F)=>C.originalIndex-F.originalIndex),t&&g.length>=3)for(let C=0;C<g.length-1;C++){let F=g[C];if(F.nodeId.endsWith("_buffer_exit")){let L=g[g.length-1];if(C<g.length-2){let N=!1;for(let z=C+1;z<g.length-1;z++)if(g[z].nodeId.endsWith("_buffer_entry")||g[z].nodeId.endsWith("_buffer_exit")){N=!0;break}if(!N){let z=o.get(F.nodeId),Y=o.get(L.nodeId);if(z&&Y){if($r(z)!==$r(Y))continue;if(ur(z,Y,t,.1)){let G=g.length-C-2;g.splice(C+1,G)}}}}}}if(t&&g.length>=3){let C=g[0],F=-1;for(let L=1;L<g.length;L++)if(g[L].nodeId.endsWith("_buffer_entry")){F=L;break}if(F>1){let L=!1;for(let N=1;N<F;N++)if(g[N].nodeId.endsWith("_buffer_entry")||g[N].nodeId.endsWith("_buffer_exit")){L=!0;break}if(!L){let N=g[F],z=o.get(C.nodeId),Y=o.get(N.nodeId);if(z&&Y&&$r(z)===$r(Y)){if(ur(z,Y,t,.1)){let G=F-1;g.splice(1,G)}}}}}let I=[];for(let C=0;C<g.length-1;C++){let F=g[C],L=g[C+1],N=o.get(F.nodeId),z=o.get(L.nodeId);N&&z?I.push(new Tt({origin:N,destination:z,distance:ft(N.geometry.coordinates,z.geometry.coordinates),angle:ut(N.geometry.coordinates,z.geometry.coordinates),multiplicativeDistanceWeightScaling:e})):Bf.warn("Origin or destination node not found for point ".concat(F.nodeId," or ").concat(L.nodeId))}return I}function bt(i,r){return new Tt({origin:i,destination:r,distance:ft(i.geometry.coordinates,r.geometry.coordinates),angle:ut(i.geometry.coordinates,r.geometry.coordinates)})}function Hf(i,r,e,t=!0){if(i.length<3)return i;let n=new Set;for(let a=0;a<i.length;a++)if(i[a].origin.properties.preventSmoothing){if(n.add(a),t){for(let l=a-1;l>=0;l--)if(!i[l].origin.properties.preventSmoothing){n.add(l);break}}if(t){for(let l=a+1;l<i.length;l++)if(!i[l].origin.properties.preventSmoothing){n.add(l);break}}}if(i.length>0&&i[i.length-1].destination.properties.preventSmoothing&&(n.add(i.length-1),t)){for(let a=i.length-2;a>=0;a--)if(!i[a].origin.properties.preventSmoothing){n.add(a);break}}let o=[],s=0;for(let a=1;a<i.length;a++){let l=a===i.length-1,u=n.has(a),m=l?.05:.7,h=ur(i[s].origin,i[a].origin,r,m),d=i[a].origin.properties.preventSmoothing,f=a-1;if(u){s!==a&&(h?(o.push(bt(i[s].origin,i[a].origin)),s=a):(s!==f&&(o.push(bt(i[s].origin,i[f].origin)),s=f),s!==a&&(o.push(bt(i[s].origin,i[a].origin)),s=a))),l&&o.push(bt(i[a].origin,i[a].destination));continue}if(d)h?(o.push(bt(i[s].origin,i[a].origin)),s=a):s!==f&&(o.push(bt(i[s].origin,i[f].origin)),s=f),o.push(bt(i[s].origin,i[a].origin)),s=a,l&&o.push(bt(i[a].origin,i[a].destination));else if(h)l&&(ur(i[s].origin,i[a].destination,r,.7)?o.push(bt(i[s].origin,i[a].destination)):(o.push(bt(i[s].origin,i[a].origin)),o.push(bt(i[a].origin,i[a].destination))),s=a);else{if(s===f){l&&(o.push(bt(i[s].origin,i[a].origin)),o.push(bt(i[a].origin,i[a].destination)));continue}o.push(bt(i[s].origin,i[f].origin)),s=f,l&&(o.push(bt(i[s].origin,i[a].origin)),o.push(bt(i[a].origin,i[a].destination)))}}if(!1){let a=o[o.length-1];window.__DEBUG_PATH.finalSteps.push({nodeId:a.destination.properties.id,coordinate:a.destination.geometry.coordinates,floorId:$r(a.destination)})}return o}v();function Vf(i,r,e=.2,t={},n){var a,l,u,m;if(i.length<3)return i;let o=[i[0]],s=1;for(let h=s+2;h<i.length;h++)if("outdoors"in t&&$l((m=(u=(l=(a=i[s])==null?void 0:a.origin)==null?void 0:l.properties)==null?void 0:u.flags)!=null?m:[],t.outdoors.index,t.outdoors.bit)||i[s].origin.properties.preventSmoothing||!ur(i[s].origin,i[h].origin,r,e)){let d=h-1;o.push(new Tt(Ce(V({},i[s]),{destination:i[d].origin,distance:ft(i[s].origin.geometry.coordinates,i[d].origin.geometry.coordinates),angle:ut(i[s].origin.geometry.coordinates,i[d].origin.geometry.coordinates)}))),s=d}return o.push(new Tt(Ce(V({},i[s]),{destination:i[i.length-1].origin,distance:ft(i[s].origin.geometry.coordinates,i[i.length-1].origin.geometry.coordinates),angle:ut(i[s].origin.geometry.coordinates,i[i.length-1].origin.geometry.coordinates),multiplicativeDistanceWeightScaling:n})),i[i.length-1]),o}v();var Wf=Es(Ku());function jf(i,r){let e=new Set;if(i.length<2)return e;let t=[i[0].origin];for(let b=0;b<i.length;b++)t.push(i[b].destination);let n=t[0].geometry.coordinates[1],{toCartesian:o}=Sa(n),s=r;if(!s)return e;let a=t.map((b,x)=>{let y={x:0,y:0,nodeId:b.properties.id,originalIndex:x};return o(b.geometry.coordinates,y),y}),l=new Set,u=new Set;for(let b=0;b<a.length;b++)s(a[b].nodeId)&&(l.add(b),u.add(a[b].nodeId));if(l.size===0)return e;let m=a.length>=3?(0,Wf.default)(a,.7,!1):a,h=new Map;for(let b=0;b<m.length;b++)h.set(m[b].originalIndex,b);let d=new Set;for(let b of l){let x=h.get(b);if(x!==void 0){if(x>0){let y=m[x-1].nodeId;d.add(y)}if(x<m.length-1){let y=m[x+1].nodeId;d.add(y)}}else{let y,g;for(let S=0;S<m.length-1;S++){let M=m[S].originalIndex,E=m[S+1].originalIndex;if(M<b&&b<E){y=m[S].nodeId,g=m[S+1].nodeId;break}}y&&d.add(y),g&&d.add(g)}}let f=0;for(let b of i)d.has(b.origin.properties.id)&&(b.origin.properties.preventSmoothing||(b.origin.properties.preventSmoothing=!0,e.add(b.origin.properties.id))),d.has(b.destination.properties.id)&&(b.destination.properties.preventSmoothing||(b.destination.properties.preventSmoothing=!0,e.add(b.destination.properties.id))),f++;return e}v();v();var ql={accessible:"accessible",outdoors:"outdoors",public:"public"};v();v();function cs(i,r,e=[]){let t=V({},i);for(let[n,o]of Object.entries(r))if(o!==void 0)if(n in t){let s=n;if(Array.isArray(o)&&o.length>0){let a=d0(o[0],e);if(a){let l=t[s];if(!Array.isArray(l))throw new Error("Expected array at ".concat(n,", got ").concat(typeof l));let u=new Map(o.map(d=>[Zf(d,a),d])),h=l.map(d=>{let f=u.get(Zf(d,a));return f?cs(d,f,e):d});t[s]=h}else t[s]=o}else{let a=t[s];typeof a=="object"&&a!==null&&typeof o=="object"&&o!==null?Object.keys(o).length===0?t[s]=o:t[s]=cs(a,o,e):t[n]=o}}else t[n]=o;return t}function d0(i,r){function e(t){if(typeof t!="object"||t===null)return null;for(let n of r)if(n in t&&typeof t[n]<"u")return[n];if(Array.isArray(t))return null;for(let[n,o]of Object.entries(t)){let s=e(o);if(s)return[n,...s]}return null}return e(i)}function Zf(i,r){return r.reduce((e,t)=>{if(e&&typeof e=="object")return e[t]},i)}v();var m0=i=>{if(i==="space"||i==="obstruction"||i==="entrance")return{}},p0=/\.json|\.geojson$/,Jl=(i,r,e)=>{let t=i[r];if(typeof t!="object"||Object.keys(t).length===0)return m0(r);let n={};for(let[o,s]of Object.entries(t)){let a=o.replace(p0,"");n[a]=JSON.parse(e(s))}return n},f0=["floorstack.json","styles.json","shapes.json","mapstack.json","floor.geojson","tileset.json","location.json","category.json","navigationFlags.json","annotation-symbols.json"],g0=f0,y0=["annotation","textAreas","enterprise","floorImages","shapeInstances","modelInstances","window","area","facade"],b0=y0,v0=i=>{let r=new TextDecoder("utf-8"),e=r.decode.bind(r),t={"manifest.geojson":JSON.parse(e(i["manifest.geojson"])),"mapstack.geojson":JSON.parse(e(i["mapstack.geojson"])),"map.geojson":JSON.parse(e(i["map.geojson"])),"node.geojson":JSON.parse(e(i["node.geojson"])),"connection.json":JSON.parse(e(i["connection.json"])),space:Jl(i,"space",e),obstruction:Jl(i,"obstruction",e),entrance:Jl(i,"entrance",e)};for(let n of g0)i[n]&&(t[n]=JSON.parse(e(i[n])));for(let n of b0)i[n]&&(t[n]=Jl(i,n,e));return t};v();v();v();var us=["agriculture","airport","casino","city-district","convention-center","entertainment","event-centre","first-responder-building","government-building","grocery-store","healthcare","higher-education","hotel","library","manufacturing","medical-centre","mixed-use","multifamily","museum","office-building","oil-and-energy","other","parking-facility","religious-institution","resort","retail-store","schools-k-12","shopping-mall","stadium-or-arena","storage-facility","theme-park","transit","transportation-hub","warehousing"],x0=[...us,"unknown"],eh=Object.freeze(Object.fromEntries([...us,"unknown"].map(i=>[i,i])));v();var hs=["reference-point","checkpoint","checkpoint-passport","parent"],S0=[...hs,"unknown"],M0=Object.freeze(Object.fromEntries([...hs,"unknown"].map(i=>[i,i])));var ds=["closed-temporarily","new","pop-up","coming-soon","relocated"],E0=[...ds,"unknown"],C0=Object.freeze(Object.fromEntries([...ds,"unknown"].map(i=>[i,i])));v();var ms=["left","center","right"],w0=[...ms,"unknown"],T0=Object.freeze(Object.fromEntries([...ms,"unknown"].map(i=>[i,i])));v();var ps=["near","center"],D0=[...ps,"unknown"],P0=Object.freeze(Object.fromEntries([...ps,"unknown"].map(i=>[i,i])));v();var fs=["top","side"],I0=[...fs,"unknown"],O0=Object.freeze(Object.fromEntries([...fs,"unknown"].map(i=>[i,i])));var gs=["inside","outside","both"],L0=[...gs,"unknown"],A0=Object.freeze(Object.fromEntries([...gs,"unknown"].map(i=>[i,i])));v();var Ql=["elevator","escalator","travelator","stairs","door","ramp","ladder"],GA=[...Ql,"unknown"],th=Object.freeze(Object.fromEntries([...Ql,"unknown"].map(i=>[i,i])));v();var Kl=["room","hallway","wall","object","poi","area","window"],kA=[...Kl,"unknown"],zA=Object.freeze(Object.fromEntries([...Kl,"unknown"].map(i=>[i,i])));v();v();var ec=class{constructor(r){p(this,"_value");this._value=r}[Symbol.iterator](){return this}next(){if(this._value==null)return{done:!0,value:void 0};let r=this._value;return this._value=null,{done:!1,value:r}}},tc=class{constructor(r){p(this,"_tag","Some");p(this,"_value");this._value=r}get value(){return this._value}isSome(){return!0}isSomeAnd(r){return r(this.value)}isNone(){return!1}equals(r){return r.isSome()&&r.value===this.value}expect(r){return this.value}unwrap(){return this.value}unwrapOr(r){return this.value}unwrapOrElse(r){return this.value}inspect(r){return r(this.value),this}inspectNone(r){return this}map(r){return Xf(r(this.value))}mapAsync(r){return r(this.value).then(e=>Xf(e))}mapOr(r,e){return this.map(r).unwrapOr(e)}mapOrAsync(r,e){return this.mapAsync(r).then(t=>t.unwrapOr(e))}mapOrElse(r,e){return this.map(r).unwrapOrElse(e)}mapOrElseAsync(r,e){return this.mapAsync(r).then(t=>t.unwrapOrElse(e))}and(r){return r}andThen(r){return r(this.value)}andThenAsync(r){return r(this.value)}filter(r){return r(this.value)?this:En()}or(r){return this}orElse(r){return this}xor(r){return r.isSome()?En():this}toString(){return"Some(".concat(this.value,")")}okOr(r){return Tr(this.value)}okOrElse(r){return Tr(this.value)}iter(){return new ec(this.value)}[Symbol.iterator](){return this.iter()}zip(r){return r.isSome()?Xi([this.value,r.value]):En()}zipWith(r,e){return r.isSome()?Xi(e(this.value,r.value)):En()}get[Symbol.toStringTag](){return"Some"}},rc=class{constructor(){p(this,"_tag","None")}get value(){return null}isSome(){return!1}isSomeAnd(r){return!1}isNone(){return!0}equals(r){return r.isNone()}expect(r){throw new Error(r)}unwrap(){throw new Error("Tried to unwrap a None value!")}unwrapOr(r){return r}unwrapOrElse(r){return r()}inspect(r){return this}inspectNone(r){return r(),this}map(r){return this}mapAsync(r){return Promise.resolve(this)}mapOr(r,e){return e}mapOrAsync(r,e){return Promise.resolve(e)}mapOrElse(r,e){return e()}mapOrElseAsync(r,e){return e()}and(r){return this}andThen(r){return this}andThenAsync(r){return Promise.resolve(this)}filter(r){return this}or(r){return r}orElse(r){return r()}xor(r){return r}toString(){return"None"}okOr(r){return ni(r)}okOrElse(r){return ni(r())}iter(){return new ec(null)}[Symbol.iterator](){return this.iter()}zip(r){return this}zipWith(r,e){return this}get[Symbol.toStringTag](){return"None"}},Xi=i=>new tc(i),En=()=>new rc,Xf=i=>i instanceof tc||i instanceof rc?i:i==null?En():Xi(i);var nc=class{constructor(r){p(this,"_value");this._value=r}[Symbol.iterator](){return this}next(){if(this._value==null)return{done:!0,value:void 0};let r=this._value;return this._value=null,{done:!1,value:r}}},rh=class{constructor(r){p(this,"_tag","Ok");p(this,"_value");this._value=r}get value(){return this._value}get error(){return null}isOk(){return!0}isOkAnd(r){return r(this.value)}isErr(){return!1}isErrAnd(r){return!1}ok(){return Xi(this.value)}err(){return En()}expect(r){return this.value}expectErr(r){throw new Error(r)}unwrap(){return this.value}unwrapOr(r){return this.value}unwrapOrElse(r){return this.value}inspect(r){return r(this.value),this}inspectErr(){return this}map(r){return Tr(r(this.value))}async mapAsync(r){return r(this.value).then(Tr)}mapOr(r,e){return r(this.value)}async mapOrAsync(r,e){return r(this.value)}mapOrElse(r,e){return r(this.value)}async mapOrElseAsync(r,e){return r(this.value)}mapErr(r){return this}iter(){return new nc(this.value)}[Symbol.iterator](){return this.iter()}and(r){return r}andThen(r){return r(this.value)}or(r){return this}orElse(r){return this}async andThenAsync(r){return r(this.value)}toString(){return"Ok(".concat(this.value,")")}get[Symbol.toStringTag](){return"Ok"}},nh=class i{constructor(r){p(this,"_tag","Err");p(this,"_error");this._error=r}get value(){return null}get error(){return this._error}isOk(){return!1}isOkAnd(r){return!1}isErr(){return!0}isErrAnd(r){return r(this.error)}ok(){return En()}err(){return Xi(this.error)}expect(r){throw new Error(r)}expectErr(r){return this.error}unwrap(){throw this.error}unwrapOr(r){return r}unwrapOrElse(r){return r()}inspect(){return this}inspectErr(r){return r(this.error),this}map(r){return this}iter(){return new nc(null)}[Symbol.iterator](){return this.iter()}async mapAsync(r){return this}mapOr(r,e){return e}async mapOrAsync(r,e){return e}mapOrElse(r,e){return e()}async mapOrElseAsync(r,e){return e()}mapErr(r){return new i(r(this.error))}and(r){return this}andThen(r){return this}async andThenAsync(r){return this}or(r){return r}orElse(r){return r(this.error)}toString(){return"Err(".concat(this.error,")")}get[Symbol.toStringTag](){return"Err"}},Tr=i=>new rh(i),ni=i=>new nh(i);v();var zt=Uint8Array,Yi=Uint16Array,R0=Int32Array,Yf=new zt([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),$f=new zt([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),_0=new zt([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),qf=function(i,r){for(var e=new Yi(31),t=0;t<31;++t)e[t]=r+=1<<i[t-1];for(var n=new R0(e[30]),t=1;t<30;++t)for(var o=e[t];o<e[t+1];++o)n[o]=o-e[t]<<5|t;return{b:e,r:n}},Jf=qf(Yf,2),Qf=Jf.b,F0=Jf.r;Qf[28]=258,F0[258]=28;var Kf=qf($f,0),G0=Kf.b,JA=Kf.r,ah=new Yi(32768);for(ve=0;ve<32768;++ve)qr=(ve&43690)>>1|(ve&21845)<<1,qr=(qr&52428)>>2|(qr&13107)<<2,qr=(qr&61680)>>4|(qr&3855)<<4,ah[ve]=((qr&65280)>>8|(qr&255)<<8)>>1;var qr,ve,ys=(function(i,r,e){for(var t=i.length,n=0,o=new Yi(r);n<t;++n)i[n]&&++o[i[n]-1];var s=new Yi(r);for(n=1;n<r;++n)s[n]=s[n-1]+o[n-1]<<1;var a;if(e){a=new Yi(1<<r);var l=15-r;for(n=0;n<t;++n)if(i[n])for(var u=n<<4|i[n],m=r-i[n],h=s[i[n]-1]++<<m,d=h|(1<<m)-1;h<=d;++h)a[ah[h]>>l]=u}else for(a=new Yi(t),n=0;n<t;++n)i[n]&&(a[n]=ah[s[i[n]-1]++]>>15-i[n]);return a}),bs=new zt(288);for(ve=0;ve<144;++ve)bs[ve]=8;var ve;for(ve=144;ve<256;++ve)bs[ve]=9;var ve;for(ve=256;ve<280;++ve)bs[ve]=7;var ve;for(ve=280;ve<288;++ve)bs[ve]=8;var ve,eg=new zt(32);for(ve=0;ve<32;++ve)eg[ve]=5;var ve;var N0=ys(bs,9,1);var B0=ys(eg,5,1),ih=function(i){for(var r=i[0],e=1;e<i.length;++e)i[e]>r&&(r=i[e]);return r},hr=function(i,r,e){var t=r/8|0;return(i[t]|i[t+1]<<8)>>(r&7)&e},oh=function(i,r){var e=r/8|0;return(i[e]|i[e+1]<<8|i[e+2]<<16)>>(r&7)},k0=function(i){return(i+7)/8|0},ch=function(i,r,e){return(r==null||r<0)&&(r=0),(e==null||e>i.length)&&(e=i.length),new zt(i.subarray(r,e))};var z0=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],Qt=function(i,r,e){var t=new Error(r||z0[i]);if(t.code=i,Error.captureStackTrace&&Error.captureStackTrace(t,Qt),!e)throw t;return t},U0=function(i,r,e,t){var n=i.length,o=t?t.length:0;if(!n||r.f&&!r.l)return e||new zt(0);var s=!e,a=s||r.i!=2,l=r.i;s&&(e=new zt(n*3));var u=function(Ue){var Ye=e.length;if(Ue>Ye){var Ut=new zt(Math.max(Ye*2,Ue));Ut.set(e),e=Ut}},m=r.f||0,h=r.p||0,d=r.b||0,f=r.l,b=r.d,x=r.m,y=r.n,g=n*8;do{if(!f){m=hr(i,h,1);var S=hr(i,h+1,3);if(h+=3,S)if(S==1)f=N0,b=B0,x=9,y=5;else if(S==2){var R=hr(i,h,31)+257,I=hr(i,h+10,15)+4,T=R+hr(i,h+5,31)+1;h+=14;for(var C=new zt(T),F=new zt(19),L=0;L<I;++L)F[_0[L]]=hr(i,h+L*3,7);h+=I*3;for(var N=ih(F),z=(1<<N)-1,Y=ys(F,N,1),L=0;L<T;){var G=Y[hr(i,h,z)];h+=G&15;var M=G>>4;if(M<16)C[L++]=M;else{var q=0,le=0;for(M==16?(le=3+hr(i,h,3),h+=2,q=C[L-1]):M==17?(le=3+hr(i,h,7),h+=3):M==18&&(le=11+hr(i,h,127),h+=7);le--;)C[L++]=q}}var Q=C.subarray(0,R),K=C.subarray(R);x=ih(Q),y=ih(K),f=ys(Q,x,1),b=ys(K,y,1)}else Qt(1);else{var M=k0(h)+4,E=i[M-4]|i[M-3]<<8,w=M+E;if(w>n){l&&Qt(0);break}a&&u(d+E),e.set(i.subarray(M,w),d),r.b=d+=E,r.p=h=w*8,r.f=m;continue}if(h>g){l&&Qt(0);break}}a&&u(d+131072);for(var B=(1<<x)-1,j=(1<<y)-1,U=h;;U=h){var q=f[oh(i,h)&B],ce=q>>4;if(h+=q&15,h>g){l&&Qt(0);break}if(q||Qt(2),ce<256)e[d++]=ce;else if(ce==256){U=h,f=null;break}else{var xe=ce-254;if(ce>264){var L=ce-257,ue=Yf[L];xe=hr(i,h,(1<<ue)-1)+Qf[L],h+=ue}var ze=b[oh(i,h)&j],Re=ze>>4;ze||Qt(3),h+=ze&15;var K=G0[Re];if(Re>3){var ue=$f[Re];K+=oh(i,h)&(1<<ue)-1,h+=ue}if(h>g){l&&Qt(0);break}a&&u(d+131072);var Se=d+xe;if(d<K){var Me=o-K,De=Math.min(K,Se);for(Me+d<0&&Qt(3);d<De;++d)e[d]=t[Me+d]}for(;d<Se;++d)e[d]=e[d-K]}}r.l=f,r.p=U,r.b=d,r.f=m,f&&(m=1,r.m=x,r.d=b,r.n=y)}while(!m);return d!=e.length&&s?ch(e,0,d):e.subarray(0,d)};var H0=new zt(0);var Dr=function(i,r){return i[r]|i[r+1]<<8},dr=function(i,r){return(i[r]|i[r+1]<<8|i[r+2]<<16|i[r+3]<<24)>>>0},sh=function(i,r){return dr(i,r)+dr(i,r+4)*4294967296};function V0(i,r){return U0(i,{i:2},r&&r.out,r&&r.dictionary)}var lh=typeof TextDecoder<"u"&&new TextDecoder,W0=0;try{lh.decode(H0,{stream:!0}),W0=1}catch(i){}var j0=function(i){for(var r="",e=0;;){var t=i[e++],n=(t>127)+(t>223)+(t>239);if(e+n>i.length)return{s:r,r:ch(i,e-1)};n?n==3?(t=((t&15)<<18|(i[e++]&63)<<12|(i[e++]&63)<<6|i[e++]&63)-65536,r+=String.fromCharCode(55296|t>>10,56320|t&1023)):n&1?r+=String.fromCharCode((t&31)<<6|i[e++]&63):r+=String.fromCharCode((t&15)<<12|(i[e++]&63)<<6|i[e++]&63):r+=String.fromCharCode(t)}};function uh(i,r){if(r){for(var e="",t=0;t<i.length;t+=16384)e+=String.fromCharCode.apply(null,i.subarray(t,t+16384));return e}else{if(lh)return lh.decode(i);var n=j0(i),o=n.s,e=n.r;return e.length&&Qt(8),o}}var Z0=function(i,r){return r+30+Dr(i,r+26)+Dr(i,r+28)},X0=function(i,r,e){var t=Dr(i,r+28),n=uh(i.subarray(r+46,r+46+t),!(Dr(i,r+8)&2048)),o=r+46+t,s=dr(i,r+20),a=e&&s==4294967295?Y0(i,o):[s,dr(i,r+24),dr(i,r+42)],l=a[0],u=a[1],m=a[2];return[Dr(i,r+10),l,u,n,o+Dr(i,r+30)+Dr(i,r+32),m]},Y0=function(i,r){for(;Dr(i,r)!=1;r+=4+Dr(i,r+2));return[sh(i,r+12),sh(i,r+4),sh(i,r+20)]};function tg(i,r){for(var e={},t=i.length-22;dr(i,t)!=101010256;--t)(!t||i.length-t>65558)&&Qt(13);var n=Dr(i,t+8);if(!n)return{};var o=dr(i,t+16),s=o==4294967295||n==65535;if(s){var a=dr(i,t-12);s=dr(i,a)==101075792,s&&(n=dr(i,a+32),o=dr(i,a+48))}for(var l=r&&r.filter,u=0;u<n;++u){var m=X0(i,o,s),h=m[0],d=m[1],f=m[2],b=m[3],x=m[4],y=m[5],g=Z0(i,y);o=x,(!l||l({name:b,size:d,originalSize:f,compression:h}))&&(h?h==8?e[b]=V0(i.subarray(g,g+d),{out:new zt(f)}):Qt(14,"unknown compression type "+h):e[b]=ch(i,g,g+d))}return e}v();v();v();v();var at=i=>Object.entries(i);v();var vs=i=>Object.keys(i);function rg(i){return i.replace(/^g_/,"s_")}function ic(i){return i.replace(/^g_/,"o_")}function $0(i){return i.replace(/^g_/,"w_")}function ng(i){return i.replace(/^loci_/,"eli_")}function xs(i){return i.replace(/^loc_/,"el_")}function oc(i){return i.replace(/^lcat_/,"ec_")}function q0(i){return i.replace(/^g_/,"ar_")}function ig(i){return i.replace(/^n_/,"s_")}function J0(i,r,e){switch(i.geometry.type){case"MultiPoint":case"MultiLineString":case"MultiPolygon":{let t=[],n=0,o=i.geometry.type.replace("Multi","");for(let s of i.geometry.coordinates)t.push(Ce(V({},i),{geometry:{type:o,coordinates:s},properties:Ce(V({},i.properties),{id:"".concat(r,"-").concat(n++),kind:e})}));return t}default:return[Ce(V({},i),{properties:Ce(V({},i.properties),{id:r,kind:e})})]}}function $i(i,r,e,t){let n=new Map;for(let{feature:o,floorId:s}of i){let a=o.properties.id,l=t.get(a);if(r.has(a)){let u=J0(o,e(a),l),m=u.map(d=>d.properties.id),h=m.map(d=>({geometryId:d,floorId:s}));n.set(a,{ids:m,features:u,anchors:h})}}return n}function og(i){var u,m;let r={space:new Map,obstruction:new Map,area:new Map,window:new Map,object:new Map};if(!i.geometry)return r;let e=Q0(i),t=at(i.geometry).flatMap(([h,d])=>{var f;return((f=d==null?void 0:d.features)!=null?f:[]).map(b=>({feature:b,floorId:h}))}).flat(),n=new Set(Object.values((u=i.walkable)!=null?u:{}).filter(h=>h!==void 0).flatMap(vs)),o=new Set(Object.values((m=i.nonwalkable)!=null?m:{}).filter(h=>h!==void 0).flatMap(vs)),s=new Set(Array.from(e.entries()).filter(([h,d])=>d==="area").map(([h])=>h)),a=new Set(Array.from(e.entries()).filter(([h,d])=>d==="object").map(([h])=>h)),l=new Set(Array.from(e.entries()).filter(([h,d])=>d==="window").map(([h])=>h));return n.size>0&&(r.space=$i(t,n,rg,e)),o.size>0&&(r.obstruction=$i(t,o,ic,e)),s.size>0&&(r.area=$i(t,s,q0,e)),a.size>0&&(r.object=$i(t,a,ic,e)),l.size>0&&(r.window=$i(t,l,$0,e)),n.size===0&&o.size===0&&s.size===0&&(r.space=$i(t,new Set(t.map(h=>h.feature.properties.id)),rg,e)),r}function Q0(i){var e,t,n;let r=new Map(Object.values((e=i.kinds)!=null?e:{}).filter(o=>o!==void 0).flatMap(at));for(let o of(n=(t=i.connections)==null?void 0:t.filter(s=>s.type!=="door"))!=null?n:[]){for(let s of o.entrances)r.set(s.geometryId,"connection.".concat(o.type));for(let s of o.exits)r.set(s.geometryId,"connection.".concat(o.type))}return r}function sg(i){if(!i||i.length===0)return[];let r=Math.max(...i.map(e=>e.length));return i.reduce((e,t)=>e.map((n,o)=>{var s;return n|((s=t[o])!=null?s:0)}),Array(r).fill(0))}function ag(i){var l;let{nodesByGeometryId:r,incomingEdgesByNodeId:e,nodesById:t}=K0(i),n=og(i),o=ex(i),s=(l=i.navigationFlags)!=null?l:{};return{geometryMaps:n,nodesByGeometryId:r,geometryFeatureById:o,navigationFlags:s,incomingEdgesByNodeId:e,nodesById:t}}function K0(i){var n,o,s;let r=new Map,e=new Map,t=new Map;for(let a of Object.values((n=i.nodes)!=null?n:{}))for(let l of(o=a==null?void 0:a.features)!=null?o:[]){if(t.set(l.properties.id,l),l.properties.geometryIds.length>0)for(let u of l.properties.geometryIds){let m=(s=r.get(u))!=null?s:[];m.push(l.properties.id),r.set(u,m)}if(l.properties.neighbors.length>0)for(let u of l.properties.neighbors){let m=e.get(u.id);m!=null?m.push(u):e.set(u.id,[u])}}return{nodesByGeometryId:r,incomingEdgesByNodeId:e,nodesById:t}}function ex(i){var e,t;let r=new Map;for(let n of Object.values((e=i.geometry)!=null?e:{}))for(let o of(t=n==null?void 0:n.features)!=null?t:[])r.set(o.properties.id,o);return r}v();function lg(i,r){if(!i.annotations||!i.annotationSymbols||!i.geometry)return{};let e={};for(let[t,n]of at(i.annotations)){if(!n||n.length===0||!i.geometry[t]||i.geometry[t].features.length===0)continue;let o=new Map(i.geometry[t].features.map(a=>[a.properties.id,a])),s={type:"FeatureCollection",features:[]};for(let a of n){let l=o.get(a.geometryId);if(!l||l.geometry.type!=="Point")continue;let u={id:a.id,externalId:a.externalId,symbolId:a.symbolKey};s.features.push({type:"Feature",geometry:l.geometry,properties:u})}e[t]=s}return{annotation:e}}v();v();function ii(i,r){return r&&(i.flags[r.index]&1<<r.bit)!==0}v();var hh={accessible:"accessible",outdoors:"outdoors",public:"public"};function cg(i,{nodesByGeometryId:r}){var s,a,l,u,m,h,d;let e={"connection.json":[],entrance:{}},t=(s=i.navigationFlags)==null?void 0:s[hh.accessible],n=(a=i.navigationFlags)==null?void 0:a[hh.outdoors],o=new Map(Object.values((l=i.geometry)!=null?l:{}).flatMap(f=>{var b;return(b=f==null?void 0:f.features)!=null?b:[]}).map(f=>[f.properties.id,f]));for(let f of(u=i.connections)!=null?u:[]){if(dh(f,o)&&!tx(f)){let S=rx(f,o,r,n);for(let[M,E]of S)e.entrance[M]||(e.entrance[M]={type:"FeatureCollection",features:[]}),e.entrance[M].features.push(E);continue}let b=t!=null&&f.entrances.some(S=>ii(S,t))&&f.exits.some(S=>ii(S,t)),x=Array.from(new Set([...f.entrances.map(S=>r.get(S.geometryId)),...f.exits.map(S=>r.get(S.geometryId))].flat().filter(S=>S!=null))),y=sg([...f.entrances.map(S=>S.flags),...f.exits.map(S=>S.flags)]),g={id:f.id,externalId:(h=(m=f.details)==null?void 0:m.externalId)!=null?h:"",type:f.type,accessible:b,nodes:x,flags:y};(d=f.details)!=null&&d.name&&(g.details={name:f.details.name}),f.extra&&(g.extra=f.extra),e["connection.json"].push(g)}return e}function dh(i,r){return i.type==th.door&&i.entrances.every(e=>{let t=r.get(e.geometryId);return(t==null?void 0:t.geometry.type)==="LineString"})}function tx(i){return i.entrances.length===0||i.exits.length===0?!1:new Set([...i.entrances.map(e=>e.floorId),...i.exits.map(e=>e.floorId)]).size>=2}function rx(i,r,e,t){var o,s;if(i.type!==th.door)return[];let n=[];for(let a of i.entrances){let l=r.get(a.geometryId);if((l==null?void 0:l.geometry.type)==="LineString"){let u={type:"Feature",geometry:l.geometry,properties:{id:i.id,externalId:(s=(o=i.details)==null?void 0:o.externalId)!=null?s:"",isExterior:nx(i,t)}},m=i.details;m&&(u.properties.details={name:m.name,description:m.description},m.icon&&(u.properties.details.images=[{url:m.icon,altText:"".concat(m.name," icon")}]));let h=e.get(a.geometryId);h&&h.length>0&&(u.properties.node=h[0]),n.push([a.floorId,u])}}return n}function nx(i,r){return i.entrances.some(e=>ii(e,r))||i.exits.some(e=>ii(e,r))}v();function hg(i,{geometryMaps:r,nodesByGeometryId:e}){var M,E,w,R,I,T,C,F,L,N,z,Y,G,q,le,Q,K,B,j,U,ce,xe,ue,ze,Re,Se,Me,De,Ue,Ye,Ut,je,ge,mr,pr,Jr,Kt,Ht,Ft,Qr,Pr,Kr,oi,fr,gr,Ir,er,$e;let t={categories:[],locations:[],locationInstances:[],layers:[],venue:{slug:"",name:"",externalId:"",defaultLanguage:{name:"English",code:"en"},languages:[]}},n=(M=i.manifest)==null?void 0:M.features[0];n&&(t.venue.defaultFloor=n.properties.defaultFloor,t.venue.tzid=n.properties.tzid,t.venue.name=n.properties.name,t.venue.defaultLanguage={name:(E=n.properties.language)!=null?E:"English",code:(w=n.properties.language)!=null?w:"en"});let o=(R=i.cms)==null?void 0:R.venue;o&&(t.venue=Ce(V({},t.venue),{slug:o.slug,name:(C=(T=(I=o.details)==null?void 0:I.name)!=null?T:t.venue.name)!=null?C:n.properties.name,externalId:(L=(F=o.details)==null?void 0:F.externalId)!=null?L:"",defaultLanguage:o.defaultLanguage,languages:(N=o.languages)!=null?N:[],countrycode:o.countrycode,coverImage:o.coverImage,logo:o.logo,icon:(z=o.details)==null?void 0:z.icon,extra:o.extra,mappedinWebUrl:o.mappedinWebUrl,operationHours:o.operationHours,topLocations:o.topLocations,type:o.type&&o.type in eh?o.type:"unknown",propertyImage:o.propertyImage}));let s=new Map,a=(Y=i.locations)!=null?Y:[],l=(q=(G=i.cms)==null?void 0:G.locations)!=null?q:[],u=(Q=(le=i.cms)==null?void 0:le.categories)!=null?Q:[],m=new Map((u!=null?u:[]).map(Ae=>[Ae.categoryId,Ae]));if(a.length>0){let Ae=new Map(l.map(ee=>[ee.locationId,ee]));for(let ee of a){let H=(K=Ae.get(ee.id))!=null?K:{};if(ee){let J=ee.details,re={id:(H==null?void 0:H.cmsId)!==void 0?"el_".concat(H==null?void 0:H.cmsId):xs(ee.id),name:J.name,externalId:(B=J.externalId)!=null?B:"",type:(j=H.type)!=null?j:"location",sortOrder:(U=H.sortOrder)!=null?U:0,amenity:H.amenity,description:J.description,extra:ee.extra,links:ee.links,operationHours:ee.openingHours,gallery:H.gallery,logo:ee.logo,shortName:J.shortName,picture:H.picture,showFloatingLabelWhenImagePresent:H.showFloatingLabelWhenImagePresent,showLogo:H.showLogo,siblingGroups:H.siblingGroups,states:H.states,tags:H.tags,spaces:[],nodes:[],polygons:[],headerImage:H.headerImage};if(ee.phone&&(re.phone={number:ee.phone}),H.primaryCategory){let se=m.get(H.primaryCategory);se&&(re.primaryCategory=se.id)}let oe=ug(ee.social);ee.website&&(oe.website=ee.website.url),re.social=oe;for(let se of ee.geometryAnchors){let Ge=r.space.get(se.geometryId),Gt=r.obstruction.get(se.geometryId),Dt=Ge!=null?Ge:Gt;if(Dt){let si=new Set(Dt.features.filter(Vt=>Vt.geometry.type==="Polygon").map(Vt=>Vt.properties.id));for(let Vt of Dt.anchors)Ge!=null&&Dt===Ge&&re.spaces.push({floor:Vt.floorId,id:Vt.geometryId}),si.has(Vt.geometryId)&&re.polygons.push({map:Vt.floorId,id:Vt.geometryId})}let dt=e.get(se.geometryId);for(let si of dt!=null?dt:[])re.nodes.push({map:se.floorId,id:si})}t.locations.push(re);for(let se of ee.categories)s.set(se,[...(ce=s.get(se))!=null?ce:[],ee.id])}}}let h=(ue=(xe=i.cms)==null?void 0:xe.locationInstances)!=null?ue:[],d=i.locationInstances;if(d){let Ae=new Map(h.map(H=>[H.locationInstanceId,H])),ee=[];for(let H of d){let J=(ze=Ae.get(H.id))!=null?ze:{};if(H){let re={id:ng(H.id),parent:(Re=J.parentId)!=null?Re:xs(H.parentId),name:(Se=H.details)==null?void 0:Se.name,externalId:(Me=H.details)==null?void 0:Me.externalId,type:J.type,sortOrder:J.sortOrder,amenity:J.amenity,description:(De=H.details)==null?void 0:De.description,extra:H.extra,links:H.links,operationHours:H.openingHours,gallery:J.gallery,picture:J.picture,showFloatingLabelWhenImagePresent:J.showFloatingLabelWhenImagePresent,showLogo:J.showLogo,siblingGroups:J.siblingGroups,states:J.states,tags:J.tags,logo:H.logo,shortName:(Ue=H.details)==null?void 0:Ue.shortName,headerImage:J.headerImage};H.phone&&(re.phone={number:H.phone});let oe=ug((Ye=H.social)!=null?Ye:[]);if(H.website&&(oe.website=H.website.url),Object.keys(oe).length>0&&(re.social=oe),(Ut=H.geometryAnchors)!=null&&Ut.length){let se=H.geometryAnchors.flatMap(Ge=>{var Gt,Dt;return(Dt=(Gt=r.space.get(Ge.geometryId))==null?void 0:Gt.anchors)!=null?Dt:[]});se.length>0&&(re.spaces=se.map(Ge=>({floor:Ge.floorId,id:Ge.geometryId})))}if(H.geometryAnchors){re.spaces=[],re.polygons=[],re.nodes=[];for(let se of H.geometryAnchors){let Ge=r.space.get(se.geometryId);if(Ge){let Dt=new Set(Ge.features.filter(dt=>dt.geometry.type==="Polygon").map(dt=>dt.properties.id));for(let dt of Ge.anchors)re.spaces.push({floor:dt.floorId,id:dt.geometryId}),Dt.has(dt.geometryId)&&re.polygons.push({map:dt.floorId,id:dt.geometryId})}let Gt=e.get(se.geometryId);for(let Dt of Gt!=null?Gt:[])re.nodes.push({map:se.floorId,id:Dt})}}ee.push(re)}}ee.length>0&&(t.locationInstances=ee)}let f=i.locationCategories;if(f){let Ae=[],ee=new Map(f.map(oe=>[oe.id,oe])),H=new Map((u!=null?u:[]).map(oe=>[oe.categoryId,oe])),J=new Map;for(let oe of f){let se=ee.get(oe.parent);if(se){let Ge=(je=J.get(se.id))!=null?je:[];Ge.push(oe.id),J.set(se.id,Ge)}}for(let oe of f){let se=H.get(oe.id);if(oe){let Ge=((ge=J.get(oe.id))!=null?ge:[]).map(oc),Gt={id:oc(oe.id),name:oe.details.name,externalId:(mr=oe.details.externalId)!=null?mr:"",sortOrder:(pr=se==null?void 0:se.sortOrder)!=null?pr:0,children:Ge,locations:((Jr=s.get(oe.id))!=null?Jr:[]).map(xs),icon:oe.details.icon,picture:se==null?void 0:se.picture,color:se==null?void 0:se.color,extra:oe.extra,iconFromDefaultList:se==null?void 0:se.iconFromDefaultList};Ae.push(Gt)}}t.categories=Ae;let re={};for(let oe of a)re[xs(oe.id)]=oe.categories.map(oc).filter(se=>se!==void 0);t.categoryPriorities=re}let b={};for(let[Ae,ee]of Object.entries((Kt=i.defaultStyle)!=null?Kt:{}))if(ee.buffer){let H=ee.geometryAnchors.flatMap(J=>{var re,oe;return(oe=(re=r.space.get(J.geometryId))==null?void 0:re.anchors)!=null?oe:[]});b[Ae]={edgeOffset:ee.buffer,geometryAnchors:H}}Object.keys(b).length>0&&(t.enterpriseStyles=b);let x=new Map;for(let Ae of Object.values((Ft=(Ht=i.cms)==null?void 0:Ht.layers)!=null?Ft:{}))if(Ae)for(let[ee,H]of at(Ae)){if(typeof H!="string")continue;let J=(Qr=x.get(H))!=null?Qr:{name:H,id:"ely_".concat(H),spaces:[]};J.spaces.push(...(Kr=(Pr=r.space.get(ee))==null?void 0:Pr.anchors.map(re=>({floorId:re.floorId,spaceId:re.geometryId})))!=null?Kr:[]),x.set(H,J)}x.size>0&&(t.layers=Array.from(x.values()));let y=[];for(let Ae of Object.values((fr=(oi=i.cms)==null?void 0:oi.textures)!=null?fr:{}))for(let ee of Ae){let H=(gr=r.space.get(ee.geometryId))==null?void 0:gr.anchors;!H||H.length<1||ee.face==="unknown"||ee.surface==="unknown"||y.push({repeat:ee.repeat,offset:ee.offset,rotation:ee.rotation,path:ee.path,face:ee.face,surface:ee.surface,bounds:ee.bounds,geometryAnchors:H})}y.length>0&&(t.textures=y);let g={};for(let[Ae,ee]of Object.entries((er=(Ir=i.cms)==null?void 0:Ir.floorText)!=null?er:{})){let H={type:"FeatureCollection",features:[]};for(let J of ee.features){if(J.properties.align==="unknown")continue;let re={align:J.properties.align,color:J.properties.color,fontFamily:J.properties.fontFamily,fontSize:J.properties.fontSize,rotation:J.properties.rotation,text:J.properties.text,visible:J.properties.visible};"geometryId"in J.properties?re.geometryId=J.properties.geometryId:re.verticalOffset=J.properties.verticalOffset,H.features.push({type:"Feature",geometry:J.geometry,properties:re})}H.features.length>0&&(g[Ae]=H)}Object.keys(g).length>0&&(t.floorText=g);let S={enterprise:t};if(($e=i.cms)!=null&&$e.textAreas){let Ae={};for(let[ee,H]of at(i.cms.textAreas)){let J={type:"FeatureCollection",features:[]};for(let re of H.features){if(re.properties.align==="unknown")continue;let oe={align:re.properties.align,maxWidth:re.properties.maxWidth,maxHeight:re.properties.maxHeight,rotation:re.properties.rotation};"geometryId"in re.properties?oe.anchorId=re.properties.geometryId:oe.verticalOffset=re.properties.verticalOffset;let se={type:"Feature",geometry:re.geometry,properties:oe};J.features.push(se)}Ae[ee]=J}S.textAreas=Ae}return S}var ix=["facebook","instagram","twitter"];function ug(i){let r={};for(let{name:e,url:t}of i){let n=e.toLowerCase();ix.includes(n)&&(r[n]=t)}return r}v();var ox=i=>"fc_".concat(i.slice(3));function dg(i,{geometryMaps:r}){var n;if(!i.facade)return{};let e={},t={};for(let[o,s]of at(i.facade))if(s)for(let a of Object.values(s)){let{floorStackId:l,geometryIds:u}=a,m=ox(l);(n=t[l])!=null||(t[l]={id:m,spaces:[]}),t[l].spaces.push(...u.map(h=>{var d,f;return{floorId:o,spaceId:(f=(d=r.space.get(h))==null?void 0:d.ids[0])!=null?f:""}}))}return Object.keys(t).length>0&&(e.facade=t),e}v();function mg(i,r={}){var n,o,s,a,l,u,m,h,d,f,b,x;let e={type:"FeatureCollection",features:[]},t=[];for(let y of i.floors.features)t.push({id:y.properties.id,externalId:(o=(n=y.properties.details)==null?void 0:n.externalId)!=null?o:"",elevation:y.properties.elevation,name:(a=(s=y.properties.details)==null?void 0:s.name)!=null?a:"",shortName:(u=(l=y.properties.details)==null?void 0:l.shortName)!=null?u:"",subtitle:y.properties.subtitle,maxHeight:y.properties.maxHeight}),e.features.push({type:"Feature",geometry:y.geometry,properties:{id:y.properties.id,externalId:(h=(m=y.properties.details)==null?void 0:m.externalId)!=null?h:"",elevation:y.properties.elevation,name:(f=(d=y.properties.details)==null?void 0:d.name)!=null?f:"",shortName:(x=(b=y.properties.details)==null?void 0:b.shortName)!=null?x:"",subtitle:y.properties.subtitle,maxHeight:y.properties.maxHeight}});return{"floor.geojson":e,"map.geojson":t}}v();function pg(i,{geometryMaps:r}){var n,o,a,l,u;let e={},t={};for(let[m,h]of at((n=i.floorImages)!=null?n:{})){let d={features:[],type:"FeatureCollection"};for(let f of(o=h==null?void 0:h.features)!=null?o:[])if("verticalOffset"in f.properties)d.features.push(f);else{let s=f.properties,{geometryId:b}=s,x=Ms(s,["geometryId"]),y=(u=(a=r.space.get(b))==null?void 0:a.ids[0])!=null?u:(l=r.obstruction.get(b))==null?void 0:l.ids[0];if(!y)continue;let g={geometry:f.geometry,properties:Ce(V({},x),{anchorId:y}),type:f.type};d.features.push(g)}t[m]=d}return Object.keys(t).length>0&&(e.floorImages=t),e}v();function fg(i,r={}){var n,o,s,a,l,u,m;let e=[];for(let h of(n=i==null?void 0:i.floorStacks)!=null?n:[]){let d={id:h.id,floors:h.floors,maps:h.floors,externalId:(s=(o=h.details)==null?void 0:o.externalId)!=null?s:"",name:(l=(a=h.details)==null?void 0:a.name)!=null?l:"",shortName:(m=(u=h.details)==null?void 0:u.shortName)!=null?m:"",type:"Building"};h.defaultFloor&&(d.defaultFloor=h.defaultFloor),e.push(d)}if(i.outdoors&&i.outdoors.floors.length>0){let h={id:"outdoors",floors:i.outdoors.floors,maps:i.outdoors.floors,type:"Outdoor",name:"Outdoors",externalId:"outdoors"};e.push(h)}return{"floorstack.json":e,"mapstack.geojson":e}}v();v();var vg=Es(bg(),1),ux=i=>{let r=i.geometry.coordinates[0],e=0;for(let t=0;t<r.length-1;t++)e+=r[t][0]*r[t+1][1]-r[t+1][0]*r[t][1];return Math.abs(e/2)},hx=(i,r)=>{let[e,t]=i,n=r.geometry.coordinates[0],o=!1;for(let s=0,a=n.length-1;s<n.length;a=s++){let[l,u]=n[s],[m,h]=n[a];u>t!=h>t&&e<(m-l)*(t-u)/(h-u)+l&&(o=!o)}return o},dx=i=>{let r=i.geometry.coordinates[0],e=0,t=0;for(let n=0;n<r.length-1;n++)e+=r[n][0],t+=r[n][1];return{geometry:{coordinates:[e/(r.length-1),t/(r.length-1)]}}},mx=i=>{let r=ux(i),e=Number.isFinite(r)?Math.max(r,1):1;return Math.sqrt(e)*1e-6},ac=i=>{try{let e=dx(i).geometry.coordinates;if(!hx(e,i)){let n=(0,vg.default)(i.geometry.coordinates,mx(i));return Tr([n[0],n[1]])}return Tr(e)}catch(r){return ni(new Error("Unable to calculate center of polygon"))}};function gh(i){var r;return((r=i==null?void 0:i.geometry)==null?void 0:r.type)==="Polygon"}function Sg(i,{geometryMaps:r,nodesByGeometryId:e,nodesById:t}){var m,h,d,f,b,x,y,g,S,M;let n=yx(i.defaultStyle),o={},s={},a={},l={};for(let E of vs(i.geometry)){let w=i.geometry[E];if(!w)continue;let R=[],I=[],T=[],C=[];for(let F of w.features){let L=F.properties.id,N=n.has(L),z=(m=e.get(L))!=null?m:[];for(let Y of(d=(h=r.space.get(L))==null?void 0:h.features)!=null?d:[])R.push(xg(Y,z));for(let Y of(b=(f=r.obstruction.get(L))==null?void 0:f.features)!=null?b:[])if(I.push(px(Y,N)),r.object.has(L)){let G=(x=e.get(L))!=null?x:[],q=G.map(le=>t.get(le)).filter(le=>le!=null);for(let le of q){let Q=xg({type:"Feature",geometry:le.geometry,properties:{id:ig(le.properties.id),kind:"desk-entrance",details:{externalId:ic(L)}}},G);R.push(Q)}}for(let Y of(g=(y=r.area.get(L))==null?void 0:y.features)!=null?g:[])T.push(fx(Y,z));for(let Y of(M=(S=r.window.get(L))==null?void 0:S.features)!=null?M:[])C.push(gx(Y))}R.length>0&&(o[E]={type:"FeatureCollection",features:R.filter(F=>F!==null)}),I.length>0&&(s[E]={type:"FeatureCollection",features:I.filter(F=>F!==null)}),T.length>0&&(a[E]={type:"FeatureCollection",features:T.filter(F=>F!==null)}),C.length>0&&(l[E]={type:"FeatureCollection",features:C.filter(F=>F!==null)})}let u={space:o,obstruction:s};return Object.keys(a).length>0&&(u.area=a),Object.keys(l).length>0&&(u.window=l),u}function xg(i,r){var t,n;switch(i.geometry.type){case"MultiPoint":case"MultiLineString":case"MultiPolygon":return null}let e={type:"Feature",geometry:i.geometry,properties:{destinationNodes:r,id:i.properties.id,externalId:(n=(t=i.properties.details)==null?void 0:t.externalId)!=null?n:"",kind:i.properties.kind}};return i.properties.details&&(e.properties.details={name:i.properties.details.name,description:i.properties.details.description,images:i.properties.details.icon?[{url:i.properties.details.icon,altText:i.properties.details.name?"".concat(i.properties.details.name," icon"):"icon"}]:void 0}),gh(e)&&(e.properties.center=ac(e).unwrapOr(void 0)),e}function px(i,r){var n,o;switch(i.geometry.type){case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"Point":return null}let e=i.properties,t={type:"Feature",geometry:i.geometry,properties:{id:e.id,externalId:(o=(n=e.details)==null?void 0:n.externalId)!=null?o:"",entrances:[],kind:e.kind,footprintComponent:r}};return gh(t)&&(t.properties.center=ac(t).unwrapOr(void 0)),e.details&&(t.properties.details={name:e.details.name,description:e.details.description,images:e.details.icon?[{url:e.details.icon,altText:e.details.name?"".concat(e.details.name," icon"):"icon"}]:void 0}),t}function fx(i,r){var n,o;if(i.geometry.type!=="Polygon")return null;let e=i.properties,t={type:"Feature",geometry:i.geometry,properties:{id:e.id,externalId:(o=(n=e.details)==null?void 0:n.externalId)!=null?o:"",destinationNodes:r}};return gh(t)&&(t.properties.center=ac(t).unwrapOr(void 0)),e.details&&(t.properties.details={name:e.details.name,description:e.details.description,images:e.details.icon?[{url:e.details.icon,altText:e.details.name?"".concat(e.details.name," icon"):"icon"}]:void 0}),t}function gx(i){return i.geometry.type!=="LineString"?null:{type:"Feature",geometry:i.geometry,properties:{id:i.properties.id}}}function yx(i){var e,t;return new Set(((t=(e=i==null?void 0:i.ExteriorWalls)==null?void 0:e.geometryAnchors)!=null?t:[]).map(n=>n.geometryId))}v();function Mg(i,{geometryMaps:r,geometryFeatureById:e}){var n,o,s,a,l,u,m,h,d,f,b,x,y;if(!i.locationCategories&&!i.locations)return{};let t={};if((n=i.locationCategories)!=null&&n.length){let g=[];for(let S of i.locationCategories){let M={id:S.id,name:S.details.name,icon:(o=S.details.icon)!=null?o:""};S.parent&&(M.parent=S.parent),g.push(M)}t["category.json"]=g}if((s=i.locations)!=null&&s.length){let g=bx(i,{geometryFeatureById:e}),S=[];for(let M of i.locations){let E={id:M.id,name:M.details.name,categories:M.categories,spaces:[],obstructions:[],areas:[],annotations:[],connections:[],entrances:[],links:M.links,openingHoursSpecification:(a=M.openingHours)!=null?a:[],pictures:M.images,social:M.social,description:M.details.description,externalId:M.details.externalId,icon:M.details.icon,logo:M.logo,phone:M.phone,website:M.website,searchTags:M.searchTags};S.push(E);for(let{geometryId:w,floorId:R}of M.geometryAnchors)E.spaces.push(...(u=(l=r.space.get(w))==null?void 0:l.ids.map(I=>({id:I,floor:R})))!=null?u:[]),E.obstructions.push(...(h=(m=r.obstruction.get(w))==null?void 0:m.ids.map(I=>({id:I,floor:R})))!=null?h:[]),E.areas.push(...(f=(d=r.area.get(w))==null?void 0:d.ids.map(I=>({id:I,floor:R})))!=null?f:[]),E.entrances.push(...(b=g.entrancesByGeometryId.get(w))!=null?b:[]),E.connections.push(...(x=g.connectionsByGeometryId.get(w))!=null?x:[]),E.annotations.push(...(y=g.annotationsByGeometryId.get(w))!=null?y:[])}t["location.json"]=S}return t}function bx(i,{geometryFeatureById:r}){var t,n,o;let e={annotationsByGeometryId:new Map,connectionsByGeometryId:new Map,entrancesByGeometryId:new Map};if(i.annotations)for(let[s,a]of at(i.annotations))for(let l of a!=null?a:[]){let u=l.geometryId,m=l.id,h=(t=e.annotationsByGeometryId.get(u))!=null?t:[];h.push({floor:s,id:m}),e.annotationsByGeometryId.set(u,h)}if(i.connections)for(let s of i.connections){let a=dh(s,r),l=Array.from(new Map([...s.entrances,...s.exits].map(u=>["".concat(u.geometryId,"_").concat(u.floorId),u])).values());for(let u of l){let m=u.geometryId;if(a){let h=(n=e.entrancesByGeometryId.get(m))!=null?n:[];h.push({floor:u.floorId,id:s.id}),e.entrancesByGeometryId.set(m,h)}else{let h=(o=e.connectionsByGeometryId.get(m))!=null?o:[];h.push(s.id),e.connectionsByGeometryId.set(m,h)}}}return e}v();function Eg(i,r){let e={features:[],type:"FeatureCollection"},t={"manifest.geojson":e},n=i.manifest;if(n.features.length>0){let o=n.features[0],s=o.properties,a=s.details!=null?V({},s.details.externalId!=null&&{externalId:s.details.externalId}):void 0,l={type:"Feature",geometry:o.geometry,properties:V({folder_struct:[],version:"2.0.0",time:s.time,name:s.name,naturalBearing:s.naturalBearing,tzid:s.tzid,map:s.mapId,org_id:s.orgId,language:s.language},a!=null&&Object.keys(a).length>0&&{details:a})};e.features.push(l)}return t}v();function Cg(i,{geometryMaps:r,navigationFlags:e,incomingEdgesByNodeId:t}){var u,m,h,d,f,b;let n={"node.geojson":{type:"FeatureCollection",features:[]}},o=n["node.geojson"].features,s=vx(i),a=xx(i),l=Sx(i,a,s);for(let[x,y]of at((u=i.nodes)!=null?u:{}))for(let g of(m=y==null?void 0:y.features)!=null?m:[]){let S=(h=r.space.get(g.properties.geometryIds[0]))==null?void 0:h.features[0],M=(S==null?void 0:S.geometry.type)==="Point"&&((d=S==null?void 0:S.properties.details)!=null&&d.externalId)?S.properties.details.externalId:"",E=(f=t.get(g.properties.id))!=null?f:[],w=Object.keys(e!=null?e:{}),R=[];for(let T of E)for(let C of w)ii(T,e[C])&&R.push(e[C]);let I={type:"Feature",geometry:g.geometry,properties:{id:g.properties.id,floor:x,space:g.properties.geometryIds.map(T=>{var C;return(C=r.space.get(T))==null?void 0:C.ids}).flat().filter(T=>T!==void 0),neighbors:[...g.properties.neighbors.map(T=>({id:T.id,weight:T.extraCost})),...(b=l.get(g.properties.id))!=null?b:[]],map:x,externalId:M,flags:R.length>0?Mx(R):void 0}};o.push(I)}return n}function vx(i){var e,t;let r=new Map;for(let n of(t=(e=i.floors)==null?void 0:e.features)!=null?t:[])r.set(n.properties.id,n.properties.elevation);return r}function xx(i){var e,t,n;let r=new Map;for(let o of Object.values((e=i.nodes)!=null?e:{}))for(let s of(t=o==null?void 0:o.features)!=null?t:[])if(s.properties.geometryIds.length!==0)for(let a of s.properties.geometryIds){let l=(n=r.get(a))!=null?n:[];l.includes(s.properties.id)||(l.push(s.properties.id),r.set(a,l))}return r}function Sx(i,r,e){var n,o,s,a,l;let t=new Map;for(let u of(n=i.connections)!=null?n:[]){let m=u.exits.map(h=>{var d;return Ce(V({},h),{nodes:(d=r.get(h.geometryId))!=null?d:[]})});for(let h of u.entrances){let d=(o=r.get(h.geometryId))!=null?o:[];for(let f of d)for(let b of m){let x=Math.abs(((s=e.get(h.floorId))!=null?s:0)-((a=e.get(b.floorId))!=null?a:0))*u.floorCostMultiplier,y=(l=t.get(f))!=null?l:[];y.push(...b.nodes.filter(g=>g!==f).map(g=>({id:g,weight:x+u.entryCost}))),t.set(f,y)}}}return t}function Mx(i){if(i==null||i.length===0)return;let r=new Array(Math.max(...i.map(e=>e.index))+1).fill(0);for(let e of i)r[e.index]|=1<<e.bit;return r}v();function Ex(i,r){var t;let e={};for(let n of i){let o=r.get(n);o&&((t=e[o])!=null||(e[o]=[]),e[o].push(n))}return e}function wg(i,{geometryMaps:r}){var s,a,l;if(!i.defaultStyle)return{};let e={},t={};e["styles.json"]=t;let n=[...Array.from(r.space.values()).map(u=>u.features),...Array.from(r.obstruction.values()).map(u=>u.features)],o=new Map(n.flatMap(u=>u.map(m=>[m.properties.id,m.geometry.type])));for(let[u,m]of at(i.defaultStyle)){let h=Ex(m.geometryAnchors.flatMap(d=>{var f,b,x,y;return[...(b=(f=r.space.get(d.geometryId))==null?void 0:f.ids)!=null?b:[],...(y=(x=r.obstruction.get(d.geometryId))==null?void 0:x.ids)!=null?y:[]]}),o);if(h.Point&&h.Point.length>0){let d={points:Array.from(h.Point.values()),showImage:((s=m.extra)==null?void 0:s.showImage)!==void 0?((a=m.extra)==null?void 0:a.showImage)===!0:m.opacity!==0};t["".concat(u,".Point")]=d}if(h.LineString&&h.LineString.length>0){let d={lineStrings:Array.from(h.LineString.values()),altitude:m.altitude,color:m.color,height:m.height,opacity:m.opacity,width:m.buffer};m.topColor!==void 0&&(d.topColor=m.topColor),t["".concat(u,".LineString")]=d}if(h.Polygon&&h.Polygon.length>0){let d={polygons:Array.from(h.Polygon.values()),altitude:m.altitude,color:m.color,height:m.height,opacity:m.opacity};((l=m.extra)==null?void 0:l.showImage)!==void 0&&(d.showImage=m.extra.showImage===!0),m.topColor!==void 0&&(d.topColor=m.topColor),t["".concat(u,".Polygon")]=d}}return e}function Tg(i){let r=ag(i),e=mg(i,r),t=Sg(i,r),n=Cg(i,r),o=cg(i,r),s=wg(i,r),a=fg(i,r),l=pg(i,r),u=dg(i,r),m=lg(i,r),h=Mg(i,r),d=hg(i,r),f=Eg(i,r);return V(V(V(V(V(V(V(V(V(V(V(V(V(V(V({},i.tileset?{"tileset.json":i.tileset}:{}),i.navigationFlags?{"navigationFlags.json":i.navigationFlags}:{}),i.annotationSymbols?{"annotation-symbols.json":i.annotationSymbols}:{}),e),t),n),o),s),a),l),u),m),h),d),f)}var ke=i=>JSON.parse(uh(i)),Cx=/^geometry\/(.+)\.geojson$/,wx=/^nodes\/(.+)\.(geo)?json$/,Tx=/^floorImages\/(.+)\.geojson$/,Dx=/^facade\/(.+)\.json$/,Px=/^walkable\/(.+)\.json$/,Ix=/^nonwalkable\/(.+)\.json$/,Ox=/^kinds\/(.+)\.json$/,Lx=/^annotations\/(.+)\.json$/,Ax=/^cms\/(?:([^/]+)\/)?([^/]+)\.(?:json|geojson)$/,Rx=[(i,r)=>i==="manifest.geojson"?{manifest:ke(r)}:void 0,(i,r)=>i==="floors.geojson"?{floors:ke(r)}:void 0,(i,r)=>{let e=i.match(Cx);return e?{geometry:{[e[1]]:ke(r)}}:void 0},(i,r)=>i==="connections.json"?{connections:ke(r)}:void 0,(i,r)=>i==="navigationFlags.json"?{navigationFlags:ke(r)}:void 0,(i,r)=>{let e=i.match(wx);return e?{nodes:{[e[1]]:ke(r)}}:void 0},(i,r)=>i==="default-style.json"?{defaultStyle:ke(r)}:void 0,(i,r)=>i==="floor-stacks.json"?{floorStacks:ke(r)}:void 0,(i,r)=>i==="outdoors.json"?{outdoors:ke(r)}:void 0,(i,r)=>i==="tileset.json"?{tileset:ke(r)}:void 0,(i,r)=>{let e=i.match(Tx);return e?{floorImages:{[e[1]]:ke(r)}}:void 0},(i,r)=>{let e=i.match(Dx);return e?{facade:{[e[1]]:ke(r)}}:void 0},(i,r)=>{let e=i.match(Px);return e?{walkable:{[e[1]]:ke(r)}}:void 0},(i,r)=>{let e=i.match(Ix);return e?{nonwalkable:{[e[1]]:ke(r)}}:void 0},(i,r)=>{let e=i.match(Ox);return e?{kinds:{[e[1]]:ke(r)}}:void 0},(i,r)=>i==="annotation-symbols.json"?{annotationSymbols:ke(r)}:void 0,(i,r)=>{let e=i.match(Lx);return e?{annotations:{[e[1]]:ke(r)}}:void 0},(i,r)=>i==="locations.json"?{locations:ke(r)}:void 0,(i,r)=>i==="location-categories.json"?{locationCategories:ke(r)}:void 0,(i,r)=>i==="location-instances.json"?{locationInstances:ke(r)}:void 0,(i,r)=>{let e=i.match(Ax);if(!e)return;let[,t,n]=e;return t==="floorText"||t==="textures"||t==="textAreas"?{cms:{[t]:{[n]:ke(r)}}}:{cms:{[n]:ke(r)}}}],_x=new Set(Ql),Fx=new Set(Kl),Gx=new Set(us),Nx=new Set(ds),Bx=new Set(hs),kx=new Set(ms),zx=new Set(ps),Ux=new Set(fs),Hx=new Set(gs);function wn(i,r){return typeof i=="string"&&r.has(i)?i:"unknown"}function Vx(i){let r=i.connections;if(Array.isArray(r))for(let a of r)a&&typeof a=="object"&&"type"in a&&(a.type=wn(a.type,_x));let e=i.kinds;if(e&&typeof e=="object"){for(let a of Object.values(e))if(a&&typeof a=="object"){let l=a;for(let u of Object.keys(l))l[u]=wn(l[u],Fx)}}let t=i.cms;if(!t||typeof t!="object")return;let n=t,o=n.locations;if(Array.isArray(o))for(let a of o){if(!a||typeof a!="object")continue;let l=a;if("type"in l&&(l.type=wn(l.type,Gx)),Array.isArray(l.states))for(let u of l.states)u&&typeof u=="object"&&"type"in u&&(u.type=wn(u.type,Nx));if(Array.isArray(l.siblingGroups))for(let u of l.siblingGroups)u&&typeof u=="object"&&"type"in u&&(u.type=wn(u.type,Bx))}for(let a of["floorText","textAreas"]){let l=a==="floorText"?kx:zx,u=n[a];if(!(!u||typeof u!="object"))for(let m of Object.values(u)){if(!m||typeof m!="object")continue;let h=m.features;if(Array.isArray(h))for(let d of h){if(!d||typeof d!="object")continue;let f=d.properties;f&&typeof f=="object"&&"alignment"in f&&(f.alignment=wn(f.alignment,l))}}}let s=n.textures;if(s&&typeof s=="object"){for(let a of Object.values(s))if(Array.isArray(a))for(let l of a){if(!l||typeof l!="object")continue;let u=l;"face"in u&&(u.face=wn(u.face,Ux)),"surface"in u&&(u.surface=wn(u.surface,Hx))}}}function Wx(i){let r=tg(i),e={};for(let t of Object.keys(r))for(let n of Rx){let o=n(t,r[t]);if(o){e=cs(e,o,[]);break}}return Vx(e),e}function lc(i){try{return Tr(Wx(i))}catch(r){return ni(r instanceof Error?r:new Error(String(r)))}}var jx={decompressUnsafeSync:i=>lc(i),decompressUnsafe:i=>Promise.resolve(lc(i)),decompressSync:i=>lc(i),decompress:i=>Promise.resolve(lc(i))};var cc=class{constructor({nodes:r,geojsonCollection:e,groupBy:t="default",multiplicativeDistanceWeightScaling:n,flagDeclarations:o,getDoorByNodeId:s}){p(this,"groupBy");p(this,"graph");p(this,"geometryEdgesByMapId",new Map);p(this,"flagDeclarations",{});p(this,"getDoorByNodeId");p(this,"disabledNodeIds");p(this,"generatePath",r=>{let{destination:e}=r[r.length-1],t={type:"FeatureCollection",features:[]};for(let o=0;o<r.length;o++){let{origin:s,destination:a}=r[o],l={id:s.properties.id,angle:r[o].angle,distance:r[o].distance,destination:a.properties.id,edges:this.graph.edges[s.properties.id]};this.groupBy!=="default"&&(l.groupBy=s.properties[this.groupBy]),t.features.push({type:"Feature",geometry:{type:"Point",coordinates:[s.geometry.coordinates[0],s.geometry.coordinates[1]]},properties:l})}let n={id:e.properties.id,edges:this.graph.edges[e.properties.id]};return this.groupBy!=="default"&&(n.groupBy=e.properties[this.groupBy]),t.features.push({type:"Feature",geometry:{type:"Point",coordinates:[e.geometry.coordinates[0],e.geometry.coordinates[1]]},properties:n}),t});p(this,"findNearestNodesOnGraph",(r,e,t,n,o=!1,s=1/0)=>{var a;return this.graph.dijkstraFindWithinTravelDistance(r,e,n,(a=this.geometryEdgesByMapId.get(t))!=null?a:[],o,s)});p(this,"hasLineOfSight",(r,e,t,n)=>this.graph.hasLineOfSight(r,e,this.geometryEdgesByMapId.get(t),n));p(this,"getDistance",(r,e)=>ft(r,e));p(this,"getAngle",(r,e)=>ut(r,e));this.groupBy=t,this.graph=new Zl({nodes:r,groupBy:this.groupBy,multiplicativeDistanceWeightScaling:n});let a=(e==null?void 0:e.features)||[];this.flagDeclarations=o!=null?o:{},this.getDoorByNodeId=s,this.disabledNodeIds=this.getDisabledNodeIds(),a.forEach(l=>{let u=null;if(l.geometry.type==="LineString"?u=l.geometry.coordinates:l.geometry.type==="Polygon"&&(u=l.geometry.coordinates.flat()),u){let m=this.groupBy==="default"?this.groupBy:l.properties[this.groupBy];this.geometryEdgesByMapId.has(m)||this.geometryEdgesByMapId.set(m,[]),u.forEach((h,d)=>{this.geometryEdgesByMapId.get(m).push([h,u[d+1]||u[0]])})}})}getDisabledNodeIds(){let r=new Set;if(ql.public in this.flagDeclarations)for(let e in this.graph.nodesById)$l(this.graph.nodesById[e].properties.flags,this.flagDeclarations[ql.public].index,this.flagDeclarations[ql.public].bit)||r.add(e);return r}getDirections({zones:r,originIds:e,from:t,to:n,destinationNodeIds:o,disabledConnectionNodeIds:s,simplify:a,multiplicativeDistanceWeightScaling:l,overrideEdgeWeights:u}){var f;let m=(f=a==null?void 0:a.enabled)!=null?f:!0,h=r!=null?r:[],d=this.graph.aStar({originIds:e,destinationNodeIds:o,zones:h,disabledConnectionNodeIds:new Set(s),overrideEdgeWeights:u,disabledNodeIds:this.disabledNodeIds});if(d.length===0)return{type:"FeatureCollection",features:[]};if((a==null?void 0:a.__EXPERIMENTAL_METHOD)!=="greedy-los"&&t&&n&&t.length===1&&n.length===1){let b=new Tt({origin:t[0],destination:d[0].origin,distance:ft(t[0].geometry.coordinates,d[0].origin.geometry.coordinates),angle:ut(t[0].geometry.coordinates,d[0].origin.geometry.coordinates),multiplicativeDistanceWeightScaling:l}),x=d.slice(),y=new Tt({origin:d[d.length-1].destination,destination:n[0],distance:ft(d[d.length-1].destination.geometry.coordinates,n[0].geometry.coordinates),angle:ut(d[d.length-1].destination.geometry.coordinates,n[0].geometry.coordinates),multiplicativeDistanceWeightScaling:l});x.unshift(b),x.push(y),d=x}return m&&(d=this.simplifyAllSteps(d,a,l)),this.generatePath(d)}simplifyAllSteps(r,e={enabled:!0,__EXPERIMENTAL_METHOD:"greedy-los"},t){var d,f,b,x;let n=[],o=[r[0]],s=(d=e.__EXPERIMENTAL_METHOD)!=null?d:"greedy-los",a=(f=e.radius)!=null?f:as,l=s==="dp-optimal"?this.simplifyStepsWithDPMethod.bind(this):s==="rdp"?this.simplifyStepsImprovedWithSimplifyBeforeLoSChecks.bind(this):this.simplifySteps.bind(this);for(let y=1;y<r.length;y++)if(this.groupBy!=="default"&&r[y].origin.properties[this.groupBy]!==r[y-1].origin.properties[this.groupBy]){let g=r[y-1].origin.properties[this.groupBy],S=(b=this.geometryEdgesByMapId.get(g))!=null?b:[];n.push(...l(o,S,a,t,e)),o=[r[y]]}else o.push(r[y]);let u=r[r.length-1],m=this.groupBy==="default"?this.groupBy:u.origin.properties[this.groupBy],h=(x=this.geometryEdgesByMapId.get(m))!=null?x:[];return n.push(...l(o,h,a,t,e)),n}simplifySteps(r,e,t,n,o){return Vf(r,e,t,this.flagDeclarations,n)}simplifyStepsImprovedWithSimplifyBeforeLoSChecks(r,e,t,n,o){var l;if(r.length<3)return r;!1,r=Uf(r,this.getDoorByNodeId,n,e);let s=(o==null?void 0:o.__EXPERIMENTAL_METHOD)==="rdp"&&(l=o.mustIncludeDoorBufferNodes)!=null?l:!0;return Hf(r,e,n,s)}simplifyStepsWithDPMethod(r,e,t,n,o){var m;if(r.length<3)return r;let s=new Set;((o==null?void 0:o.__EXPERIMENTAL_METHOD)==="dp-optimal"&&(m=o.includeDoorBufferNodes)!=null?m:!1)&&(s=jf(r,this.getDoorByNodeId));for(let h=0;h<r.length-1;h++){let d=r[h].origin.properties.floor,f=r[h+1].origin.properties.floor;d!==f&&(r[h].origin.properties.preventSmoothing||(r[h].origin.properties.preventSmoothing=!0,s.add(r[h].origin.properties.id)),r[h+1].origin.properties.preventSmoothing||(r[h+1].origin.properties.preventSmoothing=!0,s.add(r[h+1].origin.properties.id)))}let l=r[r.length-1];l.origin.properties.floor!==l.destination.properties.floor&&(l.origin.properties.preventSmoothing||(l.origin.properties.preventSmoothing=!0,s.add(l.origin.properties.id))),!1;let u=Nf(r,e,n,t);if(!1){let h=u[u.length-1];window.__DEBUG_PATH.finalSteps.push({nodeId:h.destination.properties.id,coordinate:h.destination.geometry.coordinates,floorId:h.destination.properties.map})}for(let h of r)s.has(h.origin.properties.id)&&delete h.origin.properties.preventSmoothing,s.has(h.destination.properties.id)&&delete h.destination.properties.preventSmoothing;return u}};var yh="https://tiles-cdn.mappedin.com/styles/mappedin/style.json",Zx="https://auth.mappedin.com/oauth2/token";async function B4(i,r){var n,o,s,a,l,u,m,h,d;let e=(n=r==null?void 0:r.useWorkers)!=null?n:!0,t=Ce(V({},r),{watermark:r==null?void 0:r.watermark,attribution:r==null?void 0:r.attribution,antialias:r==null?void 0:r.antialias,occlusionEnabled:r==null?void 0:r.occlusionEnabled,transformImageRequest:r==null?void 0:r.transformImageRequest,naturalBearing:(o=r==null?void 0:r.naturalBearing)!=null?o:0,imagePlacementOptions:r==null?void 0:r.imagePlacementOptions,onWebGLContextCreationError:r==null?void 0:r.onWebGLContextCreationError,onWebGLContextLost:r==null?void 0:r.onWebGLContextLost,onWebGLContextRestored:r==null?void 0:r.onWebGLContextRestored,onWebGLRendererError:r==null?void 0:r.onWebGLRendererError,useStandaloneCamera:(s=r==null?void 0:r.useStandaloneCamera)!=null?s:!1,useCollisionWorker:(a=r==null?void 0:r.useCollisionWorker)!=null?a:!0,useWorkers:e});if(e===!0&&((l=r==null?void 0:r.outdoorView)!=null&&l.enabled)){let f=r.outdoorView.headers;f==null&&(f=await md(Zx));let b=r.center||[0,0];yc&&id(yc);let x=null,y=null;try{x=new nd({container:i,style:r.outdoorView.style||yh,center:b,attributionControl:!1,zoom:(u=r.zoomLevel)!=null?u:Yu,pitch:(m=r.pitch)!=null?m:Zu,bearing:(h=r.bearing)!=null?h:Xu,transformRequest:ld(f),trackResize:!1,pixelRatio:r.outdoorView.lowDpi?1:bi(),canvasContextAttributes:{antialias:typeof r.antialias=="boolean"?r.antialias:!0,powerPreference:"high-performance"},interactive:!1,validateStyle:!1,centerClampedToGround:!1,boxZoom:!1,doubleClickZoom:!1,scrollZoom:!1,dragPan:!1,dragRotate:!1,keyboard:!1,touchZoomRotate:!1}),await cd(x,{timeout:1e4,styleUrl:((d=r.outdoorView)==null?void 0:d.style)||yh})}catch(S){if(y=S,$.warn("[MappedinJS] Outdoor view initialization failed: ".concat(y.message,". Falling back to indoor-only rendering.")),x){try{x.remove()}catch(M){}x=null}}if(!x||y){let S=new ti(i,t);return S.publish("outdoor-style-error",{error:y}),S}let g=null;try{let S=x.painter.context.gl;g=new ti(i,V({center:b,zoomLevel:x.getZoom(),pitch:x.getPitch(),bearing:x.getBearing(),gl:S,map:x,mode:"outdoors-interleaved"},t));let M={center:x.getCenter().toArray(),zoom:x.getZoom(),bearing:x.getBearing(),pitch:x.getPitch(),elevation:x.getCenterElevation()};Zs(x,g.camera.minZoomLevel,g.camera.maxZoomLevel),x.setMaxPitch(g.camera.maxPitch),x.setMinPitch(g.camera.minPitch),g.on("camera-change",z=>{M.center=z.center,M.zoom=z.zoomLevel,M.bearing=z.bearing,M.pitch=z.pitch,M.elevation=z.elevation,x.jumpTo(M)});let E=ks.fromLngLat(b,0),w=Us(E,g.viewCamera,()=>{g==null||g.renderSync()}),R=async()=>{x&&(x.addLayer(w),g==null||g.renderSync())};g.onMapLibreEvent("style.load",R),R();let I=!1,T=!1,C=()=>{x&&(I||(g==null||g.publish("outdoor-view-loaded"),I=!0),T||(T=!0,g==null||g.publish("outdoor-style-loaded")))};g.onMapLibreEvent("idle",C);let F=z=>{z&&(z.sourceDataType==="metadata"||z.sourceDataType==="visibility"||z.dataType==="style"||z.type==="terrain")&&(g==null||g.getSystems().htmlControlsSystem.updateData(x))},L=z=>{x&&z&&z.dataType==="style"&&z.type==="styledata"&&(T=!1),F(z)};g.onMapLibreEvent("styledata",L),g.onMapLibreEvent("sourcedata",F),g.onMapLibreEvent("terrain",F);let N=z=>{var Y;if(((Y=z.error)==null?void 0:Y.url)===yh){$.error('Failed to load outdoor view style, possibly due to invalid token "'.concat(f["x-mappedin-tiles-key"],'"'));return}$.warn(z)};return g.onMapLibreEvent("error",N),g}catch(S){if(g)try{g.destroy()}catch(E){}if(x)try{x.remove()}catch(E){}$.warn("Failed to initialize outdoor view, falling back to indoor-only rendering:",S);let M=new ti(i,t);return M.publish("outdoor-style-error",{error:S}),M}}else return new ti(i,t)}export{lE as a,Em as b,xa as c,cE as d,ft as e,Qc as f,Sa as g,Za as h,Zn as i,Li as j,HT as k,cs as l,v0 as m,Tg as n,jx as o,jl as p,el as q,zr as r,cc as s,Gc as t,Rg as u,Ta as v,su as w,a0 as x,$u as y,B4 as z};