@mappedin/mappedin-js 6.0.0-rc.4 → 6.0.0-rc.5

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.
Files changed (31) hide show
  1. package/lib/esm/{GLTFExporter-22SRWSNV.js → GLTFExporter-BIMYOBV2.js} +2 -2
  2. package/lib/esm/{GLTFLoader-SWPNQTFP.js → GLTFLoader-BEG3VCKK.js} +2 -2
  3. package/lib/esm/{browser-GGPMSNFY.js → browser-FKTBGI2T.js} +2 -2
  4. package/lib/esm/{chunk-GAHPB2XK.js → chunk-3E7RBW5P.js} +26 -26
  5. package/lib/esm/chunk-3E7RBW5P.js.map +7 -0
  6. package/lib/esm/{chunk-VWOFYLSM.js → chunk-HC3H6CI4.js} +2 -2
  7. package/lib/esm/{chunk-MDSV6XJR.js → chunk-OBLC2SMU.js} +2 -2
  8. package/lib/esm/{chunk-I32KNH7E.js → chunk-RQZV3WZS.js} +2 -2
  9. package/lib/esm/{chunk-AFELLAS6.js → chunk-SK7G4AI7.js} +4 -4
  10. package/lib/esm/{chunk-AFELLAS6.js.map → chunk-SK7G4AI7.js.map} +3 -3
  11. package/lib/esm/chunk-UX7CELX5.js +2 -0
  12. package/lib/esm/{chunk-3GOFR3M6.js.map → chunk-UX7CELX5.js.map} +1 -1
  13. package/lib/esm/index.d.ts +28 -3
  14. package/lib/esm/index.js +1 -1
  15. package/lib/esm/{inspector-HQV23IML.js → inspector-RGAT354S.js} +2 -2
  16. package/lib/esm/{internal-MAULC22C.js → internal-ERAZRCF7.js} +2 -2
  17. package/lib/esm/{outdoor-context-v5-5KBHPW76.js → outdoor-context-v5-XNL42GDZ.js} +2 -2
  18. package/lib/esm/{text3d-HT6TS3WO.js → text3d-2D7CP6GT.js} +2 -2
  19. package/package.json +1 -1
  20. package/lib/esm/chunk-3GOFR3M6.js +0 -2
  21. package/lib/esm/chunk-GAHPB2XK.js.map +0 -7
  22. /package/lib/esm/{GLTFExporter-22SRWSNV.js.map → GLTFExporter-BIMYOBV2.js.map} +0 -0
  23. /package/lib/esm/{GLTFLoader-SWPNQTFP.js.map → GLTFLoader-BEG3VCKK.js.map} +0 -0
  24. /package/lib/esm/{browser-GGPMSNFY.js.map → browser-FKTBGI2T.js.map} +0 -0
  25. /package/lib/esm/{chunk-VWOFYLSM.js.map → chunk-HC3H6CI4.js.map} +0 -0
  26. /package/lib/esm/{chunk-MDSV6XJR.js.map → chunk-OBLC2SMU.js.map} +0 -0
  27. /package/lib/esm/{chunk-I32KNH7E.js.map → chunk-RQZV3WZS.js.map} +0 -0
  28. /package/lib/esm/{inspector-HQV23IML.js.map → inspector-RGAT354S.js.map} +0 -0
  29. /package/lib/esm/{internal-MAULC22C.js.map → internal-ERAZRCF7.js.map} +0 -0
  30. /package/lib/esm/{outdoor-context-v5-5KBHPW76.js.map → outdoor-context-v5-XNL42GDZ.js.map} +0 -0
  31. /package/lib/esm/{text3d-HT6TS3WO.js.map → text3d-2D7CP6GT.js.map} +0 -0
@@ -1,15 +1,15 @@
1
- import{$ as w0,$a as my,A as EC,Aa as cy,Ab as Ep,B as Nl,Ba as py,Bb as U0,C as PC,Ca as YC,Cb as hy,D as FC,Da as JC,Db as OM,E as T0,Ea as KC,Eb as V0,F as Di,Fa as QC,Fb as EM,G as iy,Ga as qC,Gb as PM,H as Ps,Ha as L0,Hb as FM,I as jl,Ia as eM,Ib as DM,J as DC,Ja as tM,Jb as kM,K as kC,Ka as Cp,Kb as AM,L as AC,La as rM,Lb as Ai,M as LC,Ma as oM,Mb as LM,N as mm,Na as dy,Nb as Ht,O as Po,Oa as _0,Ob as _M,P as _C,Pa as nM,Pb as RM,Q as C0,Qa as ym,Qb as _i,R as ki,Ra as Mp,Rb as BM,S as RC,Sa as uy,Sb as fr,T as vp,Ta as wp,Tb as zn,U as F,Ua as Op,Ub as hr,V as J,Va as iM,W as sy,Wa as R0,X as Ip,Y as fm,Ya as sM,Z as BC,Za as aM,_ as M0,_a as lM,aa as NC,ab as cM,ba as jC,bb as pM,c as A,ca as GC,cb as dM,d as wr,da as Fs,db as uM,e as rC,ea as UC,eb as mM,f as b0,fa as O0,fb as bm,g as Pi,ga as VC,gb as zo,h as TC,ha as Ds,hb as fM,i as ty,ia as P0,ib as hM,j as CC,ja as Ga,jb as gM,k as Fi,ka as Mt,kb as B0,l as ry,la as ay,lb as yM,m as MC,ma as hm,mb as N0,n as oy,na as F0,nb as j0,o as Bl,oa as ly,ob as bM,p as dm,pa as D0,pb as xM,q as I0,qa as k0,qb as vM,r as xp,ra as A0,rb as IM,s as ut,sa as zC,sb as SM,t as ny,ta as Sp,tb as G0,u as ke,ua as WC,ub as TM,v as Es,va as Tp,vb as Ua,w as um,wa as gm,wb as fy,x as S0,xa as ZC,xb as CM,y as wC,ya as XC,yb as MM,z as OC,zb as wM}from"./chunk-AFELLAS6.js";import{X as E0,ea as HC,w as $C}from"./chunk-I32KNH7E.js";import{a as Li}from"./chunk-MDSV6XJR.js";import{$ as Le,Aa as Qg,B as Wg,Ba as gC,C as Zg,Ca as Na,D as sC,Da as ja,E as aC,Ea as Os,Fa as qg,G as lC,Ga as yC,H as Ue,Ha as bC,I as Me,Ja as Oi,M as cC,N as pC,O as dC,P as Xg,Q as ae,R as sr,S as uC,T as $n,Ta as bp,U as gp,V as ws,W as ar,Xa as ey,Y as Nr,Ya as xC,Z as po,_ as Yg,aa as Hn,ab as vC,b as Hg,c as lm,ca as _a,cb as Ei,d as x0,da as mC,e as Ms,ea as v0,eb as IC,f as oC,g as cm,ga as Ra,gb as SC,oa as Ba,p as nC,pa as Jg,qa as Kg,r as iC,ra as fC,ta as pm,ya as hC,z as zg,za as yp}from"./chunk-VWOFYLSM.js";import{a as d,b as y}from"./chunk-3GOFR3M6.js";import{b as Cs,c as La,d as hp,e as m,f as s,g as S,h as w,i as W}from"./chunk-ROCNZJLL.js";var GF=Cs((rS,oS)=>{d();(function(e,r){typeof rS=="object"&&typeof oS<"u"?oS.exports=r():typeof define=="function"&&define.amd?define(r):(e=e||self,e.TinyQueue=r())})(rS,function(){"use strict";var e=function(o,n){if(o===void 0&&(o=[]),n===void 0&&(n=r),this.data=o,this.length=this.data.length,this.compare=n,this.length>0)for(var i=(this.length>>1)-1;i>=0;i--)this._down(i)};e.prototype.push=function(o){this.data.push(o),this.length++,this._up(this.length-1)},e.prototype.pop=function(){if(this.length!==0){var o=this.data[0],n=this.data.pop();return this.length--,this.length>0&&(this.data[0]=n,this._down(0)),o}},e.prototype.peek=function(){return this.data[0]},e.prototype._up=function(o){for(var n=this,i=n.data,a=n.compare,l=i[o];o>0;){var c=o-1>>1,p=i[c];if(a(l,p)>=0)break;i[o]=p,o=c}i[o]=l},e.prototype._down=function(o){for(var n=this,i=n.data,a=n.compare,l=this.length>>1,c=i[o];o<l;){var p=(o<<1)+1,u=i[p],f=p+1;if(f<this.length&&a(i[f],u)<0&&(p=f,u=i[f]),a(u,c)>=0)break;i[o]=u,o=p}i[o]=c};function r(t,o){return t<o?-1:t>o?1:0}return e})});var VF=Cs((P0e,nS)=>{"use strict";d();var Kb=GF();Kb.default&&(Kb=Kb.default);nS.exports=UF;nS.exports.default=UF;function UF(e,r,t){r=r||1;for(var o,n,i,a,l=0;l<e[0].length;l++){var c=e[0][l];(!l||c[0]<o)&&(o=c[0]),(!l||c[1]<n)&&(n=c[1]),(!l||c[0]>i)&&(i=c[0]),(!l||c[1]>a)&&(a=c[1])}var p=i-o,u=a-n,f=Math.min(p,u),h=f/2;if(f===0){var b=[o,n];return b.distance=0,b}for(var x=new Kb(void 0,xU),T=o;T<i;T+=f)for(var v=n;v<a;v+=f)x.push(new el(T+h,v+h,h,e));var I=IU(e),M=new el(o+p/2,n+u/2,0,e);M.d>I.d&&(I=M);for(var O=x.length;x.length;){var C=x.pop();C.d>I.d&&(I=C,t&&console.log("found best %d after %d probes",Math.round(1e4*C.d)/1e4,O)),!(C.max-I.d<=r)&&(h=C.h/2,x.push(new el(C.x-h,C.y-h,h,e)),x.push(new el(C.x+h,C.y-h,h,e)),x.push(new el(C.x-h,C.y+h,h,e)),x.push(new el(C.x+h,C.y+h,h,e)),O+=4)}t&&(console.log("num probes: "+O),console.log("best distance: "+I.d));var E=[I.x,I.y];return E.distance=I.d,E}function xU(e,r){return r.max-e.max}function el(e,r,t,o){this.x=e,this.y=r,this.h=t,this.d=vU(e,r,o),this.max=this.d+this.h*Math.SQRT2}function vU(e,r,t){for(var o=!1,n=1/0,i=0;i<t.length;i++)for(var a=t[i],l=0,c=a.length,p=c-1;l<c;p=l++){var u=a[l],f=a[p];u[1]>r!=f[1]>r&&e<(f[0]-u[0])*(r-u[1])/(f[1]-u[1])+u[0]&&(o=!o),n=Math.min(n,SU(e,r,u,f))}return n===0?0:(o?1:-1)*Math.sqrt(n)}function IU(e){for(var r=0,t=0,o=0,n=e[0],i=0,a=n.length,l=a-1;i<a;l=i++){var c=n[i],p=n[l],u=c[0]*p[1]-p[0]*c[1];t+=(c[0]+p[0])*u,o+=(c[1]+p[1])*u,r+=u*3}return r===0?new el(n[0][0],n[0][1],0,e):new el(t/r,o/r,0,e)}function SU(e,r,t,o){var n=t[0],i=t[1],a=o[0]-n,l=o[1]-i;if(a!==0||l!==0){var c=((e-n)*a+(r-i)*l)/(a*a+l*l);c>1?(n=o[0],i=o[1]):c>0&&(n+=a*c,i+=l*c)}return a=e-n,l=r-i,a*a+l*l}});var p5=Cs((hS,gS)=>{d();(function(e,r){typeof hS=="object"&&typeof gS<"u"?gS.exports=r():typeof define=="function"&&define.amd?define(r):(e=e||self).RBush=r()})(hS,function(){"use strict";function e(v,I,M,O,C){(function E(_,G,R,N,X){for(;N>R;){if(N-R>600){var z=N-R+1,ee=G-R+1,re=Math.log(z),ue=.5*Math.exp(2*re/3),Ce=.5*Math.sqrt(re*ue*(z-ue)/z)*(ee-z/2<0?-1:1),Oe=Math.max(R,Math.floor(G-ee*ue/z+Ce)),Pe=Math.min(N,Math.floor(G+(z-ee)*ue/z+Ce));E(_,G,Oe,Pe,X)}var Fe=_[G],ce=R,Ee=N;for(r(_,R,G),X(_[N],Fe)>0&&r(_,R,N);ce<Ee;){for(r(_,ce,Ee),ce++,Ee--;X(_[ce],Fe)<0;)ce++;for(;X(_[Ee],Fe)>0;)Ee--}X(_[R],Fe)===0?r(_,R,Ee):r(_,++Ee,N),Ee<=G&&(R=Ee+1),G<=Ee&&(N=Ee-1)}})(v,I,M||0,O||v.length-1,C||t)}function r(v,I,M){var O=v[I];v[I]=v[M],v[M]=O}function t(v,I){return v<I?-1:v>I?1:0}var o=function(v){v===void 0&&(v=9),this._maxEntries=Math.max(4,v),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function n(v,I,M){if(!M)return I.indexOf(v);for(var O=0;O<I.length;O++)if(M(v,I[O]))return O;return-1}function i(v,I){a(v,0,v.children.length,I,v)}function a(v,I,M,O,C){C||(C=x(null)),C.minX=1/0,C.minY=1/0,C.maxX=-1/0,C.maxY=-1/0;for(var E=I;E<M;E++){var _=v.children[E];l(C,v.leaf?O(_):_)}return C}function l(v,I){return v.minX=Math.min(v.minX,I.minX),v.minY=Math.min(v.minY,I.minY),v.maxX=Math.max(v.maxX,I.maxX),v.maxY=Math.max(v.maxY,I.maxY),v}function c(v,I){return v.minX-I.minX}function p(v,I){return v.minY-I.minY}function u(v){return(v.maxX-v.minX)*(v.maxY-v.minY)}function f(v){return v.maxX-v.minX+(v.maxY-v.minY)}function h(v,I){return v.minX<=I.minX&&v.minY<=I.minY&&I.maxX<=v.maxX&&I.maxY<=v.maxY}function b(v,I){return I.minX<=v.maxX&&I.minY<=v.maxY&&I.maxX>=v.minX&&I.maxY>=v.minY}function x(v){return{children:v,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function T(v,I,M,O,C){for(var E=[I,M];E.length;)if(!((M=E.pop())-(I=E.pop())<=O)){var _=I+Math.ceil((M-I)/O/2)*O;e(v,_,I,M,C),E.push(I,_,_,M)}}return o.prototype.all=function(){return this._all(this.data,[])},o.prototype.search=function(v){var I=this.data,M=[];if(!b(v,I))return M;for(var O=this.toBBox,C=[];I;){for(var E=0;E<I.children.length;E++){var _=I.children[E],G=I.leaf?O(_):_;b(v,G)&&(I.leaf?M.push(_):h(v,G)?this._all(_,M):C.push(_))}I=C.pop()}return M},o.prototype.collides=function(v){var I=this.data;if(!b(v,I))return!1;for(var M=[];I;){for(var O=0;O<I.children.length;O++){var C=I.children[O],E=I.leaf?this.toBBox(C):C;if(b(v,E)){if(I.leaf||h(v,E))return!0;M.push(C)}}I=M.pop()}return!1},o.prototype.load=function(v){if(!v||!v.length)return this;if(v.length<this._minEntries){for(var I=0;I<v.length;I++)this.insert(v[I]);return this}var M=this._build(v.slice(),0,v.length-1,0);if(this.data.children.length)if(this.data.height===M.height)this._splitRoot(this.data,M);else{if(this.data.height<M.height){var O=this.data;this.data=M,M=O}this._insert(M,this.data.height-M.height-1,!0)}else this.data=M;return this},o.prototype.insert=function(v){return v&&this._insert(v,this.data.height-1),this},o.prototype.clear=function(){return this.data=x([]),this},o.prototype.remove=function(v,I){if(!v)return this;for(var M,O,C,E=this.data,_=this.toBBox(v),G=[],R=[];E||G.length;){if(E||(E=G.pop(),O=G[G.length-1],M=R.pop(),C=!0),E.leaf){var N=n(v,E.children,I);if(N!==-1)return E.children.splice(N,1),G.push(E),this._condense(G),this}C||E.leaf||!h(E,_)?O?(M++,E=O.children[M],C=!1):E=null:(G.push(E),R.push(M),M=0,O=E,E=E.children[0])}return this},o.prototype.toBBox=function(v){return v},o.prototype.compareMinX=function(v,I){return v.minX-I.minX},o.prototype.compareMinY=function(v,I){return v.minY-I.minY},o.prototype.toJSON=function(){return this.data},o.prototype.fromJSON=function(v){return this.data=v,this},o.prototype._all=function(v,I){for(var M=[];v;)v.leaf?I.push.apply(I,v.children):M.push.apply(M,v.children),v=M.pop();return I},o.prototype._build=function(v,I,M,O){var C,E=M-I+1,_=this._maxEntries;if(E<=_)return i(C=x(v.slice(I,M+1)),this.toBBox),C;O||(O=Math.ceil(Math.log(E)/Math.log(_)),_=Math.ceil(E/Math.pow(_,O-1))),(C=x([])).leaf=!1,C.height=O;var G=Math.ceil(E/_),R=G*Math.ceil(Math.sqrt(_));T(v,I,M,R,this.compareMinX);for(var N=I;N<=M;N+=R){var X=Math.min(N+R-1,M);T(v,N,X,G,this.compareMinY);for(var z=N;z<=X;z+=G){var ee=Math.min(z+G-1,X);C.children.push(this._build(v,z,ee,O-1))}}return i(C,this.toBBox),C},o.prototype._chooseSubtree=function(v,I,M,O){for(;O.push(I),!I.leaf&&O.length-1!==M;){for(var C=1/0,E=1/0,_=void 0,G=0;G<I.children.length;G++){var R=I.children[G],N=u(R),X=(z=v,ee=R,(Math.max(ee.maxX,z.maxX)-Math.min(ee.minX,z.minX))*(Math.max(ee.maxY,z.maxY)-Math.min(ee.minY,z.minY))-N);X<E?(E=X,C=N<C?N:C,_=R):X===E&&N<C&&(C=N,_=R)}I=_||I.children[0]}var z,ee;return I},o.prototype._insert=function(v,I,M){var O=M?v:this.toBBox(v),C=[],E=this._chooseSubtree(O,this.data,I,C);for(E.children.push(v),l(E,O);I>=0&&C[I].children.length>this._maxEntries;)this._split(C,I),I--;this._adjustParentBBoxes(O,C,I)},o.prototype._split=function(v,I){var M=v[I],O=M.children.length,C=this._minEntries;this._chooseSplitAxis(M,C,O);var E=this._chooseSplitIndex(M,C,O),_=x(M.children.splice(E,M.children.length-E));_.height=M.height,_.leaf=M.leaf,i(M,this.toBBox),i(_,this.toBBox),I?v[I-1].children.push(_):this._splitRoot(M,_)},o.prototype._splitRoot=function(v,I){this.data=x([v,I]),this.data.height=v.height+1,this.data.leaf=!1,i(this.data,this.toBBox)},o.prototype._chooseSplitIndex=function(v,I,M){for(var O,C,E,_,G,R,N,X=1/0,z=1/0,ee=I;ee<=M-I;ee++){var re=a(v,0,ee,this.toBBox),ue=a(v,ee,M,this.toBBox),Ce=(C=re,E=ue,_=void 0,G=void 0,R=void 0,N=void 0,_=Math.max(C.minX,E.minX),G=Math.max(C.minY,E.minY),R=Math.min(C.maxX,E.maxX),N=Math.min(C.maxY,E.maxY),Math.max(0,R-_)*Math.max(0,N-G)),Oe=u(re)+u(ue);Ce<X?(X=Ce,O=ee,z=Oe<z?Oe:z):Ce===X&&Oe<z&&(z=Oe,O=ee)}return O||M-I},o.prototype._chooseSplitAxis=function(v,I,M){var O=v.leaf?this.compareMinX:c,C=v.leaf?this.compareMinY:p;this._allDistMargin(v,I,M,O)<this._allDistMargin(v,I,M,C)&&v.children.sort(O)},o.prototype._allDistMargin=function(v,I,M,O){v.children.sort(O);for(var C=this.toBBox,E=a(v,0,I,C),_=a(v,M-I,M,C),G=f(E)+f(_),R=I;R<M-I;R++){var N=v.children[R];l(E,v.leaf?C(N):N),G+=f(E)}for(var X=M-I-1;X>=I;X--){var z=v.children[X];l(_,v.leaf?C(z):z),G+=f(_)}return G},o.prototype._adjustParentBBoxes=function(v,I,M){for(var O=M;O>=0;O--)l(I[O],v)},o.prototype._condense=function(v){for(var I=v.length-1,M=void 0;I>=0;I--)v[I].children.length===0?I>0?(M=v[I-1].children).splice(M.indexOf(v[I]),1):this.clear():i(v[I],this.toBBox)},o})});var IS=Cs(xe=>{"use strict";d();Object.defineProperty(xe,"__esModule",{value:!0});xe.earthRadius=63710088e-1;xe.factors={centimeters:xe.earthRadius*100,centimetres:xe.earthRadius*100,degrees:xe.earthRadius/111325,feet:xe.earthRadius*3.28084,inches:xe.earthRadius*39.37,kilometers:xe.earthRadius/1e3,kilometres:xe.earthRadius/1e3,meters:xe.earthRadius,metres:xe.earthRadius,miles:xe.earthRadius/1609.344,millimeters:xe.earthRadius*1e3,millimetres:xe.earthRadius*1e3,nauticalmiles:xe.earthRadius/1852,radians:1,yards:xe.earthRadius*1.0936};xe.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/xe.earthRadius,yards:1.0936133};xe.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 ol(e,r,t){t===void 0&&(t={});var o={type:"Feature"};return(t.id===0||t.id)&&(o.id=t.id),t.bbox&&(o.bbox=t.bbox),o.properties=r||{},o.geometry=e,o}xe.feature=ol;function pV(e,r,t){switch(t===void 0&&(t={}),e){case"Point":return yS(r).geometry;case"LineString":return xS(r).geometry;case"Polygon":return bS(r).geometry;case"MultiPoint":return u5(r).geometry;case"MultiLineString":return d5(r).geometry;case"MultiPolygon":return m5(r).geometry;default:throw new Error(e+" is invalid")}}xe.geometry=pV;function yS(e,r,t){if(t===void 0&&(t={}),!e)throw new Error("coordinates is required");if(!Array.isArray(e))throw new Error("coordinates must be an Array");if(e.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!n1(e[0])||!n1(e[1]))throw new Error("coordinates must contain numbers");var o={type:"Point",coordinates:e};return ol(o,r,t)}xe.point=yS;function dV(e,r,t){return t===void 0&&(t={}),i1(e.map(function(o){return yS(o,r)}),t)}xe.points=dV;function bS(e,r,t){t===void 0&&(t={});for(var o=0,n=e;o<n.length;o++){var i=n[o];if(i.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var a=0;a<i[i.length-1].length;a++)if(i[i.length-1][a]!==i[0][a])throw new Error("First and last Position are not equivalent.")}var l={type:"Polygon",coordinates:e};return ol(l,r,t)}xe.polygon=bS;function uV(e,r,t){return t===void 0&&(t={}),i1(e.map(function(o){return bS(o,r)}),t)}xe.polygons=uV;function xS(e,r,t){if(t===void 0&&(t={}),e.length<2)throw new Error("coordinates must be an array of two or more positions");var o={type:"LineString",coordinates:e};return ol(o,r,t)}xe.lineString=xS;function mV(e,r,t){return t===void 0&&(t={}),i1(e.map(function(o){return xS(o,r)}),t)}xe.lineStrings=mV;function i1(e,r){r===void 0&&(r={});var t={type:"FeatureCollection"};return r.id&&(t.id=r.id),r.bbox&&(t.bbox=r.bbox),t.features=e,t}xe.featureCollection=i1;function d5(e,r,t){t===void 0&&(t={});var o={type:"MultiLineString",coordinates:e};return ol(o,r,t)}xe.multiLineString=d5;function u5(e,r,t){t===void 0&&(t={});var o={type:"MultiPoint",coordinates:e};return ol(o,r,t)}xe.multiPoint=u5;function m5(e,r,t){t===void 0&&(t={});var o={type:"MultiPolygon",coordinates:e};return ol(o,r,t)}xe.multiPolygon=m5;function fV(e,r,t){t===void 0&&(t={});var o={type:"GeometryCollection",geometries:e};return ol(o,r,t)}xe.geometryCollection=fV;function hV(e,r){if(r===void 0&&(r=0),r&&!(r>=0))throw new Error("precision must be a positive number");var t=Math.pow(10,r||0);return Math.round(e*t)/t}xe.round=hV;function f5(e,r){r===void 0&&(r="kilometers");var t=xe.factors[r];if(!t)throw new Error(r+" units is invalid");return e*t}xe.radiansToLength=f5;function vS(e,r){r===void 0&&(r="kilometers");var t=xe.factors[r];if(!t)throw new Error(r+" units is invalid");return e/t}xe.lengthToRadians=vS;function gV(e,r){return h5(vS(e,r))}xe.lengthToDegrees=gV;function yV(e){var r=e%360;return r<0&&(r+=360),r}xe.bearingToAzimuth=yV;function h5(e){var r=e%(2*Math.PI);return r*180/Math.PI}xe.radiansToDegrees=h5;function bV(e){var r=e%360;return r*Math.PI/180}xe.degreesToRadians=bV;function xV(e,r,t){if(r===void 0&&(r="kilometers"),t===void 0&&(t="kilometers"),!(e>=0))throw new Error("length must be a positive number");return f5(vS(e,r),t)}xe.convertLength=xV;function vV(e,r,t){if(r===void 0&&(r="meters"),t===void 0&&(t="kilometers"),!(e>=0))throw new Error("area must be a positive number");var o=xe.areaFactors[r];if(!o)throw new Error("invalid original units");var n=xe.areaFactors[t];if(!n)throw new Error("invalid final units");return e/o*n}xe.convertArea=vV;function n1(e){return!isNaN(e)&&e!==null&&!Array.isArray(e)}xe.isNumber=n1;function IV(e){return!!e&&e.constructor===Object}xe.isObject=IV;function SV(e){if(!e)throw new Error("bbox is required");if(!Array.isArray(e))throw new Error("bbox must be an Array");if(e.length!==4&&e.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");e.forEach(function(r){if(!n1(r))throw new Error("bbox must only contain numbers")})}xe.validateBBox=SV;function TV(e){if(!e)throw new Error("id is required");if(["string","number"].indexOf(typeof e)===-1)throw new Error("id must be a number or a string")}xe.validateId=TV});var TS=Cs(br=>{"use strict";d();Object.defineProperty(br,"__esModule",{value:!0});var so=IS();function ff(e,r,t){if(e!==null)for(var o,n,i,a,l,c,p,u=0,f=0,h,b=e.type,x=b==="FeatureCollection",T=b==="Feature",v=x?e.features.length:1,I=0;I<v;I++){p=x?e.features[I].geometry:T?e.geometry:e,h=p?p.type==="GeometryCollection":!1,l=h?p.geometries.length:1;for(var M=0;M<l;M++){var O=0,C=0;if(a=h?p.geometries[M]:p,a!==null){c=a.coordinates;var E=a.type;switch(u=t&&(E==="Polygon"||E==="MultiPolygon")?1:0,E){case null:break;case"Point":if(r(c,f,I,O,C)===!1)return!1;f++,O++;break;case"LineString":case"MultiPoint":for(o=0;o<c.length;o++){if(r(c[o],f,I,O,C)===!1)return!1;f++,E==="MultiPoint"&&O++}E==="LineString"&&O++;break;case"Polygon":case"MultiLineString":for(o=0;o<c.length;o++){for(n=0;n<c[o].length-u;n++){if(r(c[o][n],f,I,O,C)===!1)return!1;f++}E==="MultiLineString"&&O++,E==="Polygon"&&C++}E==="Polygon"&&O++;break;case"MultiPolygon":for(o=0;o<c.length;o++){for(C=0,n=0;n<c[o].length;n++){for(i=0;i<c[o][n].length-u;i++){if(r(c[o][n][i],f,I,O,C)===!1)return!1;f++}C++}O++}break;case"GeometryCollection":for(o=0;o<a.geometries.length;o++)if(ff(a.geometries[o],r,t)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function CV(e,r,t,o){var n=t;return ff(e,function(i,a,l,c,p){a===0&&t===void 0?n=i:n=r(n,i,a,l,c,p)},o),n}function g5(e,r){var t;switch(e.type){case"FeatureCollection":for(t=0;t<e.features.length&&r(e.features[t].properties,t)!==!1;t++);break;case"Feature":r(e.properties,0);break}}function MV(e,r,t){var o=t;return g5(e,function(n,i){i===0&&t===void 0?o=n:o=r(o,n,i)}),o}function y5(e,r){if(e.type==="Feature")r(e,0);else if(e.type==="FeatureCollection")for(var t=0;t<e.features.length&&r(e.features[t],t)!==!1;t++);}function wV(e,r,t){var o=t;return y5(e,function(n,i){i===0&&t===void 0?o=n:o=r(o,n,i)}),o}function OV(e){var r=[];return ff(e,function(t){r.push(t)}),r}function SS(e,r){var t,o,n,i,a,l,c,p,u,f,h=0,b=e.type==="FeatureCollection",x=e.type==="Feature",T=b?e.features.length:1;for(t=0;t<T;t++){for(l=b?e.features[t].geometry:x?e.geometry:e,p=b?e.features[t].properties:x?e.properties:{},u=b?e.features[t].bbox:x?e.bbox:void 0,f=b?e.features[t].id:x?e.id:void 0,c=l?l.type==="GeometryCollection":!1,a=c?l.geometries.length:1,n=0;n<a;n++){if(i=c?l.geometries[n]:l,i===null){if(r(null,h,p,u,f)===!1)return!1;continue}switch(i.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(r(i,h,p,u,f)===!1)return!1;break}case"GeometryCollection":{for(o=0;o<i.geometries.length;o++)if(r(i.geometries[o],h,p,u,f)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}h++}}function EV(e,r,t){var o=t;return SS(e,function(n,i,a,l,c){i===0&&t===void 0?o=n:o=r(o,n,i,a,l,c)}),o}function s1(e,r){SS(e,function(t,o,n,i,a){var l=t===null?null:t.type;switch(l){case null:case"Point":case"LineString":case"Polygon":return r(so.feature(t,n,{bbox:i,id:a}),o,0)===!1?!1:void 0}var c;switch(l){case"MultiPoint":c="Point";break;case"MultiLineString":c="LineString";break;case"MultiPolygon":c="Polygon";break}for(var p=0;p<t.coordinates.length;p++){var u=t.coordinates[p],f={type:c,coordinates:u};if(r(so.feature(f,n),o,p)===!1)return!1}})}function PV(e,r,t){var o=t;return s1(e,function(n,i,a){i===0&&a===0&&t===void 0?o=n:o=r(o,n,i,a)}),o}function b5(e,r){s1(e,function(t,o,n){var i=0;if(t.geometry){var a=t.geometry.type;if(!(a==="Point"||a==="MultiPoint")){var l,c=0,p=0,u=0;if(ff(t,function(f,h,b,x,T){if(l===void 0||o>c||x>p||T>u){l=f,c=o,p=x,u=T,i=0;return}var v=so.lineString([l,f],t.properties);if(r(v,o,n,T,i)===!1)return!1;i++,l=f})===!1)return!1}}})}function FV(e,r,t){var o=t,n=!1;return b5(e,function(i,a,l,c,p){n===!1&&t===void 0?o=i:o=r(o,i,a,l,c,p),n=!0}),o}function x5(e,r){if(!e)throw new Error("geojson is required");s1(e,function(t,o,n){if(t.geometry!==null){var i=t.geometry.type,a=t.geometry.coordinates;switch(i){case"LineString":if(r(t,o,n,0,0)===!1)return!1;break;case"Polygon":for(var l=0;l<a.length;l++)if(r(so.lineString(a[l],t.properties),o,n,l)===!1)return!1;break}}})}function DV(e,r,t){var o=t;return x5(e,function(n,i,a,l){i===0&&t===void 0?o=n:o=r(o,n,i,a,l)}),o}function kV(e,r){if(r=r||{},!so.isObject(r))throw new Error("options is invalid");var t=r.featureIndex||0,o=r.multiFeatureIndex||0,n=r.geometryIndex||0,i=r.segmentIndex||0,a=r.properties,l;switch(e.type){case"FeatureCollection":t<0&&(t=e.features.length+t),a=a||e.features[t].properties,l=e.features[t].geometry;break;case"Feature":a=a||e.properties,l=e.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":l=e;break;default:throw new Error("geojson is invalid")}if(l===null)return null;var c=l.coordinates;switch(l.type){case"Point":case"MultiPoint":return null;case"LineString":return i<0&&(i=c.length+i-1),so.lineString([c[i],c[i+1]],a,r);case"Polygon":return n<0&&(n=c.length+n),i<0&&(i=c[n].length+i-1),so.lineString([c[n][i],c[n][i+1]],a,r);case"MultiLineString":return o<0&&(o=c.length+o),i<0&&(i=c[o].length+i-1),so.lineString([c[o][i],c[o][i+1]],a,r);case"MultiPolygon":return o<0&&(o=c.length+o),n<0&&(n=c[o].length+n),i<0&&(i=c[o][n].length-i-1),so.lineString([c[o][n][i],c[o][n][i+1]],a,r)}throw new Error("geojson is invalid")}function AV(e,r){if(r=r||{},!so.isObject(r))throw new Error("options is invalid");var t=r.featureIndex||0,o=r.multiFeatureIndex||0,n=r.geometryIndex||0,i=r.coordIndex||0,a=r.properties,l;switch(e.type){case"FeatureCollection":t<0&&(t=e.features.length+t),a=a||e.features[t].properties,l=e.features[t].geometry;break;case"Feature":a=a||e.properties,l=e.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":l=e;break;default:throw new Error("geojson is invalid")}if(l===null)return null;var c=l.coordinates;switch(l.type){case"Point":return so.point(c,a,r);case"MultiPoint":return o<0&&(o=c.length+o),so.point(c[o],a,r);case"LineString":return i<0&&(i=c.length+i),so.point(c[i],a,r);case"Polygon":return n<0&&(n=c.length+n),i<0&&(i=c[n].length+i),so.point(c[n][i],a,r);case"MultiLineString":return o<0&&(o=c.length+o),i<0&&(i=c[o].length+i),so.point(c[o][i],a,r);case"MultiPolygon":return o<0&&(o=c.length+o),n<0&&(n=c[o].length+n),i<0&&(i=c[o][n].length-i),so.point(c[o][n][i],a,r)}throw new Error("geojson is invalid")}br.coordAll=OV;br.coordEach=ff;br.coordReduce=CV;br.featureEach=y5;br.featureReduce=wV;br.findPoint=AV;br.findSegment=kV;br.flattenEach=s1;br.flattenReduce=PV;br.geomEach=SS;br.geomReduce=EV;br.lineEach=x5;br.lineReduce=DV;br.propEach=g5;br.propReduce=MV;br.segmentEach=b5;br.segmentReduce=FV});var v5=Cs(MS=>{"use strict";d();Object.defineProperty(MS,"__esModule",{value:!0});var LV=TS();function CS(e){var r=[1/0,1/0,-1/0,-1/0];return LV.coordEach(e,function(t){r[0]>t[0]&&(r[0]=t[0]),r[1]>t[1]&&(r[1]=t[1]),r[2]<t[0]&&(r[2]=t[0]),r[3]<t[1]&&(r[3]=t[1])}),r}CS.default=CS;MS.default=CS});var M5=Cs((oSe,wS)=>{d();var Ki=p5(),S5=IS(),T5=TS(),Md=v5().default,_V=T5.featureEach,tSe=T5.coordEach,rSe=S5.polygon,I5=S5.featureCollection;function C5(e){var r=new Ki(e);return r.insert=function(t){if(t.type!=="Feature")throw new Error("invalid feature");return t.bbox=t.bbox?t.bbox:Md(t),Ki.prototype.insert.call(this,t)},r.load=function(t){var o=[];return Array.isArray(t)?t.forEach(function(n){if(n.type!=="Feature")throw new Error("invalid features");n.bbox=n.bbox?n.bbox:Md(n),o.push(n)}):_V(t,function(n){if(n.type!=="Feature")throw new Error("invalid features");n.bbox=n.bbox?n.bbox:Md(n),o.push(n)}),Ki.prototype.load.call(this,o)},r.remove=function(t,o){if(t.type!=="Feature")throw new Error("invalid feature");return t.bbox=t.bbox?t.bbox:Md(t),Ki.prototype.remove.call(this,t,o)},r.clear=function(){return Ki.prototype.clear.call(this)},r.search=function(t){var o=Ki.prototype.search.call(this,this.toBBox(t));return I5(o)},r.collides=function(t){return Ki.prototype.collides.call(this,this.toBBox(t))},r.all=function(){var t=Ki.prototype.all.call(this);return I5(t)},r.toJSON=function(){return Ki.prototype.toJSON.call(this)},r.fromJSON=function(t){return Ki.prototype.fromJSON.call(this,t)},r.toBBox=function(t){var o;if(t.bbox)o=t.bbox;else if(Array.isArray(t)&&t.length===4)o=t;else if(Array.isArray(t)&&t.length===6)o=[t[0],t[1],t[3],t[4]];else if(t.type==="Feature")o=Md(t);else if(t.type==="FeatureCollection")o=Md(t);else throw new Error("invalid geojson");return{minX:o[0],minY:o[1],maxX:o[2],maxY:o[3]}},r}wS.exports=C5;wS.exports.default=C5});var Ak=Cs((qh,Uu)=>{d();var vz=200,uk="__lodash_hash_undefined__",Iz=800,Sz=16,mk=9007199254740991,fk="[object Arguments]",Tz="[object Array]",Cz="[object AsyncFunction]",Mz="[object Boolean]",wz="[object Date]",Oz="[object Error]",hk="[object Function]",Ez="[object GeneratorFunction]",Pz="[object Map]",Fz="[object Number]",Dz="[object Null]",gk="[object Object]",kz="[object Proxy]",Az="[object RegExp]",Lz="[object Set]",_z="[object String]",Rz="[object Undefined]",Bz="[object WeakMap]",Nz="[object ArrayBuffer]",jz="[object DataView]",Gz="[object Float32Array]",Uz="[object Float64Array]",Vz="[object Int8Array]",$z="[object Int16Array]",Hz="[object Int32Array]",zz="[object Uint8Array]",Wz="[object Uint8ClampedArray]",Zz="[object Uint16Array]",Xz="[object Uint32Array]",Yz=/[\\^$.*+?()[\]{}|]/g,Jz=/^\[object .+?Constructor\]$/,Kz=/^(?:0|[1-9]\d*)$/,Bt={};Bt[Gz]=Bt[Uz]=Bt[Vz]=Bt[$z]=Bt[Hz]=Bt[zz]=Bt[Wz]=Bt[Zz]=Bt[Xz]=!0;Bt[fk]=Bt[Tz]=Bt[Nz]=Bt[Mz]=Bt[jz]=Bt[wz]=Bt[Oz]=Bt[hk]=Bt[Pz]=Bt[Fz]=Bt[gk]=Bt[Az]=Bt[Lz]=Bt[_z]=Bt[Bz]=!1;var yk=typeof global=="object"&&global&&global.Object===Object&&global,Qz=typeof self=="object"&&self&&self.Object===Object&&self,rg=yk||Qz||Function("return this")(),bk=typeof qh=="object"&&qh&&!qh.nodeType&&qh,eg=bk&&typeof Uu=="object"&&Uu&&!Uu.nodeType&&Uu,xk=eg&&eg.exports===bk,pT=xk&&yk.process,ok=function(){try{var e=eg&&eg.require&&eg.require("util").types;return e||pT&&pT.binding&&pT.binding("util")}catch{}}(),nk=ok&&ok.isTypedArray;function vk(e,r,t){switch(t.length){case 0:return e.call(r);case 1:return e.call(r,t[0]);case 2:return e.call(r,t[0],t[1]);case 3:return e.call(r,t[0],t[1],t[2])}return e.apply(r,t)}function qz(e,r){for(var t=-1,o=Array(e);++t<e;)o[t]=r(t);return o}function eW(e){return function(r){return e(r)}}function tW(e,r){return e?.[r]}function rW(e,r){return function(t){return e(r(t))}}var oW=Array.prototype,nW=Function.prototype,Ux=Object.prototype,dT=rg["__core-js_shared__"],Vx=nW.toString,Ia=Ux.hasOwnProperty,ik=function(){var e=/[^.]+$/.exec(dT&&dT.keys&&dT.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),Ik=Ux.toString,iW=Vx.call(Object),sW=RegExp("^"+Vx.call(Ia).replace(Yz,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),jx=xk?rg.Buffer:void 0,sk=rg.Symbol,ak=rg.Uint8Array,lk=jx?jx.allocUnsafe:void 0,Sk=rW(Object.getPrototypeOf,Object),ck=Object.create,aW=Ux.propertyIsEnumerable,lW=oW.splice,Qc=sk?sk.toStringTag:void 0,Gx=function(){try{var e=bT(Object,"defineProperty");return e({},"",{}),e}catch{}}(),cW=jx?jx.isBuffer:void 0,pk=Math.max,pW=Date.now,Tk=bT(rg,"Map"),tg=bT(Object,"create"),dW=function(){function e(){}return function(r){if(!va(r))return{};if(ck)return ck(r);e.prototype=r;var t=new e;return e.prototype=void 0,t}}();function qc(e){var r=-1,t=e==null?0:e.length;for(this.clear();++r<t;){var o=e[r];this.set(o[0],o[1])}}function uW(){this.__data__=tg?tg(null):{},this.size=0}function mW(e){var r=this.has(e)&&delete this.__data__[e];return this.size-=r?1:0,r}function fW(e){var r=this.__data__;if(tg){var t=r[e];return t===uk?void 0:t}return Ia.call(r,e)?r[e]:void 0}function hW(e){var r=this.__data__;return tg?r[e]!==void 0:Ia.call(r,e)}function gW(e,r){var t=this.__data__;return this.size+=this.has(e)?0:1,t[e]=tg&&r===void 0?uk:r,this}qc.prototype.clear=uW;qc.prototype.delete=mW;qc.prototype.get=fW;qc.prototype.has=hW;qc.prototype.set=gW;function Sa(e){var r=-1,t=e==null?0:e.length;for(this.clear();++r<t;){var o=e[r];this.set(o[0],o[1])}}function yW(){this.__data__=[],this.size=0}function bW(e){var r=this.__data__,t=$x(r,e);if(t<0)return!1;var o=r.length-1;return t==o?r.pop():lW.call(r,t,1),--this.size,!0}function xW(e){var r=this.__data__,t=$x(r,e);return t<0?void 0:r[t][1]}function vW(e){return $x(this.__data__,e)>-1}function IW(e,r){var t=this.__data__,o=$x(t,e);return o<0?(++this.size,t.push([e,r])):t[o][1]=r,this}Sa.prototype.clear=yW;Sa.prototype.delete=bW;Sa.prototype.get=xW;Sa.prototype.has=vW;Sa.prototype.set=IW;function Vu(e){var r=-1,t=e==null?0:e.length;for(this.clear();++r<t;){var o=e[r];this.set(o[0],o[1])}}function SW(){this.size=0,this.__data__={hash:new qc,map:new(Tk||Sa),string:new qc}}function TW(e){var r=zx(this,e).delete(e);return this.size-=r?1:0,r}function CW(e){return zx(this,e).get(e)}function MW(e){return zx(this,e).has(e)}function wW(e,r){var t=zx(this,e),o=t.size;return t.set(e,r),this.size+=t.size==o?0:1,this}Vu.prototype.clear=SW;Vu.prototype.delete=TW;Vu.prototype.get=CW;Vu.prototype.has=MW;Vu.prototype.set=wW;function $u(e){var r=this.__data__=new Sa(e);this.size=r.size}function OW(){this.__data__=new Sa,this.size=0}function EW(e){var r=this.__data__,t=r.delete(e);return this.size=r.size,t}function PW(e){return this.__data__.get(e)}function FW(e){return this.__data__.has(e)}function DW(e,r){var t=this.__data__;if(t instanceof Sa){var o=t.__data__;if(!Tk||o.length<vz-1)return o.push([e,r]),this.size=++t.size,this;t=this.__data__=new Vu(o)}return t.set(e,r),this.size=t.size,this}$u.prototype.clear=OW;$u.prototype.delete=EW;$u.prototype.get=PW;$u.prototype.has=FW;$u.prototype.set=DW;function kW(e,r){var t=hT(e),o=!t&&fT(e),n=!t&&!o&&Ek(e),i=!t&&!o&&!n&&Fk(e),a=t||o||n||i,l=a?qz(e.length,String):[],c=l.length;for(var p in e)(r||Ia.call(e,p))&&!(a&&(p=="length"||n&&(p=="offset"||p=="parent")||i&&(p=="buffer"||p=="byteLength"||p=="byteOffset")||wk(p,c)))&&l.push(p);return l}function uT(e,r,t){(t!==void 0&&!Wx(e[r],t)||t===void 0&&!(r in e))&&gT(e,r,t)}function AW(e,r,t){var o=e[r];(!(Ia.call(e,r)&&Wx(o,t))||t===void 0&&!(r in e))&&gT(e,r,t)}function $x(e,r){for(var t=e.length;t--;)if(Wx(e[t][0],r))return t;return-1}function gT(e,r,t){r=="__proto__"&&Gx?Gx(e,r,{configurable:!0,enumerable:!0,value:t,writable:!0}):e[r]=t}var LW=WW();function Hx(e){return e==null?e===void 0?Rz:Dz:Qc&&Qc in Object(e)?ZW(e):qW(e)}function dk(e){return og(e)&&Hx(e)==fk}function _W(e){if(!va(e)||KW(e))return!1;var r=vT(e)?sW:Jz;return r.test(oZ(e))}function RW(e){return og(e)&&Pk(e.length)&&!!Bt[Hx(e)]}function BW(e){if(!va(e))return QW(e);var r=Ok(e),t=[];for(var o in e)o=="constructor"&&(r||!Ia.call(e,o))||t.push(o);return t}function yT(e,r,t,o,n){e!==r&&LW(r,function(i,a){if(n||(n=new $u),va(i))NW(e,r,a,t,yT,o,n);else{var l=o?o(mT(e,a),i,a+"",e,r,n):void 0;l===void 0&&(l=i),uT(e,a,l)}},Dk)}function NW(e,r,t,o,n,i,a){var l=mT(e,t),c=mT(r,t),p=a.get(c);if(p){uT(e,t,p);return}var u=i?i(l,c,t+"",e,r,a):void 0,f=u===void 0;if(f){var h=hT(c),b=!h&&Ek(c),x=!h&&!b&&Fk(c);u=c,h||b||x?hT(l)?u=l:nZ(l)?u=$W(l):b?(f=!1,u=GW(c,!0)):x?(f=!1,u=VW(c,!0)):u=[]:iZ(c)||fT(c)?(u=l,fT(l)?u=sZ(l):(!va(l)||vT(l))&&(u=XW(c))):f=!1}f&&(a.set(c,u),n(u,c,o,i,a),a.delete(c)),uT(e,t,u)}function Ck(e,r){return tZ(eZ(e,r,kk),e+"")}var jW=Gx?function(e,r){return Gx(e,"toString",{configurable:!0,enumerable:!1,value:cZ(r),writable:!0})}:kk;function GW(e,r){if(r)return e.slice();var t=e.length,o=lk?lk(t):new e.constructor(t);return e.copy(o),o}function UW(e){var r=new e.constructor(e.byteLength);return new ak(r).set(new ak(e)),r}function VW(e,r){var t=r?UW(e.buffer):e.buffer;return new e.constructor(t,e.byteOffset,e.length)}function $W(e,r){var t=-1,o=e.length;for(r||(r=Array(o));++t<o;)r[t]=e[t];return r}function HW(e,r,t,o){var n=!t;t||(t={});for(var i=-1,a=r.length;++i<a;){var l=r[i],c=o?o(t[l],e[l],l,t,e):void 0;c===void 0&&(c=e[l]),n?gT(t,l,c):AW(t,l,c)}return t}function zW(e){return Ck(function(r,t){var o=-1,n=t.length,i=n>1?t[n-1]:void 0,a=n>2?t[2]:void 0;for(i=e.length>3&&typeof i=="function"?(n--,i):void 0,a&&YW(t[0],t[1],a)&&(i=n<3?void 0:i,n=1),r=Object(r);++o<n;){var l=t[o];l&&e(r,l,o,i)}return r})}function WW(e){return function(r,t,o){for(var n=-1,i=Object(r),a=o(r),l=a.length;l--;){var c=a[e?l:++n];if(t(i[c],c,i)===!1)break}return r}}function Mk(e,r,t,o,n,i){return va(e)&&va(r)&&(i.set(r,e),yT(e,r,void 0,Mk,i),i.delete(r)),e}function zx(e,r){var t=e.__data__;return JW(r)?t[typeof r=="string"?"string":"hash"]:t.map}function bT(e,r){var t=tW(e,r);return _W(t)?t:void 0}function ZW(e){var r=Ia.call(e,Qc),t=e[Qc];try{e[Qc]=void 0;var o=!0}catch{}var n=Ik.call(e);return o&&(r?e[Qc]=t:delete e[Qc]),n}function XW(e){return typeof e.constructor=="function"&&!Ok(e)?dW(Sk(e)):{}}function wk(e,r){var t=typeof e;return r=r??mk,!!r&&(t=="number"||t!="symbol"&&Kz.test(e))&&e>-1&&e%1==0&&e<r}function YW(e,r,t){if(!va(t))return!1;var o=typeof r;return(o=="number"?xT(t)&&wk(r,t.length):o=="string"&&r in t)?Wx(t[r],e):!1}function JW(e){var r=typeof e;return r=="string"||r=="number"||r=="symbol"||r=="boolean"?e!=="__proto__":e===null}function KW(e){return!!ik&&ik in e}function Ok(e){var r=e&&e.constructor,t=typeof r=="function"&&r.prototype||Ux;return e===t}function QW(e){var r=[];if(e!=null)for(var t in Object(e))r.push(t);return r}function qW(e){return Ik.call(e)}function eZ(e,r,t){return r=pk(r===void 0?e.length-1:r,0),function(){for(var o=arguments,n=-1,i=pk(o.length-r,0),a=Array(i);++n<i;)a[n]=o[r+n];n=-1;for(var l=Array(r+1);++n<r;)l[n]=o[n];return l[r]=t(a),vk(e,this,l)}}function mT(e,r){if(!(r==="constructor"&&typeof e[r]=="function")&&r!="__proto__")return e[r]}var tZ=rZ(jW);function rZ(e){var r=0,t=0;return function(){var o=pW(),n=Sz-(o-t);if(t=o,n>0){if(++r>=Iz)return arguments[0]}else r=0;return e.apply(void 0,arguments)}}function oZ(e){if(e!=null){try{return Vx.call(e)}catch{}try{return e+""}catch{}}return""}function Wx(e,r){return e===r||e!==e&&r!==r}var fT=dk(function(){return arguments}())?dk:function(e){return og(e)&&Ia.call(e,"callee")&&!aW.call(e,"callee")},hT=Array.isArray;function xT(e){return e!=null&&Pk(e.length)&&!vT(e)}function nZ(e){return og(e)&&xT(e)}var Ek=cW||pZ;function vT(e){if(!va(e))return!1;var r=Hx(e);return r==hk||r==Ez||r==Cz||r==kz}function Pk(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=mk}function va(e){var r=typeof e;return e!=null&&(r=="object"||r=="function")}function og(e){return e!=null&&typeof e=="object"}function iZ(e){if(!og(e)||Hx(e)!=gk)return!1;var r=Sk(e);if(r===null)return!0;var t=Ia.call(r,"constructor")&&r.constructor;return typeof t=="function"&&t instanceof t&&Vx.call(t)==iW}var Fk=nk?eW(nk):RW;function sZ(e){return HW(e,Dk(e))}var aZ=Ck(function(e){return e.push(void 0,Mk),vk(lZ,void 0,e)});function Dk(e){return xT(e)?kW(e,!0):BW(e)}var lZ=zW(function(e,r,t,o){yT(e,r,t,o)});function cZ(e){return function(){return e}}function kk(e){return e}function pZ(){return!1}Uu.exports=aZ});var Hk=Cs((U9e,Zx)=>{d();(function(){"use strict";function e(a,l){var c=a.x-l.x,p=a.y-l.y;return c*c+p*p}function r(a,l,c){var p=l.x,u=l.y,f=c.x-p,h=c.y-u;if(f!==0||h!==0){var b=((a.x-p)*f+(a.y-u)*h)/(f*f+h*h);b>1?(p=c.x,u=c.y):b>0&&(p+=f*b,u+=h*b)}return f=a.x-p,h=a.y-u,f*f+h*h}function t(a,l){for(var c=a[0],p=[c],u,f=1,h=a.length;f<h;f++)u=a[f],e(u,c)>l&&(p.push(u),c=u);return c!==u&&p.push(u),p}function o(a,l,c,p,u){for(var f=p,h,b=l+1;b<c;b++){var x=r(a[b],a[l],a[c]);x>f&&(h=b,f=x)}f>p&&(h-l>1&&o(a,l,h,p,u),u.push(a[h]),c-h>1&&o(a,h,c,p,u))}function n(a,l){var c=a.length-1,p=[a[0]];return o(a,0,c,l,p),p.push(a[c]),p}function i(a,l,c){if(a.length<=2)return a;var p=l!==void 0?l*l:1;return a=c?a:t(a,p),a=n(a,p),a}typeof define=="function"&&define.amd?define(function(){return i}):typeof Zx<"u"?(Zx.exports=i,Zx.exports.default=i):typeof self<"u"?self.simplify=i:window.simplify=i})()});d();d();d();d();d();d();var xm=e=>e!=null;var T7=function(){let r=globalThis.fetch;return{fetch(...t){if(!xm(r))throw new Error("fetch is not available in your environment. Pass your own function into `setFetchFn` (node-fetch, etc)");return r?.(...t)},setFetch(t){r=t}}}(),NM=T7.fetch;var $M=["websdk","web","webv2","kiosk-v2","mobile","iossdk","androidsdk","reactnativesdk","gen7","bespoke","reactsdk"],jM=$M[0],HM="https://api-gateway.mappedin.com/track-analytics/a/",zM="deny-watchposition",WM="load-mapview",ZM="load-mapdata",XM="change-language",YM="query-directions";var Ri,pn,ks,H0,gy,Pp=class{constructor(){S(this,ks);S(this,Ri,Object.freeze({}));S(this,pn);m(this,"oneTimeEventsSent",new Set);m(this,"sendGetDirectionsEvent",I0((r,t,o)=>{let n={start:r,end:t,type:"location_to_location"};return o!==void 0&&(n.accessible=o),this.sendAnalyticEvent(YM,n)},2500));w(this,pn,W(this,ks,gy).call(this,s(this,Ri)))}init(r){this.reset(),this.updateStateWithOptions(r)}reset(){w(this,Ri,{}),w(this,pn,W(this,ks,gy).call(this,{})),this.oneTimeEventsSent.clear()}updateStateWithOptions(r){return w(this,Ri,Object.freeze(Object.assign({},s(this,Ri),r))),w(this,pn,W(this,ks,gy).call(this,r)),W(this,ks,H0).call(this,s(this,pn)),s(this,pn)}updateState(r){let t={...r};t.mapId&&(t.analyticsBaseUrl=$0({...s(this,pn),mapId:t.mapId})),t.context&&(t.context=VM(t.context)),t.baseUri&&(t.analyticsBaseUrl=$0({baseUri:t.baseUri,mapId:s(this,pn).mapId})),Object.assign(s(this,pn),t),this.handleStateUpdate(r),W(this,ks,H0).call(this,t)}handleStateUpdate(r){r.userPosition?.floorLevel?this.sendBlueDotEvents("found-floor"):r.userPosition&&this.sendBlueDotEvents("found-position")}get authReady(){let{key:r,secret:t,accessToken:o}=this.getState();return!!(r&&t)||!!o}getState(){return s(this,pn)}getContext(){return this.getState().context||s(this,Ri).context||jM}getSessionId(){return this.getState().sessionId||s(this,Ri).sessionId||UM()}getDeviceId(){return this.getState().deviceId||s(this,Ri).deviceId||GM()}sendAnalyticEvent(r,t={}){let o=this.getState(),n=C7(o.analyticsBaseUrl,r),i={"mi-context":this.getContext(),"mi-session":this.getSessionId(),"mi-device":this.getDeviceId()};if(o.logEvents&&A.log("Analytics.track",n,i),!o.sendEvents)return Promise.resolve();if(!this.authReady)return A.warn("Auth needs to be ready to send analytics.");let a={...t,g:o.geolocationMode,sdk_version:o.version};return o.userPosition&&Object.assign(a,o.userPosition),i["Content-Type"]="application/json",o.accessToken?i.Authorization=`Bearer ${o.accessToken}`:o.noAuth||o.secret&&o.key&&(i["x-mappedin-key"]=btoa(o.key),i["x-mappedin-secret"]=btoa(o.secret)),NM(n,{method:"POST",mode:"cors",headers:i,body:JSON.stringify(a)})}capture(r,t){if(w7.includes(r))return A.warn(`${r} event is sent internally.`),Promise.resolve();let o=M7.includes(r)?r.slice(1):r;return this.sendAnalyticEvent(o,t)}sendGetMapDataEvent(r){return this.sendAnalyticEvent(ZM,r)}sendChangeLanguageEvent(r){return this.sendAnalyticEvent(XM,r)}sendWatchPositionDenied(){return this.sendAnalyticEvent(zM)}sendMapViewLoadedEvent({firstRenderDuration:r,dimension:t,collisionWorkerDisabled:o,outdoorsWorkerDisabled:n}){return this.sendAnalyticEvent(WM,{type:"3d",firstRenderDuration:r,width:t.width,height:t.height,devicePixelRatio:globalThis.devicePixelRatio||1,collisionWorkerDisabled:o,outdoorsWorkerDisabled:n})}sendBlueDotEvents(r){if(!((r==="found-floor"||r==="found-position")&&this.oneTimeEventsSent.has(r)))return this.oneTimeEventsSent.add(r),this.sendAnalyticEvent(r)}};Ri=new WeakMap,pn=new WeakMap,ks=new WeakSet,H0=function(r){r.sessionId&&Es.getInstance().saveSessionData("id",r.sessionId),r.deviceId&&Es.getInstance().saveLocalData("deviceId",r.deviceId)},gy=function(r){let t=r.baseUri??HM;return{baseUri:t,analyticsBaseUrl:$0({...r,baseUri:t}),version:y?.env?.npm_package_version||"v6",deviceId:r.deviceId||GM(),accessToken:r.accessToken,mapId:r.mapId,sessionId:r.sessionId||UM(),platformString:r.platformString||"",context:VM(r.context)||jM,geolocationMode:!1,sendEvents:r.sendEvents??!0,logEvents:r.logEvents??!1,noAuth:r.noAuth||!1,key:r.key,secret:r.secret}};function $0({mapId:e,baseUri:r=HM}){return`${r}${e}/`}function GM(){return Es.getInstance().loadLocalData("deviceId")}function UM(){return Es.getInstance().loadSessionData("id")}function C7(e,r){return e+r}function VM(e){return $M.find(r=>r===e)}var M7=["$select-location","$select-category","$query-suggest","$query-search"],w7=[WM,ZM,YM,zM,XM],xX=new Pp,dn,vm=class{constructor(r){S(this,dn);m(this,"capture");m(this,"updateState");w(this,dn,r),this.capture=s(this,dn).capture.bind(s(this,dn)),this.updateState=s(this,dn).updateState.bind(s(this,dn))}getState(){let{sessionId:r,deviceId:t,...o}=s(this,dn).getState();return o}getContext(){return s(this,dn).getContext()}getSessionId(){return s(this,dn).getSessionId()}getDeviceId(){return s(this,dn).getDeviceId()}};dn=new WeakMap;d();d();var Sm,Tm,Cm,Im=class{constructor(r,t,{enabled:o=!1}={}){S(this,Sm);m(this,"searchInstance");S(this,Tm);S(this,Cm);m(this,"enabled",!1);w(this,Sm,r),w(this,Tm,t),w(this,Cm,()=>{this.searchInstance?.then(n=>n.populate())}),o&&this.enable()}async query(r,t={}){if(this.enabled||await this.enable(),!this.searchInstance)return A.error("Search should be enabled by now"),{places:[],enterpriseLocations:[],enterpriseCategories:[]};try{return await(await this.searchInstance).search(r,t)}catch(o){return A.error("Search.query failed due to",o),{places:[],enterpriseLocations:[],enterpriseCategories:[]}}}async suggest(r,t={}){if(this.enabled||await this.enable(),!this.searchInstance)return A.error("Search should be enabled by now"),[];try{return await(await this.searchInstance).suggest(r,t)}catch(o){return A.error("Search.suggest failed due to",o),[]}}async enable(){this.enabled||(this.enabled=!0,this.searchInstance||(this.searchInstance=import("./internal-MAULC22C.js").then(({InternalSearch:r})=>new r(s(this,Sm)))),s(this,Tm).on("language-change",s(this,Cm)),await this.searchInstance)}};Sm=new WeakMap,Tm=new WeakMap,Cm=new WeakMap;var JM=new WeakMap,Gl,At,z0=class{constructor(r,{search:t}={}){S(this,Gl);S(this,At);m(this,"Analytics");m(this,"Search");m(this,"Query");m(this,"internal");m(this,"on",(r,t)=>{s(this,Gl).on(r,t)});m(this,"off",(r,t)=>{s(this,Gl).off(r,t)});m(this,"__LEGACY_GET_DIRECTIONS_SYNC",(r,t,o)=>s(this,At).__LEGACY_GET_DIRECTIONS_SYNC(r,t,o));m(this,"getDirections",(r,t,o)=>s(this,At).getDirections(r,t,o));m(this,"__LEGACY_GET_DIRECTIONS_MULTI_DESTINATION_SYNC",(r,t,o)=>s(this,At).__LEGACY_GET_DIRECTIONS_MULTI_DESTINATION_SYNC(r,t,o));m(this,"getDirectionsMultiDestination",(r,t,o)=>s(this,At).getDirectionsMultiDestination(r,t,o));w(this,Gl,new ke),w(this,At,r),JM.set(this,r),this.Analytics=new vm(r.Analytics),this.Query=r.Query,this.internal=r,this.Search=new Im(this,r,{enabled:t?.enabled}),s(this,At).on("language-change",o=>{s(this,Gl).publish("language-change",o)})}getEnv(){return s(this,At).getEnv()}getAccessToken(){return s(this,At).tokenManager?.getAccessToken().token}get mapName(){return s(this,At).mapName}get mapId(){return s(this,At).getMapDataOptions?.mapId}get mapCenter(){return s(this,At).mapCenter}get organizationId(){return s(this,At).organizationId}get outdoorViewToken(){return s(this,At).outdoorViewToken}getByType(r){return s(this,At).getByType(r)}getById(r,t){return s(this,At).getById(r,t)}getByExternalId(r,t){return s(this,At).getByExternalId(r,t)}getGeoJSON(r){return r.geoJSON}async changeLanguage(r){return s(this,At).changeLanguage(r)}get currentLanguage(){return s(this,At).currentLanguage}get naturalBearing(){return s(this,At).naturalBearing??0}getDistance(r,t){return s(this,At).getDistance(r,t)}toBinaryBundle({downloadLanguagePacks:r=!0}={}){return s(this,At).toBinaryBundle({downloadLanguagePacks:r})}toJSONBundle({downloadLanguagePacks:r=!0}={}){return s(this,At).toJSONBundle({downloadLanguagePacks:r})}};Gl=new WeakMap,At=new WeakMap;var Mm=z0;function wm(e){let r=JM.get(e);if(!r)throw new Error("MapDataInternal not found");return r}d();d();d();d();d();d();d();d();d();d();d();d();d();d();d();d();d();d();d();d();d();d();d();d();d();d();d();d();var Ye={};La(Ye,{HasPropertyKey:()=>O7,IsArray:()=>qr,IsAsyncIterator:()=>W0,IsBigInt:()=>Om,IsBoolean:()=>Va,IsDate:()=>Ul,IsFunction:()=>Z0,IsIterator:()=>X0,IsNull:()=>Y0,IsNumber:()=>Wn,IsObject:()=>vt,IsRegExp:()=>Em,IsString:()=>Pt,IsSymbol:()=>J0,IsUint8Array:()=>As,IsUndefined:()=>zt});d();function O7(e,r){return r in e}function W0(e){return vt(e)&&!qr(e)&&!As(e)&&Symbol.asyncIterator in e}function qr(e){return Array.isArray(e)}function Om(e){return typeof e=="bigint"}function Va(e){return typeof e=="boolean"}function Ul(e){return e instanceof globalThis.Date}function Z0(e){return typeof e=="function"}function X0(e){return vt(e)&&!qr(e)&&!As(e)&&Symbol.iterator in e}function Y0(e){return e===null}function Wn(e){return typeof e=="number"}function vt(e){return typeof e=="object"&&e!==null}function Em(e){return e instanceof globalThis.RegExp}function Pt(e){return typeof e=="string"}function J0(e){return typeof e=="symbol"}function As(e){return e instanceof globalThis.Uint8Array}function zt(e){return e===void 0}function E7(e){return e.map(r=>yy(r))}function P7(e){return new Date(e.getTime())}function F7(e){return new Uint8Array(e)}function D7(e){return new RegExp(e.source,e.flags)}function k7(e){let r={};for(let t of Object.getOwnPropertyNames(e))r[t]=yy(e[t]);for(let t of Object.getOwnPropertySymbols(e))r[t]=yy(e[t]);return r}function yy(e){return qr(e)?E7(e):Ul(e)?P7(e):As(e)?F7(e):Em(e)?D7(e):vt(e)?k7(e):e}function Lt(e){return yy(e)}function KM(e){return e.map(r=>Pm(r))}function Pm(e,r){return r===void 0?Lt(e):Lt({...r,...e})}d();d();d();function by(e){return Ae(e)&&Symbol.asyncIterator in e}function xy(e){return Ae(e)&&Symbol.iterator in e}function K0(e){return Ae(e)&&(Object.getPrototypeOf(e)===Object.prototype||Object.getPrototypeOf(e)===null)}function vy(e){return e instanceof Promise}function uo(e){return e instanceof Date&&Number.isFinite(e.getTime())}function QM(e){return e instanceof globalThis.Map}function qM(e){return e instanceof globalThis.Set}function un(e){return ArrayBuffer.isView(e)}function Fp(e){return e instanceof globalThis.Uint8Array}function ve(e,r){return r in e}function Ae(e){return e!==null&&typeof e=="object"}function we(e){return Array.isArray(e)&&!ArrayBuffer.isView(e)}function Wt(e){return e===void 0}function Ls(e){return e===null}function Bi(e){return typeof e=="boolean"}function me(e){return typeof e=="number"}function Iy(e){return Number.isInteger(e)}function jr(e){return typeof e=="bigint"}function He(e){return typeof e=="string"}function $a(e){return typeof e=="function"}function _s(e){return typeof e=="symbol"}function Gr(e){return jr(e)||Bi(e)||Ls(e)||me(e)||He(e)||_s(e)||Wt(e)}var pt;(function(e){e.InstanceMode="default",e.ExactOptionalPropertyTypes=!1,e.AllowArrayObject=!1,e.AllowNaN=!1,e.AllowNullVoid=!1;function r(a,l){return e.ExactOptionalPropertyTypes?l in a:a[l]!==void 0}e.IsExactOptionalProperty=r;function t(a){let l=Ae(a);return e.AllowArrayObject?l:l&&!we(a)}e.IsObjectLike=t;function o(a){return t(a)&&!(a instanceof Date)&&!(a instanceof Uint8Array)}e.IsRecordLike=o;function n(a){return e.AllowNaN?me(a):Number.isFinite(a)}e.IsNumberLike=n;function i(a){let l=Wt(a);return e.AllowNullVoid?l||a===null:l}e.IsVoidLike=i})(pt||(pt={}));d();function A7(e){return globalThis.Object.freeze(e).map(r=>Fm(r))}function L7(e){let r={};for(let t of Object.getOwnPropertyNames(e))r[t]=Fm(e[t]);for(let t of Object.getOwnPropertySymbols(e))r[t]=Fm(e[t]);return globalThis.Object.freeze(r)}function Fm(e){return qr(e)?A7(e):Ul(e)?e:As(e)?e:Em(e)?e:vt(e)?L7(e):e}function Z(e,r){let t=r!==void 0?{...r,...e}:e;switch(pt.InstanceMode){case"freeze":return Fm(t);case"clone":return Lt(t);default:return t}}d();var be=class extends Error{constructor(r){super(r)}};d();d();d();var _t=Symbol.for("TypeBox.Transform"),Rs=Symbol.for("TypeBox.Readonly"),mo=Symbol.for("TypeBox.Optional"),mn=Symbol.for("TypeBox.Hint"),U=Symbol.for("TypeBox.Kind");function e3(e){return vt(e)&&e[Rs]==="Readonly"}function Ni(e){return vt(e)&&e[mo]==="Optional"}function Q0(e){return Je(e,"Any")}function Bs(e){return Je(e,"Array")}function Dm(e){return Je(e,"AsyncIterator")}function q0(e){return Je(e,"BigInt")}function ev(e){return Je(e,"Boolean")}function km(e){return Je(e,"Constructor")}function _7(e){return Je(e,"Date")}function Am(e){return Je(e,"Function")}function Vl(e){return Je(e,"Integer")}function or(e){return Je(e,"Intersect")}function Lm(e){return Je(e,"Iterator")}function Je(e,r){return vt(e)&&U in e&&e[U]===r}function Ns(e){return Je(e,"Literal")}function Wo(e){return Je(e,"MappedKey")}function Rt(e){return Je(e,"MappedResult")}function Ha(e){return Je(e,"Never")}function R7(e){return Je(e,"Not")}function B7(e){return Je(e,"Null")}function $l(e){return Je(e,"Number")}function gr(e){return Je(e,"Object")}function Hl(e){return Je(e,"Promise")}function tv(e){return Je(e,"Record")}function rv(e){return Je(e,"Ref")}function ov(e){return Je(e,"RegExp")}function _m(e){return Je(e,"String")}function N7(e){return Je(e,"Symbol")}function Zo(e){return Je(e,"TemplateLiteral")}function j7(e){return Je(e,"This")}function Dp(e){return vt(e)&&_t in e}function Zn(e){return Je(e,"Tuple")}function G7(e){return Je(e,"Undefined")}function it(e){return Je(e,"Union")}function U7(e){return Je(e,"Uint8Array")}function V7(e){return Je(e,"Unknown")}function $7(e){return Je(e,"Unsafe")}function H7(e){return Je(e,"Void")}function za(e){return vt(e)&&U in e&&Pt(e[U])}function Xn(e){return Q0(e)||Bs(e)||ev(e)||q0(e)||Dm(e)||km(e)||_7(e)||Am(e)||Vl(e)||or(e)||Lm(e)||Ns(e)||Wo(e)||Rt(e)||Ha(e)||R7(e)||B7(e)||$l(e)||gr(e)||Hl(e)||tv(e)||rv(e)||ov(e)||_m(e)||N7(e)||Zo(e)||j7(e)||Zn(e)||G7(e)||it(e)||U7(e)||V7(e)||$7(e)||H7(e)||za(e)}var D={};La(D,{IsAny:()=>n3,IsArray:()=>i3,IsAsyncIterator:()=>s3,IsBigInt:()=>a3,IsBoolean:()=>l3,IsConstructor:()=>c3,IsDate:()=>p3,IsFunction:()=>d3,IsInteger:()=>u3,IsIntersect:()=>m3,IsIterator:()=>f3,IsKind:()=>N3,IsKindOf:()=>We,IsLiteral:()=>Bm,IsLiteralBoolean:()=>K7,IsLiteralNumber:()=>g3,IsLiteralString:()=>h3,IsLiteralValue:()=>y3,IsMappedKey:()=>b3,IsMappedResult:()=>x3,IsNever:()=>v3,IsNot:()=>I3,IsNull:()=>S3,IsNumber:()=>T3,IsObject:()=>C3,IsOptional:()=>J7,IsPromise:()=>M3,IsProperties:()=>av,IsReadonly:()=>Y7,IsRecord:()=>w3,IsRecursive:()=>Q7,IsRef:()=>O3,IsRegExp:()=>E3,IsSchema:()=>ze,IsString:()=>P3,IsSymbol:()=>F3,IsTemplateLiteral:()=>D3,IsThis:()=>k3,IsTransform:()=>Ft,IsTuple:()=>A3,IsUint8Array:()=>L3,IsUndefined:()=>kp,IsUnion:()=>lv,IsUnionLiteral:()=>q7,IsUnknown:()=>_3,IsUnsafe:()=>R3,IsVoid:()=>B3,TypeGuardUnknownTypeError:()=>nv});d();var nv=class extends be{},W7=["Any","Array","AsyncIterator","BigInt","Boolean","Constructor","Date","Enum","Function","Integer","Intersect","Iterator","Literal","MappedKey","MappedResult","Not","Null","Number","Object","Promise","Record","Ref","RegExp","String","Symbol","TemplateLiteral","This","Tuple","Undefined","Union","Uint8Array","Unknown","Void"];function t3(e){try{return new RegExp(e),!0}catch{return!1}}function iv(e){if(!Pt(e))return!1;for(let r=0;r<e.length;r++){let t=e.charCodeAt(r);if(t>=7&&t<=13||t===27||t===127)return!1}return!0}function r3(e){return sv(e)||ze(e)}function Rm(e){return zt(e)||Om(e)}function wt(e){return zt(e)||Wn(e)}function sv(e){return zt(e)||Va(e)}function mt(e){return zt(e)||Pt(e)}function Z7(e){return zt(e)||Pt(e)&&iv(e)&&t3(e)}function X7(e){return zt(e)||Pt(e)&&iv(e)}function o3(e){return zt(e)||ze(e)}function Y7(e){return vt(e)&&e[Rs]==="Readonly"}function J7(e){return vt(e)&&e[mo]==="Optional"}function n3(e){return We(e,"Any")&&mt(e.$id)}function i3(e){return We(e,"Array")&&e.type==="array"&&mt(e.$id)&&ze(e.items)&&wt(e.minItems)&&wt(e.maxItems)&&sv(e.uniqueItems)&&o3(e.contains)&&wt(e.minContains)&&wt(e.maxContains)}function s3(e){return We(e,"AsyncIterator")&&e.type==="AsyncIterator"&&mt(e.$id)&&ze(e.items)}function a3(e){return We(e,"BigInt")&&e.type==="bigint"&&mt(e.$id)&&Rm(e.exclusiveMaximum)&&Rm(e.exclusiveMinimum)&&Rm(e.maximum)&&Rm(e.minimum)&&Rm(e.multipleOf)}function l3(e){return We(e,"Boolean")&&e.type==="boolean"&&mt(e.$id)}function c3(e){return We(e,"Constructor")&&e.type==="Constructor"&&mt(e.$id)&&qr(e.parameters)&&e.parameters.every(r=>ze(r))&&ze(e.returns)}function p3(e){return We(e,"Date")&&e.type==="Date"&&mt(e.$id)&&wt(e.exclusiveMaximumTimestamp)&&wt(e.exclusiveMinimumTimestamp)&&wt(e.maximumTimestamp)&&wt(e.minimumTimestamp)&&wt(e.multipleOfTimestamp)}function d3(e){return We(e,"Function")&&e.type==="Function"&&mt(e.$id)&&qr(e.parameters)&&e.parameters.every(r=>ze(r))&&ze(e.returns)}function u3(e){return We(e,"Integer")&&e.type==="integer"&&mt(e.$id)&&wt(e.exclusiveMaximum)&&wt(e.exclusiveMinimum)&&wt(e.maximum)&&wt(e.minimum)&&wt(e.multipleOf)}function av(e){return vt(e)&&Object.entries(e).every(([r,t])=>iv(r)&&ze(t))}function m3(e){return We(e,"Intersect")&&!(Pt(e.type)&&e.type!=="object")&&qr(e.allOf)&&e.allOf.every(r=>ze(r)&&!Ft(r))&&mt(e.type)&&(sv(e.unevaluatedProperties)||o3(e.unevaluatedProperties))&&mt(e.$id)}function f3(e){return We(e,"Iterator")&&e.type==="Iterator"&&mt(e.$id)&&ze(e.items)}function We(e,r){return vt(e)&&U in e&&e[U]===r}function h3(e){return Bm(e)&&Pt(e.const)}function g3(e){return Bm(e)&&Wn(e.const)}function K7(e){return Bm(e)&&Va(e.const)}function Bm(e){return We(e,"Literal")&&mt(e.$id)&&y3(e.const)}function y3(e){return Va(e)||Wn(e)||Pt(e)}function b3(e){return We(e,"MappedKey")&&qr(e.keys)&&e.keys.every(r=>Wn(r)||Pt(r))}function x3(e){return We(e,"MappedResult")&&av(e.properties)}function v3(e){return We(e,"Never")&&vt(e.not)&&Object.getOwnPropertyNames(e.not).length===0}function I3(e){return We(e,"Not")&&ze(e.not)}function S3(e){return We(e,"Null")&&e.type==="null"&&mt(e.$id)}function T3(e){return We(e,"Number")&&e.type==="number"&&mt(e.$id)&&wt(e.exclusiveMaximum)&&wt(e.exclusiveMinimum)&&wt(e.maximum)&&wt(e.minimum)&&wt(e.multipleOf)}function C3(e){return We(e,"Object")&&e.type==="object"&&mt(e.$id)&&av(e.properties)&&r3(e.additionalProperties)&&wt(e.minProperties)&&wt(e.maxProperties)}function M3(e){return We(e,"Promise")&&e.type==="Promise"&&mt(e.$id)&&ze(e.item)}function w3(e){return We(e,"Record")&&e.type==="object"&&mt(e.$id)&&r3(e.additionalProperties)&&vt(e.patternProperties)&&(r=>{let t=Object.getOwnPropertyNames(r.patternProperties);return t.length===1&&t3(t[0])&&vt(r.patternProperties)&&ze(r.patternProperties[t[0]])})(e)}function Q7(e){return vt(e)&&mn in e&&e[mn]==="Recursive"}function O3(e){return We(e,"Ref")&&mt(e.$id)&&Pt(e.$ref)}function E3(e){return We(e,"RegExp")&&mt(e.$id)&&Pt(e.source)&&Pt(e.flags)&&wt(e.maxLength)&&wt(e.minLength)}function P3(e){return We(e,"String")&&e.type==="string"&&mt(e.$id)&&wt(e.minLength)&&wt(e.maxLength)&&Z7(e.pattern)&&X7(e.format)}function F3(e){return We(e,"Symbol")&&e.type==="symbol"&&mt(e.$id)}function D3(e){return We(e,"TemplateLiteral")&&e.type==="string"&&Pt(e.pattern)&&e.pattern[0]==="^"&&e.pattern[e.pattern.length-1]==="$"}function k3(e){return We(e,"This")&&mt(e.$id)&&Pt(e.$ref)}function Ft(e){return vt(e)&&_t in e}function A3(e){return We(e,"Tuple")&&e.type==="array"&&mt(e.$id)&&Wn(e.minItems)&&Wn(e.maxItems)&&e.minItems===e.maxItems&&(zt(e.items)&&zt(e.additionalItems)&&e.minItems===0||qr(e.items)&&e.items.every(r=>ze(r)))}function kp(e){return We(e,"Undefined")&&e.type==="undefined"&&mt(e.$id)}function q7(e){return lv(e)&&e.anyOf.every(r=>h3(r)||g3(r))}function lv(e){return We(e,"Union")&&mt(e.$id)&&vt(e)&&qr(e.anyOf)&&e.anyOf.every(r=>ze(r))}function L3(e){return We(e,"Uint8Array")&&e.type==="Uint8Array"&&mt(e.$id)&&wt(e.minByteLength)&&wt(e.maxByteLength)}function _3(e){return We(e,"Unknown")&&mt(e.$id)}function R3(e){return We(e,"Unsafe")}function B3(e){return We(e,"Void")&&e.type==="void"&&mt(e.$id)}function N3(e){return vt(e)&&U in e&&Pt(e[U])&&!W7.includes(e[U])}function ze(e){return vt(e)&&(n3(e)||i3(e)||l3(e)||a3(e)||s3(e)||c3(e)||p3(e)||d3(e)||u3(e)||m3(e)||f3(e)||Bm(e)||b3(e)||x3(e)||v3(e)||I3(e)||S3(e)||T3(e)||C3(e)||M3(e)||w3(e)||O3(e)||E3(e)||P3(e)||F3(e)||D3(e)||k3(e)||A3(e)||kp(e)||lv(e)||L3(e)||_3(e)||R3(e)||B3(e)||N3(e))}d();var cv="(true|false)",Nm="(0|[1-9][0-9]*)",pv="(.*)",e6="(?!.*)",QY=`^${cv}$`,js=`^${Nm}$`,Gs=`^${pv}$`,j3=`^${e6}$`;d();var Fo={};La(Fo,{Clear:()=>r6,Delete:()=>o6,Entries:()=>t6,Get:()=>s6,Has:()=>n6,Set:()=>i6});d();var Ap=new Map;function t6(){return new Map(Ap)}function r6(){return Ap.clear()}function o6(e){return Ap.delete(e)}function n6(e){return Ap.has(e)}function i6(e,r){Ap.set(e,r)}function s6(e){return Ap.get(e)}var Or={};La(Or,{Clear:()=>l6,Delete:()=>c6,Entries:()=>a6,Get:()=>u6,Has:()=>p6,Set:()=>d6});d();var Lp=new Map;function a6(){return new Map(Lp)}function l6(){return Lp.clear()}function c6(e){return Lp.delete(e)}function p6(e){return Lp.has(e)}function d6(e,r){Lp.set(e,r)}function u6(e){return Lp.get(e)}d();function G3(e,r){return e.includes(r)}function U3(e){return[...new Set(e)]}function m6(e,r){return e.filter(t=>r.includes(t))}function f6(e,r){return e.reduce((t,o)=>m6(t,o),r)}function V3(e){return e.length===1?e[0]:e.length>1?f6(e.slice(1),e[0]):[]}function $3(e){let r=[];for(let t of e)r.push(...t);return r}d();function Wa(e){return Z({[U]:"Any"},e)}d();function Sy(e,r){return Z({[U]:"Array",type:"array",items:e},r)}d();function Ty(e,r){return Z({[U]:"AsyncIterator",type:"AsyncIterator",items:e},r)}d();d();d();function h6(e,r){let{[r]:t,...o}=e;return o}function Qt(e,r){return r.reduce((t,o)=>h6(t,o),e)}d();function ft(e){return Z({[U]:"Never",not:{}},e)}d();d();function Ke(e){return Z({[U]:"MappedResult",properties:e})}d();d();function Cy(e,r,t){return Z({[U]:"Constructor",type:"Constructor",parameters:e,returns:r},t)}d();function Za(e,r,t){return Z({[U]:"Function",type:"Function",parameters:e,returns:r},t)}d();d();d();d();function jm(e,r){return Z({[U]:"Union",anyOf:e},r)}function g6(e){return e.some(r=>Ni(r))}function H3(e){return e.map(r=>Ni(r)?y6(r):r)}function y6(e){return Qt(e,[mo])}function b6(e,r){return g6(e)?Do(jm(H3(e),r)):jm(H3(e),r)}function ji(e,r){return e.length===0?ft(r):e.length===1?Z(e[0],r):b6(e,r)}d();function ht(e,r){return e.length===0?ft(r):e.length===1?Z(e[0],r):jm(e,r)}d();d();d();var My=class extends be{};function x6(e){return e.replace(/\\\$/g,"$").replace(/\\\*/g,"*").replace(/\\\^/g,"^").replace(/\\\|/g,"|").replace(/\\\(/g,"(").replace(/\\\)/g,")")}function dv(e,r,t){return e[r]===t&&e.charCodeAt(r-1)!==92}function Us(e,r){return dv(e,r,"(")}function Gm(e,r){return dv(e,r,")")}function z3(e,r){return dv(e,r,"|")}function v6(e){if(!(Us(e,0)&&Gm(e,e.length-1)))return!1;let r=0;for(let t=0;t<e.length;t++)if(Us(e,t)&&(r+=1),Gm(e,t)&&(r-=1),r===0&&t!==e.length-1)return!1;return!0}function I6(e){return e.slice(1,e.length-1)}function S6(e){let r=0;for(let t=0;t<e.length;t++)if(Us(e,t)&&(r+=1),Gm(e,t)&&(r-=1),z3(e,t)&&r===0)return!0;return!1}function T6(e){for(let r=0;r<e.length;r++)if(Us(e,r))return!0;return!1}function C6(e){let[r,t]=[0,0],o=[];for(let i=0;i<e.length;i++)if(Us(e,i)&&(r+=1),Gm(e,i)&&(r-=1),z3(e,i)&&r===0){let a=e.slice(t,i);a.length>0&&o.push(_p(a)),t=i+1}let n=e.slice(t);return n.length>0&&o.push(_p(n)),o.length===0?{type:"const",const:""}:o.length===1?o[0]:{type:"or",expr:o}}function M6(e){function r(n,i){if(!Us(n,i))throw new My("TemplateLiteralParser: Index must point to open parens");let a=0;for(let l=i;l<n.length;l++)if(Us(n,l)&&(a+=1),Gm(n,l)&&(a-=1),a===0)return[i,l];throw new My("TemplateLiteralParser: Unclosed group parens in expression")}function t(n,i){for(let a=i;a<n.length;a++)if(Us(n,a))return[i,a];return[i,n.length]}let o=[];for(let n=0;n<e.length;n++)if(Us(e,n)){let[i,a]=r(e,n),l=e.slice(i,a+1);o.push(_p(l)),n=a}else{let[i,a]=t(e,n),l=e.slice(i,a);l.length>0&&o.push(_p(l)),n=a-1}return o.length===0?{type:"const",const:""}:o.length===1?o[0]:{type:"and",expr:o}}function _p(e){return v6(e)?_p(I6(e)):S6(e)?C6(e):T6(e)?M6(e):{type:"const",const:x6(e)}}function Rp(e){return _p(e.slice(1,e.length-1))}var uv=class extends be{};function w6(e){return e.type==="or"&&e.expr.length===2&&e.expr[0].type==="const"&&e.expr[0].const==="0"&&e.expr[1].type==="const"&&e.expr[1].const==="[1-9][0-9]*"}function O6(e){return e.type==="or"&&e.expr.length===2&&e.expr[0].type==="const"&&e.expr[0].const==="true"&&e.expr[1].type==="const"&&e.expr[1].const==="false"}function E6(e){return e.type==="const"&&e.const===".*"}function zl(e){return w6(e)||E6(e)?!1:O6(e)?!0:e.type==="and"?e.expr.every(r=>zl(r)):e.type==="or"?e.expr.every(r=>zl(r)):e.type==="const"?!0:(()=>{throw new uv("Unknown expression type")})()}function wy(e){let r=Rp(e.pattern);return zl(r)}d();var mv=class extends be{};function*W3(e){if(e.length===1)return yield*e[0];for(let r of e[0])for(let t of W3(e.slice(1)))yield`${r}${t}`}function*P6(e){return yield*W3(e.expr.map(r=>[...Um(r)]))}function*F6(e){for(let r of e.expr)yield*Um(r)}function*D6(e){return yield e.const}function*Um(e){return e.type==="and"?yield*P6(e):e.type==="or"?yield*F6(e):e.type==="const"?yield*D6(e):(()=>{throw new mv("Unknown expression")})()}function Bp(e){let r=Rp(e.pattern);return zl(r)?[...Um(r)]:[]}d();d();function at(e,r){return Z({[U]:"Literal",const:e,type:typeof e},r)}d();function Oy(e){return Z({[U]:"Boolean",type:"boolean"},e)}d();function Np(e){return Z({[U]:"BigInt",type:"bigint"},e)}d();function Gi(e){return Z({[U]:"Number",type:"number"},e)}d();function fn(e){return Z({[U]:"String",type:"string"},e)}function*k6(e){let r=e.trim().replace(/"|'/g,"");return r==="boolean"?yield Oy():r==="number"?yield Gi():r==="bigint"?yield Np():r==="string"?yield fn():yield(()=>{let t=r.split("|").map(o=>at(o.trim()));return t.length===0?ft():t.length===1?t[0]:ji(t)})()}function*A6(e){if(e[1]!=="{"){let r=at("$"),t=fv(e.slice(1));return yield*[r,...t]}for(let r=2;r<e.length;r++)if(e[r]==="}"){let t=k6(e.slice(2,r)),o=fv(e.slice(r+1));return yield*[...t,...o]}yield at(e)}function*fv(e){for(let r=0;r<e.length;r++)if(e[r]==="$"){let t=at(e.slice(0,r)),o=A6(e.slice(r));return yield*[t,...o]}yield at(e)}function Z3(e){return[...fv(e)]}d();var hv=class extends be{};function L6(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function X3(e,r){return Zo(e)?e.pattern.slice(1,e.pattern.length-1):it(e)?`(${e.anyOf.map(t=>X3(t,r)).join("|")})`:$l(e)?`${r}${Nm}`:Vl(e)?`${r}${Nm}`:q0(e)?`${r}${Nm}`:_m(e)?`${r}${pv}`:Ns(e)?`${r}${L6(e.const.toString())}`:ev(e)?`${r}${cv}`:(()=>{throw new hv(`Unexpected Kind '${e[U]}'`)})()}function gv(e){return`^${e.map(r=>X3(r,"")).join("")}$`}d();function Wl(e){let t=Bp(e).map(o=>at(o));return ji(t)}d();function Ey(e,r){let t=Pt(e)?gv(Z3(e)):gv(e);return Z({[U]:"TemplateLiteral",type:"string",pattern:t},r)}function _6(e){return Bp(e).map(t=>t.toString())}function R6(e){let r=[];for(let t of e)r.push(...ko(t));return r}function B6(e){return[e.toString()]}function ko(e){return[...new Set(Zo(e)?_6(e):it(e)?R6(e.anyOf):Ns(e)?B6(e.const):$l(e)?["[number]"]:Vl(e)?["[number]"]:[])]}d();function N6(e,r,t){let o={};for(let n of Object.getOwnPropertyNames(r))o[n]=jp(e,ko(r[n]),t);return o}function j6(e,r,t){return N6(e,r.properties,t)}function Y3(e,r,t){let o=j6(e,r,t);return Ke(o)}function K3(e,r){return e.map(t=>Q3(t,r))}function G6(e){return e.filter(r=>!Ha(r))}function U6(e,r){return Py(G6(K3(e,r)))}function V6(e){return e.some(r=>Ha(r))?[]:e}function $6(e,r){return ji(V6(K3(e,r)))}function H6(e,r){return r in e?e[r]:r==="[number]"?ji(e):ft()}function z6(e,r){return r==="[number]"?e:ft()}function W6(e,r){return r in e?e[r]:ft()}function Q3(e,r){return or(e)?U6(e.allOf,r):it(e)?$6(e.anyOf,r):Zn(e)?H6(e.items??[],r):Bs(e)?z6(e.items,r):gr(e)?W6(e.properties,r):ft()}function Vm(e,r){return r.map(t=>Q3(e,t))}function J3(e,r){return ji(Vm(e,r))}function jp(e,r,t){return Rt(r)?Y3(e,r,t):Wo(r)?q3(e,r,t):Z(Xn(r)?J3(e,ko(r)):J3(e,r),t)}function Z6(e,r,t){return{[r]:jp(e,[r],Lt(t))}}function X6(e,r,t){return r.reduce((o,n)=>({...o,...Z6(e,n,t)}),{})}function Y6(e,r,t){return X6(e,r.keys,t)}function q3(e,r,t){let o=Y6(e,r,t);return Ke(o)}d();function Fy(e,r){return Z({[U]:"Iterator",type:"Iterator",items:e},r)}d();function J6(e){let r=[];for(let t in e)Ni(e[t])||r.push(t);return r}function K6(e,r){let t=J6(e),o=t.length>0?{[U]:"Object",type:"object",properties:e,required:t}:{[U]:"Object",type:"object",properties:e};return Z(o,r)}var It=K6;d();function Dy(e,r){return Z({[U]:"Promise",type:"Promise",item:e},r)}d();d();function Q6(e){return Z(Qt(e,[Rs]))}function q6(e){return Z({...e,[Rs]:"Readonly"})}function eL(e,r){return r===!1?Q6(e):q6(e)}function hn(e,r){let t=r??!0;return Rt(e)?ew(e,t):eL(e,t)}function tL(e,r){let t={};for(let o of globalThis.Object.getOwnPropertyNames(e))t[o]=hn(e[o],r);return t}function rL(e,r){return tL(e.properties,r)}function ew(e,r){let t=rL(e,r);return Ke(t)}d();function Ui(e,r){return Z(e.length>0?{[U]:"Tuple",type:"array",items:e,additionalItems:!1,minItems:e.length,maxItems:e.length}:{[U]:"Tuple",type:"array",minItems:e.length,maxItems:e.length},r)}function tw(e,r){return e in r?gn(e,r[e]):Ke(r)}function oL(e){return{[e]:at(e)}}function nL(e){let r={};for(let t of e)r[t]=at(t);return r}function iL(e,r){return G3(r,e)?oL(e):nL(r)}function sL(e,r){let t=iL(e,r);return tw(e,t)}function $m(e,r){return r.map(t=>gn(e,t))}function aL(e,r){let t={};for(let o of globalThis.Object.getOwnPropertyNames(r))t[o]=gn(e,r[o]);return t}function gn(e,r){let t={...r};return Ni(r)?Do(gn(e,Qt(r,[mo]))):e3(r)?hn(gn(e,Qt(r,[Rs]))):Rt(r)?tw(e,r.properties):Wo(r)?sL(e,r.keys):km(r)?Cy($m(e,r.parameters),gn(e,r.returns),t):Am(r)?Za($m(e,r.parameters),gn(e,r.returns),t):Dm(r)?Ty(gn(e,r.items),t):Lm(r)?Fy(gn(e,r.items),t):or(r)?Ao($m(e,r.allOf),t):it(r)?ht($m(e,r.anyOf),t):Zn(r)?Ui($m(e,r.items??[]),t):gr(r)?It(aL(e,r.properties),t):Bs(r)?Sy(gn(e,r.items),t):Hl(r)?Dy(gn(e,r.item),t):r}function lL(e,r){let t={};for(let o of e)t[o]=gn(o,r);return t}function rw(e,r,t){let o=Xn(e)?ko(e):e,n=r({[U]:"MappedKey",keys:o}),i=lL(o,n);return It(i,t)}d();function cL(e){return Z(Qt(e,[mo]))}function pL(e){return Z({...e,[mo]:"Optional"})}function dL(e,r){return r===!1?cL(e):pL(e)}function Do(e,r){let t=r??!0;return Rt(e)?ow(e,t):dL(e,t)}function uL(e,r){let t={};for(let o of globalThis.Object.getOwnPropertyNames(e))t[o]=Do(e[o],r);return t}function mL(e,r){return uL(e.properties,r)}function ow(e,r){let t=mL(e,r);return Ke(t)}d();function Hm(e,r={}){let t=e.every(n=>gr(n)),o=Xn(r.unevaluatedProperties)?{unevaluatedProperties:r.unevaluatedProperties}:{};return Z(r.unevaluatedProperties===!1||Xn(r.unevaluatedProperties)||t?{...o,[U]:"Intersect",type:"object",allOf:e}:{...o,[U]:"Intersect",allOf:e},r)}function fL(e){return e.every(r=>Ni(r))}function hL(e){return Qt(e,[mo])}function nw(e){return e.map(r=>Ni(r)?hL(r):r)}function gL(e,r){return fL(e)?Do(Hm(nw(e),r)):Hm(nw(e),r)}function Py(e,r={}){if(e.length===0)return ft(r);if(e.length===1)return Z(e[0],r);if(e.some(t=>Dp(t)))throw new Error("Cannot intersect transform types");return gL(e,r)}d();function Ao(e,r){if(e.length===0)return ft(r);if(e.length===1)return Z(e[0],r);if(e.some(t=>Dp(t)))throw new Error("Cannot intersect transform types");return Hm(e,r)}function iw(e){return e.map(r=>yv(r))}function yL(e){return Ao(iw(e))}function bL(e){return ht(iw(e))}function xL(e){return yv(e)}function yv(e){return or(e)?yL(e.allOf):it(e)?bL(e.anyOf):Hl(e)?xL(e.item):e}function sw(e,r){return Z(yv(e),r)}d();d();d();d();function aw(e){let r=[];for(let t of e)r.push(Er(t));return r}function vL(e){let r=aw(e);return $3(r)}function IL(e){let r=aw(e);return V3(r)}function SL(e){return e.map((r,t)=>t.toString())}function TL(e){return["[number]"]}function CL(e){return globalThis.Object.getOwnPropertyNames(e)}function ML(e){return bv?globalThis.Object.getOwnPropertyNames(e).map(t=>t[0]==="^"&&t[t.length-1]==="$"?t.slice(1,t.length-1):t):[]}function Er(e){return or(e)?vL(e.allOf):it(e)?IL(e.anyOf):Zn(e)?SL(e.items??[]):Bs(e)?TL(e.items):gr(e)?CL(e.properties):tv(e)?ML(e.patternProperties):[]}var bv=!1;function Vs(e){bv=!0;let r=Er(e);return bv=!1,`^(${r.map(o=>`(${o})`).join("|")})$`}function wL(e){return e.map(r=>r==="[number]"?Gi():at(r))}function ky(e,r){if(Rt(e))return lw(e,r);{let t=Er(e),o=wL(t),n=ji(o);return Z(n,r)}}function OL(e,r){let t={};for(let o of globalThis.Object.getOwnPropertyNames(e))t[o]=ky(e[o],Lt(r));return t}function EL(e,r){return OL(e.properties,r)}function lw(e,r){let t=EL(e,r);return Ke(t)}d();function Xa(e){let r=Er(e),t=Vm(e,r);return r.map((o,n)=>[r[n],t[n]])}function PL(e){let r=[];for(let t of e)r.push(...Er(t));return U3(r)}function FL(e){return e.filter(r=>!Ha(r))}function DL(e,r){let t=[];for(let o of e)t.push(...Vm(o,[r]));return FL(t)}function kL(e,r){let t={};for(let o of r)t[o]=Py(DL(e,o));return t}function cw(e,r){let t=PL(e),o=kL(e,t);return It(o,r)}d();d();function Ay(e){return Z({[U]:"Date",type:"Date"},e)}d();function Ly(e){return Z({[U]:"Null",type:"null"},e)}d();function _y(e){return Z({[U]:"Symbol",type:"symbol"},e)}d();function Ry(e){return Z({[U]:"Undefined",type:"undefined"},e)}d();function By(e){return Z({[U]:"Uint8Array",type:"Uint8Array"},e)}d();function $s(e){return Z({[U]:"Unknown"},e)}function AL(e){return e.map(r=>xv(r,!1))}function LL(e){let r={};for(let t of globalThis.Object.getOwnPropertyNames(e))r[t]=hn(xv(e[t],!1));return r}function Ny(e,r){return r===!0?e:hn(e)}function xv(e,r){return W0(e)?Ny(Wa(),r):X0(e)?Ny(Wa(),r):qr(e)?hn(Ui(AL(e))):As(e)?By():Ul(e)?Ay():vt(e)?Ny(It(LL(e)),r):Z0(e)?Ny(Za([],$s()),r):zt(e)?Ry():Y0(e)?Ly():J0(e)?_y():Om(e)?Np():Wn(e)?at(e):Va(e)?at(e):Pt(e)?at(e):It({})}function pw(e,r){return Z(xv(e,!0),r)}d();function dw(e,r){return Ui(e.parameters,r)}d();function zm(e,r){return e.map(t=>Yn(t,r))}function _L(e,r){let t={};for(let o of globalThis.Object.getOwnPropertyNames(e))t[o]=Yn(e[o],r);return t}function RL(e,r){return e.parameters=zm(e.parameters,r),e.returns=Yn(e.returns,r),e}function BL(e,r){return e.parameters=zm(e.parameters,r),e.returns=Yn(e.returns,r),e}function NL(e,r){return e.allOf=zm(e.allOf,r),e}function jL(e,r){return e.anyOf=zm(e.anyOf,r),e}function GL(e,r){return zt(e.items)||(e.items=zm(e.items,r)),e}function UL(e,r){return e.items=Yn(e.items,r),e}function VL(e,r){return e.properties=_L(e.properties,r),e}function $L(e,r){return e.item=Yn(e.item,r),e}function HL(e,r){return e.items=Yn(e.items,r),e}function zL(e,r){return e.items=Yn(e.items,r),e}function WL(e,r){let t=r.find(n=>n.$id===e.$ref);if(t===void 0)throw Error(`Unable to dereference schema with $id ${e.$ref}`);let o=Qt(t,["$id"]);return Yn(o,r)}function ZL(e,r){return km(e)?RL(e,r):Am(e)?BL(e,r):or(e)?NL(e,r):it(e)?jL(e,r):Zn(e)?GL(e,r):Bs(e)?UL(e,r):gr(e)?VL(e,r):Hl(e)?$L(e,r):Dm(e)?HL(e,r):Lm(e)?zL(e,r):rv(e)?WL(e,r):e}function Yn(e,r){return ZL(Pm(e),KM(r))}d();function uw(e,r){if(zt(e))throw new Error("Enum undefined or empty");let t=globalThis.Object.getOwnPropertyNames(e).filter(i=>isNaN(i)).map(i=>e[i]),n=[...new Set(t)].map(i=>at(i));return ht(n,{...r,[mn]:"Enum"})}d();d();d();var Iv=class extends be{},$;(function(e){e[e.Union=0]="Union",e[e.True=1]="True",e[e.False=2]="False"})($||($={}));function yn(e){return e===$.False?e:$.True}function Gp(e){throw new Iv(e)}function lr(e){return D.IsNever(e)||D.IsIntersect(e)||D.IsUnion(e)||D.IsUnknown(e)||D.IsAny(e)}function cr(e,r){return D.IsNever(r)?xw(e,r):D.IsIntersect(r)?jy(e,r):D.IsUnion(r)?Mv(e,r):D.IsUnknown(r)?Tw(e,r):D.IsAny(r)?Cv(e,r):Gp("StructuralRight")}function Cv(e,r){return $.True}function XL(e,r){return D.IsIntersect(r)?jy(e,r):D.IsUnion(r)&&r.anyOf.some(t=>D.IsAny(t)||D.IsUnknown(t))?$.True:D.IsUnion(r)?$.Union:D.IsUnknown(r)||D.IsAny(r)?$.True:$.Union}function YL(e,r){return D.IsUnknown(e)?$.False:D.IsAny(e)?$.Union:D.IsNever(e)?$.True:$.False}function JL(e,r){return D.IsObject(r)&&Gy(r)?$.True:lr(r)?cr(e,r):D.IsArray(r)?yn(gt(e.items,r.items)):$.False}function KL(e,r){return lr(r)?cr(e,r):D.IsAsyncIterator(r)?yn(gt(e.items,r.items)):$.False}function QL(e,r){return lr(r)?cr(e,r):D.IsObject(r)?eo(e,r):D.IsRecord(r)?bn(e,r):D.IsBigInt(r)?$.True:$.False}function yw(e,r){return D.IsLiteralBoolean(e)||D.IsBoolean(e)?$.True:$.False}function qL(e,r){return lr(r)?cr(e,r):D.IsObject(r)?eo(e,r):D.IsRecord(r)?bn(e,r):D.IsBoolean(r)?$.True:$.False}function e9(e,r){return lr(r)?cr(e,r):D.IsObject(r)?eo(e,r):D.IsConstructor(r)?e.parameters.length>r.parameters.length?$.False:e.parameters.every((t,o)=>yn(gt(r.parameters[o],t))===$.True)?yn(gt(e.returns,r.returns)):$.False:$.False}function t9(e,r){return lr(r)?cr(e,r):D.IsObject(r)?eo(e,r):D.IsRecord(r)?bn(e,r):D.IsDate(r)?$.True:$.False}function r9(e,r){return lr(r)?cr(e,r):D.IsObject(r)?eo(e,r):D.IsFunction(r)?e.parameters.length>r.parameters.length?$.False:e.parameters.every((t,o)=>yn(gt(r.parameters[o],t))===$.True)?yn(gt(e.returns,r.returns)):$.False:$.False}function bw(e,r){return D.IsLiteral(e)&&Ye.IsNumber(e.const)||D.IsNumber(e)||D.IsInteger(e)?$.True:$.False}function o9(e,r){return D.IsInteger(r)||D.IsNumber(r)?$.True:lr(r)?cr(e,r):D.IsObject(r)?eo(e,r):D.IsRecord(r)?bn(e,r):$.False}function jy(e,r){return r.allOf.every(t=>gt(e,t)===$.True)?$.True:$.False}function n9(e,r){return e.allOf.some(t=>gt(t,r)===$.True)?$.True:$.False}function i9(e,r){return lr(r)?cr(e,r):D.IsIterator(r)?yn(gt(e.items,r.items)):$.False}function s9(e,r){return D.IsLiteral(r)&&r.const===e.const?$.True:lr(r)?cr(e,r):D.IsObject(r)?eo(e,r):D.IsRecord(r)?bn(e,r):D.IsString(r)?Sw(e,r):D.IsNumber(r)?vw(e,r):D.IsInteger(r)?bw(e,r):D.IsBoolean(r)?yw(e,r):$.False}function xw(e,r){return $.False}function a9(e,r){return $.True}function mw(e){let[r,t]=[e,0];for(;D.IsNot(r);)r=r.not,t+=1;return t%2===0?r:$s()}function l9(e,r){return D.IsNot(e)?gt(mw(e),r):D.IsNot(r)?gt(e,mw(r)):Gp("Invalid fallthrough for Not")}function c9(e,r){return lr(r)?cr(e,r):D.IsObject(r)?eo(e,r):D.IsRecord(r)?bn(e,r):D.IsNull(r)?$.True:$.False}function vw(e,r){return D.IsLiteralNumber(e)||D.IsNumber(e)||D.IsInteger(e)?$.True:$.False}function p9(e,r){return lr(r)?cr(e,r):D.IsObject(r)?eo(e,r):D.IsRecord(r)?bn(e,r):D.IsInteger(r)||D.IsNumber(r)?$.True:$.False}function Lo(e,r){return Object.getOwnPropertyNames(e.properties).length===r}function fw(e){return Gy(e)}function hw(e){return Lo(e,0)||Lo(e,1)&&"description"in e.properties&&D.IsUnion(e.properties.description)&&e.properties.description.anyOf.length===2&&(D.IsString(e.properties.description.anyOf[0])&&D.IsUndefined(e.properties.description.anyOf[1])||D.IsString(e.properties.description.anyOf[1])&&D.IsUndefined(e.properties.description.anyOf[0]))}function vv(e){return Lo(e,0)}function gw(e){return Lo(e,0)}function d9(e){return Lo(e,0)}function u9(e){return Lo(e,0)}function m9(e){return Gy(e)}function f9(e){let r=Gi();return Lo(e,0)||Lo(e,1)&&"length"in e.properties&&yn(gt(e.properties.length,r))===$.True}function h9(e){return Lo(e,0)}function Gy(e){let r=Gi();return Lo(e,0)||Lo(e,1)&&"length"in e.properties&&yn(gt(e.properties.length,r))===$.True}function g9(e){let r=Za([Wa()],Wa());return Lo(e,0)||Lo(e,1)&&"then"in e.properties&&yn(gt(e.properties.then,r))===$.True}function Iw(e,r){return gt(e,r)===$.False||D.IsOptional(e)&&!D.IsOptional(r)?$.False:$.True}function eo(e,r){return D.IsUnknown(e)?$.False:D.IsAny(e)?$.Union:D.IsNever(e)||D.IsLiteralString(e)&&fw(r)||D.IsLiteralNumber(e)&&vv(r)||D.IsLiteralBoolean(e)&&gw(r)||D.IsSymbol(e)&&hw(r)||D.IsBigInt(e)&&d9(r)||D.IsString(e)&&fw(r)||D.IsSymbol(e)&&hw(r)||D.IsNumber(e)&&vv(r)||D.IsInteger(e)&&vv(r)||D.IsBoolean(e)&&gw(r)||D.IsUint8Array(e)&&m9(r)||D.IsDate(e)&&u9(r)||D.IsConstructor(e)&&h9(r)||D.IsFunction(e)&&f9(r)?$.True:D.IsRecord(e)&&D.IsString(Sv(e))?r[mn]==="Record"?$.True:$.False:D.IsRecord(e)&&D.IsNumber(Sv(e))?Lo(r,0)?$.True:$.False:$.False}function y9(e,r){return lr(r)?cr(e,r):D.IsRecord(r)?bn(e,r):D.IsObject(r)?(()=>{for(let t of Object.getOwnPropertyNames(r.properties)){if(!(t in e.properties)&&!D.IsOptional(r.properties[t]))return $.False;if(D.IsOptional(r.properties[t]))return $.True;if(Iw(e.properties[t],r.properties[t])===$.False)return $.False}return $.True})():$.False}function b9(e,r){return lr(r)?cr(e,r):D.IsObject(r)&&g9(r)?$.True:D.IsPromise(r)?yn(gt(e.item,r.item)):$.False}function Sv(e){return js in e.patternProperties?Gi():Gs in e.patternProperties?fn():Gp("Unknown record key pattern")}function Tv(e){return js in e.patternProperties?e.patternProperties[js]:Gs in e.patternProperties?e.patternProperties[Gs]:Gp("Unable to get record value schema")}function bn(e,r){let[t,o]=[Sv(r),Tv(r)];return D.IsLiteralString(e)&&D.IsNumber(t)&&yn(gt(e,o))===$.True?$.True:D.IsUint8Array(e)&&D.IsNumber(t)||D.IsString(e)&&D.IsNumber(t)||D.IsArray(e)&&D.IsNumber(t)?gt(e,o):D.IsObject(e)?(()=>{for(let n of Object.getOwnPropertyNames(e.properties))if(Iw(o,e.properties[n])===$.False)return $.False;return $.True})():$.False}function x9(e,r){return lr(r)?cr(e,r):D.IsObject(r)?eo(e,r):D.IsRecord(r)?gt(Tv(e),Tv(r)):$.False}function v9(e,r){let t=D.IsRegExp(e)?fn():e,o=D.IsRegExp(r)?fn():r;return gt(t,o)}function Sw(e,r){return D.IsLiteral(e)&&Ye.IsString(e.const)||D.IsString(e)?$.True:$.False}function I9(e,r){return lr(r)?cr(e,r):D.IsObject(r)?eo(e,r):D.IsRecord(r)?bn(e,r):D.IsString(r)?$.True:$.False}function S9(e,r){return lr(r)?cr(e,r):D.IsObject(r)?eo(e,r):D.IsRecord(r)?bn(e,r):D.IsSymbol(r)?$.True:$.False}function T9(e,r){return D.IsTemplateLiteral(e)?gt(Wl(e),r):D.IsTemplateLiteral(r)?gt(e,Wl(r)):Gp("Invalid fallthrough for TemplateLiteral")}function C9(e,r){return D.IsArray(r)&&e.items!==void 0&&e.items.every(t=>gt(t,r.items)===$.True)}function M9(e,r){return D.IsNever(e)?$.True:D.IsUnknown(e)?$.False:D.IsAny(e)?$.Union:$.False}function w9(e,r){return lr(r)?cr(e,r):D.IsObject(r)&&Gy(r)||D.IsArray(r)&&C9(e,r)?$.True:D.IsTuple(r)?Ye.IsUndefined(e.items)&&!Ye.IsUndefined(r.items)||!Ye.IsUndefined(e.items)&&Ye.IsUndefined(r.items)?$.False:Ye.IsUndefined(e.items)&&!Ye.IsUndefined(r.items)||e.items.every((t,o)=>gt(t,r.items[o])===$.True)?$.True:$.False:$.False}function O9(e,r){return lr(r)?cr(e,r):D.IsObject(r)?eo(e,r):D.IsRecord(r)?bn(e,r):D.IsUint8Array(r)?$.True:$.False}function E9(e,r){return lr(r)?cr(e,r):D.IsObject(r)?eo(e,r):D.IsRecord(r)?bn(e,r):D.IsVoid(r)?D9(e,r):D.IsUndefined(r)?$.True:$.False}function Mv(e,r){return r.anyOf.some(t=>gt(e,t)===$.True)?$.True:$.False}function P9(e,r){return e.anyOf.every(t=>gt(t,r)===$.True)?$.True:$.False}function Tw(e,r){return $.True}function F9(e,r){return D.IsNever(r)?xw(e,r):D.IsIntersect(r)?jy(e,r):D.IsUnion(r)?Mv(e,r):D.IsAny(r)?Cv(e,r):D.IsString(r)?Sw(e,r):D.IsNumber(r)?vw(e,r):D.IsInteger(r)?bw(e,r):D.IsBoolean(r)?yw(e,r):D.IsArray(r)?YL(e,r):D.IsTuple(r)?M9(e,r):D.IsObject(r)?eo(e,r):D.IsUnknown(r)?$.True:$.False}function D9(e,r){return D.IsUndefined(e)||D.IsUndefined(e)?$.True:$.False}function k9(e,r){return D.IsIntersect(r)?jy(e,r):D.IsUnion(r)?Mv(e,r):D.IsUnknown(r)?Tw(e,r):D.IsAny(r)?Cv(e,r):D.IsObject(r)?eo(e,r):D.IsVoid(r)?$.True:$.False}function gt(e,r){return D.IsTemplateLiteral(e)||D.IsTemplateLiteral(r)?T9(e,r):D.IsRegExp(e)||D.IsRegExp(r)?v9(e,r):D.IsNot(e)||D.IsNot(r)?l9(e,r):D.IsAny(e)?XL(e,r):D.IsArray(e)?JL(e,r):D.IsBigInt(e)?QL(e,r):D.IsBoolean(e)?qL(e,r):D.IsAsyncIterator(e)?KL(e,r):D.IsConstructor(e)?e9(e,r):D.IsDate(e)?t9(e,r):D.IsFunction(e)?r9(e,r):D.IsInteger(e)?o9(e,r):D.IsIntersect(e)?n9(e,r):D.IsIterator(e)?i9(e,r):D.IsLiteral(e)?s9(e,r):D.IsNever(e)?a9(e,r):D.IsNull(e)?c9(e,r):D.IsNumber(e)?p9(e,r):D.IsObject(e)?y9(e,r):D.IsRecord(e)?x9(e,r):D.IsString(e)?I9(e,r):D.IsSymbol(e)?S9(e,r):D.IsTuple(e)?w9(e,r):D.IsPromise(e)?b9(e,r):D.IsUint8Array(e)?O9(e,r):D.IsUndefined(e)?E9(e,r):D.IsUnion(e)?P9(e,r):D.IsUnknown(e)?F9(e,r):D.IsVoid(e)?k9(e,r):Gp(`Unknown left type operand '${e[U]}'`)}function Ya(e,r){return gt(e,r)}d();d();d();function A9(e,r,t,o,n){let i={};for(let a of globalThis.Object.getOwnPropertyNames(e))i[a]=Up(e[a],r,t,o,Lt(n));return i}function L9(e,r,t,o,n){return A9(e.properties,r,t,o,n)}function Cw(e,r,t,o,n){let i=L9(e,r,t,o,n);return Ke(i)}function _9(e,r,t,o){let n=Ya(e,r);return n===$.Union?ht([t,o]):n===$.True?t:o}function Up(e,r,t,o,n){return Rt(e)?Cw(e,r,t,o,n):Wo(e)?Z(Mw(e,r,t,o,n)):Z(_9(e,r,t,o),n)}function R9(e,r,t,o,n){return{[e]:Up(at(e),r,t,o,Lt(n))}}function B9(e,r,t,o,n){return e.reduce((i,a)=>({...i,...R9(a,r,t,o,n)}),{})}function N9(e,r,t,o,n){return B9(e.keys,r,t,o,n)}function Mw(e,r,t,o,n){let i=N9(e,r,t,o,n);return Ke(i)}d();function j9(e){return e.allOf.every(r=>Hs(r))}function G9(e){return e.anyOf.some(r=>Hs(r))}function U9(e){return!Hs(e.not)}function Hs(e){return e[U]==="Intersect"?j9(e):e[U]==="Union"?G9(e):e[U]==="Not"?U9(e):e[U]==="Undefined"}d();function ww(e,r){return Vp(Wl(e),r)}function V9(e,r){let t=e.filter(o=>Ya(o,r)===$.False);return t.length===1?t[0]:ht(t)}function Vp(e,r,t={}){return Zo(e)?Z(ww(e,r),t):Rt(e)?Z(Ow(e,r),t):Z(it(e)?V9(e.anyOf,r):Ya(e,r)!==$.False?ft():e,t)}function $9(e,r){let t={};for(let o of globalThis.Object.getOwnPropertyNames(e))t[o]=Vp(e[o],r);return t}function H9(e,r){return $9(e.properties,r)}function Ow(e,r){let t=H9(e,r);return Ke(t)}d();d();d();function Ew(e,r){return $p(Wl(e),r)}function z9(e,r){let t=e.filter(o=>Ya(o,r)!==$.False);return t.length===1?t[0]:ht(t)}function $p(e,r,t){return Zo(e)?Z(Ew(e,r),t):Rt(e)?Z(Pw(e,r),t):Z(it(e)?z9(e.anyOf,r):Ya(e,r)!==$.False?e:ft(),t)}function W9(e,r){let t={};for(let o of globalThis.Object.getOwnPropertyNames(e))t[o]=$p(e[o],r);return t}function Z9(e,r){return W9(e.properties,r)}function Pw(e,r){let t=Z9(e,r);return Ke(t)}d();function Fw(e,r){return Z(e.returns,r)}d();function Dw(e){return Z({[U]:"Integer",type:"integer"},e)}d();d();d();function X9(e,r,t){return{[e]:Jn(at(e),r,Lt(t))}}function Y9(e,r,t){return e.reduce((n,i)=>({...n,...X9(i,r,t)}),{})}function J9(e,r,t){return Y9(e.keys,r,t)}function kw(e,r,t){let o=J9(e,r,t);return Ke(o)}function K9(e){let[r,t]=[e.slice(0,1),e.slice(1)];return[r.toLowerCase(),t].join("")}function Q9(e){let[r,t]=[e.slice(0,1),e.slice(1)];return[r.toUpperCase(),t].join("")}function q9(e){return e.toUpperCase()}function e_(e){return e.toLowerCase()}function t_(e,r,t){let o=Rp(e.pattern);if(!zl(o))return{...e,pattern:Aw(e.pattern,r)};let a=[...Um(o)].map(p=>at(p)),l=Lw(a,r),c=ht(l);return Ey([c],t)}function Aw(e,r){return typeof e=="string"?r==="Uncapitalize"?K9(e):r==="Capitalize"?Q9(e):r==="Uppercase"?q9(e):r==="Lowercase"?e_(e):e:e.toString()}function Lw(e,r){return e.map(t=>Jn(t,r))}function Jn(e,r,t={}){return Wo(e)?kw(e,r,t):Zo(e)?t_(e,r,t):it(e)?ht(Lw(e.anyOf,r),t):Ns(e)?at(Aw(e.const,r),t):Z(e,t)}function _w(e,r={}){return Jn(e,"Capitalize",r)}d();function Rw(e,r={}){return Jn(e,"Lowercase",r)}d();function Bw(e,r={}){return Jn(e,"Uncapitalize",r)}d();function Nw(e,r={}){return Jn(e,"Uppercase",r)}d();function jw(e,r){return Z({[U]:"Not",not:e},r)}d();d();d();function r_(e,r,t){let o={};for(let n of globalThis.Object.getOwnPropertyNames(e))o[n]=Hp(e[n],r,Lt(t));return o}function o_(e,r,t){return r_(e.properties,r,t)}function Gw(e,r,t){let o=o_(e,r,t);return Ke(o)}function n_(e,r){return e.map(t=>wv(t,r))}function i_(e,r){return e.map(t=>wv(t,r))}function s_(e,r){let{[r]:t,...o}=e;return o}function a_(e,r){return r.reduce((t,o)=>s_(t,o),e)}function l_(e,r){let t=Qt(e,[_t,"$id","required","properties"]),o=a_(e.properties,r);return It(o,t)}function wv(e,r){return or(e)?Ao(n_(e.allOf,r)):it(e)?ht(i_(e.anyOf,r)):gr(e)?l_(e,r):It({})}function Hp(e,r,t){if(Wo(r))return Uw(e,r,t);if(Rt(e))return Gw(e,r,t);let o=Xn(r)?ko(r):r;return Z({...wv(e,o),...t})}function c_(e,r,t){return{[r]:Hp(e,[r],Lt(t))}}function p_(e,r,t){return r.reduce((o,n)=>({...o,...c_(e,n,t)}),{})}function d_(e,r,t){return p_(e,r.keys,t)}function Uw(e,r,t){let o=d_(e,r,t);return Ke(o)}d();function Vw(e,r){return Ui(e.parameters,r)}d();d();function $w(e){return e.map(r=>Hw(r))}function u_(e){let r={};for(let t of globalThis.Object.getOwnPropertyNames(e))r[t]=Do(e[t]);return r}function m_(e){let r=Qt(e,[_t,"$id","required","properties"]),t=u_(e.properties);return It(t,r)}function Hw(e){return or(e)?Ao($w(e.allOf)):it(e)?ht($w(e.anyOf)):gr(e)?m_(e):It({})}function Uy(e,r){return Rt(e)?zw(e,r):Z({...Hw(e),...r})}function f_(e,r){let t={};for(let o of globalThis.Object.getOwnPropertyNames(e))t[o]=Uy(e[o],Lt(r));return t}function h_(e,r){return f_(e.properties,r)}function zw(e,r){let t=h_(e,r);return Ke(t)}d();d();d();function g_(e,r,t){let o={};for(let n of globalThis.Object.getOwnPropertyNames(e))o[n]=zp(e[n],r,Lt(t));return o}function y_(e,r,t){return g_(e.properties,r,t)}function Ww(e,r,t){let o=y_(e,r,t);return Ke(o)}function b_(e,r){return e.map(t=>Ov(t,r))}function x_(e,r){return e.map(t=>Ov(t,r))}function v_(e,r){let t={};for(let o of r)o in e&&(t[o]=e[o]);return t}function I_(e,r){let t=Qt(e,[_t,"$id","required","properties"]),o=v_(e.properties,r);return It(o,t)}function Ov(e,r){return or(e)?Ao(b_(e.allOf,r)):it(e)?ht(x_(e.anyOf,r)):gr(e)?I_(e,r):It({})}function zp(e,r,t){if(Wo(r))return Zw(e,r,t);if(Rt(e))return Ww(e,r,t);let o=Xn(r)?ko(r):r;return Z({...Ov(e,o),...t})}function S_(e,r,t){return{[r]:zp(e,[r],Lt(t))}}function T_(e,r,t){return r.reduce((o,n)=>({...o,...S_(e,n,t)}),{})}function C_(e,r,t){return T_(e,r.keys,t)}function Zw(e,r,t){let o=C_(e,r,t);return Ke(o)}d();function Xw(e){return hn(Do(e))}d();function Zl(e,r,t){return Z({[U]:"Record",type:"object",patternProperties:{[e]:r}},t)}function Ev(e,r,t){let o={};for(let n of e)o[n]=r;return It(o,{...t,[mn]:"Record"})}function M_(e,r,t){return wy(e)?Ev(ko(e),r,t):Zl(e.pattern,r,t)}function w_(e,r,t){return Ev(ko(ht(e)),r,t)}function O_(e,r,t){return Ev([e.toString()],r,t)}function E_(e,r,t){return Zl(e.source,r,t)}function P_(e,r,t){let o=zt(e.pattern)?Gs:e.pattern;return Zl(o,r,t)}function F_(e,r,t){return Zl(Gs,r,t)}function D_(e,r,t){return Zl(j3,r,t)}function k_(e,r,t){return Zl(js,r,t)}function A_(e,r,t){return Zl(js,r,t)}function Yw(e,r,t={}){return it(e)?w_(e.anyOf,r,t):Zo(e)?M_(e,r,t):Ns(e)?O_(e.const,r,t):Vl(e)?k_(e,r,t):$l(e)?A_(e,r,t):ov(e)?E_(e,r,t):_m(e)?P_(e,r,t):Q0(e)?F_(e,r,t):Ha(e)?D_(e,r,t):ft(t)}d();var L_=0;function Jw(e,r={}){zt(r.$id)&&(r.$id=`T${L_++}`);let t=Pm(e({[U]:"This",$ref:`${r.$id}`}));return t.$id=r.$id,Z({[mn]:"Recursive",...t},r)}d();function Kw(e,r){if(Pt(e))return Z({[U]:"Ref",$ref:e},r);if(zt(e.$id))throw new Error("Reference target type must specify an $id");return Z({[U]:"Ref",$ref:e.$id},r)}d();function Qw(e,r){let t=Pt(e)?new globalThis.RegExp(e):e;return Z({[U]:"RegExp",type:"RegExp",source:t.source,flags:t.flags},r)}d();d();function qw(e){return e.map(r=>eO(r))}function __(e){let r={};for(let t of globalThis.Object.getOwnPropertyNames(e))r[t]=Qt(e[t],[mo]);return r}function R_(e){let r=Qt(e,[_t,"$id","required","properties"]),t=__(e.properties);return It(t,r)}function eO(e){return or(e)?Ao(qw(e.allOf)):it(e)?ht(qw(e.anyOf)):gr(e)?R_(e):It({})}function Vy(e,r){return Rt(e)?tO(e,r):Z({...eO(e),...r})}function B_(e,r){let t={};for(let o of globalThis.Object.getOwnPropertyNames(e))t[o]=Vy(e[o],r);return t}function N_(e,r){return B_(e.properties,r)}function tO(e,r){let t=N_(e,r);return Ke(t)}d();function j_(e){return or(e)?e.allOf:it(e)?e.anyOf:Zn(e)?e.items??[]:[]}function rO(e){return j_(e)}d();function oO(e,r){return Z(e.returns,r)}d();function nO(e){return JSON.parse(JSON.stringify(e))}d();var Pv=class{constructor(r){this.schema=r}Decode(r){return new Fv(this.schema,r)}},Fv=class{constructor(r,t){this.schema=r,this.decode=t}EncodeTransform(r,t){let i={Encode:a=>t[_t].Encode(r(a)),Decode:a=>this.decode(t[_t].Decode(a))};return{...t,[_t]:i}}EncodeSchema(r,t){let o={Decode:this.decode,Encode:r};return{...t,[_t]:o}}Encode(r){return Dp(this.schema)?this.EncodeTransform(r,this.schema):this.EncodeSchema(r,this.schema)}};function iO(e){return new Pv(e)}d();function $y(e={}){return Z({[U]:e[U]??"Unsafe"},e)}d();function sO(e){return Z({[U]:"Void",type:"void"},e)}d();var Dv={};La(Dv,{Any:()=>Wa,Array:()=>Sy,AsyncIterator:()=>Ty,Awaited:()=>sw,BigInt:()=>Np,Boolean:()=>Oy,Capitalize:()=>_w,Composite:()=>cw,Const:()=>pw,Constructor:()=>Cy,ConstructorParameters:()=>dw,Date:()=>Ay,Deref:()=>Yn,Enum:()=>uw,Exclude:()=>Vp,Extends:()=>Up,Extract:()=>$p,Function:()=>Za,Index:()=>jp,InstanceType:()=>Fw,Integer:()=>Dw,Intersect:()=>Ao,Iterator:()=>Fy,KeyOf:()=>ky,Literal:()=>at,Lowercase:()=>Rw,Mapped:()=>rw,Never:()=>ft,Not:()=>jw,Null:()=>Ly,Number:()=>Gi,Object:()=>It,Omit:()=>Hp,Optional:()=>Do,Parameters:()=>Vw,Partial:()=>Uy,Pick:()=>zp,Promise:()=>Dy,Readonly:()=>hn,ReadonlyOptional:()=>Xw,Record:()=>Yw,Recursive:()=>Jw,Ref:()=>Kw,RegExp:()=>Qw,Required:()=>Vy,Rest:()=>rO,ReturnType:()=>oO,Strict:()=>nO,String:()=>fn,Symbol:()=>_y,TemplateLiteral:()=>Ey,Transform:()=>iO,Tuple:()=>Ui,Uint8Array:()=>By,Uncapitalize:()=>Bw,Undefined:()=>Ry,Union:()=>ht,Unknown:()=>$s,Unsafe:()=>$y,Uppercase:()=>Nw,Void:()=>sO});d();var g=Dv;d();var Wm=g.Object({externalId:g.String({description:"An identifier that can be used to link this entity to data outside of the MVF."}),name:g.String({description:"The name of the entity."}),shortName:g.String({description:"A short name for the entity."}),description:g.String({description:"A description of the entity."}),icon:g.String({format:"uri",description:"A URL to an icon for the entity."})},{$id:"BaseDetails",description:"Additional information about a given entity."}),kv=g.Partial(Wm,{$id:"Details",description:"Additional information about a given entity."}),Xo=g.Object({details:g.Optional(g.Ref(kv))},{$id:"WithDetails"}),Xl=e=>{let r=[...e].sort(),t=g.Pick(Wm,e),o=g.Omit(Wm,e);return g.Object({details:g.Intersect([t,g.Partial(o)])},{$id:`WithRequiredDetails_${r.join("_")}`})},Av=[Wm,kv];d();var Wp=g.Number({$id:"Longitude",minimum:-180,maximum:180,description:"A WGS 84-compatible longitude coordinate value."}),Zp=g.Number({$id:"Latitude",minimum:-90,maximum:90,description:"A WGS 84-compatible latitude coordinate value."}),Yl=g.Tuple([g.Ref(Wp),g.Ref(Zp)],{$id:"Position",minItems:2,maxItems:2,description:"A valid WGS 84 position consisting of a longitude value, followed by a latitude value."}),to=g.Object({type:g.Literal("Point"),coordinates:g.Ref(Yl)},{$id:"Point",description:"An RFC-7946 compatible GeoJSON Point geometry."}),Hy=g.Object({type:g.Literal("MultiPoint"),coordinates:g.Array(g.Ref(Yl))},{$id:"MultiPoint",description:"An RFC-7946 compatible GeoJSON MultiPoint geometry."}),zy=g.Object({type:g.Literal("LineString"),coordinates:g.Array(g.Ref(Yl),{minItems:2,description:"At least two positions are required."})},{$id:"LineString",description:"An RFC-7946 compatible GeoJSON LineString geometry."}),Wy=g.Object({type:g.Literal("MultiLineString"),coordinates:g.Array(g.Array(g.Ref(Yl),{minItems:2}))},{$id:"MultiLineString",description:"An RFC-7946 compatible GeoJSON MultiLineString geometry."}),aO=g.Array(g.Ref(Yl),{$id:"LinearRing",minItems:4,description:"A linear ring is a building block of a polygon or multi-polygon."}),Lv=g.Array(g.Ref(aO),{$id:"LinearRings",minItems:1,description:"A collection of linear rings, at least one of which is the exterior ring of a polygon."}),Xp=g.Object({type:g.Literal("Polygon"),coordinates:g.Ref(Lv)},{$id:"Polygon",description:"An RFC-7946 compatible GeoJSON Polygon geometry."}),Yp=g.Object({type:g.Literal("MultiPolygon"),coordinates:g.Array(g.Ref(Lv))},{$id:"MultiPolygon",description:"An RFC-7946 compatible GeoJSON MultiPolygon geometry."}),Ur=(e,r,t)=>g.Object({type:g.Literal("Feature"),geometry:e,properties:r},t),fo=(e,r,t)=>g.Object({type:g.Literal("FeatureCollection"),features:g.Array(e,t)},r),_v=[Wp,Zp,Yl,to,Hy,zy,Wy,aO,Lv,Xp,Yp];d();var qt=(e,r)=>g.Unsafe(g.String({$id:r,pattern:`^${e}_[A-Za-z0-9-]+$`})),ro=qt("g","GeometryId"),Ve=qt("f","FloorId"),Rv=[ro,Ve];d();d();d();var Zy=class{constructor(r){m(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}}},Xy=class{constructor(r){m(this,"_tag","Some");m(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 lO(r(this.value))}mapAsync(r){return r(this.value).then(t=>lO(t))}mapOr(r,t){return this.map(r).unwrapOr(t)}mapOrAsync(r,t){return this.mapAsync(r).then(o=>o.unwrapOr(t))}mapOrElse(r,t){return this.map(r).unwrapOrElse(t)}mapOrElseAsync(r,t){return this.mapAsync(r).then(o=>o.unwrapOrElse(t))}and(r){return r}andThen(r){return r(this.value)}andThenAsync(r){return r(this.value)}filter(r){return r(this.value)?this:Ja()}or(r){return this}orElse(r){return this}xor(r){return r.isSome()?Ja():this}toString(){return`Some(${this.value})`}okOr(r){return oe(this.value)}okOrElse(r){return oe(this.value)}iter(){return new Zy(this.value)}[Symbol.iterator](){return this.iter()}zip(r){return r.isSome()?Jp([this.value,r.value]):Ja()}zipWith(r,t){return r.isSome()?Jp(t(this.value,r.value)):Ja()}get[Symbol.toStringTag](){return"Some"}},Yy=class{constructor(){m(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,t){return t}mapOrAsync(r,t){return Promise.resolve(t)}mapOrElse(r,t){return t()}mapOrElseAsync(r,t){return t()}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 ie(r)}okOrElse(r){return ie(r())}iter(){return new Zy(null)}[Symbol.iterator](){return this.iter()}zip(r){return this}zipWith(r,t){return this}get[Symbol.toStringTag](){return"None"}},Jp=e=>new Xy(e),Ja=()=>new Yy,lO=e=>e instanceof Xy||e instanceof Yy?e:e==null?Ja():Jp(e);var Jy=class{constructor(r){m(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}}},Bv=class{constructor(r){m(this,"_tag","Ok");m(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 Jp(this.value)}err(){return Ja()}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 oe(r(this.value))}async mapAsync(r){return r(this.value).then(oe)}mapOr(r,t){return r(this.value)}async mapOrAsync(r,t){return r(this.value)}mapOrElse(r,t){return r(this.value)}async mapOrElseAsync(r,t){return r(this.value)}mapErr(r){return this}iter(){return new Jy(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(${this.value})`}get[Symbol.toStringTag](){return"Ok"}},Nv=class e{constructor(r){m(this,"_tag","Err");m(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 Ja()}err(){return Jp(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 Jy(null)}[Symbol.iterator](){return this.iter()}async mapAsync(r){return this}mapOr(r,t){return t}async mapOrAsync(r,t){return t}mapOrElse(r,t){return t()}async mapOrElseAsync(r,t){return t()}mapErr(r){return new e(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(${this.error})`}get[Symbol.toStringTag](){return"Err"}},oe=e=>new Bv(e),ie=e=>new Nv(e);d();var _o;(function(e){e.GeometryMissingError="GeometryMissingError",e.FloorMissingError="FloorMissingError",e.UnknownFloorError="UnknownFloorError",e.UnknownGeometryError="UnknownGeometryError",e.DuplicateIdError="DuplicateIdError"})(_o||(_o={}));d();d();d();d();var jv=class extends be{constructor(r){super(`Duplicate type kind '${r}' detected`)}},Zm=class extends be{constructor(r){super(`Duplicate string format '${r}' detected`)}},Ky;(function(e){function r(o,n){if(Or.Has(o))throw new jv(o);return Or.Set(o,n),(i={})=>$y({...i,[U]:o})}e.Type=r;function t(o,n){if(Fo.Has(o))throw new Zm(o);return Fo.Set(o,n),o}e.Format=t})(Ky||(Ky={}));d();function G_(e){switch(e.errorType){case V.ArrayContains:return"Expected array to contain at least one matching value";case V.ArrayMaxContains:return`Expected array to contain no more than ${e.schema.maxContains} matching values`;case V.ArrayMinContains:return`Expected array to contain at least ${e.schema.minContains} matching values`;case V.ArrayMaxItems:return`Expected array length to be less or equal to ${e.schema.maxItems}`;case V.ArrayMinItems:return`Expected array length to be greater or equal to ${e.schema.minItems}`;case V.ArrayUniqueItems:return"Expected array elements to be unique";case V.Array:return"Expected array";case V.AsyncIterator:return"Expected AsyncIterator";case V.BigIntExclusiveMaximum:return`Expected bigint to be less than ${e.schema.exclusiveMaximum}`;case V.BigIntExclusiveMinimum:return`Expected bigint to be greater than ${e.schema.exclusiveMinimum}`;case V.BigIntMaximum:return`Expected bigint to be less or equal to ${e.schema.maximum}`;case V.BigIntMinimum:return`Expected bigint to be greater or equal to ${e.schema.minimum}`;case V.BigIntMultipleOf:return`Expected bigint to be a multiple of ${e.schema.multipleOf}`;case V.BigInt:return"Expected bigint";case V.Boolean:return"Expected boolean";case V.DateExclusiveMinimumTimestamp:return`Expected Date timestamp to be greater than ${e.schema.exclusiveMinimumTimestamp}`;case V.DateExclusiveMaximumTimestamp:return`Expected Date timestamp to be less than ${e.schema.exclusiveMaximumTimestamp}`;case V.DateMinimumTimestamp:return`Expected Date timestamp to be greater or equal to ${e.schema.minimumTimestamp}`;case V.DateMaximumTimestamp:return`Expected Date timestamp to be less or equal to ${e.schema.maximumTimestamp}`;case V.DateMultipleOfTimestamp:return`Expected Date timestamp to be a multiple of ${e.schema.multipleOfTimestamp}`;case V.Date:return"Expected Date";case V.Function:return"Expected function";case V.IntegerExclusiveMaximum:return`Expected integer to be less than ${e.schema.exclusiveMaximum}`;case V.IntegerExclusiveMinimum:return`Expected integer to be greater than ${e.schema.exclusiveMinimum}`;case V.IntegerMaximum:return`Expected integer to be less or equal to ${e.schema.maximum}`;case V.IntegerMinimum:return`Expected integer to be greater or equal to ${e.schema.minimum}`;case V.IntegerMultipleOf:return`Expected integer to be a multiple of ${e.schema.multipleOf}`;case V.Integer:return"Expected integer";case V.IntersectUnevaluatedProperties:return"Unexpected property";case V.Intersect:return"Expected all values to match";case V.Iterator:return"Expected Iterator";case V.Literal:return`Expected ${typeof e.schema.const=="string"?`'${e.schema.const}'`:e.schema.const}`;case V.Never:return"Never";case V.Not:return"Value should not match";case V.Null:return"Expected null";case V.NumberExclusiveMaximum:return`Expected number to be less than ${e.schema.exclusiveMaximum}`;case V.NumberExclusiveMinimum:return`Expected number to be greater than ${e.schema.exclusiveMinimum}`;case V.NumberMaximum:return`Expected number to be less or equal to ${e.schema.maximum}`;case V.NumberMinimum:return`Expected number to be greater or equal to ${e.schema.minimum}`;case V.NumberMultipleOf:return`Expected number to be a multiple of ${e.schema.multipleOf}`;case V.Number:return"Expected number";case V.Object:return"Expected object";case V.ObjectAdditionalProperties:return"Unexpected property";case V.ObjectMaxProperties:return`Expected object to have no more than ${e.schema.maxProperties} properties`;case V.ObjectMinProperties:return`Expected object to have at least ${e.schema.minProperties} properties`;case V.ObjectRequiredProperty:return"Expected required property";case V.Promise:return"Expected Promise";case V.RegExp:return"Expected string to match regular expression";case V.StringFormatUnknown:return`Unknown format '${e.schema.format}'`;case V.StringFormat:return`Expected string to match '${e.schema.format}' format`;case V.StringMaxLength:return`Expected string length less or equal to ${e.schema.maxLength}`;case V.StringMinLength:return`Expected string length greater or equal to ${e.schema.minLength}`;case V.StringPattern:return`Expected string to match '${e.schema.pattern}'`;case V.String:return"Expected string";case V.Symbol:return"Expected symbol";case V.TupleLength:return`Expected tuple to have ${e.schema.maxItems||0} elements`;case V.Tuple:return"Expected tuple";case V.Uint8ArrayMaxByteLength:return`Expected byte length less or equal to ${e.schema.maxByteLength}`;case V.Uint8ArrayMinByteLength:return`Expected byte length greater or equal to ${e.schema.minByteLength}`;case V.Uint8Array:return"Expected Uint8Array";case V.Undefined:return"Expected undefined";case V.Union:return"Expected union value";case V.Void:return"Expected void";case V.Kind:return`Expected kind '${e.schema[U]}'`;default:return"Unknown error type"}}var U_=G_;function cO(){return U_}d();var Gv=class extends be{constructor(r){super(`Unable to dereference schema with $id '${r.$ref}'`),this.schema=r}};function V_(e,r){let t=r.find(o=>o.$id===e.$ref);if(t===void 0)throw new Gv(e);return Qe(t,r)}function xn(e,r){return!He(e.$id)||r.some(t=>t.$id===e.$id)||r.push(e),r}function Qe(e,r){return e[U]==="This"||e[U]==="Ref"?V_(e,r):e}d();var Uv=class extends be{constructor(r){super("Unable to hash value"),this.value=r}},Yo;(function(e){e[e.Undefined=0]="Undefined",e[e.Null=1]="Null",e[e.Boolean=2]="Boolean",e[e.Number=3]="Number",e[e.String=4]="String",e[e.Object=5]="Object",e[e.Array=6]="Array",e[e.Date=7]="Date",e[e.Uint8Array=8]="Uint8Array",e[e.Symbol=9]="Symbol",e[e.BigInt=10]="BigInt"})(Yo||(Yo={}));var Kp=BigInt("14695981039346656037"),[$_,H_]=[BigInt("1099511628211"),BigInt("18446744073709551616")],z_=Array.from({length:256}).map((e,r)=>BigInt(r)),pO=new Float64Array(1),dO=new DataView(pO.buffer),uO=new Uint8Array(pO.buffer);function*W_(e){let r=e===0?1:Math.ceil(Math.floor(Math.log2(e)+1)/8);for(let t=0;t<r;t++)yield e>>8*(r-1-t)&255}function Z_(e){oo(Yo.Array);for(let r of e)Qp(r)}function X_(e){oo(Yo.Boolean),oo(e?1:0)}function Y_(e){oo(Yo.BigInt),dO.setBigInt64(0,e);for(let r of uO)oo(r)}function J_(e){oo(Yo.Date),Qp(e.getTime())}function K_(e){oo(Yo.Null)}function Q_(e){oo(Yo.Number),dO.setFloat64(0,e);for(let r of uO)oo(r)}function q_(e){oo(Yo.Object);for(let r of globalThis.Object.getOwnPropertyNames(e).sort())Qp(r),Qp(e[r])}function e8(e){oo(Yo.String);for(let r=0;r<e.length;r++)for(let t of W_(e.charCodeAt(r)))oo(t)}function t8(e){oo(Yo.Symbol),Qp(e.description)}function r8(e){oo(Yo.Uint8Array);for(let r=0;r<e.length;r++)oo(e[r])}function o8(e){return oo(Yo.Undefined)}function Qp(e){if(we(e))return Z_(e);if(Bi(e))return X_(e);if(jr(e))return Y_(e);if(uo(e))return J_(e);if(Ls(e))return K_(e);if(me(e))return Q_(e);if(Ae(e))return q_(e);if(He(e))return e8(e);if(_s(e))return t8(e);if(Fp(e))return r8(e);if(Wt(e))return o8(e);throw new Uv(e)}function oo(e){Kp=Kp^z_[e],Kp=Kp*$_%H_}function Ka(e){return Kp=BigInt("14695981039346656037"),Qp(e),Kp}d();var Vv=class extends be{constructor(r){super("Unknown type"),this.schema=r}};function n8(e){return e[U]==="Any"||e[U]==="Unknown"}function Be(e){return e!==void 0}function i8(e,r,t){return!0}function s8(e,r,t){if(!we(t)||Be(e.minItems)&&!(t.length>=e.minItems)||Be(e.maxItems)&&!(t.length<=e.maxItems)||!t.every(i=>Vr(e.items,r,i))||e.uniqueItems===!0&&!function(){let i=new Set;for(let a of t){let l=Ka(a);if(i.has(l))return!1;i.add(l)}return!0}())return!1;if(!(Be(e.contains)||me(e.minContains)||me(e.maxContains)))return!0;let o=Be(e.contains)?e.contains:ft(),n=t.reduce((i,a)=>Vr(o,r,a)?i+1:i,0);return!(n===0||me(e.minContains)&&n<e.minContains||me(e.maxContains)&&n>e.maxContains)}function a8(e,r,t){return by(t)}function l8(e,r,t){return!(!jr(t)||Be(e.exclusiveMaximum)&&!(t<e.exclusiveMaximum)||Be(e.exclusiveMinimum)&&!(t>e.exclusiveMinimum)||Be(e.maximum)&&!(t<=e.maximum)||Be(e.minimum)&&!(t>=e.minimum)||Be(e.multipleOf)&&t%e.multipleOf!==BigInt(0))}function c8(e,r,t){return Bi(t)}function p8(e,r,t){return Vr(e.returns,r,t.prototype)}function d8(e,r,t){return!(!uo(t)||Be(e.exclusiveMaximumTimestamp)&&!(t.getTime()<e.exclusiveMaximumTimestamp)||Be(e.exclusiveMinimumTimestamp)&&!(t.getTime()>e.exclusiveMinimumTimestamp)||Be(e.maximumTimestamp)&&!(t.getTime()<=e.maximumTimestamp)||Be(e.minimumTimestamp)&&!(t.getTime()>=e.minimumTimestamp)||Be(e.multipleOfTimestamp)&&t.getTime()%e.multipleOfTimestamp!==0)}function u8(e,r,t){return $a(t)}function m8(e,r,t){return!(!Iy(t)||Be(e.exclusiveMaximum)&&!(t<e.exclusiveMaximum)||Be(e.exclusiveMinimum)&&!(t>e.exclusiveMinimum)||Be(e.maximum)&&!(t<=e.maximum)||Be(e.minimum)&&!(t>=e.minimum)||Be(e.multipleOf)&&t%e.multipleOf!==0)}function f8(e,r,t){let o=e.allOf.every(n=>Vr(n,r,t));if(e.unevaluatedProperties===!1){let n=new RegExp(Vs(e)),i=Object.getOwnPropertyNames(t).every(a=>n.test(a));return o&&i}else if(ze(e.unevaluatedProperties)){let n=new RegExp(Vs(e)),i=Object.getOwnPropertyNames(t).every(a=>n.test(a)||Vr(e.unevaluatedProperties,r,t[a]));return o&&i}else return o}function h8(e,r,t){return xy(t)}function g8(e,r,t){return t===e.const}function y8(e,r,t){return!1}function b8(e,r,t){return!Vr(e.not,r,t)}function x8(e,r,t){return Ls(t)}function v8(e,r,t){return!(!pt.IsNumberLike(t)||Be(e.exclusiveMaximum)&&!(t<e.exclusiveMaximum)||Be(e.exclusiveMinimum)&&!(t>e.exclusiveMinimum)||Be(e.minimum)&&!(t>=e.minimum)||Be(e.maximum)&&!(t<=e.maximum)||Be(e.multipleOf)&&t%e.multipleOf!==0)}function I8(e,r,t){if(!pt.IsObjectLike(t)||Be(e.minProperties)&&!(Object.getOwnPropertyNames(t).length>=e.minProperties)||Be(e.maxProperties)&&!(Object.getOwnPropertyNames(t).length<=e.maxProperties))return!1;let o=Object.getOwnPropertyNames(e.properties);for(let n of o){let i=e.properties[n];if(e.required&&e.required.includes(n)){if(!Vr(i,r,t[n])||(Hs(i)||n8(i))&&!(n in t))return!1}else if(pt.IsExactOptionalProperty(t,n)&&!Vr(i,r,t[n]))return!1}if(e.additionalProperties===!1){let n=Object.getOwnPropertyNames(t);return e.required&&e.required.length===o.length&&n.length===o.length?!0:n.every(i=>o.includes(i))}else return typeof e.additionalProperties=="object"?Object.getOwnPropertyNames(t).every(i=>o.includes(i)||Vr(e.additionalProperties,r,t[i])):!0}function S8(e,r,t){return vy(t)}function T8(e,r,t){if(!pt.IsRecordLike(t)||Be(e.minProperties)&&!(Object.getOwnPropertyNames(t).length>=e.minProperties)||Be(e.maxProperties)&&!(Object.getOwnPropertyNames(t).length<=e.maxProperties))return!1;let[o,n]=Object.entries(e.patternProperties)[0],i=new RegExp(o),a=Object.entries(t).every(([p,u])=>i.test(p)?Vr(n,r,u):!0),l=typeof e.additionalProperties=="object"?Object.entries(t).every(([p,u])=>i.test(p)?!0:Vr(e.additionalProperties,r,u)):!0,c=e.additionalProperties===!1?Object.getOwnPropertyNames(t).every(p=>i.test(p)):!0;return a&&l&&c}function C8(e,r,t){return Vr(Qe(e,r),r,t)}function M8(e,r,t){let o=new RegExp(e.source,e.flags);return Be(e.minLength)&&!(t.length>=e.minLength)||Be(e.maxLength)&&!(t.length<=e.maxLength)?!1:o.test(t)}function w8(e,r,t){return!He(t)||Be(e.minLength)&&!(t.length>=e.minLength)||Be(e.maxLength)&&!(t.length<=e.maxLength)||Be(e.pattern)&&!new RegExp(e.pattern).test(t)?!1:Be(e.format)?Fo.Has(e.format)?Fo.Get(e.format)(t):!1:!0}function O8(e,r,t){return _s(t)}function E8(e,r,t){return He(t)&&new RegExp(e.pattern).test(t)}function P8(e,r,t){return Vr(Qe(e,r),r,t)}function F8(e,r,t){if(!we(t)||e.items===void 0&&t.length!==0||t.length!==e.maxItems)return!1;if(!e.items)return!0;for(let o=0;o<e.items.length;o++)if(!Vr(e.items[o],r,t[o]))return!1;return!0}function D8(e,r,t){return Wt(t)}function k8(e,r,t){return e.anyOf.some(o=>Vr(o,r,t))}function A8(e,r,t){return!(!Fp(t)||Be(e.maxByteLength)&&!(t.length<=e.maxByteLength)||Be(e.minByteLength)&&!(t.length>=e.minByteLength))}function L8(e,r,t){return!0}function _8(e,r,t){return pt.IsVoidLike(t)}function R8(e,r,t){return Or.Has(e[U])?Or.Get(e[U])(e,t):!1}function Vr(e,r,t){let o=Be(e.$id)?[...r,e]:r,n=e;switch(n[U]){case"Any":return i8(n,o,t);case"Array":return s8(n,o,t);case"AsyncIterator":return a8(n,o,t);case"BigInt":return l8(n,o,t);case"Boolean":return c8(n,o,t);case"Constructor":return p8(n,o,t);case"Date":return d8(n,o,t);case"Function":return u8(n,o,t);case"Integer":return m8(n,o,t);case"Intersect":return f8(n,o,t);case"Iterator":return h8(n,o,t);case"Literal":return g8(n,o,t);case"Never":return y8(n,o,t);case"Not":return b8(n,o,t);case"Null":return x8(n,o,t);case"Number":return v8(n,o,t);case"Object":return I8(n,o,t);case"Promise":return S8(n,o,t);case"Record":return T8(n,o,t);case"Ref":return C8(n,o,t);case"RegExp":return M8(n,o,t);case"String":return w8(n,o,t);case"Symbol":return O8(n,o,t);case"TemplateLiteral":return E8(n,o,t);case"This":return P8(n,o,t);case"Tuple":return F8(n,o,t);case"Undefined":return D8(n,o,t);case"Union":return k8(n,o,t);case"Uint8Array":return A8(n,o,t);case"Unknown":return L8(n,o,t);case"Void":return _8(n,o,t);default:if(!Or.Has(n[U]))throw new Vv(n);return R8(n,o,t)}}function _e(...e){return e.length===3?Vr(e[0],e[1],e[2]):Vr(e[0],[],e[1])}var V;(function(e){e[e.ArrayContains=0]="ArrayContains",e[e.ArrayMaxContains=1]="ArrayMaxContains",e[e.ArrayMaxItems=2]="ArrayMaxItems",e[e.ArrayMinContains=3]="ArrayMinContains",e[e.ArrayMinItems=4]="ArrayMinItems",e[e.ArrayUniqueItems=5]="ArrayUniqueItems",e[e.Array=6]="Array",e[e.AsyncIterator=7]="AsyncIterator",e[e.BigIntExclusiveMaximum=8]="BigIntExclusiveMaximum",e[e.BigIntExclusiveMinimum=9]="BigIntExclusiveMinimum",e[e.BigIntMaximum=10]="BigIntMaximum",e[e.BigIntMinimum=11]="BigIntMinimum",e[e.BigIntMultipleOf=12]="BigIntMultipleOf",e[e.BigInt=13]="BigInt",e[e.Boolean=14]="Boolean",e[e.DateExclusiveMaximumTimestamp=15]="DateExclusiveMaximumTimestamp",e[e.DateExclusiveMinimumTimestamp=16]="DateExclusiveMinimumTimestamp",e[e.DateMaximumTimestamp=17]="DateMaximumTimestamp",e[e.DateMinimumTimestamp=18]="DateMinimumTimestamp",e[e.DateMultipleOfTimestamp=19]="DateMultipleOfTimestamp",e[e.Date=20]="Date",e[e.Function=21]="Function",e[e.IntegerExclusiveMaximum=22]="IntegerExclusiveMaximum",e[e.IntegerExclusiveMinimum=23]="IntegerExclusiveMinimum",e[e.IntegerMaximum=24]="IntegerMaximum",e[e.IntegerMinimum=25]="IntegerMinimum",e[e.IntegerMultipleOf=26]="IntegerMultipleOf",e[e.Integer=27]="Integer",e[e.IntersectUnevaluatedProperties=28]="IntersectUnevaluatedProperties",e[e.Intersect=29]="Intersect",e[e.Iterator=30]="Iterator",e[e.Kind=31]="Kind",e[e.Literal=32]="Literal",e[e.Never=33]="Never",e[e.Not=34]="Not",e[e.Null=35]="Null",e[e.NumberExclusiveMaximum=36]="NumberExclusiveMaximum",e[e.NumberExclusiveMinimum=37]="NumberExclusiveMinimum",e[e.NumberMaximum=38]="NumberMaximum",e[e.NumberMinimum=39]="NumberMinimum",e[e.NumberMultipleOf=40]="NumberMultipleOf",e[e.Number=41]="Number",e[e.ObjectAdditionalProperties=42]="ObjectAdditionalProperties",e[e.ObjectMaxProperties=43]="ObjectMaxProperties",e[e.ObjectMinProperties=44]="ObjectMinProperties",e[e.ObjectRequiredProperty=45]="ObjectRequiredProperty",e[e.Object=46]="Object",e[e.Promise=47]="Promise",e[e.RegExp=48]="RegExp",e[e.StringFormatUnknown=49]="StringFormatUnknown",e[e.StringFormat=50]="StringFormat",e[e.StringMaxLength=51]="StringMaxLength",e[e.StringMinLength=52]="StringMinLength",e[e.StringPattern=53]="StringPattern",e[e.String=54]="String",e[e.Symbol=55]="Symbol",e[e.TupleLength=56]="TupleLength",e[e.Tuple=57]="Tuple",e[e.Uint8ArrayMaxByteLength=58]="Uint8ArrayMaxByteLength",e[e.Uint8ArrayMinByteLength=59]="Uint8ArrayMinByteLength",e[e.Uint8Array=60]="Uint8Array",e[e.Undefined=61]="Undefined",e[e.Union=62]="Union",e[e.Void=63]="Void"})(V||(V={}));var $v=class extends be{constructor(r){super("Unknown type"),this.schema=r}};function zs(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function Ne(e){return e!==void 0}var vn=class{constructor(r){this.iterator=r}[Symbol.iterator](){return this.iterator}First(){let r=this.iterator.next();return r.done?void 0:r.value}};function te(e,r,t,o,n=[]){return{type:e,schema:r,path:t,value:o,message:cO()({errorType:e,path:t,schema:r,value:o,errors:n}),errors:n}}function*B8(e,r,t,o){}function*N8(e,r,t,o){if(!we(o))return yield te(V.Array,e,t,o);Ne(e.minItems)&&!(o.length>=e.minItems)&&(yield te(V.ArrayMinItems,e,t,o)),Ne(e.maxItems)&&!(o.length<=e.maxItems)&&(yield te(V.ArrayMaxItems,e,t,o));for(let a=0;a<o.length;a++)yield*$r(e.items,r,`${t}/${a}`,o[a]);if(e.uniqueItems===!0&&!function(){let a=new Set;for(let l of o){let c=Ka(l);if(a.has(c))return!1;a.add(c)}return!0}()&&(yield te(V.ArrayUniqueItems,e,t,o)),!(Ne(e.contains)||Ne(e.minContains)||Ne(e.maxContains)))return;let n=Ne(e.contains)?e.contains:ft(),i=o.reduce((a,l,c)=>$r(n,r,`${t}${c}`,l).next().done===!0?a+1:a,0);i===0&&(yield te(V.ArrayContains,e,t,o)),me(e.minContains)&&i<e.minContains&&(yield te(V.ArrayMinContains,e,t,o)),me(e.maxContains)&&i>e.maxContains&&(yield te(V.ArrayMaxContains,e,t,o))}function*j8(e,r,t,o){by(o)||(yield te(V.AsyncIterator,e,t,o))}function*G8(e,r,t,o){if(!jr(o))return yield te(V.BigInt,e,t,o);Ne(e.exclusiveMaximum)&&!(o<e.exclusiveMaximum)&&(yield te(V.BigIntExclusiveMaximum,e,t,o)),Ne(e.exclusiveMinimum)&&!(o>e.exclusiveMinimum)&&(yield te(V.BigIntExclusiveMinimum,e,t,o)),Ne(e.maximum)&&!(o<=e.maximum)&&(yield te(V.BigIntMaximum,e,t,o)),Ne(e.minimum)&&!(o>=e.minimum)&&(yield te(V.BigIntMinimum,e,t,o)),Ne(e.multipleOf)&&o%e.multipleOf!==BigInt(0)&&(yield te(V.BigIntMultipleOf,e,t,o))}function*U8(e,r,t,o){Bi(o)||(yield te(V.Boolean,e,t,o))}function*V8(e,r,t,o){yield*$r(e.returns,r,t,o.prototype)}function*$8(e,r,t,o){if(!uo(o))return yield te(V.Date,e,t,o);Ne(e.exclusiveMaximumTimestamp)&&!(o.getTime()<e.exclusiveMaximumTimestamp)&&(yield te(V.DateExclusiveMaximumTimestamp,e,t,o)),Ne(e.exclusiveMinimumTimestamp)&&!(o.getTime()>e.exclusiveMinimumTimestamp)&&(yield te(V.DateExclusiveMinimumTimestamp,e,t,o)),Ne(e.maximumTimestamp)&&!(o.getTime()<=e.maximumTimestamp)&&(yield te(V.DateMaximumTimestamp,e,t,o)),Ne(e.minimumTimestamp)&&!(o.getTime()>=e.minimumTimestamp)&&(yield te(V.DateMinimumTimestamp,e,t,o)),Ne(e.multipleOfTimestamp)&&o.getTime()%e.multipleOfTimestamp!==0&&(yield te(V.DateMultipleOfTimestamp,e,t,o))}function*H8(e,r,t,o){$a(o)||(yield te(V.Function,e,t,o))}function*z8(e,r,t,o){if(!Iy(o))return yield te(V.Integer,e,t,o);Ne(e.exclusiveMaximum)&&!(o<e.exclusiveMaximum)&&(yield te(V.IntegerExclusiveMaximum,e,t,o)),Ne(e.exclusiveMinimum)&&!(o>e.exclusiveMinimum)&&(yield te(V.IntegerExclusiveMinimum,e,t,o)),Ne(e.maximum)&&!(o<=e.maximum)&&(yield te(V.IntegerMaximum,e,t,o)),Ne(e.minimum)&&!(o>=e.minimum)&&(yield te(V.IntegerMinimum,e,t,o)),Ne(e.multipleOf)&&o%e.multipleOf!==0&&(yield te(V.IntegerMultipleOf,e,t,o))}function*W8(e,r,t,o){let n=!1;for(let i of e.allOf)for(let a of $r(i,r,t,o))n=!0,yield a;if(n)return yield te(V.Intersect,e,t,o);if(e.unevaluatedProperties===!1){let i=new RegExp(Vs(e));for(let a of Object.getOwnPropertyNames(o))i.test(a)||(yield te(V.IntersectUnevaluatedProperties,e,`${t}/${a}`,o))}if(typeof e.unevaluatedProperties=="object"){let i=new RegExp(Vs(e));for(let a of Object.getOwnPropertyNames(o))if(!i.test(a)){let l=$r(e.unevaluatedProperties,r,`${t}/${a}`,o[a]).next();l.done||(yield l.value)}}}function*Z8(e,r,t,o){xy(o)||(yield te(V.Iterator,e,t,o))}function*X8(e,r,t,o){o!==e.const&&(yield te(V.Literal,e,t,o))}function*Y8(e,r,t,o){yield te(V.Never,e,t,o)}function*J8(e,r,t,o){$r(e.not,r,t,o).next().done===!0&&(yield te(V.Not,e,t,o))}function*K8(e,r,t,o){Ls(o)||(yield te(V.Null,e,t,o))}function*Q8(e,r,t,o){if(!pt.IsNumberLike(o))return yield te(V.Number,e,t,o);Ne(e.exclusiveMaximum)&&!(o<e.exclusiveMaximum)&&(yield te(V.NumberExclusiveMaximum,e,t,o)),Ne(e.exclusiveMinimum)&&!(o>e.exclusiveMinimum)&&(yield te(V.NumberExclusiveMinimum,e,t,o)),Ne(e.maximum)&&!(o<=e.maximum)&&(yield te(V.NumberMaximum,e,t,o)),Ne(e.minimum)&&!(o>=e.minimum)&&(yield te(V.NumberMinimum,e,t,o)),Ne(e.multipleOf)&&o%e.multipleOf!==0&&(yield te(V.NumberMultipleOf,e,t,o))}function*q8(e,r,t,o){if(!pt.IsObjectLike(o))return yield te(V.Object,e,t,o);Ne(e.minProperties)&&!(Object.getOwnPropertyNames(o).length>=e.minProperties)&&(yield te(V.ObjectMinProperties,e,t,o)),Ne(e.maxProperties)&&!(Object.getOwnPropertyNames(o).length<=e.maxProperties)&&(yield te(V.ObjectMaxProperties,e,t,o));let n=Array.isArray(e.required)?e.required:[],i=Object.getOwnPropertyNames(e.properties),a=Object.getOwnPropertyNames(o);for(let l of n)a.includes(l)||(yield te(V.ObjectRequiredProperty,e.properties[l],`${t}/${zs(l)}`,void 0));if(e.additionalProperties===!1)for(let l of a)i.includes(l)||(yield te(V.ObjectAdditionalProperties,e,`${t}/${zs(l)}`,o[l]));if(typeof e.additionalProperties=="object")for(let l of a)i.includes(l)||(yield*$r(e.additionalProperties,r,`${t}/${zs(l)}`,o[l]));for(let l of i){let c=e.properties[l];e.required&&e.required.includes(l)?(yield*$r(c,r,`${t}/${zs(l)}`,o[l]),Hs(e)&&!(l in o)&&(yield te(V.ObjectRequiredProperty,c,`${t}/${zs(l)}`,void 0))):pt.IsExactOptionalProperty(o,l)&&(yield*$r(c,r,`${t}/${zs(l)}`,o[l]))}}function*eR(e,r,t,o){vy(o)||(yield te(V.Promise,e,t,o))}function*tR(e,r,t,o){if(!pt.IsRecordLike(o))return yield te(V.Object,e,t,o);Ne(e.minProperties)&&!(Object.getOwnPropertyNames(o).length>=e.minProperties)&&(yield te(V.ObjectMinProperties,e,t,o)),Ne(e.maxProperties)&&!(Object.getOwnPropertyNames(o).length<=e.maxProperties)&&(yield te(V.ObjectMaxProperties,e,t,o));let[n,i]=Object.entries(e.patternProperties)[0],a=new RegExp(n);for(let[l,c]of Object.entries(o))a.test(l)&&(yield*$r(i,r,`${t}/${zs(l)}`,c));if(typeof e.additionalProperties=="object")for(let[l,c]of Object.entries(o))a.test(l)||(yield*$r(e.additionalProperties,r,`${t}/${zs(l)}`,c));if(e.additionalProperties===!1){for(let[l,c]of Object.entries(o))if(!a.test(l))return yield te(V.ObjectAdditionalProperties,e,`${t}/${zs(l)}`,c)}}function*rR(e,r,t,o){yield*$r(Qe(e,r),r,t,o)}function*oR(e,r,t,o){if(!He(o))return yield te(V.String,e,t,o);if(Ne(e.minLength)&&!(o.length>=e.minLength)&&(yield te(V.StringMinLength,e,t,o)),Ne(e.maxLength)&&!(o.length<=e.maxLength)&&(yield te(V.StringMaxLength,e,t,o)),!new RegExp(e.source,e.flags).test(o))return yield te(V.RegExp,e,t,o)}function*nR(e,r,t,o){if(!He(o))return yield te(V.String,e,t,o);Ne(e.minLength)&&!(o.length>=e.minLength)&&(yield te(V.StringMinLength,e,t,o)),Ne(e.maxLength)&&!(o.length<=e.maxLength)&&(yield te(V.StringMaxLength,e,t,o)),He(e.pattern)&&(new RegExp(e.pattern).test(o)||(yield te(V.StringPattern,e,t,o))),He(e.format)&&(Fo.Has(e.format)?Fo.Get(e.format)(o)||(yield te(V.StringFormat,e,t,o)):yield te(V.StringFormatUnknown,e,t,o))}function*iR(e,r,t,o){_s(o)||(yield te(V.Symbol,e,t,o))}function*sR(e,r,t,o){if(!He(o))return yield te(V.String,e,t,o);new RegExp(e.pattern).test(o)||(yield te(V.StringPattern,e,t,o))}function*aR(e,r,t,o){yield*$r(Qe(e,r),r,t,o)}function*lR(e,r,t,o){if(!we(o))return yield te(V.Tuple,e,t,o);if(e.items===void 0&&o.length!==0)return yield te(V.TupleLength,e,t,o);if(o.length!==e.maxItems)return yield te(V.TupleLength,e,t,o);if(e.items)for(let n=0;n<e.items.length;n++)yield*$r(e.items[n],r,`${t}/${n}`,o[n])}function*cR(e,r,t,o){Wt(o)||(yield te(V.Undefined,e,t,o))}function*pR(e,r,t,o){if(_e(e,r,o))return;let n=e.anyOf.map(i=>new vn($r(i,r,t,o)));yield te(V.Union,e,t,o,n)}function*dR(e,r,t,o){if(!Fp(o))return yield te(V.Uint8Array,e,t,o);Ne(e.maxByteLength)&&!(o.length<=e.maxByteLength)&&(yield te(V.Uint8ArrayMaxByteLength,e,t,o)),Ne(e.minByteLength)&&!(o.length>=e.minByteLength)&&(yield te(V.Uint8ArrayMinByteLength,e,t,o))}function*uR(e,r,t,o){}function*mR(e,r,t,o){pt.IsVoidLike(o)||(yield te(V.Void,e,t,o))}function*fR(e,r,t,o){Or.Get(e[U])(e,o)||(yield te(V.Kind,e,t,o))}function*$r(e,r,t,o){let n=Ne(e.$id)?[...r,e]:r,i=e;switch(i[U]){case"Any":return yield*B8(i,n,t,o);case"Array":return yield*N8(i,n,t,o);case"AsyncIterator":return yield*j8(i,n,t,o);case"BigInt":return yield*G8(i,n,t,o);case"Boolean":return yield*U8(i,n,t,o);case"Constructor":return yield*V8(i,n,t,o);case"Date":return yield*$8(i,n,t,o);case"Function":return yield*H8(i,n,t,o);case"Integer":return yield*z8(i,n,t,o);case"Intersect":return yield*W8(i,n,t,o);case"Iterator":return yield*Z8(i,n,t,o);case"Literal":return yield*X8(i,n,t,o);case"Never":return yield*Y8(i,n,t,o);case"Not":return yield*J8(i,n,t,o);case"Null":return yield*K8(i,n,t,o);case"Number":return yield*Q8(i,n,t,o);case"Object":return yield*q8(i,n,t,o);case"Promise":return yield*eR(i,n,t,o);case"Record":return yield*tR(i,n,t,o);case"Ref":return yield*rR(i,n,t,o);case"RegExp":return yield*oR(i,n,t,o);case"String":return yield*nR(i,n,t,o);case"Symbol":return yield*iR(i,n,t,o);case"TemplateLiteral":return yield*sR(i,n,t,o);case"This":return yield*aR(i,n,t,o);case"Tuple":return yield*lR(i,n,t,o);case"Undefined":return yield*cR(i,n,t,o);case"Union":return yield*pR(i,n,t,o);case"Uint8Array":return yield*dR(i,n,t,o);case"Unknown":return yield*uR(i,n,t,o);case"Void":return yield*mR(i,n,t,o);default:if(!Or.Has(i[U]))throw new $v(e);return yield*fR(i,n,t,o)}}function Vi(...e){let r=e.length===3?$r(e[0],e[1],"",e[2]):$r(e[0],[],"",e[1]);return new vn(r)}d();d();var hR=function(e,r,t,o,n){if(o==="m")throw new TypeError("Private method is not writable");if(o==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof r=="function"?e!==r||!n:!r.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return o==="a"?n.call(e,t):n?n.value=t:r.set(e,t),t},fO=function(e,r,t,o){if(t==="a"&&!o)throw new TypeError("Private accessor was defined without a getter");if(typeof r=="function"?e!==r||!o:!r.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?o:t==="a"?o.call(e):o?o.value:r.get(e)},Hv,Qy,hO,zv=class extends be{constructor(r){let t=r.First();super(t===void 0?"Invalid Value":t.message),Hv.add(this),Qy.set(this,void 0),hR(this,Qy,r,"f"),this.error=t}Errors(){return new vn(fO(this,Hv,"m",hO).call(this))}};Qy=new WeakMap,Hv=new WeakSet,hO=function*(){this.error&&(yield this.error),yield*fO(this,Qy,"f")};function mO(e,r,t){if(!_e(e,r,t))throw new zv(Vi(e,r,t))}function qy(...e){return e.length===3?mO(e[0],e[1],e[2]):mO(e[0],[],e[1])}d();d();d();function gR(e){let r={};for(let t of Object.getOwnPropertyNames(e))r[t]=qe(e[t]);for(let t of Object.getOwnPropertySymbols(e))r[t]=qe(e[t]);return r}function yR(e){return e.map(r=>qe(r))}function bR(e){return e.slice()}function xR(e){return new Map(qe([...e.entries()]))}function vR(e){return new Set(qe([...e.entries()]))}function IR(e){return new Date(e.toISOString())}function qe(e){if(we(e))return yR(e);if(uo(e))return IR(e);if(un(e))return bR(e);if(QM(e))return xR(e);if(qM(e))return vR(e);if(Ae(e))return gR(e);if(Gr(e))return e;throw new Error("ValueClone: Unable to clone value")}var Jo=class extends be{constructor(r,t){super(t),this.schema=r}};function et(e){return $a(e)?e():qe(e)}function SR(e,r){return ve(e,"default")?et(e.default):{}}function TR(e,r){if(e.uniqueItems===!0&&!ve(e,"default"))throw new Jo(e,"Array with the uniqueItems constraint requires a default value");if("contains"in e&&!ve(e,"default"))throw new Jo(e,"Array with the contains constraint requires a default value");return"default"in e?et(e.default):e.minItems!==void 0?Array.from({length:e.minItems}).map(t=>Ko(e.items,r)):[]}function CR(e,r){return ve(e,"default")?et(e.default):async function*(){}()}function MR(e,r){return ve(e,"default")?et(e.default):BigInt(0)}function wR(e,r){return ve(e,"default")?et(e.default):!1}function OR(e,r){if(ve(e,"default"))return et(e.default);{let t=Ko(e.returns,r);return typeof t=="object"&&!Array.isArray(t)?class{constructor(){for(let[o,n]of Object.entries(t)){let i=this;i[o]=n}}}:class{}}}function ER(e,r){return ve(e,"default")?et(e.default):e.minimumTimestamp!==void 0?new Date(e.minimumTimestamp):new Date}function PR(e,r){return ve(e,"default")?et(e.default):()=>Ko(e.returns,r)}function FR(e,r){return ve(e,"default")?et(e.default):e.minimum!==void 0?e.minimum:0}function DR(e,r){if(ve(e,"default"))return et(e.default);{let t=e.allOf.reduce((o,n)=>{let i=Ko(n,r);return typeof i=="object"?{...o,...i}:i},{});if(!_e(e,r,t))throw new Jo(e,"Intersect produced invalid value. Consider using a default value.");return t}}function kR(e,r){return ve(e,"default")?et(e.default):function*(){}()}function AR(e,r){return ve(e,"default")?et(e.default):e.const}function LR(e,r){if(ve(e,"default"))return et(e.default);throw new Jo(e,"Never types cannot be created. Consider using a default value.")}function _R(e,r){if(ve(e,"default"))return et(e.default);throw new Jo(e,"Not types must have a default value")}function RR(e,r){return ve(e,"default")?et(e.default):null}function BR(e,r){return ve(e,"default")?et(e.default):e.minimum!==void 0?e.minimum:0}function NR(e,r){if(ve(e,"default"))return et(e.default);{let t=new Set(e.required),o={};for(let[n,i]of Object.entries(e.properties))t.has(n)&&(o[n]=Ko(i,r));return o}}function jR(e,r){return ve(e,"default")?et(e.default):Promise.resolve(Ko(e.item,r))}function GR(e,r){let[t,o]=Object.entries(e.patternProperties)[0];if(ve(e,"default"))return et(e.default);if(t===Gs||t===js)return{};{let n=t.slice(1,t.length-1).split("|"),i={};for(let a of n)i[a]=Ko(o,r);return i}}function UR(e,r){return ve(e,"default")?et(e.default):Ko(Qe(e,r),r)}function VR(e,r){if(ve(e,"default"))return et(e.default);throw new Jo(e,"RegExp types cannot be created. Consider using a default value.")}function $R(e,r){if(e.pattern!==void 0){if(ve(e,"default"))return et(e.default);throw new Jo(e,"String types with patterns must specify a default value")}else if(e.format!==void 0){if(ve(e,"default"))return et(e.default);throw new Jo(e,"String types with formats must specify a default value")}else return ve(e,"default")?et(e.default):e.minLength!==void 0?Array.from({length:e.minLength}).map(()=>" ").join(""):""}function HR(e,r){return ve(e,"default")?et(e.default):"value"in e?Symbol.for(e.value):Symbol()}function zR(e,r){if(ve(e,"default"))return et(e.default);if(!wy(e))throw new Jo(e,"Can only create template literals that produce a finite variants. Consider using a default value.");return Bp(e)[0]}function WR(e,r){if(gO++>eB)throw new Jo(e,"Cannot create recursive type as it appears possibly infinite. Consider using a default.");return ve(e,"default")?et(e.default):Ko(Qe(e,r),r)}function ZR(e,r){return ve(e,"default")?et(e.default):e.items===void 0?[]:Array.from({length:e.minItems}).map((t,o)=>Ko(e.items[o],r))}function XR(e,r){if(ve(e,"default"))return et(e.default)}function YR(e,r){if(ve(e,"default"))return et(e.default);if(e.anyOf.length===0)throw new Error("ValueCreate.Union: Cannot create Union with zero variants");return Ko(e.anyOf[0],r)}function JR(e,r){return ve(e,"default")?et(e.default):e.minByteLength!==void 0?new Uint8Array(e.minByteLength):new Uint8Array(0)}function KR(e,r){return ve(e,"default")?et(e.default):{}}function QR(e,r){if(ve(e,"default"))return et(e.default)}function qR(e,r){if(ve(e,"default"))return et(e.default);throw new Error("User defined types must specify a default value")}function Ko(e,r){let t=xn(e,r),o=e;switch(o[U]){case"Any":return SR(o,t);case"Array":return TR(o,t);case"AsyncIterator":return CR(o,t);case"BigInt":return MR(o,t);case"Boolean":return wR(o,t);case"Constructor":return OR(o,t);case"Date":return ER(o,t);case"Function":return PR(o,t);case"Integer":return FR(o,t);case"Intersect":return DR(o,t);case"Iterator":return kR(o,t);case"Literal":return AR(o,t);case"Never":return LR(o,t);case"Not":return _R(o,t);case"Null":return RR(o,t);case"Number":return BR(o,t);case"Object":return NR(o,t);case"Promise":return jR(o,t);case"Record":return GR(o,t);case"Ref":return UR(o,t);case"RegExp":return VR(o,t);case"String":return $R(o,t);case"Symbol":return HR(o,t);case"TemplateLiteral":return zR(o,t);case"This":return WR(o,t);case"Tuple":return ZR(o,t);case"Undefined":return XR(o,t);case"Union":return YR(o,t);case"Uint8Array":return JR(o,t);case"Unknown":return KR(o,t);case"Void":return QR(o,t);default:if(!Or.Has(o[U]))throw new Jo(o,"Unknown type");return qR(o,t)}}var eB=512,gO=0;function In(...e){return gO=0,e.length===2?Ko(e[0],e[1]):Ko(e[0],[])}var eb=class extends be{constructor(r,t){super(t),this.schema=r}};function tB(e,r,t){if(e[U]==="Object"&&typeof t=="object"&&!Ls(t)){let o=e,n=Object.getOwnPropertyNames(t),i=Object.entries(o.properties),[a,l]=[1/i.length,i.length];return i.reduce((c,[p,u])=>{let f=u[U]==="Literal"&&u.const===t[p]?l:0,h=_e(u,r,t[p])?a:0,b=n.includes(p)?a:0;return c+(f+h+b)},0)}else return _e(e,r,t)?1:0}function rB(e,r,t){let o=e.anyOf.map(a=>Qe(a,r)),[n,i]=[o[0],0];for(let a of o){let l=tB(a,r,t);l>i&&(n=a,i=l)}return n}function oB(e,r,t){if("default"in e)return typeof t=="function"?e.default:qe(e.default);{let o=rB(e,r,t);return Wv(o,r,t)}}function nB(e,r,t){return _e(e,r,t)?qe(t):In(e,r)}function iB(e,r,t){return _e(e,r,t)?t:In(e,r)}function sB(e,r,t){if(_e(e,r,t))return qe(t);let o=we(t)?qe(t):In(e,r),n=me(e.minItems)&&o.length<e.minItems?[...o,...Array.from({length:e.minItems-o.length},()=>null)]:o,a=(me(e.maxItems)&&n.length>e.maxItems?n.slice(0,e.maxItems):n).map(c=>$i(e.items,r,c));if(e.uniqueItems!==!0)return a;let l=[...new Set(a)];if(!_e(e,r,l))throw new eb(e,"Array cast produced invalid data due to uniqueItems constraint");return l}function aB(e,r,t){if(_e(e,r,t))return In(e,r);let o=new Set(e.returns.required||[]),n=function(){};for(let[i,a]of Object.entries(e.returns.properties))!o.has(i)&&t.prototype[i]===void 0||(n.prototype[i]=$i(a,r,t.prototype[i]));return n}function lB(e,r,t){let o=In(e,r),n=Ae(o)&&Ae(t)?{...o,...t}:t;return _e(e,r,n)?n:In(e,r)}function cB(e,r,t){throw new eb(e,"Never types cannot be cast")}function pB(e,r,t){if(_e(e,r,t))return t;if(t===null||typeof t!="object")return In(e,r);let o=new Set(e.required||[]),n={};for(let[i,a]of Object.entries(e.properties))!o.has(i)&&t[i]===void 0||(n[i]=$i(a,r,t[i]));if(typeof e.additionalProperties=="object"){let i=Object.getOwnPropertyNames(e.properties);for(let a of Object.getOwnPropertyNames(t))i.includes(a)||(n[a]=$i(e.additionalProperties,r,t[a]))}return n}function dB(e,r,t){if(_e(e,r,t))return qe(t);if(t===null||typeof t!="object"||Array.isArray(t)||t instanceof Date)return In(e,r);let o=Object.getOwnPropertyNames(e.patternProperties)[0],n=e.patternProperties[o],i={};for(let[a,l]of Object.entries(t))i[a]=$i(n,r,l);return i}function uB(e,r,t){return $i(Qe(e,r),r,t)}function mB(e,r,t){return $i(Qe(e,r),r,t)}function fB(e,r,t){return _e(e,r,t)?qe(t):we(t)?e.items===void 0?[]:e.items.map((o,n)=>$i(o,r,t[n])):In(e,r)}function hB(e,r,t){return _e(e,r,t)?qe(t):oB(e,r,t)}function $i(e,r,t){let o=He(e.$id)?[...r,e]:r,n=e;switch(e[U]){case"Array":return sB(n,o,t);case"Constructor":return aB(n,o,t);case"Intersect":return lB(n,o,t);case"Never":return cB(n,o,t);case"Object":return pB(n,o,t);case"Record":return dB(n,o,t);case"Ref":return uB(n,o,t);case"This":return mB(n,o,t);case"Tuple":return fB(n,o,t);case"Union":return hB(n,o,t);case"Date":case"Symbol":case"Uint8Array":return nB(e,r,t);default:return iB(n,o,t)}}function Wv(...e){return e.length===3?$i(e[0],e[1],e[2]):$i(e[0],[],e[1])}d();function gB(e){return za(e)&&e[U]!=="Unsafe"}function yB(e,r,t){return we(t)?t.map(o=>Qo(e.items,r,o)):t}function bB(e,r,t){let o=e.unevaluatedProperties,i=e.allOf.map(l=>Qo(l,r,qe(t))).reduce((l,c)=>Ae(c)?{...l,...c}:c,{});if(!Ae(t)||!Ae(i)||!za(o))return i;let a=Er(e);for(let l of Object.getOwnPropertyNames(t))a.includes(l)||_e(o,r,t[l])&&(i[l]=Qo(o,r,t[l]));return i}function xB(e,r,t){if(!Ae(t)||we(t))return t;let o=e.additionalProperties;for(let n of Object.getOwnPropertyNames(t)){if(ve(e.properties,n)){t[n]=Qo(e.properties[n],r,t[n]);continue}if(za(o)&&_e(o,r,t[n])){t[n]=Qo(o,r,t[n]);continue}delete t[n]}return t}function vB(e,r,t){if(!Ae(t))return t;let o=e.additionalProperties,n=Object.getOwnPropertyNames(t),[i,a]=Object.entries(e.patternProperties)[0],l=new RegExp(i);for(let c of n){if(l.test(c)){t[c]=Qo(a,r,t[c]);continue}if(za(o)&&_e(o,r,t[c])){t[c]=Qo(o,r,t[c]);continue}delete t[c]}return t}function IB(e,r,t){return Qo(Qe(e,r),r,t)}function SB(e,r,t){return Qo(Qe(e,r),r,t)}function TB(e,r,t){if(!we(t))return t;if(Wt(e.items))return[];let o=Math.min(t.length,e.items.length);for(let n=0;n<o;n++)t[n]=Qo(e.items[n],r,t[n]);return t.length>o?t.slice(0,o):t}function CB(e,r,t){for(let o of e.anyOf)if(gB(o)&&_e(o,r,t))return Qo(o,r,t);return t}function Qo(e,r,t){let o=He(e.$id)?[...r,e]:r,n=e;switch(n[U]){case"Array":return yB(n,o,t);case"Intersect":return bB(n,o,t);case"Object":return xB(n,o,t);case"Record":return vB(n,o,t);case"Ref":return IB(n,o,t);case"This":return SB(n,o,t);case"Tuple":return TB(n,o,t);case"Union":return CB(n,o,t);default:return t}}function tb(...e){return e.length===3?Qo(e[0],e[1],e[2]):Qo(e[0],[],e[1])}d();function rb(e){return He(e)&&!isNaN(e)&&!isNaN(parseFloat(e))}function MB(e){return jr(e)||Bi(e)||me(e)}function Xm(e){return e===!0||me(e)&&e===1||jr(e)&&e===BigInt("1")||He(e)&&(e.toLowerCase()==="true"||e==="1")}function Ym(e){return e===!1||me(e)&&(e===0||Object.is(e,-0))||jr(e)&&e===BigInt("0")||He(e)&&(e.toLowerCase()==="false"||e==="0"||e==="-0")}function wB(e){return He(e)&&/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i.test(e)}function OB(e){return He(e)&&/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)?$/i.test(e)}function EB(e){return He(e)&&/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i.test(e)}function PB(e){return He(e)&&/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)?$/i.test(e)}function FB(e){return He(e)&&/^\d\d\d\d-[0-1]\d-[0-3]\d$/i.test(e)}function DB(e,r){let t=bO(e);return t===r?t:e}function kB(e,r){let t=xO(e);return t===r?t:e}function AB(e,r){let t=yO(e);return t===r?t:e}function LB(e,r){return He(e.const)?DB(r,e.const):me(e.const)?kB(r,e.const):Bi(e.const)?AB(r,e.const):r}function yO(e){return Xm(e)?!0:Ym(e)?!1:e}function _B(e){let r=t=>t.split(".")[0];return rb(e)?BigInt(r(e)):me(e)?BigInt(Math.trunc(e)):Ym(e)?BigInt(0):Xm(e)?BigInt(1):e}function bO(e){return MB(e)?e.toString():_s(e)&&e.description!==void 0?e.description.toString():e}function xO(e){return rb(e)?parseFloat(e):Xm(e)?1:Ym(e)?0:e}function RB(e){return rb(e)?parseInt(e):me(e)?e|0:Xm(e)?1:Ym(e)?0:e}function BB(e){return He(e)&&e.toLowerCase()==="null"?null:e}function NB(e){return He(e)&&e==="undefined"?void 0:e}function jB(e){return uo(e)?e:me(e)?new Date(e):Xm(e)?new Date(1):Ym(e)?new Date(0):rb(e)?new Date(parseInt(e)):OB(e)?new Date(`1970-01-01T${e}.000Z`):wB(e)?new Date(`1970-01-01T${e}`):PB(e)?new Date(`${e}.000Z`):EB(e)?new Date(e):FB(e)?new Date(`${e}T00:00:00.000Z`):e}function GB(e,r,t){return(we(t)?t:[t]).map(n=>Hi(e.items,r,n))}function UB(e,r,t){return _B(t)}function VB(e,r,t){return yO(t)}function $B(e,r,t){return jB(t)}function HB(e,r,t){return RB(t)}function zB(e,r,t){return e.allOf.reduce((o,n)=>Hi(n,r,o),t)}function WB(e,r,t){return LB(e,t)}function ZB(e,r,t){return BB(t)}function XB(e,r,t){return xO(t)}function YB(e,r,t){if(!Ae(t))return t;for(let o of Object.getOwnPropertyNames(e.properties))ve(t,o)&&(t[o]=Hi(e.properties[o],r,t[o]));return t}function JB(e,r,t){if(!Ae(t))return t;let n=Object.getOwnPropertyNames(e.patternProperties)[0],i=e.patternProperties[n];for(let[a,l]of Object.entries(t))t[a]=Hi(i,r,l);return t}function KB(e,r,t){return Hi(Qe(e,r),r,t)}function QB(e,r,t){return bO(t)}function qB(e,r,t){return He(t)||me(t)?Symbol(t):t}function eN(e,r,t){return Hi(Qe(e,r),r,t)}function tN(e,r,t){return we(t)&&!Wt(e.items)?t.map((n,i)=>i<e.items.length?Hi(e.items[i],r,n):n):t}function rN(e,r,t){return NB(t)}function oN(e,r,t){for(let o of e.anyOf){let n=Hi(o,r,qe(t));if(_e(o,r,n))return n}return t}function Hi(e,r,t){let o=xn(e,r),n=e;switch(e[U]){case"Array":return GB(n,o,t);case"BigInt":return UB(n,o,t);case"Boolean":return VB(n,o,t);case"Date":return $B(n,o,t);case"Integer":return HB(n,o,t);case"Intersect":return zB(n,o,t);case"Literal":return WB(n,o,t);case"Null":return ZB(n,o,t);case"Number":return XB(n,o,t);case"Object":return YB(n,o,t);case"Record":return JB(n,o,t);case"Ref":return KB(n,o,t);case"String":return QB(n,o,t);case"Symbol":return qB(n,o,t);case"This":return eN(n,o,t);case"Tuple":return tN(n,o,t);case"Undefined":return rN(n,o,t);case"Union":return oN(n,o,t);default:return t}}function ob(...e){return e.length===3?Hi(e[0],e[1],e[2]):Hi(e[0],[],e[1])}d();d();var qp=class extends be{constructor(r,t,o){super("Unable to decode value as it does not match the expected schema"),this.schema=r,this.value=t,this.error=o}},Jl=class extends be{constructor(r,t,o,n){super(n instanceof Error?n.message:"Unknown error"),this.schema=r,this.path=t,this.value=o,this.error=n}};function Zt(e,r,t){try{return Ft(e)?e[_t].Decode(t):t}catch(o){throw new Jl(e,r,t,o)}}function nN(e,r,t,o){return we(o)?Zt(e,t,o.map((n,i)=>zi(e.items,r,`${t}/${i}`,n))):Zt(e,t,o)}function iN(e,r,t,o){if(!Ae(o)||Gr(o))return Zt(e,t,o);let n=Xa(e),i=n.map(u=>u[0]),a={...o};for(let[u,f]of n)u in a&&(a[u]=zi(f,r,`${t}/${u}`,a[u]));if(!Ft(e.unevaluatedProperties))return Zt(e,t,a);let l=Object.getOwnPropertyNames(a),c=e.unevaluatedProperties,p={...a};for(let u of l)i.includes(u)||(p[u]=Zt(c,`${t}/${u}`,p[u]));return Zt(e,t,p)}function sN(e,r,t,o){return Zt(e,t,zi(e.not,r,t,o))}function aN(e,r,t,o){if(!Ae(o))return Zt(e,t,o);let n=Er(e),i={...o};for(let p of n)ve(i,p)&&(Wt(i[p])&&(!kp(e.properties[p])||pt.IsExactOptionalProperty(i,p))||(i[p]=zi(e.properties[p],r,`${t}/${p}`,i[p])));if(!ze(e.additionalProperties))return Zt(e,t,i);let a=Object.getOwnPropertyNames(i),l=e.additionalProperties,c={...i};for(let p of a)n.includes(p)||(c[p]=Zt(l,`${t}/${p}`,c[p]));return Zt(e,t,c)}function lN(e,r,t,o){if(!Ae(o))return Zt(e,t,o);let n=Object.getOwnPropertyNames(e.patternProperties)[0],i=new RegExp(n),a={...o};for(let u of Object.getOwnPropertyNames(o))i.test(u)&&(a[u]=zi(e.patternProperties[n],r,`${t}/${u}`,a[u]));if(!ze(e.additionalProperties))return Zt(e,t,a);let l=Object.getOwnPropertyNames(a),c=e.additionalProperties,p={...a};for(let u of l)i.test(u)||(p[u]=Zt(c,`${t}/${u}`,p[u]));return Zt(e,t,p)}function cN(e,r,t,o){let n=Qe(e,r);return Zt(e,t,zi(n,r,t,o))}function pN(e,r,t,o){let n=Qe(e,r);return Zt(e,t,zi(n,r,t,o))}function dN(e,r,t,o){return we(o)&&we(e.items)?Zt(e,t,e.items.map((n,i)=>zi(n,r,`${t}/${i}`,o[i]))):Zt(e,t,o)}function uN(e,r,t,o){for(let n of e.anyOf){if(!_e(n,r,o))continue;let i=zi(n,r,t,o);return Zt(e,t,i)}return Zt(e,t,o)}function zi(e,r,t,o){let n=xn(e,r),i=e;switch(e[U]){case"Array":return nN(i,n,t,o);case"Intersect":return iN(i,n,t,o);case"Not":return sN(i,n,t,o);case"Object":return aN(i,n,t,o);case"Record":return lN(i,n,t,o);case"Ref":return cN(i,n,t,o);case"Symbol":return Zt(i,t,o);case"This":return pN(i,n,t,o);case"Tuple":return dN(i,n,t,o);case"Union":return uN(i,n,t,o);default:return Zt(i,t,o)}}function ed(e,r,t){return zi(e,r,"",t)}d();var td=class extends be{constructor(r,t,o){super("The encoded value does not match the expected schema"),this.schema=r,this.value=t,this.error=o}},Kl=class extends be{constructor(r,t,o,n){super(`${n instanceof Error?n.message:"Unknown error"}`),this.schema=r,this.path=t,this.value=o,this.error=n}};function no(e,r,t){try{return Ft(e)?e[_t].Encode(t):t}catch(o){throw new Kl(e,r,t,o)}}function mN(e,r,t,o){let n=no(e,t,o);return we(n)?n.map((i,a)=>Wi(e.items,r,`${t}/${a}`,i)):n}function fN(e,r,t,o){let n=no(e,t,o);if(!Ae(o)||Gr(o))return n;let i=Xa(e),a=i.map(f=>f[0]),l={...n};for(let[f,h]of i)f in l&&(l[f]=Wi(h,r,`${t}/${f}`,l[f]));if(!Ft(e.unevaluatedProperties))return l;let c=Object.getOwnPropertyNames(l),p=e.unevaluatedProperties,u={...l};for(let f of c)a.includes(f)||(u[f]=no(p,`${t}/${f}`,u[f]));return u}function hN(e,r,t,o){return no(e.not,t,no(e,t,o))}function gN(e,r,t,o){let n=no(e,t,o);if(!Ae(n))return n;let i=Er(e),a={...n};for(let u of i)ve(a,u)&&(Wt(a[u])&&(!kp(e.properties[u])||pt.IsExactOptionalProperty(a,u))||(a[u]=Wi(e.properties[u],r,`${t}/${u}`,a[u])));if(!ze(e.additionalProperties))return a;let l=Object.getOwnPropertyNames(a),c=e.additionalProperties,p={...a};for(let u of l)i.includes(u)||(p[u]=no(c,`${t}/${u}`,p[u]));return p}function yN(e,r,t,o){let n=no(e,t,o);if(!Ae(o))return n;let i=Object.getOwnPropertyNames(e.patternProperties)[0],a=new RegExp(i),l={...n};for(let f of Object.getOwnPropertyNames(o))a.test(f)&&(l[f]=Wi(e.patternProperties[i],r,`${t}/${f}`,l[f]));if(!ze(e.additionalProperties))return l;let c=Object.getOwnPropertyNames(l),p=e.additionalProperties,u={...l};for(let f of c)a.test(f)||(u[f]=no(p,`${t}/${f}`,u[f]));return u}function bN(e,r,t,o){let n=Qe(e,r),i=Wi(n,r,t,o);return no(e,t,i)}function xN(e,r,t,o){let n=Qe(e,r),i=Wi(n,r,t,o);return no(e,t,i)}function vN(e,r,t,o){let n=no(e,t,o);return we(e.items)?e.items.map((i,a)=>Wi(i,r,`${t}/${a}`,n[a])):[]}function IN(e,r,t,o){for(let n of e.anyOf){if(!_e(n,r,o))continue;let i=Wi(n,r,t,o);return no(e,t,i)}for(let n of e.anyOf){let i=Wi(n,r,t,o);if(_e(e,r,i))return no(e,t,i)}return no(e,t,o)}function Wi(e,r,t,o){let n=xn(e,r),i=e;switch(e[U]){case"Array":return mN(i,n,t,o);case"Intersect":return fN(i,n,t,o);case"Not":return hN(i,n,t,o);case"Object":return gN(i,n,t,o);case"Record":return yN(i,n,t,o);case"Ref":return bN(i,n,t,o);case"This":return xN(i,n,t,o);case"Tuple":return vN(i,n,t,o);case"Union":return IN(i,n,t,o);default:return no(i,t,o)}}function nb(e,r,t){return Wi(e,r,"",t)}d();function SN(e,r){return Ft(e)||Pr(e.items,r)}function TN(e,r){return Ft(e)||Pr(e.items,r)}function CN(e,r){return Ft(e)||Pr(e.returns,r)||e.parameters.some(t=>Pr(t,r))}function MN(e,r){return Ft(e)||Pr(e.returns,r)||e.parameters.some(t=>Pr(t,r))}function wN(e,r){return Ft(e)||Ft(e.unevaluatedProperties)||e.allOf.some(t=>Pr(t,r))}function ON(e,r){return Ft(e)||Pr(e.items,r)}function EN(e,r){return Ft(e)||Pr(e.not,r)}function PN(e,r){return Ft(e)||Object.values(e.properties).some(t=>Pr(t,r))||ze(e.additionalProperties)&&Pr(e.additionalProperties,r)}function FN(e,r){return Ft(e)||Pr(e.item,r)}function DN(e,r){let t=Object.getOwnPropertyNames(e.patternProperties)[0],o=e.patternProperties[t];return Ft(e)||Pr(o,r)||ze(e.additionalProperties)&&Ft(e.additionalProperties)}function kN(e,r){return Ft(e)?!0:Pr(Qe(e,r),r)}function AN(e,r){return Ft(e)?!0:Pr(Qe(e,r),r)}function LN(e,r){return Ft(e)||!Wt(e.items)&&e.items.some(t=>Pr(t,r))}function _N(e,r){return Ft(e)||e.anyOf.some(t=>Pr(t,r))}function Pr(e,r){let t=xn(e,r),o=e;if(e.$id&&Zv.has(e.$id))return!1;switch(e.$id&&Zv.add(e.$id),e[U]){case"Array":return SN(o,t);case"AsyncIterator":return TN(o,t);case"Constructor":return CN(o,t);case"Function":return MN(o,t);case"Intersect":return wN(o,t);case"Iterator":return ON(o,t);case"Not":return EN(o,t);case"Object":return PN(o,t);case"Promise":return FN(o,t);case"Record":return DN(o,t);case"Ref":return kN(o,t);case"This":return AN(o,t);case"Tuple":return LN(o,t);case"Union":return _N(o,t);default:return Ft(e)}}var Zv=new Set;function Zi(e,r){return Zv.clear(),Pr(e,r)}function vO(...e){let[r,t,o]=e.length===3?[e[0],e[1],e[2]]:[e[0],[],e[1]];if(!_e(r,t,o))throw new qp(r,o,Vi(r,t,o).First());return Zi(r,t)?ed(r,t,o):o}d();function Ws(e,r){let t=ve(e,"default")?e.default:void 0,o=$a(t)?t():qe(t);return Wt(r)?o:Ae(r)&&Ae(o)?Object.assign(o,r):r}function Xv(e){return za(e)&&"default"in e}function RN(e,r,t){let o=Ws(e,t);if(!we(o))return o;for(let n=0;n<o.length;n++)o[n]=qo(e.items,r,o[n]);return o}function BN(e,r,t){return uo(t)?t:Ws(e,t)}function NN(e,r,t){let o=Ws(e,t);return e.allOf.reduce((n,i)=>{let a=qo(i,r,o);return Ae(a)?{...n,...a}:a},{})}function jN(e,r,t){let o=Ws(e,t);if(!Ae(o))return o;let n=Object.getOwnPropertyNames(e.properties);for(let i of n){let a=qo(e.properties[i],r,o[i]);Wt(a)||(o[i]=qo(e.properties[i],r,o[i]))}if(!Xv(e.additionalProperties))return o;for(let i of Object.getOwnPropertyNames(o))n.includes(i)||(o[i]=qo(e.additionalProperties,r,o[i]));return o}function GN(e,r,t){let o=Ws(e,t);if(!Ae(o))return o;let n=e.additionalProperties,[i,a]=Object.entries(e.patternProperties)[0],l=new RegExp(i);for(let c of Object.getOwnPropertyNames(o))l.test(c)&&Xv(a)&&(o[c]=qo(a,r,o[c]));if(!Xv(n))return o;for(let c of Object.getOwnPropertyNames(o))l.test(c)||(o[c]=qo(n,r,o[c]));return o}function UN(e,r,t){return qo(Qe(e,r),r,Ws(e,t))}function VN(e,r,t){return qo(Qe(e,r),r,t)}function $N(e,r,t){let o=Ws(e,t);if(!we(o)||Wt(e.items))return o;let[n,i]=[e.items,Math.max(e.items.length,o.length)];for(let a=0;a<i;a++)a<n.length&&(o[a]=qo(n[a],r,o[a]));return o}function HN(e,r,t){let o=Ws(e,t);for(let n of e.anyOf){let i=qo(n,r,qe(o));if(_e(n,r,i))return i}return o}function qo(e,r,t){let o=xn(e,r),n=e;switch(n[U]){case"Array":return RN(n,o,t);case"Date":return BN(n,o,t);case"Intersect":return NN(n,o,t);case"Object":return jN(n,o,t);case"Record":return GN(n,o,t);case"Ref":return UN(n,o,t);case"This":return VN(n,o,t);case"Tuple":return $N(n,o,t);case"Union":return HN(n,o,t);default:return Ws(n,t)}}function ib(...e){return e.length===3?qo(e[0],e[1],e[2]):qo(e[0],[],e[1])}d();d();var Kn={};La(Kn,{Delete:()=>WN,Format:()=>Jm,Get:()=>XN,Has:()=>ZN,Set:()=>zN,ValuePointerRootDeleteError:()=>ab,ValuePointerRootSetError:()=>sb});d();var sb=class extends be{constructor(r,t,o){super("Cannot set root value"),this.value=r,this.path=t,this.update=o}},ab=class extends be{constructor(r,t){super("Cannot delete root value"),this.value=r,this.path=t}};function IO(e){return e.indexOf("~")===-1?e:e.replace(/~1/g,"/").replace(/~0/g,"~")}function*Jm(e){if(e==="")return;let[r,t]=[0,0];for(let o=0;o<e.length;o++)e.charAt(o)==="/"?(o===0||(t=o,yield IO(e.slice(r,t))),r=o+1):t=o;yield IO(e.slice(r))}function zN(e,r,t){if(r==="")throw new sb(e,r,t);let[o,n,i]=[null,e,""];for(let a of Jm(r))n[a]===void 0&&(n[a]={}),o=n,n=n[a],i=a;o[i]=t}function WN(e,r){if(r==="")throw new ab(e,r);let[t,o,n]=[null,e,""];for(let i of Jm(r)){if(o[i]===void 0||o[i]===null)return;t=o,o=o[i],n=i}if(Array.isArray(t)){let i=parseInt(n);t.splice(i,1)}else delete t[n]}function ZN(e,r){if(r==="")return!0;let[t,o,n]=[null,e,""];for(let i of Jm(r)){if(o[i]===void 0)return!1;t=o,o=o[i],n=i}return Object.getOwnPropertyNames(t).includes(n)}function XN(e,r){if(r==="")return e;let t=e;for(let o of Jm(r)){if(t[o]===void 0)return;t=t[o]}return t}d();function YN(e,r){if(!Ae(r))return!1;let t=[...Object.keys(e),...Object.getOwnPropertySymbols(e)],o=[...Object.keys(r),...Object.getOwnPropertySymbols(r)];return t.length!==o.length?!1:t.every(n=>Ql(e[n],r[n]))}function JN(e,r){return uo(r)&&e.getTime()===r.getTime()}function KN(e,r){return!we(r)||e.length!==r.length?!1:e.every((t,o)=>Ql(t,r[o]))}function QN(e,r){return!un(r)||e.length!==r.length||Object.getPrototypeOf(e).constructor.name!==Object.getPrototypeOf(r).constructor.name?!1:e.every((t,o)=>Ql(t,r[o]))}function qN(e,r){return e===r}function Ql(e,r){if(uo(e))return JN(e,r);if(un(e))return QN(e,r);if(we(e))return KN(e,r);if(Ae(e))return YN(e,r);if(Gr(e))return qN(e,r);throw new Error("ValueEquals: Unable to compare value")}var ej=It({type:at("insert"),path:fn(),value:$s()}),tj=It({type:at("update"),path:fn(),value:$s()}),rj=It({type:at("delete"),path:fn()}),TO=ht([ej,tj,rj]),lb=class extends be{constructor(r,t){super(t),this.value=r}};function cb(e,r){return{type:"update",path:e,value:r}}function CO(e,r){return{type:"insert",path:e,value:r}}function MO(e){return{type:"delete",path:e}}function SO(e){if(globalThis.Object.getOwnPropertySymbols(e).length>0)throw new lb(e,"Cannot diff objects with symbols")}function*oj(e,r,t){if(SO(r),SO(t),!K0(t))return yield cb(e,t);let o=globalThis.Object.getOwnPropertyNames(r),n=globalThis.Object.getOwnPropertyNames(t);for(let i of n)ve(r,i)||(yield CO(`${e}/${i}`,t[i]));for(let i of o)ve(t,i)&&(Ql(r,t)||(yield*pb(`${e}/${i}`,r[i],t[i])));for(let i of o)ve(t,i)||(yield MO(`${e}/${i}`))}function*nj(e,r,t){if(!we(t))return yield cb(e,t);for(let o=0;o<Math.min(r.length,t.length);o++)yield*pb(`${e}/${o}`,r[o],t[o]);for(let o=0;o<t.length;o++)o<r.length||(yield CO(`${e}/${o}`,t[o]));for(let o=r.length-1;o>=0;o--)o<t.length||(yield MO(`${e}/${o}`))}function*ij(e,r,t){if(!un(t)||r.length!==t.length||globalThis.Object.getPrototypeOf(r).constructor.name!==globalThis.Object.getPrototypeOf(t).constructor.name)return yield cb(e,t);for(let o=0;o<Math.min(r.length,t.length);o++)yield*pb(`${e}/${o}`,r[o],t[o])}function*sj(e,r,t){r!==t&&(yield cb(e,t))}function*pb(e,r,t){if(K0(r))return yield*oj(e,r,t);if(we(r))return yield*nj(e,r,t);if(un(r))return yield*ij(e,r,t);if(Gr(r))return yield*sj(e,r,t);throw new lb(r,"Unable to diff value")}function wO(e,r){return[...pb("",e,r)]}function aj(e){return e.length>0&&e[0].path===""&&e[0].type==="update"}function lj(e){return e.length===0}function OO(e,r){if(aj(r))return qe(r[0].value);if(lj(r))return qe(e);let t=qe(e);for(let o of r)switch(o.type){case"insert":{Kn.Set(t,o.path,o.value);break}case"update":{Kn.Set(t,o.path,o.value);break}case"delete":{Kn.Delete(t,o.path);break}}return t}d();function EO(...e){let[r,t,o]=e.length===3?[e[0],e[1],e[2]]:[e[0],[],e[1]],n=Zi(r,t)?nb(r,t,o):o;if(!_e(r,t,n))throw new td(r,n,Vi(r,t,n).First());return n}d();var db=class extends be{constructor(r){super(r)}};function cj(e,r,t,o){if(!Ae(t))Kn.Set(e,r,qe(o));else{let n=Object.getOwnPropertyNames(t),i=Object.getOwnPropertyNames(o);for(let a of n)i.includes(a)||delete t[a];for(let a of i)n.includes(a)||(t[a]=null);for(let a of i)Yv(e,`${r}/${a}`,t[a],o[a])}}function pj(e,r,t,o){if(!we(t))Kn.Set(e,r,qe(o));else{for(let n=0;n<o.length;n++)Yv(e,`${r}/${n}`,t[n],o[n]);t.splice(o.length)}}function dj(e,r,t,o){if(un(t)&&t.length===o.length)for(let n=0;n<t.length;n++)t[n]=o[n];else Kn.Set(e,r,qe(o))}function uj(e,r,t,o){t!==o&&Kn.Set(e,r,o)}function Yv(e,r,t,o){if(we(o))return pj(e,r,t,o);if(un(o))return dj(e,r,t,o);if(Ae(o))return cj(e,r,t,o);if(Gr(o))return uj(e,r,t,o)}function PO(e){return un(e)||Gr(e)}function mj(e,r){return Ae(e)&&we(r)||we(e)&&Ae(r)}function FO(e,r){if(PO(e)||PO(r))throw new db("Only object and array types can be mutated at the root level");if(mj(e,r))throw new db("Cannot assign due type mismatch of assignable values");Yv(e,"",e,r)}d();var fj=[(e,r,t)=>qe(t),(e,r,t)=>ib(e,r,t),(e,r,t)=>tb(e,r,t),(e,r,t)=>ob(e,r,t),(e,r,t)=>(qy(e,r,t),t),(e,r,t)=>Zi(e,r)?ed(e,r,t):t];function DO(e,r,t){return fj.reduce((o,n)=>n(e,r,o),t)}function kO(...e){return e.length===3?DO(e[0],e[1],e[2]):DO(e[0],[],e[1])}d();var Qn={};La(Qn,{Assert:()=>qy,Cast:()=>Wv,Check:()=>_e,Clean:()=>tb,Clone:()=>qe,Convert:()=>ob,Create:()=>In,Decode:()=>vO,Default:()=>ib,Diff:()=>wO,Edit:()=>TO,Encode:()=>EO,Equal:()=>Ql,Errors:()=>Vi,Hash:()=>Ka,Mutate:()=>FO,Parse:()=>kO,Patch:()=>OO,ValueErrorIterator:()=>vn});d();d();var AO={},hj=function(e,r,t,o,n){var i=new Worker(AO[r]||(AO[r]=URL.createObjectURL(new Blob([e+';addEventListener("error",function(e){e=e.error;postMessage({$e$:[e.message,e.code,e.stack]})})'],{type:"text/javascript"}))));return i.onmessage=function(a){var l=a.data,c=l.$e$;if(c){var p=new Error(c[0]);p.code=c[1],p.stack=c[2],n(p,null)}else n(null,l)},i.postMessage(t,o),i},St=Uint8Array,ho=Uint16Array,ef=Int32Array,sd=new St([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]),ad=new St([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]),Km=new St([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),RO=function(e,r){for(var t=new ho(31),o=0;o<31;++o)t[o]=r+=1<<e[o-1];for(var n=new ef(t[30]),o=1;o<30;++o)for(var i=t[o];i<t[o+1];++i)n[i]=i-t[o]<<5|o;return{b:t,r:n}},BO=RO(sd,2),tI=BO.b,gb=BO.r;tI[28]=258,gb[258]=28;var NO=RO(ad,0),jO=NO.b,Kv=NO.r,Qm=new ho(32768);for(lt=0;lt<32768;++lt)Zs=(lt&43690)>>1|(lt&21845)<<1,Zs=(Zs&52428)>>2|(Zs&13107)<<2,Zs=(Zs&61680)>>4|(Zs&3855)<<4,Qm[lt]=((Zs&65280)>>8|(Zs&255)<<8)>>1;var Zs,lt,Tn=function(e,r,t){for(var o=e.length,n=0,i=new ho(r);n<o;++n)e[n]&&++i[e[n]-1];var a=new ho(r);for(n=1;n<r;++n)a[n]=a[n-1]+i[n-1]<<1;var l;if(t){l=new ho(1<<r);var c=15-r;for(n=0;n<o;++n)if(e[n])for(var p=n<<4|e[n],u=r-e[n],f=a[e[n]-1]++<<u,h=f|(1<<u)-1;f<=h;++f)l[Qm[f]>>c]=p}else for(l=new ho(o),n=0;n<o;++n)e[n]&&(l[n]=Qm[a[e[n]-1]++]>>15-e[n]);return l},Xs=new St(288);for(lt=0;lt<144;++lt)Xs[lt]=8;var lt;for(lt=144;lt<256;++lt)Xs[lt]=9;var lt;for(lt=256;lt<280;++lt)Xs[lt]=7;var lt;for(lt=280;lt<288;++lt)Xs[lt]=8;var lt,nd=new St(32);for(lt=0;lt<32;++lt)nd[lt]=5;var lt,GO=Tn(Xs,9,0),UO=Tn(Xs,9,1),VO=Tn(nd,5,0),$O=Tn(nd,5,1),mb=function(e){for(var r=e[0],t=1;t<e.length;++t)e[t]>r&&(r=e[t]);return r},Sn=function(e,r,t){var o=r/8|0;return(e[o]|e[o+1]<<8)>>(r&7)&t},fb=function(e,r){var t=r/8|0;return(e[t]|e[t+1]<<8|e[t+2]<<16)>>(r&7)},tf=function(e){return(e+7)/8|0},Qa=function(e,r,t){return(r==null||r<0)&&(r=0),(t==null||t>e.length)&&(t=e.length),new St(e.subarray(r,t))},vb={UnexpectedEOF:0,InvalidBlockType:1,InvalidLengthLiteral:2,InvalidDistance:3,StreamFinished:4,NoStreamHandler:5,InvalidHeader:6,NoCallback:7,InvalidUTF8:8,ExtraFieldTooLong:9,InvalidDate:10,FilenameTooLong:11,StreamFinishing:12,InvalidZipData:13,UnknownCompressionMethod:14},HO=["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"],Xt=function(e,r,t){var o=new Error(r||HO[e]);if(o.code=e,Error.captureStackTrace&&Error.captureStackTrace(o,Xt),!t)throw o;return o},zO=function(e,r,t,o){var n=e.length,i=o?o.length:0;if(!n||r.f&&!r.l)return t||new St(0);var a=!t,l=a||r.i!=2,c=r.i;a&&(t=new St(n*3));var p=function(P){var q=t.length;if(P>q){var K=new St(Math.max(q*2,P));K.set(t),t=K}},u=r.f||0,f=r.p||0,h=r.b||0,b=r.l,x=r.d,T=r.m,v=r.n,I=n*8;do{if(!b){u=Sn(e,f,1);var M=Sn(e,f+1,3);if(f+=3,M)if(M==1)b=UO,x=$O,T=9,v=5;else if(M==2){var _=Sn(e,f,31)+257,G=Sn(e,f+10,15)+4,R=_+Sn(e,f+5,31)+1;f+=14;for(var N=new St(R),X=new St(19),z=0;z<G;++z)X[Km[z]]=Sn(e,f+z*3,7);f+=G*3;for(var ee=mb(X),re=(1<<ee)-1,ue=Tn(X,ee,1),z=0;z<R;){var Ce=ue[Sn(e,f,re)];f+=Ce&15;var O=Ce>>4;if(O<16)N[z++]=O;else{var Oe=0,Pe=0;for(O==16?(Pe=3+Sn(e,f,3),f+=2,Oe=N[z-1]):O==17?(Pe=3+Sn(e,f,7),f+=3):O==18&&(Pe=11+Sn(e,f,127),f+=7);Pe--;)N[z++]=Oe}}var Fe=N.subarray(0,_),ce=N.subarray(_);T=mb(Fe),v=mb(ce),b=Tn(Fe,T,1),x=Tn(ce,v,1)}else Xt(1);else{var O=tf(f)+4,C=e[O-4]|e[O-3]<<8,E=O+C;if(E>n){c&&Xt(0);break}l&&p(h+C),t.set(e.subarray(O,E),h),r.b=h+=C,r.p=f=E*8,r.f=u;continue}if(f>I){c&&Xt(0);break}}l&&p(h+131072);for(var Ee=(1<<T)-1,ye=(1<<v)-1,Ge=f;;Ge=f){var Oe=b[fb(e,f)&Ee],Ie=Oe>>4;if(f+=Oe&15,f>I){c&&Xt(0);break}if(Oe||Xt(2),Ie<256)t[h++]=Ie;else if(Ie==256){Ge=f,b=null;break}else{var Xe=Ie-254;if(Ie>264){var z=Ie-257,se=sd[z];Xe=Sn(e,f,(1<<se)-1)+tI[z],f+=se}var nt=x[fb(e,f)&ye],dt=nt>>4;nt||Xt(3),f+=nt&15;var ce=jO[dt];if(dt>3){var se=ad[dt];ce+=fb(e,f)&(1<<se)-1,f+=se}if(f>I){c&&Xt(0);break}l&&p(h+131072);var $t=h+Xe;if(h<ce){var k=i-ce,H=Math.min(ce,$t);for(k+h<0&&Xt(3);h<H;++h)t[h]=o[k+h]}for(;h<$t;++h)t[h]=t[h-ce]}}r.l=b,r.p=Ge,r.b=h,r.f=u,b&&(u=1,r.m=T,r.d=x,r.n=v)}while(!u);return h!=t.length&&a?Qa(t,0,h):t.subarray(0,h)},Xi=function(e,r,t){t<<=r&7;var o=r/8|0;e[o]|=t,e[o+1]|=t>>8},rd=function(e,r,t){t<<=r&7;var o=r/8|0;e[o]|=t,e[o+1]|=t>>8,e[o+2]|=t>>16},hb=function(e,r){for(var t=[],o=0;o<e.length;++o)e[o]&&t.push({s:o,f:e[o]});var n=t.length,i=t.slice();if(!n)return{t:oI,l:0};if(n==1){var a=new St(t[0].s+1);return a[t[0].s]=1,{t:a,l:1}}t.sort(function(E,_){return E.f-_.f}),t.push({s:-1,f:25001});var l=t[0],c=t[1],p=0,u=1,f=2;for(t[0]={s:-1,f:l.f+c.f,l,r:c};u!=n-1;)l=t[t[p].f<t[f].f?p++:f++],c=t[p!=u&&t[p].f<t[f].f?p++:f++],t[u++]={s:-1,f:l.f+c.f,l,r:c};for(var h=i[0].s,o=1;o<n;++o)i[o].s>h&&(h=i[o].s);var b=new ho(h+1),x=yb(t[u-1],b,0);if(x>r){var o=0,T=0,v=x-r,I=1<<v;for(i.sort(function(_,G){return b[G.s]-b[_.s]||_.f-G.f});o<n;++o){var M=i[o].s;if(b[M]>r)T+=I-(1<<x-b[M]),b[M]=r;else break}for(T>>=v;T>0;){var O=i[o].s;b[O]<r?T-=1<<r-b[O]++-1:++o}for(;o>=0&&T;--o){var C=i[o].s;b[C]==r&&(--b[C],++T)}x=r}return{t:new St(b),l:x}},yb=function(e,r,t){return e.s==-1?Math.max(yb(e.l,r,t+1),yb(e.r,r,t+1)):r[e.s]=t},Qv=function(e){for(var r=e.length;r&&!e[--r];);for(var t=new ho(++r),o=0,n=e[0],i=1,a=function(c){t[o++]=c},l=1;l<=r;++l)if(e[l]==n&&l!=r)++i;else{if(!n&&i>2){for(;i>138;i-=138)a(32754);i>2&&(a(i>10?i-11<<5|28690:i-3<<5|12305),i=0)}else if(i>3){for(a(n),--i;i>6;i-=6)a(8304);i>2&&(a(i-3<<5|8208),i=0)}for(;i--;)a(n);i=1,n=e[l]}return{c:t.subarray(0,o),n:r}},od=function(e,r){for(var t=0,o=0;o<r.length;++o)t+=e[o]*r[o];return t},rI=function(e,r,t){var o=t.length,n=tf(r+2);e[n]=o&255,e[n+1]=o>>8,e[n+2]=e[n]^255,e[n+3]=e[n+1]^255;for(var i=0;i<o;++i)e[n+i+4]=t[i];return(n+4+o)*8},qv=function(e,r,t,o,n,i,a,l,c,p,u){Xi(r,u++,t),++n[256];for(var f=hb(n,15),h=f.t,b=f.l,x=hb(i,15),T=x.t,v=x.l,I=Qv(h),M=I.c,O=I.n,C=Qv(T),E=C.c,_=C.n,G=new ho(19),R=0;R<M.length;++R)++G[M[R]&31];for(var R=0;R<E.length;++R)++G[E[R]&31];for(var N=hb(G,7),X=N.t,z=N.l,ee=19;ee>4&&!X[Km[ee-1]];--ee);var re=p+5<<3,ue=od(n,Xs)+od(i,nd)+a,Ce=od(n,h)+od(i,T)+a+14+3*ee+od(G,X)+2*G[16]+3*G[17]+7*G[18];if(c>=0&&re<=ue&&re<=Ce)return rI(r,u,e.subarray(c,c+p));var Oe,Pe,Fe,ce;if(Xi(r,u,1+(Ce<ue)),u+=2,Ce<ue){Oe=Tn(h,b,0),Pe=h,Fe=Tn(T,v,0),ce=T;var Ee=Tn(X,z,0);Xi(r,u,O-257),Xi(r,u+5,_-1),Xi(r,u+10,ee-4),u+=14;for(var R=0;R<ee;++R)Xi(r,u+3*R,X[Km[R]]);u+=3*ee;for(var ye=[M,E],Ge=0;Ge<2;++Ge)for(var Ie=ye[Ge],R=0;R<Ie.length;++R){var Xe=Ie[R]&31;Xi(r,u,Ee[Xe]),u+=X[Xe],Xe>15&&(Xi(r,u,Ie[R]>>5&127),u+=Ie[R]>>12)}}else Oe=GO,Pe=Xs,Fe=VO,ce=nd;for(var R=0;R<l;++R){var se=o[R];if(se>255){var Xe=se>>18&31;rd(r,u,Oe[Xe+257]),u+=Pe[Xe+257],Xe>7&&(Xi(r,u,se>>23&31),u+=sd[Xe]);var nt=se&31;rd(r,u,Fe[nt]),u+=ce[nt],nt>3&&(rd(r,u,se>>5&8191),u+=ad[nt])}else rd(r,u,Oe[se]),u+=Pe[se]}return rd(r,u,Oe[256]),u+Pe[256]},WO=new ef([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),oI=new St(0),ZO=function(e,r,t,o,n,i){var a=i.z||e.length,l=new St(o+a+5*(1+Math.ceil(a/7e3))+n),c=l.subarray(o,l.length-n),p=i.l,u=(i.r||0)&7;if(r){u&&(c[0]=i.r>>3);for(var f=WO[r-1],h=f>>13,b=f&8191,x=(1<<t)-1,T=i.p||new ho(32768),v=i.h||new ho(x+1),I=Math.ceil(t/3),M=2*I,O=function(Q){return(e[Q]^e[Q+1]<<I^e[Q+2]<<M)&x},C=new ef(25e3),E=new ho(288),_=new ho(32),G=0,R=0,N=i.i||0,X=0,z=i.w||0,ee=0;N+2<a;++N){var re=O(N),ue=N&32767,Ce=v[re];if(T[ue]=Ce,v[re]=ue,z<=N){var Oe=a-N;if((G>7e3||X>24576)&&(Oe>423||!p)){u=qv(e,c,0,C,E,_,R,X,ee,N-ee,u),X=G=R=0,ee=N;for(var Pe=0;Pe<286;++Pe)E[Pe]=0;for(var Pe=0;Pe<30;++Pe)_[Pe]=0}var Fe=2,ce=0,Ee=b,ye=ue-Ce&32767;if(Oe>2&&re==O(N-ye))for(var Ge=Math.min(h,Oe)-1,Ie=Math.min(32767,N),Xe=Math.min(258,Oe);ye<=Ie&&--Ee&&ue!=Ce;){if(e[N+Fe]==e[N+Fe-ye]){for(var se=0;se<Xe&&e[N+se]==e[N+se-ye];++se);if(se>Fe){if(Fe=se,ce=ye,se>Ge)break;for(var nt=Math.min(ye,se-2),dt=0,Pe=0;Pe<nt;++Pe){var $t=N-ye+Pe&32767,k=T[$t],H=$t-k&32767;H>dt&&(dt=H,Ce=$t)}}}ue=Ce,Ce=T[ue],ye+=ue-Ce&32767}if(ce){C[X++]=268435456|gb[Fe]<<18|Kv[ce];var P=gb[Fe]&31,q=Kv[ce]&31;R+=sd[P]+ad[q],++E[257+P],++_[q],z=N+Fe,++G}else C[X++]=e[N],++E[e[N]]}}for(N=Math.max(N,z);N<a;++N)C[X++]=e[N],++E[e[N]];u=qv(e,c,p,C,E,_,R,X,ee,N-ee,u),p||(i.r=u&7|c[u/8|0]<<3,u-=7,i.h=v,i.p=T,i.i=N,i.w=z)}else{for(var N=i.w||0;N<a+p;N+=65535){var K=N+65535;K>=a&&(c[u/8|0]=p,K=a),u=rI(c,u+1,e.subarray(N,K))}i.i=a}return Qa(l,0,o+tf(u)+n)},gj=function(){for(var e=new Int32Array(256),r=0;r<256;++r){for(var t=r,o=9;--o;)t=(t&1&&-306674912)^t>>>1;e[r]=t}return e}(),XO=function(){var e=-1;return{p:function(r){for(var t=e,o=0;o<r.length;++o)t=gj[t&255^r[o]]^t>>>8;e=t},d:function(){return~e}}};var YO=function(e,r,t,o,n){if(!n&&(n={l:1},r.dictionary)){var i=r.dictionary.subarray(-32768),a=new St(i.length+e.length);a.set(i),a.set(e,i.length),e=a,n.w=i.length}return ZO(e,r.level==null?6:r.level,r.mem==null?n.l?Math.ceil(Math.max(8,Math.min(13,Math.log(e.length)))*1.5):20:12+r.mem,t,o,n)},Ib=function(e,r){var t={};for(var o in e)t[o]=e[o];for(var o in r)t[o]=r[o];return t},LO=function(e,r,t){for(var o=e(),n=e.toString(),i=n.slice(n.indexOf("[")+1,n.lastIndexOf("]")).replace(/\s+/g,"").split(","),a=0;a<o.length;++a){var l=o[a],c=i[a];if(typeof l=="function"){r+=";"+c+"=";var p=l.toString();if(l.prototype)if(p.indexOf("[native code]")!=-1){var u=p.indexOf(" ",8)+1;r+=p.slice(u,p.indexOf("(",u))}else{r+=p;for(var f in l.prototype)r+=";"+c+".prototype."+f+"="+l.prototype[f].toString()}else r+=p}else t[c]=l}return r},ub=[],yj=function(e){var r=[];for(var t in e)e[t].buffer&&r.push((e[t]=new e[t].constructor(e[t])).buffer);return r},bj=function(e,r,t,o){if(!ub[t]){for(var n="",i={},a=e.length-1,l=0;l<a;++l)n=LO(e[l],n,i);ub[t]={c:LO(e[a],n,i),e:i}}var c=Ib({},ub[t].e);return hj(ub[t].c+";onmessage=function(e){for(var k in e.data)self[k]=e.data[k];onmessage="+r.toString()+"}",t,c,yj(c),o)},xj=function(){return[St,ho,ef,sd,ad,Km,tI,jO,UO,$O,Qm,HO,Tn,mb,Sn,fb,tf,Qa,Xt,zO,Cb,Sb,JO]},vj=function(){return[St,ho,ef,sd,ad,Km,gb,Kv,GO,Xs,VO,nd,Qm,WO,oI,Tn,Xi,rd,hb,yb,Qv,od,rI,qv,tf,Qa,ZO,YO,Tb,Sb]};var Sb=function(e){return postMessage(e,[e.buffer])},JO=function(e){return e&&{out:e.size&&new St(e.size),dictionary:e.dictionary}},KO=function(e,r,t,o,n,i){var a=bj(t,o,n,function(l,c){a.terminate(),i(l,c)});return a.postMessage([e,r],r.consume?[e.buffer]:[]),function(){a.terminate()}};var qn=function(e,r){return e[r]|e[r+1]<<8},zr=function(e,r){return(e[r]|e[r+1]<<8|e[r+2]<<16|e[r+3]<<24)>>>0},Jv=function(e,r){return zr(e,r)+zr(e,r+4)*4294967296},Hr=function(e,r,t){for(;t;++r)e[r]=t,t>>>=8};function Ij(e,r,t){return t||(t=r,r={}),typeof t!="function"&&Xt(7),KO(e,r,[vj],function(o){return Sb(Tb(o.data[0],o.data[1]))},0,t)}function Tb(e,r){return YO(e,r||{},0,0)}function Sj(e,r,t){return t||(t=r,r={}),typeof t!="function"&&Xt(7),KO(e,r,[xj],function(o){return Sb(Cb(o.data[0],JO(o.data[1])))},1,t)}function Cb(e,r){return zO(e,{i:2},r&&r.out,r&&r.dictionary)}var nI=function(e,r,t,o){for(var n in e){var i=e[n],a=r+n,l=o;Array.isArray(i)&&(l=Ib(o,i[1]),i=i[0]),i instanceof St?t[a]=[i,l]:(t[a+="/"]=[new St(0),l],nI(i,a,t,o))}},_O=typeof TextEncoder<"u"&&new TextEncoder,eI=typeof TextDecoder<"u"&&new TextDecoder,Tj=0;try{eI.decode(oI,{stream:!0}),Tj=1}catch{}var Cj=function(e){for(var r="",t=0;;){var o=e[t++],n=(o>127)+(o>223)+(o>239);if(t+n>e.length)return{s:r,r:Qa(e,t-1)};n?n==3?(o=((o&15)<<18|(e[t++]&63)<<12|(e[t++]&63)<<6|e[t++]&63)-65536,r+=String.fromCharCode(55296|o>>10,56320|o&1023)):n&1?r+=String.fromCharCode((o&31)<<6|e[t++]&63):r+=String.fromCharCode((o&15)<<12|(e[t++]&63)<<6|e[t++]&63):r+=String.fromCharCode(o)}};function id(e,r){if(r){for(var t=new St(e.length),o=0;o<e.length;++o)t[o]=e.charCodeAt(o);return t}if(_O)return _O.encode(e);for(var n=e.length,i=new St(e.length+(e.length>>1)),a=0,l=function(u){i[a++]=u},o=0;o<n;++o){if(a+5>i.length){var c=new St(a+8+(n-o<<1));c.set(i),i=c}var p=e.charCodeAt(o);p<128||r?l(p):p<2048?(l(192|p>>6),l(128|p&63)):p>55295&&p<57344?(p=65536+(p&1047552)|e.charCodeAt(++o)&1023,l(240|p>>18),l(128|p>>12&63),l(128|p>>6&63),l(128|p&63)):(l(224|p>>12),l(128|p>>6&63),l(128|p&63))}return Qa(i,0,a)}function iI(e,r){if(r){for(var t="",o=0;o<e.length;o+=16384)t+=String.fromCharCode.apply(null,e.subarray(o,o+16384));return t}else{if(eI)return eI.decode(e);var n=Cj(e),i=n.s,t=n.r;return t.length&&Xt(8),i}}var QO=function(e,r){return r+30+qn(e,r+26)+qn(e,r+28)},qO=function(e,r,t){var o=qn(e,r+28),n=iI(e.subarray(r+46,r+46+o),!(qn(e,r+8)&2048)),i=r+46+o,a=zr(e,r+20),l=t&&a==4294967295?Mj(e,i):[a,zr(e,r+24),zr(e,r+42)],c=l[0],p=l[1],u=l[2];return[qn(e,r+10),c,p,n,i+qn(e,r+30)+qn(e,r+32),u]},Mj=function(e,r){for(;qn(e,r)!=1;r+=4+qn(e,r+2));return[Jv(e,r+12),Jv(e,r+4),Jv(e,r+20)]},qm=function(e){var r=0;if(e)for(var t in e){var o=e[t].length;o>65535&&Xt(9),r+=o+4}return r},bb=function(e,r,t,o,n,i,a,l){var c=o.length,p=t.extra,u=l&&l.length,f=qm(p);Hr(e,r,a!=null?33639248:67324752),r+=4,a!=null&&(e[r++]=20,e[r++]=t.os),e[r]=20,r+=2,e[r++]=t.flag<<1|(i<0&&8),e[r++]=n&&8,e[r++]=t.compression&255,e[r++]=t.compression>>8;var h=new Date(t.mtime==null?Date.now():t.mtime),b=h.getFullYear()-1980;if((b<0||b>119)&&Xt(10),Hr(e,r,b<<25|h.getMonth()+1<<21|h.getDate()<<16|h.getHours()<<11|h.getMinutes()<<5|h.getSeconds()>>1),r+=4,i!=-1&&(Hr(e,r,t.crc),Hr(e,r+4,i<0?-i-2:i),Hr(e,r+8,t.size)),Hr(e,r+12,c),Hr(e,r+14,f),r+=16,a!=null&&(Hr(e,r,u),Hr(e,r+6,t.attrs),Hr(e,r+10,a),r+=14),e.set(o,r),r+=c,f)for(var x in p){var T=p[x],v=T.length;Hr(e,r,+x),Hr(e,r+2,v),e.set(T,r+4),r+=4+v}return u&&(e.set(l,r),r+=u),r},eE=function(e,r,t,o,n){Hr(e,r,101010256),Hr(e,r+8,t),Hr(e,r+10,t),Hr(e,r+12,o),Hr(e,r+16,n)};function tE(e,r,t){t||(t=r,r={}),typeof t!="function"&&Xt(7);var o={};nI(e,"",o,r);var n=Object.keys(o),i=n.length,a=0,l=0,c=i,p=new Array(i),u=[],f=function(){for(var v=0;v<u.length;++v)u[v]()},h=function(v,I){xb(function(){t(v,I)})};xb(function(){h=t});var b=function(){var v=new St(l+22),I=a,M=l-a;l=0;for(var O=0;O<c;++O){var C=p[O];try{var E=C.c.length;bb(v,l,C,C.f,C.u,E);var _=30+C.f.length+qm(C.extra),G=l+_;v.set(C.c,G),bb(v,a,C,C.f,C.u,E,l,C.m),a+=16+_+(C.m?C.m.length:0),l=G+E}catch(R){return h(R,null)}}eE(v,a,p.length,M,I),h(null,v)};i||b();for(var x=function(v){var I=n[v],M=o[I],O=M[0],C=M[1],E=XO(),_=O.length;E.p(O);var G=id(I),R=G.length,N=C.comment,X=N&&id(N),z=X&&X.length,ee=qm(C.extra),re=C.level==0?0:8,ue=function(Ce,Oe){if(Ce)f(),h(Ce,null);else{var Pe=Oe.length;p[v]=Ib(C,{size:_,crc:E.d(),c:Oe,f:G,m:X,u:R!=I.length||X&&N.length!=z,compression:re}),a+=30+R+ee+Pe,l+=76+2*(R+ee)+(z||0)+Pe,--i||b()}};if(R>65535&&ue(Xt(11,0,1),null),!re)ue(null,O);else if(_<16e4)try{ue(null,Tb(O,C))}catch(Ce){ue(Ce,null)}else u.push(Ij(O,C,ue))},T=0;T<c;++T)x(T);return f}function rE(e,r){r||(r={});var t={},o=[];nI(e,"",t,r);var n=0,i=0;for(var a in t){var l=t[a],c=l[0],p=l[1],u=p.level==0?0:8,f=id(a),h=f.length,b=p.comment,x=b&&id(b),T=x&&x.length,v=qm(p.extra);h>65535&&Xt(11);var I=u?Tb(c,p):c,M=I.length,O=XO();O.p(c),o.push(Ib(p,{size:c.length,crc:O.d(),c:I,f,m:x,u:h!=a.length||x&&b.length!=T,o:n,compression:u})),n+=30+h+v+M,i+=76+2*(h+v)+(T||0)+M}for(var C=new St(i+22),E=n,_=i-n,G=0;G<o.length;++G){var f=o[G];bb(C,f.o,f,f.f,f.u,f.c.length);var R=30+f.f.length+qm(f.extra);C.set(f.c,f.o+R),bb(C,n,f,f.f,f.u,f.c.length,f.o,f.m),n+=16+R+(f.m?f.m.length:0)}return eE(C,n,o.length,_,E),C}var xb=typeof queueMicrotask=="function"?queueMicrotask:typeof setTimeout=="function"?setTimeout:function(e){e()};function oE(e,r,t){t||(t=r,r={}),typeof t!="function"&&Xt(7);var o=[],n=function(){for(var v=0;v<o.length;++v)o[v]()},i={},a=function(v,I){xb(function(){t(v,I)})};xb(function(){a=t});for(var l=e.length-22;zr(e,l)!=101010256;--l)if(!l||e.length-l>65558)return a(Xt(13,0,1),null),n;var c=qn(e,l+8);if(c){var p=c,u=zr(e,l+16),f=u==4294967295||p==65535;if(f){var h=zr(e,l-12);f=zr(e,h)==101075792,f&&(p=c=zr(e,h+32),u=zr(e,h+48))}for(var b=r&&r.filter,x=function(v){var I=qO(e,u,f),M=I[0],O=I[1],C=I[2],E=I[3],_=I[4],G=I[5],R=QO(e,G);u=_;var N=function(z,ee){z?(n(),a(z,null)):(ee&&(i[E]=ee),--c||a(null,i))};if(!b||b({name:E,size:O,originalSize:C,compression:M}))if(!M)N(null,Qa(e,R,R+O));else if(M==8){var X=e.subarray(R,R+O);if(C<524288||O>.8*C)try{N(null,Cb(X,{out:new St(C)}))}catch(z){N(z,null)}else o.push(Sj(X,{size:C},N))}else N(Xt(14,"unknown compression type "+M,1),null);else N(null,null)},T=0;T<p;++T)x(T)}else a(null,{});return n}function nE(e,r){for(var t={},o=e.length-22;zr(e,o)!=101010256;--o)(!o||e.length-o>65558)&&Xt(13);var n=qn(e,o+8);if(!n)return{};var i=zr(e,o+16),a=i==4294967295||n==65535;if(a){var l=zr(e,o-12);a=zr(e,l)==101075792,a&&(n=zr(e,l+32),i=zr(e,l+48))}for(var c=r&&r.filter,p=0;p<n;++p){var u=qO(e,i,a),f=u[0],h=u[1],b=u[2],x=u[3],T=u[4],v=u[5],I=QO(e,v);i=T,(!c||c({name:x,size:h,originalSize:b,compression:f}))&&(f?f==8?t[x]=Cb(e.subarray(I,I+h),{out:new St(b)}):Xt(14,"unknown compression type "+f):t[x]=Qa(e,I,I+h))}return t}d();var wj=e=>{if(e!=null)return e.trim()===""?void 0:e},Oj=e=>e!=null,Mb=(e,r,t=0)=>{if(D.IsNull(e))return"null";if(D.IsUndefined(e))return"undefined";if(D.IsString(e))return"<string>";if(D.IsNumber(e))return"<number>";if(D.IsBoolean(e))return"<boolean>";if(D.IsLiteral(e))return typeof e.const=="string"?`'${e.const}'`:`${e.const}`;if(D.IsRef(e)){let o=r.find(n=>n.$id===e.$ref);return o==null?e.$ref:Mb(o,r,t)}if(D.IsArray(e))return`${Mb(e.items,r,t+1)}[]`;if(D.IsUnion(e)&&(!(e.anyOf.length>5)||e.$id==null)){let n=`${e.anyOf.map(i=>Mb(i,r,t+1)).filter(Oj).join(" | ")}`;return t>0?`(${n})`:n}return e.$id??""},Ej=(e,r,t)=>{let o=r.message;return D.IsUnion(r.schema)&&(o=`Expected one of: ${Mb(r.schema,t)}`),`${`#/definitions/${e}${wj(r.path)??""}`}: ${o}`},wb=(e,r,t)=>{let o=r.First();if(o!=null)return Ej(e,o,t)};var ld;(function(e){e.Archive="Archive",e.Validate="Validate",e.Encode="Encode",e.Unknown="Unknown"})(ld||(ld={}));var cd=class extends Error{constructor(t,o){super(o);m(this,"name");m(this,"kind");this.name="CompressError",this.kind=t}},Pj=e=>new cd(ld.Archive,e.message),Fj=e=>{let r=Object.values(vb);return e instanceof Error&&"code"in e&&typeof e.code=="number"&&r.includes(e.code)},Dj=(e,r,t)=>new cd(ld.Validate,wb(e,r,t)??"Unknown validate error"),kj=e=>new cd(ld.Encode,e.message),Aj=e=>new cd(ld.Unknown,e instanceof Error?e.message:String(e)),rf=(e,r,t)=>r instanceof Kl?kj(r):r instanceof vn?Dj(e,r,t):Fj(r)?Pj(r):Aj(r);d();var pd;(function(e){e.Unarchive="Unarchive",e.Validate="Validate",e.Decode="Decode",e.Unknown="Unknown"})(pd||(pd={}));var dd=class extends Error{constructor(t,o){super(o);m(this,"name");m(this,"kind");this.name="DecompressError",this.kind=t}},Lj=e=>new dd(pd.Unarchive,e.message),_j=e=>{let r=Object.values(vb);return e instanceof Error&&"code"in e&&typeof e.code=="number"&&r.includes(e.code)},Rj=(e,r,t)=>new dd(pd.Validate,wb(e,r,t)??"Unknown validate error"),Bj=e=>new dd(pd.Decode,e.message),Nj=e=>new dd(pd.Unknown,e instanceof Error?e.message:String(e)),of=(e,r,t)=>r instanceof Jl?Bj(r):r instanceof vn?Rj(e,r,t):_j(r)?Lj(r):Nj(r);var iE=function*(e,r=""){if(e!=null){if(Array.isArray(e)){for(let t=0;t<e.length;t++)yield[r+`[${t}]`,e[t]];return}if("features"in e){for(let t=0;t<e.features.length;t++)yield[r===""?`features[${t}]`:`${r}.features[${t}]`,e.features[t]];return}for(let[t,o]of Object.entries(e)){let n=r===""?t:`${r}.${t}`;yield*iE(o,n)}}},jj=(e,r)=>e===""?r:r.startsWith("[")?`${e}${r}`:`${e}.${r}`,er=(e,r,t)=>{let o=new Set;for(let[n,i]of iE(e)){let a=r(i);if(o.has(a))return ie({kind:_o.DuplicateIdError,properties:{id:a,path:jj(t,n)}});o.add(a)}return oe(!0)};var sE=e=>e.floors==null?ie({kind:_o.FloorMissingError,properties:null}):er(e.floors.features,r=>r.properties.id,"floors");var aE=g.Intersect([g.Object({id:g.Ref(Ve),elevation:g.Integer({description:"An ordinal representing the elevation of this map relative to other maps in the stack."}),subtitle:g.Optional(g.String({description:"The subtitle of the floor."})),maxHeight:g.Optional(g.Number({description:"The maximum height of the floor in meters. This includes the thickness of the floor itself, up to the tallest point on any wall. If the floor does not have a consistent height (eg, one room on the floor has a vaulted ceiling, the rest do not), this value represents the highest point anywhere on the floor. Must be a positive number, or undefined.",minimum:0}))}),Xo],{$id:"FloorProperties"}),lE=Ur(g.Union([g.Ref(Xp),g.Ref(Yp),g.Null()]),g.Ref(aE),{$id:"FloorFeature"}),cE=fo(g.Ref(lE),{$id:"FloorCollection"}),Gj=g.Object({floors:g.Ref(cE)}),pE={name:"core:floors",intoBundle:function*(e){e.floors!=null&&(yield{path:"floors.geojson",contents:e.floors})},fromBundle:(e,r,t)=>{if(e==="floors.geojson")return{floors:t(r)}},integrityCheck:sE,schema:Gj,references:[aE,lE,cE]};d();d();var tr=e=>g.Unsafe(e);d();var Ze=e=>Object.keys(e);d();d();var Uj=e=>new Map(e.floors?.features.map(r=>[r.properties.id,r])??[]),ei=e=>{let r=Uj(e);return o=>{let n=r.get(o);return n==null?ie({kind:_o.UnknownFloorError,properties:{floorId:o}}):oe(n)}};var dE=e=>{if(e.floors==null)return ie({kind:_o.FloorMissingError,properties:null});if(e.geometry==null)return ie({kind:_o.GeometryMissingError,properties:null});let r=er(e.geometry,o=>o.properties.id,"geometry");if(r.isErr())return r;let t=ei(e);for(let o of Ze(e.geometry)){let n=t(o);if(n.isErr())return n}return oe(!0)};var uE=g.Intersect([g.Object({id:g.Ref(ro)}),Xo],{$id:"GeometryProperties"}),mE=Ur(g.Union([g.Ref(to),g.Ref(Hy),g.Ref(zy),g.Ref(Wy),g.Ref(Xp),g.Ref(Yp)]),g.Ref(uE),{$id:"GeometryFeature"}),fE=fo(g.Ref(mE),{$id:"GeometryCollection"}),Vj=g.Object({geometry:tr(g.Record(Ve,g.Ref(fE),{additionalProperties:!1}))},{$id:"GeometrySchema"}),$j=/^geometry\/(.*)\.geojson$/,hE={name:"core:geometry",schema:Vj,intoBundle:function*(e){if(e.geometry!=null)for(let r of Ze(e.geometry))yield{path:`geometry/${r}.geojson`,contents:e.geometry[r]}},fromBundle:(e,r,t)=>{let o=e.match($j)?.[1];if(o)return{geometry:{[o]:t(r)}}},references:[uE,mE,fE],integrityCheck:dE};d();var sI=g.Object({type:g.Literal("file"),name:g.String({description:"The name of the file."})},{$id:"ManifestFile"}),gE=g.Recursive(e=>g.Object({type:g.Literal("folder"),name:g.String({description:"The name of the folder."}),children:g.Array(g.Union([e,g.Ref(sI)]),{minItems:1,description:"The children of the folder."})}),{$id:"ManifestFolder"}),yE=g.Object({name:g.String({description:"The name of the map."}),version:g.Literal("3.0.0",{description:"The version of the manifest."}),orgId:g.Optional(g.String({description:"The identifier of the organization that the map this MVF is for belongs to."})),mapId:g.Optional(g.String({description:"The identifier of the map that this MVF is for."})),contents:g.Array(g.Union([g.Ref(gE),g.Ref(sI)]),{minItems:1,description:"The contents of the MVF bundle."}),time:g.String({format:"date-time",description:"An ISO 8601 date-time string, including timezone offset."}),tzid:g.Optional(g.Unsafe(g.String({description:"A valid IANA timezone identifier.",pattern:"^[A-Za-z0-9_-]+/[A-Za-z0-9_-]+$"}))),naturalBearing:g.Optional(g.Number({minimum:0,maximum:360,description:'The angle, in degrees, the map is considered to be "naturally oriented" as, rather than facing directly north. 90 degrees means East is "up"'})),defaultFloor:g.Optional(g.Ref(Ve,{description:"The default floor ID of the map."})),language:g.Optional(g.String({description:"The language code of the map."}))},{$id:"ManifestProperties"}),bE=fo(Ur(to,g.Ref(yE)),{$id:"ManifestCollection"},{minItems:1,maxItems:1}),Hj=g.Object({manifest:g.Ref(bE)}),xE={name:"core:manifest",intoBundle:function*(e){e.manifest!=null&&(yield{path:"manifest.geojson",contents:e.manifest})},fromBundle:(e,r,t)=>{if(e==="manifest.geojson")return{manifest:t(r)}},schema:Hj,references:[sI,gE,yE,bE]};d();d();d();d();var aI=class extends be{constructor(t){super(`Unable to dereference schema with $id '${t.$ref}'`);m(this,"schema");this.schema=t}};function zj(e,r){let t=r.find(o=>o.$id===e.$ref);if(t===void 0)throw new aI(e);return ql(t,r)}function Ob(e,r){return!Ye.IsString(e.$id)||r.some(t=>t.$id===e.$id)||r.push(e),r}function ql(e,r){return e[U]==="This"||e[U]==="Ref"?zj(e,r):e}d();function Wj(e,r,t){let o=e.get(r);if(o!==void 0)return o;let n=Zi(r,t);return e.set(r,n),n}function Eb(){let e=new WeakMap;return{HasTransform:(r,t)=>Wj(e,r,t)}}function Yt(e,r,t){try{return D.IsTransform(e)?e[_t].Decode(t):t}catch(o){throw new Jl(e,r,t,o)}}function Zj(e,r,t,o,n){return Ye.IsArray(o)?Yt(e,t,o.map((i,a)=>Yi(e.items,r,`${t}/${a}`,i,n))):Yt(e,t,o)}function Xj(e,r,t,o,n){if(!Ye.IsObject(o)||Gr(o))return Yt(e,t,o);let i=Xa(e),a=i.map(f=>f[0]),l={...o};for(let[f,h]of i)f in l&&(l[f]=Yi(h,r,`${t}/${f}`,l[f],n));if(!D.IsTransform(e.unevaluatedProperties))return Yt(e,t,l);let c=Object.getOwnPropertyNames(l),p=e.unevaluatedProperties,u={...l};for(let f of c)a.includes(f)||(u[f]=Yt(p,`${t}/${f}`,u[f]));return Yt(e,t,u)}function Yj(e,r,t,o,n){return Yt(e,t,Yi(e.not,r,t,o,n))}function Jj(e,r,t,o,n){if(!Ye.IsObject(o))return Yt(e,t,o);let i=Er(e),a={...o};for(let u of i)Ye.HasPropertyKey(a,u)&&(Ye.IsUndefined(a[u])&&(!D.IsUndefined(e.properties[u])||pt.IsExactOptionalProperty(a,u))||(a[u]=Yi(e.properties[u],r,`${t}/${u}`,a[u],n)));if(!D.IsSchema(e.additionalProperties))return Yt(e,t,a);let l=Object.getOwnPropertyNames(a),c=e.additionalProperties,p={...a};for(let u of l)i.includes(u)||(p[u]=Yt(c,`${t}/${u}`,p[u]));return Yt(e,t,p)}function Kj(e,r,t,o,n){if(!Ye.IsObject(o))return Yt(e,t,o);let i=Object.getOwnPropertyNames(e.patternProperties)[0],a=new RegExp(i),l={...o};for(let f of Object.getOwnPropertyNames(o))a.test(f)&&(l[f]=Yi(e.patternProperties[i],r,`${t}/${f}`,l[f],n));if(!D.IsSchema(e.additionalProperties))return Yt(e,t,l);let c=Object.getOwnPropertyNames(l),p=e.additionalProperties,u={...l};for(let f of c)a.test(f)||(u[f]=Yt(p,`${t}/${f}`,u[f]));return Yt(e,t,u)}function Qj(e,r,t,o,n){let i=ql(e,r);return Yt(e,t,Yi(i,r,t,o,n))}function qj(e,r,t,o,n){let i=ql(e,r);return Yt(e,t,Yi(i,r,t,o,n))}function eG(e,r,t,o,n){return Ye.IsArray(o)&&Ye.IsArray(e.items)?Yt(e,t,e.items.map((i,a)=>Yi(i,r,`${t}/${a}`,o[a],n))):Yt(e,t,o)}function tG(e,r,t,o,n){for(let i of e.anyOf){if(!Qn.Check(i,r,o))continue;let a=Yi(i,r,t,o,n);return Yt(e,t,a)}return Yt(e,t,o)}function Yi(e,r,t,o,n){if(!n.HasTransform(e,r))return o;let i=Ob(e,r),a=e;switch(e[U]){case"Array":return Zj(a,i,t,o,n);case"Intersect":return Xj(a,i,t,o,n);case"Not":return Yj(a,i,t,o,n);case"Object":return Jj(a,i,t,o,n);case"Record":return Kj(a,i,t,o,n);case"Ref":return Qj(a,i,t,o,n);case"Symbol":return Yt(a,t,o);case"This":return qj(a,i,t,o,n);case"Tuple":return eG(a,i,t,o,n);case"Union":return tG(a,i,t,o,n);default:return Yt(a,t,o)}}function vE(e,r,t){let o=Eb();return Yi(e,r,"",t,o)}d();function io(e,r,t){try{return D.IsTransform(e)?e[_t].Encode(t):t}catch(o){throw new Kl(e,r,t,o)}}function rG(e,r,t,o,n){let i=io(e,t,o);return Ye.IsArray(i)?i.map((a,l)=>Ji(e.items,r,`${t}/${l}`,a,n)):i}function oG(e,r,t,o,n){let i=io(e,t,o);if(!Ye.IsObject(o)||Gr(o))return i;let a=Xa(e),l=a.map(h=>h[0]),c={...i};for(let[h,b]of a)h in c&&(c[h]=Ji(b,r,`${t}/${h}`,c[h],n));if(!D.IsTransform(e.unevaluatedProperties))return c;let p=Object.getOwnPropertyNames(c),u=e.unevaluatedProperties,f={...c};for(let h of p)l.includes(h)||(f[h]=io(u,`${t}/${h}`,f[h]));return f}function nG(e,r,t,o){return io(e.not,t,io(e,t,o))}function iG(e,r,t,o,n){let i=io(e,t,o);if(!Ye.IsObject(i))return i;let a=Er(e),l={...i};for(let f of a)Ye.HasPropertyKey(l,f)&&(Ye.IsUndefined(l[f])&&(!D.IsUndefined(e.properties[f])||pt.IsExactOptionalProperty(l,f))||(l[f]=Ji(e.properties[f],r,`${t}/${f}`,l[f],n)));if(!D.IsSchema(e.additionalProperties))return l;let c=Object.getOwnPropertyNames(l),p=e.additionalProperties,u={...l};for(let f of c)a.includes(f)||(u[f]=io(p,`${t}/${f}`,u[f]));return u}function sG(e,r,t,o,n){let i=io(e,t,o);if(!Ye.IsObject(o))return i;let a=Object.getOwnPropertyNames(e.patternProperties)[0],l=new RegExp(a),c={...i};for(let h of Object.getOwnPropertyNames(o))l.test(h)&&(c[h]=Ji(e.patternProperties[a],r,`${t}/${h}`,c[h],n));if(!D.IsSchema(e.additionalProperties))return c;let p=Object.getOwnPropertyNames(c),u=e.additionalProperties,f={...c};for(let h of p)l.test(h)||(f[h]=io(u,`${t}/${h}`,f[h]));return f}function aG(e,r,t,o,n){let i=ql(e,r),a=Ji(i,r,t,o,n);return io(e,t,a)}function lG(e,r,t,o,n){let i=ql(e,r),a=Ji(i,r,t,o,n);return io(e,t,a)}function cG(e,r,t,o,n){let i=io(e,t,o);return Ye.IsArray(e.items)?e.items.map((a,l)=>Ji(a,r,`${t}/${l}`,i[l],n)):[]}function pG(e,r,t,o,n){for(let i of e.anyOf){if(!Qn.Check(i,r,o))continue;let a=Ji(i,r,t,o,n);return io(e,t,a)}for(let i of e.anyOf){let a=Ji(i,r,t,o,n);if(Qn.Check(e,r,a))return io(e,t,a)}return io(e,t,o)}function Ji(e,r,t,o,n){if(!n.HasTransform(e,r))return o;let i=Ob(e,r),a=e;switch(e[U]){case"Array":return rG(a,i,t,o,n);case"Intersect":return oG(a,i,t,o,n);case"Not":return nG(a,i,t,o);case"Object":return iG(a,i,t,o,n);case"Record":return sG(a,i,t,o,n);case"Ref":return aG(a,i,t,o,n);case"This":return lG(a,i,t,o,n);case"Tuple":return cG(a,i,t,o,n);case"Union":return pG(a,i,t,o,n);default:return io(a,t,o)}}function IE(e,r,t){let o=Eb();return Ji(e,r,"",t,o)}d();var lI=class{constructor(r,t,o,n){this.schema=r,this.references=t,this.checkFunc=o,this.code=n,this.hasTransform=Zi(r,t)}Code(){return this.code}Errors(r){return Vi(this.schema,this.references,r)}Check(r){return this.checkFunc(r)}Decode(r){if(!this.checkFunc(r))throw new qp(this.schema,r,this.Errors(r).First());return this.hasTransform?ed(this.schema,this.references,r):r}Encode(r){let t=this.hasTransform?nb(this.schema,this.references,r):r;if(!this.checkFunc(t))throw new td(this.schema,r,this.Errors(r).First());return t}},Ys;(function(e){function r(i){return i===36}e.DollarSign=r;function t(i){return i===95}e.IsUnderscore=t;function o(i){return i>=65&&i<=90||i>=97&&i<=122}e.IsAlpha=o;function n(i){return i>=48&&i<=57}e.IsNumeric=n})(Ys||(Ys={}));var Pb;(function(e){function r(i){return i.length===0?!1:Ys.IsNumeric(i.charCodeAt(0))}function t(i){if(r(i))return!1;for(let a=0;a<i.length;a++){let l=i.charCodeAt(a);if(!(Ys.IsAlpha(l)||Ys.IsNumeric(l)||Ys.DollarSign(l)||Ys.IsUnderscore(l)))return!1}return!0}function o(i){return i.replace(/'/g,"\\'")}function n(i,a){return t(a)?`${i}.${a}`:`${i}['${o(a)}']`}e.Encode=n})(Pb||(Pb={}));var cI;(function(e){function r(t){let o=[];for(let n=0;n<t.length;n++){let i=t.charCodeAt(n);Ys.IsNumeric(i)||Ys.IsAlpha(i)?o.push(t.charAt(n)):o.push(`_${i}_`)}return o.join("").replace(/__/g,"_")}e.Encode=r})(cI||(cI={}));var pI;(function(e){function r(t){return t.replace(/'/g,"\\'")}e.Escape=r})(pI||(pI={}));var dI=class extends be{constructor(r){super("Unknown type"),this.schema=r}},Fb=class extends be{constructor(r){super("Preflight validation check failed to guard for the given schema"),this.schema=r}},ec;(function(e){function r(a,l,c){return pt.ExactOptionalPropertyTypes?`('${l}' in ${a} ? ${c} : true)`:`(${Pb.Encode(a,l)} !== undefined ? ${c} : true)`}e.IsExactOptionalProperty=r;function t(a){return pt.AllowArrayObject?`(typeof ${a} === 'object' && ${a} !== null)`:`(typeof ${a} === 'object' && ${a} !== null && !Array.isArray(${a}))`}e.IsObjectLike=t;function o(a){return pt.AllowArrayObject?`(typeof ${a} === 'object' && ${a} !== null && !(${a} instanceof Date) && !(${a} instanceof Uint8Array))`:`(typeof ${a} === 'object' && ${a} !== null && !Array.isArray(${a}) && !(${a} instanceof Date) && !(${a} instanceof Uint8Array))`}e.IsRecordLike=o;function n(a){return pt.AllowNaN?`typeof ${a} === 'number'`:`Number.isFinite(${a})`}e.IsNumberLike=n;function i(a){return pt.AllowNullVoid?`(${a} === undefined || ${a} === null)`:`${a} === undefined`}e.IsVoidLike=i})(ec||(ec={}));var Db;(function(e){function r(k){return k[U]==="Any"||k[U]==="Unknown"}function*t(k,H,P){yield"true"}function*o(k,H,P){yield`Array.isArray(${P})`;let[q,K]=[Xe("value","any"),Xe("acc","number")];me(k.maxItems)&&(yield`${P}.length <= ${k.maxItems}`),me(k.minItems)&&(yield`${P}.length >= ${k.minItems}`);let Q=Ee(k.items,H,"value");if(yield`${P}.every((${q}) => ${Q})`,ze(k.contains)||me(k.minContains)||me(k.maxContains)){let De=ze(k.contains)?k.contains:ft(),xt=Ee(De,H,"value"),dr=me(k.minContains)?[`(count >= ${k.minContains})`]:[],ir=me(k.maxContains)?[`(count <= ${k.maxContains})`]:[],ur=`const count = value.reduce((${K}, ${q}) => ${xt} ? acc + 1 : acc, 0)`,Mi=["(count > 0)",...dr,...ir].join(" && ");yield`((${q}) => { ${ur}; return ${Mi}})(${P})`}k.uniqueItems===!0&&(yield`((${q}) => { const set = new Set(); for(const element of value) { const hashed = hash(element); if(set.has(hashed)) { return false } else { set.add(hashed) } } return true } )(${P})`)}function*n(k,H,P){yield`(typeof value === 'object' && Symbol.asyncIterator in ${P})`}function*i(k,H,P){yield`(typeof ${P} === 'bigint')`,jr(k.exclusiveMaximum)&&(yield`${P} < BigInt(${k.exclusiveMaximum})`),jr(k.exclusiveMinimum)&&(yield`${P} > BigInt(${k.exclusiveMinimum})`),jr(k.maximum)&&(yield`${P} <= BigInt(${k.maximum})`),jr(k.minimum)&&(yield`${P} >= BigInt(${k.minimum})`),jr(k.multipleOf)&&(yield`(${P} % BigInt(${k.multipleOf})) === 0`)}function*a(k,H,P){yield`(typeof ${P} === 'boolean')`}function*l(k,H,P){yield*Fe(k.returns,H,`${P}.prototype`)}function*c(k,H,P){yield`(${P} instanceof Date) && Number.isFinite(${P}.getTime())`,me(k.exclusiveMaximumTimestamp)&&(yield`${P}.getTime() < ${k.exclusiveMaximumTimestamp}`),me(k.exclusiveMinimumTimestamp)&&(yield`${P}.getTime() > ${k.exclusiveMinimumTimestamp}`),me(k.maximumTimestamp)&&(yield`${P}.getTime() <= ${k.maximumTimestamp}`),me(k.minimumTimestamp)&&(yield`${P}.getTime() >= ${k.minimumTimestamp}`),me(k.multipleOfTimestamp)&&(yield`(${P}.getTime() % ${k.multipleOfTimestamp}) === 0`)}function*p(k,H,P){yield`(typeof ${P} === 'function')`}function*u(k,H,P){yield`Number.isInteger(${P})`,me(k.exclusiveMaximum)&&(yield`${P} < ${k.exclusiveMaximum}`),me(k.exclusiveMinimum)&&(yield`${P} > ${k.exclusiveMinimum}`),me(k.maximum)&&(yield`${P} <= ${k.maximum}`),me(k.minimum)&&(yield`${P} >= ${k.minimum}`),me(k.multipleOf)&&(yield`(${P} % ${k.multipleOf}) === 0`)}function*f(k,H,P){let q=k.allOf.map(K=>Ee(K,H,P)).join(" && ");if(k.unevaluatedProperties===!1){let K=Ge(`${new RegExp(Vs(k))};`),Q=`Object.getOwnPropertyNames(${P}).every(key => ${K}.test(key))`;yield`(${q} && ${Q})`}else if(ze(k.unevaluatedProperties)){let K=Ge(`${new RegExp(Vs(k))};`),Q=`Object.getOwnPropertyNames(${P}).every(key => ${K}.test(key) || ${Ee(k.unevaluatedProperties,H,`${P}[key]`)})`;yield`(${q} && ${Q})`}else yield`(${q})`}function*h(k,H,P){yield`(typeof value === 'object' && Symbol.iterator in ${P})`}function*b(k,H,P){typeof k.const=="number"||typeof k.const=="boolean"?yield`(${P} === ${k.const})`:yield`(${P} === '${pI.Escape(k.const)}')`}function*x(k,H,P){yield"false"}function*T(k,H,P){yield`(!${Ee(k.not,H,P)})`}function*v(k,H,P){yield`(${P} === null)`}function*I(k,H,P){yield ec.IsNumberLike(P),me(k.exclusiveMaximum)&&(yield`${P} < ${k.exclusiveMaximum}`),me(k.exclusiveMinimum)&&(yield`${P} > ${k.exclusiveMinimum}`),me(k.maximum)&&(yield`${P} <= ${k.maximum}`),me(k.minimum)&&(yield`${P} >= ${k.minimum}`),me(k.multipleOf)&&(yield`(${P} % ${k.multipleOf}) === 0`)}function*M(k,H,P){yield ec.IsObjectLike(P),me(k.minProperties)&&(yield`Object.getOwnPropertyNames(${P}).length >= ${k.minProperties}`),me(k.maxProperties)&&(yield`Object.getOwnPropertyNames(${P}).length <= ${k.maxProperties}`);let q=Object.getOwnPropertyNames(k.properties);for(let K of q){let Q=Pb.Encode(P,K),De=k.properties[K];if(k.required&&k.required.includes(K))yield*Fe(De,H,Q),(Hs(De)||r(De))&&(yield`('${K}' in ${P})`);else{let xt=Ee(De,H,Q);yield ec.IsExactOptionalProperty(P,K,xt)}}if(k.additionalProperties===!1)if(k.required&&k.required.length===q.length)yield`Object.getOwnPropertyNames(${P}).length === ${q.length}`;else{let K=`[${q.map(Q=>`'${Q}'`).join(", ")}]`;yield`Object.getOwnPropertyNames(${P}).every(key => ${K}.includes(key))`}if(typeof k.additionalProperties=="object"){let K=Ee(k.additionalProperties,H,`${P}[key]`),Q=`[${q.map(De=>`'${De}'`).join(", ")}]`;yield`(Object.getOwnPropertyNames(${P}).every(key => ${Q}.includes(key) || ${K}))`}}function*O(k,H,P){yield`(typeof value === 'object' && typeof ${P}.then === 'function')`}function*C(k,H,P){yield ec.IsRecordLike(P),me(k.minProperties)&&(yield`Object.getOwnPropertyNames(${P}).length >= ${k.minProperties}`),me(k.maxProperties)&&(yield`Object.getOwnPropertyNames(${P}).length <= ${k.maxProperties}`);let[q,K]=Object.entries(k.patternProperties)[0],Q=Ge(`${new RegExp(q)}`),De=Ee(K,H,"value"),xt=ze(k.additionalProperties)?Ee(k.additionalProperties,H,P):k.additionalProperties===!1?"false":"true",dr=`(${Q}.test(key) ? ${De} : ${xt})`;yield`(Object.entries(${P}).every(([key, value]) => ${dr}))`}function*E(k,H,P){let q=Qe(k,H);if(ce.functions.has(k.$ref))return yield`${ye(k.$ref)}(${P})`;yield*Fe(q,H,P)}function*_(k,H,P){let q=Ge(`${new RegExp(k.source,k.flags)};`);yield`(typeof ${P} === 'string')`,me(k.maxLength)&&(yield`${P}.length <= ${k.maxLength}`),me(k.minLength)&&(yield`${P}.length >= ${k.minLength}`),yield`${q}.test(${P})`}function*G(k,H,P){yield`(typeof ${P} === 'string')`,me(k.maxLength)&&(yield`${P}.length <= ${k.maxLength}`),me(k.minLength)&&(yield`${P}.length >= ${k.minLength}`),k.pattern!==void 0&&(yield`${Ge(`${new RegExp(k.pattern)};`)}.test(${P})`),k.format!==void 0&&(yield`format('${k.format}', ${P})`)}function*R(k,H,P){yield`(typeof ${P} === 'symbol')`}function*N(k,H,P){yield`(typeof ${P} === 'string')`,yield`${Ge(`${new RegExp(k.pattern)};`)}.test(${P})`}function*X(k,H,P){yield`${ye(k.$ref)}(${P})`}function*z(k,H,P){if(yield`Array.isArray(${P})`,k.items===void 0)return yield`${P}.length === 0`;yield`(${P}.length === ${k.maxItems})`;for(let q=0;q<k.items.length;q++)yield`${Ee(k.items[q],H,`${P}[${q}]`)}`}function*ee(k,H,P){yield`${P} === undefined`}function*re(k,H,P){yield`(${k.anyOf.map(K=>Ee(K,H,P)).join(" || ")})`}function*ue(k,H,P){yield`${P} instanceof Uint8Array`,me(k.maxByteLength)&&(yield`(${P}.length <= ${k.maxByteLength})`),me(k.minByteLength)&&(yield`(${P}.length >= ${k.minByteLength})`)}function*Ce(k,H,P){yield"true"}function*Oe(k,H,P){yield ec.IsVoidLike(P)}function*Pe(k,H,P){let q=ce.instances.size;ce.instances.set(q,k),yield`kind('${k[U]}', ${q}, ${P})`}function*Fe(k,H,P,q=!0){let K=He(k.$id)?[...H,k]:H,Q=k;if(q&&He(k.$id)){let De=ye(k.$id);if(ce.functions.has(De))return yield`${De}(${P})`;{let xt=Ie(De,k,H,"value",!1);return ce.functions.set(De,xt),yield`${De}(${P})`}}switch(Q[U]){case"Any":return yield*t(Q,K,P);case"Array":return yield*o(Q,K,P);case"AsyncIterator":return yield*n(Q,K,P);case"BigInt":return yield*i(Q,K,P);case"Boolean":return yield*a(Q,K,P);case"Constructor":return yield*l(Q,K,P);case"Date":return yield*c(Q,K,P);case"Function":return yield*p(Q,K,P);case"Integer":return yield*u(Q,K,P);case"Intersect":return yield*f(Q,K,P);case"Iterator":return yield*h(Q,K,P);case"Literal":return yield*b(Q,K,P);case"Never":return yield*x(Q,K,P);case"Not":return yield*T(Q,K,P);case"Null":return yield*v(Q,K,P);case"Number":return yield*I(Q,K,P);case"Object":return yield*M(Q,K,P);case"Promise":return yield*O(Q,K,P);case"Record":return yield*C(Q,K,P);case"Ref":return yield*E(Q,K,P);case"RegExp":return yield*_(Q,K,P);case"String":return yield*G(Q,K,P);case"Symbol":return yield*R(Q,K,P);case"TemplateLiteral":return yield*N(Q,K,P);case"This":return yield*X(Q,K,P);case"Tuple":return yield*z(Q,K,P);case"Undefined":return yield*ee(Q,K,P);case"Union":return yield*re(Q,K,P);case"Uint8Array":return yield*ue(Q,K,P);case"Unknown":return yield*Ce(Q,K,P);case"Void":return yield*Oe(Q,K,P);default:if(!Or.Has(Q[U]))throw new dI(k);return yield*Pe(Q,K,P)}}let ce={language:"javascript",functions:new Map,variables:new Map,instances:new Map};function Ee(k,H,P,q=!0){return`(${[...Fe(k,H,P,q)].join(" && ")})`}function ye(k){return`check_${cI.Encode(k)}`}function Ge(k){let H=`local_${ce.variables.size}`;return ce.variables.set(H,`const ${H} = ${k}`),H}function Ie(k,H,P,q,K=!0){let[Q,De]=[`
1
+ import{$ as O0,$a as my,A as PC,Aa as cy,Ab as Ep,B as Nl,Ba as py,Bb as V0,C as FC,Ca as JC,Cb as gy,D as DC,Da as KC,Db as OM,E as C0,Ea as QC,Eb as $0,F as ki,Fa as qC,Fb as EM,G as iy,Ga as eM,Gb as PM,H as Ps,Ha as _0,Hb as FM,I as jl,Ia as tM,Ib as DM,J as kC,Ja as rM,Jb as kM,K as AC,Ka as Cp,Kb as AM,L as LC,La as oM,Lb as Li,M as _C,Ma as nM,Mb as LM,N as mm,Na as dy,Nb as Ht,O as Po,Oa as R0,Ob as _M,P as RC,Pa as iM,Pb as RM,Q as M0,Qa as ym,Qb as Ri,R as Ai,Ra as Mp,Rb as BM,S as BC,Sa as uy,Sb as fr,T as vp,Ta as wp,Tb as Wn,U as F,Ua as Op,Ub as hr,V as J,Va as sM,W as sy,Wa as B0,X as Ip,Y as fm,Ya as aM,Z as NC,Za as lM,_ as w0,_a as cM,aa as jC,ab as pM,ba as GC,bb as dM,c as A,ca as UC,cb as uM,d as wr,da as Fs,db as mM,e as oC,ea as VC,eb as fM,f as x0,fa as E0,fb as bm,g as Fi,ga as $C,gb as zo,h as CC,ha as Ds,hb as hM,i as ty,ia as F0,ib as gM,j as MC,ja as Ga,jb as yM,k as Di,ka as Mt,kb as N0,l as ry,la as ay,lb as bM,m as wC,ma as hm,mb as j0,n as oy,na as D0,nb as G0,o as Bl,oa as ly,ob as fy,p as dm,pa as k0,pb as xM,q as S0,qa as A0,qb as vM,r as xp,ra as L0,rb as IM,s as ut,sa as WC,sb as SM,t as ny,ta as Sp,tb as U0,u as ke,ua as ZC,ub as TM,v as Es,va as Tp,vb as Ua,w as um,wa as gm,wb as hy,x as T0,xa as XC,xb as CM,y as OC,ya as YC,yb as MM,z as EC,zb as wM}from"./chunk-SK7G4AI7.js";import{X as P0,ea as zC,w as HC}from"./chunk-RQZV3WZS.js";import{a as _i}from"./chunk-OBLC2SMU.js";import{$ as Le,Aa as Qg,B as Wg,Ba as yC,C as Zg,Ca as Na,D as aC,Da as ja,E as lC,Ea as Os,Fa as qg,G as cC,Ga as bC,H as Ue,Ha as xC,I as Me,Ja as Ei,M as pC,N as dC,O as uC,P as Xg,Q as ae,R as sr,S as mC,T as Hn,Ta as bp,U as gp,V as ws,W as ar,Xa as ey,Y as Nr,Ya as vC,Z as po,_ as Yg,aa as zn,ab as IC,b as Hg,c as lm,ca as _a,cb as Pi,d as v0,da as fC,e as Ms,ea as I0,eb as SC,f as nC,g as cm,ga as Ra,gb as TC,oa as Ba,p as iC,pa as Jg,qa as Kg,r as sC,ra as hC,ta as pm,ya as gC,z as zg,za as yp}from"./chunk-HC3H6CI4.js";import{a as d,b as y}from"./chunk-UX7CELX5.js";import{b as Cs,c as La,d as hp,e as m,f as s,g as S,h as w,i as W}from"./chunk-ROCNZJLL.js";var GF=Cs((oS,nS)=>{d();(function(e,r){typeof oS=="object"&&typeof nS<"u"?nS.exports=r():typeof define=="function"&&define.amd?define(r):(e=e||self,e.TinyQueue=r())})(oS,function(){"use strict";var e=function(o,n){if(o===void 0&&(o=[]),n===void 0&&(n=r),this.data=o,this.length=this.data.length,this.compare=n,this.length>0)for(var i=(this.length>>1)-1;i>=0;i--)this._down(i)};e.prototype.push=function(o){this.data.push(o),this.length++,this._up(this.length-1)},e.prototype.pop=function(){if(this.length!==0){var o=this.data[0],n=this.data.pop();return this.length--,this.length>0&&(this.data[0]=n,this._down(0)),o}},e.prototype.peek=function(){return this.data[0]},e.prototype._up=function(o){for(var n=this,i=n.data,a=n.compare,l=i[o];o>0;){var c=o-1>>1,p=i[c];if(a(l,p)>=0)break;i[o]=p,o=c}i[o]=l},e.prototype._down=function(o){for(var n=this,i=n.data,a=n.compare,l=this.length>>1,c=i[o];o<l;){var p=(o<<1)+1,u=i[p],f=p+1;if(f<this.length&&a(i[f],u)<0&&(p=f,u=i[f]),a(u,c)>=0)break;i[o]=u,o=p}i[o]=c};function r(t,o){return t<o?-1:t>o?1:0}return e})});var VF=Cs((P0e,iS)=>{"use strict";d();var Qb=GF();Qb.default&&(Qb=Qb.default);iS.exports=UF;iS.exports.default=UF;function UF(e,r,t){r=r||1;for(var o,n,i,a,l=0;l<e[0].length;l++){var c=e[0][l];(!l||c[0]<o)&&(o=c[0]),(!l||c[1]<n)&&(n=c[1]),(!l||c[0]>i)&&(i=c[0]),(!l||c[1]>a)&&(a=c[1])}var p=i-o,u=a-n,f=Math.min(p,u),h=f/2;if(f===0){var b=[o,n];return b.distance=0,b}for(var x=new Qb(void 0,xU),T=o;T<i;T+=f)for(var v=n;v<a;v+=f)x.push(new el(T+h,v+h,h,e));var I=IU(e),M=new el(o+p/2,n+u/2,0,e);M.d>I.d&&(I=M);for(var O=x.length;x.length;){var C=x.pop();C.d>I.d&&(I=C,t&&console.log("found best %d after %d probes",Math.round(1e4*C.d)/1e4,O)),!(C.max-I.d<=r)&&(h=C.h/2,x.push(new el(C.x-h,C.y-h,h,e)),x.push(new el(C.x+h,C.y-h,h,e)),x.push(new el(C.x-h,C.y+h,h,e)),x.push(new el(C.x+h,C.y+h,h,e)),O+=4)}t&&(console.log("num probes: "+O),console.log("best distance: "+I.d));var E=[I.x,I.y];return E.distance=I.d,E}function xU(e,r){return r.max-e.max}function el(e,r,t,o){this.x=e,this.y=r,this.h=t,this.d=vU(e,r,o),this.max=this.d+this.h*Math.SQRT2}function vU(e,r,t){for(var o=!1,n=1/0,i=0;i<t.length;i++)for(var a=t[i],l=0,c=a.length,p=c-1;l<c;p=l++){var u=a[l],f=a[p];u[1]>r!=f[1]>r&&e<(f[0]-u[0])*(r-u[1])/(f[1]-u[1])+u[0]&&(o=!o),n=Math.min(n,SU(e,r,u,f))}return n===0?0:(o?1:-1)*Math.sqrt(n)}function IU(e){for(var r=0,t=0,o=0,n=e[0],i=0,a=n.length,l=a-1;i<a;l=i++){var c=n[i],p=n[l],u=c[0]*p[1]-p[0]*c[1];t+=(c[0]+p[0])*u,o+=(c[1]+p[1])*u,r+=u*3}return r===0?new el(n[0][0],n[0][1],0,e):new el(t/r,o/r,0,e)}function SU(e,r,t,o){var n=t[0],i=t[1],a=o[0]-n,l=o[1]-i;if(a!==0||l!==0){var c=((e-n)*a+(r-i)*l)/(a*a+l*l);c>1?(n=o[0],i=o[1]):c>0&&(n+=a*c,i+=l*c)}return a=e-n,l=r-i,a*a+l*l}});var p5=Cs((gS,yS)=>{d();(function(e,r){typeof gS=="object"&&typeof yS<"u"?yS.exports=r():typeof define=="function"&&define.amd?define(r):(e=e||self).RBush=r()})(gS,function(){"use strict";function e(v,I,M,O,C){(function E(_,G,R,N,X){for(;N>R;){if(N-R>600){var z=N-R+1,ee=G-R+1,re=Math.log(z),ue=.5*Math.exp(2*re/3),Ce=.5*Math.sqrt(re*ue*(z-ue)/z)*(ee-z/2<0?-1:1),Oe=Math.max(R,Math.floor(G-ee*ue/z+Ce)),Pe=Math.min(N,Math.floor(G+(z-ee)*ue/z+Ce));E(_,G,Oe,Pe,X)}var Fe=_[G],ce=R,Ee=N;for(r(_,R,G),X(_[N],Fe)>0&&r(_,R,N);ce<Ee;){for(r(_,ce,Ee),ce++,Ee--;X(_[ce],Fe)<0;)ce++;for(;X(_[Ee],Fe)>0;)Ee--}X(_[R],Fe)===0?r(_,R,Ee):r(_,++Ee,N),Ee<=G&&(R=Ee+1),G<=Ee&&(N=Ee-1)}})(v,I,M||0,O||v.length-1,C||t)}function r(v,I,M){var O=v[I];v[I]=v[M],v[M]=O}function t(v,I){return v<I?-1:v>I?1:0}var o=function(v){v===void 0&&(v=9),this._maxEntries=Math.max(4,v),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function n(v,I,M){if(!M)return I.indexOf(v);for(var O=0;O<I.length;O++)if(M(v,I[O]))return O;return-1}function i(v,I){a(v,0,v.children.length,I,v)}function a(v,I,M,O,C){C||(C=x(null)),C.minX=1/0,C.minY=1/0,C.maxX=-1/0,C.maxY=-1/0;for(var E=I;E<M;E++){var _=v.children[E];l(C,v.leaf?O(_):_)}return C}function l(v,I){return v.minX=Math.min(v.minX,I.minX),v.minY=Math.min(v.minY,I.minY),v.maxX=Math.max(v.maxX,I.maxX),v.maxY=Math.max(v.maxY,I.maxY),v}function c(v,I){return v.minX-I.minX}function p(v,I){return v.minY-I.minY}function u(v){return(v.maxX-v.minX)*(v.maxY-v.minY)}function f(v){return v.maxX-v.minX+(v.maxY-v.minY)}function h(v,I){return v.minX<=I.minX&&v.minY<=I.minY&&I.maxX<=v.maxX&&I.maxY<=v.maxY}function b(v,I){return I.minX<=v.maxX&&I.minY<=v.maxY&&I.maxX>=v.minX&&I.maxY>=v.minY}function x(v){return{children:v,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function T(v,I,M,O,C){for(var E=[I,M];E.length;)if(!((M=E.pop())-(I=E.pop())<=O)){var _=I+Math.ceil((M-I)/O/2)*O;e(v,_,I,M,C),E.push(I,_,_,M)}}return o.prototype.all=function(){return this._all(this.data,[])},o.prototype.search=function(v){var I=this.data,M=[];if(!b(v,I))return M;for(var O=this.toBBox,C=[];I;){for(var E=0;E<I.children.length;E++){var _=I.children[E],G=I.leaf?O(_):_;b(v,G)&&(I.leaf?M.push(_):h(v,G)?this._all(_,M):C.push(_))}I=C.pop()}return M},o.prototype.collides=function(v){var I=this.data;if(!b(v,I))return!1;for(var M=[];I;){for(var O=0;O<I.children.length;O++){var C=I.children[O],E=I.leaf?this.toBBox(C):C;if(b(v,E)){if(I.leaf||h(v,E))return!0;M.push(C)}}I=M.pop()}return!1},o.prototype.load=function(v){if(!v||!v.length)return this;if(v.length<this._minEntries){for(var I=0;I<v.length;I++)this.insert(v[I]);return this}var M=this._build(v.slice(),0,v.length-1,0);if(this.data.children.length)if(this.data.height===M.height)this._splitRoot(this.data,M);else{if(this.data.height<M.height){var O=this.data;this.data=M,M=O}this._insert(M,this.data.height-M.height-1,!0)}else this.data=M;return this},o.prototype.insert=function(v){return v&&this._insert(v,this.data.height-1),this},o.prototype.clear=function(){return this.data=x([]),this},o.prototype.remove=function(v,I){if(!v)return this;for(var M,O,C,E=this.data,_=this.toBBox(v),G=[],R=[];E||G.length;){if(E||(E=G.pop(),O=G[G.length-1],M=R.pop(),C=!0),E.leaf){var N=n(v,E.children,I);if(N!==-1)return E.children.splice(N,1),G.push(E),this._condense(G),this}C||E.leaf||!h(E,_)?O?(M++,E=O.children[M],C=!1):E=null:(G.push(E),R.push(M),M=0,O=E,E=E.children[0])}return this},o.prototype.toBBox=function(v){return v},o.prototype.compareMinX=function(v,I){return v.minX-I.minX},o.prototype.compareMinY=function(v,I){return v.minY-I.minY},o.prototype.toJSON=function(){return this.data},o.prototype.fromJSON=function(v){return this.data=v,this},o.prototype._all=function(v,I){for(var M=[];v;)v.leaf?I.push.apply(I,v.children):M.push.apply(M,v.children),v=M.pop();return I},o.prototype._build=function(v,I,M,O){var C,E=M-I+1,_=this._maxEntries;if(E<=_)return i(C=x(v.slice(I,M+1)),this.toBBox),C;O||(O=Math.ceil(Math.log(E)/Math.log(_)),_=Math.ceil(E/Math.pow(_,O-1))),(C=x([])).leaf=!1,C.height=O;var G=Math.ceil(E/_),R=G*Math.ceil(Math.sqrt(_));T(v,I,M,R,this.compareMinX);for(var N=I;N<=M;N+=R){var X=Math.min(N+R-1,M);T(v,N,X,G,this.compareMinY);for(var z=N;z<=X;z+=G){var ee=Math.min(z+G-1,X);C.children.push(this._build(v,z,ee,O-1))}}return i(C,this.toBBox),C},o.prototype._chooseSubtree=function(v,I,M,O){for(;O.push(I),!I.leaf&&O.length-1!==M;){for(var C=1/0,E=1/0,_=void 0,G=0;G<I.children.length;G++){var R=I.children[G],N=u(R),X=(z=v,ee=R,(Math.max(ee.maxX,z.maxX)-Math.min(ee.minX,z.minX))*(Math.max(ee.maxY,z.maxY)-Math.min(ee.minY,z.minY))-N);X<E?(E=X,C=N<C?N:C,_=R):X===E&&N<C&&(C=N,_=R)}I=_||I.children[0]}var z,ee;return I},o.prototype._insert=function(v,I,M){var O=M?v:this.toBBox(v),C=[],E=this._chooseSubtree(O,this.data,I,C);for(E.children.push(v),l(E,O);I>=0&&C[I].children.length>this._maxEntries;)this._split(C,I),I--;this._adjustParentBBoxes(O,C,I)},o.prototype._split=function(v,I){var M=v[I],O=M.children.length,C=this._minEntries;this._chooseSplitAxis(M,C,O);var E=this._chooseSplitIndex(M,C,O),_=x(M.children.splice(E,M.children.length-E));_.height=M.height,_.leaf=M.leaf,i(M,this.toBBox),i(_,this.toBBox),I?v[I-1].children.push(_):this._splitRoot(M,_)},o.prototype._splitRoot=function(v,I){this.data=x([v,I]),this.data.height=v.height+1,this.data.leaf=!1,i(this.data,this.toBBox)},o.prototype._chooseSplitIndex=function(v,I,M){for(var O,C,E,_,G,R,N,X=1/0,z=1/0,ee=I;ee<=M-I;ee++){var re=a(v,0,ee,this.toBBox),ue=a(v,ee,M,this.toBBox),Ce=(C=re,E=ue,_=void 0,G=void 0,R=void 0,N=void 0,_=Math.max(C.minX,E.minX),G=Math.max(C.minY,E.minY),R=Math.min(C.maxX,E.maxX),N=Math.min(C.maxY,E.maxY),Math.max(0,R-_)*Math.max(0,N-G)),Oe=u(re)+u(ue);Ce<X?(X=Ce,O=ee,z=Oe<z?Oe:z):Ce===X&&Oe<z&&(z=Oe,O=ee)}return O||M-I},o.prototype._chooseSplitAxis=function(v,I,M){var O=v.leaf?this.compareMinX:c,C=v.leaf?this.compareMinY:p;this._allDistMargin(v,I,M,O)<this._allDistMargin(v,I,M,C)&&v.children.sort(O)},o.prototype._allDistMargin=function(v,I,M,O){v.children.sort(O);for(var C=this.toBBox,E=a(v,0,I,C),_=a(v,M-I,M,C),G=f(E)+f(_),R=I;R<M-I;R++){var N=v.children[R];l(E,v.leaf?C(N):N),G+=f(E)}for(var X=M-I-1;X>=I;X--){var z=v.children[X];l(_,v.leaf?C(z):z),G+=f(_)}return G},o.prototype._adjustParentBBoxes=function(v,I,M){for(var O=M;O>=0;O--)l(I[O],v)},o.prototype._condense=function(v){for(var I=v.length-1,M=void 0;I>=0;I--)v[I].children.length===0?I>0?(M=v[I-1].children).splice(M.indexOf(v[I]),1):this.clear():i(v[I],this.toBBox)},o})});var SS=Cs(xe=>{"use strict";d();Object.defineProperty(xe,"__esModule",{value:!0});xe.earthRadius=63710088e-1;xe.factors={centimeters:xe.earthRadius*100,centimetres:xe.earthRadius*100,degrees:xe.earthRadius/111325,feet:xe.earthRadius*3.28084,inches:xe.earthRadius*39.37,kilometers:xe.earthRadius/1e3,kilometres:xe.earthRadius/1e3,meters:xe.earthRadius,metres:xe.earthRadius,miles:xe.earthRadius/1609.344,millimeters:xe.earthRadius*1e3,millimetres:xe.earthRadius*1e3,nauticalmiles:xe.earthRadius/1852,radians:1,yards:xe.earthRadius*1.0936};xe.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/xe.earthRadius,yards:1.0936133};xe.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 ol(e,r,t){t===void 0&&(t={});var o={type:"Feature"};return(t.id===0||t.id)&&(o.id=t.id),t.bbox&&(o.bbox=t.bbox),o.properties=r||{},o.geometry=e,o}xe.feature=ol;function pV(e,r,t){switch(t===void 0&&(t={}),e){case"Point":return bS(r).geometry;case"LineString":return vS(r).geometry;case"Polygon":return xS(r).geometry;case"MultiPoint":return u5(r).geometry;case"MultiLineString":return d5(r).geometry;case"MultiPolygon":return m5(r).geometry;default:throw new Error(e+" is invalid")}}xe.geometry=pV;function bS(e,r,t){if(t===void 0&&(t={}),!e)throw new Error("coordinates is required");if(!Array.isArray(e))throw new Error("coordinates must be an Array");if(e.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!i1(e[0])||!i1(e[1]))throw new Error("coordinates must contain numbers");var o={type:"Point",coordinates:e};return ol(o,r,t)}xe.point=bS;function dV(e,r,t){return t===void 0&&(t={}),s1(e.map(function(o){return bS(o,r)}),t)}xe.points=dV;function xS(e,r,t){t===void 0&&(t={});for(var o=0,n=e;o<n.length;o++){var i=n[o];if(i.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var a=0;a<i[i.length-1].length;a++)if(i[i.length-1][a]!==i[0][a])throw new Error("First and last Position are not equivalent.")}var l={type:"Polygon",coordinates:e};return ol(l,r,t)}xe.polygon=xS;function uV(e,r,t){return t===void 0&&(t={}),s1(e.map(function(o){return xS(o,r)}),t)}xe.polygons=uV;function vS(e,r,t){if(t===void 0&&(t={}),e.length<2)throw new Error("coordinates must be an array of two or more positions");var o={type:"LineString",coordinates:e};return ol(o,r,t)}xe.lineString=vS;function mV(e,r,t){return t===void 0&&(t={}),s1(e.map(function(o){return vS(o,r)}),t)}xe.lineStrings=mV;function s1(e,r){r===void 0&&(r={});var t={type:"FeatureCollection"};return r.id&&(t.id=r.id),r.bbox&&(t.bbox=r.bbox),t.features=e,t}xe.featureCollection=s1;function d5(e,r,t){t===void 0&&(t={});var o={type:"MultiLineString",coordinates:e};return ol(o,r,t)}xe.multiLineString=d5;function u5(e,r,t){t===void 0&&(t={});var o={type:"MultiPoint",coordinates:e};return ol(o,r,t)}xe.multiPoint=u5;function m5(e,r,t){t===void 0&&(t={});var o={type:"MultiPolygon",coordinates:e};return ol(o,r,t)}xe.multiPolygon=m5;function fV(e,r,t){t===void 0&&(t={});var o={type:"GeometryCollection",geometries:e};return ol(o,r,t)}xe.geometryCollection=fV;function hV(e,r){if(r===void 0&&(r=0),r&&!(r>=0))throw new Error("precision must be a positive number");var t=Math.pow(10,r||0);return Math.round(e*t)/t}xe.round=hV;function f5(e,r){r===void 0&&(r="kilometers");var t=xe.factors[r];if(!t)throw new Error(r+" units is invalid");return e*t}xe.radiansToLength=f5;function IS(e,r){r===void 0&&(r="kilometers");var t=xe.factors[r];if(!t)throw new Error(r+" units is invalid");return e/t}xe.lengthToRadians=IS;function gV(e,r){return h5(IS(e,r))}xe.lengthToDegrees=gV;function yV(e){var r=e%360;return r<0&&(r+=360),r}xe.bearingToAzimuth=yV;function h5(e){var r=e%(2*Math.PI);return r*180/Math.PI}xe.radiansToDegrees=h5;function bV(e){var r=e%360;return r*Math.PI/180}xe.degreesToRadians=bV;function xV(e,r,t){if(r===void 0&&(r="kilometers"),t===void 0&&(t="kilometers"),!(e>=0))throw new Error("length must be a positive number");return f5(IS(e,r),t)}xe.convertLength=xV;function vV(e,r,t){if(r===void 0&&(r="meters"),t===void 0&&(t="kilometers"),!(e>=0))throw new Error("area must be a positive number");var o=xe.areaFactors[r];if(!o)throw new Error("invalid original units");var n=xe.areaFactors[t];if(!n)throw new Error("invalid final units");return e/o*n}xe.convertArea=vV;function i1(e){return!isNaN(e)&&e!==null&&!Array.isArray(e)}xe.isNumber=i1;function IV(e){return!!e&&e.constructor===Object}xe.isObject=IV;function SV(e){if(!e)throw new Error("bbox is required");if(!Array.isArray(e))throw new Error("bbox must be an Array");if(e.length!==4&&e.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");e.forEach(function(r){if(!i1(r))throw new Error("bbox must only contain numbers")})}xe.validateBBox=SV;function TV(e){if(!e)throw new Error("id is required");if(["string","number"].indexOf(typeof e)===-1)throw new Error("id must be a number or a string")}xe.validateId=TV});var CS=Cs(br=>{"use strict";d();Object.defineProperty(br,"__esModule",{value:!0});var so=SS();function ff(e,r,t){if(e!==null)for(var o,n,i,a,l,c,p,u=0,f=0,h,b=e.type,x=b==="FeatureCollection",T=b==="Feature",v=x?e.features.length:1,I=0;I<v;I++){p=x?e.features[I].geometry:T?e.geometry:e,h=p?p.type==="GeometryCollection":!1,l=h?p.geometries.length:1;for(var M=0;M<l;M++){var O=0,C=0;if(a=h?p.geometries[M]:p,a!==null){c=a.coordinates;var E=a.type;switch(u=t&&(E==="Polygon"||E==="MultiPolygon")?1:0,E){case null:break;case"Point":if(r(c,f,I,O,C)===!1)return!1;f++,O++;break;case"LineString":case"MultiPoint":for(o=0;o<c.length;o++){if(r(c[o],f,I,O,C)===!1)return!1;f++,E==="MultiPoint"&&O++}E==="LineString"&&O++;break;case"Polygon":case"MultiLineString":for(o=0;o<c.length;o++){for(n=0;n<c[o].length-u;n++){if(r(c[o][n],f,I,O,C)===!1)return!1;f++}E==="MultiLineString"&&O++,E==="Polygon"&&C++}E==="Polygon"&&O++;break;case"MultiPolygon":for(o=0;o<c.length;o++){for(C=0,n=0;n<c[o].length;n++){for(i=0;i<c[o][n].length-u;i++){if(r(c[o][n][i],f,I,O,C)===!1)return!1;f++}C++}O++}break;case"GeometryCollection":for(o=0;o<a.geometries.length;o++)if(ff(a.geometries[o],r,t)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function CV(e,r,t,o){var n=t;return ff(e,function(i,a,l,c,p){a===0&&t===void 0?n=i:n=r(n,i,a,l,c,p)},o),n}function g5(e,r){var t;switch(e.type){case"FeatureCollection":for(t=0;t<e.features.length&&r(e.features[t].properties,t)!==!1;t++);break;case"Feature":r(e.properties,0);break}}function MV(e,r,t){var o=t;return g5(e,function(n,i){i===0&&t===void 0?o=n:o=r(o,n,i)}),o}function y5(e,r){if(e.type==="Feature")r(e,0);else if(e.type==="FeatureCollection")for(var t=0;t<e.features.length&&r(e.features[t],t)!==!1;t++);}function wV(e,r,t){var o=t;return y5(e,function(n,i){i===0&&t===void 0?o=n:o=r(o,n,i)}),o}function OV(e){var r=[];return ff(e,function(t){r.push(t)}),r}function TS(e,r){var t,o,n,i,a,l,c,p,u,f,h=0,b=e.type==="FeatureCollection",x=e.type==="Feature",T=b?e.features.length:1;for(t=0;t<T;t++){for(l=b?e.features[t].geometry:x?e.geometry:e,p=b?e.features[t].properties:x?e.properties:{},u=b?e.features[t].bbox:x?e.bbox:void 0,f=b?e.features[t].id:x?e.id:void 0,c=l?l.type==="GeometryCollection":!1,a=c?l.geometries.length:1,n=0;n<a;n++){if(i=c?l.geometries[n]:l,i===null){if(r(null,h,p,u,f)===!1)return!1;continue}switch(i.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(r(i,h,p,u,f)===!1)return!1;break}case"GeometryCollection":{for(o=0;o<i.geometries.length;o++)if(r(i.geometries[o],h,p,u,f)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}h++}}function EV(e,r,t){var o=t;return TS(e,function(n,i,a,l,c){i===0&&t===void 0?o=n:o=r(o,n,i,a,l,c)}),o}function a1(e,r){TS(e,function(t,o,n,i,a){var l=t===null?null:t.type;switch(l){case null:case"Point":case"LineString":case"Polygon":return r(so.feature(t,n,{bbox:i,id:a}),o,0)===!1?!1:void 0}var c;switch(l){case"MultiPoint":c="Point";break;case"MultiLineString":c="LineString";break;case"MultiPolygon":c="Polygon";break}for(var p=0;p<t.coordinates.length;p++){var u=t.coordinates[p],f={type:c,coordinates:u};if(r(so.feature(f,n),o,p)===!1)return!1}})}function PV(e,r,t){var o=t;return a1(e,function(n,i,a){i===0&&a===0&&t===void 0?o=n:o=r(o,n,i,a)}),o}function b5(e,r){a1(e,function(t,o,n){var i=0;if(t.geometry){var a=t.geometry.type;if(!(a==="Point"||a==="MultiPoint")){var l,c=0,p=0,u=0;if(ff(t,function(f,h,b,x,T){if(l===void 0||o>c||x>p||T>u){l=f,c=o,p=x,u=T,i=0;return}var v=so.lineString([l,f],t.properties);if(r(v,o,n,T,i)===!1)return!1;i++,l=f})===!1)return!1}}})}function FV(e,r,t){var o=t,n=!1;return b5(e,function(i,a,l,c,p){n===!1&&t===void 0?o=i:o=r(o,i,a,l,c,p),n=!0}),o}function x5(e,r){if(!e)throw new Error("geojson is required");a1(e,function(t,o,n){if(t.geometry!==null){var i=t.geometry.type,a=t.geometry.coordinates;switch(i){case"LineString":if(r(t,o,n,0,0)===!1)return!1;break;case"Polygon":for(var l=0;l<a.length;l++)if(r(so.lineString(a[l],t.properties),o,n,l)===!1)return!1;break}}})}function DV(e,r,t){var o=t;return x5(e,function(n,i,a,l){i===0&&t===void 0?o=n:o=r(o,n,i,a,l)}),o}function kV(e,r){if(r=r||{},!so.isObject(r))throw new Error("options is invalid");var t=r.featureIndex||0,o=r.multiFeatureIndex||0,n=r.geometryIndex||0,i=r.segmentIndex||0,a=r.properties,l;switch(e.type){case"FeatureCollection":t<0&&(t=e.features.length+t),a=a||e.features[t].properties,l=e.features[t].geometry;break;case"Feature":a=a||e.properties,l=e.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":l=e;break;default:throw new Error("geojson is invalid")}if(l===null)return null;var c=l.coordinates;switch(l.type){case"Point":case"MultiPoint":return null;case"LineString":return i<0&&(i=c.length+i-1),so.lineString([c[i],c[i+1]],a,r);case"Polygon":return n<0&&(n=c.length+n),i<0&&(i=c[n].length+i-1),so.lineString([c[n][i],c[n][i+1]],a,r);case"MultiLineString":return o<0&&(o=c.length+o),i<0&&(i=c[o].length+i-1),so.lineString([c[o][i],c[o][i+1]],a,r);case"MultiPolygon":return o<0&&(o=c.length+o),n<0&&(n=c[o].length+n),i<0&&(i=c[o][n].length-i-1),so.lineString([c[o][n][i],c[o][n][i+1]],a,r)}throw new Error("geojson is invalid")}function AV(e,r){if(r=r||{},!so.isObject(r))throw new Error("options is invalid");var t=r.featureIndex||0,o=r.multiFeatureIndex||0,n=r.geometryIndex||0,i=r.coordIndex||0,a=r.properties,l;switch(e.type){case"FeatureCollection":t<0&&(t=e.features.length+t),a=a||e.features[t].properties,l=e.features[t].geometry;break;case"Feature":a=a||e.properties,l=e.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":l=e;break;default:throw new Error("geojson is invalid")}if(l===null)return null;var c=l.coordinates;switch(l.type){case"Point":return so.point(c,a,r);case"MultiPoint":return o<0&&(o=c.length+o),so.point(c[o],a,r);case"LineString":return i<0&&(i=c.length+i),so.point(c[i],a,r);case"Polygon":return n<0&&(n=c.length+n),i<0&&(i=c[n].length+i),so.point(c[n][i],a,r);case"MultiLineString":return o<0&&(o=c.length+o),i<0&&(i=c[o].length+i),so.point(c[o][i],a,r);case"MultiPolygon":return o<0&&(o=c.length+o),n<0&&(n=c[o].length+n),i<0&&(i=c[o][n].length-i),so.point(c[o][n][i],a,r)}throw new Error("geojson is invalid")}br.coordAll=OV;br.coordEach=ff;br.coordReduce=CV;br.featureEach=y5;br.featureReduce=wV;br.findPoint=AV;br.findSegment=kV;br.flattenEach=a1;br.flattenReduce=PV;br.geomEach=TS;br.geomReduce=EV;br.lineEach=x5;br.lineReduce=DV;br.propEach=g5;br.propReduce=MV;br.segmentEach=b5;br.segmentReduce=FV});var v5=Cs(wS=>{"use strict";d();Object.defineProperty(wS,"__esModule",{value:!0});var LV=CS();function MS(e){var r=[1/0,1/0,-1/0,-1/0];return LV.coordEach(e,function(t){r[0]>t[0]&&(r[0]=t[0]),r[1]>t[1]&&(r[1]=t[1]),r[2]<t[0]&&(r[2]=t[0]),r[3]<t[1]&&(r[3]=t[1])}),r}MS.default=MS;wS.default=MS});var M5=Cs((oSe,OS)=>{d();var Qi=p5(),S5=SS(),T5=CS(),Md=v5().default,_V=T5.featureEach,tSe=T5.coordEach,rSe=S5.polygon,I5=S5.featureCollection;function C5(e){var r=new Qi(e);return r.insert=function(t){if(t.type!=="Feature")throw new Error("invalid feature");return t.bbox=t.bbox?t.bbox:Md(t),Qi.prototype.insert.call(this,t)},r.load=function(t){var o=[];return Array.isArray(t)?t.forEach(function(n){if(n.type!=="Feature")throw new Error("invalid features");n.bbox=n.bbox?n.bbox:Md(n),o.push(n)}):_V(t,function(n){if(n.type!=="Feature")throw new Error("invalid features");n.bbox=n.bbox?n.bbox:Md(n),o.push(n)}),Qi.prototype.load.call(this,o)},r.remove=function(t,o){if(t.type!=="Feature")throw new Error("invalid feature");return t.bbox=t.bbox?t.bbox:Md(t),Qi.prototype.remove.call(this,t,o)},r.clear=function(){return Qi.prototype.clear.call(this)},r.search=function(t){var o=Qi.prototype.search.call(this,this.toBBox(t));return I5(o)},r.collides=function(t){return Qi.prototype.collides.call(this,this.toBBox(t))},r.all=function(){var t=Qi.prototype.all.call(this);return I5(t)},r.toJSON=function(){return Qi.prototype.toJSON.call(this)},r.fromJSON=function(t){return Qi.prototype.fromJSON.call(this,t)},r.toBBox=function(t){var o;if(t.bbox)o=t.bbox;else if(Array.isArray(t)&&t.length===4)o=t;else if(Array.isArray(t)&&t.length===6)o=[t[0],t[1],t[3],t[4]];else if(t.type==="Feature")o=Md(t);else if(t.type==="FeatureCollection")o=Md(t);else throw new Error("invalid geojson");return{minX:o[0],minY:o[1],maxX:o[2],maxY:o[3]}},r}OS.exports=C5;OS.exports.default=C5});var Ak=Cs((qh,Uu)=>{d();var vz=200,uk="__lodash_hash_undefined__",Iz=800,Sz=16,mk=9007199254740991,fk="[object Arguments]",Tz="[object Array]",Cz="[object AsyncFunction]",Mz="[object Boolean]",wz="[object Date]",Oz="[object Error]",hk="[object Function]",Ez="[object GeneratorFunction]",Pz="[object Map]",Fz="[object Number]",Dz="[object Null]",gk="[object Object]",kz="[object Proxy]",Az="[object RegExp]",Lz="[object Set]",_z="[object String]",Rz="[object Undefined]",Bz="[object WeakMap]",Nz="[object ArrayBuffer]",jz="[object DataView]",Gz="[object Float32Array]",Uz="[object Float64Array]",Vz="[object Int8Array]",$z="[object Int16Array]",Hz="[object Int32Array]",zz="[object Uint8Array]",Wz="[object Uint8ClampedArray]",Zz="[object Uint16Array]",Xz="[object Uint32Array]",Yz=/[\\^$.*+?()[\]{}|]/g,Jz=/^\[object .+?Constructor\]$/,Kz=/^(?:0|[1-9]\d*)$/,Bt={};Bt[Gz]=Bt[Uz]=Bt[Vz]=Bt[$z]=Bt[Hz]=Bt[zz]=Bt[Wz]=Bt[Zz]=Bt[Xz]=!0;Bt[fk]=Bt[Tz]=Bt[Nz]=Bt[Mz]=Bt[jz]=Bt[wz]=Bt[Oz]=Bt[hk]=Bt[Pz]=Bt[Fz]=Bt[gk]=Bt[Az]=Bt[Lz]=Bt[_z]=Bt[Bz]=!1;var yk=typeof global=="object"&&global&&global.Object===Object&&global,Qz=typeof self=="object"&&self&&self.Object===Object&&self,rg=yk||Qz||Function("return this")(),bk=typeof qh=="object"&&qh&&!qh.nodeType&&qh,eg=bk&&typeof Uu=="object"&&Uu&&!Uu.nodeType&&Uu,xk=eg&&eg.exports===bk,dT=xk&&yk.process,ok=function(){try{var e=eg&&eg.require&&eg.require("util").types;return e||dT&&dT.binding&&dT.binding("util")}catch{}}(),nk=ok&&ok.isTypedArray;function vk(e,r,t){switch(t.length){case 0:return e.call(r);case 1:return e.call(r,t[0]);case 2:return e.call(r,t[0],t[1]);case 3:return e.call(r,t[0],t[1],t[2])}return e.apply(r,t)}function qz(e,r){for(var t=-1,o=Array(e);++t<e;)o[t]=r(t);return o}function eW(e){return function(r){return e(r)}}function tW(e,r){return e?.[r]}function rW(e,r){return function(t){return e(r(t))}}var oW=Array.prototype,nW=Function.prototype,Vx=Object.prototype,uT=rg["__core-js_shared__"],$x=nW.toString,Ia=Vx.hasOwnProperty,ik=function(){var e=/[^.]+$/.exec(uT&&uT.keys&&uT.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),Ik=Vx.toString,iW=$x.call(Object),sW=RegExp("^"+$x.call(Ia).replace(Yz,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Gx=xk?rg.Buffer:void 0,sk=rg.Symbol,ak=rg.Uint8Array,lk=Gx?Gx.allocUnsafe:void 0,Sk=rW(Object.getPrototypeOf,Object),ck=Object.create,aW=Vx.propertyIsEnumerable,lW=oW.splice,Qc=sk?sk.toStringTag:void 0,Ux=function(){try{var e=xT(Object,"defineProperty");return e({},"",{}),e}catch{}}(),cW=Gx?Gx.isBuffer:void 0,pk=Math.max,pW=Date.now,Tk=xT(rg,"Map"),tg=xT(Object,"create"),dW=function(){function e(){}return function(r){if(!va(r))return{};if(ck)return ck(r);e.prototype=r;var t=new e;return e.prototype=void 0,t}}();function qc(e){var r=-1,t=e==null?0:e.length;for(this.clear();++r<t;){var o=e[r];this.set(o[0],o[1])}}function uW(){this.__data__=tg?tg(null):{},this.size=0}function mW(e){var r=this.has(e)&&delete this.__data__[e];return this.size-=r?1:0,r}function fW(e){var r=this.__data__;if(tg){var t=r[e];return t===uk?void 0:t}return Ia.call(r,e)?r[e]:void 0}function hW(e){var r=this.__data__;return tg?r[e]!==void 0:Ia.call(r,e)}function gW(e,r){var t=this.__data__;return this.size+=this.has(e)?0:1,t[e]=tg&&r===void 0?uk:r,this}qc.prototype.clear=uW;qc.prototype.delete=mW;qc.prototype.get=fW;qc.prototype.has=hW;qc.prototype.set=gW;function Sa(e){var r=-1,t=e==null?0:e.length;for(this.clear();++r<t;){var o=e[r];this.set(o[0],o[1])}}function yW(){this.__data__=[],this.size=0}function bW(e){var r=this.__data__,t=Hx(r,e);if(t<0)return!1;var o=r.length-1;return t==o?r.pop():lW.call(r,t,1),--this.size,!0}function xW(e){var r=this.__data__,t=Hx(r,e);return t<0?void 0:r[t][1]}function vW(e){return Hx(this.__data__,e)>-1}function IW(e,r){var t=this.__data__,o=Hx(t,e);return o<0?(++this.size,t.push([e,r])):t[o][1]=r,this}Sa.prototype.clear=yW;Sa.prototype.delete=bW;Sa.prototype.get=xW;Sa.prototype.has=vW;Sa.prototype.set=IW;function Vu(e){var r=-1,t=e==null?0:e.length;for(this.clear();++r<t;){var o=e[r];this.set(o[0],o[1])}}function SW(){this.size=0,this.__data__={hash:new qc,map:new(Tk||Sa),string:new qc}}function TW(e){var r=Wx(this,e).delete(e);return this.size-=r?1:0,r}function CW(e){return Wx(this,e).get(e)}function MW(e){return Wx(this,e).has(e)}function wW(e,r){var t=Wx(this,e),o=t.size;return t.set(e,r),this.size+=t.size==o?0:1,this}Vu.prototype.clear=SW;Vu.prototype.delete=TW;Vu.prototype.get=CW;Vu.prototype.has=MW;Vu.prototype.set=wW;function $u(e){var r=this.__data__=new Sa(e);this.size=r.size}function OW(){this.__data__=new Sa,this.size=0}function EW(e){var r=this.__data__,t=r.delete(e);return this.size=r.size,t}function PW(e){return this.__data__.get(e)}function FW(e){return this.__data__.has(e)}function DW(e,r){var t=this.__data__;if(t instanceof Sa){var o=t.__data__;if(!Tk||o.length<vz-1)return o.push([e,r]),this.size=++t.size,this;t=this.__data__=new Vu(o)}return t.set(e,r),this.size=t.size,this}$u.prototype.clear=OW;$u.prototype.delete=EW;$u.prototype.get=PW;$u.prototype.has=FW;$u.prototype.set=DW;function kW(e,r){var t=gT(e),o=!t&&hT(e),n=!t&&!o&&Ek(e),i=!t&&!o&&!n&&Fk(e),a=t||o||n||i,l=a?qz(e.length,String):[],c=l.length;for(var p in e)(r||Ia.call(e,p))&&!(a&&(p=="length"||n&&(p=="offset"||p=="parent")||i&&(p=="buffer"||p=="byteLength"||p=="byteOffset")||wk(p,c)))&&l.push(p);return l}function mT(e,r,t){(t!==void 0&&!Zx(e[r],t)||t===void 0&&!(r in e))&&yT(e,r,t)}function AW(e,r,t){var o=e[r];(!(Ia.call(e,r)&&Zx(o,t))||t===void 0&&!(r in e))&&yT(e,r,t)}function Hx(e,r){for(var t=e.length;t--;)if(Zx(e[t][0],r))return t;return-1}function yT(e,r,t){r=="__proto__"&&Ux?Ux(e,r,{configurable:!0,enumerable:!0,value:t,writable:!0}):e[r]=t}var LW=WW();function zx(e){return e==null?e===void 0?Rz:Dz:Qc&&Qc in Object(e)?ZW(e):qW(e)}function dk(e){return og(e)&&zx(e)==fk}function _W(e){if(!va(e)||KW(e))return!1;var r=IT(e)?sW:Jz;return r.test(oZ(e))}function RW(e){return og(e)&&Pk(e.length)&&!!Bt[zx(e)]}function BW(e){if(!va(e))return QW(e);var r=Ok(e),t=[];for(var o in e)o=="constructor"&&(r||!Ia.call(e,o))||t.push(o);return t}function bT(e,r,t,o,n){e!==r&&LW(r,function(i,a){if(n||(n=new $u),va(i))NW(e,r,a,t,bT,o,n);else{var l=o?o(fT(e,a),i,a+"",e,r,n):void 0;l===void 0&&(l=i),mT(e,a,l)}},Dk)}function NW(e,r,t,o,n,i,a){var l=fT(e,t),c=fT(r,t),p=a.get(c);if(p){mT(e,t,p);return}var u=i?i(l,c,t+"",e,r,a):void 0,f=u===void 0;if(f){var h=gT(c),b=!h&&Ek(c),x=!h&&!b&&Fk(c);u=c,h||b||x?gT(l)?u=l:nZ(l)?u=$W(l):b?(f=!1,u=GW(c,!0)):x?(f=!1,u=VW(c,!0)):u=[]:iZ(c)||hT(c)?(u=l,hT(l)?u=sZ(l):(!va(l)||IT(l))&&(u=XW(c))):f=!1}f&&(a.set(c,u),n(u,c,o,i,a),a.delete(c)),mT(e,t,u)}function Ck(e,r){return tZ(eZ(e,r,kk),e+"")}var jW=Ux?function(e,r){return Ux(e,"toString",{configurable:!0,enumerable:!1,value:cZ(r),writable:!0})}:kk;function GW(e,r){if(r)return e.slice();var t=e.length,o=lk?lk(t):new e.constructor(t);return e.copy(o),o}function UW(e){var r=new e.constructor(e.byteLength);return new ak(r).set(new ak(e)),r}function VW(e,r){var t=r?UW(e.buffer):e.buffer;return new e.constructor(t,e.byteOffset,e.length)}function $W(e,r){var t=-1,o=e.length;for(r||(r=Array(o));++t<o;)r[t]=e[t];return r}function HW(e,r,t,o){var n=!t;t||(t={});for(var i=-1,a=r.length;++i<a;){var l=r[i],c=o?o(t[l],e[l],l,t,e):void 0;c===void 0&&(c=e[l]),n?yT(t,l,c):AW(t,l,c)}return t}function zW(e){return Ck(function(r,t){var o=-1,n=t.length,i=n>1?t[n-1]:void 0,a=n>2?t[2]:void 0;for(i=e.length>3&&typeof i=="function"?(n--,i):void 0,a&&YW(t[0],t[1],a)&&(i=n<3?void 0:i,n=1),r=Object(r);++o<n;){var l=t[o];l&&e(r,l,o,i)}return r})}function WW(e){return function(r,t,o){for(var n=-1,i=Object(r),a=o(r),l=a.length;l--;){var c=a[e?l:++n];if(t(i[c],c,i)===!1)break}return r}}function Mk(e,r,t,o,n,i){return va(e)&&va(r)&&(i.set(r,e),bT(e,r,void 0,Mk,i),i.delete(r)),e}function Wx(e,r){var t=e.__data__;return JW(r)?t[typeof r=="string"?"string":"hash"]:t.map}function xT(e,r){var t=tW(e,r);return _W(t)?t:void 0}function ZW(e){var r=Ia.call(e,Qc),t=e[Qc];try{e[Qc]=void 0;var o=!0}catch{}var n=Ik.call(e);return o&&(r?e[Qc]=t:delete e[Qc]),n}function XW(e){return typeof e.constructor=="function"&&!Ok(e)?dW(Sk(e)):{}}function wk(e,r){var t=typeof e;return r=r??mk,!!r&&(t=="number"||t!="symbol"&&Kz.test(e))&&e>-1&&e%1==0&&e<r}function YW(e,r,t){if(!va(t))return!1;var o=typeof r;return(o=="number"?vT(t)&&wk(r,t.length):o=="string"&&r in t)?Zx(t[r],e):!1}function JW(e){var r=typeof e;return r=="string"||r=="number"||r=="symbol"||r=="boolean"?e!=="__proto__":e===null}function KW(e){return!!ik&&ik in e}function Ok(e){var r=e&&e.constructor,t=typeof r=="function"&&r.prototype||Vx;return e===t}function QW(e){var r=[];if(e!=null)for(var t in Object(e))r.push(t);return r}function qW(e){return Ik.call(e)}function eZ(e,r,t){return r=pk(r===void 0?e.length-1:r,0),function(){for(var o=arguments,n=-1,i=pk(o.length-r,0),a=Array(i);++n<i;)a[n]=o[r+n];n=-1;for(var l=Array(r+1);++n<r;)l[n]=o[n];return l[r]=t(a),vk(e,this,l)}}function fT(e,r){if(!(r==="constructor"&&typeof e[r]=="function")&&r!="__proto__")return e[r]}var tZ=rZ(jW);function rZ(e){var r=0,t=0;return function(){var o=pW(),n=Sz-(o-t);if(t=o,n>0){if(++r>=Iz)return arguments[0]}else r=0;return e.apply(void 0,arguments)}}function oZ(e){if(e!=null){try{return $x.call(e)}catch{}try{return e+""}catch{}}return""}function Zx(e,r){return e===r||e!==e&&r!==r}var hT=dk(function(){return arguments}())?dk:function(e){return og(e)&&Ia.call(e,"callee")&&!aW.call(e,"callee")},gT=Array.isArray;function vT(e){return e!=null&&Pk(e.length)&&!IT(e)}function nZ(e){return og(e)&&vT(e)}var Ek=cW||pZ;function IT(e){if(!va(e))return!1;var r=zx(e);return r==hk||r==Ez||r==Cz||r==kz}function Pk(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=mk}function va(e){var r=typeof e;return e!=null&&(r=="object"||r=="function")}function og(e){return e!=null&&typeof e=="object"}function iZ(e){if(!og(e)||zx(e)!=gk)return!1;var r=Sk(e);if(r===null)return!0;var t=Ia.call(r,"constructor")&&r.constructor;return typeof t=="function"&&t instanceof t&&$x.call(t)==iW}var Fk=nk?eW(nk):RW;function sZ(e){return HW(e,Dk(e))}var aZ=Ck(function(e){return e.push(void 0,Mk),vk(lZ,void 0,e)});function Dk(e){return vT(e)?kW(e,!0):BW(e)}var lZ=zW(function(e,r,t,o){bT(e,r,t,o)});function cZ(e){return function(){return e}}function kk(e){return e}function pZ(){return!1}Uu.exports=aZ});var Hk=Cs((U9e,Xx)=>{d();(function(){"use strict";function e(a,l){var c=a.x-l.x,p=a.y-l.y;return c*c+p*p}function r(a,l,c){var p=l.x,u=l.y,f=c.x-p,h=c.y-u;if(f!==0||h!==0){var b=((a.x-p)*f+(a.y-u)*h)/(f*f+h*h);b>1?(p=c.x,u=c.y):b>0&&(p+=f*b,u+=h*b)}return f=a.x-p,h=a.y-u,f*f+h*h}function t(a,l){for(var c=a[0],p=[c],u,f=1,h=a.length;f<h;f++)u=a[f],e(u,c)>l&&(p.push(u),c=u);return c!==u&&p.push(u),p}function o(a,l,c,p,u){for(var f=p,h,b=l+1;b<c;b++){var x=r(a[b],a[l],a[c]);x>f&&(h=b,f=x)}f>p&&(h-l>1&&o(a,l,h,p,u),u.push(a[h]),c-h>1&&o(a,h,c,p,u))}function n(a,l){var c=a.length-1,p=[a[0]];return o(a,0,c,l,p),p.push(a[c]),p}function i(a,l,c){if(a.length<=2)return a;var p=l!==void 0?l*l:1;return a=c?a:t(a,p),a=n(a,p),a}typeof define=="function"&&define.amd?define(function(){return i}):typeof Xx<"u"?(Xx.exports=i,Xx.exports.default=i):typeof self<"u"?self.simplify=i:window.simplify=i})()});d();d();d();d();d();d();var xm=e=>e!=null;var T7=function(){let r=globalThis.fetch;return{fetch(...t){if(!xm(r))throw new Error("fetch is not available in your environment. Pass your own function into `setFetchFn` (node-fetch, etc)");return r?.(...t)},setFetch(t){r=t}}}(),NM=T7.fetch;var $M=["websdk","web","webv2","kiosk-v2","mobile","iossdk","androidsdk","reactnativesdk","gen7","bespoke","reactsdk"],jM=$M[0],HM="https://api-gateway.mappedin.com/track-analytics/a/",zM="deny-watchposition",WM="load-mapview",ZM="load-mapdata",XM="change-language",YM="query-directions";var Bi,pn,ks,z0,yy,Pp=class{constructor(){S(this,ks);S(this,Bi,Object.freeze({}));S(this,pn);m(this,"oneTimeEventsSent",new Set);m(this,"sendGetDirectionsEvent",S0((r,t,o)=>{let n={start:r,end:t,type:"location_to_location"};return o!==void 0&&(n.accessible=o),this.sendAnalyticEvent(YM,n)},2500));w(this,pn,W(this,ks,yy).call(this,s(this,Bi)))}init(r){this.reset(),this.updateStateWithOptions(r)}reset(){w(this,Bi,{}),w(this,pn,W(this,ks,yy).call(this,{})),this.oneTimeEventsSent.clear()}updateStateWithOptions(r){return w(this,Bi,Object.freeze(Object.assign({},s(this,Bi),r))),w(this,pn,W(this,ks,yy).call(this,r)),W(this,ks,z0).call(this,s(this,pn)),s(this,pn)}updateState(r){let t={...r};t.mapId&&(t.analyticsBaseUrl=H0({...s(this,pn),mapId:t.mapId})),t.context&&(t.context=VM(t.context)),t.baseUri&&(t.analyticsBaseUrl=H0({baseUri:t.baseUri,mapId:s(this,pn).mapId})),Object.assign(s(this,pn),t),this.handleStateUpdate(r),W(this,ks,z0).call(this,t)}handleStateUpdate(r){r.userPosition?.floorLevel?this.sendBlueDotEvents("found-floor"):r.userPosition&&this.sendBlueDotEvents("found-position")}get authReady(){let{key:r,secret:t,accessToken:o}=this.getState();return!!(r&&t)||!!o}getState(){return s(this,pn)}getContext(){return this.getState().context||s(this,Bi).context||jM}getSessionId(){return this.getState().sessionId||s(this,Bi).sessionId||UM()}getDeviceId(){return this.getState().deviceId||s(this,Bi).deviceId||GM()}sendAnalyticEvent(r,t={}){let o=this.getState(),n=C7(o.analyticsBaseUrl,r),i={"mi-context":this.getContext(),"mi-session":this.getSessionId(),"mi-device":this.getDeviceId()};if(o.logEvents&&A.log("Analytics.track",n,i),!o.sendEvents)return Promise.resolve();if(!this.authReady)return A.warn("Auth needs to be ready to send analytics.");let a={...t,g:o.geolocationMode,sdk_version:o.version};return o.userPosition&&Object.assign(a,o.userPosition),i["Content-Type"]="application/json",o.accessToken?i.Authorization=`Bearer ${o.accessToken}`:o.noAuth||o.secret&&o.key&&(i["x-mappedin-key"]=btoa(o.key),i["x-mappedin-secret"]=btoa(o.secret)),NM(n,{method:"POST",mode:"cors",headers:i,body:JSON.stringify(a)})}capture(r,t){if(w7.includes(r))return A.warn(`${r} event is sent internally.`),Promise.resolve();let o=M7.includes(r)?r.slice(1):r;return this.sendAnalyticEvent(o,t)}sendGetMapDataEvent(r){return this.sendAnalyticEvent(ZM,r)}sendChangeLanguageEvent(r){return this.sendAnalyticEvent(XM,r)}sendWatchPositionDenied(){return this.sendAnalyticEvent(zM)}sendMapViewLoadedEvent({firstRenderDuration:r,dimension:t,collisionWorkerDisabled:o,outdoorsWorkerDisabled:n}){return this.sendAnalyticEvent(WM,{type:"3d",firstRenderDuration:r,width:t.width,height:t.height,devicePixelRatio:globalThis.devicePixelRatio||1,collisionWorkerDisabled:o,outdoorsWorkerDisabled:n})}sendBlueDotEvents(r){if(!((r==="found-floor"||r==="found-position")&&this.oneTimeEventsSent.has(r)))return this.oneTimeEventsSent.add(r),this.sendAnalyticEvent(r)}};Bi=new WeakMap,pn=new WeakMap,ks=new WeakSet,z0=function(r){r.sessionId&&Es.getInstance().saveSessionData("id",r.sessionId),r.deviceId&&Es.getInstance().saveLocalData("deviceId",r.deviceId)},yy=function(r){let t=r.baseUri??HM;return{baseUri:t,analyticsBaseUrl:H0({...r,baseUri:t}),version:y?.env?.npm_package_version||"v6",deviceId:r.deviceId||GM(),accessToken:r.accessToken,mapId:r.mapId,sessionId:r.sessionId||UM(),platformString:r.platformString||"",context:VM(r.context)||jM,geolocationMode:!1,sendEvents:r.sendEvents??!0,logEvents:r.logEvents??!1,noAuth:r.noAuth||!1,key:r.key,secret:r.secret}};function H0({mapId:e,baseUri:r=HM}){return`${r}${e}/`}function GM(){return Es.getInstance().loadLocalData("deviceId")}function UM(){return Es.getInstance().loadSessionData("id")}function C7(e,r){return e+r}function VM(e){return $M.find(r=>r===e)}var M7=["$select-location","$select-category","$query-suggest","$query-search"],w7=[WM,ZM,YM,zM,XM],xX=new Pp,dn,vm=class{constructor(r){S(this,dn);m(this,"capture");m(this,"updateState");w(this,dn,r),this.capture=s(this,dn).capture.bind(s(this,dn)),this.updateState=s(this,dn).updateState.bind(s(this,dn))}getState(){let{sessionId:r,deviceId:t,...o}=s(this,dn).getState();return o}getContext(){return s(this,dn).getContext()}getSessionId(){return s(this,dn).getSessionId()}getDeviceId(){return s(this,dn).getDeviceId()}};dn=new WeakMap;d();d();var Sm,Tm,Cm,Im=class{constructor(r,t,{enabled:o=!1}={}){S(this,Sm);m(this,"searchInstance");S(this,Tm);S(this,Cm);m(this,"enabled",!1);w(this,Sm,r),w(this,Tm,t),w(this,Cm,()=>{this.searchInstance?.then(n=>n.populate())}),o&&this.enable()}async query(r,t={}){if(this.enabled||await this.enable(),!this.searchInstance)return A.error("Search should be enabled by now"),{places:[],enterpriseLocations:[],enterpriseCategories:[]};try{return await(await this.searchInstance).search(r,t)}catch(o){return A.error("Search.query failed due to",o),{places:[],enterpriseLocations:[],enterpriseCategories:[]}}}async suggest(r,t={}){if(this.enabled||await this.enable(),!this.searchInstance)return A.error("Search should be enabled by now"),[];try{return await(await this.searchInstance).suggest(r,t)}catch(o){return A.error("Search.suggest failed due to",o),[]}}async enable(){this.enabled||(this.enabled=!0,this.searchInstance||(this.searchInstance=import("./internal-ERAZRCF7.js").then(({InternalSearch:r})=>new r(s(this,Sm)))),s(this,Tm).on("language-change",s(this,Cm)),await this.searchInstance)}};Sm=new WeakMap,Tm=new WeakMap,Cm=new WeakMap;var JM=new WeakMap,Gl,At,W0=class{constructor(r,{search:t}={}){S(this,Gl);S(this,At);m(this,"Analytics");m(this,"Search");m(this,"Query");m(this,"internal");m(this,"on",(r,t)=>{s(this,Gl).on(r,t)});m(this,"off",(r,t)=>{s(this,Gl).off(r,t)});m(this,"__LEGACY_GET_DIRECTIONS_SYNC",(r,t,o)=>s(this,At).__LEGACY_GET_DIRECTIONS_SYNC(r,t,o));m(this,"getDirections",(r,t,o)=>s(this,At).getDirections(r,t,o));m(this,"__LEGACY_GET_DIRECTIONS_MULTI_DESTINATION_SYNC",(r,t,o)=>s(this,At).__LEGACY_GET_DIRECTIONS_MULTI_DESTINATION_SYNC(r,t,o));m(this,"getDirectionsMultiDestination",(r,t,o)=>s(this,At).getDirectionsMultiDestination(r,t,o));w(this,Gl,new ke),w(this,At,r),JM.set(this,r),this.Analytics=new vm(r.Analytics),this.Query=r.Query,this.internal=r,this.Search=new Im(this,r,{enabled:t?.enabled}),s(this,At).on("language-change",o=>{s(this,Gl).publish("language-change",o)})}getEnv(){return s(this,At).getEnv()}getAccessToken(){return s(this,At).tokenManager?.getAccessToken().token}get mapName(){return s(this,At).mapName}get mapId(){return s(this,At).getMapDataOptions?.mapId}get mapCenter(){return s(this,At).mapCenter}get organizationId(){return s(this,At).organizationId}get outdoorViewToken(){return s(this,At).outdoorViewToken}getByType(r){return s(this,At).getByType(r)}getById(r,t){return s(this,At).getById(r,t)}getByExternalId(r,t){return s(this,At).getByExternalId(r,t)}getGeoJSON(r){return r.geoJSON}async changeLanguage(r){return s(this,At).changeLanguage(r)}get currentLanguage(){return s(this,At).currentLanguage}get naturalBearing(){return s(this,At).naturalBearing??0}getDistance(r,t){return s(this,At).getDistance(r,t)}toBinaryBundle({downloadLanguagePacks:r=!0}={}){return s(this,At).toBinaryBundle({downloadLanguagePacks:r})}toJSONBundle({downloadLanguagePacks:r=!0}={}){return s(this,At).toJSONBundle({downloadLanguagePacks:r})}};Gl=new WeakMap,At=new WeakMap;var Mm=W0;function wm(e){let r=JM.get(e);if(!r)throw new Error("MapDataInternal not found");return r}d();d();d();d();d();d();d();d();d();d();d();d();d();d();d();d();d();d();d();d();d();d();d();d();d();d();d();d();var Ye={};La(Ye,{HasPropertyKey:()=>O7,IsArray:()=>qr,IsAsyncIterator:()=>Z0,IsBigInt:()=>Om,IsBoolean:()=>Va,IsDate:()=>Ul,IsFunction:()=>X0,IsIterator:()=>Y0,IsNull:()=>J0,IsNumber:()=>Zn,IsObject:()=>vt,IsRegExp:()=>Em,IsString:()=>Pt,IsSymbol:()=>K0,IsUint8Array:()=>As,IsUndefined:()=>zt});d();function O7(e,r){return r in e}function Z0(e){return vt(e)&&!qr(e)&&!As(e)&&Symbol.asyncIterator in e}function qr(e){return Array.isArray(e)}function Om(e){return typeof e=="bigint"}function Va(e){return typeof e=="boolean"}function Ul(e){return e instanceof globalThis.Date}function X0(e){return typeof e=="function"}function Y0(e){return vt(e)&&!qr(e)&&!As(e)&&Symbol.iterator in e}function J0(e){return e===null}function Zn(e){return typeof e=="number"}function vt(e){return typeof e=="object"&&e!==null}function Em(e){return e instanceof globalThis.RegExp}function Pt(e){return typeof e=="string"}function K0(e){return typeof e=="symbol"}function As(e){return e instanceof globalThis.Uint8Array}function zt(e){return e===void 0}function E7(e){return e.map(r=>by(r))}function P7(e){return new Date(e.getTime())}function F7(e){return new Uint8Array(e)}function D7(e){return new RegExp(e.source,e.flags)}function k7(e){let r={};for(let t of Object.getOwnPropertyNames(e))r[t]=by(e[t]);for(let t of Object.getOwnPropertySymbols(e))r[t]=by(e[t]);return r}function by(e){return qr(e)?E7(e):Ul(e)?P7(e):As(e)?F7(e):Em(e)?D7(e):vt(e)?k7(e):e}function Lt(e){return by(e)}function KM(e){return e.map(r=>Pm(r))}function Pm(e,r){return r===void 0?Lt(e):Lt({...r,...e})}d();d();d();function xy(e){return Ae(e)&&Symbol.asyncIterator in e}function vy(e){return Ae(e)&&Symbol.iterator in e}function Q0(e){return Ae(e)&&(Object.getPrototypeOf(e)===Object.prototype||Object.getPrototypeOf(e)===null)}function Iy(e){return e instanceof Promise}function uo(e){return e instanceof Date&&Number.isFinite(e.getTime())}function QM(e){return e instanceof globalThis.Map}function qM(e){return e instanceof globalThis.Set}function un(e){return ArrayBuffer.isView(e)}function Fp(e){return e instanceof globalThis.Uint8Array}function ve(e,r){return r in e}function Ae(e){return e!==null&&typeof e=="object"}function we(e){return Array.isArray(e)&&!ArrayBuffer.isView(e)}function Wt(e){return e===void 0}function Ls(e){return e===null}function Ni(e){return typeof e=="boolean"}function me(e){return typeof e=="number"}function Sy(e){return Number.isInteger(e)}function jr(e){return typeof e=="bigint"}function He(e){return typeof e=="string"}function $a(e){return typeof e=="function"}function _s(e){return typeof e=="symbol"}function Gr(e){return jr(e)||Ni(e)||Ls(e)||me(e)||He(e)||_s(e)||Wt(e)}var pt;(function(e){e.InstanceMode="default",e.ExactOptionalPropertyTypes=!1,e.AllowArrayObject=!1,e.AllowNaN=!1,e.AllowNullVoid=!1;function r(a,l){return e.ExactOptionalPropertyTypes?l in a:a[l]!==void 0}e.IsExactOptionalProperty=r;function t(a){let l=Ae(a);return e.AllowArrayObject?l:l&&!we(a)}e.IsObjectLike=t;function o(a){return t(a)&&!(a instanceof Date)&&!(a instanceof Uint8Array)}e.IsRecordLike=o;function n(a){return e.AllowNaN?me(a):Number.isFinite(a)}e.IsNumberLike=n;function i(a){let l=Wt(a);return e.AllowNullVoid?l||a===null:l}e.IsVoidLike=i})(pt||(pt={}));d();function A7(e){return globalThis.Object.freeze(e).map(r=>Fm(r))}function L7(e){let r={};for(let t of Object.getOwnPropertyNames(e))r[t]=Fm(e[t]);for(let t of Object.getOwnPropertySymbols(e))r[t]=Fm(e[t]);return globalThis.Object.freeze(r)}function Fm(e){return qr(e)?A7(e):Ul(e)?e:As(e)?e:Em(e)?e:vt(e)?L7(e):e}function Z(e,r){let t=r!==void 0?{...r,...e}:e;switch(pt.InstanceMode){case"freeze":return Fm(t);case"clone":return Lt(t);default:return t}}d();var be=class extends Error{constructor(r){super(r)}};d();d();d();var _t=Symbol.for("TypeBox.Transform"),Rs=Symbol.for("TypeBox.Readonly"),mo=Symbol.for("TypeBox.Optional"),mn=Symbol.for("TypeBox.Hint"),U=Symbol.for("TypeBox.Kind");function e3(e){return vt(e)&&e[Rs]==="Readonly"}function ji(e){return vt(e)&&e[mo]==="Optional"}function q0(e){return Je(e,"Any")}function Bs(e){return Je(e,"Array")}function Dm(e){return Je(e,"AsyncIterator")}function ev(e){return Je(e,"BigInt")}function tv(e){return Je(e,"Boolean")}function km(e){return Je(e,"Constructor")}function _7(e){return Je(e,"Date")}function Am(e){return Je(e,"Function")}function Vl(e){return Je(e,"Integer")}function or(e){return Je(e,"Intersect")}function Lm(e){return Je(e,"Iterator")}function Je(e,r){return vt(e)&&U in e&&e[U]===r}function Ns(e){return Je(e,"Literal")}function Wo(e){return Je(e,"MappedKey")}function Rt(e){return Je(e,"MappedResult")}function Ha(e){return Je(e,"Never")}function R7(e){return Je(e,"Not")}function B7(e){return Je(e,"Null")}function $l(e){return Je(e,"Number")}function gr(e){return Je(e,"Object")}function Hl(e){return Je(e,"Promise")}function rv(e){return Je(e,"Record")}function ov(e){return Je(e,"Ref")}function nv(e){return Je(e,"RegExp")}function _m(e){return Je(e,"String")}function N7(e){return Je(e,"Symbol")}function Zo(e){return Je(e,"TemplateLiteral")}function j7(e){return Je(e,"This")}function Dp(e){return vt(e)&&_t in e}function Xn(e){return Je(e,"Tuple")}function G7(e){return Je(e,"Undefined")}function it(e){return Je(e,"Union")}function U7(e){return Je(e,"Uint8Array")}function V7(e){return Je(e,"Unknown")}function $7(e){return Je(e,"Unsafe")}function H7(e){return Je(e,"Void")}function za(e){return vt(e)&&U in e&&Pt(e[U])}function Yn(e){return q0(e)||Bs(e)||tv(e)||ev(e)||Dm(e)||km(e)||_7(e)||Am(e)||Vl(e)||or(e)||Lm(e)||Ns(e)||Wo(e)||Rt(e)||Ha(e)||R7(e)||B7(e)||$l(e)||gr(e)||Hl(e)||rv(e)||ov(e)||nv(e)||_m(e)||N7(e)||Zo(e)||j7(e)||Xn(e)||G7(e)||it(e)||U7(e)||V7(e)||$7(e)||H7(e)||za(e)}var D={};La(D,{IsAny:()=>n3,IsArray:()=>i3,IsAsyncIterator:()=>s3,IsBigInt:()=>a3,IsBoolean:()=>l3,IsConstructor:()=>c3,IsDate:()=>p3,IsFunction:()=>d3,IsInteger:()=>u3,IsIntersect:()=>m3,IsIterator:()=>f3,IsKind:()=>N3,IsKindOf:()=>We,IsLiteral:()=>Bm,IsLiteralBoolean:()=>K7,IsLiteralNumber:()=>g3,IsLiteralString:()=>h3,IsLiteralValue:()=>y3,IsMappedKey:()=>b3,IsMappedResult:()=>x3,IsNever:()=>v3,IsNot:()=>I3,IsNull:()=>S3,IsNumber:()=>T3,IsObject:()=>C3,IsOptional:()=>J7,IsPromise:()=>M3,IsProperties:()=>lv,IsReadonly:()=>Y7,IsRecord:()=>w3,IsRecursive:()=>Q7,IsRef:()=>O3,IsRegExp:()=>E3,IsSchema:()=>ze,IsString:()=>P3,IsSymbol:()=>F3,IsTemplateLiteral:()=>D3,IsThis:()=>k3,IsTransform:()=>Ft,IsTuple:()=>A3,IsUint8Array:()=>L3,IsUndefined:()=>kp,IsUnion:()=>cv,IsUnionLiteral:()=>q7,IsUnknown:()=>_3,IsUnsafe:()=>R3,IsVoid:()=>B3,TypeGuardUnknownTypeError:()=>iv});d();var iv=class extends be{},W7=["Any","Array","AsyncIterator","BigInt","Boolean","Constructor","Date","Enum","Function","Integer","Intersect","Iterator","Literal","MappedKey","MappedResult","Not","Null","Number","Object","Promise","Record","Ref","RegExp","String","Symbol","TemplateLiteral","This","Tuple","Undefined","Union","Uint8Array","Unknown","Void"];function t3(e){try{return new RegExp(e),!0}catch{return!1}}function sv(e){if(!Pt(e))return!1;for(let r=0;r<e.length;r++){let t=e.charCodeAt(r);if(t>=7&&t<=13||t===27||t===127)return!1}return!0}function r3(e){return av(e)||ze(e)}function Rm(e){return zt(e)||Om(e)}function wt(e){return zt(e)||Zn(e)}function av(e){return zt(e)||Va(e)}function mt(e){return zt(e)||Pt(e)}function Z7(e){return zt(e)||Pt(e)&&sv(e)&&t3(e)}function X7(e){return zt(e)||Pt(e)&&sv(e)}function o3(e){return zt(e)||ze(e)}function Y7(e){return vt(e)&&e[Rs]==="Readonly"}function J7(e){return vt(e)&&e[mo]==="Optional"}function n3(e){return We(e,"Any")&&mt(e.$id)}function i3(e){return We(e,"Array")&&e.type==="array"&&mt(e.$id)&&ze(e.items)&&wt(e.minItems)&&wt(e.maxItems)&&av(e.uniqueItems)&&o3(e.contains)&&wt(e.minContains)&&wt(e.maxContains)}function s3(e){return We(e,"AsyncIterator")&&e.type==="AsyncIterator"&&mt(e.$id)&&ze(e.items)}function a3(e){return We(e,"BigInt")&&e.type==="bigint"&&mt(e.$id)&&Rm(e.exclusiveMaximum)&&Rm(e.exclusiveMinimum)&&Rm(e.maximum)&&Rm(e.minimum)&&Rm(e.multipleOf)}function l3(e){return We(e,"Boolean")&&e.type==="boolean"&&mt(e.$id)}function c3(e){return We(e,"Constructor")&&e.type==="Constructor"&&mt(e.$id)&&qr(e.parameters)&&e.parameters.every(r=>ze(r))&&ze(e.returns)}function p3(e){return We(e,"Date")&&e.type==="Date"&&mt(e.$id)&&wt(e.exclusiveMaximumTimestamp)&&wt(e.exclusiveMinimumTimestamp)&&wt(e.maximumTimestamp)&&wt(e.minimumTimestamp)&&wt(e.multipleOfTimestamp)}function d3(e){return We(e,"Function")&&e.type==="Function"&&mt(e.$id)&&qr(e.parameters)&&e.parameters.every(r=>ze(r))&&ze(e.returns)}function u3(e){return We(e,"Integer")&&e.type==="integer"&&mt(e.$id)&&wt(e.exclusiveMaximum)&&wt(e.exclusiveMinimum)&&wt(e.maximum)&&wt(e.minimum)&&wt(e.multipleOf)}function lv(e){return vt(e)&&Object.entries(e).every(([r,t])=>sv(r)&&ze(t))}function m3(e){return We(e,"Intersect")&&!(Pt(e.type)&&e.type!=="object")&&qr(e.allOf)&&e.allOf.every(r=>ze(r)&&!Ft(r))&&mt(e.type)&&(av(e.unevaluatedProperties)||o3(e.unevaluatedProperties))&&mt(e.$id)}function f3(e){return We(e,"Iterator")&&e.type==="Iterator"&&mt(e.$id)&&ze(e.items)}function We(e,r){return vt(e)&&U in e&&e[U]===r}function h3(e){return Bm(e)&&Pt(e.const)}function g3(e){return Bm(e)&&Zn(e.const)}function K7(e){return Bm(e)&&Va(e.const)}function Bm(e){return We(e,"Literal")&&mt(e.$id)&&y3(e.const)}function y3(e){return Va(e)||Zn(e)||Pt(e)}function b3(e){return We(e,"MappedKey")&&qr(e.keys)&&e.keys.every(r=>Zn(r)||Pt(r))}function x3(e){return We(e,"MappedResult")&&lv(e.properties)}function v3(e){return We(e,"Never")&&vt(e.not)&&Object.getOwnPropertyNames(e.not).length===0}function I3(e){return We(e,"Not")&&ze(e.not)}function S3(e){return We(e,"Null")&&e.type==="null"&&mt(e.$id)}function T3(e){return We(e,"Number")&&e.type==="number"&&mt(e.$id)&&wt(e.exclusiveMaximum)&&wt(e.exclusiveMinimum)&&wt(e.maximum)&&wt(e.minimum)&&wt(e.multipleOf)}function C3(e){return We(e,"Object")&&e.type==="object"&&mt(e.$id)&&lv(e.properties)&&r3(e.additionalProperties)&&wt(e.minProperties)&&wt(e.maxProperties)}function M3(e){return We(e,"Promise")&&e.type==="Promise"&&mt(e.$id)&&ze(e.item)}function w3(e){return We(e,"Record")&&e.type==="object"&&mt(e.$id)&&r3(e.additionalProperties)&&vt(e.patternProperties)&&(r=>{let t=Object.getOwnPropertyNames(r.patternProperties);return t.length===1&&t3(t[0])&&vt(r.patternProperties)&&ze(r.patternProperties[t[0]])})(e)}function Q7(e){return vt(e)&&mn in e&&e[mn]==="Recursive"}function O3(e){return We(e,"Ref")&&mt(e.$id)&&Pt(e.$ref)}function E3(e){return We(e,"RegExp")&&mt(e.$id)&&Pt(e.source)&&Pt(e.flags)&&wt(e.maxLength)&&wt(e.minLength)}function P3(e){return We(e,"String")&&e.type==="string"&&mt(e.$id)&&wt(e.minLength)&&wt(e.maxLength)&&Z7(e.pattern)&&X7(e.format)}function F3(e){return We(e,"Symbol")&&e.type==="symbol"&&mt(e.$id)}function D3(e){return We(e,"TemplateLiteral")&&e.type==="string"&&Pt(e.pattern)&&e.pattern[0]==="^"&&e.pattern[e.pattern.length-1]==="$"}function k3(e){return We(e,"This")&&mt(e.$id)&&Pt(e.$ref)}function Ft(e){return vt(e)&&_t in e}function A3(e){return We(e,"Tuple")&&e.type==="array"&&mt(e.$id)&&Zn(e.minItems)&&Zn(e.maxItems)&&e.minItems===e.maxItems&&(zt(e.items)&&zt(e.additionalItems)&&e.minItems===0||qr(e.items)&&e.items.every(r=>ze(r)))}function kp(e){return We(e,"Undefined")&&e.type==="undefined"&&mt(e.$id)}function q7(e){return cv(e)&&e.anyOf.every(r=>h3(r)||g3(r))}function cv(e){return We(e,"Union")&&mt(e.$id)&&vt(e)&&qr(e.anyOf)&&e.anyOf.every(r=>ze(r))}function L3(e){return We(e,"Uint8Array")&&e.type==="Uint8Array"&&mt(e.$id)&&wt(e.minByteLength)&&wt(e.maxByteLength)}function _3(e){return We(e,"Unknown")&&mt(e.$id)}function R3(e){return We(e,"Unsafe")}function B3(e){return We(e,"Void")&&e.type==="void"&&mt(e.$id)}function N3(e){return vt(e)&&U in e&&Pt(e[U])&&!W7.includes(e[U])}function ze(e){return vt(e)&&(n3(e)||i3(e)||l3(e)||a3(e)||s3(e)||c3(e)||p3(e)||d3(e)||u3(e)||m3(e)||f3(e)||Bm(e)||b3(e)||x3(e)||v3(e)||I3(e)||S3(e)||T3(e)||C3(e)||M3(e)||w3(e)||O3(e)||E3(e)||P3(e)||F3(e)||D3(e)||k3(e)||A3(e)||kp(e)||cv(e)||L3(e)||_3(e)||R3(e)||B3(e)||N3(e))}d();var pv="(true|false)",Nm="(0|[1-9][0-9]*)",dv="(.*)",e6="(?!.*)",QY=`^${pv}$`,js=`^${Nm}$`,Gs=`^${dv}$`,j3=`^${e6}$`;d();var Fo={};La(Fo,{Clear:()=>r6,Delete:()=>o6,Entries:()=>t6,Get:()=>s6,Has:()=>n6,Set:()=>i6});d();var Ap=new Map;function t6(){return new Map(Ap)}function r6(){return Ap.clear()}function o6(e){return Ap.delete(e)}function n6(e){return Ap.has(e)}function i6(e,r){Ap.set(e,r)}function s6(e){return Ap.get(e)}var Or={};La(Or,{Clear:()=>l6,Delete:()=>c6,Entries:()=>a6,Get:()=>u6,Has:()=>p6,Set:()=>d6});d();var Lp=new Map;function a6(){return new Map(Lp)}function l6(){return Lp.clear()}function c6(e){return Lp.delete(e)}function p6(e){return Lp.has(e)}function d6(e,r){Lp.set(e,r)}function u6(e){return Lp.get(e)}d();function G3(e,r){return e.includes(r)}function U3(e){return[...new Set(e)]}function m6(e,r){return e.filter(t=>r.includes(t))}function f6(e,r){return e.reduce((t,o)=>m6(t,o),r)}function V3(e){return e.length===1?e[0]:e.length>1?f6(e.slice(1),e[0]):[]}function $3(e){let r=[];for(let t of e)r.push(...t);return r}d();function Wa(e){return Z({[U]:"Any"},e)}d();function Ty(e,r){return Z({[U]:"Array",type:"array",items:e},r)}d();function Cy(e,r){return Z({[U]:"AsyncIterator",type:"AsyncIterator",items:e},r)}d();d();d();function h6(e,r){let{[r]:t,...o}=e;return o}function Qt(e,r){return r.reduce((t,o)=>h6(t,o),e)}d();function ft(e){return Z({[U]:"Never",not:{}},e)}d();d();function Ke(e){return Z({[U]:"MappedResult",properties:e})}d();d();function My(e,r,t){return Z({[U]:"Constructor",type:"Constructor",parameters:e,returns:r},t)}d();function Za(e,r,t){return Z({[U]:"Function",type:"Function",parameters:e,returns:r},t)}d();d();d();d();function jm(e,r){return Z({[U]:"Union",anyOf:e},r)}function g6(e){return e.some(r=>ji(r))}function H3(e){return e.map(r=>ji(r)?y6(r):r)}function y6(e){return Qt(e,[mo])}function b6(e,r){return g6(e)?Do(jm(H3(e),r)):jm(H3(e),r)}function Gi(e,r){return e.length===0?ft(r):e.length===1?Z(e[0],r):b6(e,r)}d();function ht(e,r){return e.length===0?ft(r):e.length===1?Z(e[0],r):jm(e,r)}d();d();d();var wy=class extends be{};function x6(e){return e.replace(/\\\$/g,"$").replace(/\\\*/g,"*").replace(/\\\^/g,"^").replace(/\\\|/g,"|").replace(/\\\(/g,"(").replace(/\\\)/g,")")}function uv(e,r,t){return e[r]===t&&e.charCodeAt(r-1)!==92}function Us(e,r){return uv(e,r,"(")}function Gm(e,r){return uv(e,r,")")}function z3(e,r){return uv(e,r,"|")}function v6(e){if(!(Us(e,0)&&Gm(e,e.length-1)))return!1;let r=0;for(let t=0;t<e.length;t++)if(Us(e,t)&&(r+=1),Gm(e,t)&&(r-=1),r===0&&t!==e.length-1)return!1;return!0}function I6(e){return e.slice(1,e.length-1)}function S6(e){let r=0;for(let t=0;t<e.length;t++)if(Us(e,t)&&(r+=1),Gm(e,t)&&(r-=1),z3(e,t)&&r===0)return!0;return!1}function T6(e){for(let r=0;r<e.length;r++)if(Us(e,r))return!0;return!1}function C6(e){let[r,t]=[0,0],o=[];for(let i=0;i<e.length;i++)if(Us(e,i)&&(r+=1),Gm(e,i)&&(r-=1),z3(e,i)&&r===0){let a=e.slice(t,i);a.length>0&&o.push(_p(a)),t=i+1}let n=e.slice(t);return n.length>0&&o.push(_p(n)),o.length===0?{type:"const",const:""}:o.length===1?o[0]:{type:"or",expr:o}}function M6(e){function r(n,i){if(!Us(n,i))throw new wy("TemplateLiteralParser: Index must point to open parens");let a=0;for(let l=i;l<n.length;l++)if(Us(n,l)&&(a+=1),Gm(n,l)&&(a-=1),a===0)return[i,l];throw new wy("TemplateLiteralParser: Unclosed group parens in expression")}function t(n,i){for(let a=i;a<n.length;a++)if(Us(n,a))return[i,a];return[i,n.length]}let o=[];for(let n=0;n<e.length;n++)if(Us(e,n)){let[i,a]=r(e,n),l=e.slice(i,a+1);o.push(_p(l)),n=a}else{let[i,a]=t(e,n),l=e.slice(i,a);l.length>0&&o.push(_p(l)),n=a-1}return o.length===0?{type:"const",const:""}:o.length===1?o[0]:{type:"and",expr:o}}function _p(e){return v6(e)?_p(I6(e)):S6(e)?C6(e):T6(e)?M6(e):{type:"const",const:x6(e)}}function Rp(e){return _p(e.slice(1,e.length-1))}var mv=class extends be{};function w6(e){return e.type==="or"&&e.expr.length===2&&e.expr[0].type==="const"&&e.expr[0].const==="0"&&e.expr[1].type==="const"&&e.expr[1].const==="[1-9][0-9]*"}function O6(e){return e.type==="or"&&e.expr.length===2&&e.expr[0].type==="const"&&e.expr[0].const==="true"&&e.expr[1].type==="const"&&e.expr[1].const==="false"}function E6(e){return e.type==="const"&&e.const===".*"}function zl(e){return w6(e)||E6(e)?!1:O6(e)?!0:e.type==="and"?e.expr.every(r=>zl(r)):e.type==="or"?e.expr.every(r=>zl(r)):e.type==="const"?!0:(()=>{throw new mv("Unknown expression type")})()}function Oy(e){let r=Rp(e.pattern);return zl(r)}d();var fv=class extends be{};function*W3(e){if(e.length===1)return yield*e[0];for(let r of e[0])for(let t of W3(e.slice(1)))yield`${r}${t}`}function*P6(e){return yield*W3(e.expr.map(r=>[...Um(r)]))}function*F6(e){for(let r of e.expr)yield*Um(r)}function*D6(e){return yield e.const}function*Um(e){return e.type==="and"?yield*P6(e):e.type==="or"?yield*F6(e):e.type==="const"?yield*D6(e):(()=>{throw new fv("Unknown expression")})()}function Bp(e){let r=Rp(e.pattern);return zl(r)?[...Um(r)]:[]}d();d();function at(e,r){return Z({[U]:"Literal",const:e,type:typeof e},r)}d();function Ey(e){return Z({[U]:"Boolean",type:"boolean"},e)}d();function Np(e){return Z({[U]:"BigInt",type:"bigint"},e)}d();function Ui(e){return Z({[U]:"Number",type:"number"},e)}d();function fn(e){return Z({[U]:"String",type:"string"},e)}function*k6(e){let r=e.trim().replace(/"|'/g,"");return r==="boolean"?yield Ey():r==="number"?yield Ui():r==="bigint"?yield Np():r==="string"?yield fn():yield(()=>{let t=r.split("|").map(o=>at(o.trim()));return t.length===0?ft():t.length===1?t[0]:Gi(t)})()}function*A6(e){if(e[1]!=="{"){let r=at("$"),t=hv(e.slice(1));return yield*[r,...t]}for(let r=2;r<e.length;r++)if(e[r]==="}"){let t=k6(e.slice(2,r)),o=hv(e.slice(r+1));return yield*[...t,...o]}yield at(e)}function*hv(e){for(let r=0;r<e.length;r++)if(e[r]==="$"){let t=at(e.slice(0,r)),o=A6(e.slice(r));return yield*[t,...o]}yield at(e)}function Z3(e){return[...hv(e)]}d();var gv=class extends be{};function L6(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function X3(e,r){return Zo(e)?e.pattern.slice(1,e.pattern.length-1):it(e)?`(${e.anyOf.map(t=>X3(t,r)).join("|")})`:$l(e)?`${r}${Nm}`:Vl(e)?`${r}${Nm}`:ev(e)?`${r}${Nm}`:_m(e)?`${r}${dv}`:Ns(e)?`${r}${L6(e.const.toString())}`:tv(e)?`${r}${pv}`:(()=>{throw new gv(`Unexpected Kind '${e[U]}'`)})()}function yv(e){return`^${e.map(r=>X3(r,"")).join("")}$`}d();function Wl(e){let t=Bp(e).map(o=>at(o));return Gi(t)}d();function Py(e,r){let t=Pt(e)?yv(Z3(e)):yv(e);return Z({[U]:"TemplateLiteral",type:"string",pattern:t},r)}function _6(e){return Bp(e).map(t=>t.toString())}function R6(e){let r=[];for(let t of e)r.push(...ko(t));return r}function B6(e){return[e.toString()]}function ko(e){return[...new Set(Zo(e)?_6(e):it(e)?R6(e.anyOf):Ns(e)?B6(e.const):$l(e)?["[number]"]:Vl(e)?["[number]"]:[])]}d();function N6(e,r,t){let o={};for(let n of Object.getOwnPropertyNames(r))o[n]=jp(e,ko(r[n]),t);return o}function j6(e,r,t){return N6(e,r.properties,t)}function Y3(e,r,t){let o=j6(e,r,t);return Ke(o)}function K3(e,r){return e.map(t=>Q3(t,r))}function G6(e){return e.filter(r=>!Ha(r))}function U6(e,r){return Fy(G6(K3(e,r)))}function V6(e){return e.some(r=>Ha(r))?[]:e}function $6(e,r){return Gi(V6(K3(e,r)))}function H6(e,r){return r in e?e[r]:r==="[number]"?Gi(e):ft()}function z6(e,r){return r==="[number]"?e:ft()}function W6(e,r){return r in e?e[r]:ft()}function Q3(e,r){return or(e)?U6(e.allOf,r):it(e)?$6(e.anyOf,r):Xn(e)?H6(e.items??[],r):Bs(e)?z6(e.items,r):gr(e)?W6(e.properties,r):ft()}function Vm(e,r){return r.map(t=>Q3(e,t))}function J3(e,r){return Gi(Vm(e,r))}function jp(e,r,t){return Rt(r)?Y3(e,r,t):Wo(r)?q3(e,r,t):Z(Yn(r)?J3(e,ko(r)):J3(e,r),t)}function Z6(e,r,t){return{[r]:jp(e,[r],Lt(t))}}function X6(e,r,t){return r.reduce((o,n)=>({...o,...Z6(e,n,t)}),{})}function Y6(e,r,t){return X6(e,r.keys,t)}function q3(e,r,t){let o=Y6(e,r,t);return Ke(o)}d();function Dy(e,r){return Z({[U]:"Iterator",type:"Iterator",items:e},r)}d();function J6(e){let r=[];for(let t in e)ji(e[t])||r.push(t);return r}function K6(e,r){let t=J6(e),o=t.length>0?{[U]:"Object",type:"object",properties:e,required:t}:{[U]:"Object",type:"object",properties:e};return Z(o,r)}var It=K6;d();function ky(e,r){return Z({[U]:"Promise",type:"Promise",item:e},r)}d();d();function Q6(e){return Z(Qt(e,[Rs]))}function q6(e){return Z({...e,[Rs]:"Readonly"})}function eL(e,r){return r===!1?Q6(e):q6(e)}function hn(e,r){let t=r??!0;return Rt(e)?ew(e,t):eL(e,t)}function tL(e,r){let t={};for(let o of globalThis.Object.getOwnPropertyNames(e))t[o]=hn(e[o],r);return t}function rL(e,r){return tL(e.properties,r)}function ew(e,r){let t=rL(e,r);return Ke(t)}d();function Vi(e,r){return Z(e.length>0?{[U]:"Tuple",type:"array",items:e,additionalItems:!1,minItems:e.length,maxItems:e.length}:{[U]:"Tuple",type:"array",minItems:e.length,maxItems:e.length},r)}function tw(e,r){return e in r?gn(e,r[e]):Ke(r)}function oL(e){return{[e]:at(e)}}function nL(e){let r={};for(let t of e)r[t]=at(t);return r}function iL(e,r){return G3(r,e)?oL(e):nL(r)}function sL(e,r){let t=iL(e,r);return tw(e,t)}function $m(e,r){return r.map(t=>gn(e,t))}function aL(e,r){let t={};for(let o of globalThis.Object.getOwnPropertyNames(r))t[o]=gn(e,r[o]);return t}function gn(e,r){let t={...r};return ji(r)?Do(gn(e,Qt(r,[mo]))):e3(r)?hn(gn(e,Qt(r,[Rs]))):Rt(r)?tw(e,r.properties):Wo(r)?sL(e,r.keys):km(r)?My($m(e,r.parameters),gn(e,r.returns),t):Am(r)?Za($m(e,r.parameters),gn(e,r.returns),t):Dm(r)?Cy(gn(e,r.items),t):Lm(r)?Dy(gn(e,r.items),t):or(r)?Ao($m(e,r.allOf),t):it(r)?ht($m(e,r.anyOf),t):Xn(r)?Vi($m(e,r.items??[]),t):gr(r)?It(aL(e,r.properties),t):Bs(r)?Ty(gn(e,r.items),t):Hl(r)?ky(gn(e,r.item),t):r}function lL(e,r){let t={};for(let o of e)t[o]=gn(o,r);return t}function rw(e,r,t){let o=Yn(e)?ko(e):e,n=r({[U]:"MappedKey",keys:o}),i=lL(o,n);return It(i,t)}d();function cL(e){return Z(Qt(e,[mo]))}function pL(e){return Z({...e,[mo]:"Optional"})}function dL(e,r){return r===!1?cL(e):pL(e)}function Do(e,r){let t=r??!0;return Rt(e)?ow(e,t):dL(e,t)}function uL(e,r){let t={};for(let o of globalThis.Object.getOwnPropertyNames(e))t[o]=Do(e[o],r);return t}function mL(e,r){return uL(e.properties,r)}function ow(e,r){let t=mL(e,r);return Ke(t)}d();function Hm(e,r={}){let t=e.every(n=>gr(n)),o=Yn(r.unevaluatedProperties)?{unevaluatedProperties:r.unevaluatedProperties}:{};return Z(r.unevaluatedProperties===!1||Yn(r.unevaluatedProperties)||t?{...o,[U]:"Intersect",type:"object",allOf:e}:{...o,[U]:"Intersect",allOf:e},r)}function fL(e){return e.every(r=>ji(r))}function hL(e){return Qt(e,[mo])}function nw(e){return e.map(r=>ji(r)?hL(r):r)}function gL(e,r){return fL(e)?Do(Hm(nw(e),r)):Hm(nw(e),r)}function Fy(e,r={}){if(e.length===0)return ft(r);if(e.length===1)return Z(e[0],r);if(e.some(t=>Dp(t)))throw new Error("Cannot intersect transform types");return gL(e,r)}d();function Ao(e,r){if(e.length===0)return ft(r);if(e.length===1)return Z(e[0],r);if(e.some(t=>Dp(t)))throw new Error("Cannot intersect transform types");return Hm(e,r)}function iw(e){return e.map(r=>bv(r))}function yL(e){return Ao(iw(e))}function bL(e){return ht(iw(e))}function xL(e){return bv(e)}function bv(e){return or(e)?yL(e.allOf):it(e)?bL(e.anyOf):Hl(e)?xL(e.item):e}function sw(e,r){return Z(bv(e),r)}d();d();d();d();function aw(e){let r=[];for(let t of e)r.push(Er(t));return r}function vL(e){let r=aw(e);return $3(r)}function IL(e){let r=aw(e);return V3(r)}function SL(e){return e.map((r,t)=>t.toString())}function TL(e){return["[number]"]}function CL(e){return globalThis.Object.getOwnPropertyNames(e)}function ML(e){return xv?globalThis.Object.getOwnPropertyNames(e).map(t=>t[0]==="^"&&t[t.length-1]==="$"?t.slice(1,t.length-1):t):[]}function Er(e){return or(e)?vL(e.allOf):it(e)?IL(e.anyOf):Xn(e)?SL(e.items??[]):Bs(e)?TL(e.items):gr(e)?CL(e.properties):rv(e)?ML(e.patternProperties):[]}var xv=!1;function Vs(e){xv=!0;let r=Er(e);return xv=!1,`^(${r.map(o=>`(${o})`).join("|")})$`}function wL(e){return e.map(r=>r==="[number]"?Ui():at(r))}function Ay(e,r){if(Rt(e))return lw(e,r);{let t=Er(e),o=wL(t),n=Gi(o);return Z(n,r)}}function OL(e,r){let t={};for(let o of globalThis.Object.getOwnPropertyNames(e))t[o]=Ay(e[o],Lt(r));return t}function EL(e,r){return OL(e.properties,r)}function lw(e,r){let t=EL(e,r);return Ke(t)}d();function Xa(e){let r=Er(e),t=Vm(e,r);return r.map((o,n)=>[r[n],t[n]])}function PL(e){let r=[];for(let t of e)r.push(...Er(t));return U3(r)}function FL(e){return e.filter(r=>!Ha(r))}function DL(e,r){let t=[];for(let o of e)t.push(...Vm(o,[r]));return FL(t)}function kL(e,r){let t={};for(let o of r)t[o]=Fy(DL(e,o));return t}function cw(e,r){let t=PL(e),o=kL(e,t);return It(o,r)}d();d();function Ly(e){return Z({[U]:"Date",type:"Date"},e)}d();function _y(e){return Z({[U]:"Null",type:"null"},e)}d();function Ry(e){return Z({[U]:"Symbol",type:"symbol"},e)}d();function By(e){return Z({[U]:"Undefined",type:"undefined"},e)}d();function Ny(e){return Z({[U]:"Uint8Array",type:"Uint8Array"},e)}d();function $s(e){return Z({[U]:"Unknown"},e)}function AL(e){return e.map(r=>vv(r,!1))}function LL(e){let r={};for(let t of globalThis.Object.getOwnPropertyNames(e))r[t]=hn(vv(e[t],!1));return r}function jy(e,r){return r===!0?e:hn(e)}function vv(e,r){return Z0(e)?jy(Wa(),r):Y0(e)?jy(Wa(),r):qr(e)?hn(Vi(AL(e))):As(e)?Ny():Ul(e)?Ly():vt(e)?jy(It(LL(e)),r):X0(e)?jy(Za([],$s()),r):zt(e)?By():J0(e)?_y():K0(e)?Ry():Om(e)?Np():Zn(e)?at(e):Va(e)?at(e):Pt(e)?at(e):It({})}function pw(e,r){return Z(vv(e,!0),r)}d();function dw(e,r){return Vi(e.parameters,r)}d();function zm(e,r){return e.map(t=>Jn(t,r))}function _L(e,r){let t={};for(let o of globalThis.Object.getOwnPropertyNames(e))t[o]=Jn(e[o],r);return t}function RL(e,r){return e.parameters=zm(e.parameters,r),e.returns=Jn(e.returns,r),e}function BL(e,r){return e.parameters=zm(e.parameters,r),e.returns=Jn(e.returns,r),e}function NL(e,r){return e.allOf=zm(e.allOf,r),e}function jL(e,r){return e.anyOf=zm(e.anyOf,r),e}function GL(e,r){return zt(e.items)||(e.items=zm(e.items,r)),e}function UL(e,r){return e.items=Jn(e.items,r),e}function VL(e,r){return e.properties=_L(e.properties,r),e}function $L(e,r){return e.item=Jn(e.item,r),e}function HL(e,r){return e.items=Jn(e.items,r),e}function zL(e,r){return e.items=Jn(e.items,r),e}function WL(e,r){let t=r.find(n=>n.$id===e.$ref);if(t===void 0)throw Error(`Unable to dereference schema with $id ${e.$ref}`);let o=Qt(t,["$id"]);return Jn(o,r)}function ZL(e,r){return km(e)?RL(e,r):Am(e)?BL(e,r):or(e)?NL(e,r):it(e)?jL(e,r):Xn(e)?GL(e,r):Bs(e)?UL(e,r):gr(e)?VL(e,r):Hl(e)?$L(e,r):Dm(e)?HL(e,r):Lm(e)?zL(e,r):ov(e)?WL(e,r):e}function Jn(e,r){return ZL(Pm(e),KM(r))}d();function uw(e,r){if(zt(e))throw new Error("Enum undefined or empty");let t=globalThis.Object.getOwnPropertyNames(e).filter(i=>isNaN(i)).map(i=>e[i]),n=[...new Set(t)].map(i=>at(i));return ht(n,{...r,[mn]:"Enum"})}d();d();d();var Sv=class extends be{},$;(function(e){e[e.Union=0]="Union",e[e.True=1]="True",e[e.False=2]="False"})($||($={}));function yn(e){return e===$.False?e:$.True}function Gp(e){throw new Sv(e)}function lr(e){return D.IsNever(e)||D.IsIntersect(e)||D.IsUnion(e)||D.IsUnknown(e)||D.IsAny(e)}function cr(e,r){return D.IsNever(r)?xw(e,r):D.IsIntersect(r)?Gy(e,r):D.IsUnion(r)?wv(e,r):D.IsUnknown(r)?Tw(e,r):D.IsAny(r)?Mv(e,r):Gp("StructuralRight")}function Mv(e,r){return $.True}function XL(e,r){return D.IsIntersect(r)?Gy(e,r):D.IsUnion(r)&&r.anyOf.some(t=>D.IsAny(t)||D.IsUnknown(t))?$.True:D.IsUnion(r)?$.Union:D.IsUnknown(r)||D.IsAny(r)?$.True:$.Union}function YL(e,r){return D.IsUnknown(e)?$.False:D.IsAny(e)?$.Union:D.IsNever(e)?$.True:$.False}function JL(e,r){return D.IsObject(r)&&Uy(r)?$.True:lr(r)?cr(e,r):D.IsArray(r)?yn(gt(e.items,r.items)):$.False}function KL(e,r){return lr(r)?cr(e,r):D.IsAsyncIterator(r)?yn(gt(e.items,r.items)):$.False}function QL(e,r){return lr(r)?cr(e,r):D.IsObject(r)?eo(e,r):D.IsRecord(r)?bn(e,r):D.IsBigInt(r)?$.True:$.False}function yw(e,r){return D.IsLiteralBoolean(e)||D.IsBoolean(e)?$.True:$.False}function qL(e,r){return lr(r)?cr(e,r):D.IsObject(r)?eo(e,r):D.IsRecord(r)?bn(e,r):D.IsBoolean(r)?$.True:$.False}function e9(e,r){return lr(r)?cr(e,r):D.IsObject(r)?eo(e,r):D.IsConstructor(r)?e.parameters.length>r.parameters.length?$.False:e.parameters.every((t,o)=>yn(gt(r.parameters[o],t))===$.True)?yn(gt(e.returns,r.returns)):$.False:$.False}function t9(e,r){return lr(r)?cr(e,r):D.IsObject(r)?eo(e,r):D.IsRecord(r)?bn(e,r):D.IsDate(r)?$.True:$.False}function r9(e,r){return lr(r)?cr(e,r):D.IsObject(r)?eo(e,r):D.IsFunction(r)?e.parameters.length>r.parameters.length?$.False:e.parameters.every((t,o)=>yn(gt(r.parameters[o],t))===$.True)?yn(gt(e.returns,r.returns)):$.False:$.False}function bw(e,r){return D.IsLiteral(e)&&Ye.IsNumber(e.const)||D.IsNumber(e)||D.IsInteger(e)?$.True:$.False}function o9(e,r){return D.IsInteger(r)||D.IsNumber(r)?$.True:lr(r)?cr(e,r):D.IsObject(r)?eo(e,r):D.IsRecord(r)?bn(e,r):$.False}function Gy(e,r){return r.allOf.every(t=>gt(e,t)===$.True)?$.True:$.False}function n9(e,r){return e.allOf.some(t=>gt(t,r)===$.True)?$.True:$.False}function i9(e,r){return lr(r)?cr(e,r):D.IsIterator(r)?yn(gt(e.items,r.items)):$.False}function s9(e,r){return D.IsLiteral(r)&&r.const===e.const?$.True:lr(r)?cr(e,r):D.IsObject(r)?eo(e,r):D.IsRecord(r)?bn(e,r):D.IsString(r)?Sw(e,r):D.IsNumber(r)?vw(e,r):D.IsInteger(r)?bw(e,r):D.IsBoolean(r)?yw(e,r):$.False}function xw(e,r){return $.False}function a9(e,r){return $.True}function mw(e){let[r,t]=[e,0];for(;D.IsNot(r);)r=r.not,t+=1;return t%2===0?r:$s()}function l9(e,r){return D.IsNot(e)?gt(mw(e),r):D.IsNot(r)?gt(e,mw(r)):Gp("Invalid fallthrough for Not")}function c9(e,r){return lr(r)?cr(e,r):D.IsObject(r)?eo(e,r):D.IsRecord(r)?bn(e,r):D.IsNull(r)?$.True:$.False}function vw(e,r){return D.IsLiteralNumber(e)||D.IsNumber(e)||D.IsInteger(e)?$.True:$.False}function p9(e,r){return lr(r)?cr(e,r):D.IsObject(r)?eo(e,r):D.IsRecord(r)?bn(e,r):D.IsInteger(r)||D.IsNumber(r)?$.True:$.False}function Lo(e,r){return Object.getOwnPropertyNames(e.properties).length===r}function fw(e){return Uy(e)}function hw(e){return Lo(e,0)||Lo(e,1)&&"description"in e.properties&&D.IsUnion(e.properties.description)&&e.properties.description.anyOf.length===2&&(D.IsString(e.properties.description.anyOf[0])&&D.IsUndefined(e.properties.description.anyOf[1])||D.IsString(e.properties.description.anyOf[1])&&D.IsUndefined(e.properties.description.anyOf[0]))}function Iv(e){return Lo(e,0)}function gw(e){return Lo(e,0)}function d9(e){return Lo(e,0)}function u9(e){return Lo(e,0)}function m9(e){return Uy(e)}function f9(e){let r=Ui();return Lo(e,0)||Lo(e,1)&&"length"in e.properties&&yn(gt(e.properties.length,r))===$.True}function h9(e){return Lo(e,0)}function Uy(e){let r=Ui();return Lo(e,0)||Lo(e,1)&&"length"in e.properties&&yn(gt(e.properties.length,r))===$.True}function g9(e){let r=Za([Wa()],Wa());return Lo(e,0)||Lo(e,1)&&"then"in e.properties&&yn(gt(e.properties.then,r))===$.True}function Iw(e,r){return gt(e,r)===$.False||D.IsOptional(e)&&!D.IsOptional(r)?$.False:$.True}function eo(e,r){return D.IsUnknown(e)?$.False:D.IsAny(e)?$.Union:D.IsNever(e)||D.IsLiteralString(e)&&fw(r)||D.IsLiteralNumber(e)&&Iv(r)||D.IsLiteralBoolean(e)&&gw(r)||D.IsSymbol(e)&&hw(r)||D.IsBigInt(e)&&d9(r)||D.IsString(e)&&fw(r)||D.IsSymbol(e)&&hw(r)||D.IsNumber(e)&&Iv(r)||D.IsInteger(e)&&Iv(r)||D.IsBoolean(e)&&gw(r)||D.IsUint8Array(e)&&m9(r)||D.IsDate(e)&&u9(r)||D.IsConstructor(e)&&h9(r)||D.IsFunction(e)&&f9(r)?$.True:D.IsRecord(e)&&D.IsString(Tv(e))?r[mn]==="Record"?$.True:$.False:D.IsRecord(e)&&D.IsNumber(Tv(e))?Lo(r,0)?$.True:$.False:$.False}function y9(e,r){return lr(r)?cr(e,r):D.IsRecord(r)?bn(e,r):D.IsObject(r)?(()=>{for(let t of Object.getOwnPropertyNames(r.properties)){if(!(t in e.properties)&&!D.IsOptional(r.properties[t]))return $.False;if(D.IsOptional(r.properties[t]))return $.True;if(Iw(e.properties[t],r.properties[t])===$.False)return $.False}return $.True})():$.False}function b9(e,r){return lr(r)?cr(e,r):D.IsObject(r)&&g9(r)?$.True:D.IsPromise(r)?yn(gt(e.item,r.item)):$.False}function Tv(e){return js in e.patternProperties?Ui():Gs in e.patternProperties?fn():Gp("Unknown record key pattern")}function Cv(e){return js in e.patternProperties?e.patternProperties[js]:Gs in e.patternProperties?e.patternProperties[Gs]:Gp("Unable to get record value schema")}function bn(e,r){let[t,o]=[Tv(r),Cv(r)];return D.IsLiteralString(e)&&D.IsNumber(t)&&yn(gt(e,o))===$.True?$.True:D.IsUint8Array(e)&&D.IsNumber(t)||D.IsString(e)&&D.IsNumber(t)||D.IsArray(e)&&D.IsNumber(t)?gt(e,o):D.IsObject(e)?(()=>{for(let n of Object.getOwnPropertyNames(e.properties))if(Iw(o,e.properties[n])===$.False)return $.False;return $.True})():$.False}function x9(e,r){return lr(r)?cr(e,r):D.IsObject(r)?eo(e,r):D.IsRecord(r)?gt(Cv(e),Cv(r)):$.False}function v9(e,r){let t=D.IsRegExp(e)?fn():e,o=D.IsRegExp(r)?fn():r;return gt(t,o)}function Sw(e,r){return D.IsLiteral(e)&&Ye.IsString(e.const)||D.IsString(e)?$.True:$.False}function I9(e,r){return lr(r)?cr(e,r):D.IsObject(r)?eo(e,r):D.IsRecord(r)?bn(e,r):D.IsString(r)?$.True:$.False}function S9(e,r){return lr(r)?cr(e,r):D.IsObject(r)?eo(e,r):D.IsRecord(r)?bn(e,r):D.IsSymbol(r)?$.True:$.False}function T9(e,r){return D.IsTemplateLiteral(e)?gt(Wl(e),r):D.IsTemplateLiteral(r)?gt(e,Wl(r)):Gp("Invalid fallthrough for TemplateLiteral")}function C9(e,r){return D.IsArray(r)&&e.items!==void 0&&e.items.every(t=>gt(t,r.items)===$.True)}function M9(e,r){return D.IsNever(e)?$.True:D.IsUnknown(e)?$.False:D.IsAny(e)?$.Union:$.False}function w9(e,r){return lr(r)?cr(e,r):D.IsObject(r)&&Uy(r)||D.IsArray(r)&&C9(e,r)?$.True:D.IsTuple(r)?Ye.IsUndefined(e.items)&&!Ye.IsUndefined(r.items)||!Ye.IsUndefined(e.items)&&Ye.IsUndefined(r.items)?$.False:Ye.IsUndefined(e.items)&&!Ye.IsUndefined(r.items)||e.items.every((t,o)=>gt(t,r.items[o])===$.True)?$.True:$.False:$.False}function O9(e,r){return lr(r)?cr(e,r):D.IsObject(r)?eo(e,r):D.IsRecord(r)?bn(e,r):D.IsUint8Array(r)?$.True:$.False}function E9(e,r){return lr(r)?cr(e,r):D.IsObject(r)?eo(e,r):D.IsRecord(r)?bn(e,r):D.IsVoid(r)?D9(e,r):D.IsUndefined(r)?$.True:$.False}function wv(e,r){return r.anyOf.some(t=>gt(e,t)===$.True)?$.True:$.False}function P9(e,r){return e.anyOf.every(t=>gt(t,r)===$.True)?$.True:$.False}function Tw(e,r){return $.True}function F9(e,r){return D.IsNever(r)?xw(e,r):D.IsIntersect(r)?Gy(e,r):D.IsUnion(r)?wv(e,r):D.IsAny(r)?Mv(e,r):D.IsString(r)?Sw(e,r):D.IsNumber(r)?vw(e,r):D.IsInteger(r)?bw(e,r):D.IsBoolean(r)?yw(e,r):D.IsArray(r)?YL(e,r):D.IsTuple(r)?M9(e,r):D.IsObject(r)?eo(e,r):D.IsUnknown(r)?$.True:$.False}function D9(e,r){return D.IsUndefined(e)||D.IsUndefined(e)?$.True:$.False}function k9(e,r){return D.IsIntersect(r)?Gy(e,r):D.IsUnion(r)?wv(e,r):D.IsUnknown(r)?Tw(e,r):D.IsAny(r)?Mv(e,r):D.IsObject(r)?eo(e,r):D.IsVoid(r)?$.True:$.False}function gt(e,r){return D.IsTemplateLiteral(e)||D.IsTemplateLiteral(r)?T9(e,r):D.IsRegExp(e)||D.IsRegExp(r)?v9(e,r):D.IsNot(e)||D.IsNot(r)?l9(e,r):D.IsAny(e)?XL(e,r):D.IsArray(e)?JL(e,r):D.IsBigInt(e)?QL(e,r):D.IsBoolean(e)?qL(e,r):D.IsAsyncIterator(e)?KL(e,r):D.IsConstructor(e)?e9(e,r):D.IsDate(e)?t9(e,r):D.IsFunction(e)?r9(e,r):D.IsInteger(e)?o9(e,r):D.IsIntersect(e)?n9(e,r):D.IsIterator(e)?i9(e,r):D.IsLiteral(e)?s9(e,r):D.IsNever(e)?a9(e,r):D.IsNull(e)?c9(e,r):D.IsNumber(e)?p9(e,r):D.IsObject(e)?y9(e,r):D.IsRecord(e)?x9(e,r):D.IsString(e)?I9(e,r):D.IsSymbol(e)?S9(e,r):D.IsTuple(e)?w9(e,r):D.IsPromise(e)?b9(e,r):D.IsUint8Array(e)?O9(e,r):D.IsUndefined(e)?E9(e,r):D.IsUnion(e)?P9(e,r):D.IsUnknown(e)?F9(e,r):D.IsVoid(e)?k9(e,r):Gp(`Unknown left type operand '${e[U]}'`)}function Ya(e,r){return gt(e,r)}d();d();d();function A9(e,r,t,o,n){let i={};for(let a of globalThis.Object.getOwnPropertyNames(e))i[a]=Up(e[a],r,t,o,Lt(n));return i}function L9(e,r,t,o,n){return A9(e.properties,r,t,o,n)}function Cw(e,r,t,o,n){let i=L9(e,r,t,o,n);return Ke(i)}function _9(e,r,t,o){let n=Ya(e,r);return n===$.Union?ht([t,o]):n===$.True?t:o}function Up(e,r,t,o,n){return Rt(e)?Cw(e,r,t,o,n):Wo(e)?Z(Mw(e,r,t,o,n)):Z(_9(e,r,t,o),n)}function R9(e,r,t,o,n){return{[e]:Up(at(e),r,t,o,Lt(n))}}function B9(e,r,t,o,n){return e.reduce((i,a)=>({...i,...R9(a,r,t,o,n)}),{})}function N9(e,r,t,o,n){return B9(e.keys,r,t,o,n)}function Mw(e,r,t,o,n){let i=N9(e,r,t,o,n);return Ke(i)}d();function j9(e){return e.allOf.every(r=>Hs(r))}function G9(e){return e.anyOf.some(r=>Hs(r))}function U9(e){return!Hs(e.not)}function Hs(e){return e[U]==="Intersect"?j9(e):e[U]==="Union"?G9(e):e[U]==="Not"?U9(e):e[U]==="Undefined"}d();function ww(e,r){return Vp(Wl(e),r)}function V9(e,r){let t=e.filter(o=>Ya(o,r)===$.False);return t.length===1?t[0]:ht(t)}function Vp(e,r,t={}){return Zo(e)?Z(ww(e,r),t):Rt(e)?Z(Ow(e,r),t):Z(it(e)?V9(e.anyOf,r):Ya(e,r)!==$.False?ft():e,t)}function $9(e,r){let t={};for(let o of globalThis.Object.getOwnPropertyNames(e))t[o]=Vp(e[o],r);return t}function H9(e,r){return $9(e.properties,r)}function Ow(e,r){let t=H9(e,r);return Ke(t)}d();d();d();function Ew(e,r){return $p(Wl(e),r)}function z9(e,r){let t=e.filter(o=>Ya(o,r)!==$.False);return t.length===1?t[0]:ht(t)}function $p(e,r,t){return Zo(e)?Z(Ew(e,r),t):Rt(e)?Z(Pw(e,r),t):Z(it(e)?z9(e.anyOf,r):Ya(e,r)!==$.False?e:ft(),t)}function W9(e,r){let t={};for(let o of globalThis.Object.getOwnPropertyNames(e))t[o]=$p(e[o],r);return t}function Z9(e,r){return W9(e.properties,r)}function Pw(e,r){let t=Z9(e,r);return Ke(t)}d();function Fw(e,r){return Z(e.returns,r)}d();function Dw(e){return Z({[U]:"Integer",type:"integer"},e)}d();d();d();function X9(e,r,t){return{[e]:Kn(at(e),r,Lt(t))}}function Y9(e,r,t){return e.reduce((n,i)=>({...n,...X9(i,r,t)}),{})}function J9(e,r,t){return Y9(e.keys,r,t)}function kw(e,r,t){let o=J9(e,r,t);return Ke(o)}function K9(e){let[r,t]=[e.slice(0,1),e.slice(1)];return[r.toLowerCase(),t].join("")}function Q9(e){let[r,t]=[e.slice(0,1),e.slice(1)];return[r.toUpperCase(),t].join("")}function q9(e){return e.toUpperCase()}function e_(e){return e.toLowerCase()}function t_(e,r,t){let o=Rp(e.pattern);if(!zl(o))return{...e,pattern:Aw(e.pattern,r)};let a=[...Um(o)].map(p=>at(p)),l=Lw(a,r),c=ht(l);return Py([c],t)}function Aw(e,r){return typeof e=="string"?r==="Uncapitalize"?K9(e):r==="Capitalize"?Q9(e):r==="Uppercase"?q9(e):r==="Lowercase"?e_(e):e:e.toString()}function Lw(e,r){return e.map(t=>Kn(t,r))}function Kn(e,r,t={}){return Wo(e)?kw(e,r,t):Zo(e)?t_(e,r,t):it(e)?ht(Lw(e.anyOf,r),t):Ns(e)?at(Aw(e.const,r),t):Z(e,t)}function _w(e,r={}){return Kn(e,"Capitalize",r)}d();function Rw(e,r={}){return Kn(e,"Lowercase",r)}d();function Bw(e,r={}){return Kn(e,"Uncapitalize",r)}d();function Nw(e,r={}){return Kn(e,"Uppercase",r)}d();function jw(e,r){return Z({[U]:"Not",not:e},r)}d();d();d();function r_(e,r,t){let o={};for(let n of globalThis.Object.getOwnPropertyNames(e))o[n]=Hp(e[n],r,Lt(t));return o}function o_(e,r,t){return r_(e.properties,r,t)}function Gw(e,r,t){let o=o_(e,r,t);return Ke(o)}function n_(e,r){return e.map(t=>Ov(t,r))}function i_(e,r){return e.map(t=>Ov(t,r))}function s_(e,r){let{[r]:t,...o}=e;return o}function a_(e,r){return r.reduce((t,o)=>s_(t,o),e)}function l_(e,r){let t=Qt(e,[_t,"$id","required","properties"]),o=a_(e.properties,r);return It(o,t)}function Ov(e,r){return or(e)?Ao(n_(e.allOf,r)):it(e)?ht(i_(e.anyOf,r)):gr(e)?l_(e,r):It({})}function Hp(e,r,t){if(Wo(r))return Uw(e,r,t);if(Rt(e))return Gw(e,r,t);let o=Yn(r)?ko(r):r;return Z({...Ov(e,o),...t})}function c_(e,r,t){return{[r]:Hp(e,[r],Lt(t))}}function p_(e,r,t){return r.reduce((o,n)=>({...o,...c_(e,n,t)}),{})}function d_(e,r,t){return p_(e,r.keys,t)}function Uw(e,r,t){let o=d_(e,r,t);return Ke(o)}d();function Vw(e,r){return Vi(e.parameters,r)}d();d();function $w(e){return e.map(r=>Hw(r))}function u_(e){let r={};for(let t of globalThis.Object.getOwnPropertyNames(e))r[t]=Do(e[t]);return r}function m_(e){let r=Qt(e,[_t,"$id","required","properties"]),t=u_(e.properties);return It(t,r)}function Hw(e){return or(e)?Ao($w(e.allOf)):it(e)?ht($w(e.anyOf)):gr(e)?m_(e):It({})}function Vy(e,r){return Rt(e)?zw(e,r):Z({...Hw(e),...r})}function f_(e,r){let t={};for(let o of globalThis.Object.getOwnPropertyNames(e))t[o]=Vy(e[o],Lt(r));return t}function h_(e,r){return f_(e.properties,r)}function zw(e,r){let t=h_(e,r);return Ke(t)}d();d();d();function g_(e,r,t){let o={};for(let n of globalThis.Object.getOwnPropertyNames(e))o[n]=zp(e[n],r,Lt(t));return o}function y_(e,r,t){return g_(e.properties,r,t)}function Ww(e,r,t){let o=y_(e,r,t);return Ke(o)}function b_(e,r){return e.map(t=>Ev(t,r))}function x_(e,r){return e.map(t=>Ev(t,r))}function v_(e,r){let t={};for(let o of r)o in e&&(t[o]=e[o]);return t}function I_(e,r){let t=Qt(e,[_t,"$id","required","properties"]),o=v_(e.properties,r);return It(o,t)}function Ev(e,r){return or(e)?Ao(b_(e.allOf,r)):it(e)?ht(x_(e.anyOf,r)):gr(e)?I_(e,r):It({})}function zp(e,r,t){if(Wo(r))return Zw(e,r,t);if(Rt(e))return Ww(e,r,t);let o=Yn(r)?ko(r):r;return Z({...Ev(e,o),...t})}function S_(e,r,t){return{[r]:zp(e,[r],Lt(t))}}function T_(e,r,t){return r.reduce((o,n)=>({...o,...S_(e,n,t)}),{})}function C_(e,r,t){return T_(e,r.keys,t)}function Zw(e,r,t){let o=C_(e,r,t);return Ke(o)}d();function Xw(e){return hn(Do(e))}d();function Zl(e,r,t){return Z({[U]:"Record",type:"object",patternProperties:{[e]:r}},t)}function Pv(e,r,t){let o={};for(let n of e)o[n]=r;return It(o,{...t,[mn]:"Record"})}function M_(e,r,t){return Oy(e)?Pv(ko(e),r,t):Zl(e.pattern,r,t)}function w_(e,r,t){return Pv(ko(ht(e)),r,t)}function O_(e,r,t){return Pv([e.toString()],r,t)}function E_(e,r,t){return Zl(e.source,r,t)}function P_(e,r,t){let o=zt(e.pattern)?Gs:e.pattern;return Zl(o,r,t)}function F_(e,r,t){return Zl(Gs,r,t)}function D_(e,r,t){return Zl(j3,r,t)}function k_(e,r,t){return Zl(js,r,t)}function A_(e,r,t){return Zl(js,r,t)}function Yw(e,r,t={}){return it(e)?w_(e.anyOf,r,t):Zo(e)?M_(e,r,t):Ns(e)?O_(e.const,r,t):Vl(e)?k_(e,r,t):$l(e)?A_(e,r,t):nv(e)?E_(e,r,t):_m(e)?P_(e,r,t):q0(e)?F_(e,r,t):Ha(e)?D_(e,r,t):ft(t)}d();var L_=0;function Jw(e,r={}){zt(r.$id)&&(r.$id=`T${L_++}`);let t=Pm(e({[U]:"This",$ref:`${r.$id}`}));return t.$id=r.$id,Z({[mn]:"Recursive",...t},r)}d();function Kw(e,r){if(Pt(e))return Z({[U]:"Ref",$ref:e},r);if(zt(e.$id))throw new Error("Reference target type must specify an $id");return Z({[U]:"Ref",$ref:e.$id},r)}d();function Qw(e,r){let t=Pt(e)?new globalThis.RegExp(e):e;return Z({[U]:"RegExp",type:"RegExp",source:t.source,flags:t.flags},r)}d();d();function qw(e){return e.map(r=>eO(r))}function __(e){let r={};for(let t of globalThis.Object.getOwnPropertyNames(e))r[t]=Qt(e[t],[mo]);return r}function R_(e){let r=Qt(e,[_t,"$id","required","properties"]),t=__(e.properties);return It(t,r)}function eO(e){return or(e)?Ao(qw(e.allOf)):it(e)?ht(qw(e.anyOf)):gr(e)?R_(e):It({})}function $y(e,r){return Rt(e)?tO(e,r):Z({...eO(e),...r})}function B_(e,r){let t={};for(let o of globalThis.Object.getOwnPropertyNames(e))t[o]=$y(e[o],r);return t}function N_(e,r){return B_(e.properties,r)}function tO(e,r){let t=N_(e,r);return Ke(t)}d();function j_(e){return or(e)?e.allOf:it(e)?e.anyOf:Xn(e)?e.items??[]:[]}function rO(e){return j_(e)}d();function oO(e,r){return Z(e.returns,r)}d();function nO(e){return JSON.parse(JSON.stringify(e))}d();var Fv=class{constructor(r){this.schema=r}Decode(r){return new Dv(this.schema,r)}},Dv=class{constructor(r,t){this.schema=r,this.decode=t}EncodeTransform(r,t){let i={Encode:a=>t[_t].Encode(r(a)),Decode:a=>this.decode(t[_t].Decode(a))};return{...t,[_t]:i}}EncodeSchema(r,t){let o={Decode:this.decode,Encode:r};return{...t,[_t]:o}}Encode(r){return Dp(this.schema)?this.EncodeTransform(r,this.schema):this.EncodeSchema(r,this.schema)}};function iO(e){return new Fv(e)}d();function Hy(e={}){return Z({[U]:e[U]??"Unsafe"},e)}d();function sO(e){return Z({[U]:"Void",type:"void"},e)}d();var kv={};La(kv,{Any:()=>Wa,Array:()=>Ty,AsyncIterator:()=>Cy,Awaited:()=>sw,BigInt:()=>Np,Boolean:()=>Ey,Capitalize:()=>_w,Composite:()=>cw,Const:()=>pw,Constructor:()=>My,ConstructorParameters:()=>dw,Date:()=>Ly,Deref:()=>Jn,Enum:()=>uw,Exclude:()=>Vp,Extends:()=>Up,Extract:()=>$p,Function:()=>Za,Index:()=>jp,InstanceType:()=>Fw,Integer:()=>Dw,Intersect:()=>Ao,Iterator:()=>Dy,KeyOf:()=>Ay,Literal:()=>at,Lowercase:()=>Rw,Mapped:()=>rw,Never:()=>ft,Not:()=>jw,Null:()=>_y,Number:()=>Ui,Object:()=>It,Omit:()=>Hp,Optional:()=>Do,Parameters:()=>Vw,Partial:()=>Vy,Pick:()=>zp,Promise:()=>ky,Readonly:()=>hn,ReadonlyOptional:()=>Xw,Record:()=>Yw,Recursive:()=>Jw,Ref:()=>Kw,RegExp:()=>Qw,Required:()=>$y,Rest:()=>rO,ReturnType:()=>oO,Strict:()=>nO,String:()=>fn,Symbol:()=>Ry,TemplateLiteral:()=>Py,Transform:()=>iO,Tuple:()=>Vi,Uint8Array:()=>Ny,Uncapitalize:()=>Bw,Undefined:()=>By,Union:()=>ht,Unknown:()=>$s,Unsafe:()=>Hy,Uppercase:()=>Nw,Void:()=>sO});d();var g=kv;d();var Wm=g.Object({externalId:g.String({description:"An identifier that can be used to link this entity to data outside of the MVF."}),name:g.String({description:"The name of the entity."}),shortName:g.String({description:"A short name for the entity."}),description:g.String({description:"A description of the entity."}),icon:g.String({format:"uri",description:"A URL to an icon for the entity."})},{$id:"BaseDetails",description:"Additional information about a given entity."}),Av=g.Partial(Wm,{$id:"Details",description:"Additional information about a given entity."}),Xo=g.Object({details:g.Optional(g.Ref(Av))},{$id:"WithDetails"}),Xl=e=>{let r=[...e].sort(),t=g.Pick(Wm,e),o=g.Omit(Wm,e);return g.Object({details:g.Intersect([t,g.Partial(o)])},{$id:`WithRequiredDetails_${r.join("_")}`})},Lv=[Wm,Av];d();var Wp=g.Number({$id:"Longitude",minimum:-180,maximum:180,description:"A WGS 84-compatible longitude coordinate value."}),Zp=g.Number({$id:"Latitude",minimum:-90,maximum:90,description:"A WGS 84-compatible latitude coordinate value."}),Yl=g.Tuple([g.Ref(Wp),g.Ref(Zp)],{$id:"Position",minItems:2,maxItems:2,description:"A valid WGS 84 position consisting of a longitude value, followed by a latitude value."}),to=g.Object({type:g.Literal("Point"),coordinates:g.Ref(Yl)},{$id:"Point",description:"An RFC-7946 compatible GeoJSON Point geometry."}),zy=g.Object({type:g.Literal("MultiPoint"),coordinates:g.Array(g.Ref(Yl))},{$id:"MultiPoint",description:"An RFC-7946 compatible GeoJSON MultiPoint geometry."}),Wy=g.Object({type:g.Literal("LineString"),coordinates:g.Array(g.Ref(Yl),{minItems:2,description:"At least two positions are required."})},{$id:"LineString",description:"An RFC-7946 compatible GeoJSON LineString geometry."}),Zy=g.Object({type:g.Literal("MultiLineString"),coordinates:g.Array(g.Array(g.Ref(Yl),{minItems:2}))},{$id:"MultiLineString",description:"An RFC-7946 compatible GeoJSON MultiLineString geometry."}),aO=g.Array(g.Ref(Yl),{$id:"LinearRing",minItems:4,description:"A linear ring is a building block of a polygon or multi-polygon."}),_v=g.Array(g.Ref(aO),{$id:"LinearRings",minItems:1,description:"A collection of linear rings, at least one of which is the exterior ring of a polygon."}),Xp=g.Object({type:g.Literal("Polygon"),coordinates:g.Ref(_v)},{$id:"Polygon",description:"An RFC-7946 compatible GeoJSON Polygon geometry."}),Yp=g.Object({type:g.Literal("MultiPolygon"),coordinates:g.Array(g.Ref(_v))},{$id:"MultiPolygon",description:"An RFC-7946 compatible GeoJSON MultiPolygon geometry."}),Ur=(e,r,t)=>g.Object({type:g.Literal("Feature"),geometry:e,properties:r},t),fo=(e,r,t)=>g.Object({type:g.Literal("FeatureCollection"),features:g.Array(e,t)},r),Rv=[Wp,Zp,Yl,to,zy,Wy,Zy,aO,_v,Xp,Yp];d();var qt=(e,r)=>g.Unsafe(g.String({$id:r,pattern:`^${e}_[A-Za-z0-9-]+$`})),ro=qt("g","GeometryId"),Ve=qt("f","FloorId"),Bv=[ro,Ve];d();d();d();var Xy=class{constructor(r){m(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}}},Yy=class{constructor(r){m(this,"_tag","Some");m(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 lO(r(this.value))}mapAsync(r){return r(this.value).then(t=>lO(t))}mapOr(r,t){return this.map(r).unwrapOr(t)}mapOrAsync(r,t){return this.mapAsync(r).then(o=>o.unwrapOr(t))}mapOrElse(r,t){return this.map(r).unwrapOrElse(t)}mapOrElseAsync(r,t){return this.mapAsync(r).then(o=>o.unwrapOrElse(t))}and(r){return r}andThen(r){return r(this.value)}andThenAsync(r){return r(this.value)}filter(r){return r(this.value)?this:Ja()}or(r){return this}orElse(r){return this}xor(r){return r.isSome()?Ja():this}toString(){return`Some(${this.value})`}okOr(r){return oe(this.value)}okOrElse(r){return oe(this.value)}iter(){return new Xy(this.value)}[Symbol.iterator](){return this.iter()}zip(r){return r.isSome()?Jp([this.value,r.value]):Ja()}zipWith(r,t){return r.isSome()?Jp(t(this.value,r.value)):Ja()}get[Symbol.toStringTag](){return"Some"}},Jy=class{constructor(){m(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,t){return t}mapOrAsync(r,t){return Promise.resolve(t)}mapOrElse(r,t){return t()}mapOrElseAsync(r,t){return t()}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 ie(r)}okOrElse(r){return ie(r())}iter(){return new Xy(null)}[Symbol.iterator](){return this.iter()}zip(r){return this}zipWith(r,t){return this}get[Symbol.toStringTag](){return"None"}},Jp=e=>new Yy(e),Ja=()=>new Jy,lO=e=>e instanceof Yy||e instanceof Jy?e:e==null?Ja():Jp(e);var Ky=class{constructor(r){m(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}}},Nv=class{constructor(r){m(this,"_tag","Ok");m(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 Jp(this.value)}err(){return Ja()}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 oe(r(this.value))}async mapAsync(r){return r(this.value).then(oe)}mapOr(r,t){return r(this.value)}async mapOrAsync(r,t){return r(this.value)}mapOrElse(r,t){return r(this.value)}async mapOrElseAsync(r,t){return r(this.value)}mapErr(r){return this}iter(){return new Ky(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(${this.value})`}get[Symbol.toStringTag](){return"Ok"}},jv=class e{constructor(r){m(this,"_tag","Err");m(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 Ja()}err(){return Jp(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 Ky(null)}[Symbol.iterator](){return this.iter()}async mapAsync(r){return this}mapOr(r,t){return t}async mapOrAsync(r,t){return t}mapOrElse(r,t){return t()}async mapOrElseAsync(r,t){return t()}mapErr(r){return new e(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(${this.error})`}get[Symbol.toStringTag](){return"Err"}},oe=e=>new Nv(e),ie=e=>new jv(e);d();var _o;(function(e){e.GeometryMissingError="GeometryMissingError",e.FloorMissingError="FloorMissingError",e.UnknownFloorError="UnknownFloorError",e.UnknownGeometryError="UnknownGeometryError",e.DuplicateIdError="DuplicateIdError"})(_o||(_o={}));d();d();d();d();var Gv=class extends be{constructor(r){super(`Duplicate type kind '${r}' detected`)}},Zm=class extends be{constructor(r){super(`Duplicate string format '${r}' detected`)}},Qy;(function(e){function r(o,n){if(Or.Has(o))throw new Gv(o);return Or.Set(o,n),(i={})=>Hy({...i,[U]:o})}e.Type=r;function t(o,n){if(Fo.Has(o))throw new Zm(o);return Fo.Set(o,n),o}e.Format=t})(Qy||(Qy={}));d();function G_(e){switch(e.errorType){case V.ArrayContains:return"Expected array to contain at least one matching value";case V.ArrayMaxContains:return`Expected array to contain no more than ${e.schema.maxContains} matching values`;case V.ArrayMinContains:return`Expected array to contain at least ${e.schema.minContains} matching values`;case V.ArrayMaxItems:return`Expected array length to be less or equal to ${e.schema.maxItems}`;case V.ArrayMinItems:return`Expected array length to be greater or equal to ${e.schema.minItems}`;case V.ArrayUniqueItems:return"Expected array elements to be unique";case V.Array:return"Expected array";case V.AsyncIterator:return"Expected AsyncIterator";case V.BigIntExclusiveMaximum:return`Expected bigint to be less than ${e.schema.exclusiveMaximum}`;case V.BigIntExclusiveMinimum:return`Expected bigint to be greater than ${e.schema.exclusiveMinimum}`;case V.BigIntMaximum:return`Expected bigint to be less or equal to ${e.schema.maximum}`;case V.BigIntMinimum:return`Expected bigint to be greater or equal to ${e.schema.minimum}`;case V.BigIntMultipleOf:return`Expected bigint to be a multiple of ${e.schema.multipleOf}`;case V.BigInt:return"Expected bigint";case V.Boolean:return"Expected boolean";case V.DateExclusiveMinimumTimestamp:return`Expected Date timestamp to be greater than ${e.schema.exclusiveMinimumTimestamp}`;case V.DateExclusiveMaximumTimestamp:return`Expected Date timestamp to be less than ${e.schema.exclusiveMaximumTimestamp}`;case V.DateMinimumTimestamp:return`Expected Date timestamp to be greater or equal to ${e.schema.minimumTimestamp}`;case V.DateMaximumTimestamp:return`Expected Date timestamp to be less or equal to ${e.schema.maximumTimestamp}`;case V.DateMultipleOfTimestamp:return`Expected Date timestamp to be a multiple of ${e.schema.multipleOfTimestamp}`;case V.Date:return"Expected Date";case V.Function:return"Expected function";case V.IntegerExclusiveMaximum:return`Expected integer to be less than ${e.schema.exclusiveMaximum}`;case V.IntegerExclusiveMinimum:return`Expected integer to be greater than ${e.schema.exclusiveMinimum}`;case V.IntegerMaximum:return`Expected integer to be less or equal to ${e.schema.maximum}`;case V.IntegerMinimum:return`Expected integer to be greater or equal to ${e.schema.minimum}`;case V.IntegerMultipleOf:return`Expected integer to be a multiple of ${e.schema.multipleOf}`;case V.Integer:return"Expected integer";case V.IntersectUnevaluatedProperties:return"Unexpected property";case V.Intersect:return"Expected all values to match";case V.Iterator:return"Expected Iterator";case V.Literal:return`Expected ${typeof e.schema.const=="string"?`'${e.schema.const}'`:e.schema.const}`;case V.Never:return"Never";case V.Not:return"Value should not match";case V.Null:return"Expected null";case V.NumberExclusiveMaximum:return`Expected number to be less than ${e.schema.exclusiveMaximum}`;case V.NumberExclusiveMinimum:return`Expected number to be greater than ${e.schema.exclusiveMinimum}`;case V.NumberMaximum:return`Expected number to be less or equal to ${e.schema.maximum}`;case V.NumberMinimum:return`Expected number to be greater or equal to ${e.schema.minimum}`;case V.NumberMultipleOf:return`Expected number to be a multiple of ${e.schema.multipleOf}`;case V.Number:return"Expected number";case V.Object:return"Expected object";case V.ObjectAdditionalProperties:return"Unexpected property";case V.ObjectMaxProperties:return`Expected object to have no more than ${e.schema.maxProperties} properties`;case V.ObjectMinProperties:return`Expected object to have at least ${e.schema.minProperties} properties`;case V.ObjectRequiredProperty:return"Expected required property";case V.Promise:return"Expected Promise";case V.RegExp:return"Expected string to match regular expression";case V.StringFormatUnknown:return`Unknown format '${e.schema.format}'`;case V.StringFormat:return`Expected string to match '${e.schema.format}' format`;case V.StringMaxLength:return`Expected string length less or equal to ${e.schema.maxLength}`;case V.StringMinLength:return`Expected string length greater or equal to ${e.schema.minLength}`;case V.StringPattern:return`Expected string to match '${e.schema.pattern}'`;case V.String:return"Expected string";case V.Symbol:return"Expected symbol";case V.TupleLength:return`Expected tuple to have ${e.schema.maxItems||0} elements`;case V.Tuple:return"Expected tuple";case V.Uint8ArrayMaxByteLength:return`Expected byte length less or equal to ${e.schema.maxByteLength}`;case V.Uint8ArrayMinByteLength:return`Expected byte length greater or equal to ${e.schema.minByteLength}`;case V.Uint8Array:return"Expected Uint8Array";case V.Undefined:return"Expected undefined";case V.Union:return"Expected union value";case V.Void:return"Expected void";case V.Kind:return`Expected kind '${e.schema[U]}'`;default:return"Unknown error type"}}var U_=G_;function cO(){return U_}d();var Uv=class extends be{constructor(r){super(`Unable to dereference schema with $id '${r.$ref}'`),this.schema=r}};function V_(e,r){let t=r.find(o=>o.$id===e.$ref);if(t===void 0)throw new Uv(e);return Qe(t,r)}function xn(e,r){return!He(e.$id)||r.some(t=>t.$id===e.$id)||r.push(e),r}function Qe(e,r){return e[U]==="This"||e[U]==="Ref"?V_(e,r):e}d();var Vv=class extends be{constructor(r){super("Unable to hash value"),this.value=r}},Yo;(function(e){e[e.Undefined=0]="Undefined",e[e.Null=1]="Null",e[e.Boolean=2]="Boolean",e[e.Number=3]="Number",e[e.String=4]="String",e[e.Object=5]="Object",e[e.Array=6]="Array",e[e.Date=7]="Date",e[e.Uint8Array=8]="Uint8Array",e[e.Symbol=9]="Symbol",e[e.BigInt=10]="BigInt"})(Yo||(Yo={}));var Kp=BigInt("14695981039346656037"),[$_,H_]=[BigInt("1099511628211"),BigInt("18446744073709551616")],z_=Array.from({length:256}).map((e,r)=>BigInt(r)),pO=new Float64Array(1),dO=new DataView(pO.buffer),uO=new Uint8Array(pO.buffer);function*W_(e){let r=e===0?1:Math.ceil(Math.floor(Math.log2(e)+1)/8);for(let t=0;t<r;t++)yield e>>8*(r-1-t)&255}function Z_(e){oo(Yo.Array);for(let r of e)Qp(r)}function X_(e){oo(Yo.Boolean),oo(e?1:0)}function Y_(e){oo(Yo.BigInt),dO.setBigInt64(0,e);for(let r of uO)oo(r)}function J_(e){oo(Yo.Date),Qp(e.getTime())}function K_(e){oo(Yo.Null)}function Q_(e){oo(Yo.Number),dO.setFloat64(0,e);for(let r of uO)oo(r)}function q_(e){oo(Yo.Object);for(let r of globalThis.Object.getOwnPropertyNames(e).sort())Qp(r),Qp(e[r])}function e8(e){oo(Yo.String);for(let r=0;r<e.length;r++)for(let t of W_(e.charCodeAt(r)))oo(t)}function t8(e){oo(Yo.Symbol),Qp(e.description)}function r8(e){oo(Yo.Uint8Array);for(let r=0;r<e.length;r++)oo(e[r])}function o8(e){return oo(Yo.Undefined)}function Qp(e){if(we(e))return Z_(e);if(Ni(e))return X_(e);if(jr(e))return Y_(e);if(uo(e))return J_(e);if(Ls(e))return K_(e);if(me(e))return Q_(e);if(Ae(e))return q_(e);if(He(e))return e8(e);if(_s(e))return t8(e);if(Fp(e))return r8(e);if(Wt(e))return o8(e);throw new Vv(e)}function oo(e){Kp=Kp^z_[e],Kp=Kp*$_%H_}function Ka(e){return Kp=BigInt("14695981039346656037"),Qp(e),Kp}d();var $v=class extends be{constructor(r){super("Unknown type"),this.schema=r}};function n8(e){return e[U]==="Any"||e[U]==="Unknown"}function Be(e){return e!==void 0}function i8(e,r,t){return!0}function s8(e,r,t){if(!we(t)||Be(e.minItems)&&!(t.length>=e.minItems)||Be(e.maxItems)&&!(t.length<=e.maxItems)||!t.every(i=>Vr(e.items,r,i))||e.uniqueItems===!0&&!function(){let i=new Set;for(let a of t){let l=Ka(a);if(i.has(l))return!1;i.add(l)}return!0}())return!1;if(!(Be(e.contains)||me(e.minContains)||me(e.maxContains)))return!0;let o=Be(e.contains)?e.contains:ft(),n=t.reduce((i,a)=>Vr(o,r,a)?i+1:i,0);return!(n===0||me(e.minContains)&&n<e.minContains||me(e.maxContains)&&n>e.maxContains)}function a8(e,r,t){return xy(t)}function l8(e,r,t){return!(!jr(t)||Be(e.exclusiveMaximum)&&!(t<e.exclusiveMaximum)||Be(e.exclusiveMinimum)&&!(t>e.exclusiveMinimum)||Be(e.maximum)&&!(t<=e.maximum)||Be(e.minimum)&&!(t>=e.minimum)||Be(e.multipleOf)&&t%e.multipleOf!==BigInt(0))}function c8(e,r,t){return Ni(t)}function p8(e,r,t){return Vr(e.returns,r,t.prototype)}function d8(e,r,t){return!(!uo(t)||Be(e.exclusiveMaximumTimestamp)&&!(t.getTime()<e.exclusiveMaximumTimestamp)||Be(e.exclusiveMinimumTimestamp)&&!(t.getTime()>e.exclusiveMinimumTimestamp)||Be(e.maximumTimestamp)&&!(t.getTime()<=e.maximumTimestamp)||Be(e.minimumTimestamp)&&!(t.getTime()>=e.minimumTimestamp)||Be(e.multipleOfTimestamp)&&t.getTime()%e.multipleOfTimestamp!==0)}function u8(e,r,t){return $a(t)}function m8(e,r,t){return!(!Sy(t)||Be(e.exclusiveMaximum)&&!(t<e.exclusiveMaximum)||Be(e.exclusiveMinimum)&&!(t>e.exclusiveMinimum)||Be(e.maximum)&&!(t<=e.maximum)||Be(e.minimum)&&!(t>=e.minimum)||Be(e.multipleOf)&&t%e.multipleOf!==0)}function f8(e,r,t){let o=e.allOf.every(n=>Vr(n,r,t));if(e.unevaluatedProperties===!1){let n=new RegExp(Vs(e)),i=Object.getOwnPropertyNames(t).every(a=>n.test(a));return o&&i}else if(ze(e.unevaluatedProperties)){let n=new RegExp(Vs(e)),i=Object.getOwnPropertyNames(t).every(a=>n.test(a)||Vr(e.unevaluatedProperties,r,t[a]));return o&&i}else return o}function h8(e,r,t){return vy(t)}function g8(e,r,t){return t===e.const}function y8(e,r,t){return!1}function b8(e,r,t){return!Vr(e.not,r,t)}function x8(e,r,t){return Ls(t)}function v8(e,r,t){return!(!pt.IsNumberLike(t)||Be(e.exclusiveMaximum)&&!(t<e.exclusiveMaximum)||Be(e.exclusiveMinimum)&&!(t>e.exclusiveMinimum)||Be(e.minimum)&&!(t>=e.minimum)||Be(e.maximum)&&!(t<=e.maximum)||Be(e.multipleOf)&&t%e.multipleOf!==0)}function I8(e,r,t){if(!pt.IsObjectLike(t)||Be(e.minProperties)&&!(Object.getOwnPropertyNames(t).length>=e.minProperties)||Be(e.maxProperties)&&!(Object.getOwnPropertyNames(t).length<=e.maxProperties))return!1;let o=Object.getOwnPropertyNames(e.properties);for(let n of o){let i=e.properties[n];if(e.required&&e.required.includes(n)){if(!Vr(i,r,t[n])||(Hs(i)||n8(i))&&!(n in t))return!1}else if(pt.IsExactOptionalProperty(t,n)&&!Vr(i,r,t[n]))return!1}if(e.additionalProperties===!1){let n=Object.getOwnPropertyNames(t);return e.required&&e.required.length===o.length&&n.length===o.length?!0:n.every(i=>o.includes(i))}else return typeof e.additionalProperties=="object"?Object.getOwnPropertyNames(t).every(i=>o.includes(i)||Vr(e.additionalProperties,r,t[i])):!0}function S8(e,r,t){return Iy(t)}function T8(e,r,t){if(!pt.IsRecordLike(t)||Be(e.minProperties)&&!(Object.getOwnPropertyNames(t).length>=e.minProperties)||Be(e.maxProperties)&&!(Object.getOwnPropertyNames(t).length<=e.maxProperties))return!1;let[o,n]=Object.entries(e.patternProperties)[0],i=new RegExp(o),a=Object.entries(t).every(([p,u])=>i.test(p)?Vr(n,r,u):!0),l=typeof e.additionalProperties=="object"?Object.entries(t).every(([p,u])=>i.test(p)?!0:Vr(e.additionalProperties,r,u)):!0,c=e.additionalProperties===!1?Object.getOwnPropertyNames(t).every(p=>i.test(p)):!0;return a&&l&&c}function C8(e,r,t){return Vr(Qe(e,r),r,t)}function M8(e,r,t){let o=new RegExp(e.source,e.flags);return Be(e.minLength)&&!(t.length>=e.minLength)||Be(e.maxLength)&&!(t.length<=e.maxLength)?!1:o.test(t)}function w8(e,r,t){return!He(t)||Be(e.minLength)&&!(t.length>=e.minLength)||Be(e.maxLength)&&!(t.length<=e.maxLength)||Be(e.pattern)&&!new RegExp(e.pattern).test(t)?!1:Be(e.format)?Fo.Has(e.format)?Fo.Get(e.format)(t):!1:!0}function O8(e,r,t){return _s(t)}function E8(e,r,t){return He(t)&&new RegExp(e.pattern).test(t)}function P8(e,r,t){return Vr(Qe(e,r),r,t)}function F8(e,r,t){if(!we(t)||e.items===void 0&&t.length!==0||t.length!==e.maxItems)return!1;if(!e.items)return!0;for(let o=0;o<e.items.length;o++)if(!Vr(e.items[o],r,t[o]))return!1;return!0}function D8(e,r,t){return Wt(t)}function k8(e,r,t){return e.anyOf.some(o=>Vr(o,r,t))}function A8(e,r,t){return!(!Fp(t)||Be(e.maxByteLength)&&!(t.length<=e.maxByteLength)||Be(e.minByteLength)&&!(t.length>=e.minByteLength))}function L8(e,r,t){return!0}function _8(e,r,t){return pt.IsVoidLike(t)}function R8(e,r,t){return Or.Has(e[U])?Or.Get(e[U])(e,t):!1}function Vr(e,r,t){let o=Be(e.$id)?[...r,e]:r,n=e;switch(n[U]){case"Any":return i8(n,o,t);case"Array":return s8(n,o,t);case"AsyncIterator":return a8(n,o,t);case"BigInt":return l8(n,o,t);case"Boolean":return c8(n,o,t);case"Constructor":return p8(n,o,t);case"Date":return d8(n,o,t);case"Function":return u8(n,o,t);case"Integer":return m8(n,o,t);case"Intersect":return f8(n,o,t);case"Iterator":return h8(n,o,t);case"Literal":return g8(n,o,t);case"Never":return y8(n,o,t);case"Not":return b8(n,o,t);case"Null":return x8(n,o,t);case"Number":return v8(n,o,t);case"Object":return I8(n,o,t);case"Promise":return S8(n,o,t);case"Record":return T8(n,o,t);case"Ref":return C8(n,o,t);case"RegExp":return M8(n,o,t);case"String":return w8(n,o,t);case"Symbol":return O8(n,o,t);case"TemplateLiteral":return E8(n,o,t);case"This":return P8(n,o,t);case"Tuple":return F8(n,o,t);case"Undefined":return D8(n,o,t);case"Union":return k8(n,o,t);case"Uint8Array":return A8(n,o,t);case"Unknown":return L8(n,o,t);case"Void":return _8(n,o,t);default:if(!Or.Has(n[U]))throw new $v(n);return R8(n,o,t)}}function _e(...e){return e.length===3?Vr(e[0],e[1],e[2]):Vr(e[0],[],e[1])}var V;(function(e){e[e.ArrayContains=0]="ArrayContains",e[e.ArrayMaxContains=1]="ArrayMaxContains",e[e.ArrayMaxItems=2]="ArrayMaxItems",e[e.ArrayMinContains=3]="ArrayMinContains",e[e.ArrayMinItems=4]="ArrayMinItems",e[e.ArrayUniqueItems=5]="ArrayUniqueItems",e[e.Array=6]="Array",e[e.AsyncIterator=7]="AsyncIterator",e[e.BigIntExclusiveMaximum=8]="BigIntExclusiveMaximum",e[e.BigIntExclusiveMinimum=9]="BigIntExclusiveMinimum",e[e.BigIntMaximum=10]="BigIntMaximum",e[e.BigIntMinimum=11]="BigIntMinimum",e[e.BigIntMultipleOf=12]="BigIntMultipleOf",e[e.BigInt=13]="BigInt",e[e.Boolean=14]="Boolean",e[e.DateExclusiveMaximumTimestamp=15]="DateExclusiveMaximumTimestamp",e[e.DateExclusiveMinimumTimestamp=16]="DateExclusiveMinimumTimestamp",e[e.DateMaximumTimestamp=17]="DateMaximumTimestamp",e[e.DateMinimumTimestamp=18]="DateMinimumTimestamp",e[e.DateMultipleOfTimestamp=19]="DateMultipleOfTimestamp",e[e.Date=20]="Date",e[e.Function=21]="Function",e[e.IntegerExclusiveMaximum=22]="IntegerExclusiveMaximum",e[e.IntegerExclusiveMinimum=23]="IntegerExclusiveMinimum",e[e.IntegerMaximum=24]="IntegerMaximum",e[e.IntegerMinimum=25]="IntegerMinimum",e[e.IntegerMultipleOf=26]="IntegerMultipleOf",e[e.Integer=27]="Integer",e[e.IntersectUnevaluatedProperties=28]="IntersectUnevaluatedProperties",e[e.Intersect=29]="Intersect",e[e.Iterator=30]="Iterator",e[e.Kind=31]="Kind",e[e.Literal=32]="Literal",e[e.Never=33]="Never",e[e.Not=34]="Not",e[e.Null=35]="Null",e[e.NumberExclusiveMaximum=36]="NumberExclusiveMaximum",e[e.NumberExclusiveMinimum=37]="NumberExclusiveMinimum",e[e.NumberMaximum=38]="NumberMaximum",e[e.NumberMinimum=39]="NumberMinimum",e[e.NumberMultipleOf=40]="NumberMultipleOf",e[e.Number=41]="Number",e[e.ObjectAdditionalProperties=42]="ObjectAdditionalProperties",e[e.ObjectMaxProperties=43]="ObjectMaxProperties",e[e.ObjectMinProperties=44]="ObjectMinProperties",e[e.ObjectRequiredProperty=45]="ObjectRequiredProperty",e[e.Object=46]="Object",e[e.Promise=47]="Promise",e[e.RegExp=48]="RegExp",e[e.StringFormatUnknown=49]="StringFormatUnknown",e[e.StringFormat=50]="StringFormat",e[e.StringMaxLength=51]="StringMaxLength",e[e.StringMinLength=52]="StringMinLength",e[e.StringPattern=53]="StringPattern",e[e.String=54]="String",e[e.Symbol=55]="Symbol",e[e.TupleLength=56]="TupleLength",e[e.Tuple=57]="Tuple",e[e.Uint8ArrayMaxByteLength=58]="Uint8ArrayMaxByteLength",e[e.Uint8ArrayMinByteLength=59]="Uint8ArrayMinByteLength",e[e.Uint8Array=60]="Uint8Array",e[e.Undefined=61]="Undefined",e[e.Union=62]="Union",e[e.Void=63]="Void"})(V||(V={}));var Hv=class extends be{constructor(r){super("Unknown type"),this.schema=r}};function zs(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function Ne(e){return e!==void 0}var vn=class{constructor(r){this.iterator=r}[Symbol.iterator](){return this.iterator}First(){let r=this.iterator.next();return r.done?void 0:r.value}};function te(e,r,t,o,n=[]){return{type:e,schema:r,path:t,value:o,message:cO()({errorType:e,path:t,schema:r,value:o,errors:n}),errors:n}}function*B8(e,r,t,o){}function*N8(e,r,t,o){if(!we(o))return yield te(V.Array,e,t,o);Ne(e.minItems)&&!(o.length>=e.minItems)&&(yield te(V.ArrayMinItems,e,t,o)),Ne(e.maxItems)&&!(o.length<=e.maxItems)&&(yield te(V.ArrayMaxItems,e,t,o));for(let a=0;a<o.length;a++)yield*$r(e.items,r,`${t}/${a}`,o[a]);if(e.uniqueItems===!0&&!function(){let a=new Set;for(let l of o){let c=Ka(l);if(a.has(c))return!1;a.add(c)}return!0}()&&(yield te(V.ArrayUniqueItems,e,t,o)),!(Ne(e.contains)||Ne(e.minContains)||Ne(e.maxContains)))return;let n=Ne(e.contains)?e.contains:ft(),i=o.reduce((a,l,c)=>$r(n,r,`${t}${c}`,l).next().done===!0?a+1:a,0);i===0&&(yield te(V.ArrayContains,e,t,o)),me(e.minContains)&&i<e.minContains&&(yield te(V.ArrayMinContains,e,t,o)),me(e.maxContains)&&i>e.maxContains&&(yield te(V.ArrayMaxContains,e,t,o))}function*j8(e,r,t,o){xy(o)||(yield te(V.AsyncIterator,e,t,o))}function*G8(e,r,t,o){if(!jr(o))return yield te(V.BigInt,e,t,o);Ne(e.exclusiveMaximum)&&!(o<e.exclusiveMaximum)&&(yield te(V.BigIntExclusiveMaximum,e,t,o)),Ne(e.exclusiveMinimum)&&!(o>e.exclusiveMinimum)&&(yield te(V.BigIntExclusiveMinimum,e,t,o)),Ne(e.maximum)&&!(o<=e.maximum)&&(yield te(V.BigIntMaximum,e,t,o)),Ne(e.minimum)&&!(o>=e.minimum)&&(yield te(V.BigIntMinimum,e,t,o)),Ne(e.multipleOf)&&o%e.multipleOf!==BigInt(0)&&(yield te(V.BigIntMultipleOf,e,t,o))}function*U8(e,r,t,o){Ni(o)||(yield te(V.Boolean,e,t,o))}function*V8(e,r,t,o){yield*$r(e.returns,r,t,o.prototype)}function*$8(e,r,t,o){if(!uo(o))return yield te(V.Date,e,t,o);Ne(e.exclusiveMaximumTimestamp)&&!(o.getTime()<e.exclusiveMaximumTimestamp)&&(yield te(V.DateExclusiveMaximumTimestamp,e,t,o)),Ne(e.exclusiveMinimumTimestamp)&&!(o.getTime()>e.exclusiveMinimumTimestamp)&&(yield te(V.DateExclusiveMinimumTimestamp,e,t,o)),Ne(e.maximumTimestamp)&&!(o.getTime()<=e.maximumTimestamp)&&(yield te(V.DateMaximumTimestamp,e,t,o)),Ne(e.minimumTimestamp)&&!(o.getTime()>=e.minimumTimestamp)&&(yield te(V.DateMinimumTimestamp,e,t,o)),Ne(e.multipleOfTimestamp)&&o.getTime()%e.multipleOfTimestamp!==0&&(yield te(V.DateMultipleOfTimestamp,e,t,o))}function*H8(e,r,t,o){$a(o)||(yield te(V.Function,e,t,o))}function*z8(e,r,t,o){if(!Sy(o))return yield te(V.Integer,e,t,o);Ne(e.exclusiveMaximum)&&!(o<e.exclusiveMaximum)&&(yield te(V.IntegerExclusiveMaximum,e,t,o)),Ne(e.exclusiveMinimum)&&!(o>e.exclusiveMinimum)&&(yield te(V.IntegerExclusiveMinimum,e,t,o)),Ne(e.maximum)&&!(o<=e.maximum)&&(yield te(V.IntegerMaximum,e,t,o)),Ne(e.minimum)&&!(o>=e.minimum)&&(yield te(V.IntegerMinimum,e,t,o)),Ne(e.multipleOf)&&o%e.multipleOf!==0&&(yield te(V.IntegerMultipleOf,e,t,o))}function*W8(e,r,t,o){let n=!1;for(let i of e.allOf)for(let a of $r(i,r,t,o))n=!0,yield a;if(n)return yield te(V.Intersect,e,t,o);if(e.unevaluatedProperties===!1){let i=new RegExp(Vs(e));for(let a of Object.getOwnPropertyNames(o))i.test(a)||(yield te(V.IntersectUnevaluatedProperties,e,`${t}/${a}`,o))}if(typeof e.unevaluatedProperties=="object"){let i=new RegExp(Vs(e));for(let a of Object.getOwnPropertyNames(o))if(!i.test(a)){let l=$r(e.unevaluatedProperties,r,`${t}/${a}`,o[a]).next();l.done||(yield l.value)}}}function*Z8(e,r,t,o){vy(o)||(yield te(V.Iterator,e,t,o))}function*X8(e,r,t,o){o!==e.const&&(yield te(V.Literal,e,t,o))}function*Y8(e,r,t,o){yield te(V.Never,e,t,o)}function*J8(e,r,t,o){$r(e.not,r,t,o).next().done===!0&&(yield te(V.Not,e,t,o))}function*K8(e,r,t,o){Ls(o)||(yield te(V.Null,e,t,o))}function*Q8(e,r,t,o){if(!pt.IsNumberLike(o))return yield te(V.Number,e,t,o);Ne(e.exclusiveMaximum)&&!(o<e.exclusiveMaximum)&&(yield te(V.NumberExclusiveMaximum,e,t,o)),Ne(e.exclusiveMinimum)&&!(o>e.exclusiveMinimum)&&(yield te(V.NumberExclusiveMinimum,e,t,o)),Ne(e.maximum)&&!(o<=e.maximum)&&(yield te(V.NumberMaximum,e,t,o)),Ne(e.minimum)&&!(o>=e.minimum)&&(yield te(V.NumberMinimum,e,t,o)),Ne(e.multipleOf)&&o%e.multipleOf!==0&&(yield te(V.NumberMultipleOf,e,t,o))}function*q8(e,r,t,o){if(!pt.IsObjectLike(o))return yield te(V.Object,e,t,o);Ne(e.minProperties)&&!(Object.getOwnPropertyNames(o).length>=e.minProperties)&&(yield te(V.ObjectMinProperties,e,t,o)),Ne(e.maxProperties)&&!(Object.getOwnPropertyNames(o).length<=e.maxProperties)&&(yield te(V.ObjectMaxProperties,e,t,o));let n=Array.isArray(e.required)?e.required:[],i=Object.getOwnPropertyNames(e.properties),a=Object.getOwnPropertyNames(o);for(let l of n)a.includes(l)||(yield te(V.ObjectRequiredProperty,e.properties[l],`${t}/${zs(l)}`,void 0));if(e.additionalProperties===!1)for(let l of a)i.includes(l)||(yield te(V.ObjectAdditionalProperties,e,`${t}/${zs(l)}`,o[l]));if(typeof e.additionalProperties=="object")for(let l of a)i.includes(l)||(yield*$r(e.additionalProperties,r,`${t}/${zs(l)}`,o[l]));for(let l of i){let c=e.properties[l];e.required&&e.required.includes(l)?(yield*$r(c,r,`${t}/${zs(l)}`,o[l]),Hs(e)&&!(l in o)&&(yield te(V.ObjectRequiredProperty,c,`${t}/${zs(l)}`,void 0))):pt.IsExactOptionalProperty(o,l)&&(yield*$r(c,r,`${t}/${zs(l)}`,o[l]))}}function*eR(e,r,t,o){Iy(o)||(yield te(V.Promise,e,t,o))}function*tR(e,r,t,o){if(!pt.IsRecordLike(o))return yield te(V.Object,e,t,o);Ne(e.minProperties)&&!(Object.getOwnPropertyNames(o).length>=e.minProperties)&&(yield te(V.ObjectMinProperties,e,t,o)),Ne(e.maxProperties)&&!(Object.getOwnPropertyNames(o).length<=e.maxProperties)&&(yield te(V.ObjectMaxProperties,e,t,o));let[n,i]=Object.entries(e.patternProperties)[0],a=new RegExp(n);for(let[l,c]of Object.entries(o))a.test(l)&&(yield*$r(i,r,`${t}/${zs(l)}`,c));if(typeof e.additionalProperties=="object")for(let[l,c]of Object.entries(o))a.test(l)||(yield*$r(e.additionalProperties,r,`${t}/${zs(l)}`,c));if(e.additionalProperties===!1){for(let[l,c]of Object.entries(o))if(!a.test(l))return yield te(V.ObjectAdditionalProperties,e,`${t}/${zs(l)}`,c)}}function*rR(e,r,t,o){yield*$r(Qe(e,r),r,t,o)}function*oR(e,r,t,o){if(!He(o))return yield te(V.String,e,t,o);if(Ne(e.minLength)&&!(o.length>=e.minLength)&&(yield te(V.StringMinLength,e,t,o)),Ne(e.maxLength)&&!(o.length<=e.maxLength)&&(yield te(V.StringMaxLength,e,t,o)),!new RegExp(e.source,e.flags).test(o))return yield te(V.RegExp,e,t,o)}function*nR(e,r,t,o){if(!He(o))return yield te(V.String,e,t,o);Ne(e.minLength)&&!(o.length>=e.minLength)&&(yield te(V.StringMinLength,e,t,o)),Ne(e.maxLength)&&!(o.length<=e.maxLength)&&(yield te(V.StringMaxLength,e,t,o)),He(e.pattern)&&(new RegExp(e.pattern).test(o)||(yield te(V.StringPattern,e,t,o))),He(e.format)&&(Fo.Has(e.format)?Fo.Get(e.format)(o)||(yield te(V.StringFormat,e,t,o)):yield te(V.StringFormatUnknown,e,t,o))}function*iR(e,r,t,o){_s(o)||(yield te(V.Symbol,e,t,o))}function*sR(e,r,t,o){if(!He(o))return yield te(V.String,e,t,o);new RegExp(e.pattern).test(o)||(yield te(V.StringPattern,e,t,o))}function*aR(e,r,t,o){yield*$r(Qe(e,r),r,t,o)}function*lR(e,r,t,o){if(!we(o))return yield te(V.Tuple,e,t,o);if(e.items===void 0&&o.length!==0)return yield te(V.TupleLength,e,t,o);if(o.length!==e.maxItems)return yield te(V.TupleLength,e,t,o);if(e.items)for(let n=0;n<e.items.length;n++)yield*$r(e.items[n],r,`${t}/${n}`,o[n])}function*cR(e,r,t,o){Wt(o)||(yield te(V.Undefined,e,t,o))}function*pR(e,r,t,o){if(_e(e,r,o))return;let n=e.anyOf.map(i=>new vn($r(i,r,t,o)));yield te(V.Union,e,t,o,n)}function*dR(e,r,t,o){if(!Fp(o))return yield te(V.Uint8Array,e,t,o);Ne(e.maxByteLength)&&!(o.length<=e.maxByteLength)&&(yield te(V.Uint8ArrayMaxByteLength,e,t,o)),Ne(e.minByteLength)&&!(o.length>=e.minByteLength)&&(yield te(V.Uint8ArrayMinByteLength,e,t,o))}function*uR(e,r,t,o){}function*mR(e,r,t,o){pt.IsVoidLike(o)||(yield te(V.Void,e,t,o))}function*fR(e,r,t,o){Or.Get(e[U])(e,o)||(yield te(V.Kind,e,t,o))}function*$r(e,r,t,o){let n=Ne(e.$id)?[...r,e]:r,i=e;switch(i[U]){case"Any":return yield*B8(i,n,t,o);case"Array":return yield*N8(i,n,t,o);case"AsyncIterator":return yield*j8(i,n,t,o);case"BigInt":return yield*G8(i,n,t,o);case"Boolean":return yield*U8(i,n,t,o);case"Constructor":return yield*V8(i,n,t,o);case"Date":return yield*$8(i,n,t,o);case"Function":return yield*H8(i,n,t,o);case"Integer":return yield*z8(i,n,t,o);case"Intersect":return yield*W8(i,n,t,o);case"Iterator":return yield*Z8(i,n,t,o);case"Literal":return yield*X8(i,n,t,o);case"Never":return yield*Y8(i,n,t,o);case"Not":return yield*J8(i,n,t,o);case"Null":return yield*K8(i,n,t,o);case"Number":return yield*Q8(i,n,t,o);case"Object":return yield*q8(i,n,t,o);case"Promise":return yield*eR(i,n,t,o);case"Record":return yield*tR(i,n,t,o);case"Ref":return yield*rR(i,n,t,o);case"RegExp":return yield*oR(i,n,t,o);case"String":return yield*nR(i,n,t,o);case"Symbol":return yield*iR(i,n,t,o);case"TemplateLiteral":return yield*sR(i,n,t,o);case"This":return yield*aR(i,n,t,o);case"Tuple":return yield*lR(i,n,t,o);case"Undefined":return yield*cR(i,n,t,o);case"Union":return yield*pR(i,n,t,o);case"Uint8Array":return yield*dR(i,n,t,o);case"Unknown":return yield*uR(i,n,t,o);case"Void":return yield*mR(i,n,t,o);default:if(!Or.Has(i[U]))throw new Hv(e);return yield*fR(i,n,t,o)}}function $i(...e){let r=e.length===3?$r(e[0],e[1],"",e[2]):$r(e[0],[],"",e[1]);return new vn(r)}d();d();var hR=function(e,r,t,o,n){if(o==="m")throw new TypeError("Private method is not writable");if(o==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof r=="function"?e!==r||!n:!r.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return o==="a"?n.call(e,t):n?n.value=t:r.set(e,t),t},fO=function(e,r,t,o){if(t==="a"&&!o)throw new TypeError("Private accessor was defined without a getter");if(typeof r=="function"?e!==r||!o:!r.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?o:t==="a"?o.call(e):o?o.value:r.get(e)},zv,qy,hO,Wv=class extends be{constructor(r){let t=r.First();super(t===void 0?"Invalid Value":t.message),zv.add(this),qy.set(this,void 0),hR(this,qy,r,"f"),this.error=t}Errors(){return new vn(fO(this,zv,"m",hO).call(this))}};qy=new WeakMap,zv=new WeakSet,hO=function*(){this.error&&(yield this.error),yield*fO(this,qy,"f")};function mO(e,r,t){if(!_e(e,r,t))throw new Wv($i(e,r,t))}function eb(...e){return e.length===3?mO(e[0],e[1],e[2]):mO(e[0],[],e[1])}d();d();d();function gR(e){let r={};for(let t of Object.getOwnPropertyNames(e))r[t]=qe(e[t]);for(let t of Object.getOwnPropertySymbols(e))r[t]=qe(e[t]);return r}function yR(e){return e.map(r=>qe(r))}function bR(e){return e.slice()}function xR(e){return new Map(qe([...e.entries()]))}function vR(e){return new Set(qe([...e.entries()]))}function IR(e){return new Date(e.toISOString())}function qe(e){if(we(e))return yR(e);if(uo(e))return IR(e);if(un(e))return bR(e);if(QM(e))return xR(e);if(qM(e))return vR(e);if(Ae(e))return gR(e);if(Gr(e))return e;throw new Error("ValueClone: Unable to clone value")}var Jo=class extends be{constructor(r,t){super(t),this.schema=r}};function et(e){return $a(e)?e():qe(e)}function SR(e,r){return ve(e,"default")?et(e.default):{}}function TR(e,r){if(e.uniqueItems===!0&&!ve(e,"default"))throw new Jo(e,"Array with the uniqueItems constraint requires a default value");if("contains"in e&&!ve(e,"default"))throw new Jo(e,"Array with the contains constraint requires a default value");return"default"in e?et(e.default):e.minItems!==void 0?Array.from({length:e.minItems}).map(t=>Ko(e.items,r)):[]}function CR(e,r){return ve(e,"default")?et(e.default):async function*(){}()}function MR(e,r){return ve(e,"default")?et(e.default):BigInt(0)}function wR(e,r){return ve(e,"default")?et(e.default):!1}function OR(e,r){if(ve(e,"default"))return et(e.default);{let t=Ko(e.returns,r);return typeof t=="object"&&!Array.isArray(t)?class{constructor(){for(let[o,n]of Object.entries(t)){let i=this;i[o]=n}}}:class{}}}function ER(e,r){return ve(e,"default")?et(e.default):e.minimumTimestamp!==void 0?new Date(e.minimumTimestamp):new Date}function PR(e,r){return ve(e,"default")?et(e.default):()=>Ko(e.returns,r)}function FR(e,r){return ve(e,"default")?et(e.default):e.minimum!==void 0?e.minimum:0}function DR(e,r){if(ve(e,"default"))return et(e.default);{let t=e.allOf.reduce((o,n)=>{let i=Ko(n,r);return typeof i=="object"?{...o,...i}:i},{});if(!_e(e,r,t))throw new Jo(e,"Intersect produced invalid value. Consider using a default value.");return t}}function kR(e,r){return ve(e,"default")?et(e.default):function*(){}()}function AR(e,r){return ve(e,"default")?et(e.default):e.const}function LR(e,r){if(ve(e,"default"))return et(e.default);throw new Jo(e,"Never types cannot be created. Consider using a default value.")}function _R(e,r){if(ve(e,"default"))return et(e.default);throw new Jo(e,"Not types must have a default value")}function RR(e,r){return ve(e,"default")?et(e.default):null}function BR(e,r){return ve(e,"default")?et(e.default):e.minimum!==void 0?e.minimum:0}function NR(e,r){if(ve(e,"default"))return et(e.default);{let t=new Set(e.required),o={};for(let[n,i]of Object.entries(e.properties))t.has(n)&&(o[n]=Ko(i,r));return o}}function jR(e,r){return ve(e,"default")?et(e.default):Promise.resolve(Ko(e.item,r))}function GR(e,r){let[t,o]=Object.entries(e.patternProperties)[0];if(ve(e,"default"))return et(e.default);if(t===Gs||t===js)return{};{let n=t.slice(1,t.length-1).split("|"),i={};for(let a of n)i[a]=Ko(o,r);return i}}function UR(e,r){return ve(e,"default")?et(e.default):Ko(Qe(e,r),r)}function VR(e,r){if(ve(e,"default"))return et(e.default);throw new Jo(e,"RegExp types cannot be created. Consider using a default value.")}function $R(e,r){if(e.pattern!==void 0){if(ve(e,"default"))return et(e.default);throw new Jo(e,"String types with patterns must specify a default value")}else if(e.format!==void 0){if(ve(e,"default"))return et(e.default);throw new Jo(e,"String types with formats must specify a default value")}else return ve(e,"default")?et(e.default):e.minLength!==void 0?Array.from({length:e.minLength}).map(()=>" ").join(""):""}function HR(e,r){return ve(e,"default")?et(e.default):"value"in e?Symbol.for(e.value):Symbol()}function zR(e,r){if(ve(e,"default"))return et(e.default);if(!Oy(e))throw new Jo(e,"Can only create template literals that produce a finite variants. Consider using a default value.");return Bp(e)[0]}function WR(e,r){if(gO++>eB)throw new Jo(e,"Cannot create recursive type as it appears possibly infinite. Consider using a default.");return ve(e,"default")?et(e.default):Ko(Qe(e,r),r)}function ZR(e,r){return ve(e,"default")?et(e.default):e.items===void 0?[]:Array.from({length:e.minItems}).map((t,o)=>Ko(e.items[o],r))}function XR(e,r){if(ve(e,"default"))return et(e.default)}function YR(e,r){if(ve(e,"default"))return et(e.default);if(e.anyOf.length===0)throw new Error("ValueCreate.Union: Cannot create Union with zero variants");return Ko(e.anyOf[0],r)}function JR(e,r){return ve(e,"default")?et(e.default):e.minByteLength!==void 0?new Uint8Array(e.minByteLength):new Uint8Array(0)}function KR(e,r){return ve(e,"default")?et(e.default):{}}function QR(e,r){if(ve(e,"default"))return et(e.default)}function qR(e,r){if(ve(e,"default"))return et(e.default);throw new Error("User defined types must specify a default value")}function Ko(e,r){let t=xn(e,r),o=e;switch(o[U]){case"Any":return SR(o,t);case"Array":return TR(o,t);case"AsyncIterator":return CR(o,t);case"BigInt":return MR(o,t);case"Boolean":return wR(o,t);case"Constructor":return OR(o,t);case"Date":return ER(o,t);case"Function":return PR(o,t);case"Integer":return FR(o,t);case"Intersect":return DR(o,t);case"Iterator":return kR(o,t);case"Literal":return AR(o,t);case"Never":return LR(o,t);case"Not":return _R(o,t);case"Null":return RR(o,t);case"Number":return BR(o,t);case"Object":return NR(o,t);case"Promise":return jR(o,t);case"Record":return GR(o,t);case"Ref":return UR(o,t);case"RegExp":return VR(o,t);case"String":return $R(o,t);case"Symbol":return HR(o,t);case"TemplateLiteral":return zR(o,t);case"This":return WR(o,t);case"Tuple":return ZR(o,t);case"Undefined":return XR(o,t);case"Union":return YR(o,t);case"Uint8Array":return JR(o,t);case"Unknown":return KR(o,t);case"Void":return QR(o,t);default:if(!Or.Has(o[U]))throw new Jo(o,"Unknown type");return qR(o,t)}}var eB=512,gO=0;function In(...e){return gO=0,e.length===2?Ko(e[0],e[1]):Ko(e[0],[])}var tb=class extends be{constructor(r,t){super(t),this.schema=r}};function tB(e,r,t){if(e[U]==="Object"&&typeof t=="object"&&!Ls(t)){let o=e,n=Object.getOwnPropertyNames(t),i=Object.entries(o.properties),[a,l]=[1/i.length,i.length];return i.reduce((c,[p,u])=>{let f=u[U]==="Literal"&&u.const===t[p]?l:0,h=_e(u,r,t[p])?a:0,b=n.includes(p)?a:0;return c+(f+h+b)},0)}else return _e(e,r,t)?1:0}function rB(e,r,t){let o=e.anyOf.map(a=>Qe(a,r)),[n,i]=[o[0],0];for(let a of o){let l=tB(a,r,t);l>i&&(n=a,i=l)}return n}function oB(e,r,t){if("default"in e)return typeof t=="function"?e.default:qe(e.default);{let o=rB(e,r,t);return Zv(o,r,t)}}function nB(e,r,t){return _e(e,r,t)?qe(t):In(e,r)}function iB(e,r,t){return _e(e,r,t)?t:In(e,r)}function sB(e,r,t){if(_e(e,r,t))return qe(t);let o=we(t)?qe(t):In(e,r),n=me(e.minItems)&&o.length<e.minItems?[...o,...Array.from({length:e.minItems-o.length},()=>null)]:o,a=(me(e.maxItems)&&n.length>e.maxItems?n.slice(0,e.maxItems):n).map(c=>Hi(e.items,r,c));if(e.uniqueItems!==!0)return a;let l=[...new Set(a)];if(!_e(e,r,l))throw new tb(e,"Array cast produced invalid data due to uniqueItems constraint");return l}function aB(e,r,t){if(_e(e,r,t))return In(e,r);let o=new Set(e.returns.required||[]),n=function(){};for(let[i,a]of Object.entries(e.returns.properties))!o.has(i)&&t.prototype[i]===void 0||(n.prototype[i]=Hi(a,r,t.prototype[i]));return n}function lB(e,r,t){let o=In(e,r),n=Ae(o)&&Ae(t)?{...o,...t}:t;return _e(e,r,n)?n:In(e,r)}function cB(e,r,t){throw new tb(e,"Never types cannot be cast")}function pB(e,r,t){if(_e(e,r,t))return t;if(t===null||typeof t!="object")return In(e,r);let o=new Set(e.required||[]),n={};for(let[i,a]of Object.entries(e.properties))!o.has(i)&&t[i]===void 0||(n[i]=Hi(a,r,t[i]));if(typeof e.additionalProperties=="object"){let i=Object.getOwnPropertyNames(e.properties);for(let a of Object.getOwnPropertyNames(t))i.includes(a)||(n[a]=Hi(e.additionalProperties,r,t[a]))}return n}function dB(e,r,t){if(_e(e,r,t))return qe(t);if(t===null||typeof t!="object"||Array.isArray(t)||t instanceof Date)return In(e,r);let o=Object.getOwnPropertyNames(e.patternProperties)[0],n=e.patternProperties[o],i={};for(let[a,l]of Object.entries(t))i[a]=Hi(n,r,l);return i}function uB(e,r,t){return Hi(Qe(e,r),r,t)}function mB(e,r,t){return Hi(Qe(e,r),r,t)}function fB(e,r,t){return _e(e,r,t)?qe(t):we(t)?e.items===void 0?[]:e.items.map((o,n)=>Hi(o,r,t[n])):In(e,r)}function hB(e,r,t){return _e(e,r,t)?qe(t):oB(e,r,t)}function Hi(e,r,t){let o=He(e.$id)?[...r,e]:r,n=e;switch(e[U]){case"Array":return sB(n,o,t);case"Constructor":return aB(n,o,t);case"Intersect":return lB(n,o,t);case"Never":return cB(n,o,t);case"Object":return pB(n,o,t);case"Record":return dB(n,o,t);case"Ref":return uB(n,o,t);case"This":return mB(n,o,t);case"Tuple":return fB(n,o,t);case"Union":return hB(n,o,t);case"Date":case"Symbol":case"Uint8Array":return nB(e,r,t);default:return iB(n,o,t)}}function Zv(...e){return e.length===3?Hi(e[0],e[1],e[2]):Hi(e[0],[],e[1])}d();function gB(e){return za(e)&&e[U]!=="Unsafe"}function yB(e,r,t){return we(t)?t.map(o=>Qo(e.items,r,o)):t}function bB(e,r,t){let o=e.unevaluatedProperties,i=e.allOf.map(l=>Qo(l,r,qe(t))).reduce((l,c)=>Ae(c)?{...l,...c}:c,{});if(!Ae(t)||!Ae(i)||!za(o))return i;let a=Er(e);for(let l of Object.getOwnPropertyNames(t))a.includes(l)||_e(o,r,t[l])&&(i[l]=Qo(o,r,t[l]));return i}function xB(e,r,t){if(!Ae(t)||we(t))return t;let o=e.additionalProperties;for(let n of Object.getOwnPropertyNames(t)){if(ve(e.properties,n)){t[n]=Qo(e.properties[n],r,t[n]);continue}if(za(o)&&_e(o,r,t[n])){t[n]=Qo(o,r,t[n]);continue}delete t[n]}return t}function vB(e,r,t){if(!Ae(t))return t;let o=e.additionalProperties,n=Object.getOwnPropertyNames(t),[i,a]=Object.entries(e.patternProperties)[0],l=new RegExp(i);for(let c of n){if(l.test(c)){t[c]=Qo(a,r,t[c]);continue}if(za(o)&&_e(o,r,t[c])){t[c]=Qo(o,r,t[c]);continue}delete t[c]}return t}function IB(e,r,t){return Qo(Qe(e,r),r,t)}function SB(e,r,t){return Qo(Qe(e,r),r,t)}function TB(e,r,t){if(!we(t))return t;if(Wt(e.items))return[];let o=Math.min(t.length,e.items.length);for(let n=0;n<o;n++)t[n]=Qo(e.items[n],r,t[n]);return t.length>o?t.slice(0,o):t}function CB(e,r,t){for(let o of e.anyOf)if(gB(o)&&_e(o,r,t))return Qo(o,r,t);return t}function Qo(e,r,t){let o=He(e.$id)?[...r,e]:r,n=e;switch(n[U]){case"Array":return yB(n,o,t);case"Intersect":return bB(n,o,t);case"Object":return xB(n,o,t);case"Record":return vB(n,o,t);case"Ref":return IB(n,o,t);case"This":return SB(n,o,t);case"Tuple":return TB(n,o,t);case"Union":return CB(n,o,t);default:return t}}function rb(...e){return e.length===3?Qo(e[0],e[1],e[2]):Qo(e[0],[],e[1])}d();function ob(e){return He(e)&&!isNaN(e)&&!isNaN(parseFloat(e))}function MB(e){return jr(e)||Ni(e)||me(e)}function Xm(e){return e===!0||me(e)&&e===1||jr(e)&&e===BigInt("1")||He(e)&&(e.toLowerCase()==="true"||e==="1")}function Ym(e){return e===!1||me(e)&&(e===0||Object.is(e,-0))||jr(e)&&e===BigInt("0")||He(e)&&(e.toLowerCase()==="false"||e==="0"||e==="-0")}function wB(e){return He(e)&&/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i.test(e)}function OB(e){return He(e)&&/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)?$/i.test(e)}function EB(e){return He(e)&&/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i.test(e)}function PB(e){return He(e)&&/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)?$/i.test(e)}function FB(e){return He(e)&&/^\d\d\d\d-[0-1]\d-[0-3]\d$/i.test(e)}function DB(e,r){let t=bO(e);return t===r?t:e}function kB(e,r){let t=xO(e);return t===r?t:e}function AB(e,r){let t=yO(e);return t===r?t:e}function LB(e,r){return He(e.const)?DB(r,e.const):me(e.const)?kB(r,e.const):Ni(e.const)?AB(r,e.const):r}function yO(e){return Xm(e)?!0:Ym(e)?!1:e}function _B(e){let r=t=>t.split(".")[0];return ob(e)?BigInt(r(e)):me(e)?BigInt(Math.trunc(e)):Ym(e)?BigInt(0):Xm(e)?BigInt(1):e}function bO(e){return MB(e)?e.toString():_s(e)&&e.description!==void 0?e.description.toString():e}function xO(e){return ob(e)?parseFloat(e):Xm(e)?1:Ym(e)?0:e}function RB(e){return ob(e)?parseInt(e):me(e)?e|0:Xm(e)?1:Ym(e)?0:e}function BB(e){return He(e)&&e.toLowerCase()==="null"?null:e}function NB(e){return He(e)&&e==="undefined"?void 0:e}function jB(e){return uo(e)?e:me(e)?new Date(e):Xm(e)?new Date(1):Ym(e)?new Date(0):ob(e)?new Date(parseInt(e)):OB(e)?new Date(`1970-01-01T${e}.000Z`):wB(e)?new Date(`1970-01-01T${e}`):PB(e)?new Date(`${e}.000Z`):EB(e)?new Date(e):FB(e)?new Date(`${e}T00:00:00.000Z`):e}function GB(e,r,t){return(we(t)?t:[t]).map(n=>zi(e.items,r,n))}function UB(e,r,t){return _B(t)}function VB(e,r,t){return yO(t)}function $B(e,r,t){return jB(t)}function HB(e,r,t){return RB(t)}function zB(e,r,t){return e.allOf.reduce((o,n)=>zi(n,r,o),t)}function WB(e,r,t){return LB(e,t)}function ZB(e,r,t){return BB(t)}function XB(e,r,t){return xO(t)}function YB(e,r,t){if(!Ae(t))return t;for(let o of Object.getOwnPropertyNames(e.properties))ve(t,o)&&(t[o]=zi(e.properties[o],r,t[o]));return t}function JB(e,r,t){if(!Ae(t))return t;let n=Object.getOwnPropertyNames(e.patternProperties)[0],i=e.patternProperties[n];for(let[a,l]of Object.entries(t))t[a]=zi(i,r,l);return t}function KB(e,r,t){return zi(Qe(e,r),r,t)}function QB(e,r,t){return bO(t)}function qB(e,r,t){return He(t)||me(t)?Symbol(t):t}function eN(e,r,t){return zi(Qe(e,r),r,t)}function tN(e,r,t){return we(t)&&!Wt(e.items)?t.map((n,i)=>i<e.items.length?zi(e.items[i],r,n):n):t}function rN(e,r,t){return NB(t)}function oN(e,r,t){for(let o of e.anyOf){let n=zi(o,r,qe(t));if(_e(o,r,n))return n}return t}function zi(e,r,t){let o=xn(e,r),n=e;switch(e[U]){case"Array":return GB(n,o,t);case"BigInt":return UB(n,o,t);case"Boolean":return VB(n,o,t);case"Date":return $B(n,o,t);case"Integer":return HB(n,o,t);case"Intersect":return zB(n,o,t);case"Literal":return WB(n,o,t);case"Null":return ZB(n,o,t);case"Number":return XB(n,o,t);case"Object":return YB(n,o,t);case"Record":return JB(n,o,t);case"Ref":return KB(n,o,t);case"String":return QB(n,o,t);case"Symbol":return qB(n,o,t);case"This":return eN(n,o,t);case"Tuple":return tN(n,o,t);case"Undefined":return rN(n,o,t);case"Union":return oN(n,o,t);default:return t}}function nb(...e){return e.length===3?zi(e[0],e[1],e[2]):zi(e[0],[],e[1])}d();d();var qp=class extends be{constructor(r,t,o){super("Unable to decode value as it does not match the expected schema"),this.schema=r,this.value=t,this.error=o}},Jl=class extends be{constructor(r,t,o,n){super(n instanceof Error?n.message:"Unknown error"),this.schema=r,this.path=t,this.value=o,this.error=n}};function Zt(e,r,t){try{return Ft(e)?e[_t].Decode(t):t}catch(o){throw new Jl(e,r,t,o)}}function nN(e,r,t,o){return we(o)?Zt(e,t,o.map((n,i)=>Wi(e.items,r,`${t}/${i}`,n))):Zt(e,t,o)}function iN(e,r,t,o){if(!Ae(o)||Gr(o))return Zt(e,t,o);let n=Xa(e),i=n.map(u=>u[0]),a={...o};for(let[u,f]of n)u in a&&(a[u]=Wi(f,r,`${t}/${u}`,a[u]));if(!Ft(e.unevaluatedProperties))return Zt(e,t,a);let l=Object.getOwnPropertyNames(a),c=e.unevaluatedProperties,p={...a};for(let u of l)i.includes(u)||(p[u]=Zt(c,`${t}/${u}`,p[u]));return Zt(e,t,p)}function sN(e,r,t,o){return Zt(e,t,Wi(e.not,r,t,o))}function aN(e,r,t,o){if(!Ae(o))return Zt(e,t,o);let n=Er(e),i={...o};for(let p of n)ve(i,p)&&(Wt(i[p])&&(!kp(e.properties[p])||pt.IsExactOptionalProperty(i,p))||(i[p]=Wi(e.properties[p],r,`${t}/${p}`,i[p])));if(!ze(e.additionalProperties))return Zt(e,t,i);let a=Object.getOwnPropertyNames(i),l=e.additionalProperties,c={...i};for(let p of a)n.includes(p)||(c[p]=Zt(l,`${t}/${p}`,c[p]));return Zt(e,t,c)}function lN(e,r,t,o){if(!Ae(o))return Zt(e,t,o);let n=Object.getOwnPropertyNames(e.patternProperties)[0],i=new RegExp(n),a={...o};for(let u of Object.getOwnPropertyNames(o))i.test(u)&&(a[u]=Wi(e.patternProperties[n],r,`${t}/${u}`,a[u]));if(!ze(e.additionalProperties))return Zt(e,t,a);let l=Object.getOwnPropertyNames(a),c=e.additionalProperties,p={...a};for(let u of l)i.test(u)||(p[u]=Zt(c,`${t}/${u}`,p[u]));return Zt(e,t,p)}function cN(e,r,t,o){let n=Qe(e,r);return Zt(e,t,Wi(n,r,t,o))}function pN(e,r,t,o){let n=Qe(e,r);return Zt(e,t,Wi(n,r,t,o))}function dN(e,r,t,o){return we(o)&&we(e.items)?Zt(e,t,e.items.map((n,i)=>Wi(n,r,`${t}/${i}`,o[i]))):Zt(e,t,o)}function uN(e,r,t,o){for(let n of e.anyOf){if(!_e(n,r,o))continue;let i=Wi(n,r,t,o);return Zt(e,t,i)}return Zt(e,t,o)}function Wi(e,r,t,o){let n=xn(e,r),i=e;switch(e[U]){case"Array":return nN(i,n,t,o);case"Intersect":return iN(i,n,t,o);case"Not":return sN(i,n,t,o);case"Object":return aN(i,n,t,o);case"Record":return lN(i,n,t,o);case"Ref":return cN(i,n,t,o);case"Symbol":return Zt(i,t,o);case"This":return pN(i,n,t,o);case"Tuple":return dN(i,n,t,o);case"Union":return uN(i,n,t,o);default:return Zt(i,t,o)}}function ed(e,r,t){return Wi(e,r,"",t)}d();var td=class extends be{constructor(r,t,o){super("The encoded value does not match the expected schema"),this.schema=r,this.value=t,this.error=o}},Kl=class extends be{constructor(r,t,o,n){super(`${n instanceof Error?n.message:"Unknown error"}`),this.schema=r,this.path=t,this.value=o,this.error=n}};function no(e,r,t){try{return Ft(e)?e[_t].Encode(t):t}catch(o){throw new Kl(e,r,t,o)}}function mN(e,r,t,o){let n=no(e,t,o);return we(n)?n.map((i,a)=>Zi(e.items,r,`${t}/${a}`,i)):n}function fN(e,r,t,o){let n=no(e,t,o);if(!Ae(o)||Gr(o))return n;let i=Xa(e),a=i.map(f=>f[0]),l={...n};for(let[f,h]of i)f in l&&(l[f]=Zi(h,r,`${t}/${f}`,l[f]));if(!Ft(e.unevaluatedProperties))return l;let c=Object.getOwnPropertyNames(l),p=e.unevaluatedProperties,u={...l};for(let f of c)a.includes(f)||(u[f]=no(p,`${t}/${f}`,u[f]));return u}function hN(e,r,t,o){return no(e.not,t,no(e,t,o))}function gN(e,r,t,o){let n=no(e,t,o);if(!Ae(n))return n;let i=Er(e),a={...n};for(let u of i)ve(a,u)&&(Wt(a[u])&&(!kp(e.properties[u])||pt.IsExactOptionalProperty(a,u))||(a[u]=Zi(e.properties[u],r,`${t}/${u}`,a[u])));if(!ze(e.additionalProperties))return a;let l=Object.getOwnPropertyNames(a),c=e.additionalProperties,p={...a};for(let u of l)i.includes(u)||(p[u]=no(c,`${t}/${u}`,p[u]));return p}function yN(e,r,t,o){let n=no(e,t,o);if(!Ae(o))return n;let i=Object.getOwnPropertyNames(e.patternProperties)[0],a=new RegExp(i),l={...n};for(let f of Object.getOwnPropertyNames(o))a.test(f)&&(l[f]=Zi(e.patternProperties[i],r,`${t}/${f}`,l[f]));if(!ze(e.additionalProperties))return l;let c=Object.getOwnPropertyNames(l),p=e.additionalProperties,u={...l};for(let f of c)a.test(f)||(u[f]=no(p,`${t}/${f}`,u[f]));return u}function bN(e,r,t,o){let n=Qe(e,r),i=Zi(n,r,t,o);return no(e,t,i)}function xN(e,r,t,o){let n=Qe(e,r),i=Zi(n,r,t,o);return no(e,t,i)}function vN(e,r,t,o){let n=no(e,t,o);return we(e.items)?e.items.map((i,a)=>Zi(i,r,`${t}/${a}`,n[a])):[]}function IN(e,r,t,o){for(let n of e.anyOf){if(!_e(n,r,o))continue;let i=Zi(n,r,t,o);return no(e,t,i)}for(let n of e.anyOf){let i=Zi(n,r,t,o);if(_e(e,r,i))return no(e,t,i)}return no(e,t,o)}function Zi(e,r,t,o){let n=xn(e,r),i=e;switch(e[U]){case"Array":return mN(i,n,t,o);case"Intersect":return fN(i,n,t,o);case"Not":return hN(i,n,t,o);case"Object":return gN(i,n,t,o);case"Record":return yN(i,n,t,o);case"Ref":return bN(i,n,t,o);case"This":return xN(i,n,t,o);case"Tuple":return vN(i,n,t,o);case"Union":return IN(i,n,t,o);default:return no(i,t,o)}}function ib(e,r,t){return Zi(e,r,"",t)}d();function SN(e,r){return Ft(e)||Pr(e.items,r)}function TN(e,r){return Ft(e)||Pr(e.items,r)}function CN(e,r){return Ft(e)||Pr(e.returns,r)||e.parameters.some(t=>Pr(t,r))}function MN(e,r){return Ft(e)||Pr(e.returns,r)||e.parameters.some(t=>Pr(t,r))}function wN(e,r){return Ft(e)||Ft(e.unevaluatedProperties)||e.allOf.some(t=>Pr(t,r))}function ON(e,r){return Ft(e)||Pr(e.items,r)}function EN(e,r){return Ft(e)||Pr(e.not,r)}function PN(e,r){return Ft(e)||Object.values(e.properties).some(t=>Pr(t,r))||ze(e.additionalProperties)&&Pr(e.additionalProperties,r)}function FN(e,r){return Ft(e)||Pr(e.item,r)}function DN(e,r){let t=Object.getOwnPropertyNames(e.patternProperties)[0],o=e.patternProperties[t];return Ft(e)||Pr(o,r)||ze(e.additionalProperties)&&Ft(e.additionalProperties)}function kN(e,r){return Ft(e)?!0:Pr(Qe(e,r),r)}function AN(e,r){return Ft(e)?!0:Pr(Qe(e,r),r)}function LN(e,r){return Ft(e)||!Wt(e.items)&&e.items.some(t=>Pr(t,r))}function _N(e,r){return Ft(e)||e.anyOf.some(t=>Pr(t,r))}function Pr(e,r){let t=xn(e,r),o=e;if(e.$id&&Xv.has(e.$id))return!1;switch(e.$id&&Xv.add(e.$id),e[U]){case"Array":return SN(o,t);case"AsyncIterator":return TN(o,t);case"Constructor":return CN(o,t);case"Function":return MN(o,t);case"Intersect":return wN(o,t);case"Iterator":return ON(o,t);case"Not":return EN(o,t);case"Object":return PN(o,t);case"Promise":return FN(o,t);case"Record":return DN(o,t);case"Ref":return kN(o,t);case"This":return AN(o,t);case"Tuple":return LN(o,t);case"Union":return _N(o,t);default:return Ft(e)}}var Xv=new Set;function Xi(e,r){return Xv.clear(),Pr(e,r)}function vO(...e){let[r,t,o]=e.length===3?[e[0],e[1],e[2]]:[e[0],[],e[1]];if(!_e(r,t,o))throw new qp(r,o,$i(r,t,o).First());return Xi(r,t)?ed(r,t,o):o}d();function Ws(e,r){let t=ve(e,"default")?e.default:void 0,o=$a(t)?t():qe(t);return Wt(r)?o:Ae(r)&&Ae(o)?Object.assign(o,r):r}function Yv(e){return za(e)&&"default"in e}function RN(e,r,t){let o=Ws(e,t);if(!we(o))return o;for(let n=0;n<o.length;n++)o[n]=qo(e.items,r,o[n]);return o}function BN(e,r,t){return uo(t)?t:Ws(e,t)}function NN(e,r,t){let o=Ws(e,t);return e.allOf.reduce((n,i)=>{let a=qo(i,r,o);return Ae(a)?{...n,...a}:a},{})}function jN(e,r,t){let o=Ws(e,t);if(!Ae(o))return o;let n=Object.getOwnPropertyNames(e.properties);for(let i of n){let a=qo(e.properties[i],r,o[i]);Wt(a)||(o[i]=qo(e.properties[i],r,o[i]))}if(!Yv(e.additionalProperties))return o;for(let i of Object.getOwnPropertyNames(o))n.includes(i)||(o[i]=qo(e.additionalProperties,r,o[i]));return o}function GN(e,r,t){let o=Ws(e,t);if(!Ae(o))return o;let n=e.additionalProperties,[i,a]=Object.entries(e.patternProperties)[0],l=new RegExp(i);for(let c of Object.getOwnPropertyNames(o))l.test(c)&&Yv(a)&&(o[c]=qo(a,r,o[c]));if(!Yv(n))return o;for(let c of Object.getOwnPropertyNames(o))l.test(c)||(o[c]=qo(n,r,o[c]));return o}function UN(e,r,t){return qo(Qe(e,r),r,Ws(e,t))}function VN(e,r,t){return qo(Qe(e,r),r,t)}function $N(e,r,t){let o=Ws(e,t);if(!we(o)||Wt(e.items))return o;let[n,i]=[e.items,Math.max(e.items.length,o.length)];for(let a=0;a<i;a++)a<n.length&&(o[a]=qo(n[a],r,o[a]));return o}function HN(e,r,t){let o=Ws(e,t);for(let n of e.anyOf){let i=qo(n,r,qe(o));if(_e(n,r,i))return i}return o}function qo(e,r,t){let o=xn(e,r),n=e;switch(n[U]){case"Array":return RN(n,o,t);case"Date":return BN(n,o,t);case"Intersect":return NN(n,o,t);case"Object":return jN(n,o,t);case"Record":return GN(n,o,t);case"Ref":return UN(n,o,t);case"This":return VN(n,o,t);case"Tuple":return $N(n,o,t);case"Union":return HN(n,o,t);default:return Ws(n,t)}}function sb(...e){return e.length===3?qo(e[0],e[1],e[2]):qo(e[0],[],e[1])}d();d();var Qn={};La(Qn,{Delete:()=>WN,Format:()=>Jm,Get:()=>XN,Has:()=>ZN,Set:()=>zN,ValuePointerRootDeleteError:()=>lb,ValuePointerRootSetError:()=>ab});d();var ab=class extends be{constructor(r,t,o){super("Cannot set root value"),this.value=r,this.path=t,this.update=o}},lb=class extends be{constructor(r,t){super("Cannot delete root value"),this.value=r,this.path=t}};function IO(e){return e.indexOf("~")===-1?e:e.replace(/~1/g,"/").replace(/~0/g,"~")}function*Jm(e){if(e==="")return;let[r,t]=[0,0];for(let o=0;o<e.length;o++)e.charAt(o)==="/"?(o===0||(t=o,yield IO(e.slice(r,t))),r=o+1):t=o;yield IO(e.slice(r))}function zN(e,r,t){if(r==="")throw new ab(e,r,t);let[o,n,i]=[null,e,""];for(let a of Jm(r))n[a]===void 0&&(n[a]={}),o=n,n=n[a],i=a;o[i]=t}function WN(e,r){if(r==="")throw new lb(e,r);let[t,o,n]=[null,e,""];for(let i of Jm(r)){if(o[i]===void 0||o[i]===null)return;t=o,o=o[i],n=i}if(Array.isArray(t)){let i=parseInt(n);t.splice(i,1)}else delete t[n]}function ZN(e,r){if(r==="")return!0;let[t,o,n]=[null,e,""];for(let i of Jm(r)){if(o[i]===void 0)return!1;t=o,o=o[i],n=i}return Object.getOwnPropertyNames(t).includes(n)}function XN(e,r){if(r==="")return e;let t=e;for(let o of Jm(r)){if(t[o]===void 0)return;t=t[o]}return t}d();function YN(e,r){if(!Ae(r))return!1;let t=[...Object.keys(e),...Object.getOwnPropertySymbols(e)],o=[...Object.keys(r),...Object.getOwnPropertySymbols(r)];return t.length!==o.length?!1:t.every(n=>Ql(e[n],r[n]))}function JN(e,r){return uo(r)&&e.getTime()===r.getTime()}function KN(e,r){return!we(r)||e.length!==r.length?!1:e.every((t,o)=>Ql(t,r[o]))}function QN(e,r){return!un(r)||e.length!==r.length||Object.getPrototypeOf(e).constructor.name!==Object.getPrototypeOf(r).constructor.name?!1:e.every((t,o)=>Ql(t,r[o]))}function qN(e,r){return e===r}function Ql(e,r){if(uo(e))return JN(e,r);if(un(e))return QN(e,r);if(we(e))return KN(e,r);if(Ae(e))return YN(e,r);if(Gr(e))return qN(e,r);throw new Error("ValueEquals: Unable to compare value")}var ej=It({type:at("insert"),path:fn(),value:$s()}),tj=It({type:at("update"),path:fn(),value:$s()}),rj=It({type:at("delete"),path:fn()}),TO=ht([ej,tj,rj]),cb=class extends be{constructor(r,t){super(t),this.value=r}};function pb(e,r){return{type:"update",path:e,value:r}}function CO(e,r){return{type:"insert",path:e,value:r}}function MO(e){return{type:"delete",path:e}}function SO(e){if(globalThis.Object.getOwnPropertySymbols(e).length>0)throw new cb(e,"Cannot diff objects with symbols")}function*oj(e,r,t){if(SO(r),SO(t),!Q0(t))return yield pb(e,t);let o=globalThis.Object.getOwnPropertyNames(r),n=globalThis.Object.getOwnPropertyNames(t);for(let i of n)ve(r,i)||(yield CO(`${e}/${i}`,t[i]));for(let i of o)ve(t,i)&&(Ql(r,t)||(yield*db(`${e}/${i}`,r[i],t[i])));for(let i of o)ve(t,i)||(yield MO(`${e}/${i}`))}function*nj(e,r,t){if(!we(t))return yield pb(e,t);for(let o=0;o<Math.min(r.length,t.length);o++)yield*db(`${e}/${o}`,r[o],t[o]);for(let o=0;o<t.length;o++)o<r.length||(yield CO(`${e}/${o}`,t[o]));for(let o=r.length-1;o>=0;o--)o<t.length||(yield MO(`${e}/${o}`))}function*ij(e,r,t){if(!un(t)||r.length!==t.length||globalThis.Object.getPrototypeOf(r).constructor.name!==globalThis.Object.getPrototypeOf(t).constructor.name)return yield pb(e,t);for(let o=0;o<Math.min(r.length,t.length);o++)yield*db(`${e}/${o}`,r[o],t[o])}function*sj(e,r,t){r!==t&&(yield pb(e,t))}function*db(e,r,t){if(Q0(r))return yield*oj(e,r,t);if(we(r))return yield*nj(e,r,t);if(un(r))return yield*ij(e,r,t);if(Gr(r))return yield*sj(e,r,t);throw new cb(r,"Unable to diff value")}function wO(e,r){return[...db("",e,r)]}function aj(e){return e.length>0&&e[0].path===""&&e[0].type==="update"}function lj(e){return e.length===0}function OO(e,r){if(aj(r))return qe(r[0].value);if(lj(r))return qe(e);let t=qe(e);for(let o of r)switch(o.type){case"insert":{Qn.Set(t,o.path,o.value);break}case"update":{Qn.Set(t,o.path,o.value);break}case"delete":{Qn.Delete(t,o.path);break}}return t}d();function EO(...e){let[r,t,o]=e.length===3?[e[0],e[1],e[2]]:[e[0],[],e[1]],n=Xi(r,t)?ib(r,t,o):o;if(!_e(r,t,n))throw new td(r,n,$i(r,t,n).First());return n}d();var ub=class extends be{constructor(r){super(r)}};function cj(e,r,t,o){if(!Ae(t))Qn.Set(e,r,qe(o));else{let n=Object.getOwnPropertyNames(t),i=Object.getOwnPropertyNames(o);for(let a of n)i.includes(a)||delete t[a];for(let a of i)n.includes(a)||(t[a]=null);for(let a of i)Jv(e,`${r}/${a}`,t[a],o[a])}}function pj(e,r,t,o){if(!we(t))Qn.Set(e,r,qe(o));else{for(let n=0;n<o.length;n++)Jv(e,`${r}/${n}`,t[n],o[n]);t.splice(o.length)}}function dj(e,r,t,o){if(un(t)&&t.length===o.length)for(let n=0;n<t.length;n++)t[n]=o[n];else Qn.Set(e,r,qe(o))}function uj(e,r,t,o){t!==o&&Qn.Set(e,r,o)}function Jv(e,r,t,o){if(we(o))return pj(e,r,t,o);if(un(o))return dj(e,r,t,o);if(Ae(o))return cj(e,r,t,o);if(Gr(o))return uj(e,r,t,o)}function PO(e){return un(e)||Gr(e)}function mj(e,r){return Ae(e)&&we(r)||we(e)&&Ae(r)}function FO(e,r){if(PO(e)||PO(r))throw new ub("Only object and array types can be mutated at the root level");if(mj(e,r))throw new ub("Cannot assign due type mismatch of assignable values");Jv(e,"",e,r)}d();var fj=[(e,r,t)=>qe(t),(e,r,t)=>sb(e,r,t),(e,r,t)=>rb(e,r,t),(e,r,t)=>nb(e,r,t),(e,r,t)=>(eb(e,r,t),t),(e,r,t)=>Xi(e,r)?ed(e,r,t):t];function DO(e,r,t){return fj.reduce((o,n)=>n(e,r,o),t)}function kO(...e){return e.length===3?DO(e[0],e[1],e[2]):DO(e[0],[],e[1])}d();var qn={};La(qn,{Assert:()=>eb,Cast:()=>Zv,Check:()=>_e,Clean:()=>rb,Clone:()=>qe,Convert:()=>nb,Create:()=>In,Decode:()=>vO,Default:()=>sb,Diff:()=>wO,Edit:()=>TO,Encode:()=>EO,Equal:()=>Ql,Errors:()=>$i,Hash:()=>Ka,Mutate:()=>FO,Parse:()=>kO,Patch:()=>OO,ValueErrorIterator:()=>vn});d();d();var AO={},hj=function(e,r,t,o,n){var i=new Worker(AO[r]||(AO[r]=URL.createObjectURL(new Blob([e+';addEventListener("error",function(e){e=e.error;postMessage({$e$:[e.message,e.code,e.stack]})})'],{type:"text/javascript"}))));return i.onmessage=function(a){var l=a.data,c=l.$e$;if(c){var p=new Error(c[0]);p.code=c[1],p.stack=c[2],n(p,null)}else n(null,l)},i.postMessage(t,o),i},St=Uint8Array,ho=Uint16Array,ef=Int32Array,sd=new St([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]),ad=new St([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]),Km=new St([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),RO=function(e,r){for(var t=new ho(31),o=0;o<31;++o)t[o]=r+=1<<e[o-1];for(var n=new ef(t[30]),o=1;o<30;++o)for(var i=t[o];i<t[o+1];++i)n[i]=i-t[o]<<5|o;return{b:t,r:n}},BO=RO(sd,2),rI=BO.b,yb=BO.r;rI[28]=258,yb[258]=28;var NO=RO(ad,0),jO=NO.b,Qv=NO.r,Qm=new ho(32768);for(lt=0;lt<32768;++lt)Zs=(lt&43690)>>1|(lt&21845)<<1,Zs=(Zs&52428)>>2|(Zs&13107)<<2,Zs=(Zs&61680)>>4|(Zs&3855)<<4,Qm[lt]=((Zs&65280)>>8|(Zs&255)<<8)>>1;var Zs,lt,Tn=function(e,r,t){for(var o=e.length,n=0,i=new ho(r);n<o;++n)e[n]&&++i[e[n]-1];var a=new ho(r);for(n=1;n<r;++n)a[n]=a[n-1]+i[n-1]<<1;var l;if(t){l=new ho(1<<r);var c=15-r;for(n=0;n<o;++n)if(e[n])for(var p=n<<4|e[n],u=r-e[n],f=a[e[n]-1]++<<u,h=f|(1<<u)-1;f<=h;++f)l[Qm[f]>>c]=p}else for(l=new ho(o),n=0;n<o;++n)e[n]&&(l[n]=Qm[a[e[n]-1]++]>>15-e[n]);return l},Xs=new St(288);for(lt=0;lt<144;++lt)Xs[lt]=8;var lt;for(lt=144;lt<256;++lt)Xs[lt]=9;var lt;for(lt=256;lt<280;++lt)Xs[lt]=7;var lt;for(lt=280;lt<288;++lt)Xs[lt]=8;var lt,nd=new St(32);for(lt=0;lt<32;++lt)nd[lt]=5;var lt,GO=Tn(Xs,9,0),UO=Tn(Xs,9,1),VO=Tn(nd,5,0),$O=Tn(nd,5,1),fb=function(e){for(var r=e[0],t=1;t<e.length;++t)e[t]>r&&(r=e[t]);return r},Sn=function(e,r,t){var o=r/8|0;return(e[o]|e[o+1]<<8)>>(r&7)&t},hb=function(e,r){var t=r/8|0;return(e[t]|e[t+1]<<8|e[t+2]<<16)>>(r&7)},tf=function(e){return(e+7)/8|0},Qa=function(e,r,t){return(r==null||r<0)&&(r=0),(t==null||t>e.length)&&(t=e.length),new St(e.subarray(r,t))},Ib={UnexpectedEOF:0,InvalidBlockType:1,InvalidLengthLiteral:2,InvalidDistance:3,StreamFinished:4,NoStreamHandler:5,InvalidHeader:6,NoCallback:7,InvalidUTF8:8,ExtraFieldTooLong:9,InvalidDate:10,FilenameTooLong:11,StreamFinishing:12,InvalidZipData:13,UnknownCompressionMethod:14},HO=["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"],Xt=function(e,r,t){var o=new Error(r||HO[e]);if(o.code=e,Error.captureStackTrace&&Error.captureStackTrace(o,Xt),!t)throw o;return o},zO=function(e,r,t,o){var n=e.length,i=o?o.length:0;if(!n||r.f&&!r.l)return t||new St(0);var a=!t,l=a||r.i!=2,c=r.i;a&&(t=new St(n*3));var p=function(P){var q=t.length;if(P>q){var K=new St(Math.max(q*2,P));K.set(t),t=K}},u=r.f||0,f=r.p||0,h=r.b||0,b=r.l,x=r.d,T=r.m,v=r.n,I=n*8;do{if(!b){u=Sn(e,f,1);var M=Sn(e,f+1,3);if(f+=3,M)if(M==1)b=UO,x=$O,T=9,v=5;else if(M==2){var _=Sn(e,f,31)+257,G=Sn(e,f+10,15)+4,R=_+Sn(e,f+5,31)+1;f+=14;for(var N=new St(R),X=new St(19),z=0;z<G;++z)X[Km[z]]=Sn(e,f+z*3,7);f+=G*3;for(var ee=fb(X),re=(1<<ee)-1,ue=Tn(X,ee,1),z=0;z<R;){var Ce=ue[Sn(e,f,re)];f+=Ce&15;var O=Ce>>4;if(O<16)N[z++]=O;else{var Oe=0,Pe=0;for(O==16?(Pe=3+Sn(e,f,3),f+=2,Oe=N[z-1]):O==17?(Pe=3+Sn(e,f,7),f+=3):O==18&&(Pe=11+Sn(e,f,127),f+=7);Pe--;)N[z++]=Oe}}var Fe=N.subarray(0,_),ce=N.subarray(_);T=fb(Fe),v=fb(ce),b=Tn(Fe,T,1),x=Tn(ce,v,1)}else Xt(1);else{var O=tf(f)+4,C=e[O-4]|e[O-3]<<8,E=O+C;if(E>n){c&&Xt(0);break}l&&p(h+C),t.set(e.subarray(O,E),h),r.b=h+=C,r.p=f=E*8,r.f=u;continue}if(f>I){c&&Xt(0);break}}l&&p(h+131072);for(var Ee=(1<<T)-1,ye=(1<<v)-1,Ge=f;;Ge=f){var Oe=b[hb(e,f)&Ee],Ie=Oe>>4;if(f+=Oe&15,f>I){c&&Xt(0);break}if(Oe||Xt(2),Ie<256)t[h++]=Ie;else if(Ie==256){Ge=f,b=null;break}else{var Xe=Ie-254;if(Ie>264){var z=Ie-257,se=sd[z];Xe=Sn(e,f,(1<<se)-1)+rI[z],f+=se}var nt=x[hb(e,f)&ye],dt=nt>>4;nt||Xt(3),f+=nt&15;var ce=jO[dt];if(dt>3){var se=ad[dt];ce+=hb(e,f)&(1<<se)-1,f+=se}if(f>I){c&&Xt(0);break}l&&p(h+131072);var $t=h+Xe;if(h<ce){var k=i-ce,H=Math.min(ce,$t);for(k+h<0&&Xt(3);h<H;++h)t[h]=o[k+h]}for(;h<$t;++h)t[h]=t[h-ce]}}r.l=b,r.p=Ge,r.b=h,r.f=u,b&&(u=1,r.m=T,r.d=x,r.n=v)}while(!u);return h!=t.length&&a?Qa(t,0,h):t.subarray(0,h)},Yi=function(e,r,t){t<<=r&7;var o=r/8|0;e[o]|=t,e[o+1]|=t>>8},rd=function(e,r,t){t<<=r&7;var o=r/8|0;e[o]|=t,e[o+1]|=t>>8,e[o+2]|=t>>16},gb=function(e,r){for(var t=[],o=0;o<e.length;++o)e[o]&&t.push({s:o,f:e[o]});var n=t.length,i=t.slice();if(!n)return{t:nI,l:0};if(n==1){var a=new St(t[0].s+1);return a[t[0].s]=1,{t:a,l:1}}t.sort(function(E,_){return E.f-_.f}),t.push({s:-1,f:25001});var l=t[0],c=t[1],p=0,u=1,f=2;for(t[0]={s:-1,f:l.f+c.f,l,r:c};u!=n-1;)l=t[t[p].f<t[f].f?p++:f++],c=t[p!=u&&t[p].f<t[f].f?p++:f++],t[u++]={s:-1,f:l.f+c.f,l,r:c};for(var h=i[0].s,o=1;o<n;++o)i[o].s>h&&(h=i[o].s);var b=new ho(h+1),x=bb(t[u-1],b,0);if(x>r){var o=0,T=0,v=x-r,I=1<<v;for(i.sort(function(_,G){return b[G.s]-b[_.s]||_.f-G.f});o<n;++o){var M=i[o].s;if(b[M]>r)T+=I-(1<<x-b[M]),b[M]=r;else break}for(T>>=v;T>0;){var O=i[o].s;b[O]<r?T-=1<<r-b[O]++-1:++o}for(;o>=0&&T;--o){var C=i[o].s;b[C]==r&&(--b[C],++T)}x=r}return{t:new St(b),l:x}},bb=function(e,r,t){return e.s==-1?Math.max(bb(e.l,r,t+1),bb(e.r,r,t+1)):r[e.s]=t},qv=function(e){for(var r=e.length;r&&!e[--r];);for(var t=new ho(++r),o=0,n=e[0],i=1,a=function(c){t[o++]=c},l=1;l<=r;++l)if(e[l]==n&&l!=r)++i;else{if(!n&&i>2){for(;i>138;i-=138)a(32754);i>2&&(a(i>10?i-11<<5|28690:i-3<<5|12305),i=0)}else if(i>3){for(a(n),--i;i>6;i-=6)a(8304);i>2&&(a(i-3<<5|8208),i=0)}for(;i--;)a(n);i=1,n=e[l]}return{c:t.subarray(0,o),n:r}},od=function(e,r){for(var t=0,o=0;o<r.length;++o)t+=e[o]*r[o];return t},oI=function(e,r,t){var o=t.length,n=tf(r+2);e[n]=o&255,e[n+1]=o>>8,e[n+2]=e[n]^255,e[n+3]=e[n+1]^255;for(var i=0;i<o;++i)e[n+i+4]=t[i];return(n+4+o)*8},eI=function(e,r,t,o,n,i,a,l,c,p,u){Yi(r,u++,t),++n[256];for(var f=gb(n,15),h=f.t,b=f.l,x=gb(i,15),T=x.t,v=x.l,I=qv(h),M=I.c,O=I.n,C=qv(T),E=C.c,_=C.n,G=new ho(19),R=0;R<M.length;++R)++G[M[R]&31];for(var R=0;R<E.length;++R)++G[E[R]&31];for(var N=gb(G,7),X=N.t,z=N.l,ee=19;ee>4&&!X[Km[ee-1]];--ee);var re=p+5<<3,ue=od(n,Xs)+od(i,nd)+a,Ce=od(n,h)+od(i,T)+a+14+3*ee+od(G,X)+2*G[16]+3*G[17]+7*G[18];if(c>=0&&re<=ue&&re<=Ce)return oI(r,u,e.subarray(c,c+p));var Oe,Pe,Fe,ce;if(Yi(r,u,1+(Ce<ue)),u+=2,Ce<ue){Oe=Tn(h,b,0),Pe=h,Fe=Tn(T,v,0),ce=T;var Ee=Tn(X,z,0);Yi(r,u,O-257),Yi(r,u+5,_-1),Yi(r,u+10,ee-4),u+=14;for(var R=0;R<ee;++R)Yi(r,u+3*R,X[Km[R]]);u+=3*ee;for(var ye=[M,E],Ge=0;Ge<2;++Ge)for(var Ie=ye[Ge],R=0;R<Ie.length;++R){var Xe=Ie[R]&31;Yi(r,u,Ee[Xe]),u+=X[Xe],Xe>15&&(Yi(r,u,Ie[R]>>5&127),u+=Ie[R]>>12)}}else Oe=GO,Pe=Xs,Fe=VO,ce=nd;for(var R=0;R<l;++R){var se=o[R];if(se>255){var Xe=se>>18&31;rd(r,u,Oe[Xe+257]),u+=Pe[Xe+257],Xe>7&&(Yi(r,u,se>>23&31),u+=sd[Xe]);var nt=se&31;rd(r,u,Fe[nt]),u+=ce[nt],nt>3&&(rd(r,u,se>>5&8191),u+=ad[nt])}else rd(r,u,Oe[se]),u+=Pe[se]}return rd(r,u,Oe[256]),u+Pe[256]},WO=new ef([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),nI=new St(0),ZO=function(e,r,t,o,n,i){var a=i.z||e.length,l=new St(o+a+5*(1+Math.ceil(a/7e3))+n),c=l.subarray(o,l.length-n),p=i.l,u=(i.r||0)&7;if(r){u&&(c[0]=i.r>>3);for(var f=WO[r-1],h=f>>13,b=f&8191,x=(1<<t)-1,T=i.p||new ho(32768),v=i.h||new ho(x+1),I=Math.ceil(t/3),M=2*I,O=function(Q){return(e[Q]^e[Q+1]<<I^e[Q+2]<<M)&x},C=new ef(25e3),E=new ho(288),_=new ho(32),G=0,R=0,N=i.i||0,X=0,z=i.w||0,ee=0;N+2<a;++N){var re=O(N),ue=N&32767,Ce=v[re];if(T[ue]=Ce,v[re]=ue,z<=N){var Oe=a-N;if((G>7e3||X>24576)&&(Oe>423||!p)){u=eI(e,c,0,C,E,_,R,X,ee,N-ee,u),X=G=R=0,ee=N;for(var Pe=0;Pe<286;++Pe)E[Pe]=0;for(var Pe=0;Pe<30;++Pe)_[Pe]=0}var Fe=2,ce=0,Ee=b,ye=ue-Ce&32767;if(Oe>2&&re==O(N-ye))for(var Ge=Math.min(h,Oe)-1,Ie=Math.min(32767,N),Xe=Math.min(258,Oe);ye<=Ie&&--Ee&&ue!=Ce;){if(e[N+Fe]==e[N+Fe-ye]){for(var se=0;se<Xe&&e[N+se]==e[N+se-ye];++se);if(se>Fe){if(Fe=se,ce=ye,se>Ge)break;for(var nt=Math.min(ye,se-2),dt=0,Pe=0;Pe<nt;++Pe){var $t=N-ye+Pe&32767,k=T[$t],H=$t-k&32767;H>dt&&(dt=H,Ce=$t)}}}ue=Ce,Ce=T[ue],ye+=ue-Ce&32767}if(ce){C[X++]=268435456|yb[Fe]<<18|Qv[ce];var P=yb[Fe]&31,q=Qv[ce]&31;R+=sd[P]+ad[q],++E[257+P],++_[q],z=N+Fe,++G}else C[X++]=e[N],++E[e[N]]}}for(N=Math.max(N,z);N<a;++N)C[X++]=e[N],++E[e[N]];u=eI(e,c,p,C,E,_,R,X,ee,N-ee,u),p||(i.r=u&7|c[u/8|0]<<3,u-=7,i.h=v,i.p=T,i.i=N,i.w=z)}else{for(var N=i.w||0;N<a+p;N+=65535){var K=N+65535;K>=a&&(c[u/8|0]=p,K=a),u=oI(c,u+1,e.subarray(N,K))}i.i=a}return Qa(l,0,o+tf(u)+n)},gj=function(){for(var e=new Int32Array(256),r=0;r<256;++r){for(var t=r,o=9;--o;)t=(t&1&&-306674912)^t>>>1;e[r]=t}return e}(),XO=function(){var e=-1;return{p:function(r){for(var t=e,o=0;o<r.length;++o)t=gj[t&255^r[o]]^t>>>8;e=t},d:function(){return~e}}};var YO=function(e,r,t,o,n){if(!n&&(n={l:1},r.dictionary)){var i=r.dictionary.subarray(-32768),a=new St(i.length+e.length);a.set(i),a.set(e,i.length),e=a,n.w=i.length}return ZO(e,r.level==null?6:r.level,r.mem==null?n.l?Math.ceil(Math.max(8,Math.min(13,Math.log(e.length)))*1.5):20:12+r.mem,t,o,n)},Sb=function(e,r){var t={};for(var o in e)t[o]=e[o];for(var o in r)t[o]=r[o];return t},LO=function(e,r,t){for(var o=e(),n=e.toString(),i=n.slice(n.indexOf("[")+1,n.lastIndexOf("]")).replace(/\s+/g,"").split(","),a=0;a<o.length;++a){var l=o[a],c=i[a];if(typeof l=="function"){r+=";"+c+"=";var p=l.toString();if(l.prototype)if(p.indexOf("[native code]")!=-1){var u=p.indexOf(" ",8)+1;r+=p.slice(u,p.indexOf("(",u))}else{r+=p;for(var f in l.prototype)r+=";"+c+".prototype."+f+"="+l.prototype[f].toString()}else r+=p}else t[c]=l}return r},mb=[],yj=function(e){var r=[];for(var t in e)e[t].buffer&&r.push((e[t]=new e[t].constructor(e[t])).buffer);return r},bj=function(e,r,t,o){if(!mb[t]){for(var n="",i={},a=e.length-1,l=0;l<a;++l)n=LO(e[l],n,i);mb[t]={c:LO(e[a],n,i),e:i}}var c=Sb({},mb[t].e);return hj(mb[t].c+";onmessage=function(e){for(var k in e.data)self[k]=e.data[k];onmessage="+r.toString()+"}",t,c,yj(c),o)},xj=function(){return[St,ho,ef,sd,ad,Km,rI,jO,UO,$O,Qm,HO,Tn,fb,Sn,hb,tf,Qa,Xt,zO,Mb,Tb,JO]},vj=function(){return[St,ho,ef,sd,ad,Km,yb,Qv,GO,Xs,VO,nd,Qm,WO,nI,Tn,Yi,rd,gb,bb,qv,od,oI,eI,tf,Qa,ZO,YO,Cb,Tb]};var Tb=function(e){return postMessage(e,[e.buffer])},JO=function(e){return e&&{out:e.size&&new St(e.size),dictionary:e.dictionary}},KO=function(e,r,t,o,n,i){var a=bj(t,o,n,function(l,c){a.terminate(),i(l,c)});return a.postMessage([e,r],r.consume?[e.buffer]:[]),function(){a.terminate()}};var ei=function(e,r){return e[r]|e[r+1]<<8},zr=function(e,r){return(e[r]|e[r+1]<<8|e[r+2]<<16|e[r+3]<<24)>>>0},Kv=function(e,r){return zr(e,r)+zr(e,r+4)*4294967296},Hr=function(e,r,t){for(;t;++r)e[r]=t,t>>>=8};function Ij(e,r,t){return t||(t=r,r={}),typeof t!="function"&&Xt(7),KO(e,r,[vj],function(o){return Tb(Cb(o.data[0],o.data[1]))},0,t)}function Cb(e,r){return YO(e,r||{},0,0)}function Sj(e,r,t){return t||(t=r,r={}),typeof t!="function"&&Xt(7),KO(e,r,[xj],function(o){return Tb(Mb(o.data[0],JO(o.data[1])))},1,t)}function Mb(e,r){return zO(e,{i:2},r&&r.out,r&&r.dictionary)}var iI=function(e,r,t,o){for(var n in e){var i=e[n],a=r+n,l=o;Array.isArray(i)&&(l=Sb(o,i[1]),i=i[0]),i instanceof St?t[a]=[i,l]:(t[a+="/"]=[new St(0),l],iI(i,a,t,o))}},_O=typeof TextEncoder<"u"&&new TextEncoder,tI=typeof TextDecoder<"u"&&new TextDecoder,Tj=0;try{tI.decode(nI,{stream:!0}),Tj=1}catch{}var Cj=function(e){for(var r="",t=0;;){var o=e[t++],n=(o>127)+(o>223)+(o>239);if(t+n>e.length)return{s:r,r:Qa(e,t-1)};n?n==3?(o=((o&15)<<18|(e[t++]&63)<<12|(e[t++]&63)<<6|e[t++]&63)-65536,r+=String.fromCharCode(55296|o>>10,56320|o&1023)):n&1?r+=String.fromCharCode((o&31)<<6|e[t++]&63):r+=String.fromCharCode((o&15)<<12|(e[t++]&63)<<6|e[t++]&63):r+=String.fromCharCode(o)}};function id(e,r){if(r){for(var t=new St(e.length),o=0;o<e.length;++o)t[o]=e.charCodeAt(o);return t}if(_O)return _O.encode(e);for(var n=e.length,i=new St(e.length+(e.length>>1)),a=0,l=function(u){i[a++]=u},o=0;o<n;++o){if(a+5>i.length){var c=new St(a+8+(n-o<<1));c.set(i),i=c}var p=e.charCodeAt(o);p<128||r?l(p):p<2048?(l(192|p>>6),l(128|p&63)):p>55295&&p<57344?(p=65536+(p&1047552)|e.charCodeAt(++o)&1023,l(240|p>>18),l(128|p>>12&63),l(128|p>>6&63),l(128|p&63)):(l(224|p>>12),l(128|p>>6&63),l(128|p&63))}return Qa(i,0,a)}function sI(e,r){if(r){for(var t="",o=0;o<e.length;o+=16384)t+=String.fromCharCode.apply(null,e.subarray(o,o+16384));return t}else{if(tI)return tI.decode(e);var n=Cj(e),i=n.s,t=n.r;return t.length&&Xt(8),i}}var QO=function(e,r){return r+30+ei(e,r+26)+ei(e,r+28)},qO=function(e,r,t){var o=ei(e,r+28),n=sI(e.subarray(r+46,r+46+o),!(ei(e,r+8)&2048)),i=r+46+o,a=zr(e,r+20),l=t&&a==4294967295?Mj(e,i):[a,zr(e,r+24),zr(e,r+42)],c=l[0],p=l[1],u=l[2];return[ei(e,r+10),c,p,n,i+ei(e,r+30)+ei(e,r+32),u]},Mj=function(e,r){for(;ei(e,r)!=1;r+=4+ei(e,r+2));return[Kv(e,r+12),Kv(e,r+4),Kv(e,r+20)]},qm=function(e){var r=0;if(e)for(var t in e){var o=e[t].length;o>65535&&Xt(9),r+=o+4}return r},xb=function(e,r,t,o,n,i,a,l){var c=o.length,p=t.extra,u=l&&l.length,f=qm(p);Hr(e,r,a!=null?33639248:67324752),r+=4,a!=null&&(e[r++]=20,e[r++]=t.os),e[r]=20,r+=2,e[r++]=t.flag<<1|(i<0&&8),e[r++]=n&&8,e[r++]=t.compression&255,e[r++]=t.compression>>8;var h=new Date(t.mtime==null?Date.now():t.mtime),b=h.getFullYear()-1980;if((b<0||b>119)&&Xt(10),Hr(e,r,b<<25|h.getMonth()+1<<21|h.getDate()<<16|h.getHours()<<11|h.getMinutes()<<5|h.getSeconds()>>1),r+=4,i!=-1&&(Hr(e,r,t.crc),Hr(e,r+4,i<0?-i-2:i),Hr(e,r+8,t.size)),Hr(e,r+12,c),Hr(e,r+14,f),r+=16,a!=null&&(Hr(e,r,u),Hr(e,r+6,t.attrs),Hr(e,r+10,a),r+=14),e.set(o,r),r+=c,f)for(var x in p){var T=p[x],v=T.length;Hr(e,r,+x),Hr(e,r+2,v),e.set(T,r+4),r+=4+v}return u&&(e.set(l,r),r+=u),r},eE=function(e,r,t,o,n){Hr(e,r,101010256),Hr(e,r+8,t),Hr(e,r+10,t),Hr(e,r+12,o),Hr(e,r+16,n)};function tE(e,r,t){t||(t=r,r={}),typeof t!="function"&&Xt(7);var o={};iI(e,"",o,r);var n=Object.keys(o),i=n.length,a=0,l=0,c=i,p=new Array(i),u=[],f=function(){for(var v=0;v<u.length;++v)u[v]()},h=function(v,I){vb(function(){t(v,I)})};vb(function(){h=t});var b=function(){var v=new St(l+22),I=a,M=l-a;l=0;for(var O=0;O<c;++O){var C=p[O];try{var E=C.c.length;xb(v,l,C,C.f,C.u,E);var _=30+C.f.length+qm(C.extra),G=l+_;v.set(C.c,G),xb(v,a,C,C.f,C.u,E,l,C.m),a+=16+_+(C.m?C.m.length:0),l=G+E}catch(R){return h(R,null)}}eE(v,a,p.length,M,I),h(null,v)};i||b();for(var x=function(v){var I=n[v],M=o[I],O=M[0],C=M[1],E=XO(),_=O.length;E.p(O);var G=id(I),R=G.length,N=C.comment,X=N&&id(N),z=X&&X.length,ee=qm(C.extra),re=C.level==0?0:8,ue=function(Ce,Oe){if(Ce)f(),h(Ce,null);else{var Pe=Oe.length;p[v]=Sb(C,{size:_,crc:E.d(),c:Oe,f:G,m:X,u:R!=I.length||X&&N.length!=z,compression:re}),a+=30+R+ee+Pe,l+=76+2*(R+ee)+(z||0)+Pe,--i||b()}};if(R>65535&&ue(Xt(11,0,1),null),!re)ue(null,O);else if(_<16e4)try{ue(null,Cb(O,C))}catch(Ce){ue(Ce,null)}else u.push(Ij(O,C,ue))},T=0;T<c;++T)x(T);return f}function rE(e,r){r||(r={});var t={},o=[];iI(e,"",t,r);var n=0,i=0;for(var a in t){var l=t[a],c=l[0],p=l[1],u=p.level==0?0:8,f=id(a),h=f.length,b=p.comment,x=b&&id(b),T=x&&x.length,v=qm(p.extra);h>65535&&Xt(11);var I=u?Cb(c,p):c,M=I.length,O=XO();O.p(c),o.push(Sb(p,{size:c.length,crc:O.d(),c:I,f,m:x,u:h!=a.length||x&&b.length!=T,o:n,compression:u})),n+=30+h+v+M,i+=76+2*(h+v)+(T||0)+M}for(var C=new St(i+22),E=n,_=i-n,G=0;G<o.length;++G){var f=o[G];xb(C,f.o,f,f.f,f.u,f.c.length);var R=30+f.f.length+qm(f.extra);C.set(f.c,f.o+R),xb(C,n,f,f.f,f.u,f.c.length,f.o,f.m),n+=16+R+(f.m?f.m.length:0)}return eE(C,n,o.length,_,E),C}var vb=typeof queueMicrotask=="function"?queueMicrotask:typeof setTimeout=="function"?setTimeout:function(e){e()};function oE(e,r,t){t||(t=r,r={}),typeof t!="function"&&Xt(7);var o=[],n=function(){for(var v=0;v<o.length;++v)o[v]()},i={},a=function(v,I){vb(function(){t(v,I)})};vb(function(){a=t});for(var l=e.length-22;zr(e,l)!=101010256;--l)if(!l||e.length-l>65558)return a(Xt(13,0,1),null),n;var c=ei(e,l+8);if(c){var p=c,u=zr(e,l+16),f=u==4294967295||p==65535;if(f){var h=zr(e,l-12);f=zr(e,h)==101075792,f&&(p=c=zr(e,h+32),u=zr(e,h+48))}for(var b=r&&r.filter,x=function(v){var I=qO(e,u,f),M=I[0],O=I[1],C=I[2],E=I[3],_=I[4],G=I[5],R=QO(e,G);u=_;var N=function(z,ee){z?(n(),a(z,null)):(ee&&(i[E]=ee),--c||a(null,i))};if(!b||b({name:E,size:O,originalSize:C,compression:M}))if(!M)N(null,Qa(e,R,R+O));else if(M==8){var X=e.subarray(R,R+O);if(C<524288||O>.8*C)try{N(null,Mb(X,{out:new St(C)}))}catch(z){N(z,null)}else o.push(Sj(X,{size:C},N))}else N(Xt(14,"unknown compression type "+M,1),null);else N(null,null)},T=0;T<p;++T)x(T)}else a(null,{});return n}function nE(e,r){for(var t={},o=e.length-22;zr(e,o)!=101010256;--o)(!o||e.length-o>65558)&&Xt(13);var n=ei(e,o+8);if(!n)return{};var i=zr(e,o+16),a=i==4294967295||n==65535;if(a){var l=zr(e,o-12);a=zr(e,l)==101075792,a&&(n=zr(e,l+32),i=zr(e,l+48))}for(var c=r&&r.filter,p=0;p<n;++p){var u=qO(e,i,a),f=u[0],h=u[1],b=u[2],x=u[3],T=u[4],v=u[5],I=QO(e,v);i=T,(!c||c({name:x,size:h,originalSize:b,compression:f}))&&(f?f==8?t[x]=Mb(e.subarray(I,I+h),{out:new St(b)}):Xt(14,"unknown compression type "+f):t[x]=Qa(e,I,I+h))}return t}d();var wj=e=>{if(e!=null)return e.trim()===""?void 0:e},Oj=e=>e!=null,wb=(e,r,t=0)=>{if(D.IsNull(e))return"null";if(D.IsUndefined(e))return"undefined";if(D.IsString(e))return"<string>";if(D.IsNumber(e))return"<number>";if(D.IsBoolean(e))return"<boolean>";if(D.IsLiteral(e))return typeof e.const=="string"?`'${e.const}'`:`${e.const}`;if(D.IsRef(e)){let o=r.find(n=>n.$id===e.$ref);return o==null?e.$ref:wb(o,r,t)}if(D.IsArray(e))return`${wb(e.items,r,t+1)}[]`;if(D.IsUnion(e)&&(!(e.anyOf.length>5)||e.$id==null)){let n=`${e.anyOf.map(i=>wb(i,r,t+1)).filter(Oj).join(" | ")}`;return t>0?`(${n})`:n}return e.$id??""},Ej=(e,r,t)=>{let o=r.message;return D.IsUnion(r.schema)&&(o=`Expected one of: ${wb(r.schema,t)}`),`${`#/definitions/${e}${wj(r.path)??""}`}: ${o}`},Ob=(e,r,t)=>{let o=r.First();if(o!=null)return Ej(e,o,t)};var ld;(function(e){e.Archive="Archive",e.Validate="Validate",e.Encode="Encode",e.Unknown="Unknown"})(ld||(ld={}));var cd=class extends Error{constructor(t,o){super(o);m(this,"name");m(this,"kind");this.name="CompressError",this.kind=t}},Pj=e=>new cd(ld.Archive,e.message),Fj=e=>{let r=Object.values(Ib);return e instanceof Error&&"code"in e&&typeof e.code=="number"&&r.includes(e.code)},Dj=(e,r,t)=>new cd(ld.Validate,Ob(e,r,t)??"Unknown validate error"),kj=e=>new cd(ld.Encode,e.message),Aj=e=>new cd(ld.Unknown,e instanceof Error?e.message:String(e)),rf=(e,r,t)=>r instanceof Kl?kj(r):r instanceof vn?Dj(e,r,t):Fj(r)?Pj(r):Aj(r);d();var pd;(function(e){e.Unarchive="Unarchive",e.Validate="Validate",e.Decode="Decode",e.Unknown="Unknown"})(pd||(pd={}));var dd=class extends Error{constructor(t,o){super(o);m(this,"name");m(this,"kind");this.name="DecompressError",this.kind=t}},Lj=e=>new dd(pd.Unarchive,e.message),_j=e=>{let r=Object.values(Ib);return e instanceof Error&&"code"in e&&typeof e.code=="number"&&r.includes(e.code)},Rj=(e,r,t)=>new dd(pd.Validate,Ob(e,r,t)??"Unknown validate error"),Bj=e=>new dd(pd.Decode,e.message),Nj=e=>new dd(pd.Unknown,e instanceof Error?e.message:String(e)),of=(e,r,t)=>r instanceof Jl?Bj(r):r instanceof vn?Rj(e,r,t):_j(r)?Lj(r):Nj(r);var iE=function*(e,r=""){if(e!=null){if(Array.isArray(e)){for(let t=0;t<e.length;t++)yield[r+`[${t}]`,e[t]];return}if("features"in e){for(let t=0;t<e.features.length;t++)yield[r===""?`features[${t}]`:`${r}.features[${t}]`,e.features[t]];return}for(let[t,o]of Object.entries(e)){let n=r===""?t:`${r}.${t}`;yield*iE(o,n)}}},jj=(e,r)=>e===""?r:r.startsWith("[")?`${e}${r}`:`${e}.${r}`,er=(e,r,t)=>{let o=new Set;for(let[n,i]of iE(e)){let a=r(i);if(o.has(a))return ie({kind:_o.DuplicateIdError,properties:{id:a,path:jj(t,n)}});o.add(a)}return oe(!0)};var sE=e=>e.floors==null?ie({kind:_o.FloorMissingError,properties:null}):er(e.floors.features,r=>r.properties.id,"floors");var aE=g.Intersect([g.Object({id:g.Ref(Ve),elevation:g.Integer({description:"An ordinal representing the elevation of this map relative to other maps in the stack."}),subtitle:g.Optional(g.String({description:"The subtitle of the floor."})),maxHeight:g.Optional(g.Number({description:"The maximum height of the floor in meters. This includes the thickness of the floor itself, up to the tallest point on any wall. If the floor does not have a consistent height (eg, one room on the floor has a vaulted ceiling, the rest do not), this value represents the highest point anywhere on the floor. Must be a positive number, or undefined.",minimum:0}))}),Xo],{$id:"FloorProperties"}),lE=Ur(g.Union([g.Ref(Xp),g.Ref(Yp),g.Null()]),g.Ref(aE),{$id:"FloorFeature"}),cE=fo(g.Ref(lE),{$id:"FloorCollection"}),Gj=g.Object({floors:g.Ref(cE)}),pE={name:"core:floors",intoBundle:function*(e){e.floors!=null&&(yield{path:"floors.geojson",contents:e.floors})},fromBundle:(e,r,t)=>{if(e==="floors.geojson")return{floors:t(r)}},integrityCheck:sE,schema:Gj,references:[aE,lE,cE]};d();d();var tr=e=>g.Unsafe(e);d();var Ze=e=>Object.keys(e);d();d();var Uj=e=>new Map(e.floors?.features.map(r=>[r.properties.id,r])??[]),ti=e=>{let r=Uj(e);return o=>{let n=r.get(o);return n==null?ie({kind:_o.UnknownFloorError,properties:{floorId:o}}):oe(n)}};var dE=e=>{if(e.floors==null)return ie({kind:_o.FloorMissingError,properties:null});if(e.geometry==null)return ie({kind:_o.GeometryMissingError,properties:null});let r=er(e.geometry,o=>o.properties.id,"geometry");if(r.isErr())return r;let t=ti(e);for(let o of Ze(e.geometry)){let n=t(o);if(n.isErr())return n}return oe(!0)};var uE=g.Intersect([g.Object({id:g.Ref(ro)}),Xo],{$id:"GeometryProperties"}),mE=Ur(g.Union([g.Ref(to),g.Ref(zy),g.Ref(Wy),g.Ref(Zy),g.Ref(Xp),g.Ref(Yp)]),g.Ref(uE),{$id:"GeometryFeature"}),fE=fo(g.Ref(mE),{$id:"GeometryCollection"}),Vj=g.Object({geometry:tr(g.Record(Ve,g.Ref(fE),{additionalProperties:!1}))},{$id:"GeometrySchema"}),$j=/^geometry\/(.*)\.geojson$/,hE={name:"core:geometry",schema:Vj,intoBundle:function*(e){if(e.geometry!=null)for(let r of Ze(e.geometry))yield{path:`geometry/${r}.geojson`,contents:e.geometry[r]}},fromBundle:(e,r,t)=>{let o=e.match($j)?.[1];if(o)return{geometry:{[o]:t(r)}}},references:[uE,mE,fE],integrityCheck:dE};d();var aI=g.Object({type:g.Literal("file"),name:g.String({description:"The name of the file."})},{$id:"ManifestFile"}),gE=g.Recursive(e=>g.Object({type:g.Literal("folder"),name:g.String({description:"The name of the folder."}),children:g.Array(g.Union([e,g.Ref(aI)]),{minItems:1,description:"The children of the folder."})}),{$id:"ManifestFolder"}),yE=g.Object({name:g.String({description:"The name of the map."}),version:g.Literal("3.0.0",{description:"The version of the manifest."}),orgId:g.Optional(g.String({description:"The identifier of the organization that the map this MVF is for belongs to."})),mapId:g.Optional(g.String({description:"The identifier of the map that this MVF is for."})),contents:g.Array(g.Union([g.Ref(gE),g.Ref(aI)]),{minItems:1,description:"The contents of the MVF bundle."}),time:g.String({format:"date-time",description:"An ISO 8601 date-time string, including timezone offset."}),tzid:g.Optional(g.Unsafe(g.String({description:"A valid IANA timezone identifier.",pattern:"^[A-Za-z0-9_-]+/[A-Za-z0-9_-]+$"}))),naturalBearing:g.Optional(g.Number({minimum:0,maximum:360,description:'The angle, in degrees, the map is considered to be "naturally oriented" as, rather than facing directly north. 90 degrees means East is "up"'})),defaultFloor:g.Optional(g.Ref(Ve,{description:"The default floor ID of the map."})),language:g.Optional(g.String({description:"The language code of the map."}))},{$id:"ManifestProperties"}),bE=fo(Ur(to,g.Ref(yE)),{$id:"ManifestCollection"},{minItems:1,maxItems:1}),Hj=g.Object({manifest:g.Ref(bE)}),xE={name:"core:manifest",intoBundle:function*(e){e.manifest!=null&&(yield{path:"manifest.geojson",contents:e.manifest})},fromBundle:(e,r,t)=>{if(e==="manifest.geojson")return{manifest:t(r)}},schema:Hj,references:[aI,gE,yE,bE]};d();d();d();d();var lI=class extends be{constructor(t){super(`Unable to dereference schema with $id '${t.$ref}'`);m(this,"schema");this.schema=t}};function zj(e,r){let t=r.find(o=>o.$id===e.$ref);if(t===void 0)throw new lI(e);return ql(t,r)}function Eb(e,r){return!Ye.IsString(e.$id)||r.some(t=>t.$id===e.$id)||r.push(e),r}function ql(e,r){return e[U]==="This"||e[U]==="Ref"?zj(e,r):e}d();function Wj(e,r,t){let o=e.get(r);if(o!==void 0)return o;let n=Xi(r,t);return e.set(r,n),n}function Pb(){let e=new WeakMap;return{HasTransform:(r,t)=>Wj(e,r,t)}}function Yt(e,r,t){try{return D.IsTransform(e)?e[_t].Decode(t):t}catch(o){throw new Jl(e,r,t,o)}}function Zj(e,r,t,o,n){return Ye.IsArray(o)?Yt(e,t,o.map((i,a)=>Ji(e.items,r,`${t}/${a}`,i,n))):Yt(e,t,o)}function Xj(e,r,t,o,n){if(!Ye.IsObject(o)||Gr(o))return Yt(e,t,o);let i=Xa(e),a=i.map(f=>f[0]),l={...o};for(let[f,h]of i)f in l&&(l[f]=Ji(h,r,`${t}/${f}`,l[f],n));if(!D.IsTransform(e.unevaluatedProperties))return Yt(e,t,l);let c=Object.getOwnPropertyNames(l),p=e.unevaluatedProperties,u={...l};for(let f of c)a.includes(f)||(u[f]=Yt(p,`${t}/${f}`,u[f]));return Yt(e,t,u)}function Yj(e,r,t,o,n){return Yt(e,t,Ji(e.not,r,t,o,n))}function Jj(e,r,t,o,n){if(!Ye.IsObject(o))return Yt(e,t,o);let i=Er(e),a={...o};for(let u of i)Ye.HasPropertyKey(a,u)&&(Ye.IsUndefined(a[u])&&(!D.IsUndefined(e.properties[u])||pt.IsExactOptionalProperty(a,u))||(a[u]=Ji(e.properties[u],r,`${t}/${u}`,a[u],n)));if(!D.IsSchema(e.additionalProperties))return Yt(e,t,a);let l=Object.getOwnPropertyNames(a),c=e.additionalProperties,p={...a};for(let u of l)i.includes(u)||(p[u]=Yt(c,`${t}/${u}`,p[u]));return Yt(e,t,p)}function Kj(e,r,t,o,n){if(!Ye.IsObject(o))return Yt(e,t,o);let i=Object.getOwnPropertyNames(e.patternProperties)[0],a=new RegExp(i),l={...o};for(let f of Object.getOwnPropertyNames(o))a.test(f)&&(l[f]=Ji(e.patternProperties[i],r,`${t}/${f}`,l[f],n));if(!D.IsSchema(e.additionalProperties))return Yt(e,t,l);let c=Object.getOwnPropertyNames(l),p=e.additionalProperties,u={...l};for(let f of c)a.test(f)||(u[f]=Yt(p,`${t}/${f}`,u[f]));return Yt(e,t,u)}function Qj(e,r,t,o,n){let i=ql(e,r);return Yt(e,t,Ji(i,r,t,o,n))}function qj(e,r,t,o,n){let i=ql(e,r);return Yt(e,t,Ji(i,r,t,o,n))}function eG(e,r,t,o,n){return Ye.IsArray(o)&&Ye.IsArray(e.items)?Yt(e,t,e.items.map((i,a)=>Ji(i,r,`${t}/${a}`,o[a],n))):Yt(e,t,o)}function tG(e,r,t,o,n){for(let i of e.anyOf){if(!qn.Check(i,r,o))continue;let a=Ji(i,r,t,o,n);return Yt(e,t,a)}return Yt(e,t,o)}function Ji(e,r,t,o,n){if(!n.HasTransform(e,r))return o;let i=Eb(e,r),a=e;switch(e[U]){case"Array":return Zj(a,i,t,o,n);case"Intersect":return Xj(a,i,t,o,n);case"Not":return Yj(a,i,t,o,n);case"Object":return Jj(a,i,t,o,n);case"Record":return Kj(a,i,t,o,n);case"Ref":return Qj(a,i,t,o,n);case"Symbol":return Yt(a,t,o);case"This":return qj(a,i,t,o,n);case"Tuple":return eG(a,i,t,o,n);case"Union":return tG(a,i,t,o,n);default:return Yt(a,t,o)}}function vE(e,r,t){let o=Pb();return Ji(e,r,"",t,o)}d();function io(e,r,t){try{return D.IsTransform(e)?e[_t].Encode(t):t}catch(o){throw new Kl(e,r,t,o)}}function rG(e,r,t,o,n){let i=io(e,t,o);return Ye.IsArray(i)?i.map((a,l)=>Ki(e.items,r,`${t}/${l}`,a,n)):i}function oG(e,r,t,o,n){let i=io(e,t,o);if(!Ye.IsObject(o)||Gr(o))return i;let a=Xa(e),l=a.map(h=>h[0]),c={...i};for(let[h,b]of a)h in c&&(c[h]=Ki(b,r,`${t}/${h}`,c[h],n));if(!D.IsTransform(e.unevaluatedProperties))return c;let p=Object.getOwnPropertyNames(c),u=e.unevaluatedProperties,f={...c};for(let h of p)l.includes(h)||(f[h]=io(u,`${t}/${h}`,f[h]));return f}function nG(e,r,t,o){return io(e.not,t,io(e,t,o))}function iG(e,r,t,o,n){let i=io(e,t,o);if(!Ye.IsObject(i))return i;let a=Er(e),l={...i};for(let f of a)Ye.HasPropertyKey(l,f)&&(Ye.IsUndefined(l[f])&&(!D.IsUndefined(e.properties[f])||pt.IsExactOptionalProperty(l,f))||(l[f]=Ki(e.properties[f],r,`${t}/${f}`,l[f],n)));if(!D.IsSchema(e.additionalProperties))return l;let c=Object.getOwnPropertyNames(l),p=e.additionalProperties,u={...l};for(let f of c)a.includes(f)||(u[f]=io(p,`${t}/${f}`,u[f]));return u}function sG(e,r,t,o,n){let i=io(e,t,o);if(!Ye.IsObject(o))return i;let a=Object.getOwnPropertyNames(e.patternProperties)[0],l=new RegExp(a),c={...i};for(let h of Object.getOwnPropertyNames(o))l.test(h)&&(c[h]=Ki(e.patternProperties[a],r,`${t}/${h}`,c[h],n));if(!D.IsSchema(e.additionalProperties))return c;let p=Object.getOwnPropertyNames(c),u=e.additionalProperties,f={...c};for(let h of p)l.test(h)||(f[h]=io(u,`${t}/${h}`,f[h]));return f}function aG(e,r,t,o,n){let i=ql(e,r),a=Ki(i,r,t,o,n);return io(e,t,a)}function lG(e,r,t,o,n){let i=ql(e,r),a=Ki(i,r,t,o,n);return io(e,t,a)}function cG(e,r,t,o,n){let i=io(e,t,o);return Ye.IsArray(e.items)?e.items.map((a,l)=>Ki(a,r,`${t}/${l}`,i[l],n)):[]}function pG(e,r,t,o,n){for(let i of e.anyOf){if(!qn.Check(i,r,o))continue;let a=Ki(i,r,t,o,n);return io(e,t,a)}for(let i of e.anyOf){let a=Ki(i,r,t,o,n);if(qn.Check(e,r,a))return io(e,t,a)}return io(e,t,o)}function Ki(e,r,t,o,n){if(!n.HasTransform(e,r))return o;let i=Eb(e,r),a=e;switch(e[U]){case"Array":return rG(a,i,t,o,n);case"Intersect":return oG(a,i,t,o,n);case"Not":return nG(a,i,t,o);case"Object":return iG(a,i,t,o,n);case"Record":return sG(a,i,t,o,n);case"Ref":return aG(a,i,t,o,n);case"This":return lG(a,i,t,o,n);case"Tuple":return cG(a,i,t,o,n);case"Union":return pG(a,i,t,o,n);default:return io(a,t,o)}}function IE(e,r,t){let o=Pb();return Ki(e,r,"",t,o)}d();var cI=class{constructor(r,t,o,n){this.schema=r,this.references=t,this.checkFunc=o,this.code=n,this.hasTransform=Xi(r,t)}Code(){return this.code}Errors(r){return $i(this.schema,this.references,r)}Check(r){return this.checkFunc(r)}Decode(r){if(!this.checkFunc(r))throw new qp(this.schema,r,this.Errors(r).First());return this.hasTransform?ed(this.schema,this.references,r):r}Encode(r){let t=this.hasTransform?ib(this.schema,this.references,r):r;if(!this.checkFunc(t))throw new td(this.schema,r,this.Errors(r).First());return t}},Ys;(function(e){function r(i){return i===36}e.DollarSign=r;function t(i){return i===95}e.IsUnderscore=t;function o(i){return i>=65&&i<=90||i>=97&&i<=122}e.IsAlpha=o;function n(i){return i>=48&&i<=57}e.IsNumeric=n})(Ys||(Ys={}));var Fb;(function(e){function r(i){return i.length===0?!1:Ys.IsNumeric(i.charCodeAt(0))}function t(i){if(r(i))return!1;for(let a=0;a<i.length;a++){let l=i.charCodeAt(a);if(!(Ys.IsAlpha(l)||Ys.IsNumeric(l)||Ys.DollarSign(l)||Ys.IsUnderscore(l)))return!1}return!0}function o(i){return i.replace(/'/g,"\\'")}function n(i,a){return t(a)?`${i}.${a}`:`${i}['${o(a)}']`}e.Encode=n})(Fb||(Fb={}));var pI;(function(e){function r(t){let o=[];for(let n=0;n<t.length;n++){let i=t.charCodeAt(n);Ys.IsNumeric(i)||Ys.IsAlpha(i)?o.push(t.charAt(n)):o.push(`_${i}_`)}return o.join("").replace(/__/g,"_")}e.Encode=r})(pI||(pI={}));var dI;(function(e){function r(t){return t.replace(/'/g,"\\'")}e.Escape=r})(dI||(dI={}));var uI=class extends be{constructor(r){super("Unknown type"),this.schema=r}},Db=class extends be{constructor(r){super("Preflight validation check failed to guard for the given schema"),this.schema=r}},ec;(function(e){function r(a,l,c){return pt.ExactOptionalPropertyTypes?`('${l}' in ${a} ? ${c} : true)`:`(${Fb.Encode(a,l)} !== undefined ? ${c} : true)`}e.IsExactOptionalProperty=r;function t(a){return pt.AllowArrayObject?`(typeof ${a} === 'object' && ${a} !== null)`:`(typeof ${a} === 'object' && ${a} !== null && !Array.isArray(${a}))`}e.IsObjectLike=t;function o(a){return pt.AllowArrayObject?`(typeof ${a} === 'object' && ${a} !== null && !(${a} instanceof Date) && !(${a} instanceof Uint8Array))`:`(typeof ${a} === 'object' && ${a} !== null && !Array.isArray(${a}) && !(${a} instanceof Date) && !(${a} instanceof Uint8Array))`}e.IsRecordLike=o;function n(a){return pt.AllowNaN?`typeof ${a} === 'number'`:`Number.isFinite(${a})`}e.IsNumberLike=n;function i(a){return pt.AllowNullVoid?`(${a} === undefined || ${a} === null)`:`${a} === undefined`}e.IsVoidLike=i})(ec||(ec={}));var kb;(function(e){function r(k){return k[U]==="Any"||k[U]==="Unknown"}function*t(k,H,P){yield"true"}function*o(k,H,P){yield`Array.isArray(${P})`;let[q,K]=[Xe("value","any"),Xe("acc","number")];me(k.maxItems)&&(yield`${P}.length <= ${k.maxItems}`),me(k.minItems)&&(yield`${P}.length >= ${k.minItems}`);let Q=Ee(k.items,H,"value");if(yield`${P}.every((${q}) => ${Q})`,ze(k.contains)||me(k.minContains)||me(k.maxContains)){let De=ze(k.contains)?k.contains:ft(),xt=Ee(De,H,"value"),dr=me(k.minContains)?[`(count >= ${k.minContains})`]:[],ir=me(k.maxContains)?[`(count <= ${k.maxContains})`]:[],ur=`const count = value.reduce((${K}, ${q}) => ${xt} ? acc + 1 : acc, 0)`,wi=["(count > 0)",...dr,...ir].join(" && ");yield`((${q}) => { ${ur}; return ${wi}})(${P})`}k.uniqueItems===!0&&(yield`((${q}) => { const set = new Set(); for(const element of value) { const hashed = hash(element); if(set.has(hashed)) { return false } else { set.add(hashed) } } return true } )(${P})`)}function*n(k,H,P){yield`(typeof value === 'object' && Symbol.asyncIterator in ${P})`}function*i(k,H,P){yield`(typeof ${P} === 'bigint')`,jr(k.exclusiveMaximum)&&(yield`${P} < BigInt(${k.exclusiveMaximum})`),jr(k.exclusiveMinimum)&&(yield`${P} > BigInt(${k.exclusiveMinimum})`),jr(k.maximum)&&(yield`${P} <= BigInt(${k.maximum})`),jr(k.minimum)&&(yield`${P} >= BigInt(${k.minimum})`),jr(k.multipleOf)&&(yield`(${P} % BigInt(${k.multipleOf})) === 0`)}function*a(k,H,P){yield`(typeof ${P} === 'boolean')`}function*l(k,H,P){yield*Fe(k.returns,H,`${P}.prototype`)}function*c(k,H,P){yield`(${P} instanceof Date) && Number.isFinite(${P}.getTime())`,me(k.exclusiveMaximumTimestamp)&&(yield`${P}.getTime() < ${k.exclusiveMaximumTimestamp}`),me(k.exclusiveMinimumTimestamp)&&(yield`${P}.getTime() > ${k.exclusiveMinimumTimestamp}`),me(k.maximumTimestamp)&&(yield`${P}.getTime() <= ${k.maximumTimestamp}`),me(k.minimumTimestamp)&&(yield`${P}.getTime() >= ${k.minimumTimestamp}`),me(k.multipleOfTimestamp)&&(yield`(${P}.getTime() % ${k.multipleOfTimestamp}) === 0`)}function*p(k,H,P){yield`(typeof ${P} === 'function')`}function*u(k,H,P){yield`Number.isInteger(${P})`,me(k.exclusiveMaximum)&&(yield`${P} < ${k.exclusiveMaximum}`),me(k.exclusiveMinimum)&&(yield`${P} > ${k.exclusiveMinimum}`),me(k.maximum)&&(yield`${P} <= ${k.maximum}`),me(k.minimum)&&(yield`${P} >= ${k.minimum}`),me(k.multipleOf)&&(yield`(${P} % ${k.multipleOf}) === 0`)}function*f(k,H,P){let q=k.allOf.map(K=>Ee(K,H,P)).join(" && ");if(k.unevaluatedProperties===!1){let K=Ge(`${new RegExp(Vs(k))};`),Q=`Object.getOwnPropertyNames(${P}).every(key => ${K}.test(key))`;yield`(${q} && ${Q})`}else if(ze(k.unevaluatedProperties)){let K=Ge(`${new RegExp(Vs(k))};`),Q=`Object.getOwnPropertyNames(${P}).every(key => ${K}.test(key) || ${Ee(k.unevaluatedProperties,H,`${P}[key]`)})`;yield`(${q} && ${Q})`}else yield`(${q})`}function*h(k,H,P){yield`(typeof value === 'object' && Symbol.iterator in ${P})`}function*b(k,H,P){typeof k.const=="number"||typeof k.const=="boolean"?yield`(${P} === ${k.const})`:yield`(${P} === '${dI.Escape(k.const)}')`}function*x(k,H,P){yield"false"}function*T(k,H,P){yield`(!${Ee(k.not,H,P)})`}function*v(k,H,P){yield`(${P} === null)`}function*I(k,H,P){yield ec.IsNumberLike(P),me(k.exclusiveMaximum)&&(yield`${P} < ${k.exclusiveMaximum}`),me(k.exclusiveMinimum)&&(yield`${P} > ${k.exclusiveMinimum}`),me(k.maximum)&&(yield`${P} <= ${k.maximum}`),me(k.minimum)&&(yield`${P} >= ${k.minimum}`),me(k.multipleOf)&&(yield`(${P} % ${k.multipleOf}) === 0`)}function*M(k,H,P){yield ec.IsObjectLike(P),me(k.minProperties)&&(yield`Object.getOwnPropertyNames(${P}).length >= ${k.minProperties}`),me(k.maxProperties)&&(yield`Object.getOwnPropertyNames(${P}).length <= ${k.maxProperties}`);let q=Object.getOwnPropertyNames(k.properties);for(let K of q){let Q=Fb.Encode(P,K),De=k.properties[K];if(k.required&&k.required.includes(K))yield*Fe(De,H,Q),(Hs(De)||r(De))&&(yield`('${K}' in ${P})`);else{let xt=Ee(De,H,Q);yield ec.IsExactOptionalProperty(P,K,xt)}}if(k.additionalProperties===!1)if(k.required&&k.required.length===q.length)yield`Object.getOwnPropertyNames(${P}).length === ${q.length}`;else{let K=`[${q.map(Q=>`'${Q}'`).join(", ")}]`;yield`Object.getOwnPropertyNames(${P}).every(key => ${K}.includes(key))`}if(typeof k.additionalProperties=="object"){let K=Ee(k.additionalProperties,H,`${P}[key]`),Q=`[${q.map(De=>`'${De}'`).join(", ")}]`;yield`(Object.getOwnPropertyNames(${P}).every(key => ${Q}.includes(key) || ${K}))`}}function*O(k,H,P){yield`(typeof value === 'object' && typeof ${P}.then === 'function')`}function*C(k,H,P){yield ec.IsRecordLike(P),me(k.minProperties)&&(yield`Object.getOwnPropertyNames(${P}).length >= ${k.minProperties}`),me(k.maxProperties)&&(yield`Object.getOwnPropertyNames(${P}).length <= ${k.maxProperties}`);let[q,K]=Object.entries(k.patternProperties)[0],Q=Ge(`${new RegExp(q)}`),De=Ee(K,H,"value"),xt=ze(k.additionalProperties)?Ee(k.additionalProperties,H,P):k.additionalProperties===!1?"false":"true",dr=`(${Q}.test(key) ? ${De} : ${xt})`;yield`(Object.entries(${P}).every(([key, value]) => ${dr}))`}function*E(k,H,P){let q=Qe(k,H);if(ce.functions.has(k.$ref))return yield`${ye(k.$ref)}(${P})`;yield*Fe(q,H,P)}function*_(k,H,P){let q=Ge(`${new RegExp(k.source,k.flags)};`);yield`(typeof ${P} === 'string')`,me(k.maxLength)&&(yield`${P}.length <= ${k.maxLength}`),me(k.minLength)&&(yield`${P}.length >= ${k.minLength}`),yield`${q}.test(${P})`}function*G(k,H,P){yield`(typeof ${P} === 'string')`,me(k.maxLength)&&(yield`${P}.length <= ${k.maxLength}`),me(k.minLength)&&(yield`${P}.length >= ${k.minLength}`),k.pattern!==void 0&&(yield`${Ge(`${new RegExp(k.pattern)};`)}.test(${P})`),k.format!==void 0&&(yield`format('${k.format}', ${P})`)}function*R(k,H,P){yield`(typeof ${P} === 'symbol')`}function*N(k,H,P){yield`(typeof ${P} === 'string')`,yield`${Ge(`${new RegExp(k.pattern)};`)}.test(${P})`}function*X(k,H,P){yield`${ye(k.$ref)}(${P})`}function*z(k,H,P){if(yield`Array.isArray(${P})`,k.items===void 0)return yield`${P}.length === 0`;yield`(${P}.length === ${k.maxItems})`;for(let q=0;q<k.items.length;q++)yield`${Ee(k.items[q],H,`${P}[${q}]`)}`}function*ee(k,H,P){yield`${P} === undefined`}function*re(k,H,P){yield`(${k.anyOf.map(K=>Ee(K,H,P)).join(" || ")})`}function*ue(k,H,P){yield`${P} instanceof Uint8Array`,me(k.maxByteLength)&&(yield`(${P}.length <= ${k.maxByteLength})`),me(k.minByteLength)&&(yield`(${P}.length >= ${k.minByteLength})`)}function*Ce(k,H,P){yield"true"}function*Oe(k,H,P){yield ec.IsVoidLike(P)}function*Pe(k,H,P){let q=ce.instances.size;ce.instances.set(q,k),yield`kind('${k[U]}', ${q}, ${P})`}function*Fe(k,H,P,q=!0){let K=He(k.$id)?[...H,k]:H,Q=k;if(q&&He(k.$id)){let De=ye(k.$id);if(ce.functions.has(De))return yield`${De}(${P})`;{let xt=Ie(De,k,H,"value",!1);return ce.functions.set(De,xt),yield`${De}(${P})`}}switch(Q[U]){case"Any":return yield*t(Q,K,P);case"Array":return yield*o(Q,K,P);case"AsyncIterator":return yield*n(Q,K,P);case"BigInt":return yield*i(Q,K,P);case"Boolean":return yield*a(Q,K,P);case"Constructor":return yield*l(Q,K,P);case"Date":return yield*c(Q,K,P);case"Function":return yield*p(Q,K,P);case"Integer":return yield*u(Q,K,P);case"Intersect":return yield*f(Q,K,P);case"Iterator":return yield*h(Q,K,P);case"Literal":return yield*b(Q,K,P);case"Never":return yield*x(Q,K,P);case"Not":return yield*T(Q,K,P);case"Null":return yield*v(Q,K,P);case"Number":return yield*I(Q,K,P);case"Object":return yield*M(Q,K,P);case"Promise":return yield*O(Q,K,P);case"Record":return yield*C(Q,K,P);case"Ref":return yield*E(Q,K,P);case"RegExp":return yield*_(Q,K,P);case"String":return yield*G(Q,K,P);case"Symbol":return yield*R(Q,K,P);case"TemplateLiteral":return yield*N(Q,K,P);case"This":return yield*X(Q,K,P);case"Tuple":return yield*z(Q,K,P);case"Undefined":return yield*ee(Q,K,P);case"Union":return yield*re(Q,K,P);case"Uint8Array":return yield*ue(Q,K,P);case"Unknown":return yield*Ce(Q,K,P);case"Void":return yield*Oe(Q,K,P);default:if(!Or.Has(Q[U]))throw new uI(k);return yield*Pe(Q,K,P)}}let ce={language:"javascript",functions:new Map,variables:new Map,instances:new Map};function Ee(k,H,P,q=!0){return`(${[...Fe(k,H,P,q)].join(" && ")})`}function ye(k){return`check_${pI.Encode(k)}`}function Ge(k){let H=`local_${ce.variables.size}`;return ce.variables.set(H,`const ${H} = ${k}`),H}function Ie(k,H,P,q,K=!0){let[Q,De]=[`
2
2
  `,ur=>"".padStart(ur," ")],xt=Xe("value","any"),dr=se("boolean"),ir=[...Fe(H,P,q,K)].map(ur=>`${De(4)}${ur}`).join(` &&${Q}`);return`function ${k}(${xt})${dr} {${Q}${De(2)}return (${Q}${ir}${Q}${De(2)})
3
3
  }`}function Xe(k,H){let P=ce.language==="typescript"?`: ${H}`:"";return`${k}${P}`}function se(k){return ce.language==="typescript"?`: ${k}`:""}function nt(k,H,P){let q=Ie("check",k,H,"value"),K=Xe("value","any"),Q=se("boolean"),De=[...ce.functions.values()],xt=[...ce.variables.values()],dr=He(k.$id)?`return function check(${K})${Q} {
4
4
  return ${ye(k.$id)}(value)
5
5
  }`:`return ${q}`;return[...xt,...De,dr].join(`
6
- `)}function dt(...k){let H={language:"javascript"},[P,q,K]=k.length===2&&we(k[1])?[k[0],k[1],H]:k.length===2&&!we(k[1])?[k[0],[],k[1]]:k.length===3?[k[0],k[1],k[2]]:k.length===1?[k[0],[],H]:[null,[],H];if(ce.language=K.language,ce.variables.clear(),ce.functions.clear(),ce.instances.clear(),!ze(P))throw new Fb(P);for(let Q of q)if(!ze(Q))throw new Fb(Q);return nt(P,q,K)}e.Code=dt;function $t(k,H=[]){let P=dt(k,H,{language:"javascript"}),q=globalThis.Function("kind","format","hash",P),K=new Map(ce.instances);function Q(ir,ur,Mi){if(!Or.Has(ir)||!K.has(ur))return!1;let lp=Or.Get(ir),nm=K.get(ur);return lp(nm,Mi)}function De(ir,ur){return Fo.Has(ir)?Fo.Get(ir)(ur):!1}function xt(ir){return Ka(ir)}let dr=q(Q,De,xt);return new lI(k,H,dr,P)}e.Compile=$t})(Db||(Db={}));d();d();d();var dG=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,uG=[0,31,28,31,30,31,30,31,31,30,31,30,31],mG=e=>e%4===0&&(e%100!==0||e%400===0),kb=e=>{let r=dG.exec(e);if(!r)return!1;let t=+r[1],o=+r[2],n=+r[3];return o>=1&&o<=12&&n>=1&&n<=(o===2&&mG(t)?29:uG[o])};d();var fG=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i,Ab=e=>{let r=fG.exec(e);if(!r)return!1;let t=+r[1],o=+r[2],n=+r[3],i=r[4],a=r[5]==="-"?-1:1,l=+(r[6]||0),c=+(r[7]||0);if(l>23||c>59||!i)return!1;if(t<=23&&o<=59&&n<60)return!0;let p=o-c*a,u=t-l*a-(p<0?1:0);return(u===23||u===-1)&&(p===59||p===-1)&&n<61};var hG=/t|\s/i,SE=e=>{let r=e.split(hG);return r.length===2&&kb(r[0])&&Ab(r[1])};d();var gG=/\/|:/,yG=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,TE=e=>gG.test(e)&&yG.test(e);var bG=[["date",kb],["time",Ab],["date-time",SE],["uri",TE]],CE=()=>{for(let[e,r]of bG)try{Ky.Format(e,r)}catch(t){if(t instanceof Zm)continue;throw t}};d();var uI=g.Record(g.String(),g.Unknown(),{$id:"Extra"}),ti=g.Object({extra:g.Optional(g.Ref(uI))}),mI=[uI];d();d();d();d();d();d();var tt=e=>Object.entries(e);var xG=e=>{let r=new Map;for(let[t,o]of tt(e.geometry??{}))r.set(t,new Map(o?.features.map(n=>[n.properties.id,n])));return r},yr=e=>{let r=xG(e);return(o,n)=>{let i=r.get(o);if(i==null)return ie({kind:_o.UnknownFloorError,properties:{floorId:o}});let a=i.get(n);return a==null?ie({kind:_o.UnknownGeometryError,properties:{floorId:o,geometryId:n}}):oe(a)}};d();var Cn=g.Object({geometryId:g.Ref(ro)},{$id:"WithGeometryId"}),ud=g.Object({geometryIds:g.Array(g.Ref(ro))},{$id:"WithGeometryIds"}),fI=[Cn,ud];d();d();d();var ME=e=>e instanceof Error?e:new Error(String(e));var md=e=>(...r)=>{try{return oe(e(...r))}catch(t){return ie(ME(t))}};var wE=md((e,r)=>{let t={};for(let o of r)for(let n of o.intoBundle(e))t[n.path]=id(JSON.stringify(n.contents));return t}),hI=async(e,r,t)=>wE(e,r).andThenAsync(o=>new Promise(n=>{tE(o,{...t,consume:!0},(i,a)=>{n(i?ie(i):oe(a))})})),vG=md(rE),gI=(e,r,t)=>wE(e,r).andThen(o=>vG(o,t));d();d();function Lb(e,r,t=[]){let o={...e};for(let[n,i]of Object.entries(r))if(i!==void 0)if(n in o){let a=n;if(Array.isArray(i)&&i.length>0){let l=IG(i[0],t);if(l){let c=o[a];if(!Array.isArray(c))throw new Error(`Expected array at ${n}, got ${typeof c}`);let p=new Map(i.map(h=>[OE(h,l),h])),f=c.map(h=>{let b=p.get(OE(h,l));return b?Lb(h,b,t):h});o[a]=f}else o[a]=i}else{let l=o[a];typeof l=="object"&&l!==null&&typeof i=="object"&&i!==null?Object.keys(i).length===0?o[a]=i:o[a]=Lb(l,i,t):o[n]=i}}else o[n]=i;return o}function IG(e,r){function t(o){if(typeof o!="object"||o===null)return null;for(let n of r)if(n in o&&typeof o[n]<"u")return[n];if(Array.isArray(o))return null;for(let[n,i]of Object.entries(o)){let a=t(i);if(a)return[n,...a]}return null}return t(e)}function OE(e,r){return r.reduce((t,o)=>{if(t&&typeof t=="object")return t[o]},e)}var SG=e=>e,TG=e=>JSON.parse(iI(e)),EE=(e,r)=>r.some(t=>t.fromBundle(e.name,new Uint8Array,SG)!==void 0),PE=md((e,r)=>{let t={};for(let o of Object.keys(e)){let n=e[o];for(let i of r){let a=i.fromBundle(o,n,TG);if(a){t=Lb(t,a,[]);break}}}return t}),yI=async(e,r)=>new Promise(t=>oE(e,{filter:o=>EE(o,r)},(o,n)=>{t(o?ie(o):oe(n))})).then(t=>t.andThen(o=>PE(o,r))),CG=md(nE),bI=(e,r)=>CG(e,{filter:t=>EE(t,r)}).andThen(t=>PE(t,r));d();var MG=e=>typeof e=="object"&&e!=null&&"$ref"in e&&typeof e.$ref=="string",wG=e=>{if(e.length<2)return!1;let r=e.filter(MG);if(r.length!==e.length)return!1;let t=r[0].$ref;return r.slice(1).every(o=>o.$ref===t)},_b=e=>typeof e=="object"&&e!=null&&"allOf"in e&&Array.isArray(e.allOf)&&wG(e.allOf)?e.allOf[0]:typeof e=="object"&&e!=null&&!Array.isArray(e)?Object.fromEntries(Object.entries(e).map(([r,t])=>[r,_b(t)])):Array.isArray(e)?e.map(_b):e;d();var Rb=e=>typeof e=="object"&&e!=null&&"$ref"in e?{...e,$ref:`#/definitions/${e.$ref}`}:typeof e=="object"&&e!=null&&!Array.isArray(e)?Object.fromEntries(Object.entries(e).map(([r,t])=>[r,Rb(t)])):Array.isArray(e)?e.map(Rb):e;var fd;(function(e){e.InvalidTypeboxSchema="InvalidTypeboxSchema",e.MissingReferenceId="MissingReferenceId",e.DuplicateReferenceId="DuplicateReferenceId",e.TypeboxError="TypeboxError",e.UnknownError="UnknownError"})(fd||(fd={}));var OG=e=>({next(){for(let t of e){let o=t.next();if(!o.done)return o}return{done:!0,value:void 0}},[Symbol.iterator](){return this}}),EG=(...e)=>{let r=new Map;for(let t of OG(e)){if(!t.$id)continue;let o=r.get(t.$id);if(o!=null&&o!==t)return ie({kind:fd.DuplicateReferenceId,message:"Failed to register a reference for a schema with an $id that has already been used",schema:t});r.set(t.$id,t)}return oe(r)},Fr,hd,en,Wr,xI=class xI{constructor(r,t,o,n){S(this,Fr);S(this,hd);S(this,en,[]);S(this,Wr);w(this,Fr,r),w(this,hd,t),w(this,en,o),w(this,Wr,n),this.is=this.is.bind(this),this.parse=this.parse.bind(this),this.verify=this.verify.bind(this),this.jsonSchema=this.jsonSchema.bind(this),this.compress=this.compress.bind(this),this.decompress=this.decompress.bind(this)}static create(r,t="CoreMVF",o=!1){let n=g.Composite(r.extensions.map(a=>a.schema),{$id:t});if(!D.IsSchema(n))return ie({kind:fd.InvalidTypeboxSchema,message:"Attempting to merge schemas produced an invalid schema",schema:n});let i=EG(_v.values(),Rv.values(),Av.values(),mI.values(),vI.values(),fI.values(),r.extensions.flatMap(a=>a.references??[]).values());if(!i.isOk())return i;try{CE();let a=o?null:Db.Compile(n,[...i.value.values()]);return oe(new xI(n,a,r.extensions,i.value))}catch(a){return a instanceof be?ie({kind:fd.TypeboxError,message:a.message,original:a}):ie({kind:fd.UnknownError,message:"An unknown error occurred while compiling the schema",original:a})}}is(r){return s(this,hd)?.Check(r)??Qn.Check(s(this,Fr),[...s(this,Wr).values()],r)}parse(r){return this.is(r)?oe(r):ie(s(this,hd)?.Errors(r)??Qn.Errors(s(this,Fr),[...s(this,Wr).values()],r))}decode(r){try{return oe(vE(s(this,Fr),[...s(this,Wr).values()],r))}catch(t){return ie(t)}}encode(r){try{return oe(IE(s(this,Fr),[...s(this,Wr).values()],r))}catch(t){return ie(t)}}verify(r){for(let t of s(this,en))if(t.integrityCheck){let o=t.integrityCheck(r);if(o.isErr())return ie(o.error)}return oe(!0)}jsonSchema(){let r=JSON.parse(JSON.stringify([s(this,Fr),...s(this,Wr).values()])),t=_b(Rb({$id:`#/definitions/${s(this,Fr).$id??"CoreMVF"}`,$schema:"http://json-schema.org/draft-07/schema#",references:r}));return JSON.stringify(t,null,2)}async compress(r){return this.encode(r).andThen(t=>this.parse(t)).andThenAsync(t=>hI(t,s(this,en))).then(t=>t.mapErr(o=>rf(s(this,Fr).$id??"CoreMVF",o,[...s(this,Wr).values()])))}async compressUnsafe(r){return this.encode(r).andThenAsync(t=>hI(t,s(this,en))).then(t=>t.mapErr(o=>rf(s(this,Fr).$id??"CoreMVF",o,[...s(this,Wr).values()])))}compressSync(r){return this.encode(r).andThen(t=>this.parse(t)).andThen(t=>gI(t,s(this,en))).mapErr(t=>rf(s(this,Fr).$id??"CoreMVF",t,[...s(this,Wr).values()]))}compressUnsafeSync(r){return this.encode(r).andThen(t=>gI(t,s(this,en))).mapErr(t=>rf(s(this,Fr).$id??"CoreMVF",t,[...s(this,Wr).values()]))}async decompress(r){return yI(r,s(this,en)).then(t=>t.andThen(o=>this.parse(o)).andThen(o=>this.decode(o)).mapErr(o=>of(s(this,Fr).$id??"CoreMVF",o,[...s(this,Wr).values()])))}async decompressUnsafe(r){return yI(r,s(this,en)).then(t=>t.andThen(o=>this.decode(o)).mapErr(o=>of(s(this,Fr).$id??"CoreMVF",o,[...s(this,Wr).values()])))}decompressSync(r){return bI(r,s(this,en)).andThen(t=>this.parse(t)).andThen(t=>this.decode(t)).mapErr(t=>of(s(this,Fr).$id??"CoreMVF",t,[...s(this,Wr).values()]))}decompressUnsafeSync(r){return bI(r,s(this,en)).andThen(t=>this.decode(t)).mapErr(t=>of(s(this,Fr).$id??"CoreMVF",t,[...s(this,Wr).values()]))}};Fr=new WeakMap,hd=new WeakMap,en=new WeakMap,Wr=new WeakMap;var Bb=xI;var gd,Nb=class{constructor(){S(this,gd,[]);this.extend=this.extend.bind(this)}extend(r){return s(this,gd).push(r),this}extendOptional(r){let t={...r,schema:g.Partial(r.schema)};return s(this,gd).push(t),this}build(r){return Bb.create(this,void 0,r?.cspSafe)}get extensions(){return s(this,gd)}};gd=new WeakMap;d();d();d();d();var yd=g.Object({geometryId:g.Ref(ro),floorId:g.Ref(Ve)},{$id:"GeometryAnchor"}),PG=g.Object({geometryAnchor:g.Ref(yd)}),nf=(e,r)=>g.Object({geometryAnchors:g.Array(g.Ref(yd),e)},r),vI=[yd];d();d();d();var FE=(e,r)=>g.Unsafe(g.Transform(g.String(r)).Decode(t=>e.includes(t)?t:"unknown").Encode(t=>t)),Ro=(e,r)=>{let t=FE(e,r),o=[...e,"unknown"],n=Object.freeze(Object.fromEntries([...e,"unknown"].map(i=>[i,i])));return{schema:t,values:o,record:n}};var DE=()=>new Nb().extend(pE).extend(hE).extend(xE);d();d();d();d();d();d();var sf;(function(e){e.AnnotationNonPointGeometryError="AnnotationNonPointGeometryError",e.AnnotationUnknownSymbolError="AnnotationUnknownSymbolError"})(sf||(sf={}));var kE=e=>{if(e.annotations==null)return oe(!0);let r=er(e.annotations,n=>n.id,"annotations");if(r.isErr())return r;let t=yr(e),o=new Set(Ze(e.annotationSymbols??{}));for(let n of Ze(e.annotations)){let i=e.annotations[n];if(i!=null)for(let a of i){if(!o.has(a.symbolKey))return ie({kind:sf.AnnotationUnknownSymbolError,properties:{annotationId:a.id,symbolKey:a.symbolKey}});let l=t(n,a.geometryId);if(l.isErr())return l;if(l.value.geometry.type!=="Point")return ie({kind:sf.AnnotationNonPointGeometryError,properties:{annotationId:a.id,floorId:n,geometryId:a.geometryId}})}}return oe(!0)};var AE=qt("a","AnnotationId"),II=g.Intersect([Cn,g.Object({id:g.Ref(AE,{description:"The unique identifier for the annotation."}),externalId:g.Optional(g.String({description:"The external identifier for the annotation."})),symbolKey:g.String({description:"The symbol identifier for the annotation."})})],{$id:"AnnotationProperties"}),LE=g.Object({url:g.String({format:"uri",description:"The URL for the symbol."}),name:g.String({description:"The name of the symbol."})},{$id:"AnnotationSymbol"}),FG=g.Object({annotations:tr(g.Record(Ve,g.Array(g.Ref(II)),{additionalProperties:!1})),annotationSymbols:tr(g.Record(g.Index(II,["symbolKey"]),g.Ref(LE)))},{$id:"AnnotationsSchema"}),DG=/^annotations\/(.*)\.json$/,_E={name:"ext:mvf-annotations",schema:FG,intoBundle:function*(e){if(e.annotations!=null)for(let r of Ze(e.annotations))yield{path:`annotations/${r}.json`,contents:e.annotations[r]};e.annotationSymbols!=null&&(yield{path:"annotation-symbols.json",contents:e.annotationSymbols})},fromBundle:(e,r,t)=>{if(e==="annotation-symbols.json")return{annotationSymbols:t(r)};let o=e.match(DG)?.[1];if(o)return{annotations:{[o]:t(r)}}},references:[AE,II,LE],integrityCheck:kE};d();d();d();var Js=qt("lcat","LocationCategoryId"),SI=g.Intersect([g.Object({id:g.Ref(Js),parent:g.Optional(g.Ref(Js))}),Xl(["name"]),ti],{$id:"LocationCategory"}),RE=[Js,SI];d();d();var tc;(function(e){e.UnknownCategoryError="UnknownCategoryError",e.UnknownParentCategoryError="UnknownParentCategoryError",e.UnknownParentLocationError="UnknownParentLocationError"})(tc||(tc={}));var BE=e=>{if(e.locationCategories==null&&e.locations==null)return oe(!0);if(e.locationCategories!=null){let n=er(e.locationCategories,i=>i.id,"locationCategories");if(n.isErr())return n}if(e.locations!=null){let n=er(e.locations,i=>i.id,"locations");if(n.isErr())return n}if(e.locationInstances!=null){let n=er(e.locationInstances,i=>i.id,"locationInstances");if(n.isErr())return n}let r=new Set(e.locationCategories?.map(n=>n.id)??[]);for(let n of e.locationCategories??[])if(n.parent!=null&&!r.has(n.parent))return ie({kind:tc.UnknownParentCategoryError,properties:{categoryId:n.id,parentCategoryId:n.parent}});let t=yr(e);for(let n of e.locations??[]){for(let i of n.categories)if(!r.has(i))return ie({kind:tc.UnknownCategoryError,properties:{locationId:n.id,categoryId:i}});for(let i of n.geometryAnchors){let a=t(i.floorId,i.geometryId);if(a.isErr())return a}}let o=new Set(e.locations?.map(n=>n.id)??[]);for(let n of e.locationInstances??[]){if(!o.has(n.parentId))return ie({kind:tc.UnknownParentLocationError,properties:{locationInstanceId:n.id,parentLocationId:n.parentId}});for(let i of n.categories??[])if(!r.has(i))return ie({kind:tc.UnknownCategoryError,properties:{locationId:n.id,categoryId:i}});for(let i of n.geometryAnchors??[]){let a=t(i.floorId,i.geometryId);if(a.isErr())return a}}return oe(!0)};d();var Ks=qt("loc","LocationId"),jb=qt("loci","LocationInstanceId"),NE=g.Object({name:g.String(),url:g.String({format:"uri"})},{$id:"LocationSocial"}),jE=g.Object({url:g.String({format:"uri"})},{$id:"LocationImage"}),TI=g.Object({label:g.String(),url:g.String({format:"uri"})},{$id:"LocationLink"}),CI=g.String({pattern:"^[0-2][0-9]:[0-6][0-9](:[0-6][0-9])?$",$id:"OpeningHoursTime"}),GE=g.Union([g.Literal("Sunday"),g.Literal("Monday"),g.Literal("Tuesday"),g.Literal("Wednesday"),g.Literal("Thursday"),g.Literal("Friday"),g.Literal("Saturday")],{$id:"OpeningHoursDay"}),kG="PublicHolidays",MI=g.Union([GE,g.Literal(kG)],{$id:"OpeningHoursDayOrPublicHoliday"}),Gb=g.Object({"@type":g.Optional(g.Literal("OpeningHoursSpecification",{description:"The type of opening hours"})),opens:g.Optional(g.Ref(CI,{description:"The time the opening hours start"})),closes:g.Optional(g.Ref(CI,{description:"The time the opening hours end"})),dayOfWeek:g.Optional(g.Union([g.Ref(MI),g.Array(g.Ref(MI))],{description:"The days of the week the opening hours apply to"})),validFrom:g.Optional(g.String({format:"date",description:"The date the opening hours start, in ISO 8601 format"})),validThrough:g.Optional(g.String({format:"date",description:"The date the opening hours end, in ISO 8601 format"}))},{$id:"OpeningHoursSpecification"}),Ub=g.Intersect([g.Object({id:g.Ref(Ks),categories:g.Array(g.Ref(Js)),logo:g.Optional(g.String({format:"uri"})),phone:g.Optional(g.String()),social:g.Array(g.Ref(NE)),images:g.Array(g.Ref(jE)),links:g.Array(g.Ref(TI)),website:g.Optional(g.Ref(TI)),openingHours:g.Optional(g.Array(g.Ref(Gb)))}),Xl(["name"]),nf(),ti],{$id:"Location"}),wI=g.Intersect([g.Object({id:g.Ref(jb),parentId:g.Ref(Ks)}),g.Partial(g.Omit(Ub,["id","parentId","details"])),Xo],{$id:"LocationInstance",description:"A location instance is a particular instance of an location that has some properties different from the parent."}),Vb=[Ks,jb,NE,jE,TI,CI,GE,MI,Gb,Ub,wI];var AG=g.Object({locations:g.Array(g.Ref(Ub)),locationCategories:g.Array(g.Ref(SI)),locationInstances:g.Optional(g.Array(g.Ref(wI)))},{$id:"LocationsExtensionSchema"}),UE="locations.json",VE="location-categories.json",$E="location-instances.json",HE={name:"ext:locations",schema:AG,intoBundle:function*(e){e.locations!=null&&(yield{path:UE,contents:e.locations}),e.locationCategories!=null&&(yield{path:VE,contents:e.locationCategories}),e.locationInstances!=null&&(yield{path:$E,contents:e.locationInstances})},fromBundle:(e,r,t)=>{if(e===UE)return{locations:t(r)};if(e===VE)return{locationCategories:t(r)};if(e===$E)return{locationInstances:t(r)}},references:[...RE,...Vb],integrityCheck:BE};d();d();var ri;(function(e){e.EnterpriseLocationWithUnknownLocationError="EnterpriseLocationWithUnknownLocationError",e.EnterpriseCategoryWithUnknownLocationCategoryError="EnterpriseCategoryWithUnknownLocationCategoryError",e.InstanceWithUnknownLocationInstanceError="InstanceWithUnknownLocationInstanceError",e.InstanceWithUnknownEnterpriseLocationError="InstanceWithUnknownEnterpriseLocationError",e.EnterpriseLocationWithUnknownSibling="EnterpriseLocationWithUnknownSibling",e.EnterpriseLocationInstanceWithUnknownSibling="EnterpriseLocationInstanceWithUnknownSibling",e.EnterpriseVenueWithUnknownTopLocationError="EnterpriseVenueWithUnknownTopLocationError",e.EnterpriseLocationWithInvalidPrimaryCategory="EnterpriseLocationWithInvalidPrimaryCategory"})(ri||(ri={}));var zE=e=>{if(e.cms==null)return oe(!0);let r=e.cms,t=er(e.cms.categories,h=>h.id,"cms.categories");if(t.isErr())return t;let o=new Set(e.locationCategories?.map(h=>h.id)??[]);for(let h of r.categories??[])if(!o.has(h.categoryId))return ie({kind:ri.EnterpriseCategoryWithUnknownLocationCategoryError,properties:{enterpriseCategoryId:h.id,locationCategoryId:h.categoryId}});let n=er(e.cms.locations,h=>h.id,"cms.locations");if(n.isErr())return n;let i=new Map(e.locations?.map(h=>[h.id,h])??[]);for(let h of r.locations??[]){if(!i.has(h.locationId))return ie({kind:ri.EnterpriseLocationWithUnknownLocationError,properties:{enterpriseLocationId:h.id,locationId:h.locationId}});for(let b of h.siblingGroups??[])for(let x of b.siblings??[])if(!i.has(x))return ie({kind:ri.EnterpriseLocationWithUnknownSibling,properties:{enterpriseLocationId:h.id,siblingLocationId:x,label:b.label}});if(h.primaryCategory!=null){let b=i.get(h.locationId);if(b!=null&&!b.categories.includes(h.primaryCategory))return ie({kind:ri.EnterpriseLocationWithInvalidPrimaryCategory,properties:{enterpriseLocationId:h.id,locationId:h.locationId,primaryCategory:h.primaryCategory}})}}if(r.venue?.topLocations!=null){for(let h of r.venue.topLocations)if(!i.has(h))return ie({kind:ri.EnterpriseVenueWithUnknownTopLocationError,properties:{locationId:h}})}let a=new Set(e.cms.locations?.map(h=>h.id)??[]),l=er(e.cms.locationInstances,h=>h.id,"cms.locationInstances");if(l.isErr())return l;let c=new Set(e.locationInstances?.map(h=>h.id)??[]);for(let h of r.locationInstances??[]){if(!a.has(h.parentId))return ie({kind:ri.InstanceWithUnknownEnterpriseLocationError,properties:{enterpriseLocationInstanceId:h.id,enterpriseLocationId:h.parentId}});if(!c.has(h.locationInstanceId))return ie({kind:ri.InstanceWithUnknownLocationInstanceError,properties:{enterpriseLocationInstanceId:h.id,locationInstanceId:h.locationInstanceId}});for(let b of h.siblingGroups??[])for(let x of b.siblings??[])if(!i.has(x))return ie({kind:ri.EnterpriseLocationInstanceWithUnknownSibling,properties:{enterpriseLocationInstanceId:h.id,siblingLocationId:x,label:b.label}})}let p=ei(e),u=yr(e),f=er(e.cms.floorText,h=>h.properties.id,"cms.floorText");if(f.isErr())return f;for(let[h,b]of tt(r.floorText??{})){let x=p(h);if(x.isErr())return x;for(let T of b.features){if(!("geometryId"in T.properties))continue;let v=u(h,T.properties.geometryId);if(v.isErr())return v}}for(let[h,b]of tt(r.textures??{})){let x=p(h);if(x.isErr())return x;for(let T of b){let v=u(h,T.geometryId);if(v.isErr())return v}}for(let[h,b]of tt(r.layers??{})){let x=p(h);if(x.isErr())return x;for(let T of Ze(b??{})){let v=u(h,T);if(v.isErr())return v}}for(let[h,b]of tt(r.textAreas??{})){let x=p(h);if(x.isErr())return x;for(let T of b.features)if("geometryId"in T.properties){let v=u(h,T.properties.geometryId);if(v.isErr())return v}}return oe(!0)};d();d();var af=qt("el","EnterpriseLocationId"),OI=qt("ec","EnterpriseCategoryId"),EI=qt("eli","EnterpriseLocationInstanceId"),PI=qt("ev","EnterpriseVenueId"),FI=qt("eft","EnterpriseFloorTextId"),WE=[af,OI,EI,PI,FI];var ZE=g.Object({id:g.Ref(OI),categoryId:g.Ref(Js),color:g.Optional(g.String()),sortOrder:g.Number(),iconFromDefaultList:g.Optional(g.Union([g.String(),g.Null()])),picture:g.Optional(g.String({format:"uri",description:"The category's picture"}))},{$id:"EnterpriseCategory"}),DI=g.Object({categories:g.Optional(g.Array(g.Ref(ZE)))},{$id:"EnterpriseCategoriesSchema"}),XE=[ZE,DI];d();var YE=Ro(["left","center","right"]),LG=YE.schema,rye=YE.values,kI=g.Object({id:g.Ref(FI),text:g.String(),visible:g.Boolean({default:!0}),fontSize:g.Number({default:12,exclusiveMinimum:0}),fontFamily:g.String({default:"Droid Sans"}),color:g.String({default:"black"}),rotation:g.Number({minimum:0,maximum:360}),align:LG},{$id:"FloorTextCommonProperties"}),AI=g.Intersect([g.Ref(kI),Cn],{$id:"AnchoredFloorTextProperties"}),LI=g.Intersect([g.Ref(kI),g.Object({verticalOffset:g.Number()})],{$id:"FloatingFloorTextProperties"}),JE=g.Union([g.Ref(AI),g.Ref(LI)],{$id:"FloorTextProperties"}),KE=Ur(to,g.Ref(JE),{$id:"FloorTextFeature"}),_G=Ur(to,g.Ref(AI),{$id:"AnchoredFloorTextFeature"}),RG=Ur(to,g.Ref(LI),{$id:"FloatingFloorTextFeature"}),QE=fo(g.Ref(KE),{$id:"EnterpriseFloorTextFeatureCollection"}),qE=g.Record(Ve,g.Ref(QE),{$id:"EnterpriseFloorTextCollectionsByFloor",additionalProperties:!1}),_I=g.Object({floorText:g.Optional(g.Ref(qE))},{$id:"EnterpriseFloorTextSchema"}),eP=[kI,AI,LI,JE,KE,_G,RG,QE,qE,_I];d();var tP=tr(g.Record(ro,g.String({minLength:1}),{additionalProperties:!1,$id:"EnterpriseLayers"})),rP=tr(g.Record(Ve,g.Ref(tP),{additionalProperties:!1,$id:"EnterpriseLayersByFloor"})),RI=g.Object({layers:g.Optional(g.Ref(rP))},{$id:"EnterpriseLayersSchema"}),oP=[tP,rP,RI];d();d();d();var BI=Ro(["closed-temporarily","new","pop-up","coming-soon","relocated"]),BG=BI.schema,mye=BI.values,fye=BI.record,NI=g.Object({type:BG,start:g.Optional(g.String({format:"date",description:"The start date of the state"})),end:g.Optional(g.String({format:"date",description:"The end date of the state"}))},{$id:"LocationState",description:"The state of a location. Start and end dates are optional."}),jI=g.Object({label:g.String(),siblings:g.Array(g.Ref(Ks))},{$id:"SiblingGroup"}),$b=g.Object({name:g.String(),code:g.String()},{$id:"Language"}),nP=[NI,jI,$b];var Hb=g.Object({id:g.Ref(af),locationId:g.Ref(Ks),cmsId:g.String(),type:g.String(),sortOrder:g.Number(),tags:g.Optional(g.Array(g.String())),picture:g.Optional(g.String({format:"uri",description:"The picture of the location"})),states:g.Optional(g.Array(g.Ref(NI),{description:"The location's state. No more than one state should be active at a time, and all but at most one should have dates set"})),siblingGroups:g.Optional(g.Array(g.Ref(jI))),gallery:g.Optional(g.Array(g.Object({caption:g.Optional(g.String()),image:g.String({format:"uri"}),embeddedUrl:g.Optional(g.String({format:"uri",description:"The URL to link from the image"}))},{description:"The location's image gallery"}),{description:"The location's image gallery"})),showFloatingLabelWhenImagePresent:g.Optional(g.Boolean({description:"Whether to show the flat label when an image is present"})),amenity:g.Optional(g.String({description:"The location's amenity type. Only set if the location is an amenity"})),showLogo:g.Optional(g.Boolean({description:"Whether to show the logo of the location"})),primaryCategory:g.Optional(g.Ref(Js))},{$id:"EnterpriseLocation"}),GI=g.Object({locations:g.Optional(g.Array(g.Ref(Hb)))},{$id:"EnterpriseLocationsSchema"}),iP=[Hb,GI];var sP=g.Intersect([g.Object({id:g.Ref(EI),parentId:g.Ref(af),locationInstanceId:g.Ref(jb)}),g.Partial(g.Omit(Hb,["id","parentId","locationId"]))],{$id:"EnterpriseLocationInstance",description:"A locationInstance is a particular instance of an Enterprise Location that has some properties different from the parent."}),UI=g.Object({locationInstances:g.Optional(g.Array(g.Ref(sP)))},{$id:"EnterpriseLocationInstancesSchema"}),aP=[sP,UI];d();var VI=Ro(["near","center"],{$id:"EnterpriseTextAreaAlignment"}),lP=VI.schema,Aye=VI.values,Lye=VI.record,$I=g.Object({maxWidth:g.Number({exclusiveMinimum:0,description:"The maximum width of the label, in meters."}),maxHeight:g.Number({exclusiveMinimum:0,description:"The maximum height of the label, in meters."}),align:g.Ref(lP),rotation:g.Number({minimum:0,maximum:360,description:"Rotation in degrees, about the center of the image. North is 0, east is 90."})},{$id:"EnterpriseBaseTextAreaProperties"}),cP=g.Intersect([g.Ref($I),Cn],{$id:"EnterpriseAnchoredTextAreaProperties"}),pP=g.Intersect([g.Ref($I),g.Object({verticalOffset:g.Number({minimum:0,description:"How high to position the image, in meters, relative to the ground plane."})})],{$id:"EnterpriseFloatingTextAreaProperties"}),dP=g.Union([cP,pP],{$id:"EnterpriseTextAreaProperties"}),uP=Ur(g.Ref(to),dP,{$id:"EnterpriseTextAreaFeature"}),mP=fo(g.Ref(uP),{$id:"EnterpriseTextAreaCollection"}),fP=g.Record(Ve,g.Ref(mP),{$id:"EnterpriseTextAreasByFloor",additionalProperties:!1}),hP=g.Object({textAreas:g.Optional(g.Ref(fP))},{$id:"EnterpriseTextAreasSchema"}),gP=[lP,$I,cP,pP,dP,uP,mP,fP];d();var HI=g.Object({u:g.Number(),v:g.Number()},{$id:"EnterpriseTextureUV"}),zI=Ro(["top","side"],{$id:"EnterpriseTextureFace"}),yP=zI.schema,jye=zI.values,Gye=zI.record,WI=Ro(["inside","outside","both"],{$id:"EnterpriseTextureSurface"}),bP=WI.schema,Uye=WI.values,Vye=WI.record,xP=g.Tuple([Wp,Zp,Wp,Zp],{$id:"EnterpriseTextureBounds"}),vP=g.Intersect([g.Object({repeat:g.Ref(HI),offset:g.Ref(HI),rotation:g.Number({minimum:0,maximum:360}),path:g.String({format:"uri"}),face:g.Ref(yP),surface:g.Ref(bP),bounds:g.Ref(xP)},{$id:"EnterpriseTextureProperties"}),Cn],{$id:"EnterpriseTexture"}),IP=g.Array(g.Ref(vP),{$id:"EnterpriseTextures"}),SP=g.Record(Ve,g.Ref(IP),{$id:"EnterpriseTexturesByFloor",additionalProperties:!1}),ZI=g.Object({textures:g.Optional(g.Ref(SP))},{$id:"EnterpriseTexturesSchema"}),TP=[vP,IP,ZI,HI,yP,bP,xP,SP];d();var CP=g.Intersect([g.Object({id:g.Ref(PI),slug:g.String(),defaultLanguage:g.Ref($b),languages:g.Array(g.Ref($b)),countrycode:g.Optional(g.String()),logo:g.Optional(g.String({format:"uri"})),mappedinWebUrl:g.Optional(g.String({format:"uri"})),topLocations:g.Optional(g.Array(g.Ref(Ks))),operationHours:g.Optional(g.Array(g.Ref(Gb))),coverImage:g.Optional(g.String({format:"uri"}))}),Xl(["name"]),ti],{$id:"EnterpriseVenue"}),XI=g.Object({venue:g.Optional(g.Ref(CP))},{$id:"EnterpriseVenueSchema"}),MP=[CP,XI];var OP=g.Intersect([XI,GI,UI,DI,ZI,_I,RI,hP],{$id:"CMSProperties"}),wP=g.Object({cms:g.Optional(g.Ref(OP))},{$id:"CMSExtensionSchema"}),NG=/^cms\/(?:([^/]+)\/)?([^/]+)\.(?:json|geojson)$/,EP={name:"ext:cms",schema:wP,intoBundle:function*(e){if(e.cms==null)return;let r=e.cms;for(let t of Ze(r))switch(t){case"floorText":for(let o of Ze(r.floorText??{}))yield{path:`cms/floorText/${o}.geojson`,contents:(r.floorText??{})[o]};continue;case"textures":for(let o of Ze(r.textures??{}))yield{path:`cms/textures/${o}.json`,contents:(r.textures??{})[o]};continue;case"textAreas":for(let o of Ze(r.textAreas??{}))yield{path:`cms/textAreas/${o}.geojson`,contents:(r.textAreas??{})[o]};continue;default:yield{path:`cms/${t}.json`,contents:r[t]};continue}},fromBundle:(e,r,t)=>{let o=e.match(NG);if(!o)return;let[,n,i]=o,a=t(r);switch(n){case"floorText":case"textures":case"textAreas":return{cms:{[n]:{[i]:a}}};default:return{cms:{[i]:a}}}},references:[OP,wP,...MP,...iP,...aP,...XE,...TP,...oP,...eP,...gP,...WE,...nP,...Vb],integrityCheck:zE};d();d();d();d();var oi;(function(e){e.NavigationFlagMissingDeclaration="NavigationFlagMissingDeclaration",e.NavigationFlagDuplicateBit="NavigationFlagDuplicateBit",e.NavigationFlagIncorrectFlagsLength="NavigationFlagIncorrectFlagsLength",e.NavigationFlagValueTooBig="NavigationFlagValueTooBig"})(oi||(oi={}));var PP=e=>{let{navigationFlags:r}=e;if(!r||Object.keys(r).length===0)return oe(!0);let t=Object.entries(r).map(([i,a])=>({key:i,...a})).sort((i,a)=>i.index!==a.index?i.index-a.index:i.bit-a.bit),o=0,n=-1;for(let i of t){if(i.bit===n)return ie({kind:oi.NavigationFlagDuplicateBit,properties:{index:i.index,bit:i.bit,path:`navigationFlags.${i.key}`}});if(i.index!=o){if(n!=31)return ie({kind:oi.NavigationFlagMissingDeclaration,properties:{index:o,bit:n+1,path:"navigationFlags"}});if(i.index!=o+1||i.bit!=0)return ie({kind:oi.NavigationFlagMissingDeclaration,properties:{index:o+1,bit:0,path:"navigationFlags"}});o=i.index,n=0}else{if(i.bit!==n+1)return ie({kind:oi.NavigationFlagMissingDeclaration,properties:{index:i.index,bit:n+1,path:"navigationFlags"}});n=i.bit}}return oe(!0)};d();function qa(e,r){return r&&(e.flags[r.index]&1<<r.bit)!==0}d();var FP=2**32-1,lf=e=>{let r=Object.keys(e.navigationFlags??{}).length;if(r===0)return{index:-1,flag:0};let t=Math.floor(r/32),o=r%32;return{index:t,flag:2**o-1}},bd=(e,r,t)=>{if(r.index==-1&&e.length===0)return oe(!0);let o=r.flag>0||r.index===-1?r.index+1:r.index;if(e.length!==o)return ie({kind:oi.NavigationFlagIncorrectFlagsLength,properties:{expected:o,actual:e.length,path:t}});for(let n=0;n<e.length;n++){let i=e[n];if(n<r.index){if(i>FP)return ie({kind:oi.NavigationFlagValueTooBig,properties:{index:n,flagValue:i,expectedMaxFlagValue:FP,path:t}});continue}else if(i>r.flag)return ie({kind:oi.NavigationFlagValueTooBig,properties:{index:n,flagValue:i,expectedMaxFlagValue:r.flag,path:t}})}return oe(!0)};var jG=g.Object({index:g.Integer({description:"The index of the flag in a flags array.",minimum:0}),bit:g.Integer({description:"The bit position of the flag in a flag's bitfield.",minimum:0,maximum:31})},{$id:"NavigationFlagDeclarationCore"}),DP=g.Intersect([jG,Xo],{$id:"NavigationFlagDeclaration",description:'A NavigationFlagDeclaration describes the relationship between a "key" that a developer might use to wayfind using that flag, and the index and bit position in an object\'s `flags` array.'}),YI={accessible:"accessible",outdoors:"outdoors",public:"public"},kP=g.Record(g.String(),DP,{$id:"NavigationFlagDeclarations",description:"Any well known and custom flags present in the MVF"}),GG=g.Object({navigationFlags:g.Ref(kP)},{$id:"NavigationFlagsSchema"}),zb=g.Array(g.Integer({minimum:0,maximum:Math.pow(2,32)-1}),{$id:"Flags"}),JI=g.Object({flags:g.Ref(zb)},{$id:"WithFlags"}),rc=g.Intersect([yd,JI],{$id:"FlaggedGeometryAnchor"}),UG=g.Object({geometryAnchor:rc},{$id:"WithFlaggedGeometryAnchor"}),VG=g.Object({geometryAnchors:g.Array(rc)},{$id:"WithFlaggedGeometryAnchors"}),AP={name:"ext:mvf-navigation-flags",schema:GG,intoBundle:function*(e){e.navigationFlags!=null&&(yield{path:"navigationFlags.json",contents:e.navigationFlags})},fromBundle:(e,r,t)=>e!=="navigationFlags.json"?void 0:{navigationFlags:t(r)},references:[DP,kP,zb,rc,UG,VG],integrityCheck:PP};d();var LP=e=>{if(e.connections==null)return oe(!0);let r=er(e.connections,n=>n.id,"connections");if(r.isErr())return r;let t=yr(e),o=lf(e);for(let[n,i]of e.connections.entries()){for(let[a,l]of i.entrances.entries()){let c=t(l.floorId,l.geometryId);if(c.isErr())return c;let p=bd(l.flags,o,`connections[${n}].entrances[${a}]`);if(p.isErr())return p}for(let[a,l]of i.exits.entries()){let c=t(l.floorId,l.geometryId);if(c.isErr())return c;let p=bd(l.flags,o,`connections[${n}].exits[${a}]`);if(p.isErr())return p}}return oe(!0)};var RP=qt("c","ConnectionId"),{schema:$G,values:zbe,record:HG}=Ro(["elevator","escalator","travelator","stairs","door","ramp","ladder"],{$id:"ConnectionType"}),BP=$G;var KI=HG,NP=g.Intersect([g.Object({id:g.Ref(RP,{description:"The unique identifier for the connection."}),entrances:g.Array(g.Ref(rc)),exits:g.Array(g.Ref(rc)),entryCost:g.Number({description:"The cost to enter the connection.",minimum:0}),floorCostMultiplier:g.Number({description:"The cost multiplier for each floor transitioned.",minimum:1}),type:g.Ref(BP,{description:"The type of connection."})}),Xo,ti],{$id:"ConnectionsProperties"}),jP=g.Array(g.Ref(NP),{$id:"ConnectionsCollection"}),zG=g.Object({connections:g.Ref(jP)},{$id:"ConnectionsExtensionSchema"}),_P="connections.json",GP={name:"ext:connections",schema:zG,intoBundle:function*(e){e.connections!=null&&(yield{path:_P,contents:e.connections})},fromBundle:(e,r,t)=>{if(e===_P)return{connections:t(r)}},references:[NP,jP,BP,RP,rc,zb],integrityCheck:LP};d();d();var UP=e=>{if(e.defaultStyle==null)return oe(!0);let r=yr(e);for(let t of Object.values(e.defaultStyle))if(t!=null)for(let o of t.geometryAnchors){let n=r(o.floorId,o.geometryId);if(n.isErr())return n}return oe(!0)};var VP=g.Intersect([nf(),ti,g.Object({altitude:g.Number({description:"How far off the bottom of the floor the objects with this style should be drawn, in meters."}),color:g.String({pattern:"^#[0-9a-fA-F]{6}$",description:"Color should be represented with a hash (#), followed by 6 hexadecimal digits. ex: #RRGGBB"}),height:g.Number({minimum:0,description:"The height of the objects belonging to this layer, in meters."}),opacity:g.Number({minimum:0,maximum:1,description:"The opacity of the objects belonging to this layer, from 0 to 1."}),buffer:g.Number({description:"The buffer amount to apply to the geometry, in meters. This can be used to inflate line string geometry for walls, but might also be applicable as a way to grow or shrink polygon geometry for aesthetic purposes. Can be negative."}),hidden:g.Optional(g.Boolean({description:"Whether or not the objects with this style should be hidden."}))})],{$id:"DefaultStyle"}),$P=g.Record(g.String(),g.Ref(VP),{$id:"DefaultStyleCollection",additionalProperties:!1}),WG=g.Object({defaultStyle:g.Ref($P)},{$id:"DefaultStyleSchema"}),HP={name:"ext:mvf-default-style",schema:WG,intoBundle:function*(e){e.defaultStyle!=null&&(yield{path:"default-style.json",contents:e.defaultStyle})},fromBundle:(e,r,t)=>{if(e==="default-style.json")return{defaultStyle:t(r)}},references:[VP,$P],integrityCheck:UP};d();d();d();d();var Wb;(function(e){e.InvalidDefaultFloorError="InvalidDefaultFloorError"})(Wb||(Wb={}));var zP=e=>{if(e.floorStacks==null)return oe(!0);let r=er(e.floorStacks,o=>o.id,"floorStacks");if(r.isErr())return r;let t=ei(e);for(let o of e.floorStacks){for(let n of o.floors){let i=t(n);if(i.isErr())return i}if(o.defaultFloor!=null&&!o.floors.includes(o.defaultFloor))return ie({kind:Wb.InvalidDefaultFloorError,properties:{floorStackId:o.id,floorId:o.defaultFloor}})}return oe(!0)};var cf=qt("fs","FloorStackId"),ZP=g.Intersect([g.Object({id:g.Ref(cf,{description:"The unique identifier for the floor stack."}),floors:g.Array(g.Ref(Ve),{uniqueItems:!0,minItems:1,description:"The floors that are part of this floor stack."}),defaultFloor:g.Optional(g.Ref(Ve,{description:"The default floor for the floor stack."}))}),Xo],{$id:"FloorStacksProperties"}),XP=g.Array(g.Ref(ZP),{$id:"FloorStackCollection"}),ZG=g.Object({floorStacks:g.Ref(XP)},{$id:"FloorStackExtensionSchema"}),WP="floor-stacks.json",YP={name:"ext:floor-stacks",schema:ZG,intoBundle:function*(e){e.floorStacks!=null&&(yield{path:WP,contents:e.floorStacks})},fromBundle:(e,r,t)=>{if(e===WP)return{floorStacks:t(r)}},references:[cf,ZP,XP],integrityCheck:zP};d();d();var pf;(function(e){e.MissingFloorStackError="MissingFloorStackError",e.UnknownFloorStackError="UnknownFloorStackError"})(pf||(pf={}));var JP=e=>{if(e.facade==null)return oe(!0);if(e.floorStacks==null)return ie({kind:pf.MissingFloorStackError,properties:null});let r=new Set(e.floorStacks.map(n=>n.id)),t=yr(e),o=ei(e);for(let[n,i]of tt(e.facade)){if(i==null)continue;let a=o(n);if(a.isErr())return a;for(let l of i){let{floorStackId:c,geometryIds:p}=l;if(!r.has(c))return ie({kind:pf.UnknownFloorStackError,properties:{floorStackId:c}});for(let u of p){let f=t(n,u);if(f.isErr())return f}}}return oe(!0)};var KP=g.Intersect([g.Object({floorStackId:g.Ref(cf)}),ud],{$id:"Facade"}),XG=g.Object({facade:tr(g.Record(Ve,g.Array(g.Ref(KP)),{additionalProperties:!1}))},{$id:"FacadeExtensionSchema"}),YG=/^facade\/(.*)\.json$/,QP={name:"ext:facade",schema:XG,intoBundle:function*(e){if(e.facade!=null)for(let r of Ze(e.facade))yield{path:`facade/${r}.json`,contents:e.facade[r]}},fromBundle:(e,r,t)=>{let o=e.match(YG)?.[1];if(o)return{facade:{[o]:t(r)}}},references:[cf,KP],integrityCheck:JP};d();d();var qP=e=>{if(e.floorImages==null)return oe(!0);let r=yr(e);for(let[t,o]of tt(e.floorImages))if(o!=null)for(let n of o.features){if(!("geometryId"in n.properties))continue;let i=n.properties.geometryId,a=r(t,i);if(a.isErr())return a}return oe(!0)};var QI=g.Object({path:g.String({format:"uri",description:"The path to the image. This will be a remote URL."}),width:g.Number({minimum:0,description:"The width of the image when represented on the map, in meters."}),height:g.Number({minimum:0,description:"The height of the image when represented on the map, in meters."}),rotation:g.Number({minimum:0,maximum:360,description:"Rotation in degrees, about the center of the image. North is 0, east is 90."})},{$id:"BaseFloorImageProperties"}),eF=g.Intersect([g.Ref(QI),Cn],{$id:"AnchoredFloorImageProperties"}),tF=g.Intersect([g.Ref(QI),g.Object({verticalOffset:g.Number({minimum:0,description:"How high to position the image, in meters, relative to the ground plane."})})],{$id:"FloatingFloorImageProperties"}),rF=g.Union([eF,tF],{$id:"FloorImageProperties"}),oF=Ur(g.Ref(to),rF,{$id:"FloorImageFeature"}),nF=fo(g.Ref(oF),{$id:"FloorImageCollection"}),JG=g.Object({floorImages:tr(g.Record(Ve,g.Ref(nF),{additionalProperties:!1}))},{$id:"FloorImagesExtensionSchema"}),KG=/^floorImages\/(.*)\.geojson$/,iF={name:"ext:floor-images",schema:JG,intoBundle:function*(e){if(e.floorImages!=null)for(let r of Ze(e.floorImages))yield{path:`floorImages/${r}.geojson`,contents:e.floorImages[r]}},fromBundle:(e,r,t)=>{let o=e.match(KG)?.[1];if(o)return{floorImages:{[o]:t(r)}}},references:[QI,eF,tF,rF,oF,nF],integrityCheck:qP};d();d();var sF=e=>{if(e.kinds==null)return oe(!0);let r=yr(e);for(let[t,o]of tt(e.kinds))if(o!=null)for(let n of Ze(o)){let i=r(t,n);if(i.isErr())return i}return oe(!0)};var{values:oxe,schema:QG,record:nxe}=Ro(["room","hallway","wall","object","poi","area","window"],{$id:"Kind"}),aF=QG;var lF=tr(g.Record(ro,g.Ref(aF),{additionalProperties:!1,$id:"GeometryKinds"})),qG=g.Object({kinds:tr(g.Record(Ve,g.Ref(lF),{additionalProperties:!1}))},{$id:"KindsExtensionSchema"}),eU=/^kinds\/(.*)\.json$/,cF={name:"ext:kinds",schema:qG,intoBundle:function*(e){if(e.kinds!=null)for(let r of Ze(e.kinds))yield{path:`kinds/${r}.json`,contents:e.kinds[r]}},fromBundle:(e,r,t)=>{let o=e.match(eU)?.[1];if(o)return{kinds:{[o]:t(r)}}},references:[aF,lF],integrityCheck:sF};d();d();d();var Zb;(function(e){e.UnknownNeighbor="UnknownNeighbor"})(Zb||(Zb={}));var pF=e=>{if(e.nodes==null)return oe(!0);let r=er(e.nodes,n=>n.properties.id,"nodes");if(r.isErr())return r;let t=yr(e),o=lf(e);for(let[n,i]of tt(e.nodes)){if(i==null)continue;let a=new Set(i.features.map(l=>l.properties.id));for(let[l,c]of i.features.entries()){for(let p of c.properties.geometryIds){let u=t(n,p);if(u.isErr())return u}for(let[p,u]of c.properties.neighbors.entries()){if(!a.has(u.id))return ie({kind:Zb.UnknownNeighbor,properties:{floorId:n,nodeId:c.properties.id,neighborId:u.id}});let f=bd(u.flags,o,`nodes["${n}"].features[${l}].properties.neighbors[${p}]`);if(f.isErr())return f}}}return oe(!0)};var qI=qt("n","NodeId"),dF=g.Intersect([g.Object({id:g.Ref(qI,{description:"The unique identifier for the node."}),extraCost:g.Number({minimum:0,description:"The extra cost to traverse to the node, above the straight-line distance."})}),JI],{$id:"NodeNeighbor"}),uF=g.Intersect([g.Object({id:g.Ref(qI,{description:"The unique identifier for the node."}),neighbors:g.Array(g.Ref(dF),{description:"The neighbors of the node."})}),ud],{$id:"NodeProperties"}),mF=Ur(g.Ref(to),uF,{$id:"NodeFeature"}),fF=fo(g.Ref(mF),{$id:"NodeCollection"}),tU=g.Object({nodes:tr(g.Record(Ve,g.Ref(fF),{additionalProperties:!1}))},{$id:"NodesExtensionSchema"}),rU=/^nodes\/(.*)\.(geo)?json$/,hF={name:"ext:nodes",schema:tU,intoBundle:function*(e){if(e.nodes!=null)for(let r of Ze(e.nodes))yield{path:`nodes/${r}.geojson`,contents:e.nodes[r]}},fromBundle:(e,r,t)=>{let o=e.match(rU)?.[1];if(o)return{nodes:{[o]:t(r)}}},references:[qI,dF,uF,mF,fF],integrityCheck:pF};d();d();d();var Xb;(function(e){e.FloorInFloorStackError="FloorInFloorStackError"})(Xb||(Xb={}));var gF=e=>{if(e.outdoors==null)return oe(!0);let r=ei(e);for(let t of e.outdoors.floors){let o=r(t);if(o.isErr())return o;if(e.floorStacks!=null){for(let n of e.floorStacks)if(n.floors.includes(t))return ie({kind:Xb.FloorInFloorStackError,properties:{floorId:t,floorStackId:n.id}})}}return oe(!0)};var bF=g.Object({floors:g.Array(g.Ref(Ve),{uniqueItems:!0,description:"A list of floor IDs that should be considered to contain outdoor features."})},{$id:"Outdoors"}),oU=g.Object({outdoors:g.Ref(bF)},{$id:"OutdoorsExtensionSchema"}),yF="outdoors.json",xF={name:"ext:outdoors",schema:oU,intoBundle:function*(e){e.outdoors!=null&&(yield{path:yF,contents:e.outdoors})},fromBundle:(e,r,t)=>{if(e===yF)return{outdoors:t(r)}},references:[bF],integrityCheck:gF};d();d();d();var Yb;(function(e){e.TilesetDuplicateKeyError="TilesetDuplicateKeyError"})(Yb||(Yb={}));var vF=e=>{if(e.tileset==null)return oe(!0);let r=new Set;if(r.add(e.tileset.default.key),e.tileset.others)for(let t of e.tileset.others){if(r.has(t.key))return ie({kind:Yb.TilesetDuplicateKeyError,properties:{key:t.key}});r.add(t.key)}return oe(!0)};var eS=g.Object({key:g.String({minLength:1,description:"Unique identifier for the tileset style."}),name:g.String({minLength:1,description:"Display name of the tileset style."}),url:g.String({format:"uri",description:"URL of the tileset style."})},{$id:"TilesetStyle",description:"A tileset style definition."}),IF=g.Object({default:g.Ref(eS,{description:"The default tileset style, which should be used."}),others:g.Optional(g.Array(g.Ref(eS,{description:"Additional tileset styles that can be used."})))},{$id:"TilesetCollection"}),nU=g.Object({tileset:g.Ref(IF)},{$id:"TilesetExtensionSchema"}),SF={name:"ext:mvf-tileset",schema:nU,intoBundle:function*(e){e.tileset!=null&&(yield{path:"tileset.json",contents:e.tileset})},fromBundle:(e,r,t)=>{if(e==="tileset.json")return{tileset:t(r)}},references:[eS,IF],integrityCheck:vF};d();var TF=g.Object({},{$id:"WalkableProperties"}),CF=g.Object({},{$id:"NonWalkableProperties"}),MF=tr(g.Record(ro,g.Ref(TF),{$id:"WalkableGeometries",additionalProperties:!1})),wF=tr(g.Record(ro,g.Ref(CF),{$id:"NonWalkableGeometries",additionalProperties:!1})),iU=g.Object({walkable:tr(g.Record(Ve,g.Ref(MF),{additionalProperties:!1})),nonwalkable:tr(g.Record(Ve,g.Ref(wF),{additionalProperties:!1}))},{$id:"TraversabilitySchema"}),sU=/^walkable\/(.*)\.json$/,aU=/^nonwalkable\/(.*)\.json$/,OF={name:"ext:mvf-traversability",schema:iU,intoBundle:function*(e){if(e.walkable!=null)for(let r of Ze(e.walkable))yield{path:`walkable/${r}.json`,contents:e.walkable[r]};if(e.nonwalkable!=null)for(let r of Ze(e.nonwalkable))yield{path:`nonwalkable/${r}.json`,contents:e.nonwalkable[r]}},fromBundle:(e,r,t)=>{let o=e.match(sU)?.[1];if(o!=null)return{walkable:{[o]:t(r)}};let n=e.match(aU)?.[1];if(n!=null)return{nonwalkable:{[n]:t(r)}}},references:[TF,CF,MF,wF]};d();d();function EF(e){return e.replace(/^g_/,"s_")}function lU(e){return e.replace(/^g_/,"o_")}function cU(e){return e.replace(/^g_/,"w_")}function PF(e){return e.replace(/^loci_/,"eli_")}function uf(e){return e.replace(/^loc_/,"el_")}function Jb(e){return e.replace(/^lcat_/,"ec_")}function pU(e){return e.replace(/^g_/,"ar_")}function dU(e,r,t){switch(e.geometry.type){case"MultiPoint":case"MultiLineString":case"MultiPolygon":{let o=[],n=0,i=e.geometry.type.replace("Multi","");for(let a of e.geometry.coordinates)o.push({...e,geometry:{type:i,coordinates:a},properties:{...e.properties,id:`${r}-${n++}`,kind:t}});return o}default:return[{...e,properties:{...e.properties,id:r,kind:t}}]}}function df(e,r,t,o){let n=new Map;for(let{feature:i,floorId:a}of e){let l=i.properties.id,c=o.get(l);if(r.has(l)){let p=dU(i,t(l),c),u=p.map(h=>h.properties.id),f=u.map(h=>({geometryId:h,floorId:a}));n.set(l,{ids:u,features:p,anchors:f})}}return n}function FF(e){let r={space:new Map,obstruction:new Map,area:new Map,window:new Map};if(!e.geometry)return r;let t=uU(e),o=tt(e.geometry).flatMap(([c,p])=>(p?.features??[]).map(u=>({feature:u,floorId:c}))).flat(),n=new Set(Object.values(e.walkable??{}).filter(c=>c!==void 0).flatMap(Ze)),i=new Set(Object.values(e.nonwalkable??{}).filter(c=>c!==void 0).flatMap(Ze)),a=new Set(Array.from(t.entries()).filter(([c,p])=>p==="area").map(([c])=>c)),l=new Set(Array.from(t.entries()).filter(([c,p])=>p==="window").map(([c])=>c));return n.size>0&&(r.space=df(o,n,EF,t)),i.size>0&&(r.obstruction=df(o,i,lU,t)),a.size>0&&(r.area=df(o,a,pU,t)),l.size>0&&(r.window=df(o,l,cU,t)),n.size===0&&i.size===0&&a.size===0&&(r.space=df(o,new Set(o.map(c=>c.feature.properties.id)),EF,t)),r}function uU(e){let r=new Map(Object.values(e.kinds??{}).filter(t=>t!==void 0).flatMap(tt));for(let t of e.connections?.filter(o=>o.type!=="door")??[]){for(let o of t.entrances)r.set(o.geometryId,`connection.${t.type}`);for(let o of t.exits)r.set(o.geometryId,`connection.${t.type}`)}return r}function DF(e){let{nodesByGeometryId:r,incomingEdgesByNodeId:t}=mU(e),o=FF(e),n=fU(e),i=e.navigationFlags??{};return{geometryMaps:o,nodesByGeometryId:r,geometryFeatureById:n,navigationFlags:i,incomingEdgesByNodeId:t}}function mU(e){let r=new Map,t=new Map;for(let o of Object.values(e.nodes??{}))for(let n of o?.features??[]){if(n.properties.geometryIds.length>0)for(let i of n.properties.geometryIds){let a=r.get(i)??[];a.push(n.properties.id),r.set(i,a)}if(n.properties.neighbors.length>0)for(let i of n.properties.neighbors){let a=t.get(i.id);a!=null?a.push(i):t.set(i.id,[i])}}return{nodesByGeometryId:r,incomingEdgesByNodeId:t}}function fU(e){let r=new Map;for(let t of Object.values(e.geometry??{}))for(let o of t?.features??[])r.set(o.properties.id,o);return r}d();function kF(e,r){if(!e.annotations||!e.annotationSymbols||!e.geometry)return{};let t={};for(let[o,n]of tt(e.annotations)){if(!n||n.length===0||!e.geometry[o]||e.geometry[o].features.length===0)continue;let i=new Map(e.geometry[o].features.map(l=>[l.properties.id,l])),a={type:"FeatureCollection",features:[]};for(let l of n){let c=i.get(l.geometryId);if(!c||c.geometry.type!=="Point")continue;let p={id:l.id,externalId:l.externalId,symbolId:l.symbolKey};a.features.push({type:"Feature",geometry:c.geometry,properties:p})}t[o]=a}return{annotation:t}}d();function AF(e,{nodesByGeometryId:r}){let t={"connection.json":[],entrance:{}},o=e.navigationFlags?.[YI.accessible],n=e.navigationFlags?.[YI.outdoors],i=new Map(Object.values(e.geometry??{}).flatMap(a=>a?.features??[]).map(a=>[a.properties.id,a]));for(let a of e.connections??[]){if(tS(a,i)){let u=hU(a,i,r,n);for(let[f,h]of u)t.entrance[f]||(t.entrance[f]={type:"FeatureCollection",features:[]}),t.entrance[f].features.push(h);continue}let l=o!=null&&a.entrances.some(u=>qa(u,o))&&a.exits.some(u=>qa(u,o)),c=Array.from(new Set([...a.entrances.map(u=>r.get(u.geometryId)),...a.exits.map(u=>r.get(u.geometryId))].flat().filter(u=>u!=null))),p={id:a.id,externalId:a.details?.externalId??"",type:a.type,accessible:l,nodes:c};a.details?.name&&(p.details={name:a.details.name}),a.extra&&(p.extra=a.extra),t["connection.json"].push(p)}return t}function tS(e,r){return e.type==KI.door&&e.entrances.every(t=>r.get(t.geometryId)?.geometry.type==="LineString")}function hU(e,r,t,o){if(e.type!==KI.door)return[];let n=[];for(let i of e.entrances){let a=r.get(i.geometryId);if(a?.geometry.type==="LineString"){let l={type:"Feature",geometry:a.geometry,properties:{id:e.id,externalId:e.details?.externalId??"",isExterior:gU(e,o)}},c=e.details;c&&(l.properties.details={name:c.name,description:c.description},c.icon&&(l.properties.details.images=[{url:c.icon,altText:`${c.name} icon`}]));let p=t.get(i.geometryId);p&&p.length>0&&(l.properties.node=p[0]),n.push([i.floorId,l])}}return n}function gU(e,r){return e.entrances.some(t=>qa(t,r))||e.exits.some(t=>qa(t,r))}d();function _F(e,{geometryMaps:r,nodesByGeometryId:t}){let o={categories:[],locations:[],locationInstances:[],layers:[],venue:{slug:"",name:"",externalId:"",defaultLanguage:{name:"English",code:"en"},languages:[]}},n=e.manifest?.features[0];n&&(o.venue.defaultFloor=n.properties.defaultFloor,o.venue.tzid=n.properties.tzid,o.venue.name=n.properties.name,o.venue.defaultLanguage={name:n.properties.language??"English",code:n.properties.language??"en"});let i=e.cms?.venue;i&&(o.venue={...o.venue,slug:i.slug,name:i.details?.name??o.venue.name??n.properties.name,externalId:i.details?.externalId??"",defaultLanguage:i.defaultLanguage,languages:i.languages??[],countrycode:i.countrycode,coverImage:i.coverImage,logo:i.logo,icon:i.details?.icon,extra:i.extra,mappedinWebUrl:i.mappedinWebUrl,operationHours:i.operationHours,topLocations:i.topLocations});let a=new Map,l=e.locations??[],c=e.cms?.locations??[],p=e.cms?.categories??[],u=new Map((p??[]).map(O=>[O.categoryId,O]));if(l.length>0){let O=new Map(c.map(C=>[C.locationId,C]));for(let C of l){let E=O.get(C.id)??{};if(C){let _=C.details,G={id:E?.cmsId!==void 0?`el_${E?.cmsId}`:uf(C.id),name:_.name,externalId:_.externalId??"",type:E.type??"location",sortOrder:E.sortOrder??0,amenity:E.amenity,description:_.description,extra:C.extra,links:C.links,operationHours:C.openingHours,gallery:E.gallery,logo:C.logo,shortName:_.shortName,picture:E.picture,showFloatingLabelWhenImagePresent:E.showFloatingLabelWhenImagePresent,showLogo:E.showLogo,siblingGroups:E.siblingGroups,states:E.states,tags:E.tags,spaces:[],nodes:[],polygons:[]};if(C.phone&&(G.phone={number:C.phone}),E.primaryCategory){let N=u.get(E.primaryCategory);N&&(G.primaryCategory=N.id)}let R=LF(C.social);C.website&&(R.website=C.website.url),G.social=R;for(let N of C.geometryAnchors){let X=r.space.get(N.geometryId);if(X){let ee=new Set(X.features.filter(re=>re.geometry.type==="Polygon").map(re=>re.properties.id));for(let re of X.anchors)G.spaces.push({floor:re.floorId,id:re.geometryId}),ee.has(re.geometryId)&&G.polygons.push({map:re.floorId,id:re.geometryId})}let z=t.get(N.geometryId);for(let ee of z??[])G.nodes.push({map:N.floorId,id:ee})}o.locations.push(G);for(let N of C.categories)a.set(N,[...a.get(N)??[],C.id])}}}let f=e.cms?.locationInstances??[],h=e.locationInstances;if(h){let O=new Map(f.map(E=>[E.locationInstanceId,E])),C=[];for(let E of h){let _=O.get(E.id)??{};if(E){let G={id:PF(E.id),parent:_.parentId??uf(E.parentId),name:E.details?.name,externalId:E.details?.externalId,type:_.type,sortOrder:_.sortOrder,amenity:_.amenity,description:E.details?.description,extra:E.extra,links:E.links,operationHours:E.openingHours,gallery:_.gallery,picture:_.picture,showFloatingLabelWhenImagePresent:_.showFloatingLabelWhenImagePresent,showLogo:_.showLogo,siblingGroups:_.siblingGroups,states:_.states,tags:_.tags,logo:E.logo,shortName:E.details?.shortName};E.phone&&(G.phone={number:E.phone});let R=LF(E.social??[]);if(E.website&&(R.website=E.website.url),Object.keys(R).length>0&&(G.social=R),E.geometryAnchors?.length){let N=E.geometryAnchors.flatMap(X=>r.space.get(X.geometryId)?.anchors??[]);N.length>0&&(G.spaces=N.map(X=>({floor:X.floorId,id:X.geometryId})))}if(E.geometryAnchors){G.spaces=[],G.polygons=[],G.nodes=[];for(let N of E.geometryAnchors){let X=r.space.get(N.geometryId);if(X){let ee=new Set(X.features.filter(re=>re.geometry.type==="Polygon").map(re=>re.properties.id));for(let re of X.anchors)G.spaces.push({floor:re.floorId,id:re.geometryId}),ee.has(re.geometryId)&&G.polygons.push({map:re.floorId,id:re.geometryId})}let z=t.get(N.geometryId);for(let ee of z??[])G.nodes.push({map:N.floorId,id:ee})}}C.push(G)}}C.length>0&&(o.locationInstances=C)}let b=e.locationCategories;if(b){let O=[],C=new Map(b.map(R=>[R.id,R])),E=new Map((p??[]).map(R=>[R.categoryId,R])),_=new Map;for(let R of b){let N=C.get(R.parent);if(N){let X=_.get(N.id)??[];X.push(R.id),_.set(N.id,X)}}for(let R of b){let N=E.get(R.id);if(R){let X=(_.get(R.id)??[]).map(Jb),z={id:Jb(R.id),name:R.details.name,externalId:R.details.externalId??"",sortOrder:N?.sortOrder??0,children:X,locations:(a.get(R.id)??[]).map(uf),icon:R.details.icon,picture:N?.picture,color:N?.color,extra:R.extra,iconFromDefaultList:N?.iconFromDefaultList};O.push(z)}}o.categories=O;let G={};for(let R of l)G[uf(R.id)]=R.categories.map(Jb).filter(N=>N!==void 0);o.categoryPriorities=G}let x={};for(let[O,C]of Object.entries(e.defaultStyle??{}))if(C.buffer){let E=C.geometryAnchors.flatMap(_=>r.space.get(_.geometryId)?.anchors??[]);x[O]={edgeOffset:C.buffer,geometryAnchors:E}}Object.keys(x).length>0&&(o.enterpriseStyles=x);let T=new Map;for(let O of Object.values(e.cms?.layers??{}))if(O)for(let[C,E]of tt(O)){if(typeof E!="string")continue;let _=T.get(E)??{name:E,id:`ely_${E}`,spaces:[]};_.spaces.push(...r.space.get(C)?.anchors.map(G=>({floorId:G.floorId,spaceId:G.geometryId}))??[]),T.set(E,_)}T.size>0&&(o.layers=Array.from(T.values()));let v=[];for(let O of Object.values(e.cms?.textures??{}))for(let C of O){let E=r.space.get(C.geometryId)?.anchors;!E||E.length<1||C.face==="unknown"||C.surface==="unknown"||v.push({repeat:C.repeat,offset:C.offset,rotation:C.rotation,path:C.path,face:C.face,surface:C.surface,bounds:C.bounds,geometryAnchors:E})}v.length>0&&(o.textures=v);let I={};for(let[O,C]of Object.entries(e.cms?.floorText??{})){let E={type:"FeatureCollection",features:[]};for(let _ of C.features){if(_.properties.align==="unknown")continue;let G={align:_.properties.align,color:_.properties.color,fontFamily:_.properties.fontFamily,fontSize:_.properties.fontSize,rotation:_.properties.rotation,text:_.properties.text,visible:_.properties.visible};"geometryId"in _.properties?G.geometryId=_.properties.geometryId:G.verticalOffset=_.properties.verticalOffset,E.features.push({type:"Feature",geometry:_.geometry,properties:G})}E.features.length>0&&(I[O]=E)}Object.keys(I).length>0&&(o.floorText=I);let M={enterprise:o};if(e.cms?.textAreas){let O={};for(let[C,E]of tt(e.cms.textAreas)){let _={type:"FeatureCollection",features:[]};for(let G of E.features){if(G.properties.align==="unknown")continue;let R={align:G.properties.align,maxWidth:G.properties.maxWidth,maxHeight:G.properties.maxHeight,rotation:G.properties.rotation};"geometryId"in G.properties?R.anchorId=G.properties.geometryId:R.verticalOffset=G.properties.verticalOffset;let N={type:"Feature",geometry:G.geometry,properties:R};_.features.push(N)}O[C]=_}M.textAreas=O}return M}var yU=["facebook","instagram","twitter"];function LF(e){let r={};for(let{name:t,url:o}of e){let n=t.toLowerCase();yU.includes(n)&&(r[n]=o)}return r}d();var bU=e=>`fc_${e.slice(3)}`;function RF(e,{geometryMaps:r}){if(!e.facade)return{};let t={},o={};for(let[n,i]of tt(e.facade))if(i)for(let a of Object.values(i)){let{floorStackId:l,geometryIds:c}=a,p=bU(l);o[l]??(o[l]={id:p,spaces:[]}),o[l].spaces.push(...c.map(u=>({floorId:n,spaceId:r.space.get(u)?.ids[0]??""})))}return Object.keys(o).length>0&&(t.facade=o),t}d();function BF(e,r={}){let t={type:"FeatureCollection",features:[]},o=[];for(let n of e.floors.features)o.push({id:n.properties.id.replace(/^f_/,"m_"),externalId:n.properties.details?.externalId??"",elevation:n.properties.elevation,name:n.properties.details?.name??"",shortName:n.properties.details?.shortName??"",subtitle:n.properties.subtitle,maxHeight:n.properties.maxHeight}),t.features.push({type:"Feature",geometry:n.geometry,properties:{id:n.properties.id,externalId:n.properties.details?.externalId??"",elevation:n.properties.elevation,name:n.properties.details?.name??"",shortName:n.properties.details?.shortName??"",subtitle:n.properties.subtitle,maxHeight:n.properties.maxHeight}});return{"floor.geojson":t,"map.geojson":o}}d();function NF(e,{geometryMaps:r}){let t={},o={};for(let[n,i]of tt(e.floorImages??{})){let a={features:[],type:"FeatureCollection"};for(let l of i?.features??[])if("verticalOffset"in l.properties)a.features.push(l);else{let{geometryId:c,...p}=l.properties,u=r.space.get(c)?.ids[0]??r.obstruction.get(c)?.ids[0];if(!u)continue;let f={geometry:l.geometry,properties:{...p,anchorId:u},type:l.type};a.features.push(f)}o[n]=a}return Object.keys(o).length>0&&(t.floorImages=o),t}d();function jF(e,r={}){let t=[];for(let n of e?.floorStacks??[]){let i={id:n.id,floors:n.floors,maps:n.floors,externalId:n.details?.externalId??"",name:n.details?.name??"",shortName:n.details?.shortName??"",type:"Building"};n.defaultFloor&&(i.defaultFloor=n.defaultFloor),t.push(i)}if(e.outdoors&&e.outdoors.floors.length>0){let n={id:"outdoors",floors:e.outdoors.floors,maps:e.outdoors.floors,type:"Outdoor",name:"Outdoors",externalId:"outdoors"};t.push(n)}return{"floorstack.json":t,"mapstack.geojson":t}}d();d();var $F=hp(VF(),1),TU=e=>{let r=e.geometry.coordinates[0],t=0;for(let o=0;o<r.length-1;o++)t+=r[o][0]*r[o+1][1]-r[o+1][0]*r[o][1];return Math.abs(t/2)},CU=(e,r)=>{let[t,o]=e,n=r.geometry.coordinates[0],i=!1;for(let a=0,l=n.length-1;a<n.length;l=a++){let[c,p]=n[a],[u,f]=n[l];p>o!=f>o&&t<(u-c)*(o-p)/(f-p)+c&&(i=!i)}return i},MU=e=>{let r=e.geometry.coordinates[0],t=0,o=0;for(let n=0;n<r.length-1;n++)t+=r[n][0],o+=r[n][1];return{geometry:{coordinates:[t/(r.length-1),o/(r.length-1)]}}},wU=e=>{let r=TU(e),t=Number.isFinite(r)?Math.max(r,1):1;return Math.sqrt(t)*1e-6},Qb=e=>{try{let t=MU(e).geometry.coordinates;if(!CU(t,e)){let n=(0,$F.default)(e.geometry.coordinates,wU(e));return oe([n[0],n[1]])}return oe(t)}catch{return ie(new Error("Unable to calculate center of polygon"))}};function iS(e){return e?.geometry?.type==="Polygon"}function HF(e,{geometryMaps:r,nodesByGeometryId:t}){let o=DU(e.defaultStyle),n={},i={},a={},l={};for(let p of Ze(e.geometry)){let u=e.geometry[p];if(!u)continue;let f=[],h=[],b=[],x=[];for(let T of u.features){let v=T.properties.id,I=o.has(v),M=t.get(v)??[];for(let O of r.space.get(v)?.features??[])f.push(OU(O,M));for(let O of r.obstruction.get(v)?.features??[])h.push(EU(O,I));for(let O of r.area.get(v)?.features??[])b.push(PU(O,M));for(let O of r.window.get(v)?.features??[])x.push(FU(O))}f.length>0&&(n[p]={type:"FeatureCollection",features:f.filter(T=>T!==null)}),h.length>0&&(i[p]={type:"FeatureCollection",features:h.filter(T=>T!==null)}),b.length>0&&(a[p]={type:"FeatureCollection",features:b.filter(T=>T!==null)}),x.length>0&&(l[p]={type:"FeatureCollection",features:x.filter(T=>T!==null)})}let c={space:n,obstruction:i};return Object.keys(a).length>0&&(c.area=a),Object.keys(l).length>0&&(c.window=l),c}function OU(e,r){switch(e.geometry.type){case"MultiPoint":case"MultiLineString":case"MultiPolygon":return null}let t={type:"Feature",geometry:e.geometry,properties:{destinationNodes:r,id:e.properties.id,externalId:e.properties.details?.externalId??"",kind:e.properties.kind}};return e.properties.details&&(t.properties.details={name:e.properties.details.name,description:e.properties.details.description,images:e.properties.details.icon?[{url:e.properties.details.icon,altText:e.properties.details.name?`${e.properties.details.name} icon`:"icon"}]:void 0}),iS(t)&&(t.properties.center=Qb(t).unwrapOr(void 0)),t}function EU(e,r){switch(e.geometry.type){case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"Point":return null}let t=e.properties,o={type:"Feature",geometry:e.geometry,properties:{id:t.id,externalId:t.details?.externalId??"",entrances:[],kind:t.kind,footprintComponent:r}};return iS(o)&&(o.properties.center=Qb(o).unwrapOr(void 0)),t.details&&(o.properties.details={name:t.details.name,description:t.details.description,images:t.details.icon?[{url:t.details.icon,altText:t.details.name?`${t.details.name} icon`:"icon"}]:void 0}),o}function PU(e,r){if(e.geometry.type!=="Polygon")return null;let t=e.properties,o={type:"Feature",geometry:e.geometry,properties:{id:t.id,externalId:t.details?.externalId??"",destinationNodes:r}};return iS(o)&&(o.properties.center=Qb(o).unwrapOr(void 0)),t.details&&(o.properties.details={name:t.details.name,description:t.details.description,images:t.details.icon?[{url:t.details.icon,altText:t.details.name?`${t.details.name} icon`:"icon"}]:void 0}),o}function FU(e){return e.geometry.type!=="LineString"?null:{type:"Feature",geometry:e.geometry,properties:{id:e.properties.id}}}function DU(e){return new Set((e?.ExteriorWalls?.geometryAnchors??[]).map(t=>t.geometryId))}d();function zF(e,{geometryMaps:r,geometryFeatureById:t}){if(!e.locationCategories&&!e.locations)return{};let o={};if(e.locationCategories?.length){let n=[];for(let i of e.locationCategories){let a={id:i.id,name:i.details.name,icon:i.details.icon??""};i.parent&&(a.parent=i.parent),n.push(a)}o["category.json"]=n}if(e.locations?.length){let n=kU(e,{geometryFeatureById:t}),i=[];for(let a of e.locations){let l={id:a.id,name:a.details.name,categories:a.categories,spaces:[],obstructions:[],areas:[],annotations:[],connections:[],entrances:[],links:a.links,openingHoursSpecification:a.openingHours??[],pictures:a.images,social:a.social,description:a.details.description,externalId:a.details.externalId,icon:a.details.icon,logo:a.logo,phone:a.phone,website:a.website};i.push(l);for(let{geometryId:c,floorId:p}of a.geometryAnchors)l.spaces.push(...r.space.get(c)?.ids.map(u=>({id:u,floor:p}))??[]),l.obstructions.push(...r.obstruction.get(c)?.ids.map(u=>({id:u,floor:p}))??[]),l.areas.push(...r.area.get(c)?.ids.map(u=>({id:u,floor:p}))??[]),l.entrances.push(...n.entrancesByGeometryId.get(c)??[]),l.connections.push(...n.connectionsByGeometryId.get(c)??[]),l.annotations.push(...n.annotationsByGeometryId.get(c)??[])}o["location.json"]=i}return o}function kU(e,{geometryFeatureById:r}){let t={annotationsByGeometryId:new Map,connectionsByGeometryId:new Map,entrancesByGeometryId:new Map};if(e.annotations)for(let[o,n]of tt(e.annotations))for(let i of n??[]){let a=i.geometryId,l=i.id,c=t.annotationsByGeometryId.get(a)??[];c.push({floor:o,id:l}),t.annotationsByGeometryId.set(a,c)}if(e.connections)for(let o of e.connections){let n=tS(o,r),i=Array.from(new Map([...o.entrances,...o.exits].map(a=>[`${a.geometryId}_${a.floorId}`,a])).values());for(let a of i){let l=a.geometryId;if(n){let c=t.entrancesByGeometryId.get(l)??[];c.push({floor:a.floorId,id:o.id}),t.entrancesByGeometryId.set(l,c)}else{let c=t.connectionsByGeometryId.get(l)??[];c.push(o.id),t.connectionsByGeometryId.set(l,c)}}}return t}d();function WF(e,r){let t={features:[],type:"FeatureCollection"},o={"manifest.geojson":t},n=e.manifest;if(n.features.length>0){let i=n.features[0],a=i.properties,l={type:"Feature",geometry:i.geometry,properties:{folder_struct:[],version:"2.0.0",time:a.time,name:a.name,naturalBearing:a.naturalBearing,tzid:a.tzid,map:a.mapId,org_id:a.orgId,language:a.language}};t.features.push(l)}return o}d();function ZF(e,{geometryMaps:r,navigationFlags:t,incomingEdgesByNodeId:o}){let n={"node.geojson":{type:"FeatureCollection",features:[]}},i=n["node.geojson"].features,a=new Map;for(let p of e.floors?.features??[])a.set(p.properties.id,p.properties.elevation);let l=new Map;for(let p of Object.values(e.nodes??{}))for(let u of p?.features??[])for(let f of u.properties.geometryIds)l.set(f,[...l.get(f)??[],u.properties.id]);let c=new Map;for(let p of e.connections??[]){let u=p.exits.map(f=>({...f,nodes:l.get(f.geometryId)??[]}));for(let f of p.entrances){let h=l.get(f.geometryId)??[];for(let b of h)for(let x of u){let T=Math.abs((a.get(f.floorId)??0)-(a.get(x.floorId)??0))*p.floorCostMultiplier,v=c.get(b)??[];v.push(...x.nodes.map(I=>({id:I,weight:T+p.entryCost}))),c.set(b,v)}}}for(let[p,u]of tt(e.nodes??{}))for(let f of u?.features??[]){let h=r.space.get(f.properties.geometryIds[0])?.features[0],b=h?.geometry.type==="Point"&&h?.properties.details?.externalId?h.properties.details.externalId:"",x=o.get(f.properties.id)??[],T=Object.keys(t??{}),v=[];for(let M of x)for(let O of T)qa(M,t[O])&&v.push(t[O]);let I={type:"Feature",geometry:f.geometry,properties:{id:f.properties.id,floor:p,space:f.properties.geometryIds.map(M=>r.space.get(M)?.ids).flat().filter(M=>M!==void 0),neighbors:[...f.properties.neighbors.map(M=>({id:M.id,weight:M.extraCost})),...c.get(f.properties.id)??[]],map:p,externalId:b,flags:v.length>0?AU(v):void 0}};i.push(I)}return n}function AU(e){if(e==null||e.length===0)return;let r=new Array(Math.max(...e.map(t=>t.index))+1).fill(0);for(let t of e)r[t.index]|=1<<t.bit;return r}d();function LU(e,r){let t={};for(let o of e){let n=r.get(o);n&&(t[n]??(t[n]=[]),t[n].push(o))}return t}function XF(e,{geometryMaps:r}){if(!e.defaultStyle)return{};let t={},o={};t["styles.json"]=o;let n=[...Array.from(r.space.values()).map(a=>a.features),...Array.from(r.obstruction.values()).map(a=>a.features)],i=new Map(n.flatMap(a=>a.map(l=>[l.properties.id,l.geometry.type])));for(let[a,l]of tt(e.defaultStyle)){let c=LU(l.geometryAnchors.flatMap(p=>[...r.space.get(p.geometryId)?.ids??[],...r.obstruction.get(p.geometryId)?.ids??[]]),i);if(c.Point&&c.Point.length>0){let p={points:Array.from(c.Point.values()),showImage:l.extra?.showImage!==void 0?l.extra?.showImage===!0:l.opacity!==0};o[`${a}.Point`]=p}if(c.LineString&&c.LineString.length>0){let p={lineStrings:Array.from(c.LineString.values()),altitude:l.altitude,color:l.color,height:l.height,opacity:l.opacity,width:l.buffer};o[`${a}.LineString`]=p}if(c.Polygon&&c.Polygon.length>0){let p={polygons:Array.from(c.Polygon.values()),altitude:l.altitude,color:l.color,height:l.height,opacity:l.opacity};l.extra?.showImage!==void 0&&(p.showImage=l.extra.showImage===!0),o[`${a}.Polygon`]=p}}return t}var _U=DE().extendOptional(AP).extendOptional(hF).extendOptional(GP).extendOptional(cF).extendOptional(OF).extendOptional(HP).extendOptional(YP).extendOptional(xF).extendOptional(SF).extendOptional(iF).extendOptional(QP).extendOptional(_E).extendOptional(HE).extendOptional(EP).build({cspSafe:!0}).expect("Invalid parser, this should never happen. Likely a bug in the MVFv2 library, or one of the extensions.");function YF(e){let r=DF(e),t=BF(e,r),o=HF(e,r),n=ZF(e,r),i=AF(e,r),a=XF(e,r),l=jF(e,r),c=NF(e,r),p=RF(e,r),u=kF(e,r),f=zF(e,r),h=_F(e,r),b=WF(e,r);return{...t,...o,...n,...i,...a,...l,"tileset.json":e.tileset,...c,...p,...u,...f,...h,...b}}function sS(e){let r=_U.decompressUnsafeSync(e);return r.isOk()?oe(YF(r.value)):ie(r.error)}d();function xd(e){return e.endsWith("/")?e:`${e}/`}d();var vd="https://app.mappedin.com/",JF="https://auth.mappedin.com/";d();d();var RU=e=>{let r=Date.now();return e-r},qb=(e,r)=>RU(e)<=r*60*1e3;var QF=60,qF=QF*60*1e3,KF="accessTokens";async function mf(e,r=!1){let t=`${e.key}`,o=Es.getInstance(),n=o?.loadSessionData(KF)||{},i=Math.floor(Date.now()/1e3);if(n[t]&&!qb(n[t].expiresTimestamp*1e3,QF))return n[t];let a=r?await BU(e,i):await NU(e,i),l={...n,[t]:a};return o?.saveSessionData(KF,l),a}async function BU(e,r){let t=`${e.baseAuthUri??JF}oauth2/token`,o=await tn()(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({grant_type:"client_credentials",client_id:e.key,client_secret:e.secret})});if(!o.ok)throw new Error(`${o.status} ${o.statusText}: ${await o.text()}`);let n=await o.json();return{accessToken:n.access_token,expiresTimestamp:r+n.expires_in}}async function NU(e,r){let t=`${e.baseAuthUri?xd(e.baseAuthUri):vd}api/v1/api-key/token`,o=await tn()(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:e.key,secret:e.secret})});if(!o.ok)throw new Error(`${o.status} ${o.statusText}: ${await o.text()}`);let n=await o.json();return{accessToken:n.access_token,expiresTimestamp:r+n.expires_in}}d();var t5=60,r5=t5*60*1e3,e5="miSasTokens";async function aS(e,r){let t=`${r}__${e.mapId}`,o=Es.getInstance(),n=o?.loadSessionData(e5)||{};if(n[t]&&!qb(n[t].expires,t5))return n[t];let i=await jU(e,r),a={...n,[t]:{token:i.token,expires:new Date(i.expires).getTime()}};return o?.saveSessionData(e5,a),i}async function jU(e,r){let t=`${e.baseUri?xd(e.baseUri):vd}api/v1/venue/${e.mapId}/sas-token`,o=await tn()(t,{method:"GET",headers:{Authorization:`Bearer ${r}`}});if(!o.ok)throw new Error(`${o.status} ${o.statusText}: ${await o.text()}`);let n=await o.json();return{token:n.token,expires:new Date(n.expires).getTime()}}var o5=globalThis.fetch,GU=y?.env?.npm_package_version;function tn(){if(o5==null)throw new Error("fetch is not available in your environment. Pass your own function into `setFetchFn` (node-fetch, etc)");return o5}var lS={supplementaryUrl:"https://api-gateway.mappedin.com/analytics/",headers:{},accessToken:"",clientId:"",noAuth:!1,includeHidden:!0,clientSecret:"",apiGateway:"",authorization:"",perspective:"Website",language:"",venue:""};function i5(e){let r={...lS,...e};return r.headers={...r.headers,"mappedin-sdk-version":GU},r.things=[],"platformString"in e&&(r.headers={...r.headers,"mappedin-platform-version":e.platformString}),r.noAuth||(r.accessToken?r.authorization=`Bearer ${r.accessToken}`:r.clientId&&r.clientSecret&&(r.authorization=`Basic ${globalThis.btoa(`${r.clientId}:${r.clientSecret}`)}`)),r.language=r.language?.toLowerCase(),r}function UU(e,r,t=!1){let o={language:e.language,clientId:e.clientId,clientSecret:e.clientSecret};t&&delete o.language;let{headers:n}=e;n["Content-Type"]=n["Content-Type"]||"text/json",e.accessToken?n.Authorization=`Bearer ${e.accessToken}`:e.noAuth||e.clientId&&e.clientSecret&&(n["x-mappedin-key"]=btoa(e.clientId),n["x-mappedin-secret"]=btoa(e.clientSecret));let i={method:"GET",headers:n};return e.secure&&(r+="&withcdntoken"),{req:i,url:r}}async function VU(e,r,t=!1){let o=UU(e,r,t),n=await tn()(o.url,o.req);if(!n.ok)throw new Error(`${n.status} ${n.statusText}`);return n.json()}var $U=e=>{let r=e!=null&&typeof e=="object"&&"perspectives"in e&&e.perspectives!=null&&typeof e.perspectives=="object"?e.perspectives:null;if(r==null||Object.keys(r).length===0)return A.warn("No perspectives available in response!"),null;let t={};for(let[o,n]of Object.entries(r)){let i="url"in n&&typeof n.url=="string"?n.url:null,a="locale_packs"in n&&typeof n.locale_packs=="object"?n.locale_packs:null;if(i==null||a==null){A.warn(`Perspective ${o} is missing url or locale_packs!`);continue}t[o]={url:i,locale_packs:a}}return t};async function HU(e,r="exports/mvf/1/bundle"){let t=i5({baseUri:"https://api-gateway.mappedin.com/",...lS,...e}),o=`${t.baseUri+r}?venue=${t.venue}&version=${t.version??"2.0.0"}`;t.headers["Content-Type"]="application/zip";let n=await VU(t,o),i=n.url,a=n.locale_packs,l=t.perspective??lS.perspective,c=$U(n);if(l!=null&&l!==""&&c!=null){let p=c[l];p==null?A.warn(`Perspective ${l} not found in response! Loading default perspective instead.`):(A.log(`Loading perspective "${l}"`),i=p.url,a=p.locale_packs)}return{url:i,localePacks:a,updated_at:n.updated_at}}var Id=function(){let e;return()=>(e||(e=new TextDecoder),e)}();async function cS(e,{signal:r}){let t=await(await tn()(e,{signal:r})).arrayBuffer();return new Uint8Array(t)}async function Sd(e){let t=(await import("./browser-GGPMSNFY.js")).unzipSync(e),o={};if(t["enterprise/"]!=null){o.enterprise={};let n=t["enterprise/locations.json"];n&&(o.enterprise.locations=JSON.parse(Id().decode(n)));let i=t["enterprise/locationInstances.json"];i&&(o.enterprise.locationInstances=JSON.parse(Id().decode(i)));let a=t["enterprise/categories.json"];a&&(o.enterprise.categories=JSON.parse(Id().decode(a)))}return t["floorstack.json"]&&(o["floorstack.json"]=JSON.parse(Id().decode(t["floorstack.json"]))),t["floor.geojson"]&&(o["floor.geojson"]=JSON.parse(Id().decode(t["floor.geojson"]))),t["manifest.json"]&&(o["manifest.geojson"]=JSON.parse(Id().decode(t["manifest.json"]))),o}async function s5(e,{signal:r}){try{let t=await(await tn()(e,{signal:r})).arrayBuffer();if(r.aborted)return;let o=new Uint8Array(t);return await Sd(o)}catch(t){let o=new Error("downloadLanguagePack failed");throw o.cause=t,o}}function zU(e){let{mvfVersion:r,useDraftData:t}=e;if(r==="3.0.0")return t?"exports/mvf3-draft/1/bundle":"exports/mvf3/1/bundle";if(r==null||r==="2.0.0")return t?"exports/mvf2-draft/1/bundle":"exports/mvf2/1/bundle";if(r==="2.0.0-c")return t?"exports/mvf2c-draft/1/bundle":"exports/mvf2c/1/bundle";throw new Error(`Unsupported MVF version: ${r}`)}async function pS(e){return new Promise(async(r,t)=>{try{let o=zU(e),{url:n,localePacks:i}=await HU(e,o),a=await tn()(n).then(c=>c.arrayBuffer()),l=new Uint8Array(a);r({compressed:l,localePacks:i})}catch(o){t(o)}})}async function dS(e,r){return new Promise(async(t,o)=>{try{let{url:n}=await WU(e,r),i=await tn()(n).then(l=>l.arrayBuffer()),a=new Uint8Array(i);t(a)}catch(n){o(n)}})}async function WU(e,r){let t=new URL(`${e.baseUri?xd(e.baseUri):vd}api/v1/venue/${e.mapId}/mvf`);e.viewId&&t.searchParams.set("configId",e.viewId),e.mvfVersion&&t.searchParams.set("version",e.mvfVersion);let o=await tn()(t.toString(),{headers:{Authorization:`Bearer ${r}`}});if(!o.ok)throw new Error(`${o.status} ${o.statusText}`);return o.json()}function uS(e){let r=new TextDecoder,t=r.decode.bind(r);try{let o={"connection.json":JSON.parse(t(e["connection.json"])),"manifest.geojson":JSON.parse(t(e["manifest.geojson"])),"map.geojson":e["map.geojson"]?JSON.parse(t(e["map.geojson"])):void 0,"mapstack.geojson":e["mapstack.geojson"]?JSON.parse(t(e["mapstack.geojson"])):void 0,"node.geojson":JSON.parse(t(e["node.geojson"])),obstruction:{},space:{},entrance:{},facade:{},"tileset.json":e["tileset.json"]?JSON.parse(t(e["tileset.json"])):void 0,"navigationFlags.json":e["navigationFlags.json"]?JSON.parse(t(e["navigationFlags.json"])):void 0};if(e.enterprise!=null&&(o.enterprise={},e.enterprise?.["locations.json"]&&(o.enterprise.locations=JSON.parse(t(e.enterprise?.["locations.json"]))),e.enterprise?.["categories.json"]&&(o.enterprise.categories=JSON.parse(t(e.enterprise?.["categories.json"]))),e.enterprise?.["venue.json"]&&(o.enterprise.venue=JSON.parse(t(e.enterprise?.["venue.json"]))),e.enterprise?.["layers.json"]&&(o.enterprise.layers=JSON.parse(t(e.enterprise?.["layers.json"]))),e.enterprise?.["locationInstances.json"]&&(o.enterprise.locationInstances=JSON.parse(t(e.enterprise?.["locationInstances.json"]))),e.enterprise?.["enterpriseStyles.json"]&&(o.enterprise.enterpriseStyles=JSON.parse(t(e.enterprise?.["enterpriseStyles.json"]))),e.enterprise?.["textures.json"]&&(o.enterprise.textures=JSON.parse(t(e.enterprise?.["textures.json"]))),e.enterprise?.["floorText.json"]&&(o.enterprise.floorText=JSON.parse(t(e.enterprise?.["floorText.json"]))),e.enterprise?.["categoryPriorities.json"]&&(o.enterprise.categoryPriorities=JSON.parse(t(e.enterprise?.["categoryPriorities.json"])))),e["floorstack.json"]!=null?o["floorstack.json"]=JSON.parse(t(e["floorstack.json"])):e["mapstack.json"]!=null&&(o["mapstack.json"]=JSON.parse(t(e["mapstack.json"]))),o["floorstack.json"]==null&&o["mapstack.json"]==null&&o["mapstack.geojson"]==null)throw new Error("MVF is missing floorstack.json or mapstack.json/mapstack.geojson");if(e["floor.geojson"]&&(o["floor.geojson"]=JSON.parse(t(e["floor.geojson"]))),o["floor.geojson"]==null&&o["map.geojson"]==null)throw new Error("MVF is missing floor.geojson or map.geojson");if("styles.json"in e&&(o["styles.json"]=JSON.parse(t(e["styles.json"]))),"shapes.json"in e&&(o["shapes.json"]=JSON.parse(t(e["shapes.json"]))),"location.json"in e&&(o["location.json"]=JSON.parse(t(e["location.json"]))),"category.json"in e&&(o["category.json"]=JSON.parse(t(e["category.json"]))),e.annotation!=null){o.annotation={};let i=Object.keys(e.annotation);for(let a of i){let l=a.replace(/\.json|\.geojson/g,"");o.annotation[l]=JSON.parse(t(e.annotation[a]))}}let n=Object.keys(e.space);for(let i of n){let a=i.replace(/\.json|\.geojson/g,"");o.space[a]=JSON.parse(t(e.space[i]))}if(e.obstruction!=null){let i=Object.keys(e.obstruction);for(let a of i){let l=a.replace(/\.json|\.geojson/g,"");o.obstruction[l]=JSON.parse(t(e.obstruction[a]))}}else o.obstruction={};if(e.entrance!=null){let i=Object.keys(e.entrance);for(let a of i){let l=a.replace(/\.json|\.geojson/g,"");o.entrance[l]=JSON.parse(t(e.entrance[a]))}}else o.entrance={};if("floorImages"in e&&e.floorImages!=null){o.floorImages={};for(let i of Object.keys(e.floorImages)){let a=i.replace(/\.json|\.geojson/g,"");o.floorImages[a]=JSON.parse(t(e.floorImages[i]))}}if("textAreas"in e&&e.textAreas!=null){o.textAreas={};for(let i of Object.keys(e.textAreas)){let a=i.replace(/\.json|\.geojson/g,"");o.textAreas[a]=JSON.parse(t(e.textAreas[i]))}}if("facade"in e&&e.facade!=null){o.facade={};for(let i of Object.keys(e.facade)){let a=i.replace(/\.json|\.geojson/g,"");o.facade[a]=JSON.parse(t(e.facade[i]))}}if("area"in e&&e.area!=null){o.area={};for(let i of Object.keys(e.area)){let a=i.replace(/\.json|\.geojson/g,"");o.area[a]=JSON.parse(t(e.area[i]))}}return o}catch(o){throw A.error(o),new Error("MVF parsing failed! Probably encountered a bad file.")}}function ZU(e){if(e==null||typeof e!="object")return!1;let r=["connection.json","manifest.geojson","floor.geojson"in e?"floor.geojson":"map.geojson","node.geojson","floorstack.json"in e?"floorstack.json":"mapstack.json"in e?"mapstack.json":"mapstack.geojson"];"styles.json"in e&&r.push("styles.json"),"shapes.json"in e&&r.push("shapes.json");for(let t of r)if(e[t]==null||e[t][Symbol.toStringTag]!=="Uint8Array")return!1;return!0}async function mS(e){return new Promise(async(r,t)=>{try{if(e==null||typeof e!="object")throw new Error("Error parsing data! Unzipping failed.");if(e[Symbol.toStringTag]!=="Uint8Array")throw new Error("Unexpected file type! Unzipping failed.");let n=(await import("./browser-GGPMSNFY.js")).unzipSync(e);if(!ZU(n))throw new Error("MVF is missing some expect static files. Unzipping failed.");let i={},a=Object.keys(n);for(let l of a){if(n[l].length===0)continue;let c=l.split("/");if(c.length<0)throw new Error("Encounted a file with no name! Unzipping failed.");if(c.length>2)throw new Error("Encountered unexpected nesting in MVF! Unzipping failed.");if(c.length===1){i[c[0]]=n[l];continue}if(c[0]==="image"){A.warn("MVF unzipping encountered an image. Ignoring as this case has not been implemented.");continue}else i[c[0]]==null&&(i[c[0]]={}),i[c[0]][c[1]]=n[l]}r(i)}catch(o){t(o)}})}function tl(){let e="us",r={};function t(){return QU(eV(e),r)}return{updateByUserOption(o){o.environment&&(e=o.environment),o.baseUri&&(r.baseUri=o.baseUri),o.baseAuthUri&&(r.baseAuthUri=o.baseAuthUri),o.analytics?.baseUri&&(r.analyticsBaseUri=o.analytics?.baseUri)},updateTileServerBaseUrl(o){r.tileServerUri=o},updateEnvironment(o){e=o},setEnterprise(o){(e==="us"||e==="us-enterprise")&&(e=o?"us-enterprise":"us")},getBaseUri(){return t().baseUri},getBaseAuthUri(){return t().baseAuthUri},getAnalyticsBaseUri(){return t().analyticsBaseUri},getTileServerUri(){return t().tileServerUri},reset(){e="us",r={}},__getState:t}}var a5=Object.freeze({baseUri:"https://app.mappedin.com/",baseAuthUri:"https://app.mappedin.com/",analyticsBaseUri:"https://api-gateway.mappedin.com/track-analytics/a/",tileServerUri:"https://tiles-cdn.mappedin.com/styles/mappedin/style.json"}),XU=Object.freeze({...a5,baseUri:"https://api-gateway.mappedin.com/",baseAuthUri:"https://auth.mappedin.com/"}),YU=Object.freeze({baseUri:"https://api-gateway.eu.mappedin.com/",baseAuthUri:"https://auth.eu.mappedin.com/",analyticsBaseUri:"https://api-gateway.eu.mappedin.com/track-analytics/a/",tileServerUri:"https://tiles-cdn.eu.mappedin.com/styles/mappedin/style.json"}),JU=Object.freeze({baseUri:"https://api-gateway-staging.mappedin.net/",baseAuthUri:"https://auth-staging.mappedin.net/",analyticsBaseUri:"https://api-gateway-staging.mappedin.net/track-analytics/a/",tileServerUri:"https://tiles-cdn.mappedin.com/styles/mappedin/style.json"}),KU=Object.freeze({baseUri:"https://app-staging.mappedin.net/",baseAuthUri:"https://app-staging.mappedin.net/",analyticsBaseUri:"https://api-gateway-staging.mappedin.net/track-analytics/a/",tileServerUri:"https://tiles-cdn.mappedin.com/styles/mappedin/style.json"});function QU(e,r){return{...e,...r}}var qU={eu:YU,us:a5,"us-enterprise":XU,"us-staging-enterprise":JU,"us-staging-self-serve":KU};function eV(e){return qU[e]}var e1=e=>{let r=Object.values(e["floorstack.json"]??e["mapstack.json"]??{});return r.length===1?[]:r.filter(t=>t.type!=="Outdoor").map(t=>t.id.replace("fs_","").replace("ms_",""))},n5=async e=>{let r=performance.now(),t=sS(e);return A.log(`Parsed MVFv3 in ${performance.now()-r}ms`),t.inspectErr(n=>{throw A.error(n),new Error("MVFv3 parsing failed!")}),t.unwrap()};async function t1(e,r="2.0.0"){switch(r){case"2.0.0":case"2.0.0-c":try{let t=await mS(e);return uS(t)}catch{return n5(e)}case"3.0.0":return n5(e);default:throw new Error(`Unsupported MVF version: ${r}`)}}d();d();d();function Mn(e){if(!e)throw new Error("coord is required");if(!Array.isArray(e)){if(e.type==="Feature"&&e.geometry!==null&&e.geometry.type==="Point")return e.geometry.coordinates;if(e.type==="Point")return e.coordinates}if(Array.isArray(e)&&e.length>=2&&!Array.isArray(e[0])&&!Array.isArray(e[1]))return e;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function rn(e){if(Array.isArray(e))return e;if(e.type==="Feature"){if(e.geometry!==null)return e.geometry.coordinates}else if(e.coordinates)return e.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function Td(e){return e.type==="Feature"?e.geometry:e}function l5(e,r){return e.type==="FeatureCollection"?"FeatureCollection":e.type==="GeometryCollection"?"GeometryCollection":e.type==="Feature"&&e.geometry!==null?e.geometry.type:e.type}function tV(e,r,t){t===void 0&&(t={});for(var o=Mn(e),n=rn(r),i=0;i<n.length-1;i++){var a=!1;if(t.ignoreEndVertices&&(i===0&&(a="start"),i===n.length-2&&(a="end"),i===0&&i+1===n.length-1&&(a="both")),rV(n[i],n[i+1],o,a,typeof t.epsilon>"u"?null:t.epsilon))return!0}return!1}function rV(e,r,t,o,n){var i=t[0],a=t[1],l=e[0],c=e[1],p=r[0],u=r[1],f=t[0]-l,h=t[1]-c,b=p-l,x=u-c,T=f*x-h*b;if(n!==null){if(Math.abs(T)>n)return!1}else if(T!==0)return!1;if(o){if(o==="start")return Math.abs(b)>=Math.abs(x)?b>0?l<i&&i<=p:p<=i&&i<l:x>0?c<a&&a<=u:u<=a&&a<c;if(o==="end")return Math.abs(b)>=Math.abs(x)?b>0?l<=i&&i<p:p<i&&i<=l:x>0?c<=a&&a<u:u<a&&a<=c;if(o==="both")return Math.abs(b)>=Math.abs(x)?b>0?l<i&&i<p:p<i&&i<l:x>0?c<a&&a<u:u<a&&a<c}else return Math.abs(b)>=Math.abs(x)?b>0?l<=i&&i<=p:p<=i&&i<=l:x>0?c<=a&&a<=u:u<=a&&a<=c;return!1}var c5=tV;d();function oV(e,r){r===void 0&&(r={});var t=vp(e),o=(t[0]+t[2])/2,n=(t[1]+t[3])/2;return Di([o,n],r.properties,r)}var Cd=oV;d();d();function nV(e,r,t){t===void 0&&(t={});var o=Mn(e),n=Mn(r),i=Po(n[1]-o[1]),a=Po(n[0]-o[0]),l=Po(o[1]),c=Po(n[1]),p=Math.pow(Math.sin(i/2),2)+Math.pow(Math.sin(a/2),2)*Math.cos(l)*Math.cos(c);return AC(2*Math.atan2(Math.sqrt(p),Math.sqrt(1-p)),t.units)}var rl=nV;function r1(e,r){return r===void 0&&(r={}),RC(e,function(t,o){var n=o.geometry.coordinates;return t+rl(n[0],n[1],r)},0)}d();d();d();function o1(e,r,t){if(t===void 0&&(t={}),t.final===!0)return iV(e,r);var o=Mn(e),n=Mn(r),i=Po(o[0]),a=Po(n[0]),l=Po(o[1]),c=Po(n[1]),p=Math.sin(a-i)*Math.cos(c),u=Math.cos(l)*Math.sin(c)-Math.sin(l)*Math.cos(c)*Math.cos(a-i);return mm(Math.atan2(p,u))}function iV(e,r){var t=o1(r,e);return t=(t+180)%360,t}d();function oc(e,r,t,o){o===void 0&&(o={});var n=Mn(e),i=Po(n[0]),a=Po(n[1]),l=Po(t),c=LC(r,o.units),p=Math.asin(Math.sin(a)*Math.cos(c)+Math.cos(a)*Math.sin(c)*Math.cos(l)),u=i+Math.atan2(Math.sin(l)*Math.sin(c)*Math.cos(a),Math.cos(c)-Math.sin(a)*Math.sin(p)),f=mm(u),h=mm(p);return Di([f,h],o.properties)}d();d();function sV(e){if(!e)throw new Error("geojson is required");var r=[];return ki(e,function(t){aV(t,r)}),jl(r)}function aV(e,r){var t=[],o=e.geometry;if(o!==null){switch(o.type){case"Polygon":t=rn(o);break;case"LineString":t=[rn(o)]}t.forEach(function(n){var i=lV(n,e.properties);i.forEach(function(a){a.id=r.length,r.push(a)})})}}function lV(e,r){var t=[];return e.reduce(function(o,n){var i=Ps([o,n],r);return i.bbox=cV(o,n),t.push(i),n}),t}function cV(e,r){var t=e[0],o=e[1],n=r[0],i=r[1],a=t<n?t:n,l=o<i?o:i,c=t>n?t:n,p=o>i?o:i;return[a,l,c,p]}var fS=sV;var O5=hp(M5(),1);function RV(e,r){var t={},o=[];if(e.type==="LineString"&&(e=T0(e)),r.type==="LineString"&&(r=T0(r)),e.type==="Feature"&&r.type==="Feature"&&e.geometry!==null&&r.geometry!==null&&e.geometry.type==="LineString"&&r.geometry.type==="LineString"&&e.geometry.coordinates.length===2&&r.geometry.coordinates.length===2){var n=w5(e,r);return n&&o.push(n),jl(o)}var i=(0,O5.default)();return i.load(fS(r)),C0(fS(e),function(a){C0(i.search(a),function(l){var c=w5(a,l);if(c){var p=rn(c).join(",");t[p]||(t[p]=!0,o.push(c))}})}),jl(o)}function w5(e,r){var t=rn(e),o=rn(r);if(t.length!==2)throw new Error("<intersects> line1 must only contain 2 coordinates");if(o.length!==2)throw new Error("<intersects> line2 must only contain 2 coordinates");var n=t[0][0],i=t[0][1],a=t[1][0],l=t[1][1],c=o[0][0],p=o[0][1],u=o[1][0],f=o[1][1],h=(f-p)*(a-n)-(u-c)*(l-i),b=(u-c)*(i-p)-(f-p)*(n-c),x=(a-n)*(i-p)-(l-i)*(n-c);if(h===0)return null;var T=b/h,v=x/h;if(T>=0&&T<=1&&v>=0&&v<=1){var I=n+T*(a-n),M=i+T*(l-i);return Di([I,M])}return null}var wd=RV;function BV(e,r,t){t===void 0&&(t={});var o=Di([1/0,1/0],{dist:1/0}),n=0;return ki(e,function(i){for(var a=rn(i),l=0;l<a.length-1;l++){var c=Di(a[l]);c.properties.dist=rl(r,c,t);var p=Di(a[l+1]);p.properties.dist=rl(r,p,t);var u=rl(c,p,t),f=Math.max(c.properties.dist,p.properties.dist),h=o1(c,p),b=oc(r,f,h+90,t),x=oc(r,f,h-90,t),T=wd(Ps([b.geometry.coordinates,x.geometry.coordinates]),Ps([c.geometry.coordinates,p.geometry.coordinates])),v=null;T.features.length>0&&(v=T.features[0],v.properties.dist=rl(r,v,t),v.properties.location=n+rl(c,v,t)),c.properties.dist<o.properties.dist&&(o=c,o.properties.index=l,o.properties.location=n),p.properties.dist<o.properties.dist&&(o=p,o.properties.index=l+1,o.properties.location=n+u),v&&v.properties.dist<o.properties.dist&&(o=v,o.properties.index=l),n+=u}}),o}var hf=BV;function NV(e,r,t){var o=rn(t);if(l5(t)!=="LineString")throw new Error("line must be a LineString");var n=hf(t,e),i=hf(t,r),a;n.properties.index<=i.properties.index?a=[n,i]:a=[i,n];for(var l=[a[0].geometry.coordinates],c=a[0].properties.index+1;c<a[1].properties.index+1;c++)l.push(o[c]);return l.push(a[1].geometry.coordinates),Ps(l,t.properties)}var OS=NV;var jV=1e-7;function ES(e){return{type:"Point",coordinates:e}}function GV(e,r){let{coordinates:t}=r.geometry,{coordinates:o}=e.geometry,n=t.map(i=>hf(e,ES(i)));return o.reduce((i,a)=>{let l=OS(ES(a),n[0],e),c=OS(ES(a),n[1],e),p=r1(l)<r1(c)?l:c;return p.properties={...e.properties,entrances:[]},i.concat([p])},[])}function PS(e,r){return r.reduce((t,o)=>{let n={epsilon:jV},i=t.obstructions.findIndex(l=>c5(Cd(o),l,n)),a=t.obstructions[i];if(a){let[l,c]=GV(a,o);t.entrances.push(o),t.obstructions.splice(i,1,l,c)}return t},{obstructions:[e],entrances:[]})}d();d();d();var xr=class{constructor(r){m(this,"id");this.id=r}};d();d();var Od=class Od{constructor(r,t,o){m(this,"__type",Od.__type);m(this,"id",ut());m(this,"latitude");m(this,"longitude");m(this,"floorId");m(this,"verticalOffset");if(typeof r=="object")this.latitude=r.latitude,this.longitude=r.longitude,this.floorId=r.floorId,this.verticalOffset=r.verticalOffset??0;else{if(t==null)throw new Error("Coordinate longitude is required.");this.latitude=r,this.longitude=t,this.floorId=o,this.verticalOffset=0}}static is(r){return r.__type===Od.__type}get anchorTarget(){return this}get focusTarget(){return this}isEqual(r){return this.latitude===r.latitude&&this.longitude===r.longitude&&this.floorId===r.floorId}toJSON(){return{__type:Od.__type,latitude:this.latitude,longitude:this.longitude,floorId:this.floorId,verticalOffset:this.verticalOffset}}destroy(){}};m(Od,"__type","coordinate");var FS=Od,fe=FS;function DS(e){let r=e.enterprise?.locations?.reduce((n,i)=>(n[i.id]=i,n),{})||{};for(let n of e.enterprise?.locationInstances||[])r[n.id]=n;let t={};for(let n of e["floorstack.json"]||[])t[n.id]=n;let o={};for(let n of e["floor.geojson"]?.features||[])n.properties&&n.properties.id&&(o[n.properties.id]=n.properties);return{type:"downloaded",data:e,optimized:{"enterprise-location":r,"enterprise-category":e.enterprise?.categories?.reduce((n,i)=>(n[i.id]=i,n),{})||{},"floor-stack":t,floor:o}}}function E5(e){return/^https?:\/\/cdn\.mappedin\.com/.test(e)}function P5(e){return!!e.split("?")[1]?.includes("sv=")}function Dr(e,r){let t=e?.properties?.id||"unknown";if(e.geometry==null)return A.error(`Cannot get the center coordinate for "${t}" because it has no geometry.`),new fe({latitude:0,longitude:0,floorId:r});try{if(e.geometry.type==="LineString"){let[[o,n],[i,a]]=e.geometry.coordinates,l=(o+i)/2,c=(n+a)/2;return new fe({latitude:c,longitude:l,floorId:r})}else if(e.geometry.type==="Point"){let[o,n]=e.geometry.coordinates;return new fe({latitude:n,longitude:o,floorId:r})}else if(e.geometry.type==="Polygon"){let o=e;if(o.properties.center!=null){let[n,i]=o.properties.center;return new fe({latitude:i,longitude:n,floorId:r})}}}catch{}try{let[o,n]=Cd(e).geometry.coordinates;return new fe({latitude:n,longitude:o,floorId:r})}catch(o){return A.error(`Failed to get center coordinate for "${t}" ${o instanceof Error?o.stack:""}`),new fe({latitude:0,longitude:0,floorId:r})}}function F5(e,r){return r&&(e.flags[r.index]&1<<r.bit)!==0}var ni,kr,nc,Qs,Ed=class Ed extends xr{constructor(t,o){super(o.mvfData.properties.id);m(this,"__type",Ed.__type);S(this,ni);S(this,kr,{});S(this,nc);S(this,Qs);w(this,ni,t),w(this,nc,o.floorId),w(this,Qs,o.mvfData)}static is(t){return t.__type===Ed.__type}get locations(){return s(this,kr).locations?s(this,kr).locations:(s(this,kr).locations=(s(this,ni).locationIdsByNodeId[this.id]||[]).map(t=>s(this,ni).getById("enterprise-location",t)).filter(Boolean),s(this,kr).locations)}get space(){return s(this,ni).getById("space",s(this,ni).spaceIdsByNodeId[this.id]?.[0])}get floor(){let t=s(this,ni).getById("floor",s(this,nc));if(t==null)throw new Error(`Floor ${s(this,nc)} not found!`);return t}get coordinate(){return s(this,kr).coordinate==null&&(s(this,kr).coordinate=Dr(s(this,Qs),s(this,nc))),s(this,kr).coordinate}get externalId(){return s(this,Qs).properties.externalId??""}get neighbors(){if(s(this,kr).neighbors==null){let t=s(this,Qs).properties.neighbors.map(o=>{let n=s(this,ni).getById("node",o.id);if(n==null)throw new Error(`Node ${o.id} not found!`);return n});s(this,kr).neighbors=t}return s(this,kr).neighbors}get navigationFlags(){if(s(this,kr).navigationFlags==null){let t=[],o=s(this,Qs).properties.flags;if(o!=null&&o.length>0)for(let[n,i]of Object.entries(s(this,ni).navigationFlags))o.length>i.index&&o[i.index]!=null&&F5({flags:o},i)&&t.push(n);s(this,kr).navigationFlags=Object.freeze(t)}return s(this,kr).navigationFlags}get geoJSON(){return{...s(this,Qs),properties:null}}get focusTarget(){return this.coordinate}get anchorTarget(){return this.coordinate}toJSON(){return{__type:Ed.__type,id:this.id,floor:this.floor.id,coordinate:this.coordinate.toJSON(),neighbors:this.neighbors.map(t=>t.id)}}destroy(){for(let t of Object.keys(s(this,kr)))delete s(this,kr)[t]}};ni=new WeakMap,kr=new WeakMap,nc=new WeakMap,Qs=new WeakMap,m(Ed,"__type","node");var kS=Ed,wn=kS;d();d();d();d();var gf,qs,Pd=class Pd extends xr{constructor(t){super(String(ut()));m(this,"__type",Pd.__type);S(this,gf,{});S(this,qs);w(this,qs,t.mvfData)}static is(t){return t.__type===Pd.__type}get url(){return s(this,qs).url}get name(){if("displayName"in s(this,qs))return s(this,qs).displayName;if("label"in s(this,qs))return s(this,qs).label}toJSON(){return{__type:Pd.__type,id:this.id,url:this.url,name:this.name}}destroy(){for(let t of globalThis.Object.keys(s(this,gf)))delete s(this,gf)[t]}};gf=new WeakMap,qs=new WeakMap,m(Pd,"__type","hyperlink");var AS=Pd,ic=AS;d();d();function yf(e){return typeof e=="string"?e:e.id}function _S(e){return Array.isArray(e)&&Number.isFinite(e[0])&&Number.isFinite(e[1])}var LS=8,Qi=e=>typeof e=="number"?e.toFixed(LS):_S(e)?e[1].toFixed(LS)+"-"+e[0].toFixed(LS):e.map(r=>Qi(r)).join("-"),UV=/^https:\/\/cdn\.mappedin\.com\/category-symbols\/.+$/,VV=/^https:\/\/cdn-staging\.mappedin\.net\/category-symbols\/.+$/,$V=e=>UV.test(e)||VV.test(e),HV=/^https:\/\/cdn\.mappedin\.com\/[^/]+\/[^/]+\.[a-zA-Z0-9]+$/,zV=/^https:\/\/cdn-staging\.mappedin\.net\/[^/]+\/[^/]+\.[a-zA-Z0-9]+$/,WV=e=>$V(e)?!1:HV.test(e)||zV.test(e),a1=e=>{if(!WV(e))return null;let r="";e.startsWith("https://")?(r="https://",e=e.slice(8)):e.startsWith("http://")&&(r="http://",e=e.slice(7));let[t,o,n]=e.split("/"),i=n.split(".").pop()??"";return{origin:r+t,mapId:o,fileName:n,fileType:i}};var bf,nl,sc,Fd=class Fd extends xr{constructor(t){super(String(ut()));m(this,"__type",Fd.__type);S(this,bf,{});S(this,nl);S(this,sc);w(this,nl,t.mvfData),w(this,sc,t.mapData)}static is(t){return t.__type===Fd.__type}get url(){let t=s(this,nl).url;if(s(this,sc).tokenManager==null)return t;let o=a1(s(this,nl).url);if(o==null)return t;let n=o.mapId;try{if(s(this,sc).tokenManager.isEnterpriseMode())return t;let i=s(this,sc).tokenManager.getSasToken(n).token;if(i==null||i==="")throw new Error("SAS token empty!");return`${t}?${i}`}catch(i){return o.fileType!=="svg"&&A.error("Error getting SAS token for image",{error:i,url:t}),t}}get name(){return s(this,nl).altText}get altText(){return s(this,nl).altText}toJSON(){return{__type:Fd.__type,id:this.id,url:this.url,name:this.name}}destroy(){for(let t of globalThis.Object.keys(s(this,bf)))delete s(this,bf)[t]}};bf=new WeakMap,nl=new WeakMap,sc=new WeakMap,m(Fd,"__type","image");var RS=Fd,ac=RS;d();var lc,ii=class{constructor(r,t){m(this,"id");S(this,lc);this.id=r}get geoJSONBoundingBox(){return s(this,lc)?s(this,lc):"bbox"in this.geoJSON.geometry&&this.geoJSON.geometry.bbox?this.geoJSON.geometry.bbox:(w(this,lc,vp(this.geoJSON)),s(this,lc))}get geoJSON(){return{properties:null,type:"Feature",geometry:{type:"Polygon",coordinates:[[]]}}}};lc=new WeakMap;var Dd,ea,ta,Zr=class extends ii{constructor(t,o){super(o.properties.id,t);S(this,Dd);S(this,ea);S(this,ta,{});w(this,Dd,t),w(this,ea,o)}get externalId(){return s(this,ea).properties.externalId??""}get name(){let t=s(this,ea).properties.details?.name??"";return t===""&&(t=this.locationProfiles.find(o=>o.name&&o.name.length>0)?.name??""),t}get description(){let t=s(this,ea).properties.details?.description??"";return t===""&&(t=this.locationProfiles.find(o=>o.description&&o.description.length>0)?.description??""),t}get images(){if(s(this,ta).images!=null)return s(this,ta).images;let t=s(this,ea).properties.details?.images?.map(o=>new ac({mvfData:o,mapData:s(this,Dd)}))??[];return(t==null||t.length===0)&&(t=this.locationProfiles.find(o=>o.images.length>0)?.images??[]),s(this,ta).images=t,t}get links(){if(s(this,ta).links!=null)return s(this,ta).links;let t=s(this,ea).properties.details?.links?.map(o=>new ic({mvfData:o}))??[];return(t==null||t.length===0)&&(t=this.locationProfiles.find(o=>o.links.length>0)?.links??[]),s(this,ta).links=t,t}get locationProfiles(){return s(this,Dd).locationProfilesByAttachedFeatureId[this.id]??[]}};Dd=new WeakMap,ea=new WeakMap,ta=new WeakMap;var xf,cc,Ad,Ld,kd=class kd extends Zr{constructor(t,o){super(t,o.mvfData);m(this,"__type",kd.__type);S(this,xf);S(this,cc);S(this,Ad,{});S(this,Ld);w(this,xf,t),w(this,cc,o.floorId),w(this,Ld,o.mvfData)}static is(t){return t.__type===kd.__type}get center(){return s(this,Ad).center==null&&(s(this,Ad).center=Dr(s(this,Ld),s(this,cc))),s(this,Ad).center}get floor(){let t=s(this,xf).getById("floor",s(this,cc));if(t==null)throw new Error(`Floor ${s(this,cc)} not found!`);return t}get geoJSON(){return{...s(this,Ld),properties:null}}get focusTarget(){return this}get anchorTarget(){return this.center}toJSON(){return{__type:kd.__type,id:this.id,name:this.name,floor:this.floor.id}}destroy(){}};xf=new WeakMap,cc=new WeakMap,Ad=new WeakMap,Ld=new WeakMap,m(kd,"__type","area");var BS=kd,si=BS;d();var pc,ra,dc,uc,_d=class _d extends Zr{constructor(t,o){super(t,o.mvfData);m(this,"__type",_d.__type);S(this,pc);S(this,ra);S(this,dc);S(this,uc);w(this,ra,{}),w(this,uc,o.mvfData),w(this,pc,t),w(this,dc,o.floorId)}static is(t){return t.__type===_d.__type}get floor(){let t=s(this,pc).getById("floor",s(this,dc));if(t==null)throw new Error(`Floor ${s(this,dc)} not found!`);return t}get center(){return s(this,ra).center==null&&(s(this,ra).center=Dr(s(this,uc),s(this,dc))),s(this,ra).center}get isExterior(){if(s(this,uc).properties.isExterior)return!0;let t=s(this,pc).obstructionIdByEntranceId[this.id];return s(this,pc).getMVFFeatureById("obstruction",t)?.properties.footprintComponent??!1}get geoJSON(){return{...s(this,uc),properties:null}}get focusTarget(){return this.center}get anchorTarget(){return this.center}toJSON(){return{__type:_d.__type,id:this.id,name:this.name,floor:this.floor.id,center:this.center.toJSON()}}destroy(){for(let t of Object.keys(s(this,ra)))delete s(this,ra)[t]}};pc=new WeakMap,ra=new WeakMap,dc=new WeakMap,uc=new WeakMap,m(_d,"__type","door");var NS=_d,go=NS;d();var il,mc,on,oa,Rd=class Rd extends Zr{constructor(t,o){super(t,o.mvfData);m(this,"__type",Rd.__type);S(this,il);S(this,mc);S(this,on,{});S(this,oa);w(this,il,t),w(this,mc,o.floorId),w(this,oa,o.mvfData)}static is(t){return t.__type===Rd.__type}get type(){return XV(s(this,oa).properties.kind)}get locations(){if(s(this,on).locations)return s(this,on).locations;s(this,on).locations=[];let t=s(this,il).mvfLocationsBySpaceId[s(this,oa).properties.id];if(t?.length>0)for(let o of t){let n=s(this,il).getById("enterprise-location",o.id);n&&s(this,on).locations.push(n)}return s(this,on).locations}get floor(){let t=s(this,il).getById("floor",s(this,mc));if(t==null)throw new Error(`Floor ${s(this,mc)} not found!`);return t}get doors(){return s(this,oa).properties.destinationNodes.reduce((t,o)=>{let n=s(this,il).doorsByNodeId[o];return n&&t.push(n),t},[])}get center(){return s(this,on).center==null&&(s(this,on).center=Dr(s(this,oa),s(this,mc))),s(this,on).center}get geoJSON(){return{...s(this,oa),properties:null}}get focusTarget(){return this.geoJSON.geometry.type==="Polygon"?this:this.center}get anchorTarget(){return this.center}toJSON(){return{__type:Rd.__type,id:this.id,name:this.name,type:this.type,floor:this.floor.id,center:this.center.toJSON()}}destroy(){for(let t of Object.keys(s(this,on)))delete s(this,on)[t]}};il=new WeakMap,mc=new WeakMap,on=new WeakMap,oa=new WeakMap,m(Rd,"__type","space");var jS=Rd,ZV=["room","hallway","exterior","void","gate"];function XV(e){if(e==null||e==="default")return"room";let r=e.toLowerCase();return ZV.includes(r)?r:"room"}var vr=jS;d();var On,yt,nn,Nd,l1,Bd=class Bd extends ii{constructor(t,o){super(o.mvfData.properties.id,t);S(this,Nd);m(this,"__type",Bd.__type);S(this,On);S(this,yt,{});S(this,nn);w(this,On,t),w(this,nn,o.mvfData)}static is(t){return t.__type===Bd.__type}get focusTarget(){return this}get name(){if(!("name"in s(this,nn).properties))return s(this,nn).properties.externalId??"";let t=W(this,Nd,l1).call(this,"name");return typeof t=="string"?t:""}get shortName(){if(!("shortName"in s(this,nn).properties))return s(this,nn).properties.externalId??"";let t=W(this,Nd,l1).call(this,"shortName");return typeof t=="string"?t:""}get subtitle(){let t=W(this,Nd,l1).call(this,"subtitle");return typeof t=="string"?t:""}get externalId(){return s(this,nn).properties.externalId??""}get elevation(){return s(this,nn).properties.elevation}get spaces(){if(s(this,yt).spaces==null){let t=s(this,On).spaces.filter(o=>o.floor.id===this.id);s(this,yt).spaces=t}return s(this,yt).spaces}get geoJSON(){return{type:"Feature",properties:null,geometry:s(this,nn).geometry??{type:"Polygon",coordinates:[]}}}get objects(){if(s(this,yt).objects==null){let t=s(this,On).objects.filter(o=>o.floor.id===this.id);s(this,yt).objects=t}return s(this,yt).objects}get connections(){if(s(this,yt).connections==null){let t=s(this,On).connections.filter(o=>o.floors.includes(this));s(this,yt).connections=t}return s(this,yt).connections}get doors(){if(s(this,yt).doors==null){let t=s(this,On).doors.filter(o=>o.floor.id===this.id);s(this,yt).doors=t}return s(this,yt).doors}get annotations(){if(s(this,yt).annotations==null){let t=s(this,On).annotations.filter(o=>o.floor.id===this.id);s(this,yt).annotations=t}return s(this,yt).annotations}get pois(){if(s(this,yt).pois==null){let t=s(this,On).pointsOfInterest.filter(o=>o.floor.id===this.id);s(this,yt).pois=t}return s(this,yt).pois}get floorStack(){if(s(this,yt).floorStack==null){let t=s(this,On).floorStacks.find(o=>o.floors.includes(this));s(this,yt).floorStack=t}return s(this,yt).floorStack}get center(){return s(this,yt).center==null&&(s(this,yt).center=Dr(s(this,nn),this.id)),s(this,yt).center}toJSON(){return{__type:Bd.__type,id:this.id,name:this.name,shortName:this.shortName,subtitle:this.subtitle,elevation:this.elevation,spaces:this.spaces.map(t=>t.id),objects:this.objects.map(t=>t.id),connections:this.connections.map(t=>t.id),doors:this.doors.map(t=>t.id),annotations:this.annotations.map(t=>t.id),pois:this.pois.map(t=>t.id)}}destroy(){for(let t of globalThis.Object.keys(s(this,yt)))delete s(this,yt)[t]}};On=new WeakMap,yt=new WeakMap,nn=new WeakMap,Nd=new WeakSet,l1=function(t){let o=s(this,nn).properties[t];return s(this,On).getPropTranslation(this.__type,t,this.id,o)},m(Bd,"__type","floor");var GS=Bd,Bo=GS;d();d();d();function jd(e){let r;if(vr.is(e)||go.is(e)||No.is(e)||si.is(e)||Ar.is(e))r=e.center;else if(sn.is(e)||na.is(e))r=e.coordinate;else if(fe.is(e))r=e;else if(wn.is(e))r=e.coordinate;else if(qi.is(e))r=e.coordinates[0];else return;return r}d();d();var vf={debug:!1,pitch:45,bearing:0,antialiasing:{enabled:!0},shadingAndOutlines:!0,outdoorView:{layersHiddenByGeometry:["building","building-top"]},imagePlacementOptions:{mode:"default"},flipImagesToFaceCamera:!0,multiFloorView:{enabled:!0,floorGap:10}},es="ExteriorWalls",sl="Walls",D5=0,Gd="InteriorDoors",Ud="ExteriorDoors",rr="GeometryLayer",ts="LabelsLayer",ai="MarkersLayer",Vd="FootprintLayer",al="OcclusionLayer",US="AreasLayer",$d="ImagesLayer",fc="FacadesLayer",rs="PathsLayer";var k5=["https://mappedin.auth0.com","https://mappedin-staging.auth0.com","https://staging.mappedin.com","https://mappedin-staging.auth0.com/userinfo","https://mappedin.com","https://mappedin.auth0.com/userinfo"],YV={orange:"#F26336",teal:"#057685",lightTeal:"#5DC7D0"};var JV=new Set(["outdoorView","bearing","pitch","zoomLevel","screenOffsets","debug","initialFloor","shadingAndOutlines","wallTopColor","style","multiFloorView","occlusion","imagePlacementOptions","flipImagesToFaceCamera","injectStyles","useStandaloneCamera","preloadFloors"]),KV=new Set(["style","enabled","layersHiddenByGeometry","lowDpi"]);function VS(e){e.outdoorView?.enabled&&!e.outdoorView?.token&&A.error("Enable outdoor view requires a token. Provide token in `options.outdoorView.token`")}function $S(e,r){let t=e?.outdoorView?.token||r.outdoorViewToken,o={...vf,...e,outdoorView:{enabled:e?.outdoorView?.enabled===void 0?!!t:e?.outdoorView?.enabled,layersHiddenByGeometry:vf.outdoorView?.layersHiddenByGeometry,...e?.outdoorView},bearing:e?.bearing??r.naturalBearing??0,imagePlacementOptions:{...vf.imagePlacementOptions,...e?.imagePlacementOptions},multiFloorView:{...vf.multiFloorView,...e?.multiFloorView}};return t&&o.outdoorView&&(o.outdoorView.token=t),o}function A5(e){let r={remove_watermark:!1};if(e)try{let t=ty(e);Object.assign(r,t.capabilities)}catch(t){A.error("Error decoding capabilities from token",t)}return r}function L5(e){let r=Object.fromEntries(Object.entries(e).filter(([t])=>JV.has(t)));return r.outdoorView&&(r.outdoorView=Object.fromEntries(Object.entries(r.outdoorView).filter(([t])=>KV.has(t)))),r}var ll,En,ia,Hd=class Hd extends Zr{constructor(t,o){let n=Object.values(o.mvfDataByFloorId)[0];super(t,n);m(this,"__type",Hd.__type);S(this,ll);S(this,En);S(this,ia);w(this,En,{}),w(this,ll,t),w(this,ia,o.mvfDataByFloorId)}static is(t){return t.__type===Hd.__type}get accessible(){return Object.values(s(this,ia))[0].properties.accessible??!1}get type(){return Object.values(s(this,ia))[0].properties.kind?.split(".")[1]??"unknown"}get extra(){return Object.values(s(this,ia))[0].properties.extra}get coordinates(){return s(this,En).coordinates==null&&(s(this,En).coordinates=Object.entries(s(this,ia)).map(([t,o])=>Dr(o,t))),s(this,En).coordinates}get nodes(){return Object.values(s(this,ia))[0].properties.nodes.map(t=>s(this,ll).getById("node",t))}get floors(){return this.coordinates.map(t=>t.floorId?s(this,ll).getById("floor",t.floorId):void 0).filter(xm)}get locationProfiles(){if(s(this,En).locationProfiles!=null)return s(this,En).locationProfiles;let t=super.locationProfiles;if(t==null||t.length===0){let o=[this.coordinates[0]?.longitude??0,this.coordinates[0]?.latitude??0],n=Qi(o),i=s(this,ll).mvfConnectionIdsByLatLon[n]??[];for(let a of i){let l=s(this,ll).locationProfilesByAttachedFeatureId[a];if(l!=null){t=l;break}}}return s(this,En).locationProfiles=t??[],t}get focusTarget(){return this.coordinates}toJSON(){return{__type:Hd.__type,id:this.id,name:this.name,type:this.type,externalId:this.externalId,coordinates:this.coordinates.map(t=>t.toJSON()),floors:this.floors.map(t=>t.id),extra:this.extra}}destroy(){for(let t of Object.keys(s(this,En)))delete s(this,En)[t]}};ll=new WeakMap,En=new WeakMap,ia=new WeakMap,m(Hd,"__type","connection");var HS=Hd,an=HS;d();var If,hc,cl,gc,zd=class zd extends Zr{constructor(t,o){super(t,o.mvfData);m(this,"__type",zd.__type);S(this,If);S(this,hc);S(this,cl,{});S(this,gc);w(this,If,t),w(this,hc,o.floorId),w(this,gc,o.mvfData)}static is(t){return t.__type===zd.__type}get type(){let t=s(this,gc).properties.kind;return t==null&&(t="object"),t==="Desks"&&(t="desk"),t.toLowerCase()}get floor(){let t=s(this,If).getById("floor",s(this,hc));if(t==null)throw new Error(`Floor ${s(this,hc)} not found!`);return t}get center(){return s(this,cl).center==null&&(s(this,cl).center=Dr(s(this,gc),s(this,hc))),s(this,cl).center}get geoJSON(){return{...s(this,gc),properties:null}}get anchorTarget(){return this.center}get focusTarget(){return this.geoJSON.geometry.type==="Polygon"?this:this.center}toJSON(){return{__type:zd.__type,id:this.id,name:this.name,type:this.type,floor:this.floor.id,center:this.center.toJSON()}}destroy(){for(let t of globalThis.Object.keys(s(this,cl)))s(this,cl)[t]=null}};If=new WeakMap,hc=new WeakMap,cl=new WeakMap,gc=new WeakMap,m(zd,"__type","object");var zS=zd,No=zS;d();var Sf,yc,pl,Zd,Wd=class Wd extends Zr{constructor(t,o){super(t,o.mvfData);m(this,"__type",Wd.__type);S(this,Sf);S(this,yc);S(this,pl,{});S(this,Zd);w(this,Sf,t),w(this,Zd,o.mvfData),w(this,yc,o.floorId)}static is(t){return t.__type===Wd.__type}get floor(){let t=s(this,Sf).getById("floor",s(this,yc));if(t==null)throw new Error(`Floor ${s(this,yc)} not found!`);return t}get coordinate(){return s(this,pl).coordinate==null&&(s(this,pl).coordinate=Dr(s(this,Zd),s(this,yc))),s(this,pl).coordinate}get geoJSON(){return{...s(this,Zd),properties:null}}get focusTarget(){return this.coordinate}get anchorTarget(){return this.coordinate}toJSON(){return{__type:Wd.__type,id:this.id,name:this.name,floor:this.floor.id,coordinate:this.coordinate.toJSON()}}destroy(){for(let t in s(this,pl))s(this,pl)[t]=null}};Sf=new WeakMap,yc=new WeakMap,pl=new WeakMap,Zd=new WeakMap,m(Wd,"__type","point-of-interest");var WS=Wd,sn=WS;d();var Tf,bc,dl,xc,Cf,XS,Xd=class Xd extends Zr{constructor(t,o){super(t,o.mvfData);S(this,Cf);m(this,"__type",Xd.__type);S(this,Tf);S(this,bc);S(this,dl,{});S(this,xc);w(this,Tf,t),w(this,bc,o.floorId),w(this,xc,o.mvfData)}static is(t){return t.__type===Xd.__type}get group(){return W(this,Cf,XS).call(this).group}get type(){return W(this,Cf,XS).call(this).type}get coordinate(){return s(this,dl).coordinate==null&&(s(this,dl).coordinate=Dr(s(this,xc),s(this,bc))),s(this,dl).coordinate}get floor(){let t=s(this,Tf).getById("floor",s(this,bc));if(t==null)throw new Error(`Floor ${s(this,bc)} not found!`);return t}get geoJSON(){return{...s(this,xc),properties:null}}get focusTarget(){return this.coordinate}get anchorTarget(){return this.coordinate}toJSON(){return{__type:Xd.__type,id:this.id,group:this.group,type:this.type,coordinate:this.coordinate.toJSON()}}destroy(){for(let t of Object.keys(s(this,dl)))delete s(this,dl)[t]}};Tf=new WeakMap,bc=new WeakMap,dl=new WeakMap,xc=new WeakMap,Cf=new WeakSet,XS=function(){let[t,o]=s(this,xc).properties.symbolId.split("--");return{group:t,type:o}},m(Xd,"__type","annotation");var ZS=Xd,na=ZS;d();var ul,Pn,li,Jd,Mf,JS,Yd=class Yd extends ii{constructor(t,o){super(o.mvfData.id,t);S(this,Mf);m(this,"__type",Yd.__type);S(this,ul);S(this,Pn,{});S(this,li);S(this,Jd);w(this,ul,t),w(this,li,o.mvfData),w(this,Jd,o.facadeId)}static is(t){return t.__type===Yd.__type}get type(){return s(this,li).type}get name(){let t=W(this,Mf,JS).call(this,"name");return typeof t=="string"?t:""}get shortName(){let t=W(this,Mf,JS).call(this,"shortName");return typeof t=="string"?t:""}get externalId(){return s(this,li).externalId??""}get floors(){if(s(this,Pn).floors==null){let t=(s(this,li).floors??s(this,li).maps??[]).reduce((o,n)=>{let i=s(this,ul).floorsById[n];return i&&o.push(i),o},[]);t.length===0&&A.error(`Floor stack ${this.id} has no floors`),s(this,Pn).floors=t.sort((o,n)=>o.elevation-n.elevation)}return s(this,Pn).floors}get defaultFloor(){if(s(this,Pn).defaultFloor!=null)return s(this,Pn).defaultFloor;let t=s(this,li).defaultFloor?s(this,ul).getById("floor",s(this,li).defaultFloor):void 0;return s(this,Pn).defaultFloor=t||this.floors.reduce((o,n)=>Math.abs(n.elevation)<Math.abs(o.elevation)?n:o),s(this,Pn).defaultFloor}get facade(){return s(this,Jd)?s(this,ul).facadesById[s(this,Jd)]:void 0}toJSON(){return{__type:Yd.__type,id:this.id,name:this.name,shortName:this.shortName,type:this.type,floors:this.floors.map(t=>t.id)}}destroy(){for(let t of globalThis.Object.keys(s(this,Pn)))delete s(this,Pn)[t]}};ul=new WeakMap,Pn=new WeakMap,li=new WeakMap,Jd=new WeakMap,Mf=new WeakSet,JS=function(t){return s(this,ul).getPropTranslation(this.__type,t,this.id,s(this,li)[t])},m(Yd,"__type","floor-stack");var YS=Yd,c1=YS;d();var Qd,vc,qd,os,Kd=class Kd extends ii{constructor(t,o){super(o.mvfData.id,t);m(this,"__type",Kd.__type);S(this,Qd);S(this,vc);S(this,qd);S(this,os,{});w(this,Qd,o.mvfData),w(this,vc,t),w(this,qd,o.floorStackId)}static is(t){return t.__type===Kd.__type}get floorStack(){return s(this,vc).getById("floor-stack",s(this,qd))}get spaces(){if(!s(this,os).spaces){s(this,os).spaces=[];for(let t of s(this,Qd).spaces){let o=s(this,vc).getById("space",t.spaceId);o&&s(this,os).spaces.push(o)}}return s(this,os).spaces}get center(){if(!s(this,os).center){let t={type:"FeatureCollection",features:[]};for(let n of this.spaces){let i=s(this,vc).mvfSpacesById[n.id];i&&t.features.push(i)}if(t.features.length===0)throw new wr("No geometry found for facade!");let o=Cd(t);s(this,os).center=new fe({latitude:o.geometry.coordinates[1],longitude:o.geometry.coordinates[0],floorId:s(this,Qd).spaces[0].floorId})}return s(this,os).center}get focusTarget(){return this.spaces}get anchorTarget(){return this.center}toJSON(){return{id:this.id,__type:Kd.__type,floorStackId:s(this,qd),floorStack:this.floorStack,spaces:this.spaces}}};Qd=new WeakMap,vc=new WeakMap,qd=new WeakMap,os=new WeakMap,m(Kd,"__type","facade");var KS=Kd,Ar=KS;d();var QV=new Set(["wall","area"]),qV=new Set(["void","desk-entrance"]),e$=(e,r)=>{let t={},o={},n={},i={},a={},l={};for(let c of e["location.json"]||[]){let p=new Ic(r,{mvfData:c});if(t[c.id]=p,c.externalId&&(i[c.externalId]==null&&(i[c.externalId]=[]),i[c.externalId].push(p)),c.categories)for(let f of c.categories)a[f]==null&&(a[f]=[]),a[f].push(p);let u=[...c.obstructions?.map(f=>f.id)??[],...c.spaces?.map(f=>f.id)??[],...c.annotations?.map(f=>f.id)??[],...c.connections??[],...c.entrances?.map(f=>f.id)??[],...c.areas?.map(f=>f.id)??[]];for(let f of u)f&&(l[f]==null&&(l[f]=[]),l[f].push(p))}for(let c of e["category.json"]||[]){let p=new d1(r,{mvfData:c});o[c.id]=p,c.parent&&(n[c.parent]==null&&(n[c.parent]=[]),n[c.parent].push(p))}return{locationCategoriesByParentId:n,locationProfilesById:t,locationCategoriesById:o,locationProfilesByExternalId:i,locationProfilesByCategoryId:a,locationProfilesByAttachedFeatureId:l}},t$=(e,r,t)=>{let o={},n={},i={},a={},l={},c={},p={},u={},f={},h={},b={},x=globalThis.Object.keys(e.space);for(let T of x){let v=e.space[T];if(v!=null){for(let I of v.features)if(b[I.properties.id]=T,c[I.properties.id]=I,I.properties.kind==="desk-entrance"&&(l[I.properties.externalId]==null&&(l[I.properties.externalId]=[]),l[I.properties.externalId].push(...I.properties.destinationNodes)),!f$(I)){if(I.properties.kind?.includes("connection")){let M=Qi(I.geometry.coordinates);f[M]==null&&(f[M]=[]),f[M].push(I.properties.id);continue}if(I.properties.kind==="poi"||I.geometry.type==="Point"&&I.properties.kind==null){let M=new sn(t,{floorId:T,mvfData:I});i[I.properties.id]=M,u[T]||(u[T]=[]),u[T].push(I),I.properties.externalId&&(a[I.properties.externalId]==null&&(a[I.properties.externalId]=[]),a[I.properties.externalId].push(M))}else if(I.geometry.type==="Point")A.warn("Encountered a point space with an unknown kind!",I.properties.kind);else{let M=new vr(t,{floorId:T,mvfData:I});o[I.properties.id]=M,I.properties.externalId&&(n[I.properties.externalId]==null&&(n[I.properties.externalId]=[]),n[I.properties.externalId].push(M)),p[T]||(p[T]=[]),p[T].push(I)}}}}for(let T in f){let v=f[T],I={};for(let O of v){let C=b[O],E=c[O],_=r?.["n_"+E.properties.id.split("s_")[1]];I[C]={...E,properties:{...E.properties,accessible:_?.accessible===!0}}}let M=new an(t,{mvfDataByFloorId:I});h[M.id]=M}return{spacesById:o,spacesByExternalId:n,poisById:i,poisByExternalId:a,connectionsById:h,objectEntranceNodeIdsByObstructionId:l,mvfSpacesById:c,connectionIdsByLatLon:f,mvfSpacesByFloorId:p,mvfPoisByFloorId:u}},r$=(e,r)=>{let t={},o={},n={},i={};for(let a of e["node.geojson"].features){n[a.properties.id]=a;let l=new wn(r,{mvfData:a,floorId:a.properties.floor??a.properties.map});t[a.properties.id]=l,a.properties.externalId&&(o[a.properties.externalId]==null&&(o[a.properties.externalId]=[]),o[a.properties.externalId].push(l));let c=a.properties.floor??a.properties.map;i[c]||(i[c]=[]),i[c].push(a)}return{nodesById:t,nodesByExternalId:o,mvfNodesById:n,mvfNodesByFloorId:i}},o$=(e,r)=>{let t={},o={},n={},i={},a=globalThis.Object.keys(e.obstruction);for(let l of a){let c=e.obstruction[l];if(c!=null)for(let p of c.features){n[p.properties.id]=p;for(let f of p.properties.entrances)i[f]=p.properties.id;if(QV.has(p.properties.kind?.toLowerCase()??""))continue;let u=new No(r,{floorId:l,mvfData:p});t[p.properties.id]=u,p.properties.externalId&&(o[p.properties.externalId]==null&&(o[p.properties.externalId]=[]),o[p.properties.externalId].push(u))}}return{objectsById:t,objectsByExternalId:o,mvfObstructionById:n,obstructionIdByEntranceId:i}},n$=(e,r)=>{let t={},o={},n={};if("floor.geojson"in e&&e["floor.geojson"]!=null)for(let i of e["floor.geojson"].features){n[i.properties.id]=i.properties;let a=new Bo(r,{mvfData:i});t[i.properties.id]=a,i.properties.externalId&&(o[i.properties.externalId]==null&&(o[i.properties.externalId]=[]),o[i.properties.externalId].push(a))}else for(let i of e["map.geojson"]){n[i.id]=i;let a=new Bo(r,{mvfData:{properties:i}});t[i.id]=a}return{floorsById:t,floorsByExternalId:o,mvfFloorsById:n}},i$=(e,r)=>{let t={},o={},n={},i={},a={},l=e["floorstack.json"]||e["mapstack.json"]||e["mapstack.geojson"];if(l!=null)for(let c of l){let p=e.facade?.[c.id],u=new c1(r,{mvfData:c,facadeId:p?.id});if(t[c.id]=u,c.externalId&&(o[c.externalId]==null&&(o[c.externalId]=[]),o[c.externalId].push(u)),n[c.id]=c,p){let f=new Ar(r,{mvfData:p,floorStackId:c.id});i[p.id]=f;for(let h of p.spaces)a[h.spaceId]=f}}return{floorStacksById:t,floorStacksByExternalId:o,mvfFloorStacksById:n,facadesById:i,facadesBySpaceId:a}},s$=(e,r)=>{let t={},o={},n=e["connection.json"].reduce((i,a)=>{a.nodes.forEach(c=>i[c]=a),t[a.id]=a;let l=r?.[a.nodes[0]];if(l!=null){let c=Qi(l.geometry.coordinates);o[c]==null&&(o[c]=[]),o[c].push(a.id)}return i},{});return{mvfConnectionsById:t,mvfConnectionsByNodeId:n,mvfConnectionIdsByLatLon:o}},a$=(e,r)=>{let t={},o={},n={},i={},a={},l=globalThis.Object.keys(e.entrance);for(let c of l){let p=e.entrance[c];if(p!=null)for(let u of p.features){i[u.properties.id]=u;let f=new go(r,{floorId:c,mvfData:u});u.properties.node&&(n[u.properties.node]=f),t[u.properties.id]=f,u.properties.externalId&&(o[u.properties.externalId]==null&&(o[u.properties.externalId]=[]),o[u.properties.externalId].push(f)),a[c]||(a[c]=[]),a[c].push(u)}}return{doorsById:t,doorsByExternalId:o,doorsByNodeId:n,mvfEntrancesById:i,mvfEntrancesByFloorId:a}},l$=(e,r,t)=>{if(e.textAreas!=null)for(let o in e.textAreas){let n=e.textAreas[o]?.features;if(n!=null){for(let i of n)if("anchorId"in i.properties){let a=i?.properties,l=r[a.anchorId]||t[a.anchorId];if(l!=null&&a!=null){let c=l.properties;c.textArea=a,c.textArea&&(c.textArea.position=i.geometry.coordinates)}}}}},c$=(e,r,t)=>{if(e.floorImages!=null)for(let o in e.floorImages){let n=e.floorImages[o]?.features;if(n!=null){for(let i of n)if("anchorId"in i.properties){let a=i?.properties,l=r[a.anchorId]||t[a.anchorId];if(l!=null&&a!=null){let c=l.properties;c.image=a,c.image&&(c.image.position=i.geometry.coordinates)}}}}},p$=(e,r)=>{if(e.enterprise?.enterpriseStyles==null)return;let t=e.enterprise?.enterpriseStyles;for(let o in t){let n=t[o];n.geometryAnchors.forEach(i=>{let a=r[i.geometryId];if(a!=null){let l=a.properties;l.style={styleId:o,edgeOffset:n.edgeOffset}}})}},d$=(e,r,t)=>{if(!(e.enterprise==null||e.enterprise.textures==null))for(let o of e.enterprise.textures)for(let n of o.geometryAnchors){let i=r[n.geometryId]||t[n.geometryId];if(i!=null){let a=i.properties;a.textures==null&&(a.textures=[]),a.textures.push(o)}}},u$=(e,r)=>{let t={},o={},n={};if(e.annotation==null)return{annotationsById:t,mvfAnnotationsById:o,mvfAnnotationsByFloorId:n};let i=globalThis.Object.keys(e.annotation);for(let a of i){let l=e.annotation[a];if(l!=null)for(let c of l.features){o[c.properties.id]=c;let p=new na(r,{floorId:a,mvfData:c});t[c.properties.id]=p,n[a]||(n[a]=[]),n[a].push(c)}}return{annotationsById:t,mvfAnnotationsById:o,mvfAnnotationsByFloorId:n}},m$=(e,r)=>{let t={},o={},n={};if(e.area==null)return{areasById:t,areasByExternalId:o,mvfAreasById:n};let i=globalThis.Object.keys(e.area);for(let a of i){let l=e.area[a];if(l!=null)for(let c of l.features){n[c.properties.id]=c;let p=new si(r,{floorId:a,mvfData:c});t[c.properties.id]=p,c.properties.externalId&&(o[c.properties.externalId]==null&&(o[c.properties.externalId]=[]),o[c.properties.externalId].push(p))}}return{areasById:t,areasByExternalId:o,mvfAreasById:n}},_5=(e,r)=>{let t={},o={},n={},i={},a=(e.enterprise?.locations??[]).reduce((M,O)=>(M[O.id]=O,M),{}),l={},c={},p={},u={},f={},h={},b=e.enterprise?.venue||{},x={},T={},v={};for(let M of e.enterprise?.categories??[]){let O=new p1(r,{mvfData:M});l[M.id]=O,M.externalId&&(c[M.externalId]==null&&(c[M.externalId]=[]),c[M.externalId].push(O)),p[M.id]=M,M.locations.forEach(C=>{f[C]==null&&(f[C]=[]),f[C].push(M.id)})}let I={};for(let M of e.enterprise?.locationInstances??[]){let O=a[M.parent],C=Object.keys(O),E={};for(let G of C)E[G]=void 0;let _={...E,polygons:[],nodes:[],...M};I[_.parent]==null&&(I[_.parent]=[]),I[_.parent].push(new qi(r,{mvfData:_,categoryIds:e.enterprise?.categoryPriorities?.[_.id]||f[_.id],parentId:M.parent})),x[_.id]=M}for(let M in e.space){let O=e.space[M];if(O!=null)for(let C of O.features){for(let E of C.properties.destinationNodes)T[E]==null&&(T[E]=[]),T[E].push(C.properties.id);v[C.properties.id]=C.properties.destinationNodes}}for(let M of e.enterprise?.locations??[]){let O=new qi(r,{mvfData:M,categoryIds:e.enterprise?.categoryPriorities?.[M.id]||f[M.id],locationInstances:I[M.id]});n[M.id]=O,M.externalId&&(i[M.externalId]==null&&(i[M.externalId]=[]),i[M.externalId].push(O)),M.nodes.forEach(C=>{h[C.id]==null&&(h[C.id]=[]),h[C.id].push(M.id)});for(let C of M.polygons)u[C.id]==null&&(u[C.id]=[]),u[C.id].push(M)}if(r.enterpriseMode===!0){for(let M in r.mvfConnectionsById){let O={},C=r.mvfConnectionsById[M];for(let E of r.mvfConnectionsById[M].nodes){let _=r.nodesById[E];_!=null&&(O[_.floor.id]={type:"Feature",geometry:{type:"Point",coordinates:[_.coordinate.longitude,_.coordinate.latitude]},properties:{id:M,externalId:C.externalId,kind:"enterprise."+C.type,destinationNodes:[],flags:"",type:C.type,nodes:C.nodes,accessible:C.accessible,extra:C.extra,details:C.details}})}Object.keys(O).length>0&&(t[M]=new an(r,{mvfDataByFloorId:O}),C.externalId&&(o[C.externalId]==null&&(o[C.externalId]=[]),o[C.externalId].push(t[M])))}r.connectionsById=t}return{spaceIdsByNodeId:T,connectionsByExternalId:o,locationIdsByNodeId:h,mvfLocationsBySpaceId:u,mvfLocationsById:a,mvfCategoriesById:p,locationsById:n,locationsByExternalId:i,locationInstancesById:x,categoriesById:l,categoriesByExternalId:c,destinationNodesIdsBySpaceId:v,venue:b}},R5=(e,r)=>{let{nodesById:t,nodesByExternalId:o,mvfNodesById:n,mvfNodesByFloorId:i}=r$(e,r),{mvfConnectionsById:a,mvfConnectionsByNodeId:l,mvfConnectionIdsByLatLon:c}=s$(e,n),{spacesById:p,spacesByExternalId:u,poisById:f,poisByExternalId:h,mvfSpacesById:b,objectEntranceNodeIdsByObstructionId:x,connectionsById:T,connectionIdsByLatLon:v,mvfSpacesByFloorId:I,mvfPoisByFloorId:M}=t$(e,l,r),{objectsById:O,objectsByExternalId:C,mvfObstructionById:E,obstructionIdByEntranceId:_}=o$(e,r),{floorsById:G,floorsByExternalId:R,mvfFloorsById:N}=n$(e,r),{floorStacksById:X,floorStacksByExternalId:z,mvfFloorStacksById:ee,facadesById:re,facadesBySpaceId:ue}=i$(e,r),{doorsById:Ce,doorsByExternalId:Oe,doorsByNodeId:Pe,mvfEntrancesById:Fe,mvfEntrancesByFloorId:ce}=a$(e,r),{annotationsById:Ee,mvfAnnotationsById:ye,mvfAnnotationsByFloorId:Ge}=u$(e,r),{areasById:Ie,areasByExternalId:Xe,mvfAreasById:se}=m$(e,r);c$(e,b,E),l$(e,b,E),p$(e,b),d$(e,b,E);let{locationCategoriesByParentId:nt,locationProfilesById:dt,locationCategoriesById:$t,locationProfilesByExternalId:k,locationProfilesByCategoryId:H,locationProfilesByAttachedFeatureId:P}=e$(e,r);return{spacesById:p,spacesByExternalId:u,nodesById:t,nodesByExternalId:o,objectsById:O,objectsByExternalId:C,floorsById:G,floorsByExternalId:R,floorStacksById:X,floorStacksByExternalId:z,facadesById:re,facadesBySpaceId:ue,connectionsById:T,doorsById:Ce,doorsByExternalId:Oe,doorsByNodeId:Pe,poisById:f,poisByExternalId:h,annotationsById:Ee,areasById:Ie,areasByExternalId:Xe,objectEntranceNodeIdsByObstructionId:x,obstructionIdByEntranceId:_,connectionIdsByLatLon:v,locationProfilesById:dt,locationCategoriesById:$t,locationProfilesByExternalId:k,locationProfilesByCategoryId:H,locationCategoriesByParentId:nt,mvfSpacesById:b,mvfNodesById:n,mvfObstructionById:E,mvfFloorsById:N,mvfFloorStacksById:ee,mvfConnectionsById:a,mvfConnectionsByNodeId:l,mvfEntrancesById:Fe,mvfAnnotationsById:ye,mvfNodesByFloorId:i,mvfSpacesByFloorId:I,mvfPoisByFloorId:M,mvfAreasById:se,mvfEntrancesByFloorId:ce,mvfAnnotationsByFloorId:Ge,locationProfilesByAttachedFeatureId:P,mvfConnectionIdsByLatLon:c}};function f$(e){return!["Polygon","MultiPolygon"].includes(e.geometry.type)&&"kind"in e.properties&&e.properties.kind==null||qV.has(e.properties.kind??"")}d();var h$=new Set(["polygons"]),Fn,bt,ao,wf,eu=class eu extends xr{constructor(t,o){super(o.mvfData.externalId);m(this,"__type",eu.__type);m(this,"description");m(this,"name","");m(this,"amenity");m(this,"externalId","");m(this,"extra");m(this,"gallery");m(this,"instances");m(this,"logo");m(this,"operationHours");m(this,"phone");m(this,"picture");m(this,"shortName");m(this,"showFloatingLabelWhenImagePresent");m(this,"showLogo");m(this,"siblingGroups");m(this,"social");m(this,"sortOrder",-1);m(this,"states");m(this,"tags");m(this,"type","");m(this,"hidden",!1);m(this,"primaryCategory");S(this,Fn);S(this,bt,{});S(this,ao);S(this,wf);w(this,Fn,t),w(this,ao,o.mvfData),w(this,wf,o.categoryIds||[]),this.instances=o.locationInstances||[];for(let n in o.mvfData)!h$.has(n)&&!Object.getOwnPropertyDescriptor(Object.getPrototypeOf(this),n)&&Object.defineProperty(this,n,{enumerable:!0,get(){if(o.parentId){let i=s(this,Fn).locationsById[o.parentId];return s(this,ao)[n]!=null?s(this,Fn).getPropTranslation(this.__type,n,s(this,ao).id,s(this,ao)[n]):s(this,Fn).getPropTranslation(this.__type,n,s(this,ao).id,i[n])}return s(this,Fn).getPropTranslation(this.__type,n,s(this,ao).id,s(this,ao)[n])}})}static is(t){return t.__type===eu.__type}get focusTarget(){return this.spaces}get categories(){return s(this,bt).categories?s(this,bt).categories:(s(this,bt).categories=(s(this,wf).map(t=>s(this,Fn).getById("enterprise-category",t))||[]).filter(Boolean),s(this,bt).categories)}get coordinates(){if(s(this,bt).coordinates)return s(this,bt).coordinates;s(this,bt).coordinates=[];for(let t=0;t<this.nodes.length;t++)s(this,bt).coordinates.push(this.nodes[t].coordinate);return s(this,bt).coordinates}get nodes(){if(s(this,bt).nodes)return s(this,bt).nodes;s(this,bt).nodes=[];for(let t=0;t<s(this,ao).nodes.length;t++){let o=s(this,Fn).getById("node",s(this,ao).nodes[t].id);o&&s(this,bt).nodes.push(o)}return s(this,bt).nodes}get points(){if(s(this,bt).points)return s(this,bt).points;s(this,bt).points=[];for(let t=0;t<s(this,ao).spaces.length;t++){let o=s(this,Fn).getById("point-of-interest",s(this,ao).spaces[t].id);o&&s(this,bt).points.push(o)}return s(this,bt).points}get spaces(){if(s(this,bt).spaces)return s(this,bt).spaces;s(this,bt).spaces=[];for(let t=0;t<s(this,ao).polygons.length;t++){let o=s(this,Fn).getById("space",s(this,ao).polygons[t].id);o&&s(this,bt).spaces.push(o)}return s(this,bt).spaces}toJSON(){return{__type:eu.__type,id:this.id,name:this.name}}destroy(){for(let t of Object.keys(s(this,bt)))delete s(this,bt)[t]}};Fn=new WeakMap,bt=new WeakMap,ao=new WeakMap,wf=new WeakMap,m(eu,"__type","enterprise-location");var QS=eu,qi=QS;d();var g$=new Set,Sc,yo,ns,tu=class tu extends xr{constructor(t,o){super(o.mvfData.externalId);m(this,"__type",tu.__type);m(this,"name","");m(this,"color");m(this,"externalId","");m(this,"extra");m(this,"icon");m(this,"iconFromDefaultList");m(this,"sortOrder",-1);m(this,"picture");S(this,Sc);S(this,yo,{});S(this,ns);w(this,Sc,t),w(this,ns,o.mvfData);for(let n in o.mvfData)!g$.has(n)&&!Object.getOwnPropertyDescriptor(Object.getPrototypeOf(this),n)&&Object.defineProperty(this,n,{get(){return s(this,Sc).getPropTranslation(this.__type,n,s(this,ns).id,s(this,ns)[n])}})}static is(t){return t.__type===tu.__type}get children(){if(s(this,yo).children)return s(this,yo).children;s(this,yo).children=[];for(let t=0;t<s(this,ns).children.length;t++){let o=s(this,Sc).getById("enterprise-category",s(this,ns).children[t]);o&&s(this,yo).children.push(o)}return s(this,yo).children}get locations(){if(s(this,yo).locations)return s(this,yo).locations;s(this,yo).locations=[];for(let t=0;t<s(this,ns).locations.length;t++){let o=s(this,Sc).getById("enterprise-location",s(this,ns).locations[t]);o&&s(this,yo).locations.push(o)}return s(this,yo).locations}toJSON(){return{__type:tu.__type,id:this.id,name:this.name}}destroy(){for(let t of Object.keys(s(this,yo)))delete s(this,yo)[t]}};Sc=new WeakMap,yo=new WeakMap,ns=new WeakMap,m(tu,"__type","enterprise-category");var qS=tu,p1=qS;d();var y$=new Set,Of,ou,ru=class ru extends xr{constructor(t,o){super(o.mvfData.externalId);m(this,"__type",ru.__type);m(this,"countrycode");m(this,"coverImage");m(this,"externalId","");m(this,"defaultLanguage",{code:"en",name:"English"});m(this,"defaultFloor");m(this,"extra");m(this,"icon");m(this,"languages",[]);m(this,"links",[]);m(this,"logo");m(this,"mappedinWebUrl");m(this,"operationHours");m(this,"slug","");m(this,"topLocations");m(this,"tzid");S(this,Of,{});S(this,ou);w(this,ou,o.mvfData);for(let n in o.mvfData)!y$.has(n)&&!Object.getOwnPropertyDescriptor(Object.getPrototypeOf(this),n)&&(this[n]=o.mvfData[n])}static is(t){return t.__type===ru.__type}get name(){return s(this,ou).name??""}get defaultMap(){return s(this,ou).defaultMap??this.defaultFloor??""}toJSON(){return{__type:ru.__type,id:this.id,name:this.name}}destroy(){for(let t of Object.keys(s(this,Of)))delete s(this,Of)[t]}};Of=new WeakMap,ou=new WeakMap,m(ru,"__type","enterprise-venue");var e2=ru,t2=e2;d();d();function Ef(e,r,t=[]){let o={...e};for(let[n,i]of Object.entries(r))if(i!==void 0)if(n in o){let a=n;if(Array.isArray(i)&&i.length>0){let l=b$(i[0],t);if(l){let c=o[a];if(!Array.isArray(c))throw new Error(`Expected array at ${n}, got ${typeof c}`);let p=new Map(i.map(h=>[B5(h,l),h])),f=c.map(h=>{let b=p.get(B5(h,l));return b?Ef(h,b,t):h});o[a]=f}else o[a]=i}else{let l=o[a];typeof l=="object"&&l!==null&&typeof i=="object"&&i!==null?Object.keys(i).length===0?o[a]=i:o[a]=Ef(l,i,t):o[n]=i}}else o[n]=i;return o}function b$(e,r){function t(o){if(typeof o!="object"||o===null)return null;for(let n of r)if(n in o&&typeof o[n]<"u")return[n];if(Array.isArray(o))return null;for(let[n,i]of Object.entries(o)){let a=t(i);if(a)return[n,...a]}return null}return t(e)}function B5(e,r){return r.reduce((t,o)=>{if(t&&typeof t=="object")return t[o]},e)}d();d();d();d();d();var N5=(i=>(i.Departure="Departure",i.TakeConnection="TakeConnection",i.ExitConnection="ExitConnection",i.Turn="Turn",i.Arrival="Arrival",i))(N5||{}),r2=(a=>(a.Straight="Straight",a.Right="Right",a.SlightRight="SlightRight",a.Left="Left",a.SlightLeft="SlightLeft",a.Back="Back",a))(r2||{}),j5=(p=>(p.stairs="stairs",p.elevator="elevator",p.escalator="escalator",p.door="door",p.ramp="ramp",p.slide="slide",p.portal="portal",p.security="security",p.shuttle="shuttle",p))(j5||{}),u1=(t=>(t.Exterior="exterior-walls",t.Interior="interior-walls",t))(u1||{}),m1=(t=>(t.Interior="interior-doors",t.Exterior="exterior-doors",t))(m1||{});function Dn(e){return e.verticalOffset===0?[e.longitude,e.latitude]:[e.longitude,e.latitude,e.verticalOffset]}function x$(e){return new Map(e.map(r=>{let{properties:t}=r,{id:o}=t;return[o,r]}))}var o2=(e,r)=>{let t=x$(r),o={entrances:{type:"FeatureCollection",features:[]},walls:{type:"Feature",properties:{id:e[0].properties.id},geometry:{type:"MultiLineString",coordinates:[]}}};for(let n of e){let i=[n.geometry.coordinates],a=(n.properties.entrances||[]).reduce((l,c)=>(t.has(c)&&l.push(t.get(c)),l),[]);if(a.length){let{entrances:l,obstructions:c}=PS(n,a);i=c.map(p=>p.geometry.coordinates),o.entrances.features.push(...l)}o.walls.geometry.coordinates.push(...i)}return o};function G5(e,r){return((r-e+Math.PI)%(Math.PI*2)+Math.PI*2)%(Math.PI*2)-Math.PI}function U5(e,r){let t="Left";return e<=-Math.PI/4?t="Right":e<=-r?t="SlightRight":e<=r?t="Straight":e<=Math.PI/4?t="SlightLeft":t="Left",t}function V5(e){let r={};for(let t in e){let o=e[t];if(o!=null){if(o.id=t,"polygons"in o)for(let n of o.polygons)r[n]=o;else if("lineStrings"in o)for(let n of o.lineStrings)r[n]=o;else if("points"in o)for(let n of o.points)r[n]=o}}return r}function f1(e,r){return e.reduce((t,o)=>{let n=r[o.properties.id];if(n==null)return t;if("textures"in o.properties&&Array.isArray(o.properties.textures)&&o.properties.textures.length>0){let i={...n,id:n.id+"-textures"};t.set(i,[o])}else t.has(n)||t.set(n,[]),t.get(n).push(o);return t},new Map)}function nu(e,r={}){let t={...e,flipImageToFaceCamera:r?.flipImagesToFaceCamera??!0},o=r?.style?.shading??r?.shadingAndOutlines;if(o===!0?t.shading={start:.1,end:.15,intensity:.4}:typeof o=="object"&&(t.shading={start:o.start,end:o.end,intensity:o.intensity}),t.outline=r?.style?.outlines??r?.shadingAndOutlines,"lineStrings"in e){let n=r?.style?.wallTopColor??r?.wallTopColor;n!=null&&(t.topColor=n)}return t}var $5=(e,r)=>{let o=(r.currentMap?.currentFloor).layers.get(rr);switch(e){case"interior-walls":return o?.layers.get(sl);case"exterior-walls":return o?.layers.get(es);case"interior-doors":return o?.layers.get(Gd);case"exterior-doors":return o?.layers.get(Ud);default:return typeof e=="string"?e:e.id}};function n2(e){return new Promise(r=>{e.onComplete(r),e.onStop(r)})}function h1(e){return e.bbox?e.bbox:vp(e)}function H5(e,r){return[Math.min(e[0],r[0]),Math.min(e[1],r[1]),Math.max(e[2],r[2]),Math.max(e[3],r[3])]}function i2(e,r,t){return e.floorId&&r.has(e.floorId)?r.get(e.floorId):t}function iu(e){if(vr.is(e)||No.is(e))return e.id}function z5(e,r,t){let o=e.coordinates.length===2&&e.coordinates[0].floorId!==e.coordinates[1].floorId,n=!0;if(o&&e.coordinates[0].floorId!=null&&e.coordinates[1].floorId!=null){let i=r?.getById("floor",e.coordinates[0].floorId),a=r?.getById("floor",e.coordinates[1].floorId);if(i&&a){let l=t.getState(i),c=t.getState(a);l!=null&&c!=null&&(n=l.visible&&c.visible&&l.altitude!==c.altitude)}}else{let i=e.coordinates[0].floorId!=null?r?.getById("floor",e.coordinates[0].floorId):void 0;n=i?t.getState(i)?.visible??!0:!0}return n}function W5(e,r){let t=e.properties.path.split("/"),o=t[t.length-1].split(".")[0],n=atob(o);return"img_"+ny(n).toString()+"-"+r}var Z5=Math.PI*.1,bo,jo,ln,sa,Tc,au,kn,X5,su,Y5,ml=class{constructor(r,t,o,n,i){S(this,kn);m(this,"id");S(this,bo,{});S(this,jo);S(this,ln);m(this,"departure");m(this,"destination");S(this,sa);S(this,Tc);S(this,au);this.id=i?.id??ut(),w(this,jo,t),w(this,ln,r.features),this.departure=o,this.destination=n}get path(){return s(this,ln).map(r=>s(this,jo).getById("node",r.properties.id)).filter(Boolean)}get coordinates(){return s(this,bo).coordinates?s(this,bo).coordinates:(s(this,bo).coordinates=s(this,ln).map(r=>new fe(r.geometry.coordinates[1],r.geometry.coordinates[0],r.properties.groupBy)),s(this,bo).coordinates)}get distance(){return s(this,bo).distance?s(this,bo).distance:(s(this,bo).distance=s(this,ln).reduce((r,t)=>r+(t.properties.distance||0),0),s(this,bo).distance)}get instructions(){if(s(this,ln).length<2)return[];if(s(this,bo).instructions)return s(this,bo).instructions;let r=[],t=0;for(let o=0;o<s(this,ln).length;o++){let n=s(this,ln)[o],i=s(this,ln)[o-1],a=s(this,ln)[o+1],l=new fe(n.geometry.coordinates[1],n.geometry.coordinates[0],n.properties.groupBy),c=W(this,kn,X5).call(this,{prevDirection:i,direction:n,nextDirection:a});t+=i?.properties.distance||0;for(let p of c)p&&(r.push({action:p,distance:t,coordinate:l,node:s(this,jo).getById("node",n.properties.id)}),t=0)}return s(this,bo).instructions=r,s(this,bo).instructions}toJSON(){return{id:this.id,directions:s(this,ln),__type:"directions",from:this.departure,to:this.destination}}};bo=new WeakMap,jo=new WeakMap,ln=new WeakMap,sa=new WeakMap,Tc=new WeakMap,au=new WeakMap,kn=new WeakSet,X5=function(r){let{prevDirection:t,direction:o,nextDirection:n}=r,i=t&&s(this,jo).getById("floor",t.properties.groupBy),a=s(this,jo).getById("floor",o.properties.groupBy),l=n&&s(this,jo).getById("floor",n.properties.groupBy),c=[];t||c.push({type:"Departure"});let p=s(this,jo).getMVFFeatureByNodeId("connection",o.properties.id),u=p?s(this,jo).getById("connection",p.id):void 0,f=p&&p.nodes.length>1,h=s(this,jo).enterpriseMode&&(!o.properties.destination||!p?.nodes.includes(o.properties.destination)||!p?.nodes.includes(o.properties.id));if(p&&!(!f||h))if(!s(this,sa)||s(this,sa)==="exit")c.push(W(this,kn,su).call(this,"TakeConnection",a,l,u,p)),w(this,sa,"take"),w(this,Tc,u),w(this,au,p);else{let x=s(this,jo).getMVFFeatureByNodeId("connection",t?.properties.id??""),T=s(this,jo).getById("connection",x?.id??"");c.push(W(this,kn,su).call(this,"ExitConnection",a,i,T,x)),w(this,sa,"exit"),w(this,Tc,u),w(this,au,p)}else s(this,sa)==="take"?(c.push(W(this,kn,su).call(this,"ExitConnection",a,i,s(this,Tc),s(this,au))),w(this,sa,"exit"),w(this,Tc,u)):l&&a?.id!==l.id?c.push(W(this,kn,su).call(this,"TakeConnection",a,l,u)):i&&i.id!==a?.id?c.push(W(this,kn,su).call(this,"ExitConnection",a,i,u)):c.push(W(this,kn,Y5).call(this,t,o));return n||c.push({type:"Arrival"}),c},su=function(r,t,o,n,i){let a="none",l=t?t.elevation:0;if(l!=null&&o?.elevation!=null){let p=l-o.elevation;p>0?a="down":p<0&&(a="up")}let c=n?.type??i?.type??"stairs";return{type:r,fromFloor:t,toFloor:o,direction:a,connection:n,connectionType:c}},Y5=function(r,t){let o=t.properties.edges;if(!o||o.filter(a=>a.destination.properties.id!==r?.properties.id&&a.destination.properties.id!==t.properties.destination).length===0)return null;let i=r?-G5(r.properties.angle,t.properties.angle):0;return Math.abs(i)>=Z5?{type:"Turn",bearing:U5(i,Z5),referencePosition:"At"}:null};d();d();d();d();d();d();d();var Cc=class{constructor({origin:r,destination:t,distance:o=0,angle:n=0,pathWeight:i=0,multiplicativeDistanceWeightScaling:a=!0}){m(this,"origin");m(this,"destination");m(this,"distance");m(this,"angle");m(this,"weight");if(this.origin=r,this.destination=t,this.distance=o,this.angle=n,this.weight=i||0,a?r.properties.floor===t.properties.floor&&(this.weight=(this.weight>=0?this.distance*this.weight:0)+this.distance):r.properties.map===t.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.")}};d();d();d();function aa(e,r,t){if(t===void 0&&(t={}),!e)throw new Error("point is required");if(!r)throw new Error("polygon is required");var o=Mn(e),n=Td(r),i=n.type,a=r.bbox,l=n.coordinates;if(a&&v$(o,a)===!1)return!1;i==="Polygon"&&(l=[l]);for(var c=!1,p=0;p<l.length&&!c;p++)if(J5(o,l[p][0],t.ignoreBoundary)){for(var u=!1,f=1;f<l[p].length&&!u;)J5(o,l[p][f],!t.ignoreBoundary)&&(u=!0),f++;u||(c=!0)}return c}function J5(e,r,t){var o=!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,i=r.length-1;n<r.length;i=n++){var a=r[n][0],l=r[n][1],c=r[i][0],p=r[i][1],u=e[1]*(a-c)+l*(c-e[0])+p*(e[0]-a)===0&&(a-e[0])*(c-e[0])<=0&&(l-e[1])*(p-e[1])<=0;if(u)return!t;var f=l>e[1]!=p>e[1]&&e[0]<(c-a)*(e[1]-l)/(p-l)+a;f&&(o=!o)}return o}function v$(e,r){return r[0]<=e[0]&&r[1]<=e[1]&&r[2]>=e[0]&&r[3]>=e[1]}d();d();function la([e,r],[t,o]){let n=r-o,i=e-t;return(Math.atan2(i,n)+Math.PI*3)%(Math.PI*2)}d();var I$=63710088e-1;function ci(e,r){let[t,o]=e.map(u=>u*Math.PI/180),[n,i]=r.map(u=>u*Math.PI/180),a=i-o,l=n-t,c=Math.sin(a/2)*Math.sin(a/2)+Math.cos(o)*Math.cos(i)*Math.sin(l/2)*Math.sin(l/2),p=2*Math.atan2(Math.sqrt(c),Math.sqrt(1-c));return I$*p}d();d();function g1(e,r,t,o){let[n,i]=e,[a,l]=r,[c,p]=t,[u,f]=o;if(i===l&&n===a||p===f&&c===u)return null;let h=(u-c)*(l-i)-(f-p)*(a-n);if(h===0)return null;let b=((f-p)*(n-c)-(u-c)*(i-p))/h,x=((l-i)*(n-c)-(a-n)*(i-p))/h;if(b<0||b>1||x<0||x>1)return null;let T=i+b*(l-i);return[n+b*(a-n),T]}d();function s2(e,r,t,o){let n=oc(e,t/1e3,o),i=oc(r,t/1e3,o);return[n.geometry.coordinates,i.geometry.coordinates]}d();function a2(e){let r=e*(180/Math.PI);return r=r%360,r>180?r-=360:r<-180&&(r+=360),Object.is(r,-0)?0:r}var K5=111e3;function y1(e,r,t=[],o=0){let n=!0,i=e.geometry.coordinates,a=r.geometry.coordinates,l=a2(la(i,a)-Math.PI/2),c=a2(la(i,a)+Math.PI/2),p=o/K5,u=o/(K5*Math.cos(i[1]*Math.PI/180)),f=Math.min(i[1],a[1])-p,h=Math.max(i[1],a[1])+p,b=Math.min(i[0],a[0])-u,x=Math.max(i[0],a[0])+u;for(let T of t)if(!(Math.max(T[0][1],T[1][1])<f||Math.min(T[0][1],T[1][1])>h||Math.max(T[0][0],T[1][0])<b||Math.min(T[0][0],T[1][0])>x)){if(o>0){let v=s2(i,a,o,l),I=s2(i,a,o,c);if(g1(v[0],v[1],T[0],T[1])||g1(I[0],I[1],T[0],T[1]))return n=!1,!1}else if(g1(i,a,T[0],T[1]))return n=!1,!1}return n}var c2=.4,Mc,Xr,l2,Q5,q5,eD,tD,rD,oD,x1,b1=class{constructor({nodes:r,groupBy:t,multiplicativeDistanceWeightScaling:o}){S(this,Xr);m(this,"edges",{});m(this,"nodesById");m(this,"nodesByGroup",new Map);S(this,Mc);m(this,"hasLineOfSight",(r,t,o=[],n=c2)=>y1({type:"Feature",properties:{id:"origin",neighbors:[]},geometry:{type:"Point",coordinates:r}},{type:"Feature",properties:{id:"destination",neighbors:[]},geometry:{type:"Point",coordinates:t}},o,n)===!0);S(this,x1,(r,t)=>{let o=0;for(let n of t)(!n[s(this,Mc)]||n[s(this,Mc)]===r.properties[s(this,Mc)])&&aa(r.geometry.coordinates,n.geometry.geometry)&&(o+=Math.max(0,n.cost));return o});w(this,Mc,t);let{features:n}=r;this.nodesById=W(this,Xr,Q5).call(this,n),W(this,Xr,q5).call(this),W(this,Xr,eD).call(this,n,t,{multiplicativeDistanceWeightScaling:o})}getShortestEuclideanDistance(r,t){return t.reduce((o,n)=>{let i=ci(r.geometry.coordinates,n.geometry.coordinates);return Math.min(o,i)},Number.MAX_VALUE)}dijkstraFindWithinTravelDistance(r,t,o,n,i){let a=this.nodesById[r];if(!a)return[];let l=[],c={},p={},u=new Set,f=[];for(l.push({node:a,distance:0}),c[a.properties.id]=null,p[a.properties.id]=0;l.length>0;){l.sort((T,v)=>T.distance-v.distance);let h=l.shift();if(!h)break;let b=h.node,x=h.distance;if(!u.has(b.properties.id)){u.add(b.properties.id),b.properties.id!=null&&o.includes(b.properties.id?.toString())&&(i?this.hasLineOfSight(a.geometry.coordinates,b.geometry.coordinates,n)&&f.push({feature:b,distance:x}):f.push({feature:b,distance:x}));for(let T of this.edges[b.properties.id]){let v=T.destination,I=x+T.distance,M=p[b.properties.id]+T.weight;I>t||u.has(v.properties.id)||p[v.properties.id]!==void 0&&M>=p[v.properties.id]||(p[v.properties.id]=M,c[v.properties.id]=T,l.push({node:v,distance:I}))}}}return f.sort((h,b)=>h.distance-b.distance)}aStar({originIds:r,destinationNodeIds:t,disabledConnectionNodeIds:o,zones:n,overrideEdgeWeights:i}){let a=W(this,Xr,l2).call(this,r),l=W(this,Xr,l2).call(this,t);if(a.length===0||l.length===0)return[];let{frontier:c,cameFrom:p,costSoFar:u}=W(this,Xr,tD).call(this,a,l);for(;c.length>0;){let f=c.shift();if(!f)break;if(W(this,Xr,rD).call(this,f.origin,l))return W(this,Xr,oD).call(this,p,f.origin.properties.id);for(let h of this.edges[f.origin.properties.id]){let b=i?.get(h)??h.weight;if(o?.has(h.origin.properties.id)&&h.destination.properties.map!==h.origin.properties.map)continue;let x=u[f.origin.properties.id]+b+s(this,x1).call(this,h.destination,n);if(x!==1/0&&(u[h.destination.properties.id]==null||x<u[h.destination.properties.id])){let T=x+this.getShortestEuclideanDistance(h.destination,l);u[h.destination.properties.id]=x,p[h.destination.properties.id]=h,c.push({origin:h.destination,priority:T})}}c.sort((h,b)=>h.priority-b.priority)}return[]}};Mc=new WeakMap,Xr=new WeakSet,l2=function(r){return r.map(t=>this.nodesById[t]).filter(Boolean)},Q5=function(r){return r.reduce((t,o)=>(t[o.properties.id]=o,t),{})},q5=function(){for(let r in this.nodesById)this.nodesById.hasOwnProperty(r)&&(this.nodesById[r].properties.neighbors=this.nodesById[r].properties.neighbors.filter(({id:t})=>!!this.nodesById[t]))},eD=function(r,t,o){r.forEach(n=>{let i=t==="default"?t:n.properties[t];this.nodesByGroup.has(i)||this.nodesByGroup.set(i,[]),this.nodesByGroup.get(i).push(n),this.edges[n.properties.id]=n.properties.neighbors.map(({id:a,weight:l})=>{let c=this.nodesById[a],p=ci(n.geometry.coordinates,c.geometry.coordinates),u=la(n.geometry.coordinates,c.geometry.coordinates);return new Cc({origin:n,destination:c,pathWeight:l,distance:p,angle:u,multiplicativeDistanceWeightScaling:o?.multiplicativeDistanceWeightScaling})})})},tD=function(r,t){let o=[],n={},i={};return r.forEach(a=>{let l=this.getShortestEuclideanDistance(a,t);o.push({origin:a,priority:l}),n[a.properties.id]=null,i[a.properties.id]=0}),o.sort((a,l)=>a.priority-l.priority),{frontier:o,cameFrom:n,costSoFar:i}},rD=function(r,t){return t.some(o=>o.properties.id===r.properties.id)},oD=function(r,t){let o=[],n=r[t];for(;n;)o.push(n),n=r[n.origin.properties.id];return o.reverse()},x1=new WeakMap;var lu=class{constructor({nodes:r,geojsonCollection:t,groupBy:o="default",multiplicativeDistanceWeightScaling:n}){m(this,"groupBy");m(this,"graph");m(this,"geometryEdgesByMapId",new Map);m(this,"generatePath",r=>{let{destination:t}=r[r.length-1],o={type:"FeatureCollection",features:[]};for(let i=0;i<r.length;i++){let{origin:a,destination:l}=r[i],c={id:a.properties.id,angle:r[i].angle,distance:r[i].distance,destination:l.properties.id,edges:this.graph.edges[a.properties.id]};this.groupBy!=="default"&&(c.groupBy=a.properties[this.groupBy]),o.features.push({type:"Feature",geometry:{type:"Point",coordinates:[a.geometry.coordinates[0],a.geometry.coordinates[1]]},properties:c})}let n={id:t.properties.id,edges:this.graph.edges[t.properties.id]};return this.groupBy!=="default"&&(n.groupBy=t.properties[this.groupBy]),o.features.push({type:"Feature",geometry:{type:"Point",coordinates:[t.geometry.coordinates[0],t.geometry.coordinates[1]]},properties:n}),o});m(this,"findNearestNodesOnGraph",(r,t,o,n,i=!1)=>this.graph.dijkstraFindWithinTravelDistance(r,t,n,this.geometryEdgesByMapId.get(o)??[],i));m(this,"hasLineOfSight",(r,t,o,n)=>this.graph.hasLineOfSight(r,t,this.geometryEdgesByMapId.get(o),n));m(this,"getDistance",(r,t)=>ci(r,t));m(this,"getAngle",(r,t)=>la(r,t));this.groupBy=o,this.graph=new b1({nodes:r,groupBy:this.groupBy,multiplicativeDistanceWeightScaling:n}),(t?.features||[]).forEach(a=>{let l=null;if(a.geometry.type==="LineString"?l=a.geometry.coordinates:a.geometry.type==="Polygon"&&(l=a.geometry.coordinates.flat()),l){let c=this.groupBy==="default"?this.groupBy:a.properties[this.groupBy];this.geometryEdgesByMapId.has(c)||this.geometryEdgesByMapId.set(c,[]),l.forEach((p,u)=>{this.geometryEdgesByMapId.get(c).push([p,l[u+1]||l[0]])})}})}getDirections({zones:r,originIds:t,destinationNodeIds:o,disabledConnectionNodeIds:n,simplify:i,multiplicativeDistanceWeightScaling:a,overrideEdgeWeights:l}){let c=i?.enabled??!0,p=r??[],u=this.graph.aStar({originIds:t,destinationNodeIds:o,zones:p,disabledConnectionNodeIds:new Set(n),overrideEdgeWeights:l});return u.length===0?{type:"FeatureCollection",features:[]}:(c&&(u=this.simplifyAllSteps(u,i?.bufferRadius??c2,a)),this.generatePath(u))}simplifyAllSteps(r,t,o){let n=[],i=[r[0]];for(let p=1;p<r.length;p++)if(this.groupBy!=="default"&&r[p].origin.properties[this.groupBy]!==r[p-1].origin.properties[this.groupBy]){let u=r[p-1].origin.properties[this.groupBy],f=this.geometryEdgesByMapId.get(u)??[];n.push(...this.simplifySteps(i,f,t,o)),i=[r[p]]}else i.push(r[p]);let a=r[r.length-1],l=this.groupBy==="default"?this.groupBy:a.origin.properties[this.groupBy],c=this.geometryEdgesByMapId.get(l)??[];return n.push(...this.simplifySteps(i,c,t,o)),n}simplifySteps(r,t,o,n){if(r.length<3)return r;let i=[r[0]],a=1;for(let l=a+2;l<r.length;l++)if(r[a].origin.properties.preventSmoothing||!y1(r[a].origin,r[l].origin,t,o)){let c=l-1;i.push(new Cc({...r[a],destination:r[c].origin,distance:ci(r[a].origin.geometry.coordinates,r[c].origin.geometry.coordinates),angle:la(r[a].origin.geometry.coordinates,r[c].origin.geometry.coordinates)})),a=c}return i.push(new Cc({...r[a],destination:r[r.length-1].origin,distance:ci(r[a].origin.geometry.coordinates,r[r.length-1].origin.geometry.coordinates),angle:la(r[a].origin.geometry.coordinates,r[r.length-1].origin.geometry.coordinates),multiplicativeDistanceWeightScaling:n}),r[r.length-1]),i}};d();var Dt=new WeakMap;function cu(e,r){if(Dt.has(e))return Dt.get(e);if(Ic.is(e)){let t=[];for(let o of e.navigationTarget){let n=cu(o,r);t.push(...n)}return Dt.set(e,t),t}else if(na.is(e)){let t=r.Query.__LEGACY_NEAREST_SYNC(e,r.getByType("node")),o=t?.[0]?.feature.id?[t[0].feature.id]:[];return Dt.set(e,o),o}else if(fe.is(e)){let t=r.Query.__LEGACY_NEAREST_SYNC(e,r.getByType("node"),{lineOfSight:!0}),o=t?.[0]?.feature.id?[t[0].feature.id]:[];return Dt.set(e,o),o}else if(sn.is(e)){let t=r.Query.__LEGACY_NEAREST_SYNC(e,r.getByType("node"));return t?.[0]?.feature.id?[t[0].feature.id]:[]}else if(go.is(e)){let t=r?.getMVFFeatureById("entrance",e.id),o=t?.properties.node?[t?.properties.node]:[];return Dt.set(e,o),o}else if(si.is(e)){let o=r?.getMVFFeatureById("area",e.id)?.properties.destinationNodes??[];return Dt.set(e,o),o}else if(vr.is(e)){let t=r?.getMVFFeatureById("space",e.id);if(t==null)return[];let o=t.properties.destinationNodes;return Dt.set(e,o),o}else if(an.is(e)){let t=[];for(let o of e.coordinates){let n=r.Query.__LEGACY_NEAREST_SYNC(o,r.getByType("node"));n?.[0]?.feature.id&&t.push(n[0].feature.id)}return Dt.set(e,t),t}else if(No.is(e)){let t=r?.objectEntranceNodeIdsByObstructionId[e.id];return Dt.set(e,t??[]),t??[]}else if(Ar.is(e)){let t=e.spaces.flatMap(o=>r?.getMVFFeatureById("space",o.id)?.properties.destinationNodes??[]).filter(o=>typeof o=="string");return Dt.set(e,t),t}else if(qi.is(e)){let t=e.nodes.map(o=>o.id);return Dt.set(e,t),t}else if(wn.is(e)){let t=[e.id];return Dt.set(e,t),t}else return[]}async function fl(e,r){if(Dt.has(e))return Dt.get(e);if(Ic.is(e)){let t=[];for(let o of e.navigationTarget){let n=await fl(o,r);t.push(...n)}return Dt.set(e,t),t}else if(na.is(e)){let t=await r.Query.nearest(e,r.getByType("node")),o=t?.[0]?.feature.id?[t[0].feature.id]:[];return Dt.set(e,o),o}else if(fe.is(e)){let t=await r.Query.nearest(e,r.getByType("node"),{lineOfSight:!0}),o=t?.[0]?.feature.id?[t[0].feature.id]:[];return Dt.set(e,o),o}else if(sn.is(e)){let t=await r.Query.nearest(e,r.getByType("node")),o=t?.[0]?.feature.id?[t[0].feature.id]:[];return Dt.set(e,o),o}else if(go.is(e)){let t=r?.getMVFFeatureById("entrance",e.id),o=t?.properties.node?[t?.properties.node]:[];return Dt.set(e,o),o}else if(si.is(e)){let o=r?.getMVFFeatureById("area",e.id)?.properties.destinationNodes??[];return Dt.set(e,o),o}else if(vr.is(e)){let t=r?.getMVFFeatureById("space",e.id);if(t==null)return[];let o=t.properties.destinationNodes;return Dt.set(e,o),o}else if(an.is(e)){let t=[];for(let o of e.coordinates){let n=await r.Query.nearest(o,r.getByType("node"));n?.[0]?.feature.id&&t.push(n[0].feature.id)}return Dt.set(e,t),t}else if(No.is(e)){let t=r?.objectEntranceNodeIdsByObstructionId[e.id];return Dt.set(e,t??[]),t??[]}else{if(Ar.is(e))return e.spaces.flatMap(t=>r?.getMVFFeatureById("space",t.id)?.properties.destinationNodes??[]).filter(t=>typeof t=="string");if(qi.is(e)){let t=e.nodes.map(o=>o.id);return Dt.set(e,t),t}else if(wn.is(e)){let t=[e.id];return Dt.set(e,t),t}else return[]}}function nD(e,r,t){let o=e.features[0]?.properties.id,n=r[0];if(r.length>1){for(let i of r)if((t.get(i)??[]).includes(o)){n=i;break}}return n}function iD(e,r,t){let o=e.features[e.features.length-1]?.properties.id,n=r[0];if(r.length>1){for(let i of r)if((t.get(i)??[]).includes(o)){n=i;break}}return n}var Pf,v1,pu=class{constructor({nodes:r,geojsonCollection:t,connections:o,groupBy:n,multiplicativeDistanceWeightScaling:i}){m(this,"navigator");m(this,"connections");m(this,"getDirections",async(r,t,o,n)=>{let i=[],a=[],l=new Map;for(let c of r){let p=await fl(c,n);for(let u of p)i.push(u),l.set(c,p)}for(let c of t){let p=await fl(c,n);for(let u of p)a.push(u),l.set(c,p)}return s(this,Pf).call(this,r,t,i,a,o,n,l)});m(this,"getDirectionsSync",(r,t,o,n)=>{let i=[],a=[],l=new Map;for(let c of r){let p=cu(c,n);for(let u of p)i.push(u),l.set(c,p)}for(let c of t){let p=cu(c,n);for(let u of p)a.push(u),l.set(c,p)}return s(this,Pf).call(this,r,t,i,a,o,n,l)});S(this,Pf,(r,t,o,n,i,a,l)=>{let c=this.getDisabledConnectionNodeIds(i.accessible).filter(T=>!o.includes(T)&&!n.includes(T)),p=new Map,u={...i.connectionIdWeightMap};for(let T of i.excludedConnections)u[T.id]=1/0;for(let T in u){let v=a.getById("connection",T);v&&s(this,v1).call(this,v,u[T],p)}let f=this.navigator.getDirections({zones:i.zones.map(T=>({geometry:T.geometry,cost:T.cost,map:T.floor?.id})),originIds:o,destinationNodeIds:n,disabledConnectionNodeIds:c,simplify:{enabled:i.smoothing.enabled,bufferRadius:i.smoothing.radius},overrideEdgeWeights:p,multiplicativeDistanceWeightScaling:!a.enterpriseMode});this.addCoordinateDirections(f,r,t);let h=nD(f,r,l),b=iD(f,t,l),x=new ml(f,a,h,b);if(!(x.distance===0&&new Set([...o,...n]).size===o.length+n.length))return x});m(this,"getDisabledConnectionNodeIds",r=>r===!1?[]:this.connections.reduce((t,o)=>o.accessible?t:t.concat(o.nodes),[]));S(this,v1,(r,t,o)=>{if(r.nodes.length<2)return;let n=new Set(r.nodes.map(i=>i.id));for(let i of r.nodes){let a=this.navigator.graph.edges[i.id];if(a)for(let l of a)n.has(l.destination.properties.id)&&o.set(l,t)}});m(this,"addCoordinateDirections",(r,[t],[o])=>{if(r.features.length){if(fe.is(t)){let n=this.createDirectionFeature(t,this.navigator.getAngle([t.longitude,t.latitude],r.features[0].geometry.coordinates),this.navigator.getDistance([t.longitude,t.latitude],r.features[0].geometry.coordinates));r.features.splice(0,0,n)}if(fe.is(o)){let n=this.createDirectionFeature(o,0,0),i=r.features[r.features.length-1];i.properties.distance=this.navigator.getDistance(i.geometry.coordinates,[o.longitude,o.latitude]),i.properties.angle=this.navigator.getAngle(i.geometry.coordinates,[o.longitude,o.latitude]),r.features.push(n)}}});m(this,"createDirectionFeature",(r,t,o)=>({type:"Feature",geometry:{type:"Point",coordinates:[r.longitude,r.latitude]},properties:{groupBy:r.floorId,id:r.id,angle:t,distance:o,edges:[]}}));this.navigator=new lu({nodes:r,geojsonCollection:this.createCollection(t),groupBy:n,multiplicativeDistanceWeightScaling:i}),this.connections=o}createCollection(r){return{type:"FeatureCollection",features:Object.entries(r).reduce((t,[o,n])=>t.concat(n.features.map(i=>(i.properties.map=o,i))),[])}}};Pf=new WeakMap,v1=new WeakMap;d();d();d();d();d();d();function sD(e){let r=+this._x.call(null,e),t=+this._y.call(null,e);return aD(this.cover(r,t),r,t,e)}function aD(e,r,t,o){if(isNaN(r)||isNaN(t))return e;var n,i=e._root,a={data:o},l=e._x0,c=e._y0,p=e._x1,u=e._y1,f,h,b,x,T,v,I,M;if(!i)return e._root=a,e;for(;i.length;)if((T=r>=(f=(l+p)/2))?l=f:p=f,(v=t>=(h=(c+u)/2))?c=h:u=h,n=i,!(i=i[I=v<<1|T]))return n[I]=a,e;if(b=+e._x.call(null,i.data),x=+e._y.call(null,i.data),r===b&&t===x)return a.next=i,n?n[I]=a:e._root=a,e;do n=n?n[I]=new Array(4):e._root=new Array(4),(T=r>=(f=(l+p)/2))?l=f:p=f,(v=t>=(h=(c+u)/2))?c=h:u=h;while((I=v<<1|T)===(M=(x>=h)<<1|b>=f));return n[M]=i,n[I]=a,e}function lD(e){var r,t,o=e.length,n,i,a=new Array(o),l=new Array(o),c=1/0,p=1/0,u=-1/0,f=-1/0;for(t=0;t<o;++t)isNaN(n=+this._x.call(null,r=e[t]))||isNaN(i=+this._y.call(null,r))||(a[t]=n,l[t]=i,n<c&&(c=n),n>u&&(u=n),i<p&&(p=i),i>f&&(f=i));if(c>u||p>f)return this;for(this.cover(c,p).cover(u,f),t=0;t<o;++t)aD(this,a[t],l[t],e[t]);return this}d();function cD(e,r){if(isNaN(e=+e)||isNaN(r=+r))return this;var t=this._x0,o=this._y0,n=this._x1,i=this._y1;if(isNaN(t))n=(t=Math.floor(e))+1,i=(o=Math.floor(r))+1;else{for(var a=n-t||1,l=this._root,c,p;t>e||e>=n||o>r||r>=i;)switch(p=(r<o)<<1|e<t,c=new Array(4),c[p]=l,l=c,a*=2,p){case 0:n=t+a,i=o+a;break;case 1:t=n-a,i=o+a;break;case 2:n=t+a,o=i-a;break;case 3:t=n-a,o=i-a;break}this._root&&this._root.length&&(this._root=l)}return this._x0=t,this._y0=o,this._x1=n,this._y1=i,this}d();function pD(){var e=[];return this.visit(function(r){if(!r.length)do e.push(r.data);while(r=r.next)}),e}d();function dD(e){return arguments.length?this.cover(+e[0][0],+e[0][1]).cover(+e[1][0],+e[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}d();d();function Lr(e,r,t,o,n){this.node=e,this.x0=r,this.y0=t,this.x1=o,this.y1=n}function uD(e,r,t){var o,n=this._x0,i=this._y0,a,l,c,p,u=this._x1,f=this._y1,h=[],b=this._root,x,T;for(b&&h.push(new Lr(b,n,i,u,f)),t==null?t=1/0:(n=e-t,i=r-t,u=e+t,f=r+t,t*=t);x=h.pop();)if(!(!(b=x.node)||(a=x.x0)>u||(l=x.y0)>f||(c=x.x1)<n||(p=x.y1)<i))if(b.length){var v=(a+c)/2,I=(l+p)/2;h.push(new Lr(b[3],v,I,c,p),new Lr(b[2],a,I,v,p),new Lr(b[1],v,l,c,I),new Lr(b[0],a,l,v,I)),(T=(r>=I)<<1|e>=v)&&(x=h[h.length-1],h[h.length-1]=h[h.length-1-T],h[h.length-1-T]=x)}else{var M=e-+this._x.call(null,b.data),O=r-+this._y.call(null,b.data),C=M*M+O*O;if(C<t){var E=Math.sqrt(t=C);n=e-E,i=r-E,u=e+E,f=r+E,o=b.data}}return o}d();function mD(e){if(isNaN(u=+this._x.call(null,e))||isNaN(f=+this._y.call(null,e)))return this;var r,t=this._root,o,n,i,a=this._x0,l=this._y0,c=this._x1,p=this._y1,u,f,h,b,x,T,v,I;if(!t)return this;if(t.length)for(;;){if((x=u>=(h=(a+c)/2))?a=h:c=h,(T=f>=(b=(l+p)/2))?l=b:p=b,r=t,!(t=t[v=T<<1|x]))return this;if(!t.length)break;(r[v+1&3]||r[v+2&3]||r[v+3&3])&&(o=r,I=v)}for(;t.data!==e;)if(n=t,!(t=t.next))return this;return(i=t.next)&&delete t.next,n?(i?n.next=i:delete n.next,this):r?(i?r[v]=i:delete r[v],(t=r[0]||r[1]||r[2]||r[3])&&t===(r[3]||r[2]||r[1]||r[0])&&!t.length&&(o?o[I]=t:this._root=t),this):(this._root=i,this)}function fD(e){for(var r=0,t=e.length;r<t;++r)this.remove(e[r]);return this}d();function hD(){return this._root}d();function gD(){var e=0;return this.visit(function(r){if(!r.length)do++e;while(r=r.next)}),e}d();function yD(e){var r=[],t,o=this._root,n,i,a,l,c;for(o&&r.push(new Lr(o,this._x0,this._y0,this._x1,this._y1));t=r.pop();)if(!e(o=t.node,i=t.x0,a=t.y0,l=t.x1,c=t.y1)&&o.length){var p=(i+l)/2,u=(a+c)/2;(n=o[3])&&r.push(new Lr(n,p,u,l,c)),(n=o[2])&&r.push(new Lr(n,i,u,p,c)),(n=o[1])&&r.push(new Lr(n,p,a,l,u)),(n=o[0])&&r.push(new Lr(n,i,a,p,u))}return this}d();function bD(e){var r=[],t=[],o;for(this._root&&r.push(new Lr(this._root,this._x0,this._y0,this._x1,this._y1));o=r.pop();){var n=o.node;if(n.length){var i,a=o.x0,l=o.y0,c=o.x1,p=o.y1,u=(a+c)/2,f=(l+p)/2;(i=n[0])&&r.push(new Lr(i,a,l,u,f)),(i=n[1])&&r.push(new Lr(i,u,l,c,f)),(i=n[2])&&r.push(new Lr(i,a,f,u,p)),(i=n[3])&&r.push(new Lr(i,u,f,c,p))}t.push(o)}for(;o=t.pop();)e(o.node,o.x0,o.y0,o.x1,o.y1);return this}d();function xD(e){return e[0]}function vD(e){return arguments.length?(this._x=e,this):this._x}d();function ID(e){return e[1]}function SD(e){return arguments.length?(this._y=e,this):this._y}function Ff(e,r,t){var o=new p2(r??xD,t??ID,NaN,NaN,NaN,NaN);return e==null?o:o.addAll(e)}function p2(e,r,t,o,n,i){this._x=e,this._y=r,this._x0=t,this._y0=o,this._x1=n,this._y1=i,this._root=void 0}function TD(e){for(var r={data:e.data},t=r;e=e.next;)t=t.next={data:e.data};return r}var xo=Ff.prototype=p2.prototype;xo.copy=function(){var e=new p2(this._x,this._y,this._x0,this._y0,this._x1,this._y1),r=this._root,t,o;if(!r)return e;if(!r.length)return e._root=TD(r),e;for(t=[{source:r,target:e._root=new Array(4)}];r=t.pop();)for(var n=0;n<4;++n)(o=r.source[n])&&(o.length?t.push({source:o,target:r.target[n]=new Array(4)}):r.target[n]=TD(o));return e};xo.add=sD;xo.addAll=lD;xo.cover=cD;xo.data=pD;xo.extent=dD;xo.find=uD;xo.remove=mD;xo.removeAll=fD;xo.root=hD;xo.size=gD;xo.visit=yD;xo.visitAfter=bD;xo.x=vD;xo.y=SD;d();function d2(e,r,t,o=0,n=0,i=0,a=0){if(t===void 0){t=e.root();let c=e.extent();if(c&&([[o,n],[i,a]]=c,r(t,o,n,i,a)))return!0;if(!t)return!1}let l=[[o,n,(i+o)/2,(a+n)/2],[(i+o)/2,n,i,(a+n)/2],[o,(a+n)/2,(i+o)/2,a],[(i+o)/2,(a+n)/2,i,a]];for(let c=0;c<4;c++){let p=t[c];if(p){let[u,f,h,b]=l[c];r(p,u,f,h,b)||d2(e,r,p,u,f,h,b)}}return!1}var CD=1e3,S$=.1,pi,Df,Go,wc,I1=class{constructor(r,t){S(this,pi,{});S(this,Df,new Map);m(this,"getMaxSearchRadiusForFloorId",(r,t)=>{let o=s(this,Df).get(s(this,Go).mapName)?.get(t);if(o)return o;let n=this.getNodeTreeByTypeAndFloorId(r,s(this,Go).mapName,t);if(typeof n.extent=="function")if(n.extent()){let[[i,a],[l,c]]=n.extent(),p=l-i,u=c-a;o=Math.max(p,u)}else o=CD;else o=CD;return s(this,Df).set(s(this,Go).mapName,new Map([[t,o]])),o});S(this,Go);S(this,wc);w(this,Go,r),w(this,wc,t)}searchWithIncludedIds(r,t,o,n,i,a,l=!1){let{x:c,y:p}=s(this,wc).call(this,r),u=c-a,f=c+a,h=p-a,b=p+a,x=this.getNodeTreeByTypeAndFloorId(t,o,n),T=[],v=new Set;return d2(x,(I,M,O,C,E)=>{let _=M>=f||O>=b||C<u||E<h;if("data"in I){let G=I.data,R=G.properties.parentId||G.properties.id;if(i.includes(R)&&!v.has(R)){v.add(R);let N=ci(r,G.geometry.coordinates);N<=a&&(l?s(this,Go).directions.navigator.hasLineOfSight(r,G.geometry.coordinates,n,S$)&&T.push({node:G,distance:N}):T.push({node:G,distance:N}))}}return _}),T.sort((I,M)=>I.distance-M.distance)}getNodeTreeByTypeAndFloorId(r,t,o){if(s(this,pi)[r]||(s(this,pi)[r]={}),s(this,pi)[r][t]?.[o])return s(this,pi)[r][t][o];s(this,pi)[r][t]||(s(this,pi)[r][t]={}),s(this,pi)[r][t][o]=Ff();let n=s(this,pi)[r][t][o];n.x(a=>s(this,wc).call(this,a.geometry.coordinates).x),n.y(a=>s(this,wc).call(this,a.geometry.coordinates).y);let i=[];switch(r){case"space":i=s(this,Go).mvfSpacesByFloorId[o].flatMap(l=>l.properties.destinationNodes).map(l=>{let c=s(this,Go).mvfNodesById[l];return c?{...c,properties:{id:c.properties.id,parentId:c.properties.space[0]}}:null});break;case"node":i=s(this,Go).mvfNodesByFloorId[o]?.filter(l=>l.properties.neighbors.length>0)||[];break;case"point-of-interest":i=s(this,Go).mvfPoisByFloorId[o]||[];break;case"door":i=s(this,Go).mvfEntrancesByFloorId[o]||[];break;case"annotation":i=s(this,Go).mvfAnnotationsByFloorId[o]||[];break}return i?.length>0&&n.addAll(i),n}};pi=new WeakMap,Df=new WeakMap,Go=new WeakMap,wc=new WeakMap;var du=50,MD=111319.9,u2=!1,wD=J.object({limit:J.enum(["same-floor","same-elevation"]).optional(),mode:J.enum(["travel-distance","absolute-distance"]).optional(),lineOfSight:J.boolean().optional().or(J.literal("auto")),maxDistance:J.number().optional()}),OD={lineOfSight:u2,mode:"travel-distance",maxDistance:du,limit:"same-floor"},Ir,Af,S1,Lf,m2,uu,T1,C1,kf=class{constructor(r){S(this,Lf);S(this,Ir);S(this,Af);S(this,S1,([r,t])=>{let[o,n]=[s(this,Ir).mapCenter.longitude,s(this,Ir).mapCenter.latitude],i=MD,a=MD*Math.cos(t*Math.PI/180),l=(r-o)*a,c=(t-n)*i;return{x:l,y:c}});m(this,"__LEGACY_NEAREST_SYNC",(r,t,o)=>{let n={...OD,...o};try{wD.parse(n)}catch(u){A.error(u);return}let i=jd(r);if(!i)return;let a=W(this,Lf,m2).call(this,i,n),l=[],c={},p=[];for(let u of t){let f=cu(u,s(this,Ir));if(f)for(let h of f)c[h]||(c[h]=[]),c[h].push(u),p.push(h)}return o?.mode==="absolute-distance"?l=s(this,uu).call(this,i,a,t,n):l=s(this,C1).call(this,r,a,p,c,n),l.sort((u,f)=>u.distance-f.distance)});S(this,uu,(r,t,o,n)=>{let i=[],a=new Set(o.map(l=>l.__type));for(let l of t)for(let c of a){let p=s(this,Af).searchWithIncludedIds([r.longitude,r.latitude],c,s(this,Ir).mapName,l,o.filter(u=>u.__type===c).map(u=>u.id),n?.maxDistance??du,n?.lineOfSight==="auto"?u2:n?.lineOfSight);if(p)for(let u of p)i.push({distance:u.distance,feature:s(this,Ir).getById(c,u.node.properties.parentId)||s(this,Ir).getById(c,u.node.properties.id)})}return i});S(this,T1,async(r,t,o,n,i)=>{let a=[];for(let l of t){let c,p=0;if(!wn.is(r)){let u=s(this,uu).call(this,r.anchorTarget,[l],s(this,Ir).getByType("node").filter(f=>f.floor.id===l),{limit:"same-floor",lineOfSight:i?.lineOfSight??!0,mode:"absolute-distance",maxDistance:i?.maxDistance??du});u.length>0&&(c=u[0].feature,p=u[0].distance)}if(c){let u=new Set,f=s(this,Ir).directions.navigator.findNearestNodesOnGraph(c.id,(i?.maxDistance??du)-p,l,o,!1);for(let h of f)for(let b of n[h.feature.properties.id])u.has(b.id)||(a.push({distance:h.distance+p,feature:b}),u.add(b.id))}}return a});S(this,C1,(r,t,o,n,i)=>{let a=[];for(let l of t){let c;if(wn.is(r)||(c=this.__LEGACY_NEAREST_SYNC(r,s(this,Ir).getByType("node"),{lineOfSight:i?.lineOfSight??!0,mode:"absolute-distance",maxDistance:i?.maxDistance??du})?.[0].feature),c){let p=s(this,Ir).directions.navigator.findNearestNodesOnGraph(c.id,i?.maxDistance??du,l,o,i?.lineOfSight==="auto"?u2:i?.lineOfSight);for(let u of p)for(let f of n[u.feature.properties.id])a.push({distance:u.distance,feature:f})}}return a});w(this,Ir,r),w(this,Af,new I1(s(this,Ir),s(this,S1)))}async nearest(r,t,o){let n={...OD,...o};try{wD.parse(n)}catch(f){A.error(f);return}let i=jd(r);if(!i)return;let a=W(this,Lf,m2).call(this,i,n),l=[],c={},p=[],u=[];if(o?.mode==="absolute-distance")l=s(this,uu).call(this,i,a,t,n);else{for(let f of t)u.push(fl(f,s(this,Ir)).then(h=>{if(h)for(let b of h)c[b]||(c[b]=[]),c[b].push(f),p.push(b)}));await Promise.all(u),l=await s(this,T1).call(this,r,a,p,c,n)}return l.sort((f,h)=>f.distance-h.distance)}};Ir=new WeakMap,Af=new WeakMap,S1=new WeakMap,Lf=new WeakSet,m2=function(r,t){let o=r.floorId?[r.floorId]:[];if(r.floorId==null)for(let n of s(this,Ir).getByType("floor-stack")){let i=n.defaultFloor;i&&o.push(i.id)}else if(t?.limit==="same-elevation"){let n=s(this,Ir).floorsById[r.floorId];if(n){let i=n?.elevation;i&&(o=s(this,Ir).getByType("floor-stack").map(a=>a.floors.find(l=>l.elevation===i)?.id).filter(Boolean))}}return o},uu=new WeakMap,T1=new WeakMap,C1=new WeakMap;d();d();var _f,M1=class{constructor(r){S(this,_f);w(this,_f,r||[])}get raw(){return s(this,_f)}};_f=new WeakMap;var Yr,le,Ot,mu=class mu extends xr{constructor(t,o){super(o.mvfData.id);m(this,"__type",mu.__type);m(this,"id","loc_");m(this,"name","");m(this,"externalId");m(this,"description");m(this,"logo");m(this,"phone");m(this,"social",[]);m(this,"images",[]);m(this,"links",[]);m(this,"website");m(this,"icon");S(this,Yr);S(this,le,{});S(this,Ot);w(this,Yr,t),w(this,Ot,o.mvfData);for(let n in o.mvfData)n==="links"?this.links=o.mvfData.links.map(i=>new ic({mvfData:i})):n==="pictures"?this.images=o.mvfData.pictures.map(i=>i.url?new ac({mvfData:{...i,url:i.url??""},mapData:s(this,Yr)}):void 0).filter(i=>i!=null):n==="website"?o.mvfData.website&&(this.website=new ic({mvfData:o.mvfData.website})):n==="icon"?o.mvfData.icon&&(this.icon=new ac({mvfData:{url:o.mvfData.icon},mapData:s(this,Yr)})):Object.getOwnPropertyDescriptor(Object.getPrototypeOf(this),n)||Object.defineProperty(this,n,{enumerable:!0,get(){return s(this,Ot)[n]}})}static is(t){return t.__type===mu.__type}get spaces(){if(s(this,le).spaces)return s(this,le).spaces;if(s(this,Ot).spaces==null)return s(this,le).spaces=[],s(this,le).spaces;s(this,le).spaces=[];for(let t=0;t<s(this,Ot).spaces.length;t++){let o=s(this,Yr).getById("space",s(this,Ot).spaces[t].id);o&&s(this,le).spaces.push(o)}return s(this,le).spaces}get points(){if(s(this,le).points)return s(this,le).points;if(s(this,Ot).spaces==null)return s(this,le).points=[],s(this,le).points;s(this,le).points=[];for(let t=0;t<s(this,Ot).spaces.length;t++){let o=s(this,Yr).getById("point-of-interest",s(this,Ot).spaces[t].id);o&&s(this,le).points.push(o)}return s(this,le).points}get doors(){if(s(this,le).doors)return s(this,le).doors;if(s(this,Ot).entrances==null)return s(this,le).doors=[],s(this,le).doors;s(this,le).doors=[];for(let t=0;t<s(this,Ot).entrances.length;t++){let o=s(this,Yr).getById("door",s(this,Ot).entrances[t].id);o&&s(this,le).doors.push(o)}return s(this,le).doors}get connections(){if(s(this,le).connections)return s(this,le).connections;if(s(this,Ot).connections==null)return s(this,le).connections=[],s(this,le).connections;let t=new Set;for(let o=0;o<s(this,Ot).connections.length;o++){let n=s(this,Ot).connections[o],i=s(this,Yr).mvfConnectionsById[n],l=(i==null?[]:i.nodes).map(c=>s(this,Yr).getById("node",c)).filter(Boolean);for(let c of l){if(c==null)continue;let p=Qi([c.coordinate.longitude,c.coordinate.latitude]),f=(s(this,Yr).connectionSpaceIdsByLatLon[p]??[]).map(h=>s(this,Yr).connectionsById[h]).filter(h=>h!=null);for(let h of f)t.add(h)}}return s(this,le).connections=Array.from(t),s(this,le).connections}get annotations(){if(s(this,le).annotations)return s(this,le).annotations;if(s(this,Ot).annotations==null)return s(this,le).annotations=[],s(this,le).annotations;s(this,le).annotations=[];for(let t=0;t<s(this,Ot).annotations.length;t++){let o=s(this,Yr).getById("annotation",s(this,Ot).annotations[t].id);o&&s(this,le).annotations.push(o)}return s(this,le).annotations}get categories(){return s(this,le).categories?s(this,le).categories:s(this,Ot).categories==null?(s(this,le).categories=[],s(this,le).categories):(s(this,le).categories=s(this,Ot).categories.map(t=>s(this,Yr).getById("location-category",t)).filter(t=>t!=null),s(this,le).categories)}get mapObjects(){return s(this,le).mapObjects?s(this,le).mapObjects:s(this,Ot).obstructions==null?(s(this,le).mapObjects=[],s(this,le).mapObjects):(s(this,le).mapObjects=s(this,Ot).obstructions.map(t=>s(this,Yr).getById("object",t.id)).filter(t=>t!=null),s(this,le).mapObjects)}get areas(){return s(this,le).areas?s(this,le).areas:s(this,Ot).areas==null?(s(this,le).areas=[],s(this,le).areas):(s(this,le).areas=s(this,Ot).areas.map(t=>s(this,Yr).getById("area",t.id)).filter(t=>t!=null),s(this,le).areas)}get focusTarget(){if(s(this,le).focusTarget)return s(this,le).focusTarget;let t=[];for(let o of this.spaces)t.push(o);for(let o of this.connections)t.push(...o.coordinates);for(let o of this.doors)t.push(o.focusTarget);for(let o of this.mapObjects)t.push(o.focusTarget);for(let o of this.annotations)t.push(o.focusTarget);for(let o of this.points)t.push(o.focusTarget);for(let o of this.areas)t.push(o.focusTarget);return s(this,le).focusTarget=t,t}get openingHours(){return s(this,le).openingHours?s(this,le).openingHours:(s(this,le).openingHours=new M1(s(this,Ot).openingHoursSpecification??[]),s(this,le).openingHours)}get navigationTarget(){if(s(this,le).navigationTarget)return s(this,le).navigationTarget;let t=[];for(let o of this.spaces)t.push(o);for(let o of this.connections)t.push(...o.coordinates);for(let o of this.doors)t.push(o.focusTarget);for(let o of this.mapObjects)t.push(o.focusTarget);for(let o of this.annotations)t.push(o.focusTarget);for(let o of this.points)t.push(o.focusTarget);return s(this,le).navigationTarget=t,t}toJSON(){return{__type:mu.__type,id:this.id,name:this.name}}};Yr=new WeakMap,le=new WeakMap,Ot=new WeakMap,m(mu,"__type","location-profile");var f2=mu,Ic=f2;d();var hl,Uo,Oc,fu=class fu extends xr{constructor(t,o){super(o.mvfData.id);m(this,"__type",fu.__type);m(this,"id","cat_");m(this,"name","");m(this,"icon","");S(this,hl);S(this,Uo,{});S(this,Oc);w(this,hl,t),w(this,Oc,o.mvfData);for(let n in o.mvfData)Object.getOwnPropertyDescriptor(Object.getPrototypeOf(this),n)||Object.defineProperty(this,n,{enumerable:!0,get(){return s(this,Oc)[n]}})}static is(t){return t.__type===fu.__type}get parent(){return s(this,Uo).parent?s(this,Uo).parent:(s(this,Uo).parent=s(this,Oc).parent?s(this,hl).getById("location-category",s(this,Oc).parent):void 0,s(this,Uo).parent)}get children(){return s(this,Uo).children?s(this,Uo).children:(s(this,Uo).children=s(this,hl).locationCategoriesByParentId[this.id]||[],s(this,Uo).children)}get locationProfiles(){if(s(this,Uo).locationProfiles)return s(this,Uo).locationProfiles;let t=[];for(let o of s(this,hl).locationProfilesByCategoryId[this.id]||[]){let n=s(this,hl).getById("location-profile",o.id);n&&t.push(n)}return s(this,Uo).locationProfiles=t,t}toJSON(){return{__type:fu.__type,id:this.id,name:this.name}}};hl=new WeakMap,Uo=new WeakMap,Oc=new WeakMap,m(fu,"__type","location-category");var h2=fu,d1=h2;var ge,w1,PD,hu,Ec=class extends ke{constructor(t,o){super();S(this,w1);m(this,"Analytics");S(this,ge,{});m(this,"Query");m(this,"mvf");m(this,"outdoorViewToken");m(this,"objectEntranceNodeIdsByObstructionId");m(this,"obstructionIdByEntranceId");m(this,"venue");m(this,"tokenManager");m(this,"directions");m(this,"enterpriseMode",!1);m(this,"nodesById");m(this,"spacesById");m(this,"floorsById");m(this,"floorStacksById");m(this,"facadesById");m(this,"facadesBySpaceId");m(this,"connectionsById");m(this,"objectsById");m(this,"doorsById");m(this,"pointsOfInterestById");m(this,"annotationsById");m(this,"areasById");m(this,"locationProfilesById");m(this,"locationCategoriesById");m(this,"locationProfilesByExternalId");m(this,"locationProfilesByCategoryId");m(this,"locationCategoriesByParentId");m(this,"doorsByNodeId");m(this,"mvfAnnotationsById");m(this,"mvfConnectionsById");m(this,"mvfConnectionsByNodeId");m(this,"mvfConnectionIdsByLatLon");m(this,"mvfEntrancesById");m(this,"mvfNodesById");m(this,"mvfObstructionById");m(this,"mvfSpacesById");m(this,"mvfFloorsById");m(this,"mvfFloorStacksById");m(this,"mvfAreasById");m(this,"spacesByExternalId");m(this,"nodesByExternalId");m(this,"objectsByExternalId");m(this,"poisByExternalId");m(this,"floorsByExternalId");m(this,"floorStacksByExternalId");m(this,"doorsByExternalId");m(this,"areasByExternalId");m(this,"connectionSpaceIdsByLatLon",{});m(this,"locationProfilesByAttachedFeatureId",{});m(this,"locationsById",{});m(this,"categoriesById",{});m(this,"mvfLocationsBySpaceId",{});m(this,"locationIdsByNodeId",{});m(this,"spaceIdsByNodeId",{});m(this,"connectionsByExternalId",{});m(this,"locationsByExternalId",{});m(this,"categoriesByExternalId",{});m(this,"destinationNodesIdsBySpaceId",{});m(this,"mvfNodesByFloorId");m(this,"mvfSpacesByFloorId");m(this,"mvfPoisByFloorId");m(this,"mvfEntrancesByFloorId");m(this,"mvfAnnotationsByFloorId");m(this,"localePacksUrls");m(this,"currentLanguage");m(this,"languagePacks",{});m(this,"tilesets",{});m(this,"navigationFlags");m(this,"binaryBundle");m(this,"envControl");m(this,"getMapDataOptions");m(this,"propTranslationCache",new Map);S(this,hu);m(this,"__LEGACY_GET_DIRECTIONS_MULTI_DESTINATION_SYNC",(t,o,n)=>this.__LEGACY_GET_DIRECTIONS_SYNC(t,o,{...n,multiDestination:!0}));m(this,"__LEGACY_GET_DIRECTIONS_SYNC",(t,o,n)=>{let{accessible:i=!1,multiDestination:a=!1}=n||{},l=ED(this.enterpriseMode,n),c=n?.zones||[],p={accessible:i,zones:c,smoothing:l,excludedConnections:n?.excludedConnections||[],connectionIdWeightMap:n?.connectionIdWeightMap||{}};if(a&&Array.isArray(o)){let u=Array.isArray(t)?t:[t],f=[];for(let h of o){let b=Array.isArray(h)?h:[h],x=this.directions.getDirectionsSync(u,b,p,this);if(!x){A.error("getDirections failed due to missing directions for one of the segments");return}u=b,f.push(x)}return f}else{let u=Array.isArray(t)?t:[t],f=Array.isArray(o)?o:[o];if(Array.isArray(f[0])){A.error("getDirections does not support multi-destination without multisegment option");return}u[0].id&&f[0].id&&this.Analytics.sendGetDirectionsEvent(u[0].id,f[0].id,i);try{return this.directions.getDirectionsSync(u,f,p,this)}catch(h){A.error("Unable to get directions",h);return}}});m(this,"getDirections",async(t,o,n)=>{let{accessible:i=!1}=n||{},a=ED(this.enterpriseMode,n),l=n?.zones||[],c={accessible:i,zones:l,smoothing:a,excludedConnections:n?.excludedConnections||[],connectionIdWeightMap:n?.connectionIdWeightMap||{}},p=Array.isArray(t)?t:[t],u=Array.isArray(o)?o:[o];if(Array.isArray(u[0])){A.error("getDirections does not support multi-destination without multisegment option");return}p[0].id&&u[0].id&&this.Analytics.sendGetDirectionsEvent(p[0].id,u[0].id,i);try{return this.directions.getDirections(p,u,c,this)}catch(f){A.error("Unable to get directions",f);return}});m(this,"getDirectionsMultiDestination",async(t,o,n)=>Promise.resolve(this.__LEGACY_GET_DIRECTIONS_MULTI_DESTINATION_SYNC(t,o,n)));m(this,"transformImageRequest",async t=>{if(this.enterpriseMode||!this.getMapDataOptions)return{url:t};if(!E5(t))return{url:t};if(P5(t))return{url:t};let o=a1(t);if(!o)return{url:t};try{let i=(await this.tokenManager?.getSasTokensAsync())?.[o.mapId];if(i==null)throw new Error("SAS token not found");let[a]=t.split("?");return{url:`${a}?${i.token}`}}catch(n){return A.error("Failed to append SAS token to image request. Requests for private images may fail.",n),{url:t}}});let n=o?.env??tl();if(this.envControl=n,this.binaryBundle=o?.binaryBundle,this.Analytics=new Pp,this.localePacksUrls=o?.localePacksUrls??{},this.mvf=t,this.outdoorViewToken=o?.outdoorViewToken,this.getMapDataOptions=o?.getMapDataOptions,t["tileset.json"]?.default!=null&&(this.tilesets[t["tileset.json"].default.key]=t["tileset.json"].default,n.updateTileServerBaseUrl(t["tileset.json"].default.url),t["tileset.json"].others!=null))for(let a of t["tileset.json"].others)this.tilesets[a.key]=a;this.navigationFlags=t["navigationFlags.json"]??{},this.enterpriseMode=o?.enterprise??!1,this.tokenManager=o?.tokenManager;let i=R5(t,this);if(this.nodesById=i.nodesById,this.spacesById=i.spacesById,this.floorsById=i.floorsById,this.floorStacksById=i.floorStacksById,this.facadesById=i.facadesById,this.facadesBySpaceId=i.facadesBySpaceId,this.connectionsById=i.connectionsById,this.objectsById=i.objectsById,this.doorsById=i.doorsById,this.pointsOfInterestById=i.poisById,this.annotationsById=i.annotationsById,this.areasById=i.areasById,this.locationProfilesById=i.locationProfilesById,this.locationCategoriesById=i.locationCategoriesById,this.locationProfilesByCategoryId=i.locationProfilesByCategoryId,this.locationCategoriesByParentId=i.locationCategoriesByParentId,this.spacesByExternalId=i.spacesByExternalId,this.nodesByExternalId=i.nodesByExternalId,this.objectsByExternalId=i.objectsByExternalId,this.floorsByExternalId=i.floorsByExternalId,this.locationProfilesByExternalId=i.locationProfilesByExternalId,this.floorStacksByExternalId=i.floorStacksByExternalId,this.poisByExternalId=i.poisByExternalId,this.doorsByExternalId=i.doorsByExternalId,this.areasByExternalId=i.areasByExternalId,this.mvfAnnotationsById=i.mvfAnnotationsById,this.mvfConnectionsById=i.mvfConnectionsById,this.mvfConnectionsByNodeId=i.mvfConnectionsByNodeId,this.mvfConnectionIdsByLatLon=i.mvfConnectionIdsByLatLon,this.mvfEntrancesById=i.mvfEntrancesById,this.mvfNodesById=i.mvfNodesById,this.mvfObstructionById=i.mvfObstructionById,this.mvfSpacesById=i.mvfSpacesById,this.mvfFloorsById=i.mvfFloorsById,this.mvfFloorStacksById=i.mvfFloorStacksById,this.mvfNodesByFloorId=i.mvfNodesByFloorId,this.mvfSpacesByFloorId=i.mvfSpacesByFloorId,this.mvfPoisByFloorId=i.mvfPoisByFloorId,this.mvfEntrancesByFloorId=i.mvfEntrancesByFloorId,this.mvfAnnotationsByFloorId=i.mvfAnnotationsByFloorId,this.mvfAreasById=i.mvfAreasById,this.doorsByNodeId=i.doorsByNodeId,this.objectEntranceNodeIdsByObstructionId=i.objectEntranceNodeIdsByObstructionId,this.obstructionIdByEntranceId=i.obstructionIdByEntranceId,this.connectionSpaceIdsByLatLon=i.connectionIdsByLatLon,this.locationProfilesByAttachedFeatureId=i.locationProfilesByAttachedFeatureId,this.enterpriseMode||Rf()){let a=_5(t,this);if(this.locationsById=a.locationsById,this.categoriesById=a.categoriesById,this.mvfLocationsBySpaceId=a.mvfLocationsBySpaceId,this.locationIdsByNodeId=a.locationIdsByNodeId,this.spaceIdsByNodeId=a.spaceIdsByNodeId,this.connectionsByExternalId=a.connectionsByExternalId,this.locationsByExternalId=a.locationsByExternalId,this.categoriesByExternalId=a.categoriesByExternalId,this.destinationNodesIdsBySpaceId=a.destinationNodesIdsBySpaceId,a.venue.name!=null){this.venue=new t2(this,{mvfData:a.venue});let l={};for(let c in a.mvfLocationsById)l[c]=a.mvfLocationsById[c];for(let c in a.locationInstancesById)l[c]=a.locationInstancesById[c];this.languagePacks[this.venue.defaultLanguage.code]={type:"initial",optimized:{"enterprise-location":l,"enterprise-category":a.mvfCategoriesById,"floor-stack":i.mvfFloorStacksById,floor:i.mvfFloorsById}},o?.languagePacks?.forEach(({language:c,localePack:p})=>{this.languagePacks[c.code]=DS(p)}),this.currentLanguage=this.venue.defaultLanguage}}this.directions=new pu({nodes:t["node.geojson"],geojsonCollection:t.enterprise?t.space:t.obstruction,connections:t["connection.json"],groupBy:"map",multiplicativeDistanceWeightScaling:!this.enterpriseMode}),this.Query=new kf(this)}getEnv(){let t=this;return{get baseUri(){return t.envControl.getBaseUri()},get baseAuthUri(){return t.envControl.getBaseAuthUri()},get analyticsBaseUri(){return t.envControl.getAnalyticsBaseUri()},get tileServerUri(){return t.envControl.getTileServerUri()}}}get mapName(){return this.mvf["manifest.geojson"].features[0].properties.name}get organizationId(){return this.mvf["manifest.geojson"].features[0].properties.org_id??""}get mapCenter(){return new fe(this.mvf["manifest.geojson"].features[0].geometry.coordinates[1],this.mvf["manifest.geojson"].features[0].geometry.coordinates[0])}get naturalBearing(){return this.mvf["manifest.geojson"].features[0].properties.naturalBearing??0}get spaces(){return s(this,ge).spaces==null&&(s(this,ge).spaces=globalThis.Object.values(this.spacesById)),s(this,ge).spaces}get objects(){return s(this,ge).objects==null&&(s(this,ge).objects=globalThis.Object.values(this.objectsById)),s(this,ge).objects}get connections(){return s(this,ge).connections==null&&(s(this,ge).connections=globalThis.Object.values(this.connectionsById)),s(this,ge).connections}get floors(){return s(this,ge).floors==null&&(s(this,ge).floors=globalThis.Object.values(this.floorsById)),s(this,ge).floors}get floorStacks(){return s(this,ge).floorStacks==null&&(s(this,ge).floorStacks=globalThis.Object.values(this.floorStacksById)),s(this,ge).floorStacks}get facades(){return s(this,ge).facades==null&&(s(this,ge).facades=globalThis.Object.values(this.facadesById)),s(this,ge).facades}get doors(){return s(this,ge).doors==null&&(s(this,ge).doors=globalThis.Object.values(this.doorsById)),s(this,ge).doors}get pointsOfInterest(){return s(this,ge).pointsOfInterest==null&&(s(this,ge).pointsOfInterest=globalThis.Object.values(this.pointsOfInterestById)),s(this,ge).pointsOfInterest}get annotations(){return s(this,ge).annotations==null&&(s(this,ge).annotations=globalThis.Object.values(this.annotationsById)),s(this,ge).annotations}get areas(){return s(this,ge).areas==null&&(s(this,ge).areas=globalThis.Object.values(this.areasById)),s(this,ge).areas}get nodes(){return s(this,ge).nodes==null&&(s(this,ge).nodes=globalThis.Object.values(this.nodesById)),s(this,ge).nodes}get locations(){return s(this,ge).locations==null&&(s(this,ge).locations=globalThis.Object.values(this.locationsById)),globalThis.Object.values(this.locationsById)}get categories(){return s(this,ge).categories==null&&(s(this,ge).categories=globalThis.Object.values(this.categoriesById)),globalThis.Object.values(this.categoriesById)}get locationProfiles(){return s(this,ge).locationProfiles==null&&(s(this,ge).locationProfiles=globalThis.Object.values(this.locationProfilesById)),s(this,ge).locationProfiles}get locationCategories(){return s(this,ge).locationCategories==null&&(s(this,ge).locationCategories=globalThis.Object.values(this.locationCategoriesById)),s(this,ge).locationCategories}get mvfFloors(){return s(this,ge).mvfFloors==null&&(s(this,ge).mvfFloors=globalThis.Object.values(this.mvfFloorsById)),s(this,ge).mvfFloors}get mvfFloorStacks(){return s(this,ge).mvfFloorStacks==null&&(s(this,ge).mvfFloorStacks=globalThis.Object.values(this.mvfFloorStacksById)),s(this,ge).mvfFloorStacks}getByType(t){switch(t){case"location-profile":return this.locationProfiles;case"location-category":return this.locationCategories;case"area":return this.areas;case"node":return this.nodes;case"space":return this.spaces;case"door":return this.doors;case"floor":return this.floors;case"floor-stack":return this.floorStacks;case"connection":return this.connections;case"object":return this.objects;case"point-of-interest":return this.pointsOfInterest;case"annotation":return this.annotations;case"enterprise-location":return this.locations;case"enterprise-category":return this.categories;case"enterprise-venue":return this.venue;case"facade":return this.facades;default:return[]}}getById(t,o){let n={"location-profile":this.locationProfilesById,"location-category":this.locationCategoriesById,space:this.spacesById,floor:this.floorsById,"floor-stack":this.floorStacksById,facade:this.facadesById,node:this.nodesById,door:this.doorsById,connection:this.connectionsById,"mvf-connection":l=>W(this,w1,PD).call(this,this.mvfConnectionsById[l]),object:this.objectsById,"point-of-interest":this.pointsOfInterestById,annotation:this.annotationsById,area:this.areasById,"enterprise-location":this.locationsById,"enterprise-category":this.categoriesById},i=l=>{let c=n[l];if(c!=null)return typeof c=="function"?c(o):c[o]},a=()=>{for(let l of Object.keys(n)){let c=i(l);if(c!=null)return c}};return t==="unknown"?a():i(t)}getByExternalId(t,o){switch(t){case"location-profile":return this.locationProfilesByExternalId[o]??[];case"location-category":return[];case"space":return this.spacesByExternalId[o]??[];case"floor":return this.floorsByExternalId[o]??[];case"floor-stack":return this.floorStacksByExternalId[o]??[];case"node":return this.nodesByExternalId[o]??[];case"door":return this.doorsByExternalId[o]??[];case"connection":return this.connectionsByExternalId[o]??[];case"object":return this.objectsByExternalId[o]??[];case"point-of-interest":return this.poisByExternalId[o]??[];case"area":return this.areasByExternalId[o]??[];case"enterprise-location":return this.locationsByExternalId[o]??[];case"enterprise-category":return this.categoriesByExternalId[o]??[];default:return[]}}getMapDataById(t){return this.spacesById[t]??this.floorsById[t]??this.floorStacksById[t]??this.facadesById[t]??this.nodesById[t]??this.doorsById[t]??this.connectionsById[t]??this.objectsById[t]??this.pointsOfInterestById[t]??this.annotationsById[t]??this.areasById[t]}getMVFFeatureById(t,o){switch(t){case"space":return this.mvfSpacesById[o];case"node":return this.mvfNodesById[o];case"obstruction":return this.mvfObstructionById[o];case"floor":return this.mvfFloorsById[o];case"floor-stack":return this.mvfFloorStacksById[o];case"connection":return this.mvfConnectionsById[o];case"entrance":return this.mvfEntrancesById[o];case"annotation":return this.mvfAnnotationsById[o];case"area":return this.mvfAreasById[o];default:throw new Error(`Unknown MVF feature type: ${t}`)}}getMVFFeatureByNodeId(t,o){switch(t){case"connection":return this.mvfConnectionsByNodeId[o];default:throw new Error(`Unsupported MVF feature type: ${t}`)}}getMVFFeatureByType(t){switch(t){case"floor-stack":return this.mvfFloorStacks;case"floor":return this.mvfFloors;default:throw new Error(`Unsupported MVF feature type: ${t}`)}}getPropTranslation(t,o,n,i){if(!this.currentLanguage)return i;let{code:a}=this.currentLanguage,l=this.languagePacks[a]?.optimized?.[t];if(l){let c=l[n];if(c!=null&&c[o]!==void 0){let p=c[o];if(p!=null&&typeof p=="object"){if(typeof i=="object"&&typeof p=="object"&&!Array.isArray(p)){let u=ny(a+t+n+o.toString());if(this.propTranslationCache.has(u))return this.propTranslationCache.get(u);let f=Ef(i,p,["id"]);return this.propTranslationCache.set(u,f),f}return p}return p}}return i}findPreferredLanguage(t){if(!this.venue)return;let o=g2(this.venue,t);return t?.languageCode!=null&&t.languageCode.toLowerCase()!==o.code.toLowerCase()&&A.warn(`Language code "${t.languageCode}" could not be found in the venue. Using "${o.code}" instead.`),o}async changeLanguage(t){let o=t.toLowerCase();if(!o){A.error("Language code must be defined.");return}if(!this.currentLanguage||!this.venue){A.error("Changing the language is not supported for this map.");return}let n=this.currentLanguage.code,i=this.venue?.languages.find(({code:l})=>l.toLowerCase()===o.toLowerCase());if(!i){A.warn(`Language code "${o}" could not be found in the venue.`);return}if(n===i.code)return;let a=this.languagePacks[i.code];if(!a){let l=this.localePacksUrls[i.code];if(!l){A.error(`Locale pack URL not found for language code "${i.code}".`);return}s(this,hu)&&s(this,hu).abort();let c=new AbortController;w(this,hu,c);let p;try{p=await s5(l,{signal:c.signal})}catch(u){A.error(`Failed to download language pack for language code "${i.code}".`,u);return}if(!p||c.signal.aborted)return;a=DS(p),this.languagePacks[i.code]=a}this.Analytics.sendChangeLanguageEvent({fromLanguage:this.currentLanguage.code}),this.currentLanguage=i,this.publish("language-change",this.currentLanguage)}getDistance(t,o){let n=jd(t),i=jd(o);return ci([n.longitude,n.latitude],[i.longitude,i.latitude])}async toJSONBundle({downloadLanguagePacks:t=!0}={}){let o=[];if(t&&this.enterpriseMode){let n=new AbortController;for(let i of this.venue?.languages||[])try{if(this.localePacksUrls[i.code]){let a=await cS(this.localePacksUrls[i.code],{signal:n.signal}),l=await Sd(a);l&&o.push({language:{code:i.code,name:i.name},localePack:l})}}catch(a){A.warn("failed downloading language pack",a)}}return{type:"json",options:{enterprise:this.enterpriseMode},languagePacks:o,main:this.mvf}}async toBinaryBundle({downloadLanguagePacks:t=!0}={}){if(!this.binaryBundle){A.error("binary bundle not found");return}let o=[];if(t&&this.enterpriseMode){let n=new AbortController;for(let i of this.venue?.languages||[])try{if(this.localePacksUrls[i.code]){let a=await cS(this.localePacksUrls[i.code],{signal:n.signal});a&&o.push({language:{code:i.code,name:i.name},localePack:a})}}catch(a){A.warn("failed downloading language pack",a)}}return{type:"binary",options:{enterprise:this.enterpriseMode},languagePacks:o,main:this.binaryBundle}}destroy(){for(let t of globalThis.Object.keys(s(this,ge)))s(this,ge)[t]=null;this.propTranslationCache.clear()}};ge=new WeakMap,w1=new WeakSet,PD=function(t){let o=t?.nodes?.[0],n=this.getById("node",o);if(n==null)return;let i=Qi([n.coordinate.longitude,n.coordinate.latitude]);return this.connectionSpaceIdsByLatLon[i]?.map(l=>this.connectionsById[l]).find(l=>l!=null)},hu=new WeakMap;var ED=(e,r)=>{let t=!e,o=r?.smoothing,i=o!=null?typeof o=="object"?o.enabled??t:o:t,a=typeof o=="object"?o.radius:void 0;return{enabled:i,radius:a??.75}};d();d();d();d();(function(){typeof globalThis!="object"&&(Object.defineProperty(Object.prototype,"__magic__",{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__)})();var FD="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAkGBwgHBgkICAgKCgkLDhcPDg0NDhwUFREXIh4jIyEeICAlKjUtJScyKCAgLj8vMjc5PDw8JC1CRkE6RjU7PDn/2wBDAQoKCg4MDhsPDxs5JiAmOTk5OTk5OTk5OTk5OTk5OTk5OTk5OTk5OTk5OTk5OTk5OTk5OTk5OTk5OTk5OTk5OTn/wgARCAIABAADAREAAhEBAxEB/8QAGwABAAMBAQEBAAAAAAAAAAAAAAECAwQFBgf/xAAWAQEBAQAAAAAAAAAAAAAAAAAAAQL/2gAMAwEAAhADEAAAAP3EAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAIAAAJAFAAAAAAAAAAAAAAAAAAAAAAAAABAgAAEgCgAAAAAAAAAAAAAAAAAAAABERLSM1zM4zXMzjMoUIqCCSSS8XNC9mpoaVomharWTQAAAAAAAAAAAAAAAAEREtIoZrnGZkucUKFStQQSTFixdNDStF0TWrmiWqbJoAAAAAAAAAAAAAIgiWkZy4HNLzHLXKcxzpzmFYmRkUKFSCCSSxcuampsbR0HSdK9R1R1HTZvWll0mlAAAAAAAAAAAIiKLnLjHNLynLXKcycxzmNYmJmUKFSCAWLFy5qamxvHQvSdJ0nVHUdFm1aparWKAjNWSKAAAAARBEtYzlyXnjmOSuM4U4q4jjOM5a5k5zAyMjOqFCCCCSSS5c0jU1NzoOk6pew7TtjuO1e0646jezWr2WSaUAAAAAECIqtZco55eY464zhTirhOI5Dks5jAwMTIzqhUqQASWLFzSNTY3Og6V646zsO2O47V7DrjqNzWy9nlZ1c0LlrLEk0EQQVipRczIyMU5q5F4U8+vOPOrgThOOuU5jAxMjMzKpUggigJiSSxY0XQ1Njc6TqjtO49CX0D0T0Y7l7E6JdzU1NEvViSalBAWIqVKLSMjIxOauM4U86vPPOrz04TjrkOYwMTIzKJQqQQCKmBJJYutzQ1Njc6TrOyO475fRPRPQjuXsToXWPn6kkkEkhCkEAgggqVMjlrzzzDy7PMPPrhOQ5jBMqoVIIIAAIAJAAJJJLFzWN16TsO49CPTPUl9Q9A6o1LFiSSSSQpCwQQCCCpVMjlrzzyzy7PMPPrhOM5kwM6zKlQQAAQASAASCxY0NI3XpOw7j0I9M9SX0z0DqjU+UqpQqVIBFgEyixJYuWLFDkrzE8o8yvOONOasipBAAAAAAAAAAABJJY2OiO1fQPUj1T0pewuVKlCCqQsBIUSSSSWLlyTM5K808pPLrzziTnrEqQQAAAAAAAAAAASSWNjojtX0D1I9VfSOuND4uzMzqhQqVIALEli5c1jUuQc1vnp5pwJzVmQQAAAAAAAAAAAAAASSaHTHevpHoHTFjMyM6zKlSpABJJcsaGkamhU5q88804E5qzIIAAAAAAAAAAAAAAJJNDpjvX0j0Dqix8dVDMolSpAqCYElixc0XU0IMjlTlrIqAAAAAAAAAAAAAAAAAWNTqjqXYGZkZpUoQQRSFIsSXLroaGhBkcqctZFQAAAAAAAAAAAAAAAACxqdUdS7EngWQCAAQASACSSSwKlSCAAAAAAAAAAAAAAAAAACSSxYFSCCAACCQACSSSwKlSCAAAAAAAAAAAAAAAAAACSSxYGIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABIAJAJAJBAAIAIABAAAAAAAAAAAAAAAAAAAABIAJAJAJBAAIAIABAAAAJABAAAAAAAAAJBILEli5Y0LlzQ0Lly5csWLAkgFSChUoUMyhmUMyhQqVKkEEAEAAAAAAAAAkEgsSWLljQuXNDQuXLlyxYsCSAVIKFShQzKGZQzKFCpUqQe+ZmZkUKFCpUEEAAkksWLFzQ0NTU2NzY3Og3NzoNzc2NjU1NS5csSAQVKmZmZGRiYmBgYHOYGBgYGBiZGRkUMypUqQCAASSWLFi5oaGpqbG5sbnQbm50G5ubGxqampcuWJAIIKGZmZGRiYmBgYHOYGBgYGR+jmBzmBzmJiZGZQoQQSSWLmhqbGxudB0nSdJ1HSdR1HSdJ0G5qamhcsWJJJBIIIBUqVKFDIyMDA5jmOU5TlOY5TmOc5znMTEyMyhQggFixc0NTY2NzoOk6TpOo6TqOo6TpOg3NTU0LlixJJIJBAIKkFChQyMjAwOY5jlOU5jnP00yMTnOc5zAwMjMoVIJJLmhqbmx0HQdBubmxqXLkkgAAAAAAAAAAAAAEEFTMzMTEwOc5znMDAyMyhUgkkuaGpsbnQdB0G5ubGpcuSSAAAAAAAAAAAAAAQQVKGZ1gAEEEEFSCACSSxJJJIAAAAAAAAAAAAAAAAAAAAAAABBBBBUggAkkksSSSAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQCCpBUqQVIKggAkFiSSxYksSSSSAAAAAAAAAAAAAAAAAAQCCpBUqQVIKggAkFiSSxYksSWBIAAKFiQAAAAAAAAACCpUoUMzIyMzMzMyhQoVKkEEAgkEkklixYuXNDQ0NTQ1NC5cuWJAAAAAAAAAAIKlShQzMjIzMzMzKFChUqQQQCCQSSSWLFyxoXNDQ1NDU0LljUkkAAAAAAAAAAggggEEAgAAAAAAAAAAAAAEkgkkkkkAAAAAAAAAAgggggEAgAAAAAEgEAAAAAAEkgkkuAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADyyCCCCCCCCAQASCSQWJJJJLEkkkkkgkkEgkAEgAAEAAgEAggEEEEEEEFSCCCCCCAQASCSQWJJJJLEkkkkkgkkEgEgEgAAEAAgEAggEEEEEH5AQQQQVBBAIAAJBIJJJLEkkkkliSSSSSQSSCQSAAAQAQQCCCCCCCCCpBBBBBUEEEAgAAkEgkkksSSSSSWJJJJJJBJIJBIAABABBAIIIIIIIIKg/LCAQCACAAAACQCQSCQSASSASCQCQAAAAAAQCAQAQCAQAQQCACAAAACQCQSCQSASSASCQCQAAAAAAQCAQAQCAQfPgAAAAAAAAAAAAAAkAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAkAAAAAAAAAAAAAAgAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAH/xAApEAAABQUBAQACAwACAwAAAAABAgQFFQMGERQWEhNAUAAgMGCAkKCw/9oACAEBAAECAP8AwTZznOf3mc5/YZE41xVivFyM6i7C8C8C8zMzMzMyDyDyDyDwV4K7ldSuZV5VgVwqZ/SCca4qxXmcjOouwvAvEzMzMzMzMyDyDyDwV4K7ldSuRVwKgrgf88TDWMrO4VHOo61Hao7ndzvB3k7yZ5M8i8i8zMzMzMyDyDyDyV5K8keSPJHmm8U3em70nam603Mi8qotUDfk5GqZUdfUc6jrUdqjvUeDvB3kzyZ5M8i8i8zMzMzMzMg8g8leSvJHkjyR5pvFN4pu9N2pOtNzIvKqLWA39PX+/saplJlh1tRfVcKrlVdKrrVdqrvVdzu53Y7sZ2M6mdRdRdBdJSUk5SUB0B0B1K6kdSOxHam7Unek70nei7UXWi6UXKk40l9NaRWWuB8/75E41zKjraq+q41nOq6VXas7VXeq71Hc7ud2O7GdRdRdZQXSUlJSUlAdCugOpXUjqR2I7U3em70nek70nai60XSk5UnGkvItIrKoCsC0FwLgXAuBbube3ubm7uiuFcZcZaZYdZUWVl1dwruVdzrulZ0qulVzqOR3EzgZeZcZcK0Vm3t7W1tbW1tgrBYC0q0q4q8jgRxpuVJzoulB0oOlBzoOVBworqa0iwi0i0q4FwLQWAr2trZ2trb3RWiuFcZaZadbUW1l1ZwruVd0rulZ0qulVzqOR3E7gZeZeK4VorNzb29ra2tsFe2CwFpVxVxV5HAjjTcqTnRdKDpQdKDnQcqDhRXU1pFhVm/ISUnKSkrLSsrKyspJyUhvitOtrLq69Q4qHGu41nGqvqLjrDKhUDW+nv1nP+Oc+vYVArFUEVEWUl1FfQcU7imckzinX0VxFoLgXyMlJykrLS0tLS0rKSclI74rjraq6uvUuKhxruNdxqr6i46wysVA1vp79Zz/AI5z6A4VArFUEVkWUl1FfQcU7imcUzinX0VxFoLZKTlJWVlpaXl5eWlpWUB0BzBxkDr669SvUr666stqqz1xqes/j5AxahFFJXRWp1yZemX0F5HCQkpOUlZaWlpeXl5aWB2lQdAcwcZE7hWcFLgpXqF1ZbVVnUDU9Z/HyBi1CV6SuitTrky9MvoLyL5AXEXEXIXIXKSkpKSkpIHIHIHIrkVxK4yJnCsvrra6uqpPVE354GJVpKaCtOtoryuEiZxM5C5C5C5SUnJSclJSQOQORXIrkVxBxM4VV9dbXV1VJ6om/PAxKtFTQVp1tFeRwkRWitFYKvb2tra2draBUCsFgLCrSrQWitOsqqT1RN+jAxKtJTTWFWitMtMtFYKzb29ra2tnaBUCsFZVhVpVoLRWnWVFJ6om/RgYlWkpprAW73v36zn++c+gOFQKv1GoJv04GCp9Rq/T36zn++c+gOFT7fUagm/TgYKn1+3/AKEeMefHjx8/n8vl8vn8/Hjx5xj9bjHnx48fP5/L5fL5/Px48ecY/wAvOPxceQIFIKIJgSAiBAVuK2FaitINAM4MwMwMsJCQkJCQkJCwosws4tAtItQtgtot4oRSCm+Hy8ecfi48gQKQUQTAkBECArcVsK1FaQaAZwZgZgZYSEhISEhISFhRZhZxaBaRahbBbRbxQikFN8BpfMWgWozWLaLcKAUWpq62vr/DX19YEoJARAhBvK2laytRGgjORlIyEYiMJLfJbxLdJbhLbJbRLaJbJbZLbAWxzHMcxzHMcxzHMDbBrYNbJraNbRrbPbh7dPbx7fOwHYjsZ2UzMZoM0maxbRbhQCi1NXW19fX19fW1QSAiBCDeVtK1laiNBGYjKRkIxEYSW+S3iW6S3CW2S2iW0S2S2yW2AtgLY5jmOY5jmOY5gbYNbJrZNbRraPbZ7cPbp7ePb52A7EdjOymZjW4e3D26e3j2+ZgMwmYhYxY4SEhISEBjKxlYiMJGAjAS3iW9TtynblO26dtUrap2zTtmnbNO2SW2S3isRWYGkG0EAItTW1/h8Phr6+rp6AtwtQs5mI9vntw9tHtk9s1LZqWzUto9tnts9uHt09vHt8zAZhMxCxixwkJCQkIDGVjKxEYSMBGAlvEt6nblO3Kdt0rap21TtmnbNO2SWyS2yW8ViKzA1A2ggBFqa2v8Ph8NfW1dPRFuFqMzGYjW+e3D20e2T2zUtk9tHto1tCzHYj2+e3T24e3D24a3DW4Nuc5znOc4FuBbhbcLbhLcJblO3CW4S3iMRGcrYVECcKYB+cJBoCjM2maDsZ7fPbp7cPbh7cNbhrcG3Oc5znOcC3C24W3C24S3CW5TtwluEt4jERnK2FRAnCmAfnCQaAoxb/7ePl8NbU09PT1NYKHy8Y/ZePl8NbU09PT1NYKHy8Y/4Z6+g1tjb3d+Rk5SVlZWVlZSTkd8Fu3s/b6es/pvX0Gtsbe7vyMnKSkrKysrKSciC8Fu3s/YKnrP9gqAb8X0NQawqBVCrMrMqMoGuNUTiYf4ICT5/L4/H4fD4fH4hSCmBAAP4AgctUtYqgqoqsqsqoFIVwqAb8X0NQawqBVCrMrMqMoGuNUTiYf4ICT5/L4/H4fD4fH4hSCmBAAP4AgctUtYqgqkqsqsqsFIV/Hn8XHj5/H4a+traurq6mpqampqampqampqampqampqampqamrq62tr/D4/Lx5/Fx4+fx+Gvra2rq6upqampqampqamrq6upqampqampqamrq6utra/w+Py/wCgEzNTc5OTs7PT09PT8/Pz09PT07Ozk3Ng9TMxLy0rKSclJSMhIb+9vbu9u7u7u7u7u729vb2/vyEjJSUnKSstLzEzNTc5OTs7Oz09PT8/Pz09PT07Ozk5NzUzMS8tKyknJSUjISG/v727vbu7u7u7u7u9u729v78hIyUlJykrLS8x0nR9H0fR9H0XRdF0XRdD0PQ9F0XRdF0XRdF0fR9H0nSdJ0vS9L0vTdN03TdP0/T9P0/T9P0/T9P0/T9R0/T9P0/T9P0/TdN03S9L0vS9J0nSdJ0fR9H0XRdF0PRdD0PQ9D0PRdF0XRdF0XR9H0fSdJ0nS9L0vS9N03TdN0/T9P0/T9P0/T9P0/T9P1HT9P0/T9P0/T9N03TdL0vS9L0vSS8tLy0tLS0rKysrKysrKysrKystLS0vLS8vLy8vMTExMTExMzMzMTMzMzM1NTUzMzMzMzMzMzExMTExMS8vLy8vLy8tKy0tKysrKysrKysrKysrLS0tLy0vLy8vLzExMTExMTMzMzEzMzMzNTU1MzMzMzMzMzMxMTExMTEvLy8vnOc5znOc5znOc5znOc5znOc59ZznPr169evXr169evXr169evXr16znOfWc5znOc5znOc5znOc5znOc5znOc59ZznPr169evXr169evXr169evXr16znOfWc5z/9YD//xAArEAEAAgIDAQABBAICAQUAAAAAAVICYgNRYQRBEEBQUzFCIDARYICQoLD/2gAIAQEAAz8A/wDgmhCEI/nYQj+RhjH5ccflxw44YMe0dtmzZs2bNmzZs2bIsjtiwlxy45/Ljn8se0fwuPbjj8uOPy44YQxR2izZs2bNmzZs2bNkWR2xYS45cc/lhP5Y9/wEQwj8sIRD1s2bNmzZs2bNmzZs2bNmzZs2bNmzZs2bNmyLMZYZMZ/KJ/dRDCPywhjCI/LZs2bNmzZs2bNmzZs2bNmzZs2bNmzZs2bNkWYywlhP5RP/ABj9hDGGMIh69bNmzZs2bNmzZsmybJsmybJsmybJsmybJsmybJs2bNmzZs2bNmzZ7+mMsZYyj9hDGGMIj9NmzZs2bNmzZs2bJsmybJsmybJs2TZNk2TZNk2bJs2bNmzZs2bNmzZ6iWMsXr16hiwYMGDBgwYo/T169/T162bNmzZs2TZNk2T2ntPae09pSlKUpSlPae09p7T2mybJsmzZs2bNmz17+nr16hiwYOPtx9uPtx9sO2DBih69evXr1s2bNmzZsmybJsmye09p7T2lKUpSlKU9p7T2ntNk2TZNmzZs2bNmz17+vr1s2bNmzZs2bNmzZs2evXr169bNmye09p7SlKUp/wC6UpSlKe09p7etmzZs9evWzZs2bNmzZs2bNmzZs2bPXr1s9bNmye09p7SlKUp/7pSlKUp7T29bPWz169evWzZs2bNmzZs2bNmzZs2bNmzZs2evU9plM/vJhMJ7T29bNnrZ62bNmzZs2bNmzZs2bNmzZs2bNnr39J7TKZ/eTCYT3+nr162bNnrZs2bJsntNk2TZPabNmzZs2etnr39JlM/wUwmP09etmzZs2bNk2TZNk2TZNk2bNmzZs2bNnv6TKZ/gphMfp69etk9p7T2ntKUpSlKUp7T2nt69e/pMpn+GmH/j9PXr1Pae09pSySlklKU9p7T29evf0mUz/DTCY/T16lP/AHSlKU/xUpSlP/dKUpT/ABUpT/8AQllKWTJl0y6ZdMumXTLpl0y6ZJSn+QlKWTJl0y6ZdMumXTLpl0y6ZJSn/sn9xKWXTLpn0z6Z9M+mXTLplVlVlVlVlVlVlVlVlVlVlRlVlVlRlVlVlVlVlVlVlVl0z6Z9M4/DPpn0z6ZdMkp/byll0y6Z9M+mfTPpn0y6ZVZVZVZVZVZVZVZVZUZVZUZVZVZVZVZVZVZVZVZVZVZdM+mfTOPwz6Z9M+mTJlVlVlVl0yZ9M2fTPpn0z6Z9M+mbPpn0z6Z9M2fTPpl0yqyqyqyqyqyomiaJomiaJomiaJomjRo0aNGjRo0aNGjRNE0TRNE0TRNE0TRNE0ZVZVZVZVZVZVZM+mbPpn0z6Z9M+mfTNn0z6Z9M+mfTPpl0y6ZVZVZVTVlVlRNE0TRlRNE0TRNE0TRo0aNGjRo0aNGjRomiaJomiaJomiaJomqaJqyq0TRNE0TRNE0TVNE1TVNU1TRNE1TVNU0TRNE0TRNGjRo0aNGjRhWHFHTgh88Pmj8Pnj/V89HBRwf1w4f64cNMXFSHFTFxUxcVIcP9cOGkOCkPno+ej55/D55cEuKemHUIo0aNGjRo0TRNE0TRNE0TVNE0TVNE1TVNE1TRNU0TRNE0TRNGjRo0aNGjRhWHFHThh88Pnj8Pnq+ejgo4P64cP9cOKkOKkOKmLipi4aYuH+uHBSHBSHz0fPR88/h88uCXFNWHUIo0aNGjRo4ZcU9MOoRRFGjRo0aNGjRo0aNGjRo0RRhVxR04IcGP4cGP+jij/GEMI/xjCP3+M/5xhxT/AJwhwT/o4Mv9XBk4p6YdQiiKNGjRo0aNGjRo0aNGjRoijGsOKOnBi4Mfw4I/0cUf4whhH+MYR+/xn/OMOKf84Q4J/wBHBP8Ar/zxrDCsOKkOKjhq4auGrhq4auGjipDjpDGsI/k8awwrDipDio4aOGrhq4auGrho4qQ46QxrCP8A0bHcMLQ47w4rw4buCzgs4O3A4HA4XA4HA4HA4O3BZwWcN3Fdx3hhaGNoR/Dx3DC0OO8OK8OG7gs4LODtwOBwOFwOBwOBwODtwWcFnDdxXcd4YWhjaEf88UftoQh4y6ZuRyuVzOZzeudz+uf1z+uf1z+uf1z+uf1zuf1z+uf1z+uf1z+udzR25nM5o7c3rlcrlZsniOkSj9tCEPGXTNyuVy+uZzOb1z+uf1z+uf1z+uf1z+uf1z+udz+uf1z+uf1z+uf1z+ueO3O5nM5vXK5XKzZPEdMUftoYsemHTDpx9OPpxVcVXDVw1cNXDVw0cNHDRw0cNHDRw0cNHDRw0cNHDRw0cNHDRw0cNHDVw1cNXFVxVcVXFVx9OPph0w6Yo/bQxY9MOnH04+nH04quKrhq4auGrhq4aOGjho4aOGjho4aOGkOGkOGkOGjho4aOGjho4aOGjhq4auGriq4quKriq4+nH0w6Ydf+wHgcLhcLicTjYdww7hh3DDuGPcMe4Y9ww7hh3DDuGHcONxuJxOFwuBwOB8753z2fPZ89nz3fNd893zXfPd893z3fP/Y+e757uC75/wCyHz/2Q+f+yHBd893z3fPd893z3fPd893zXfNd893z2fPZ8/b5+3zvncDgcLhcLicTjYdww7hh3DDuGHcMe4Ydww7hh3DDuGHcONxuJxOFwuBwPnfO+d89nz2fPZ893zXfPd813z3fPd893z/2Pnu+e7gu+f8Ash8/9kPn/shwXcF3z3fPd893z3fPd893zXfNd893z2fPZ8/b5+3zvncDdu3bt03bt26bpum6bpum6bt27du3bt26bt26bpum6bpum6bpum6bt03TdN26bpum6bpum7dN03TdN03TdN03TdN03Tdum7dum7dN27dum6bpum6bpum6bpum7du3bt03bpu3bpum6bpum6bpum6bpu3TdN03bpum6bpum6bt03TdN03TdN03TdN03TdN03TduysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysmzKzKzKybMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrJT+2lKUpSlKUpSlKUpSlKUpSlKUpSlKUpSlKUpSn9tKUpSlKUpSlKUpSlKUpSlKUpSlKUpSlKUpT/wDrA//EAB0RAAMBAAMBAQEAAAAAAAAAAAABERIwQFAgkMD/2gAIAQIBAT8A/COlKioqKioqKi+zSoqKioqL59Ro0aKyvpVlZWaNFXiVGkaNFZWV9CsrNGjRpFXepo0V8c69Zo0u1pGilfVnJWaNF+NFXNUaNFfmU0aReamkaNPzNM19VlZWaKysrK/XrKzTNGjRWaKyv+u0/8QAHREBAQACAQUAAAAAAAAAAAAAEQBAUCAQITCQwP/aAAgBAwEBPwD1NkRER07eYiIiNMRERGARERGgIiNAREZRERoCIjiYBERqiIwiI1REcCIiIiIjbkREREREfXZ//9k=";d();d();var DD=!1;function kD(){DD=!0}function AD(){return DD}var O1=class{constructor(r){m(this,"backgroundAlpha",1);m(this,"backgroundColor",new ar);m(this,"width",0);m(this,"height",0);m(this,"options",{});m(this,"renderer");m(this,"enabledLayers",new Set([0,1]));m(this,"handleWebGLContextCreationError",r=>{this.options.onWebGLContextCreationError?.(r)});m(this,"handleWebGLContextLost",r=>{this.options.onWebGLContextLost?.(r)});m(this,"handleWebGLContextRestored",r=>{this.options.onWebGLContextRestored?.(r)});try{this.options=r,AD()?(this.renderer={setSize:()=>{},state:{reset:()=>{}},properties:{get:()=>{}},getSize:()=>({width:window.innerWidth,height:innerHeight}),getDrawingBufferSize:()=>({width:window.innerWidth,height:innerHeight}),getClearAlpha:()=>1,getClearColor:()=>new ar,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 SC({canvas:r.canvas,alpha:r.alpha||!1,stencil:!0,antialias:typeof r.antialias=="boolean"?r.antialias:!0,powerPreference:"high-performance",preserveDrawingBuffer:!0}),this.backgroundColor=new ar(r.backgroundColor??"#ffffff"),this.backgroundAlpha=r.backgroundAlpha??1}catch(t){A.error(t),r.onWebGLRendererError&&r.onWebGLRendererError(t)}this.domElement()?.addEventListener("webglcontextlost",this.handleWebGLContextLost),this.domElement()?.addEventListener("webglcontextrestored",this.handleWebGLContextRestored),this.domElement()?.addEventListener("webglcontextcreationerror",this.handleWebGLContextCreationError)}destroy(){this.renderer&&this.renderer.dispose?.(),this.domElement()?.removeEventListener("webglcontextlost",this.handleWebGLContextLost),this.domElement()?.removeEventListener("webglcontextrestored",this.handleWebGLContextRestored),this.domElement()?.removeEventListener("webglcontextcreationerror",this.handleWebGLContextCreationError)}render(r,t){if(this.renderer){this.renderer.state.reset(),t.layers.disableAll();for(let o of this.enabledLayers.values())t.layers.enable(o);this.renderer.clearStencil(),this.renderer.autoClear=!1,this.renderer.setRenderTarget(null),this.renderer.render(r,t),this.renderer.clearDepth(),t.layers.disableAll(),t.layers.enable(ly.ALWAYS_ON_TOP),this.renderer.render(r,t),this.renderer.state.reset()}}clear(){this.renderer&&(this.renderer.setClearColor(this.backgroundColor,this.backgroundAlpha),this.renderer.clear())}setBufferSize(r,t){y.env.NODE_ENV==="test"||!this.renderer||(this.width=r,this.height=t,this.renderer.setSize(r,t,!1))}setBackgroundColor(r,t){this.backgroundColor=r,this.backgroundAlpha=t}domElement(){return this.renderer?.domElement}};d();d();var LD='"use strict";(()=>{var Qe=Object.defineProperty;var _t=(r,e,t)=>e in r?Qe(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var vt=(r,e)=>{for(var t in e)Qe(r,t,{get:e[t],enumerable:!0})};var w=(r,e,t)=>_t(r,typeof e!="symbol"?e+"":e,t);function Ke(r,e){return e.x+e.w<r.x+r.w&&e.x>r.x&&e.y>r.y&&e.y+e.h<r.y+r.h}function Ge(r,e){let[t,s]=e;return t>=r.x&&t<=r.x+r.w&&s>=r.y&&s<=r.y+r.h}function He(r,e){let t=e.x,s=e.y,n=e.x+e.w,a=e.y+e.h,o=r.x,i=r.y,u=r.x+r.w,l=r.y+r.h;return t<u&&o<n&&s<l&&i<a}function L(r,e){for(let t=0;t<e.length;t++)r.push(e[t])}var b=class{constructor(e,t,s,n,a){w(this,"x");w(this,"y");w(this,"w");w(this,"h");w(this,"userData");this.userData=typeof a>"u"?null:a,this.x=e,this.y=t,this.w=s,this.h=n}contains(e){return e===this?!1:Ke(this,e)}intersects(e){return He(this,e)}intersectsPoint(e){return Ge(this,e)}draw(e){e.fillStyle="rgba(123,222,26, 0.8)",e.fillRect(this.x,this.y,this.w,this.h)}};var Re=class r{constructor(e,t){w(this,"topLeft");w(this,"topRight");w(this,"bottomLeft");w(this,"bottomRight");w(this,"divided",!1);w(this,"boundary");w(this,"capacity",16);w(this,"objects",[]);w(this,"parent");this.parent=t,this.boundary=e}getSize(){return this.divided?this.objects.length+this.topLeft.getSize()+this.topRight.getSize()+this.bottomLeft.getSize()+this.bottomRight.getSize():this.objects.length}subdivide(){let{x:e,y:t,w:s,h:n}=this.boundary;this.topLeft=new r(new b(e,t,s/2,n/2),this),this.topRight=new r(new b(e+s/2,t,s/2,n/2),this),this.bottomLeft=new r(new b(e,t+n/2,s/2,n/2),this),this.bottomRight=new r(new b(e+s/2,t+n/2,s/2,n/2),this),this.divided=!0}queryRect(e){let t=[];if(this.boundary.intersects(e))t.push(...this.objects);else return[];return this.divided&&(L(t,this.topLeft.queryRect(e)),L(t,this.topRight.queryRect(e)),L(t,this.bottomLeft.queryRect(e)),L(t,this.bottomRight.queryRect(e))),t}queryPoint(e){let t=[];if(this.boundary.intersectsPoint(e))t.push(...this.objects);else return[];return this.divided&&(L(t,this.topLeft.queryPoint(e)),L(t,this.topRight.queryPoint(e)),L(t,this.bottomLeft.queryPoint(e)),L(t,this.bottomRight.queryPoint(e))),t}insert(e){return(this.parent?!this.boundary.contains(e):!this.boundary.intersects(e))?!1:this.objects.length<this.capacity?(this.objects.push(e),!0):(this.divided||this.subdivide(),(this.topLeft.insert(e)||this.topRight.insert(e)||this.bottomLeft.insert(e)||this.bottomRight.insert(e))===!1&&this.objects.push(e),!0)}drawObjects(e){this.objects.forEach(t=>t.draw(e)),this.divided&&(this.topLeft.drawObjects(e),this.topRight.drawObjects(e),this.bottomLeft.drawObjects(e),this.bottomRight.drawObjects(e))}draw(e){e.rect(this.boundary.x,this.boundary.y,this.boundary.w,this.boundary.h),this.divided&&(this.topLeft.draw(e),this.topRight.draw(e),this.bottomLeft.draw(e),this.bottomRight.draw(e)),e.strokeStyle="black",e.lineWidth=4,e.stroke()}};var be={};vt(be,{BRAND:()=>Wt,DIRTY:()=>K,EMPTY_PATH:()=>wt,INVALID:()=>p,NEVER:()=>Or,OK:()=>T,ParseStatus:()=>k,Schema:()=>_,ZodAny:()=>W,ZodArray:()=>B,ZodBigInt:()=>H,ZodBoolean:()=>ee,ZodBranded:()=>Se,ZodCatch:()=>le,ZodDate:()=>te,ZodDefault:()=>ue,ZodDiscriminatedUnion:()=>Me,ZodEffects:()=>E,ZodEnum:()=>ce,ZodError:()=>C,ZodFirstPartyTypeKind:()=>m,ZodFunction:()=>Ze,ZodIntersection:()=>ae,ZodIssueCode:()=>c,ZodLazy:()=>ie,ZodLiteral:()=>oe,ZodMap:()=>_e,ZodNaN:()=>xe,ZodNativeEnum:()=>de,ZodNever:()=>j,ZodNull:()=>se,ZodNullable:()=>Z,ZodNumber:()=>G,ZodObject:()=>S,ZodOptional:()=>I,ZodParsedType:()=>f,ZodPipeline:()=>Ae,ZodPromise:()=>q,ZodReadonly:()=>fe,ZodRecord:()=>Pe,ZodSchema:()=>_,ZodSet:()=>ve,ZodString:()=>U,ZodSymbol:()=>ye,ZodTransformer:()=>E,ZodTuple:()=>P,ZodType:()=>_,ZodUndefined:()=>re,ZodUnion:()=>ne,ZodUnknown:()=>z,ZodVoid:()=>ge,addIssueToContext:()=>d,any:()=>er,array:()=>nr,bigint:()=>Jt,boolean:()=>ut,coerce:()=>Ar,custom:()=>ot,date:()=>Qt,datetimeRegex:()=>at,defaultErrorMap:()=>D,discriminatedUnion:()=>cr,effect:()=>xr,enum:()=>gr,function:()=>pr,getErrorMap:()=>he,getParsedType:()=>M,instanceof:()=>Yt,intersection:()=>dr,isAborted:()=>Ee,isAsync:()=>pe,isDirty:()=>je,isValid:()=>F,late:()=>qt,lazy:()=>mr,literal:()=>yr,makeIssue:()=>Ce,map:()=>fr,nan:()=>Xt,nativeEnum:()=>_r,never:()=>rr,null:()=>Ht,nullable:()=>kr,number:()=>dt,object:()=>ar,objectUtil:()=>ze,oboolean:()=>Sr,onumber:()=>Cr,optional:()=>br,ostring:()=>Rr,pipeline:()=>Tr,preprocess:()=>wr,promise:()=>vr,quotelessJson:()=>xt,record:()=>lr,set:()=>hr,setErrorMap:()=>kt,strictObject:()=>ir,string:()=>ct,symbol:()=>Kt,transformer:()=>xr,tuple:()=>ur,undefined:()=>Gt,union:()=>or,unknown:()=>tr,util:()=>v,void:()=>sr});var v;(function(r){r.assertEqual=n=>{};function e(n){}r.assertIs=e;function t(n){throw new Error}r.assertNever=t,r.arrayToEnum=n=>{let a={};for(let o of n)a[o]=o;return a},r.getValidEnumValues=n=>{let a=r.objectKeys(n).filter(i=>typeof n[n[i]]!="number"),o={};for(let i of a)o[i]=n[i];return r.objectValues(o)},r.objectValues=n=>r.objectKeys(n).map(function(a){return n[a]}),r.objectKeys=typeof Object.keys=="function"?n=>Object.keys(n):n=>{let a=[];for(let o in n)Object.prototype.hasOwnProperty.call(n,o)&&a.push(o);return a},r.find=(n,a)=>{for(let o of n)if(a(o))return o},r.isInteger=typeof Number.isInteger=="function"?n=>Number.isInteger(n):n=>typeof n=="number"&&Number.isFinite(n)&&Math.floor(n)===n;function s(n,a=" | "){return n.map(o=>typeof o=="string"?`\'${o}\'`:o).join(a)}r.joinValues=s,r.jsonStringifyReplacer=(n,a)=>typeof a=="bigint"?a.toString():a})(v||(v={}));var ze;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(ze||(ze={}));var f=v.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),M=r=>{switch(typeof r){case"undefined":return f.undefined;case"string":return f.string;case"number":return Number.isNaN(r)?f.nan:f.number;case"boolean":return f.boolean;case"function":return f.function;case"bigint":return f.bigint;case"symbol":return f.symbol;case"object":return Array.isArray(r)?f.array:r===null?f.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?f.promise:typeof Map<"u"&&r instanceof Map?f.map:typeof Set<"u"&&r instanceof Set?f.set:typeof Date<"u"&&r instanceof Date?f.date:f.object;default:return f.unknown}};var c=v.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),xt=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:"),C=class r extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){let t=e||function(a){return a.message},s={_errors:[]},n=a=>{for(let o of a.issues)if(o.code==="invalid_union")o.unionErrors.map(n);else if(o.code==="invalid_return_type")n(o.returnTypeError);else if(o.code==="invalid_arguments")n(o.argumentsError);else if(o.path.length===0)s._errors.push(t(o));else{let i=s,u=0;for(;u<o.path.length;){let l=o.path[u];u===o.path.length-1?(i[l]=i[l]||{_errors:[]},i[l]._errors.push(t(o))):i[l]=i[l]||{_errors:[]},i=i[l],u++}}};return n(this),s}static assert(e){if(!(e instanceof r))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,v.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){let t={},s=[];for(let n of this.issues)n.path.length>0?(t[n.path[0]]=t[n.path[0]]||[],t[n.path[0]].push(e(n))):s.push(e(n));return{formErrors:s,fieldErrors:t}}get formErrors(){return this.flatten()}};C.create=r=>new C(r);var bt=(r,e)=>{let t;switch(r.code){case c.invalid_type:r.received===f.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case c.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,v.jsonStringifyReplacer)}`;break;case c.unrecognized_keys:t=`Unrecognized key(s) in object: ${v.joinValues(r.keys,", ")}`;break;case c.invalid_union:t="Invalid input";break;case c.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${v.joinValues(r.options)}`;break;case c.invalid_enum_value:t=`Invalid enum value. Expected ${v.joinValues(r.options)}, received \'${r.received}\'`;break;case c.invalid_arguments:t="Invalid function arguments";break;case c.invalid_return_type:t="Invalid function return type";break;case c.invalid_date:t="Invalid date";break;case c.invalid_string:typeof r.validation=="object"?"includes"in r.validation?(t=`Invalid input: must include "${r.validation.includes}"`,typeof r.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${r.validation.position}`)):"startsWith"in r.validation?t=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?t=`Invalid input: must end with "${r.validation.endsWith}"`:v.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case c.too_small:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(r.minimum))}`:t="Invalid input";break;case c.too_big:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="bigint"?t=`BigInt must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(r.maximum))}`:t="Invalid input";break;case c.custom:t="Invalid input";break;case c.invalid_intersection_types:t="Intersection results could not be merged";break;case c.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case c.not_finite:t="Number must be finite";break;default:t=e.defaultError,v.assertNever(r)}return{message:t}},D=bt;var et=D;function kt(r){et=r}function he(){return et}var Ce=r=>{let{data:e,path:t,errorMaps:s,issueData:n}=r,a=[...t,...n.path||[]],o={...n,path:a};if(n.message!==void 0)return{...n,path:a,message:n.message};let i="",u=s.filter(l=>!!l).slice().reverse();for(let l of u)i=l(o,{data:e,defaultError:i}).message;return{...n,path:a,message:i}},wt=[];function d(r,e){let t=he(),s=Ce({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t,t===D?void 0:D].filter(n=>!!n)});r.common.issues.push(s)}var k=class r{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){let s=[];for(let n of t){if(n.status==="aborted")return p;n.status==="dirty"&&e.dirty(),s.push(n.value)}return{status:e.value,value:s}}static async mergeObjectAsync(e,t){let s=[];for(let n of t){let a=await n.key,o=await n.value;s.push({key:a,value:o})}return r.mergeObjectSync(e,s)}static mergeObjectSync(e,t){let s={};for(let n of t){let{key:a,value:o}=n;if(a.status==="aborted"||o.status==="aborted")return p;a.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof o.value<"u"||n.alwaysSet)&&(s[a.value]=o.value)}return{status:e.value,value:s}}},p=Object.freeze({status:"aborted"}),K=r=>({status:"dirty",value:r}),T=r=>({status:"valid",value:r}),Ee=r=>r.status==="aborted",je=r=>r.status==="dirty",F=r=>r.status==="valid",pe=r=>typeof Promise<"u"&&r instanceof Promise;var h;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e?.message})(h||(h={}));var N=class{constructor(e,t,s,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=s,this._key=n}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},tt=(r,e)=>{if(F(e))return{success:!0,data:e.value};if(!r.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new C(r.common.issues);return this._error=t,this._error}}};function y(r){if(!r)return{};let{errorMap:e,invalid_type_error:t,required_error:s,description:n}=r;if(e&&(t||s))throw new Error(`Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:n}:{errorMap:(o,i)=>{let{message:u}=r;return o.code==="invalid_enum_value"?{message:u??i.defaultError}:typeof i.data>"u"?{message:u??s??i.defaultError}:o.code!=="invalid_type"?{message:i.defaultError}:{message:u??t??i.defaultError}},description:n}}var _=class{get description(){return this._def.description}_getType(e){return M(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:M(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new k,ctx:{common:e.parent.common,data:e.data,parsedType:M(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(pe(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let s=this.safeParse(e,t);if(s.success)return s.data;throw s.error}safeParse(e,t){let s={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:M(e)},n=this._parseSync({data:e,path:s.path,parent:s});return tt(s,n)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:M(e)};if(!this["~standard"].async)try{let s=this._parseSync({data:e,path:[],parent:t});return F(s)?{value:s.value}:{issues:t.common.issues}}catch(s){s?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(s=>F(s)?{value:s.value}:{issues:t.common.issues})}async parseAsync(e,t){let s=await this.safeParseAsync(e,t);if(s.success)return s.data;throw s.error}async safeParseAsync(e,t){let s={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:M(e)},n=this._parse({data:e,path:s.path,parent:s}),a=await(pe(n)?n:Promise.resolve(n));return tt(s,a)}refine(e,t){let s=n=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(n):t;return this._refinement((n,a)=>{let o=e(n),i=()=>a.addIssue({code:c.custom,...s(n)});return typeof Promise<"u"&&o instanceof Promise?o.then(u=>u?!0:(i(),!1)):o?!0:(i(),!1)})}refinement(e,t){return this._refinement((s,n)=>e(s)?!0:(n.addIssue(typeof t=="function"?t(s,n):t),!1))}_refinement(e){return new E({schema:this,typeName:m.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return I.create(this,this._def)}nullable(){return Z.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return B.create(this)}promise(){return q.create(this,this._def)}or(e){return ne.create([this,e],this._def)}and(e){return ae.create(this,e,this._def)}transform(e){return new E({...y(this._def),schema:this,typeName:m.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new ue({...y(this._def),innerType:this,defaultValue:t,typeName:m.ZodDefault})}brand(){return new Se({typeName:m.ZodBranded,type:this,...y(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new le({...y(this._def),innerType:this,catchValue:t,typeName:m.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Ae.create(this,e)}readonly(){return fe.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Tt=/^c[^\\s-]{8,}$/i,Rt=/^[0-9a-z]+$/,Ct=/^[0-9A-HJKMNP-TV-Z]{26}$/i,St=/^[0-9a-fA-F]{8}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{12}$/i,At=/^[a-z0-9_-]{21}$/i,Ot=/^[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]*$/,It=/^[-+]?P(?!$)(?:(?:[-+]?\\d+Y)|(?:[-+]?\\d+[.,]\\d+Y$))?(?:(?:[-+]?\\d+M)|(?:[-+]?\\d+[.,]\\d+M$))?(?:(?:[-+]?\\d+W)|(?:[-+]?\\d+[.,]\\d+W$))?(?:(?:[-+]?\\d+D)|(?:[-+]?\\d+[.,]\\d+D$))?(?:T(?=[\\d+-])(?:(?:[-+]?\\d+H)|(?:[-+]?\\d+[.,]\\d+H$))?(?:(?:[-+]?\\d+M)|(?:[-+]?\\d+[.,]\\d+M$))?(?:[-+]?\\d+(?:[.,]\\d+)?S)?)??$/,Nt=/^(?!\\.)(?!.*\\.\\.)([A-Z0-9_\'+\\-\\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\\-]*\\.)+[A-Z]{2,}$/i,Et="^(\\\\p{Extended_Pictographic}|\\\\p{Emoji_Component})+$",Be,jt=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Mt=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\/(3[0-2]|[12]?[0-9])$/,Pt=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Zt=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,$t=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Lt=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,st="((\\\\d\\\\d[2468][048]|\\\\d\\\\d[13579][26]|\\\\d\\\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\\\d|30)|(02)-(0[1-9]|1\\\\d|2[0-8])))",Dt=new RegExp(`^${st}$`);function nt(r){let e="[0-5]\\\\d";r.precision?e=`${e}\\\\.\\\\d{${r.precision}}`:r.precision==null&&(e=`${e}(\\\\.\\\\d+)?`);let t=r.precision?"+":"?";return`([01]\\\\d|2[0-3]):[0-5]\\\\d(:${e})${t}`}function Vt(r){return new RegExp(`^${nt(r)}$`)}function at(r){let e=`${st}T${nt(r)}`,t=[];return t.push(r.local?"Z?":"Z"),r.offset&&t.push("([+-]\\\\d{2}:?\\\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function zt(r,e){return!!((e==="v4"||!e)&&jt.test(r)||(e==="v6"||!e)&&Pt.test(r))}function Bt(r,e){if(!Ot.test(r))return!1;try{let[t]=r.split("."),s=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),n=JSON.parse(atob(s));return!(typeof n!="object"||n===null||"typ"in n&&n?.typ!=="JWT"||!n.alg||e&&n.alg!==e)}catch{return!1}}function Ft(r,e){return!!((e==="v4"||!e)&&Mt.test(r)||(e==="v6"||!e)&&Zt.test(r))}var U=class r extends _{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==f.string){let a=this._getOrReturnCtx(e);return d(a,{code:c.invalid_type,expected:f.string,received:a.parsedType}),p}let s=new k,n;for(let a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(n=this._getOrReturnCtx(e,n),d(n,{code:c.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),s.dirty());else if(a.kind==="max")e.data.length>a.value&&(n=this._getOrReturnCtx(e,n),d(n,{code:c.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),s.dirty());else if(a.kind==="length"){let o=e.data.length>a.value,i=e.data.length<a.value;(o||i)&&(n=this._getOrReturnCtx(e,n),o?d(n,{code:c.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):i&&d(n,{code:c.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),s.dirty())}else if(a.kind==="email")Nt.test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"email",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="emoji")Be||(Be=new RegExp(Et,"u")),Be.test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"emoji",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="uuid")St.test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"uuid",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="nanoid")At.test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"nanoid",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="cuid")Tt.test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"cuid",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="cuid2")Rt.test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"cuid2",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="ulid")Ct.test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"ulid",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),d(n,{validation:"url",code:c.invalid_string,message:a.message}),s.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"regex",code:c.invalid_string,message:a.message}),s.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(n=this._getOrReturnCtx(e,n),d(n,{code:c.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),s.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(n=this._getOrReturnCtx(e,n),d(n,{code:c.invalid_string,validation:{startsWith:a.value},message:a.message}),s.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(n=this._getOrReturnCtx(e,n),d(n,{code:c.invalid_string,validation:{endsWith:a.value},message:a.message}),s.dirty()):a.kind==="datetime"?at(a).test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{code:c.invalid_string,validation:"datetime",message:a.message}),s.dirty()):a.kind==="date"?Dt.test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{code:c.invalid_string,validation:"date",message:a.message}),s.dirty()):a.kind==="time"?Vt(a).test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{code:c.invalid_string,validation:"time",message:a.message}),s.dirty()):a.kind==="duration"?It.test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"duration",code:c.invalid_string,message:a.message}),s.dirty()):a.kind==="ip"?zt(e.data,a.version)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"ip",code:c.invalid_string,message:a.message}),s.dirty()):a.kind==="jwt"?Bt(e.data,a.alg)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"jwt",code:c.invalid_string,message:a.message}),s.dirty()):a.kind==="cidr"?Ft(e.data,a.version)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"cidr",code:c.invalid_string,message:a.message}),s.dirty()):a.kind==="base64"?$t.test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"base64",code:c.invalid_string,message:a.message}),s.dirty()):a.kind==="base64url"?Lt.test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"base64url",code:c.invalid_string,message:a.message}),s.dirty()):v.assertNever(a);return{status:s.value,value:e.data}}_regex(e,t,s){return this.refinement(n=>e.test(n),{validation:t,code:c.invalid_string,...h.errToObj(s)})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...h.errToObj(e)})}url(e){return this._addCheck({kind:"url",...h.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...h.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...h.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...h.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...h.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...h.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...h.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...h.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...h.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...h.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...h.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...h.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...h.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...h.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...h.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...h.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...h.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...h.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...h.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...h.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...h.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...h.errToObj(t)})}nonempty(e){return this.min(1,h.errToObj(e))}trim(){return new r({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new r({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new r({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};U.create=r=>new U({checks:[],typeName:m.ZodString,coerce:r?.coerce??!1,...y(r)});function Ut(r,e){let t=(r.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,n=t>s?t:s,a=Number.parseInt(r.toFixed(n).replace(".","")),o=Number.parseInt(e.toFixed(n).replace(".",""));return a%o/10**n}var G=class r extends _{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==f.number){let a=this._getOrReturnCtx(e);return d(a,{code:c.invalid_type,expected:f.number,received:a.parsedType}),p}let s,n=new k;for(let a of this._def.checks)a.kind==="int"?v.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{code:c.invalid_type,expected:"integer",received:"float",message:a.message}),n.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(s=this._getOrReturnCtx(e,s),d(s,{code:c.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(s=this._getOrReturnCtx(e,s),d(s,{code:c.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):a.kind==="multipleOf"?Ut(e.data,a.value)!==0&&(s=this._getOrReturnCtx(e,s),d(s,{code:c.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{code:c.not_finite,message:a.message}),n.dirty()):v.assertNever(a);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,h.toString(t))}gt(e,t){return this.setLimit("min",e,!1,h.toString(t))}lte(e,t){return this.setLimit("max",e,!0,h.toString(t))}lt(e,t){return this.setLimit("max",e,!1,h.toString(t))}setLimit(e,t,s,n){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:h.toString(n)}]})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:h.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:h.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:h.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:h.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:h.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:h.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:h.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:h.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:h.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&v.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(t===null||s.value>t)&&(t=s.value):s.kind==="max"&&(e===null||s.value<e)&&(e=s.value)}return Number.isFinite(t)&&Number.isFinite(e)}};G.create=r=>new G({checks:[],typeName:m.ZodNumber,coerce:r?.coerce||!1,...y(r)});var H=class r extends _{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==f.bigint)return this._getInvalidInput(e);let s,n=new k;for(let a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(s=this._getOrReturnCtx(e,s),d(s,{code:c.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(s=this._getOrReturnCtx(e,s),d(s,{code:c.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(s=this._getOrReturnCtx(e,s),d(s,{code:c.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):v.assertNever(a);return{status:n.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return d(t,{code:c.invalid_type,expected:f.bigint,received:t.parsedType}),p}gte(e,t){return this.setLimit("min",e,!0,h.toString(t))}gt(e,t){return this.setLimit("min",e,!1,h.toString(t))}lte(e,t){return this.setLimit("max",e,!0,h.toString(t))}lt(e,t){return this.setLimit("max",e,!1,h.toString(t))}setLimit(e,t,s,n){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:h.toString(n)}]})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:h.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:h.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:h.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:h.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:h.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};H.create=r=>new H({checks:[],typeName:m.ZodBigInt,coerce:r?.coerce??!1,...y(r)});var ee=class extends _{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==f.boolean){let s=this._getOrReturnCtx(e);return d(s,{code:c.invalid_type,expected:f.boolean,received:s.parsedType}),p}return T(e.data)}};ee.create=r=>new ee({typeName:m.ZodBoolean,coerce:r?.coerce||!1,...y(r)});var te=class r extends _{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==f.date){let a=this._getOrReturnCtx(e);return d(a,{code:c.invalid_type,expected:f.date,received:a.parsedType}),p}if(Number.isNaN(e.data.getTime())){let a=this._getOrReturnCtx(e);return d(a,{code:c.invalid_date}),p}let s=new k,n;for(let a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(n=this._getOrReturnCtx(e,n),d(n,{code:c.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),s.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(n=this._getOrReturnCtx(e,n),d(n,{code:c.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),s.dirty()):v.assertNever(a);return{status:s.value,value:new Date(e.data.getTime())}}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:h.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:h.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}};te.create=r=>new te({checks:[],coerce:r?.coerce||!1,typeName:m.ZodDate,...y(r)});var ye=class extends _{_parse(e){if(this._getType(e)!==f.symbol){let s=this._getOrReturnCtx(e);return d(s,{code:c.invalid_type,expected:f.symbol,received:s.parsedType}),p}return T(e.data)}};ye.create=r=>new ye({typeName:m.ZodSymbol,...y(r)});var re=class extends _{_parse(e){if(this._getType(e)!==f.undefined){let s=this._getOrReturnCtx(e);return d(s,{code:c.invalid_type,expected:f.undefined,received:s.parsedType}),p}return T(e.data)}};re.create=r=>new re({typeName:m.ZodUndefined,...y(r)});var se=class extends _{_parse(e){if(this._getType(e)!==f.null){let s=this._getOrReturnCtx(e);return d(s,{code:c.invalid_type,expected:f.null,received:s.parsedType}),p}return T(e.data)}};se.create=r=>new se({typeName:m.ZodNull,...y(r)});var W=class extends _{constructor(){super(...arguments),this._any=!0}_parse(e){return T(e.data)}};W.create=r=>new W({typeName:m.ZodAny,...y(r)});var z=class extends _{constructor(){super(...arguments),this._unknown=!0}_parse(e){return T(e.data)}};z.create=r=>new z({typeName:m.ZodUnknown,...y(r)});var j=class extends _{_parse(e){let t=this._getOrReturnCtx(e);return d(t,{code:c.invalid_type,expected:f.never,received:t.parsedType}),p}};j.create=r=>new j({typeName:m.ZodNever,...y(r)});var ge=class extends _{_parse(e){if(this._getType(e)!==f.undefined){let s=this._getOrReturnCtx(e);return d(s,{code:c.invalid_type,expected:f.void,received:s.parsedType}),p}return T(e.data)}};ge.create=r=>new ge({typeName:m.ZodVoid,...y(r)});var B=class r extends _{_parse(e){let{ctx:t,status:s}=this._processInputParams(e),n=this._def;if(t.parsedType!==f.array)return d(t,{code:c.invalid_type,expected:f.array,received:t.parsedType}),p;if(n.exactLength!==null){let o=t.data.length>n.exactLength.value,i=t.data.length<n.exactLength.value;(o||i)&&(d(t,{code:o?c.too_big:c.too_small,minimum:i?n.exactLength.value:void 0,maximum:o?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),s.dirty())}if(n.minLength!==null&&t.data.length<n.minLength.value&&(d(t,{code:c.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),s.dirty()),n.maxLength!==null&&t.data.length>n.maxLength.value&&(d(t,{code:c.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),s.dirty()),t.common.async)return Promise.all([...t.data].map((o,i)=>n.type._parseAsync(new N(t,o,t.path,i)))).then(o=>k.mergeArray(s,o));let a=[...t.data].map((o,i)=>n.type._parseSync(new N(t,o,t.path,i)));return k.mergeArray(s,a)}get element(){return this._def.type}min(e,t){return new r({...this._def,minLength:{value:e,message:h.toString(t)}})}max(e,t){return new r({...this._def,maxLength:{value:e,message:h.toString(t)}})}length(e,t){return new r({...this._def,exactLength:{value:e,message:h.toString(t)}})}nonempty(e){return this.min(1,e)}};B.create=(r,e)=>new B({type:r,minLength:null,maxLength:null,exactLength:null,typeName:m.ZodArray,...y(e)});function me(r){if(r instanceof S){let e={};for(let t in r.shape){let s=r.shape[t];e[t]=I.create(me(s))}return new S({...r._def,shape:()=>e})}else return r instanceof B?new B({...r._def,type:me(r.element)}):r instanceof I?I.create(me(r.unwrap())):r instanceof Z?Z.create(me(r.unwrap())):r instanceof P?P.create(r.items.map(e=>me(e))):r}var S=class r extends _{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=v.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==f.object){let l=this._getOrReturnCtx(e);return d(l,{code:c.invalid_type,expected:f.object,received:l.parsedType}),p}let{status:s,ctx:n}=this._processInputParams(e),{shape:a,keys:o}=this._getCached(),i=[];if(!(this._def.catchall instanceof j&&this._def.unknownKeys==="strip"))for(let l in n.data)o.includes(l)||i.push(l);let u=[];for(let l of o){let g=a[l],R=n.data[l];u.push({key:{status:"valid",value:l},value:g._parse(new N(n,R,n.path,l)),alwaysSet:l in n.data})}if(this._def.catchall instanceof j){let l=this._def.unknownKeys;if(l==="passthrough")for(let g of i)u.push({key:{status:"valid",value:g},value:{status:"valid",value:n.data[g]}});else if(l==="strict")i.length>0&&(d(n,{code:c.unrecognized_keys,keys:i}),s.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let l=this._def.catchall;for(let g of i){let R=n.data[g];u.push({key:{status:"valid",value:g},value:l._parse(new N(n,R,n.path,g)),alwaysSet:g in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let l=[];for(let g of u){let R=await g.key,Oe=await g.value;l.push({key:R,value:Oe,alwaysSet:g.alwaysSet})}return l}).then(l=>k.mergeObjectSync(s,l)):k.mergeObjectSync(s,u)}get shape(){return this._def.shape()}strict(e){return h.errToObj,new r({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,s)=>{let n=this._def.errorMap?.(t,s).message??s.defaultError;return t.code==="unrecognized_keys"?{message:h.errToObj(e).message??n}:{message:n}}}:{}})}strip(){return new r({...this._def,unknownKeys:"strip"})}passthrough(){return new r({...this._def,unknownKeys:"passthrough"})}extend(e){return new r({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new r({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:m.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new r({...this._def,catchall:e})}pick(e){let t={};for(let s of v.objectKeys(e))e[s]&&this.shape[s]&&(t[s]=this.shape[s]);return new r({...this._def,shape:()=>t})}omit(e){let t={};for(let s of v.objectKeys(this.shape))e[s]||(t[s]=this.shape[s]);return new r({...this._def,shape:()=>t})}deepPartial(){return me(this)}partial(e){let t={};for(let s of v.objectKeys(this.shape)){let n=this.shape[s];e&&!e[s]?t[s]=n:t[s]=n.optional()}return new r({...this._def,shape:()=>t})}required(e){let t={};for(let s of v.objectKeys(this.shape))if(e&&!e[s])t[s]=this.shape[s];else{let a=this.shape[s];for(;a instanceof I;)a=a._def.innerType;t[s]=a}return new r({...this._def,shape:()=>t})}keyof(){return it(v.objectKeys(this.shape))}};S.create=(r,e)=>new S({shape:()=>r,unknownKeys:"strip",catchall:j.create(),typeName:m.ZodObject,...y(e)});S.strictCreate=(r,e)=>new S({shape:()=>r,unknownKeys:"strict",catchall:j.create(),typeName:m.ZodObject,...y(e)});S.lazycreate=(r,e)=>new S({shape:r,unknownKeys:"strip",catchall:j.create(),typeName:m.ZodObject,...y(e)});var ne=class extends _{_parse(e){let{ctx:t}=this._processInputParams(e),s=this._def.options;function n(a){for(let i of a)if(i.result.status==="valid")return i.result;for(let i of a)if(i.result.status==="dirty")return t.common.issues.push(...i.ctx.common.issues),i.result;let o=a.map(i=>new C(i.ctx.common.issues));return d(t,{code:c.invalid_union,unionErrors:o}),p}if(t.common.async)return Promise.all(s.map(async a=>{let o={...t,common:{...t.common,issues:[]},parent:null};return{result:await a._parseAsync({data:t.data,path:t.path,parent:o}),ctx:o}})).then(n);{let a,o=[];for(let u of s){let l={...t,common:{...t.common,issues:[]},parent:null},g=u._parseSync({data:t.data,path:t.path,parent:l});if(g.status==="valid")return g;g.status==="dirty"&&!a&&(a={result:g,ctx:l}),l.common.issues.length&&o.push(l.common.issues)}if(a)return t.common.issues.push(...a.ctx.common.issues),a.result;let i=o.map(u=>new C(u));return d(t,{code:c.invalid_union,unionErrors:i}),p}}get options(){return this._def.options}};ne.create=(r,e)=>new ne({options:r,typeName:m.ZodUnion,...y(e)});var V=r=>r instanceof ie?V(r.schema):r instanceof E?V(r.innerType()):r instanceof oe?[r.value]:r instanceof ce?r.options:r instanceof de?v.objectValues(r.enum):r instanceof ue?V(r._def.innerType):r instanceof re?[void 0]:r instanceof se?[null]:r instanceof I?[void 0,...V(r.unwrap())]:r instanceof Z?[null,...V(r.unwrap())]:r instanceof Se||r instanceof fe?V(r.unwrap()):r instanceof le?V(r._def.innerType):[],Me=class r extends _{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==f.object)return d(t,{code:c.invalid_type,expected:f.object,received:t.parsedType}),p;let s=this.discriminator,n=t.data[s],a=this.optionsMap.get(n);return a?t.common.async?a._parseAsync({data:t.data,path:t.path,parent:t}):a._parseSync({data:t.data,path:t.path,parent:t}):(d(t,{code:c.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),p)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,s){let n=new Map;for(let a of t){let o=V(a.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \\`${e}\\` could not be extracted from all schema options`);for(let i of o){if(n.has(i))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);n.set(i,a)}}return new r({typeName:m.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,...y(s)})}};function Fe(r,e){let t=M(r),s=M(e);if(r===e)return{valid:!0,data:r};if(t===f.object&&s===f.object){let n=v.objectKeys(e),a=v.objectKeys(r).filter(i=>n.indexOf(i)!==-1),o={...r,...e};for(let i of a){let u=Fe(r[i],e[i]);if(!u.valid)return{valid:!1};o[i]=u.data}return{valid:!0,data:o}}else if(t===f.array&&s===f.array){if(r.length!==e.length)return{valid:!1};let n=[];for(let a=0;a<r.length;a++){let o=r[a],i=e[a],u=Fe(o,i);if(!u.valid)return{valid:!1};n.push(u.data)}return{valid:!0,data:n}}else return t===f.date&&s===f.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}var ae=class extends _{_parse(e){let{status:t,ctx:s}=this._processInputParams(e),n=(a,o)=>{if(Ee(a)||Ee(o))return p;let i=Fe(a.value,o.value);return i.valid?((je(a)||je(o))&&t.dirty(),{status:t.value,value:i.data}):(d(s,{code:c.invalid_intersection_types}),p)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([a,o])=>n(a,o)):n(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}};ae.create=(r,e,t)=>new ae({left:r,right:e,typeName:m.ZodIntersection,...y(t)});var P=class r extends _{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==f.array)return d(s,{code:c.invalid_type,expected:f.array,received:s.parsedType}),p;if(s.data.length<this._def.items.length)return d(s,{code:c.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),p;!this._def.rest&&s.data.length>this._def.items.length&&(d(s,{code:c.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let a=[...s.data].map((o,i)=>{let u=this._def.items[i]||this._def.rest;return u?u._parse(new N(s,o,s.path,i)):null}).filter(o=>!!o);return s.common.async?Promise.all(a).then(o=>k.mergeArray(t,o)):k.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new r({...this._def,rest:e})}};P.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new P({items:r,typeName:m.ZodTuple,rest:null,...y(e)})};var Pe=class r extends _{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==f.object)return d(s,{code:c.invalid_type,expected:f.object,received:s.parsedType}),p;let n=[],a=this._def.keyType,o=this._def.valueType;for(let i in s.data)n.push({key:a._parse(new N(s,i,s.path,i)),value:o._parse(new N(s,s.data[i],s.path,i)),alwaysSet:i in s.data});return s.common.async?k.mergeObjectAsync(t,n):k.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,s){return t instanceof _?new r({keyType:e,valueType:t,typeName:m.ZodRecord,...y(s)}):new r({keyType:U.create(),valueType:e,typeName:m.ZodRecord,...y(t)})}},_e=class extends _{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==f.map)return d(s,{code:c.invalid_type,expected:f.map,received:s.parsedType}),p;let n=this._def.keyType,a=this._def.valueType,o=[...s.data.entries()].map(([i,u],l)=>({key:n._parse(new N(s,i,s.path,[l,"key"])),value:a._parse(new N(s,u,s.path,[l,"value"]))}));if(s.common.async){let i=new Map;return Promise.resolve().then(async()=>{for(let u of o){let l=await u.key,g=await u.value;if(l.status==="aborted"||g.status==="aborted")return p;(l.status==="dirty"||g.status==="dirty")&&t.dirty(),i.set(l.value,g.value)}return{status:t.value,value:i}})}else{let i=new Map;for(let u of o){let l=u.key,g=u.value;if(l.status==="aborted"||g.status==="aborted")return p;(l.status==="dirty"||g.status==="dirty")&&t.dirty(),i.set(l.value,g.value)}return{status:t.value,value:i}}}};_e.create=(r,e,t)=>new _e({valueType:e,keyType:r,typeName:m.ZodMap,...y(t)});var ve=class r extends _{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==f.set)return d(s,{code:c.invalid_type,expected:f.set,received:s.parsedType}),p;let n=this._def;n.minSize!==null&&s.data.size<n.minSize.value&&(d(s,{code:c.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()),n.maxSize!==null&&s.data.size>n.maxSize.value&&(d(s,{code:c.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());let a=this._def.valueType;function o(u){let l=new Set;for(let g of u){if(g.status==="aborted")return p;g.status==="dirty"&&t.dirty(),l.add(g.value)}return{status:t.value,value:l}}let i=[...s.data.values()].map((u,l)=>a._parse(new N(s,u,s.path,l)));return s.common.async?Promise.all(i).then(u=>o(u)):o(i)}min(e,t){return new r({...this._def,minSize:{value:e,message:h.toString(t)}})}max(e,t){return new r({...this._def,maxSize:{value:e,message:h.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};ve.create=(r,e)=>new ve({valueType:r,minSize:null,maxSize:null,typeName:m.ZodSet,...y(e)});var Ze=class r extends _{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==f.function)return d(t,{code:c.invalid_type,expected:f.function,received:t.parsedType}),p;function s(i,u){return Ce({data:i,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,he(),D].filter(l=>!!l),issueData:{code:c.invalid_arguments,argumentsError:u}})}function n(i,u){return Ce({data:i,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,he(),D].filter(l=>!!l),issueData:{code:c.invalid_return_type,returnTypeError:u}})}let a={errorMap:t.common.contextualErrorMap},o=t.data;if(this._def.returns instanceof q){let i=this;return T(async function(...u){let l=new C([]),g=await i._def.args.parseAsync(u,a).catch(ke=>{throw l.addIssue(s(u,ke)),l}),R=await Reflect.apply(o,this,g);return await i._def.returns._def.type.parseAsync(R,a).catch(ke=>{throw l.addIssue(n(R,ke)),l})})}else{let i=this;return T(function(...u){let l=i._def.args.safeParse(u,a);if(!l.success)throw new C([s(u,l.error)]);let g=Reflect.apply(o,this,l.data),R=i._def.returns.safeParse(g,a);if(!R.success)throw new C([n(g,R.error)]);return R.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new r({...this._def,args:P.create(e).rest(z.create())})}returns(e){return new r({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,s){return new r({args:e||P.create([]).rest(z.create()),returns:t||z.create(),typeName:m.ZodFunction,...y(s)})}},ie=class extends _{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};ie.create=(r,e)=>new ie({getter:r,typeName:m.ZodLazy,...y(e)});var oe=class extends _{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return d(t,{received:t.data,code:c.invalid_literal,expected:this._def.value}),p}return{status:"valid",value:e.data}}get value(){return this._def.value}};oe.create=(r,e)=>new oe({value:r,typeName:m.ZodLiteral,...y(e)});function it(r,e){return new ce({values:r,typeName:m.ZodEnum,...y(e)})}var ce=class r extends _{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),s=this._def.values;return d(t,{expected:v.joinValues(s),received:t.parsedType,code:c.invalid_type}),p}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),s=this._def.values;return d(t,{received:t.data,code:c.invalid_enum_value,options:s}),p}return T(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return r.create(e,{...this._def,...t})}exclude(e,t=this._def){return r.create(this.options.filter(s=>!e.includes(s)),{...this._def,...t})}};ce.create=it;var de=class extends _{_parse(e){let t=v.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==f.string&&s.parsedType!==f.number){let n=v.objectValues(t);return d(s,{expected:v.joinValues(n),received:s.parsedType,code:c.invalid_type}),p}if(this._cache||(this._cache=new Set(v.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let n=v.objectValues(t);return d(s,{received:s.data,code:c.invalid_enum_value,options:n}),p}return T(e.data)}get enum(){return this._def.values}};de.create=(r,e)=>new de({values:r,typeName:m.ZodNativeEnum,...y(e)});var q=class extends _{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==f.promise&&t.common.async===!1)return d(t,{code:c.invalid_type,expected:f.promise,received:t.parsedType}),p;let s=t.parsedType===f.promise?t.data:Promise.resolve(t.data);return T(s.then(n=>this._def.type.parseAsync(n,{path:t.path,errorMap:t.common.contextualErrorMap})))}};q.create=(r,e)=>new q({type:r,typeName:m.ZodPromise,...y(e)});var E=class extends _{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===m.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:s}=this._processInputParams(e),n=this._def.effect||null,a={addIssue:o=>{d(s,o),o.fatal?t.abort():t.dirty()},get path(){return s.path}};if(a.addIssue=a.addIssue.bind(a),n.type==="preprocess"){let o=n.transform(s.data,a);if(s.common.async)return Promise.resolve(o).then(async i=>{if(t.value==="aborted")return p;let u=await this._def.schema._parseAsync({data:i,path:s.path,parent:s});return u.status==="aborted"?p:u.status==="dirty"?K(u.value):t.value==="dirty"?K(u.value):u});{if(t.value==="aborted")return p;let i=this._def.schema._parseSync({data:o,path:s.path,parent:s});return i.status==="aborted"?p:i.status==="dirty"?K(i.value):t.value==="dirty"?K(i.value):i}}if(n.type==="refinement"){let o=i=>{let u=n.refinement(i,a);if(s.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return i};if(s.common.async===!1){let i=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return i.status==="aborted"?p:(i.status==="dirty"&&t.dirty(),o(i.value),{status:t.value,value:i.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(i=>i.status==="aborted"?p:(i.status==="dirty"&&t.dirty(),o(i.value).then(()=>({status:t.value,value:i.value}))))}if(n.type==="transform")if(s.common.async===!1){let o=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!F(o))return p;let i=n.transform(o.value,a);if(i instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:i}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(o=>F(o)?Promise.resolve(n.transform(o.value,a)).then(i=>({status:t.value,value:i})):p);v.assertNever(n)}};E.create=(r,e,t)=>new E({schema:r,typeName:m.ZodEffects,effect:e,...y(t)});E.createWithPreprocess=(r,e,t)=>new E({schema:e,effect:{type:"preprocess",transform:r},typeName:m.ZodEffects,...y(t)});var I=class extends _{_parse(e){return this._getType(e)===f.undefined?T(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};I.create=(r,e)=>new I({innerType:r,typeName:m.ZodOptional,...y(e)});var Z=class extends _{_parse(e){return this._getType(e)===f.null?T(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Z.create=(r,e)=>new Z({innerType:r,typeName:m.ZodNullable,...y(e)});var ue=class extends _{_parse(e){let{ctx:t}=this._processInputParams(e),s=t.data;return t.parsedType===f.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};ue.create=(r,e)=>new ue({innerType:r,typeName:m.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...y(e)});var le=class extends _{_parse(e){let{ctx:t}=this._processInputParams(e),s={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return pe(n)?n.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new C(s.common.issues)},input:s.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new C(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}};le.create=(r,e)=>new le({innerType:r,typeName:m.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...y(e)});var xe=class extends _{_parse(e){if(this._getType(e)!==f.nan){let s=this._getOrReturnCtx(e);return d(s,{code:c.invalid_type,expected:f.nan,received:s.parsedType}),p}return{status:"valid",value:e.data}}};xe.create=r=>new xe({typeName:m.ZodNaN,...y(r)});var Wt=Symbol("zod_brand"),Se=class extends _{_parse(e){let{ctx:t}=this._processInputParams(e),s=t.data;return this._def.type._parse({data:s,path:t.path,parent:t})}unwrap(){return this._def.type}},Ae=class r extends _{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.common.async)return(async()=>{let a=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return a.status==="aborted"?p:a.status==="dirty"?(t.dirty(),K(a.value)):this._def.out._parseAsync({data:a.value,path:s.path,parent:s})})();{let n=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return n.status==="aborted"?p:n.status==="dirty"?(t.dirty(),{status:"dirty",value:n.value}):this._def.out._parseSync({data:n.value,path:s.path,parent:s})}}static create(e,t){return new r({in:e,out:t,typeName:m.ZodPipeline})}},fe=class extends _{_parse(e){let t=this._def.innerType._parse(e),s=n=>(F(n)&&(n.value=Object.freeze(n.value)),n);return pe(t)?t.then(n=>s(n)):s(t)}unwrap(){return this._def.innerType}};fe.create=(r,e)=>new fe({innerType:r,typeName:m.ZodReadonly,...y(e)});function rt(r,e){let t=typeof r=="function"?r(e):typeof r=="string"?{message:r}:r;return typeof t=="string"?{message:t}:t}function ot(r,e={},t){return r?W.create().superRefine((s,n)=>{let a=r(s);if(a instanceof Promise)return a.then(o=>{if(!o){let i=rt(e,s),u=i.fatal??t??!0;n.addIssue({code:"custom",...i,fatal:u})}});if(!a){let o=rt(e,s),i=o.fatal??t??!0;n.addIssue({code:"custom",...o,fatal:i})}}):W.create()}var qt={object:S.lazycreate},m;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline",r.ZodReadonly="ZodReadonly"})(m||(m={}));var Yt=(r,e={message:`Input not instance of ${r.name}`})=>ot(t=>t instanceof r,e),ct=U.create,dt=G.create,Xt=xe.create,Jt=H.create,ut=ee.create,Qt=te.create,Kt=ye.create,Gt=re.create,Ht=se.create,er=W.create,tr=z.create,rr=j.create,sr=ge.create,nr=B.create,ar=S.create,ir=S.strictCreate,or=ne.create,cr=Me.create,dr=ae.create,ur=P.create,lr=Pe.create,fr=_e.create,hr=ve.create,pr=Ze.create,mr=ie.create,yr=oe.create,gr=ce.create,_r=de.create,vr=q.create,xr=E.create,br=I.create,kr=Z.create,wr=E.createWithPreprocess,Tr=Ae.create,Rr=()=>ct().optional(),Cr=()=>dt().optional(),Sr=()=>ut().optional(),Ar={string:r=>U.create({...r,coerce:!0}),number:r=>G.create({...r,coerce:!0}),boolean:r=>ee.create({...r,coerce:!0}),bigint:r=>H.create({...r,coerce:!0}),date:r=>te.create({...r,coerce:!0})};var Or=p;var Ns=be.union([be.enum(["low","medium","high","always-visible"]),be.number()]);var $e=5;var Ir=9,Y=200,Le=10;function lt(r,e,t,s,n,a,o="-1"){let i=1/0,u=1/0,l=-1/0,g=-1/0,R=new b(-Le,0,5,t),Oe=new b(-Le,0,e,5),ke=new b(e-5,0,e+Le,t),ht=new b(0,t-5,e,t+Le),pt=Nr(e,t,s,n,a),mt=[R,Oe,ke,ht],Ue=new b(-Y,-Y,e+Y*2,t+Y*2);for(let x of r){let $,Te;for(let A=0;A<x.bboxes.length;A++){if(x.bboxes[A]==null||($=x.bboxes[A].boundingBox,Te=x.bboxes[A].index,x.lockedToStrategyIndex!==-1&&Te!==x.lockedToStrategyIndex))continue;let[Ne,O,J,qe]=$,[Q,yt,Ye,gt]=[x.y-Ne,x.y+O,x.x-J,x.x+qe],De=Ye,Ve=Q,Xe=gt-Ye,Je=yt-Q;i=Math.min(i,De)-Y,u=Math.min(u,Ve)-Y,l=Math.max(l,De+Xe)+Y,g=Math.max(g,Ve+Je)+Y,x.bboxes[A].boundingRect=new b(De,Ve,Xe,Je)}}let Ie=new Re(new b(i,u,l-i,g-u)),X={msgId:o,colliders:new Array(r.length),staticColliders:[],debug:[]},We=0;for(let x=0;x<r.length;x++){let $=r[x];$.bboxes?.[0]?.index===Ir&&(X.staticColliders.push($.bboxes[0].boundingRect),Ie.insert($.bboxes[0].boundingRect),We++)}r=r.slice(We,r.length);let we;for(let x=0;x<r.length;x++)if(we=r[x],X.colliders[x]=[-1,0],we.enabledAndVisible){let[$,Te,A]=[1/0,-1,void 0];for(let{index:Ne,boundingRect:O}of we.bboxes){if(O==null)continue;let J=[];if(J=Ie.queryRect(O).filter(Q=>O.intersects(Q)),we.shouldCollideWithScreenEdges&&mt.forEach(Q=>{O.intersects(Q)&&J.push(Q)}),O.intersects(pt)){X.colliders[x]=[-1,0,O];break}if(J.length<=$&&(A=O,Te=Ne,$=J.length),J.length===0){Ie.insert(O),X.colliders[x]=[Ne,Ue.contains(O)?0:1,O];break}}we.rank===$e&&A!=null&&(Ie.insert(A),X.colliders[x]=[Te,Ue.contains(A)?0:1,A])}else X.colliders[x]=[-1,0];return X}function Nr(r,e,t,s,n){switch(n){case"top-right":return new b(r-t,0,t,s);case"bottom-left":return new b(0,e-s,t,s);case"bottom-right":return new b(r-t,e-s,t,s);case"top-left":return new b(0,0,t,s)}}function ft(r){let e=r[0].map(t=>{let s=t[0].map(n=>({index:n[4],boundingBox:[n[0],n[1],n[2],n[3]]}));return{enabledAndVisible:t[1]===1,rank:t[2]===1?$e:0,x:t[3],y:t[4],shouldCollideWithScreenEdges:t[5]===1,bboxes:s,lockedToStrategyIndex:t[6]}});return{msgId:"-1",totalWidth:r[3],totalHeight:r[2],watermarkWidth:r[4],watermarkHeight:r[5],watermarkPosition:r[6],colliders:e,devicePixelRatio:r[1]}}self.onmessage=r=>{let e=ft(r.data);self.postMessage(lt(e.colliders,e.totalWidth,e.totalHeight,e.watermarkWidth,e.watermarkHeight,e.watermarkPosition,e.msgId))};})();\n';d();d();d();d();d();function _D(e,r){return r.x+r.w<e.x+e.w&&r.x>e.x&&r.y>e.y&&r.y+r.h<e.y+e.h}d();function RD(e,r){let[t,o]=r;return t>=e.x&&t<=e.x+e.w&&o>=e.y&&o<=e.y+e.h}d();function BD(e,r){let t=r.x,o=r.y,n=r.x+r.w,i=r.y+r.h,a=e.x,l=e.y,c=e.x+e.w,p=e.y+e.h;return t<c&&a<n&&o<p&&l<i}d();function ca(e,r){for(let t=0;t<r.length;t++)e.push(r[t])}d();var rt=class{constructor(r,t,o,n,i){m(this,"x");m(this,"y");m(this,"w");m(this,"h");m(this,"userData");this.userData=typeof i>"u"?null:i,this.x=r,this.y=t,this.w=o,this.h=n}contains(r){return r===this?!1:_D(this,r)}intersects(r){return BD(this,r)}intersectsPoint(r){return RD(this,r)}draw(r){r.fillStyle="rgba(123,222,26, 0.8)",r.fillRect(this.x,this.y,this.w,this.h)}};var An=class e{constructor(r,t){m(this,"topLeft");m(this,"topRight");m(this,"bottomLeft");m(this,"bottomRight");m(this,"divided",!1);m(this,"boundary");m(this,"capacity",16);m(this,"objects",[]);m(this,"parent");this.parent=t,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:t,w:o,h:n}=this.boundary;this.topLeft=new e(new rt(r,t,o/2,n/2),this),this.topRight=new e(new rt(r+o/2,t,o/2,n/2),this),this.bottomLeft=new e(new rt(r,t+n/2,o/2,n/2),this),this.bottomRight=new e(new rt(r+o/2,t+n/2,o/2,n/2),this),this.divided=!0}queryRect(r){let t=[];if(this.boundary.intersects(r))t.push(...this.objects);else return[];return this.divided&&(ca(t,this.topLeft.queryRect(r)),ca(t,this.topRight.queryRect(r)),ca(t,this.bottomLeft.queryRect(r)),ca(t,this.bottomRight.queryRect(r))),t}queryPoint(r){let t=[];if(this.boundary.intersectsPoint(r))t.push(...this.objects);else return[];return this.divided&&(ca(t,this.topLeft.queryPoint(r)),ca(t,this.topRight.queryPoint(r)),ca(t,this.bottomLeft.queryPoint(r)),ca(t,this.bottomRight.queryPoint(r))),t}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(t=>t.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()}};d();function ND(e,r,t){let o,n,i,a=null,l=0;t||(t={});let c=function(){l=t.leading===!1?0:Date.now(),a=null,i=e.apply(o,n),a||(o=n=null)};return function(){let p=Date.now();!l&&t.leading===!1&&(l=p);let u=r-(p-l);return o=globalThis,n=arguments,u<=0||u>r?(a&&(clearTimeout(a),a=null),l=p,i=e.apply(o,n),a||(o=n=null)):!a&&t.trailing!==!1&&(a=setTimeout(c,u)),i}}function jD(e){let r=e[0].map(t=>{let o=t[0].map(n=>({index:n[4],boundingBox:[n[0],n[1],n[2],n[3]]}));return{enabledAndVisible:t[1]===1,rank:t[2]===1?Ip:0,x:t[3],y:t[4],shouldCollideWithScreenEdges:t[5]===1,bboxes:o,lockedToStrategyIndex:t[6]}});return{msgId:"-1",totalWidth:e[3],totalHeight:e[2],watermarkWidth:e[4],watermarkHeight:e[5],watermarkPosition:e[6],colliders:r,devicePixelRatio:e[1]}}d();var y2=9,gl=200,E1=10;function GD(e,r,t,o,n,i,a="-1"){let l=1/0,c=1/0,p=-1/0,u=-1/0,f=new rt(-E1,0,5,t),h=new rt(-E1,0,r,5),b=new rt(r-5,0,r+E1,t),x=new rt(0,t-5,r,t+E1),T=C$(r,t,o,n,i),v=[f,h,b,x],I=new rt(-gl,-gl,r+gl*2,t+gl*2);for(let _ of e){let G,R;for(let N=0;N<_.bboxes.length;N++){if(_.bboxes[N]==null||(G=_.bboxes[N].boundingBox,R=_.bboxes[N].index,_.lockedToStrategyIndex!==-1&&R!==_.lockedToStrategyIndex))continue;let[X,z,ee,re]=G,[ue,Ce,Oe,Pe]=[_.y-X,_.y+z,_.x-ee,_.x+re],Fe=Oe,ce=ue,Ee=Pe-Oe,ye=Ce-ue;l=Math.min(l,Fe)-gl,c=Math.min(c,ce)-gl,p=Math.max(p,Fe+Ee)+gl,u=Math.max(u,ce+ye)+gl,_.bboxes[N].boundingRect=new rt(Fe,ce,Ee,ye)}}let M=new An(new rt(l,c,p-l,u-c)),O={msgId:a,colliders:new Array(e.length),staticColliders:[],debug:[]},C=0;for(let _=0;_<e.length;_++){let G=e[_];G.bboxes?.[0]?.index===y2&&(O.staticColliders.push(G.bboxes[0].boundingRect),M.insert(G.bboxes[0].boundingRect),C++)}e=e.slice(C,e.length);let E;for(let _=0;_<e.length;_++)if(E=e[_],O.colliders[_]=[-1,0],E.enabledAndVisible){let[G,R,N]=[1/0,-1,void 0];for(let{index:X,boundingRect:z}of E.bboxes){if(z==null)continue;let ee=[];if(ee=M.queryRect(z).filter(ue=>z.intersects(ue)),E.shouldCollideWithScreenEdges&&v.forEach(ue=>{z.intersects(ue)&&ee.push(ue)}),z.intersects(T)){O.colliders[_]=[-1,0,z];break}if(ee.length<=G&&(N=z,R=X,G=ee.length),ee.length===0){M.insert(z),O.colliders[_]=[X,I.contains(z)?0:1,z];break}}E.rank===Ip&&N!=null&&(M.insert(N),O.colliders[_]=[R,I.contains(N)?0:1,N])}else O.colliders[_]=[-1,0];return O}function C$(e,r,t,o,n){switch(n){case"top-right":return new rt(e-t,0,t,o);case"bottom-left":return new rt(0,r-o,t,o);case"bottom-right":return new rt(e-t,r-o,t,o);case"top-left":return new rt(0,0,t,o)}}d();var Bf=class{constructor(){m(this,"onerror",()=>{});m(this,"onmessage",()=>{});m(this,"postMessage",r=>{let t=jD(r);this.onmessage({data:GD(t.colliders,t.totalWidth,t.totalHeight,t.watermarkWidth,t.watermarkHeight,t.watermarkPosition,t.msgId)})});m(this,"terminate",()=>{})}};var gu=!1,M$=150,P1=class extends ke{constructor(t,o,n=!0){super();m(this,"worker");m(this,"debugContext");m(this,"debugCanvas");m(this,"collidersDirty",!0);m(this,"packedMessage",[[],0,0,0,0,0,"bottom-left"]);m(this,"visibleCollidersQTree",new An(new rt(0,0,0,0)));m(this,"interactiveCollidersQTree",new An(new rt(0,0,0,0)));m(this,"coreState");m(this,"postMessage");m(this,"showCollisionBoxes",()=>{gu=!0,this.debugCanvas.style.display="block"});m(this,"hideCollisionBoxes",()=>{gu=!1,this.debugContext.clearRect(0,0,this.debugCanvas.width,this.debugCanvas.height),this.debugCanvas.style.display="none"});m(this,"currentMsgId","");m(this,"working",!1);m(this,"_postMessage",()=>{this.worker.postMessage(this.packedMessage)});m(this,"componentArray",[]);m(this,"update",(t,o,n="bottom-left",i=!1,a=[])=>{let l=!1;if(this.collidersDirty){this.packedMessage=[[],0,0,0,0,0,"bottom-left"],this.componentArray=[];let u;for(let f of this.coreState.geometry2DIdsInScene){let h=this.coreState.geometry2DMap.get(f);h&&(u=h.components[0],this.componentArray.push(u))}this.resize(t,o,n),this.collidersDirty=!1,l=!0}else l=this.componentArray.some(u=>u.collisionDirty===!0);l&&this.componentArray.sort((u,f)=>f.rank-u.rank);let c=0;for(let u of a)this.packedMessage[0][c]==null&&(this.packedMessage[0][c]=[]),this.packedMessage[0][c][0]==null&&(this.packedMessage[0][c][0]=[]),this.packedMessage[0][c][0]=[[u.h/2,u.h/2,u.w/2,u.w/2,y2]],this.packedMessage[0][c][1]=1,this.packedMessage[0][c][2]=1,this.packedMessage[0][c][3]=u.x,this.packedMessage[0][c][4]=u.y,this.packedMessage[0][c][5]=0,this.packedMessage[0][c][6]=-1,c++;let p=0;for(;c<this.componentArray.length+a.length;){if(this.packedMessage){let u=this.componentArray[p].toPackedMessage(i&&!l);this.packedMessage[0][c]==null&&(this.packedMessage[0][c]=[]),this.packedMessage[0][c][0]==null&&(this.packedMessage[0][c][0]=[]),this.packedMessage[0][c][0]=u.bboxes,this.packedMessage[0][c][1]=u.enabled&&this.componentArray[p].visible&&!this.componentArray[p].isOccluded?1:0,this.packedMessage[0][c][2]=u.rank===Ip?1:0,this.packedMessage[0][c][3]=u.x,this.packedMessage[0][c][4]=u.y,this.packedMessage[0][c][5]=u.shouldCollideWithScreenEdges?1:0,this.packedMessage[0][c][6]=u.lockedToStrategyIndex}c++,p++}this.working||this.postMessage()});m(this,"resolve",t=>{if(this.working=!1,this.collidersDirty||!t.data)return;let o=t.data.colliders,n=-1,i,a,l,c=new rt(0,0,this.debugCanvas.width,this.debugCanvas.height);if(this.visibleCollidersQTree=new An(c),this.interactiveCollidersQTree=new An(c),gu)for(let p of t.data.staticColliders)this.visibleCollidersQTree.insert(new rt(p.x,p.y,p.w,p.h));for(let p=0;p<this.componentArray.length;p++){let u=this.componentArray[p];o[p]!=null&&(n=o[p][0],i=o[p][2],u.offscreen=o[p][1]===1,n!==-1&&i!=null?(l=new rt(i.x,i.y,i.w,i.h,{entityId:u.id}),this.visibleCollidersQTree.insert(l),a=this.coreState.geometry2DMap.get(u.id),a?.components[1]!=null&&this.interactiveCollidersQTree.insert(l),(u.canShow===!1||u.visibilityNeedsUpdate!==!1)&&"visibilityNeedsUpdate"in u&&(u.visibilityNeedsUpdate="show"),n!==-1&&n!==u.currentStrategyIndex&&(u.activeBoundingBox=l,u.onStrategySelected(n))):((u.canShow===!0||u.visibilityNeedsUpdate!==!1)&&"visibilityNeedsUpdate"in u&&(u.visibilityNeedsUpdate="hide"),n!==-1&&n!==u.currentStrategyIndex&&u.onStrategySelected(n)))}gu&&this.drawDebug(),this.publish("visibility-changed")});m(this,"drawDebug",()=>{gu&&this.visibleCollidersQTree&&(this.debugContext.clearRect(0,0,this.debugCanvas.width,this.debugCanvas.height),this.debugContext.beginPath(),this.visibleCollidersQTree.drawObjects(this.debugContext))});m(this,"destroy",()=>{this.worker.terminate()});this.worker=n===!1?new Bf:Pc!==""?new Worker(Pc):new Worker(URL.createObjectURL(new Blob([LD],{type:"text/javascript"}))),this.worker.onerror=()=>{this.worker=new Bf,this.worker.onmessage=i=>this.resolve(i)},this.coreState=o,this.debugCanvas=t,this.debugContext=t.getContext("2d"),this.worker.onmessage=i=>this.resolve(i),this.postMessage=ND(this._postMessage,M$,!1),gu?this.showCollisionBoxes():this.hideCollisionBoxes()}resize(t,o,n){this.packedMessage[6]=n,this.packedMessage[5]=o,this.packedMessage[4]=t,this.packedMessage[3]=this.debugCanvas.width,this.packedMessage[2]=this.debugCanvas.height}};d();d();d();d();var F1=class{constructor(r){m(this,"type");m(this,"event");this.type=0,this.event=r}get timestamp(){return this.event.timeStamp}},D1=class{constructor(){m(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(){return this.isSingleTap&&this.lastPointerDown?.type===1}get isSingleTapWithOneFinger(){return this.isSingleTap&&this.lastPointerDown?.type===0}get isDoubleTapWithOneFinger(){return this.isDoubleTap&&this.taps[0]?.type===0&&this.taps[1]?.type===0}get isSingleTap(){return this.taps.length===1}get isDoubleTap(){return this.taps.length===2}discardOutsideOfWaitWindow(r){this.taps=this.taps.filter(t=>r-t.timestamp<300)}flush(){this.taps=[]}get _taps(){return this.taps}destroy(){this.flush()}};d();function x2(e){let r=new Set;for(let t of e){let o=t.object;for(;o.visible&&o.parent&&o.parent.visible===!0&&!r.has(o.parent);)o=o.parent,o instanceof hr&&o.type==="group-container"&&o.visible&&o.components[0]&&r.add(o)}return Array.from(r)}var yu,Nf=class extends ke{constructor(t,o,n,i,a){super();m(this,"raycaster",new Ei);m(this,"state",{hovered3DEntity:void 0,hovered2DEntity:void 0,hovered3DContainers:void 0,lastHover:void 0,interaction:{mouseDownStart:void 0,distanceFromMouseDown:void 0,isPanning:!1}});m(this,"coreState");m(this,"camera");m(this,"worldPlane");m(this,"_quadtree",new An(new rt(0,0,0,0)));m(this,"_container");m(this,"lastPointerEvent");m(this,"cursor","grab");m(this,"touchesCount",0);m(this,"isUserInteracting");m(this,"hasTouched",!1);S(this,yu);m(this,"onPointerMoveRaf",t=>{this.lastPointerEvent=t,s(this,yu)&&cancelAnimationFrame(s(this,yu)),w(this,yu,requestAnimationFrame(()=>{this.onPointerMove(t)}))});m(this,"onPointerMove",t=>{t.preventDefault(),this.updateInteractionStateIfPanning(t),(t.pointerType!=="touch"||t.pointerType===void 0&&this.hasTouched)&&this.handleHover(t),this.handleCursor()});m(this,"tapsControl",new D1);m(this,"onPointerDown",t=>{t.target===this._container&&(this._container.addEventListener("pointerup",this.onPointerUp,!1),this._container.addEventListener("pointercancel",this.onPointerUp,!1),this.state.interaction.mouseDownStart={time:Date.now(),timestamp:t.timeStamp,offsetX:t.offsetX,offsetY:t.offsetY},this.lastPointerEvent=t,this.state.interaction.distanceFromMouseDown=0,this.handleCursor(),t.pointerType==="touch"&&(this.tapsControl.add(new F1(t)),this.touchesCount=Math.max(0,this.touchesCount+1)))});m(this,"clickTimeout");m(this,"onPointerUp",t=>{this.tapsControl.discardOutsideOfWaitWindow(t.timeStamp),this.lastPointerEvent=t,this.touchesCount=Math.max(0,this.touchesCount-1),this.touchesCount===0&&(this._container.removeEventListener("pointerup",this.onPointerUp,!1),this._container.removeEventListener("pointercancel",this.onPointerUp,!1)),this.updateInteractionStateIfPanning(t);let{mouseDownStart:o}=this.state.interaction;!o||this.state.interaction.distanceFromMouseDown==null||(Date.now()<o.time+300&&(this.tapsControl.isSingleTapWithTwoFingers||this.state.interaction.distanceFromMouseDown<=15)&&(t.pointerType==="touch"?this.tapsControl.isSingleTapWithTwoFingers?(this.publish("singletap-with-twofinger",t),this.flush()):this.tapsControl.isSingleTapWithOneFinger&&this.touchesCount===0?(this.clickTimeout&&clearTimeout(this.clickTimeout),this.clickTimeout=window.setTimeout(()=>{this.handleClick(t),this.flush()},300)):this.tapsControl.isDoubleTapWithOneFinger&&(this.publish("doubletap-with-onefinger",t),this.flush()):this.handleClick(t)),this.state.interaction.mouseDownStart=void 0,this.state.interaction.distanceFromMouseDown=void 0,this.state.interaction.isPanning=!1,this.handleCursor())});m(this,"dirty3D",!0);m(this,"cachedHitBoxes",{entities:[]});m(this,"ndcPoint",new Me);m(this,"debugPanel");this.isUserInteracting=a,this.raycaster.layers.enableAll(),this.raycaster.layers.disable(1),this.camera=n,this._container=t,this.coreState=o,this.worldPlane=i,this._container.addEventListener("pointerdown",this.onPointerDown,!1),this._container.addEventListener("pointermove",this.onPointerMoveRaf,!1),this._container.classList.add("mappedin-interactive")}updateQuadtree(t){this._quadtree=t}setHovered3DEntityInteractionComponentDirty(){if(this.state.hovered3DEntity){let t=this.state.hovered3DEntity.components[2];t&&(t.dirty=!0)}}getThreeDIntersectsFromXY(t){this.raycaster.setFromCamera(t,this.camera),this.raycaster.layers.enable(0);let o=this.raycaster.intersectObjects(this._hitBoxes.entities,!0).filter(i=>i.object?.name==="worldPlane"||i.object?.visible),n=o.findIndex(i=>i.object?.name==="worldPlane");return n!==-1&&o.push(o.splice(n,1)[0]),o}getGroupContainerIntersectsFromXY(t){let o=this.getThreeDIntersectsFromXY(t),n;return o!=null&&o.length>0&&(n=x2(o)),n}flush(){this.tapsControl.flush(),this.clickTimeout!=null&&(clearTimeout(this.clickTimeout),this.clickTimeout=void 0)}handleHover(t){let o=t||this.lastPointerEvent;if(this.state.interaction.mouseDownStart||!o||this.isUserInteracting())return;let{entity3D:n,entity2D:i,position:a,groupContainers:l}=this.intersect(o);(this.detect3DEntityHover(n)||this.detect2DEntityHover(i)||this.detect3DContainerHover(l))&&(this.state.hovered3DEntity=n,this.state.lastHover=n,this.state.hovered2DEntity=i,this.state.hovered3DContainers=l,this.publish("hover",{entity2D:this.state.hovered2DEntity,entity3D:this.state.hovered3DEntity,position:a,groupContainers:l})),this.handleCursor()}handleCursor(){let t=!!(this.state.hovered3DEntity&&this.state.hovered3DEntity?.components[2]||this.state.hovered2DEntity),o=!!this.state.interaction.mouseDownStart,n=this.state.interaction.isPanning,i=E$(t,n,o);this.cursor!==i&&(this.cursor=i,i==="pointer"?this._container.classList.add("mappedin-interaction-hover"):this._container.classList.remove("mappedin-interaction-hover"))}detect2DEntityHover(t){return this.state.hovered2DEntity!==t}handleClick(t){let o=this.intersect(t);this.publish("click",{entity2D:o.entity2D,entity3D:o.entity3D,position:o.position,groupContainers:o.groupContainers,pointerEvent:{button:t.button}})}get _hitBoxes(){if(this.dirty3D){this.cachedHitBoxes.entities=[];let t;for(let o of this.coreState.geometry3DIdsInScene)t=this.coreState.geometry3DMap.get(o),(t?.type==="geometry"||t?.type==="model"||t?.type==="path"||t?.type==="custom-geometry")&&t.components[0].mesh&&!this.cachedHitBoxes.entities.includes(t.components[0].mesh)&&this.cachedHitBoxes.entities.push(t.components[0].mesh);return this.dirty3D=!1,this.cachedHitBoxes.entities.push(this.worldPlane),this.cachedHitBoxes}return this.cachedHitBoxes}intersect(t){let{offsetX:o,offsetY:n}=t,i=[o,n],a=this._quadtree.queryPoint(i),[l]=a.filter(I=>I.intersectsPoint(i));this.ndcPoint.x=o/this._container.clientWidth*2-1,this.ndcPoint.y=-(n/this._container.clientHeight)*2+1;let c=this.getThreeDIntersectsFromXY(this.ndcPoint),p=c[0]?.point,u=[],f=[],h=c.filter(I=>I.object.name!=="worldPlane");for(let I of h)I.object instanceof Le&&I.object.material.depthTest===!1?u.push(I):f.push(I);let b=u[0]??f[0]??void 0,x,T;if(b!=null){if(x=F$(b.object,this.coreState.geometry3DMap),!x){let I=b?.instanceId??b?.batchId;x=I!=null&&b?.object.userData.entities?this.coreState.geometry3DMap.get(b?.object.userData.entities[I]):this.coreState.geometry3DMap.get(b?.object.userData.entityId)}x?.components[2]&&(T=x)}let v=x2(h);return{entity2D:l?.userData?.entityId==="watermark"?{id:"watermark"}:this.coreState.geometry2DMap.get(l?.userData.entityId),entity3D:T,position:p,groupContainers:v.length>0?v:void 0}}detect3DEntityHover(t){return this.state.lastHover!==t&&(this.state.lastHover&&$D(this.state.lastHover,!1,this.coreState),t&&$D(t,!0,this.coreState)),this.state.hovered3DEntity!==t}detect3DContainerHover(t){return!TC(this.state.hovered3DContainers,t)}updateInteractionStateIfPanning(t){this.state.interaction.mouseDownStart&&(this.state.interaction.distanceFromMouseDown=Math.sqrt(Math.pow(t.offsetX-this.state.interaction.mouseDownStart.offsetX,2)+Math.pow(t.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,!1),this._container.removeEventListener("pointermove",this.onPointerMoveRaf,!1),this._container.removeEventListener("pointerup",this.onPointerUp,!1),this._container.removeEventListener("pointercancel",this.onPointerUp,!1)}enableDebug(){let t=document.createElement("div");t.style.position="absolute",t.style.top="0",t.style.right="0",t.style.backgroundColor="white",t.style.padding="10px",document.body.append(t),t.id="interaction-debug-panel",this.debugPanel=t,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",o=>{this.queueDebugMessage(`CLICK
6
+ `)}function dt(...k){let H={language:"javascript"},[P,q,K]=k.length===2&&we(k[1])?[k[0],k[1],H]:k.length===2&&!we(k[1])?[k[0],[],k[1]]:k.length===3?[k[0],k[1],k[2]]:k.length===1?[k[0],[],H]:[null,[],H];if(ce.language=K.language,ce.variables.clear(),ce.functions.clear(),ce.instances.clear(),!ze(P))throw new Db(P);for(let Q of q)if(!ze(Q))throw new Db(Q);return nt(P,q,K)}e.Code=dt;function $t(k,H=[]){let P=dt(k,H,{language:"javascript"}),q=globalThis.Function("kind","format","hash",P),K=new Map(ce.instances);function Q(ir,ur,wi){if(!Or.Has(ir)||!K.has(ur))return!1;let lp=Or.Get(ir),nm=K.get(ur);return lp(nm,wi)}function De(ir,ur){return Fo.Has(ir)?Fo.Get(ir)(ur):!1}function xt(ir){return Ka(ir)}let dr=q(Q,De,xt);return new cI(k,H,dr,P)}e.Compile=$t})(kb||(kb={}));d();d();d();var dG=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,uG=[0,31,28,31,30,31,30,31,31,30,31,30,31],mG=e=>e%4===0&&(e%100!==0||e%400===0),Ab=e=>{let r=dG.exec(e);if(!r)return!1;let t=+r[1],o=+r[2],n=+r[3];return o>=1&&o<=12&&n>=1&&n<=(o===2&&mG(t)?29:uG[o])};d();var fG=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i,Lb=e=>{let r=fG.exec(e);if(!r)return!1;let t=+r[1],o=+r[2],n=+r[3],i=r[4],a=r[5]==="-"?-1:1,l=+(r[6]||0),c=+(r[7]||0);if(l>23||c>59||!i)return!1;if(t<=23&&o<=59&&n<60)return!0;let p=o-c*a,u=t-l*a-(p<0?1:0);return(u===23||u===-1)&&(p===59||p===-1)&&n<61};var hG=/t|\s/i,SE=e=>{let r=e.split(hG);return r.length===2&&Ab(r[0])&&Lb(r[1])};d();var gG=/\/|:/,yG=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,TE=e=>gG.test(e)&&yG.test(e);var bG=[["date",Ab],["time",Lb],["date-time",SE],["uri",TE]],CE=()=>{for(let[e,r]of bG)try{Qy.Format(e,r)}catch(t){if(t instanceof Zm)continue;throw t}};d();var mI=g.Record(g.String(),g.Unknown(),{$id:"Extra"}),ri=g.Object({extra:g.Optional(g.Ref(mI))}),fI=[mI];d();d();d();d();d();d();var tt=e=>Object.entries(e);var xG=e=>{let r=new Map;for(let[t,o]of tt(e.geometry??{}))r.set(t,new Map(o?.features.map(n=>[n.properties.id,n])));return r},yr=e=>{let r=xG(e);return(o,n)=>{let i=r.get(o);if(i==null)return ie({kind:_o.UnknownFloorError,properties:{floorId:o}});let a=i.get(n);return a==null?ie({kind:_o.UnknownGeometryError,properties:{floorId:o,geometryId:n}}):oe(a)}};d();var Cn=g.Object({geometryId:g.Ref(ro)},{$id:"WithGeometryId"}),ud=g.Object({geometryIds:g.Array(g.Ref(ro))},{$id:"WithGeometryIds"}),hI=[Cn,ud];d();d();d();var ME=e=>e instanceof Error?e:new Error(String(e));var md=e=>(...r)=>{try{return oe(e(...r))}catch(t){return ie(ME(t))}};var wE=md((e,r)=>{let t={};for(let o of r)for(let n of o.intoBundle(e))t[n.path]=id(JSON.stringify(n.contents));return t}),gI=async(e,r,t)=>wE(e,r).andThenAsync(o=>new Promise(n=>{tE(o,{...t,consume:!0},(i,a)=>{n(i?ie(i):oe(a))})})),vG=md(rE),yI=(e,r,t)=>wE(e,r).andThen(o=>vG(o,t));d();d();function _b(e,r,t=[]){let o={...e};for(let[n,i]of Object.entries(r))if(i!==void 0)if(n in o){let a=n;if(Array.isArray(i)&&i.length>0){let l=IG(i[0],t);if(l){let c=o[a];if(!Array.isArray(c))throw new Error(`Expected array at ${n}, got ${typeof c}`);let p=new Map(i.map(h=>[OE(h,l),h])),f=c.map(h=>{let b=p.get(OE(h,l));return b?_b(h,b,t):h});o[a]=f}else o[a]=i}else{let l=o[a];typeof l=="object"&&l!==null&&typeof i=="object"&&i!==null?Object.keys(i).length===0?o[a]=i:o[a]=_b(l,i,t):o[n]=i}}else o[n]=i;return o}function IG(e,r){function t(o){if(typeof o!="object"||o===null)return null;for(let n of r)if(n in o&&typeof o[n]<"u")return[n];if(Array.isArray(o))return null;for(let[n,i]of Object.entries(o)){let a=t(i);if(a)return[n,...a]}return null}return t(e)}function OE(e,r){return r.reduce((t,o)=>{if(t&&typeof t=="object")return t[o]},e)}var SG=e=>e,TG=e=>JSON.parse(sI(e)),EE=(e,r)=>r.some(t=>t.fromBundle(e.name,new Uint8Array,SG)!==void 0),PE=md((e,r)=>{let t={};for(let o of Object.keys(e)){let n=e[o];for(let i of r){let a=i.fromBundle(o,n,TG);if(a){t=_b(t,a,[]);break}}}return t}),bI=async(e,r)=>new Promise(t=>oE(e,{filter:o=>EE(o,r)},(o,n)=>{t(o?ie(o):oe(n))})).then(t=>t.andThen(o=>PE(o,r))),CG=md(nE),xI=(e,r)=>CG(e,{filter:t=>EE(t,r)}).andThen(t=>PE(t,r));d();var MG=e=>typeof e=="object"&&e!=null&&"$ref"in e&&typeof e.$ref=="string",wG=e=>{if(e.length<2)return!1;let r=e.filter(MG);if(r.length!==e.length)return!1;let t=r[0].$ref;return r.slice(1).every(o=>o.$ref===t)},Rb=e=>typeof e=="object"&&e!=null&&"allOf"in e&&Array.isArray(e.allOf)&&wG(e.allOf)?e.allOf[0]:typeof e=="object"&&e!=null&&!Array.isArray(e)?Object.fromEntries(Object.entries(e).map(([r,t])=>[r,Rb(t)])):Array.isArray(e)?e.map(Rb):e;d();var Bb=e=>typeof e=="object"&&e!=null&&"$ref"in e?{...e,$ref:`#/definitions/${e.$ref}`}:typeof e=="object"&&e!=null&&!Array.isArray(e)?Object.fromEntries(Object.entries(e).map(([r,t])=>[r,Bb(t)])):Array.isArray(e)?e.map(Bb):e;var fd;(function(e){e.InvalidTypeboxSchema="InvalidTypeboxSchema",e.MissingReferenceId="MissingReferenceId",e.DuplicateReferenceId="DuplicateReferenceId",e.TypeboxError="TypeboxError",e.UnknownError="UnknownError"})(fd||(fd={}));var OG=e=>({next(){for(let t of e){let o=t.next();if(!o.done)return o}return{done:!0,value:void 0}},[Symbol.iterator](){return this}}),EG=(...e)=>{let r=new Map;for(let t of OG(e)){if(!t.$id)continue;let o=r.get(t.$id);if(o!=null&&o!==t)return ie({kind:fd.DuplicateReferenceId,message:"Failed to register a reference for a schema with an $id that has already been used",schema:t});r.set(t.$id,t)}return oe(r)},Fr,hd,en,Wr,vI=class vI{constructor(r,t,o,n){S(this,Fr);S(this,hd);S(this,en,[]);S(this,Wr);w(this,Fr,r),w(this,hd,t),w(this,en,o),w(this,Wr,n),this.is=this.is.bind(this),this.parse=this.parse.bind(this),this.verify=this.verify.bind(this),this.jsonSchema=this.jsonSchema.bind(this),this.compress=this.compress.bind(this),this.decompress=this.decompress.bind(this)}static create(r,t="CoreMVF",o=!1){let n=g.Composite(r.extensions.map(a=>a.schema),{$id:t});if(!D.IsSchema(n))return ie({kind:fd.InvalidTypeboxSchema,message:"Attempting to merge schemas produced an invalid schema",schema:n});let i=EG(Rv.values(),Bv.values(),Lv.values(),fI.values(),II.values(),hI.values(),r.extensions.flatMap(a=>a.references??[]).values());if(!i.isOk())return i;try{CE();let a=o?null:kb.Compile(n,[...i.value.values()]);return oe(new vI(n,a,r.extensions,i.value))}catch(a){return a instanceof be?ie({kind:fd.TypeboxError,message:a.message,original:a}):ie({kind:fd.UnknownError,message:"An unknown error occurred while compiling the schema",original:a})}}is(r){return s(this,hd)?.Check(r)??qn.Check(s(this,Fr),[...s(this,Wr).values()],r)}parse(r){return this.is(r)?oe(r):ie(s(this,hd)?.Errors(r)??qn.Errors(s(this,Fr),[...s(this,Wr).values()],r))}decode(r){try{return oe(vE(s(this,Fr),[...s(this,Wr).values()],r))}catch(t){return ie(t)}}encode(r){try{return oe(IE(s(this,Fr),[...s(this,Wr).values()],r))}catch(t){return ie(t)}}verify(r){for(let t of s(this,en))if(t.integrityCheck){let o=t.integrityCheck(r);if(o.isErr())return ie(o.error)}return oe(!0)}jsonSchema(){let r=JSON.parse(JSON.stringify([s(this,Fr),...s(this,Wr).values()])),t=Rb(Bb({$id:`#/definitions/${s(this,Fr).$id??"CoreMVF"}`,$schema:"http://json-schema.org/draft-07/schema#",references:r}));return JSON.stringify(t,null,2)}async compress(r){return this.encode(r).andThen(t=>this.parse(t)).andThenAsync(t=>gI(t,s(this,en))).then(t=>t.mapErr(o=>rf(s(this,Fr).$id??"CoreMVF",o,[...s(this,Wr).values()])))}async compressUnsafe(r){return this.encode(r).andThenAsync(t=>gI(t,s(this,en))).then(t=>t.mapErr(o=>rf(s(this,Fr).$id??"CoreMVF",o,[...s(this,Wr).values()])))}compressSync(r){return this.encode(r).andThen(t=>this.parse(t)).andThen(t=>yI(t,s(this,en))).mapErr(t=>rf(s(this,Fr).$id??"CoreMVF",t,[...s(this,Wr).values()]))}compressUnsafeSync(r){return this.encode(r).andThen(t=>yI(t,s(this,en))).mapErr(t=>rf(s(this,Fr).$id??"CoreMVF",t,[...s(this,Wr).values()]))}async decompress(r){return bI(r,s(this,en)).then(t=>t.andThen(o=>this.parse(o)).andThen(o=>this.decode(o)).mapErr(o=>of(s(this,Fr).$id??"CoreMVF",o,[...s(this,Wr).values()])))}async decompressUnsafe(r){return bI(r,s(this,en)).then(t=>t.andThen(o=>this.decode(o)).mapErr(o=>of(s(this,Fr).$id??"CoreMVF",o,[...s(this,Wr).values()])))}decompressSync(r){return xI(r,s(this,en)).andThen(t=>this.parse(t)).andThen(t=>this.decode(t)).mapErr(t=>of(s(this,Fr).$id??"CoreMVF",t,[...s(this,Wr).values()]))}decompressUnsafeSync(r){return xI(r,s(this,en)).andThen(t=>this.decode(t)).mapErr(t=>of(s(this,Fr).$id??"CoreMVF",t,[...s(this,Wr).values()]))}};Fr=new WeakMap,hd=new WeakMap,en=new WeakMap,Wr=new WeakMap;var Nb=vI;var gd,jb=class{constructor(){S(this,gd,[]);this.extend=this.extend.bind(this)}extend(r){return s(this,gd).push(r),this}extendOptional(r){let t={...r,schema:g.Partial(r.schema)};return s(this,gd).push(t),this}build(r){return Nb.create(this,void 0,r?.cspSafe)}get extensions(){return s(this,gd)}};gd=new WeakMap;d();d();d();d();var yd=g.Object({geometryId:g.Ref(ro),floorId:g.Ref(Ve)},{$id:"GeometryAnchor"}),PG=g.Object({geometryAnchor:g.Ref(yd)}),nf=(e,r)=>g.Object({geometryAnchors:g.Array(g.Ref(yd),e)},r),II=[yd];d();d();d();var FE=(e,r)=>g.Unsafe(g.Transform(g.String(r)).Decode(t=>e.includes(t)?t:"unknown").Encode(t=>t)),Ro=(e,r)=>{let t=FE(e,r),o=[...e,"unknown"],n=Object.freeze(Object.fromEntries([...e,"unknown"].map(i=>[i,i])));return{schema:t,values:o,record:n}};var DE=()=>new jb().extend(pE).extend(hE).extend(xE);d();d();d();d();d();d();var sf;(function(e){e.AnnotationNonPointGeometryError="AnnotationNonPointGeometryError",e.AnnotationUnknownSymbolError="AnnotationUnknownSymbolError"})(sf||(sf={}));var kE=e=>{if(e.annotations==null)return oe(!0);let r=er(e.annotations,n=>n.id,"annotations");if(r.isErr())return r;let t=yr(e),o=new Set(Ze(e.annotationSymbols??{}));for(let n of Ze(e.annotations)){let i=e.annotations[n];if(i!=null)for(let a of i){if(!o.has(a.symbolKey))return ie({kind:sf.AnnotationUnknownSymbolError,properties:{annotationId:a.id,symbolKey:a.symbolKey}});let l=t(n,a.geometryId);if(l.isErr())return l;if(l.value.geometry.type!=="Point")return ie({kind:sf.AnnotationNonPointGeometryError,properties:{annotationId:a.id,floorId:n,geometryId:a.geometryId}})}}return oe(!0)};var AE=qt("a","AnnotationId"),SI=g.Intersect([Cn,g.Object({id:g.Ref(AE,{description:"The unique identifier for the annotation."}),externalId:g.Optional(g.String({description:"The external identifier for the annotation."})),symbolKey:g.String({description:"The symbol identifier for the annotation."})})],{$id:"AnnotationProperties"}),LE=g.Object({url:g.String({format:"uri",description:"The URL for the symbol."}),name:g.String({description:"The name of the symbol."})},{$id:"AnnotationSymbol"}),FG=g.Object({annotations:tr(g.Record(Ve,g.Array(g.Ref(SI)),{additionalProperties:!1})),annotationSymbols:tr(g.Record(g.Index(SI,["symbolKey"]),g.Ref(LE)))},{$id:"AnnotationsSchema"}),DG=/^annotations\/(.*)\.json$/,_E={name:"ext:mvf-annotations",schema:FG,intoBundle:function*(e){if(e.annotations!=null)for(let r of Ze(e.annotations))yield{path:`annotations/${r}.json`,contents:e.annotations[r]};e.annotationSymbols!=null&&(yield{path:"annotation-symbols.json",contents:e.annotationSymbols})},fromBundle:(e,r,t)=>{if(e==="annotation-symbols.json")return{annotationSymbols:t(r)};let o=e.match(DG)?.[1];if(o)return{annotations:{[o]:t(r)}}},references:[AE,SI,LE],integrityCheck:kE};d();d();d();var Js=qt("lcat","LocationCategoryId"),TI=g.Intersect([g.Object({id:g.Ref(Js),parent:g.Optional(g.Ref(Js))}),Xl(["name"]),ri],{$id:"LocationCategory"}),RE=[Js,TI];d();d();var tc;(function(e){e.UnknownCategoryError="UnknownCategoryError",e.UnknownParentCategoryError="UnknownParentCategoryError",e.UnknownParentLocationError="UnknownParentLocationError"})(tc||(tc={}));var BE=e=>{if(e.locationCategories==null&&e.locations==null)return oe(!0);if(e.locationCategories!=null){let n=er(e.locationCategories,i=>i.id,"locationCategories");if(n.isErr())return n}if(e.locations!=null){let n=er(e.locations,i=>i.id,"locations");if(n.isErr())return n}if(e.locationInstances!=null){let n=er(e.locationInstances,i=>i.id,"locationInstances");if(n.isErr())return n}let r=new Set(e.locationCategories?.map(n=>n.id)??[]);for(let n of e.locationCategories??[])if(n.parent!=null&&!r.has(n.parent))return ie({kind:tc.UnknownParentCategoryError,properties:{categoryId:n.id,parentCategoryId:n.parent}});let t=yr(e);for(let n of e.locations??[]){for(let i of n.categories)if(!r.has(i))return ie({kind:tc.UnknownCategoryError,properties:{locationId:n.id,categoryId:i}});for(let i of n.geometryAnchors){let a=t(i.floorId,i.geometryId);if(a.isErr())return a}}let o=new Set(e.locations?.map(n=>n.id)??[]);for(let n of e.locationInstances??[]){if(!o.has(n.parentId))return ie({kind:tc.UnknownParentLocationError,properties:{locationInstanceId:n.id,parentLocationId:n.parentId}});for(let i of n.categories??[])if(!r.has(i))return ie({kind:tc.UnknownCategoryError,properties:{locationId:n.id,categoryId:i}});for(let i of n.geometryAnchors??[]){let a=t(i.floorId,i.geometryId);if(a.isErr())return a}}return oe(!0)};d();var Ks=qt("loc","LocationId"),Gb=qt("loci","LocationInstanceId"),NE=g.Object({name:g.String(),url:g.String({format:"uri"})},{$id:"LocationSocial"}),jE=g.Object({url:g.String({format:"uri"})},{$id:"LocationImage"}),CI=g.Object({label:g.String(),url:g.String({format:"uri"})},{$id:"LocationLink"}),MI=g.String({pattern:"^[0-2][0-9]:[0-6][0-9](:[0-6][0-9])?$",$id:"OpeningHoursTime"}),GE=g.Union([g.Literal("Sunday"),g.Literal("Monday"),g.Literal("Tuesday"),g.Literal("Wednesday"),g.Literal("Thursday"),g.Literal("Friday"),g.Literal("Saturday")],{$id:"OpeningHoursDay"}),kG="PublicHolidays",wI=g.Union([GE,g.Literal(kG)],{$id:"OpeningHoursDayOrPublicHoliday"}),Ub=g.Object({"@type":g.Optional(g.Literal("OpeningHoursSpecification",{description:"The type of opening hours"})),opens:g.Optional(g.Ref(MI,{description:"The time the opening hours start"})),closes:g.Optional(g.Ref(MI,{description:"The time the opening hours end"})),dayOfWeek:g.Optional(g.Union([g.Ref(wI),g.Array(g.Ref(wI))],{description:"The days of the week the opening hours apply to"})),validFrom:g.Optional(g.String({format:"date",description:"The date the opening hours start, in ISO 8601 format"})),validThrough:g.Optional(g.String({format:"date",description:"The date the opening hours end, in ISO 8601 format"}))},{$id:"OpeningHoursSpecification"}),Vb=g.Intersect([g.Object({id:g.Ref(Ks),categories:g.Array(g.Ref(Js)),logo:g.Optional(g.String({format:"uri"})),phone:g.Optional(g.String()),social:g.Array(g.Ref(NE)),images:g.Array(g.Ref(jE)),links:g.Array(g.Ref(CI)),website:g.Optional(g.Ref(CI)),openingHours:g.Optional(g.Array(g.Ref(Ub)))}),Xl(["name"]),nf(),ri],{$id:"Location"}),OI=g.Intersect([g.Object({id:g.Ref(Gb),parentId:g.Ref(Ks)}),g.Partial(g.Omit(Vb,["id","parentId","details"])),Xo],{$id:"LocationInstance",description:"A location instance is a particular instance of an location that has some properties different from the parent."}),$b=[Ks,Gb,NE,jE,CI,MI,GE,wI,Ub,Vb,OI];var AG=g.Object({locations:g.Array(g.Ref(Vb)),locationCategories:g.Array(g.Ref(TI)),locationInstances:g.Optional(g.Array(g.Ref(OI)))},{$id:"LocationsExtensionSchema"}),UE="locations.json",VE="location-categories.json",$E="location-instances.json",HE={name:"ext:locations",schema:AG,intoBundle:function*(e){e.locations!=null&&(yield{path:UE,contents:e.locations}),e.locationCategories!=null&&(yield{path:VE,contents:e.locationCategories}),e.locationInstances!=null&&(yield{path:$E,contents:e.locationInstances})},fromBundle:(e,r,t)=>{if(e===UE)return{locations:t(r)};if(e===VE)return{locationCategories:t(r)};if(e===$E)return{locationInstances:t(r)}},references:[...RE,...$b],integrityCheck:BE};d();d();var oi;(function(e){e.EnterpriseLocationWithUnknownLocationError="EnterpriseLocationWithUnknownLocationError",e.EnterpriseCategoryWithUnknownLocationCategoryError="EnterpriseCategoryWithUnknownLocationCategoryError",e.InstanceWithUnknownLocationInstanceError="InstanceWithUnknownLocationInstanceError",e.InstanceWithUnknownEnterpriseLocationError="InstanceWithUnknownEnterpriseLocationError",e.EnterpriseLocationWithUnknownSibling="EnterpriseLocationWithUnknownSibling",e.EnterpriseLocationInstanceWithUnknownSibling="EnterpriseLocationInstanceWithUnknownSibling",e.EnterpriseVenueWithUnknownTopLocationError="EnterpriseVenueWithUnknownTopLocationError",e.EnterpriseLocationWithInvalidPrimaryCategory="EnterpriseLocationWithInvalidPrimaryCategory"})(oi||(oi={}));var zE=e=>{if(e.cms==null)return oe(!0);let r=e.cms,t=er(e.cms.categories,h=>h.id,"cms.categories");if(t.isErr())return t;let o=new Set(e.locationCategories?.map(h=>h.id)??[]);for(let h of r.categories??[])if(!o.has(h.categoryId))return ie({kind:oi.EnterpriseCategoryWithUnknownLocationCategoryError,properties:{enterpriseCategoryId:h.id,locationCategoryId:h.categoryId}});let n=er(e.cms.locations,h=>h.id,"cms.locations");if(n.isErr())return n;let i=new Map(e.locations?.map(h=>[h.id,h])??[]);for(let h of r.locations??[]){if(!i.has(h.locationId))return ie({kind:oi.EnterpriseLocationWithUnknownLocationError,properties:{enterpriseLocationId:h.id,locationId:h.locationId}});for(let b of h.siblingGroups??[])for(let x of b.siblings??[])if(!i.has(x))return ie({kind:oi.EnterpriseLocationWithUnknownSibling,properties:{enterpriseLocationId:h.id,siblingLocationId:x,label:b.label}});if(h.primaryCategory!=null){let b=i.get(h.locationId);if(b!=null&&!b.categories.includes(h.primaryCategory))return ie({kind:oi.EnterpriseLocationWithInvalidPrimaryCategory,properties:{enterpriseLocationId:h.id,locationId:h.locationId,primaryCategory:h.primaryCategory}})}}if(r.venue?.topLocations!=null){for(let h of r.venue.topLocations)if(!i.has(h))return ie({kind:oi.EnterpriseVenueWithUnknownTopLocationError,properties:{locationId:h}})}let a=new Set(e.cms.locations?.map(h=>h.id)??[]),l=er(e.cms.locationInstances,h=>h.id,"cms.locationInstances");if(l.isErr())return l;let c=new Set(e.locationInstances?.map(h=>h.id)??[]);for(let h of r.locationInstances??[]){if(!a.has(h.parentId))return ie({kind:oi.InstanceWithUnknownEnterpriseLocationError,properties:{enterpriseLocationInstanceId:h.id,enterpriseLocationId:h.parentId}});if(!c.has(h.locationInstanceId))return ie({kind:oi.InstanceWithUnknownLocationInstanceError,properties:{enterpriseLocationInstanceId:h.id,locationInstanceId:h.locationInstanceId}});for(let b of h.siblingGroups??[])for(let x of b.siblings??[])if(!i.has(x))return ie({kind:oi.EnterpriseLocationInstanceWithUnknownSibling,properties:{enterpriseLocationInstanceId:h.id,siblingLocationId:x,label:b.label}})}let p=ti(e),u=yr(e),f=er(e.cms.floorText,h=>h.properties.id,"cms.floorText");if(f.isErr())return f;for(let[h,b]of tt(r.floorText??{})){let x=p(h);if(x.isErr())return x;for(let T of b.features){if(!("geometryId"in T.properties))continue;let v=u(h,T.properties.geometryId);if(v.isErr())return v}}for(let[h,b]of tt(r.textures??{})){let x=p(h);if(x.isErr())return x;for(let T of b){let v=u(h,T.geometryId);if(v.isErr())return v}}for(let[h,b]of tt(r.layers??{})){let x=p(h);if(x.isErr())return x;for(let T of Ze(b??{})){let v=u(h,T);if(v.isErr())return v}}for(let[h,b]of tt(r.textAreas??{})){let x=p(h);if(x.isErr())return x;for(let T of b.features)if("geometryId"in T.properties){let v=u(h,T.properties.geometryId);if(v.isErr())return v}}return oe(!0)};d();d();var af=qt("el","EnterpriseLocationId"),EI=qt("ec","EnterpriseCategoryId"),PI=qt("eli","EnterpriseLocationInstanceId"),FI=qt("ev","EnterpriseVenueId"),DI=qt("eft","EnterpriseFloorTextId"),WE=[af,EI,PI,FI,DI];var ZE=g.Object({id:g.Ref(EI),categoryId:g.Ref(Js),color:g.Optional(g.String()),sortOrder:g.Number(),iconFromDefaultList:g.Optional(g.Union([g.String(),g.Null()])),picture:g.Optional(g.String({format:"uri",description:"The category's picture"}))},{$id:"EnterpriseCategory"}),kI=g.Object({categories:g.Optional(g.Array(g.Ref(ZE)))},{$id:"EnterpriseCategoriesSchema"}),XE=[ZE,kI];d();var YE=Ro(["left","center","right"]),LG=YE.schema,rye=YE.values,AI=g.Object({id:g.Ref(DI),text:g.String(),visible:g.Boolean({default:!0}),fontSize:g.Number({default:12,exclusiveMinimum:0}),fontFamily:g.String({default:"Droid Sans"}),color:g.String({default:"black"}),rotation:g.Number({minimum:0,maximum:360}),align:LG},{$id:"FloorTextCommonProperties"}),LI=g.Intersect([g.Ref(AI),Cn],{$id:"AnchoredFloorTextProperties"}),_I=g.Intersect([g.Ref(AI),g.Object({verticalOffset:g.Number()})],{$id:"FloatingFloorTextProperties"}),JE=g.Union([g.Ref(LI),g.Ref(_I)],{$id:"FloorTextProperties"}),KE=Ur(to,g.Ref(JE),{$id:"FloorTextFeature"}),_G=Ur(to,g.Ref(LI),{$id:"AnchoredFloorTextFeature"}),RG=Ur(to,g.Ref(_I),{$id:"FloatingFloorTextFeature"}),QE=fo(g.Ref(KE),{$id:"EnterpriseFloorTextFeatureCollection"}),qE=g.Record(Ve,g.Ref(QE),{$id:"EnterpriseFloorTextCollectionsByFloor",additionalProperties:!1}),RI=g.Object({floorText:g.Optional(g.Ref(qE))},{$id:"EnterpriseFloorTextSchema"}),eP=[AI,LI,_I,JE,KE,_G,RG,QE,qE,RI];d();var tP=tr(g.Record(ro,g.String({minLength:1}),{additionalProperties:!1,$id:"EnterpriseLayers"})),rP=tr(g.Record(Ve,g.Ref(tP),{additionalProperties:!1,$id:"EnterpriseLayersByFloor"})),BI=g.Object({layers:g.Optional(g.Ref(rP))},{$id:"EnterpriseLayersSchema"}),oP=[tP,rP,BI];d();d();d();var NI=Ro(["closed-temporarily","new","pop-up","coming-soon","relocated"]),BG=NI.schema,mye=NI.values,fye=NI.record,jI=g.Object({type:BG,start:g.Optional(g.String({format:"date",description:"The start date of the state"})),end:g.Optional(g.String({format:"date",description:"The end date of the state"}))},{$id:"LocationState",description:"The state of a location. Start and end dates are optional."}),GI=g.Object({label:g.String(),siblings:g.Array(g.Ref(Ks))},{$id:"SiblingGroup"}),Hb=g.Object({name:g.String(),code:g.String()},{$id:"Language"}),nP=[jI,GI,Hb];var zb=g.Object({id:g.Ref(af),locationId:g.Ref(Ks),cmsId:g.String(),type:g.String(),sortOrder:g.Number(),tags:g.Optional(g.Array(g.String())),picture:g.Optional(g.String({format:"uri",description:"The picture of the location"})),states:g.Optional(g.Array(g.Ref(jI),{description:"The location's state. No more than one state should be active at a time, and all but at most one should have dates set"})),siblingGroups:g.Optional(g.Array(g.Ref(GI))),gallery:g.Optional(g.Array(g.Object({caption:g.Optional(g.String()),image:g.String({format:"uri"}),embeddedUrl:g.Optional(g.String({format:"uri",description:"The URL to link from the image"}))},{description:"The location's image gallery"}),{description:"The location's image gallery"})),showFloatingLabelWhenImagePresent:g.Optional(g.Boolean({description:"Whether to show the flat label when an image is present"})),amenity:g.Optional(g.String({description:"The location's amenity type. Only set if the location is an amenity"})),showLogo:g.Optional(g.Boolean({description:"Whether to show the logo of the location"})),primaryCategory:g.Optional(g.Ref(Js))},{$id:"EnterpriseLocation"}),UI=g.Object({locations:g.Optional(g.Array(g.Ref(zb)))},{$id:"EnterpriseLocationsSchema"}),iP=[zb,UI];var sP=g.Intersect([g.Object({id:g.Ref(PI),parentId:g.Ref(af),locationInstanceId:g.Ref(Gb)}),g.Partial(g.Omit(zb,["id","parentId","locationId"]))],{$id:"EnterpriseLocationInstance",description:"A locationInstance is a particular instance of an Enterprise Location that has some properties different from the parent."}),VI=g.Object({locationInstances:g.Optional(g.Array(g.Ref(sP)))},{$id:"EnterpriseLocationInstancesSchema"}),aP=[sP,VI];d();var $I=Ro(["near","center"],{$id:"EnterpriseTextAreaAlignment"}),lP=$I.schema,Aye=$I.values,Lye=$I.record,HI=g.Object({maxWidth:g.Number({exclusiveMinimum:0,description:"The maximum width of the label, in meters."}),maxHeight:g.Number({exclusiveMinimum:0,description:"The maximum height of the label, in meters."}),align:g.Ref(lP),rotation:g.Number({minimum:0,maximum:360,description:"Rotation in degrees, about the center of the image. North is 0, east is 90."})},{$id:"EnterpriseBaseTextAreaProperties"}),cP=g.Intersect([g.Ref(HI),Cn],{$id:"EnterpriseAnchoredTextAreaProperties"}),pP=g.Intersect([g.Ref(HI),g.Object({verticalOffset:g.Number({minimum:0,description:"How high to position the image, in meters, relative to the ground plane."})})],{$id:"EnterpriseFloatingTextAreaProperties"}),dP=g.Union([cP,pP],{$id:"EnterpriseTextAreaProperties"}),uP=Ur(g.Ref(to),dP,{$id:"EnterpriseTextAreaFeature"}),mP=fo(g.Ref(uP),{$id:"EnterpriseTextAreaCollection"}),fP=g.Record(Ve,g.Ref(mP),{$id:"EnterpriseTextAreasByFloor",additionalProperties:!1}),hP=g.Object({textAreas:g.Optional(g.Ref(fP))},{$id:"EnterpriseTextAreasSchema"}),gP=[lP,HI,cP,pP,dP,uP,mP,fP];d();var zI=g.Object({u:g.Number(),v:g.Number()},{$id:"EnterpriseTextureUV"}),WI=Ro(["top","side"],{$id:"EnterpriseTextureFace"}),yP=WI.schema,jye=WI.values,Gye=WI.record,ZI=Ro(["inside","outside","both"],{$id:"EnterpriseTextureSurface"}),bP=ZI.schema,Uye=ZI.values,Vye=ZI.record,xP=g.Tuple([Wp,Zp,Wp,Zp],{$id:"EnterpriseTextureBounds"}),vP=g.Intersect([g.Object({repeat:g.Ref(zI),offset:g.Ref(zI),rotation:g.Number({minimum:0,maximum:360}),path:g.String({format:"uri"}),face:g.Ref(yP),surface:g.Ref(bP),bounds:g.Ref(xP)},{$id:"EnterpriseTextureProperties"}),Cn],{$id:"EnterpriseTexture"}),IP=g.Array(g.Ref(vP),{$id:"EnterpriseTextures"}),SP=g.Record(Ve,g.Ref(IP),{$id:"EnterpriseTexturesByFloor",additionalProperties:!1}),XI=g.Object({textures:g.Optional(g.Ref(SP))},{$id:"EnterpriseTexturesSchema"}),TP=[vP,IP,XI,zI,yP,bP,xP,SP];d();var CP=g.Intersect([g.Object({id:g.Ref(FI),slug:g.String(),defaultLanguage:g.Ref(Hb),languages:g.Array(g.Ref(Hb)),countrycode:g.Optional(g.String()),logo:g.Optional(g.String({format:"uri"})),mappedinWebUrl:g.Optional(g.String({format:"uri"})),topLocations:g.Optional(g.Array(g.Ref(Ks))),operationHours:g.Optional(g.Array(g.Ref(Ub))),coverImage:g.Optional(g.String({format:"uri"}))}),Xl(["name"]),ri],{$id:"EnterpriseVenue"}),YI=g.Object({venue:g.Optional(g.Ref(CP))},{$id:"EnterpriseVenueSchema"}),MP=[CP,YI];var OP=g.Intersect([YI,UI,VI,kI,XI,RI,BI,hP],{$id:"CMSProperties"}),wP=g.Object({cms:g.Optional(g.Ref(OP))},{$id:"CMSExtensionSchema"}),NG=/^cms\/(?:([^/]+)\/)?([^/]+)\.(?:json|geojson)$/,EP={name:"ext:cms",schema:wP,intoBundle:function*(e){if(e.cms==null)return;let r=e.cms;for(let t of Ze(r))switch(t){case"floorText":for(let o of Ze(r.floorText??{}))yield{path:`cms/floorText/${o}.geojson`,contents:(r.floorText??{})[o]};continue;case"textures":for(let o of Ze(r.textures??{}))yield{path:`cms/textures/${o}.json`,contents:(r.textures??{})[o]};continue;case"textAreas":for(let o of Ze(r.textAreas??{}))yield{path:`cms/textAreas/${o}.geojson`,contents:(r.textAreas??{})[o]};continue;default:yield{path:`cms/${t}.json`,contents:r[t]};continue}},fromBundle:(e,r,t)=>{let o=e.match(NG);if(!o)return;let[,n,i]=o,a=t(r);switch(n){case"floorText":case"textures":case"textAreas":return{cms:{[n]:{[i]:a}}};default:return{cms:{[i]:a}}}},references:[OP,wP,...MP,...iP,...aP,...XE,...TP,...oP,...eP,...gP,...WE,...nP,...$b],integrityCheck:zE};d();d();d();d();var ni;(function(e){e.NavigationFlagMissingDeclaration="NavigationFlagMissingDeclaration",e.NavigationFlagDuplicateBit="NavigationFlagDuplicateBit",e.NavigationFlagIncorrectFlagsLength="NavigationFlagIncorrectFlagsLength",e.NavigationFlagValueTooBig="NavigationFlagValueTooBig"})(ni||(ni={}));var PP=e=>{let{navigationFlags:r}=e;if(!r||Object.keys(r).length===0)return oe(!0);let t=Object.entries(r).map(([i,a])=>({key:i,...a})).sort((i,a)=>i.index!==a.index?i.index-a.index:i.bit-a.bit),o=0,n=-1;for(let i of t){if(i.bit===n)return ie({kind:ni.NavigationFlagDuplicateBit,properties:{index:i.index,bit:i.bit,path:`navigationFlags.${i.key}`}});if(i.index!=o){if(n!=31)return ie({kind:ni.NavigationFlagMissingDeclaration,properties:{index:o,bit:n+1,path:"navigationFlags"}});if(i.index!=o+1||i.bit!=0)return ie({kind:ni.NavigationFlagMissingDeclaration,properties:{index:o+1,bit:0,path:"navigationFlags"}});o=i.index,n=0}else{if(i.bit!==n+1)return ie({kind:ni.NavigationFlagMissingDeclaration,properties:{index:i.index,bit:n+1,path:"navigationFlags"}});n=i.bit}}return oe(!0)};d();function qa(e,r){return r&&(e.flags[r.index]&1<<r.bit)!==0}d();var FP=2**32-1,lf=e=>{let r=Object.keys(e.navigationFlags??{}).length;if(r===0)return{index:-1,flag:0};let t=Math.floor(r/32),o=r%32;return{index:t,flag:2**o-1}},bd=(e,r,t)=>{if(r.index==-1&&e.length===0)return oe(!0);let o=r.flag>0||r.index===-1?r.index+1:r.index;if(e.length!==o)return ie({kind:ni.NavigationFlagIncorrectFlagsLength,properties:{expected:o,actual:e.length,path:t}});for(let n=0;n<e.length;n++){let i=e[n];if(n<r.index){if(i>FP)return ie({kind:ni.NavigationFlagValueTooBig,properties:{index:n,flagValue:i,expectedMaxFlagValue:FP,path:t}});continue}else if(i>r.flag)return ie({kind:ni.NavigationFlagValueTooBig,properties:{index:n,flagValue:i,expectedMaxFlagValue:r.flag,path:t}})}return oe(!0)};var jG=g.Object({index:g.Integer({description:"The index of the flag in a flags array.",minimum:0}),bit:g.Integer({description:"The bit position of the flag in a flag's bitfield.",minimum:0,maximum:31})},{$id:"NavigationFlagDeclarationCore"}),DP=g.Intersect([jG,Xo],{$id:"NavigationFlagDeclaration",description:'A NavigationFlagDeclaration describes the relationship between a "key" that a developer might use to wayfind using that flag, and the index and bit position in an object\'s `flags` array.'}),JI={accessible:"accessible",outdoors:"outdoors",public:"public"},kP=g.Record(g.String(),DP,{$id:"NavigationFlagDeclarations",description:"Any well known and custom flags present in the MVF"}),GG=g.Object({navigationFlags:g.Ref(kP)},{$id:"NavigationFlagsSchema"}),Wb=g.Array(g.Integer({minimum:0,maximum:Math.pow(2,32)-1}),{$id:"Flags"}),KI=g.Object({flags:g.Ref(Wb)},{$id:"WithFlags"}),rc=g.Intersect([yd,KI],{$id:"FlaggedGeometryAnchor"}),UG=g.Object({geometryAnchor:rc},{$id:"WithFlaggedGeometryAnchor"}),VG=g.Object({geometryAnchors:g.Array(rc)},{$id:"WithFlaggedGeometryAnchors"}),AP={name:"ext:mvf-navigation-flags",schema:GG,intoBundle:function*(e){e.navigationFlags!=null&&(yield{path:"navigationFlags.json",contents:e.navigationFlags})},fromBundle:(e,r,t)=>e!=="navigationFlags.json"?void 0:{navigationFlags:t(r)},references:[DP,kP,Wb,rc,UG,VG],integrityCheck:PP};d();var LP=e=>{if(e.connections==null)return oe(!0);let r=er(e.connections,n=>n.id,"connections");if(r.isErr())return r;let t=yr(e),o=lf(e);for(let[n,i]of e.connections.entries()){for(let[a,l]of i.entrances.entries()){let c=t(l.floorId,l.geometryId);if(c.isErr())return c;let p=bd(l.flags,o,`connections[${n}].entrances[${a}]`);if(p.isErr())return p}for(let[a,l]of i.exits.entries()){let c=t(l.floorId,l.geometryId);if(c.isErr())return c;let p=bd(l.flags,o,`connections[${n}].exits[${a}]`);if(p.isErr())return p}}return oe(!0)};var RP=qt("c","ConnectionId"),{schema:$G,values:zbe,record:HG}=Ro(["elevator","escalator","travelator","stairs","door","ramp","ladder"],{$id:"ConnectionType"}),BP=$G;var QI=HG,NP=g.Intersect([g.Object({id:g.Ref(RP,{description:"The unique identifier for the connection."}),entrances:g.Array(g.Ref(rc)),exits:g.Array(g.Ref(rc)),entryCost:g.Number({description:"The cost to enter the connection.",minimum:0}),floorCostMultiplier:g.Number({description:"The cost multiplier for each floor transitioned.",minimum:1}),type:g.Ref(BP,{description:"The type of connection."})}),Xo,ri],{$id:"ConnectionsProperties"}),jP=g.Array(g.Ref(NP),{$id:"ConnectionsCollection"}),zG=g.Object({connections:g.Ref(jP)},{$id:"ConnectionsExtensionSchema"}),_P="connections.json",GP={name:"ext:connections",schema:zG,intoBundle:function*(e){e.connections!=null&&(yield{path:_P,contents:e.connections})},fromBundle:(e,r,t)=>{if(e===_P)return{connections:t(r)}},references:[NP,jP,BP,RP,rc,Wb],integrityCheck:LP};d();d();var UP=e=>{if(e.defaultStyle==null)return oe(!0);let r=yr(e);for(let t of Object.values(e.defaultStyle))if(t!=null)for(let o of t.geometryAnchors){let n=r(o.floorId,o.geometryId);if(n.isErr())return n}return oe(!0)};var VP=g.Intersect([nf(),ri,g.Object({altitude:g.Number({description:"How far off the bottom of the floor the objects with this style should be drawn, in meters."}),color:g.String({pattern:"^#[0-9a-fA-F]{6}$",description:"Color should be represented with a hash (#), followed by 6 hexadecimal digits. ex: #RRGGBB"}),height:g.Number({minimum:0,description:"The height of the objects belonging to this layer, in meters."}),opacity:g.Number({minimum:0,maximum:1,description:"The opacity of the objects belonging to this layer, from 0 to 1."}),buffer:g.Number({description:"The buffer amount to apply to the geometry, in meters. This can be used to inflate line string geometry for walls, but might also be applicable as a way to grow or shrink polygon geometry for aesthetic purposes. Can be negative."}),hidden:g.Optional(g.Boolean({description:"Whether or not the objects with this style should be hidden."}))})],{$id:"DefaultStyle"}),$P=g.Record(g.String(),g.Ref(VP),{$id:"DefaultStyleCollection",additionalProperties:!1}),WG=g.Object({defaultStyle:g.Ref($P)},{$id:"DefaultStyleSchema"}),HP={name:"ext:mvf-default-style",schema:WG,intoBundle:function*(e){e.defaultStyle!=null&&(yield{path:"default-style.json",contents:e.defaultStyle})},fromBundle:(e,r,t)=>{if(e==="default-style.json")return{defaultStyle:t(r)}},references:[VP,$P],integrityCheck:UP};d();d();d();d();var Zb;(function(e){e.InvalidDefaultFloorError="InvalidDefaultFloorError"})(Zb||(Zb={}));var zP=e=>{if(e.floorStacks==null)return oe(!0);let r=er(e.floorStacks,o=>o.id,"floorStacks");if(r.isErr())return r;let t=ti(e);for(let o of e.floorStacks){for(let n of o.floors){let i=t(n);if(i.isErr())return i}if(o.defaultFloor!=null&&!o.floors.includes(o.defaultFloor))return ie({kind:Zb.InvalidDefaultFloorError,properties:{floorStackId:o.id,floorId:o.defaultFloor}})}return oe(!0)};var cf=qt("fs","FloorStackId"),ZP=g.Intersect([g.Object({id:g.Ref(cf,{description:"The unique identifier for the floor stack."}),floors:g.Array(g.Ref(Ve),{uniqueItems:!0,minItems:1,description:"The floors that are part of this floor stack."}),defaultFloor:g.Optional(g.Ref(Ve,{description:"The default floor for the floor stack."}))}),Xo],{$id:"FloorStacksProperties"}),XP=g.Array(g.Ref(ZP),{$id:"FloorStackCollection"}),ZG=g.Object({floorStacks:g.Ref(XP)},{$id:"FloorStackExtensionSchema"}),WP="floor-stacks.json",YP={name:"ext:floor-stacks",schema:ZG,intoBundle:function*(e){e.floorStacks!=null&&(yield{path:WP,contents:e.floorStacks})},fromBundle:(e,r,t)=>{if(e===WP)return{floorStacks:t(r)}},references:[cf,ZP,XP],integrityCheck:zP};d();d();var pf;(function(e){e.MissingFloorStackError="MissingFloorStackError",e.UnknownFloorStackError="UnknownFloorStackError"})(pf||(pf={}));var JP=e=>{if(e.facade==null)return oe(!0);if(e.floorStacks==null)return ie({kind:pf.MissingFloorStackError,properties:null});let r=new Set(e.floorStacks.map(n=>n.id)),t=yr(e),o=ti(e);for(let[n,i]of tt(e.facade)){if(i==null)continue;let a=o(n);if(a.isErr())return a;for(let l of i){let{floorStackId:c,geometryIds:p}=l;if(!r.has(c))return ie({kind:pf.UnknownFloorStackError,properties:{floorStackId:c}});for(let u of p){let f=t(n,u);if(f.isErr())return f}}}return oe(!0)};var KP=g.Intersect([g.Object({floorStackId:g.Ref(cf)}),ud],{$id:"Facade"}),XG=g.Object({facade:tr(g.Record(Ve,g.Array(g.Ref(KP)),{additionalProperties:!1}))},{$id:"FacadeExtensionSchema"}),YG=/^facade\/(.*)\.json$/,QP={name:"ext:facade",schema:XG,intoBundle:function*(e){if(e.facade!=null)for(let r of Ze(e.facade))yield{path:`facade/${r}.json`,contents:e.facade[r]}},fromBundle:(e,r,t)=>{let o=e.match(YG)?.[1];if(o)return{facade:{[o]:t(r)}}},references:[cf,KP],integrityCheck:JP};d();d();var qP=e=>{if(e.floorImages==null)return oe(!0);let r=yr(e);for(let[t,o]of tt(e.floorImages))if(o!=null)for(let n of o.features){if(!("geometryId"in n.properties))continue;let i=n.properties.geometryId,a=r(t,i);if(a.isErr())return a}return oe(!0)};var qI=g.Object({path:g.String({format:"uri",description:"The path to the image. This will be a remote URL."}),width:g.Number({minimum:0,description:"The width of the image when represented on the map, in meters."}),height:g.Number({minimum:0,description:"The height of the image when represented on the map, in meters."}),rotation:g.Number({minimum:0,maximum:360,description:"Rotation in degrees, about the center of the image. North is 0, east is 90."})},{$id:"BaseFloorImageProperties"}),eF=g.Intersect([g.Ref(qI),Cn],{$id:"AnchoredFloorImageProperties"}),tF=g.Intersect([g.Ref(qI),g.Object({verticalOffset:g.Number({minimum:0,description:"How high to position the image, in meters, relative to the ground plane."})})],{$id:"FloatingFloorImageProperties"}),rF=g.Union([eF,tF],{$id:"FloorImageProperties"}),oF=Ur(g.Ref(to),rF,{$id:"FloorImageFeature"}),nF=fo(g.Ref(oF),{$id:"FloorImageCollection"}),JG=g.Object({floorImages:tr(g.Record(Ve,g.Ref(nF),{additionalProperties:!1}))},{$id:"FloorImagesExtensionSchema"}),KG=/^floorImages\/(.*)\.geojson$/,iF={name:"ext:floor-images",schema:JG,intoBundle:function*(e){if(e.floorImages!=null)for(let r of Ze(e.floorImages))yield{path:`floorImages/${r}.geojson`,contents:e.floorImages[r]}},fromBundle:(e,r,t)=>{let o=e.match(KG)?.[1];if(o)return{floorImages:{[o]:t(r)}}},references:[qI,eF,tF,rF,oF,nF],integrityCheck:qP};d();d();var sF=e=>{if(e.kinds==null)return oe(!0);let r=yr(e);for(let[t,o]of tt(e.kinds))if(o!=null)for(let n of Ze(o)){let i=r(t,n);if(i.isErr())return i}return oe(!0)};var{values:oxe,schema:QG,record:nxe}=Ro(["room","hallway","wall","object","poi","area","window"],{$id:"Kind"}),aF=QG;var lF=tr(g.Record(ro,g.Ref(aF),{additionalProperties:!1,$id:"GeometryKinds"})),qG=g.Object({kinds:tr(g.Record(Ve,g.Ref(lF),{additionalProperties:!1}))},{$id:"KindsExtensionSchema"}),eU=/^kinds\/(.*)\.json$/,cF={name:"ext:kinds",schema:qG,intoBundle:function*(e){if(e.kinds!=null)for(let r of Ze(e.kinds))yield{path:`kinds/${r}.json`,contents:e.kinds[r]}},fromBundle:(e,r,t)=>{let o=e.match(eU)?.[1];if(o)return{kinds:{[o]:t(r)}}},references:[aF,lF],integrityCheck:sF};d();d();d();var Xb;(function(e){e.UnknownNeighbor="UnknownNeighbor"})(Xb||(Xb={}));var pF=e=>{if(e.nodes==null)return oe(!0);let r=er(e.nodes,n=>n.properties.id,"nodes");if(r.isErr())return r;let t=yr(e),o=lf(e);for(let[n,i]of tt(e.nodes)){if(i==null)continue;let a=new Set(i.features.map(l=>l.properties.id));for(let[l,c]of i.features.entries()){for(let p of c.properties.geometryIds){let u=t(n,p);if(u.isErr())return u}for(let[p,u]of c.properties.neighbors.entries()){if(!a.has(u.id))return ie({kind:Xb.UnknownNeighbor,properties:{floorId:n,nodeId:c.properties.id,neighborId:u.id}});let f=bd(u.flags,o,`nodes["${n}"].features[${l}].properties.neighbors[${p}]`);if(f.isErr())return f}}}return oe(!0)};var eS=qt("n","NodeId"),dF=g.Intersect([g.Object({id:g.Ref(eS,{description:"The unique identifier for the node."}),extraCost:g.Number({minimum:0,description:"The extra cost to traverse to the node, above the straight-line distance."})}),KI],{$id:"NodeNeighbor"}),uF=g.Intersect([g.Object({id:g.Ref(eS,{description:"The unique identifier for the node."}),neighbors:g.Array(g.Ref(dF),{description:"The neighbors of the node."})}),ud],{$id:"NodeProperties"}),mF=Ur(g.Ref(to),uF,{$id:"NodeFeature"}),fF=fo(g.Ref(mF),{$id:"NodeCollection"}),tU=g.Object({nodes:tr(g.Record(Ve,g.Ref(fF),{additionalProperties:!1}))},{$id:"NodesExtensionSchema"}),rU=/^nodes\/(.*)\.(geo)?json$/,hF={name:"ext:nodes",schema:tU,intoBundle:function*(e){if(e.nodes!=null)for(let r of Ze(e.nodes))yield{path:`nodes/${r}.geojson`,contents:e.nodes[r]}},fromBundle:(e,r,t)=>{let o=e.match(rU)?.[1];if(o)return{nodes:{[o]:t(r)}}},references:[eS,dF,uF,mF,fF],integrityCheck:pF};d();d();d();var Yb;(function(e){e.FloorInFloorStackError="FloorInFloorStackError"})(Yb||(Yb={}));var gF=e=>{if(e.outdoors==null)return oe(!0);let r=ti(e);for(let t of e.outdoors.floors){let o=r(t);if(o.isErr())return o;if(e.floorStacks!=null){for(let n of e.floorStacks)if(n.floors.includes(t))return ie({kind:Yb.FloorInFloorStackError,properties:{floorId:t,floorStackId:n.id}})}}return oe(!0)};var bF=g.Object({floors:g.Array(g.Ref(Ve),{uniqueItems:!0,description:"A list of floor IDs that should be considered to contain outdoor features."})},{$id:"Outdoors"}),oU=g.Object({outdoors:g.Ref(bF)},{$id:"OutdoorsExtensionSchema"}),yF="outdoors.json",xF={name:"ext:outdoors",schema:oU,intoBundle:function*(e){e.outdoors!=null&&(yield{path:yF,contents:e.outdoors})},fromBundle:(e,r,t)=>{if(e===yF)return{outdoors:t(r)}},references:[bF],integrityCheck:gF};d();d();d();var Jb;(function(e){e.TilesetDuplicateKeyError="TilesetDuplicateKeyError"})(Jb||(Jb={}));var vF=e=>{if(e.tileset==null)return oe(!0);let r=new Set;if(r.add(e.tileset.default.key),e.tileset.others)for(let t of e.tileset.others){if(r.has(t.key))return ie({kind:Jb.TilesetDuplicateKeyError,properties:{key:t.key}});r.add(t.key)}return oe(!0)};var tS=g.Object({key:g.String({minLength:1,description:"Unique identifier for the tileset style."}),name:g.String({minLength:1,description:"Display name of the tileset style."}),url:g.String({format:"uri",description:"URL of the tileset style."})},{$id:"TilesetStyle",description:"A tileset style definition."}),IF=g.Object({default:g.Ref(tS,{description:"The default tileset style, which should be used."}),others:g.Optional(g.Array(g.Ref(tS,{description:"Additional tileset styles that can be used."})))},{$id:"TilesetCollection"}),nU=g.Object({tileset:g.Ref(IF)},{$id:"TilesetExtensionSchema"}),SF={name:"ext:mvf-tileset",schema:nU,intoBundle:function*(e){e.tileset!=null&&(yield{path:"tileset.json",contents:e.tileset})},fromBundle:(e,r,t)=>{if(e==="tileset.json")return{tileset:t(r)}},references:[tS,IF],integrityCheck:vF};d();var TF=g.Object({},{$id:"WalkableProperties"}),CF=g.Object({},{$id:"NonWalkableProperties"}),MF=tr(g.Record(ro,g.Ref(TF),{$id:"WalkableGeometries",additionalProperties:!1})),wF=tr(g.Record(ro,g.Ref(CF),{$id:"NonWalkableGeometries",additionalProperties:!1})),iU=g.Object({walkable:tr(g.Record(Ve,g.Ref(MF),{additionalProperties:!1})),nonwalkable:tr(g.Record(Ve,g.Ref(wF),{additionalProperties:!1}))},{$id:"TraversabilitySchema"}),sU=/^walkable\/(.*)\.json$/,aU=/^nonwalkable\/(.*)\.json$/,OF={name:"ext:mvf-traversability",schema:iU,intoBundle:function*(e){if(e.walkable!=null)for(let r of Ze(e.walkable))yield{path:`walkable/${r}.json`,contents:e.walkable[r]};if(e.nonwalkable!=null)for(let r of Ze(e.nonwalkable))yield{path:`nonwalkable/${r}.json`,contents:e.nonwalkable[r]}},fromBundle:(e,r,t)=>{let o=e.match(sU)?.[1];if(o!=null)return{walkable:{[o]:t(r)}};let n=e.match(aU)?.[1];if(n!=null)return{nonwalkable:{[n]:t(r)}}},references:[TF,CF,MF,wF]};d();d();function EF(e){return e.replace(/^g_/,"s_")}function lU(e){return e.replace(/^g_/,"o_")}function cU(e){return e.replace(/^g_/,"w_")}function PF(e){return e.replace(/^loci_/,"eli_")}function uf(e){return e.replace(/^loc_/,"el_")}function Kb(e){return e.replace(/^lcat_/,"ec_")}function pU(e){return e.replace(/^g_/,"ar_")}function dU(e,r,t){switch(e.geometry.type){case"MultiPoint":case"MultiLineString":case"MultiPolygon":{let o=[],n=0,i=e.geometry.type.replace("Multi","");for(let a of e.geometry.coordinates)o.push({...e,geometry:{type:i,coordinates:a},properties:{...e.properties,id:`${r}-${n++}`,kind:t}});return o}default:return[{...e,properties:{...e.properties,id:r,kind:t}}]}}function df(e,r,t,o){let n=new Map;for(let{feature:i,floorId:a}of e){let l=i.properties.id,c=o.get(l);if(r.has(l)){let p=dU(i,t(l),c),u=p.map(h=>h.properties.id),f=u.map(h=>({geometryId:h,floorId:a}));n.set(l,{ids:u,features:p,anchors:f})}}return n}function FF(e){let r={space:new Map,obstruction:new Map,area:new Map,window:new Map};if(!e.geometry)return r;let t=uU(e),o=tt(e.geometry).flatMap(([c,p])=>(p?.features??[]).map(u=>({feature:u,floorId:c}))).flat(),n=new Set(Object.values(e.walkable??{}).filter(c=>c!==void 0).flatMap(Ze)),i=new Set(Object.values(e.nonwalkable??{}).filter(c=>c!==void 0).flatMap(Ze)),a=new Set(Array.from(t.entries()).filter(([c,p])=>p==="area").map(([c])=>c)),l=new Set(Array.from(t.entries()).filter(([c,p])=>p==="window").map(([c])=>c));return n.size>0&&(r.space=df(o,n,EF,t)),i.size>0&&(r.obstruction=df(o,i,lU,t)),a.size>0&&(r.area=df(o,a,pU,t)),l.size>0&&(r.window=df(o,l,cU,t)),n.size===0&&i.size===0&&a.size===0&&(r.space=df(o,new Set(o.map(c=>c.feature.properties.id)),EF,t)),r}function uU(e){let r=new Map(Object.values(e.kinds??{}).filter(t=>t!==void 0).flatMap(tt));for(let t of e.connections?.filter(o=>o.type!=="door")??[]){for(let o of t.entrances)r.set(o.geometryId,`connection.${t.type}`);for(let o of t.exits)r.set(o.geometryId,`connection.${t.type}`)}return r}function DF(e){let{nodesByGeometryId:r,incomingEdgesByNodeId:t}=mU(e),o=FF(e),n=fU(e),i=e.navigationFlags??{};return{geometryMaps:o,nodesByGeometryId:r,geometryFeatureById:n,navigationFlags:i,incomingEdgesByNodeId:t}}function mU(e){let r=new Map,t=new Map;for(let o of Object.values(e.nodes??{}))for(let n of o?.features??[]){if(n.properties.geometryIds.length>0)for(let i of n.properties.geometryIds){let a=r.get(i)??[];a.push(n.properties.id),r.set(i,a)}if(n.properties.neighbors.length>0)for(let i of n.properties.neighbors){let a=t.get(i.id);a!=null?a.push(i):t.set(i.id,[i])}}return{nodesByGeometryId:r,incomingEdgesByNodeId:t}}function fU(e){let r=new Map;for(let t of Object.values(e.geometry??{}))for(let o of t?.features??[])r.set(o.properties.id,o);return r}d();function kF(e,r){if(!e.annotations||!e.annotationSymbols||!e.geometry)return{};let t={};for(let[o,n]of tt(e.annotations)){if(!n||n.length===0||!e.geometry[o]||e.geometry[o].features.length===0)continue;let i=new Map(e.geometry[o].features.map(l=>[l.properties.id,l])),a={type:"FeatureCollection",features:[]};for(let l of n){let c=i.get(l.geometryId);if(!c||c.geometry.type!=="Point")continue;let p={id:l.id,externalId:l.externalId,symbolId:l.symbolKey};a.features.push({type:"Feature",geometry:c.geometry,properties:p})}t[o]=a}return{annotation:t}}d();function AF(e,{nodesByGeometryId:r}){let t={"connection.json":[],entrance:{}},o=e.navigationFlags?.[JI.accessible],n=e.navigationFlags?.[JI.outdoors],i=new Map(Object.values(e.geometry??{}).flatMap(a=>a?.features??[]).map(a=>[a.properties.id,a]));for(let a of e.connections??[]){if(rS(a,i)){let u=hU(a,i,r,n);for(let[f,h]of u)t.entrance[f]||(t.entrance[f]={type:"FeatureCollection",features:[]}),t.entrance[f].features.push(h);continue}let l=o!=null&&a.entrances.some(u=>qa(u,o))&&a.exits.some(u=>qa(u,o)),c=Array.from(new Set([...a.entrances.map(u=>r.get(u.geometryId)),...a.exits.map(u=>r.get(u.geometryId))].flat().filter(u=>u!=null))),p={id:a.id,externalId:a.details?.externalId??"",type:a.type,accessible:l,nodes:c};a.details?.name&&(p.details={name:a.details.name}),a.extra&&(p.extra=a.extra),t["connection.json"].push(p)}return t}function rS(e,r){return e.type==QI.door&&e.entrances.every(t=>r.get(t.geometryId)?.geometry.type==="LineString")}function hU(e,r,t,o){if(e.type!==QI.door)return[];let n=[];for(let i of e.entrances){let a=r.get(i.geometryId);if(a?.geometry.type==="LineString"){let l={type:"Feature",geometry:a.geometry,properties:{id:e.id,externalId:e.details?.externalId??"",isExterior:gU(e,o)}},c=e.details;c&&(l.properties.details={name:c.name,description:c.description},c.icon&&(l.properties.details.images=[{url:c.icon,altText:`${c.name} icon`}]));let p=t.get(i.geometryId);p&&p.length>0&&(l.properties.node=p[0]),n.push([i.floorId,l])}}return n}function gU(e,r){return e.entrances.some(t=>qa(t,r))||e.exits.some(t=>qa(t,r))}d();function _F(e,{geometryMaps:r,nodesByGeometryId:t}){let o={categories:[],locations:[],locationInstances:[],layers:[],venue:{slug:"",name:"",externalId:"",defaultLanguage:{name:"English",code:"en"},languages:[]}},n=e.manifest?.features[0];n&&(o.venue.defaultFloor=n.properties.defaultFloor,o.venue.tzid=n.properties.tzid,o.venue.name=n.properties.name,o.venue.defaultLanguage={name:n.properties.language??"English",code:n.properties.language??"en"});let i=e.cms?.venue;i&&(o.venue={...o.venue,slug:i.slug,name:i.details?.name??o.venue.name??n.properties.name,externalId:i.details?.externalId??"",defaultLanguage:i.defaultLanguage,languages:i.languages??[],countrycode:i.countrycode,coverImage:i.coverImage,logo:i.logo,icon:i.details?.icon,extra:i.extra,mappedinWebUrl:i.mappedinWebUrl,operationHours:i.operationHours,topLocations:i.topLocations});let a=new Map,l=e.locations??[],c=e.cms?.locations??[],p=e.cms?.categories??[],u=new Map((p??[]).map(O=>[O.categoryId,O]));if(l.length>0){let O=new Map(c.map(C=>[C.locationId,C]));for(let C of l){let E=O.get(C.id)??{};if(C){let _=C.details,G={id:E?.cmsId!==void 0?`el_${E?.cmsId}`:uf(C.id),name:_.name,externalId:_.externalId??"",type:E.type??"location",sortOrder:E.sortOrder??0,amenity:E.amenity,description:_.description,extra:C.extra,links:C.links,operationHours:C.openingHours,gallery:E.gallery,logo:C.logo,shortName:_.shortName,picture:E.picture,showFloatingLabelWhenImagePresent:E.showFloatingLabelWhenImagePresent,showLogo:E.showLogo,siblingGroups:E.siblingGroups,states:E.states,tags:E.tags,spaces:[],nodes:[],polygons:[]};if(C.phone&&(G.phone={number:C.phone}),E.primaryCategory){let N=u.get(E.primaryCategory);N&&(G.primaryCategory=N.id)}let R=LF(C.social);C.website&&(R.website=C.website.url),G.social=R;for(let N of C.geometryAnchors){let X=r.space.get(N.geometryId);if(X){let ee=new Set(X.features.filter(re=>re.geometry.type==="Polygon").map(re=>re.properties.id));for(let re of X.anchors)G.spaces.push({floor:re.floorId,id:re.geometryId}),ee.has(re.geometryId)&&G.polygons.push({map:re.floorId,id:re.geometryId})}let z=t.get(N.geometryId);for(let ee of z??[])G.nodes.push({map:N.floorId,id:ee})}o.locations.push(G);for(let N of C.categories)a.set(N,[...a.get(N)??[],C.id])}}}let f=e.cms?.locationInstances??[],h=e.locationInstances;if(h){let O=new Map(f.map(E=>[E.locationInstanceId,E])),C=[];for(let E of h){let _=O.get(E.id)??{};if(E){let G={id:PF(E.id),parent:_.parentId??uf(E.parentId),name:E.details?.name,externalId:E.details?.externalId,type:_.type,sortOrder:_.sortOrder,amenity:_.amenity,description:E.details?.description,extra:E.extra,links:E.links,operationHours:E.openingHours,gallery:_.gallery,picture:_.picture,showFloatingLabelWhenImagePresent:_.showFloatingLabelWhenImagePresent,showLogo:_.showLogo,siblingGroups:_.siblingGroups,states:_.states,tags:_.tags,logo:E.logo,shortName:E.details?.shortName};E.phone&&(G.phone={number:E.phone});let R=LF(E.social??[]);if(E.website&&(R.website=E.website.url),Object.keys(R).length>0&&(G.social=R),E.geometryAnchors?.length){let N=E.geometryAnchors.flatMap(X=>r.space.get(X.geometryId)?.anchors??[]);N.length>0&&(G.spaces=N.map(X=>({floor:X.floorId,id:X.geometryId})))}if(E.geometryAnchors){G.spaces=[],G.polygons=[],G.nodes=[];for(let N of E.geometryAnchors){let X=r.space.get(N.geometryId);if(X){let ee=new Set(X.features.filter(re=>re.geometry.type==="Polygon").map(re=>re.properties.id));for(let re of X.anchors)G.spaces.push({floor:re.floorId,id:re.geometryId}),ee.has(re.geometryId)&&G.polygons.push({map:re.floorId,id:re.geometryId})}let z=t.get(N.geometryId);for(let ee of z??[])G.nodes.push({map:N.floorId,id:ee})}}C.push(G)}}C.length>0&&(o.locationInstances=C)}let b=e.locationCategories;if(b){let O=[],C=new Map(b.map(R=>[R.id,R])),E=new Map((p??[]).map(R=>[R.categoryId,R])),_=new Map;for(let R of b){let N=C.get(R.parent);if(N){let X=_.get(N.id)??[];X.push(R.id),_.set(N.id,X)}}for(let R of b){let N=E.get(R.id);if(R){let X=(_.get(R.id)??[]).map(Kb),z={id:Kb(R.id),name:R.details.name,externalId:R.details.externalId??"",sortOrder:N?.sortOrder??0,children:X,locations:(a.get(R.id)??[]).map(uf),icon:R.details.icon,picture:N?.picture,color:N?.color,extra:R.extra,iconFromDefaultList:N?.iconFromDefaultList};O.push(z)}}o.categories=O;let G={};for(let R of l)G[uf(R.id)]=R.categories.map(Kb).filter(N=>N!==void 0);o.categoryPriorities=G}let x={};for(let[O,C]of Object.entries(e.defaultStyle??{}))if(C.buffer){let E=C.geometryAnchors.flatMap(_=>r.space.get(_.geometryId)?.anchors??[]);x[O]={edgeOffset:C.buffer,geometryAnchors:E}}Object.keys(x).length>0&&(o.enterpriseStyles=x);let T=new Map;for(let O of Object.values(e.cms?.layers??{}))if(O)for(let[C,E]of tt(O)){if(typeof E!="string")continue;let _=T.get(E)??{name:E,id:`ely_${E}`,spaces:[]};_.spaces.push(...r.space.get(C)?.anchors.map(G=>({floorId:G.floorId,spaceId:G.geometryId}))??[]),T.set(E,_)}T.size>0&&(o.layers=Array.from(T.values()));let v=[];for(let O of Object.values(e.cms?.textures??{}))for(let C of O){let E=r.space.get(C.geometryId)?.anchors;!E||E.length<1||C.face==="unknown"||C.surface==="unknown"||v.push({repeat:C.repeat,offset:C.offset,rotation:C.rotation,path:C.path,face:C.face,surface:C.surface,bounds:C.bounds,geometryAnchors:E})}v.length>0&&(o.textures=v);let I={};for(let[O,C]of Object.entries(e.cms?.floorText??{})){let E={type:"FeatureCollection",features:[]};for(let _ of C.features){if(_.properties.align==="unknown")continue;let G={align:_.properties.align,color:_.properties.color,fontFamily:_.properties.fontFamily,fontSize:_.properties.fontSize,rotation:_.properties.rotation,text:_.properties.text,visible:_.properties.visible};"geometryId"in _.properties?G.geometryId=_.properties.geometryId:G.verticalOffset=_.properties.verticalOffset,E.features.push({type:"Feature",geometry:_.geometry,properties:G})}E.features.length>0&&(I[O]=E)}Object.keys(I).length>0&&(o.floorText=I);let M={enterprise:o};if(e.cms?.textAreas){let O={};for(let[C,E]of tt(e.cms.textAreas)){let _={type:"FeatureCollection",features:[]};for(let G of E.features){if(G.properties.align==="unknown")continue;let R={align:G.properties.align,maxWidth:G.properties.maxWidth,maxHeight:G.properties.maxHeight,rotation:G.properties.rotation};"geometryId"in G.properties?R.anchorId=G.properties.geometryId:R.verticalOffset=G.properties.verticalOffset;let N={type:"Feature",geometry:G.geometry,properties:R};_.features.push(N)}O[C]=_}M.textAreas=O}return M}var yU=["facebook","instagram","twitter"];function LF(e){let r={};for(let{name:t,url:o}of e){let n=t.toLowerCase();yU.includes(n)&&(r[n]=o)}return r}d();var bU=e=>`fc_${e.slice(3)}`;function RF(e,{geometryMaps:r}){if(!e.facade)return{};let t={},o={};for(let[n,i]of tt(e.facade))if(i)for(let a of Object.values(i)){let{floorStackId:l,geometryIds:c}=a,p=bU(l);o[l]??(o[l]={id:p,spaces:[]}),o[l].spaces.push(...c.map(u=>({floorId:n,spaceId:r.space.get(u)?.ids[0]??""})))}return Object.keys(o).length>0&&(t.facade=o),t}d();function BF(e,r={}){let t={type:"FeatureCollection",features:[]},o=[];for(let n of e.floors.features)o.push({id:n.properties.id.replace(/^f_/,"m_"),externalId:n.properties.details?.externalId??"",elevation:n.properties.elevation,name:n.properties.details?.name??"",shortName:n.properties.details?.shortName??"",subtitle:n.properties.subtitle,maxHeight:n.properties.maxHeight}),t.features.push({type:"Feature",geometry:n.geometry,properties:{id:n.properties.id,externalId:n.properties.details?.externalId??"",elevation:n.properties.elevation,name:n.properties.details?.name??"",shortName:n.properties.details?.shortName??"",subtitle:n.properties.subtitle,maxHeight:n.properties.maxHeight}});return{"floor.geojson":t,"map.geojson":o}}d();function NF(e,{geometryMaps:r}){let t={},o={};for(let[n,i]of tt(e.floorImages??{})){let a={features:[],type:"FeatureCollection"};for(let l of i?.features??[])if("verticalOffset"in l.properties)a.features.push(l);else{let{geometryId:c,...p}=l.properties,u=r.space.get(c)?.ids[0]??r.obstruction.get(c)?.ids[0];if(!u)continue;let f={geometry:l.geometry,properties:{...p,anchorId:u},type:l.type};a.features.push(f)}o[n]=a}return Object.keys(o).length>0&&(t.floorImages=o),t}d();function jF(e,r={}){let t=[];for(let n of e?.floorStacks??[]){let i={id:n.id,floors:n.floors,maps:n.floors,externalId:n.details?.externalId??"",name:n.details?.name??"",shortName:n.details?.shortName??"",type:"Building"};n.defaultFloor&&(i.defaultFloor=n.defaultFloor),t.push(i)}if(e.outdoors&&e.outdoors.floors.length>0){let n={id:"outdoors",floors:e.outdoors.floors,maps:e.outdoors.floors,type:"Outdoor",name:"Outdoors",externalId:"outdoors"};t.push(n)}return{"floorstack.json":t,"mapstack.geojson":t}}d();d();var $F=hp(VF(),1),TU=e=>{let r=e.geometry.coordinates[0],t=0;for(let o=0;o<r.length-1;o++)t+=r[o][0]*r[o+1][1]-r[o+1][0]*r[o][1];return Math.abs(t/2)},CU=(e,r)=>{let[t,o]=e,n=r.geometry.coordinates[0],i=!1;for(let a=0,l=n.length-1;a<n.length;l=a++){let[c,p]=n[a],[u,f]=n[l];p>o!=f>o&&t<(u-c)*(o-p)/(f-p)+c&&(i=!i)}return i},MU=e=>{let r=e.geometry.coordinates[0],t=0,o=0;for(let n=0;n<r.length-1;n++)t+=r[n][0],o+=r[n][1];return{geometry:{coordinates:[t/(r.length-1),o/(r.length-1)]}}},wU=e=>{let r=TU(e),t=Number.isFinite(r)?Math.max(r,1):1;return Math.sqrt(t)*1e-6},qb=e=>{try{let t=MU(e).geometry.coordinates;if(!CU(t,e)){let n=(0,$F.default)(e.geometry.coordinates,wU(e));return oe([n[0],n[1]])}return oe(t)}catch{return ie(new Error("Unable to calculate center of polygon"))}};function sS(e){return e?.geometry?.type==="Polygon"}function HF(e,{geometryMaps:r,nodesByGeometryId:t}){let o=DU(e.defaultStyle),n={},i={},a={},l={};for(let p of Ze(e.geometry)){let u=e.geometry[p];if(!u)continue;let f=[],h=[],b=[],x=[];for(let T of u.features){let v=T.properties.id,I=o.has(v),M=t.get(v)??[];for(let O of r.space.get(v)?.features??[])f.push(OU(O,M));for(let O of r.obstruction.get(v)?.features??[])h.push(EU(O,I));for(let O of r.area.get(v)?.features??[])b.push(PU(O,M));for(let O of r.window.get(v)?.features??[])x.push(FU(O))}f.length>0&&(n[p]={type:"FeatureCollection",features:f.filter(T=>T!==null)}),h.length>0&&(i[p]={type:"FeatureCollection",features:h.filter(T=>T!==null)}),b.length>0&&(a[p]={type:"FeatureCollection",features:b.filter(T=>T!==null)}),x.length>0&&(l[p]={type:"FeatureCollection",features:x.filter(T=>T!==null)})}let c={space:n,obstruction:i};return Object.keys(a).length>0&&(c.area=a),Object.keys(l).length>0&&(c.window=l),c}function OU(e,r){switch(e.geometry.type){case"MultiPoint":case"MultiLineString":case"MultiPolygon":return null}let t={type:"Feature",geometry:e.geometry,properties:{destinationNodes:r,id:e.properties.id,externalId:e.properties.details?.externalId??"",kind:e.properties.kind}};return e.properties.details&&(t.properties.details={name:e.properties.details.name,description:e.properties.details.description,images:e.properties.details.icon?[{url:e.properties.details.icon,altText:e.properties.details.name?`${e.properties.details.name} icon`:"icon"}]:void 0}),sS(t)&&(t.properties.center=qb(t).unwrapOr(void 0)),t}function EU(e,r){switch(e.geometry.type){case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"Point":return null}let t=e.properties,o={type:"Feature",geometry:e.geometry,properties:{id:t.id,externalId:t.details?.externalId??"",entrances:[],kind:t.kind,footprintComponent:r}};return sS(o)&&(o.properties.center=qb(o).unwrapOr(void 0)),t.details&&(o.properties.details={name:t.details.name,description:t.details.description,images:t.details.icon?[{url:t.details.icon,altText:t.details.name?`${t.details.name} icon`:"icon"}]:void 0}),o}function PU(e,r){if(e.geometry.type!=="Polygon")return null;let t=e.properties,o={type:"Feature",geometry:e.geometry,properties:{id:t.id,externalId:t.details?.externalId??"",destinationNodes:r}};return sS(o)&&(o.properties.center=qb(o).unwrapOr(void 0)),t.details&&(o.properties.details={name:t.details.name,description:t.details.description,images:t.details.icon?[{url:t.details.icon,altText:t.details.name?`${t.details.name} icon`:"icon"}]:void 0}),o}function FU(e){return e.geometry.type!=="LineString"?null:{type:"Feature",geometry:e.geometry,properties:{id:e.properties.id}}}function DU(e){return new Set((e?.ExteriorWalls?.geometryAnchors??[]).map(t=>t.geometryId))}d();function zF(e,{geometryMaps:r,geometryFeatureById:t}){if(!e.locationCategories&&!e.locations)return{};let o={};if(e.locationCategories?.length){let n=[];for(let i of e.locationCategories){let a={id:i.id,name:i.details.name,icon:i.details.icon??""};i.parent&&(a.parent=i.parent),n.push(a)}o["category.json"]=n}if(e.locations?.length){let n=kU(e,{geometryFeatureById:t}),i=[];for(let a of e.locations){let l={id:a.id,name:a.details.name,categories:a.categories,spaces:[],obstructions:[],areas:[],annotations:[],connections:[],entrances:[],links:a.links,openingHoursSpecification:a.openingHours??[],pictures:a.images,social:a.social,description:a.details.description,externalId:a.details.externalId,icon:a.details.icon,logo:a.logo,phone:a.phone,website:a.website};i.push(l);for(let{geometryId:c,floorId:p}of a.geometryAnchors)l.spaces.push(...r.space.get(c)?.ids.map(u=>({id:u,floor:p}))??[]),l.obstructions.push(...r.obstruction.get(c)?.ids.map(u=>({id:u,floor:p}))??[]),l.areas.push(...r.area.get(c)?.ids.map(u=>({id:u,floor:p}))??[]),l.entrances.push(...n.entrancesByGeometryId.get(c)??[]),l.connections.push(...n.connectionsByGeometryId.get(c)??[]),l.annotations.push(...n.annotationsByGeometryId.get(c)??[])}o["location.json"]=i}return o}function kU(e,{geometryFeatureById:r}){let t={annotationsByGeometryId:new Map,connectionsByGeometryId:new Map,entrancesByGeometryId:new Map};if(e.annotations)for(let[o,n]of tt(e.annotations))for(let i of n??[]){let a=i.geometryId,l=i.id,c=t.annotationsByGeometryId.get(a)??[];c.push({floor:o,id:l}),t.annotationsByGeometryId.set(a,c)}if(e.connections)for(let o of e.connections){let n=rS(o,r),i=Array.from(new Map([...o.entrances,...o.exits].map(a=>[`${a.geometryId}_${a.floorId}`,a])).values());for(let a of i){let l=a.geometryId;if(n){let c=t.entrancesByGeometryId.get(l)??[];c.push({floor:a.floorId,id:o.id}),t.entrancesByGeometryId.set(l,c)}else{let c=t.connectionsByGeometryId.get(l)??[];c.push(o.id),t.connectionsByGeometryId.set(l,c)}}}return t}d();function WF(e,r){let t={features:[],type:"FeatureCollection"},o={"manifest.geojson":t},n=e.manifest;if(n.features.length>0){let i=n.features[0],a=i.properties,l={type:"Feature",geometry:i.geometry,properties:{folder_struct:[],version:"2.0.0",time:a.time,name:a.name,naturalBearing:a.naturalBearing,tzid:a.tzid,map:a.mapId,org_id:a.orgId,language:a.language}};t.features.push(l)}return o}d();function ZF(e,{geometryMaps:r,navigationFlags:t,incomingEdgesByNodeId:o}){let n={"node.geojson":{type:"FeatureCollection",features:[]}},i=n["node.geojson"].features,a=new Map;for(let p of e.floors?.features??[])a.set(p.properties.id,p.properties.elevation);let l=new Map;for(let p of Object.values(e.nodes??{}))for(let u of p?.features??[])for(let f of u.properties.geometryIds)l.set(f,[...l.get(f)??[],u.properties.id]);let c=new Map;for(let p of e.connections??[]){let u=p.exits.map(f=>({...f,nodes:l.get(f.geometryId)??[]}));for(let f of p.entrances){let h=l.get(f.geometryId)??[];for(let b of h)for(let x of u){let T=Math.abs((a.get(f.floorId)??0)-(a.get(x.floorId)??0))*p.floorCostMultiplier,v=c.get(b)??[];v.push(...x.nodes.map(I=>({id:I,weight:T+p.entryCost}))),c.set(b,v)}}}for(let[p,u]of tt(e.nodes??{}))for(let f of u?.features??[]){let h=r.space.get(f.properties.geometryIds[0])?.features[0],b=h?.geometry.type==="Point"&&h?.properties.details?.externalId?h.properties.details.externalId:"",x=o.get(f.properties.id)??[],T=Object.keys(t??{}),v=[];for(let M of x)for(let O of T)qa(M,t[O])&&v.push(t[O]);let I={type:"Feature",geometry:f.geometry,properties:{id:f.properties.id,floor:p,space:f.properties.geometryIds.map(M=>r.space.get(M)?.ids).flat().filter(M=>M!==void 0),neighbors:[...f.properties.neighbors.map(M=>({id:M.id,weight:M.extraCost})),...c.get(f.properties.id)??[]],map:p,externalId:b,flags:v.length>0?AU(v):void 0}};i.push(I)}return n}function AU(e){if(e==null||e.length===0)return;let r=new Array(Math.max(...e.map(t=>t.index))+1).fill(0);for(let t of e)r[t.index]|=1<<t.bit;return r}d();function LU(e,r){let t={};for(let o of e){let n=r.get(o);n&&(t[n]??(t[n]=[]),t[n].push(o))}return t}function XF(e,{geometryMaps:r}){if(!e.defaultStyle)return{};let t={},o={};t["styles.json"]=o;let n=[...Array.from(r.space.values()).map(a=>a.features),...Array.from(r.obstruction.values()).map(a=>a.features)],i=new Map(n.flatMap(a=>a.map(l=>[l.properties.id,l.geometry.type])));for(let[a,l]of tt(e.defaultStyle)){let c=LU(l.geometryAnchors.flatMap(p=>[...r.space.get(p.geometryId)?.ids??[],...r.obstruction.get(p.geometryId)?.ids??[]]),i);if(c.Point&&c.Point.length>0){let p={points:Array.from(c.Point.values()),showImage:l.extra?.showImage!==void 0?l.extra?.showImage===!0:l.opacity!==0};o[`${a}.Point`]=p}if(c.LineString&&c.LineString.length>0){let p={lineStrings:Array.from(c.LineString.values()),altitude:l.altitude,color:l.color,height:l.height,opacity:l.opacity,width:l.buffer};o[`${a}.LineString`]=p}if(c.Polygon&&c.Polygon.length>0){let p={polygons:Array.from(c.Polygon.values()),altitude:l.altitude,color:l.color,height:l.height,opacity:l.opacity};l.extra?.showImage!==void 0&&(p.showImage=l.extra.showImage===!0),o[`${a}.Polygon`]=p}}return t}var _U=DE().extendOptional(AP).extendOptional(hF).extendOptional(GP).extendOptional(cF).extendOptional(OF).extendOptional(HP).extendOptional(YP).extendOptional(xF).extendOptional(SF).extendOptional(iF).extendOptional(QP).extendOptional(_E).extendOptional(HE).extendOptional(EP).build({cspSafe:!0}).expect("Invalid parser, this should never happen. Likely a bug in the MVFv2 library, or one of the extensions.");function YF(e){let r=DF(e),t=BF(e,r),o=HF(e,r),n=ZF(e,r),i=AF(e,r),a=XF(e,r),l=jF(e,r),c=NF(e,r),p=RF(e,r),u=kF(e,r),f=zF(e,r),h=_F(e,r),b=WF(e,r);return{...t,...o,...n,...i,...a,...l,"tileset.json":e.tileset,...c,...p,...u,...f,...h,...b}}function aS(e){let r=_U.decompressUnsafeSync(e);return r.isOk()?oe(YF(r.value)):ie(r.error)}d();function xd(e){return e.endsWith("/")?e:`${e}/`}d();var vd="https://app.mappedin.com/",JF="https://auth.mappedin.com/";d();d();var RU=e=>{let r=Date.now();return e-r},e1=(e,r)=>RU(e)<=r*60*1e3;var QF=60,qF=QF*60*1e3,KF="accessTokens";async function mf(e,r=!1){let t=`${e.key}`,o=Es.getInstance(),n=o?.loadSessionData(KF)||{},i=Math.floor(Date.now()/1e3);if(n[t]&&!e1(n[t].expiresTimestamp*1e3,QF))return n[t];let a=r?await BU(e,i):await NU(e,i),l={...n,[t]:a};return o?.saveSessionData(KF,l),a}async function BU(e,r){let t=`${e.baseAuthUri??JF}oauth2/token`,o=await tn()(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({grant_type:"client_credentials",client_id:e.key,client_secret:e.secret})});if(!o.ok)throw new Error(`${o.status} ${o.statusText}: ${await o.text()}`);let n=await o.json();return{accessToken:n.access_token,expiresTimestamp:r+n.expires_in}}async function NU(e,r){let t=`${e.baseAuthUri?xd(e.baseAuthUri):vd}api/v1/api-key/token`,o=await tn()(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:e.key,secret:e.secret})});if(!o.ok)throw new Error(`${o.status} ${o.statusText}: ${await o.text()}`);let n=await o.json();return{accessToken:n.access_token,expiresTimestamp:r+n.expires_in}}d();var t5=60,r5=t5*60*1e3,e5="miSasTokens";async function lS(e,r){let t=`${r}__${e.mapId}`,o=Es.getInstance(),n=o?.loadSessionData(e5)||{};if(n[t]&&!e1(n[t].expires,t5))return n[t];let i=await jU(e,r),a={...n,[t]:{token:i.token,expires:new Date(i.expires).getTime()}};return o?.saveSessionData(e5,a),i}async function jU(e,r){let t=`${e.baseUri?xd(e.baseUri):vd}api/v1/venue/${e.mapId}/sas-token`,o=await tn()(t,{method:"GET",headers:{Authorization:`Bearer ${r}`}});if(!o.ok)throw new Error(`${o.status} ${o.statusText}: ${await o.text()}`);let n=await o.json();return{token:n.token,expires:new Date(n.expires).getTime()}}var o5=globalThis.fetch,GU=y?.env?.npm_package_version;function tn(){if(o5==null)throw new Error("fetch is not available in your environment. Pass your own function into `setFetchFn` (node-fetch, etc)");return o5}var cS={supplementaryUrl:"https://api-gateway.mappedin.com/analytics/",headers:{},accessToken:"",clientId:"",noAuth:!1,includeHidden:!0,clientSecret:"",apiGateway:"",authorization:"",perspective:"Website",language:"",venue:""};function i5(e){let r={...cS,...e};return r.headers={...r.headers,"mappedin-sdk-version":GU},r.things=[],"platformString"in e&&(r.headers={...r.headers,"mappedin-platform-version":e.platformString}),r.noAuth||(r.accessToken?r.authorization=`Bearer ${r.accessToken}`:r.clientId&&r.clientSecret&&(r.authorization=`Basic ${globalThis.btoa(`${r.clientId}:${r.clientSecret}`)}`)),r.language=r.language?.toLowerCase(),r}function UU(e,r,t=!1){let o={language:e.language,clientId:e.clientId,clientSecret:e.clientSecret};t&&delete o.language;let{headers:n}=e;n["Content-Type"]=n["Content-Type"]||"text/json",e.accessToken?n.Authorization=`Bearer ${e.accessToken}`:e.noAuth||e.clientId&&e.clientSecret&&(n["x-mappedin-key"]=btoa(e.clientId),n["x-mappedin-secret"]=btoa(e.clientSecret));let i={method:"GET",headers:n};return e.secure&&(r+="&withcdntoken"),{req:i,url:r}}async function VU(e,r,t=!1){let o=UU(e,r,t),n=await tn()(o.url,o.req);if(!n.ok)throw new Error(`${n.status} ${n.statusText}`);return n.json()}var $U=e=>{let r=e!=null&&typeof e=="object"&&"perspectives"in e&&e.perspectives!=null&&typeof e.perspectives=="object"?e.perspectives:null;if(r==null||Object.keys(r).length===0)return A.warn("No perspectives available in response!"),null;let t={};for(let[o,n]of Object.entries(r)){let i="url"in n&&typeof n.url=="string"?n.url:null,a="locale_packs"in n&&typeof n.locale_packs=="object"?n.locale_packs:null;if(i==null||a==null){A.warn(`Perspective ${o} is missing url or locale_packs!`);continue}t[o]={url:i,locale_packs:a}}return t};async function HU(e,r="exports/mvf/1/bundle"){let t=i5({baseUri:"https://api-gateway.mappedin.com/",...cS,...e}),o=`${t.baseUri+r}?venue=${t.venue}&version=${t.version??"2.0.0"}`;t.headers["Content-Type"]="application/zip";let n=await VU(t,o),i=n.url,a=n.locale_packs,l=t.perspective??cS.perspective,c=$U(n);if(l!=null&&l!==""&&c!=null){let p=c[l];p==null?A.warn(`Perspective ${l} not found in response! Loading default perspective instead.`):(A.log(`Loading perspective "${l}"`),i=p.url,a=p.locale_packs)}return{url:i,localePacks:a,updated_at:n.updated_at}}var Id=function(){let e;return()=>(e||(e=new TextDecoder),e)}();async function pS(e,{signal:r}){let t=await(await tn()(e,{signal:r})).arrayBuffer();return new Uint8Array(t)}async function Sd(e){let t=(await import("./browser-FKTBGI2T.js")).unzipSync(e),o={};if(t["enterprise/"]!=null){o.enterprise={};let n=t["enterprise/locations.json"];n&&(o.enterprise.locations=JSON.parse(Id().decode(n)));let i=t["enterprise/locationInstances.json"];i&&(o.enterprise.locationInstances=JSON.parse(Id().decode(i)));let a=t["enterprise/categories.json"];a&&(o.enterprise.categories=JSON.parse(Id().decode(a)))}return t["floorstack.json"]&&(o["floorstack.json"]=JSON.parse(Id().decode(t["floorstack.json"]))),t["floor.geojson"]&&(o["floor.geojson"]=JSON.parse(Id().decode(t["floor.geojson"]))),t["manifest.json"]&&(o["manifest.geojson"]=JSON.parse(Id().decode(t["manifest.json"]))),o}async function s5(e,{signal:r}){try{let t=await(await tn()(e,{signal:r})).arrayBuffer();if(r.aborted)return;let o=new Uint8Array(t);return await Sd(o)}catch(t){let o=new Error("downloadLanguagePack failed");throw o.cause=t,o}}function zU(e){let{mvfVersion:r,useDraftData:t}=e;if(r==="3.0.0")return t?"exports/mvf3-draft/1/bundle":"exports/mvf3/1/bundle";if(r==null||r==="2.0.0")return t?"exports/mvf2-draft/1/bundle":"exports/mvf2/1/bundle";if(r==="2.0.0-c")return t?"exports/mvf2c-draft/1/bundle":"exports/mvf2c/1/bundle";throw new Error(`Unsupported MVF version: ${r}`)}async function dS(e){return new Promise(async(r,t)=>{try{let o=zU(e),{url:n,localePacks:i}=await HU(e,o),a=await tn()(n).then(c=>c.arrayBuffer()),l=new Uint8Array(a);r({compressed:l,localePacks:i})}catch(o){t(o)}})}async function uS(e,r){return new Promise(async(t,o)=>{try{let{url:n}=await WU(e,r),i=await tn()(n).then(l=>l.arrayBuffer()),a=new Uint8Array(i);t(a)}catch(n){o(n)}})}async function WU(e,r){let t=new URL(`${e.baseUri?xd(e.baseUri):vd}api/v1/venue/${e.mapId}/mvf`);e.viewId&&t.searchParams.set("configId",e.viewId),e.mvfVersion&&t.searchParams.set("version",e.mvfVersion);let o=await tn()(t.toString(),{headers:{Authorization:`Bearer ${r}`}});if(!o.ok)throw new Error(`${o.status} ${o.statusText}`);return o.json()}function mS(e){let r=new TextDecoder,t=r.decode.bind(r);try{let o={"connection.json":JSON.parse(t(e["connection.json"])),"manifest.geojson":JSON.parse(t(e["manifest.geojson"])),"map.geojson":e["map.geojson"]?JSON.parse(t(e["map.geojson"])):void 0,"mapstack.geojson":e["mapstack.geojson"]?JSON.parse(t(e["mapstack.geojson"])):void 0,"node.geojson":JSON.parse(t(e["node.geojson"])),obstruction:{},space:{},entrance:{},facade:{},"tileset.json":e["tileset.json"]?JSON.parse(t(e["tileset.json"])):void 0,"navigationFlags.json":e["navigationFlags.json"]?JSON.parse(t(e["navigationFlags.json"])):void 0};if(e.enterprise!=null&&(o.enterprise={},e.enterprise?.["locations.json"]&&(o.enterprise.locations=JSON.parse(t(e.enterprise?.["locations.json"]))),e.enterprise?.["categories.json"]&&(o.enterprise.categories=JSON.parse(t(e.enterprise?.["categories.json"]))),e.enterprise?.["venue.json"]&&(o.enterprise.venue=JSON.parse(t(e.enterprise?.["venue.json"]))),e.enterprise?.["layers.json"]&&(o.enterprise.layers=JSON.parse(t(e.enterprise?.["layers.json"]))),e.enterprise?.["locationInstances.json"]&&(o.enterprise.locationInstances=JSON.parse(t(e.enterprise?.["locationInstances.json"]))),e.enterprise?.["enterpriseStyles.json"]&&(o.enterprise.enterpriseStyles=JSON.parse(t(e.enterprise?.["enterpriseStyles.json"]))),e.enterprise?.["textures.json"]&&(o.enterprise.textures=JSON.parse(t(e.enterprise?.["textures.json"]))),e.enterprise?.["floorText.json"]&&(o.enterprise.floorText=JSON.parse(t(e.enterprise?.["floorText.json"]))),e.enterprise?.["categoryPriorities.json"]&&(o.enterprise.categoryPriorities=JSON.parse(t(e.enterprise?.["categoryPriorities.json"])))),e["floorstack.json"]!=null?o["floorstack.json"]=JSON.parse(t(e["floorstack.json"])):e["mapstack.json"]!=null&&(o["mapstack.json"]=JSON.parse(t(e["mapstack.json"]))),o["floorstack.json"]==null&&o["mapstack.json"]==null&&o["mapstack.geojson"]==null)throw new Error("MVF is missing floorstack.json or mapstack.json/mapstack.geojson");if(e["floor.geojson"]&&(o["floor.geojson"]=JSON.parse(t(e["floor.geojson"]))),o["floor.geojson"]==null&&o["map.geojson"]==null)throw new Error("MVF is missing floor.geojson or map.geojson");if("styles.json"in e&&(o["styles.json"]=JSON.parse(t(e["styles.json"]))),"shapes.json"in e&&(o["shapes.json"]=JSON.parse(t(e["shapes.json"]))),"location.json"in e&&(o["location.json"]=JSON.parse(t(e["location.json"]))),"category.json"in e&&(o["category.json"]=JSON.parse(t(e["category.json"]))),e.annotation!=null){o.annotation={};let i=Object.keys(e.annotation);for(let a of i){let l=a.replace(/\.json|\.geojson/g,"");o.annotation[l]=JSON.parse(t(e.annotation[a]))}}let n=Object.keys(e.space);for(let i of n){let a=i.replace(/\.json|\.geojson/g,"");o.space[a]=JSON.parse(t(e.space[i]))}if(e.obstruction!=null){let i=Object.keys(e.obstruction);for(let a of i){let l=a.replace(/\.json|\.geojson/g,"");o.obstruction[l]=JSON.parse(t(e.obstruction[a]))}}else o.obstruction={};if(e.entrance!=null){let i=Object.keys(e.entrance);for(let a of i){let l=a.replace(/\.json|\.geojson/g,"");o.entrance[l]=JSON.parse(t(e.entrance[a]))}}else o.entrance={};if("floorImages"in e&&e.floorImages!=null){o.floorImages={};for(let i of Object.keys(e.floorImages)){let a=i.replace(/\.json|\.geojson/g,"");o.floorImages[a]=JSON.parse(t(e.floorImages[i]))}}if("textAreas"in e&&e.textAreas!=null){o.textAreas={};for(let i of Object.keys(e.textAreas)){let a=i.replace(/\.json|\.geojson/g,"");o.textAreas[a]=JSON.parse(t(e.textAreas[i]))}}if("facade"in e&&e.facade!=null){o.facade={};for(let i of Object.keys(e.facade)){let a=i.replace(/\.json|\.geojson/g,"");o.facade[a]=JSON.parse(t(e.facade[i]))}}if("area"in e&&e.area!=null){o.area={};for(let i of Object.keys(e.area)){let a=i.replace(/\.json|\.geojson/g,"");o.area[a]=JSON.parse(t(e.area[i]))}}return o}catch(o){throw A.error(o),new Error("MVF parsing failed! Probably encountered a bad file.")}}function ZU(e){if(e==null||typeof e!="object")return!1;let r=["connection.json","manifest.geojson","floor.geojson"in e?"floor.geojson":"map.geojson","node.geojson","floorstack.json"in e?"floorstack.json":"mapstack.json"in e?"mapstack.json":"mapstack.geojson"];"styles.json"in e&&r.push("styles.json"),"shapes.json"in e&&r.push("shapes.json");for(let t of r)if(e[t]==null||e[t][Symbol.toStringTag]!=="Uint8Array")return!1;return!0}async function fS(e){return new Promise(async(r,t)=>{try{if(e==null||typeof e!="object")throw new Error("Error parsing data! Unzipping failed.");if(e[Symbol.toStringTag]!=="Uint8Array")throw new Error("Unexpected file type! Unzipping failed.");let n=(await import("./browser-FKTBGI2T.js")).unzipSync(e);if(!ZU(n))throw new Error("MVF is missing some expect static files. Unzipping failed.");let i={},a=Object.keys(n);for(let l of a){if(n[l].length===0)continue;let c=l.split("/");if(c.length<0)throw new Error("Encounted a file with no name! Unzipping failed.");if(c.length>2)throw new Error("Encountered unexpected nesting in MVF! Unzipping failed.");if(c.length===1){i[c[0]]=n[l];continue}if(c[0]==="image"){A.warn("MVF unzipping encountered an image. Ignoring as this case has not been implemented.");continue}else i[c[0]]==null&&(i[c[0]]={}),i[c[0]][c[1]]=n[l]}r(i)}catch(o){t(o)}})}function tl(){let e="us",r={};function t(){return QU(eV(e),r)}return{updateByUserOption(o){o.environment&&(e=o.environment),o.baseUri&&(r.baseUri=o.baseUri),o.baseAuthUri&&(r.baseAuthUri=o.baseAuthUri),o.analytics?.baseUri&&(r.analyticsBaseUri=o.analytics?.baseUri)},updateTileServerBaseUrl(o){r.tileServerUri=o},updateEnvironment(o){e=o},setEnterprise(o){(e==="us"||e==="us-enterprise")&&(e=o?"us-enterprise":"us")},getBaseUri(){return t().baseUri},getBaseAuthUri(){return t().baseAuthUri},getAnalyticsBaseUri(){return t().analyticsBaseUri},getTileServerUri(){return t().tileServerUri},reset(){e="us",r={}},__getState:t}}var a5=Object.freeze({baseUri:"https://app.mappedin.com/",baseAuthUri:"https://app.mappedin.com/",analyticsBaseUri:"https://api-gateway.mappedin.com/track-analytics/a/",tileServerUri:"https://tiles-cdn.mappedin.com/styles/mappedin/style.json"}),XU=Object.freeze({...a5,baseUri:"https://api-gateway.mappedin.com/",baseAuthUri:"https://auth.mappedin.com/"}),YU=Object.freeze({baseUri:"https://api-gateway.eu.mappedin.com/",baseAuthUri:"https://auth.eu.mappedin.com/",analyticsBaseUri:"https://api-gateway.eu.mappedin.com/track-analytics/a/",tileServerUri:"https://tiles-cdn.eu.mappedin.com/styles/mappedin/style.json"}),JU=Object.freeze({baseUri:"https://api-gateway-staging.mappedin.net/",baseAuthUri:"https://auth-staging.mappedin.net/",analyticsBaseUri:"https://api-gateway-staging.mappedin.net/track-analytics/a/",tileServerUri:"https://tiles-cdn.mappedin.com/styles/mappedin/style.json"}),KU=Object.freeze({baseUri:"https://app-staging.mappedin.net/",baseAuthUri:"https://app-staging.mappedin.net/",analyticsBaseUri:"https://api-gateway-staging.mappedin.net/track-analytics/a/",tileServerUri:"https://tiles-cdn.mappedin.com/styles/mappedin/style.json"});function QU(e,r){return{...e,...r}}var qU={eu:YU,us:a5,"us-enterprise":XU,"us-staging-enterprise":JU,"us-staging-self-serve":KU};function eV(e){return qU[e]}var t1=e=>{let r=Object.values(e["floorstack.json"]??e["mapstack.json"]??{});return r.length===1?[]:r.filter(t=>t.type!=="Outdoor").map(t=>t.id.replace("fs_","").replace("ms_",""))},n5=async e=>{let r=performance.now(),t=aS(e);return A.log(`Parsed MVFv3 in ${performance.now()-r}ms`),t.inspectErr(n=>{throw A.error(n),new Error("MVFv3 parsing failed!")}),t.unwrap()};async function r1(e,r="2.0.0"){switch(r){case"2.0.0":case"2.0.0-c":try{let t=await fS(e);return mS(t)}catch{return n5(e)}case"3.0.0":return n5(e);default:throw new Error(`Unsupported MVF version: ${r}`)}}d();d();d();function Mn(e){if(!e)throw new Error("coord is required");if(!Array.isArray(e)){if(e.type==="Feature"&&e.geometry!==null&&e.geometry.type==="Point")return e.geometry.coordinates;if(e.type==="Point")return e.coordinates}if(Array.isArray(e)&&e.length>=2&&!Array.isArray(e[0])&&!Array.isArray(e[1]))return e;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function rn(e){if(Array.isArray(e))return e;if(e.type==="Feature"){if(e.geometry!==null)return e.geometry.coordinates}else if(e.coordinates)return e.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function Td(e){return e.type==="Feature"?e.geometry:e}function l5(e,r){return e.type==="FeatureCollection"?"FeatureCollection":e.type==="GeometryCollection"?"GeometryCollection":e.type==="Feature"&&e.geometry!==null?e.geometry.type:e.type}function tV(e,r,t){t===void 0&&(t={});for(var o=Mn(e),n=rn(r),i=0;i<n.length-1;i++){var a=!1;if(t.ignoreEndVertices&&(i===0&&(a="start"),i===n.length-2&&(a="end"),i===0&&i+1===n.length-1&&(a="both")),rV(n[i],n[i+1],o,a,typeof t.epsilon>"u"?null:t.epsilon))return!0}return!1}function rV(e,r,t,o,n){var i=t[0],a=t[1],l=e[0],c=e[1],p=r[0],u=r[1],f=t[0]-l,h=t[1]-c,b=p-l,x=u-c,T=f*x-h*b;if(n!==null){if(Math.abs(T)>n)return!1}else if(T!==0)return!1;if(o){if(o==="start")return Math.abs(b)>=Math.abs(x)?b>0?l<i&&i<=p:p<=i&&i<l:x>0?c<a&&a<=u:u<=a&&a<c;if(o==="end")return Math.abs(b)>=Math.abs(x)?b>0?l<=i&&i<p:p<i&&i<=l:x>0?c<=a&&a<u:u<a&&a<=c;if(o==="both")return Math.abs(b)>=Math.abs(x)?b>0?l<i&&i<p:p<i&&i<l:x>0?c<a&&a<u:u<a&&a<c}else return Math.abs(b)>=Math.abs(x)?b>0?l<=i&&i<=p:p<=i&&i<=l:x>0?c<=a&&a<=u:u<=a&&a<=c;return!1}var c5=tV;d();function oV(e,r){r===void 0&&(r={});var t=vp(e),o=(t[0]+t[2])/2,n=(t[1]+t[3])/2;return ki([o,n],r.properties,r)}var Cd=oV;d();d();function nV(e,r,t){t===void 0&&(t={});var o=Mn(e),n=Mn(r),i=Po(n[1]-o[1]),a=Po(n[0]-o[0]),l=Po(o[1]),c=Po(n[1]),p=Math.pow(Math.sin(i/2),2)+Math.pow(Math.sin(a/2),2)*Math.cos(l)*Math.cos(c);return LC(2*Math.atan2(Math.sqrt(p),Math.sqrt(1-p)),t.units)}var rl=nV;function o1(e,r){return r===void 0&&(r={}),BC(e,function(t,o){var n=o.geometry.coordinates;return t+rl(n[0],n[1],r)},0)}d();d();d();function n1(e,r,t){if(t===void 0&&(t={}),t.final===!0)return iV(e,r);var o=Mn(e),n=Mn(r),i=Po(o[0]),a=Po(n[0]),l=Po(o[1]),c=Po(n[1]),p=Math.sin(a-i)*Math.cos(c),u=Math.cos(l)*Math.sin(c)-Math.sin(l)*Math.cos(c)*Math.cos(a-i);return mm(Math.atan2(p,u))}function iV(e,r){var t=n1(r,e);return t=(t+180)%360,t}d();function oc(e,r,t,o){o===void 0&&(o={});var n=Mn(e),i=Po(n[0]),a=Po(n[1]),l=Po(t),c=_C(r,o.units),p=Math.asin(Math.sin(a)*Math.cos(c)+Math.cos(a)*Math.sin(c)*Math.cos(l)),u=i+Math.atan2(Math.sin(l)*Math.sin(c)*Math.cos(a),Math.cos(c)-Math.sin(a)*Math.sin(p)),f=mm(u),h=mm(p);return ki([f,h],o.properties)}d();d();function sV(e){if(!e)throw new Error("geojson is required");var r=[];return Ai(e,function(t){aV(t,r)}),jl(r)}function aV(e,r){var t=[],o=e.geometry;if(o!==null){switch(o.type){case"Polygon":t=rn(o);break;case"LineString":t=[rn(o)]}t.forEach(function(n){var i=lV(n,e.properties);i.forEach(function(a){a.id=r.length,r.push(a)})})}}function lV(e,r){var t=[];return e.reduce(function(o,n){var i=Ps([o,n],r);return i.bbox=cV(o,n),t.push(i),n}),t}function cV(e,r){var t=e[0],o=e[1],n=r[0],i=r[1],a=t<n?t:n,l=o<i?o:i,c=t>n?t:n,p=o>i?o:i;return[a,l,c,p]}var hS=sV;var O5=hp(M5(),1);function RV(e,r){var t={},o=[];if(e.type==="LineString"&&(e=C0(e)),r.type==="LineString"&&(r=C0(r)),e.type==="Feature"&&r.type==="Feature"&&e.geometry!==null&&r.geometry!==null&&e.geometry.type==="LineString"&&r.geometry.type==="LineString"&&e.geometry.coordinates.length===2&&r.geometry.coordinates.length===2){var n=w5(e,r);return n&&o.push(n),jl(o)}var i=(0,O5.default)();return i.load(hS(r)),M0(hS(e),function(a){M0(i.search(a),function(l){var c=w5(a,l);if(c){var p=rn(c).join(",");t[p]||(t[p]=!0,o.push(c))}})}),jl(o)}function w5(e,r){var t=rn(e),o=rn(r);if(t.length!==2)throw new Error("<intersects> line1 must only contain 2 coordinates");if(o.length!==2)throw new Error("<intersects> line2 must only contain 2 coordinates");var n=t[0][0],i=t[0][1],a=t[1][0],l=t[1][1],c=o[0][0],p=o[0][1],u=o[1][0],f=o[1][1],h=(f-p)*(a-n)-(u-c)*(l-i),b=(u-c)*(i-p)-(f-p)*(n-c),x=(a-n)*(i-p)-(l-i)*(n-c);if(h===0)return null;var T=b/h,v=x/h;if(T>=0&&T<=1&&v>=0&&v<=1){var I=n+T*(a-n),M=i+T*(l-i);return ki([I,M])}return null}var wd=RV;function BV(e,r,t){t===void 0&&(t={});var o=ki([1/0,1/0],{dist:1/0}),n=0;return Ai(e,function(i){for(var a=rn(i),l=0;l<a.length-1;l++){var c=ki(a[l]);c.properties.dist=rl(r,c,t);var p=ki(a[l+1]);p.properties.dist=rl(r,p,t);var u=rl(c,p,t),f=Math.max(c.properties.dist,p.properties.dist),h=n1(c,p),b=oc(r,f,h+90,t),x=oc(r,f,h-90,t),T=wd(Ps([b.geometry.coordinates,x.geometry.coordinates]),Ps([c.geometry.coordinates,p.geometry.coordinates])),v=null;T.features.length>0&&(v=T.features[0],v.properties.dist=rl(r,v,t),v.properties.location=n+rl(c,v,t)),c.properties.dist<o.properties.dist&&(o=c,o.properties.index=l,o.properties.location=n),p.properties.dist<o.properties.dist&&(o=p,o.properties.index=l+1,o.properties.location=n+u),v&&v.properties.dist<o.properties.dist&&(o=v,o.properties.index=l),n+=u}}),o}var hf=BV;function NV(e,r,t){var o=rn(t);if(l5(t)!=="LineString")throw new Error("line must be a LineString");var n=hf(t,e),i=hf(t,r),a;n.properties.index<=i.properties.index?a=[n,i]:a=[i,n];for(var l=[a[0].geometry.coordinates],c=a[0].properties.index+1;c<a[1].properties.index+1;c++)l.push(o[c]);return l.push(a[1].geometry.coordinates),Ps(l,t.properties)}var ES=NV;var jV=1e-7;function PS(e){return{type:"Point",coordinates:e}}function GV(e,r){let{coordinates:t}=r.geometry,{coordinates:o}=e.geometry,n=t.map(i=>hf(e,PS(i)));return o.reduce((i,a)=>{let l=ES(PS(a),n[0],e),c=ES(PS(a),n[1],e),p=o1(l)<o1(c)?l:c;return p.properties={...e.properties,entrances:[]},i.concat([p])},[])}function FS(e,r){return r.reduce((t,o)=>{let n={epsilon:jV},i=t.obstructions.findIndex(l=>c5(Cd(o),l,n)),a=t.obstructions[i];if(a){let[l,c]=GV(a,o);t.entrances.push(o),t.obstructions.splice(i,1,l,c)}return t},{obstructions:[e],entrances:[]})}d();d();d();var xr=class{constructor(r){m(this,"id");this.id=r}};d();d();var Od=class Od{constructor(r,t,o){m(this,"__type",Od.__type);m(this,"id",ut());m(this,"latitude");m(this,"longitude");m(this,"floorId");m(this,"verticalOffset");if(typeof r=="object")this.latitude=r.latitude,this.longitude=r.longitude,this.floorId=r.floorId,this.verticalOffset=r.verticalOffset??0;else{if(t==null)throw new Error("Coordinate longitude is required.");this.latitude=r,this.longitude=t,this.floorId=o,this.verticalOffset=0}}static is(r){return r.__type===Od.__type}get anchorTarget(){return this}get focusTarget(){return this}isEqual(r){return this.latitude===r.latitude&&this.longitude===r.longitude&&this.floorId===r.floorId}toJSON(){return{__type:Od.__type,latitude:this.latitude,longitude:this.longitude,floorId:this.floorId,verticalOffset:this.verticalOffset}}destroy(){}};m(Od,"__type","coordinate");var DS=Od,fe=DS;function kS(e){let r=e.enterprise?.locations?.reduce((n,i)=>(n[i.id]=i,n),{})||{};for(let n of e.enterprise?.locationInstances||[])r[n.id]=n;let t={};for(let n of e["floorstack.json"]||[])t[n.id]=n;let o={};for(let n of e["floor.geojson"]?.features||[])n.properties&&n.properties.id&&(o[n.properties.id]=n.properties);return{type:"downloaded",data:e,optimized:{"enterprise-location":r,"enterprise-category":e.enterprise?.categories?.reduce((n,i)=>(n[i.id]=i,n),{})||{},"floor-stack":t,floor:o}}}function E5(e){return/^https?:\/\/cdn\.mappedin\.com/.test(e)}function P5(e){return!!e.split("?")[1]?.includes("sv=")}function Dr(e,r){let t=e?.properties?.id||"unknown";if(e.geometry==null)return A.error(`Cannot get the center coordinate for "${t}" because it has no geometry.`),new fe({latitude:0,longitude:0,floorId:r});try{if(e.geometry.type==="LineString"){let[[o,n],[i,a]]=e.geometry.coordinates,l=(o+i)/2,c=(n+a)/2;return new fe({latitude:c,longitude:l,floorId:r})}else if(e.geometry.type==="Point"){let[o,n]=e.geometry.coordinates;return new fe({latitude:n,longitude:o,floorId:r})}else if(e.geometry.type==="Polygon"){let o=e;if(o.properties.center!=null){let[n,i]=o.properties.center;return new fe({latitude:i,longitude:n,floorId:r})}}}catch{}try{let[o,n]=Cd(e).geometry.coordinates;return new fe({latitude:n,longitude:o,floorId:r})}catch(o){return A.error(`Failed to get center coordinate for "${t}" ${o instanceof Error?o.stack:""}`),new fe({latitude:0,longitude:0,floorId:r})}}function F5(e,r){return r&&(e.flags[r.index]&1<<r.bit)!==0}var ii,kr,nc,Qs,Ed=class Ed extends xr{constructor(t,o){super(o.mvfData.properties.id);m(this,"__type",Ed.__type);S(this,ii);S(this,kr,{});S(this,nc);S(this,Qs);w(this,ii,t),w(this,nc,o.floorId),w(this,Qs,o.mvfData)}static is(t){return t.__type===Ed.__type}get locations(){return s(this,kr).locations?s(this,kr).locations:(s(this,kr).locations=(s(this,ii).locationIdsByNodeId[this.id]||[]).map(t=>s(this,ii).getById("enterprise-location",t)).filter(Boolean),s(this,kr).locations)}get space(){return s(this,ii).getById("space",s(this,ii).spaceIdsByNodeId[this.id]?.[0])}get floor(){let t=s(this,ii).getById("floor",s(this,nc));if(t==null)throw new Error(`Floor ${s(this,nc)} not found!`);return t}get coordinate(){return s(this,kr).coordinate==null&&(s(this,kr).coordinate=Dr(s(this,Qs),s(this,nc))),s(this,kr).coordinate}get externalId(){return s(this,Qs).properties.externalId??""}get neighbors(){if(s(this,kr).neighbors==null){let t=s(this,Qs).properties.neighbors.map(o=>{let n=s(this,ii).getById("node",o.id);if(n==null)throw new Error(`Node ${o.id} not found!`);return n});s(this,kr).neighbors=t}return s(this,kr).neighbors}get navigationFlags(){if(s(this,kr).navigationFlags==null){let t=[],o=s(this,Qs).properties.flags;if(o!=null&&o.length>0)for(let[n,i]of Object.entries(s(this,ii).navigationFlags))o.length>i.index&&o[i.index]!=null&&F5({flags:o},i)&&t.push(n);s(this,kr).navigationFlags=Object.freeze(t)}return s(this,kr).navigationFlags}get geoJSON(){return{...s(this,Qs),properties:null}}get focusTarget(){return this.coordinate}get anchorTarget(){return this.coordinate}toJSON(){return{__type:Ed.__type,id:this.id,floor:this.floor.id,coordinate:this.coordinate.toJSON(),neighbors:this.neighbors.map(t=>t.id)}}destroy(){for(let t of Object.keys(s(this,kr)))delete s(this,kr)[t]}};ii=new WeakMap,kr=new WeakMap,nc=new WeakMap,Qs=new WeakMap,m(Ed,"__type","node");var AS=Ed,wn=AS;d();d();d();d();var gf,qs,Pd=class Pd extends xr{constructor(t){super(String(ut()));m(this,"__type",Pd.__type);S(this,gf,{});S(this,qs);w(this,qs,t.mvfData)}static is(t){return t.__type===Pd.__type}get url(){return s(this,qs).url}get name(){if("displayName"in s(this,qs))return s(this,qs).displayName;if("label"in s(this,qs))return s(this,qs).label}toJSON(){return{__type:Pd.__type,id:this.id,url:this.url,name:this.name}}destroy(){for(let t of globalThis.Object.keys(s(this,gf)))delete s(this,gf)[t]}};gf=new WeakMap,qs=new WeakMap,m(Pd,"__type","hyperlink");var LS=Pd,ic=LS;d();d();function yf(e){return typeof e=="string"?e:e.id}function RS(e){return Array.isArray(e)&&Number.isFinite(e[0])&&Number.isFinite(e[1])}var _S=8,qi=e=>typeof e=="number"?e.toFixed(_S):RS(e)?e[1].toFixed(_S)+"-"+e[0].toFixed(_S):e.map(r=>qi(r)).join("-"),UV=/^https:\/\/cdn\.mappedin\.com\/category-symbols\/.+$/,VV=/^https:\/\/cdn-staging\.mappedin\.net\/category-symbols\/.+$/,$V=e=>UV.test(e)||VV.test(e),HV=/^https:\/\/cdn\.mappedin\.com\/[^/]+\/[^/]+\.[a-zA-Z0-9]+$/,zV=/^https:\/\/cdn-staging\.mappedin\.net\/[^/]+\/[^/]+\.[a-zA-Z0-9]+$/,WV=e=>$V(e)?!1:HV.test(e)||zV.test(e),l1=e=>{if(!WV(e))return null;let r="";e.startsWith("https://")?(r="https://",e=e.slice(8)):e.startsWith("http://")&&(r="http://",e=e.slice(7));let[t,o,n]=e.split("/"),i=n.split(".").pop()??"";return{origin:r+t,mapId:o,fileName:n,fileType:i}};var bf,nl,sc,Fd=class Fd extends xr{constructor(t){super(String(ut()));m(this,"__type",Fd.__type);S(this,bf,{});S(this,nl);S(this,sc);w(this,nl,t.mvfData),w(this,sc,t.mapData)}static is(t){return t.__type===Fd.__type}get url(){let t=s(this,nl).url;if(s(this,sc).tokenManager==null)return t;let o=l1(s(this,nl).url);if(o==null)return t;let n=o.mapId;try{if(s(this,sc).tokenManager.isEnterpriseMode())return t;let i=s(this,sc).tokenManager.getSasToken(n).token;if(i==null||i==="")throw new Error("SAS token empty!");return`${t}?${i}`}catch(i){return o.fileType!=="svg"&&A.error("Error getting SAS token for image",{error:i,url:t}),t}}get name(){return s(this,nl).altText}get altText(){return s(this,nl).altText}toJSON(){return{__type:Fd.__type,id:this.id,url:this.url,name:this.name}}destroy(){for(let t of globalThis.Object.keys(s(this,bf)))delete s(this,bf)[t]}};bf=new WeakMap,nl=new WeakMap,sc=new WeakMap,m(Fd,"__type","image");var BS=Fd,ac=BS;d();var lc,si=class{constructor(r,t){m(this,"id");S(this,lc);this.id=r}get geoJSONBoundingBox(){return s(this,lc)?s(this,lc):"bbox"in this.geoJSON.geometry&&this.geoJSON.geometry.bbox?this.geoJSON.geometry.bbox:(w(this,lc,vp(this.geoJSON)),s(this,lc))}get geoJSON(){return{properties:null,type:"Feature",geometry:{type:"Polygon",coordinates:[[]]}}}};lc=new WeakMap;var Dd,ea,ta,Zr=class extends si{constructor(t,o){super(o.properties.id,t);S(this,Dd);S(this,ea);S(this,ta,{});w(this,Dd,t),w(this,ea,o)}get externalId(){return s(this,ea).properties.externalId??""}get name(){let t=s(this,ea).properties.details?.name??"";return t===""&&(t=this.locationProfiles.find(o=>o.name&&o.name.length>0)?.name??""),t}get description(){let t=s(this,ea).properties.details?.description??"";return t===""&&(t=this.locationProfiles.find(o=>o.description&&o.description.length>0)?.description??""),t}get images(){if(s(this,ta).images!=null)return s(this,ta).images;let t=s(this,ea).properties.details?.images?.map(o=>new ac({mvfData:o,mapData:s(this,Dd)}))??[];return(t==null||t.length===0)&&(t=this.locationProfiles.find(o=>o.images.length>0)?.images??[]),s(this,ta).images=t,t}get links(){if(s(this,ta).links!=null)return s(this,ta).links;let t=s(this,ea).properties.details?.links?.map(o=>new ic({mvfData:o}))??[];return(t==null||t.length===0)&&(t=this.locationProfiles.find(o=>o.links.length>0)?.links??[]),s(this,ta).links=t,t}get locationProfiles(){return s(this,Dd).locationProfilesByAttachedFeatureId[this.id]??[]}};Dd=new WeakMap,ea=new WeakMap,ta=new WeakMap;var xf,cc,Ad,Ld,kd=class kd extends Zr{constructor(t,o){super(t,o.mvfData);m(this,"__type",kd.__type);S(this,xf);S(this,cc);S(this,Ad,{});S(this,Ld);w(this,xf,t),w(this,cc,o.floorId),w(this,Ld,o.mvfData)}static is(t){return t.__type===kd.__type}get center(){return s(this,Ad).center==null&&(s(this,Ad).center=Dr(s(this,Ld),s(this,cc))),s(this,Ad).center}get floor(){let t=s(this,xf).getById("floor",s(this,cc));if(t==null)throw new Error(`Floor ${s(this,cc)} not found!`);return t}get geoJSON(){return{...s(this,Ld),properties:null}}get focusTarget(){return this}get anchorTarget(){return this.center}toJSON(){return{__type:kd.__type,id:this.id,name:this.name,floor:this.floor.id}}destroy(){}};xf=new WeakMap,cc=new WeakMap,Ad=new WeakMap,Ld=new WeakMap,m(kd,"__type","area");var NS=kd,ai=NS;d();var pc,ra,dc,uc,_d=class _d extends Zr{constructor(t,o){super(t,o.mvfData);m(this,"__type",_d.__type);S(this,pc);S(this,ra);S(this,dc);S(this,uc);w(this,ra,{}),w(this,uc,o.mvfData),w(this,pc,t),w(this,dc,o.floorId)}static is(t){return t.__type===_d.__type}get floor(){let t=s(this,pc).getById("floor",s(this,dc));if(t==null)throw new Error(`Floor ${s(this,dc)} not found!`);return t}get center(){return s(this,ra).center==null&&(s(this,ra).center=Dr(s(this,uc),s(this,dc))),s(this,ra).center}get isExterior(){if(s(this,uc).properties.isExterior)return!0;let t=s(this,pc).obstructionIdByEntranceId[this.id];return s(this,pc).getMVFFeatureById("obstruction",t)?.properties.footprintComponent??!1}get geoJSON(){return{...s(this,uc),properties:null}}get focusTarget(){return this.center}get anchorTarget(){return this.center}toJSON(){return{__type:_d.__type,id:this.id,name:this.name,floor:this.floor.id,center:this.center.toJSON()}}destroy(){for(let t of Object.keys(s(this,ra)))delete s(this,ra)[t]}};pc=new WeakMap,ra=new WeakMap,dc=new WeakMap,uc=new WeakMap,m(_d,"__type","door");var jS=_d,go=jS;d();var il,mc,on,oa,Rd=class Rd extends Zr{constructor(t,o){super(t,o.mvfData);m(this,"__type",Rd.__type);S(this,il);S(this,mc);S(this,on,{});S(this,oa);w(this,il,t),w(this,mc,o.floorId),w(this,oa,o.mvfData)}static is(t){return t.__type===Rd.__type}get type(){return XV(s(this,oa).properties.kind)}get locations(){if(s(this,on).locations)return s(this,on).locations;s(this,on).locations=[];let t=s(this,il).mvfLocationsBySpaceId[s(this,oa).properties.id];if(t?.length>0)for(let o of t){let n=s(this,il).getById("enterprise-location",o.id);n&&s(this,on).locations.push(n)}return s(this,on).locations}get floor(){let t=s(this,il).getById("floor",s(this,mc));if(t==null)throw new Error(`Floor ${s(this,mc)} not found!`);return t}get doors(){return s(this,oa).properties.destinationNodes.reduce((t,o)=>{let n=s(this,il).doorsByNodeId[o];return n&&t.push(n),t},[])}get center(){return s(this,on).center==null&&(s(this,on).center=Dr(s(this,oa),s(this,mc))),s(this,on).center}get geoJSON(){return{...s(this,oa),properties:null}}get focusTarget(){return this.geoJSON.geometry.type==="Polygon"?this:this.center}get anchorTarget(){return this.center}toJSON(){return{__type:Rd.__type,id:this.id,name:this.name,type:this.type,floor:this.floor.id,center:this.center.toJSON()}}destroy(){for(let t of Object.keys(s(this,on)))delete s(this,on)[t]}};il=new WeakMap,mc=new WeakMap,on=new WeakMap,oa=new WeakMap,m(Rd,"__type","space");var GS=Rd,ZV=["room","hallway","exterior","void","gate"];function XV(e){if(e==null||e==="default")return"room";let r=e.toLowerCase();return ZV.includes(r)?r:"room"}var vr=GS;d();var On,yt,nn,Nd,c1,Bd=class Bd extends si{constructor(t,o){super(o.mvfData.properties.id,t);S(this,Nd);m(this,"__type",Bd.__type);S(this,On);S(this,yt,{});S(this,nn);w(this,On,t),w(this,nn,o.mvfData)}static is(t){return t.__type===Bd.__type}get focusTarget(){return this}get name(){if(!("name"in s(this,nn).properties))return s(this,nn).properties.externalId??"";let t=W(this,Nd,c1).call(this,"name");return typeof t=="string"?t:""}get shortName(){if(!("shortName"in s(this,nn).properties))return s(this,nn).properties.externalId??"";let t=W(this,Nd,c1).call(this,"shortName");return typeof t=="string"?t:""}get subtitle(){let t=W(this,Nd,c1).call(this,"subtitle");return typeof t=="string"?t:""}get externalId(){return s(this,nn).properties.externalId??""}get elevation(){return s(this,nn).properties.elevation}get spaces(){if(s(this,yt).spaces==null){let t=s(this,On).spaces.filter(o=>o.floor.id===this.id);s(this,yt).spaces=t}return s(this,yt).spaces}get geoJSON(){return{type:"Feature",properties:null,geometry:s(this,nn).geometry??{type:"Polygon",coordinates:[]}}}get objects(){if(s(this,yt).objects==null){let t=s(this,On).objects.filter(o=>o.floor.id===this.id);s(this,yt).objects=t}return s(this,yt).objects}get connections(){if(s(this,yt).connections==null){let t=s(this,On).connections.filter(o=>o.floors.includes(this));s(this,yt).connections=t}return s(this,yt).connections}get doors(){if(s(this,yt).doors==null){let t=s(this,On).doors.filter(o=>o.floor.id===this.id);s(this,yt).doors=t}return s(this,yt).doors}get annotations(){if(s(this,yt).annotations==null){let t=s(this,On).annotations.filter(o=>o.floor.id===this.id);s(this,yt).annotations=t}return s(this,yt).annotations}get pois(){if(s(this,yt).pois==null){let t=s(this,On).pointsOfInterest.filter(o=>o.floor.id===this.id);s(this,yt).pois=t}return s(this,yt).pois}get floorStack(){if(s(this,yt).floorStack==null){let t=s(this,On).floorStacks.find(o=>o.floors.includes(this));s(this,yt).floorStack=t}return s(this,yt).floorStack}get center(){return s(this,yt).center==null&&(s(this,yt).center=Dr(s(this,nn),this.id)),s(this,yt).center}toJSON(){return{__type:Bd.__type,id:this.id,name:this.name,shortName:this.shortName,subtitle:this.subtitle,elevation:this.elevation,spaces:this.spaces.map(t=>t.id),objects:this.objects.map(t=>t.id),connections:this.connections.map(t=>t.id),doors:this.doors.map(t=>t.id),annotations:this.annotations.map(t=>t.id),pois:this.pois.map(t=>t.id)}}destroy(){for(let t of globalThis.Object.keys(s(this,yt)))delete s(this,yt)[t]}};On=new WeakMap,yt=new WeakMap,nn=new WeakMap,Nd=new WeakSet,c1=function(t){let o=s(this,nn).properties[t];return s(this,On).getPropTranslation(this.__type,t,this.id,o)},m(Bd,"__type","floor");var US=Bd,Bo=US;d();d();d();function jd(e){let r;if(vr.is(e)||go.is(e)||No.is(e)||ai.is(e)||Ar.is(e))r=e.center;else if(sn.is(e)||na.is(e))r=e.coordinate;else if(fe.is(e))r=e;else if(wn.is(e))r=e.coordinate;else if(es.is(e))r=e.coordinates[0];else return;return r}d();d();var vf={debug:!1,pitch:45,bearing:0,antialiasing:{enabled:!0},shadingAndOutlines:!0,outdoorView:{layersHiddenByGeometry:["building","building-top"]},imagePlacementOptions:{mode:"default"},flipImagesToFaceCamera:!0,multiFloorView:{enabled:!0,floorGap:10}},ts="ExteriorWalls",sl="Walls",D5=0,Gd="InteriorDoors",Ud="ExteriorDoors",rr="GeometryLayer",rs="LabelsLayer",li="MarkersLayer",Vd="FootprintLayer",al="OcclusionLayer",VS="AreasLayer",$d="ImagesLayer",fc="FacadesLayer",os="PathsLayer";var k5=["https://mappedin.auth0.com","https://mappedin-staging.auth0.com","https://staging.mappedin.com","https://mappedin-staging.auth0.com/userinfo","https://mappedin.com","https://mappedin.auth0.com/userinfo"],YV={orange:"#F26336",teal:"#057685",lightTeal:"#5DC7D0"};var JV=new Set(["outdoorView","bearing","pitch","zoomLevel","screenOffsets","debug","initialFloor","shadingAndOutlines","wallTopColor","style","multiFloorView","occlusion","imagePlacementOptions","flipImagesToFaceCamera","injectStyles","useStandaloneCamera","preloadFloors"]),KV=new Set(["style","enabled","layersHiddenByGeometry","lowDpi"]);function $S(e){e.outdoorView?.enabled&&!e.outdoorView?.token&&A.error("Enable outdoor view requires a token. Provide token in `options.outdoorView.token`")}function HS(e,r){let t=e?.outdoorView?.token||r.outdoorViewToken,o={...vf,...e,outdoorView:{enabled:e?.outdoorView?.enabled===void 0?!!t:e?.outdoorView?.enabled,layersHiddenByGeometry:vf.outdoorView?.layersHiddenByGeometry,...e?.outdoorView},bearing:e?.bearing??r.naturalBearing??0,imagePlacementOptions:{...vf.imagePlacementOptions,...e?.imagePlacementOptions},multiFloorView:{...vf.multiFloorView,...e?.multiFloorView}};return t&&o.outdoorView&&(o.outdoorView.token=t),o}function A5(e){let r={remove_watermark:!1};if(e)try{let t=ty(e);Object.assign(r,t.capabilities)}catch(t){A.error("Error decoding capabilities from token",t)}return r}function L5(e){let r=Object.fromEntries(Object.entries(e).filter(([t])=>JV.has(t)));return r.outdoorView&&(r.outdoorView=Object.fromEntries(Object.entries(r.outdoorView).filter(([t])=>KV.has(t)))),r}var ll,En,ia,Hd=class Hd extends Zr{constructor(t,o){let n=Object.values(o.mvfDataByFloorId)[0];super(t,n);m(this,"__type",Hd.__type);S(this,ll);S(this,En);S(this,ia);w(this,En,{}),w(this,ll,t),w(this,ia,o.mvfDataByFloorId)}static is(t){return t.__type===Hd.__type}get accessible(){return Object.values(s(this,ia))[0].properties.accessible??!1}get type(){return Object.values(s(this,ia))[0].properties.kind?.split(".")[1]??"unknown"}get extra(){return Object.values(s(this,ia))[0].properties.extra}get coordinates(){return s(this,En).coordinates==null&&(s(this,En).coordinates=Object.entries(s(this,ia)).map(([t,o])=>Dr(o,t))),s(this,En).coordinates}get nodes(){return Object.values(s(this,ia))[0].properties.nodes.map(t=>s(this,ll).getById("node",t))}get floors(){return this.coordinates.map(t=>t.floorId?s(this,ll).getById("floor",t.floorId):void 0).filter(xm)}get locationProfiles(){if(s(this,En).locationProfiles!=null)return s(this,En).locationProfiles;let t=super.locationProfiles;if(t==null||t.length===0){let o=[this.coordinates[0]?.longitude??0,this.coordinates[0]?.latitude??0],n=qi(o),i=s(this,ll).mvfConnectionIdsByLatLon[n]??[];for(let a of i){let l=s(this,ll).locationProfilesByAttachedFeatureId[a];if(l!=null){t=l;break}}}return s(this,En).locationProfiles=t??[],t}get focusTarget(){return this.coordinates}toJSON(){return{__type:Hd.__type,id:this.id,name:this.name,type:this.type,externalId:this.externalId,coordinates:this.coordinates.map(t=>t.toJSON()),floors:this.floors.map(t=>t.id),extra:this.extra}}destroy(){for(let t of Object.keys(s(this,En)))delete s(this,En)[t]}};ll=new WeakMap,En=new WeakMap,ia=new WeakMap,m(Hd,"__type","connection");var zS=Hd,an=zS;d();var If,hc,cl,gc,zd=class zd extends Zr{constructor(t,o){super(t,o.mvfData);m(this,"__type",zd.__type);S(this,If);S(this,hc);S(this,cl,{});S(this,gc);w(this,If,t),w(this,hc,o.floorId),w(this,gc,o.mvfData)}static is(t){return t.__type===zd.__type}get type(){let t=s(this,gc).properties.kind;return t==null&&(t="object"),t==="Desks"&&(t="desk"),t.toLowerCase()}get floor(){let t=s(this,If).getById("floor",s(this,hc));if(t==null)throw new Error(`Floor ${s(this,hc)} not found!`);return t}get center(){return s(this,cl).center==null&&(s(this,cl).center=Dr(s(this,gc),s(this,hc))),s(this,cl).center}get geoJSON(){return{...s(this,gc),properties:null}}get anchorTarget(){return this.center}get focusTarget(){return this.geoJSON.geometry.type==="Polygon"?this:this.center}toJSON(){return{__type:zd.__type,id:this.id,name:this.name,type:this.type,floor:this.floor.id,center:this.center.toJSON()}}destroy(){for(let t of globalThis.Object.keys(s(this,cl)))s(this,cl)[t]=null}};If=new WeakMap,hc=new WeakMap,cl=new WeakMap,gc=new WeakMap,m(zd,"__type","object");var WS=zd,No=WS;d();var Sf,yc,pl,Zd,Wd=class Wd extends Zr{constructor(t,o){super(t,o.mvfData);m(this,"__type",Wd.__type);S(this,Sf);S(this,yc);S(this,pl,{});S(this,Zd);w(this,Sf,t),w(this,Zd,o.mvfData),w(this,yc,o.floorId)}static is(t){return t.__type===Wd.__type}get floor(){let t=s(this,Sf).getById("floor",s(this,yc));if(t==null)throw new Error(`Floor ${s(this,yc)} not found!`);return t}get coordinate(){return s(this,pl).coordinate==null&&(s(this,pl).coordinate=Dr(s(this,Zd),s(this,yc))),s(this,pl).coordinate}get geoJSON(){return{...s(this,Zd),properties:null}}get focusTarget(){return this.coordinate}get anchorTarget(){return this.coordinate}toJSON(){return{__type:Wd.__type,id:this.id,name:this.name,floor:this.floor.id,coordinate:this.coordinate.toJSON()}}destroy(){for(let t in s(this,pl))s(this,pl)[t]=null}};Sf=new WeakMap,yc=new WeakMap,pl=new WeakMap,Zd=new WeakMap,m(Wd,"__type","point-of-interest");var ZS=Wd,sn=ZS;d();var Tf,bc,dl,xc,Cf,YS,Xd=class Xd extends Zr{constructor(t,o){super(t,o.mvfData);S(this,Cf);m(this,"__type",Xd.__type);S(this,Tf);S(this,bc);S(this,dl,{});S(this,xc);w(this,Tf,t),w(this,bc,o.floorId),w(this,xc,o.mvfData)}static is(t){return t.__type===Xd.__type}get group(){return W(this,Cf,YS).call(this).group}get type(){return W(this,Cf,YS).call(this).type}get coordinate(){return s(this,dl).coordinate==null&&(s(this,dl).coordinate=Dr(s(this,xc),s(this,bc))),s(this,dl).coordinate}get floor(){let t=s(this,Tf).getById("floor",s(this,bc));if(t==null)throw new Error(`Floor ${s(this,bc)} not found!`);return t}get geoJSON(){return{...s(this,xc),properties:null}}get focusTarget(){return this.coordinate}get anchorTarget(){return this.coordinate}toJSON(){return{__type:Xd.__type,id:this.id,group:this.group,type:this.type,coordinate:this.coordinate.toJSON()}}destroy(){for(let t of Object.keys(s(this,dl)))delete s(this,dl)[t]}};Tf=new WeakMap,bc=new WeakMap,dl=new WeakMap,xc=new WeakMap,Cf=new WeakSet,YS=function(){let[t,o]=s(this,xc).properties.symbolId.split("--");return{group:t,type:o}},m(Xd,"__type","annotation");var XS=Xd,na=XS;d();var ul,Pn,ci,Jd,Mf,KS,Yd=class Yd extends si{constructor(t,o){super(o.mvfData.id,t);S(this,Mf);m(this,"__type",Yd.__type);S(this,ul);S(this,Pn,{});S(this,ci);S(this,Jd);w(this,ul,t),w(this,ci,o.mvfData),w(this,Jd,o.facadeId)}static is(t){return t.__type===Yd.__type}get type(){return s(this,ci).type}get name(){let t=W(this,Mf,KS).call(this,"name");return typeof t=="string"?t:""}get shortName(){let t=W(this,Mf,KS).call(this,"shortName");return typeof t=="string"?t:""}get externalId(){return s(this,ci).externalId??""}get floors(){if(s(this,Pn).floors==null){let t=(s(this,ci).floors??s(this,ci).maps??[]).reduce((o,n)=>{let i=s(this,ul).floorsById[n];return i&&o.push(i),o},[]);t.length===0&&A.error(`Floor stack ${this.id} has no floors`),s(this,Pn).floors=t.sort((o,n)=>o.elevation-n.elevation)}return s(this,Pn).floors}get defaultFloor(){if(s(this,Pn).defaultFloor!=null)return s(this,Pn).defaultFloor;let t=s(this,ci).defaultFloor?s(this,ul).getById("floor",s(this,ci).defaultFloor):void 0;return s(this,Pn).defaultFloor=t||this.floors.reduce((o,n)=>Math.abs(n.elevation)<Math.abs(o.elevation)?n:o),s(this,Pn).defaultFloor}get facade(){return s(this,Jd)?s(this,ul).facadesById[s(this,Jd)]:void 0}toJSON(){return{__type:Yd.__type,id:this.id,name:this.name,shortName:this.shortName,type:this.type,floors:this.floors.map(t=>t.id)}}destroy(){for(let t of globalThis.Object.keys(s(this,Pn)))delete s(this,Pn)[t]}};ul=new WeakMap,Pn=new WeakMap,ci=new WeakMap,Jd=new WeakMap,Mf=new WeakSet,KS=function(t){return s(this,ul).getPropTranslation(this.__type,t,this.id,s(this,ci)[t])},m(Yd,"__type","floor-stack");var JS=Yd,p1=JS;d();var Qd,vc,qd,ns,Kd=class Kd extends si{constructor(t,o){super(o.mvfData.id,t);m(this,"__type",Kd.__type);S(this,Qd);S(this,vc);S(this,qd);S(this,ns,{});w(this,Qd,o.mvfData),w(this,vc,t),w(this,qd,o.floorStackId)}static is(t){return t.__type===Kd.__type}get floorStack(){return s(this,vc).getById("floor-stack",s(this,qd))}get spaces(){if(!s(this,ns).spaces){s(this,ns).spaces=[];for(let t of s(this,Qd).spaces){let o=s(this,vc).getById("space",t.spaceId);o&&s(this,ns).spaces.push(o)}}return s(this,ns).spaces}get center(){if(!s(this,ns).center){let t={type:"FeatureCollection",features:[]};for(let n of this.spaces){let i=s(this,vc).mvfSpacesById[n.id];i&&t.features.push(i)}if(t.features.length===0)throw new wr("No geometry found for facade!");let o=Cd(t);s(this,ns).center=new fe({latitude:o.geometry.coordinates[1],longitude:o.geometry.coordinates[0],floorId:s(this,Qd).spaces[0].floorId})}return s(this,ns).center}get focusTarget(){return this.spaces}get anchorTarget(){return this.center}toJSON(){return{id:this.id,__type:Kd.__type,floorStackId:s(this,qd),floorStack:this.floorStack,spaces:this.spaces}}};Qd=new WeakMap,vc=new WeakMap,qd=new WeakMap,ns=new WeakMap,m(Kd,"__type","facade");var QS=Kd,Ar=QS;d();var QV=new Set(["wall","area"]),qV=new Set(["void","desk-entrance"]),e$=(e,r)=>{let t={},o={},n={},i={},a={},l={};for(let c of e["location.json"]||[]){let p=new Ic(r,{mvfData:c});if(t[c.id]=p,c.externalId&&(i[c.externalId]==null&&(i[c.externalId]=[]),i[c.externalId].push(p)),c.categories)for(let f of c.categories)a[f]==null&&(a[f]=[]),a[f].push(p);let u=[...c.obstructions?.map(f=>f.id)??[],...c.spaces?.map(f=>f.id)??[],...c.annotations?.map(f=>f.id)??[],...c.connections??[],...c.entrances?.map(f=>f.id)??[],...c.areas?.map(f=>f.id)??[]];for(let f of u)f&&(l[f]==null&&(l[f]=[]),l[f].push(p))}for(let c of e["category.json"]||[]){let p=new u1(r,{mvfData:c});o[c.id]=p,c.parent&&(n[c.parent]==null&&(n[c.parent]=[]),n[c.parent].push(p))}return{locationCategoriesByParentId:n,locationProfilesById:t,locationCategoriesById:o,locationProfilesByExternalId:i,locationProfilesByCategoryId:a,locationProfilesByAttachedFeatureId:l}},t$=(e,r,t)=>{let o={},n={},i={},a={},l={},c={},p={},u={},f={},h={},b={},x=globalThis.Object.keys(e.space);for(let T of x){let v=e.space[T];if(v!=null){for(let I of v.features)if(b[I.properties.id]=T,c[I.properties.id]=I,I.properties.kind==="desk-entrance"&&(l[I.properties.externalId]==null&&(l[I.properties.externalId]=[]),l[I.properties.externalId].push(...I.properties.destinationNodes)),!f$(I)){if(I.properties.kind?.includes("connection")){let M=qi(I.geometry.coordinates);f[M]==null&&(f[M]=[]),f[M].push(I.properties.id);continue}if(I.properties.kind==="poi"||I.geometry.type==="Point"&&I.properties.kind==null){let M=new sn(t,{floorId:T,mvfData:I});i[I.properties.id]=M,u[T]||(u[T]=[]),u[T].push(I),I.properties.externalId&&(a[I.properties.externalId]==null&&(a[I.properties.externalId]=[]),a[I.properties.externalId].push(M))}else if(I.geometry.type==="Point")A.warn("Encountered a point space with an unknown kind!",I.properties.kind);else{let M=new vr(t,{floorId:T,mvfData:I});o[I.properties.id]=M,I.properties.externalId&&(n[I.properties.externalId]==null&&(n[I.properties.externalId]=[]),n[I.properties.externalId].push(M)),p[T]||(p[T]=[]),p[T].push(I)}}}}for(let T in f){let v=f[T],I={};for(let O of v){let C=b[O],E=c[O],_=r?.["n_"+E.properties.id.split("s_")[1]];I[C]={...E,properties:{...E.properties,accessible:_?.accessible===!0}}}let M=new an(t,{mvfDataByFloorId:I});h[M.id]=M}return{spacesById:o,spacesByExternalId:n,poisById:i,poisByExternalId:a,connectionsById:h,objectEntranceNodeIdsByObstructionId:l,mvfSpacesById:c,connectionIdsByLatLon:f,mvfSpacesByFloorId:p,mvfPoisByFloorId:u}},r$=(e,r)=>{let t={},o={},n={},i={};for(let a of e["node.geojson"].features){n[a.properties.id]=a;let l=new wn(r,{mvfData:a,floorId:a.properties.floor??a.properties.map});t[a.properties.id]=l,a.properties.externalId&&(o[a.properties.externalId]==null&&(o[a.properties.externalId]=[]),o[a.properties.externalId].push(l));let c=a.properties.floor??a.properties.map;i[c]||(i[c]=[]),i[c].push(a)}return{nodesById:t,nodesByExternalId:o,mvfNodesById:n,mvfNodesByFloorId:i}},o$=(e,r)=>{let t={},o={},n={},i={},a=globalThis.Object.keys(e.obstruction);for(let l of a){let c=e.obstruction[l];if(c!=null)for(let p of c.features){n[p.properties.id]=p;for(let f of p.properties.entrances)i[f]=p.properties.id;if(QV.has(p.properties.kind?.toLowerCase()??""))continue;let u=new No(r,{floorId:l,mvfData:p});t[p.properties.id]=u,p.properties.externalId&&(o[p.properties.externalId]==null&&(o[p.properties.externalId]=[]),o[p.properties.externalId].push(u))}}return{objectsById:t,objectsByExternalId:o,mvfObstructionById:n,obstructionIdByEntranceId:i}},n$=(e,r)=>{let t={},o={},n={};if("floor.geojson"in e&&e["floor.geojson"]!=null)for(let i of e["floor.geojson"].features){n[i.properties.id]=i.properties;let a=new Bo(r,{mvfData:i});t[i.properties.id]=a,i.properties.externalId&&(o[i.properties.externalId]==null&&(o[i.properties.externalId]=[]),o[i.properties.externalId].push(a))}else for(let i of e["map.geojson"]){n[i.id]=i;let a=new Bo(r,{mvfData:{properties:i}});t[i.id]=a}return{floorsById:t,floorsByExternalId:o,mvfFloorsById:n}},i$=(e,r)=>{let t={},o={},n={},i={},a={},l=e["floorstack.json"]||e["mapstack.json"]||e["mapstack.geojson"];if(l!=null)for(let c of l){let p=e.facade?.[c.id],u=new p1(r,{mvfData:c,facadeId:p?.id});if(t[c.id]=u,c.externalId&&(o[c.externalId]==null&&(o[c.externalId]=[]),o[c.externalId].push(u)),n[c.id]=c,p){let f=new Ar(r,{mvfData:p,floorStackId:c.id});i[p.id]=f;for(let h of p.spaces)a[h.spaceId]=f}}return{floorStacksById:t,floorStacksByExternalId:o,mvfFloorStacksById:n,facadesById:i,facadesBySpaceId:a}},s$=(e,r)=>{let t={},o={},n=e["connection.json"].reduce((i,a)=>{a.nodes.forEach(c=>i[c]=a),t[a.id]=a;let l=r?.[a.nodes[0]];if(l!=null){let c=qi(l.geometry.coordinates);o[c]==null&&(o[c]=[]),o[c].push(a.id)}return i},{});return{mvfConnectionsById:t,mvfConnectionsByNodeId:n,mvfConnectionIdsByLatLon:o}},a$=(e,r)=>{let t={},o={},n={},i={},a={},l=globalThis.Object.keys(e.entrance);for(let c of l){let p=e.entrance[c];if(p!=null)for(let u of p.features){i[u.properties.id]=u;let f=new go(r,{floorId:c,mvfData:u});u.properties.node&&(n[u.properties.node]=f),t[u.properties.id]=f,u.properties.externalId&&(o[u.properties.externalId]==null&&(o[u.properties.externalId]=[]),o[u.properties.externalId].push(f)),a[c]||(a[c]=[]),a[c].push(u)}}return{doorsById:t,doorsByExternalId:o,doorsByNodeId:n,mvfEntrancesById:i,mvfEntrancesByFloorId:a}},l$=(e,r,t)=>{if(e.textAreas!=null)for(let o in e.textAreas){let n=e.textAreas[o]?.features;if(n!=null){for(let i of n)if("anchorId"in i.properties){let a=i?.properties,l=r[a.anchorId]||t[a.anchorId];if(l!=null&&a!=null){let c=l.properties;c.textArea=a,c.textArea&&(c.textArea.position=i.geometry.coordinates)}}}}},c$=(e,r,t)=>{if(e.floorImages!=null)for(let o in e.floorImages){let n=e.floorImages[o]?.features;if(n!=null){for(let i of n)if("anchorId"in i.properties){let a=i?.properties,l=r[a.anchorId]||t[a.anchorId];if(l!=null&&a!=null){let c=l.properties;c.image=a,c.image&&(c.image.position=i.geometry.coordinates)}}}}},p$=(e,r)=>{if(e.enterprise?.enterpriseStyles==null)return;let t=e.enterprise?.enterpriseStyles;for(let o in t){let n=t[o];n.geometryAnchors.forEach(i=>{let a=r[i.geometryId];if(a!=null){let l=a.properties;l.style={styleId:o,edgeOffset:n.edgeOffset}}})}},d$=(e,r,t)=>{if(!(e.enterprise==null||e.enterprise.textures==null))for(let o of e.enterprise.textures)for(let n of o.geometryAnchors){let i=r[n.geometryId]||t[n.geometryId];if(i!=null){let a=i.properties;a.textures==null&&(a.textures=[]),a.textures.push(o)}}},u$=(e,r)=>{let t={},o={},n={};if(e.annotation==null)return{annotationsById:t,mvfAnnotationsById:o,mvfAnnotationsByFloorId:n};let i=globalThis.Object.keys(e.annotation);for(let a of i){let l=e.annotation[a];if(l!=null)for(let c of l.features){o[c.properties.id]=c;let p=new na(r,{floorId:a,mvfData:c});t[c.properties.id]=p,n[a]||(n[a]=[]),n[a].push(c)}}return{annotationsById:t,mvfAnnotationsById:o,mvfAnnotationsByFloorId:n}},m$=(e,r)=>{let t={},o={},n={};if(e.area==null)return{areasById:t,areasByExternalId:o,mvfAreasById:n};let i=globalThis.Object.keys(e.area);for(let a of i){let l=e.area[a];if(l!=null)for(let c of l.features){n[c.properties.id]=c;let p=new ai(r,{floorId:a,mvfData:c});t[c.properties.id]=p,c.properties.externalId&&(o[c.properties.externalId]==null&&(o[c.properties.externalId]=[]),o[c.properties.externalId].push(p))}}return{areasById:t,areasByExternalId:o,mvfAreasById:n}},_5=(e,r)=>{let t={},o={},n={},i={},a=(e.enterprise?.locations??[]).reduce((M,O)=>(M[O.id]=O,M),{}),l={},c={},p={},u={},f={},h={},b=e.enterprise?.venue||{},x={},T={},v={};for(let M of e.enterprise?.categories??[]){let O=new d1(r,{mvfData:M});l[M.id]=O,M.externalId&&(c[M.externalId]==null&&(c[M.externalId]=[]),c[M.externalId].push(O)),p[M.id]=M,M.locations.forEach(C=>{f[C]==null&&(f[C]=[]),f[C].push(M.id)})}let I={};for(let M of e.enterprise?.locationInstances??[]){let O=a[M.parent],C=Object.keys(O),E={};for(let G of C)E[G]=void 0;let _={...E,polygons:[],nodes:[],...M};I[_.parent]==null&&(I[_.parent]=[]),I[_.parent].push(new es(r,{mvfData:_,categoryIds:e.enterprise?.categoryPriorities?.[_.id]||f[_.id],parentId:M.parent})),x[_.id]=M}for(let M in e.space){let O=e.space[M];if(O!=null)for(let C of O.features){for(let E of C.properties.destinationNodes)T[E]==null&&(T[E]=[]),T[E].push(C.properties.id);v[C.properties.id]=C.properties.destinationNodes}}for(let M of e.enterprise?.locations??[]){let O=new es(r,{mvfData:M,categoryIds:e.enterprise?.categoryPriorities?.[M.id]||f[M.id],locationInstances:I[M.id]});n[M.id]=O,M.externalId&&(i[M.externalId]==null&&(i[M.externalId]=[]),i[M.externalId].push(O)),M.nodes.forEach(C=>{h[C.id]==null&&(h[C.id]=[]),h[C.id].push(M.id)});for(let C of M.polygons)u[C.id]==null&&(u[C.id]=[]),u[C.id].push(M)}if(r.enterpriseMode===!0){for(let M in r.mvfConnectionsById){let O={},C=r.mvfConnectionsById[M];for(let E of r.mvfConnectionsById[M].nodes){let _=r.nodesById[E];_!=null&&(O[_.floor.id]={type:"Feature",geometry:{type:"Point",coordinates:[_.coordinate.longitude,_.coordinate.latitude]},properties:{id:M,externalId:C.externalId,kind:"enterprise."+C.type,destinationNodes:[],flags:"",type:C.type,nodes:C.nodes,accessible:C.accessible,extra:C.extra,details:C.details}})}Object.keys(O).length>0&&(t[M]=new an(r,{mvfDataByFloorId:O}),C.externalId&&(o[C.externalId]==null&&(o[C.externalId]=[]),o[C.externalId].push(t[M])))}r.connectionsById=t}return{spaceIdsByNodeId:T,connectionsByExternalId:o,locationIdsByNodeId:h,mvfLocationsBySpaceId:u,mvfLocationsById:a,mvfCategoriesById:p,locationsById:n,locationsByExternalId:i,locationInstancesById:x,categoriesById:l,categoriesByExternalId:c,destinationNodesIdsBySpaceId:v,venue:b}},R5=(e,r)=>{let{nodesById:t,nodesByExternalId:o,mvfNodesById:n,mvfNodesByFloorId:i}=r$(e,r),{mvfConnectionsById:a,mvfConnectionsByNodeId:l,mvfConnectionIdsByLatLon:c}=s$(e,n),{spacesById:p,spacesByExternalId:u,poisById:f,poisByExternalId:h,mvfSpacesById:b,objectEntranceNodeIdsByObstructionId:x,connectionsById:T,connectionIdsByLatLon:v,mvfSpacesByFloorId:I,mvfPoisByFloorId:M}=t$(e,l,r),{objectsById:O,objectsByExternalId:C,mvfObstructionById:E,obstructionIdByEntranceId:_}=o$(e,r),{floorsById:G,floorsByExternalId:R,mvfFloorsById:N}=n$(e,r),{floorStacksById:X,floorStacksByExternalId:z,mvfFloorStacksById:ee,facadesById:re,facadesBySpaceId:ue}=i$(e,r),{doorsById:Ce,doorsByExternalId:Oe,doorsByNodeId:Pe,mvfEntrancesById:Fe,mvfEntrancesByFloorId:ce}=a$(e,r),{annotationsById:Ee,mvfAnnotationsById:ye,mvfAnnotationsByFloorId:Ge}=u$(e,r),{areasById:Ie,areasByExternalId:Xe,mvfAreasById:se}=m$(e,r);c$(e,b,E),l$(e,b,E),p$(e,b),d$(e,b,E);let{locationCategoriesByParentId:nt,locationProfilesById:dt,locationCategoriesById:$t,locationProfilesByExternalId:k,locationProfilesByCategoryId:H,locationProfilesByAttachedFeatureId:P}=e$(e,r);return{spacesById:p,spacesByExternalId:u,nodesById:t,nodesByExternalId:o,objectsById:O,objectsByExternalId:C,floorsById:G,floorsByExternalId:R,floorStacksById:X,floorStacksByExternalId:z,facadesById:re,facadesBySpaceId:ue,connectionsById:T,doorsById:Ce,doorsByExternalId:Oe,doorsByNodeId:Pe,poisById:f,poisByExternalId:h,annotationsById:Ee,areasById:Ie,areasByExternalId:Xe,objectEntranceNodeIdsByObstructionId:x,obstructionIdByEntranceId:_,connectionIdsByLatLon:v,locationProfilesById:dt,locationCategoriesById:$t,locationProfilesByExternalId:k,locationProfilesByCategoryId:H,locationCategoriesByParentId:nt,mvfSpacesById:b,mvfNodesById:n,mvfObstructionById:E,mvfFloorsById:N,mvfFloorStacksById:ee,mvfConnectionsById:a,mvfConnectionsByNodeId:l,mvfEntrancesById:Fe,mvfAnnotationsById:ye,mvfNodesByFloorId:i,mvfSpacesByFloorId:I,mvfPoisByFloorId:M,mvfAreasById:se,mvfEntrancesByFloorId:ce,mvfAnnotationsByFloorId:Ge,locationProfilesByAttachedFeatureId:P,mvfConnectionIdsByLatLon:c}};function f$(e){return!["Polygon","MultiPolygon"].includes(e.geometry.type)&&"kind"in e.properties&&e.properties.kind==null||qV.has(e.properties.kind??"")}d();var h$=new Set(["polygons"]),Fn,bt,ao,wf,eu=class eu extends xr{constructor(t,o){super(o.mvfData.externalId);m(this,"__type",eu.__type);m(this,"description");m(this,"name","");m(this,"amenity");m(this,"externalId","");m(this,"extra");m(this,"gallery");m(this,"instances");m(this,"logo");m(this,"operationHours");m(this,"phone");m(this,"picture");m(this,"shortName");m(this,"showFloatingLabelWhenImagePresent");m(this,"showLogo");m(this,"siblingGroups");m(this,"social");m(this,"sortOrder",-1);m(this,"states");m(this,"tags");m(this,"type","");m(this,"hidden",!1);m(this,"primaryCategory");S(this,Fn);S(this,bt,{});S(this,ao);S(this,wf);w(this,Fn,t),w(this,ao,o.mvfData),w(this,wf,o.categoryIds||[]),this.instances=o.locationInstances||[];for(let n in o.mvfData)!h$.has(n)&&!Object.getOwnPropertyDescriptor(Object.getPrototypeOf(this),n)&&Object.defineProperty(this,n,{enumerable:!0,get(){if(o.parentId){let i=s(this,Fn).locationsById[o.parentId];return s(this,ao)[n]!=null?s(this,Fn).getPropTranslation(this.__type,n,s(this,ao).id,s(this,ao)[n]):s(this,Fn).getPropTranslation(this.__type,n,s(this,ao).id,i[n])}return s(this,Fn).getPropTranslation(this.__type,n,s(this,ao).id,s(this,ao)[n])}})}static is(t){return t.__type===eu.__type}get focusTarget(){return this.spaces}get categories(){return s(this,bt).categories?s(this,bt).categories:(s(this,bt).categories=(s(this,wf).map(t=>s(this,Fn).getById("enterprise-category",t))||[]).filter(Boolean),s(this,bt).categories)}get coordinates(){if(s(this,bt).coordinates)return s(this,bt).coordinates;s(this,bt).coordinates=[];for(let t=0;t<this.nodes.length;t++)s(this,bt).coordinates.push(this.nodes[t].coordinate);return s(this,bt).coordinates}get nodes(){if(s(this,bt).nodes)return s(this,bt).nodes;s(this,bt).nodes=[];for(let t=0;t<s(this,ao).nodes.length;t++){let o=s(this,Fn).getById("node",s(this,ao).nodes[t].id);o&&s(this,bt).nodes.push(o)}return s(this,bt).nodes}get points(){if(s(this,bt).points)return s(this,bt).points;s(this,bt).points=[];for(let t=0;t<s(this,ao).spaces.length;t++){let o=s(this,Fn).getById("point-of-interest",s(this,ao).spaces[t].id);o&&s(this,bt).points.push(o)}return s(this,bt).points}get spaces(){if(s(this,bt).spaces)return s(this,bt).spaces;s(this,bt).spaces=[];for(let t=0;t<s(this,ao).polygons.length;t++){let o=s(this,Fn).getById("space",s(this,ao).polygons[t].id);o&&s(this,bt).spaces.push(o)}return s(this,bt).spaces}toJSON(){return{__type:eu.__type,id:this.id,name:this.name}}destroy(){for(let t of Object.keys(s(this,bt)))delete s(this,bt)[t]}};Fn=new WeakMap,bt=new WeakMap,ao=new WeakMap,wf=new WeakMap,m(eu,"__type","enterprise-location");var qS=eu,es=qS;d();var g$=new Set,Sc,yo,is,tu=class tu extends xr{constructor(t,o){super(o.mvfData.externalId);m(this,"__type",tu.__type);m(this,"name","");m(this,"color");m(this,"externalId","");m(this,"extra");m(this,"icon");m(this,"iconFromDefaultList");m(this,"sortOrder",-1);m(this,"picture");S(this,Sc);S(this,yo,{});S(this,is);w(this,Sc,t),w(this,is,o.mvfData);for(let n in o.mvfData)!g$.has(n)&&!Object.getOwnPropertyDescriptor(Object.getPrototypeOf(this),n)&&Object.defineProperty(this,n,{get(){return s(this,Sc).getPropTranslation(this.__type,n,s(this,is).id,s(this,is)[n])}})}static is(t){return t.__type===tu.__type}get children(){if(s(this,yo).children)return s(this,yo).children;s(this,yo).children=[];for(let t=0;t<s(this,is).children.length;t++){let o=s(this,Sc).getById("enterprise-category",s(this,is).children[t]);o&&s(this,yo).children.push(o)}return s(this,yo).children}get locations(){if(s(this,yo).locations)return s(this,yo).locations;s(this,yo).locations=[];for(let t=0;t<s(this,is).locations.length;t++){let o=s(this,Sc).getById("enterprise-location",s(this,is).locations[t]);o&&s(this,yo).locations.push(o)}return s(this,yo).locations}toJSON(){return{__type:tu.__type,id:this.id,name:this.name}}destroy(){for(let t of Object.keys(s(this,yo)))delete s(this,yo)[t]}};Sc=new WeakMap,yo=new WeakMap,is=new WeakMap,m(tu,"__type","enterprise-category");var e2=tu,d1=e2;d();var y$=new Set,Of,ou,ru=class ru extends xr{constructor(t,o){super(o.mvfData.externalId);m(this,"__type",ru.__type);m(this,"countrycode");m(this,"coverImage");m(this,"externalId","");m(this,"defaultLanguage",{code:"en",name:"English"});m(this,"defaultFloor");m(this,"extra");m(this,"icon");m(this,"languages",[]);m(this,"links",[]);m(this,"logo");m(this,"mappedinWebUrl");m(this,"operationHours");m(this,"slug","");m(this,"topLocations");m(this,"tzid");S(this,Of,{});S(this,ou);w(this,ou,o.mvfData);for(let n in o.mvfData)!y$.has(n)&&!Object.getOwnPropertyDescriptor(Object.getPrototypeOf(this),n)&&(this[n]=o.mvfData[n])}static is(t){return t.__type===ru.__type}get name(){return s(this,ou).name??""}get defaultMap(){return s(this,ou).defaultMap??this.defaultFloor??""}toJSON(){return{__type:ru.__type,id:this.id,name:this.name}}destroy(){for(let t of Object.keys(s(this,Of)))delete s(this,Of)[t]}};Of=new WeakMap,ou=new WeakMap,m(ru,"__type","enterprise-venue");var t2=ru,r2=t2;d();d();function Ef(e,r,t=[]){let o={...e};for(let[n,i]of Object.entries(r))if(i!==void 0)if(n in o){let a=n;if(Array.isArray(i)&&i.length>0){let l=b$(i[0],t);if(l){let c=o[a];if(!Array.isArray(c))throw new Error(`Expected array at ${n}, got ${typeof c}`);let p=new Map(i.map(h=>[B5(h,l),h])),f=c.map(h=>{let b=p.get(B5(h,l));return b?Ef(h,b,t):h});o[a]=f}else o[a]=i}else{let l=o[a];typeof l=="object"&&l!==null&&typeof i=="object"&&i!==null?Object.keys(i).length===0?o[a]=i:o[a]=Ef(l,i,t):o[n]=i}}else o[n]=i;return o}function b$(e,r){function t(o){if(typeof o!="object"||o===null)return null;for(let n of r)if(n in o&&typeof o[n]<"u")return[n];if(Array.isArray(o))return null;for(let[n,i]of Object.entries(o)){let a=t(i);if(a)return[n,...a]}return null}return t(e)}function B5(e,r){return r.reduce((t,o)=>{if(t&&typeof t=="object")return t[o]},e)}d();d();d();d();d();var N5=(i=>(i.Departure="Departure",i.TakeConnection="TakeConnection",i.ExitConnection="ExitConnection",i.Turn="Turn",i.Arrival="Arrival",i))(N5||{}),o2=(a=>(a.Straight="Straight",a.Right="Right",a.SlightRight="SlightRight",a.Left="Left",a.SlightLeft="SlightLeft",a.Back="Back",a))(o2||{}),j5=(p=>(p.stairs="stairs",p.elevator="elevator",p.escalator="escalator",p.door="door",p.ramp="ramp",p.slide="slide",p.portal="portal",p.security="security",p.shuttle="shuttle",p))(j5||{}),m1=(t=>(t.Exterior="exterior-walls",t.Interior="interior-walls",t))(m1||{}),f1=(t=>(t.Interior="interior-doors",t.Exterior="exterior-doors",t))(f1||{});function Dn(e){return e.verticalOffset===0?[e.longitude,e.latitude]:[e.longitude,e.latitude,e.verticalOffset]}function x$(e){return new Map(e.map(r=>{let{properties:t}=r,{id:o}=t;return[o,r]}))}var n2=(e,r)=>{let t=x$(r),o={entrances:{type:"FeatureCollection",features:[]},walls:{type:"Feature",properties:{id:e[0].properties.id},geometry:{type:"MultiLineString",coordinates:[]}}};for(let n of e){let i=[n.geometry.coordinates],a=(n.properties.entrances||[]).reduce((l,c)=>(t.has(c)&&l.push(t.get(c)),l),[]);if(a.length){let{entrances:l,obstructions:c}=FS(n,a);i=c.map(p=>p.geometry.coordinates),o.entrances.features.push(...l)}o.walls.geometry.coordinates.push(...i)}return o};function G5(e,r){return((r-e+Math.PI)%(Math.PI*2)+Math.PI*2)%(Math.PI*2)-Math.PI}function U5(e,r){let t="Left";return e<=-Math.PI/4?t="Right":e<=-r?t="SlightRight":e<=r?t="Straight":e<=Math.PI/4?t="SlightLeft":t="Left",t}function V5(e){let r={};for(let t in e){let o=e[t];if(o!=null){if(o.id=t,"polygons"in o)for(let n of o.polygons)r[n]=o;else if("lineStrings"in o)for(let n of o.lineStrings)r[n]=o;else if("points"in o)for(let n of o.points)r[n]=o}}return r}function h1(e,r){return e.reduce((t,o)=>{let n=r[o.properties.id];if(n==null)return t;if("textures"in o.properties&&Array.isArray(o.properties.textures)&&o.properties.textures.length>0){let i={...n,id:n.id+"-textures"};t.set(i,[o])}else t.has(n)||t.set(n,[]),t.get(n).push(o);return t},new Map)}function nu(e,r={}){let t={...e,flipImageToFaceCamera:r?.flipImagesToFaceCamera??!0},o=r?.style?.shading??r?.shadingAndOutlines;if(o===!0?t.shading={start:.1,end:.15,intensity:.4}:typeof o=="object"&&(t.shading={start:o.start,end:o.end,intensity:o.intensity}),t.outline=r?.style?.outlines??r?.shadingAndOutlines,"lineStrings"in e){let n=r?.style?.wallTopColor??r?.wallTopColor;n!=null&&(t.topColor=n)}return t}var $5=(e,r)=>{let o=(r.currentMap?.currentFloor).layers.get(rr);switch(e){case"interior-walls":return o?.layers.get(sl);case"exterior-walls":return o?.layers.get(ts);case"interior-doors":return o?.layers.get(Gd);case"exterior-doors":return o?.layers.get(Ud);default:return typeof e=="string"?e:e.id}};function i2(e){return new Promise(r=>{e.onComplete(r),e.onStop(r)})}function g1(e){return e.bbox?e.bbox:vp(e)}function H5(e,r){return[Math.min(e[0],r[0]),Math.min(e[1],r[1]),Math.max(e[2],r[2]),Math.max(e[3],r[3])]}function s2(e,r,t){return e.floorId&&r.has(e.floorId)?r.get(e.floorId):t}function iu(e){if(vr.is(e)||No.is(e))return e.id}function z5(e,r,t){let o=e.coordinates.length===2&&e.coordinates[0].floorId!==e.coordinates[1].floorId,n=!0;if(o&&e.coordinates[0].floorId!=null&&e.coordinates[1].floorId!=null){let i=r?.getById("floor",e.coordinates[0].floorId),a=r?.getById("floor",e.coordinates[1].floorId);if(i&&a){let l=t.getState(i),c=t.getState(a);l!=null&&c!=null&&(n=l.visible&&c.visible&&l.altitude!==c.altitude)}}else{let i=e.coordinates[0].floorId!=null?r?.getById("floor",e.coordinates[0].floorId):void 0;n=i?t.getState(i)?.visible??!0:!0}return n}function W5(e,r){let t=e.properties.path.split("/"),o=t[t.length-1].split(".")[0],n=atob(o);return"img_"+ny(n).toString()+"-"+r}var Z5=Math.PI*.1,bo,jo,ln,sa,Tc,au,kn,X5,su,Y5,ml=class{constructor(r,t,o,n,i){S(this,kn);m(this,"id");S(this,bo,{});S(this,jo);S(this,ln);m(this,"departure");m(this,"destination");S(this,sa);S(this,Tc);S(this,au);this.id=i?.id??ut(),w(this,jo,t),w(this,ln,r.features),this.departure=o,this.destination=n}get path(){return s(this,ln).map(r=>s(this,jo).getById("node",r.properties.id)).filter(Boolean)}get coordinates(){return s(this,bo).coordinates?s(this,bo).coordinates:(s(this,bo).coordinates=s(this,ln).map(r=>new fe(r.geometry.coordinates[1],r.geometry.coordinates[0],r.properties.groupBy)),s(this,bo).coordinates)}get distance(){return s(this,bo).distance?s(this,bo).distance:(s(this,bo).distance=s(this,ln).reduce((r,t)=>r+(t.properties.distance||0),0),s(this,bo).distance)}get instructions(){if(s(this,ln).length<2)return[];if(s(this,bo).instructions)return s(this,bo).instructions;let r=[],t=0;for(let o=0;o<s(this,ln).length;o++){let n=s(this,ln)[o],i=s(this,ln)[o-1],a=s(this,ln)[o+1],l=new fe(n.geometry.coordinates[1],n.geometry.coordinates[0],n.properties.groupBy),c=W(this,kn,X5).call(this,{prevDirection:i,direction:n,nextDirection:a});t+=i?.properties.distance||0;for(let p of c)p&&(r.push({action:p,distance:t,coordinate:l,node:s(this,jo).getById("node",n.properties.id)}),t=0)}return s(this,bo).instructions=r,s(this,bo).instructions}toJSON(){return{id:this.id,directions:s(this,ln),__type:"directions",from:this.departure,to:this.destination}}};bo=new WeakMap,jo=new WeakMap,ln=new WeakMap,sa=new WeakMap,Tc=new WeakMap,au=new WeakMap,kn=new WeakSet,X5=function(r){let{prevDirection:t,direction:o,nextDirection:n}=r,i=t&&s(this,jo).getById("floor",t.properties.groupBy),a=s(this,jo).getById("floor",o.properties.groupBy),l=n&&s(this,jo).getById("floor",n.properties.groupBy),c=[];t||c.push({type:"Departure"});let p=s(this,jo).getMVFFeatureByNodeId("connection",o.properties.id),u=p?s(this,jo).getById("connection",p.id):void 0,f=p&&p.nodes.length>1,h=s(this,jo).enterpriseMode&&(!o.properties.destination||!p?.nodes.includes(o.properties.destination)||!p?.nodes.includes(o.properties.id));if(p&&!(!f||h))if(!s(this,sa)||s(this,sa)==="exit")c.push(W(this,kn,su).call(this,"TakeConnection",a,l,u,p)),w(this,sa,"take"),w(this,Tc,u),w(this,au,p);else{let x=s(this,jo).getMVFFeatureByNodeId("connection",t?.properties.id??""),T=s(this,jo).getById("connection",x?.id??"");c.push(W(this,kn,su).call(this,"ExitConnection",a,i,T,x)),w(this,sa,"exit"),w(this,Tc,u),w(this,au,p)}else s(this,sa)==="take"?(c.push(W(this,kn,su).call(this,"ExitConnection",a,i,s(this,Tc),s(this,au))),w(this,sa,"exit"),w(this,Tc,u)):l&&a?.id!==l.id?c.push(W(this,kn,su).call(this,"TakeConnection",a,l,u)):i&&i.id!==a?.id?c.push(W(this,kn,su).call(this,"ExitConnection",a,i,u)):c.push(W(this,kn,Y5).call(this,t,o));return n||c.push({type:"Arrival"}),c},su=function(r,t,o,n,i){let a="none",l=t?t.elevation:0;if(l!=null&&o?.elevation!=null){let p=l-o.elevation;p>0?a="down":p<0&&(a="up")}let c=n?.type??i?.type??"stairs";return{type:r,fromFloor:t,toFloor:o,direction:a,connection:n,connectionType:c}},Y5=function(r,t){let o=t.properties.edges;if(!o||o.filter(a=>a.destination.properties.id!==r?.properties.id&&a.destination.properties.id!==t.properties.destination).length===0)return null;let i=r?-G5(r.properties.angle,t.properties.angle):0;return Math.abs(i)>=Z5?{type:"Turn",bearing:U5(i,Z5),referencePosition:"At"}:null};d();d();d();d();d();d();d();var Cc=class{constructor({origin:r,destination:t,distance:o=0,angle:n=0,pathWeight:i=0,multiplicativeDistanceWeightScaling:a=!0}){m(this,"origin");m(this,"destination");m(this,"distance");m(this,"angle");m(this,"weight");if(this.origin=r,this.destination=t,this.distance=o,this.angle=n,this.weight=i||0,a?r.properties.floor===t.properties.floor&&(this.weight=(this.weight>=0?this.distance*this.weight:0)+this.distance):r.properties.map===t.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.")}};d();d();d();function aa(e,r,t){if(t===void 0&&(t={}),!e)throw new Error("point is required");if(!r)throw new Error("polygon is required");var o=Mn(e),n=Td(r),i=n.type,a=r.bbox,l=n.coordinates;if(a&&v$(o,a)===!1)return!1;i==="Polygon"&&(l=[l]);for(var c=!1,p=0;p<l.length&&!c;p++)if(J5(o,l[p][0],t.ignoreBoundary)){for(var u=!1,f=1;f<l[p].length&&!u;)J5(o,l[p][f],!t.ignoreBoundary)&&(u=!0),f++;u||(c=!0)}return c}function J5(e,r,t){var o=!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,i=r.length-1;n<r.length;i=n++){var a=r[n][0],l=r[n][1],c=r[i][0],p=r[i][1],u=e[1]*(a-c)+l*(c-e[0])+p*(e[0]-a)===0&&(a-e[0])*(c-e[0])<=0&&(l-e[1])*(p-e[1])<=0;if(u)return!t;var f=l>e[1]!=p>e[1]&&e[0]<(c-a)*(e[1]-l)/(p-l)+a;f&&(o=!o)}return o}function v$(e,r){return r[0]<=e[0]&&r[1]<=e[1]&&r[2]>=e[0]&&r[3]>=e[1]}d();d();function la([e,r],[t,o]){let n=r-o,i=e-t;return(Math.atan2(i,n)+Math.PI*3)%(Math.PI*2)}d();var I$=63710088e-1;function pi(e,r){let[t,o]=e.map(u=>u*Math.PI/180),[n,i]=r.map(u=>u*Math.PI/180),a=i-o,l=n-t,c=Math.sin(a/2)*Math.sin(a/2)+Math.cos(o)*Math.cos(i)*Math.sin(l/2)*Math.sin(l/2),p=2*Math.atan2(Math.sqrt(c),Math.sqrt(1-c));return I$*p}d();d();function y1(e,r,t,o){let[n,i]=e,[a,l]=r,[c,p]=t,[u,f]=o;if(i===l&&n===a||p===f&&c===u)return null;let h=(u-c)*(l-i)-(f-p)*(a-n);if(h===0)return null;let b=((f-p)*(n-c)-(u-c)*(i-p))/h,x=((l-i)*(n-c)-(a-n)*(i-p))/h;if(b<0||b>1||x<0||x>1)return null;let T=i+b*(l-i);return[n+b*(a-n),T]}d();function a2(e,r,t,o){let n=oc(e,t/1e3,o),i=oc(r,t/1e3,o);return[n.geometry.coordinates,i.geometry.coordinates]}d();function l2(e){let r=e*(180/Math.PI);return r=r%360,r>180?r-=360:r<-180&&(r+=360),Object.is(r,-0)?0:r}var K5=111e3;function b1(e,r,t=[],o=0){let n=!0,i=e.geometry.coordinates,a=r.geometry.coordinates,l=l2(la(i,a)-Math.PI/2),c=l2(la(i,a)+Math.PI/2),p=o/K5,u=o/(K5*Math.cos(i[1]*Math.PI/180)),f=Math.min(i[1],a[1])-p,h=Math.max(i[1],a[1])+p,b=Math.min(i[0],a[0])-u,x=Math.max(i[0],a[0])+u;for(let T of t)if(!(Math.max(T[0][1],T[1][1])<f||Math.min(T[0][1],T[1][1])>h||Math.max(T[0][0],T[1][0])<b||Math.min(T[0][0],T[1][0])>x)){if(o>0){let v=a2(i,a,o,l),I=a2(i,a,o,c);if(y1(v[0],v[1],T[0],T[1])||y1(I[0],I[1],T[0],T[1]))return n=!1,!1}else if(y1(i,a,T[0],T[1]))return n=!1,!1}return n}var p2=.4,Mc,Xr,c2,Q5,q5,eD,tD,rD,oD,v1,x1=class{constructor({nodes:r,groupBy:t,multiplicativeDistanceWeightScaling:o}){S(this,Xr);m(this,"edges",{});m(this,"nodesById");m(this,"nodesByGroup",new Map);S(this,Mc);m(this,"hasLineOfSight",(r,t,o=[],n=p2)=>b1({type:"Feature",properties:{id:"origin",neighbors:[]},geometry:{type:"Point",coordinates:r}},{type:"Feature",properties:{id:"destination",neighbors:[]},geometry:{type:"Point",coordinates:t}},o,n)===!0);S(this,v1,(r,t)=>{let o=0;for(let n of t)(!n[s(this,Mc)]||n[s(this,Mc)]===r.properties[s(this,Mc)])&&aa(r.geometry.coordinates,n.geometry.geometry)&&(o+=Math.max(0,n.cost));return o});w(this,Mc,t);let{features:n}=r;this.nodesById=W(this,Xr,Q5).call(this,n),W(this,Xr,q5).call(this),W(this,Xr,eD).call(this,n,t,{multiplicativeDistanceWeightScaling:o})}getShortestEuclideanDistance(r,t){return t.reduce((o,n)=>{let i=pi(r.geometry.coordinates,n.geometry.coordinates);return Math.min(o,i)},Number.MAX_VALUE)}dijkstraFindWithinTravelDistance(r,t,o,n,i){let a=this.nodesById[r];if(!a)return[];let l=[],c={},p={},u=new Set,f=[];for(l.push({node:a,distance:0}),c[a.properties.id]=null,p[a.properties.id]=0;l.length>0;){l.sort((T,v)=>T.distance-v.distance);let h=l.shift();if(!h)break;let b=h.node,x=h.distance;if(!u.has(b.properties.id)){u.add(b.properties.id),b.properties.id!=null&&o.includes(b.properties.id?.toString())&&(i?this.hasLineOfSight(a.geometry.coordinates,b.geometry.coordinates,n)&&f.push({feature:b,distance:x}):f.push({feature:b,distance:x}));for(let T of this.edges[b.properties.id]){let v=T.destination,I=x+T.distance,M=p[b.properties.id]+T.weight;I>t||u.has(v.properties.id)||p[v.properties.id]!==void 0&&M>=p[v.properties.id]||(p[v.properties.id]=M,c[v.properties.id]=T,l.push({node:v,distance:I}))}}}return f.sort((h,b)=>h.distance-b.distance)}aStar({originIds:r,destinationNodeIds:t,disabledConnectionNodeIds:o,zones:n,overrideEdgeWeights:i}){let a=W(this,Xr,c2).call(this,r),l=W(this,Xr,c2).call(this,t);if(a.length===0||l.length===0)return[];let{frontier:c,cameFrom:p,costSoFar:u}=W(this,Xr,tD).call(this,a,l);for(;c.length>0;){let f=c.shift();if(!f)break;if(W(this,Xr,rD).call(this,f.origin,l))return W(this,Xr,oD).call(this,p,f.origin.properties.id);for(let h of this.edges[f.origin.properties.id]){let b=i?.get(h)??h.weight;if(o?.has(h.origin.properties.id)&&h.destination.properties.map!==h.origin.properties.map)continue;let x=u[f.origin.properties.id]+b+s(this,v1).call(this,h.destination,n);if(x!==1/0&&(u[h.destination.properties.id]==null||x<u[h.destination.properties.id])){let T=x+this.getShortestEuclideanDistance(h.destination,l);u[h.destination.properties.id]=x,p[h.destination.properties.id]=h,c.push({origin:h.destination,priority:T})}}c.sort((h,b)=>h.priority-b.priority)}return[]}};Mc=new WeakMap,Xr=new WeakSet,c2=function(r){return r.map(t=>this.nodesById[t]).filter(Boolean)},Q5=function(r){return r.reduce((t,o)=>(t[o.properties.id]=o,t),{})},q5=function(){for(let r in this.nodesById)this.nodesById.hasOwnProperty(r)&&(this.nodesById[r].properties.neighbors=this.nodesById[r].properties.neighbors.filter(({id:t})=>!!this.nodesById[t]))},eD=function(r,t,o){r.forEach(n=>{let i=t==="default"?t:n.properties[t];this.nodesByGroup.has(i)||this.nodesByGroup.set(i,[]),this.nodesByGroup.get(i).push(n),this.edges[n.properties.id]=n.properties.neighbors.map(({id:a,weight:l})=>{let c=this.nodesById[a],p=pi(n.geometry.coordinates,c.geometry.coordinates),u=la(n.geometry.coordinates,c.geometry.coordinates);return new Cc({origin:n,destination:c,pathWeight:l,distance:p,angle:u,multiplicativeDistanceWeightScaling:o?.multiplicativeDistanceWeightScaling})})})},tD=function(r,t){let o=[],n={},i={};return r.forEach(a=>{let l=this.getShortestEuclideanDistance(a,t);o.push({origin:a,priority:l}),n[a.properties.id]=null,i[a.properties.id]=0}),o.sort((a,l)=>a.priority-l.priority),{frontier:o,cameFrom:n,costSoFar:i}},rD=function(r,t){return t.some(o=>o.properties.id===r.properties.id)},oD=function(r,t){let o=[],n=r[t];for(;n;)o.push(n),n=r[n.origin.properties.id];return o.reverse()},v1=new WeakMap;var lu=class{constructor({nodes:r,geojsonCollection:t,groupBy:o="default",multiplicativeDistanceWeightScaling:n}){m(this,"groupBy");m(this,"graph");m(this,"geometryEdgesByMapId",new Map);m(this,"generatePath",r=>{let{destination:t}=r[r.length-1],o={type:"FeatureCollection",features:[]};for(let i=0;i<r.length;i++){let{origin:a,destination:l}=r[i],c={id:a.properties.id,angle:r[i].angle,distance:r[i].distance,destination:l.properties.id,edges:this.graph.edges[a.properties.id]};this.groupBy!=="default"&&(c.groupBy=a.properties[this.groupBy]),o.features.push({type:"Feature",geometry:{type:"Point",coordinates:[a.geometry.coordinates[0],a.geometry.coordinates[1]]},properties:c})}let n={id:t.properties.id,edges:this.graph.edges[t.properties.id]};return this.groupBy!=="default"&&(n.groupBy=t.properties[this.groupBy]),o.features.push({type:"Feature",geometry:{type:"Point",coordinates:[t.geometry.coordinates[0],t.geometry.coordinates[1]]},properties:n}),o});m(this,"findNearestNodesOnGraph",(r,t,o,n,i=!1)=>this.graph.dijkstraFindWithinTravelDistance(r,t,n,this.geometryEdgesByMapId.get(o)??[],i));m(this,"hasLineOfSight",(r,t,o,n)=>this.graph.hasLineOfSight(r,t,this.geometryEdgesByMapId.get(o),n));m(this,"getDistance",(r,t)=>pi(r,t));m(this,"getAngle",(r,t)=>la(r,t));this.groupBy=o,this.graph=new x1({nodes:r,groupBy:this.groupBy,multiplicativeDistanceWeightScaling:n}),(t?.features||[]).forEach(a=>{let l=null;if(a.geometry.type==="LineString"?l=a.geometry.coordinates:a.geometry.type==="Polygon"&&(l=a.geometry.coordinates.flat()),l){let c=this.groupBy==="default"?this.groupBy:a.properties[this.groupBy];this.geometryEdgesByMapId.has(c)||this.geometryEdgesByMapId.set(c,[]),l.forEach((p,u)=>{this.geometryEdgesByMapId.get(c).push([p,l[u+1]||l[0]])})}})}getDirections({zones:r,originIds:t,destinationNodeIds:o,disabledConnectionNodeIds:n,simplify:i,multiplicativeDistanceWeightScaling:a,overrideEdgeWeights:l}){let c=i?.enabled??!0,p=r??[],u=this.graph.aStar({originIds:t,destinationNodeIds:o,zones:p,disabledConnectionNodeIds:new Set(n),overrideEdgeWeights:l});return u.length===0?{type:"FeatureCollection",features:[]}:(c&&(u=this.simplifyAllSteps(u,i?.bufferRadius??p2,a)),this.generatePath(u))}simplifyAllSteps(r,t,o){let n=[],i=[r[0]];for(let p=1;p<r.length;p++)if(this.groupBy!=="default"&&r[p].origin.properties[this.groupBy]!==r[p-1].origin.properties[this.groupBy]){let u=r[p-1].origin.properties[this.groupBy],f=this.geometryEdgesByMapId.get(u)??[];n.push(...this.simplifySteps(i,f,t,o)),i=[r[p]]}else i.push(r[p]);let a=r[r.length-1],l=this.groupBy==="default"?this.groupBy:a.origin.properties[this.groupBy],c=this.geometryEdgesByMapId.get(l)??[];return n.push(...this.simplifySteps(i,c,t,o)),n}simplifySteps(r,t,o,n){if(r.length<3)return r;let i=[r[0]],a=1;for(let l=a+2;l<r.length;l++)if(r[a].origin.properties.preventSmoothing||!b1(r[a].origin,r[l].origin,t,o)){let c=l-1;i.push(new Cc({...r[a],destination:r[c].origin,distance:pi(r[a].origin.geometry.coordinates,r[c].origin.geometry.coordinates),angle:la(r[a].origin.geometry.coordinates,r[c].origin.geometry.coordinates)})),a=c}return i.push(new Cc({...r[a],destination:r[r.length-1].origin,distance:pi(r[a].origin.geometry.coordinates,r[r.length-1].origin.geometry.coordinates),angle:la(r[a].origin.geometry.coordinates,r[r.length-1].origin.geometry.coordinates),multiplicativeDistanceWeightScaling:n}),r[r.length-1]),i}};d();var Dt=new WeakMap;function cu(e,r){if(Dt.has(e))return Dt.get(e);if(Ic.is(e)){let t=[];for(let o of e.navigationTarget){let n=cu(o,r);t.push(...n)}return Dt.set(e,t),t}else if(na.is(e)){let t=r.Query.__LEGACY_NEAREST_SYNC(e,r.getByType("node")),o=t?.[0]?.feature.id?[t[0].feature.id]:[];return Dt.set(e,o),o}else if(fe.is(e)){let t=r.Query.__LEGACY_NEAREST_SYNC(e,r.getByType("node"),{lineOfSight:!0}),o=t?.[0]?.feature.id?[t[0].feature.id]:[];return Dt.set(e,o),o}else if(sn.is(e)){let t=r.Query.__LEGACY_NEAREST_SYNC(e,r.getByType("node"));return t?.[0]?.feature.id?[t[0].feature.id]:[]}else if(go.is(e)){let t=r?.getMVFFeatureById("entrance",e.id),o=t?.properties.node?[t?.properties.node]:[];return Dt.set(e,o),o}else if(ai.is(e)){let o=r?.getMVFFeatureById("area",e.id)?.properties.destinationNodes??[];return Dt.set(e,o),o}else if(vr.is(e)){let t=r?.getMVFFeatureById("space",e.id);if(t==null)return[];let o=t.properties.destinationNodes;return Dt.set(e,o),o}else if(an.is(e)){let t=[];for(let o of e.coordinates){let n=r.Query.__LEGACY_NEAREST_SYNC(o,r.getByType("node"));n?.[0]?.feature.id&&t.push(n[0].feature.id)}return Dt.set(e,t),t}else if(No.is(e)){let t=r?.objectEntranceNodeIdsByObstructionId[e.id];return Dt.set(e,t??[]),t??[]}else if(Ar.is(e)){let t=e.spaces.flatMap(o=>r?.getMVFFeatureById("space",o.id)?.properties.destinationNodes??[]).filter(o=>typeof o=="string");return Dt.set(e,t),t}else if(es.is(e)){let t=e.nodes.map(o=>o.id);return Dt.set(e,t),t}else if(wn.is(e)){let t=[e.id];return Dt.set(e,t),t}else return[]}async function fl(e,r){if(Dt.has(e))return Dt.get(e);if(Ic.is(e)){let t=[];for(let o of e.navigationTarget){let n=await fl(o,r);t.push(...n)}return Dt.set(e,t),t}else if(na.is(e)){let t=await r.Query.nearest(e,r.getByType("node")),o=t?.[0]?.feature.id?[t[0].feature.id]:[];return Dt.set(e,o),o}else if(fe.is(e)){let t=await r.Query.nearest(e,r.getByType("node"),{lineOfSight:!0}),o=t?.[0]?.feature.id?[t[0].feature.id]:[];return Dt.set(e,o),o}else if(sn.is(e)){let t=await r.Query.nearest(e,r.getByType("node")),o=t?.[0]?.feature.id?[t[0].feature.id]:[];return Dt.set(e,o),o}else if(go.is(e)){let t=r?.getMVFFeatureById("entrance",e.id),o=t?.properties.node?[t?.properties.node]:[];return Dt.set(e,o),o}else if(ai.is(e)){let o=r?.getMVFFeatureById("area",e.id)?.properties.destinationNodes??[];return Dt.set(e,o),o}else if(vr.is(e)){let t=r?.getMVFFeatureById("space",e.id);if(t==null)return[];let o=t.properties.destinationNodes;return Dt.set(e,o),o}else if(an.is(e)){let t=[];for(let o of e.coordinates){let n=await r.Query.nearest(o,r.getByType("node"));n?.[0]?.feature.id&&t.push(n[0].feature.id)}return Dt.set(e,t),t}else if(No.is(e)){let t=r?.objectEntranceNodeIdsByObstructionId[e.id];return Dt.set(e,t??[]),t??[]}else{if(Ar.is(e))return e.spaces.flatMap(t=>r?.getMVFFeatureById("space",t.id)?.properties.destinationNodes??[]).filter(t=>typeof t=="string");if(es.is(e)){let t=e.nodes.map(o=>o.id);return Dt.set(e,t),t}else if(wn.is(e)){let t=[e.id];return Dt.set(e,t),t}else return[]}}function nD(e,r,t){let o=e.features[0]?.properties.id,n=r[0];if(r.length>1){for(let i of r)if((t.get(i)??[]).includes(o)){n=i;break}}return n}function iD(e,r,t){let o=e.features[e.features.length-1]?.properties.id,n=r[0];if(r.length>1){for(let i of r)if((t.get(i)??[]).includes(o)){n=i;break}}return n}var Pf,I1,pu=class{constructor({nodes:r,geojsonCollection:t,connections:o,groupBy:n,multiplicativeDistanceWeightScaling:i}){m(this,"navigator");m(this,"connections");m(this,"getDirections",async(r,t,o,n)=>{let i=[],a=[],l=new Map;for(let c of r){let p=await fl(c,n);for(let u of p)i.push(u),l.set(c,p)}for(let c of t){let p=await fl(c,n);for(let u of p)a.push(u),l.set(c,p)}return s(this,Pf).call(this,r,t,i,a,o,n,l)});m(this,"getDirectionsSync",(r,t,o,n)=>{let i=[],a=[],l=new Map;for(let c of r){let p=cu(c,n);for(let u of p)i.push(u),l.set(c,p)}for(let c of t){let p=cu(c,n);for(let u of p)a.push(u),l.set(c,p)}return s(this,Pf).call(this,r,t,i,a,o,n,l)});S(this,Pf,(r,t,o,n,i,a,l)=>{let c=this.getDisabledConnectionNodeIds(i.accessible).filter(T=>!o.includes(T)&&!n.includes(T)),p=new Map,u={...i.connectionIdWeightMap};for(let T of i.excludedConnections)u[T.id]=1/0;for(let T in u){let v=a.getById("connection",T);v&&s(this,I1).call(this,v,u[T],p)}let f=this.navigator.getDirections({zones:i.zones.map(T=>({geometry:T.geometry,cost:T.cost,map:T.floor?.id})),originIds:o,destinationNodeIds:n,disabledConnectionNodeIds:c,simplify:{enabled:i.smoothing.enabled,bufferRadius:i.smoothing.radius},overrideEdgeWeights:p,multiplicativeDistanceWeightScaling:!a.enterpriseMode});this.addCoordinateDirections(f,r,t);let h=nD(f,r,l),b=iD(f,t,l),x=new ml(f,a,h,b);if(!(x.distance===0&&new Set([...o,...n]).size===o.length+n.length))return x});m(this,"getDisabledConnectionNodeIds",r=>r===!1?[]:this.connections.reduce((t,o)=>o.accessible?t:t.concat(o.nodes),[]));S(this,I1,(r,t,o)=>{if(r.nodes.length<2)return;let n=new Set(r.nodes.map(i=>i.id));for(let i of r.nodes){let a=this.navigator.graph.edges[i.id];if(a)for(let l of a)n.has(l.destination.properties.id)&&o.set(l,t)}});m(this,"addCoordinateDirections",(r,[t],[o])=>{if(r.features.length){if(fe.is(t)){let n=this.createDirectionFeature(t,this.navigator.getAngle([t.longitude,t.latitude],r.features[0].geometry.coordinates),this.navigator.getDistance([t.longitude,t.latitude],r.features[0].geometry.coordinates));r.features.splice(0,0,n)}if(fe.is(o)){let n=this.createDirectionFeature(o,0,0),i=r.features[r.features.length-1];i.properties.distance=this.navigator.getDistance(i.geometry.coordinates,[o.longitude,o.latitude]),i.properties.angle=this.navigator.getAngle(i.geometry.coordinates,[o.longitude,o.latitude]),r.features.push(n)}}});m(this,"createDirectionFeature",(r,t,o)=>({type:"Feature",geometry:{type:"Point",coordinates:[r.longitude,r.latitude]},properties:{groupBy:r.floorId,id:r.id,angle:t,distance:o,edges:[]}}));this.navigator=new lu({nodes:r,geojsonCollection:this.createCollection(t),groupBy:n,multiplicativeDistanceWeightScaling:i}),this.connections=o}createCollection(r){return{type:"FeatureCollection",features:Object.entries(r).reduce((t,[o,n])=>t.concat(n.features.map(i=>(i.properties.map=o,i))),[])}}};Pf=new WeakMap,I1=new WeakMap;d();d();d();d();d();d();function sD(e){let r=+this._x.call(null,e),t=+this._y.call(null,e);return aD(this.cover(r,t),r,t,e)}function aD(e,r,t,o){if(isNaN(r)||isNaN(t))return e;var n,i=e._root,a={data:o},l=e._x0,c=e._y0,p=e._x1,u=e._y1,f,h,b,x,T,v,I,M;if(!i)return e._root=a,e;for(;i.length;)if((T=r>=(f=(l+p)/2))?l=f:p=f,(v=t>=(h=(c+u)/2))?c=h:u=h,n=i,!(i=i[I=v<<1|T]))return n[I]=a,e;if(b=+e._x.call(null,i.data),x=+e._y.call(null,i.data),r===b&&t===x)return a.next=i,n?n[I]=a:e._root=a,e;do n=n?n[I]=new Array(4):e._root=new Array(4),(T=r>=(f=(l+p)/2))?l=f:p=f,(v=t>=(h=(c+u)/2))?c=h:u=h;while((I=v<<1|T)===(M=(x>=h)<<1|b>=f));return n[M]=i,n[I]=a,e}function lD(e){var r,t,o=e.length,n,i,a=new Array(o),l=new Array(o),c=1/0,p=1/0,u=-1/0,f=-1/0;for(t=0;t<o;++t)isNaN(n=+this._x.call(null,r=e[t]))||isNaN(i=+this._y.call(null,r))||(a[t]=n,l[t]=i,n<c&&(c=n),n>u&&(u=n),i<p&&(p=i),i>f&&(f=i));if(c>u||p>f)return this;for(this.cover(c,p).cover(u,f),t=0;t<o;++t)aD(this,a[t],l[t],e[t]);return this}d();function cD(e,r){if(isNaN(e=+e)||isNaN(r=+r))return this;var t=this._x0,o=this._y0,n=this._x1,i=this._y1;if(isNaN(t))n=(t=Math.floor(e))+1,i=(o=Math.floor(r))+1;else{for(var a=n-t||1,l=this._root,c,p;t>e||e>=n||o>r||r>=i;)switch(p=(r<o)<<1|e<t,c=new Array(4),c[p]=l,l=c,a*=2,p){case 0:n=t+a,i=o+a;break;case 1:t=n-a,i=o+a;break;case 2:n=t+a,o=i-a;break;case 3:t=n-a,o=i-a;break}this._root&&this._root.length&&(this._root=l)}return this._x0=t,this._y0=o,this._x1=n,this._y1=i,this}d();function pD(){var e=[];return this.visit(function(r){if(!r.length)do e.push(r.data);while(r=r.next)}),e}d();function dD(e){return arguments.length?this.cover(+e[0][0],+e[0][1]).cover(+e[1][0],+e[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}d();d();function Lr(e,r,t,o,n){this.node=e,this.x0=r,this.y0=t,this.x1=o,this.y1=n}function uD(e,r,t){var o,n=this._x0,i=this._y0,a,l,c,p,u=this._x1,f=this._y1,h=[],b=this._root,x,T;for(b&&h.push(new Lr(b,n,i,u,f)),t==null?t=1/0:(n=e-t,i=r-t,u=e+t,f=r+t,t*=t);x=h.pop();)if(!(!(b=x.node)||(a=x.x0)>u||(l=x.y0)>f||(c=x.x1)<n||(p=x.y1)<i))if(b.length){var v=(a+c)/2,I=(l+p)/2;h.push(new Lr(b[3],v,I,c,p),new Lr(b[2],a,I,v,p),new Lr(b[1],v,l,c,I),new Lr(b[0],a,l,v,I)),(T=(r>=I)<<1|e>=v)&&(x=h[h.length-1],h[h.length-1]=h[h.length-1-T],h[h.length-1-T]=x)}else{var M=e-+this._x.call(null,b.data),O=r-+this._y.call(null,b.data),C=M*M+O*O;if(C<t){var E=Math.sqrt(t=C);n=e-E,i=r-E,u=e+E,f=r+E,o=b.data}}return o}d();function mD(e){if(isNaN(u=+this._x.call(null,e))||isNaN(f=+this._y.call(null,e)))return this;var r,t=this._root,o,n,i,a=this._x0,l=this._y0,c=this._x1,p=this._y1,u,f,h,b,x,T,v,I;if(!t)return this;if(t.length)for(;;){if((x=u>=(h=(a+c)/2))?a=h:c=h,(T=f>=(b=(l+p)/2))?l=b:p=b,r=t,!(t=t[v=T<<1|x]))return this;if(!t.length)break;(r[v+1&3]||r[v+2&3]||r[v+3&3])&&(o=r,I=v)}for(;t.data!==e;)if(n=t,!(t=t.next))return this;return(i=t.next)&&delete t.next,n?(i?n.next=i:delete n.next,this):r?(i?r[v]=i:delete r[v],(t=r[0]||r[1]||r[2]||r[3])&&t===(r[3]||r[2]||r[1]||r[0])&&!t.length&&(o?o[I]=t:this._root=t),this):(this._root=i,this)}function fD(e){for(var r=0,t=e.length;r<t;++r)this.remove(e[r]);return this}d();function hD(){return this._root}d();function gD(){var e=0;return this.visit(function(r){if(!r.length)do++e;while(r=r.next)}),e}d();function yD(e){var r=[],t,o=this._root,n,i,a,l,c;for(o&&r.push(new Lr(o,this._x0,this._y0,this._x1,this._y1));t=r.pop();)if(!e(o=t.node,i=t.x0,a=t.y0,l=t.x1,c=t.y1)&&o.length){var p=(i+l)/2,u=(a+c)/2;(n=o[3])&&r.push(new Lr(n,p,u,l,c)),(n=o[2])&&r.push(new Lr(n,i,u,p,c)),(n=o[1])&&r.push(new Lr(n,p,a,l,u)),(n=o[0])&&r.push(new Lr(n,i,a,p,u))}return this}d();function bD(e){var r=[],t=[],o;for(this._root&&r.push(new Lr(this._root,this._x0,this._y0,this._x1,this._y1));o=r.pop();){var n=o.node;if(n.length){var i,a=o.x0,l=o.y0,c=o.x1,p=o.y1,u=(a+c)/2,f=(l+p)/2;(i=n[0])&&r.push(new Lr(i,a,l,u,f)),(i=n[1])&&r.push(new Lr(i,u,l,c,f)),(i=n[2])&&r.push(new Lr(i,a,f,u,p)),(i=n[3])&&r.push(new Lr(i,u,f,c,p))}t.push(o)}for(;o=t.pop();)e(o.node,o.x0,o.y0,o.x1,o.y1);return this}d();function xD(e){return e[0]}function vD(e){return arguments.length?(this._x=e,this):this._x}d();function ID(e){return e[1]}function SD(e){return arguments.length?(this._y=e,this):this._y}function Ff(e,r,t){var o=new d2(r??xD,t??ID,NaN,NaN,NaN,NaN);return e==null?o:o.addAll(e)}function d2(e,r,t,o,n,i){this._x=e,this._y=r,this._x0=t,this._y0=o,this._x1=n,this._y1=i,this._root=void 0}function TD(e){for(var r={data:e.data},t=r;e=e.next;)t=t.next={data:e.data};return r}var xo=Ff.prototype=d2.prototype;xo.copy=function(){var e=new d2(this._x,this._y,this._x0,this._y0,this._x1,this._y1),r=this._root,t,o;if(!r)return e;if(!r.length)return e._root=TD(r),e;for(t=[{source:r,target:e._root=new Array(4)}];r=t.pop();)for(var n=0;n<4;++n)(o=r.source[n])&&(o.length?t.push({source:o,target:r.target[n]=new Array(4)}):r.target[n]=TD(o));return e};xo.add=sD;xo.addAll=lD;xo.cover=cD;xo.data=pD;xo.extent=dD;xo.find=uD;xo.remove=mD;xo.removeAll=fD;xo.root=hD;xo.size=gD;xo.visit=yD;xo.visitAfter=bD;xo.x=vD;xo.y=SD;d();function u2(e,r,t,o=0,n=0,i=0,a=0){if(t===void 0){t=e.root();let c=e.extent();if(c&&([[o,n],[i,a]]=c,r(t,o,n,i,a)))return!0;if(!t)return!1}let l=[[o,n,(i+o)/2,(a+n)/2],[(i+o)/2,n,i,(a+n)/2],[o,(a+n)/2,(i+o)/2,a],[(i+o)/2,(a+n)/2,i,a]];for(let c=0;c<4;c++){let p=t[c];if(p){let[u,f,h,b]=l[c];r(p,u,f,h,b)||u2(e,r,p,u,f,h,b)}}return!1}var CD=1e3,S$=.1,di,Df,Go,wc,S1=class{constructor(r,t){S(this,di,{});S(this,Df,new Map);m(this,"getMaxSearchRadiusForFloorId",(r,t)=>{let o=s(this,Df).get(s(this,Go).mapName)?.get(t);if(o)return o;let n=this.getNodeTreeByTypeAndFloorId(r,s(this,Go).mapName,t);if(typeof n.extent=="function")if(n.extent()){let[[i,a],[l,c]]=n.extent(),p=l-i,u=c-a;o=Math.max(p,u)}else o=CD;else o=CD;return s(this,Df).set(s(this,Go).mapName,new Map([[t,o]])),o});S(this,Go);S(this,wc);w(this,Go,r),w(this,wc,t)}searchWithIncludedIds(r,t,o,n,i,a,l=!1){let{x:c,y:p}=s(this,wc).call(this,r),u=c-a,f=c+a,h=p-a,b=p+a,x=this.getNodeTreeByTypeAndFloorId(t,o,n),T=[],v=new Set;return u2(x,(I,M,O,C,E)=>{let _=M>=f||O>=b||C<u||E<h;if("data"in I){let G=I.data,R=G.properties.parentId||G.properties.id;if(i.includes(R)&&!v.has(R)){v.add(R);let N=pi(r,G.geometry.coordinates);N<=a&&(l?s(this,Go).directions.navigator.hasLineOfSight(r,G.geometry.coordinates,n,S$)&&T.push({node:G,distance:N}):T.push({node:G,distance:N}))}}return _}),T.sort((I,M)=>I.distance-M.distance)}getNodeTreeByTypeAndFloorId(r,t,o){if(s(this,di)[r]||(s(this,di)[r]={}),s(this,di)[r][t]?.[o])return s(this,di)[r][t][o];s(this,di)[r][t]||(s(this,di)[r][t]={}),s(this,di)[r][t][o]=Ff();let n=s(this,di)[r][t][o];n.x(a=>s(this,wc).call(this,a.geometry.coordinates).x),n.y(a=>s(this,wc).call(this,a.geometry.coordinates).y);let i=[];switch(r){case"space":i=s(this,Go).mvfSpacesByFloorId[o].flatMap(l=>l.properties.destinationNodes).map(l=>{let c=s(this,Go).mvfNodesById[l];return c?{...c,properties:{id:c.properties.id,parentId:c.properties.space[0]}}:null});break;case"node":i=s(this,Go).mvfNodesByFloorId[o]?.filter(l=>l.properties.neighbors.length>0)||[];break;case"point-of-interest":i=s(this,Go).mvfPoisByFloorId[o]||[];break;case"door":i=s(this,Go).mvfEntrancesByFloorId[o]||[];break;case"annotation":i=s(this,Go).mvfAnnotationsByFloorId[o]||[];break}return i?.length>0&&n.addAll(i),n}};di=new WeakMap,Df=new WeakMap,Go=new WeakMap,wc=new WeakMap;var du=50,MD=111319.9,m2=!1,wD=J.object({limit:J.enum(["same-floor","same-elevation"]).optional(),mode:J.enum(["travel-distance","absolute-distance"]).optional(),lineOfSight:J.boolean().optional().or(J.literal("auto")),maxDistance:J.number().optional()}),OD={lineOfSight:m2,mode:"travel-distance",maxDistance:du,limit:"same-floor"},Ir,Af,T1,Lf,f2,uu,C1,M1,kf=class{constructor(r){S(this,Lf);S(this,Ir);S(this,Af);S(this,T1,([r,t])=>{let[o,n]=[s(this,Ir).mapCenter.longitude,s(this,Ir).mapCenter.latitude],i=MD,a=MD*Math.cos(t*Math.PI/180),l=(r-o)*a,c=(t-n)*i;return{x:l,y:c}});m(this,"__LEGACY_NEAREST_SYNC",(r,t,o)=>{let n={...OD,...o};try{wD.parse(n)}catch(u){A.error(u);return}let i=jd(r);if(!i)return;let a=W(this,Lf,f2).call(this,i,n),l=[],c={},p=[];for(let u of t){let f=cu(u,s(this,Ir));if(f)for(let h of f)c[h]||(c[h]=[]),c[h].push(u),p.push(h)}return o?.mode==="absolute-distance"?l=s(this,uu).call(this,i,a,t,n):l=s(this,M1).call(this,r,a,p,c,n),l.sort((u,f)=>u.distance-f.distance)});S(this,uu,(r,t,o,n)=>{let i=[],a=new Set(o.map(l=>l.__type));for(let l of t)for(let c of a){let p=s(this,Af).searchWithIncludedIds([r.longitude,r.latitude],c,s(this,Ir).mapName,l,o.filter(u=>u.__type===c).map(u=>u.id),n?.maxDistance??du,n?.lineOfSight==="auto"?m2:n?.lineOfSight);if(p)for(let u of p)i.push({distance:u.distance,feature:s(this,Ir).getById(c,u.node.properties.parentId)||s(this,Ir).getById(c,u.node.properties.id)})}return i});S(this,C1,async(r,t,o,n,i)=>{let a=[];for(let l of t){let c,p=0;if(!wn.is(r)){let u=s(this,uu).call(this,r.anchorTarget,[l],s(this,Ir).getByType("node").filter(f=>f.floor.id===l),{limit:"same-floor",lineOfSight:i?.lineOfSight??!0,mode:"absolute-distance",maxDistance:i?.maxDistance??du});u.length>0&&(c=u[0].feature,p=u[0].distance)}if(c){let u=new Set,f=s(this,Ir).directions.navigator.findNearestNodesOnGraph(c.id,(i?.maxDistance??du)-p,l,o,!1);for(let h of f)for(let b of n[h.feature.properties.id])u.has(b.id)||(a.push({distance:h.distance+p,feature:b}),u.add(b.id))}}return a});S(this,M1,(r,t,o,n,i)=>{let a=[];for(let l of t){let c;if(wn.is(r)||(c=this.__LEGACY_NEAREST_SYNC(r,s(this,Ir).getByType("node"),{lineOfSight:i?.lineOfSight??!0,mode:"absolute-distance",maxDistance:i?.maxDistance??du})?.[0].feature),c){let p=s(this,Ir).directions.navigator.findNearestNodesOnGraph(c.id,i?.maxDistance??du,l,o,i?.lineOfSight==="auto"?m2:i?.lineOfSight);for(let u of p)for(let f of n[u.feature.properties.id])a.push({distance:u.distance,feature:f})}}return a});w(this,Ir,r),w(this,Af,new S1(s(this,Ir),s(this,T1)))}async nearest(r,t,o){let n={...OD,...o};try{wD.parse(n)}catch(f){A.error(f);return}let i=jd(r);if(!i)return;let a=W(this,Lf,f2).call(this,i,n),l=[],c={},p=[],u=[];if(o?.mode==="absolute-distance")l=s(this,uu).call(this,i,a,t,n);else{for(let f of t)u.push(fl(f,s(this,Ir)).then(h=>{if(h)for(let b of h)c[b]||(c[b]=[]),c[b].push(f),p.push(b)}));await Promise.all(u),l=await s(this,C1).call(this,r,a,p,c,n)}return l.sort((f,h)=>f.distance-h.distance)}};Ir=new WeakMap,Af=new WeakMap,T1=new WeakMap,Lf=new WeakSet,f2=function(r,t){let o=r.floorId?[r.floorId]:[];if(r.floorId==null)for(let n of s(this,Ir).getByType("floor-stack")){let i=n.defaultFloor;i&&o.push(i.id)}else if(t?.limit==="same-elevation"){let n=s(this,Ir).floorsById[r.floorId];if(n){let i=n?.elevation;i&&(o=s(this,Ir).getByType("floor-stack").map(a=>a.floors.find(l=>l.elevation===i)?.id).filter(Boolean))}}return o},uu=new WeakMap,C1=new WeakMap,M1=new WeakMap;d();d();var _f,w1=class{constructor(r){S(this,_f);w(this,_f,r||[])}get raw(){return s(this,_f)}};_f=new WeakMap;var Yr,le,Ot,mu=class mu extends xr{constructor(t,o){super(o.mvfData.id);m(this,"__type",mu.__type);m(this,"id","loc_");m(this,"name","");m(this,"externalId");m(this,"description");m(this,"logo");m(this,"phone");m(this,"social",[]);m(this,"images",[]);m(this,"links",[]);m(this,"website");m(this,"icon");S(this,Yr);S(this,le,{});S(this,Ot);w(this,Yr,t),w(this,Ot,o.mvfData);for(let n in o.mvfData)n==="links"?this.links=o.mvfData.links.map(i=>new ic({mvfData:i})):n==="pictures"?this.images=o.mvfData.pictures.map(i=>i.url?new ac({mvfData:{...i,url:i.url??""},mapData:s(this,Yr)}):void 0).filter(i=>i!=null):n==="website"?o.mvfData.website&&(this.website=new ic({mvfData:o.mvfData.website})):n==="icon"?o.mvfData.icon&&(this.icon=new ac({mvfData:{url:o.mvfData.icon},mapData:s(this,Yr)})):Object.getOwnPropertyDescriptor(Object.getPrototypeOf(this),n)||Object.defineProperty(this,n,{enumerable:!0,get(){return s(this,Ot)[n]}})}static is(t){return t.__type===mu.__type}get spaces(){if(s(this,le).spaces)return s(this,le).spaces;if(s(this,Ot).spaces==null)return s(this,le).spaces=[],s(this,le).spaces;s(this,le).spaces=[];for(let t=0;t<s(this,Ot).spaces.length;t++){let o=s(this,Yr).getById("space",s(this,Ot).spaces[t].id);o&&s(this,le).spaces.push(o)}return s(this,le).spaces}get points(){if(s(this,le).points)return s(this,le).points;if(s(this,Ot).spaces==null)return s(this,le).points=[],s(this,le).points;s(this,le).points=[];for(let t=0;t<s(this,Ot).spaces.length;t++){let o=s(this,Yr).getById("point-of-interest",s(this,Ot).spaces[t].id);o&&s(this,le).points.push(o)}return s(this,le).points}get doors(){if(s(this,le).doors)return s(this,le).doors;if(s(this,Ot).entrances==null)return s(this,le).doors=[],s(this,le).doors;s(this,le).doors=[];for(let t=0;t<s(this,Ot).entrances.length;t++){let o=s(this,Yr).getById("door",s(this,Ot).entrances[t].id);o&&s(this,le).doors.push(o)}return s(this,le).doors}get connections(){if(s(this,le).connections)return s(this,le).connections;if(s(this,Ot).connections==null)return s(this,le).connections=[],s(this,le).connections;let t=new Set;for(let o=0;o<s(this,Ot).connections.length;o++){let n=s(this,Ot).connections[o],i=s(this,Yr).mvfConnectionsById[n],l=(i==null?[]:i.nodes).map(c=>s(this,Yr).getById("node",c)).filter(Boolean);for(let c of l){if(c==null)continue;let p=qi([c.coordinate.longitude,c.coordinate.latitude]),f=(s(this,Yr).connectionSpaceIdsByLatLon[p]??[]).map(h=>s(this,Yr).connectionsById[h]).filter(h=>h!=null);for(let h of f)t.add(h)}}return s(this,le).connections=Array.from(t),s(this,le).connections}get annotations(){if(s(this,le).annotations)return s(this,le).annotations;if(s(this,Ot).annotations==null)return s(this,le).annotations=[],s(this,le).annotations;s(this,le).annotations=[];for(let t=0;t<s(this,Ot).annotations.length;t++){let o=s(this,Yr).getById("annotation",s(this,Ot).annotations[t].id);o&&s(this,le).annotations.push(o)}return s(this,le).annotations}get categories(){return s(this,le).categories?s(this,le).categories:s(this,Ot).categories==null?(s(this,le).categories=[],s(this,le).categories):(s(this,le).categories=s(this,Ot).categories.map(t=>s(this,Yr).getById("location-category",t)).filter(t=>t!=null),s(this,le).categories)}get mapObjects(){return s(this,le).mapObjects?s(this,le).mapObjects:s(this,Ot).obstructions==null?(s(this,le).mapObjects=[],s(this,le).mapObjects):(s(this,le).mapObjects=s(this,Ot).obstructions.map(t=>s(this,Yr).getById("object",t.id)).filter(t=>t!=null),s(this,le).mapObjects)}get areas(){return s(this,le).areas?s(this,le).areas:s(this,Ot).areas==null?(s(this,le).areas=[],s(this,le).areas):(s(this,le).areas=s(this,Ot).areas.map(t=>s(this,Yr).getById("area",t.id)).filter(t=>t!=null),s(this,le).areas)}get focusTarget(){if(s(this,le).focusTarget)return s(this,le).focusTarget;let t=[];for(let o of this.spaces)t.push(o);for(let o of this.connections)t.push(...o.coordinates);for(let o of this.doors)t.push(o.focusTarget);for(let o of this.mapObjects)t.push(o.focusTarget);for(let o of this.annotations)t.push(o.focusTarget);for(let o of this.points)t.push(o.focusTarget);for(let o of this.areas)t.push(o.focusTarget);return s(this,le).focusTarget=t,t}get openingHours(){return s(this,le).openingHours?s(this,le).openingHours:(s(this,le).openingHours=new w1(s(this,Ot).openingHoursSpecification??[]),s(this,le).openingHours)}get navigationTarget(){if(s(this,le).navigationTarget)return s(this,le).navigationTarget;let t=[];for(let o of this.spaces)t.push(o);for(let o of this.connections)t.push(...o.coordinates);for(let o of this.doors)t.push(o.focusTarget);for(let o of this.mapObjects)t.push(o.focusTarget);for(let o of this.annotations)t.push(o.focusTarget);for(let o of this.points)t.push(o.focusTarget);return s(this,le).navigationTarget=t,t}toJSON(){return{__type:mu.__type,id:this.id,name:this.name}}};Yr=new WeakMap,le=new WeakMap,Ot=new WeakMap,m(mu,"__type","location-profile");var h2=mu,Ic=h2;d();var hl,Uo,Oc,fu=class fu extends xr{constructor(t,o){super(o.mvfData.id);m(this,"__type",fu.__type);m(this,"id","cat_");m(this,"name","");m(this,"icon","");S(this,hl);S(this,Uo,{});S(this,Oc);w(this,hl,t),w(this,Oc,o.mvfData);for(let n in o.mvfData)Object.getOwnPropertyDescriptor(Object.getPrototypeOf(this),n)||Object.defineProperty(this,n,{enumerable:!0,get(){return s(this,Oc)[n]}})}static is(t){return t.__type===fu.__type}get parent(){return s(this,Uo).parent?s(this,Uo).parent:(s(this,Uo).parent=s(this,Oc).parent?s(this,hl).getById("location-category",s(this,Oc).parent):void 0,s(this,Uo).parent)}get children(){return s(this,Uo).children?s(this,Uo).children:(s(this,Uo).children=s(this,hl).locationCategoriesByParentId[this.id]||[],s(this,Uo).children)}get locationProfiles(){if(s(this,Uo).locationProfiles)return s(this,Uo).locationProfiles;let t=[];for(let o of s(this,hl).locationProfilesByCategoryId[this.id]||[]){let n=s(this,hl).getById("location-profile",o.id);n&&t.push(n)}return s(this,Uo).locationProfiles=t,t}toJSON(){return{__type:fu.__type,id:this.id,name:this.name}}};hl=new WeakMap,Uo=new WeakMap,Oc=new WeakMap,m(fu,"__type","location-category");var g2=fu,u1=g2;var ge,O1,PD,hu,Ec=class extends ke{constructor(t,o){super();S(this,O1);m(this,"Analytics");S(this,ge,{});m(this,"Query");m(this,"mvf");m(this,"outdoorViewToken");m(this,"objectEntranceNodeIdsByObstructionId");m(this,"obstructionIdByEntranceId");m(this,"venue");m(this,"tokenManager");m(this,"directions");m(this,"enterpriseMode",!1);m(this,"nodesById");m(this,"spacesById");m(this,"floorsById");m(this,"floorStacksById");m(this,"facadesById");m(this,"facadesBySpaceId");m(this,"connectionsById");m(this,"objectsById");m(this,"doorsById");m(this,"pointsOfInterestById");m(this,"annotationsById");m(this,"areasById");m(this,"locationProfilesById");m(this,"locationCategoriesById");m(this,"locationProfilesByExternalId");m(this,"locationProfilesByCategoryId");m(this,"locationCategoriesByParentId");m(this,"doorsByNodeId");m(this,"mvfAnnotationsById");m(this,"mvfConnectionsById");m(this,"mvfConnectionsByNodeId");m(this,"mvfConnectionIdsByLatLon");m(this,"mvfEntrancesById");m(this,"mvfNodesById");m(this,"mvfObstructionById");m(this,"mvfSpacesById");m(this,"mvfFloorsById");m(this,"mvfFloorStacksById");m(this,"mvfAreasById");m(this,"spacesByExternalId");m(this,"nodesByExternalId");m(this,"objectsByExternalId");m(this,"poisByExternalId");m(this,"floorsByExternalId");m(this,"floorStacksByExternalId");m(this,"doorsByExternalId");m(this,"areasByExternalId");m(this,"connectionSpaceIdsByLatLon",{});m(this,"locationProfilesByAttachedFeatureId",{});m(this,"locationsById",{});m(this,"categoriesById",{});m(this,"mvfLocationsBySpaceId",{});m(this,"locationIdsByNodeId",{});m(this,"spaceIdsByNodeId",{});m(this,"connectionsByExternalId",{});m(this,"locationsByExternalId",{});m(this,"categoriesByExternalId",{});m(this,"destinationNodesIdsBySpaceId",{});m(this,"mvfNodesByFloorId");m(this,"mvfSpacesByFloorId");m(this,"mvfPoisByFloorId");m(this,"mvfEntrancesByFloorId");m(this,"mvfAnnotationsByFloorId");m(this,"localePacksUrls");m(this,"currentLanguage");m(this,"languagePacks",{});m(this,"tilesets",{});m(this,"navigationFlags");m(this,"binaryBundle");m(this,"envControl");m(this,"getMapDataOptions");m(this,"propTranslationCache",new Map);S(this,hu);m(this,"__LEGACY_GET_DIRECTIONS_MULTI_DESTINATION_SYNC",(t,o,n)=>this.__LEGACY_GET_DIRECTIONS_SYNC(t,o,{...n,multiDestination:!0}));m(this,"__LEGACY_GET_DIRECTIONS_SYNC",(t,o,n)=>{let{accessible:i=!1,multiDestination:a=!1}=n||{},l=ED(this.enterpriseMode,n),c=n?.zones||[],p={accessible:i,zones:c,smoothing:l,excludedConnections:n?.excludedConnections||[],connectionIdWeightMap:n?.connectionIdWeightMap||{}};if(a&&Array.isArray(o)){let u=Array.isArray(t)?t:[t],f=[];for(let h of o){let b=Array.isArray(h)?h:[h],x=this.directions.getDirectionsSync(u,b,p,this);if(!x){A.error("getDirections failed due to missing directions for one of the segments");return}u=b,f.push(x)}return f}else{let u=Array.isArray(t)?t:[t],f=Array.isArray(o)?o:[o];if(Array.isArray(f[0])){A.error("getDirections does not support multi-destination without multisegment option");return}u[0].id&&f[0].id&&this.Analytics.sendGetDirectionsEvent(u[0].id,f[0].id,i);try{return this.directions.getDirectionsSync(u,f,p,this)}catch(h){A.error("Unable to get directions",h);return}}});m(this,"getDirections",async(t,o,n)=>{let{accessible:i=!1}=n||{},a=ED(this.enterpriseMode,n),l=n?.zones||[],c={accessible:i,zones:l,smoothing:a,excludedConnections:n?.excludedConnections||[],connectionIdWeightMap:n?.connectionIdWeightMap||{}},p=Array.isArray(t)?t:[t],u=Array.isArray(o)?o:[o];if(Array.isArray(u[0])){A.error("getDirections does not support multi-destination without multisegment option");return}p[0].id&&u[0].id&&this.Analytics.sendGetDirectionsEvent(p[0].id,u[0].id,i);try{return this.directions.getDirections(p,u,c,this)}catch(f){A.error("Unable to get directions",f);return}});m(this,"getDirectionsMultiDestination",async(t,o,n)=>Promise.resolve(this.__LEGACY_GET_DIRECTIONS_MULTI_DESTINATION_SYNC(t,o,n)));m(this,"transformImageRequest",async t=>{if(this.enterpriseMode||!this.getMapDataOptions)return{url:t};if(!E5(t))return{url:t};if(P5(t))return{url:t};let o=l1(t);if(!o)return{url:t};try{let i=(await this.tokenManager?.getSasTokensAsync())?.[o.mapId];if(i==null)throw new Error("SAS token not found");let[a]=t.split("?");return{url:`${a}?${i.token}`}}catch(n){return A.error("Failed to append SAS token to image request. Requests for private images may fail.",n),{url:t}}});let n=o?.env??tl();if(this.envControl=n,this.binaryBundle=o?.binaryBundle,this.Analytics=new Pp,this.localePacksUrls=o?.localePacksUrls??{},this.mvf=t,this.outdoorViewToken=o?.outdoorViewToken,this.getMapDataOptions=o?.getMapDataOptions,t["tileset.json"]?.default!=null&&(this.tilesets[t["tileset.json"].default.key]=t["tileset.json"].default,n.updateTileServerBaseUrl(t["tileset.json"].default.url),t["tileset.json"].others!=null))for(let a of t["tileset.json"].others)this.tilesets[a.key]=a;this.navigationFlags=t["navigationFlags.json"]??{},this.enterpriseMode=o?.enterprise??!1,this.tokenManager=o?.tokenManager;let i=R5(t,this);if(this.nodesById=i.nodesById,this.spacesById=i.spacesById,this.floorsById=i.floorsById,this.floorStacksById=i.floorStacksById,this.facadesById=i.facadesById,this.facadesBySpaceId=i.facadesBySpaceId,this.connectionsById=i.connectionsById,this.objectsById=i.objectsById,this.doorsById=i.doorsById,this.pointsOfInterestById=i.poisById,this.annotationsById=i.annotationsById,this.areasById=i.areasById,this.locationProfilesById=i.locationProfilesById,this.locationCategoriesById=i.locationCategoriesById,this.locationProfilesByCategoryId=i.locationProfilesByCategoryId,this.locationCategoriesByParentId=i.locationCategoriesByParentId,this.spacesByExternalId=i.spacesByExternalId,this.nodesByExternalId=i.nodesByExternalId,this.objectsByExternalId=i.objectsByExternalId,this.floorsByExternalId=i.floorsByExternalId,this.locationProfilesByExternalId=i.locationProfilesByExternalId,this.floorStacksByExternalId=i.floorStacksByExternalId,this.poisByExternalId=i.poisByExternalId,this.doorsByExternalId=i.doorsByExternalId,this.areasByExternalId=i.areasByExternalId,this.mvfAnnotationsById=i.mvfAnnotationsById,this.mvfConnectionsById=i.mvfConnectionsById,this.mvfConnectionsByNodeId=i.mvfConnectionsByNodeId,this.mvfConnectionIdsByLatLon=i.mvfConnectionIdsByLatLon,this.mvfEntrancesById=i.mvfEntrancesById,this.mvfNodesById=i.mvfNodesById,this.mvfObstructionById=i.mvfObstructionById,this.mvfSpacesById=i.mvfSpacesById,this.mvfFloorsById=i.mvfFloorsById,this.mvfFloorStacksById=i.mvfFloorStacksById,this.mvfNodesByFloorId=i.mvfNodesByFloorId,this.mvfSpacesByFloorId=i.mvfSpacesByFloorId,this.mvfPoisByFloorId=i.mvfPoisByFloorId,this.mvfEntrancesByFloorId=i.mvfEntrancesByFloorId,this.mvfAnnotationsByFloorId=i.mvfAnnotationsByFloorId,this.mvfAreasById=i.mvfAreasById,this.doorsByNodeId=i.doorsByNodeId,this.objectEntranceNodeIdsByObstructionId=i.objectEntranceNodeIdsByObstructionId,this.obstructionIdByEntranceId=i.obstructionIdByEntranceId,this.connectionSpaceIdsByLatLon=i.connectionIdsByLatLon,this.locationProfilesByAttachedFeatureId=i.locationProfilesByAttachedFeatureId,this.enterpriseMode||Rf()){let a=_5(t,this);if(this.locationsById=a.locationsById,this.categoriesById=a.categoriesById,this.mvfLocationsBySpaceId=a.mvfLocationsBySpaceId,this.locationIdsByNodeId=a.locationIdsByNodeId,this.spaceIdsByNodeId=a.spaceIdsByNodeId,this.connectionsByExternalId=a.connectionsByExternalId,this.locationsByExternalId=a.locationsByExternalId,this.categoriesByExternalId=a.categoriesByExternalId,this.destinationNodesIdsBySpaceId=a.destinationNodesIdsBySpaceId,a.venue.name!=null){this.venue=new r2(this,{mvfData:a.venue});let l={};for(let c in a.mvfLocationsById)l[c]=a.mvfLocationsById[c];for(let c in a.locationInstancesById)l[c]=a.locationInstancesById[c];this.languagePacks[this.venue.defaultLanguage.code]={type:"initial",optimized:{"enterprise-location":l,"enterprise-category":a.mvfCategoriesById,"floor-stack":i.mvfFloorStacksById,floor:i.mvfFloorsById}},o?.languagePacks?.forEach(({language:c,localePack:p})=>{this.languagePacks[c.code]=kS(p)}),this.currentLanguage=this.venue.defaultLanguage}}this.directions=new pu({nodes:t["node.geojson"],geojsonCollection:t.enterprise?t.space:t.obstruction,connections:t["connection.json"],groupBy:"map",multiplicativeDistanceWeightScaling:!this.enterpriseMode}),this.Query=new kf(this)}getEnv(){let t=this;return{get baseUri(){return t.envControl.getBaseUri()},get baseAuthUri(){return t.envControl.getBaseAuthUri()},get analyticsBaseUri(){return t.envControl.getAnalyticsBaseUri()},get tileServerUri(){return t.envControl.getTileServerUri()}}}get mapName(){return this.mvf["manifest.geojson"].features[0].properties.name}get organizationId(){return this.mvf["manifest.geojson"].features[0].properties.org_id??""}get mapCenter(){return new fe(this.mvf["manifest.geojson"].features[0].geometry.coordinates[1],this.mvf["manifest.geojson"].features[0].geometry.coordinates[0])}get naturalBearing(){return this.mvf["manifest.geojson"].features[0].properties.naturalBearing??0}get spaces(){return s(this,ge).spaces==null&&(s(this,ge).spaces=globalThis.Object.values(this.spacesById)),s(this,ge).spaces}get objects(){return s(this,ge).objects==null&&(s(this,ge).objects=globalThis.Object.values(this.objectsById)),s(this,ge).objects}get connections(){return s(this,ge).connections==null&&(s(this,ge).connections=globalThis.Object.values(this.connectionsById)),s(this,ge).connections}get floors(){return s(this,ge).floors==null&&(s(this,ge).floors=globalThis.Object.values(this.floorsById)),s(this,ge).floors}get floorStacks(){return s(this,ge).floorStacks==null&&(s(this,ge).floorStacks=globalThis.Object.values(this.floorStacksById)),s(this,ge).floorStacks}get facades(){return s(this,ge).facades==null&&(s(this,ge).facades=globalThis.Object.values(this.facadesById)),s(this,ge).facades}get doors(){return s(this,ge).doors==null&&(s(this,ge).doors=globalThis.Object.values(this.doorsById)),s(this,ge).doors}get pointsOfInterest(){return s(this,ge).pointsOfInterest==null&&(s(this,ge).pointsOfInterest=globalThis.Object.values(this.pointsOfInterestById)),s(this,ge).pointsOfInterest}get annotations(){return s(this,ge).annotations==null&&(s(this,ge).annotations=globalThis.Object.values(this.annotationsById)),s(this,ge).annotations}get areas(){return s(this,ge).areas==null&&(s(this,ge).areas=globalThis.Object.values(this.areasById)),s(this,ge).areas}get nodes(){return s(this,ge).nodes==null&&(s(this,ge).nodes=globalThis.Object.values(this.nodesById)),s(this,ge).nodes}get locations(){return s(this,ge).locations==null&&(s(this,ge).locations=globalThis.Object.values(this.locationsById)),globalThis.Object.values(this.locationsById)}get categories(){return s(this,ge).categories==null&&(s(this,ge).categories=globalThis.Object.values(this.categoriesById)),globalThis.Object.values(this.categoriesById)}get locationProfiles(){return s(this,ge).locationProfiles==null&&(s(this,ge).locationProfiles=globalThis.Object.values(this.locationProfilesById)),s(this,ge).locationProfiles}get locationCategories(){return s(this,ge).locationCategories==null&&(s(this,ge).locationCategories=globalThis.Object.values(this.locationCategoriesById)),s(this,ge).locationCategories}get mvfFloors(){return s(this,ge).mvfFloors==null&&(s(this,ge).mvfFloors=globalThis.Object.values(this.mvfFloorsById)),s(this,ge).mvfFloors}get mvfFloorStacks(){return s(this,ge).mvfFloorStacks==null&&(s(this,ge).mvfFloorStacks=globalThis.Object.values(this.mvfFloorStacksById)),s(this,ge).mvfFloorStacks}getByType(t){switch(t){case"location-profile":return this.locationProfiles;case"location-category":return this.locationCategories;case"area":return this.areas;case"node":return this.nodes;case"space":return this.spaces;case"door":return this.doors;case"floor":return this.floors;case"floor-stack":return this.floorStacks;case"connection":return this.connections;case"object":return this.objects;case"point-of-interest":return this.pointsOfInterest;case"annotation":return this.annotations;case"enterprise-location":return this.locations;case"enterprise-category":return this.categories;case"enterprise-venue":return this.venue;case"facade":return this.facades;default:return[]}}getById(t,o){let n={"location-profile":this.locationProfilesById,"location-category":this.locationCategoriesById,space:this.spacesById,floor:this.floorsById,"floor-stack":this.floorStacksById,facade:this.facadesById,node:this.nodesById,door:this.doorsById,connection:this.connectionsById,"mvf-connection":l=>W(this,O1,PD).call(this,this.mvfConnectionsById[l]),object:this.objectsById,"point-of-interest":this.pointsOfInterestById,annotation:this.annotationsById,area:this.areasById,"enterprise-location":this.locationsById,"enterprise-category":this.categoriesById},i=l=>{let c=n[l];if(c!=null)return typeof c=="function"?c(o):c[o]},a=()=>{for(let l of Object.keys(n)){let c=i(l);if(c!=null)return c}};return t==="unknown"?a():i(t)}getByExternalId(t,o){switch(t){case"location-profile":return this.locationProfilesByExternalId[o]??[];case"location-category":return[];case"space":return this.spacesByExternalId[o]??[];case"floor":return this.floorsByExternalId[o]??[];case"floor-stack":return this.floorStacksByExternalId[o]??[];case"node":return this.nodesByExternalId[o]??[];case"door":return this.doorsByExternalId[o]??[];case"connection":return this.connectionsByExternalId[o]??[];case"object":return this.objectsByExternalId[o]??[];case"point-of-interest":return this.poisByExternalId[o]??[];case"area":return this.areasByExternalId[o]??[];case"enterprise-location":return this.locationsByExternalId[o]??[];case"enterprise-category":return this.categoriesByExternalId[o]??[];default:return[]}}getMapDataById(t){return this.spacesById[t]??this.floorsById[t]??this.floorStacksById[t]??this.facadesById[t]??this.nodesById[t]??this.doorsById[t]??this.connectionsById[t]??this.objectsById[t]??this.pointsOfInterestById[t]??this.annotationsById[t]??this.areasById[t]}getMVFFeatureById(t,o){switch(t){case"space":return this.mvfSpacesById[o];case"node":return this.mvfNodesById[o];case"obstruction":return this.mvfObstructionById[o];case"floor":return this.mvfFloorsById[o];case"floor-stack":return this.mvfFloorStacksById[o];case"connection":return this.mvfConnectionsById[o];case"entrance":return this.mvfEntrancesById[o];case"annotation":return this.mvfAnnotationsById[o];case"area":return this.mvfAreasById[o];default:throw new Error(`Unknown MVF feature type: ${t}`)}}getMVFFeatureByNodeId(t,o){switch(t){case"connection":return this.mvfConnectionsByNodeId[o];default:throw new Error(`Unsupported MVF feature type: ${t}`)}}getMVFFeatureByType(t){switch(t){case"floor-stack":return this.mvfFloorStacks;case"floor":return this.mvfFloors;default:throw new Error(`Unsupported MVF feature type: ${t}`)}}getPropTranslation(t,o,n,i){if(!this.currentLanguage)return i;let{code:a}=this.currentLanguage,l=this.languagePacks[a]?.optimized?.[t];if(l){let c=l[n];if(c!=null&&c[o]!==void 0){let p=c[o];if(p!=null&&typeof p=="object"){if(typeof i=="object"&&typeof p=="object"&&!Array.isArray(p)){let u=ny(a+t+n+o.toString());if(this.propTranslationCache.has(u))return this.propTranslationCache.get(u);let f=Ef(i,p,["id"]);return this.propTranslationCache.set(u,f),f}return p}return p}}return i}findPreferredLanguage(t){if(!this.venue)return;let o=y2(this.venue,t);return t?.languageCode!=null&&t.languageCode.toLowerCase()!==o.code.toLowerCase()&&A.warn(`Language code "${t.languageCode}" could not be found in the venue. Using "${o.code}" instead.`),o}async changeLanguage(t){let o=t.toLowerCase();if(!o){A.error("Language code must be defined.");return}if(!this.currentLanguage||!this.venue){A.error("Changing the language is not supported for this map.");return}let n=this.currentLanguage.code,i=this.venue?.languages.find(({code:l})=>l.toLowerCase()===o.toLowerCase());if(!i){A.warn(`Language code "${o}" could not be found in the venue.`);return}if(n===i.code)return;let a=this.languagePacks[i.code];if(!a){let l=this.localePacksUrls[i.code];if(!l){A.error(`Locale pack URL not found for language code "${i.code}".`);return}s(this,hu)&&s(this,hu).abort();let c=new AbortController;w(this,hu,c);let p;try{p=await s5(l,{signal:c.signal})}catch(u){A.error(`Failed to download language pack for language code "${i.code}".`,u);return}if(!p||c.signal.aborted)return;a=kS(p),this.languagePacks[i.code]=a}this.Analytics.sendChangeLanguageEvent({fromLanguage:this.currentLanguage.code}),this.currentLanguage=i,this.publish("language-change",this.currentLanguage)}getDistance(t,o){let n=jd(t),i=jd(o);return pi([n.longitude,n.latitude],[i.longitude,i.latitude])}async toJSONBundle({downloadLanguagePacks:t=!0}={}){let o=[];if(t&&this.enterpriseMode){let n=new AbortController;for(let i of this.venue?.languages||[])try{if(this.localePacksUrls[i.code]){let a=await pS(this.localePacksUrls[i.code],{signal:n.signal}),l=await Sd(a);l&&o.push({language:{code:i.code,name:i.name},localePack:l})}}catch(a){A.warn("failed downloading language pack",a)}}return{type:"json",options:{enterprise:this.enterpriseMode},languagePacks:o,main:this.mvf}}async toBinaryBundle({downloadLanguagePacks:t=!0}={}){if(!this.binaryBundle){A.error("binary bundle not found");return}let o=[];if(t&&this.enterpriseMode){let n=new AbortController;for(let i of this.venue?.languages||[])try{if(this.localePacksUrls[i.code]){let a=await pS(this.localePacksUrls[i.code],{signal:n.signal});a&&o.push({language:{code:i.code,name:i.name},localePack:a})}}catch(a){A.warn("failed downloading language pack",a)}}return{type:"binary",options:{enterprise:this.enterpriseMode},languagePacks:o,main:this.binaryBundle}}destroy(){for(let t of globalThis.Object.keys(s(this,ge)))s(this,ge)[t]=null;this.propTranslationCache.clear()}};ge=new WeakMap,O1=new WeakSet,PD=function(t){let o=t?.nodes?.[0],n=this.getById("node",o);if(n==null)return;let i=qi([n.coordinate.longitude,n.coordinate.latitude]);return this.connectionSpaceIdsByLatLon[i]?.map(l=>this.connectionsById[l]).find(l=>l!=null)},hu=new WeakMap;var ED=(e,r)=>{let t=!e,o=r?.smoothing,i=o!=null?typeof o=="object"?o.enabled??t:o:t,a=typeof o=="object"?o.radius:void 0;return{enabled:i,radius:a??.75}};d();d();d();d();(function(){typeof globalThis!="object"&&(Object.defineProperty(Object.prototype,"__magic__",{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__)})();var FD="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAkGBwgHBgkICAgKCgkLDhcPDg0NDhwUFREXIh4jIyEeICAlKjUtJScyKCAgLj8vMjc5PDw8JC1CRkE6RjU7PDn/2wBDAQoKCg4MDhsPDxs5JiAmOTk5OTk5OTk5OTk5OTk5OTk5OTk5OTk5OTk5OTk5OTk5OTk5OTk5OTk5OTk5OTk5OTn/wgARCAIABAADAREAAhEBAxEB/8QAGwABAAMBAQEBAAAAAAAAAAAAAAECAwQFBgf/xAAWAQEBAQAAAAAAAAAAAAAAAAAAAQL/2gAMAwEAAhADEAAAAP3EAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAIAAAJAFAAAAAAAAAAAAAAAAAAAAAAAAABAgAAEgCgAAAAAAAAAAAAAAAAAAAABERLSM1zM4zXMzjMoUIqCCSSS8XNC9mpoaVomharWTQAAAAAAAAAAAAAAAAEREtIoZrnGZkucUKFStQQSTFixdNDStF0TWrmiWqbJoAAAAAAAAAAAAAIgiWkZy4HNLzHLXKcxzpzmFYmRkUKFSCCSSxcuampsbR0HSdK9R1R1HTZvWll0mlAAAAAAAAAAAIiKLnLjHNLynLXKcycxzmNYmJmUKFSCAWLFy5qamxvHQvSdJ0nVHUdFm1aparWKAjNWSKAAAAARBEtYzlyXnjmOSuM4U4q4jjOM5a5k5zAyMjOqFCCCCSSS5c0jU1NzoOk6pew7TtjuO1e0646jezWr2WSaUAAAAAECIqtZco55eY464zhTirhOI5Dks5jAwMTIzqhUqQASWLFzSNTY3Og6V646zsO2O47V7DrjqNzWy9nlZ1c0LlrLEk0EQQVipRczIyMU5q5F4U8+vOPOrgThOOuU5jAxMjMzKpUggigJiSSxY0XQ1Njc6TqjtO49CX0D0T0Y7l7E6JdzU1NEvViSalBAWIqVKLSMjIxOauM4U86vPPOrz04TjrkOYwMTIzKJQqQQCKmBJJYutzQ1Njc6TrOyO475fRPRPQjuXsToXWPn6kkkEkhCkEAgggqVMjlrzzzDy7PMPPrhOQ5jBMqoVIIIAAIAJAAJJJLFzWN16TsO49CPTPUl9Q9A6o1LFiSSSSQpCwQQCCCpVMjlrzzyzy7PMPPrhOM5kwM6zKlQQAAQASAASCxY0NI3XpOw7j0I9M9SX0z0DqjU+UqpQqVIBFgEyixJYuWLFDkrzE8o8yvOONOasipBAAAAAAAAAAABJJY2OiO1fQPUj1T0pewuVKlCCqQsBIUSSSSWLlyTM5K808pPLrzziTnrEqQQAAAAAAAAAAASSWNjojtX0D1I9VfSOuND4uzMzqhQqVIALEli5c1jUuQc1vnp5pwJzVmQQAAAAAAAAAAAAAASSaHTHevpHoHTFjMyM6zKlSpABJJcsaGkamhU5q88804E5qzIIAAAAAAAAAAAAAAJJNDpjvX0j0Dqix8dVDMolSpAqCYElixc0XU0IMjlTlrIqAAAAAAAAAAAAAAAAAWNTqjqXYGZkZpUoQQRSFIsSXLroaGhBkcqctZFQAAAAAAAAAAAAAAAACxqdUdS7EngWQCAAQASACSSSwKlSCAAAAAAAAAAAAAAAAAACSSxYFSCCAACCQACSSSwKlSCAAAAAAAAAAAAAAAAAACSSxYGIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABIAJAJAJBAAIAIABAAAAAAAAAAAAAAAAAAAABIAJAJAJBAAIAIABAAAAJABAAAAAAAAAJBILEli5Y0LlzQ0Lly5csWLAkgFSChUoUMyhmUMyhQqVKkEEAEAAAAAAAAAkEgsSWLljQuXNDQuXLlyxYsCSAVIKFShQzKGZQzKFCpUqQe+ZmZkUKFCpUEEAAkksWLFzQ0NTU2NzY3Og3NzoNzc2NjU1NS5csSAQVKmZmZGRiYmBgYHOYGBgYGBiZGRkUMypUqQCAASSWLFi5oaGpqbG5sbnQbm50G5ubGxqampcuWJAIIKGZmZGRiYmBgYHOYGBgYGR+jmBzmBzmJiZGZQoQQSSWLmhqbGxudB0nSdJ1HSdR1HSdJ0G5qamhcsWJJJBIIIBUqVKFDIyMDA5jmOU5TlOY5TmOc5znMTEyMyhQggFixc0NTY2NzoOk6TpOo6TqOo6TpOg3NTU0LlixJJIJBAIKkFChQyMjAwOY5jlOU5jnP00yMTnOc5zAwMjMoVIJJLmhqbmx0HQdBubmxqXLkkgAAAAAAAAAAAAAEEFTMzMTEwOc5znMDAyMyhUgkkuaGpsbnQdB0G5ubGpcuSSAAAAAAAAAAAAAAQQVKGZ1gAEEEEFSCACSSxJJJIAAAAAAAAAAAAAAAAAAAAAAABBBBBUggAkkksSSSAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQCCpBUqQVIKggAkFiSSxYksSSSSAAAAAAAAAAAAAAAAAAQCCpBUqQVIKggAkFiSSxYksSWBIAAKFiQAAAAAAAAACCpUoUMzIyMzMzMyhQoVKkEEAgkEkklixYuXNDQ0NTQ1NC5cuWJAAAAAAAAAAIKlShQzMjIzMzMzKFChUqQQQCCQSSSWLFyxoXNDQ1NDU0LljUkkAAAAAAAAAAggggEEAgAAAAAAAAAAAAAEkgkkkkkAAAAAAAAAAgggggEAgAAAAAEgEAAAAAAEkgkkuAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADyyCCCCCCCCAQASCSQWJJJJLEkkkkkgkkEgkAEgAAEAAgEAggEEEEEEEFSCCCCCCAQASCSQWJJJJLEkkkkkgkkEgEgEgAAEAAgEAggEEEEEH5AQQQQVBBAIAAJBIJJJLEkkkkliSSSSSQSSCQSAAAQAQQCCCCCCCCCpBBBBBUEEEAgAAkEgkkksSSSSSWJJJJJJBJIJBIAABABBAIIIIIIIIKg/LCAQCACAAAACQCQSCQSASSASCQCQAAAAAAQCAQAQCAQAQQCACAAAACQCQSCQSASSASCQCQAAAAAAQCAQAQCAQfPgAAAAAAAAAAAAAAkAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAkAAAAAAAAAAAAAAgAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAH/xAApEAAABQUBAQACAwACAwAAAAABAgQFFQMGERQWEhNAUAAgMGCAkKCw/9oACAEBAAECAP8AwTZznOf3mc5/YZE41xVivFyM6i7C8C8C8zMzMzMyDyDyDyDwV4K7ldSuZV5VgVwqZ/SCca4qxXmcjOouwvAvEzMzMzMzMyDyDyDwV4K7ldSuRVwKgrgf88TDWMrO4VHOo61Hao7ndzvB3k7yZ5M8i8i8zMzMzMyDyDyDyV5K8keSPJHmm8U3em70nam603Mi8qotUDfk5GqZUdfUc6jrUdqjvUeDvB3kzyZ5M8i8i8zMzMzMzMg8g8leSvJHkjyR5pvFN4pu9N2pOtNzIvKqLWA39PX+/saplJlh1tRfVcKrlVdKrrVdqrvVdzu53Y7sZ2M6mdRdRdBdJSUk5SUB0B0B1K6kdSOxHam7Unek70nei7UXWi6UXKk40l9NaRWWuB8/75E41zKjraq+q41nOq6VXas7VXeq71Hc7ud2O7GdRdRdZQXSUlJSUlAdCugOpXUjqR2I7U3em70nek70nai60XSk5UnGkvItIrKoCsC0FwLgXAuBbube3ubm7uiuFcZcZaZYdZUWVl1dwruVdzrulZ0qulVzqOR3EzgZeZcZcK0Vm3t7W1tbW1tgrBYC0q0q4q8jgRxpuVJzoulB0oOlBzoOVBworqa0iwi0i0q4FwLQWAr2trZ2trb3RWiuFcZaZadbUW1l1ZwruVd0rulZ0qulVzqOR3E7gZeZeK4VorNzb29ra2tsFe2CwFpVxVxV5HAjjTcqTnRdKDpQdKDnQcqDhRXU1pFhVm/ISUnKSkrLSsrKyspJyUhvitOtrLq69Q4qHGu41nGqvqLjrDKhUDW+nv1nP+Oc+vYVArFUEVEWUl1FfQcU7imckzinX0VxFoLgXyMlJykrLS0tLS0rKSclI74rjraq6uvUuKhxruNdxqr6i46wysVA1vp79Zz/AI5z6A4VArFUEVkWUl1FfQcU7imcUzinX0VxFoLZKTlJWVlpaXl5eWlpWUB0BzBxkDr669SvUr666stqqz1xqes/j5AxahFFJXRWp1yZemX0F5HCQkpOUlZaWlpeXl5aWB2lQdAcwcZE7hWcFLgpXqF1ZbVVnUDU9Z/HyBi1CV6SuitTrky9MvoLyL5AXEXEXIXIXKSkpKSkpIHIHIHIrkVxK4yJnCsvrra6uqpPVE354GJVpKaCtOtoryuEiZxM5C5C5C5SUnJSclJSQOQORXIrkVxBxM4VV9dbXV1VJ6om/PAxKtFTQVp1tFeRwkRWitFYKvb2tra2draBUCsFgLCrSrQWitOsqqT1RN+jAxKtJTTWFWitMtMtFYKzb29ra2tnaBUCsFZVhVpVoLRWnWVFJ6om/RgYlWkpprAW73v36zn++c+gOFQKv1GoJv04GCp9Rq/T36zn++c+gOFT7fUagm/TgYKn1+3/AKEeMefHjx8/n8vl8vn8/Hjx5xj9bjHnx48fP5/L5fL5/Px48ecY/wAvOPxceQIFIKIJgSAiBAVuK2FaitINAM4MwMwMsJCQkJCQkJCwosws4tAtItQtgtot4oRSCm+Hy8ecfi48gQKQUQTAkBECArcVsK1FaQaAZwZgZgZYSEhISEhISFhRZhZxaBaRahbBbRbxQikFN8BpfMWgWozWLaLcKAUWpq62vr/DX19YEoJARAhBvK2laytRGgjORlIyEYiMJLfJbxLdJbhLbJbRLaJbJbZLbAWxzHMcxzHMcxzHMDbBrYNbJraNbRrbPbh7dPbx7fOwHYjsZ2UzMZoM0maxbRbhQCi1NXW19fX19fW1QSAiBCDeVtK1laiNBGYjKRkIxEYSW+S3iW6S3CW2S2iW0S2S2yW2AtgLY5jmOY5jmOY5gbYNbJrZNbRraPbZ7cPbp7ePb52A7EdjOymZjW4e3D26e3j2+ZgMwmYhYxY4SEhISEBjKxlYiMJGAjAS3iW9TtynblO26dtUrap2zTtmnbNO2SW2S3isRWYGkG0EAItTW1/h8Phr6+rp6AtwtQs5mI9vntw9tHtk9s1LZqWzUto9tnts9uHt09vHt8zAZhMxCxixwkJCQkIDGVjKxEYSMBGAlvEt6nblO3Kdt0rap21TtmnbNO2SWyS2yW8ViKzA1A2ggBFqa2v8Ph8NfW1dPRFuFqMzGYjW+e3D20e2T2zUtk9tHto1tCzHYj2+e3T24e3D24a3DW4Nuc5znOc4FuBbhbcLbhLcJblO3CW4S3iMRGcrYVECcKYB+cJBoCjM2maDsZ7fPbp7cPbh7cNbhrcG3Oc5znOcC3C24W3C24S3CW5TtwluEt4jERnK2FRAnCmAfnCQaAoxb/7ePl8NbU09PT1NYKHy8Y/ZePl8NbU09PT1NYKHy8Y/4Z6+g1tjb3d+Rk5SVlZWVlZSTkd8Fu3s/b6es/pvX0Gtsbe7vyMnKSkrKysrKSciC8Fu3s/YKnrP9gqAb8X0NQawqBVCrMrMqMoGuNUTiYf4ICT5/L4/H4fD4fH4hSCmBAAP4AgctUtYqgqoqsqsqoFIVwqAb8X0NQawqBVCrMrMqMoGuNUTiYf4ICT5/L4/H4fD4fH4hSCmBAAP4AgctUtYqgqkqsqsqsFIV/Hn8XHj5/H4a+traurq6mpqampqampqampqampqampqampqamrq62tr/D4/Lx5/Fx4+fx+Gvra2rq6upqampqampqamrq6upqampqampqamrq6utra/w+Py/wCgEzNTc5OTs7PT09PT8/Pz09PT07Ozk3Ng9TMxLy0rKSclJSMhIb+9vbu9u7u7u7u7u729vb2/vyEjJSUnKSstLzEzNTc5OTs7Oz09PT8/Pz09PT07Ozk5NzUzMS8tKyknJSUjISG/v727vbu7u7u7u7u9u729v78hIyUlJykrLS8x0nR9H0fR9H0XRdF0XRdD0PQ9F0XRdF0XRdF0fR9H0nSdJ0vS9L0vTdN03TdP0/T9P0/T9P0/T9P0/T9R0/T9P0/T9P0/TdN03S9L0vS9J0nSdJ0fR9H0XRdF0PRdD0PQ9D0PRdF0XRdF0XR9H0fSdJ0nS9L0vS9N03TdN0/T9P0/T9P0/T9P0/T9P1HT9P0/T9P0/T9N03TdL0vS9L0vSS8tLy0tLS0rKysrKysrKysrKystLS0vLS8vLy8vMTExMTExMzMzMTMzMzM1NTUzMzMzMzMzMzExMTExMS8vLy8vLy8tKy0tKysrKysrKysrKysrLS0tLy0vLy8vLzExMTExMTMzMzEzMzMzNTU1MzMzMzMzMzMxMTExMTEvLy8vnOc5znOc5znOc5znOc5znOc59ZznPr169evXr169evXr169evXr16znOfWc5znOc5znOc5znOc5znOc5znOc59ZznPr169evXr169evXr169evXr16znOfWc5z/9YD//xAArEAEAAgIDAQABBAICAQUAAAAAAVICYgNRYQRBEEBQUzFCIDARYICQoLD/2gAIAQEAAz8A/wDgmhCEI/nYQj+RhjH5ccflxw44YMe0dtmzZs2bNmzZs2bIsjtiwlxy45/Ljn8se0fwuPbjj8uOPy44YQxR2izZs2bNmzZs2bNkWR2xYS45cc/lhP5Y9/wEQwj8sIRD1s2bNmzZs2bNmzZs2bNmzZs2bNmzZs2bNmyLMZYZMZ/KJ/dRDCPywhjCI/LZs2bNmzZs2bNmzZs2bNmzZs2bNmzZs2bNkWYywlhP5RP/ABj9hDGGMIh69bNmzZs2bNmzZsmybJsmybJsmybJsmybJsmybJs2bNmzZs2bNmzZ7+mMsZYyj9hDGGMIj9NmzZs2bNmzZs2bJsmybJsmybJs2TZNk2TZNk2bJs2bNmzZs2bNmzZ6iWMsXr16hiwYMGDBgwYo/T169/T162bNmzZs2TZNk2T2ntPae09pSlKUpSlPae09p7T2mybJsmzZs2bNmz17+nr16hiwYOPtx9uPtx9sO2DBih69evXr1s2bNmzZsmybJsmye09p7T2lKUpSlKU9p7T2ntNk2TZNmzZs2bNmz17+vr1s2bNmzZs2bNmzZs2evXr169bNmye09p7SlKUp/wC6UpSlKe09p7etmzZs9evWzZs2bNmzZs2bNmzZs2bPXr1s9bNmye09p7SlKUp/7pSlKUp7T29bPWz169evWzZs2bNmzZs2bNmzZs2bNmzZs2evU9plM/vJhMJ7T29bNnrZ62bNmzZs2bNmzZs2bNmzZs2bNnr39J7TKZ/eTCYT3+nr162bNnrZs2bJsntNk2TZPabNmzZs2etnr39JlM/wUwmP09etmzZs2bNk2TZNk2TZNk2bNmzZs2bNnv6TKZ/gphMfp69etk9p7T2ntKUpSlKUp7T2nt69e/pMpn+GmH/j9PXr1Pae09pSySlklKU9p7T29evf0mUz/DTCY/T16lP/AHSlKU/xUpSlP/dKUpT/ABUpT/8AQllKWTJl0y6ZdMumXTLpl0y6ZJSn+QlKWTJl0y6ZdMumXTLpl0y6ZJSn/sn9xKWXTLpn0z6Z9M+mXTLplVlVlVlVlVlVlVlVlVlVlRlVlVlRlVlVlVlVlVlVlVl0z6Z9M4/DPpn0z6ZdMkp/byll0y6Z9M+mfTPpn0y6ZVZVZVZVZVZVZVZVZUZVZUZVZVZVZVZVZVZVZVZVZVZdM+mfTOPwz6Z9M+mTJlVlVlVl0yZ9M2fTPpn0z6Z9M+mbPpn0z6Z9M2fTPpl0yqyqyqyqyqyomiaJomiaJomiaJomjRo0aNGjRo0aNGjRNE0TRNE0TRNE0TRNE0ZVZVZVZVZVZVZM+mbPpn0z6Z9M+mfTNn0z6Z9M+mfTPpl0y6ZVZVZVTVlVlRNE0TRlRNE0TRNE0TRo0aNGjRo0aNGjRomiaJomiaJomiaJomqaJqyq0TRNE0TRNE0TVNE1TVNU1TRNE1TVNU0TRNE0TRNGjRo0aNGjRhWHFHTgh88Pmj8Pnj/V89HBRwf1w4f64cNMXFSHFTFxUxcVIcP9cOGkOCkPno+ej55/D55cEuKemHUIo0aNGjRo0TRNE0TRNE0TVNE0TVNE1TVNE1TRNU0TRNE0TRNGjRo0aNGjRhWHFHThh88Pnj8Pnq+ejgo4P64cP9cOKkOKkOKmLipi4aYuH+uHBSHBSHz0fPR88/h88uCXFNWHUIo0aNGjRo4ZcU9MOoRRFGjRo0aNGjRo0aNGjRo0RRhVxR04IcGP4cGP+jij/GEMI/xjCP3+M/5xhxT/AJwhwT/o4Mv9XBk4p6YdQiiKNGjRo0aNGjRo0aNGjRoijGsOKOnBi4Mfw4I/0cUf4whhH+MYR+/xn/OMOKf84Q4J/wBHBP8Ar/zxrDCsOKkOKjhq4auGrhq4auGjipDjpDGsI/k8awwrDipDio4aOGrhq4auGrho4qQ46QxrCP8A0bHcMLQ47w4rw4buCzgs4O3A4HA4XA4HA4HA4O3BZwWcN3Fdx3hhaGNoR/Dx3DC0OO8OK8OG7gs4LODtwOBwOFwOBwOBwODtwWcFnDdxXcd4YWhjaEf88UftoQh4y6ZuRyuVzOZzeudz+uf1z+uf1z+uf1z+uf1zuf1z+uf1z+uf1z+udzR25nM5o7c3rlcrlZsniOkSj9tCEPGXTNyuVy+uZzOb1z+uf1z+uf1z+uf1z+uf1z+udz+uf1z+uf1z+uf1z+ueO3O5nM5vXK5XKzZPEdMUftoYsemHTDpx9OPpxVcVXDVw1cNXDVw0cNHDRw0cNHDRw0cNHDRw0cNHDRw0cNHDRw0cNHDVw1cNXFVxVcVXFVx9OPph0w6Yo/bQxY9MOnH04+nH04quKrhq4auGrhq4aOGjho4aOGjho4aOGkOGkOGkOGjho4aOGjho4aOGjhq4auGriq4quKriq4+nH0w6Ydf+wHgcLhcLicTjYdww7hh3DDuGPcMe4Y9ww7hh3DDuGHcONxuJxOFwuBwOB8753z2fPZ89nz3fNd893zXfPd893z3fP/Y+e757uC75/wCyHz/2Q+f+yHBd893z3fPd893z3fPd893zXfNd893z2fPZ8/b5+3zvncDgcLhcLicTjYdww7hh3DDuGHcMe4Ydww7hh3DDuGHcONxuJxOFwuBwPnfO+d89nz2fPZ893zXfPd813z3fPd893z/2Pnu+e7gu+f8Ash8/9kPn/shwXcF3z3fPd893z3fPd893zXfNd893z2fPZ8/b5+3zvncDdu3bt03bt26bpum6bpum6bt27du3bt26bt26bpum6bpum6bpum6bt03TdN26bpum6bpum7dN03TdN03TdN03TdN03Tdum7dum7dN27dum6bpum6bpum6bpum7du3bt03bpu3bpum6bpum6bpum6bpu3TdN03bpum6bpum6bt03TdN03TdN03TdN03TdN03TduysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysmzKzKzKybMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrJT+2lKUpSlKUpSlKUpSlKUpSlKUpSlKUpSlKUpSn9tKUpSlKUpSlKUpSlKUpSlKUpSlKUpSlKUpT/wDrA//EAB0RAAMBAAMBAQEAAAAAAAAAAAABERIwQFAgkMD/2gAIAQIBAT8A/COlKioqKioqKi+zSoqKioqL59Ro0aKyvpVlZWaNFXiVGkaNFZWV9CsrNGjRpFXepo0V8c69Zo0u1pGilfVnJWaNF+NFXNUaNFfmU0aReamkaNPzNM19VlZWaKysrK/XrKzTNGjRWaKyv+u0/8QAHREBAQACAQUAAAAAAAAAAAAAEQBAUCAQITCQwP/aAAgBAwEBPwD1NkRER07eYiIiNMRERGARERGgIiNAREZRERoCIjiYBERqiIwiI1REcCIiIiIjbkREREREfXZ//9k=";d();d();var DD=!1;function kD(){DD=!0}function AD(){return DD}var E1=class{constructor(r){m(this,"backgroundAlpha",1);m(this,"backgroundColor",new ar);m(this,"width",0);m(this,"height",0);m(this,"options",{});m(this,"renderer");m(this,"enabledLayers",new Set([0,1]));m(this,"handleWebGLContextCreationError",r=>{this.options.onWebGLContextCreationError?.(r)});m(this,"handleWebGLContextLost",r=>{this.options.onWebGLContextLost?.(r)});m(this,"handleWebGLContextRestored",r=>{this.options.onWebGLContextRestored?.(r)});try{this.options=r,AD()?(this.renderer={setSize:()=>{},state:{reset:()=>{}},properties:{get:()=>{}},getSize:()=>({width:window.innerWidth,height:innerHeight}),getDrawingBufferSize:()=>({width:window.innerWidth,height:innerHeight}),getClearAlpha:()=>1,getClearColor:()=>new ar,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 TC({canvas:r.canvas,alpha:r.alpha||!1,stencil:!0,antialias:typeof r.antialias=="boolean"?r.antialias:!0,powerPreference:"high-performance",preserveDrawingBuffer:!0}),this.backgroundColor=new ar(r.backgroundColor??"#ffffff"),this.backgroundAlpha=r.backgroundAlpha??1}catch(t){A.error(t),r.onWebGLRendererError&&r.onWebGLRendererError(t)}this.domElement()?.addEventListener("webglcontextlost",this.handleWebGLContextLost),this.domElement()?.addEventListener("webglcontextrestored",this.handleWebGLContextRestored),this.domElement()?.addEventListener("webglcontextcreationerror",this.handleWebGLContextCreationError)}destroy(){this.renderer&&this.renderer.dispose?.(),this.domElement()?.removeEventListener("webglcontextlost",this.handleWebGLContextLost),this.domElement()?.removeEventListener("webglcontextrestored",this.handleWebGLContextRestored),this.domElement()?.removeEventListener("webglcontextcreationerror",this.handleWebGLContextCreationError)}render(r,t){if(this.renderer){this.renderer.state.reset(),t.layers.disableAll();for(let o of this.enabledLayers.values())t.layers.enable(o);this.renderer.clearStencil(),this.renderer.autoClear=!1,this.renderer.setRenderTarget(null),this.renderer.render(r,t),this.renderer.clearDepth(),t.layers.disableAll(),t.layers.enable(ly.ALWAYS_ON_TOP),this.renderer.render(r,t),this.renderer.state.reset()}}clear(){this.renderer&&(this.renderer.setClearColor(this.backgroundColor,this.backgroundAlpha),this.renderer.clear())}setBufferSize(r,t){y.env.NODE_ENV==="test"||!this.renderer||(this.width=r,this.height=t,this.renderer.setSize(r,t,!1))}setBackgroundColor(r,t){this.backgroundColor=r,this.backgroundAlpha=t}domElement(){return this.renderer?.domElement}};d();d();var LD='"use strict";(()=>{var Qe=Object.defineProperty;var _t=(r,e,t)=>e in r?Qe(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var vt=(r,e)=>{for(var t in e)Qe(r,t,{get:e[t],enumerable:!0})};var w=(r,e,t)=>_t(r,typeof e!="symbol"?e+"":e,t);function Ke(r,e){return e.x+e.w<r.x+r.w&&e.x>r.x&&e.y>r.y&&e.y+e.h<r.y+r.h}function Ge(r,e){let[t,s]=e;return t>=r.x&&t<=r.x+r.w&&s>=r.y&&s<=r.y+r.h}function He(r,e){let t=e.x,s=e.y,n=e.x+e.w,a=e.y+e.h,o=r.x,i=r.y,u=r.x+r.w,l=r.y+r.h;return t<u&&o<n&&s<l&&i<a}function L(r,e){for(let t=0;t<e.length;t++)r.push(e[t])}var b=class{constructor(e,t,s,n,a){w(this,"x");w(this,"y");w(this,"w");w(this,"h");w(this,"userData");this.userData=typeof a>"u"?null:a,this.x=e,this.y=t,this.w=s,this.h=n}contains(e){return e===this?!1:Ke(this,e)}intersects(e){return He(this,e)}intersectsPoint(e){return Ge(this,e)}draw(e){e.fillStyle="rgba(123,222,26, 0.8)",e.fillRect(this.x,this.y,this.w,this.h)}};var Re=class r{constructor(e,t){w(this,"topLeft");w(this,"topRight");w(this,"bottomLeft");w(this,"bottomRight");w(this,"divided",!1);w(this,"boundary");w(this,"capacity",16);w(this,"objects",[]);w(this,"parent");this.parent=t,this.boundary=e}getSize(){return this.divided?this.objects.length+this.topLeft.getSize()+this.topRight.getSize()+this.bottomLeft.getSize()+this.bottomRight.getSize():this.objects.length}subdivide(){let{x:e,y:t,w:s,h:n}=this.boundary;this.topLeft=new r(new b(e,t,s/2,n/2),this),this.topRight=new r(new b(e+s/2,t,s/2,n/2),this),this.bottomLeft=new r(new b(e,t+n/2,s/2,n/2),this),this.bottomRight=new r(new b(e+s/2,t+n/2,s/2,n/2),this),this.divided=!0}queryRect(e){let t=[];if(this.boundary.intersects(e))t.push(...this.objects);else return[];return this.divided&&(L(t,this.topLeft.queryRect(e)),L(t,this.topRight.queryRect(e)),L(t,this.bottomLeft.queryRect(e)),L(t,this.bottomRight.queryRect(e))),t}queryPoint(e){let t=[];if(this.boundary.intersectsPoint(e))t.push(...this.objects);else return[];return this.divided&&(L(t,this.topLeft.queryPoint(e)),L(t,this.topRight.queryPoint(e)),L(t,this.bottomLeft.queryPoint(e)),L(t,this.bottomRight.queryPoint(e))),t}insert(e){return(this.parent?!this.boundary.contains(e):!this.boundary.intersects(e))?!1:this.objects.length<this.capacity?(this.objects.push(e),!0):(this.divided||this.subdivide(),(this.topLeft.insert(e)||this.topRight.insert(e)||this.bottomLeft.insert(e)||this.bottomRight.insert(e))===!1&&this.objects.push(e),!0)}drawObjects(e){this.objects.forEach(t=>t.draw(e)),this.divided&&(this.topLeft.drawObjects(e),this.topRight.drawObjects(e),this.bottomLeft.drawObjects(e),this.bottomRight.drawObjects(e))}draw(e){e.rect(this.boundary.x,this.boundary.y,this.boundary.w,this.boundary.h),this.divided&&(this.topLeft.draw(e),this.topRight.draw(e),this.bottomLeft.draw(e),this.bottomRight.draw(e)),e.strokeStyle="black",e.lineWidth=4,e.stroke()}};var be={};vt(be,{BRAND:()=>Wt,DIRTY:()=>K,EMPTY_PATH:()=>wt,INVALID:()=>p,NEVER:()=>Or,OK:()=>T,ParseStatus:()=>k,Schema:()=>_,ZodAny:()=>W,ZodArray:()=>B,ZodBigInt:()=>H,ZodBoolean:()=>ee,ZodBranded:()=>Se,ZodCatch:()=>le,ZodDate:()=>te,ZodDefault:()=>ue,ZodDiscriminatedUnion:()=>Me,ZodEffects:()=>E,ZodEnum:()=>ce,ZodError:()=>C,ZodFirstPartyTypeKind:()=>m,ZodFunction:()=>Ze,ZodIntersection:()=>ae,ZodIssueCode:()=>c,ZodLazy:()=>ie,ZodLiteral:()=>oe,ZodMap:()=>_e,ZodNaN:()=>xe,ZodNativeEnum:()=>de,ZodNever:()=>j,ZodNull:()=>se,ZodNullable:()=>Z,ZodNumber:()=>G,ZodObject:()=>S,ZodOptional:()=>I,ZodParsedType:()=>f,ZodPipeline:()=>Ae,ZodPromise:()=>q,ZodReadonly:()=>fe,ZodRecord:()=>Pe,ZodSchema:()=>_,ZodSet:()=>ve,ZodString:()=>U,ZodSymbol:()=>ye,ZodTransformer:()=>E,ZodTuple:()=>P,ZodType:()=>_,ZodUndefined:()=>re,ZodUnion:()=>ne,ZodUnknown:()=>z,ZodVoid:()=>ge,addIssueToContext:()=>d,any:()=>er,array:()=>nr,bigint:()=>Jt,boolean:()=>ut,coerce:()=>Ar,custom:()=>ot,date:()=>Qt,datetimeRegex:()=>at,defaultErrorMap:()=>D,discriminatedUnion:()=>cr,effect:()=>xr,enum:()=>gr,function:()=>pr,getErrorMap:()=>he,getParsedType:()=>M,instanceof:()=>Yt,intersection:()=>dr,isAborted:()=>Ee,isAsync:()=>pe,isDirty:()=>je,isValid:()=>F,late:()=>qt,lazy:()=>mr,literal:()=>yr,makeIssue:()=>Ce,map:()=>fr,nan:()=>Xt,nativeEnum:()=>_r,never:()=>rr,null:()=>Ht,nullable:()=>kr,number:()=>dt,object:()=>ar,objectUtil:()=>ze,oboolean:()=>Sr,onumber:()=>Cr,optional:()=>br,ostring:()=>Rr,pipeline:()=>Tr,preprocess:()=>wr,promise:()=>vr,quotelessJson:()=>xt,record:()=>lr,set:()=>hr,setErrorMap:()=>kt,strictObject:()=>ir,string:()=>ct,symbol:()=>Kt,transformer:()=>xr,tuple:()=>ur,undefined:()=>Gt,union:()=>or,unknown:()=>tr,util:()=>v,void:()=>sr});var v;(function(r){r.assertEqual=n=>{};function e(n){}r.assertIs=e;function t(n){throw new Error}r.assertNever=t,r.arrayToEnum=n=>{let a={};for(let o of n)a[o]=o;return a},r.getValidEnumValues=n=>{let a=r.objectKeys(n).filter(i=>typeof n[n[i]]!="number"),o={};for(let i of a)o[i]=n[i];return r.objectValues(o)},r.objectValues=n=>r.objectKeys(n).map(function(a){return n[a]}),r.objectKeys=typeof Object.keys=="function"?n=>Object.keys(n):n=>{let a=[];for(let o in n)Object.prototype.hasOwnProperty.call(n,o)&&a.push(o);return a},r.find=(n,a)=>{for(let o of n)if(a(o))return o},r.isInteger=typeof Number.isInteger=="function"?n=>Number.isInteger(n):n=>typeof n=="number"&&Number.isFinite(n)&&Math.floor(n)===n;function s(n,a=" | "){return n.map(o=>typeof o=="string"?`\'${o}\'`:o).join(a)}r.joinValues=s,r.jsonStringifyReplacer=(n,a)=>typeof a=="bigint"?a.toString():a})(v||(v={}));var ze;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(ze||(ze={}));var f=v.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),M=r=>{switch(typeof r){case"undefined":return f.undefined;case"string":return f.string;case"number":return Number.isNaN(r)?f.nan:f.number;case"boolean":return f.boolean;case"function":return f.function;case"bigint":return f.bigint;case"symbol":return f.symbol;case"object":return Array.isArray(r)?f.array:r===null?f.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?f.promise:typeof Map<"u"&&r instanceof Map?f.map:typeof Set<"u"&&r instanceof Set?f.set:typeof Date<"u"&&r instanceof Date?f.date:f.object;default:return f.unknown}};var c=v.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),xt=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:"),C=class r extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){let t=e||function(a){return a.message},s={_errors:[]},n=a=>{for(let o of a.issues)if(o.code==="invalid_union")o.unionErrors.map(n);else if(o.code==="invalid_return_type")n(o.returnTypeError);else if(o.code==="invalid_arguments")n(o.argumentsError);else if(o.path.length===0)s._errors.push(t(o));else{let i=s,u=0;for(;u<o.path.length;){let l=o.path[u];u===o.path.length-1?(i[l]=i[l]||{_errors:[]},i[l]._errors.push(t(o))):i[l]=i[l]||{_errors:[]},i=i[l],u++}}};return n(this),s}static assert(e){if(!(e instanceof r))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,v.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){let t={},s=[];for(let n of this.issues)n.path.length>0?(t[n.path[0]]=t[n.path[0]]||[],t[n.path[0]].push(e(n))):s.push(e(n));return{formErrors:s,fieldErrors:t}}get formErrors(){return this.flatten()}};C.create=r=>new C(r);var bt=(r,e)=>{let t;switch(r.code){case c.invalid_type:r.received===f.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case c.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,v.jsonStringifyReplacer)}`;break;case c.unrecognized_keys:t=`Unrecognized key(s) in object: ${v.joinValues(r.keys,", ")}`;break;case c.invalid_union:t="Invalid input";break;case c.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${v.joinValues(r.options)}`;break;case c.invalid_enum_value:t=`Invalid enum value. Expected ${v.joinValues(r.options)}, received \'${r.received}\'`;break;case c.invalid_arguments:t="Invalid function arguments";break;case c.invalid_return_type:t="Invalid function return type";break;case c.invalid_date:t="Invalid date";break;case c.invalid_string:typeof r.validation=="object"?"includes"in r.validation?(t=`Invalid input: must include "${r.validation.includes}"`,typeof r.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${r.validation.position}`)):"startsWith"in r.validation?t=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?t=`Invalid input: must end with "${r.validation.endsWith}"`:v.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case c.too_small:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(r.minimum))}`:t="Invalid input";break;case c.too_big:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="bigint"?t=`BigInt must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(r.maximum))}`:t="Invalid input";break;case c.custom:t="Invalid input";break;case c.invalid_intersection_types:t="Intersection results could not be merged";break;case c.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case c.not_finite:t="Number must be finite";break;default:t=e.defaultError,v.assertNever(r)}return{message:t}},D=bt;var et=D;function kt(r){et=r}function he(){return et}var Ce=r=>{let{data:e,path:t,errorMaps:s,issueData:n}=r,a=[...t,...n.path||[]],o={...n,path:a};if(n.message!==void 0)return{...n,path:a,message:n.message};let i="",u=s.filter(l=>!!l).slice().reverse();for(let l of u)i=l(o,{data:e,defaultError:i}).message;return{...n,path:a,message:i}},wt=[];function d(r,e){let t=he(),s=Ce({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t,t===D?void 0:D].filter(n=>!!n)});r.common.issues.push(s)}var k=class r{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){let s=[];for(let n of t){if(n.status==="aborted")return p;n.status==="dirty"&&e.dirty(),s.push(n.value)}return{status:e.value,value:s}}static async mergeObjectAsync(e,t){let s=[];for(let n of t){let a=await n.key,o=await n.value;s.push({key:a,value:o})}return r.mergeObjectSync(e,s)}static mergeObjectSync(e,t){let s={};for(let n of t){let{key:a,value:o}=n;if(a.status==="aborted"||o.status==="aborted")return p;a.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof o.value<"u"||n.alwaysSet)&&(s[a.value]=o.value)}return{status:e.value,value:s}}},p=Object.freeze({status:"aborted"}),K=r=>({status:"dirty",value:r}),T=r=>({status:"valid",value:r}),Ee=r=>r.status==="aborted",je=r=>r.status==="dirty",F=r=>r.status==="valid",pe=r=>typeof Promise<"u"&&r instanceof Promise;var h;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e?.message})(h||(h={}));var N=class{constructor(e,t,s,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=s,this._key=n}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},tt=(r,e)=>{if(F(e))return{success:!0,data:e.value};if(!r.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new C(r.common.issues);return this._error=t,this._error}}};function y(r){if(!r)return{};let{errorMap:e,invalid_type_error:t,required_error:s,description:n}=r;if(e&&(t||s))throw new Error(`Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:n}:{errorMap:(o,i)=>{let{message:u}=r;return o.code==="invalid_enum_value"?{message:u??i.defaultError}:typeof i.data>"u"?{message:u??s??i.defaultError}:o.code!=="invalid_type"?{message:i.defaultError}:{message:u??t??i.defaultError}},description:n}}var _=class{get description(){return this._def.description}_getType(e){return M(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:M(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new k,ctx:{common:e.parent.common,data:e.data,parsedType:M(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(pe(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let s=this.safeParse(e,t);if(s.success)return s.data;throw s.error}safeParse(e,t){let s={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:M(e)},n=this._parseSync({data:e,path:s.path,parent:s});return tt(s,n)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:M(e)};if(!this["~standard"].async)try{let s=this._parseSync({data:e,path:[],parent:t});return F(s)?{value:s.value}:{issues:t.common.issues}}catch(s){s?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(s=>F(s)?{value:s.value}:{issues:t.common.issues})}async parseAsync(e,t){let s=await this.safeParseAsync(e,t);if(s.success)return s.data;throw s.error}async safeParseAsync(e,t){let s={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:M(e)},n=this._parse({data:e,path:s.path,parent:s}),a=await(pe(n)?n:Promise.resolve(n));return tt(s,a)}refine(e,t){let s=n=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(n):t;return this._refinement((n,a)=>{let o=e(n),i=()=>a.addIssue({code:c.custom,...s(n)});return typeof Promise<"u"&&o instanceof Promise?o.then(u=>u?!0:(i(),!1)):o?!0:(i(),!1)})}refinement(e,t){return this._refinement((s,n)=>e(s)?!0:(n.addIssue(typeof t=="function"?t(s,n):t),!1))}_refinement(e){return new E({schema:this,typeName:m.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return I.create(this,this._def)}nullable(){return Z.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return B.create(this)}promise(){return q.create(this,this._def)}or(e){return ne.create([this,e],this._def)}and(e){return ae.create(this,e,this._def)}transform(e){return new E({...y(this._def),schema:this,typeName:m.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new ue({...y(this._def),innerType:this,defaultValue:t,typeName:m.ZodDefault})}brand(){return new Se({typeName:m.ZodBranded,type:this,...y(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new le({...y(this._def),innerType:this,catchValue:t,typeName:m.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Ae.create(this,e)}readonly(){return fe.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Tt=/^c[^\\s-]{8,}$/i,Rt=/^[0-9a-z]+$/,Ct=/^[0-9A-HJKMNP-TV-Z]{26}$/i,St=/^[0-9a-fA-F]{8}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{12}$/i,At=/^[a-z0-9_-]{21}$/i,Ot=/^[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]*$/,It=/^[-+]?P(?!$)(?:(?:[-+]?\\d+Y)|(?:[-+]?\\d+[.,]\\d+Y$))?(?:(?:[-+]?\\d+M)|(?:[-+]?\\d+[.,]\\d+M$))?(?:(?:[-+]?\\d+W)|(?:[-+]?\\d+[.,]\\d+W$))?(?:(?:[-+]?\\d+D)|(?:[-+]?\\d+[.,]\\d+D$))?(?:T(?=[\\d+-])(?:(?:[-+]?\\d+H)|(?:[-+]?\\d+[.,]\\d+H$))?(?:(?:[-+]?\\d+M)|(?:[-+]?\\d+[.,]\\d+M$))?(?:[-+]?\\d+(?:[.,]\\d+)?S)?)??$/,Nt=/^(?!\\.)(?!.*\\.\\.)([A-Z0-9_\'+\\-\\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\\-]*\\.)+[A-Z]{2,}$/i,Et="^(\\\\p{Extended_Pictographic}|\\\\p{Emoji_Component})+$",Be,jt=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Mt=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\/(3[0-2]|[12]?[0-9])$/,Pt=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Zt=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,$t=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Lt=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,st="((\\\\d\\\\d[2468][048]|\\\\d\\\\d[13579][26]|\\\\d\\\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\\\d|30)|(02)-(0[1-9]|1\\\\d|2[0-8])))",Dt=new RegExp(`^${st}$`);function nt(r){let e="[0-5]\\\\d";r.precision?e=`${e}\\\\.\\\\d{${r.precision}}`:r.precision==null&&(e=`${e}(\\\\.\\\\d+)?`);let t=r.precision?"+":"?";return`([01]\\\\d|2[0-3]):[0-5]\\\\d(:${e})${t}`}function Vt(r){return new RegExp(`^${nt(r)}$`)}function at(r){let e=`${st}T${nt(r)}`,t=[];return t.push(r.local?"Z?":"Z"),r.offset&&t.push("([+-]\\\\d{2}:?\\\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function zt(r,e){return!!((e==="v4"||!e)&&jt.test(r)||(e==="v6"||!e)&&Pt.test(r))}function Bt(r,e){if(!Ot.test(r))return!1;try{let[t]=r.split("."),s=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),n=JSON.parse(atob(s));return!(typeof n!="object"||n===null||"typ"in n&&n?.typ!=="JWT"||!n.alg||e&&n.alg!==e)}catch{return!1}}function Ft(r,e){return!!((e==="v4"||!e)&&Mt.test(r)||(e==="v6"||!e)&&Zt.test(r))}var U=class r extends _{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==f.string){let a=this._getOrReturnCtx(e);return d(a,{code:c.invalid_type,expected:f.string,received:a.parsedType}),p}let s=new k,n;for(let a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(n=this._getOrReturnCtx(e,n),d(n,{code:c.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),s.dirty());else if(a.kind==="max")e.data.length>a.value&&(n=this._getOrReturnCtx(e,n),d(n,{code:c.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),s.dirty());else if(a.kind==="length"){let o=e.data.length>a.value,i=e.data.length<a.value;(o||i)&&(n=this._getOrReturnCtx(e,n),o?d(n,{code:c.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):i&&d(n,{code:c.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),s.dirty())}else if(a.kind==="email")Nt.test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"email",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="emoji")Be||(Be=new RegExp(Et,"u")),Be.test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"emoji",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="uuid")St.test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"uuid",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="nanoid")At.test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"nanoid",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="cuid")Tt.test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"cuid",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="cuid2")Rt.test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"cuid2",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="ulid")Ct.test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"ulid",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),d(n,{validation:"url",code:c.invalid_string,message:a.message}),s.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"regex",code:c.invalid_string,message:a.message}),s.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(n=this._getOrReturnCtx(e,n),d(n,{code:c.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),s.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(n=this._getOrReturnCtx(e,n),d(n,{code:c.invalid_string,validation:{startsWith:a.value},message:a.message}),s.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(n=this._getOrReturnCtx(e,n),d(n,{code:c.invalid_string,validation:{endsWith:a.value},message:a.message}),s.dirty()):a.kind==="datetime"?at(a).test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{code:c.invalid_string,validation:"datetime",message:a.message}),s.dirty()):a.kind==="date"?Dt.test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{code:c.invalid_string,validation:"date",message:a.message}),s.dirty()):a.kind==="time"?Vt(a).test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{code:c.invalid_string,validation:"time",message:a.message}),s.dirty()):a.kind==="duration"?It.test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"duration",code:c.invalid_string,message:a.message}),s.dirty()):a.kind==="ip"?zt(e.data,a.version)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"ip",code:c.invalid_string,message:a.message}),s.dirty()):a.kind==="jwt"?Bt(e.data,a.alg)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"jwt",code:c.invalid_string,message:a.message}),s.dirty()):a.kind==="cidr"?Ft(e.data,a.version)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"cidr",code:c.invalid_string,message:a.message}),s.dirty()):a.kind==="base64"?$t.test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"base64",code:c.invalid_string,message:a.message}),s.dirty()):a.kind==="base64url"?Lt.test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"base64url",code:c.invalid_string,message:a.message}),s.dirty()):v.assertNever(a);return{status:s.value,value:e.data}}_regex(e,t,s){return this.refinement(n=>e.test(n),{validation:t,code:c.invalid_string,...h.errToObj(s)})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...h.errToObj(e)})}url(e){return this._addCheck({kind:"url",...h.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...h.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...h.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...h.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...h.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...h.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...h.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...h.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...h.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...h.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...h.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...h.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...h.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...h.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...h.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...h.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...h.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...h.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...h.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...h.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...h.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...h.errToObj(t)})}nonempty(e){return this.min(1,h.errToObj(e))}trim(){return new r({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new r({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new r({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};U.create=r=>new U({checks:[],typeName:m.ZodString,coerce:r?.coerce??!1,...y(r)});function Ut(r,e){let t=(r.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,n=t>s?t:s,a=Number.parseInt(r.toFixed(n).replace(".","")),o=Number.parseInt(e.toFixed(n).replace(".",""));return a%o/10**n}var G=class r extends _{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==f.number){let a=this._getOrReturnCtx(e);return d(a,{code:c.invalid_type,expected:f.number,received:a.parsedType}),p}let s,n=new k;for(let a of this._def.checks)a.kind==="int"?v.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{code:c.invalid_type,expected:"integer",received:"float",message:a.message}),n.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(s=this._getOrReturnCtx(e,s),d(s,{code:c.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(s=this._getOrReturnCtx(e,s),d(s,{code:c.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):a.kind==="multipleOf"?Ut(e.data,a.value)!==0&&(s=this._getOrReturnCtx(e,s),d(s,{code:c.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{code:c.not_finite,message:a.message}),n.dirty()):v.assertNever(a);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,h.toString(t))}gt(e,t){return this.setLimit("min",e,!1,h.toString(t))}lte(e,t){return this.setLimit("max",e,!0,h.toString(t))}lt(e,t){return this.setLimit("max",e,!1,h.toString(t))}setLimit(e,t,s,n){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:h.toString(n)}]})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:h.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:h.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:h.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:h.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:h.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:h.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:h.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:h.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:h.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&v.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(t===null||s.value>t)&&(t=s.value):s.kind==="max"&&(e===null||s.value<e)&&(e=s.value)}return Number.isFinite(t)&&Number.isFinite(e)}};G.create=r=>new G({checks:[],typeName:m.ZodNumber,coerce:r?.coerce||!1,...y(r)});var H=class r extends _{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==f.bigint)return this._getInvalidInput(e);let s,n=new k;for(let a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(s=this._getOrReturnCtx(e,s),d(s,{code:c.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(s=this._getOrReturnCtx(e,s),d(s,{code:c.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(s=this._getOrReturnCtx(e,s),d(s,{code:c.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):v.assertNever(a);return{status:n.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return d(t,{code:c.invalid_type,expected:f.bigint,received:t.parsedType}),p}gte(e,t){return this.setLimit("min",e,!0,h.toString(t))}gt(e,t){return this.setLimit("min",e,!1,h.toString(t))}lte(e,t){return this.setLimit("max",e,!0,h.toString(t))}lt(e,t){return this.setLimit("max",e,!1,h.toString(t))}setLimit(e,t,s,n){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:h.toString(n)}]})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:h.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:h.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:h.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:h.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:h.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};H.create=r=>new H({checks:[],typeName:m.ZodBigInt,coerce:r?.coerce??!1,...y(r)});var ee=class extends _{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==f.boolean){let s=this._getOrReturnCtx(e);return d(s,{code:c.invalid_type,expected:f.boolean,received:s.parsedType}),p}return T(e.data)}};ee.create=r=>new ee({typeName:m.ZodBoolean,coerce:r?.coerce||!1,...y(r)});var te=class r extends _{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==f.date){let a=this._getOrReturnCtx(e);return d(a,{code:c.invalid_type,expected:f.date,received:a.parsedType}),p}if(Number.isNaN(e.data.getTime())){let a=this._getOrReturnCtx(e);return d(a,{code:c.invalid_date}),p}let s=new k,n;for(let a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(n=this._getOrReturnCtx(e,n),d(n,{code:c.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),s.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(n=this._getOrReturnCtx(e,n),d(n,{code:c.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),s.dirty()):v.assertNever(a);return{status:s.value,value:new Date(e.data.getTime())}}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:h.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:h.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}};te.create=r=>new te({checks:[],coerce:r?.coerce||!1,typeName:m.ZodDate,...y(r)});var ye=class extends _{_parse(e){if(this._getType(e)!==f.symbol){let s=this._getOrReturnCtx(e);return d(s,{code:c.invalid_type,expected:f.symbol,received:s.parsedType}),p}return T(e.data)}};ye.create=r=>new ye({typeName:m.ZodSymbol,...y(r)});var re=class extends _{_parse(e){if(this._getType(e)!==f.undefined){let s=this._getOrReturnCtx(e);return d(s,{code:c.invalid_type,expected:f.undefined,received:s.parsedType}),p}return T(e.data)}};re.create=r=>new re({typeName:m.ZodUndefined,...y(r)});var se=class extends _{_parse(e){if(this._getType(e)!==f.null){let s=this._getOrReturnCtx(e);return d(s,{code:c.invalid_type,expected:f.null,received:s.parsedType}),p}return T(e.data)}};se.create=r=>new se({typeName:m.ZodNull,...y(r)});var W=class extends _{constructor(){super(...arguments),this._any=!0}_parse(e){return T(e.data)}};W.create=r=>new W({typeName:m.ZodAny,...y(r)});var z=class extends _{constructor(){super(...arguments),this._unknown=!0}_parse(e){return T(e.data)}};z.create=r=>new z({typeName:m.ZodUnknown,...y(r)});var j=class extends _{_parse(e){let t=this._getOrReturnCtx(e);return d(t,{code:c.invalid_type,expected:f.never,received:t.parsedType}),p}};j.create=r=>new j({typeName:m.ZodNever,...y(r)});var ge=class extends _{_parse(e){if(this._getType(e)!==f.undefined){let s=this._getOrReturnCtx(e);return d(s,{code:c.invalid_type,expected:f.void,received:s.parsedType}),p}return T(e.data)}};ge.create=r=>new ge({typeName:m.ZodVoid,...y(r)});var B=class r extends _{_parse(e){let{ctx:t,status:s}=this._processInputParams(e),n=this._def;if(t.parsedType!==f.array)return d(t,{code:c.invalid_type,expected:f.array,received:t.parsedType}),p;if(n.exactLength!==null){let o=t.data.length>n.exactLength.value,i=t.data.length<n.exactLength.value;(o||i)&&(d(t,{code:o?c.too_big:c.too_small,minimum:i?n.exactLength.value:void 0,maximum:o?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),s.dirty())}if(n.minLength!==null&&t.data.length<n.minLength.value&&(d(t,{code:c.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),s.dirty()),n.maxLength!==null&&t.data.length>n.maxLength.value&&(d(t,{code:c.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),s.dirty()),t.common.async)return Promise.all([...t.data].map((o,i)=>n.type._parseAsync(new N(t,o,t.path,i)))).then(o=>k.mergeArray(s,o));let a=[...t.data].map((o,i)=>n.type._parseSync(new N(t,o,t.path,i)));return k.mergeArray(s,a)}get element(){return this._def.type}min(e,t){return new r({...this._def,minLength:{value:e,message:h.toString(t)}})}max(e,t){return new r({...this._def,maxLength:{value:e,message:h.toString(t)}})}length(e,t){return new r({...this._def,exactLength:{value:e,message:h.toString(t)}})}nonempty(e){return this.min(1,e)}};B.create=(r,e)=>new B({type:r,minLength:null,maxLength:null,exactLength:null,typeName:m.ZodArray,...y(e)});function me(r){if(r instanceof S){let e={};for(let t in r.shape){let s=r.shape[t];e[t]=I.create(me(s))}return new S({...r._def,shape:()=>e})}else return r instanceof B?new B({...r._def,type:me(r.element)}):r instanceof I?I.create(me(r.unwrap())):r instanceof Z?Z.create(me(r.unwrap())):r instanceof P?P.create(r.items.map(e=>me(e))):r}var S=class r extends _{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=v.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==f.object){let l=this._getOrReturnCtx(e);return d(l,{code:c.invalid_type,expected:f.object,received:l.parsedType}),p}let{status:s,ctx:n}=this._processInputParams(e),{shape:a,keys:o}=this._getCached(),i=[];if(!(this._def.catchall instanceof j&&this._def.unknownKeys==="strip"))for(let l in n.data)o.includes(l)||i.push(l);let u=[];for(let l of o){let g=a[l],R=n.data[l];u.push({key:{status:"valid",value:l},value:g._parse(new N(n,R,n.path,l)),alwaysSet:l in n.data})}if(this._def.catchall instanceof j){let l=this._def.unknownKeys;if(l==="passthrough")for(let g of i)u.push({key:{status:"valid",value:g},value:{status:"valid",value:n.data[g]}});else if(l==="strict")i.length>0&&(d(n,{code:c.unrecognized_keys,keys:i}),s.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let l=this._def.catchall;for(let g of i){let R=n.data[g];u.push({key:{status:"valid",value:g},value:l._parse(new N(n,R,n.path,g)),alwaysSet:g in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let l=[];for(let g of u){let R=await g.key,Oe=await g.value;l.push({key:R,value:Oe,alwaysSet:g.alwaysSet})}return l}).then(l=>k.mergeObjectSync(s,l)):k.mergeObjectSync(s,u)}get shape(){return this._def.shape()}strict(e){return h.errToObj,new r({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,s)=>{let n=this._def.errorMap?.(t,s).message??s.defaultError;return t.code==="unrecognized_keys"?{message:h.errToObj(e).message??n}:{message:n}}}:{}})}strip(){return new r({...this._def,unknownKeys:"strip"})}passthrough(){return new r({...this._def,unknownKeys:"passthrough"})}extend(e){return new r({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new r({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:m.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new r({...this._def,catchall:e})}pick(e){let t={};for(let s of v.objectKeys(e))e[s]&&this.shape[s]&&(t[s]=this.shape[s]);return new r({...this._def,shape:()=>t})}omit(e){let t={};for(let s of v.objectKeys(this.shape))e[s]||(t[s]=this.shape[s]);return new r({...this._def,shape:()=>t})}deepPartial(){return me(this)}partial(e){let t={};for(let s of v.objectKeys(this.shape)){let n=this.shape[s];e&&!e[s]?t[s]=n:t[s]=n.optional()}return new r({...this._def,shape:()=>t})}required(e){let t={};for(let s of v.objectKeys(this.shape))if(e&&!e[s])t[s]=this.shape[s];else{let a=this.shape[s];for(;a instanceof I;)a=a._def.innerType;t[s]=a}return new r({...this._def,shape:()=>t})}keyof(){return it(v.objectKeys(this.shape))}};S.create=(r,e)=>new S({shape:()=>r,unknownKeys:"strip",catchall:j.create(),typeName:m.ZodObject,...y(e)});S.strictCreate=(r,e)=>new S({shape:()=>r,unknownKeys:"strict",catchall:j.create(),typeName:m.ZodObject,...y(e)});S.lazycreate=(r,e)=>new S({shape:r,unknownKeys:"strip",catchall:j.create(),typeName:m.ZodObject,...y(e)});var ne=class extends _{_parse(e){let{ctx:t}=this._processInputParams(e),s=this._def.options;function n(a){for(let i of a)if(i.result.status==="valid")return i.result;for(let i of a)if(i.result.status==="dirty")return t.common.issues.push(...i.ctx.common.issues),i.result;let o=a.map(i=>new C(i.ctx.common.issues));return d(t,{code:c.invalid_union,unionErrors:o}),p}if(t.common.async)return Promise.all(s.map(async a=>{let o={...t,common:{...t.common,issues:[]},parent:null};return{result:await a._parseAsync({data:t.data,path:t.path,parent:o}),ctx:o}})).then(n);{let a,o=[];for(let u of s){let l={...t,common:{...t.common,issues:[]},parent:null},g=u._parseSync({data:t.data,path:t.path,parent:l});if(g.status==="valid")return g;g.status==="dirty"&&!a&&(a={result:g,ctx:l}),l.common.issues.length&&o.push(l.common.issues)}if(a)return t.common.issues.push(...a.ctx.common.issues),a.result;let i=o.map(u=>new C(u));return d(t,{code:c.invalid_union,unionErrors:i}),p}}get options(){return this._def.options}};ne.create=(r,e)=>new ne({options:r,typeName:m.ZodUnion,...y(e)});var V=r=>r instanceof ie?V(r.schema):r instanceof E?V(r.innerType()):r instanceof oe?[r.value]:r instanceof ce?r.options:r instanceof de?v.objectValues(r.enum):r instanceof ue?V(r._def.innerType):r instanceof re?[void 0]:r instanceof se?[null]:r instanceof I?[void 0,...V(r.unwrap())]:r instanceof Z?[null,...V(r.unwrap())]:r instanceof Se||r instanceof fe?V(r.unwrap()):r instanceof le?V(r._def.innerType):[],Me=class r extends _{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==f.object)return d(t,{code:c.invalid_type,expected:f.object,received:t.parsedType}),p;let s=this.discriminator,n=t.data[s],a=this.optionsMap.get(n);return a?t.common.async?a._parseAsync({data:t.data,path:t.path,parent:t}):a._parseSync({data:t.data,path:t.path,parent:t}):(d(t,{code:c.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),p)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,s){let n=new Map;for(let a of t){let o=V(a.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \\`${e}\\` could not be extracted from all schema options`);for(let i of o){if(n.has(i))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);n.set(i,a)}}return new r({typeName:m.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,...y(s)})}};function Fe(r,e){let t=M(r),s=M(e);if(r===e)return{valid:!0,data:r};if(t===f.object&&s===f.object){let n=v.objectKeys(e),a=v.objectKeys(r).filter(i=>n.indexOf(i)!==-1),o={...r,...e};for(let i of a){let u=Fe(r[i],e[i]);if(!u.valid)return{valid:!1};o[i]=u.data}return{valid:!0,data:o}}else if(t===f.array&&s===f.array){if(r.length!==e.length)return{valid:!1};let n=[];for(let a=0;a<r.length;a++){let o=r[a],i=e[a],u=Fe(o,i);if(!u.valid)return{valid:!1};n.push(u.data)}return{valid:!0,data:n}}else return t===f.date&&s===f.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}var ae=class extends _{_parse(e){let{status:t,ctx:s}=this._processInputParams(e),n=(a,o)=>{if(Ee(a)||Ee(o))return p;let i=Fe(a.value,o.value);return i.valid?((je(a)||je(o))&&t.dirty(),{status:t.value,value:i.data}):(d(s,{code:c.invalid_intersection_types}),p)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([a,o])=>n(a,o)):n(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}};ae.create=(r,e,t)=>new ae({left:r,right:e,typeName:m.ZodIntersection,...y(t)});var P=class r extends _{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==f.array)return d(s,{code:c.invalid_type,expected:f.array,received:s.parsedType}),p;if(s.data.length<this._def.items.length)return d(s,{code:c.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),p;!this._def.rest&&s.data.length>this._def.items.length&&(d(s,{code:c.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let a=[...s.data].map((o,i)=>{let u=this._def.items[i]||this._def.rest;return u?u._parse(new N(s,o,s.path,i)):null}).filter(o=>!!o);return s.common.async?Promise.all(a).then(o=>k.mergeArray(t,o)):k.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new r({...this._def,rest:e})}};P.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new P({items:r,typeName:m.ZodTuple,rest:null,...y(e)})};var Pe=class r extends _{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==f.object)return d(s,{code:c.invalid_type,expected:f.object,received:s.parsedType}),p;let n=[],a=this._def.keyType,o=this._def.valueType;for(let i in s.data)n.push({key:a._parse(new N(s,i,s.path,i)),value:o._parse(new N(s,s.data[i],s.path,i)),alwaysSet:i in s.data});return s.common.async?k.mergeObjectAsync(t,n):k.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,s){return t instanceof _?new r({keyType:e,valueType:t,typeName:m.ZodRecord,...y(s)}):new r({keyType:U.create(),valueType:e,typeName:m.ZodRecord,...y(t)})}},_e=class extends _{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==f.map)return d(s,{code:c.invalid_type,expected:f.map,received:s.parsedType}),p;let n=this._def.keyType,a=this._def.valueType,o=[...s.data.entries()].map(([i,u],l)=>({key:n._parse(new N(s,i,s.path,[l,"key"])),value:a._parse(new N(s,u,s.path,[l,"value"]))}));if(s.common.async){let i=new Map;return Promise.resolve().then(async()=>{for(let u of o){let l=await u.key,g=await u.value;if(l.status==="aborted"||g.status==="aborted")return p;(l.status==="dirty"||g.status==="dirty")&&t.dirty(),i.set(l.value,g.value)}return{status:t.value,value:i}})}else{let i=new Map;for(let u of o){let l=u.key,g=u.value;if(l.status==="aborted"||g.status==="aborted")return p;(l.status==="dirty"||g.status==="dirty")&&t.dirty(),i.set(l.value,g.value)}return{status:t.value,value:i}}}};_e.create=(r,e,t)=>new _e({valueType:e,keyType:r,typeName:m.ZodMap,...y(t)});var ve=class r extends _{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==f.set)return d(s,{code:c.invalid_type,expected:f.set,received:s.parsedType}),p;let n=this._def;n.minSize!==null&&s.data.size<n.minSize.value&&(d(s,{code:c.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()),n.maxSize!==null&&s.data.size>n.maxSize.value&&(d(s,{code:c.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());let a=this._def.valueType;function o(u){let l=new Set;for(let g of u){if(g.status==="aborted")return p;g.status==="dirty"&&t.dirty(),l.add(g.value)}return{status:t.value,value:l}}let i=[...s.data.values()].map((u,l)=>a._parse(new N(s,u,s.path,l)));return s.common.async?Promise.all(i).then(u=>o(u)):o(i)}min(e,t){return new r({...this._def,minSize:{value:e,message:h.toString(t)}})}max(e,t){return new r({...this._def,maxSize:{value:e,message:h.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};ve.create=(r,e)=>new ve({valueType:r,minSize:null,maxSize:null,typeName:m.ZodSet,...y(e)});var Ze=class r extends _{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==f.function)return d(t,{code:c.invalid_type,expected:f.function,received:t.parsedType}),p;function s(i,u){return Ce({data:i,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,he(),D].filter(l=>!!l),issueData:{code:c.invalid_arguments,argumentsError:u}})}function n(i,u){return Ce({data:i,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,he(),D].filter(l=>!!l),issueData:{code:c.invalid_return_type,returnTypeError:u}})}let a={errorMap:t.common.contextualErrorMap},o=t.data;if(this._def.returns instanceof q){let i=this;return T(async function(...u){let l=new C([]),g=await i._def.args.parseAsync(u,a).catch(ke=>{throw l.addIssue(s(u,ke)),l}),R=await Reflect.apply(o,this,g);return await i._def.returns._def.type.parseAsync(R,a).catch(ke=>{throw l.addIssue(n(R,ke)),l})})}else{let i=this;return T(function(...u){let l=i._def.args.safeParse(u,a);if(!l.success)throw new C([s(u,l.error)]);let g=Reflect.apply(o,this,l.data),R=i._def.returns.safeParse(g,a);if(!R.success)throw new C([n(g,R.error)]);return R.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new r({...this._def,args:P.create(e).rest(z.create())})}returns(e){return new r({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,s){return new r({args:e||P.create([]).rest(z.create()),returns:t||z.create(),typeName:m.ZodFunction,...y(s)})}},ie=class extends _{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};ie.create=(r,e)=>new ie({getter:r,typeName:m.ZodLazy,...y(e)});var oe=class extends _{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return d(t,{received:t.data,code:c.invalid_literal,expected:this._def.value}),p}return{status:"valid",value:e.data}}get value(){return this._def.value}};oe.create=(r,e)=>new oe({value:r,typeName:m.ZodLiteral,...y(e)});function it(r,e){return new ce({values:r,typeName:m.ZodEnum,...y(e)})}var ce=class r extends _{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),s=this._def.values;return d(t,{expected:v.joinValues(s),received:t.parsedType,code:c.invalid_type}),p}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),s=this._def.values;return d(t,{received:t.data,code:c.invalid_enum_value,options:s}),p}return T(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return r.create(e,{...this._def,...t})}exclude(e,t=this._def){return r.create(this.options.filter(s=>!e.includes(s)),{...this._def,...t})}};ce.create=it;var de=class extends _{_parse(e){let t=v.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==f.string&&s.parsedType!==f.number){let n=v.objectValues(t);return d(s,{expected:v.joinValues(n),received:s.parsedType,code:c.invalid_type}),p}if(this._cache||(this._cache=new Set(v.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let n=v.objectValues(t);return d(s,{received:s.data,code:c.invalid_enum_value,options:n}),p}return T(e.data)}get enum(){return this._def.values}};de.create=(r,e)=>new de({values:r,typeName:m.ZodNativeEnum,...y(e)});var q=class extends _{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==f.promise&&t.common.async===!1)return d(t,{code:c.invalid_type,expected:f.promise,received:t.parsedType}),p;let s=t.parsedType===f.promise?t.data:Promise.resolve(t.data);return T(s.then(n=>this._def.type.parseAsync(n,{path:t.path,errorMap:t.common.contextualErrorMap})))}};q.create=(r,e)=>new q({type:r,typeName:m.ZodPromise,...y(e)});var E=class extends _{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===m.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:s}=this._processInputParams(e),n=this._def.effect||null,a={addIssue:o=>{d(s,o),o.fatal?t.abort():t.dirty()},get path(){return s.path}};if(a.addIssue=a.addIssue.bind(a),n.type==="preprocess"){let o=n.transform(s.data,a);if(s.common.async)return Promise.resolve(o).then(async i=>{if(t.value==="aborted")return p;let u=await this._def.schema._parseAsync({data:i,path:s.path,parent:s});return u.status==="aborted"?p:u.status==="dirty"?K(u.value):t.value==="dirty"?K(u.value):u});{if(t.value==="aborted")return p;let i=this._def.schema._parseSync({data:o,path:s.path,parent:s});return i.status==="aborted"?p:i.status==="dirty"?K(i.value):t.value==="dirty"?K(i.value):i}}if(n.type==="refinement"){let o=i=>{let u=n.refinement(i,a);if(s.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return i};if(s.common.async===!1){let i=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return i.status==="aborted"?p:(i.status==="dirty"&&t.dirty(),o(i.value),{status:t.value,value:i.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(i=>i.status==="aborted"?p:(i.status==="dirty"&&t.dirty(),o(i.value).then(()=>({status:t.value,value:i.value}))))}if(n.type==="transform")if(s.common.async===!1){let o=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!F(o))return p;let i=n.transform(o.value,a);if(i instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:i}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(o=>F(o)?Promise.resolve(n.transform(o.value,a)).then(i=>({status:t.value,value:i})):p);v.assertNever(n)}};E.create=(r,e,t)=>new E({schema:r,typeName:m.ZodEffects,effect:e,...y(t)});E.createWithPreprocess=(r,e,t)=>new E({schema:e,effect:{type:"preprocess",transform:r},typeName:m.ZodEffects,...y(t)});var I=class extends _{_parse(e){return this._getType(e)===f.undefined?T(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};I.create=(r,e)=>new I({innerType:r,typeName:m.ZodOptional,...y(e)});var Z=class extends _{_parse(e){return this._getType(e)===f.null?T(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Z.create=(r,e)=>new Z({innerType:r,typeName:m.ZodNullable,...y(e)});var ue=class extends _{_parse(e){let{ctx:t}=this._processInputParams(e),s=t.data;return t.parsedType===f.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};ue.create=(r,e)=>new ue({innerType:r,typeName:m.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...y(e)});var le=class extends _{_parse(e){let{ctx:t}=this._processInputParams(e),s={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return pe(n)?n.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new C(s.common.issues)},input:s.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new C(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}};le.create=(r,e)=>new le({innerType:r,typeName:m.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...y(e)});var xe=class extends _{_parse(e){if(this._getType(e)!==f.nan){let s=this._getOrReturnCtx(e);return d(s,{code:c.invalid_type,expected:f.nan,received:s.parsedType}),p}return{status:"valid",value:e.data}}};xe.create=r=>new xe({typeName:m.ZodNaN,...y(r)});var Wt=Symbol("zod_brand"),Se=class extends _{_parse(e){let{ctx:t}=this._processInputParams(e),s=t.data;return this._def.type._parse({data:s,path:t.path,parent:t})}unwrap(){return this._def.type}},Ae=class r extends _{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.common.async)return(async()=>{let a=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return a.status==="aborted"?p:a.status==="dirty"?(t.dirty(),K(a.value)):this._def.out._parseAsync({data:a.value,path:s.path,parent:s})})();{let n=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return n.status==="aborted"?p:n.status==="dirty"?(t.dirty(),{status:"dirty",value:n.value}):this._def.out._parseSync({data:n.value,path:s.path,parent:s})}}static create(e,t){return new r({in:e,out:t,typeName:m.ZodPipeline})}},fe=class extends _{_parse(e){let t=this._def.innerType._parse(e),s=n=>(F(n)&&(n.value=Object.freeze(n.value)),n);return pe(t)?t.then(n=>s(n)):s(t)}unwrap(){return this._def.innerType}};fe.create=(r,e)=>new fe({innerType:r,typeName:m.ZodReadonly,...y(e)});function rt(r,e){let t=typeof r=="function"?r(e):typeof r=="string"?{message:r}:r;return typeof t=="string"?{message:t}:t}function ot(r,e={},t){return r?W.create().superRefine((s,n)=>{let a=r(s);if(a instanceof Promise)return a.then(o=>{if(!o){let i=rt(e,s),u=i.fatal??t??!0;n.addIssue({code:"custom",...i,fatal:u})}});if(!a){let o=rt(e,s),i=o.fatal??t??!0;n.addIssue({code:"custom",...o,fatal:i})}}):W.create()}var qt={object:S.lazycreate},m;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline",r.ZodReadonly="ZodReadonly"})(m||(m={}));var Yt=(r,e={message:`Input not instance of ${r.name}`})=>ot(t=>t instanceof r,e),ct=U.create,dt=G.create,Xt=xe.create,Jt=H.create,ut=ee.create,Qt=te.create,Kt=ye.create,Gt=re.create,Ht=se.create,er=W.create,tr=z.create,rr=j.create,sr=ge.create,nr=B.create,ar=S.create,ir=S.strictCreate,or=ne.create,cr=Me.create,dr=ae.create,ur=P.create,lr=Pe.create,fr=_e.create,hr=ve.create,pr=Ze.create,mr=ie.create,yr=oe.create,gr=ce.create,_r=de.create,vr=q.create,xr=E.create,br=I.create,kr=Z.create,wr=E.createWithPreprocess,Tr=Ae.create,Rr=()=>ct().optional(),Cr=()=>dt().optional(),Sr=()=>ut().optional(),Ar={string:r=>U.create({...r,coerce:!0}),number:r=>G.create({...r,coerce:!0}),boolean:r=>ee.create({...r,coerce:!0}),bigint:r=>H.create({...r,coerce:!0}),date:r=>te.create({...r,coerce:!0})};var Or=p;var Ns=be.union([be.enum(["low","medium","high","always-visible"]),be.number()]);var $e=5;var Ir=9,Y=200,Le=10;function lt(r,e,t,s,n,a,o="-1"){let i=1/0,u=1/0,l=-1/0,g=-1/0,R=new b(-Le,0,5,t),Oe=new b(-Le,0,e,5),ke=new b(e-5,0,e+Le,t),ht=new b(0,t-5,e,t+Le),pt=Nr(e,t,s,n,a),mt=[R,Oe,ke,ht],Ue=new b(-Y,-Y,e+Y*2,t+Y*2);for(let x of r){let $,Te;for(let A=0;A<x.bboxes.length;A++){if(x.bboxes[A]==null||($=x.bboxes[A].boundingBox,Te=x.bboxes[A].index,x.lockedToStrategyIndex!==-1&&Te!==x.lockedToStrategyIndex))continue;let[Ne,O,J,qe]=$,[Q,yt,Ye,gt]=[x.y-Ne,x.y+O,x.x-J,x.x+qe],De=Ye,Ve=Q,Xe=gt-Ye,Je=yt-Q;i=Math.min(i,De)-Y,u=Math.min(u,Ve)-Y,l=Math.max(l,De+Xe)+Y,g=Math.max(g,Ve+Je)+Y,x.bboxes[A].boundingRect=new b(De,Ve,Xe,Je)}}let Ie=new Re(new b(i,u,l-i,g-u)),X={msgId:o,colliders:new Array(r.length),staticColliders:[],debug:[]},We=0;for(let x=0;x<r.length;x++){let $=r[x];$.bboxes?.[0]?.index===Ir&&(X.staticColliders.push($.bboxes[0].boundingRect),Ie.insert($.bboxes[0].boundingRect),We++)}r=r.slice(We,r.length);let we;for(let x=0;x<r.length;x++)if(we=r[x],X.colliders[x]=[-1,0],we.enabledAndVisible){let[$,Te,A]=[1/0,-1,void 0];for(let{index:Ne,boundingRect:O}of we.bboxes){if(O==null)continue;let J=[];if(J=Ie.queryRect(O).filter(Q=>O.intersects(Q)),we.shouldCollideWithScreenEdges&&mt.forEach(Q=>{O.intersects(Q)&&J.push(Q)}),O.intersects(pt)){X.colliders[x]=[-1,0,O];break}if(J.length<=$&&(A=O,Te=Ne,$=J.length),J.length===0){Ie.insert(O),X.colliders[x]=[Ne,Ue.contains(O)?0:1,O];break}}we.rank===$e&&A!=null&&(Ie.insert(A),X.colliders[x]=[Te,Ue.contains(A)?0:1,A])}else X.colliders[x]=[-1,0];return X}function Nr(r,e,t,s,n){switch(n){case"top-right":return new b(r-t,0,t,s);case"bottom-left":return new b(0,e-s,t,s);case"bottom-right":return new b(r-t,e-s,t,s);case"top-left":return new b(0,0,t,s)}}function ft(r){let e=r[0].map(t=>{let s=t[0].map(n=>({index:n[4],boundingBox:[n[0],n[1],n[2],n[3]]}));return{enabledAndVisible:t[1]===1,rank:t[2]===1?$e:0,x:t[3],y:t[4],shouldCollideWithScreenEdges:t[5]===1,bboxes:s,lockedToStrategyIndex:t[6]}});return{msgId:"-1",totalWidth:r[3],totalHeight:r[2],watermarkWidth:r[4],watermarkHeight:r[5],watermarkPosition:r[6],colliders:e,devicePixelRatio:r[1]}}self.onmessage=r=>{let e=ft(r.data);self.postMessage(lt(e.colliders,e.totalWidth,e.totalHeight,e.watermarkWidth,e.watermarkHeight,e.watermarkPosition,e.msgId))};})();\n';d();d();d();d();d();function _D(e,r){return r.x+r.w<e.x+e.w&&r.x>e.x&&r.y>e.y&&r.y+r.h<e.y+e.h}d();function RD(e,r){let[t,o]=r;return t>=e.x&&t<=e.x+e.w&&o>=e.y&&o<=e.y+e.h}d();function BD(e,r){let t=r.x,o=r.y,n=r.x+r.w,i=r.y+r.h,a=e.x,l=e.y,c=e.x+e.w,p=e.y+e.h;return t<c&&a<n&&o<p&&l<i}d();function ca(e,r){for(let t=0;t<r.length;t++)e.push(r[t])}d();var rt=class{constructor(r,t,o,n,i){m(this,"x");m(this,"y");m(this,"w");m(this,"h");m(this,"userData");this.userData=typeof i>"u"?null:i,this.x=r,this.y=t,this.w=o,this.h=n}contains(r){return r===this?!1:_D(this,r)}intersects(r){return BD(this,r)}intersectsPoint(r){return RD(this,r)}draw(r){r.fillStyle="rgba(123,222,26, 0.8)",r.fillRect(this.x,this.y,this.w,this.h)}};var An=class e{constructor(r,t){m(this,"topLeft");m(this,"topRight");m(this,"bottomLeft");m(this,"bottomRight");m(this,"divided",!1);m(this,"boundary");m(this,"capacity",16);m(this,"objects",[]);m(this,"parent");this.parent=t,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:t,w:o,h:n}=this.boundary;this.topLeft=new e(new rt(r,t,o/2,n/2),this),this.topRight=new e(new rt(r+o/2,t,o/2,n/2),this),this.bottomLeft=new e(new rt(r,t+n/2,o/2,n/2),this),this.bottomRight=new e(new rt(r+o/2,t+n/2,o/2,n/2),this),this.divided=!0}queryRect(r){let t=[];if(this.boundary.intersects(r))t.push(...this.objects);else return[];return this.divided&&(ca(t,this.topLeft.queryRect(r)),ca(t,this.topRight.queryRect(r)),ca(t,this.bottomLeft.queryRect(r)),ca(t,this.bottomRight.queryRect(r))),t}queryPoint(r){let t=[];if(this.boundary.intersectsPoint(r))t.push(...this.objects);else return[];return this.divided&&(ca(t,this.topLeft.queryPoint(r)),ca(t,this.topRight.queryPoint(r)),ca(t,this.bottomLeft.queryPoint(r)),ca(t,this.bottomRight.queryPoint(r))),t}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(t=>t.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()}};d();function ND(e,r,t){let o,n,i,a=null,l=0;t||(t={});let c=function(){l=t.leading===!1?0:Date.now(),a=null,i=e.apply(o,n),a||(o=n=null)};return function(){let p=Date.now();!l&&t.leading===!1&&(l=p);let u=r-(p-l);return o=globalThis,n=arguments,u<=0||u>r?(a&&(clearTimeout(a),a=null),l=p,i=e.apply(o,n),a||(o=n=null)):!a&&t.trailing!==!1&&(a=setTimeout(c,u)),i}}function jD(e){let r=e[0].map(t=>{let o=t[0].map(n=>({index:n[4],boundingBox:[n[0],n[1],n[2],n[3]]}));return{enabledAndVisible:t[1]===1,rank:t[2]===1?Ip:0,x:t[3],y:t[4],shouldCollideWithScreenEdges:t[5]===1,bboxes:o,lockedToStrategyIndex:t[6]}});return{msgId:"-1",totalWidth:e[3],totalHeight:e[2],watermarkWidth:e[4],watermarkHeight:e[5],watermarkPosition:e[6],colliders:r,devicePixelRatio:e[1]}}d();var b2=9,gl=200,P1=10;function GD(e,r,t,o,n,i,a="-1"){let l=1/0,c=1/0,p=-1/0,u=-1/0,f=new rt(-P1,0,5,t),h=new rt(-P1,0,r,5),b=new rt(r-5,0,r+P1,t),x=new rt(0,t-5,r,t+P1),T=C$(r,t,o,n,i),v=[f,h,b,x],I=new rt(-gl,-gl,r+gl*2,t+gl*2);for(let _ of e){let G,R;for(let N=0;N<_.bboxes.length;N++){if(_.bboxes[N]==null||(G=_.bboxes[N].boundingBox,R=_.bboxes[N].index,_.lockedToStrategyIndex!==-1&&R!==_.lockedToStrategyIndex))continue;let[X,z,ee,re]=G,[ue,Ce,Oe,Pe]=[_.y-X,_.y+z,_.x-ee,_.x+re],Fe=Oe,ce=ue,Ee=Pe-Oe,ye=Ce-ue;l=Math.min(l,Fe)-gl,c=Math.min(c,ce)-gl,p=Math.max(p,Fe+Ee)+gl,u=Math.max(u,ce+ye)+gl,_.bboxes[N].boundingRect=new rt(Fe,ce,Ee,ye)}}let M=new An(new rt(l,c,p-l,u-c)),O={msgId:a,colliders:new Array(e.length),staticColliders:[],debug:[]},C=0;for(let _=0;_<e.length;_++){let G=e[_];G.bboxes?.[0]?.index===b2&&(O.staticColliders.push(G.bboxes[0].boundingRect),M.insert(G.bboxes[0].boundingRect),C++)}e=e.slice(C,e.length);let E;for(let _=0;_<e.length;_++)if(E=e[_],O.colliders[_]=[-1,0],E.enabledAndVisible){let[G,R,N]=[1/0,-1,void 0];for(let{index:X,boundingRect:z}of E.bboxes){if(z==null)continue;let ee=[];if(ee=M.queryRect(z).filter(ue=>z.intersects(ue)),E.shouldCollideWithScreenEdges&&v.forEach(ue=>{z.intersects(ue)&&ee.push(ue)}),z.intersects(T)){O.colliders[_]=[-1,0,z];break}if(ee.length<=G&&(N=z,R=X,G=ee.length),ee.length===0){M.insert(z),O.colliders[_]=[X,I.contains(z)?0:1,z];break}}E.rank===Ip&&N!=null&&(M.insert(N),O.colliders[_]=[R,I.contains(N)?0:1,N])}else O.colliders[_]=[-1,0];return O}function C$(e,r,t,o,n){switch(n){case"top-right":return new rt(e-t,0,t,o);case"bottom-left":return new rt(0,r-o,t,o);case"bottom-right":return new rt(e-t,r-o,t,o);case"top-left":return new rt(0,0,t,o)}}d();var Bf=class{constructor(){m(this,"onerror",()=>{});m(this,"onmessage",()=>{});m(this,"postMessage",r=>{let t=jD(r);this.onmessage({data:GD(t.colliders,t.totalWidth,t.totalHeight,t.watermarkWidth,t.watermarkHeight,t.watermarkPosition,t.msgId)})});m(this,"terminate",()=>{})}};var gu=!1,M$=150,F1=class extends ke{constructor(t,o,n=!0){super();m(this,"worker");m(this,"debugContext");m(this,"debugCanvas");m(this,"collidersDirty",!0);m(this,"packedMessage",[[],0,0,0,0,0,"bottom-left"]);m(this,"visibleCollidersQTree",new An(new rt(0,0,0,0)));m(this,"interactiveCollidersQTree",new An(new rt(0,0,0,0)));m(this,"coreState");m(this,"postMessage");m(this,"showCollisionBoxes",()=>{gu=!0,this.debugCanvas.style.display="block"});m(this,"hideCollisionBoxes",()=>{gu=!1,this.debugContext.clearRect(0,0,this.debugCanvas.width,this.debugCanvas.height),this.debugCanvas.style.display="none"});m(this,"currentMsgId","");m(this,"working",!1);m(this,"_postMessage",()=>{this.worker.postMessage(this.packedMessage)});m(this,"componentArray",[]);m(this,"update",(t,o,n="bottom-left",i=!1,a=[])=>{let l=!1;if(this.collidersDirty){this.packedMessage=[[],0,0,0,0,0,"bottom-left"],this.componentArray=[];let u;for(let f of this.coreState.geometry2DIdsInScene){let h=this.coreState.geometry2DMap.get(f);h&&(u=h.components[0],this.componentArray.push(u))}this.resize(t,o,n),this.collidersDirty=!1,l=!0}else l=this.componentArray.some(u=>u.collisionDirty===!0);l&&this.componentArray.sort((u,f)=>f.rank-u.rank);let c=0;for(let u of a)this.packedMessage[0][c]==null&&(this.packedMessage[0][c]=[]),this.packedMessage[0][c][0]==null&&(this.packedMessage[0][c][0]=[]),this.packedMessage[0][c][0]=[[u.h/2,u.h/2,u.w/2,u.w/2,b2]],this.packedMessage[0][c][1]=1,this.packedMessage[0][c][2]=1,this.packedMessage[0][c][3]=u.x,this.packedMessage[0][c][4]=u.y,this.packedMessage[0][c][5]=0,this.packedMessage[0][c][6]=-1,c++;let p=0;for(;c<this.componentArray.length+a.length;){if(this.packedMessage){let u=this.componentArray[p].toPackedMessage(i&&!l);this.packedMessage[0][c]==null&&(this.packedMessage[0][c]=[]),this.packedMessage[0][c][0]==null&&(this.packedMessage[0][c][0]=[]),this.packedMessage[0][c][0]=u.bboxes,this.packedMessage[0][c][1]=u.enabled&&this.componentArray[p].visible&&!this.componentArray[p].isOccluded?1:0,this.packedMessage[0][c][2]=u.rank===Ip?1:0,this.packedMessage[0][c][3]=u.x,this.packedMessage[0][c][4]=u.y,this.packedMessage[0][c][5]=u.shouldCollideWithScreenEdges?1:0,this.packedMessage[0][c][6]=u.lockedToStrategyIndex}c++,p++}this.working||this.postMessage()});m(this,"resolve",t=>{if(this.working=!1,this.collidersDirty||!t.data)return;let o=t.data.colliders,n=-1,i,a,l,c=new rt(0,0,this.debugCanvas.width,this.debugCanvas.height);if(this.visibleCollidersQTree=new An(c),this.interactiveCollidersQTree=new An(c),gu)for(let p of t.data.staticColliders)this.visibleCollidersQTree.insert(new rt(p.x,p.y,p.w,p.h));for(let p=0;p<this.componentArray.length;p++){let u=this.componentArray[p];o[p]!=null&&(n=o[p][0],i=o[p][2],u.offscreen=o[p][1]===1,n!==-1&&i!=null?(l=new rt(i.x,i.y,i.w,i.h,{entityId:u.id}),this.visibleCollidersQTree.insert(l),a=this.coreState.geometry2DMap.get(u.id),a?.components[1]!=null&&this.interactiveCollidersQTree.insert(l),(u.canShow===!1||u.visibilityNeedsUpdate!==!1)&&"visibilityNeedsUpdate"in u&&(u.visibilityNeedsUpdate="show"),n!==-1&&n!==u.currentStrategyIndex&&(u.activeBoundingBox=l,u.onStrategySelected(n))):((u.canShow===!0||u.visibilityNeedsUpdate!==!1)&&"visibilityNeedsUpdate"in u&&(u.visibilityNeedsUpdate="hide"),n!==-1&&n!==u.currentStrategyIndex&&u.onStrategySelected(n)))}gu&&this.drawDebug(),this.publish("visibility-changed")});m(this,"drawDebug",()=>{gu&&this.visibleCollidersQTree&&(this.debugContext.clearRect(0,0,this.debugCanvas.width,this.debugCanvas.height),this.debugContext.beginPath(),this.visibleCollidersQTree.drawObjects(this.debugContext))});m(this,"destroy",()=>{this.worker.terminate()});this.worker=n===!1?new Bf:Pc!==""?new Worker(Pc):new Worker(URL.createObjectURL(new Blob([LD],{type:"text/javascript"}))),this.worker.onerror=()=>{this.worker=new Bf,this.worker.onmessage=i=>this.resolve(i)},this.coreState=o,this.debugCanvas=t,this.debugContext=t.getContext("2d"),this.worker.onmessage=i=>this.resolve(i),this.postMessage=ND(this._postMessage,M$,!1),gu?this.showCollisionBoxes():this.hideCollisionBoxes()}resize(t,o,n){this.packedMessage[6]=n,this.packedMessage[5]=o,this.packedMessage[4]=t,this.packedMessage[3]=this.debugCanvas.width,this.packedMessage[2]=this.debugCanvas.height}};d();d();d();d();var D1=class{constructor(r){m(this,"type");m(this,"event");this.type=0,this.event=r}get timestamp(){return this.event.timeStamp}},k1=class{constructor(){m(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(){return this.isSingleTap&&this.lastPointerDown?.type===1}get isSingleTapWithOneFinger(){return this.isSingleTap&&this.lastPointerDown?.type===0}get isDoubleTapWithOneFinger(){return this.isDoubleTap&&this.taps[0]?.type===0&&this.taps[1]?.type===0}get isSingleTap(){return this.taps.length===1}get isDoubleTap(){return this.taps.length===2}discardOutsideOfWaitWindow(r){this.taps=this.taps.filter(t=>r-t.timestamp<300)}flush(){this.taps=[]}get _taps(){return this.taps}destroy(){this.flush()}};d();function v2(e){let r=new Set;for(let t of e){let o=t.object;for(;o.visible&&o.parent&&o.parent.visible===!0&&!r.has(o.parent);)o=o.parent,o instanceof hr&&o.type==="group-container"&&o.visible&&o.components[0]&&r.add(o)}return Array.from(r)}var yu,Nf=class extends ke{constructor(t,o,n,i,a){super();m(this,"raycaster",new Pi);m(this,"state",{hovered3DEntity:void 0,hovered2DEntity:void 0,hovered3DContainers:void 0,lastHover:void 0,interaction:{mouseDownStart:void 0,distanceFromMouseDown:void 0,isPanning:!1}});m(this,"coreState");m(this,"camera");m(this,"worldPlane");m(this,"_quadtree",new An(new rt(0,0,0,0)));m(this,"_container");m(this,"lastPointerEvent");m(this,"cursor","grab");m(this,"touchesCount",0);m(this,"isUserInteracting");m(this,"hasTouched",!1);S(this,yu);m(this,"onPointerMoveRaf",t=>{this.lastPointerEvent=t,s(this,yu)&&cancelAnimationFrame(s(this,yu)),w(this,yu,requestAnimationFrame(()=>{this.onPointerMove(t)}))});m(this,"onPointerMove",t=>{t.preventDefault(),this.updateInteractionStateIfPanning(t),(t.pointerType!=="touch"||t.pointerType===void 0&&this.hasTouched)&&this.handleHover(t),this.handleCursor()});m(this,"tapsControl",new k1);m(this,"onPointerDown",t=>{t.target===this._container&&(this._container.addEventListener("pointerup",this.onPointerUp,!1),this._container.addEventListener("pointercancel",this.onPointerUp,!1),this.state.interaction.mouseDownStart={time:Date.now(),timestamp:t.timeStamp,offsetX:t.offsetX,offsetY:t.offsetY},this.lastPointerEvent=t,this.state.interaction.distanceFromMouseDown=0,this.handleCursor(),t.pointerType==="touch"&&(this.tapsControl.add(new D1(t)),this.touchesCount=Math.max(0,this.touchesCount+1)))});m(this,"clickTimeout");m(this,"onPointerUp",t=>{this.tapsControl.discardOutsideOfWaitWindow(t.timeStamp),this.lastPointerEvent=t,this.touchesCount=Math.max(0,this.touchesCount-1),this.touchesCount===0&&(this._container.removeEventListener("pointerup",this.onPointerUp,!1),this._container.removeEventListener("pointercancel",this.onPointerUp,!1)),this.updateInteractionStateIfPanning(t);let{mouseDownStart:o}=this.state.interaction;!o||this.state.interaction.distanceFromMouseDown==null||(Date.now()<o.time+300&&(this.tapsControl.isSingleTapWithTwoFingers||this.state.interaction.distanceFromMouseDown<=15)&&(t.pointerType==="touch"?this.tapsControl.isSingleTapWithTwoFingers?(this.publish("singletap-with-twofinger",t),this.flush()):this.tapsControl.isSingleTapWithOneFinger&&this.touchesCount===0?(this.clickTimeout&&clearTimeout(this.clickTimeout),this.clickTimeout=window.setTimeout(()=>{this.handleClick(t),this.flush()},300)):this.tapsControl.isDoubleTapWithOneFinger&&(this.publish("doubletap-with-onefinger",t),this.flush()):this.handleClick(t)),this.state.interaction.mouseDownStart=void 0,this.state.interaction.distanceFromMouseDown=void 0,this.state.interaction.isPanning=!1,this.handleCursor())});m(this,"dirty3D",!0);m(this,"cachedHitBoxes",{entities:[]});m(this,"ndcPoint",new Me);m(this,"debugPanel");this.isUserInteracting=a,this.raycaster.layers.enableAll(),this.raycaster.layers.disable(1),this.camera=n,this._container=t,this.coreState=o,this.worldPlane=i,this._container.addEventListener("pointerdown",this.onPointerDown,!1),this._container.addEventListener("pointermove",this.onPointerMoveRaf,!1),this._container.classList.add("mappedin-interactive")}updateQuadtree(t){this._quadtree=t}setHovered3DEntityInteractionComponentDirty(){if(this.state.hovered3DEntity){let t=this.state.hovered3DEntity.components[2];t&&(t.dirty=!0)}}getThreeDIntersectsFromXY(t){this.raycaster.setFromCamera(t,this.camera),this.raycaster.layers.enable(0);let o=this.raycaster.intersectObjects(this._hitBoxes.entities,!0).filter(i=>i.object?.name==="worldPlane"||i.object?.visible),n=o.findIndex(i=>i.object?.name==="worldPlane");return n!==-1&&o.push(o.splice(n,1)[0]),o}getGroupContainerIntersectsFromXY(t){let o=this.getThreeDIntersectsFromXY(t),n;return o!=null&&o.length>0&&(n=v2(o)),n}flush(){this.tapsControl.flush(),this.clickTimeout!=null&&(clearTimeout(this.clickTimeout),this.clickTimeout=void 0)}handleHover(t){let o=t||this.lastPointerEvent;if(this.state.interaction.mouseDownStart||!o||this.isUserInteracting())return;let{entity3D:n,entity2D:i,position:a,groupContainers:l}=this.intersect(o);(this.detect3DEntityHover(n)||this.detect2DEntityHover(i)||this.detect3DContainerHover(l))&&(this.state.hovered3DEntity=n,this.state.lastHover=n,this.state.hovered2DEntity=i,this.state.hovered3DContainers=l,this.publish("hover",{entity2D:this.state.hovered2DEntity,entity3D:this.state.hovered3DEntity,position:a,groupContainers:l})),this.handleCursor()}handleCursor(){let t=!!(this.state.hovered3DEntity&&this.state.hovered3DEntity?.components[2]||this.state.hovered2DEntity),o=!!this.state.interaction.mouseDownStart,n=this.state.interaction.isPanning,i=E$(t,n,o);this.cursor!==i&&(this.cursor=i,i==="pointer"?this._container.classList.add("mappedin-interaction-hover"):this._container.classList.remove("mappedin-interaction-hover"))}detect2DEntityHover(t){return this.state.hovered2DEntity!==t}handleClick(t){let o=this.intersect(t);this.publish("click",{entity2D:o.entity2D,entity3D:o.entity3D,position:o.position,groupContainers:o.groupContainers,pointerEvent:{button:t.button}})}get _hitBoxes(){if(this.dirty3D){this.cachedHitBoxes.entities=[];let t;for(let o of this.coreState.geometry3DIdsInScene)t=this.coreState.geometry3DMap.get(o),(t?.type==="geometry"||t?.type==="model"||t?.type==="path"||t?.type==="custom-geometry")&&t.components[0].mesh&&!this.cachedHitBoxes.entities.includes(t.components[0].mesh)&&this.cachedHitBoxes.entities.push(t.components[0].mesh);return this.dirty3D=!1,this.cachedHitBoxes.entities.push(this.worldPlane),this.cachedHitBoxes}return this.cachedHitBoxes}intersect(t){let{offsetX:o,offsetY:n}=t,i=[o,n],a=this._quadtree.queryPoint(i),[l]=a.filter(I=>I.intersectsPoint(i));this.ndcPoint.x=o/this._container.clientWidth*2-1,this.ndcPoint.y=-(n/this._container.clientHeight)*2+1;let c=this.getThreeDIntersectsFromXY(this.ndcPoint),p=c[0]?.point,u=[],f=[],h=c.filter(I=>I.object.name!=="worldPlane");for(let I of h)I.object instanceof Le&&I.object.material.depthTest===!1?u.push(I):f.push(I);let b=u[0]??f[0]??void 0,x,T;if(b!=null){if(x=F$(b.object,this.coreState.geometry3DMap),!x){let I=b?.instanceId??b?.batchId;x=I!=null&&b?.object.userData.entities?this.coreState.geometry3DMap.get(b?.object.userData.entities[I]):this.coreState.geometry3DMap.get(b?.object.userData.entityId)}x?.components[2]&&(T=x)}let v=v2(h);return{entity2D:l?.userData?.entityId==="watermark"?{id:"watermark"}:this.coreState.geometry2DMap.get(l?.userData.entityId),entity3D:T,position:p,groupContainers:v.length>0?v:void 0}}detect3DEntityHover(t){return this.state.lastHover!==t&&(this.state.lastHover&&$D(this.state.lastHover,!1,this.coreState),t&&$D(t,!0,this.coreState)),this.state.hovered3DEntity!==t}detect3DContainerHover(t){return!CC(this.state.hovered3DContainers,t)}updateInteractionStateIfPanning(t){this.state.interaction.mouseDownStart&&(this.state.interaction.distanceFromMouseDown=Math.sqrt(Math.pow(t.offsetX-this.state.interaction.mouseDownStart.offsetX,2)+Math.pow(t.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,!1),this._container.removeEventListener("pointermove",this.onPointerMoveRaf,!1),this._container.removeEventListener("pointerup",this.onPointerUp,!1),this._container.removeEventListener("pointercancel",this.onPointerUp,!1)}enableDebug(){let t=document.createElement("div");t.style.position="absolute",t.style.top="0",t.style.right="0",t.style.backgroundColor="white",t.style.padding="10px",document.body.append(t),t.id="interaction-debug-panel",this.debugPanel=t,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",o=>{this.queueDebugMessage(`CLICK
7
7
  3D: ${o.entity3D?.id}
8
8
  2D: ${o.entity2D?.id}
9
9
  Pos: ${o.position?.toArray().join(", ")}`,"#fdffb6")}),this.on("hover",o=>{this.queueDebugMessage(`HOVER
10
10
  3D: ${o.entity3D?.id}
11
11
  2D: ${o.entity2D?.id}
12
- Pos: ${o.position?.toArray().join(", ")}`,"#caffbf")})}get _state(){return this.state}queueDebugMessage(t,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=o,n.textContent=t,this.debugPanel?.prepend(n),setTimeout(()=>{n.style.opacity="0",setTimeout(()=>{n.remove()},500)},2500)}getCursor(){return this.cursor}};yu=new WeakMap;function $D(e,r,t){let o=e.components[2];o&&o.hover!==!0&&(o.hover=r?"user-interaction":!1,o.dirty=!0);let n=e.components[0].textMesh?.userData.entityId;if(!n)return;let i=t.geometry3DMap.get(n);i?.type==="text3d"&&(i.components[1].hoverByPolygon=r,i.components[1].dirty=!0)}function E$(e,r,t){return r?"grabbing":e?"pointer":t?"grabbing":"grab"}function P$(e){let r=e;for(;r?.parent;){if(r instanceof Ra)return;if(r.userData.isSingleModel)return r;r=r.parent}}function F$(e,r){let t=P$(e);return t?r.get(t.userData.entityId):void 0}d();d();var Fc,is,k1,bl,HD,Gf,A1,zD,WD,Uf,L1,Vf,$f,_1,jf=class{constructor(r){S(this,bl);S(this,Fc,null);S(this,is);m(this,"getCurrentSceneGLTF",async r=>{let t={onlyVisible:!0,binary:!0,light:!0,scale:1,...r},o=await W(this,bl,HD).call(this),n=s(this,k1).call(this,t),i=await o.parseAsync(n,{trs:!1,maxTextureSize:1/0,onlyVisible:t.onlyVisible,binary:t.binary,scale:t.scale}),a;if(i instanceof ArrayBuffer)a=new Blob([i],{type:"application/octet-stream"});else{let l=JSON.stringify(i,null,2);a=new Blob([l],{type:"text/plain"})}return a});S(this,k1,r=>{let{scale:t,light:o,onlyVisible:n}=r,i=new Ra,a=new sr().setFromObject(s(this,is).entityScene);if(s(this,Gf).call(this,s(this,is).entityScene,i,n),o){let l=new ey(16777215,.3*Math.PI);l.position.set(0,Math.max(a.max.x,a.max.y)*t*.5,a.max.y*t*4),l.lookAt(0,0,-1),l.target.position.set(0,0,-1),l.add(l.target),i.add(l)}return i});S(this,Gf,(r,t,o)=>{r.material&&(r instanceof Kg?W(this,bl,zD).call(this,r).forEach(n=>t.add(n)):r instanceof pm&&t.add(W(this,bl,WD).call(this,r))),r.children.forEach(n=>{(!o||n.visible)&&s(this,Gf).call(this,n,t,o)})});S(this,A1,(r,t,o)=>{let n=new bC({color:new ar(r),metalness:0});return n.opacity=t,n.transparent=o,n});S(this,Uf,r=>{let{geometry:t,material:o,position:n,rotation:i,quaternion:a,scale:l}=r;if(!t?.isBufferGeometry)return r;let c=t.attributes.position,p=t.attributes.normal,u=t.attributes.uv;return s(this,L1).call(this,c,p),s(this,$f).call(this,n,l,i,a),u&&s(this,_1).call(this,u),o?.map&&t.type==="PlaneGeometry"&&(r.side=Ms),r});S(this,L1,(r,t)=>{let o=new ae,n=new ae;for(let i=0;i<r.count;i++)o.fromBufferAttribute(r,i),s(this,Vf).call(this,o),r.setXYZ(i,o.x,o.y,o.z),t&&(n.fromBufferAttribute(t,i),s(this,Vf).call(this,n),t.setXYZ(i,n.x,n.y,n.z))});S(this,Vf,r=>{let t=r.y;r.y=r.z,r.z=-t});S(this,$f,(r,t,o,n)=>{let i=r.y;r.y=r.z,r.z=-i;let a=t.y;if(t.y=t.z,t.z=a,o instanceof gp)o.order="YXZ",o.set(o.x,o.y,o.z,o.order);else{let l=n.y;n.set(n.x,n.z,-l,n.w)}});S(this,_1,r=>{for(let t=0;t<r.count;t++){let o=r.getX(t),n=r.getY(t);r.setXY(t,o,n)}});w(this,is,r),s(this,is).entityScene=r.entityScene,s(this,is).geometry3DMap=r.geometry3DMap}destroy(){w(this,Fc,null)}};Fc=new WeakMap,is=new WeakMap,k1=new WeakMap,bl=new WeakSet,HD=async function(){if(!s(this,Fc)){let{GLTFExporter:r}=await import("./GLTFExporter-22SRWSNV.js");w(this,Fc,new r)}return s(this,Fc)},Gf=new WeakMap,A1=new WeakMap,zD=function(r){let t=[],n=(r.userData?.entities?Object.values(r.userData?.entities):[]).map(a=>s(this,is).geometry3DMap.get(a)),i=new Map;return n.forEach(a=>{if(!a||!(a instanceof Mt))return;let l=a.components[1],c=a.components[2];if(!l.visible||l instanceof _i&&l.opacity===0||l instanceof ym||l instanceof uy)return;let u=`${c?.hover?l.hoverColor||s(this,is).hoverColor:l.color}-${l.opacity}-${Number(l.visible)}`;i.has(u)||i.set(u,[]),i.get(u)?.push(a)}),i.forEach((a,l)=>{let[c,p,u]=l.split("-"),f=a.reduce((T,v)=>{if(v.type==="custom-geometry")return T;let I=v.components[0];return"geometry"in I&&I.geometry instanceof Yg&&T.push(I.geometry),T},[]),h=s(this,A1).call(this,c,Number(p),r.material.transparent),b=Li(f,!0),x=new Le(b,h);x.position.copy(r.position),x.rotation.copy(r.rotation),x.scale.copy(r.scale),x.visible=!!u,s(this,$f).call(this,x.position,x.scale,x.rotation,x.quaternion),t.push(s(this,Uf).call(this,x))}),t},WD=function(r){let t=r.geometry.clone(),o=r.material,n=new Nr({color:o.color,side:Ms});n.opacity=o.opacity,n.transparent=o.transparent;let i=new pm(t,n);return i.position.copy(r.position),i.rotation.copy(r.rotation),i.scale.copy(r.scale),i.visible=r.visible,s(this,Uf).call(this,i)},Uf=new WeakMap,L1=new WeakMap,Vf=new WeakMap,$f=new WeakMap,_1=new WeakMap;d();d();var D$="gray",k$=.1,Hf=100,I2=new Ai.ClipperOffset;function A$(e,r){I2.Clear(),r/=2;let t=e.map(n=>({X:n.x*Hf,Y:n.y*Hf}));I2.AddPath(t,Ai.JoinType.jtMiter,Ai.EndType.etClosedPolygon);let o=new Ai.Paths;return I2.Execute(o,r*Hf),o.length?o.map(i=>i.map(a=>({x:a.X/Hf,y:a.Y/Hf}))):[e]}function R1(e,r,t){let{color:o=D$,opacity:n=1,altitude:i=0,height:a=k$}=t||{};Array.isArray(n)&&(n=1);let l={min:{x:1/0,y:1/0,z:i},max:{x:-1/0,y:-1/0,z:a+i},center:{x:0,y:0,z:(a+i)/2}},p=e.geometry.coordinates[0].map(b=>{let x=r(b[1],b[0]);return l.min.x=Math.min(l.min.x,x.x),l.min.y=Math.min(l.min.y,x.y),l.max.x=Math.max(l.max.x,x.x),l.max.y=Math.max(l.max.y,x.y),x});e.properties?.style?.edgeOffset!=null&&e.properties.style.edgeOffset!==0||e.properties?.image!=null?p=A$(p,e.properties?.style?.edgeOffset||0):p=[p];let u=[];for(let b of p){let x=new Na;x.moveTo(b[0].x,b[0].y),b.slice(1).forEach(M=>x.lineTo(M.x,M.y)),x.lineTo(b[0].x,b[0].y);let T=e.geometry.coordinates.slice(1);x.holes=T.map(M=>{let O=M.map(E=>r(E[1],E[0])),C=new yp;return C.moveTo(O[0].x,O[0].y),O.slice(1).forEach(E=>C.lineTo(E.x,E.y)),C.lineTo(O[0].x,O[0].y),C});let v=hm(t?.bevel,a),I=new ja(x,v);I.userData={style:{color:o,opacity:n},usedBevelSettings:v},u.push(I)}if(u.length===1)return u[0];let f=Li(u);u.forEach(b=>b.dispose());let h=hm(t?.bevel,a);return f.userData={style:{color:o,opacity:n},usedBevelSettings:h,_split:!0},f}d();var L$="gray",_$=.1;function B1(e,r,t){let{color:o=L$,opacity:n=1,altitude:i=0,height:a=_$}=t||{};Array.isArray(n)&&(n=1);let l={min:{x:1/0,y:1/0,z:i},max:{x:-1/0,y:-1/0,z:a+i}},c=hm(t?.bevel,a),p=[];e.geometry.coordinates.forEach(f=>{let h=new Na,b=f[0].map(v=>{let I=r(v[1],v[0]);return l.min.x=Math.min(l.min.x,I.x),l.min.y=Math.min(l.min.y,I.y),l.max.x=Math.max(l.max.x,I.x),l.max.y=Math.max(l.max.y,I.y),I});h.moveTo(b[0].x,b[0].y),b.slice(1).forEach(v=>h.lineTo(v.x,v.y)),h.lineTo(b[0].x,b[0].y);let x=f.slice(1);h.holes=x.map(v=>{let I=v.map(O=>r(O[1],O[0])),M=new yp;return M.moveTo(I[0].x,I[0].y),I.slice(1).forEach(O=>M.lineTo(O.x,O.y)),M.lineTo(I[0].x,I[0].y),M});let T=new ja(h,c);p.push(T)});let u=Li(p);return p.forEach(f=>f.dispose()),u.translate(0,0,i||0),u.userData={style:{color:o,opacity:n},usedBevelSettings:c},u}d();var Io=100,R$=.22,B$=.01;function ZD(e,r,t={}){let{width:o=R$,height:n=B$,color:i="gray",opacity:a=1,altitude:l=0}=t,c={min:{x:1/0,y:1/0,z:l},max:{x:-1/0,y:-1/0,z:l+n}},p={bevelEnabled:!1,depth:n},u=new Ai.ClipperOffset,f=e.geometry.coordinates.map(T=>T.map(v=>r(v[1],v[0])));u.AddPaths(f.map(T=>T.map(v=>({X:v.x*Io,Y:v.y*Io}))),Ai.JoinType.jsMiter,Ai.EndType.etOpenRound);let h=new Ai.PolyTree;u.Execute(h,o/2*Io);let b=[];for(let T of h.m_AllPolys){let v=new Na;if(T.IsHole())continue;c.min.x=Math.min(c.min.x,T.m_polygon[0].X),c.min.y=Math.min(c.min.y,T.m_polygon[0].Y),c.max.x=Math.max(c.max.x,T.m_polygon[0].X),c.max.y=Math.max(c.max.y,T.m_polygon[0].Y);let I=T.m_polygon;v.moveTo(I[0].X/Io,I[0].Y/Io),I.slice(1).forEach(M=>v.lineTo(M.X/Io,M.Y/Io)),v.lineTo(I[0].X/Io,I[0].Y/Io),v.holes=T.m_Childs.map(M=>{let O=new yp,C=M.m_polygon;return O.moveTo(C[0].X/Io,C[0].Y/Io),C.slice(1).forEach(E=>O.lineTo(E.X/Io,E.Y/Io)),O.lineTo(C[0].X/Io,C[0].Y/Io),O}),b.push(new ja(v,p))}let x=Li(b);return x.translate(0,0,l||0),x.userData={style:{color:i,opacity:a}},u.Clear(),x}d();d();var bu=F.object({type:F.enum(["Point"]),coordinates:F.array(F.number()).min(2).max(3)});var S2=F.object({rotation:F.array(F.number()).length(3).optional(),altitude:F.number().optional(),scale:F.array(F.number()).length(3).optional(),interactive:F.boolean().optional(),verticalOffset:F.number().optional(),id:F.union([F.number(),F.string()]).optional()}),N$=F.object({type:F.enum(["Feature"]),geometry:bu,properties:S2}),j$=F.object({type:F.enum(["FeatureCollection"]),features:F.array(N$)}),T2=F.object({color:F.string()}),G$=F.object({url:F.string(),color:F.string().optional(),opacity:F.number().optional(),material:F.record(F.string(),T2).optional()});function YD(e,r,t){F.union([F.number(),F.string()]).parse(e),j$.parse(r),G$.parse(t)}var zf,Wf,xl=class{constructor(r){m(this,"mesh");m(this,"type","model");m(this,"positionDirty",!0);m(this,"outline");m(this,"geometry");m(this,"material");m(this,"feature");m(this,"instanceIndex",-1);m(this,"visible",!0);m(this,"color",new ar);m(this,"position",new ae);S(this,zf,0);S(this,Wf,1);this.feature=r}setOpacity(){}setColor(){}get altitude(){return s(this,zf)}set altitude(r){this.mesh&&(this.mesh.position.z=r,w(this,zf,r))}getRotation(){return this.mesh?[this.mesh.rotation.x,this.mesh.rotation.y,this.mesh.rotation.z]:void 0}setRotation(r){this.mesh&&this.mesh.rotation.set(Ue.degToRad(r[0]),Ue.degToRad(r[1]),Ue.degToRad(r[2]))}getScale(){return this.mesh?[this.mesh.scale.x,this.mesh.scale.y,this.mesh.scale.z]:void 0}setScale(r){this.mesh&&this.mesh.scale.set(r[0],r[1],r[2])}get opacity(){return s(this,Wf)}set opacity(r){if(this.mesh){if(this.mesh.children[0]instanceof Ba){for(let t of this.mesh.children)if(t instanceof Ba){t.userData?.originalOpacity===void 0&&(t.userData.originalOpacity=t.material.opacity);let o=Nl(r,0,t.userData?.originalOpacity,0,1);t.material.opacity=o,t.material.transparent=o<1,t.material.needsUpdate=!0}}else this.mesh?.traverse(t=>{t instanceof Le&&t.material&&(Array.isArray(t.material)?t.material.forEach(o=>{XD(o,r)}):XD(t.material,r))});w(this,Wf,r)}}};zf=new WeakMap,Wf=new WeakMap;function XD(e,r){e.opacity!==r&&(r===1?(e.opacity=1,e.transparent=!1):(e.opacity=r,e.transparent=!0),e.needsUpdate=!0)}d();function N1(e){let r=e.components[0],t=e.components[1];t.opacity!=null&&t.opacity!==r.opacity&&(r.opacity=t.opacity);let o=t.material,n=t.color;if(o||n){let l=U$(n,o);r.mesh?.traverse(c=>{c instanceof Le&&c.material&&(Array.isArray(c.material)?c.material.forEach(p=>{l[p.name]?p.color.set(l[p.name].color):p.color.set(n)}):l[c.material.name]?c.material.color.set(l[c.material.name].color):c.material.color.set(n))})}let i=r.feature.geometry.coordinates[2]??0,a=t.verticalOffset+i;r.altitude!==a&&(r.altitude=a),t.visible!==r.visible&&(r.visible=t.visible),t.rotation&&r.setRotation(t.rotation),t.scale&&r.setScale(t.scale)}function U$(e,r){let t={};if(e&&Object.assign(t,{Default:{color:e},Fabric:{color:e},Mpdn_Logo:{color:e},CouchLogo:{color:e}}),r)for(let o in r)r[o].color&&(t[o]?t[o].color=r[o].color:t[o]={color:r[o].color});return t}function JD(e,r){let t=e.components[0],n=e.components[1].verticalOffset??0,i=t.feature.geometry.coordinates.slice();i[2]=(i[2]??0)+n,t.mesh?t.mesh.position.copy(r(i)):t.position.copy(r(i))}function KD(e){return e instanceof fr?e.material:null}function QD(e){return e.side===x0?"back":e.side===lm?"front":"double"}function qD(e,r){e.side=r==="back"?x0:r==="front"?lm:Ms}function V$(e){let{color:r,opacity:t,topColor:o,texture:n,topTexture:i}=e;return`${r}${t}${o||""}${n||""}${i||""}`}var j1=class extends ke{constructor(t,o){super();m(this,"state");m(this,"convertTo3DMapPosition");m(this,"loader");m(this,"optimizePromise",[]);this.state=t,this.convertTo3DMapPosition=o}async getGLTFLoader(){if(this.loader)return this.loader;let{GLTFLoader:t}=await import("./GLTFLoader-SWPNQTFP.js");return this.loader=new t,this.loader}createEntityFromFeature(t,o,n){let i=new fr(o),a=o?.properties?.bevel,l=n&&"bevel"in n?n.bevel:void 0,c;l?c={...a,...l}:a&&(c=a);let p=new Mt(i,new _i({...n,url:o.properties?.image?.path,bevel:c}));return n?.outline&&(p.components[3]=new cM(uM(n.color))),n?.focusable&&(p.components[4]=new bm),p.id=t,p}createModelFromFeature(t,o,n){let i=new xl(o),a={...n};o.properties.verticalOffset!=null&&(a.verticalOffset=o.properties.verticalOffset),o.properties.rotation!=null&&(a.rotation=o.properties.rotation),o.properties.scale!=null&&(a.scale=o.properties.scale);let l=new uy(a),c=new Mt(i,l);return c.id=t,c}populateEntityMesh(t,o){let n=t.components[0];n.geometry=o,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:o.attributes.position.count},n.currentHeight=t.components[1].height,n.dirty=!1}async populateModelGroup(t,o,n){let i=new $n,a=new gp,l=new Xg,c=new ae,p=new Ga,u=await this.getGLTFLoader(),f=new Promise(h=>{u.load(o,b=>{"entities3D"in n.userData&&(n.userData.entities3D.size>1?b.scene.traverse(x=>{let T=x;if("isMesh"in T&&T.isMesh===!0){let v=new Ba(T.geometry,T.material,t.size);v.userData={entities:{}},p.add(v),n.add(p)}}):(b.scene.traverse(x=>{"isMesh"in x&&x.isMesh===!0&&(x.position.set(0,0,0),x.rotation.set(0,0,0),x.scale.set(1,1,1),x.updateMatrix())}),p.add(b.scene),n.add(p),p.userData.isSingleModel=!0,p.userData.entityId=t.values().next().value,p.userData.type="model")),h()})});return this.optimizePromise.push(f.then(()=>{let h=0,b;for(let x of t.values()){if(b=this.state.geometry3DMap.get(x),!b||b?.type!=="model")continue;let T=b.components[0],v=b.components[1],I=b.components[0].feature;T.mesh=p,T.instanceIndex=h,N1(b),b.components[1].dirty=!1;let{x:M,y:O}=this.convertTo3DMapPosition(I.geometry.coordinates[1],I.geometry.coordinates[0],0);T.position.set(M,O,T.altitude),a.set(Ue.degToRad(v.rotation?.[0]??Op[0]),Ue.degToRad(v.rotation?.[1]??Op[1]),Ue.degToRad(v.rotation?.[2]??Op[2])),c.set(v.scale?.[0]??wp[0],v.scale?.[1]??wp[1],v.scale?.[2]??wp[2]),l.setFromEuler(a),i.compose(T.position,l,c),p.children.forEach(C=>{!b||b?.type!=="model"||!(C instanceof Ba)||(C.setMatrixAt(h,i),C.userData.entities[h]=b.id)}),T.mesh.userData.isSingleModel&&(T.mesh.matrix.copy(i),T.mesh.matrix.decompose(T.mesh.position,T.mesh.quaternion,T.mesh.scale)),h++}this.publish("model-loaded")})),p}populateEntityGroup(t){let o,n,i,a;for(let l of t.values())a=this.state.geometry3DMap.get(l),a.components[0]instanceof fr&&(n=a.components[0].feature,i=a.components[1],n.geometry.type==="Polygon"?(o=R1(n,this.convertTo3DMapPosition,i),n.properties?.textures&&n.properties.textures.length>0&&mM(o,n.properties.textures,this.state.naturalBearing,this.convertTo3DMapPosition),this.populateEntityMesh(a,o)):n.geometry.type==="MultiPolygon"?(o=B1(n,this.convertTo3DMapPosition,i),this.populateEntityMesh(a,o)):n.geometry.type==="LineString"?(o=LM(n,this.convertTo3DMapPosition,i),this.populateEntityMesh(a,o)):n.geometry.type==="MultiLineString"&&(o=ZD(n,this.convertTo3DMapPosition,i),this.populateEntityMesh(a,o)));return t}update(){for(let t of this.state.geometryGroupIdsToLoad.values()){let o=this.state.geometry3DMap.get(t);if(o instanceof zn&&o.userData.dirty){if(o.userData.modelURL)o.userData.modelURL&&(this.populateModelGroup(o.userData.entities3D,o.userData.modelURL,o),o.userData.dirty=!1);else try{this.populateEntityGroup(o.userData.entities3D)}catch(a){A.warn(a)}let n,i={};for(let a of o.userData.entities3D.values()){n=this.state.geometry3DMap.get(a);let l=n?.components[0];if(n?.type==="geometry"){let c=n.components[1],p=V$(c);i[p]===void 0&&(i[p]={style:c,entities:[]}),i[p].entities.push(n)}else l&&"mesh"in l&&l.mesh&&l.mesh?.parent!==o&&o.add(l.mesh)}for(let a in i){let l=dM(i[a].entities,i[a].style);o.add(l)}for(let a of o.userData.entities3D.values())if(n=this.state.geometry3DMap.get(a),n!=null&&n.entities2D.size>0)for(let l of n.entities2D.values())l&&(n.attach(l),this.publish("geometry-2d-added"));this.publish("geometry-group-added"),o.userData.dirty=!1}}return Promise.resolve()}};d();var G1=class{constructor(r,t){m(this,"state");m(this,"dirty",!0);m(this,"domTree");this.state=r,this.domTree=t}update(){if(this.dirty){let r;for(let t of Array.from(this.domTree.children))if(r=this.state.geometry2DMap.get(t.userData.entityId),r){let o=r.components[0];(!o.enabled||!o.visible||!this.state.geometry2DIdsInScene.has(t.userData.entityId))&&this.domTree.removeChild(t)}else this.domTree.removeChild(t);for(let t of this.state.geometry2DIdsInScene)if(r=this.state.geometry2DMap.get(t),r){let o=r.components[0];o instanceof Ds&&o.enabled&&o.markerContainer&&!this.domTree.contains(o.markerContainer)&&(o.markerContainer.userData={entityId:r.id},this.domTree.appendChild(o.markerContainer),o.updateDimensions())}this.dirty=!1}}};d();var U1=class{constructor(r,t){m(this,"state");m(this,"project");this.state=r,this.project=t}update(){let r,t=0,o,n;for(let i of this.state.geometry2DIdsInScene)if(r=this.state.geometry2DMap.get(i),r){n=r.components[0];let a=r.attachedTo?this.state.geometry3DMap.get(r.attachedTo):void 0;if(a instanceof Mt)if(this.state.geometry3DIdsInScene.has(a.id)){o=a.components[1],n=r.components[0],(o.dirty||r.components[0].attachedDirty)&&(t=o.height,r.setAltitude(t));let l=o.visible;n.visible!==l&&(n.visible=l)}else n.visible===!0&&(n.visible=!1);this.project(r.components[0].projection,r.position),r.components[0].attachedDirty=!1}}};d();d();d();var $$=function(){let r,t;return o=>{if((!t||!t)&&(r=document.createElement("canvas"),r.width=500*o,r.height=500*o,r.style.width="500px",r.style.height="500px",t=r.getContext("2d")),!t)throw new Error("Could not get 2D context");return{measureCanvas:r,measureCanvasContext:t}}}(),e4=({text:e,size:r,maxWidth:t,pixelRatio:o,maxLines:n=2,lineHeight:i=1.2,options:a={strokeText:!0}})=>{let l=`bold ${r*o}px 'InterUI-Regular', Helvetica Neue, Arial, sans-serif`,{measureCanvasContext:c}=$$(o);c.font=l;let p=[],u=e.split(" "),f=0,h=0,b=0;for(;h<u.length;){let I=u[h];if(f===n&&f>0){p[f-1]+="...";break}if(p[f]==null&&(p[f]=I,h++),u.length===1){p[f]=I;break}if(u[h]==null)break;let{width:M}=c.measureText(p[f]+" "+u[h]);M<=t*o?(p[f]+=" "+u[h],h++):f++}p.forEach(I=>{let{width:M}=c.measureText(I);b=Math.max(M,b)});let x=r*o*i,T=p.length*x;return{maxWidth:b,maxHeight:T,lines:p.length,draw:(I,M,O)=>{p.length===1?(a.strokeText&&I.strokeText(p[0],M,O),I.fillText(p[0],M,O)):(a.strokeText&&(I.strokeText(p[0],M,O-x/2),I.strokeText(p[1],M,O+x/2)),I.fillText(p[0],M,O-x/2),I.fillText(p[1],M,O+x/2))}}};d();function t4(e){let r=new Image;return e&&(/<svg[\s\S]*>/i.test(e)?r.src=`data:image/svg+xml;base64,${btoa(e)}`:r.src=e),r}var V1=class extends ke{constructor(t,o,n){super();m(this,"dirty",!1);m(this,"state");m(this,"colliderContext");m(this,"colliderCanvas");m(this,"transformRequestFunc");m(this,"transformRequest",async t=>this.transformRequestFunc?await this.transformRequestFunc(t):{url:t});m(this,"pinCache",{});m(this,"imageCache",{});m(this,"imagePromiseCache",{});m(this,"imageDimensionsCache",{});m(this,"textCache",{});m(this,"update",t=>{let o=this.state.pixelRatio;this.colliderContext.clearRect(0,0,this.colliderCanvas.width,this.colliderCanvas.height);let n,i,a,l,c,p,u;for(let f of this.state.geometry2DIdsInScene)if(u=this.state.geometry2DMap.get(f),u!=null&&(p=u.components[0],p instanceof Fs&&!u.disposed)){if(c=p.appearance.iconVisible,p.appearance.icon!=null&&c!=null){let b=typeof c=="boolean"?c:t>=c;b!==p.iconVisible&&(p.iconVisible=b,p.dirty=!0)}if((p.dirty||this.dirty)&&p.calculatePinSize(),i={active:p.appearance.pinColor,inactive:p.appearance.pinColorInactive},a={active:p.appearance.pinOutlineColor,inactive:p.appearance.pinOutlineColorInactive},l=Fi(p.pinSize,2),n=`${i.active}-${i.inactive}-${a.active}-${a.inactive}-${l}-${p.iconVisible}`,p.labelCacheId=n,(!this.pinCache[n]||this.dirty)&&(this.prepare(p,n,this.colliderContext),p.dirty=!0),(p.appearance.icon&&(!p.imageHash||p.pinDirty)||this.dirty)&&this.cacheImage(p),this.textCache[p.id]==null||p.textDirty||this.dirty){p.dirty=!0,this.textCache[p.id]={};let{textDrawFn:b,width:x,height:T}=this.processText(p.text,p.appearance.textSize,p.appearance.maxWidth,p.appearance.maxLines,p.appearance.lineHeight);["left","center","right"].forEach(v=>{this.textCache[p.id][v]=this.textToCanvas(b,p.appearance.textSize,v,x,T,p.appearance.textColor,p.appearance.textOutlineColor)}),p.dimensions={width:Math.ceil(x/o),height:Math.ceil(T/o)}}let h=1;if(p.appearance.iconScale)if(typeof p.appearance.iconScale=="number")h=p.appearance.iconScale;else{let{on:b,input:x,output:T,easing:v}=p.appearance.iconScale;b==="zoom-level"?h=FC(t,x,T,v??"linear"):A.warn(`Unsupported interpolation property: ${b}`)}p.recomputeCurrentStrategy(p.iconVisible?h:1),p.canShow&&p.visible&&(p.enabled||p.visibilityNeedsUpdate!==!1)&&this.draw(p,n,this.colliderContext),p.textDirty=!1,p.pinDirty=!1}this.dirty=!1});m(this,"processText",(t,o,n,i,a)=>{let l=this.state.pixelRatio,{draw:c,maxWidth:p,maxHeight:u}=e4({text:t,size:o,pixelRatio:l,maxWidth:n,maxLines:i,lineHeight:a});return{textDrawFn:c,width:p+2.5*l*2,height:u+2.5*l*2}});m(this,"textToCanvas",(t,o,n,i,a,l,c)=>{let p=this.state.pixelRatio,u,f=i,h=a;window.OffscreenCanvas!=null&&!ZC()?u=new OffscreenCanvas(f,h):(u=document.createElement("canvas"),u.width=f,u.height=h,u.style.width=f+"px",u.style.height=h+"px");let b=u.getContext("2d",{willReadFrequently:!0});if(!b)return;let x=2.5*p;b.textAlign=n,b.font=`bold ${o*p}px 'InterUI-Regular', Helvetica Neue, Arial, sans-serif`,b.textBaseline="middle",b.lineJoin="miter",b.miterLimit=2,b.strokeStyle="white",b.lineWidth=x,b.fillStyle=l,b.strokeStyle=c;let T=n==="left"?x/2:n==="center"?f/2:f-x/2;return t(b,T,(h+x/2)/2),u});m(this,"cacheImage",t=>{if(!t.appearance.icon)return;let o=qC(t.appearance.icon);this.imagePromiseCache[o]||(this.imagePromiseCache[o]=new Promise(n=>{this.transformRequest(t.appearance.icon).then(i=>{let a=t4(i.url);a.onload=()=>{this.imageCache[o]=a,this.publish("img:loaded"),n(a)}})})),t.imageHash!==o&&(t.imageHash=o,this.imagePromiseCache[o].then(()=>{t.dirty=!0}))});m(this,"createPinCanvas",(t,o,n,i,a=1)=>{let l,c=this.state.pixelRatio,p=t.totalPinSize*2*c*a;window.OffscreenCanvas!=null?l=new OffscreenCanvas(p,p):(l=document.createElement("canvas"),l.width=p,l.height=p,l.style.width=p/c+"px",l.style.height=p/c+"px");let u=l.getContext("2d");return u.shadowColor="rgba(0,0,0,0.3)",u.shadowOffsetY=2*c,u.shadowBlur=5*c,u.beginPath(),u.arc(p/2,p/2,(o/2+2.5*c/2)*a,0,2*Math.PI),u.fillStyle=n,u.fill(),u.beginPath(),u.arc(p/2,p/2,o/2*a,0,2*Math.PI),u.shadowColor="transparent",u.fillStyle=i,u.fill(),l});m(this,"prepare",(t,o,n)=>{let i=this.state.pixelRatio;n.lineWidth=4*i;let a=typeof t.appearance.iconScale=="number"?[t.appearance.iconScale]:t.appearance.iconScale==null?[]:t.appearance.iconScale.output,l=a.length>0?Math.max(...a):void 0,c=this.createPinCanvas(t,t.pinSize,t.appearance.pinOutlineColor,t.appearance.pinColor,l),p=this.createPinCanvas(t,3.5*i,t.appearance.pinOutlineColorInactive,t.appearance.pinColorInactive,l);this.pinCache[o]=[c,p]});this.state=t,this.colliderCanvas=o,this.colliderContext=o.getContext("2d"),this.transformRequestFunc=n}draw(t,o,n){if(!t.canShow||!t.visible)return;n.save(),n.globalAlpha=t.opacity;let i=this.state.pixelRatio,a=t.projection.x*i,l=t.projection.y*i,c=t.style.pinVisibility===1?this.pinCache[o][0]:this.pinCache[o][1],p=t.style.pinVisibility===1?t.scaledPinSize*i:t.totalPinSize*i;if(t.style.pinVisibility!==0&&n.drawImage(c,a-p,l-p,p*2,p*2),t.appearance.icon&&t.iconVisible&&t.imageHash&&t.appearance.iconSize&&this.imageCache[t.imageHash]&&t.style.pinVisibility===1){let u=this.imageCache[t.imageHash],f=(t.scaledPinSize-t.scaledIconPadding)*i,h=t.appearance.iconFit,b=f,x=f,T=`${t.imageHash}_${h}`;if(this.imageDimensionsCache[T])b=this.imageDimensionsCache[T].width,x=this.imageDimensionsCache[T].height;else{let v=u.width*i,I=u.height*i;if(h==="contain"){let M=Math.sqrt(v**2+I**2),O=f/M;b=v*O,x=I*O}if(h==="cover"){let M=f/v,O=f/I,C=Math.max(M,O);b=v*C,x=I*C}}n.save(),n.beginPath(),n.arc(a,l,f/2,0,2*Math.PI),n.closePath(),t?.appearance?.iconOverflow!=="visible"&&n.clip(),n.drawImage(u,a-b/2,l-x/2,b,x),n.restore()}t.style.textLabelVisible&&t.style.textAlign!=null&&t.style.left!=null&&t.style.top!=null&&n.drawImage(this.textCache[t.id][t.style.textAlign],a+t.style.left*i,l+t.style.top*i),n.restore()}};d();d();var Dc=class Dc{constructor(){m(this,"loader");this.loader=new bp}static getInstance(){return Dc.instance||(Dc.instance=new Dc),Dc.instance}getLoader(){return this.loader}load(r){return new Promise((t,o)=>{this.loader.load(r,t,void 0,o)})}};m(Dc,"instance");var M2=Dc,vl=M2.getInstance();function X$(e,r){let t=e.components[2],o=e.components[1];return t?.hover?[o.hoverColor||r,o.hoverColor||r]:[o.color,o.topColor||o.color]}var kc,Zf,$1=class extends ke{constructor(t,o){super();S(this,kc);m(this,"state");m(this,"convertTo3DMapPosition");m(this,"textureLoadingCache",new Map);this.convertTo3DMapPosition=o,this.state=t}processTextures(t,o,n){if(o.texture!==t.texture&&o.texture!==""&&W(this,kc,Zf).call(this,o.texture,t,"texture"),o.topTexture!==t.topTexture&&o.topTexture!==""&&W(this,kc,Zf).call(this,o.topTexture,t,"topTexture"),(t.texture==null||t.topTexture==null)&&Array.isArray(t.feature.properties?.textures)&&t.feature.properties.textures.length>0)for(let i of t.feature.properties.textures)i.face==="top"&&t.topTexture!==i.path?W(this,kc,Zf).call(this,i.path,t,"topTexture"):i.face==="side"&&t.texture!==i.path&&W(this,kc,Zf).call(this,i.path,t,"texture"),t.blendTexture=!0;(t.texture!=null||t.topTexture!=null)&&(n?.hover&&t.texturesVisible?t.hideTextures():t.texturesVisible||t.showTextures(),o.texture===""&&t.removeSideTexture(),o.topTexture===""&&t.removeTopTexture())}update(){let t,o,n;for(let i of this.state.geometry3DIdsInScene)if(n=this.state.geometry3DMap.get(i),n&&(n.type==="geometry"||n.type==="custom-geometry")&&(n.components[1]?.dirty||n.components[2]?.dirty)){let a=n.components[0],l=n.components[1];o=n.components[2];let c=X$(n,this.state.hoverColor);a.setColor(c[0],c[1]);let p=KD(a);if(l.visible!==a.visible&&(a.visible=l.visible,a instanceof fr&&a.textMesh)){let f=this.state.geometry3DMap.get(a.textMesh.userData.entityId);f?.type==="text3d"&&f.components[0].polygonEntityId!=null&&(f.components[0].visible=l.visible)}l.altitude!==a.altitude&&(a.altitude=l.altitude);let u=l.opacity*Cp(n);u!==a.opacity&&(a.opacity=u),l.renderOrder!==a.renderOrder&&(a.renderOrder=l.renderOrder),p&&l.side!==QD(p)&&qD(p,l.side),a instanceof fr&&l.shading!=null&&(l.shading?.start!==p?.getGradientShading().start||l.shading?.end!==p?.getGradientShading().end||l.shading?.intensity!==p?.getGradientShading().intensity)&&p?.setGradientShading(l.shading?.start??0,l.shading?.end??0,l.shading?.intensity??0),l.dirty=!1,a instanceof fr&&this.processTextures(a,l,o),n.components[2]&&(n.components[2].dirty=!1)}else if(n?.type==="model")n.components[1].dirty&&(N1(n),n.components[1].dirty=!1),n.components[0].positionDirty&&(JD(n,this.convertTo3DMapPosition),n.components[0].positionDirty=!1);else if(n?.type==="image"&&n.components[1]?.dirty){t=n.components[0];let a=n.components[1];a.visible!==t.visible&&(t.visible=a.visible),a.dirty=!1}else if(n?.type==="text3d"&&n.components[1]?.dirty&&n.components[0].polygonEntityId!=null){t=n.components[0];let a=n.components[1];a.visible!=null&&a.visible!==t.visible&&(t.visible=a.visible);let{textMesh:l}=t;if(l){Object.assign(l,a.getState());let c=a.hoverColor??this.state.text3dHoverColor;l.color=a.hoverByPolygon?c:a.color??Mp.color,l.outlineColor=a.hoverByPolygon?c:a.outlineColor??Mp.outlineColor,l.strokeColor=a.hoverByPolygon?c:a.strokeColor??Mp.strokeColor}a.dirty=!1}}destroy(){this.textureLoadingCache.forEach(async t=>{(await t).dispose()}),this.textureLoadingCache.clear()}};kc=new WeakSet,Zf=async function(t,o,n){if(!(!t||!o.showTextures))if(this.textureLoadingCache.has(t)){n==="topTexture"?o.topTexture=await this.textureLoadingCache.get(t):o.texture=await this.textureLoadingCache.get(t),o.showTextures();return}else{let i=new Promise((a,l)=>{vl.getLoader().load(t,c=>{n==="topTexture"?o.topTexture=c:o.texture=c,o.showTextures(),this.publish("texture-loaded"),a(c)},void 0,()=>{A.error(`Failed to load texture: ${t}`),l(`Failed to load texture: ${t}`)})});this.textureLoadingCache.set(t,i)}};d();var H1=class extends ke{constructor(t){super();m(this,"state");m(this,"animating",new Map);m(this,"isAnimating",!1);m(this,"startTime",-1);m(this,"showDuration",300);m(this,"hideDuration",250);m(this,"update",()=>{this.animating.clear();let t,o;for(let n of this.state.geometry2DIdsInScene)t=this.state.geometry2DMap.get(n),t&&(o=t.components[0],o instanceof Fs&&(o.visibilityNeedsUpdate==="show"?(o.canShow=!0,this.animating.set(o,[o.opacity,1])):o.visibilityNeedsUpdate==="hide"&&this.animating.set(o,[o.opacity,0])));this.startTime=performance.now(),this.publish("animate:2d")});m(this,"playAnimations");this.state=t,this.playAnimations=this._playAnimations}_playAnimations(){let t=performance.now();for(let[o,[n,i]]of this.animating.entries()){let a=i===1?this.showDuration:this.hideDuration,l=(t-this.startTime)/a;o.opacity=Nl(l,0,1,n,i,i===0?OC:EC),t-this.startTime>=a&&(i===1?o.canShow=!0:i===0&&(o.canShow=!1),o.visibilityNeedsUpdate=!1,this.animating.delete(o))}this.publish("draw:2d"),this.animating.size>0&&this.publish("animate:2d")}};d();var z1=class extends ke{constructor(t,o,n,i,a,l,c){super();m(this,"state");m(this,"renderer");m(this,"mode");m(this,"scene");m(this,"cameraObject");m(this,"viewCamera");m(this,"systems");m(this,"needs2DRecompute",!1);m(this,"twoDdirty",!0);m(this,"threeDdirty",!0);m(this,"frameId",null);m(this,"twoDFrameId",null);m(this,"animationFrameId",null);m(this,"nextFrame",null);m(this,"update",(t=!1)=>{if(this.renderer?.renderer==null)return Promise.resolve();if(t){let o=this.commitRenderState();return this.paint(),o}else return this.frameId?Promise.resolve():new Promise((o,n)=>{this.frameId=requestAnimationFrame(()=>this.renderer?.renderer==null?o():this.mode==="standalone"?this.commitRenderState()?.then(()=>{this.paint(),o()}).catch(i=>{n(i)}):o())})});m(this,"animate2D",()=>{this.animationFrameId=requestAnimationFrame(()=>{this.animationFrameId=null,this.systems.twoDVisiblitySystem.playAnimations()})});m(this,"drawEntities2D",()=>{this.twoDFrameId||(this.twoDFrameId=requestAnimationFrame(()=>{this.twoDFrameId=null,this.systems.twoDDrawSystem.update(this.systems.cameraSystem.getZoomLevel())}))});m(this,"updateEntities2D",()=>{this.twoDFrameId&&(cancelAnimationFrame(this.twoDFrameId),this.twoDFrameId=null),this.twoDFrameId=requestAnimationFrame(()=>{this.twoDFrameId=null,this.systems.watermarkSystem.insertIntoQuadTree(this.systems.collisionSystem.interactiveCollidersQTree),this.systems.interactionSystem.updateQuadtree(this.systems.collisionSystem.interactiveCollidersQTree),this.systems.twoDVisiblitySystem.update(),this.systems.twoDDrawSystem.update(this.systems.cameraSystem.getZoomLevel()),this.systems.domDrawSystem.update(this.systems.cameraSystem.isUserInteracting())})});m(this,"commitRenderState",()=>{try{let t=[];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(),JC(this.state.entityScene,this.state.geometry2DIdsInScene),this.systems.domVisiblitySystem.dirty=!0,this.systems.collisionSystem.collidersDirty=!0,this.systems.domMutationSystem.dirty=!0,this.systems.panBoundsSystem.dirty=!0,this.twoDdirty=!1),this.threeDdirty&&(this.state.geometry3DIdsInScene.clear(),this.state.geometryGroupIdsToLoad.clear(),YC(this.state.entityScene,this.state.geometry3DIdsInScene,this.state.geometryGroupIdsToLoad),this.threeDdirty=!1,this.systems.interactionSystem.dirty3D=!0,this.systems.panBoundsSystem.dirty=!0,this.systems.outlineInterpolationSystem.geometries3DDirty=!0,this.systems.geometryInFocusSystem.focusablesDirty=!0);let o=this.systems.meshOptimizationSystem.update();o&&t.push(o),this.systems.borderSystem.update(),this.systems.meshModificationSystem.update(),this.systems.meshDetachmentSystem.update(),this.systems.imageSystem.update(this.systems.cameraSystem.getRotation()),t.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.getRotation()),this.systems.cameraSystem.postRender(),this.systems.domVisiblitySystem.update(),this.systems.domMutationSystem.update(),this.systems.twoDProjectionSystem.update(),this.systems.occlusion2DSystem.update(),this.systems.twoDDrawSystem.update(this.systems.cameraSystem.getZoomLevel()),this.systems.domDrawSystem.update(this.systems.cameraSystem.isUserInteracting()),this.systems.watermarkSystem.update();let n=this.needs2DRecompute;return this.nextFrame=requestAnimationFrame(()=>{this.systems.collisionSystem.update(this.systems.watermarkSystem.width,this.systems.watermarkSystem.height,this.systems.watermarkSystem.options.position,!n,this.systems.imageSystem.currentImageScreenBBoxes)}),this.systems.drawSystem.update(),this.systems.geometryDisposalSystem.update(),this.systems.cameraSystem.dirty=!1,this.systems.cameraSystem.zoomDirty=!1,this.systems.cameraSystem.rotationDirty=!1,this.systems.cameraSystem.stateDirty&&(this.publish("camera-state-change"),this.systems.cameraSystem.stateDirty=!1),this.publish("post-render"),Promise.all(t)}catch(t){return Promise.reject(t)}});this.renderer=t,this.state=o,this.mode=n,this.scene=i,this.cameraObject=a,this.viewCamera=l,this.systems=c,this.systems.collisionSystem.on("visibility-changed",this.updateEntities2D),this.systems.twoDVisiblitySystem.on("draw:2d",this.drawEntities2D),this.systems.twoDVisiblitySystem.on("animate:2d",this.animate2D),this.systems.cameraSystem.on("pan-start",()=>this.needs2DRecompute=!1),this.systems.cameraSystem.on("zoom-start",()=>this.needs2DRecompute=!1),this.systems.cameraSystem.on("zoom-end",()=>this.needs2DRecompute=!0),this.systems.cameraSystem.on("rotate-start",()=>this.needs2DRecompute=!1),this.systems.cameraSystem.on("rotate-end",()=>this.needs2DRecompute=!0)}paint(){this.renderer?.renderer&&(this.mode==="standalone"&&this.renderer.clear(),this.renderer.render(this.scene,this.state.useStandaloneCamera||this.mode==="standalone"?this.cameraObject:this.viewCamera))}destroy(){this.frameId&&cancelAnimationFrame(this.frameId),this.twoDFrameId&&cancelAnimationFrame(this.twoDFrameId),this.animationFrameId&&cancelAnimationFrame(this.animationFrameId),this.nextFrame&&cancelAnimationFrame(this.nextFrame),this.state.geometry2DIdsInScene.clear(),this.state.geometry3DIdsInScene.clear(),this.systems.domVisiblitySystem.dirty=!0,this.systems.collisionSystem.collidersDirty=!0,this.update(),this.systems.collisionSystem.off("visibility-changed",this.updateEntities2D),this.systems.twoDVisiblitySystem.off("draw:2d",this.drawEntities2D),this.systems.twoDVisiblitySystem.off("animate:2d",this.animate2D)}};d();var Y$=F.object({interactive:F.boolean().optional(),id:F.string().optional(),width:F.union([F.number(),F.object({on:F.literal("zoom-level").optional(),input:F.array(F.number()).nonempty(),output:F.array(F.number()).nonempty(),easing:F.string().optional()})]).optional(),accentColor:F.string().optional(),displayArrowsOnPath:F.boolean().optional(),animateArrowsOnPath:F.boolean().optional(),visibleThroughGeometry:F.boolean().optional(),dashed:F.boolean().optional()}),J$=F.object({type:F.enum(["Feature"]),geometry:bu,properties:F.object({parentId:F.any().optional()})});function r4(e,r){F.object({features:F.array(J$)}).parse(e),Y$.parse(r)}var Xf,Il=class{constructor(r,t){m(this,"type","path");m(this,"mesh",new Ga);m(this,"material");m(this,"geometry");m(this,"outline");m(this,"feature");m(this,"options");m(this,"width",{on:"zoom-level",input:[17,22],output:[.8,.4]});m(this,"breakpoint",0);m(this,"altitudeBreakpoints");m(this,"accentColor","blue");m(this,"completeFraction",1);m(this,"altitudeAdjustment",1);m(this,"displayArrowsOnPath",!1);m(this,"animateArrowsOnPath",!1);m(this,"visibleThroughGeometry",!1);m(this,"dashed",!1);m(this,"isVertical",!1);m(this,"dirty",!0);m(this,"materialDirty",!0);m(this,"position",new ae);S(this,Xf,0);this.feature=r,this.options=t||{},this.width=t?.width??this.width,this.accentColor=t?.accentColor??this.accentColor,this.displayArrowsOnPath=t?.displayArrowsOnPath??this.displayArrowsOnPath,this.animateArrowsOnPath=t?.animateArrowsOnPath??this.animateArrowsOnPath,this.visibleThroughGeometry=t?.visibleThroughGeometry??this.visibleThroughGeometry,this.dashed=t?.dashed??this.dashed}setColor(){}setOpacity(){}set visible(r){this.mesh&&(this.mesh.visible=r)}get visible(){return this.mesh?this.mesh.visible:!1}get altitude(){return s(this,Xf)}set altitude(r){this.mesh&&(this.mesh.position.z=r,w(this,Xf,r))}set complete(r){this.material&&(this.material.uniforms.complete.value=r,this.material.needsUpdate=!0)}};Xf=new WeakMap;d();d();d();var Vo=Object.freeze({Linear:Object.freeze({None:function(e){return e},In:function(e){return e},Out:function(e){return e},InOut:function(e){return e}}),Quadratic:Object.freeze({In:function(e){return e*e},Out:function(e){return e*(2-e)},InOut:function(e){return(e*=2)<1?.5*e*e:-.5*(--e*(e-2)-1)}}),Cubic:Object.freeze({In:function(e){return e*e*e},Out:function(e){return--e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e:.5*((e-=2)*e*e+2)}}),Quartic:Object.freeze({In:function(e){return e*e*e*e},Out:function(e){return 1- --e*e*e*e},InOut:function(e){return(e*=2)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2)}}),Quintic:Object.freeze({In:function(e){return e*e*e*e*e},Out:function(e){return--e*e*e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2)}}),Sinusoidal:Object.freeze({In:function(e){return 1-Math.sin((1-e)*Math.PI/2)},Out:function(e){return Math.sin(e*Math.PI/2)},InOut:function(e){return .5*(1-Math.sin(Math.PI*(.5-e)))}}),Exponential:Object.freeze({In:function(e){return e===0?0:Math.pow(1024,e-1)},Out:function(e){return e===1?1:1-Math.pow(2,-10*e)},InOut:function(e){return e===0?0:e===1?1:(e*=2)<1?.5*Math.pow(1024,e-1):.5*(-Math.pow(2,-10*(e-1))+2)}}),Circular:Object.freeze({In:function(e){return 1-Math.sqrt(1-e*e)},Out:function(e){return Math.sqrt(1- --e*e)},InOut:function(e){return(e*=2)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1)}}),Elastic:Object.freeze({In:function(e){return e===0?0:e===1?1:-Math.pow(2,10*(e-1))*Math.sin((e-1.1)*5*Math.PI)},Out:function(e){return e===0?0:e===1?1:Math.pow(2,-10*e)*Math.sin((e-.1)*5*Math.PI)+1},InOut:function(e){return e===0?0:e===1?1:(e*=2,e<1?-.5*Math.pow(2,10*(e-1))*Math.sin((e-1.1)*5*Math.PI):.5*Math.pow(2,-10*(e-1))*Math.sin((e-1.1)*5*Math.PI)+1)}}),Back:Object.freeze({In:function(e){var r=1.70158;return e===1?1:e*e*((r+1)*e-r)},Out:function(e){var r=1.70158;return e===0?0:--e*e*((r+1)*e+r)+1},InOut:function(e){var r=2.5949095;return(e*=2)<1?.5*(e*e*((r+1)*e-r)):.5*((e-=2)*e*((r+1)*e+r)+2)}}),Bounce:Object.freeze({In:function(e){return 1-Vo.Bounce.Out(1-e)},Out:function(e){return e<.36363636363636365?7.5625*e*e:e<.7272727272727273?7.5625*(e-=.5454545454545454)*e+.75:e<.9090909090909091?7.5625*(e-=.8181818181818182)*e+.9375:7.5625*(e-=.9545454545454546)*e+.984375},InOut:function(e){return e<.5?Vo.Bounce.In(e*2)*.5:Vo.Bounce.Out(e*2-1)*.5+.5}}),generatePow:function(e){return e===void 0&&(e=4),e=e<Number.EPSILON?Number.EPSILON:e,e=e>1e4?1e4:e,{In:function(r){return Math.pow(r,e)},Out:function(r){return 1-Math.pow(1-r,e)},InOut:function(r){return r<.5?Math.pow(r*2,e)/2:(1-Math.pow(2-r*2,e))/2+.5}}}}),Yf=function(){return performance.now()},W1=function(){function e(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];this._tweens={},this._tweensAddedDuringUpdate={},this.add.apply(this,r)}return e.prototype.getAll=function(){var r=this;return Object.keys(this._tweens).map(function(t){return r._tweens[t]})},e.prototype.removeAll=function(){this._tweens={}},e.prototype.add=function(){for(var r,t=[],o=0;o<arguments.length;o++)t[o]=arguments[o];for(var n=0,i=t;n<i.length;n++){var a=i[n];(r=a._group)===null||r===void 0||r.remove(a),a._group=this,this._tweens[a.getId()]=a,this._tweensAddedDuringUpdate[a.getId()]=a}},e.prototype.remove=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];for(var o=0,n=r;o<n.length;o++){var i=n[o];i._group=void 0,delete this._tweens[i.getId()],delete this._tweensAddedDuringUpdate[i.getId()]}},e.prototype.allStopped=function(){return this.getAll().every(function(r){return!r.isPlaying()})},e.prototype.update=function(r,t){r===void 0&&(r=Yf()),t===void 0&&(t=!0);var o=Object.keys(this._tweens);if(o.length!==0)for(;o.length>0;){this._tweensAddedDuringUpdate={};for(var n=0;n<o.length;n++){var i=this._tweens[o[n]],a=!t;i&&i.update(r,a)===!1&&!t&&this.remove(i)}o=Object.keys(this._tweensAddedDuringUpdate)}},e}(),xu={Linear:function(e,r){var t=e.length-1,o=t*r,n=Math.floor(o),i=xu.Utils.Linear;return r<0?i(e[0],e[1],o):r>1?i(e[t],e[t-1],t-o):i(e[n],e[n+1>t?t:n+1],o-n)},Bezier:function(e,r){for(var t=0,o=e.length-1,n=Math.pow,i=xu.Utils.Bernstein,a=0;a<=o;a++)t+=n(1-r,o-a)*n(r,a)*e[a]*i(o,a);return t},CatmullRom:function(e,r){var t=e.length-1,o=t*r,n=Math.floor(o),i=xu.Utils.CatmullRom;return e[0]===e[t]?(r<0&&(n=Math.floor(o=t*(1+r))),i(e[(n-1+t)%t],e[n],e[(n+1)%t],e[(n+2)%t],o-n)):r<0?e[0]-(i(e[0],e[0],e[1],e[1],-o)-e[0]):r>1?e[t]-(i(e[t],e[t],e[t-1],e[t-1],o-t)-e[t]):i(e[n?n-1:0],e[n],e[t<n+1?t:n+1],e[t<n+2?t:n+2],o-n)},Utils:{Linear:function(e,r,t){return(r-e)*t+e},Bernstein:function(e,r){var t=xu.Utils.Factorial;return t(e)/t(r)/t(e-r)},Factorial:function(){var e=[1];return function(r){var t=1;if(e[r])return e[r];for(var o=r;o>1;o--)t*=o;return e[r]=t,t}}(),CatmullRom:function(e,r,t,o,n){var i=(t-e)*.5,a=(o-r)*.5,l=n*n,c=n*l;return(2*r-2*t+i+a)*c+(-3*r+3*t-2*i-a)*l+i*n+r}}},o4=function(){function e(){}return e.nextId=function(){return e._nextId++},e._nextId=0,e}(),w2=new W1,di=function(){function e(r,t){this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._isDynamic=!1,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=Vo.Linear.None,this._interpolationFunction=xu.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=o4.nextId(),this._isChainStopped=!1,this._propertiesAreSetUp=!1,this._goToEnd=!1,this._object=r,typeof t=="object"?(this._group=t,t.add(this)):t===!0&&(this._group=w2,w2.add(this))}return e.prototype.getId=function(){return this._id},e.prototype.isPlaying=function(){return this._isPlaying},e.prototype.isPaused=function(){return this._isPaused},e.prototype.getDuration=function(){return this._duration},e.prototype.to=function(r,t){if(t===void 0&&(t=1e3),this._isPlaying)throw new Error("Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.");return this._valuesEnd=r,this._propertiesAreSetUp=!1,this._duration=t<0?0:t,this},e.prototype.duration=function(r){return r===void 0&&(r=1e3),this._duration=r<0?0:r,this},e.prototype.dynamic=function(r){return r===void 0&&(r=!1),this._isDynamic=r,this},e.prototype.start=function(r,t){if(r===void 0&&(r=Yf()),t===void 0&&(t=!1),this._isPlaying)return this;if(this._repeat=this._initialRepeat,this._reversed){this._reversed=!1;for(var o in this._valuesStartRepeat)this._swapEndStartRepeatValues(o),this._valuesStart[o]=this._valuesStartRepeat[o]}if(this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=r,this._startTime+=this._delayTime,!this._propertiesAreSetUp||t){if(this._propertiesAreSetUp=!0,!this._isDynamic){var n={};for(var i in this._valuesEnd)n[i]=this._valuesEnd[i];this._valuesEnd=n}this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat,t)}return this},e.prototype.startFromCurrentValues=function(r){return this.start(r,!0)},e.prototype._setupProperties=function(r,t,o,n,i){for(var a in o){var l=r[a],c=Array.isArray(l),p=c?"array":typeof l,u=!c&&Array.isArray(o[a]);if(!(p==="undefined"||p==="function")){if(u){var f=o[a];if(f.length===0)continue;for(var h=[l],b=0,x=f.length;b<x;b+=1){var T=this._handleRelativeValue(l,f[b]);if(isNaN(T)){u=!1,console.warn("Found invalid interpolation list. Skipping.");break}h.push(T)}u&&(o[a]=h)}if((p==="object"||c)&&l&&!u){t[a]=c?[]:{};var v=l;for(var I in v)t[a][I]=v[I];n[a]=c?[]:{};var f=o[a];if(!this._isDynamic){var M={};for(var I in f)M[I]=f[I];o[a]=f=M}this._setupProperties(v,t[a],f,n[a],i)}else(typeof t[a]>"u"||i)&&(t[a]=l),c||(t[a]*=1),u?n[a]=o[a].slice().reverse():n[a]=t[a]||0}}},e.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},e.prototype.end=function(){return this._goToEnd=!0,this.update(this._startTime+this._duration),this},e.prototype.pause=function(r){return r===void 0&&(r=Yf()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=r,this)},e.prototype.resume=function(r){return r===void 0&&(r=Yf()),!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=r-this._pauseStart,this._pauseStart=0,this)},e.prototype.stopChainedTweens=function(){for(var r=0,t=this._chainedTweens.length;r<t;r++)this._chainedTweens[r].stop();return this},e.prototype.group=function(r){return r?(r.add(this),this):(console.warn("tween.group() without args has been removed, use group.add(tween) instead."),this)},e.prototype.remove=function(){var r;return(r=this._group)===null||r===void 0||r.remove(this),this},e.prototype.delay=function(r){return r===void 0&&(r=0),this._delayTime=r,this},e.prototype.repeat=function(r){return r===void 0&&(r=0),this._initialRepeat=r,this._repeat=r,this},e.prototype.repeatDelay=function(r){return this._repeatDelayTime=r,this},e.prototype.yoyo=function(r){return r===void 0&&(r=!1),this._yoyo=r,this},e.prototype.easing=function(r){return r===void 0&&(r=Vo.Linear.None),this._easingFunction=r,this},e.prototype.interpolation=function(r){return r===void 0&&(r=xu.Linear),this._interpolationFunction=r,this},e.prototype.chain=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this._chainedTweens=r,this},e.prototype.onStart=function(r){return this._onStartCallback=r,this},e.prototype.onEveryStart=function(r){return this._onEveryStartCallback=r,this},e.prototype.onUpdate=function(r){return this._onUpdateCallback=r,this},e.prototype.onRepeat=function(r){return this._onRepeatCallback=r,this},e.prototype.onComplete=function(r){return this._onCompleteCallback=r,this},e.prototype.onStop=function(r){return this._onStopCallback=r,this},e.prototype.update=function(r,t){var o=this,n;if(r===void 0&&(r=Yf()),t===void 0&&(t=e.autoStartOnUpdate),this._isPaused)return!0;var i;if(!this._goToEnd&&!this._isPlaying)if(t)this.start(r,!0);else return!1;if(this._goToEnd=!1,r<this._startTime)return!0;this._onStartCallbackFired===!1&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),this._onEveryStartCallbackFired===!1&&(this._onEveryStartCallback&&this._onEveryStartCallback(this._object),this._onEveryStartCallbackFired=!0);var a=r-this._startTime,l=this._duration+((n=this._repeatDelayTime)!==null&&n!==void 0?n:this._delayTime),c=this._duration+this._repeat*l,p=function(){if(o._duration===0||a>c)return 1;var T=Math.trunc(a/l),v=a-T*l,I=Math.min(v/o._duration,1);return I===0&&a===o._duration?1:I},u=p(),f=this._easingFunction(u);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,f),this._onUpdateCallback&&this._onUpdateCallback(this._object,u),this._duration===0||a>=this._duration)if(this._repeat>0){var h=Math.min(Math.trunc((a-this._duration)/l)+1,this._repeat);isFinite(this._repeat)&&(this._repeat-=h);for(i in this._valuesStartRepeat)!this._yoyo&&typeof this._valuesEnd[i]=="string"&&(this._valuesStartRepeat[i]=this._valuesStartRepeat[i]+parseFloat(this._valuesEnd[i])),this._yoyo&&this._swapEndStartRepeatValues(i),this._valuesStart[i]=this._valuesStartRepeat[i];return this._yoyo&&(this._reversed=!this._reversed),this._startTime+=l*h,this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1,!0}else{this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var b=0,x=this._chainedTweens.length;b<x;b++)this._chainedTweens[b].start(this._startTime+this._duration,!1);return this._isPlaying=!1,!1}return!0},e.prototype._updateProperties=function(r,t,o,n){for(var i in o)if(t[i]!==void 0){var a=t[i]||0,l=o[i],c=Array.isArray(r[i]),p=Array.isArray(l),u=!c&&p;u?r[i]=this._interpolationFunction(l,n):typeof l=="object"&&l?this._updateProperties(r[i],a,l,n):(l=this._handleRelativeValue(a,l),typeof l=="number"&&(r[i]=a+(l-a)*n))}},e.prototype._handleRelativeValue=function(r,t){return typeof t!="string"?t:t.charAt(0)==="+"||t.charAt(0)==="-"?r+parseFloat(t):parseFloat(t)},e.prototype._swapEndStartRepeatValues=function(r){var t=this._valuesStartRepeat[r],o=this._valuesEnd[r];typeof o=="string"?this._valuesStartRepeat[r]=this._valuesStartRepeat[r]+parseFloat(o):this._valuesStartRepeat[r]=this._valuesEnd[r],this._valuesEnd[r]=t},e.autoStartOnUpdate=!1,e}();var i5e=o4.nextId,ss=w2,s5e=ss.getAll.bind(ss),a5e=ss.removeAll.bind(ss),l5e=ss.add.bind(ss),c5e=ss.remove.bind(ss),p5e=ss.update.bind(ss);d();d();d();var n4=(e,r)=>(r-e+Math.PI)%(Math.PI*2)+Math.PI*2%(Math.PI*2)-Math.PI,i4=(e,r)=>new Me(e.clientX-r.offsetLeft,e.clientY-r.offsetTop),O2=(e,r)=>Math.atan2(r.y-e.y,r.x-e.x),Jf=(e,r)=>Math.sqrt((r.y-e.y)**2+(r.x-e.x)**2),E2=(e,r)=>new Me((e.x+r.x)/2,(e.y+r.y)/2),P2=e=>{let r=0,{wheelDelta:t,detail:o}=e;return t!==void 0?r=t:o!==void 0&&(r=-o),r};var Z1=class{constructor(r,t){m(this,"input1");m(this,"input2");m(this,"lastAngle");m(this,"lastDistance");m(this,"totalDistance");m(this,"first");m(this,"second");this.input1=r,this.input2=t,this.lastAngle=O2(r,t),this.lastDistance=Jf(r,t),this.totalDistance=0,this.first=r,this.second=t}update(r,t){let o=Jf(r,t);this.input1=r,this.input2=t;let n=O2(r,t);this.lastAngle=n,this.lastDistance=o,this.totalDistance+=(Jf(this.first,r)+Jf(this.second,t))/2,this.first=E2(this.first,r),this.second=E2(this.second,t)}};d();var Kf=class{constructor(r,t,o){m(this,"touch");m(this,"camera");m(this,"cameraPlane");m(this,"viewCoordinate");m(this,"snapHolderMatrix");m(this,"snapCamera");m(this,"cameraPosition");m(this,"raycaster");m(this,"worldCoordinate");m(this,"snapshotted",!1);this.touch=r,this.camera=t,this.cameraPlane=o,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 Me(this.viewCoordinate.x,this.viewCoordinate.y);this.raycaster=this.raycaster||new Ei,this.raycaster.setFromCamera(r,this.snapCamera);let t=this.raycaster.intersectObject(this.cameraPlane,!0);this.worldCoordinate=t&&t.length>0?t[0].point:null,this.snapshotted=!0}updateAnchorState(r,t){this.camera=r,this.snapCamera=r.clone(),this.snapHolderMatrix=r.matrixWorld.clone(),this.updateViewCoordinate(t),this.snapshotCameraState()}updateViewCoordinate(r){this.viewCoordinate={x:r.x,y:r.y}}reUnproject(){let r=new Me(this.viewCoordinate.x,this.viewCoordinate.y);this.raycaster?.setFromCamera(r,this.snapCamera);let t=this.raycaster?.intersectObject(this.cameraPlane,!0)[0];return t?t.point:void 0}};var ui={};La(ui,{BLOCK_MERCATOR_ZOOM_LEVEL:()=>Q$,CLIPPING_RADIUS:()=>Qf,CONTROL_OPTIONS:()=>K$,DEFAULT_ANIMATION_DURATION:()=>L2,DEFAULT_BEARING:()=>oH,DEFAULT_MAX_ZOOM_LEVEL:()=>tH,DEFAULT_MIN_ZOOM_LEVEL:()=>_2,DEFAULT_PITCH:()=>rH,DEFAULT_ZOOM_LEVEL:()=>eH,EVENTS:()=>K1,MAPLIBRE_TILE_SIZE:()=>X1,MAX_LAT:()=>D2,MAX_MERCATOR_ZOOM_LEVEL:()=>J1,MIN_LAT:()=>F2,MIN_MERCATOR_ZOOM_LEVEL:()=>Y1,ROOM_MERCATOR_ZOOM_LEVEL:()=>q$,TWO_PI:()=>k2,WHEEL_ZOOM_MULTIPLIER:()=>A2,ZRANGE:()=>vu});d();var X1=512,F2=-85.051129,D2=85.051129,Qf=1e4,K$={chain:"chain",cancel:"cancel"},k2=Math.PI*2,vu=100,A2=1e4,Y1=0,J1=24,Q$=17,q$=20,L2=200,K1=["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"],eH=18,_2=12,tH=22,rH=0,oH=0;var Q1=!1,nH=!1;var q1,Ac=class extends ke{constructor(t,o,n,i,a){super();m(this,"dirty",!1);m(this,"zoomDirty",!1);m(this,"rotationDirty",!1);m(this,"panDirty",!1);m(this,"stateDirty",!1);S(this,q1,_2);m(this,"zoomSpeed",5);m(this,"rotateSpeed",100);m(this,"enabled",!0);m(this,"enableZoom",!0);m(this,"enablePan",!0);m(this,"enablePedestal",!1);m(this,"maxPedestal",1/0);m(this,"minPedestal",0);m(this,"enableRotate",!0);m(this,"minZoomAltitude",0);m(this,"maxZoomAltitude",1/0);m(this,"ignoreZoomLimits",!1);m(this,"zoomFactor",1);m(this,"panBounds",{min:new ae(1/0,1/0),max:new ae(-1/0,-1/0),center:new ae(0,0,0),radius:1/0});m(this,"minTilt",0);m(this,"maxTilt",1.2);m(this,"MOUSE_BUTTONS",{ORBIT:Hg.RIGHT,ZOOM:Hg.MIDDLE,PAN:Hg.LEFT});m(this,"camera");m(this,"scene");m(this,"renderer");m(this,"elevation");m(this,"orbit");m(this,"cameraPlane");m(this,"raycaster",new Ei);m(this,"rendererState");m(this,"options");m(this,"state",-1);m(this,"intersection");m(this,"viewState",null);m(this,"tweens",new Map);m(this,"clock",new vC(!0));m(this,"coords",{mouse:new Me,rotateStart:new Me,rotateEnd:new Me,rotateDelta:new Me,panStart:new ae,panCameraStart:new ae,panEnd:new ae,panDelta:new ae,initialShiftPos:new Me,initialPedestal:0,floorAnchor:new ae});m(this,"touch",{origin:{offsetLeft:0,offsetTop:0},touches:[],anchor1:null,anchor2:null,inputs:null});m(this,"scrollTimer",null);m(this,"lastWheelTime",0);m(this,"resetZoom",!1);m(this,"zoomStart");m(this,"pedestalScaleFactor",1);m(this,"isUserZooming",!1);m(this,"stayInsideBounds",!0);m(this,"userInteracting",!1);m(this,"cameraMoving",!1);m(this,"lastCameraMoveTime",Date.now());m(this,"raycastToFloor",t=>{this.raycaster.setFromCamera(t,this.camera);let o=this.raycaster.intersectObject(this.cameraPlane,!1)[0];return o?o.point:new ae});m(this,"isUserInteracting",()=>this.userInteracting);m(this,"getPosition",()=>new ae(this.orbit.position.x,this.orbit.position.y,this.orbit.position.z));m(this,"getPedestal",()=>this.orbit.position.z);m(this,"pan",(t,o)=>{isNaN(t)||isNaN(o)||(this.setPosition(this.orbit.position.x+t,this.orbit.position.y+o),this.publish("position-updated"))});m(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"))});m(this,"isCameraMoving",()=>this.cameraMoving);m(this,"lastCameraStoppedMovingTime",()=>this.lastCameraMoveTime);m(this,"setPosition",(t,o)=>{t===void 0||o===void 0||isNaN(t)||isNaN(o)||(this.state===-1&&this.publish("pan-start"),this.updateCameraPosition(t,o),this.publish("position-updated"),this.publish("change"),this.state===-1&&this.publish("pan-end"),this.dirty=!0,this.stateDirty=!0)});m(this,"updateCameraPosition",(t,o)=>{let n=t-this.panBounds.center.x,i=o-this.panBounds.center.y,a=Math.sqrt(n*n+i*i);if(this.stayInsideBounds&&a>this.panBounds.radius){let l=Math.atan2(i,n),c={x:Math.cos(l)*this.panBounds.radius+this.panBounds.center.x,y:Math.sin(l)*this.panBounds.radius+this.panBounds.center.y};this.orbit.position.x=c.x,this.orbit.position.y=c.y}else this.orbit.position.x=t,this.orbit.position.y=o});m(this,"tilt",t=>{if(isNaN(t))return;this.state===-1&&this.publish("rotate-start");let o=this.stayInsideBounds?Math.max(Math.min(t+this.getTilt(),this.maxTilt),this.minTilt):t+this.getTilt();o!==this.elevation.rotation.x&&(this.elevation.rotation.x=o,this.publish("tilt-updated")),this.publish("change"),this.state===-1&&this.publish("rotate-end"),this.stateDirty=!0});m(this,"zoomIn",(t,o,n)=>{let i=this.getZoomAltitude();this.animateCamera({zoom:i/1.5},t,o,n)});m(this,"zoomOut",(t,o,n)=>{let i=this.getZoomAltitude();this.animateCamera({zoom:i*1.5},t,o,n)});m(this,"getRotation",()=>(-this.orbit.rotation.z+Math.PI*2)%(Math.PI*2));m(this,"cancelAnimation",()=>{let t=Array.from(this.tweens.keys()),o=t[t.length-1];o.state===7&&this.publish("multi-cancel",{zooming:!0,rotating:!0,tilting:!0}),this.completeTween(o)});m(this,"animateCamera",(t,o,n,i,a,l)=>{let c={interruptible:!0,...l},p={},u={},f=this.getPosition();if(t.position!=null&&(t.position.x!==void 0&&(p.x=f.x,u.x=t.position.x),t.position.y!==void 0&&(p.y=f.y,u.y=t.position.y),t.position.z!==void 0&&(p.z=f.z,u.z=t.position.z)),t.zoom!==void 0&&(p.zoom=this.stayInsideBounds?Math.min(Math.max(this.getZoomAltitude(),this.getZoomScaledMin()),this.getZoomScaledMax()):this.getZoomAltitude(),this.viewState==="multi_floor"||!this.stayInsideBounds?u.zoom=t.zoom:u.zoom=Math.min(Math.max(t.zoom,this.getZoomScaledMin()),this.getZoomScaledMax())),t.rotation!==void 0){let{start:O,end:C}=oy(this.getRotation(),t.rotation);p.rotation=O,u.rotation=C}t.tilt!==void 0&&(p.tilt=this.getTilt(),this.viewState==="multi_floor"||!this.stayInsideBounds?u.tilt=t.tilt:u.tilt=Math.max(Math.min(t.tilt,this.maxTilt),this.minTilt));let h=p.zoom!==u.zoom,b=p.rotation!==u.rotation,x=p.tilt!==u.tilt,T=new di(p).to(u,y.env.TESTING?0:o).onUpdate(O=>{this.setMulti({x:O.x,y:O.y,z:O.z},O.zoom,O.rotation,O.tilt)}).onComplete(()=>{this.completeTween(T),this.publish("multi-end",{zooming:h,rotating:b,tilting:x}),i&&i()}).onStart(()=>{this.state!==7&&(this.state=7,T.state=7,this.publish("multi-start",{zooming:h,rotating:b,tilting:x})),this.publish("change")});this.rendererState.internalTweenGroup.add(T);let v=Array.from(this.tweens.entries()),I=v[v.length-1],M=!1;return I!=null&&(I[1].interruptible?(typeof I[1].cancelledCallback=="function"&&I[1].cancelledCallback(),this.completeTween(I[0])):(M=!0,I[0].chain(T))),this.tweens.set(T,{cancelledCallback:a,interruptible:c.interruptible}),n?T.easing(n):T.easing(Vo.Quadratic.In),!t.doNotAutoStart&&!M&&(T.start(),this.publish("change")),T.cameraAnimation=!0,T});m(this,"setMulti",(t,o,n,i,a=!0)=>{this.state===-1&&this.publish("multi-start");let l=!1;t!=null&&(t.x!==void 0&&!isNaN(t.x)&&t.y!==void 0&&!isNaN(t.y)&&(this.updateCameraPosition(t.x,t.y),l=!0),t.z!==void 0&&!isNaN(t.z)&&(this.setPedestal(t.z,!0,!1),l=!0)),l&&this.publish("position-updated");let c={zooming:!1,tilting:!!o,rotating:!1};if(o!==void 0&&!isNaN(o)){let p=this.stayInsideBounds?Math.min(Math.max(o,this.getZoomScaledMin()),this.getZoomScaledMax()):o;p!==this.camera.position.z&&(c.zooming=!0,this.camera.position.z=p,this.publish("zoom-updated"),this.zoomDirty=!0,this.viewState==="multi_floor"?o>Qf&&(this.camera.near=o-Qf,this.camera.far=o+Qf):(this.camera.near=o/vu,this.camera.far=o*vu),this.camera.updateProjectionMatrix())}if(n!==void 0&&!isNaN(n)&&n!==this.getRotation()&&(c.rotating=!0,this.orbit.rotation.z=-n,this.publish("rotation-updated")),i!==void 0&&!isNaN(i)){let p=this.stayInsideBounds?Math.max(Math.min(i,this.maxTilt),this.minTilt):i;p!==this.elevation.rotation.x&&(c.tilting=!0,this.elevation.rotation.x=p,this.publish("tilt-updated"))}a&&this.publish("change"),this.state===-1&&this.publish("multi-end",c),this.stateDirty=!0});m(this,"getZoomScaledMin",()=>this.minZoomAltitude*this.zoomFactor);m(this,"getZoomScaledMax",()=>{let t=this.minZoomAltitude*this.zoomFactor;return Math.max(this.maxZoomAltitude,t)});m(this,"setRotation",(t,o)=>{if(isNaN(t))return;this.state===-1&&!o&&this.publish("rotate-start");let n=-(t%k2);n!==this.orbit.rotation.z&&(this.orbit.rotation.z=n,o||this.publish("rotation-updated")),o||this.publish("change"),this.state===-1&&!o&&this.publish("rotate-end"),this.dirty=!0,this.rotationDirty=!0,o||(this.stateDirty=!0)});m(this,"setZoomAltitude",t=>{if(isNaN(t))return;this.state===-1&&this.publish("zoom-start");let o=this.stayInsideBounds?Math.min(Math.max(t,this.getZoomScaledMin()),this.getZoomScaledMax()):t;o!==this.camera.position.z&&(this.camera.position.z=o,this.publish("zoom-updated"),this.zoomDirty=!0),this.camera.near=o/vu,this.camera.far=o*vu,this.camera.updateProjectionMatrix(),this.publish("change"),this.state===-1&&this.publish("zoom-end"),this.dirty=!0,this.stateDirty=!0});m(this,"setZoomLevel",t=>{this.setZoomAltitude(this.convertZoomLevelToAltitude(t))});m(this,"getZoomAltitude",()=>this.camera.position.z);m(this,"getZoomLevel",()=>this.convertAltitudeToZoomLevel(this.getZoomAltitude()));m(this,"setTilt",(t,o)=>{if(isNaN(t))return;this.state===-1&&!o&&this.publish("rotate-start");let n=this.stayInsideBounds?Math.max(Math.min(t,this.maxTilt),this.minTilt):t;n!==this.elevation.rotation.x&&(this.elevation.rotation.x=n,o||this.publish("tilt-updated")),o||this.publish("change"),this.state===-1&&!o&&this.publish("rotate-end"),this.dirty=!0,o||(this.stateDirty=!0)});m(this,"getTilt",()=>this.elevation.rotation.x);m(this,"setCameraPlaneElevation",t=>{this.cameraPlane.position.z=t});m(this,"zoom",t=>{if(isNaN(t))return;this.state===-1&&this.publish("zoom-start");let o=this.getZoomAltitude()-t;this.camera.position.z=this.stayInsideBounds?Math.min(Math.max(o,this.minZoomAltitude*this.zoomFactor),this.maxZoomAltitude*this.zoomFactor):o,this.publish("zoom-updated"),this.zoomDirty=!0,this.publish("change"),this.state===-1&&this.publish("zoom-end"),this.stateDirty=!0});m(this,"getProjectionScaleFactor",(t,o,n)=>L0(t,o,n));m(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())});m(this,"setPedestal",(t,o=!1,n=!0)=>{typeof t=="number"&&!isNaN(t)&&(this.orbit.position.z=t,o&&(this.publishPedestalChangeEvent(t),this.publish("pedestal-change",{pedestal:t})),this.publish("change"),this.dirty=!0,n&&(this.stateDirty=!0))});m(this,"dispose",()=>{for(let t of K1)t.endsWith("start")?(this.off(t,this.setCameraMoving),t.startsWith("user")&&this.off(t,this.setUserInteracting)):(t.endsWith("end")||t.endsWith("cancel"))&&(this.off(t,this.unsetCameraMoving),t.startsWith("user")&&this.off(t,this.unsetUserInteracting));this.removeEventListeners(),this.scene.remove(this.cameraPlane),this.destroy()});m(this,"createCameraPlane",()=>{let t=Q1?2e3:1e10,o=Q1?100:1,n=new Os(t,t,o,o),i=new Nr({color:0,wireframe:Q1,visible:Q1}),a=new Le(n,i);return this.scene.add(a),a});m(this,"addEventListeners",()=>{let{domElement:t}=this.renderer;for(let o of K1)o.endsWith("start")?(this.on(o,this.setCameraMoving),o.startsWith("user")&&this.on(o,this.setUserInteracting)):(o.endsWith("end")||o.endsWith("cancel"))&&(this.on(o,this.unsetCameraMoving),o.startsWith("user")&&this.on(o,this.unsetUserInteracting));t.addEventListener("contextmenu",this.onContextMenu,!1),t.addEventListener("mousedown",this.onMouseDown,!1),t.addEventListener("wheel",this.onMouseWheel,{passive:!1}),t.addEventListener("touchstart",this.onTouchStart,!1),t.addEventListener("touchend",this.onTouchEnd,!1),t.addEventListener("touchmove",this.onTouchMove,!1)});m(this,"addMouseEventListeners",()=>{this.addMouseMoveEventListeners(),window.addEventListener("mouseup",this.onMouseUp,!1),window.addEventListener("mouseout",this.onMouseUp,!1)});m(this,"addMouseMoveEventListeners",()=>{this.renderer.domElement.addEventListener("mousemove",this.onMouseMove,!1)});m(this,"removeMouseMoveEventListeners",()=>{this.renderer.domElement.removeEventListener("mousemove",this.onMouseMove,!1)});m(this,"removeEventListeners",()=>{let{domElement:t}=this.renderer;t.removeEventListener("contextmenu",this.onContextMenu,!1),t.removeEventListener("mousedown",this.onMouseDown,!1),t.removeEventListener("wheel",this.onMouseWheel,!1),t.removeEventListener("touchstart",this.onTouchStart,!1),t.removeEventListener("touchend",this.onTouchEnd,!1),t.removeEventListener("touchmove",this.onTouchMove,!1),t.removeEventListener("mousemove",this.onMouseMove,!1),window.removeEventListener("mouseup",this.onMouseUp,!1),window.removeEventListener("mouseout",this.onMouseUp,!1)});m(this,"removeMouseUpEventListeners",()=>{this.renderer.domElement.removeEventListener("mousemove",this.onMouseMove,!1),window.removeEventListener("mouseup",this.onMouseUp,!1),window.removeEventListener("mouseout",this.onMouseUp,!1)});m(this,"onContextMenu",t=>{t.preventDefault()});m(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}});m(this,"onMouseMove",t=>{if(this.enabled!==!1)if(t.preventDefault(),this.mouseToScene(t),this.state===0){if(this.enableRotate===!1)return;this.handleMouseMoveRotate(t)}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(t)});m(this,"onTouchStart",t=>{if(this.enabled!==!1){switch(this.updateTouchOrigin(),this.touchToScene(t),t.touches.length){case 1:this.enablePedestal?(this.handleTouchStartPedestal(t),this.state=9):this.enablePan&&(this.handleTouchStartPan(t),this.state=6);break;case 2:this.touch.inputs=new Z1(this.touch.touches[0],this.touch.touches[1]);break;default:this.state=-1}this.state}});m(this,"onTouchMove",t=>{if(this.enabled!==!1)switch(this.touchToScene(t),t.touches.length){case 2:t.preventDefault(),t.stopPropagation();let o={...this.touch.inputs.first},n={...this.touch.inputs.second},i=new Me(this.touch.touches[0].x,this.touch.touches[0].y),a=new Me(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(t);else if(this.state===5)this.handleTouchMoveDolly();else if(this.state!==5&&this.touch.inputs.totalDistance>.05){let l=o.y<i.y&&n.y<a.y,c=o.y>i.y&&n.y>a.y;this.enableRotate&&this.state!==4&&(c||l)?(this.handleTouchStartTilt(t),this.state=4):(this.handleTouchStartDolly(),this.state=5)}break;case 1:(this.enablePedestal||this.enablePan)&&(t.preventDefault(),t.stopPropagation()),this.enablePedestal&&this.state===9?this.handleTouchMovePedestal(t):this.enablePan&&this.state===6&&this.handleTouchMovePan(t);break;default:this.state=-1}});m(this,"onTouchEnd",t=>{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}t.touches.length?this.onTouchStart(t):this.state=-1}});m(this,"handleTouchMovePan",t=>{let o=Object.hasOwn(t,"x")?new Me(t.x,t.y):this.touch.touches[0],n=this.raycastToFloor(o);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});m(this,"handleTouchStartDolly",()=>{let t=this.touch.touches[0].x-this.touch.touches[1].x,o=this.touch.touches[0].y-this.touch.touches[1].y;this.zoomStart=this.getZoomAltitude();let n=new Me(this.touch.touches[0].x-t/2,this.touch.touches[0].y-o/2);this.coords.floorAnchor=this.raycastToFloor(n),this.orbit.updateMatrixWorld(),this.touch.anchor1=new Kf(this.touch.touches[0],this.camera,this.cameraPlane),this.touch.anchor2=new Kf(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")});m(this,"handleMouseMovePan",()=>{let t=this.raycastToFloor(this.coords.mouse);this.coords.panEnd.set(t.x,t.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});m(this,"handleTouchStartTilt",t=>{this.coords.rotateStart.set(t.touches[1].clientX,t.touches[1].clientY),this.publish("user-tilt-start"),this.publish("rotate-start")});m(this,"handleTouchMovePedestal",t=>{this.handleMouseMovePedestal(t.touches[0])});m(this,"handleTouchMoveTilt",t=>{this.coords.rotateEnd.set(t.touches[1].clientX,t.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)});m(this,"handleTouchMoveDolly",()=>{let t=this.touch.inputs.first,o=this.touch.inputs.second;this.touch.anchor1.viewCoordinate={x:t.x,y:t.y},this.touch.anchor2.viewCoordinate={x:o.x,y:o.y};let n=this.makeTransformFromTouchAnchors(this.touch.anchor1,this.touch.anchor2);n&&this.setCameraFromTransformMatrix(n),this.orbit.updateMatrixWorld(),this.touch.anchor1.updateAnchorState(this.camera,t),this.touch.anchor2.updateAnchorState(this.camera,o)});m(this,"handleTouchEnd",()=>{this.state===4||this.state===5?this.publish("multi-end"):this.state===6&&this.publish("pan-end"),this.panDirty=!1});m(this,"handleTouchStartPan",t=>{let o=Object.hasOwn(t,"x")?new Me(t.x,t.y):this.touch.touches[0],n=this.raycastToFloor(o);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")});m(this,"handleTouchStartPedestal",t=>{this.handleMouseDownPedestal(t.touches[0])});m(this,"onMouseDown",t=>{if(this.enabled!==!1){if(this.mouseToScene(t),t.preventDefault(),this.state===3&&this.publish("zoom-end"),t.button===this.MOUSE_BUTTONS.ORBIT){if(this.enableRotate===!1)return;this.handleMouseDownRotate(t),this.state=0}else t.button===this.MOUSE_BUTTONS.PAN&&(this.enablePan?(this.handleMouseDownPan(),this.state=2):this.enablePedestal&&(this.handleMouseDownPedestal(t),this.state=8));this.state!==-1&&this.addMouseEventListeners()}});m(this,"onMouseWheel",t=>{this.enabled===!1||this.enableZoom===!1||this.state!==-1&&this.state!==3||(t.preventDefault(),t.stopPropagation(),this.mouseToScene(t),this.canScrollZoom(t)&&(this.lastWheelTime=this.clock.getElapsedTime(),this.publishUserZoomEvent()),this.state!==3&&this.canScrollZoom(t)&&(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(t))});m(this,"handleMouseWheel",t=>{if(this.publish("zoom-start"),!this.canScrollZoom(t)){this.lastWheelTime>0&&this.publish("zoom-end"),this.lastWheelTime=0,this.state=-1;return}let o=this.getZoomAltitude(),n=o-P2(t)*o/A2*this.zoomSpeed;if(this.setZoomAltitude(n),this.enablePan){let i=n/this.zoomStart;this.coords.panDelta.subVectors(this.coords.floorAnchor,this.coords.panCameraStart).multiplyScalar(1-i),this.setPosition(this.coords.panCameraStart.x+this.coords.panDelta.x,this.coords.panCameraStart.y+this.coords.panDelta.y)}this.publish("change")});m(this,"setCameraFromTransformMatrix",t=>{this.orbit.updateMatrixWorld();let o=new gp;o.setFromRotationMatrix(t,"ZYX");let n=(t.elements[14]-this.cameraPlane.position.z)/Math.cos(o.x),i=o.z,a=new ae(0,0,1);a.applyEuler(o),a.setLength(n);let l=new ae;l.setFromMatrixPosition(t),l.sub(a),this.enablePan&&this.setPosition(l.x,l.y),this.enableZoom&&this.setZoomAltitude(n),this.enableRotate&&this.setRotation(-i)});m(this,"makeTransformFromTouchAnchors",(t,o)=>{this.orbit.updateMatrixWorld(),this.camera.updateProjectionMatrix();let n=this.camera.projectionMatrix.clone(),i=t.worldCoordinate,a=o.worldCoordinate,l=t.reUnproject(),c=o.reUnproject();if(!l||!c||!i||!a)return null;let p=t.viewCoordinate,u=o.viewCoordinate,f=a.x-i.x,h=a.y-i.y,b=Math.atan2(h,f),x=c.x-l.x,T=c.y-l.y,v=Math.atan2(T,x),I=n4(b,v),M=new $n;M.makeRotationZ(-I);let O=M.clone();O.multiply(t.snapHolderMatrix);let C=(Ug,pp,dp)=>Ug.elements[(pp-1)*4+dp-1],E=C(n,1,1)*C(O,1,1)-p.x*C(n,3,4)*C(O,3,1),_=C(n,1,1)*C(O,1,2)-p.x*C(n,3,4)*C(O,3,2),G=C(n,1,1)*C(O,1,3)-p.x*C(n,3,4)*C(O,3,3),R=i.x*E+i.y*_+i.z*G,N=C(n,2,2)*C(O,2,1)-p.y*C(n,3,4)*C(O,3,1),X=C(n,2,2)*C(O,2,2)-p.y*C(n,3,4)*C(O,3,2),z=C(n,2,2)*C(O,2,3)-p.y*C(n,3,4)*C(O,3,3),ee=i.x*N+i.y*X+i.z*z,re=C(n,1,1)*C(O,1,1)-u.x*C(n,3,4)*C(O,3,1),ue=C(n,1,1)*C(O,1,2)-u.x*C(n,3,4)*C(O,3,2),Ce=C(n,1,1)*C(O,1,3)-u.x*C(n,3,4)*C(O,3,3),Oe=a.x*re+a.y*ue+a.z*Ce,Pe=C(n,2,2)*C(O,2,1)-u.y*C(n,3,4)*C(O,3,1),Fe=C(n,2,2)*C(O,2,2)-u.y*C(n,3,4)*C(O,3,2),ce=C(n,2,2)*C(O,2,3)-u.y*C(n,3,4)*C(O,3,3),Ee=a.x*Pe+a.y*Fe+a.z*ce,ye=Math.abs(re-E),Ge=Math.abs(ue-_),Ie=Math.abs(Ce-G),Xe=Math.abs(re-N),se=Math.abs(ue-X),nt=Math.abs(Ce-z),dt=Math.abs(Pe-E),$t=Math.abs(Fe-_),k=Math.abs(ce-G),H=Math.abs(Pe-N),P=Math.abs(Fe-X),q=Math.abs(ce-z),K=Math.min(ye+Ge+Ie,Xe+se+nt),Q=Math.min(dt+$t+k,H+P+q);K<Q&&(re=Pe,ue=Fe,Ce=ce,Oe=Ee);let De=N*G-E*z,xt=X*G-_*z,dr=ee*G-R*z,ir=re*z-N*Ce,ur=ue*z-X*Ce,Mi=Oe*z-ee*Ce,lp=(Mi*xt-dr*ur)/(ir*xt-De*ur),nm=(Mi*De-dr*ir)/(ur*De-xt*ir),cp=X*E-_*N,Rl=z*E-G*N,ka=ee*E-R*N,vs=ue*N-X*re,Gg=Ce*N-z*re,im=((Oe*N-ee*re)*cp-ka*vs)/(Gg*cp-Rl*vs),Aa=O.clone();return Aa.elements[12]=lp,Aa.elements[13]=nm,Aa.elements[14]=im,im>0?Aa:null});m(this,"updateTouchOrigin",()=>{let t=this.renderer.domElement;this.touch.origin.offsetLeft=t.getBoundingClientRect().left,this.touch.origin.offsetTop=t.getBoundingClientRect().top});m(this,"touchToScene",t=>{this.touch.touches=[];for(let o=0,n=t.touches.length;o<n;o++){let i=t.touches[o],a=i4(i,this.touch.origin);this.touch.touches.push(new Me(a.x/this.renderer.domElement.width*this.rendererState.pixelRatio*2-1,-(a.y/this.renderer.domElement.height*this.rendererState.pixelRatio)*2+1))}this.coords.mouse=this.touch.touches[0]});m(this,"canScrollZoom",t=>{let o=P2(t),n=this.getZoomAltitude();return!(o<0&&n===this.getZoomScaledMax()||o>0&&n===this.getZoomScaledMin())});m(this,"mouseToScene",t=>{let o=this.getMousePos(t);return this.coords.mouse.x=o.x/this.renderer.domElement.width*this.rendererState.pixelRatio*2-1,this.coords.mouse.y=-(o.y/this.renderer.domElement.height*this.rendererState.pixelRatio)*2+1,this.coords.mouse});m(this,"getMousePos",t=>({x:t.offsetX,y:t.offsetY}));m(this,"handleMouseDownRotate",t=>{this.coords.rotateStart.set(t.clientX,t.clientY),this.publish("rotate-start"),this.publish("user-rotate-start")});m(this,"handleMouseDownPan",()=>{let t=this.raycastToFloor(this.coords.mouse);this.coords.panStart.set(t.x,t.y,0),this.coords.panCameraStart.set(this.orbit.position.x,this.orbit.position.y,0),this.publish("pan-start"),this.publish("user-pan-start")});m(this,"handleMouseDownPedestal",t=>{let o=new Me(t.clientX,t.clientY);this.coords.initialShiftPos=o,this.coords.initialPedestal=this.getPedestal(),this.pedestalScaleFactor=L0(this.camera.fov,this.renderer.domElement.clientHeight,this.getZoomAltitude()),this.publish("pedestal-start"),this.publish("user-pedestal-start")});m(this,"handleMouseMovePedestal",t=>{let o={x:t.clientX,y:t.clientY},n=this.coords.initialPedestal+this.pedestalScaleFactor*(o.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)});m(this,"handleMouseMoveRotate",t=>{this.coords.rotateEnd.set(t.clientX,t.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")});m(this,"publishUserZoomDebounced",gm(()=>{this.isUserZooming=!1,this.publish("user-zoom-end")},250));m(this,"publishUserZoomEvent",()=>{this.isUserZooming?this.publishUserZoomDebounced():(this.publish("user-zoom-start"),this.isUserZooming=!0,this.publishUserZoomDebounced())});m(this,"setCameraMoving",()=>{this.cameraMoving=!0});m(this,"unsetCameraMoving",()=>{this.cameraMoving=!1,this.lastCameraMoveTime=Date.now()});m(this,"setUserInteracting",()=>{this.userInteracting=!0});m(this,"unsetUserInteracting",()=>{this.userInteracting=!1});m(this,"publishPedestalChangeEvent",t=>{this.publish("pedestal-change",{pedestal:t,scrolledToTop:this.scrolledToTop,scrolledToBottom:this.scrolledToBottom,scrollPercent:this.scrollPercent})});m(this,"convertAltitudeToZoomLevel",t=>{let[,o]=this.center,i=t*2*Math.tan(Ue.degToRad(this.camera.fov)/2)/this.options.canvasHeight,a=Math.cos(Ue.degToRad(o))*2*Math.PI*b0/i;return Ue.clamp(Math.log2(a/512),Y1,J1)});m(this,"convertZoomLevelToAltitude",t=>{let[,o]=this.center,n=Ue.clamp(t,Y1,J1),i=Math.pow(2,n),a=Ue.clamp(o,F2,D2),l=i*512;return Math.cos(Ue.degToRad(a))*Math.PI*2*b0/l*this.options.canvasHeight/2/Math.tan(Ue.degToRad(this.camera.fov)/2)});m(this,"completeTween",t=>{t.isPlaying()&&t.stop(),this.rendererState.internalTweenGroup.remove(t),this.tweens.delete(t)});m(this,"debugContainer",new ws);this.camera=t,this.renderer=n,this.rendererState=i,this.scene=o,this.options=a,this.elevation=t.parent,this.orbit=this.elevation.parent,this.cameraPlane=this.createCameraPlane(),this.zoomStart=t.position.z,a.mode!=="outdoors-overlay"&&this.addEventListeners()}get maxZoomLevel(){return this.convertAltitudeToZoomLevel(this.minZoomAltitude)}setMaxZoomLevel(t){this.minZoomAltitude=this.convertZoomLevelToAltitude(t),this.stateDirty=!0}get defaultMinZoomLevel(){return s(this,q1)}get minZoomLevel(){return this.convertAltitudeToZoomLevel(this.maxZoomAltitude)}setMinZoomLevel(t){this.maxZoomAltitude=this.convertZoomLevelToAltitude(t),this.stateDirty=!0}get scrollPercent(){let t=this.minPedestal,o=this.maxPedestal,n=this.getPedestal();return n=Math.min(n,o),n=Math.max(n,t),(n-t)/(o-t)*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(){let t=this.getPosition(),{lat:o,lon:n}=cy(this.rendererState.center?.[1]??0,this.rendererState.center?.[0]??0,t.x,t.y);return[n,o]}setCenter(t,o){let{x:n,y:i}=py(this.rendererState.center?.[1]??0,this.rendererState.center?.[0]??0,o,t);this.setPosition(n,i)}get isAnimating(){return this.rendererState.internalTweenGroup.getAll().some(t=>t.cameraAnimation)}getCameraFrameForCoordinates(t,o){let n=o.minZoom!==void 0?o.minZoom:this.minZoomAltitude,i=o.maxZoom!==void 0?o.maxZoom:this.maxZoomAltitude,a=this.options.canvasWidth,l=this.options.canvasHeight,c=this.getRotation(),p=this.getTilt(),u=this.getPosition();this.setRotation(o.rotation??c,!0),this.setTilt(o.tilt??p,!0);let f=s4(t,{canvasWidth:a,canvasHeight:l,paddingOption:o.padding,verticalPadding:o.verticalPadding,minZoom:n,maxZoom:i,position:u,camera:this.camera,orbit:this.orbit});return this.setRotation(c,!0),this.setTilt(p,!0),{center:f.position,zoomLevel:this.convertAltitudeToZoomLevel(f.zoom)}}focusOn(t,o){if(nH){this.debugContainer&&Ht(this.debugContainer);let v=new Hn(4,4,4),I=new Nr({color:65280,depthTest:!1}),M=new Ba(v,I,t.length),O=new $n;t.forEach((C,E)=>{O.setPosition(C),M.setMatrixAt(E,O)}),M.instanceMatrix.needsUpdate=!0,this.debugContainer.add(M),this.scene.add(this.debugContainer)}let n=o.curve,i=o.callback,a=o.cancelledCallback,l=o.minZoom!==void 0?o.minZoom:this.minZoomAltitude,c=o.maxZoom!==void 0?o.maxZoom:this.maxZoomAltitude,p=this.options.canvasWidth,u=this.options.canvasHeight,f;o.duration!==void 0?f=o.duration:y.env.TESTING==="true"?f=0:f=L2;let h=o.padding,b=this.getRotation(),x=this.getTilt();o.rotation!=null&&this.setRotation(o.rotation),o.tilt!=null&&this.setTilt(o.tilt);let T=s4(t,{canvasHeight:u,paddingOption:h,canvasWidth:p,minZoom:l,maxZoom:c,camera:this.camera,orbit:this.orbit,position:this.getPosition(),verticalPadding:o.verticalPadding});this.setRotation(b),this.setTilt(x),this.animateCamera({position:T.position,tilt:o.tilt,rotation:o.rotation,zoom:T.zoom},f,n,i,a,o)}resize(t,o){this.options.canvasWidth=t,this.options.canvasHeight=o}};q1=new WeakMap,m(Ac,"CAMERA_FRAME_PADDING_SIDES",["top","bottom","left","right"]);function s4(e,{canvasWidth:r,orbit:t,paddingOption:o,verticalPadding:n=0,canvasHeight:i,minZoom:a,maxZoom:l,camera:c,position:p}){let u={zoom:a,position:p};if(e.length===0)return u;for(let De of Ac.CAMERA_FRAME_PADDING_SIDES)typeof o[De]!="number"&&(o[De]=0);let f=o.type==="portion"?{top:o.top*i,bottom:o.bottom*i,left:o.left*r,right:o.right*r,type:"pixel"}:o;if(f.left+f.right>=r||f.top+f.bottom>=i)return u;t.updateMatrixWorld();let h=c.matrixWorldInverse,b=c.fov*(Math.PI/180)/2,x=b,v=Math.atan(Math.tan(b)*(r/i)),I=new ae(1/0,1/0,1/0),M=new ae(-1/0,-1/0,-1/0),O=new sr,C=new ae;for(let De=0,xt=e.length;De<xt;De++)C.copy(e[De]),O.expandByPoint(C),C.applyMatrix4(h),I.min(C),M.max(C),C.copy(e[De]),C.z-=n,C.applyMatrix4(h),I.min(C),M.max(C),C.copy(e[De]),C.z+=n,C.applyMatrix4(h),I.min(C),M.max(C);let E=M.x-I.x,_=M.y-I.y,G=r-f.left-f.right,R=i-f.top-f.bottom,N=(M.x+I.x)/2,X=(M.y+I.y)/2,z=E/G,ee=_/R,re=a,ue=l,Ce=re*Math.tan(v)*2,Oe=ue*Math.tan(v)*2,Pe=Ce/r,Fe=Oe/r,ce=Math.max(z,ee);ce=Ue.clamp(ce,Pe,Fe);let Ee=G*ce,ye=R*ce,Ge={min:{x:N-Ee/2-f.left*ce,y:X-ye/2-f.bottom*ce},max:{x:N+Ee/2+f.right*ce,y:X+ye/2+f.top*ce}},Ie=(Ge.min.x+Ge.max.x)/2,Xe=(Ge.min.y+Ge.max.y)/2,se=O.getCenter(new ae),nt=Math.abs(Ie-Ge.min.x),dt=Math.abs(Xe-Ge.min.y),$t=nt/Math.tan(v),k=dt/Math.tan(x),H=new ae;H.set(Ie,Xe,M.z+Math.max($t,k)),H.applyMatrix4(c.matrixWorld);let P=new ae;P.set(Ie,Xe,M.z),P.applyMatrix4(c.matrixWorld);let q=new ae().subVectors(P,H),K=(se.z-H.z)/q.z,Q=new ae().copy(H).add(q.clone().multiplyScalar(K));return P.set(Q.x,Q.y,Q.z),H.sub(P),{position:Q,zoom:H.length()}}d();var iH=300,qf,eh,ex=class{constructor(r){m(this,"state");S(this,qf,new ae);S(this,eh,new ae);this.state=r}update(r){let t,o;this.state.cameraObject.getWorldPosition(s(this,eh));for(let n of this.state.geometry2DIdsInScene)if(t=this.state.geometry2DMap.get(n),t&&(o=t.components[0],o&&"containerEl"in o&&o.markerContainer!=null)){if(o.visibilityNeedsUpdate!==!1&&(o.visibilityNeedsUpdate==="show"?o.canShow=!0:o.canShow=!1),(o.canShow&&o.visible===!0||o.animation?.pending===!0)&&!o.offscreen)if(o.options.zIndex!=null)o.markerContainer.style.transform=`translate3D(${o.projection.x}px, ${o.projection.y}px, ${o.options.zIndex}px)`;else{t.object3d.getWorldPosition(s(this,qf));let i=s(this,eh).distanceTo(s(this,qf));o.markerContainer.style.transform=`translate3D(${o.projection.x}px, ${o.projection.y}px, ${-i}px)`}if(o.canShow===!0&&o.visible===!0?o.markerContainer.style.pointerEvents=r?"none":o.pointerEvents:o.markerContainer.style.pointerEvents="none",o.currentStrategyIndex===-1&&o.visible&&o.visibilityNeedsUpdate==="show")continue;o.visibilityNeedsUpdate!==!1&&!o.offscreen&&(o.visibilityNeedsUpdate==="show"&&(o.markerContainer.style.opacity="0"),o.animation&&o.animation.cancel(),o.animation=o.markerContainer.animate([{opacity:o.canShow&&o.visible?"1":"0"}],{duration:iH,easing:"ease-in-out",fill:"forwards"}),o.visibilityNeedsUpdate=!1)}}};qf=new WeakMap,eh=new WeakMap;d();var tx=class extends ke{constructor(t,o){super();m(this,"state");m(this,"dirty",!0);m(this,"domTree");m(this,"observers",new Map);m(this,"updateDimensions",t=>{t.forEach(o=>{let i=o.target.parentElement?.getAttribute("data-marker-id");if(i){let a=this.state.geometry2DMap.get(i),l=a?.components[0];a&&l instanceof Ds&&(l.updateDimensions(o.contentRect.width,o.contentRect.height),l.collisionDirty=!0)}}),this.publish("dimensions-update")});this.state=t,this.domTree=o}setupObserver(){if(this.observers){for(let n of this.observers.values())n.disconnect();this.observers.clear()}let t,o;for(let n of this.domTree.children){let i=n.getAttribute("data-marker-id");if(i!=null&&(t=this.state.geometry2DMap.get(i),o=t.components[0],o.options?.dynamicResize)){let a=new ResizeObserver(this.updateDimensions);a.observe(o.containerEl),this.observers.set(n.userData.entityId,a)}}}update(){this.dirty&&(this.setupObserver(),this.dirty=!1)}destroy(){for(let t of this.observers.values())t.disconnect();this.observers.clear()}};d();var sH=0,aH=90,lH=(y.env.NODE_ENV==="test",!1),as={linear:Vo.Linear.None,"ease-in":Vo.Quadratic.In,"ease-out":Vo.Quadratic.Out,"ease-in-out":Vo.Quadratic.InOut},cH=-50,de,Se,pa,th,rh,B2,rx=class{constructor(r,t,o){S(this,rh);S(this,de);S(this,Se);S(this,pa);S(this,th);w(this,de,r),w(this,Se,t),w(this,pa,o),s(this,de).map&&s(this,de).map.transform.setMinElevationForCurrentTile(cH),s(this,Se).cameraSystem.on("pedestal-change",({pedestal:n})=>{s(this,Se).cameraSystem.setCameraPlaneElevation(n)})}get center(){return s(this,de).mode==="outdoors-overlay"&&s(this,de).map?s(this,de).map.getCenter?.().toArray():s(this,Se).cameraSystem.center}setCenter(r){if(s(this,de).mode==="outdoors-overlay"&&s(this,de).map){s(this,de).map?.setCenter(r),s(this,Se).interactionSystem.handleHover();return}s(this,Se).cameraSystem.setCenter(r[0],r[1]),s(this,Se).interactionSystem.handleHover()}get zoomLevel(){return s(this,de).mode==="outdoors-overlay"&&s(this,de).map?s(this,de).map?.getZoom():s(this,Se).cameraSystem.getZoomLevel()}setZoomLevel(r){s(this,de).mode==="outdoors-overlay"&&s(this,de).map&&s(this,de).map?.setZoom(r),s(this,Se).cameraSystem.setZoomLevel(Pi(r,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 s(this,Se).cameraSystem.isAnimating}cancelAnimation(){s(this,Se).cameraSystem.cancelAnimation()}get maxZoomLevel(){return s(this,Se).cameraSystem.maxZoomLevel}get minZoomLevel(){return s(this,Se).cameraSystem.minZoomLevel}setAutoMinZoomLevel(r){s(this,Se).panBoundsSystem.autoMinZoomLevel=r,r&&(s(this,Se).panBoundsSystem.dirty=!0,s(this,Se).panBoundsSystem.update())}get autoMinZoomLevel(){return s(this,Se).panBoundsSystem.autoMinZoomLevel}setMinZoomLevel(r,t=!1){t&&this.setAutoMinZoomLevel(!1);let o=Pi(r,ui.MIN_MERCATOR_ZOOM_LEVEL,this.maxZoomLevel,`setMinZoomLevel was clamped. minZoomLevel must be between ${ui.MIN_MERCATOR_ZOOM_LEVEL} and maxZoomLevel.`);s(this,Se).cameraSystem.setMinZoomLevel(o),this.zoomLevel<o&&this.setZoomLevel(o),s(this,de).map?.setMinZoom(o)}setMaxZoomLevel(r){let t=Pi(r,this.minZoomLevel,ui.MAX_MERCATOR_ZOOM_LEVEL,`setMaxZoomLevel was clamped. maxZoomLevel must be between minZoomLevel and ${ui.MAX_MERCATOR_ZOOM_LEVEL}.`);s(this,Se).cameraSystem.setMaxZoomLevel(t),this.zoomLevel>t&&this.setZoomLevel(t),s(this,de).map?.setMaxZoom(t)}get maxPitch(){return s(this,de).mode==="outdoors-overlay"&&s(this,de).map?s(this,de).map?.getMaxPitch?.():Ue.radToDeg(s(this,Se).cameraSystem.maxTilt)}get minPitch(){return s(this,de).mode==="outdoors-overlay"&&s(this,de).map?s(this,de).map?.getMinPitch?.():Ue.radToDeg(s(this,Se).cameraSystem.minTilt)}setMinPitch(r){let t=Math.max(sH,r);s(this,de).map?.setMinPitch(t),s(this,Se).cameraSystem.minTilt=Ue.degToRad(t)}setMaxPitch(r){let t=Math.min(aH,r);s(this,de).map?.setMaxPitch(t),s(this,Se).cameraSystem.maxTilt=Ue.degToRad(t)}get bearing(){return s(this,de).mode==="outdoors-overlay"&&s(this,de).map?s(this,de).map?.getBearing():Ue.radToDeg(s(this,Se).cameraSystem.getRotation())}setBearing(r){if(s(this,de).mode==="outdoors-overlay"&&s(this,de).map){s(this,de).map?.setBearing(r);return}s(this,Se).cameraSystem.setRotation(Ue.degToRad(r))}get pitch(){return s(this,de).mode==="outdoors-overlay"&&s(this,de).map?s(this,de).map?.getPitch():Ue.radToDeg(s(this,Se).cameraSystem.getTilt())}setPitch(r){if(s(this,de).mode==="outdoors-overlay"&&s(this,de).map){s(this,de).map?.setPitch(r);return}s(this,Se).cameraSystem.setTilt(Ue.degToRad(Pi(r,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 s(this,Se).cameraSystem.getPedestal()}setElevation(r){s(this,Se).cameraSystem.setPedestal(r,!0)}animateElevation(r,t){return s(this,th)&&s(this,th).stop(),new Promise(o=>{s(this,Se).cameraSystem.animateCamera({position:{z:r}},t?.duration||300,as[t?.easing||"ease-in-out"],o,o,{interruptible:t?.interruptible??!0})})}get insetsPadding(){return s(this,pa).insetsPadding}get panMode(){return s(this,Se).cameraSystem.enablePan===!1&&s(this,Se).cameraSystem.enablePedestal===!0?"elevation":"default"}setPanMode(r){if(r!=="default"&&r!=="elevation")throw new Error("Invalid pan mode");r!==this.panMode&&(r==="default"?(s(this,Se).cameraSystem.enablePan=!0,s(this,Se).cameraSystem.enablePedestal=!1):(s(this,Se).cameraSystem.enablePan=!1,s(this,Se).cameraSystem.enablePedestal=!0))}setInsetPadding(r){s(this,pa).insetsPadding=Object.assign({},s(this,pa).insetsPadding,r)}animateTo(r){if(s(this,de).mode==="outdoors-overlay"&&s(this,de).map)return s(this,de).map?.flyTo({center:r.center??this.center,zoom:r.zoomLevel??this.zoomLevel,bearing:r.bearing??this.bearing,pitch:r.pitch??this.pitch,duration:r.duration??600}),Promise.resolve();let t=r.center?s(this,de).convertTo3DMapPosition(r.center[1],r.center[0],r.center[2]||this.elevation):void 0,o=r.zoomLevel!==void 0?s(this,Se).cameraSystem.convertZoomLevelToAltitude(Pi(r.zoomLevel,this.minZoomLevel,this.maxZoomLevel,"zoomLevel was clamped to minZoomLevel/maxZoomLevel bounds. Use mapView.Camera.setMinZoomLevel() and mapView.Camera.setMaxZoomLevel() to adjust limits.")):void 0,n=r.bearing!==void 0?Ue.degToRad(r.bearing):void 0,i=r.pitch!==void 0?Ue.degToRad(Pi(r.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(a=>{s(this,Se).cameraSystem.animateCamera({position:t,zoom:o,rotation:n,tilt:i},r.duration||0,as[r.easing||"ease-in-out"],()=>{s(this,Se).interactionSystem.handleHover(),a()},a,{interruptible:r?.interruptible??!0})})}getCameraFrameForCoordinates(r,t){let o=W(this,rh,B2).call(this,t||{},()=>Promise.resolve()),{pointCloud:n}=a4(r,s(this,de),s(this,pa).geometry3DMap);if(n.length===0)return A.error("No valid coordinates found in targets:",r),{center:this.center,zoomLevel:this.zoomLevel};let{center:i,zoomLevel:a}=s(this,Se).cameraSystem.getCameraFrameForCoordinates(n,o);return{center:s(this,de).convert3DMapPositionToCoordinate(i),zoomLevel:a}}focusOn(r,t){let{pointCloud:o,geoBounds:n,firstPosition:i}=a4(r,s(this,de),s(this,pa).geometry3DMap);return o.length===0?(A.error("No valid coordinates found in targets:",r),Promise.resolve()):s(this,de).mode==="outdoors-overlay"&&s(this,de).map?(o.length===1&&i?s(this,de).map?.flyTo({center:[i[0],i[1]],duration:t?.duration||s(this,de).map.getBearing(),animate:!0,bearing:t?.bearing===void 0?s(this,de).map.getBearing():t?.bearing,pitch:t?.pitch===void 0?s(this,de).map.getPitch():t?.pitch,zoom:t?.maxZoomLevel||s(this,de).map.getMaxZoom()}):(lH&&pH(s(this,de),n),s(this,de).map?.fitBounds(n,{duration:t?.duration??ui.DEFAULT_ANIMATION_DURATION,bearing:t?.bearing===void 0?s(this,de).map.getBearing():t?.bearing,pitch:t?.pitch===void 0?s(this,de).map.getPitch():t?.pitch,maxZoom:t?.maxZoomLevel??s(this,de).map.getMaxZoom()})),s(this,Se).interactionSystem.handleHover(),Promise.resolve()):new Promise(a=>{s(this,Se).cameraSystem.focusOn(o,W(this,rh,B2).call(this,t||{},a))})}};de=new WeakMap,Se=new WeakMap,pa=new WeakMap,th=new WeakMap,rh=new WeakSet,B2=function(r,t){return{minZoom:r?.maxZoomLevel===void 0?void 0:s(this,Se).cameraSystem.convertZoomLevelToAltitude(Pi(r.maxZoomLevel,this.minZoomLevel,this.maxZoomLevel,"maxZoomLevel was clamped to minZoomLevel/maxZoomLevel bounds. Use mapView.Camera.setMaxZoomLevel() to adjust limits.")),maxZoom:r?.minZoomLevel===void 0?void 0:s(this,Se).cameraSystem.convertZoomLevelToAltitude(Pi(r.minZoomLevel,this.minZoomLevel,this.maxZoomLevel,"minZoomLevel was clamped to minZoomLevel/maxZoomLevel bounds. Use mapView.Camera.setMinZoomLevel() to adjust limits.")),padding:r?.padding?Object.assign({},ay,r?.padding):this.insetsPadding,curve:as[r?.easing||"ease-in-out"],rotation:r?.bearing===void 0?void 0:Ue.degToRad(r.bearing),tilt:r?.pitch!==void 0?Ue.degToRad(Pi(r.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:r?.duration,callback:()=>{s(this,Se).interactionSystem.handleHover(),t()},cancelledCallback:t,interruptible:r?.interruptible??!0,verticalPadding:r?.verticalPadding}};function R2(e,r){e[0]=Math.min(e[0],r[0]),e[1]=Math.min(e[1],r[1]),e[2]=Math.max(e[2],r[0]),e[3]=Math.max(e[3],r[1])}function a4(e,r,t){let o=[],n=[1/0,1/0,-1/0,-1/0],i=null;if(!e||!Array.isArray(e)||e.length===0)return{pointCloud:o,geoBounds:n,firstPosition:i};let a=r.getSystems().renderSystem;(a.threeDdirty||a.twoDdirty)&&r.renderSync();for(let l of e)if(typeof l=="string"){let c=t.get(l);if(!c){A.error("Entity not found with id:",l);continue}let p=new sr;WC(r,"userData"in c?c.userData.entityId??c.id:c.id,o,p,c instanceof hr?c.position.z:void 0);let u=r.convert3DMapPositionToCoordinate(p.min),f=r.convert3DMapPositionToCoordinate(p.max);R2(n,u),R2(n,f),i||(i=r.convert3DMapPositionToCoordinate(p.getCenter(new ae)))}else o.push(r.convertTo3DMapPosition(l[1],l[0],l[2]||0)),R2(n,l),i||(i=l);return{pointCloud:o,geoBounds:n,firstPosition:i}}function pH(e,r){let t=[[r[0],r[1]],[r[0],r[3]],[r[2],r[3]],[r[2],r[1]],[r[0],r[1]]];e.map?.getLayer("bounds-outline")&&e.map.removeLayer("bounds-outline"),e.map?.getSource("bounds-source")&&e.map.removeSource("bounds-source"),e.map?.addSource("bounds-source",{type:"geojson",data:{type:"Feature",properties:{},geometry:{type:"LineString",coordinates:t}}}),e.map?.addLayer({id:"bounds-outline",type:"line",source:"bounds-source",layout:{},paint:{"line-color":"#FF0000","line-width":2,"line-opacity":.8}})}d();d();var l4=`uniform vec4 uSize;
12
+ Pos: ${o.position?.toArray().join(", ")}`,"#caffbf")})}get _state(){return this.state}queueDebugMessage(t,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=o,n.textContent=t,this.debugPanel?.prepend(n),setTimeout(()=>{n.style.opacity="0",setTimeout(()=>{n.remove()},500)},2500)}getCursor(){return this.cursor}};yu=new WeakMap;function $D(e,r,t){let o=e.components[2];o&&o.hover!==!0&&(o.hover=r?"user-interaction":!1,o.dirty=!0);let n=e.components[0].textMesh?.userData.entityId;if(!n)return;let i=t.geometry3DMap.get(n);i?.type==="text3d"&&(i.components[1].hoverByPolygon=r,i.components[1].dirty=!0)}function E$(e,r,t){return r?"grabbing":e?"pointer":t?"grabbing":"grab"}function P$(e){let r=e;for(;r?.parent;){if(r instanceof Ra)return;if(r.userData.isSingleModel)return r;r=r.parent}}function F$(e,r){let t=P$(e);return t?r.get(t.userData.entityId):void 0}d();d();var Fc,ss,A1,bl,HD,Gf,L1,zD,WD,Uf,_1,Vf,$f,R1,jf=class{constructor(r){S(this,bl);S(this,Fc,null);S(this,ss);m(this,"getCurrentSceneGLTF",async r=>{let t={onlyVisible:!0,binary:!0,light:!0,scale:1,...r},o=await W(this,bl,HD).call(this),n=s(this,A1).call(this,t),i=await o.parseAsync(n,{trs:!1,maxTextureSize:1/0,onlyVisible:t.onlyVisible,binary:t.binary,scale:t.scale}),a;if(i instanceof ArrayBuffer)a=new Blob([i],{type:"application/octet-stream"});else{let l=JSON.stringify(i,null,2);a=new Blob([l],{type:"text/plain"})}return a});S(this,A1,r=>{let{scale:t,light:o,onlyVisible:n}=r,i=new Ra,a=new sr().setFromObject(s(this,ss).entityScene);if(s(this,Gf).call(this,s(this,ss).entityScene,i,n),o){let l=new ey(16777215,.3*Math.PI);l.position.set(0,Math.max(a.max.x,a.max.y)*t*.5,a.max.y*t*4),l.lookAt(0,0,-1),l.target.position.set(0,0,-1),l.add(l.target),i.add(l)}return i});S(this,Gf,(r,t,o)=>{r.material&&(r instanceof Kg?W(this,bl,zD).call(this,r).forEach(n=>t.add(n)):r instanceof pm&&t.add(W(this,bl,WD).call(this,r))),r.children.forEach(n=>{(!o||n.visible)&&s(this,Gf).call(this,n,t,o)})});S(this,L1,(r,t,o)=>{let n=new xC({color:new ar(r),metalness:0});return n.opacity=t,n.transparent=o,n});S(this,Uf,r=>{let{geometry:t,material:o,position:n,rotation:i,quaternion:a,scale:l}=r;if(!t?.isBufferGeometry)return r;let c=t.attributes.position,p=t.attributes.normal,u=t.attributes.uv;return s(this,_1).call(this,c,p),s(this,$f).call(this,n,l,i,a),u&&s(this,R1).call(this,u),o?.map&&t.type==="PlaneGeometry"&&(r.side=Ms),r});S(this,_1,(r,t)=>{let o=new ae,n=new ae;for(let i=0;i<r.count;i++)o.fromBufferAttribute(r,i),s(this,Vf).call(this,o),r.setXYZ(i,o.x,o.y,o.z),t&&(n.fromBufferAttribute(t,i),s(this,Vf).call(this,n),t.setXYZ(i,n.x,n.y,n.z))});S(this,Vf,r=>{let t=r.y;r.y=r.z,r.z=-t});S(this,$f,(r,t,o,n)=>{let i=r.y;r.y=r.z,r.z=-i;let a=t.y;if(t.y=t.z,t.z=a,o instanceof gp)o.order="YXZ",o.set(o.x,o.y,o.z,o.order);else{let l=n.y;n.set(n.x,n.z,-l,n.w)}});S(this,R1,r=>{for(let t=0;t<r.count;t++){let o=r.getX(t),n=r.getY(t);r.setXY(t,o,n)}});w(this,ss,r),s(this,ss).entityScene=r.entityScene,s(this,ss).geometry3DMap=r.geometry3DMap}destroy(){w(this,Fc,null)}};Fc=new WeakMap,ss=new WeakMap,A1=new WeakMap,bl=new WeakSet,HD=async function(){if(!s(this,Fc)){let{GLTFExporter:r}=await import("./GLTFExporter-BIMYOBV2.js");w(this,Fc,new r)}return s(this,Fc)},Gf=new WeakMap,L1=new WeakMap,zD=function(r){let t=[],n=(r.userData?.entities?Object.values(r.userData?.entities):[]).map(a=>s(this,ss).geometry3DMap.get(a)),i=new Map;return n.forEach(a=>{if(!a||!(a instanceof Mt))return;let l=a.components[1],c=a.components[2];if(!l.visible||l instanceof Ri&&l.opacity===0||l instanceof ym||l instanceof uy)return;let u=`${c?.hover?l.hoverColor||s(this,ss).hoverColor:l.color}-${l.opacity}-${Number(l.visible)}`;i.has(u)||i.set(u,[]),i.get(u)?.push(a)}),i.forEach((a,l)=>{let[c,p,u]=l.split("-"),f=a.reduce((T,v)=>{if(v.type==="custom-geometry")return T;let I=v.components[0];return"geometry"in I&&I.geometry instanceof Yg&&T.push(I.geometry),T},[]),h=s(this,L1).call(this,c,Number(p),r.material.transparent),b=_i(f,!0),x=new Le(b,h);x.position.copy(r.position),x.rotation.copy(r.rotation),x.scale.copy(r.scale),x.visible=!!u,s(this,$f).call(this,x.position,x.scale,x.rotation,x.quaternion),t.push(s(this,Uf).call(this,x))}),t},WD=function(r){let t=r.geometry.clone(),o=r.material,n=new Nr({color:o.color,side:Ms});n.opacity=o.opacity,n.transparent=o.transparent;let i=new pm(t,n);return i.position.copy(r.position),i.rotation.copy(r.rotation),i.scale.copy(r.scale),i.visible=r.visible,s(this,Uf).call(this,i)},Uf=new WeakMap,_1=new WeakMap,Vf=new WeakMap,$f=new WeakMap,R1=new WeakMap;d();d();var D$="gray",k$=.1,Hf=100,S2=new Li.ClipperOffset;function A$(e,r){S2.Clear(),r/=2;let t=e.map(n=>({X:n.x*Hf,Y:n.y*Hf}));S2.AddPath(t,Li.JoinType.jtMiter,Li.EndType.etClosedPolygon);let o=new Li.Paths;return S2.Execute(o,r*Hf),o.length?o.map(i=>i.map(a=>({x:a.X/Hf,y:a.Y/Hf}))):[e]}function B1(e,r,t){let{color:o=D$,opacity:n=1,altitude:i=0,height:a=k$}=t||{};Array.isArray(n)&&(n=1);let l={min:{x:1/0,y:1/0,z:i},max:{x:-1/0,y:-1/0,z:a+i},center:{x:0,y:0,z:(a+i)/2}},p=e.geometry.coordinates[0].map(b=>{let x=r(b[1],b[0]);return l.min.x=Math.min(l.min.x,x.x),l.min.y=Math.min(l.min.y,x.y),l.max.x=Math.max(l.max.x,x.x),l.max.y=Math.max(l.max.y,x.y),x});e.properties?.style?.edgeOffset!=null&&e.properties.style.edgeOffset!==0||e.properties?.image!=null?p=A$(p,e.properties?.style?.edgeOffset||0):p=[p];let u=[];for(let b of p){let x=new Na;x.moveTo(b[0].x,b[0].y),b.slice(1).forEach(M=>x.lineTo(M.x,M.y)),x.lineTo(b[0].x,b[0].y);let T=e.geometry.coordinates.slice(1);x.holes=T.map(M=>{let O=M.map(E=>r(E[1],E[0])),C=new yp;return C.moveTo(O[0].x,O[0].y),O.slice(1).forEach(E=>C.lineTo(E.x,E.y)),C.lineTo(O[0].x,O[0].y),C});let v=hm(t?.bevel,a),I=new ja(x,v);I.userData={style:{color:o,opacity:n},usedBevelSettings:v},u.push(I)}if(u.length===1)return u[0];let f=_i(u);u.forEach(b=>b.dispose());let h=hm(t?.bevel,a);return f.userData={style:{color:o,opacity:n},usedBevelSettings:h,_split:!0},f}d();var L$="gray",_$=.1;function N1(e,r,t){let{color:o=L$,opacity:n=1,altitude:i=0,height:a=_$}=t||{};Array.isArray(n)&&(n=1);let l={min:{x:1/0,y:1/0,z:i},max:{x:-1/0,y:-1/0,z:a+i}},c=hm(t?.bevel,a),p=[];e.geometry.coordinates.forEach(f=>{let h=new Na,b=f[0].map(v=>{let I=r(v[1],v[0]);return l.min.x=Math.min(l.min.x,I.x),l.min.y=Math.min(l.min.y,I.y),l.max.x=Math.max(l.max.x,I.x),l.max.y=Math.max(l.max.y,I.y),I});h.moveTo(b[0].x,b[0].y),b.slice(1).forEach(v=>h.lineTo(v.x,v.y)),h.lineTo(b[0].x,b[0].y);let x=f.slice(1);h.holes=x.map(v=>{let I=v.map(O=>r(O[1],O[0])),M=new yp;return M.moveTo(I[0].x,I[0].y),I.slice(1).forEach(O=>M.lineTo(O.x,O.y)),M.lineTo(I[0].x,I[0].y),M});let T=new ja(h,c);p.push(T)});let u=_i(p);return p.forEach(f=>f.dispose()),u.translate(0,0,i||0),u.userData={style:{color:o,opacity:n},usedBevelSettings:c},u}d();var Io=100,R$=.22,B$=.01;function ZD(e,r,t={}){let{width:o=R$,height:n=B$,color:i="gray",opacity:a=1,altitude:l=0}=t,c={min:{x:1/0,y:1/0,z:l},max:{x:-1/0,y:-1/0,z:l+n}},p={bevelEnabled:!1,depth:n},u=new Li.ClipperOffset,f=e.geometry.coordinates.map(T=>T.map(v=>r(v[1],v[0])));u.AddPaths(f.map(T=>T.map(v=>({X:v.x*Io,Y:v.y*Io}))),Li.JoinType.jsMiter,Li.EndType.etOpenRound);let h=new Li.PolyTree;u.Execute(h,o/2*Io);let b=[];for(let T of h.m_AllPolys){let v=new Na;if(T.IsHole())continue;c.min.x=Math.min(c.min.x,T.m_polygon[0].X),c.min.y=Math.min(c.min.y,T.m_polygon[0].Y),c.max.x=Math.max(c.max.x,T.m_polygon[0].X),c.max.y=Math.max(c.max.y,T.m_polygon[0].Y);let I=T.m_polygon;v.moveTo(I[0].X/Io,I[0].Y/Io),I.slice(1).forEach(M=>v.lineTo(M.X/Io,M.Y/Io)),v.lineTo(I[0].X/Io,I[0].Y/Io),v.holes=T.m_Childs.map(M=>{let O=new yp,C=M.m_polygon;return O.moveTo(C[0].X/Io,C[0].Y/Io),C.slice(1).forEach(E=>O.lineTo(E.X/Io,E.Y/Io)),O.lineTo(C[0].X/Io,C[0].Y/Io),O}),b.push(new ja(v,p))}let x=_i(b);return x.translate(0,0,l||0),x.userData={style:{color:i,opacity:a}},u.Clear(),x}d();d();var bu=F.object({type:F.enum(["Point"]),coordinates:F.array(F.number()).min(2).max(3)});var T2=F.object({rotation:F.array(F.number()).length(3).optional(),altitude:F.number().optional(),scale:F.array(F.number()).length(3).optional(),interactive:F.boolean().optional(),verticalOffset:F.number().optional(),id:F.union([F.number(),F.string()]).optional()}),N$=F.object({type:F.enum(["Feature"]),geometry:bu,properties:T2}),j$=F.object({type:F.enum(["FeatureCollection"]),features:F.array(N$)}),C2=F.object({color:F.string()}),G$=F.object({url:F.string(),color:F.string().optional(),opacity:F.number().optional(),material:F.record(F.string(),C2).optional()});function YD(e,r,t){F.union([F.number(),F.string()]).parse(e),j$.parse(r),G$.parse(t)}var zf,Wf,xl=class{constructor(r){m(this,"mesh");m(this,"type","model");m(this,"positionDirty",!0);m(this,"outline");m(this,"geometry");m(this,"material");m(this,"feature");m(this,"instanceIndex",-1);m(this,"visible",!0);m(this,"color",new ar);m(this,"position",new ae);S(this,zf,0);S(this,Wf,1);this.feature=r}setOpacity(){}setColor(){}get altitude(){return s(this,zf)}set altitude(r){this.mesh&&(this.mesh.position.z=r,w(this,zf,r))}getRotation(){return this.mesh?[this.mesh.rotation.x,this.mesh.rotation.y,this.mesh.rotation.z]:void 0}setRotation(r){this.mesh&&this.mesh.rotation.set(Ue.degToRad(r[0]),Ue.degToRad(r[1]),Ue.degToRad(r[2]))}getScale(){return this.mesh?[this.mesh.scale.x,this.mesh.scale.y,this.mesh.scale.z]:void 0}setScale(r){this.mesh&&this.mesh.scale.set(r[0],r[1],r[2])}get opacity(){return s(this,Wf)}set opacity(r){if(this.mesh){if(this.mesh.children[0]instanceof Ba){for(let t of this.mesh.children)if(t instanceof Ba){t.userData?.originalOpacity===void 0&&(t.userData.originalOpacity=t.material.opacity);let o=Nl(r,0,t.userData?.originalOpacity,0,1);t.material.opacity=o,t.material.transparent=o<1,t.material.needsUpdate=!0}}else this.mesh?.traverse(t=>{t instanceof Le&&t.material&&(Array.isArray(t.material)?t.material.forEach(o=>{XD(o,r)}):XD(t.material,r))});w(this,Wf,r)}}};zf=new WeakMap,Wf=new WeakMap;function XD(e,r){e.opacity!==r&&(r===1?(e.opacity=1,e.transparent=!1):(e.opacity=r,e.transparent=!0),e.needsUpdate=!0)}d();function j1(e){let r=e.components[0],t=e.components[1];t.opacity!=null&&t.opacity!==r.opacity&&(r.opacity=t.opacity);let o=t.material,n=t.color;if(o||n){let l=U$(n,o);r.mesh?.traverse(c=>{c instanceof Le&&c.material&&(Array.isArray(c.material)?c.material.forEach(p=>{l[p.name]?p.color.set(l[p.name].color):p.color.set(n)}):l[c.material.name]?c.material.color.set(l[c.material.name].color):c.material.color.set(n))})}let i=r.feature.geometry.coordinates[2]??0,a=t.verticalOffset+i;r.altitude!==a&&(r.altitude=a),t.visible!==r.visible&&(r.visible=t.visible),t.rotation&&r.setRotation(t.rotation),t.scale&&r.setScale(t.scale)}function U$(e,r){let t={};if(e&&Object.assign(t,{Default:{color:e},Fabric:{color:e},Mpdn_Logo:{color:e},CouchLogo:{color:e}}),r)for(let o in r)r[o].color&&(t[o]?t[o].color=r[o].color:t[o]={color:r[o].color});return t}function JD(e,r){let t=e.components[0],n=e.components[1].verticalOffset??0,i=t.feature.geometry.coordinates.slice();i[2]=(i[2]??0)+n,t.mesh?t.mesh.position.copy(r(i)):t.position.copy(r(i))}function KD(e){return e instanceof fr?e.material:null}function QD(e){return e.side===v0?"back":e.side===lm?"front":"double"}function qD(e,r){e.side=r==="back"?v0:r==="front"?lm:Ms}function V$(e){let{color:r,opacity:t,topColor:o,texture:n,topTexture:i}=e;return`${r}${t}${o||""}${n||""}${i||""}`}var G1=class extends ke{constructor(t,o){super();m(this,"state");m(this,"convertTo3DMapPosition");m(this,"loader");m(this,"optimizePromise",[]);this.state=t,this.convertTo3DMapPosition=o}async getGLTFLoader(){if(this.loader)return this.loader;let{GLTFLoader:t}=await import("./GLTFLoader-BEG3VCKK.js");return this.loader=new t,this.loader}createEntityFromFeature(t,o,n){let i=new fr(o),a=o?.properties?.bevel,l=n&&"bevel"in n?n.bevel:void 0,c;l?c={...a,...l}:a&&(c=a);let p=new Mt(i,new Ri({...n,url:o.properties?.image?.path,bevel:c}));return n?.outline&&(p.components[3]=new pM(mM(n.color))),n?.focusable&&(p.components[4]=new bm),p.id=t,p}createModelFromFeature(t,o,n){let i=new xl(o),a={...n};o.properties.verticalOffset!=null&&(a.verticalOffset=o.properties.verticalOffset),o.properties.rotation!=null&&(a.rotation=o.properties.rotation),o.properties.scale!=null&&(a.scale=o.properties.scale);let l=new uy(a),c=new Mt(i,l);return c.id=t,c}populateEntityMesh(t,o){let n=t.components[0];n.geometry=o,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:o.attributes.position.count},n.currentHeight=t.components[1].height,n.dirty=!1}async populateModelGroup(t,o,n){let i=new Hn,a=new gp,l=new Xg,c=new ae,p=new Ga,u=await this.getGLTFLoader(),f=new Promise(h=>{u.load(o,b=>{"entities3D"in n.userData&&(n.userData.entities3D.size>1?b.scene.traverse(x=>{let T=x;if("isMesh"in T&&T.isMesh===!0){let v=new Ba(T.geometry,T.material,t.size);v.userData={entities:{}},p.add(v),n.add(p)}}):(b.scene.traverse(x=>{"isMesh"in x&&x.isMesh===!0&&(x.position.set(0,0,0),x.rotation.set(0,0,0),x.scale.set(1,1,1),x.updateMatrix())}),p.add(b.scene),n.add(p),p.userData.isSingleModel=!0,p.userData.entityId=t.values().next().value,p.userData.type="model")),h()})});return this.optimizePromise.push(f.then(()=>{let h=0,b;for(let x of t.values()){if(b=this.state.geometry3DMap.get(x),!b||b?.type!=="model")continue;let T=b.components[0],v=b.components[1],I=b.components[0].feature;T.mesh=p,T.instanceIndex=h,j1(b),b.components[1].dirty=!1;let{x:M,y:O}=this.convertTo3DMapPosition(I.geometry.coordinates[1],I.geometry.coordinates[0],0);T.position.set(M,O,T.altitude),a.set(Ue.degToRad(v.rotation?.[0]??Op[0]),Ue.degToRad(v.rotation?.[1]??Op[1]),Ue.degToRad(v.rotation?.[2]??Op[2])),c.set(v.scale?.[0]??wp[0],v.scale?.[1]??wp[1],v.scale?.[2]??wp[2]),l.setFromEuler(a),i.compose(T.position,l,c),p.children.forEach(C=>{!b||b?.type!=="model"||!(C instanceof Ba)||(C.setMatrixAt(h,i),C.userData.entities[h]=b.id)}),T.mesh.userData.isSingleModel&&(T.mesh.matrix.copy(i),T.mesh.matrix.decompose(T.mesh.position,T.mesh.quaternion,T.mesh.scale)),h++}this.publish("model-loaded")})),p}populateEntityGroup(t){let o,n,i,a;for(let l of t.values())a=this.state.geometry3DMap.get(l),a.components[0]instanceof fr&&(n=a.components[0].feature,i=a.components[1],n.geometry.type==="Polygon"?(o=B1(n,this.convertTo3DMapPosition,i),n.properties?.textures&&n.properties.textures.length>0&&fM(o,n.properties.textures,this.state.naturalBearing,this.convertTo3DMapPosition),this.populateEntityMesh(a,o)):n.geometry.type==="MultiPolygon"?(o=N1(n,this.convertTo3DMapPosition,i),this.populateEntityMesh(a,o)):n.geometry.type==="LineString"?(o=LM(n,this.convertTo3DMapPosition,i),this.populateEntityMesh(a,o)):n.geometry.type==="MultiLineString"&&(o=ZD(n,this.convertTo3DMapPosition,i),this.populateEntityMesh(a,o)));return t}update(){for(let t of this.state.geometryGroupIdsToLoad.values()){let o=this.state.geometry3DMap.get(t);if(o instanceof Wn&&o.userData.dirty){if(o.userData.modelURL)o.userData.modelURL&&(this.populateModelGroup(o.userData.entities3D,o.userData.modelURL,o),o.userData.dirty=!1);else try{this.populateEntityGroup(o.userData.entities3D)}catch(a){A.warn(a)}let n,i={};for(let a of o.userData.entities3D.values()){n=this.state.geometry3DMap.get(a);let l=n?.components[0];if(n?.type==="geometry"){let c=n.components[1],p=V$(c);i[p]===void 0&&(i[p]={style:c,entities:[]}),i[p].entities.push(n)}else l&&"mesh"in l&&l.mesh&&l.mesh?.parent!==o&&o.add(l.mesh)}for(let a in i){let l=uM(i[a].entities,i[a].style);o.add(l)}for(let a of o.userData.entities3D.values())if(n=this.state.geometry3DMap.get(a),n!=null&&n.entities2D.size>0)for(let l of n.entities2D.values())l&&(n.attach(l),this.publish("geometry-2d-added"));this.publish("geometry-group-added"),o.userData.dirty=!1}}return Promise.resolve()}};d();var U1=class{constructor(r,t){m(this,"state");m(this,"dirty",!0);m(this,"domTree");this.state=r,this.domTree=t}update(){if(this.dirty){let r;for(let t of Array.from(this.domTree.children))if(r=this.state.geometry2DMap.get(t.userData.entityId),r){let o=r.components[0];(!o.enabled||!o.visible||!this.state.geometry2DIdsInScene.has(t.userData.entityId))&&this.domTree.removeChild(t)}else this.domTree.removeChild(t);for(let t of this.state.geometry2DIdsInScene)if(r=this.state.geometry2DMap.get(t),r){let o=r.components[0];o instanceof Ds&&o.enabled&&o.markerContainer&&!this.domTree.contains(o.markerContainer)&&(o.markerContainer.userData={entityId:r.id},this.domTree.appendChild(o.markerContainer),o.updateDimensions())}this.dirty=!1}}};d();var V1=class{constructor(r,t){m(this,"state");m(this,"project");this.state=r,this.project=t}update(){let r,t=0,o,n;for(let i of this.state.geometry2DIdsInScene)if(r=this.state.geometry2DMap.get(i),r){n=r.components[0];let a=r.attachedTo?this.state.geometry3DMap.get(r.attachedTo):void 0;if(a instanceof Mt)if(this.state.geometry3DIdsInScene.has(a.id)){o=a.components[1],n=r.components[0],(o.dirty||r.components[0].attachedDirty)&&(t=o.height,r.setAltitude(t));let l=o.visible;n.visible!==l&&(n.visible=l)}else n.visible===!0&&(n.visible=!1);this.project(r.components[0].projection,r.position),r.components[0].attachedDirty=!1}}};d();d();d();var $$=function(){let r,t;return o=>{if((!t||!t)&&(r=document.createElement("canvas"),r.width=500*o,r.height=500*o,r.style.width="500px",r.style.height="500px",t=r.getContext("2d")),!t)throw new Error("Could not get 2D context");return{measureCanvas:r,measureCanvasContext:t}}}(),e4=({text:e,size:r,maxWidth:t,pixelRatio:o,maxLines:n=2,lineHeight:i=1.2,options:a={strokeText:!0}})=>{let l=`bold ${r*o}px 'InterUI-Regular', Helvetica Neue, Arial, sans-serif`,{measureCanvasContext:c}=$$(o);c.font=l;let p=[],u=e.split(" "),f=0,h=0,b=0;for(;h<u.length;){let I=u[h];if(f===n&&f>0){p[f-1]+="...";break}if(p[f]==null&&(p[f]=I,h++),u.length===1){p[f]=I;break}if(u[h]==null)break;let{width:M}=c.measureText(p[f]+" "+u[h]);M<=t*o?(p[f]+=" "+u[h],h++):f++}p.forEach(I=>{let{width:M}=c.measureText(I);b=Math.max(M,b)});let x=r*o*i,T=p.length*x;return{maxWidth:b,maxHeight:T,lines:p.length,draw:(I,M,O)=>{p.length===1?(a.strokeText&&I.strokeText(p[0],M,O),I.fillText(p[0],M,O)):(a.strokeText&&(I.strokeText(p[0],M,O-x/2),I.strokeText(p[1],M,O+x/2)),I.fillText(p[0],M,O-x/2),I.fillText(p[1],M,O+x/2))}}};d();function t4(e){let r=new Image;return e&&(/<svg[\s\S]*>/i.test(e)?r.src=`data:image/svg+xml;base64,${btoa(e)}`:r.src=e),r}var $1=class extends ke{constructor(t,o,n){super();m(this,"dirty",!1);m(this,"state");m(this,"colliderContext");m(this,"colliderCanvas");m(this,"transformRequestFunc");m(this,"transformRequest",async t=>this.transformRequestFunc?await this.transformRequestFunc(t):{url:t});m(this,"pinCache",{});m(this,"imageCache",{});m(this,"imagePromiseCache",{});m(this,"imageDimensionsCache",{});m(this,"textCache",{});m(this,"update",t=>{let o=this.state.pixelRatio;this.colliderContext.clearRect(0,0,this.colliderCanvas.width,this.colliderCanvas.height);let n,i,a,l,c,p,u;for(let f of this.state.geometry2DIdsInScene)if(u=this.state.geometry2DMap.get(f),u!=null&&(p=u.components[0],p instanceof Fs&&!u.disposed)){if(c=p.appearance.iconVisible,p.appearance.icon!=null&&c!=null){let b=typeof c=="boolean"?c:t>=c;b!==p.iconVisible&&(p.iconVisible=b,p.dirty=!0)}if((p.dirty||this.dirty)&&p.calculatePinSize(),i={active:p.appearance.pinColor,inactive:p.appearance.pinColorInactive},a={active:p.appearance.pinOutlineColor,inactive:p.appearance.pinOutlineColorInactive},l=Di(p.pinSize,2),n=`${i.active}-${i.inactive}-${a.active}-${a.inactive}-${l}-${p.iconVisible}`,p.labelCacheId=n,(!this.pinCache[n]||this.dirty)&&(this.prepare(p,n,this.colliderContext),p.dirty=!0),(p.appearance.icon&&(!p.imageHash||p.pinDirty)||this.dirty)&&this.cacheImage(p),this.textCache[p.id]==null||p.textDirty||this.dirty){p.dirty=!0,this.textCache[p.id]={};let{textDrawFn:b,width:x,height:T}=this.processText(p.text,p.appearance.textSize,p.appearance.maxWidth,p.appearance.maxLines,p.appearance.lineHeight);["left","center","right"].forEach(v=>{this.textCache[p.id][v]=this.textToCanvas(b,p.appearance.textSize,v,x,T,p.appearance.textColor,p.appearance.textOutlineColor)}),p.dimensions={width:Math.ceil(x/o),height:Math.ceil(T/o)}}let h=1;if(p.appearance.iconScale)if(typeof p.appearance.iconScale=="number")h=p.appearance.iconScale;else{let{on:b,input:x,output:T,easing:v}=p.appearance.iconScale;b==="zoom-level"?h=DC(t,x,T,v??"linear"):A.warn(`Unsupported interpolation property: ${b}`)}p.recomputeCurrentStrategy(p.iconVisible?h:1),p.canShow&&p.visible&&(p.enabled||p.visibilityNeedsUpdate!==!1)&&this.draw(p,n,this.colliderContext),p.textDirty=!1,p.pinDirty=!1}this.dirty=!1});m(this,"processText",(t,o,n,i,a)=>{let l=this.state.pixelRatio,{draw:c,maxWidth:p,maxHeight:u}=e4({text:t,size:o,pixelRatio:l,maxWidth:n,maxLines:i,lineHeight:a});return{textDrawFn:c,width:p+2.5*l*2,height:u+2.5*l*2}});m(this,"textToCanvas",(t,o,n,i,a,l,c)=>{let p=this.state.pixelRatio,u,f=i,h=a;window.OffscreenCanvas!=null&&!XC()?u=new OffscreenCanvas(f,h):(u=document.createElement("canvas"),u.width=f,u.height=h,u.style.width=f+"px",u.style.height=h+"px");let b=u.getContext("2d",{willReadFrequently:!0});if(!b)return;let x=2.5*p;b.textAlign=n,b.font=`bold ${o*p}px 'InterUI-Regular', Helvetica Neue, Arial, sans-serif`,b.textBaseline="middle",b.lineJoin="miter",b.miterLimit=2,b.strokeStyle="white",b.lineWidth=x,b.fillStyle=l,b.strokeStyle=c;let T=n==="left"?x/2:n==="center"?f/2:f-x/2;return t(b,T,(h+x/2)/2),u});m(this,"cacheImage",t=>{if(!t.appearance.icon)return;let o=eM(t.appearance.icon);this.imagePromiseCache[o]||(this.imagePromiseCache[o]=new Promise(n=>{this.transformRequest(t.appearance.icon).then(i=>{let a=t4(i.url);a.onload=()=>{this.imageCache[o]=a,this.publish("img:loaded"),n(a)}})})),t.imageHash!==o&&(t.imageHash=o,this.imagePromiseCache[o].then(()=>{t.dirty=!0}))});m(this,"createPinCanvas",(t,o,n,i,a=1)=>{let l,c=this.state.pixelRatio,p=t.totalPinSize*2*c*a;window.OffscreenCanvas!=null?l=new OffscreenCanvas(p,p):(l=document.createElement("canvas"),l.width=p,l.height=p,l.style.width=p/c+"px",l.style.height=p/c+"px");let u=l.getContext("2d");return u.shadowColor="rgba(0,0,0,0.3)",u.shadowOffsetY=2*c,u.shadowBlur=5*c,u.beginPath(),u.arc(p/2,p/2,(o/2+2.5*c/2)*a,0,2*Math.PI),u.fillStyle=n,u.fill(),u.beginPath(),u.arc(p/2,p/2,o/2*a,0,2*Math.PI),u.shadowColor="transparent",u.fillStyle=i,u.fill(),l});m(this,"prepare",(t,o,n)=>{let i=this.state.pixelRatio;n.lineWidth=4*i;let a=typeof t.appearance.iconScale=="number"?[t.appearance.iconScale]:t.appearance.iconScale==null?[]:t.appearance.iconScale.output,l=a.length>0?Math.max(...a):void 0,c=this.createPinCanvas(t,t.pinSize,t.appearance.pinOutlineColor,t.appearance.pinColor,l),p=this.createPinCanvas(t,3.5*i,t.appearance.pinOutlineColorInactive,t.appearance.pinColorInactive,l);this.pinCache[o]=[c,p]});this.state=t,this.colliderCanvas=o,this.colliderContext=o.getContext("2d"),this.transformRequestFunc=n}draw(t,o,n){if(!t.canShow||!t.visible)return;n.save(),n.globalAlpha=t.opacity;let i=this.state.pixelRatio,a=t.projection.x*i,l=t.projection.y*i,c=t.style.pinVisibility===1?this.pinCache[o][0]:this.pinCache[o][1],p=t.style.pinVisibility===1?t.scaledPinSize*i:t.totalPinSize*i;if(t.style.pinVisibility!==0&&n.drawImage(c,a-p,l-p,p*2,p*2),t.appearance.icon&&t.iconVisible&&t.imageHash&&t.appearance.iconSize&&this.imageCache[t.imageHash]&&t.style.pinVisibility===1){let u=this.imageCache[t.imageHash],f=(t.scaledPinSize-t.scaledIconPadding)*i,h=t.appearance.iconFit,b=f,x=f,T=`${t.imageHash}_${h}`;if(this.imageDimensionsCache[T])b=this.imageDimensionsCache[T].width,x=this.imageDimensionsCache[T].height;else{let v=u.width*i,I=u.height*i;if(h==="contain"){let M=Math.sqrt(v**2+I**2),O=f/M;b=v*O,x=I*O}if(h==="cover"){let M=f/v,O=f/I,C=Math.max(M,O);b=v*C,x=I*C}}n.save(),n.beginPath(),n.arc(a,l,f/2,0,2*Math.PI),n.closePath(),t?.appearance?.iconOverflow!=="visible"&&n.clip(),n.drawImage(u,a-b/2,l-x/2,b,x),n.restore()}t.style.textLabelVisible&&t.style.textAlign!=null&&t.style.left!=null&&t.style.top!=null&&n.drawImage(this.textCache[t.id][t.style.textAlign],a+t.style.left*i,l+t.style.top*i),n.restore()}};d();d();var Dc=class Dc{constructor(){m(this,"loader");this.loader=new bp}static getInstance(){return Dc.instance||(Dc.instance=new Dc),Dc.instance}getLoader(){return this.loader}load(r){return new Promise((t,o)=>{this.loader.load(r,t,void 0,o)})}};m(Dc,"instance");var w2=Dc,vl=w2.getInstance();function X$(e,r){let t=e.components[2],o=e.components[1];return t?.hover?[o.hoverColor||r,o.hoverColor||r]:[o.color,o.topColor||o.color]}var kc,Zf,H1=class extends ke{constructor(t,o){super();S(this,kc);m(this,"state");m(this,"convertTo3DMapPosition");m(this,"textureLoadingCache",new Map);this.convertTo3DMapPosition=o,this.state=t}processTextures(t,o,n){if(o.texture!==t.texture&&o.texture!==""&&W(this,kc,Zf).call(this,o.texture,t,"texture"),o.topTexture!==t.topTexture&&o.topTexture!==""&&W(this,kc,Zf).call(this,o.topTexture,t,"topTexture"),(t.texture==null||t.topTexture==null)&&Array.isArray(t.feature.properties?.textures)&&t.feature.properties.textures.length>0)for(let i of t.feature.properties.textures)i.face==="top"&&t.topTexture!==i.path?W(this,kc,Zf).call(this,i.path,t,"topTexture"):i.face==="side"&&t.texture!==i.path&&W(this,kc,Zf).call(this,i.path,t,"texture"),t.blendTexture=!0;(t.texture!=null||t.topTexture!=null)&&(n?.hover&&t.texturesVisible?t.hideTextures():t.texturesVisible||t.showTextures(),o.texture===""&&t.removeSideTexture(),o.topTexture===""&&t.removeTopTexture())}update(){let t,o,n;for(let i of this.state.geometry3DIdsInScene)if(n=this.state.geometry3DMap.get(i),n&&(n.type==="geometry"||n.type==="custom-geometry")&&(n.components[1]?.dirty||n.components[2]?.dirty)){let a=n.components[0],l=n.components[1];o=n.components[2];let c=X$(n,this.state.hoverColor);a.setColor(c[0],c[1]);let p=KD(a);if(l.visible!==a.visible&&(a.visible=l.visible,a instanceof fr&&a.textMesh)){let f=this.state.geometry3DMap.get(a.textMesh.userData.entityId);f?.type==="text3d"&&f.components[0].polygonEntityId!=null&&(f.components[0].visible=l.visible)}l.altitude!==a.altitude&&(a.altitude=l.altitude);let u=l.opacity*Cp(n);u!==a.opacity&&(a.opacity=u),l.renderOrder!==a.renderOrder&&(a.renderOrder=l.renderOrder),p&&l.side!==QD(p)&&qD(p,l.side),a instanceof fr&&l.shading!=null&&(l.shading?.start!==p?.getGradientShading().start||l.shading?.end!==p?.getGradientShading().end||l.shading?.intensity!==p?.getGradientShading().intensity)&&p?.setGradientShading(l.shading?.start??0,l.shading?.end??0,l.shading?.intensity??0),l.dirty=!1,a instanceof fr&&this.processTextures(a,l,o),n.components[2]&&(n.components[2].dirty=!1)}else if(n?.type==="model")n.components[1].dirty&&(j1(n),n.components[1].dirty=!1),n.components[0].positionDirty&&(JD(n,this.convertTo3DMapPosition),n.components[0].positionDirty=!1);else if(n?.type==="image"&&n.components[1]?.dirty){t=n.components[0];let a=n.components[1];a.visible!==t.visible&&(t.visible=a.visible),a.dirty=!1}else if(n?.type==="text3d"&&n.components[1]?.dirty&&n.components[0].polygonEntityId!=null){t=n.components[0];let a=n.components[1];a.visible!=null&&a.visible!==t.visible&&(t.visible=a.visible);let{textMesh:l}=t;if(l){Object.assign(l,a.getState());let c=a.hoverColor??this.state.text3dHoverColor;l.color=a.hoverByPolygon?c:a.color??Mp.color,l.outlineColor=a.hoverByPolygon?c:a.outlineColor??Mp.outlineColor,l.strokeColor=a.hoverByPolygon?c:a.strokeColor??Mp.strokeColor}a.dirty=!1}}destroy(){this.textureLoadingCache.forEach(async t=>{(await t).dispose()}),this.textureLoadingCache.clear()}};kc=new WeakSet,Zf=async function(t,o,n){if(!(!t||!o.showTextures))if(this.textureLoadingCache.has(t)){n==="topTexture"?o.topTexture=await this.textureLoadingCache.get(t):o.texture=await this.textureLoadingCache.get(t),o.showTextures();return}else{let i=new Promise((a,l)=>{vl.getLoader().load(t,c=>{n==="topTexture"?o.topTexture=c:o.texture=c,o.showTextures(),this.publish("texture-loaded"),a(c)},void 0,()=>{A.error(`Failed to load texture: ${t}`),l(`Failed to load texture: ${t}`)})});this.textureLoadingCache.set(t,i)}};d();var z1=class extends ke{constructor(t){super();m(this,"state");m(this,"animating",new Map);m(this,"isAnimating",!1);m(this,"startTime",-1);m(this,"showDuration",300);m(this,"hideDuration",250);m(this,"update",()=>{this.animating.clear();let t,o;for(let n of this.state.geometry2DIdsInScene)t=this.state.geometry2DMap.get(n),t&&(o=t.components[0],o instanceof Fs&&(o.visibilityNeedsUpdate==="show"?(o.canShow=!0,this.animating.set(o,[o.opacity,1])):o.visibilityNeedsUpdate==="hide"&&this.animating.set(o,[o.opacity,0])));this.startTime=performance.now(),this.publish("animate:2d")});m(this,"playAnimations");this.state=t,this.playAnimations=this._playAnimations}_playAnimations(){let t=performance.now();for(let[o,[n,i]]of this.animating.entries()){let a=i===1?this.showDuration:this.hideDuration,l=(t-this.startTime)/a;o.opacity=Nl(l,0,1,n,i,i===0?EC:PC),t-this.startTime>=a&&(i===1?o.canShow=!0:i===0&&(o.canShow=!1),o.visibilityNeedsUpdate=!1,this.animating.delete(o))}this.publish("draw:2d"),this.animating.size>0&&this.publish("animate:2d")}};d();var W1=class extends ke{constructor(t,o,n,i,a,l,c){super();m(this,"state");m(this,"renderer");m(this,"mode");m(this,"scene");m(this,"cameraObject");m(this,"viewCamera");m(this,"systems");m(this,"needs2DRecompute",!1);m(this,"twoDdirty",!0);m(this,"threeDdirty",!0);m(this,"frameId",null);m(this,"twoDFrameId",null);m(this,"animationFrameId",null);m(this,"nextFrame",null);m(this,"update",(t=!1)=>{if(this.renderer?.renderer==null)return Promise.resolve();if(t){let o=this.commitRenderState();return this.paint(),o}else return this.frameId?Promise.resolve():new Promise((o,n)=>{this.frameId=requestAnimationFrame(()=>this.renderer?.renderer==null?o():this.mode==="standalone"?this.commitRenderState()?.then(()=>{this.paint(),o()}).catch(i=>{n(i)}):o())})});m(this,"animate2D",()=>{this.animationFrameId=requestAnimationFrame(()=>{this.animationFrameId=null,this.systems.twoDVisiblitySystem.playAnimations()})});m(this,"drawEntities2D",()=>{this.twoDFrameId||(this.twoDFrameId=requestAnimationFrame(()=>{this.twoDFrameId=null,this.systems.twoDDrawSystem.update(this.systems.cameraSystem.getZoomLevel())}))});m(this,"updateEntities2D",()=>{this.twoDFrameId&&(cancelAnimationFrame(this.twoDFrameId),this.twoDFrameId=null),this.twoDFrameId=requestAnimationFrame(()=>{this.twoDFrameId=null,this.systems.watermarkSystem.insertIntoQuadTree(this.systems.collisionSystem.interactiveCollidersQTree),this.systems.interactionSystem.updateQuadtree(this.systems.collisionSystem.interactiveCollidersQTree),this.systems.twoDVisiblitySystem.update(),this.systems.twoDDrawSystem.update(this.systems.cameraSystem.getZoomLevel()),this.systems.domDrawSystem.update(this.systems.cameraSystem.isUserInteracting())})});m(this,"commitRenderState",()=>{try{let t=[];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(),KC(this.state.entityScene,this.state.geometry2DIdsInScene),this.systems.domVisiblitySystem.dirty=!0,this.systems.collisionSystem.collidersDirty=!0,this.systems.domMutationSystem.dirty=!0,this.systems.panBoundsSystem.dirty=!0,this.twoDdirty=!1),this.threeDdirty&&(this.state.geometry3DIdsInScene.clear(),this.state.geometryGroupIdsToLoad.clear(),JC(this.state.entityScene,this.state.geometry3DIdsInScene,this.state.geometryGroupIdsToLoad),this.threeDdirty=!1,this.systems.interactionSystem.dirty3D=!0,this.systems.panBoundsSystem.dirty=!0,this.systems.outlineInterpolationSystem.geometries3DDirty=!0,this.systems.geometryInFocusSystem.focusablesDirty=!0);let o=this.systems.meshOptimizationSystem.update();o&&t.push(o),this.systems.borderSystem.update(),this.systems.meshModificationSystem.update(),this.systems.meshDetachmentSystem.update(),this.systems.imageSystem.update(this.systems.cameraSystem.getRotation()),t.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.domVisiblitySystem.update(),this.systems.domMutationSystem.update(),this.systems.twoDProjectionSystem.update(),this.systems.occlusion2DSystem.update(),this.systems.twoDDrawSystem.update(this.systems.cameraSystem.getZoomLevel()),this.systems.domDrawSystem.update(this.systems.cameraSystem.isUserInteracting()),this.systems.watermarkSystem.update();let n=this.needs2DRecompute;return this.nextFrame=requestAnimationFrame(()=>{this.systems.collisionSystem.update(this.systems.watermarkSystem.width,this.systems.watermarkSystem.height,this.systems.watermarkSystem.options.position,!n,this.systems.imageSystem.currentImageScreenBBoxes)}),this.systems.drawSystem.update(),this.systems.geometryDisposalSystem.update(),this.systems.cameraSystem.dirty=!1,this.systems.cameraSystem.zoomDirty=!1,this.systems.cameraSystem.rotationDirty=!1,this.systems.cameraSystem.stateDirty&&(this.publish("camera-state-change"),this.systems.cameraSystem.stateDirty=!1),this.publish("post-render"),Promise.all(t)}catch(t){return Promise.reject(t)}});this.renderer=t,this.state=o,this.mode=n,this.scene=i,this.cameraObject=a,this.viewCamera=l,this.systems=c,this.systems.collisionSystem.on("visibility-changed",this.updateEntities2D),this.systems.twoDVisiblitySystem.on("draw:2d",this.drawEntities2D),this.systems.twoDVisiblitySystem.on("animate:2d",this.animate2D),this.systems.cameraSystem.on("pan-start",()=>this.needs2DRecompute=!1),this.systems.cameraSystem.on("zoom-start",()=>this.needs2DRecompute=!1),this.systems.cameraSystem.on("zoom-end",()=>this.needs2DRecompute=!0),this.systems.cameraSystem.on("rotate-start",()=>this.needs2DRecompute=!1),this.systems.cameraSystem.on("rotate-end",()=>this.needs2DRecompute=!0)}paint(){this.renderer?.renderer&&(this.mode==="standalone"&&this.renderer.clear(),this.renderer.render(this.scene,this.state.useStandaloneCamera||this.mode==="standalone"?this.cameraObject:this.viewCamera))}destroy(){this.frameId&&cancelAnimationFrame(this.frameId),this.twoDFrameId&&cancelAnimationFrame(this.twoDFrameId),this.animationFrameId&&cancelAnimationFrame(this.animationFrameId),this.nextFrame&&cancelAnimationFrame(this.nextFrame),this.state.geometry2DIdsInScene.clear(),this.state.geometry3DIdsInScene.clear(),this.systems.domVisiblitySystem.dirty=!0,this.systems.collisionSystem.collidersDirty=!0,this.update(),this.systems.collisionSystem.off("visibility-changed",this.updateEntities2D),this.systems.twoDVisiblitySystem.off("draw:2d",this.drawEntities2D),this.systems.twoDVisiblitySystem.off("animate:2d",this.animate2D)}};d();var Y$=F.object({interactive:F.boolean().optional(),id:F.string().optional(),width:F.union([F.number(),F.object({on:F.literal("zoom-level").optional(),input:F.array(F.number()).nonempty(),output:F.array(F.number()).nonempty(),easing:F.string().optional()})]).optional(),accentColor:F.string().optional(),displayArrowsOnPath:F.boolean().optional(),animateArrowsOnPath:F.boolean().optional(),visibleThroughGeometry:F.boolean().optional(),dashed:F.boolean().optional()}),J$=F.object({type:F.enum(["Feature"]),geometry:bu,properties:F.object({parentId:F.any().optional()})});function r4(e,r){F.object({features:F.array(J$)}).parse(e),Y$.parse(r)}var Xf,Il=class{constructor(r,t){m(this,"type","path");m(this,"mesh",new Ga);m(this,"material");m(this,"geometry");m(this,"outline");m(this,"feature");m(this,"options");m(this,"width",{on:"zoom-level",input:[17,22],output:[.8,.4]});m(this,"breakpoint",0);m(this,"altitudeBreakpoints");m(this,"accentColor","blue");m(this,"completeFraction",1);m(this,"altitudeAdjustment",1);m(this,"displayArrowsOnPath",!1);m(this,"animateArrowsOnPath",!1);m(this,"visibleThroughGeometry",!1);m(this,"dashed",!1);m(this,"isVertical",!1);m(this,"dirty",!0);m(this,"materialDirty",!0);m(this,"position",new ae);S(this,Xf,0);this.feature=r,this.options=t||{},this.width=t?.width??this.width,this.accentColor=t?.accentColor??this.accentColor,this.displayArrowsOnPath=t?.displayArrowsOnPath??this.displayArrowsOnPath,this.animateArrowsOnPath=t?.animateArrowsOnPath??this.animateArrowsOnPath,this.visibleThroughGeometry=t?.visibleThroughGeometry??this.visibleThroughGeometry,this.dashed=t?.dashed??this.dashed}setColor(){}setOpacity(){}set visible(r){this.mesh&&(this.mesh.visible=r)}get visible(){return this.mesh?this.mesh.visible:!1}get altitude(){return s(this,Xf)}set altitude(r){this.mesh&&(this.mesh.position.z=r,w(this,Xf,r))}set complete(r){this.material&&(this.material.uniforms.complete.value=r,this.material.needsUpdate=!0)}};Xf=new WeakMap;d();d();d();var Vo=Object.freeze({Linear:Object.freeze({None:function(e){return e},In:function(e){return e},Out:function(e){return e},InOut:function(e){return e}}),Quadratic:Object.freeze({In:function(e){return e*e},Out:function(e){return e*(2-e)},InOut:function(e){return(e*=2)<1?.5*e*e:-.5*(--e*(e-2)-1)}}),Cubic:Object.freeze({In:function(e){return e*e*e},Out:function(e){return--e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e:.5*((e-=2)*e*e+2)}}),Quartic:Object.freeze({In:function(e){return e*e*e*e},Out:function(e){return 1- --e*e*e*e},InOut:function(e){return(e*=2)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2)}}),Quintic:Object.freeze({In:function(e){return e*e*e*e*e},Out:function(e){return--e*e*e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2)}}),Sinusoidal:Object.freeze({In:function(e){return 1-Math.sin((1-e)*Math.PI/2)},Out:function(e){return Math.sin(e*Math.PI/2)},InOut:function(e){return .5*(1-Math.sin(Math.PI*(.5-e)))}}),Exponential:Object.freeze({In:function(e){return e===0?0:Math.pow(1024,e-1)},Out:function(e){return e===1?1:1-Math.pow(2,-10*e)},InOut:function(e){return e===0?0:e===1?1:(e*=2)<1?.5*Math.pow(1024,e-1):.5*(-Math.pow(2,-10*(e-1))+2)}}),Circular:Object.freeze({In:function(e){return 1-Math.sqrt(1-e*e)},Out:function(e){return Math.sqrt(1- --e*e)},InOut:function(e){return(e*=2)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1)}}),Elastic:Object.freeze({In:function(e){return e===0?0:e===1?1:-Math.pow(2,10*(e-1))*Math.sin((e-1.1)*5*Math.PI)},Out:function(e){return e===0?0:e===1?1:Math.pow(2,-10*e)*Math.sin((e-.1)*5*Math.PI)+1},InOut:function(e){return e===0?0:e===1?1:(e*=2,e<1?-.5*Math.pow(2,10*(e-1))*Math.sin((e-1.1)*5*Math.PI):.5*Math.pow(2,-10*(e-1))*Math.sin((e-1.1)*5*Math.PI)+1)}}),Back:Object.freeze({In:function(e){var r=1.70158;return e===1?1:e*e*((r+1)*e-r)},Out:function(e){var r=1.70158;return e===0?0:--e*e*((r+1)*e+r)+1},InOut:function(e){var r=2.5949095;return(e*=2)<1?.5*(e*e*((r+1)*e-r)):.5*((e-=2)*e*((r+1)*e+r)+2)}}),Bounce:Object.freeze({In:function(e){return 1-Vo.Bounce.Out(1-e)},Out:function(e){return e<.36363636363636365?7.5625*e*e:e<.7272727272727273?7.5625*(e-=.5454545454545454)*e+.75:e<.9090909090909091?7.5625*(e-=.8181818181818182)*e+.9375:7.5625*(e-=.9545454545454546)*e+.984375},InOut:function(e){return e<.5?Vo.Bounce.In(e*2)*.5:Vo.Bounce.Out(e*2-1)*.5+.5}}),generatePow:function(e){return e===void 0&&(e=4),e=e<Number.EPSILON?Number.EPSILON:e,e=e>1e4?1e4:e,{In:function(r){return Math.pow(r,e)},Out:function(r){return 1-Math.pow(1-r,e)},InOut:function(r){return r<.5?Math.pow(r*2,e)/2:(1-Math.pow(2-r*2,e))/2+.5}}}}),Yf=function(){return performance.now()},Z1=function(){function e(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];this._tweens={},this._tweensAddedDuringUpdate={},this.add.apply(this,r)}return e.prototype.getAll=function(){var r=this;return Object.keys(this._tweens).map(function(t){return r._tweens[t]})},e.prototype.removeAll=function(){this._tweens={}},e.prototype.add=function(){for(var r,t=[],o=0;o<arguments.length;o++)t[o]=arguments[o];for(var n=0,i=t;n<i.length;n++){var a=i[n];(r=a._group)===null||r===void 0||r.remove(a),a._group=this,this._tweens[a.getId()]=a,this._tweensAddedDuringUpdate[a.getId()]=a}},e.prototype.remove=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];for(var o=0,n=r;o<n.length;o++){var i=n[o];i._group=void 0,delete this._tweens[i.getId()],delete this._tweensAddedDuringUpdate[i.getId()]}},e.prototype.allStopped=function(){return this.getAll().every(function(r){return!r.isPlaying()})},e.prototype.update=function(r,t){r===void 0&&(r=Yf()),t===void 0&&(t=!0);var o=Object.keys(this._tweens);if(o.length!==0)for(;o.length>0;){this._tweensAddedDuringUpdate={};for(var n=0;n<o.length;n++){var i=this._tweens[o[n]],a=!t;i&&i.update(r,a)===!1&&!t&&this.remove(i)}o=Object.keys(this._tweensAddedDuringUpdate)}},e}(),xu={Linear:function(e,r){var t=e.length-1,o=t*r,n=Math.floor(o),i=xu.Utils.Linear;return r<0?i(e[0],e[1],o):r>1?i(e[t],e[t-1],t-o):i(e[n],e[n+1>t?t:n+1],o-n)},Bezier:function(e,r){for(var t=0,o=e.length-1,n=Math.pow,i=xu.Utils.Bernstein,a=0;a<=o;a++)t+=n(1-r,o-a)*n(r,a)*e[a]*i(o,a);return t},CatmullRom:function(e,r){var t=e.length-1,o=t*r,n=Math.floor(o),i=xu.Utils.CatmullRom;return e[0]===e[t]?(r<0&&(n=Math.floor(o=t*(1+r))),i(e[(n-1+t)%t],e[n],e[(n+1)%t],e[(n+2)%t],o-n)):r<0?e[0]-(i(e[0],e[0],e[1],e[1],-o)-e[0]):r>1?e[t]-(i(e[t],e[t],e[t-1],e[t-1],o-t)-e[t]):i(e[n?n-1:0],e[n],e[t<n+1?t:n+1],e[t<n+2?t:n+2],o-n)},Utils:{Linear:function(e,r,t){return(r-e)*t+e},Bernstein:function(e,r){var t=xu.Utils.Factorial;return t(e)/t(r)/t(e-r)},Factorial:function(){var e=[1];return function(r){var t=1;if(e[r])return e[r];for(var o=r;o>1;o--)t*=o;return e[r]=t,t}}(),CatmullRom:function(e,r,t,o,n){var i=(t-e)*.5,a=(o-r)*.5,l=n*n,c=n*l;return(2*r-2*t+i+a)*c+(-3*r+3*t-2*i-a)*l+i*n+r}}},o4=function(){function e(){}return e.nextId=function(){return e._nextId++},e._nextId=0,e}(),O2=new Z1,ui=function(){function e(r,t){this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._isDynamic=!1,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=Vo.Linear.None,this._interpolationFunction=xu.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=o4.nextId(),this._isChainStopped=!1,this._propertiesAreSetUp=!1,this._goToEnd=!1,this._object=r,typeof t=="object"?(this._group=t,t.add(this)):t===!0&&(this._group=O2,O2.add(this))}return e.prototype.getId=function(){return this._id},e.prototype.isPlaying=function(){return this._isPlaying},e.prototype.isPaused=function(){return this._isPaused},e.prototype.getDuration=function(){return this._duration},e.prototype.to=function(r,t){if(t===void 0&&(t=1e3),this._isPlaying)throw new Error("Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.");return this._valuesEnd=r,this._propertiesAreSetUp=!1,this._duration=t<0?0:t,this},e.prototype.duration=function(r){return r===void 0&&(r=1e3),this._duration=r<0?0:r,this},e.prototype.dynamic=function(r){return r===void 0&&(r=!1),this._isDynamic=r,this},e.prototype.start=function(r,t){if(r===void 0&&(r=Yf()),t===void 0&&(t=!1),this._isPlaying)return this;if(this._repeat=this._initialRepeat,this._reversed){this._reversed=!1;for(var o in this._valuesStartRepeat)this._swapEndStartRepeatValues(o),this._valuesStart[o]=this._valuesStartRepeat[o]}if(this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=r,this._startTime+=this._delayTime,!this._propertiesAreSetUp||t){if(this._propertiesAreSetUp=!0,!this._isDynamic){var n={};for(var i in this._valuesEnd)n[i]=this._valuesEnd[i];this._valuesEnd=n}this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat,t)}return this},e.prototype.startFromCurrentValues=function(r){return this.start(r,!0)},e.prototype._setupProperties=function(r,t,o,n,i){for(var a in o){var l=r[a],c=Array.isArray(l),p=c?"array":typeof l,u=!c&&Array.isArray(o[a]);if(!(p==="undefined"||p==="function")){if(u){var f=o[a];if(f.length===0)continue;for(var h=[l],b=0,x=f.length;b<x;b+=1){var T=this._handleRelativeValue(l,f[b]);if(isNaN(T)){u=!1,console.warn("Found invalid interpolation list. Skipping.");break}h.push(T)}u&&(o[a]=h)}if((p==="object"||c)&&l&&!u){t[a]=c?[]:{};var v=l;for(var I in v)t[a][I]=v[I];n[a]=c?[]:{};var f=o[a];if(!this._isDynamic){var M={};for(var I in f)M[I]=f[I];o[a]=f=M}this._setupProperties(v,t[a],f,n[a],i)}else(typeof t[a]>"u"||i)&&(t[a]=l),c||(t[a]*=1),u?n[a]=o[a].slice().reverse():n[a]=t[a]||0}}},e.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},e.prototype.end=function(){return this._goToEnd=!0,this.update(this._startTime+this._duration),this},e.prototype.pause=function(r){return r===void 0&&(r=Yf()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=r,this)},e.prototype.resume=function(r){return r===void 0&&(r=Yf()),!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=r-this._pauseStart,this._pauseStart=0,this)},e.prototype.stopChainedTweens=function(){for(var r=0,t=this._chainedTweens.length;r<t;r++)this._chainedTweens[r].stop();return this},e.prototype.group=function(r){return r?(r.add(this),this):(console.warn("tween.group() without args has been removed, use group.add(tween) instead."),this)},e.prototype.remove=function(){var r;return(r=this._group)===null||r===void 0||r.remove(this),this},e.prototype.delay=function(r){return r===void 0&&(r=0),this._delayTime=r,this},e.prototype.repeat=function(r){return r===void 0&&(r=0),this._initialRepeat=r,this._repeat=r,this},e.prototype.repeatDelay=function(r){return this._repeatDelayTime=r,this},e.prototype.yoyo=function(r){return r===void 0&&(r=!1),this._yoyo=r,this},e.prototype.easing=function(r){return r===void 0&&(r=Vo.Linear.None),this._easingFunction=r,this},e.prototype.interpolation=function(r){return r===void 0&&(r=xu.Linear),this._interpolationFunction=r,this},e.prototype.chain=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this._chainedTweens=r,this},e.prototype.onStart=function(r){return this._onStartCallback=r,this},e.prototype.onEveryStart=function(r){return this._onEveryStartCallback=r,this},e.prototype.onUpdate=function(r){return this._onUpdateCallback=r,this},e.prototype.onRepeat=function(r){return this._onRepeatCallback=r,this},e.prototype.onComplete=function(r){return this._onCompleteCallback=r,this},e.prototype.onStop=function(r){return this._onStopCallback=r,this},e.prototype.update=function(r,t){var o=this,n;if(r===void 0&&(r=Yf()),t===void 0&&(t=e.autoStartOnUpdate),this._isPaused)return!0;var i;if(!this._goToEnd&&!this._isPlaying)if(t)this.start(r,!0);else return!1;if(this._goToEnd=!1,r<this._startTime)return!0;this._onStartCallbackFired===!1&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),this._onEveryStartCallbackFired===!1&&(this._onEveryStartCallback&&this._onEveryStartCallback(this._object),this._onEveryStartCallbackFired=!0);var a=r-this._startTime,l=this._duration+((n=this._repeatDelayTime)!==null&&n!==void 0?n:this._delayTime),c=this._duration+this._repeat*l,p=function(){if(o._duration===0||a>c)return 1;var T=Math.trunc(a/l),v=a-T*l,I=Math.min(v/o._duration,1);return I===0&&a===o._duration?1:I},u=p(),f=this._easingFunction(u);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,f),this._onUpdateCallback&&this._onUpdateCallback(this._object,u),this._duration===0||a>=this._duration)if(this._repeat>0){var h=Math.min(Math.trunc((a-this._duration)/l)+1,this._repeat);isFinite(this._repeat)&&(this._repeat-=h);for(i in this._valuesStartRepeat)!this._yoyo&&typeof this._valuesEnd[i]=="string"&&(this._valuesStartRepeat[i]=this._valuesStartRepeat[i]+parseFloat(this._valuesEnd[i])),this._yoyo&&this._swapEndStartRepeatValues(i),this._valuesStart[i]=this._valuesStartRepeat[i];return this._yoyo&&(this._reversed=!this._reversed),this._startTime+=l*h,this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1,!0}else{this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var b=0,x=this._chainedTweens.length;b<x;b++)this._chainedTweens[b].start(this._startTime+this._duration,!1);return this._isPlaying=!1,!1}return!0},e.prototype._updateProperties=function(r,t,o,n){for(var i in o)if(t[i]!==void 0){var a=t[i]||0,l=o[i],c=Array.isArray(r[i]),p=Array.isArray(l),u=!c&&p;u?r[i]=this._interpolationFunction(l,n):typeof l=="object"&&l?this._updateProperties(r[i],a,l,n):(l=this._handleRelativeValue(a,l),typeof l=="number"&&(r[i]=a+(l-a)*n))}},e.prototype._handleRelativeValue=function(r,t){return typeof t!="string"?t:t.charAt(0)==="+"||t.charAt(0)==="-"?r+parseFloat(t):parseFloat(t)},e.prototype._swapEndStartRepeatValues=function(r){var t=this._valuesStartRepeat[r],o=this._valuesEnd[r];typeof o=="string"?this._valuesStartRepeat[r]=this._valuesStartRepeat[r]+parseFloat(o):this._valuesStartRepeat[r]=this._valuesEnd[r],this._valuesEnd[r]=t},e.autoStartOnUpdate=!1,e}();var i5e=o4.nextId,as=O2,s5e=as.getAll.bind(as),a5e=as.removeAll.bind(as),l5e=as.add.bind(as),c5e=as.remove.bind(as),p5e=as.update.bind(as);d();d();d();var n4=(e,r)=>(r-e+Math.PI)%(Math.PI*2)+Math.PI*2%(Math.PI*2)-Math.PI,i4=(e,r)=>new Me(e.clientX-r.offsetLeft,e.clientY-r.offsetTop),E2=(e,r)=>Math.atan2(r.y-e.y,r.x-e.x),Jf=(e,r)=>Math.sqrt((r.y-e.y)**2+(r.x-e.x)**2),P2=(e,r)=>new Me((e.x+r.x)/2,(e.y+r.y)/2),F2=e=>{let r=0,{wheelDelta:t,detail:o}=e;return t!==void 0?r=t:o!==void 0&&(r=-o),r};var X1=class{constructor(r,t){m(this,"input1");m(this,"input2");m(this,"lastAngle");m(this,"lastDistance");m(this,"totalDistance");m(this,"first");m(this,"second");this.input1=r,this.input2=t,this.lastAngle=E2(r,t),this.lastDistance=Jf(r,t),this.totalDistance=0,this.first=r,this.second=t}update(r,t){let o=Jf(r,t);this.input1=r,this.input2=t;let n=E2(r,t);this.lastAngle=n,this.lastDistance=o,this.totalDistance+=(Jf(this.first,r)+Jf(this.second,t))/2,this.first=P2(this.first,r),this.second=P2(this.second,t)}};d();var Kf=class{constructor(r,t,o){m(this,"touch");m(this,"camera");m(this,"cameraPlane");m(this,"viewCoordinate");m(this,"snapHolderMatrix");m(this,"snapCamera");m(this,"cameraPosition");m(this,"raycaster");m(this,"worldCoordinate");m(this,"snapshotted",!1);this.touch=r,this.camera=t,this.cameraPlane=o,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 Me(this.viewCoordinate.x,this.viewCoordinate.y);this.raycaster=this.raycaster||new Pi,this.raycaster.setFromCamera(r,this.snapCamera);let t=this.raycaster.intersectObject(this.cameraPlane,!0);this.worldCoordinate=t&&t.length>0?t[0].point:null,this.snapshotted=!0}updateAnchorState(r,t){this.camera=r,this.snapCamera=r.clone(),this.snapHolderMatrix=r.matrixWorld.clone(),this.updateViewCoordinate(t),this.snapshotCameraState()}updateViewCoordinate(r){this.viewCoordinate={x:r.x,y:r.y}}reUnproject(){let r=new Me(this.viewCoordinate.x,this.viewCoordinate.y);this.raycaster?.setFromCamera(r,this.snapCamera);let t=this.raycaster?.intersectObject(this.cameraPlane,!0)[0];return t?t.point:void 0}};var mi={};La(mi,{BLOCK_MERCATOR_ZOOM_LEVEL:()=>Q$,CLIPPING_RADIUS:()=>Qf,CONTROL_OPTIONS:()=>K$,DEFAULT_ANIMATION_DURATION:()=>_2,DEFAULT_BEARING:()=>oH,DEFAULT_MAX_ZOOM_LEVEL:()=>tH,DEFAULT_MIN_ZOOM_LEVEL:()=>R2,DEFAULT_PITCH:()=>rH,DEFAULT_ZOOM_LEVEL:()=>eH,EVENTS:()=>Q1,MAPLIBRE_TILE_SIZE:()=>Y1,MAX_LAT:()=>k2,MAX_MERCATOR_ZOOM_LEVEL:()=>K1,MIN_LAT:()=>D2,MIN_MERCATOR_ZOOM_LEVEL:()=>J1,ROOM_MERCATOR_ZOOM_LEVEL:()=>q$,TWO_PI:()=>A2,WHEEL_ZOOM_MULTIPLIER:()=>L2,ZRANGE:()=>vu});d();var Y1=512,D2=-85.051129,k2=85.051129,Qf=1e4,K$={chain:"chain",cancel:"cancel"},A2=Math.PI*2,vu=100,L2=1e4,J1=0,K1=24,Q$=17,q$=20,_2=200,Q1=["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"],eH=18,R2=12,tH=22,rH=0,oH=0;var q1=!1,nH=!1;var ex,Ac=class extends ke{constructor(t,o,n,i,a){super();m(this,"dirty",!1);m(this,"zoomDirty",!1);m(this,"rotationDirty",!1);m(this,"panDirty",!1);m(this,"stateDirty",!1);S(this,ex,R2);m(this,"zoomSpeed",5);m(this,"rotateSpeed",100);m(this,"enabled",!0);m(this,"enableZoom",!0);m(this,"enablePan",!0);m(this,"enablePedestal",!1);m(this,"maxPedestal",1/0);m(this,"minPedestal",0);m(this,"enableRotate",!0);m(this,"minZoomAltitude",0);m(this,"maxZoomAltitude",1/0);m(this,"ignoreZoomLimits",!1);m(this,"zoomFactor",1);m(this,"panBounds",{min:new ae(1/0,1/0),max:new ae(-1/0,-1/0),center:new ae(0,0,0),radius:1/0});m(this,"minTilt",0);m(this,"maxTilt",1.2);m(this,"MOUSE_BUTTONS",{ORBIT:Hg.RIGHT,ZOOM:Hg.MIDDLE,PAN:Hg.LEFT});m(this,"camera");m(this,"scene");m(this,"renderer");m(this,"elevation");m(this,"orbit");m(this,"cameraPlane");m(this,"raycaster",new Pi);m(this,"rendererState");m(this,"options");m(this,"state",-1);m(this,"intersection");m(this,"viewState",null);m(this,"tweens",new Map);m(this,"clock",new IC(!0));m(this,"coords",{mouse:new Me,rotateStart:new Me,rotateEnd:new Me,rotateDelta:new Me,panStart:new ae,panCameraStart:new ae,panEnd:new ae,panDelta:new ae,initialShiftPos:new Me,initialPedestal:0,floorAnchor:new ae});m(this,"touch",{origin:{offsetLeft:0,offsetTop:0},touches:[],anchor1:null,anchor2:null,inputs:null});m(this,"scrollTimer",null);m(this,"lastWheelTime",0);m(this,"resetZoom",!1);m(this,"zoomStart");m(this,"pedestalScaleFactor",1);m(this,"isUserZooming",!1);m(this,"stayInsideBounds",!0);m(this,"userInteracting",!1);m(this,"cameraMoving",!1);m(this,"lastCameraMoveTime",Date.now());m(this,"raycastToFloor",t=>{this.raycaster.setFromCamera(t,this.camera);let o=this.raycaster.intersectObject(this.cameraPlane,!1)[0];return o?o.point:new ae});m(this,"isUserInteracting",()=>this.userInteracting);m(this,"getPosition",()=>new ae(this.orbit.position.x,this.orbit.position.y,this.orbit.position.z));m(this,"getPedestal",()=>this.orbit.position.z);m(this,"pan",(t,o)=>{isNaN(t)||isNaN(o)||(this.setPosition(this.orbit.position.x+t,this.orbit.position.y+o),this.publish("position-updated"))});m(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"))});m(this,"isCameraMoving",()=>this.cameraMoving);m(this,"lastCameraStoppedMovingTime",()=>this.lastCameraMoveTime);m(this,"setPosition",(t,o)=>{t===void 0||o===void 0||isNaN(t)||isNaN(o)||(this.state===-1&&this.publish("pan-start"),this.updateCameraPosition(t,o),this.publish("position-updated"),this.publish("change"),this.state===-1&&this.publish("pan-end"),this.dirty=!0,this.stateDirty=!0)});m(this,"updateCameraPosition",(t,o)=>{let n=t-this.panBounds.center.x,i=o-this.panBounds.center.y,a=Math.sqrt(n*n+i*i);if(this.stayInsideBounds&&a>this.panBounds.radius){let l=Math.atan2(i,n),c={x:Math.cos(l)*this.panBounds.radius+this.panBounds.center.x,y:Math.sin(l)*this.panBounds.radius+this.panBounds.center.y};this.orbit.position.x=c.x,this.orbit.position.y=c.y}else this.orbit.position.x=t,this.orbit.position.y=o});m(this,"tilt",t=>{if(isNaN(t))return;this.state===-1&&this.publish("rotate-start");let o=this.stayInsideBounds?Math.max(Math.min(t+this.getTilt(),this.maxTilt),this.minTilt):t+this.getTilt();o!==this.elevation.rotation.x&&(this.elevation.rotation.x=o,this.publish("tilt-updated")),this.publish("change"),this.state===-1&&this.publish("rotate-end"),this.stateDirty=!0});m(this,"zoomIn",(t,o,n)=>{let i=this.getZoomAltitude();this.animateCamera({zoom:i/1.5},t,o,n)});m(this,"zoomOut",(t,o,n)=>{let i=this.getZoomAltitude();this.animateCamera({zoom:i*1.5},t,o,n)});m(this,"getRotation",()=>(-this.orbit.rotation.z+Math.PI*2)%(Math.PI*2));m(this,"cancelAnimation",()=>{let t=Array.from(this.tweens.keys()),o=t[t.length-1];o.state===7&&this.publish("multi-cancel",{zooming:!0,rotating:!0,tilting:!0}),this.completeTween(o)});m(this,"animateCamera",(t,o,n,i,a,l)=>{let c={interruptible:!0,...l},p={},u={},f=this.getPosition();if(t.position!=null&&(t.position.x!==void 0&&(p.x=f.x,u.x=t.position.x),t.position.y!==void 0&&(p.y=f.y,u.y=t.position.y),t.position.z!==void 0&&(p.z=f.z,u.z=t.position.z)),t.zoom!==void 0&&(p.zoom=this.stayInsideBounds?Math.min(Math.max(this.getZoomAltitude(),this.getZoomScaledMin()),this.getZoomScaledMax()):this.getZoomAltitude(),this.viewState==="multi_floor"||!this.stayInsideBounds?u.zoom=t.zoom:u.zoom=Math.min(Math.max(t.zoom,this.getZoomScaledMin()),this.getZoomScaledMax())),t.rotation!==void 0){let{start:O,end:C}=oy(this.getRotation(),t.rotation);p.rotation=O,u.rotation=C}t.tilt!==void 0&&(p.tilt=this.getTilt(),this.viewState==="multi_floor"||!this.stayInsideBounds?u.tilt=t.tilt:u.tilt=Math.max(Math.min(t.tilt,this.maxTilt),this.minTilt));let h=p.zoom!==u.zoom,b=p.rotation!==u.rotation,x=p.tilt!==u.tilt,T=new ui(p).to(u,y.env.TESTING?0:o).onUpdate(O=>{this.setMulti({x:O.x,y:O.y,z:O.z},O.zoom,O.rotation,O.tilt)}).onComplete(()=>{this.completeTween(T),this.publish("multi-end",{zooming:h,rotating:b,tilting:x}),i&&i()}).onStart(()=>{this.state!==7&&(this.state=7,T.state=7,this.publish("multi-start",{zooming:h,rotating:b,tilting:x})),this.publish("change")});this.rendererState.internalTweenGroup.add(T);let v=Array.from(this.tweens.entries()),I=v[v.length-1],M=!1;return I!=null&&(I[1].interruptible?(typeof I[1].cancelledCallback=="function"&&I[1].cancelledCallback(),this.completeTween(I[0])):(M=!0,I[0].chain(T))),this.tweens.set(T,{cancelledCallback:a,interruptible:c.interruptible}),n?T.easing(n):T.easing(Vo.Quadratic.In),!t.doNotAutoStart&&!M&&(T.start(),this.publish("change")),T.cameraAnimation=!0,T});m(this,"setMulti",(t,o,n,i,a=!0)=>{this.state===-1&&this.publish("multi-start");let l=!1;t!=null&&(t.x!==void 0&&!isNaN(t.x)&&t.y!==void 0&&!isNaN(t.y)&&(this.updateCameraPosition(t.x,t.y),l=!0),t.z!==void 0&&!isNaN(t.z)&&(this.setPedestal(t.z,!0,!1),l=!0)),l&&this.publish("position-updated");let c={zooming:!1,tilting:!!o,rotating:!1};if(o!==void 0&&!isNaN(o)){let p=this.stayInsideBounds?Math.min(Math.max(o,this.getZoomScaledMin()),this.getZoomScaledMax()):o;p!==this.camera.position.z&&(c.zooming=!0,this.camera.position.z=p,this.publish("zoom-updated"),this.zoomDirty=!0,this.viewState==="multi_floor"?o>Qf&&(this.camera.near=o-Qf,this.camera.far=o+Qf):(this.camera.near=o/vu,this.camera.far=o*vu),this.camera.updateProjectionMatrix())}if(n!==void 0&&!isNaN(n)&&n!==this.getRotation()&&(c.rotating=!0,this.orbit.rotation.z=-n,this.publish("rotation-updated")),i!==void 0&&!isNaN(i)){let p=this.stayInsideBounds?Math.max(Math.min(i,this.maxTilt),this.minTilt):i;p!==this.elevation.rotation.x&&(c.tilting=!0,this.elevation.rotation.x=p,this.publish("tilt-updated"))}a&&this.publish("change"),this.state===-1&&this.publish("multi-end",c),this.stateDirty=!0});m(this,"getZoomScaledMin",()=>this.minZoomAltitude*this.zoomFactor);m(this,"getZoomScaledMax",()=>{let t=this.minZoomAltitude*this.zoomFactor;return Math.max(this.maxZoomAltitude,t)});m(this,"setRotation",(t,o)=>{if(isNaN(t))return;this.state===-1&&!o&&this.publish("rotate-start");let n=-(t%A2);n!==this.orbit.rotation.z&&(this.orbit.rotation.z=n,o||this.publish("rotation-updated")),o||this.publish("change"),this.state===-1&&!o&&this.publish("rotate-end"),this.dirty=!0,this.rotationDirty=!0,o||(this.stateDirty=!0)});m(this,"setZoomAltitude",t=>{if(isNaN(t))return;this.state===-1&&this.publish("zoom-start");let o=this.stayInsideBounds?Math.min(Math.max(t,this.getZoomScaledMin()),this.getZoomScaledMax()):t;o!==this.camera.position.z&&(this.camera.position.z=o,this.publish("zoom-updated"),this.zoomDirty=!0),this.camera.near=o/vu,this.camera.far=o*vu,this.camera.updateProjectionMatrix(),this.publish("change"),this.state===-1&&this.publish("zoom-end"),this.dirty=!0,this.stateDirty=!0});m(this,"setZoomLevel",t=>{this.setZoomAltitude(this.convertZoomLevelToAltitude(t))});m(this,"getZoomAltitude",()=>this.camera.position.z);m(this,"getZoomLevel",()=>this.convertAltitudeToZoomLevel(this.getZoomAltitude()));m(this,"setTilt",(t,o)=>{if(isNaN(t))return;this.state===-1&&!o&&this.publish("rotate-start");let n=this.stayInsideBounds?Math.max(Math.min(t,this.maxTilt),this.minTilt):t;n!==this.elevation.rotation.x&&(this.elevation.rotation.x=n,o||this.publish("tilt-updated")),o||this.publish("change"),this.state===-1&&!o&&this.publish("rotate-end"),this.dirty=!0,o||(this.stateDirty=!0)});m(this,"getTilt",()=>this.elevation.rotation.x);m(this,"setCameraPlaneElevation",t=>{this.cameraPlane.position.z=t});m(this,"zoom",t=>{if(isNaN(t))return;this.state===-1&&this.publish("zoom-start");let o=this.getZoomAltitude()-t;this.camera.position.z=this.stayInsideBounds?Math.min(Math.max(o,this.minZoomAltitude*this.zoomFactor),this.maxZoomAltitude*this.zoomFactor):o,this.publish("zoom-updated"),this.zoomDirty=!0,this.publish("change"),this.state===-1&&this.publish("zoom-end"),this.stateDirty=!0});m(this,"getProjectionScaleFactor",(t,o,n)=>_0(t,o,n));m(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())});m(this,"setPedestal",(t,o=!1,n=!0)=>{typeof t=="number"&&!isNaN(t)&&(this.orbit.position.z=t,o&&(this.publishPedestalChangeEvent(t),this.publish("pedestal-change",{pedestal:t})),this.publish("change"),this.dirty=!0,n&&(this.stateDirty=!0))});m(this,"dispose",()=>{for(let t of Q1)t.endsWith("start")?(this.off(t,this.setCameraMoving),t.startsWith("user")&&this.off(t,this.setUserInteracting)):(t.endsWith("end")||t.endsWith("cancel"))&&(this.off(t,this.unsetCameraMoving),t.startsWith("user")&&this.off(t,this.unsetUserInteracting));this.removeEventListeners(),this.scene.remove(this.cameraPlane),this.destroy()});m(this,"createCameraPlane",()=>{let t=q1?2e3:1e10,o=q1?100:1,n=new Os(t,t,o,o),i=new Nr({color:0,wireframe:q1,visible:q1}),a=new Le(n,i);return this.scene.add(a),a});m(this,"addEventListeners",()=>{let{domElement:t}=this.renderer;for(let o of Q1)o.endsWith("start")?(this.on(o,this.setCameraMoving),o.startsWith("user")&&this.on(o,this.setUserInteracting)):(o.endsWith("end")||o.endsWith("cancel"))&&(this.on(o,this.unsetCameraMoving),o.startsWith("user")&&this.on(o,this.unsetUserInteracting));t.addEventListener("contextmenu",this.onContextMenu,!1),t.addEventListener("mousedown",this.onMouseDown,!1),t.addEventListener("wheel",this.onMouseWheel,{passive:!1}),t.addEventListener("touchstart",this.onTouchStart,!1),t.addEventListener("touchend",this.onTouchEnd,!1),t.addEventListener("touchmove",this.onTouchMove,!1)});m(this,"addMouseEventListeners",()=>{this.addMouseMoveEventListeners(),window.addEventListener("mouseup",this.onMouseUp,!1),window.addEventListener("mouseout",this.onMouseUp,!1)});m(this,"addMouseMoveEventListeners",()=>{this.renderer.domElement.addEventListener("mousemove",this.onMouseMove,!1)});m(this,"removeMouseMoveEventListeners",()=>{this.renderer.domElement.removeEventListener("mousemove",this.onMouseMove,!1)});m(this,"removeEventListeners",()=>{let{domElement:t}=this.renderer;t.removeEventListener("contextmenu",this.onContextMenu,!1),t.removeEventListener("mousedown",this.onMouseDown,!1),t.removeEventListener("wheel",this.onMouseWheel,!1),t.removeEventListener("touchstart",this.onTouchStart,!1),t.removeEventListener("touchend",this.onTouchEnd,!1),t.removeEventListener("touchmove",this.onTouchMove,!1),t.removeEventListener("mousemove",this.onMouseMove,!1),window.removeEventListener("mouseup",this.onMouseUp,!1),window.removeEventListener("mouseout",this.onMouseUp,!1)});m(this,"removeMouseUpEventListeners",()=>{this.renderer.domElement.removeEventListener("mousemove",this.onMouseMove,!1),window.removeEventListener("mouseup",this.onMouseUp,!1),window.removeEventListener("mouseout",this.onMouseUp,!1)});m(this,"onContextMenu",t=>{t.preventDefault()});m(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}});m(this,"onMouseMove",t=>{if(this.enabled!==!1)if(t.preventDefault(),this.mouseToScene(t),this.state===0){if(this.enableRotate===!1)return;this.handleMouseMoveRotate(t)}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(t)});m(this,"onTouchStart",t=>{if(this.enabled!==!1){switch(this.updateTouchOrigin(),this.touchToScene(t),t.touches.length){case 1:this.enablePedestal?(this.handleTouchStartPedestal(t),this.state=9):this.enablePan&&(this.handleTouchStartPan(t),this.state=6);break;case 2:this.touch.inputs=new X1(this.touch.touches[0],this.touch.touches[1]);break;default:this.state=-1}this.state}});m(this,"onTouchMove",t=>{if(this.enabled!==!1)switch(this.touchToScene(t),t.touches.length){case 2:t.preventDefault(),t.stopPropagation();let o={...this.touch.inputs.first},n={...this.touch.inputs.second},i=new Me(this.touch.touches[0].x,this.touch.touches[0].y),a=new Me(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(t);else if(this.state===5)this.handleTouchMoveDolly();else if(this.state!==5&&this.touch.inputs.totalDistance>.05){let l=o.y<i.y&&n.y<a.y,c=o.y>i.y&&n.y>a.y;this.enableRotate&&this.state!==4&&(c||l)?(this.handleTouchStartTilt(t),this.state=4):(this.handleTouchStartDolly(),this.state=5)}break;case 1:(this.enablePedestal||this.enablePan)&&(t.preventDefault(),t.stopPropagation()),this.enablePedestal&&this.state===9?this.handleTouchMovePedestal(t):this.enablePan&&this.state===6&&this.handleTouchMovePan(t);break;default:this.state=-1}});m(this,"onTouchEnd",t=>{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}t.touches.length?this.onTouchStart(t):this.state=-1}});m(this,"handleTouchMovePan",t=>{let o=Object.hasOwn(t,"x")?new Me(t.x,t.y):this.touch.touches[0],n=this.raycastToFloor(o);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});m(this,"handleTouchStartDolly",()=>{let t=this.touch.touches[0].x-this.touch.touches[1].x,o=this.touch.touches[0].y-this.touch.touches[1].y;this.zoomStart=this.getZoomAltitude();let n=new Me(this.touch.touches[0].x-t/2,this.touch.touches[0].y-o/2);this.coords.floorAnchor=this.raycastToFloor(n),this.orbit.updateMatrixWorld(),this.touch.anchor1=new Kf(this.touch.touches[0],this.camera,this.cameraPlane),this.touch.anchor2=new Kf(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")});m(this,"handleMouseMovePan",()=>{let t=this.raycastToFloor(this.coords.mouse);this.coords.panEnd.set(t.x,t.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});m(this,"handleTouchStartTilt",t=>{this.coords.rotateStart.set(t.touches[1].clientX,t.touches[1].clientY),this.publish("user-tilt-start"),this.publish("rotate-start")});m(this,"handleTouchMovePedestal",t=>{this.handleMouseMovePedestal(t.touches[0])});m(this,"handleTouchMoveTilt",t=>{this.coords.rotateEnd.set(t.touches[1].clientX,t.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)});m(this,"handleTouchMoveDolly",()=>{let t=this.touch.inputs.first,o=this.touch.inputs.second;this.touch.anchor1.viewCoordinate={x:t.x,y:t.y},this.touch.anchor2.viewCoordinate={x:o.x,y:o.y};let n=this.makeTransformFromTouchAnchors(this.touch.anchor1,this.touch.anchor2);n&&this.setCameraFromTransformMatrix(n),this.orbit.updateMatrixWorld(),this.touch.anchor1.updateAnchorState(this.camera,t),this.touch.anchor2.updateAnchorState(this.camera,o)});m(this,"handleTouchEnd",()=>{this.state===4||this.state===5?this.publish("multi-end"):this.state===6&&this.publish("pan-end"),this.panDirty=!1});m(this,"handleTouchStartPan",t=>{let o=Object.hasOwn(t,"x")?new Me(t.x,t.y):this.touch.touches[0],n=this.raycastToFloor(o);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")});m(this,"handleTouchStartPedestal",t=>{this.handleMouseDownPedestal(t.touches[0])});m(this,"onMouseDown",t=>{if(this.enabled!==!1){if(this.mouseToScene(t),t.preventDefault(),this.state===3&&this.publish("zoom-end"),t.button===this.MOUSE_BUTTONS.ORBIT){if(this.enableRotate===!1)return;this.handleMouseDownRotate(t),this.state=0}else t.button===this.MOUSE_BUTTONS.PAN&&(this.enablePan?(this.handleMouseDownPan(),this.state=2):this.enablePedestal&&(this.handleMouseDownPedestal(t),this.state=8));this.state!==-1&&this.addMouseEventListeners()}});m(this,"onMouseWheel",t=>{this.enabled===!1||this.enableZoom===!1||this.state!==-1&&this.state!==3||(t.preventDefault(),t.stopPropagation(),this.mouseToScene(t),this.canScrollZoom(t)&&(this.lastWheelTime=this.clock.getElapsedTime(),this.publishUserZoomEvent()),this.state!==3&&this.canScrollZoom(t)&&(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(t))});m(this,"handleMouseWheel",t=>{if(this.publish("zoom-start"),!this.canScrollZoom(t)){this.lastWheelTime>0&&this.publish("zoom-end"),this.lastWheelTime=0,this.state=-1;return}let o=this.getZoomAltitude(),n=o-F2(t)*o/L2*this.zoomSpeed;if(this.setZoomAltitude(n),this.enablePan){let i=n/this.zoomStart;this.coords.panDelta.subVectors(this.coords.floorAnchor,this.coords.panCameraStart).multiplyScalar(1-i),this.setPosition(this.coords.panCameraStart.x+this.coords.panDelta.x,this.coords.panCameraStart.y+this.coords.panDelta.y)}this.publish("change")});m(this,"setCameraFromTransformMatrix",t=>{this.orbit.updateMatrixWorld();let o=new gp;o.setFromRotationMatrix(t,"ZYX");let n=(t.elements[14]-this.cameraPlane.position.z)/Math.cos(o.x),i=o.z,a=new ae(0,0,1);a.applyEuler(o),a.setLength(n);let l=new ae;l.setFromMatrixPosition(t),l.sub(a),this.enablePan&&this.setPosition(l.x,l.y),this.enableZoom&&this.setZoomAltitude(n),this.enableRotate&&this.setRotation(-i)});m(this,"makeTransformFromTouchAnchors",(t,o)=>{this.orbit.updateMatrixWorld(),this.camera.updateProjectionMatrix();let n=this.camera.projectionMatrix.clone(),i=t.worldCoordinate,a=o.worldCoordinate,l=t.reUnproject(),c=o.reUnproject();if(!l||!c||!i||!a)return null;let p=t.viewCoordinate,u=o.viewCoordinate,f=a.x-i.x,h=a.y-i.y,b=Math.atan2(h,f),x=c.x-l.x,T=c.y-l.y,v=Math.atan2(T,x),I=n4(b,v),M=new Hn;M.makeRotationZ(-I);let O=M.clone();O.multiply(t.snapHolderMatrix);let C=(Ug,pp,dp)=>Ug.elements[(pp-1)*4+dp-1],E=C(n,1,1)*C(O,1,1)-p.x*C(n,3,4)*C(O,3,1),_=C(n,1,1)*C(O,1,2)-p.x*C(n,3,4)*C(O,3,2),G=C(n,1,1)*C(O,1,3)-p.x*C(n,3,4)*C(O,3,3),R=i.x*E+i.y*_+i.z*G,N=C(n,2,2)*C(O,2,1)-p.y*C(n,3,4)*C(O,3,1),X=C(n,2,2)*C(O,2,2)-p.y*C(n,3,4)*C(O,3,2),z=C(n,2,2)*C(O,2,3)-p.y*C(n,3,4)*C(O,3,3),ee=i.x*N+i.y*X+i.z*z,re=C(n,1,1)*C(O,1,1)-u.x*C(n,3,4)*C(O,3,1),ue=C(n,1,1)*C(O,1,2)-u.x*C(n,3,4)*C(O,3,2),Ce=C(n,1,1)*C(O,1,3)-u.x*C(n,3,4)*C(O,3,3),Oe=a.x*re+a.y*ue+a.z*Ce,Pe=C(n,2,2)*C(O,2,1)-u.y*C(n,3,4)*C(O,3,1),Fe=C(n,2,2)*C(O,2,2)-u.y*C(n,3,4)*C(O,3,2),ce=C(n,2,2)*C(O,2,3)-u.y*C(n,3,4)*C(O,3,3),Ee=a.x*Pe+a.y*Fe+a.z*ce,ye=Math.abs(re-E),Ge=Math.abs(ue-_),Ie=Math.abs(Ce-G),Xe=Math.abs(re-N),se=Math.abs(ue-X),nt=Math.abs(Ce-z),dt=Math.abs(Pe-E),$t=Math.abs(Fe-_),k=Math.abs(ce-G),H=Math.abs(Pe-N),P=Math.abs(Fe-X),q=Math.abs(ce-z),K=Math.min(ye+Ge+Ie,Xe+se+nt),Q=Math.min(dt+$t+k,H+P+q);K<Q&&(re=Pe,ue=Fe,Ce=ce,Oe=Ee);let De=N*G-E*z,xt=X*G-_*z,dr=ee*G-R*z,ir=re*z-N*Ce,ur=ue*z-X*Ce,wi=Oe*z-ee*Ce,lp=(wi*xt-dr*ur)/(ir*xt-De*ur),nm=(wi*De-dr*ir)/(ur*De-xt*ir),cp=X*E-_*N,Rl=z*E-G*N,ka=ee*E-R*N,vs=ue*N-X*re,Gg=Ce*N-z*re,im=((Oe*N-ee*re)*cp-ka*vs)/(Gg*cp-Rl*vs),Aa=O.clone();return Aa.elements[12]=lp,Aa.elements[13]=nm,Aa.elements[14]=im,im>0?Aa:null});m(this,"updateTouchOrigin",()=>{let t=this.renderer.domElement;this.touch.origin.offsetLeft=t.getBoundingClientRect().left,this.touch.origin.offsetTop=t.getBoundingClientRect().top});m(this,"touchToScene",t=>{this.touch.touches=[];for(let o=0,n=t.touches.length;o<n;o++){let i=t.touches[o],a=i4(i,this.touch.origin);this.touch.touches.push(new Me(a.x/this.renderer.domElement.width*this.rendererState.pixelRatio*2-1,-(a.y/this.renderer.domElement.height*this.rendererState.pixelRatio)*2+1))}this.coords.mouse=this.touch.touches[0]});m(this,"canScrollZoom",t=>{let o=F2(t),n=this.getZoomAltitude();return!(o<0&&n===this.getZoomScaledMax()||o>0&&n===this.getZoomScaledMin())});m(this,"mouseToScene",t=>{let o=this.getMousePos(t);return this.coords.mouse.x=o.x/this.renderer.domElement.width*this.rendererState.pixelRatio*2-1,this.coords.mouse.y=-(o.y/this.renderer.domElement.height*this.rendererState.pixelRatio)*2+1,this.coords.mouse});m(this,"getMousePos",t=>({x:t.offsetX,y:t.offsetY}));m(this,"handleMouseDownRotate",t=>{this.coords.rotateStart.set(t.clientX,t.clientY),this.publish("rotate-start"),this.publish("user-rotate-start")});m(this,"handleMouseDownPan",()=>{let t=this.raycastToFloor(this.coords.mouse);this.coords.panStart.set(t.x,t.y,0),this.coords.panCameraStart.set(this.orbit.position.x,this.orbit.position.y,0),this.publish("pan-start"),this.publish("user-pan-start")});m(this,"handleMouseDownPedestal",t=>{let o=new Me(t.clientX,t.clientY);this.coords.initialShiftPos=o,this.coords.initialPedestal=this.getPedestal(),this.pedestalScaleFactor=_0(this.camera.fov,this.renderer.domElement.clientHeight,this.getZoomAltitude()),this.publish("pedestal-start"),this.publish("user-pedestal-start")});m(this,"handleMouseMovePedestal",t=>{let o={x:t.clientX,y:t.clientY},n=this.coords.initialPedestal+this.pedestalScaleFactor*(o.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)});m(this,"handleMouseMoveRotate",t=>{this.coords.rotateEnd.set(t.clientX,t.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")});m(this,"publishUserZoomDebounced",gm(()=>{this.isUserZooming=!1,this.publish("user-zoom-end")},250));m(this,"publishUserZoomEvent",()=>{this.isUserZooming?this.publishUserZoomDebounced():(this.publish("user-zoom-start"),this.isUserZooming=!0,this.publishUserZoomDebounced())});m(this,"setCameraMoving",()=>{this.cameraMoving=!0});m(this,"unsetCameraMoving",()=>{this.cameraMoving=!1,this.lastCameraMoveTime=Date.now()});m(this,"setUserInteracting",()=>{this.userInteracting=!0});m(this,"unsetUserInteracting",()=>{this.userInteracting=!1});m(this,"publishPedestalChangeEvent",t=>{this.publish("pedestal-change",{pedestal:t,scrolledToTop:this.scrolledToTop,scrolledToBottom:this.scrolledToBottom,scrollPercent:this.scrollPercent})});m(this,"convertAltitudeToZoomLevel",t=>{let[,o]=this.center,i=t*2*Math.tan(Ue.degToRad(this.camera.fov)/2)/this.options.canvasHeight,a=Math.cos(Ue.degToRad(o))*2*Math.PI*x0/i;return Ue.clamp(Math.log2(a/512),J1,K1)});m(this,"convertZoomLevelToAltitude",t=>{let[,o]=this.center,n=Ue.clamp(t,J1,K1),i=Math.pow(2,n),a=Ue.clamp(o,D2,k2),l=i*512;return Math.cos(Ue.degToRad(a))*Math.PI*2*x0/l*this.options.canvasHeight/2/Math.tan(Ue.degToRad(this.camera.fov)/2)});m(this,"completeTween",t=>{t.isPlaying()&&t.stop(),this.rendererState.internalTweenGroup.remove(t),this.tweens.delete(t)});m(this,"debugContainer",new ws);this.camera=t,this.renderer=n,this.rendererState=i,this.scene=o,this.options=a,this.elevation=t.parent,this.orbit=this.elevation.parent,this.cameraPlane=this.createCameraPlane(),this.zoomStart=t.position.z,a.mode!=="outdoors-overlay"&&this.addEventListeners()}get maxZoomLevel(){return this.convertAltitudeToZoomLevel(this.minZoomAltitude)}setMaxZoomLevel(t){this.minZoomAltitude=this.convertZoomLevelToAltitude(t),this.stateDirty=!0}get defaultMinZoomLevel(){return s(this,ex)}get minZoomLevel(){return this.convertAltitudeToZoomLevel(this.maxZoomAltitude)}setMinZoomLevel(t){this.maxZoomAltitude=this.convertZoomLevelToAltitude(t),this.stateDirty=!0}get scrollPercent(){let t=this.minPedestal,o=this.maxPedestal,n=this.getPedestal();return n=Math.min(n,o),n=Math.max(n,t),(n-t)/(o-t)*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(){let t=this.getPosition(),{lat:o,lon:n}=cy(this.rendererState.center?.[1]??0,this.rendererState.center?.[0]??0,t.x,t.y);return[n,o]}setCenter(t,o){let{x:n,y:i}=py(this.rendererState.center?.[1]??0,this.rendererState.center?.[0]??0,o,t);this.setPosition(n,i)}get isAnimating(){return this.rendererState.internalTweenGroup.getAll().some(t=>t.cameraAnimation)}getCameraFrameForCoordinates(t,o){let n=o.minZoom!==void 0?o.minZoom:this.minZoomAltitude,i=o.maxZoom!==void 0?o.maxZoom:this.maxZoomAltitude,a=this.options.canvasWidth,l=this.options.canvasHeight,c=this.getRotation(),p=this.getTilt(),u=this.getPosition();this.setRotation(o.rotation??c,!0),this.setTilt(o.tilt??p,!0);let f=s4(t,{canvasWidth:a,canvasHeight:l,paddingOption:o.padding,verticalPadding:o.verticalPadding,minZoom:n,maxZoom:i,position:u,camera:this.camera,orbit:this.orbit});return this.setRotation(c,!0),this.setTilt(p,!0),{center:f.position,zoomLevel:this.convertAltitudeToZoomLevel(f.zoom)}}focusOn(t,o){if(nH){this.debugContainer&&Ht(this.debugContainer);let v=new zn(4,4,4),I=new Nr({color:65280,depthTest:!1}),M=new Ba(v,I,t.length),O=new Hn;t.forEach((C,E)=>{O.setPosition(C),M.setMatrixAt(E,O)}),M.instanceMatrix.needsUpdate=!0,this.debugContainer.add(M),this.scene.add(this.debugContainer)}let n=o.curve,i=o.callback,a=o.cancelledCallback,l=o.minZoom!==void 0?o.minZoom:this.minZoomAltitude,c=o.maxZoom!==void 0?o.maxZoom:this.maxZoomAltitude,p=this.options.canvasWidth,u=this.options.canvasHeight,f;o.duration!==void 0?f=o.duration:y.env.TESTING==="true"?f=0:f=_2;let h=o.padding,b=this.getRotation(),x=this.getTilt();o.rotation!=null&&this.setRotation(o.rotation),o.tilt!=null&&this.setTilt(o.tilt);let T=s4(t,{canvasHeight:u,paddingOption:h,canvasWidth:p,minZoom:l,maxZoom:c,camera:this.camera,orbit:this.orbit,position:this.getPosition(),verticalPadding:o.verticalPadding});this.setRotation(b),this.setTilt(x),this.animateCamera({position:T.position,tilt:o.tilt,rotation:o.rotation,zoom:T.zoom},f,n,i,a,o)}resize(t,o){this.options.canvasWidth=t,this.options.canvasHeight=o}};ex=new WeakMap,m(Ac,"CAMERA_FRAME_PADDING_SIDES",["top","bottom","left","right"]);function s4(e,{canvasWidth:r,orbit:t,paddingOption:o,verticalPadding:n=0,canvasHeight:i,minZoom:a,maxZoom:l,camera:c,position:p}){let u={zoom:a,position:p};if(e.length===0)return u;for(let De of Ac.CAMERA_FRAME_PADDING_SIDES)typeof o[De]!="number"&&(o[De]=0);let f=o.type==="portion"?{top:o.top*i,bottom:o.bottom*i,left:o.left*r,right:o.right*r,type:"pixel"}:o;if(f.left+f.right>=r||f.top+f.bottom>=i)return u;t.updateMatrixWorld();let h=c.matrixWorldInverse,b=c.fov*(Math.PI/180)/2,x=b,v=Math.atan(Math.tan(b)*(r/i)),I=new ae(1/0,1/0,1/0),M=new ae(-1/0,-1/0,-1/0),O=new sr,C=new ae;for(let De=0,xt=e.length;De<xt;De++)C.copy(e[De]),O.expandByPoint(C),C.applyMatrix4(h),I.min(C),M.max(C),C.copy(e[De]),C.z-=n,C.applyMatrix4(h),I.min(C),M.max(C),C.copy(e[De]),C.z+=n,C.applyMatrix4(h),I.min(C),M.max(C);let E=M.x-I.x,_=M.y-I.y,G=r-f.left-f.right,R=i-f.top-f.bottom,N=(M.x+I.x)/2,X=(M.y+I.y)/2,z=E/G,ee=_/R,re=a,ue=l,Ce=re*Math.tan(v)*2,Oe=ue*Math.tan(v)*2,Pe=Ce/r,Fe=Oe/r,ce=Math.max(z,ee);ce=Ue.clamp(ce,Pe,Fe);let Ee=G*ce,ye=R*ce,Ge={min:{x:N-Ee/2-f.left*ce,y:X-ye/2-f.bottom*ce},max:{x:N+Ee/2+f.right*ce,y:X+ye/2+f.top*ce}},Ie=(Ge.min.x+Ge.max.x)/2,Xe=(Ge.min.y+Ge.max.y)/2,se=O.getCenter(new ae),nt=Math.abs(Ie-Ge.min.x),dt=Math.abs(Xe-Ge.min.y),$t=nt/Math.tan(v),k=dt/Math.tan(x),H=new ae;H.set(Ie,Xe,M.z+Math.max($t,k)),H.applyMatrix4(c.matrixWorld);let P=new ae;P.set(Ie,Xe,M.z),P.applyMatrix4(c.matrixWorld);let q=new ae().subVectors(P,H),K=(se.z-H.z)/q.z,Q=new ae().copy(H).add(q.clone().multiplyScalar(K));return P.set(Q.x,Q.y,Q.z),H.sub(P),{position:Q,zoom:H.length()}}d();var iH=300,qf,eh,tx=class{constructor(r){m(this,"state");S(this,qf,new ae);S(this,eh,new ae);this.state=r}update(r){let t,o;this.state.cameraObject.getWorldPosition(s(this,eh));for(let n of this.state.geometry2DIdsInScene)if(t=this.state.geometry2DMap.get(n),t&&(o=t.components[0],o&&"containerEl"in o&&o.markerContainer!=null)){if(o.visibilityNeedsUpdate!==!1&&(o.visibilityNeedsUpdate==="show"?o.canShow=!0:o.canShow=!1),(o.canShow&&o.visible===!0||o.animation?.pending===!0)&&!o.offscreen)if(o.options.zIndex!=null)o.markerContainer.style.transform=`translate3D(${o.projection.x}px, ${o.projection.y}px, ${o.options.zIndex}px)`;else{t.object3d.getWorldPosition(s(this,qf));let i=s(this,eh).distanceTo(s(this,qf));o.markerContainer.style.transform=`translate3D(${o.projection.x}px, ${o.projection.y}px, ${-i}px)`}if(o.canShow===!0&&o.visible===!0?o.markerContainer.style.pointerEvents=r?"none":o.pointerEvents:o.markerContainer.style.pointerEvents="none",o.currentStrategyIndex===-1&&o.visible&&o.visibilityNeedsUpdate==="show")continue;o.visibilityNeedsUpdate!==!1&&!o.offscreen&&(o.visibilityNeedsUpdate==="show"&&(o.markerContainer.style.opacity="0"),o.animation&&o.animation.cancel(),o.animation=o.markerContainer.animate([{opacity:o.canShow&&o.visible?"1":"0"}],{duration:iH,easing:"ease-in-out",fill:"forwards"}),o.visibilityNeedsUpdate=!1)}}};qf=new WeakMap,eh=new WeakMap;d();var rx=class extends ke{constructor(t,o){super();m(this,"state");m(this,"dirty",!0);m(this,"domTree");m(this,"observers",new Map);m(this,"updateDimensions",t=>{t.forEach(o=>{let i=o.target.parentElement?.getAttribute("data-marker-id");if(i){let a=this.state.geometry2DMap.get(i),l=a?.components[0];a&&l instanceof Ds&&(l.updateDimensions(o.contentRect.width,o.contentRect.height),l.collisionDirty=!0)}}),this.publish("dimensions-update")});this.state=t,this.domTree=o}setupObserver(){if(this.observers){for(let n of this.observers.values())n.disconnect();this.observers.clear()}let t,o;for(let n of this.domTree.children){let i=n.getAttribute("data-marker-id");if(i!=null&&(t=this.state.geometry2DMap.get(i),o=t.components[0],o.options?.dynamicResize)){let a=new ResizeObserver(this.updateDimensions);a.observe(o.containerEl),this.observers.set(n.userData.entityId,a)}}}update(){this.dirty&&(this.setupObserver(),this.dirty=!1)}destroy(){for(let t of this.observers.values())t.disconnect();this.observers.clear()}};d();var sH=0,aH=90,lH=(y.env.NODE_ENV==="test",!1),ls={linear:Vo.Linear.None,"ease-in":Vo.Quadratic.In,"ease-out":Vo.Quadratic.Out,"ease-in-out":Vo.Quadratic.InOut},cH=-50,de,Se,pa,th,rh,N2,ox=class{constructor(r,t,o){S(this,rh);S(this,de);S(this,Se);S(this,pa);S(this,th);w(this,de,r),w(this,Se,t),w(this,pa,o),s(this,de).map&&s(this,de).map.transform.setMinElevationForCurrentTile(cH),s(this,Se).cameraSystem.on("pedestal-change",({pedestal:n})=>{s(this,Se).cameraSystem.setCameraPlaneElevation(n)})}get center(){return s(this,de).mode==="outdoors-overlay"&&s(this,de).map?s(this,de).map.getCenter?.().toArray():s(this,Se).cameraSystem.center}setCenter(r){if(s(this,de).mode==="outdoors-overlay"&&s(this,de).map){s(this,de).map?.setCenter(r),s(this,Se).interactionSystem.handleHover();return}s(this,Se).cameraSystem.setCenter(r[0],r[1]),s(this,Se).interactionSystem.handleHover()}get zoomLevel(){return s(this,de).mode==="outdoors-overlay"&&s(this,de).map?s(this,de).map?.getZoom():s(this,Se).cameraSystem.getZoomLevel()}setZoomLevel(r){s(this,de).mode==="outdoors-overlay"&&s(this,de).map&&s(this,de).map?.setZoom(r),s(this,Se).cameraSystem.setZoomLevel(Fi(r,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 s(this,Se).cameraSystem.isAnimating}cancelAnimation(){s(this,Se).cameraSystem.cancelAnimation()}get maxZoomLevel(){return s(this,Se).cameraSystem.maxZoomLevel}get minZoomLevel(){return s(this,Se).cameraSystem.minZoomLevel}setAutoMinZoomLevel(r){s(this,Se).panBoundsSystem.autoMinZoomLevel=r,r&&(s(this,Se).panBoundsSystem.dirty=!0,s(this,Se).panBoundsSystem.update())}get autoMinZoomLevel(){return s(this,Se).panBoundsSystem.autoMinZoomLevel}setMinZoomLevel(r,t=!1){t&&this.setAutoMinZoomLevel(!1);let o=Fi(r,mi.MIN_MERCATOR_ZOOM_LEVEL,this.maxZoomLevel,`setMinZoomLevel was clamped. minZoomLevel must be between ${mi.MIN_MERCATOR_ZOOM_LEVEL} and maxZoomLevel.`);s(this,Se).cameraSystem.setMinZoomLevel(o),this.zoomLevel<o&&this.setZoomLevel(o),s(this,de).map?.setMinZoom(o)}setMaxZoomLevel(r){let t=Fi(r,this.minZoomLevel,mi.MAX_MERCATOR_ZOOM_LEVEL,`setMaxZoomLevel was clamped. maxZoomLevel must be between minZoomLevel and ${mi.MAX_MERCATOR_ZOOM_LEVEL}.`);s(this,Se).cameraSystem.setMaxZoomLevel(t),this.zoomLevel>t&&this.setZoomLevel(t),s(this,de).map?.setMaxZoom(t)}get maxPitch(){return s(this,de).mode==="outdoors-overlay"&&s(this,de).map?s(this,de).map?.getMaxPitch?.():Ue.radToDeg(s(this,Se).cameraSystem.maxTilt)}get minPitch(){return s(this,de).mode==="outdoors-overlay"&&s(this,de).map?s(this,de).map?.getMinPitch?.():Ue.radToDeg(s(this,Se).cameraSystem.minTilt)}setMinPitch(r){let t=Math.max(sH,r);s(this,de).map?.setMinPitch(t),s(this,Se).cameraSystem.minTilt=Ue.degToRad(t)}setMaxPitch(r){let t=Math.min(aH,r);s(this,de).map?.setMaxPitch(t),s(this,Se).cameraSystem.maxTilt=Ue.degToRad(t)}get bearing(){return s(this,de).mode==="outdoors-overlay"&&s(this,de).map?s(this,de).map?.getBearing():Ue.radToDeg(s(this,Se).cameraSystem.getRotation())}setBearing(r){if(s(this,de).mode==="outdoors-overlay"&&s(this,de).map){s(this,de).map?.setBearing(r);return}s(this,Se).cameraSystem.setRotation(Ue.degToRad(r))}get pitch(){return s(this,de).mode==="outdoors-overlay"&&s(this,de).map?s(this,de).map?.getPitch():Ue.radToDeg(s(this,Se).cameraSystem.getTilt())}setPitch(r){if(s(this,de).mode==="outdoors-overlay"&&s(this,de).map){s(this,de).map?.setPitch(r);return}s(this,Se).cameraSystem.setTilt(Ue.degToRad(Fi(r,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 s(this,Se).cameraSystem.getPedestal()}setElevation(r){s(this,Se).cameraSystem.setPedestal(r,!0)}animateElevation(r,t){return s(this,th)&&s(this,th).stop(),new Promise(o=>{s(this,Se).cameraSystem.animateCamera({position:{z:r}},t?.duration||300,ls[t?.easing||"ease-in-out"],o,o,{interruptible:t?.interruptible??!0})})}get insetsPadding(){return s(this,pa).insetsPadding}get panMode(){return s(this,Se).cameraSystem.enablePan===!1&&s(this,Se).cameraSystem.enablePedestal===!0?"elevation":"default"}setPanMode(r){if(r!=="default"&&r!=="elevation")throw new Error("Invalid pan mode");r!==this.panMode&&(r==="default"?(s(this,Se).cameraSystem.enablePan=!0,s(this,Se).cameraSystem.enablePedestal=!1):(s(this,Se).cameraSystem.enablePan=!1,s(this,Se).cameraSystem.enablePedestal=!0))}setInsetPadding(r){s(this,pa).insetsPadding=Object.assign({},s(this,pa).insetsPadding,r)}animateTo(r){if(s(this,de).mode==="outdoors-overlay"&&s(this,de).map)return s(this,de).map?.flyTo({center:r.center??this.center,zoom:r.zoomLevel??this.zoomLevel,bearing:r.bearing??this.bearing,pitch:r.pitch??this.pitch,duration:r.duration??600}),Promise.resolve();let t=r.center?s(this,de).convertTo3DMapPosition(r.center[1],r.center[0],r.center[2]||this.elevation):void 0,o=r.zoomLevel!==void 0?s(this,Se).cameraSystem.convertZoomLevelToAltitude(Fi(r.zoomLevel,this.minZoomLevel,this.maxZoomLevel,"zoomLevel was clamped to minZoomLevel/maxZoomLevel bounds. Use mapView.Camera.setMinZoomLevel() and mapView.Camera.setMaxZoomLevel() to adjust limits.")):void 0,n=r.bearing!==void 0?Ue.degToRad(r.bearing):void 0,i=r.pitch!==void 0?Ue.degToRad(Fi(r.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(a=>{s(this,Se).cameraSystem.animateCamera({position:t,zoom:o,rotation:n,tilt:i},r.duration||0,ls[r.easing||"ease-in-out"],()=>{s(this,Se).interactionSystem.handleHover(),a()},a,{interruptible:r?.interruptible??!0})})}getCameraFrameForCoordinates(r,t){let o=W(this,rh,N2).call(this,t||{},()=>Promise.resolve()),{pointCloud:n}=a4(r,s(this,de),s(this,pa).geometry3DMap);if(n.length===0)return A.error("No valid coordinates found in targets:",r),{center:this.center,zoomLevel:this.zoomLevel};let{center:i,zoomLevel:a}=s(this,Se).cameraSystem.getCameraFrameForCoordinates(n,o);return{center:s(this,de).convert3DMapPositionToCoordinate(i),zoomLevel:a}}focusOn(r,t){let{pointCloud:o,geoBounds:n,firstPosition:i}=a4(r,s(this,de),s(this,pa).geometry3DMap);return o.length===0?(A.error("No valid coordinates found in targets:",r),Promise.resolve()):s(this,de).mode==="outdoors-overlay"&&s(this,de).map?(o.length===1&&i?s(this,de).map?.flyTo({center:[i[0],i[1]],duration:t?.duration||s(this,de).map.getBearing(),animate:!0,bearing:t?.bearing===void 0?s(this,de).map.getBearing():t?.bearing,pitch:t?.pitch===void 0?s(this,de).map.getPitch():t?.pitch,zoom:t?.maxZoomLevel||s(this,de).map.getMaxZoom()}):(lH&&pH(s(this,de),n),s(this,de).map?.fitBounds(n,{duration:t?.duration??mi.DEFAULT_ANIMATION_DURATION,bearing:t?.bearing===void 0?s(this,de).map.getBearing():t?.bearing,pitch:t?.pitch===void 0?s(this,de).map.getPitch():t?.pitch,maxZoom:t?.maxZoomLevel??s(this,de).map.getMaxZoom()})),s(this,Se).interactionSystem.handleHover(),Promise.resolve()):new Promise(a=>{s(this,Se).cameraSystem.focusOn(o,W(this,rh,N2).call(this,t||{},a))})}};de=new WeakMap,Se=new WeakMap,pa=new WeakMap,th=new WeakMap,rh=new WeakSet,N2=function(r,t){return{minZoom:r?.maxZoomLevel===void 0?void 0:s(this,Se).cameraSystem.convertZoomLevelToAltitude(Fi(r.maxZoomLevel,this.minZoomLevel,this.maxZoomLevel,"maxZoomLevel was clamped to minZoomLevel/maxZoomLevel bounds. Use mapView.Camera.setMaxZoomLevel() to adjust limits.")),maxZoom:r?.minZoomLevel===void 0?void 0:s(this,Se).cameraSystem.convertZoomLevelToAltitude(Fi(r.minZoomLevel,this.minZoomLevel,this.maxZoomLevel,"minZoomLevel was clamped to minZoomLevel/maxZoomLevel bounds. Use mapView.Camera.setMinZoomLevel() to adjust limits.")),padding:r?.padding?Object.assign({},ay,r?.padding):this.insetsPadding,curve:ls[r?.easing||"ease-in-out"],rotation:r?.bearing===void 0?void 0:Ue.degToRad(r.bearing),tilt:r?.pitch!==void 0?Ue.degToRad(Fi(r.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:r?.duration,callback:()=>{s(this,Se).interactionSystem.handleHover(),t()},cancelledCallback:t,interruptible:r?.interruptible??!0,verticalPadding:r?.verticalPadding}};function B2(e,r){e[0]=Math.min(e[0],r[0]),e[1]=Math.min(e[1],r[1]),e[2]=Math.max(e[2],r[0]),e[3]=Math.max(e[3],r[1])}function a4(e,r,t){let o=[],n=[1/0,1/0,-1/0,-1/0],i=null;if(!e||!Array.isArray(e)||e.length===0)return{pointCloud:o,geoBounds:n,firstPosition:i};let a=r.getSystems().renderSystem;(a.threeDdirty||a.twoDdirty)&&r.renderSync();for(let l of e)if(typeof l=="string"){let c=t.get(l);if(!c){A.error("Entity not found with id:",l);continue}let p=new sr;ZC(r,"userData"in c?c.userData.entityId??c.id:c.id,o,p,c instanceof hr?c.position.z:void 0);let u=r.convert3DMapPositionToCoordinate(p.min),f=r.convert3DMapPositionToCoordinate(p.max);B2(n,u),B2(n,f),i||(i=r.convert3DMapPositionToCoordinate(p.getCenter(new ae)))}else o.push(r.convertTo3DMapPosition(l[1],l[0],l[2]||0)),B2(n,l),i||(i=l);return{pointCloud:o,geoBounds:n,firstPosition:i}}function pH(e,r){let t=[[r[0],r[1]],[r[0],r[3]],[r[2],r[3]],[r[2],r[1]],[r[0],r[1]]];e.map?.getLayer("bounds-outline")&&e.map.removeLayer("bounds-outline"),e.map?.getSource("bounds-source")&&e.map.removeSource("bounds-source"),e.map?.addSource("bounds-source",{type:"geojson",data:{type:"Feature",properties:{},geometry:{type:"LineString",coordinates:t}}}),e.map?.addLayer({id:"bounds-outline",type:"line",source:"bounds-source",layout:{},paint:{"line-color":"#FF0000","line-width":2,"line-opacity":.8}})}d();d();var l4=`uniform vec4 uSize;
13
13
  varying vec2 vUv;
14
14
  void main() {
15
15
  vUv = uv;
@@ -40,10 +40,10 @@ void main() {
40
40
  <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"/>
41
41
  <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"/>
42
42
  <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"/>
43
- </svg>`]]),uH=/<svg([^>]*)>/g;function h4(e,r,t,o){let n=dH.get(e);return n?n.replace(uH,`<svg$1 width="${t}" height="${o}" xmlns="http://www.w3.org/2000/svg" style="fill: ${r};">`):""}var g4=!1,Tt,da,Iu,Sr,So,Lc,mi,ls,ox=class extends ke{constructor(t,o,n){super();S(this,Tt,{padding:16,scale:1,iconOnly:!1,position:"bottom-left",color:"dark",onClick:()=>{window?.open("https://www.mappedin.com")},interactive:!0,visible:!0});S(this,da);S(this,Iu);S(this,Sr);S(this,So);S(this,Lc);S(this,mi,0);S(this,ls,0);m(this,"dirty",!0);m(this,"getPositionAlignedCanvasCoordinates",(t,o)=>({"top-left":{x:0,y:0},"top-right":{x:t,y:0},"bottom-left":{x:0,y:o},"bottom-right":{x:t,y:o},center:{x:t/2,y:o/2},top:{x:t/2,y:0},bottom:{x:t/2,y:o},left:{x:0,y:o/2},right:{x:t,y:o/2}})[s(this,Tt).position]);m(this,"getPositionAlignedPadding",()=>{let t=s(this,Tt).padding;if(typeof t=="number")return{"top-left":{x:t,y:t},"top-right":{x:-t,y:t},"bottom-left":{x:t,y:-t},"bottom-right":{x:-t,y:-t},center:{x:0,y:0},top:{x:0,y:t},bottom:{x:0,y:-t},left:{x:t,y:0},right:{x:-t,y:0}}[s(this,Tt).position];let o={top:t.top??0,right:t.right??0,bottom:t.bottom??0,left:t.left??0};return{x:o.left-o.right,y:o.top-o.bottom}});n&&Object.entries(n).forEach(([i,a])=>{a!==void 0&&(s(this,Tt)[i]=a)}),w(this,Iu,t),w(this,da,o)}get color(){return s(this,Tt).color==="light"?"white":"#293136"}get iconName(){return s(this,Tt).iconOnly?"icon":"horizontal"}get minWidth(){return s(this,Tt).iconOnly?d4:75}get defaultWidth(){return s(this,Tt).iconOnly?u4:150}get aspectRatio(){return s(this,Tt).iconOnly?m4:p4}get options(){return{...s(this,Tt)}}set options(t){w(this,Tt,{padding:t.padding||s(this,Tt).padding,position:t.position||s(this,Tt).position,iconOnly:t.iconOnly||s(this,Tt).iconOnly,color:t.color||s(this,Tt).color,scale:t.scale||s(this,Tt).scale,onClick:s(this,Tt).onClick,interactive:t.interactive??s(this,Tt).interactive,visible:t.visible??s(this,Tt).visible})}get icon(){return h4(this.iconName,this.color,s(this,mi)*s(this,da).pixelRatio,s(this,ls)*s(this,da).pixelRatio)}setSize(t,o){s(this,So)&&(s(this,So).uniforms.uSize.value.x=t,s(this,So).uniforms.uSize.value.y=o)}setXY(t,o){s(this,So)&&(s(this,So).uniforms.uSize.value.w=t,s(this,So).uniforms.uSize.value.z=o)}get width(){return s(this,mi)}get height(){return s(this,ls)}getPositionAlignedOffset(t,o){return{"top-left":{x:0,y:0},"top-right":{x:-t,y:0},"bottom-left":{x:0,y:-o},"bottom-right":{x:-t,y:-o},center:{x:-(t/2),y:-(o/2)},top:{x:-(t/2),y:0},bottom:{x:-(t/2),y:-o},left:{x:0,y:-(o/2)},right:{x:-t,y:-(o/2)}}[s(this,Tt).position]}insertIntoQuadTree(t){s(this,Lc)!=null&&typeof s(this,Tt).onClick=="function"&&s(this,Tt).interactive&&t.insert(s(this,Lc))}resize(t,o){if(s(this,Tt).visible!==!0)return;let n=this.getPositionAlignedCanvasCoordinates(t,o),i=this.getPositionAlignedPadding(),a=this.getPositionAlignedOffset(s(this,mi),s(this,ls)),l=Math.min(t-s(this,mi),Math.max(0,n.x+i.x+a.x)),c=Math.min(o-s(this,ls),Math.max(0,n.y+i.y+a.y));this.setSize(s(this,mi)/t,s(this,ls)/o),this.setXY(l/t,c/o),w(this,Lc,new rt(l,c,s(this,mi),s(this,ls),{entityId:"watermark"}))}update(){this.dirty&&(s(this,Tt).visible===!0?(w(this,mi,Math.min(s(this,da).canvasWidth,Math.max(this.minWidth,this.defaultWidth*s(this,Tt).scale))),w(this,ls,s(this,mi)/this.aspectRatio),vl.getLoader().load(`data:image/svg+xml;base64,${btoa(this.icon)}`,t=>{if(w(this,So,new _a({uniforms:{uTexture:{value:t},uSize:{value:new pC(0,0,0,0)},uOpacity:{value:.7}},vertexShader:l4,fragmentShader:c4,depthWrite:!1,depthTest:!1,defines:{debug:g4},wireframe:g4,transparent:!0,visible:!0})),s(this,Sr))s(this,Sr).visible=!0,s(this,Sr).material=s(this,So),s(this,Sr).material.needsUpdate=!0;else{let o=new Os(2,2,1,1);w(this,Sr,new Le(o,s(this,So))),s(this,Sr).position.set(0,0,-1),s(this,Sr).frustumCulled=!1,s(this,Sr).renderOrder=999;let n=new Hn(1,1,1),i=new Le(n,new Nr({transparent:!0,opacity:0,depthTest:!1,depthWrite:!1}));i.frustumCulled=!1,i.layers.set(1),s(this,Sr).add(i),s(this,Iu).add(s(this,Sr))}this.resize(s(this,da).canvasWidth,s(this,da).canvasHeight),this.publish("texture-loaded")})):s(this,Sr)&&(s(this,Sr).visible=!1),this.dirty=!1)}destroy(){s(this,Sr)&&(s(this,Iu).remove(s(this,Sr)),Ht(s(this,Sr))),w(this,Sr,void 0),s(this,So)&&s(this,So).dispose(),w(this,So,void 0),w(this,Lc,void 0)}};Tt=new WeakMap,da=new WeakMap,Iu=new WeakMap,Sr=new WeakMap,So=new WeakMap,Lc=new WeakMap,mi=new WeakMap,ls=new WeakMap;d();var nx=100,hH=!1,sx=class extends ke{constructor(t,o){super();m(this,"currentTotalBoundingBox");m(this,"state");m(this,"cameraSystem");m(this,"debugMesh",null);m(this,"dirty",!0);m(this,"autoMinZoomLevel",!0);this.state=t,this.cameraSystem=o}update(){if(this.dirty){this.currentTotalBoundingBox==null&&(this.currentTotalBoundingBox=new sr,this.state.entityScene.children.length===0?this.currentTotalBoundingBox.setFromCenterAndSize(new ae(0,0,0),new ae(nx*2,nx*2,0)):(this.currentTotalBoundingBox.setFromObject(this.state.entityScene),this.currentTotalBoundingBox.expandByScalar(nx)));let t=new sr().setFromObject(this.state.entityScene);this.currentTotalBoundingBox.union(t);let o=t.getSize(new ae),n=Math.max(o.x,o.y,o.z);for(let a of this.state.geometry2DMap.values())a.positionDirty===!0&&(this.currentTotalBoundingBox.expandByPoint(a.position),a.positionDirty=!1);let i=ix.copy(this.currentTotalBoundingBox).expandByScalar(Math.max(n,nx)).getBoundingSphere(gH).radius;if(this.cameraSystem.panBounds={center:this.currentTotalBoundingBox.getCenter(new ae),min:ix.min,max:ix.max,radius:i},this.publish("update"),this.cameraSystem.dirty=!0,this.dirty=!1,hH&&this.state.entityScene.parent instanceof Ra){this.debugMesh&&(this.state.entityScene.parent.remove(this.debugMesh),this.debugMesh=null),this.debugMesh=new ws,this.debugMesh.add(new Le(new qg(this.cameraSystem.panBounds.radius),new Nr({color:16711680,transparent:!0,opacity:.2}))),this.debugMesh.position.copy(this.cameraSystem.panBounds.center),this.state.entityScene.parent.add(this.debugMesh);let a=new ae;ix.getSize(a);let l=new Hn(a.x,a.y,a.z),c=new Nr({color:65280,wireframe:!0,transparent:!0,opacity:.5}),p=new Le(l,c);p.position.copy(this.currentTotalBoundingBox.getCenter(new ae)),this.debugMesh.add(p)}}}},ix=new sr,gH=new uC;d();var N2="\xA9 Mappedin",yH="https://info.mappedin.com/feedback",G2=["top-left","top-right","bottom-left","bottom-right"],bH=640,xH=()=>`<svg xmlns='http://www.w3.org/2000/svg' width='15' height='15' fill-rule='evenodd' viewBox='0 0 20 20'>
43
+ </svg>`]]),uH=/<svg([^>]*)>/g;function h4(e,r,t,o){let n=dH.get(e);return n?n.replace(uH,`<svg$1 width="${t}" height="${o}" xmlns="http://www.w3.org/2000/svg" style="fill: ${r};">`):""}var g4=!1,Tt,da,Iu,Sr,So,Lc,fi,cs,nx=class extends ke{constructor(t,o,n){super();S(this,Tt,{padding:16,scale:1,iconOnly:!1,position:"bottom-left",color:"dark",onClick:()=>{window?.open("https://www.mappedin.com")},interactive:!0,visible:!0});S(this,da);S(this,Iu);S(this,Sr);S(this,So);S(this,Lc);S(this,fi,0);S(this,cs,0);m(this,"dirty",!0);m(this,"getPositionAlignedCanvasCoordinates",(t,o)=>({"top-left":{x:0,y:0},"top-right":{x:t,y:0},"bottom-left":{x:0,y:o},"bottom-right":{x:t,y:o},center:{x:t/2,y:o/2},top:{x:t/2,y:0},bottom:{x:t/2,y:o},left:{x:0,y:o/2},right:{x:t,y:o/2}})[s(this,Tt).position]);m(this,"getPositionAlignedPadding",()=>{let t=s(this,Tt).padding;if(typeof t=="number")return{"top-left":{x:t,y:t},"top-right":{x:-t,y:t},"bottom-left":{x:t,y:-t},"bottom-right":{x:-t,y:-t},center:{x:0,y:0},top:{x:0,y:t},bottom:{x:0,y:-t},left:{x:t,y:0},right:{x:-t,y:0}}[s(this,Tt).position];let o={top:t.top??0,right:t.right??0,bottom:t.bottom??0,left:t.left??0};return{x:o.left-o.right,y:o.top-o.bottom}});n&&Object.entries(n).forEach(([i,a])=>{a!==void 0&&(s(this,Tt)[i]=a)}),w(this,Iu,t),w(this,da,o)}get color(){return s(this,Tt).color==="light"?"white":"#293136"}get iconName(){return s(this,Tt).iconOnly?"icon":"horizontal"}get minWidth(){return s(this,Tt).iconOnly?d4:75}get defaultWidth(){return s(this,Tt).iconOnly?u4:150}get aspectRatio(){return s(this,Tt).iconOnly?m4:p4}get options(){return{...s(this,Tt)}}set options(t){w(this,Tt,{padding:t.padding||s(this,Tt).padding,position:t.position||s(this,Tt).position,iconOnly:t.iconOnly||s(this,Tt).iconOnly,color:t.color||s(this,Tt).color,scale:t.scale||s(this,Tt).scale,onClick:s(this,Tt).onClick,interactive:t.interactive??s(this,Tt).interactive,visible:t.visible??s(this,Tt).visible})}get icon(){return h4(this.iconName,this.color,s(this,fi)*s(this,da).pixelRatio,s(this,cs)*s(this,da).pixelRatio)}setSize(t,o){s(this,So)&&(s(this,So).uniforms.uSize.value.x=t,s(this,So).uniforms.uSize.value.y=o)}setXY(t,o){s(this,So)&&(s(this,So).uniforms.uSize.value.w=t,s(this,So).uniforms.uSize.value.z=o)}get width(){return s(this,fi)}get height(){return s(this,cs)}getPositionAlignedOffset(t,o){return{"top-left":{x:0,y:0},"top-right":{x:-t,y:0},"bottom-left":{x:0,y:-o},"bottom-right":{x:-t,y:-o},center:{x:-(t/2),y:-(o/2)},top:{x:-(t/2),y:0},bottom:{x:-(t/2),y:-o},left:{x:0,y:-(o/2)},right:{x:-t,y:-(o/2)}}[s(this,Tt).position]}insertIntoQuadTree(t){s(this,Lc)!=null&&typeof s(this,Tt).onClick=="function"&&s(this,Tt).interactive&&t.insert(s(this,Lc))}resize(t,o){if(s(this,Tt).visible!==!0)return;let n=this.getPositionAlignedCanvasCoordinates(t,o),i=this.getPositionAlignedPadding(),a=this.getPositionAlignedOffset(s(this,fi),s(this,cs)),l=Math.min(t-s(this,fi),Math.max(0,n.x+i.x+a.x)),c=Math.min(o-s(this,cs),Math.max(0,n.y+i.y+a.y));this.setSize(s(this,fi)/t,s(this,cs)/o),this.setXY(l/t,c/o),w(this,Lc,new rt(l,c,s(this,fi),s(this,cs),{entityId:"watermark"}))}update(){this.dirty&&(s(this,Tt).visible===!0?(w(this,fi,Math.min(s(this,da).canvasWidth,Math.max(this.minWidth,this.defaultWidth*s(this,Tt).scale))),w(this,cs,s(this,fi)/this.aspectRatio),vl.getLoader().load(`data:image/svg+xml;base64,${btoa(this.icon)}`,t=>{if(w(this,So,new _a({uniforms:{uTexture:{value:t},uSize:{value:new dC(0,0,0,0)},uOpacity:{value:.7}},vertexShader:l4,fragmentShader:c4,depthWrite:!1,depthTest:!1,defines:{debug:g4},wireframe:g4,transparent:!0,visible:!0})),s(this,Sr))s(this,Sr).visible=!0,s(this,Sr).material=s(this,So),s(this,Sr).material.needsUpdate=!0;else{let o=new Os(2,2,1,1);w(this,Sr,new Le(o,s(this,So))),s(this,Sr).position.set(0,0,-1),s(this,Sr).frustumCulled=!1,s(this,Sr).renderOrder=999;let n=new zn(1,1,1),i=new Le(n,new Nr({transparent:!0,opacity:0,depthTest:!1,depthWrite:!1}));i.frustumCulled=!1,i.layers.set(1),s(this,Sr).add(i),s(this,Iu).add(s(this,Sr))}this.resize(s(this,da).canvasWidth,s(this,da).canvasHeight),this.publish("texture-loaded")})):s(this,Sr)&&(s(this,Sr).visible=!1),this.dirty=!1)}destroy(){s(this,Sr)&&(s(this,Iu).remove(s(this,Sr)),Ht(s(this,Sr))),w(this,Sr,void 0),s(this,So)&&s(this,So).dispose(),w(this,So,void 0),w(this,Lc,void 0)}};Tt=new WeakMap,da=new WeakMap,Iu=new WeakMap,Sr=new WeakMap,So=new WeakMap,Lc=new WeakMap,fi=new WeakMap,cs=new WeakMap;d();var ix=100,hH=!1,ax=class extends ke{constructor(t,o){super();m(this,"currentTotalBoundingBox");m(this,"state");m(this,"cameraSystem");m(this,"debugMesh",null);m(this,"dirty",!0);m(this,"autoMinZoomLevel",!0);this.state=t,this.cameraSystem=o}update(){if(this.dirty){this.currentTotalBoundingBox==null&&(this.currentTotalBoundingBox=new sr,this.state.entityScene.children.length===0?this.currentTotalBoundingBox.setFromCenterAndSize(new ae(0,0,0),new ae(ix*2,ix*2,0)):(this.currentTotalBoundingBox.setFromObject(this.state.entityScene),this.currentTotalBoundingBox.expandByScalar(ix)));let t=new sr().setFromObject(this.state.entityScene);this.currentTotalBoundingBox.union(t);let o=t.getSize(new ae),n=Math.max(o.x,o.y,o.z);for(let a of this.state.geometry2DMap.values())a.positionDirty===!0&&(this.currentTotalBoundingBox.expandByPoint(a.position),a.positionDirty=!1);let i=sx.copy(this.currentTotalBoundingBox).expandByScalar(Math.max(n,ix)).getBoundingSphere(gH).radius;if(this.cameraSystem.panBounds={center:this.currentTotalBoundingBox.getCenter(new ae),min:sx.min,max:sx.max,radius:i},this.publish("update"),this.cameraSystem.dirty=!0,this.dirty=!1,hH&&this.state.entityScene.parent instanceof Ra){this.debugMesh&&(this.state.entityScene.parent.remove(this.debugMesh),this.debugMesh=null),this.debugMesh=new ws,this.debugMesh.add(new Le(new qg(this.cameraSystem.panBounds.radius),new Nr({color:16711680,transparent:!0,opacity:.2}))),this.debugMesh.position.copy(this.cameraSystem.panBounds.center),this.state.entityScene.parent.add(this.debugMesh);let a=new ae;sx.getSize(a);let l=new zn(a.x,a.y,a.z),c=new Nr({color:65280,wireframe:!0,transparent:!0,opacity:.5}),p=new Le(l,c);p.position.copy(this.currentTotalBoundingBox.getCenter(new ae)),this.debugMesh.add(p)}}}},sx=new sr,gH=new mC;d();var j2="\xA9 Mappedin",yH="https://info.mappedin.com/feedback",U2=["top-left","top-right","bottom-left","bottom-right"],bH=640,xH=()=>`<svg xmlns='http://www.w3.org/2000/svg' width='15' height='15' fill-rule='evenodd' viewBox='0 0 20 20'>
44
44
  <circle cx='10' cy='10' r='5.9' style='fill:rgba(255,255,255,1);'/>
45
45
  <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'/>
46
- </svg>`,j2={custom:[],position:"bottom-right",feedback:!0},Su,ax=class{constructor(r,t={}){m(this,"controlContainerEl");m(this,"controlPositions");m(this,"compact");S(this,Su);m(this,"attribContainerEl");m(this,"attribInnerEl");m(this,"attribButtonEl");m(this,"feedbackLinkEl");m(this,"attribHTML",N2);m(this,"customAttributions",[]);m(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",""))))});w(this,Su,!!t.outdoorEnabled),this.controlContainerEl=document.createElement("div"),this.controlContainerEl.classList.add("mappedin-control-container"),r.appendChild(this.controlContainerEl),this.controlPositions=G2.reduce((o,n)=>{let i=document.createElement("div");return i.classList.add(`mappedin-ctrl-${n}`),this.controlContainerEl.appendChild(i),o[n]=i,o},{})}addAttributionControl(r=j2){let t=r.position&&G2.includes(r.position)?r.position:j2.position;this.attribContainerEl=document.createElement("details"),this.attribContainerEl.classList.add("mappedin-ctrl-attrib",`mappedin-ctrl-attrib-${t}`),this.attribContainerEl.open=!0,this.attribContainerEl.ariaLabel="Attribution",this.controlPositions[t].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=xH(),this.attribContainerEl.appendChild(this.attribButtonEl),this.attribInnerEl=document.createElement("div"),this.attribInnerEl.classList.add("mappedin-ctrl-attrib-inner"),this.attribHTML=s(this,Su)?N2:"",this.attribInnerEl.innerHTML=this.attribHTML,this.attribContainerEl.appendChild(this.attribInnerEl),(r.feedback??j2.feedback)&&(this.feedbackLinkEl=document.createElement("a"),this.feedbackLinkEl.href=yH,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 t=s(this,Su)?[N2]:[],o=r.style.sourceCaches;for(let n in o){let i=o[n];if(i.used||i.usedForTerrain){let a=i.getSource();a.attribution&&t.indexOf(a.attribution)<0&&t.push(a.attribution)}}t=t.filter(n=>String(n).trim()),t=t.filter((n,i)=>{for(let a=i+1;a<t.length;a++)if(t[a].indexOf(n)>=0)return!1;return!0}),this.attribHTML=t.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<=bH||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}};Su=new WeakMap;d();var oh,nh,Tu=class{constructor(r,t){m(this,"mesh");m(this,"type","custom-geometry");m(this,"dirty",!0);m(this,"feature");m(this,"builder");m(this,"outline");S(this,oh,1);m(this,"color",new ar);S(this,nh,0);this.mesh=new Ga,this.feature=r,this.builder=t}get visible(){return this.mesh.visible}set visible(r){this.mesh.visible=r}set opacity(r){w(this,oh,r)}get opacity(){return s(this,oh)}setColor(r){this.color.set(r)}get position(){return this.mesh?.position}get altitude(){return s(this,nh)}set altitude(r){this.mesh&&(this.mesh.position.z=r,w(this,nh,r))}get renderOrder(){return this.mesh?this.mesh.renderOrder:0}set renderOrder(r){this.mesh&&(this.mesh.renderOrder=r)}};oh=new WeakMap,nh=new WeakMap;d();var lx=class{constructor(r,t){m(this,"state");m(this,"convertTo3DMapPosition");this.state=r,this.convertTo3DMapPosition=t}update(){let r,t;for(let o of this.state.geometry3DIdsInScene){let n=this.state.geometry3DMap.get(o);n?.type==="custom-geometry"&&(r=n.components[0],t=n.components[1],r.dirty&&t.visible!==!1&&(r.position.copy(this.convertTo3DMapPosition(r.feature.geometry.coordinates[1],r.feature.geometry.coordinates[0],t.altitude)),r.builder.setup(r.mesh),r.mesh.traverse(i=>{i.userData={...i.userData,entityId:o,type:"custom-geometry"}}),r.dirty=!1),t.visible!==!1&&r.builder.update(r.mesh))}}};d();d();function y4(e){return e.children.some(r=>r.userData.isOutline)}function b4(e,r){let t=e.userData.entities3D.values().next().value;return t?r.geometry3DMap.get(t)?.components[3]!==void 0:!1}function cx(e,r,t,o){let i=e.getAttribute("position").array,a=-1/0;for(let l=0;l<r.count;l++){let p=(r.start+l)*3,u=i[p+2];a=Math.max(a,u)}for(let l=0;l<r.count;l++){let p=(r.start+l)*3,u=i[p+2];Math.abs(u-a)<1e-4?i[p+2]=Math.max(t+o,2e-4+o):i[p+2]=o}e.attributes.position.needsUpdate=!0}d();function U2(e){let r=new Yg,t=e.mesh?.geometry;if(!t||!e.batchedProps?.range)return;let o=e.batchedProps.range,n=o.start,i=o.count,a=t.getAttribute("position");if(a){let p=new Float32Array(i*3);for(let u=0;u<i;u++){let f=n+u;p[u*3]=a.array[f*3],p[u*3+1]=a.array[f*3+1],p[u*3+2]=a.array[f*3+2]}r.setAttribute("position",new po(p,3))}let l=t.getAttribute("normal");if(l){let p=new Float32Array(i*3);for(let u=0;u<i;u++){let f=n+u;p[u*3]=l.array[f*3],p[u*3+1]=l.array[f*3+1],p[u*3+2]=l.array[f*3+2]}r.setAttribute("normal",new po(p,3))}let c=t.getAttribute("uv");if(c){let p=new Float32Array(i*2);for(let u=0;u<i;u++){let f=n+u;p[u*2]=c.array[f*2],p[u*2+1]=c.array[f*2+1]}r.setAttribute("uv",new po(p,2))}if(t.index){let p=t.index,u=new Uint32Array(i);for(let f=0;f<i;f++)u[f]=p.array[n+f];r.setIndex(new po(u,1))}return r}function x4(e,r){let t=U2(e);if(!t||!e.mesh)return;e.mesh.deleteInstance(e.instanceIndex),e.mesh.optimize();let o=r.addGeometry(t);r.addInstance(o);let n=r.getGeometryIdAt(o),i=r.getGeometryRangeAt(n);return i&&e.batchedProps&&(e.batchedProps.range=i),t.dispose(),o}d();d();var v4=`// Modified from https://github.com/mrdoob/three.js/blob/dev/src/renderers/shaders/ShaderLib/linedashed.glsl.js
46
+ </svg>`,G2={custom:[],position:"bottom-right",feedback:!0},Su,lx=class{constructor(r,t={}){m(this,"controlContainerEl");m(this,"controlPositions");m(this,"compact");S(this,Su);m(this,"attribContainerEl");m(this,"attribInnerEl");m(this,"attribButtonEl");m(this,"feedbackLinkEl");m(this,"attribHTML",j2);m(this,"customAttributions",[]);m(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",""))))});w(this,Su,!!t.outdoorEnabled),this.controlContainerEl=document.createElement("div"),this.controlContainerEl.classList.add("mappedin-control-container"),r.appendChild(this.controlContainerEl),this.controlPositions=U2.reduce((o,n)=>{let i=document.createElement("div");return i.classList.add(`mappedin-ctrl-${n}`),this.controlContainerEl.appendChild(i),o[n]=i,o},{})}addAttributionControl(r=G2){let t=r.position&&U2.includes(r.position)?r.position:G2.position;this.attribContainerEl=document.createElement("details"),this.attribContainerEl.classList.add("mappedin-ctrl-attrib",`mappedin-ctrl-attrib-${t}`),this.attribContainerEl.open=!0,this.attribContainerEl.ariaLabel="Attribution",this.controlPositions[t].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=xH(),this.attribContainerEl.appendChild(this.attribButtonEl),this.attribInnerEl=document.createElement("div"),this.attribInnerEl.classList.add("mappedin-ctrl-attrib-inner"),this.attribHTML=s(this,Su)?j2:"",this.attribInnerEl.innerHTML=this.attribHTML,this.attribContainerEl.appendChild(this.attribInnerEl),(r.feedback??G2.feedback)&&(this.feedbackLinkEl=document.createElement("a"),this.feedbackLinkEl.href=yH,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 t=s(this,Su)?[j2]:[],o=r.style.sourceCaches;for(let n in o){let i=o[n];if(i.used||i.usedForTerrain){let a=i.getSource();a.attribution&&t.indexOf(a.attribution)<0&&t.push(a.attribution)}}t=t.filter(n=>String(n).trim()),t=t.filter((n,i)=>{for(let a=i+1;a<t.length;a++)if(t[a].indexOf(n)>=0)return!1;return!0}),this.attribHTML=t.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<=bH||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}};Su=new WeakMap;d();var oh,nh,Tu=class{constructor(r,t){m(this,"mesh");m(this,"type","custom-geometry");m(this,"dirty",!0);m(this,"feature");m(this,"builder");m(this,"outline");S(this,oh,1);m(this,"color",new ar);S(this,nh,0);this.mesh=new Ga,this.feature=r,this.builder=t}get visible(){return this.mesh.visible}set visible(r){this.mesh.visible=r}set opacity(r){w(this,oh,r)}get opacity(){return s(this,oh)}setColor(r){this.color.set(r)}get position(){return this.mesh?.position}get altitude(){return s(this,nh)}set altitude(r){this.mesh&&(this.mesh.position.z=r,w(this,nh,r))}get renderOrder(){return this.mesh?this.mesh.renderOrder:0}set renderOrder(r){this.mesh&&(this.mesh.renderOrder=r)}};oh=new WeakMap,nh=new WeakMap;d();var cx=class{constructor(r,t){m(this,"state");m(this,"convertTo3DMapPosition");this.state=r,this.convertTo3DMapPosition=t}update(){let r,t;for(let o of this.state.geometry3DIdsInScene){let n=this.state.geometry3DMap.get(o);n?.type==="custom-geometry"&&(r=n.components[0],t=n.components[1],r.dirty&&t.visible!==!1&&(r.position.copy(this.convertTo3DMapPosition(r.feature.geometry.coordinates[1],r.feature.geometry.coordinates[0],t.altitude)),r.builder.setup(r.mesh),r.mesh.traverse(i=>{i.userData={...i.userData,entityId:o,type:"custom-geometry"}}),r.dirty=!1),t.visible!==!1&&r.builder.update(r.mesh))}}};d();d();function y4(e){return e.children.some(r=>r.userData.isOutline)}function b4(e,r){let t=e.userData.entities3D.values().next().value;return t?r.geometry3DMap.get(t)?.components[3]!==void 0:!1}function px(e,r,t,o){let i=e.getAttribute("position").array,a=-1/0;for(let l=0;l<r.count;l++){let p=(r.start+l)*3,u=i[p+2];a=Math.max(a,u)}for(let l=0;l<r.count;l++){let p=(r.start+l)*3,u=i[p+2];Math.abs(u-a)<1e-4?i[p+2]=Math.max(t+o,2e-4+o):i[p+2]=o}e.attributes.position.needsUpdate=!0}d();function V2(e){let r=new Yg,t=e.mesh?.geometry;if(!t||!e.batchedProps?.range)return;let o=e.batchedProps.range,n=o.start,i=o.count,a=t.getAttribute("position");if(a){let p=new Float32Array(i*3);for(let u=0;u<i;u++){let f=n+u;p[u*3]=a.array[f*3],p[u*3+1]=a.array[f*3+1],p[u*3+2]=a.array[f*3+2]}r.setAttribute("position",new po(p,3))}let l=t.getAttribute("normal");if(l){let p=new Float32Array(i*3);for(let u=0;u<i;u++){let f=n+u;p[u*3]=l.array[f*3],p[u*3+1]=l.array[f*3+1],p[u*3+2]=l.array[f*3+2]}r.setAttribute("normal",new po(p,3))}let c=t.getAttribute("uv");if(c){let p=new Float32Array(i*2);for(let u=0;u<i;u++){let f=n+u;p[u*2]=c.array[f*2],p[u*2+1]=c.array[f*2+1]}r.setAttribute("uv",new po(p,2))}if(t.index){let p=t.index,u=new Uint32Array(i);for(let f=0;f<i;f++)u[f]=p.array[n+f];r.setIndex(new po(u,1))}return r}function x4(e,r){let t=V2(e);if(!t||!e.mesh)return;e.mesh.deleteInstance(e.instanceIndex),e.mesh.optimize();let o=r.addGeometry(t);r.addInstance(o);let n=r.getGeometryIdAt(o),i=r.getGeometryRangeAt(n);return i&&e.batchedProps&&(e.batchedProps.range=i),t.dispose(),o}d();d();var v4=`// Modified from https://github.com/mrdoob/three.js/blob/dev/src/renderers/shaders/ShaderLib/linedashed.glsl.js
47
47
  uniform float scale;
48
48
  attribute float lineDistance;
49
49
 
@@ -126,7 +126,7 @@ void main() {
126
126
  discard;
127
127
  }
128
128
  }
129
- `;var px=class extends fC{constructor(r){super(r),this.onBeforeCompile=t=>{t.vertexShader=v4,t.fragmentShader=I4}}};var SH=80,_c,Cu,ux,mx,dx=class{constructor(r){m(this,"rendererState");m(this,"outlineOpacitiesDirty",!0);S(this,_c,!0);S(this,Cu,-1/0);S(this,ux,new Map);S(this,mx,new px({vertexColors:!0,linewidth:1,transparent:!0,opacity:1,side:lm}));this.rendererState=r}get geometries3DDirty(){return s(this,_c)}set geometries3DDirty(r){w(this,_c,r)}update(r,t=!0){let o;if(this.geometries3DDirty){for(let i of this.rendererState.geometry3DIdsInScene){let a=this.rendererState.geometry3DMap.get(i);if(a instanceof zn&&b4(a,this.rendererState)&&!y4(a)&&a.userData.entities3D.size>0){let l=[];for(let v of a.userData.entities3D.values()){let I=this.rendererState.geometry3DMap.get(v);if(I instanceof Mt&&I.type==="geometry"&&I.components[3]&&I.components[3].dirty===!0&&I.components[0].material!=null){let M=I.components[0].geometry,O=!1;M||(M=U2(I.components[0]),O=!0);let C=I.components[1];l.push([I.components[3],new gC(M,C.bevel?.enabled?1:SH)]),O&&(M?.dispose(),M=void 0)}}if(l.length===0)continue;let c=Li(l.map(v=>v[1]),!1);if(c==null)continue;let p=c.getAttribute("position"),u=new Float32Array(p.count*4),f=new po(u,4);c.setAttribute("color",f);let h=new Uint8Array(p.count);h.fill(0);let b=new po(h,1,!1);c.setAttribute("visibility",b);let x=0;for(let v=0;v<l.length;v++){let[I,M]=l[v],O=M.getAttribute("position").count;I.edgeColors=f,I.edgeVisibility=b,I.geometry=c,I.ranges={count:O,start:x},x+=O,M.dispose()}let T=new pm(c,s(this,mx));T.userData.isOutline=!0,a.add(T)}}w(this,_c,!1),this.outlineOpacitiesDirty=!0}for(let i of this.rendererState.geometry3DIdsInScene){let a=this.rendererState.geometry3DMap.get(i);if(a instanceof Mt&&a.type==="geometry"&&a.components[3]&&a.components[3].dirty===!0&&a.components[0].material!=null&&a.parentObject3D instanceof zn){let l=a.components[3].geometry;if(!l)continue;let c=a.components[3];if(!c)continue;let p=c.enabled&&a.components[1].visible;if(c.visible!==p&&(c.visible=p),!c.visible)continue;let u=c.edgeColors;if(!u||!c.ranges)continue;let f=new ar(c.color);for(let T=0;T<c.ranges.count;T++){let v=c.ranges.start+T;u.setXYZ(v,f.r,f.g,f.b)}let h=a.components[1].height,b=a.components[1].altitude;a.components[1]?.bevel?.enabled||cx(l,c.ranges,h,b),l.attributes.color.needsUpdate=!0,l.computeBoundingSphere(),c.dirty=!1}}let n=t?Nl(r,16,19,0,1):s(this,Cu);if((n!==s(this,Cu)||this.outlineOpacitiesDirty)&&this.rendererState.geometry3DIdsInScene.size>0){for(let i of this.rendererState.geometry3DIdsInScene)if(o=this.rendererState.geometry3DMap.get(i),o?.type==="geometry"&&o.components[0]instanceof fr){let a=o.components[3];if(a&&a.edgeColors&&a.geometry&&a.visible){let l=Math.min(n,o.components[1].opacity*Cp(o));if(a.currentOpacity!==l){for(let c=0;c<a.ranges.count;c++){let p=a.ranges.start+c;a.edgeColors.setW(p,l)}a.geometry.attributes.color.needsUpdate=!0}}}}w(this,Cu,n),w(this,_c,!1),this.outlineOpacitiesDirty=!1}destroy(){s(this,ux).clear()}};_c=new WeakMap,Cu=new WeakMap,ux=new WeakMap,mx=new WeakMap;d();d();var fx=class extends Le{constructor(){super(...arguments);m(this,"userData",{entityId:""})}},TH=F.object({flipImageToFaceCamera:F.boolean().optional(),url:F.string()}),CH=F.object({type:F.enum(["Feature"]),properties:F.object({width:F.number(),height:F.number(),rotation:F.number().min(0).max(360).optional(),verticalOffset:F.number().optional()}),geometry:bu});function S4(e,r,t){F.union([F.number(),F.string()]).parse(e),CH.parse(r),TH.parse(t)}var hx=class{constructor(r){m(this,"mesh",new Ga);m(this,"imageMesh");m(this,"outline");m(this,"type","image");m(this,"instanceIndex",-1);m(this,"geometry");m(this,"material");m(this,"feature");m(this,"position",new ae);this.feature=r}get visible(){return this.mesh?.visible??!1}set visible(r){this.mesh&&(this.mesh.visible=r)}};d();function V2(e,r){return{x:e.x*Math.cos(r)-e.y*Math.sin(r),y:e.x*Math.sin(r)+e.y*Math.cos(r)}}function MH(e,r){return e.map(t=>V2(t,r))}function wH(e){let r=1/0,t=1/0,o=-1/0,n=-1/0;for(let i of e)r=Math.min(r,i.x),t=Math.min(t,i.y),o=Math.max(o,i.x),n=Math.max(n,i.y);return{minX:r,minY:t,maxX:o,maxY:n}}function OH(e,r){let t=!1;for(let o=0,n=r.length-1;o<r.length;n=o++){let i=r[o].x,a=r[o].y,l=r[n].x,c=r[n].y;a>e.y!=c>e.y&&e.x<(l-i)*(e.y-a)/(c-a)+i&&(t=!t)}return t}function T4(e,r,t,o,n){for(let i=0;i<n;i++)for(let a=0;a<o;a++)if(e[t+i][r+a]!==1)return!1;return!0}function EH(e,r,t){let o=e.maxX-e.minX,n=e.maxY-e.minY,i,a,l={...e};return o/n>r?(a=n/t,i=a*r,l.minX+=(o-i*t)/2):(i=o/t,a=i/r,l.minY+=(n-a*t)/2),{dx:i,dy:a,gridBounds:l}}function PH(e,r,t,o,n){let i=Array(t).fill(0).map(()=>Array(t).fill(0));for(let a=0;a<t;a++)for(let l=0;l<t;l++){let c={x:r.minX+l*o,y:r.minY+a*n};OH(c,e)&&(i[a][l]=1)}return i}function FH(e,r){let t=Array(r).fill(0).map(()=>Array(r).fill(0));for(let o=0;o<r;o++)for(let n=0;n<r;n++)if(e[o][n]===1){let i=0;for(let a=1;a<=Math.min(r-n,r-o)&&T4(e,n,o,a,a);a++)i=a;t[o][n]=i}return t}function DH(e,r,t,o,n,i){let a=0,l=0,c=0;for(let p=0;p<o;p++)for(let u=0;u<o;u++)if(e[p][u]===1){let f=Math.pow(r[p][u],2),h=t.minX+u*n,b=t.minY+p*i;a+=f,l+=h*f,c+=b*f}return{x:l/a,y:c/a}}function kH(e,r,t,o,n,i,a){let l=-1/0,c=null,p=e.length,u=Math.sqrt(Math.pow(r.maxX-r.minX,2)+Math.pow(r.maxY-r.minY,2));for(let f=0;f<p;f++)for(let h=0;h<p;h++)if(e[f][h]===1)for(let b=1;b<=p-h;b++){let x=b;if(!(x>p-f)&&T4(e,h,f,b,x)){let T=b*x,v=r.minX+(h+b/2)*t,I=r.minY+(f+x/2)*o,M={x:v,y:I},C=Math.sqrt(Math.pow(M.x-n.x,2)+Math.pow(M.y-n.y,2))/u,E=T*(1-i)-C*i*T;E>l&&(l=E,c={center:M,width:b*t*a,height:b*o*a})}}return c}function $2(e,r,t,o={}){let{scaleFactor:n=.9,centerPriority:i=.5,resolution:a=100,minimumSizeRatio:l=.5}=o,c=CC(t),p=e.width/e.height,u=MH(r,c),f=wH(u),{dx:h,dy:b,gridBounds:x}=EH(f,p,a),T=PH(u,x,a,h,b),v=FH(T,a),I=DH(T,v,x,a,h,b),M=kH(T,x,h,b,I,i,n);return!M||M.width<e.width*l||M.height<e.height*l?e:{...M,center:V2(M.center,-c),rotation:t,polygonCenter:V2(I,-c)}}var ih=Math.PI*2,AH=Math.PI/2,LH=Math.PI*1.5,_H=Fi(AH,2),RH=Fi(LH,2),BH=.01,C4=!1,gx=class extends ke{constructor(t,o,n,i=0,a=0,l={}){super();m(this,"rendererState");m(this,"convertTo3DMapPosition");m(this,"projectToScreen");m(this,"initialBearing",0);m(this,"naturalBearing",0);m(this,"imagePlacementOptions");m(this,"cameraFrustum",new Jg);m(this,"imageLoadingCache",new Map);m(this,"currentImageScreenBBoxes",[]);m(this,"viewProjectionMatrix",new $n);this.rendererState=t,this.convertTo3DMapPosition=o,this.projectToScreen=n,this.initialBearing=i,this.naturalBearing=a,this.imagePlacementOptions=l}createImageMesh(t,o,n,i=0,a,l){let c={width:n.width,height:n.height,center:this.convertTo3DMapPosition(a),rotation:n.rotation??0},p=this.imagePlacementOptions.mode??"default",u=(()=>{switch(p){case"fit-nearest-90":let x=(this.initialBearing-this.naturalBearing+360)%180;return x>=45&&x<=135?$2(c,l,c.rotation+90,this.imagePlacementOptions):c;case"fit-initial-bearing":return $2(c,l,this.initialBearing,this.imagePlacementOptions);case"default":case"none":default:return c}})();if(C4&&u.polygonCenter){let x=new Le(new qg(1),new Oi({color:65280}));x.position.set(u.polygonCenter.x,u.polygonCenter.y,i),this.rendererState.entityScene.add(x)}let f=new Oi({transparent:!0,depthWrite:!1,side:Ms}),h=new Os(u.width,u.height),b=new fx(h);if(b.visible=!1,b.renderOrder=1,this.getOrDownloadImage(o)?.then(x=>{f.map=x,f.needsUpdate=!0,f.map.colorSpace=zg,b.visible=!0,this.publish("image-loaded")}),b.userData.entityId=t,b.material=f,C4){let x=new Le(new Os(n.width,n.height),new Oi({color:"gray"}));b.add(x);let T=new IC;b.add(T),T.scale.set(10,10,10)}return b.position.set(u.center.x,u.center.y,i+BH),b.rotation.z=(-Ue.degToRad(u.rotation)+ih)%ih,b}getOrDownloadImage(t){if(this.imageLoadingCache.has(t))return this.imageLoadingCache.get(t)?.promise;{let o=new Promise(n=>{vl.getLoader().load(t,i=>{let a=this.imageLoadingCache.get(t);a&&!a.loaded&&(a.loaded=!0),n(i)})});return this.imageLoadingCache.set(t,{loaded:!1,promise:o}),o}}flipIfNeeded(t,o){if(t.imageMesh==null)return;let n=-o,i=t.imageMesh.rotation.z,a=Fi((i-n+ih)%ih,2);a>_H&&a<RH&&(t.imageMesh.rotation.z=(i+Math.PI)%ih)}update(t){this.currentImageScreenBBoxes=[],this.viewProjectionMatrix.identity().multiply(this.rendererState.cameraObject.projectionMatrix).multiply(this.rendererState.cameraObject.matrixWorldInverse),this.cameraFrustum.setFromProjectionMatrix(this.viewProjectionMatrix);let o,n,i;for(let a of this.rendererState.geometry3DIdsInScene)if(o=this.rendererState.geometry3DMap.get(a),o?.type==="image"){if(n=o.components[0],i=o.components[1],i.url&&n.imageMesh==null){let l=this.convertTo3DMapPosition(n.feature.geometry.coordinates),c={x:l.x,y:l.y};n.imageMesh=this.createImageMesh(o.id,i.url,n.feature.properties,n.feature.properties.verticalOffset,n.feature.geometry.coordinates,[c]),n.mesh.add(n.imageMesh),n.position.copy(n.imageMesh.position)}n.imageMesh&&(i.flipImageToFaceCamera&&this.flipIfNeeded(n,t),n.imageMesh.material instanceof Oi&&i.dirty&&(n.imageMesh.material.opacity=i.opacity))}else if(o?.type==="geometry"){if(n=o.components[0],i=o.components[1],i.showImage&&n.feature.properties?.image&&n.imageMesh==null&&n.visible&&n.mesh!=null&&n.mesh.parent!=null&&n.feature.properties?.image.position!=null&&n.feature.geometry.coordinates!=null&&n.feature.geometry.coordinates.length>0){let l=n.feature.geometry.coordinates[0].map(p=>{let u=this.convertTo3DMapPosition(p);return{x:u.x,y:u.y}}),c=this.createImageMesh(a,n.feature.properties?.image.path,n.feature.properties?.image,i.height,n.feature.properties?.image.position,l);n.mesh.parent.add(c),n.imageMesh=c}if(n.imageMesh){if(!n.visible)n.imageMesh.visible=!1;else if(i.showImage&&!n.imageMesh.visible)if(i.url){let l=this.imageLoadingCache.get(i.url);l&&l.loaded&&(n.imageMesh.visible=!0)}else n.imageMesh.visible=!0;else!i.showImage&&n.imageMesh.visible&&(n.imageMesh.visible=!1);i.flipImageToFaceCamera&&this.flipIfNeeded(n,t),i.enableImageCollisions===!0&&this.updateImageScreenBBoxes(n)}}}updateImageScreenBBoxes(t){if(t.imageMesh==null)return;let o=t.imageMesh.geometry.boundingBox;if(o!=null){let n=new ae;if(t.imageMesh.getWorldPosition(n),!this.cameraFrustum.containsPoint(n))return;let i=new Me;this.projectToScreen(i,n);let a=[new ae(o.min.x,o.min.y,o.min.z),new ae(o.max.x,o.min.y,o.min.z),new ae(o.min.x,o.max.y,o.min.z),new ae(o.max.x,o.max.y,o.min.z),new ae(o.min.x,o.min.y,o.max.z),new ae(o.max.x,o.min.y,o.max.z),new ae(o.min.x,o.max.y,o.max.z),new ae(o.max.x,o.max.y,o.max.z)],l=[];for(let b of a){let x=b.clone().applyMatrix4(t.imageMesh.matrixWorld),T=new Me;this.projectToScreen(T,x),l.push(T)}let c=1/0,p=1/0,u=-1/0,f=-1/0;for(let b of l)c=Math.min(c,b.x),p=Math.min(p,b.y),u=Math.max(u,b.x),f=Math.max(f,b.y);let h=new rt(i.x,i.y,u-c,f-p);this.currentImageScreenBBoxes.push(h)}}};d();var NH=250,Sl,yx=class extends ke{constructor(t,o){super();m(this,"cameraDirty",!0);m(this,"focusablesDirty",!0);m(this,"state");m(this,"camera");m(this,"debugEl",null);m(this,"raycasters",[]);m(this,"collisions",new Map);m(this,"focusableEntities",new Set);m(this,"debugRaycasters",!1);S(this,Sl);m(this,"update",(t=!1,o=Date.now())=>{this.focusablesDirty&&this.updateFocusableEntities(),!t&&(Date.now()-o>NH||(s(this,Sl)&&cancelAnimationFrame(s(this,Sl)),w(this,Sl,requestAnimationFrame(()=>{this.updateRaf()}))))});this.state=t,this.camera=o,this.buildRaycasters()}resize(){this.buildRaycasters()}buildRaycasters(){this.debugEl&&this.debugEl.remove();let t=new Me(this.state.canvasWidth/2,this.state.canvasHeight/2),o=new Me(t.x/1.2,t.y/1.2),n=new Me(t.x+(t.x-o.x),o.y),i=new Me(o.x,t.y+(t.y-o.y)),a=new Me(n.x,i.y),l=new Me(t.x,t.y/1.5),c=new Me(t.x,t.y+(t.y-l.y));this.debugEl=document.createElement("div"),Object.assign(this.debugEl.style,{position:"absolute",top:"0",left:"0",width:"100%",height:"100%",pointerEvents:"none"}),document.body.append(this.debugEl),this.raycasters=[t,l,c,o,n,i,a].map((p,u)=>{if(this.debugRaycasters){let T=document.createElement("div");T.style.position="absolute",T.style.top=p.y+"px",T.style.left=p.x+"px",T.style.width="10px",T.style.height="10px",T.style.backgroundColor="red",this.debugEl.append(T)}let f=p.x/this.state.canvasWidth*2-1,h=-(p.y/this.state.canvasHeight)*2+1,b=new Me(f,h),x=new Ei;return x.setFromCamera(b,this.camera),[x,b,u===0?10:u<7?2:1]})}updateFocusableEntities(){this.focusableEntities.clear();let t,o,n;for(let i of this.state.geometry3DIdsInScene)if(n=this.state.geometry3DMap.get(i),n!=null){if(n.type==="group-container"&&n.components[1]!==void 0&&n.components[1]instanceof bm){if(o=n.components[1],o.dirty===!0||o.focusMesh==null){o.focusMesh&&Ht(o.focusMesh);let a=new sr;a.setFromObject(n);let l=a.max.x-a.min.x,c=a.max.y-a.min.y,p=a.max.z-a.min.z;if(!isFinite(l)||!isFinite(c)||!isFinite(p)||isNaN(l)||isNaN(c)||isNaN(p)||l<=0||c<=0||p<=0)continue;let u=new Hn(l,c,p),f={transparent:!0,opacity:this.debugRaycasters?1:0,visible:this.debugRaycasters};if(this.debugRaycasters){let x=["red","green","blue","yellow","purple","orange","pink","brown","gray","black"];f.color=x[Math.floor(Math.random()*x.length)]}let h=new Nr(f),b=new Le(u,h);b.position.set((a.min.x+a.max.x)/2,(a.min.y+a.max.y)/2,0),b.userData={entityId:n.userData.entityId},o.focusMesh=b,n.add(b),n.components[1].dirty=!1}this.focusableEntities.add(o.focusMesh)}else if(n.type==="geometry"&&n.components[4]&&n.components[4]instanceof bm&&(t=n.components[0],o=n.components[4],t instanceof fr&&t.geometry!=null&&(o.dirty===!0||o.focusMesh==null))){if(o.focusMesh==null){let a=new Le(t.geometry);a.userData={entityId:n.id},o.focusMesh=a}this.focusableEntities.add(o.focusMesh)}}this.focusablesDirty=!1}updateRaf(){if(this.focusableEntities.size===0){this.publish("geometry-in-focus",[]);return}this.cameraDirty&&this.raycast()}raycast(){this.collisions.clear();for(let[o,n]of this.raycasters)o.setFromCamera(n,this.camera);for(let[o,n,i]of this.raycasters)o.intersectObjects(Array.from(this.focusableEntities.values())).forEach(l=>{if(l?.object!=null&&"isMesh"in l.object&&l?.object.isMesh){let c=l.object.userData.entityId,p=this.collisions.get(c)??0;this.collisions.set(c,p+i)}});let t=Array.from(this.collisions,([o,n])=>({entityId:o,weight:n})).sort((o,n)=>n.weight-o.weight).map(({entityId:o})=>o);this.publish("geometry-in-focus",t),this.cameraDirty=!1}showRaycasters(){this.debugRaycasters=!0,this.buildRaycasters()}hideRaycasters(){this.debugRaycasters=!1,this.buildRaycasters()}destroy(){s(this,Sl)&&cancelAnimationFrame(s(this,Sl)),this.debugEl&&this.debugEl.remove(),this.collisions.clear(),this.focusableEntities.clear(),this.raycasters=[]}};Sl=new WeakMap;d();d();d();d();function bx(e,r){r===void 0&&(r={});var t=Td(e);switch(!r.properties&&e.type==="Feature"&&(r.properties=e.properties),t.type){case"Polygon":return jH(t,r);case"MultiPolygon":return GH(t,r);default:throw new Error("invalid poly")}}function jH(e,r){r===void 0&&(r={});var t=Td(e),o=t.coordinates,n=r.properties?r.properties:e.type==="Feature"?e.properties:{};return M4(o,n)}function GH(e,r){r===void 0&&(r={});var t=Td(e),o=t.coordinates,n=r.properties?r.properties:e.type==="Feature"?e.properties:{},i=[];return o.forEach(function(a){i.push(M4(a,n))}),jl(i)}function M4(e,r){return e.length>1?DC(e,r):Ps(e[0],r)}function UH(e,r){var t=!0;return ki(e,function(o){ki(r,function(n){if(t===!1)return!1;t=VH(o.geometry,n.geometry)})}),t}function VH(e,r){switch(e.type){case"Point":switch(r.type){case"Point":return!WH(e.coordinates,r.coordinates);case"LineString":return!w4(r,e);case"Polygon":return!aa(e,r)}break;case"LineString":switch(r.type){case"Point":return!w4(e,r);case"LineString":return!$H(e,r);case"Polygon":return!O4(r,e)}break;case"Polygon":switch(r.type){case"Point":return!aa(r,e);case"LineString":return!O4(e,r);case"Polygon":return!HH(r,e)}}return!1}function w4(e,r){for(var t=0;t<e.coordinates.length-1;t++)if(zH(e.coordinates[t],e.coordinates[t+1],r.coordinates))return!0;return!1}function $H(e,r){var t=wd(e,r);return t.features.length>0}function O4(e,r){for(var t=0,o=r.coordinates;t<o.length;t++){var n=o[t];if(aa(n,e))return!0}var i=wd(r,bx(e));return i.features.length>0}function HH(e,r){for(var t=0,o=e.coordinates[0];t<o.length;t++){var n=o[t];if(aa(n,r))return!0}for(var i=0,a=r.coordinates[0];i<a.length;i++){var l=a[i];if(aa(l,e))return!0}var c=wd(bx(e),bx(r));return c.features.length>0}function zH(e,r,t){var o=t[0]-e[0],n=t[1]-e[1],i=r[0]-e[0],a=r[1]-e[1],l=o*a-n*i;return l!==0?!1:Math.abs(i)>=Math.abs(a)?i>0?e[0]<=t[0]&&t[0]<=r[0]:r[0]<=t[0]&&t[0]<=e[0]:a>0?e[1]<=t[1]&&t[1]<=r[1]:r[1]<=t[1]&&t[1]<=e[1]}function WH(e,r){return e[0]===r[0]&&e[1]===r[1]}var E4=UH;function H2(e,r){var t=!1;return ki(e,function(o){ki(r,function(n){if(t===!0)return!0;t=!E4(o.geometry,n.geometry)})}),t}var P4=20,ZH=5e3,z2="outdoor-system-debug-container",F4=!1,fi,Ut,sh,Rc,hi,Mu,Tl,Bc,Ln,wu,ah,lh,ch,cs,xx,Nc,gi,Cl,Ml,jc,Ix,ph,dh,D4,k4,vx=class{constructor(r){S(this,cs);S(this,fi,!0);S(this,Ut);S(this,sh,"");S(this,Rc,new Set);S(this,hi,new Set);S(this,Mu);S(this,Tl);S(this,Bc);S(this,Ln,null);S(this,wu,!1);S(this,ah,r=>{if(!s(this,Ut))throw new Error("Map not initialized");let o=[[r[0],r[1]],[r[2],r[1]],[r[2],r[3]],[r[0],r[3]]].map(c=>s(this,Ut).project(c)),n=Math.max(...o.map(c=>c.x)),i=Math.min(...o.map(c=>c.x)),a=Math.max(...o.map(c=>c.y)),l=Math.min(...o.map(c=>c.y));return[new E0.default(i,l),new E0.default(n,a)]});S(this,lh,()=>{s(this,Ln)&&(clearTimeout(s(this,Ln)),w(this,Ln,null),w(this,fi,!1))});S(this,ch,()=>{s(this,Ln)&&(clearTimeout(s(this,Ln)),w(this,Ln,null)),w(this,Ln,setTimeout(()=>{s(this,lh).call(this)},ZH))});S(this,Nc,async()=>{if(F4&&s(this,Tl)){let r=s(this,ah).call(this,s(this,Tl));W(this,cs,k4).call(this,r)}if(!(!s(this,Ut)||!s(this,wu))&&s(this,fi)&&!(!s(this,hi)||s(this,hi).size===0)){if(s(this,Cl)&&(s(this,Ix).call(this),w(this,Cl,!1)),s(this,Mu)){let r=s(this,Ut).project(s(this,Mu)),t=s(this,Ut).queryRenderedFeatures(r,{layers:Array.from(s(this,hi))});if(t.length>0){for(let o of t)s(this,gi).push(["!=",["id"],o.id]);s(this,gi).length>0&&s(this,hi).forEach(o=>{s(this,Ut)?.setFilter(o,["all",...s(this,gi)])}),w(this,gi,[]),w(this,Cl,!1),w(this,fi,!1)}}else if(s(this,Tl)&&s(this,Bc)){let r=s(this,ah).call(this,s(this,Tl)),t=s(this,Ut).queryRenderedFeatures(r,{layers:Array.from(s(this,hi))});if(t.length>0){w(this,Cl,!0),s(this,Ml).push(()=>{s(this,gi).length>0&&(s(this,hi).forEach(o=>{s(this,Ut)?.setFilter(o,["all",...s(this,gi)])}),w(this,fi,!1)),w(this,gi,[])});for(let o=0;o<t.length;o+=P4){let n=t.slice(o,o+P4);s(this,Ml).push(()=>{for(let i of n)if(i.geometry!=null&&"coordinates"in i.geometry){if(s(this,Bc)==null)return;let a;if(i.geometry.type==="Polygon"?a=iy(i.geometry.coordinates):i.geometry.type==="MultiPolygon"&&(a=kC(i.geometry.coordinates)),!a)continue;for(let l of s(this,Bc))if(H2(l,a)){s(this,gi).push(["!=",["id"],i.id]);continue}}})}s(this,ph).call(this)}}}});S(this,gi,[]);S(this,Cl,!1);S(this,Ml,[]);S(this,jc,null);S(this,Ix,()=>{s(this,jc)&&(globalThis.cancelAnimationFrame(s(this,jc)),w(this,jc,null)),w(this,Ml,[])});S(this,ph,()=>{let r=s(this,Ml).pop();typeof r=="function"&&(r(),s(this,Ml).length>0&&w(this,jc,globalThis.requestAnimationFrame(s(this,ph)))),w(this,Cl,!1),s(this,lh).call(this)});S(this,dh,r=>{if(s(this,Ut)&&r&&r.dataType==="style"&&r.type==="styledata"&&s(this,Rc).size>0){let t=r?.style?.stylesheet?.id;(!t||t!==s(this,sh))&&(w(this,sh,t),W(this,cs,xx).call(this),w(this,fi,!0))}});r&&(w(this,Ut,r),s(this,Ut).on("styledata",s(this,dh)),s(this,Ut).on("render",s(this,Nc)),w(this,wu,s(this,Ut).loaded()),s(this,Ut).on("load",()=>{w(this,wu,!0)})),F4&&W(this,cs,D4).call(this)}hideLayersUnderPoint(r,t){s(this,ch).call(this),w(this,Mu,r);for(let o of t)s(this,Rc).add(o);w(this,fi,!0),W(this,cs,xx).call(this),s(this,Nc).call(this)}hideLayersIntersectingPolygons(r,t,o){s(this,Ln)&&clearTimeout(s(this,Ln)),s(this,ch).call(this),w(this,Tl,r),w(this,Bc,t.reduce((n,i)=>{if(i.geometry.type==="Polygon"){let a=iy(i.geometry.coordinates);n.push(a)}else i.geometry.type==="MultiPolygon"&&n.push(...i.geometry.coordinates.map(a=>iy(a)));return n},[]));for(let n of o)s(this,Rc).add(n);w(this,fi,!0),W(this,cs,xx).call(this),s(this,Nc).call(this)}destroy(){s(this,Ut)&&(s(this,Ut).off("styledata",s(this,dh)),s(this,Ut).off("render",s(this,Nc)))}};fi=new WeakMap,Ut=new WeakMap,sh=new WeakMap,Rc=new WeakMap,hi=new WeakMap,Mu=new WeakMap,Tl=new WeakMap,Bc=new WeakMap,Ln=new WeakMap,wu=new WeakMap,ah=new WeakMap,lh=new WeakMap,ch=new WeakMap,cs=new WeakSet,xx=function(){if(w(this,hi,new Set),s(this,Ut))for(let r of s(this,Rc))s(this,Ut).getLayer(r)&&s(this,hi).add(r)},Nc=new WeakMap,gi=new WeakMap,Cl=new WeakMap,Ml=new WeakMap,jc=new WeakMap,Ix=new WeakMap,ph=new WeakMap,dh=new WeakMap,D4=function(){if(!document.getElementById(z2)&&s(this,Ut)){let r=document.createElement("div");r.id=z2,r.style.position="absolute",r.style.top="0",r.style.left="0",r.style.bottom="0",r.style.right="0",r.style.pointerEvents="none",r.style.zIndex="1000",s(this,Ut).getContainer().appendChild(r)}},k4=function(r){let t=document.getElementById(z2);if(!t)return;let o=document.getElementById("bbox");o==null&&(o=document.createElement("div"),o.id="bbox",o.style.position="absolute",t.appendChild(o));let n=[Math.min(r[0].x,r[1].x),Math.min(r[0].y,r[1].y)],i=[Math.max(r[0].x,r[1].x),Math.max(r[0].y,r[1].y)];o.style.top=n[1]+"px",o.style.left=n[0]+"px",o.style.width=i[0]-n[0]+"px",o.style.height=i[1]-n[1]+"px",o.style.border=`2px solid ${s(this,fi)?"red":"blue"}`};d();d();d();d();var Sx=`attribute float pathDistance;
129
+ `;var dx=class extends hC{constructor(r){super(r),this.onBeforeCompile=t=>{t.vertexShader=v4,t.fragmentShader=I4}}};var SH=80,_c,Cu,mx,fx,ux=class{constructor(r){m(this,"rendererState");m(this,"outlineOpacitiesDirty",!0);S(this,_c,!0);S(this,Cu,-1/0);S(this,mx,new Map);S(this,fx,new dx({vertexColors:!0,linewidth:1,transparent:!0,opacity:1,side:lm}));this.rendererState=r}get geometries3DDirty(){return s(this,_c)}set geometries3DDirty(r){w(this,_c,r)}update(r,t=!0){let o;if(this.geometries3DDirty){for(let i of this.rendererState.geometry3DIdsInScene){let a=this.rendererState.geometry3DMap.get(i);if(a instanceof Wn&&b4(a,this.rendererState)&&!y4(a)&&a.userData.entities3D.size>0){let l=[];for(let v of a.userData.entities3D.values()){let I=this.rendererState.geometry3DMap.get(v);if(I instanceof Mt&&I.type==="geometry"&&I.components[3]&&I.components[3].dirty===!0&&I.components[0].material!=null){let M=I.components[0].geometry,O=!1;M||(M=V2(I.components[0]),O=!0);let C=I.components[1];l.push([I.components[3],new yC(M,C.bevel?.enabled?1:SH)]),O&&(M?.dispose(),M=void 0)}}if(l.length===0)continue;let c=_i(l.map(v=>v[1]),!1);if(c==null)continue;let p=c.getAttribute("position"),u=new Float32Array(p.count*4),f=new po(u,4);c.setAttribute("color",f);let h=new Uint8Array(p.count);h.fill(0);let b=new po(h,1,!1);c.setAttribute("visibility",b);let x=0;for(let v=0;v<l.length;v++){let[I,M]=l[v],O=M.getAttribute("position").count;I.edgeColors=f,I.edgeVisibility=b,I.geometry=c,I.ranges={count:O,start:x},x+=O,M.dispose()}let T=new pm(c,s(this,fx));T.userData.isOutline=!0,a.add(T)}}w(this,_c,!1),this.outlineOpacitiesDirty=!0}for(let i of this.rendererState.geometry3DIdsInScene){let a=this.rendererState.geometry3DMap.get(i);if(a instanceof Mt&&a.type==="geometry"&&a.components[3]&&a.components[3].dirty===!0&&a.components[0].material!=null&&a.parentObject3D instanceof Wn){let l=a.components[3].geometry;if(!l)continue;let c=a.components[3];if(!c)continue;let p=c.enabled&&a.components[1].visible;if(c.visible!==p&&(c.visible=p),!c.visible)continue;let u=c.edgeColors;if(!u||!c.ranges)continue;let f=new ar(c.color);for(let T=0;T<c.ranges.count;T++){let v=c.ranges.start+T;u.setXYZ(v,f.r,f.g,f.b)}let h=a.components[1].height,b=a.components[1].altitude;a.components[1]?.bevel?.enabled||px(l,c.ranges,h,b),l.attributes.color.needsUpdate=!0,l.computeBoundingSphere(),c.dirty=!1}}let n=t?Nl(r,16,19,0,1):s(this,Cu);if((n!==s(this,Cu)||this.outlineOpacitiesDirty)&&this.rendererState.geometry3DIdsInScene.size>0){for(let i of this.rendererState.geometry3DIdsInScene)if(o=this.rendererState.geometry3DMap.get(i),o?.type==="geometry"&&o.components[0]instanceof fr){let a=o.components[3];if(a&&a.edgeColors&&a.geometry&&a.visible){let l=Math.min(n,o.components[1].opacity*Cp(o));if(a.currentOpacity!==l){for(let c=0;c<a.ranges.count;c++){let p=a.ranges.start+c;a.edgeColors.setW(p,l)}a.geometry.attributes.color.needsUpdate=!0}}}}w(this,Cu,n),w(this,_c,!1),this.outlineOpacitiesDirty=!1}destroy(){s(this,mx).clear()}};_c=new WeakMap,Cu=new WeakMap,mx=new WeakMap,fx=new WeakMap;d();d();var hx=class extends Le{constructor(){super(...arguments);m(this,"userData",{entityId:""})}},TH=F.object({flipImageToFaceCamera:F.boolean().optional(),url:F.string()}),CH=F.object({type:F.enum(["Feature"]),properties:F.object({width:F.number(),height:F.number(),rotation:F.number().min(0).max(360).optional(),verticalOffset:F.number().optional()}),geometry:bu});function S4(e,r,t){F.union([F.number(),F.string()]).parse(e),CH.parse(r),TH.parse(t)}var gx=class{constructor(r){m(this,"mesh",new Ga);m(this,"imageMesh");m(this,"outline");m(this,"type","image");m(this,"instanceIndex",-1);m(this,"geometry");m(this,"material");m(this,"feature");m(this,"position",new ae);this.feature=r}get visible(){return this.mesh?.visible??!1}set visible(r){this.mesh&&(this.mesh.visible=r)}};d();function $2(e,r){return{x:e.x*Math.cos(r)-e.y*Math.sin(r),y:e.x*Math.sin(r)+e.y*Math.cos(r)}}function MH(e,r){return e.map(t=>$2(t,r))}function wH(e){let r=1/0,t=1/0,o=-1/0,n=-1/0;for(let i of e)r=Math.min(r,i.x),t=Math.min(t,i.y),o=Math.max(o,i.x),n=Math.max(n,i.y);return{minX:r,minY:t,maxX:o,maxY:n}}function OH(e,r){let t=!1;for(let o=0,n=r.length-1;o<r.length;n=o++){let i=r[o].x,a=r[o].y,l=r[n].x,c=r[n].y;a>e.y!=c>e.y&&e.x<(l-i)*(e.y-a)/(c-a)+i&&(t=!t)}return t}function T4(e,r,t,o,n){for(let i=0;i<n;i++)for(let a=0;a<o;a++)if(e[t+i][r+a]!==1)return!1;return!0}function EH(e,r,t){let o=e.maxX-e.minX,n=e.maxY-e.minY,i,a,l={...e};return o/n>r?(a=n/t,i=a*r,l.minX+=(o-i*t)/2):(i=o/t,a=i/r,l.minY+=(n-a*t)/2),{dx:i,dy:a,gridBounds:l}}function PH(e,r,t,o,n){let i=Array(t).fill(0).map(()=>Array(t).fill(0));for(let a=0;a<t;a++)for(let l=0;l<t;l++){let c={x:r.minX+l*o,y:r.minY+a*n};OH(c,e)&&(i[a][l]=1)}return i}function FH(e,r){let t=Array(r).fill(0).map(()=>Array(r).fill(0));for(let o=0;o<r;o++)for(let n=0;n<r;n++)if(e[o][n]===1){let i=0;for(let a=1;a<=Math.min(r-n,r-o)&&T4(e,n,o,a,a);a++)i=a;t[o][n]=i}return t}function DH(e,r,t,o,n,i){let a=0,l=0,c=0;for(let p=0;p<o;p++)for(let u=0;u<o;u++)if(e[p][u]===1){let f=Math.pow(r[p][u],2),h=t.minX+u*n,b=t.minY+p*i;a+=f,l+=h*f,c+=b*f}return{x:l/a,y:c/a}}function kH(e,r,t,o,n,i,a){let l=-1/0,c=null,p=e.length,u=Math.sqrt(Math.pow(r.maxX-r.minX,2)+Math.pow(r.maxY-r.minY,2));for(let f=0;f<p;f++)for(let h=0;h<p;h++)if(e[f][h]===1)for(let b=1;b<=p-h;b++){let x=b;if(!(x>p-f)&&T4(e,h,f,b,x)){let T=b*x,v=r.minX+(h+b/2)*t,I=r.minY+(f+x/2)*o,M={x:v,y:I},C=Math.sqrt(Math.pow(M.x-n.x,2)+Math.pow(M.y-n.y,2))/u,E=T*(1-i)-C*i*T;E>l&&(l=E,c={center:M,width:b*t*a,height:b*o*a})}}return c}function H2(e,r,t,o={}){let{scaleFactor:n=.9,centerPriority:i=.5,resolution:a=100,minimumSizeRatio:l=.5}=o,c=MC(t),p=e.width/e.height,u=MH(r,c),f=wH(u),{dx:h,dy:b,gridBounds:x}=EH(f,p,a),T=PH(u,x,a,h,b),v=FH(T,a),I=DH(T,v,x,a,h,b),M=kH(T,x,h,b,I,i,n);return!M||M.width<e.width*l||M.height<e.height*l?e:{...M,center:$2(M.center,-c),rotation:t,polygonCenter:$2(I,-c)}}var ih=Math.PI*2,AH=Math.PI/2,LH=Math.PI*1.5,_H=Di(AH,2),RH=Di(LH,2),BH=.01,C4=!1,yx=class extends ke{constructor(t,o,n,i=0,a=0,l={}){super();m(this,"rendererState");m(this,"convertTo3DMapPosition");m(this,"projectToScreen");m(this,"initialBearing",0);m(this,"naturalBearing",0);m(this,"imagePlacementOptions");m(this,"cameraFrustum",new Jg);m(this,"imageLoadingCache",new Map);m(this,"currentImageScreenBBoxes",[]);m(this,"viewProjectionMatrix",new Hn);this.rendererState=t,this.convertTo3DMapPosition=o,this.projectToScreen=n,this.initialBearing=i,this.naturalBearing=a,this.imagePlacementOptions=l}createImageMesh(t,o,n,i=0,a,l){let c={width:n.width,height:n.height,center:this.convertTo3DMapPosition(a),rotation:n.rotation??0},p=this.imagePlacementOptions.mode??"default",u=(()=>{switch(p){case"fit-nearest-90":let x=(this.initialBearing-this.naturalBearing+360)%180;return x>=45&&x<=135?H2(c,l,c.rotation+90,this.imagePlacementOptions):c;case"fit-initial-bearing":return H2(c,l,this.initialBearing,this.imagePlacementOptions);case"default":case"none":default:return c}})();if(C4&&u.polygonCenter){let x=new Le(new qg(1),new Ei({color:65280}));x.position.set(u.polygonCenter.x,u.polygonCenter.y,i),this.rendererState.entityScene.add(x)}let f=new Ei({transparent:!0,depthWrite:!1,side:Ms}),h=new Os(u.width,u.height),b=new hx(h);if(b.visible=!1,b.renderOrder=1,this.getOrDownloadImage(o)?.then(x=>{f.map=x,f.needsUpdate=!0,f.map.colorSpace=zg,b.visible=!0,this.publish("image-loaded")}),b.userData.entityId=t,b.material=f,C4){let x=new Le(new Os(n.width,n.height),new Ei({color:"gray"}));b.add(x);let T=new SC;b.add(T),T.scale.set(10,10,10)}return b.position.set(u.center.x,u.center.y,i+BH),b.rotation.z=(-Ue.degToRad(u.rotation)+ih)%ih,b}getOrDownloadImage(t){if(this.imageLoadingCache.has(t))return this.imageLoadingCache.get(t)?.promise;{let o=new Promise(n=>{vl.getLoader().load(t,i=>{let a=this.imageLoadingCache.get(t);a&&!a.loaded&&(a.loaded=!0),n(i)})});return this.imageLoadingCache.set(t,{loaded:!1,promise:o}),o}}flipIfNeeded(t,o){if(t.imageMesh==null)return;let n=-o,i=t.imageMesh.rotation.z,a=Di((i-n+ih)%ih,2);a>_H&&a<RH&&(t.imageMesh.rotation.z=(i+Math.PI)%ih)}update(t){this.currentImageScreenBBoxes=[],this.viewProjectionMatrix.identity().multiply(this.rendererState.cameraObject.projectionMatrix).multiply(this.rendererState.cameraObject.matrixWorldInverse),this.cameraFrustum.setFromProjectionMatrix(this.viewProjectionMatrix);let o,n,i;for(let a of this.rendererState.geometry3DIdsInScene)if(o=this.rendererState.geometry3DMap.get(a),o?.type==="image"){if(n=o.components[0],i=o.components[1],i.url&&n.imageMesh==null){let l=this.convertTo3DMapPosition(n.feature.geometry.coordinates),c={x:l.x,y:l.y};n.imageMesh=this.createImageMesh(o.id,i.url,n.feature.properties,n.feature.properties.verticalOffset,n.feature.geometry.coordinates,[c]),n.mesh.add(n.imageMesh),n.position.copy(n.imageMesh.position)}n.imageMesh&&(i.flipImageToFaceCamera&&this.flipIfNeeded(n,t),n.imageMesh.material instanceof Ei&&i.dirty&&(n.imageMesh.material.opacity=i.opacity))}else if(o?.type==="geometry"){if(n=o.components[0],i=o.components[1],i.showImage&&n.feature.properties?.image&&n.imageMesh==null&&n.visible&&n.mesh!=null&&n.mesh.parent!=null&&n.feature.properties?.image.position!=null&&n.feature.geometry.coordinates!=null&&n.feature.geometry.coordinates.length>0){let l=n.feature.geometry.coordinates[0].map(p=>{let u=this.convertTo3DMapPosition(p);return{x:u.x,y:u.y}}),c=this.createImageMesh(a,n.feature.properties?.image.path,n.feature.properties?.image,i.height,n.feature.properties?.image.position,l);n.mesh.parent.add(c),n.imageMesh=c}if(n.imageMesh){if(!n.visible)n.imageMesh.visible=!1;else if(i.showImage&&!n.imageMesh.visible)if(i.url){let l=this.imageLoadingCache.get(i.url);l&&l.loaded&&(n.imageMesh.visible=!0)}else n.imageMesh.visible=!0;else!i.showImage&&n.imageMesh.visible&&(n.imageMesh.visible=!1);i.flipImageToFaceCamera&&this.flipIfNeeded(n,t),i.enableImageCollisions===!0&&this.updateImageScreenBBoxes(n)}}}updateImageScreenBBoxes(t){if(t.imageMesh==null)return;let o=t.imageMesh.geometry.boundingBox;if(o!=null){let n=new ae;if(t.imageMesh.getWorldPosition(n),!this.cameraFrustum.containsPoint(n))return;let i=new Me;this.projectToScreen(i,n);let a=[new ae(o.min.x,o.min.y,o.min.z),new ae(o.max.x,o.min.y,o.min.z),new ae(o.min.x,o.max.y,o.min.z),new ae(o.max.x,o.max.y,o.min.z),new ae(o.min.x,o.min.y,o.max.z),new ae(o.max.x,o.min.y,o.max.z),new ae(o.min.x,o.max.y,o.max.z),new ae(o.max.x,o.max.y,o.max.z)],l=[];for(let b of a){let x=b.clone().applyMatrix4(t.imageMesh.matrixWorld),T=new Me;this.projectToScreen(T,x),l.push(T)}let c=1/0,p=1/0,u=-1/0,f=-1/0;for(let b of l)c=Math.min(c,b.x),p=Math.min(p,b.y),u=Math.max(u,b.x),f=Math.max(f,b.y);let h=new rt(i.x,i.y,u-c,f-p);this.currentImageScreenBBoxes.push(h)}}};d();var NH=250,Sl,bx=class extends ke{constructor(t,o){super();m(this,"cameraDirty",!0);m(this,"focusablesDirty",!0);m(this,"state");m(this,"camera");m(this,"debugEl",null);m(this,"raycasters",[]);m(this,"collisions",new Map);m(this,"focusableEntities",new Set);m(this,"debugRaycasters",!1);S(this,Sl);m(this,"update",(t=!1,o=Date.now())=>{this.focusablesDirty&&this.updateFocusableEntities(),!t&&(Date.now()-o>NH||(s(this,Sl)&&cancelAnimationFrame(s(this,Sl)),w(this,Sl,requestAnimationFrame(()=>{this.updateRaf()}))))});this.state=t,this.camera=o,this.buildRaycasters()}resize(){this.buildRaycasters()}buildRaycasters(){this.debugEl&&this.debugEl.remove();let t=new Me(this.state.canvasWidth/2,this.state.canvasHeight/2),o=new Me(t.x/1.2,t.y/1.2),n=new Me(t.x+(t.x-o.x),o.y),i=new Me(o.x,t.y+(t.y-o.y)),a=new Me(n.x,i.y),l=new Me(t.x,t.y/1.5),c=new Me(t.x,t.y+(t.y-l.y));this.debugEl=document.createElement("div"),Object.assign(this.debugEl.style,{position:"absolute",top:"0",left:"0",width:"100%",height:"100%",pointerEvents:"none"}),document.body.append(this.debugEl),this.raycasters=[t,l,c,o,n,i,a].map((p,u)=>{if(this.debugRaycasters){let T=document.createElement("div");T.style.position="absolute",T.style.top=p.y+"px",T.style.left=p.x+"px",T.style.width="10px",T.style.height="10px",T.style.backgroundColor="red",this.debugEl.append(T)}let f=p.x/this.state.canvasWidth*2-1,h=-(p.y/this.state.canvasHeight)*2+1,b=new Me(f,h),x=new Pi;return x.setFromCamera(b,this.camera),[x,b,u===0?10:u<7?2:1]})}updateFocusableEntities(){this.focusableEntities.clear();let t,o,n;for(let i of this.state.geometry3DIdsInScene)if(n=this.state.geometry3DMap.get(i),n!=null){if(n.type==="group-container"&&n.components[1]!==void 0&&n.components[1]instanceof bm){if(o=n.components[1],o.dirty===!0||o.focusMesh==null){o.focusMesh&&Ht(o.focusMesh);let a=new sr;a.setFromObject(n);let l=a.max.x-a.min.x,c=a.max.y-a.min.y,p=a.max.z-a.min.z;if(!isFinite(l)||!isFinite(c)||!isFinite(p)||isNaN(l)||isNaN(c)||isNaN(p)||l<=0||c<=0||p<=0)continue;let u=new zn(l,c,p),f={transparent:!0,opacity:this.debugRaycasters?1:0,visible:this.debugRaycasters};if(this.debugRaycasters){let x=["red","green","blue","yellow","purple","orange","pink","brown","gray","black"];f.color=x[Math.floor(Math.random()*x.length)]}let h=new Nr(f),b=new Le(u,h);b.position.set((a.min.x+a.max.x)/2,(a.min.y+a.max.y)/2,0),b.userData={entityId:n.userData.entityId},o.focusMesh=b,n.add(b),n.components[1].dirty=!1}this.focusableEntities.add(o.focusMesh)}else if(n.type==="geometry"&&n.components[4]&&n.components[4]instanceof bm&&(t=n.components[0],o=n.components[4],t instanceof fr&&t.geometry!=null&&(o.dirty===!0||o.focusMesh==null))){if(o.focusMesh==null){let a=new Le(t.geometry);a.userData={entityId:n.id},o.focusMesh=a}this.focusableEntities.add(o.focusMesh)}}this.focusablesDirty=!1}updateRaf(){if(this.focusableEntities.size===0){this.publish("geometry-in-focus",[]);return}this.cameraDirty&&this.raycast()}raycast(){this.collisions.clear();for(let[o,n]of this.raycasters)o.setFromCamera(n,this.camera);for(let[o,n,i]of this.raycasters)o.intersectObjects(Array.from(this.focusableEntities.values())).forEach(l=>{if(l?.object!=null&&"isMesh"in l.object&&l?.object.isMesh){let c=l.object.userData.entityId,p=this.collisions.get(c)??0;this.collisions.set(c,p+i)}});let t=Array.from(this.collisions,([o,n])=>({entityId:o,weight:n})).sort((o,n)=>n.weight-o.weight).map(({entityId:o})=>o);this.publish("geometry-in-focus",t),this.cameraDirty=!1}showRaycasters(){this.debugRaycasters=!0,this.buildRaycasters()}hideRaycasters(){this.debugRaycasters=!1,this.buildRaycasters()}destroy(){s(this,Sl)&&cancelAnimationFrame(s(this,Sl)),this.debugEl&&this.debugEl.remove(),this.collisions.clear(),this.focusableEntities.clear(),this.raycasters=[]}};Sl=new WeakMap;d();d();d();d();function xx(e,r){r===void 0&&(r={});var t=Td(e);switch(!r.properties&&e.type==="Feature"&&(r.properties=e.properties),t.type){case"Polygon":return jH(t,r);case"MultiPolygon":return GH(t,r);default:throw new Error("invalid poly")}}function jH(e,r){r===void 0&&(r={});var t=Td(e),o=t.coordinates,n=r.properties?r.properties:e.type==="Feature"?e.properties:{};return M4(o,n)}function GH(e,r){r===void 0&&(r={});var t=Td(e),o=t.coordinates,n=r.properties?r.properties:e.type==="Feature"?e.properties:{},i=[];return o.forEach(function(a){i.push(M4(a,n))}),jl(i)}function M4(e,r){return e.length>1?kC(e,r):Ps(e[0],r)}function UH(e,r){var t=!0;return Ai(e,function(o){Ai(r,function(n){if(t===!1)return!1;t=VH(o.geometry,n.geometry)})}),t}function VH(e,r){switch(e.type){case"Point":switch(r.type){case"Point":return!WH(e.coordinates,r.coordinates);case"LineString":return!w4(r,e);case"Polygon":return!aa(e,r)}break;case"LineString":switch(r.type){case"Point":return!w4(e,r);case"LineString":return!$H(e,r);case"Polygon":return!O4(r,e)}break;case"Polygon":switch(r.type){case"Point":return!aa(r,e);case"LineString":return!O4(e,r);case"Polygon":return!HH(r,e)}}return!1}function w4(e,r){for(var t=0;t<e.coordinates.length-1;t++)if(zH(e.coordinates[t],e.coordinates[t+1],r.coordinates))return!0;return!1}function $H(e,r){var t=wd(e,r);return t.features.length>0}function O4(e,r){for(var t=0,o=r.coordinates;t<o.length;t++){var n=o[t];if(aa(n,e))return!0}var i=wd(r,xx(e));return i.features.length>0}function HH(e,r){for(var t=0,o=e.coordinates[0];t<o.length;t++){var n=o[t];if(aa(n,r))return!0}for(var i=0,a=r.coordinates[0];i<a.length;i++){var l=a[i];if(aa(l,e))return!0}var c=wd(xx(e),xx(r));return c.features.length>0}function zH(e,r,t){var o=t[0]-e[0],n=t[1]-e[1],i=r[0]-e[0],a=r[1]-e[1],l=o*a-n*i;return l!==0?!1:Math.abs(i)>=Math.abs(a)?i>0?e[0]<=t[0]&&t[0]<=r[0]:r[0]<=t[0]&&t[0]<=e[0]:a>0?e[1]<=t[1]&&t[1]<=r[1]:r[1]<=t[1]&&t[1]<=e[1]}function WH(e,r){return e[0]===r[0]&&e[1]===r[1]}var E4=UH;function z2(e,r){var t=!1;return Ai(e,function(o){Ai(r,function(n){if(t===!0)return!0;t=!E4(o.geometry,n.geometry)})}),t}var P4=20,ZH=5e3,W2="outdoor-system-debug-container",F4=!1,hi,Ut,sh,Rc,gi,Mu,Tl,Bc,Ln,wu,ah,lh,ch,ps,vx,Nc,yi,Cl,Ml,jc,Sx,ph,dh,D4,k4,Ix=class{constructor(r){S(this,ps);S(this,hi,!0);S(this,Ut);S(this,sh,"");S(this,Rc,new Set);S(this,gi,new Set);S(this,Mu);S(this,Tl);S(this,Bc);S(this,Ln,null);S(this,wu,!1);S(this,ah,r=>{if(!s(this,Ut))throw new Error("Map not initialized");let o=[[r[0],r[1]],[r[2],r[1]],[r[2],r[3]],[r[0],r[3]]].map(c=>s(this,Ut).project(c)),n=Math.max(...o.map(c=>c.x)),i=Math.min(...o.map(c=>c.x)),a=Math.max(...o.map(c=>c.y)),l=Math.min(...o.map(c=>c.y));return[new P0.default(i,l),new P0.default(n,a)]});S(this,lh,()=>{s(this,Ln)&&(clearTimeout(s(this,Ln)),w(this,Ln,null),w(this,hi,!1))});S(this,ch,()=>{s(this,Ln)&&(clearTimeout(s(this,Ln)),w(this,Ln,null)),w(this,Ln,setTimeout(()=>{s(this,lh).call(this)},ZH))});S(this,Nc,async()=>{if(F4&&s(this,Tl)){let r=s(this,ah).call(this,s(this,Tl));W(this,ps,k4).call(this,r)}if(!(!s(this,Ut)||!s(this,wu))&&s(this,hi)&&!(!s(this,gi)||s(this,gi).size===0)){if(s(this,Cl)&&(s(this,Sx).call(this),w(this,Cl,!1)),s(this,Mu)){let r=s(this,Ut).project(s(this,Mu)),t=s(this,Ut).queryRenderedFeatures(r,{layers:Array.from(s(this,gi))});if(t.length>0){for(let o of t)s(this,yi).push(["!=",["id"],o.id]);s(this,yi).length>0&&s(this,gi).forEach(o=>{s(this,Ut)?.setFilter(o,["all",...s(this,yi)])}),w(this,yi,[]),w(this,Cl,!1),w(this,hi,!1)}}else if(s(this,Tl)&&s(this,Bc)){let r=s(this,ah).call(this,s(this,Tl)),t=s(this,Ut).queryRenderedFeatures(r,{layers:Array.from(s(this,gi))});if(t.length>0){w(this,Cl,!0),s(this,Ml).push(()=>{s(this,yi).length>0&&(s(this,gi).forEach(o=>{s(this,Ut)?.setFilter(o,["all",...s(this,yi)])}),w(this,hi,!1)),w(this,yi,[])});for(let o=0;o<t.length;o+=P4){let n=t.slice(o,o+P4);s(this,Ml).push(()=>{for(let i of n)if(i.geometry!=null&&"coordinates"in i.geometry){if(s(this,Bc)==null)return;let a;if(i.geometry.type==="Polygon"?a=iy(i.geometry.coordinates):i.geometry.type==="MultiPolygon"&&(a=AC(i.geometry.coordinates)),!a)continue;for(let l of s(this,Bc))if(z2(l,a)){s(this,yi).push(["!=",["id"],i.id]);continue}}})}s(this,ph).call(this)}}}});S(this,yi,[]);S(this,Cl,!1);S(this,Ml,[]);S(this,jc,null);S(this,Sx,()=>{s(this,jc)&&(globalThis.cancelAnimationFrame(s(this,jc)),w(this,jc,null)),w(this,Ml,[])});S(this,ph,()=>{let r=s(this,Ml).pop();typeof r=="function"&&(r(),s(this,Ml).length>0&&w(this,jc,globalThis.requestAnimationFrame(s(this,ph)))),w(this,Cl,!1),s(this,lh).call(this)});S(this,dh,r=>{if(s(this,Ut)&&r&&r.dataType==="style"&&r.type==="styledata"&&s(this,Rc).size>0){let t=r?.style?.stylesheet?.id;(!t||t!==s(this,sh))&&(w(this,sh,t),W(this,ps,vx).call(this),w(this,hi,!0))}});r&&(w(this,Ut,r),s(this,Ut).on("styledata",s(this,dh)),s(this,Ut).on("render",s(this,Nc)),w(this,wu,s(this,Ut).loaded()),s(this,Ut).on("load",()=>{w(this,wu,!0)})),F4&&W(this,ps,D4).call(this)}hideLayersUnderPoint(r,t){s(this,ch).call(this),w(this,Mu,r);for(let o of t)s(this,Rc).add(o);w(this,hi,!0),W(this,ps,vx).call(this),s(this,Nc).call(this)}hideLayersIntersectingPolygons(r,t,o){s(this,Ln)&&clearTimeout(s(this,Ln)),s(this,ch).call(this),w(this,Tl,r),w(this,Bc,t.reduce((n,i)=>{if(i.geometry.type==="Polygon"){let a=iy(i.geometry.coordinates);n.push(a)}else i.geometry.type==="MultiPolygon"&&n.push(...i.geometry.coordinates.map(a=>iy(a)));return n},[]));for(let n of o)s(this,Rc).add(n);w(this,hi,!0),W(this,ps,vx).call(this),s(this,Nc).call(this)}destroy(){s(this,Ut)&&(s(this,Ut).off("styledata",s(this,dh)),s(this,Ut).off("render",s(this,Nc)))}};hi=new WeakMap,Ut=new WeakMap,sh=new WeakMap,Rc=new WeakMap,gi=new WeakMap,Mu=new WeakMap,Tl=new WeakMap,Bc=new WeakMap,Ln=new WeakMap,wu=new WeakMap,ah=new WeakMap,lh=new WeakMap,ch=new WeakMap,ps=new WeakSet,vx=function(){if(w(this,gi,new Set),s(this,Ut))for(let r of s(this,Rc))s(this,Ut).getLayer(r)&&s(this,gi).add(r)},Nc=new WeakMap,yi=new WeakMap,Cl=new WeakMap,Ml=new WeakMap,jc=new WeakMap,Sx=new WeakMap,ph=new WeakMap,dh=new WeakMap,D4=function(){if(!document.getElementById(W2)&&s(this,Ut)){let r=document.createElement("div");r.id=W2,r.style.position="absolute",r.style.top="0",r.style.left="0",r.style.bottom="0",r.style.right="0",r.style.pointerEvents="none",r.style.zIndex="1000",s(this,Ut).getContainer().appendChild(r)}},k4=function(r){let t=document.getElementById(W2);if(!t)return;let o=document.getElementById("bbox");o==null&&(o=document.createElement("div"),o.id="bbox",o.style.position="absolute",t.appendChild(o));let n=[Math.min(r[0].x,r[1].x),Math.min(r[0].y,r[1].y)],i=[Math.max(r[0].x,r[1].x),Math.max(r[0].y,r[1].y)];o.style.top=n[1]+"px",o.style.left=n[0]+"px",o.style.width=i[0]-n[0]+"px",o.style.height=i[1]-n[1]+"px",o.style.border=`2px solid ${s(this,hi)?"red":"blue"}`};d();d();d();d();var Tx=`attribute float pathDistance;
130
130
  attribute vec3 pathNormal;
131
131
  attribute vec3 pathTangent;
132
132
 
@@ -142,7 +142,6 @@ uniform float pulseLength;
142
142
  uniform bool pathIsVertical;
143
143
  uniform bool displayArrowsOnPath;
144
144
  uniform vec2 cameraParameters;
145
- uniform float flattenFactor;
146
145
 
147
146
  varying float zoomLevel;
148
147
  varying float radius;
@@ -150,6 +149,7 @@ varying vec2 fragTexcoord;
150
149
  varying float fragTopTextureU;
151
150
  varying float fragPathDistance;
152
151
 
152
+ float flattenFactor = 0.0;
153
153
  // Map the x value from the range [xMin, xMax] to the range [yMin, yMax] using
154
154
  // linear interpolation/extrapolation.
155
155
  //
@@ -184,16 +184,16 @@ void main() {
184
184
  // path normal.
185
185
  float height = dot(adjustedPosition - origin, pathNormal);
186
186
 
187
- // Flatten the bottom half of the path entirely so that it's flat
187
+ // For horizontal paths, flatten the bottom half entirely so that it's flat
188
188
  // against the floor. This makes the path look nicer when it's
189
189
  // semitransparent behind opaque geometry, so you don't see it
190
- // peeking through.
191
- float desiredHeight = max(height, 0.0);
192
-
193
- desiredHeight = desiredHeight * flattenFactor;
194
-
195
- float flattenMagnitude = height - desiredHeight;
196
- adjustedPosition = adjustedPosition - pathNormal * flattenMagnitude;
190
+ // peeking through. For vertical paths, preserve the full tube geometry.
191
+ if (!pathIsVertical) {
192
+ float desiredHeight = max(height, 0.0);
193
+ desiredHeight = desiredHeight * flattenFactor;
194
+ float flattenMagnitude = height - desiredHeight;
195
+ adjustedPosition = adjustedPosition - pathNormal * flattenMagnitude;
196
+ }
197
197
 
198
198
  // Transform the vertices into NDC.
199
199
  vec4 mvPosition = modelViewMatrix * vec4(adjustedPosition, 1.0);
@@ -210,7 +210,7 @@ void main() {
210
210
 
211
211
  radius = mix(nearRadius, farRadius, zoomLevel);
212
212
  }
213
- `;d();var W2=`#define ARROW_FADING_POINT 0.15
213
+ `;d();var Z2=`#define ARROW_FADING_POINT 0.15
214
214
 
215
215
  uniform float complete;
216
216
  uniform float nearRadius;
@@ -492,7 +492,7 @@ void main(void) {
492
492
  }
493
493
 
494
494
  gl_FragColor = vec4(0.0, 1.0, 0.0, opacity);
495
- }`;var L4="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAAAAAB5Gfe6AAAQkHpUWHRSYXcgcHJvZmlsZSB0eXBlIGV4aWYAAHjarZpZciQ7rkT/uYpeAicQ5HI4mr0dvOX3ATOl0li3q3SVJkUqFMEBcHc4IuX2///fcf/hK7cSXRatpZXi+cott9h5U/3j63EMPt+fL1/h+fPdeff6NnJMHNPjD2U/7+qcl183aH6eH+/PO52PN7E+B3qZ+Tlgspkjb57X1edAKT7Oh+fvrj3v6/nNdp7ftd057abHnz78npVgLGG8FF3cKSTPz2oXJFaQWuocCz9D0mhnEu8Tx54k6dexc98F77vY+f48n96HwvnyvKB8iNHzfJCvY3cj9HZF4dfM7/6QZ4j+7deb2J2z6jn7sbueC5Eq7rmpl63cd1w4GCrd2wov5Vt4r/fVeFW2OMnYIpuD13ShhUi0T8hhhR5O2Pc4w2SJOe5IuGOMM6Z7rhL+FudNSrZXOFFJz3KpkqtJ1hKn4+tawp233flmqMy8AlfGwGCBOz693Fcn/+b1OtA5Bt0QfH2NFeuKFnCWYZmzn1xFQsJ5xlRufO/LvcGNf5PYRAblhrmywe7HY4gh4Re20s1z4jrx2fkHNYKu5wCEiLmFxYREBnwJSUIJXmPUEIhjJT+dlceU4yADQSSu4A65SamQnBptbu7RcK+NEh+nkRYSIZBGSQ0EIlk5C/jRXMFQlyTZiUgRlSpNekklFymlaDGN6po0q2hR1apNe001V6mlaq211d5iS0iYtNLUtdpa651JO0N37u5c0fuII408ZJSho442+gQ+M0+ZZeqss82+4koL+q+y1K262uo7bKC085Zdtu662+4HrJ108pFTjp562umvWXtm9X3WwofM/T5r4Zk1y1i+1+mvrHFa9WWIYHIiljMyFnMg42oZANDRcuZryDla5ixnvkVIIZGsBbHkrGAZI4N5hygnvObuV+Z+mzcn+Y/yFr/LnLPU/RuZc5a6Z+Y+5+2LrK1+K0q6CTIWWkx9OggbF+zaY+1Wk/766H46wF8ONFY+O8hBMEc7oc4Vdh+8JsE+PUSrVjr70Zz1+H56PH3o9sRR1ql5Ha8bUMQxpe89Tki8Sb0tE23cw3DcfEo+ugnj2G3WEmononVfoag71pVjR+EmAE53eT5tqYfEHl/7ThMusaI+St0jktFa9gKnreiQqCNpZ2mJdSkbaiK6DrovYR4/JhJfRsx5d5EVZnEIPetHnU5KynJPTSuCPuC0lOuXH7n1DNq7DpUtHbhM5lDA0c2bnDCJoOObMnyj+aPjPwx0yiDUxKKsg35VnRnBEVhonKwK5hOk5NttUrhr2+tMOXkPJb1RZ+iAelYjL2MuO3pGRQ78GdxwOOaTAcJZcewq7ilB1RJCSozUdSEdwVJVb6asiBsHH1Bqgbiv3Cmkkis6ktVnZGRRwMNJjUA3Ao2127YWdhAIblxF51hzMcZsVZc0r0dJo5Liqfn41Q+q193SGhhkMkgaLJRNnEpqBtyVvbcVffIk+LE9QPFBTMTQe0aWkMXMnx3dy5sfHreDE60Ql50E+SqRcmfK16L2p0Ol8JFATu3qASXy7SvmiGW2cdMBxsty44CvtLogfGlv7WkCSV0WId2270EaD5Ym40cs+SAwZuNjPSTywAvEfLmzQhtLDntfCnhl/fNmUNnzyA2g76Zn0SP+c+I6bCC0FONUQ4L50e95dif+DH/m9htQjBEhPPpOjYjmm2ChbfEMIUaYtAIxmWJHlilLU8ZRs9pCsHbDpFaRgZljz2QandjDIBPZDGTuoZW1KdlYh52ALzisKJRNWSQmLAWx8iv9mGttT15bBc2oxd57bZtVF98CYtK3UH22Yd/A7WaKa+ZjNTOXEzNhMJ5kmQOvfzsbxbZALJ2xwGBjX2HFQybhi7kpbA7DVpS3RxMJwFyHwGk5gs6a4lrRHVqhYT0QTJC9UZcC9Yrelkn6yXch68NKNtG7CiU3vf/zMZAYXPWdrR9XZ/ctMV1sJQ2wJEGxzaHs7LmmHIwnUwbwnNAapBY9xhE19DNJW3ua0dDk/AjwITacR0PqZxkbyJ+E5jYbxI84x1TBE+y90hwDCYZIM0tqAKPZfCzFrbH8kYCm3eqQkZ2+2GovcL8Suokyg8yyCJes6dcouSLiNSLb0ETJU+/N/WFsBBSOXBbm9Cwp4CzlOag7ro7R2vC19nSsCPmAjIEMiobFwaoVXhjTU2XMpgEsDH/L3Sx54OCTMUSXI/IIA2V4QcLQpwVz12pInI0bY56pIQ2BSGRLL+yLfZ7JkiimbK+aepsbwRStpokx5gCqe1hjdMAwcINbkk5jmedrNRAG5pUXPe0sZIoXy1h7lSDxApzheg24JeDNtDS1oBDBUC4iWZFilBPhZx0Kqx2lihpbG9q4sYidksCN4yRYhNM4nxfBbTi4E3AT6B3igbvs9Gv8ZkHsIfdlep+2HelEDbkJdNjqZQ90B7k6OIoFfkkPNoY+z0gzACa1f2qcBYxVJpT2QQgS19dKQlbC24S92xiEAFRKB5Uy1qrBgOtwIge55G0kRPfIytGx0tMOrGfrijB2FHOk/TKcMjDTMPeBo4FnXD5cQ8vtdgoAN0yuzZQHQI09wm/5vAB6RHyI9rYKiZ6YWC6rbaiLmDtoaToC1bViXQFNtgWsOfEEKCleC3GWPSfgQWRQWMgw/9FDgvOZrFAT3SmsA3DLbqlsSppQG5QeOjPXavUUkxF/qgLM05vW5o7UakuBqo2ZW8Nj0LB7imVJC9QSA+wd7RPztIUZ80xQZq0ROrc8CSVncWzkTA/RwmunldCPAQKjqVC7bhRuTIv0plbk7gOX4m5OAi2YesYZ0KBQRToG8iv9x8dgGtgECYRBeEU87OxoSc8epu+s7Mq/MN0VbBT19dii7ekO66UZwdAMtoAVQd13J5nwZe98OgGslmVqAGBkeLZNVNVlWpV18qihntXKnBZvrDIVgFpx4q5poLqREOVplMPSpTF2KvjBAzDpprkruXIaaUmUD4Xo2yrGWcYlixKIwRFjl0jPQhKznUXZAoSjlg9c/NwAI4p3Q/w5bCNfhUZS7bGfqesHqKAlyZZxZgNrhGevZXccaqBys4NEqB3Vqfptji9uUrhCL6yXFqxtm0hhLyYU3Tjd8I/HZaWD1oyVjnG5hhpCN5yHSf8BQUZlVNd00OP4M0TK+JSM7iqWi01SinFkCQXWxiZJLqqAHiEt3G3I2WYd46KU9pIJIOkoRQYCcEAAPguHo0Y4k8Hl6SW50MoW0uZU8jJOUghKo38Nl5ZSwsJNAUC2/lFZWkfMjrU8dFrTjHpJnUrLCILQIxINiYdQlDXaE/razQ4jjQluN5jW1Eh/S7yYvI5gigSjdLYU9TiFXAcHjISiLhQd9obb3OQmwY+YqVwiBMCkOGLXaK/ljBShh56c1g0uyIb2lBRKO7ZTAFncw5c5UGjGSy3CsI1Jt2mtruZkfhBZmbR+842Yu1eDiWEl0V6LZcGem6Ct+LW4Wy3oAjyNObazKBHomhJ3HMKEKHgiGksH+Ig1nTidfNMyA+oYHqVFaRGLiQreVLc9GvQgftKjW9cfUSKNYL80rqU7Um2rwqQJR1ai31Wq7vzKJEsFHDj0bAEMUKXgvfD5bWbaLPBTKz1Nk/Fg+GUZvUzFw80CLaKtPAACVAWrismh863FU4IJ0716SXBUNVb/SDMVvZgDt34CXoOq1JKvg0n08gPHTwXBNgD5W8pZZ8E9EVWcv1DZMB2NFysIwkqBSaH5QRmsAHdkHB+UANvLJvFpQKAahSmYTLEd2AFO+5rsqRRU6sVv5IP0wsSPLcWsbC1Y95mte71CUm6RJJWwkg6Q4k+xWMM0ByElJPQ6j2ED5hY42ALpZRytx9RlgQlJLijzhKi5eX5JBSIRGfo9o2xhd/0aWku8OS+4D9ZnovHDQMPaYo4qm2mlZbUnd7pR6oQj29Z2BqJ9n3LRT+MTLu3IR+ZP2TCPh3EDw8H1NHpoT7FibNYU8WHd9ESHcY12aDOQCUBddi4Ucp+4yuzz8ybcCCu1h8zvzXhDN4HYLq1R+U0xzUqg5QSA3iSBgdDouy55Ifx0DaeEhgezxBRGmoEJ6AJitVuzwtKPlUskHgU2F0LS7AFIwW5jPu0RUL7sp+fkNk0ee8P6uXYgl40WM+cdCOW21r13e0ivt0ff/mYcUfrQZWs2BiN6G+MDTGz1BKORmUTNQp9YGSHFxAeTkQrKd6FoVUogyytW25OLy3OpaO5oZCQp46aPzb5LnJiFEIwAKkmbYVYIjzVv3vj7rA6HignEeQAXTAHKDhoD7Uujh0QjtsB6fTP1NzO7T1Nzq4F1GnfHdXCG1Yxjwdtjf+PGRGTzEtEAUCz7KLfTdItLwCXuSOAzVjaZB6LvbUZhYGWmifSZlcMDnGHPd6gPeiK9erhpiw7ZP9ahTrMhFDa1J53m9ri2DloziqGETTcVSppCbTDDjExg6RrZ6cPEzB8XArEjQSB29odrUoLyoS/65RfM9fprGGjlHpbhGgbYD8MtmW1eFcAWX5dbcMHcl8sUI2k+H7GPW9VrArw3G+BefcCrCaAT/N53YLvP26Uy0kMFnDEZz0DJkmQqEOlL7SlKweYhH8gxpYeAYi0f9magqPbMYZuUI6007lSZQoyoGfYQHsNRzHXR3MMINTSMZpq1KD2A5MDJgtMLdRU6R4CEOJcKGiIJ7K6P/vAM6xpECHI8rRHsaEj6smkngAUjXTzrRoSI48ZpHOqgOY5OejKVdpnmiYUChQnVdIPa6ekGqRSRgEO119oDHOiIUQ5ciYVgaF1oG8Udo8WYtD+DEi8D/w8rAJE2k2PoyV0oMtpauxreaFjpujAvxFlwBhjuNqM9P0IfI5iD8Nh8y1kG4igjJkDNkOijnlLhItAd9lhRd670yNRTu95cR/Xuu0c5WO4DEFk5YQAPtLvU4TYPGRh4APPEDNiuuwR6SC21JoFbQBBMr+zJmT32QplNI6p16PbculN/pCX1wAyTWGTeJ774aln0gvQikw7TmkfsNbdQNs0adutYUDqNtGc0RqngUYdhUYuHSL1/eLrgvqDTC5neu++vufRkEgP9D2T64Kg/c4n+s7k3dDr3me8nOr0c72MRNmgF7D4WySPP0YAI/bI4eixwc7K13QiRiL85A8fnSsUj+mvTrsZtVUEQZ6sTpVafW8nYJZyaZS0U+0xIb6et9PhhtoObozQbjKAoDf6eiFgx1UUvpUYj1GweH0MNMrofhynfWn7+KYu7n5r83hN9aqm+6qjcH7dUlgvZVLV3xqq4fbP16qv+eofuTz43eomAqfS7GBAB9zEE31WJ37eVIPtdGN5A8nMYPvvLt8t2/V/6gM19G4g/hIL7UXf9JgbuLRZ+AoW//AzyMxTcWyz8BAruLRZ+AgX3r3y2+mT/PwfiN1DoVI+QT3CZDmvb8022JeYb6HiQPQpPPvboFB+i1MZdcqWZqthHmix6vttw0UAI1z8oEnGwVe++c7JamxslC+8xKJE41XJmug1npz+6CUAKyURd9gSxo+kWxvtZth848GBlws/0SKjYhmbZ9IiV+mcGBSdWHk8sqSr2zz5J7QME/0yD+z4Pe+JuGn1MV/vUyZwOHojWPlmPXgf9CuoeN9UAT+FGwaLg44v3dWe6QpvuL3Ln/p3k/2AgqNDcfwHgqUmIIqn+hwAAAAJiS0dEAACqjSMyAAAACXBIWXMAAAsSAAALEgHS3X78AAAAB3RJTUUH4wYRESAMujenGAAAB9FJREFUeNrtnWlsFVUUx899fS1gUoKioEY+WBRUEohGkUhAKxgEjSgGoRGB4AJCNKAIJBJZJSiyGYMKKkIoLlEUKhUraxFkKUE2kU1aCrRgW2jpg9f29R2/sBTo67v3zL2zvfP73MzM+XU6mf+5504BGIZhGIZhGIZhGIZhGMZGGq3JvSmR62++BXHH7Ylbf9ouRMT99yVq/e0PICIiHumUmPV3PooXOf5EItafXoCXOdUn8ep/pgjrUDY40ervX4JXUTEiocoXL5/FawiNEwlU/6hzeB3hqQljQIwJYT3UzEkQA2JiGOslsiAhDIgZ1RiD6NIEMBD8NIKxyQr6vv7FtdgQa31uILg0ig2zsZmv4//yePUj7rjNv/U3yUEJ/r7Xr/XfvBmlOPKwT+vfhpIUdvdj/Wm7UZpTz/mv/g4HUYGyQb5r/+SjEhXD/VV/j5OoSGisj16LRe9iVCY8xTcGxIulSKBmtk8MiKHlSMIn8ViMqkQivojHgfcuIJ0VAc/XPzmMVljrcQOBmdVojY1NvVx/8mcRtEqeh+NxypJatM6+ezxb/7Io6uBwR4/e/1moicJunvz956A2ip/1Xv3Nt6JGSgd6rf47/0KtlHssHrfZi5rxVDwWDx5C7XgoHotHC9AANbO8YqBXERohMt8bv/8X/kNDRDM9cA+IgWVojhWuNxAYXo4mWePyeBwYHUKz5Lo6HidNvICmybvVxfXPqEbz7Gvr2vrn1KAdHH7IpX//8yNoD8dcGY+TM6NoF26MxzLTL26Mx0majtM4q5ed7yhNulVsd5WAxqset/mGS6/d5CIBLXI62/7I6ZKyzjUC0rIfsP+hE3zkxt9c8vy7tPnJbiKfuyP+Xdn8ZDeuiMei+zF0juWOGyBNv+iMxw4bEBkl6CzOxmPx6ll0mryWDtb/ViU6z17H4rEYG0I3cMiheByYFEZ34Ew8Dn5UjW7BiXisY/rFDfGYmgWCCwcngXto0q08z1YBSUsy3NWgb5Qe2WSjgJRlfdy2RJPcNXm9bQIarexpsP5VdxHjcbMcm2Q3/5P64i71U8k/ELuLNsVjcct2cnST+rGg+Jo4XmhLPBZ376GOfoOkAIB5NWTHxuu/nzj9ElkA8gLgA+pLlvF43IU4/VI9G1QEAHnIPjfVaP1PnqRdVngKqAkActDMa2Hw/u9zijjjNg5UBcBr1FbD3jbG6h9QSruk8ovfyFESABnUWSNT8VgMI06/lF7aBqomAJ4n3m+G4nHgbeJfZfHljcCKAqDHcWo87m2g/gnE53LhlS+lqQqATv9S4/FL2u//qcT2T34XoAuAdvuJBspf11z/LOKbyYG6q4bqAqDVTqKByjFa21/U6ZfdaWBNADTdTDQQnqSv/pRMYjrZevVLCUUAiF+JBqpnaqv/J2I+zb3mxZwkAMTPDq8ep1A3P/1y3ZOEJABgiaPxuOnvxLN/B7oEwELq/sPl1utvSdz8VPsl6BMAn1AbBKut1t96F+3ENXOFTgFiehXRwAZL8Vi0JW5+qppW7+HIAgDGnyca2G4hHouOh2knvTARdAuAkedsj8cinTj9Ujka9AuAV87YHI/F08TNT2eHgQkB0I/aIDhGmuIU/YnnKxkAZgTAU8SGHC0eDyJufiqKfTKrAqBrPtFAiXo8HlFBO1VBA7ebZQHQifhUVo7H4p2QgQeOdQHQbp8t8Tg4idj+2dPgwJIGAdBqhw3xmDz9EuelQ4cASP3DeDwOziW+ecdbldEiACDbcDxOWkBs/8QNHpoEAPXjLNFMmfpv+IZ4+PjRU5cAWGwwHqcQNz/J2NUmAMgjavHjMfEPTGpvvz4BQH1MrzMkoHoW2CsAppEaBFskemQUA+HJYLcAeJfQINgpNVuvbiA0FuwXAG8qNwh2S07WqxqQ/saPXgEwRDGu7W8te2Q1A6XSH0HWLAD6nVa5zoPS9asZKJb/DLZuAdDzhPx1Hu2gkobkDRQq/J8w7QJAfstevuI3+WQN1F39dkAAtP9H7jpPdFVtiMgZOKC0Z9aAAEiT+mrbScLQjIyBXWngtABokRf/kKefonRF4xvYqrjmYEQApG6Md8SyvrS+eDwDG5QbzUYExL3QMxnUlZGGD5wFbhEADQ7YVwyhr401YCD6LbhHACyK3SA4N9TK6mhMA5EvwE0CYF6sBkFopLXl8exYq9/gLgHwYf3x+PxoqwMC9RoIvw9uE1D/gH3VeOsjItnSq9/OCqhvwL5qAoABA5XU28qsAHjj2tW8mukABgzEXP12WgAMvrpBEPkYwICB2KvfjguAvnUH7GvnARgwUGRhEt24gLoD9tGvAAwYKLDyySzzAqDzpQH76CIAAwYOWtqNYoMAaH9xwP57AAMG9ljbj2SHALhjJyLijwAGDGyzuCPNFgGQuhlxpfw1yR94dfAxi5cmojI/lRyx+rtaX9XDhADr2CVABc//JycWwAJYAAtgASyABbAAFsACWAALYAEsgAWwABbAAlgAC2ABLIAFsAAWwAJYAAtgASyABbAAFsACWAALYAEsgAWwABbAAlgAC2ABLIAFsAAWwAJYAAtgASyABbAAFsACWAALYAEsgAWwABbAAlgAC2ABLIAFsAAWwAJYAAtgASyABbAAFsACWIDToH8FyJUWtVWAALedDoFhGIZhGIZhGIZhGIYxyf+YwEMsIhMo/AAAAABJRU5ErkJggg==";var YH=new bp;function _4(e,r,t){let{breakpoint:o,width:n,accentColor:i,completeFraction:a,isVertical:l,visibleThroughGeometry:c,dashed:p}=r,{color:u}=t,f=!0,h=0,b=1/0,x=r.displayArrowsOnPath,T=!0,v=x,I=typeof n=="object"?Number(n.output[o])/2:n/2,M=typeof n=="object"?Number(n.output[o+1]??n.output[o])/2:n/2,O=(t.altitude??0)+JH,C=0;e[0].z+=O;for(let H=1;H<e.length;++H){e[H].z+=O;let P=e[H].x-e[H-1].x,q=e[H].z-e[H-1].z;if(l)C+=Math.sqrt(P*P+q*q);else{let K=e[H].y-e[H-1].y;C+=Math.sqrt(P*P+K*K+q*q)}}if(!l){let H=e[0],P=e[e.length-1];e.push(P.clone().setZ(P.z-.01)),e.unshift(H.clone().setZ(H.z-.01))}let E=new cC;v&&(E=YH.load(L4),E.colorSpace=zg);let _=new ar(u),G=new ar(i),R={vertexes:{type:"f",value:1},resolution:{type:"v2",value:new Me(1,1)},cameraParameters:{type:"v2",value:new Me(h,0)},complete:{type:"f",value:f?0:1},color:{type:"c",value:_},pathLength:{type:"f",value:C},nearRadius:{type:"f",value:I},farRadius:{type:"f",value:M},nearZoom:{type:"f",value:h},farZoom:{type:"f",value:b},pulseColor:{type:"c",value:G},pulse:{type:"f",value:0},pulseLength:{type:"f",value:.075},pathIsVertical:{type:"b",value:l},arrowAnimationTimer:{type:"f",value:0},arrowTexture:{type:"t",value:E},displayArrowsOnPath:{type:"b",value:x},showPulse:{type:"b",value:T},opacityMultiplier:{type:"f",value:1},dashed:{type:"b",value:p}},N=new hC(e);N.curveType="catmullrom",N.tension=0;let X=30,z=8,ee=X*e.length,re=new yC(N,ee,I,z,!1),ue=new Float32Array(re.attributes.position.count);for(let H=e.length;H<ue.length;H++)ue[H]=H;re.setAttribute("vertexIndex",new po(ue,1));let Ce=new Float32Array(re.attributes.position.count),Oe=new po(Ce,1);for(let H=0;H<=ee;H++)for(let P=0;P<=z;++P)Oe.setX(H*(z+1)+P,H/ee);re.setAttribute("pathDistance",Oe);let Pe=new Float32Array(re.attributes.normal.count*3),Fe=new po(Pe,3);for(let H=0;H<ee;H++){let P=re.tangents[H];for(let q=0;q<=z;++q)Fe.setXYZ(H*(z+1)+q,P.x,P.y,P.z)}re.setAttribute("pathTangent",Fe);let ce=new Float32Array(re.attributes.normal.count*3),Ee=new po(ce,3);for(let H=0;H<ee;H++){let P=re.tangents[H];var ye,Ge,Ie;l?(ye=P.x*P.y,Ge=-1+P.y*P.y,Ie=P.z*P.y):(ye=-P.x*P.z,Ge=-P.y*P.z,Ie=1-P.z*P.z);let q=Math.sqrt(ye*ye+Ge*Ge+Ie*Ie);q===0&&(q=1);let K=ye/q,Q=Ge/q,De=Ie/q;for(let xt=0;xt<=z;++xt)Ee.setXYZ(H*(z+1)+xt,K,Q,De)}re.setAttribute("pathNormal",Ee);let Xe=new _a({uniforms:R,vertexShader:Sx,fragmentShader:W2});Xe.transparent=!0,Xe.alphaTest=.5,R.resolution.value.x=1,R.resolution.value.y=1,R.vertexes.value=ue.length,R.arrowTexture.value.wrapS=cm,R.arrowTexture.value.wrapT=cm,R.arrowTexture.value.anisotropy=16;let se=new Le(re,Xe),nt=se.clone(),dt={...R,opacityMultiplier:{type:"f",value:.25}};dt.complete.value=1,nt.material=new _a({uniforms:dt,vertexShader:Sx,fragmentShader:W2}),nt.material.transparent=!0,nt.material.alphaTest=.5,nt.material.depthWrite=!1,nt.material.depthTest=!1,dt.resolution.value.x=1,dt.resolution.value.y=1,dt.vertexes.value=ue.length,dt.arrowTexture.value.wrapS=cm,dt.arrowTexture.value.wrapT=cm,dt.arrowTexture.value.anisotropy=16,dt.complete.value=a,se.userData=nt.userData=r.mesh.userData;let $t=r.mesh;if(!c){let H=new _a({uniforms:R,vertexShader:Sx,fragmentShader:A4}),P=new Le(re,H);P.name="stencil",P.material.colorWrite=!1,P.material.stencilWrite=!0,P.material.stencilRef=1,P.material.stencilFunc=aC,P.material.stencilZPass=Zg,P.material.stencilZFail=Zg,P.material.stencilFail=Zg,P.material.depthWrite=!1,P.material.depthTest=!1,P.userData=r.mesh.userData,$t.add(P),$t.add(nt),nt.renderOrder=0,se.renderOrder=1}if($t.add(se),l){let H=new sr().setFromObject(se),P=new ae;H.getCenter(P),$t.children.forEach(q=>{q.geometry.center(),q.position.copy(P)})}c&&(se.material.stencilWrite=!0,se.material.stencilRef=1,se.material.stencilFunc=sC,se.material.stencilZPass=Wg,se.material.stencilZFail=Wg,se.material.stencilFail=Wg,se.material.needsUpdate=!0,se.layers.disableAll(),se.layers.enable(ly.ALWAYS_ON_TOP)),re.computeBoundingBox();let k=new ae;return re.boundingBox.getCenter(k),{mesh:$t,material:Xe,center:k}}var JH=.15;var KH=.5,uh=class extends ke{constructor(t,o,n,i){super();m(this,"rendererState");m(this,"verticalDistanceDirty",!0);m(this,"convertTo3DMapPosition");m(this,"getParentContainer");m(this,"convertZoomLevelToAltitude");this.rendererState=t,this.convertTo3DMapPosition=o,this.getParentContainer=n,this.convertZoomLevelToAltitude=i}update(t,o,n,i=0){let a,l=!1;for(let c of this.rendererState.geometry3DIdsInScene)if(a=this.rendererState.geometry3DMap.get(c),a&&a.type==="path"&&a.components[0].type==="path"){let p=a.components[0],u=a.components[1],f=p.isVertical&&this.verticalDistanceDirty;if(!(p instanceof Il))continue;let h=[];if(p.dirty||u.dirty||f){if(p.mesh.parent!=null)for(let b=p.mesh.children.length-1;b>=0;b--)Ht(p.mesh.children[0]);if(p.feature.features.length===2&&p.feature.features[0].properties.parentId&&p.feature.features[1].properties.parentId){let b=p.feature.features[0],x=p.feature.features[p.feature.features.length-1],T,v,I=b.geometry.coordinates[2]||0,M=x.geometry.coordinates[2]||0;b.properties.parentId&&(T=this.getParentContainer(b.properties.parentId,!0),T!=null&&T.altitude!=null&&(I+=T.altitude,p.isVertical=!0)),x.properties.parentId&&(v=this.getParentContainer(x.properties.parentId,!0),v!=null&&v.altitude!=null&&(M+=v.altitude,p.isVertical=!0));let O=this.convertTo3DMapPosition(b.geometry.coordinates[1],b.geometry.coordinates[0],I),C=this.convertTo3DMapPosition(x.geometry.coordinates[1],x.geometry.coordinates[0],M);Math.abs(O.z-C.z)>KH&&T!=null&&T.visible&&v!=null&&v.visible&&(h=[O,C])}else{let b=p.feature.features;for(let x=0;x<b.length;x++)if(x===0||!rM(b[x].geometry.coordinates,b[x-1].geometry.coordinates)){let T=this.convertTo3DMapPosition(b[x].geometry.coordinates[1],b[x].geometry.coordinates[0],b[x].geometry.coordinates[2]||0);h.push(T)}}if(h.length>1){let{mesh:b,material:x,center:T}=_4(h,p,{color:u.color,altitude:u.altitude});p.mesh=b,p.material=x,p.position=T}p.dirty&&typeof p.width=="object"&&p.width.on==="zoom-level"&&(p.altitudeBreakpoints=p.width.input.map(b=>this.convertZoomLevelToAltitude(b))),p.dirty=!1}u.dirty&&(p.mesh.children.forEach(b=>{b.name!=="stencil"&&(b.material.uniforms.color.value.set(u.color),b.material.visible=u.visible,b.material.needsUpdate=!0)}),p.mesh.position.z=u.altitude,u.dirty=!1),p.isVertical&&p.mesh.children.forEach(b=>{b.rotation.z=-i}),p.material&&(p.mesh.children.forEach(b=>{let x=b.material.uniforms;if(b.name==="stencil"){p.materialDirty&&(x.complete.value=p.completeFraction);return}if(typeof p.width=="object"&&p.width.on==="zoom-level"){p.altitudeBreakpoints&&p.altitudeBreakpoints.length>2&&A.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 T=PC(n,p.altitudeBreakpoints?.slice(0,2)??[t,o]);p.breakpoint=T,x.nearZoom.value=p.altitudeBreakpoints?.[T]??t,x.farZoom.value=p.altitudeBreakpoints?.[T+1]??o,x.nearRadius.value=Number(p.width.output[T])/2,x.farRadius.value=Number(p.width.output[T+1]??p.width.output[T])/2}x.cameraParameters.value.x=n,p.materialDirty&&(x.displayArrowsOnPath.value=p.displayArrowsOnPath,x.pulseColor.value.set(p.accentColor),x.complete.value=p.completeFraction,typeof p.width=="number"&&(x.nearZoom.value=t,x.farZoom.value=o,x.nearRadius.value=Number(p.width)/2,x.farRadius.value=Number(p.width)/2))}),p.displayArrowsOnPath&&p.animateArrowsOnPath&&(p.mesh.children.forEach(b=>{b.name!=="stencil"&&(b.material.uniforms.arrowAnimationTimer.value=performance.now()/3e3,b.material.needsUpdate=!0)}),l=!0),p.materialDirty=!1)}this.verticalDistanceDirty=!1,l&&this.publish("animate:path")}};d();var pr,Ou,ua,Tx=class{constructor(r){m(this,"rendererState");m(this,"dirty",!1);S(this,pr);S(this,Ou);S(this,ua);this.rendererState=r}updateOne(r){if(r instanceof Mt&&r.components[0]instanceof fr&&r.components[1]instanceof _i&&r.parentObject3D instanceof zn&&(w(this,pr,r.components[0]),w(this,ua,r.components[1]),s(this,pr).detached&&s(this,pr).dirty&&s(this,pr).mesh!=null&&s(this,pr).material!=null&&s(this,pr).batchedProps!=null)){w(this,Ou,r.parentObject3D),s(this,pr).visible=!1;let t=new ar(s(this,ua).color),o=s(this,ua).opacity*Cp(r),n=new pM({color:t,side:Ms,opacity:o??1,transparent:o!==void 0?o<1:!1},1,s(this,pr).material.repeatYFactor),i=new BM(1,s(this,pr).batchedProps.positionCount,0,n),a=x4(s(this,pr),i);if(a==null)return;i.userData={entities:{0:r.id},detached:!0},s(this,pr).instanceIndex=a,s(this,pr).material.setColor(s(this,pr).instanceIndex,t,s(this,ua).topColor?new ar(s(this,ua).topColor):t),s(this,pr).mesh=i,s(this,pr).material=n,s(this,Ou).add(i),s(this,pr).dirty=!1}}update(){if(!this.dirty)return;let r;for(let t of this.rendererState.geometry3DIdsInScene)r=this.rendererState.geometry3DMap.get(t),this.updateOne(r);this.dirty=!1,this.cleanup()}cleanup(){w(this,pr,void 0),w(this,Ou,void 0),w(this,ua,void 0)}};pr=new WeakMap,Ou=new WeakMap,ua=new WeakMap;d();d();function R4(e,r,t){if(e.batchedProps?.range&&e.mesh){let o=r||1e-4,n=o/Math.max(t,1e-4);return cx(e.mesh.geometry,e.batchedProps.range,o,0),e.material&&(e.material.repeatYFactor=n),e.currentHeight=o,!0}return!1}function B4(e,r,t,o,n,i){return e.mesh&&e.instanceIndex!==-1?(e.mesh.getMatrixAt(e.instanceIndex,t),t.decompose(o,n,i),o.z=r,t.compose(o,n,i),e.mesh.setMatrixAt(e.instanceIndex,t),e.altitude=r,!0):!1}var yi,ps,Mx,wx,Ox,Ex,Cx=class{constructor(r){m(this,"rendererState");m(this,"dirty",!1);S(this,yi);S(this,ps);S(this,Mx,new $n);S(this,wx,new ae);S(this,Ox,new Xg);S(this,Ex,new ae);this.rendererState=r}updateOne(r){if(r instanceof Mt&&r.type==="geometry"&&r.components[1]?.dirty&&(w(this,yi,r.components[0]),w(this,ps,r.components[1]),r.type==="geometry")){let t=!1;s(this,ps).height!==s(this,yi).currentHeight&&(t=R4(s(this,yi),s(this,ps).height,s(this,ps).initialHeight)),s(this,ps).altitude!==s(this,yi).altitude&&(t=B4(s(this,yi),s(this,ps).altitude,s(this,Mx),s(this,wx),s(this,Ox),s(this,Ex))),t&&s(this,yi).mesh!=null&&s(this,yi).mesh.computeBoundingSphere()}}update(){let r;for(let t of this.rendererState.geometry3DIdsInScene)r=this.rendererState.geometry3DMap.get(t),this.updateOne(r);this.cleanup()}cleanup(){w(this,yi,void 0),w(this,ps,void 0)}};yi=new WeakMap,ps=new WeakMap,Mx=new WeakMap,wx=new WeakMap,Ox=new WeakMap,Ex=new WeakMap;d();var QH={showPolygonLabelTextAreaMesh:!1,showEnvMap:!1,showCollisionBoxes:!1},Px=class{constructor(r){m(this,"state",QH);m(this,"core");this.core=r}update(r){let t={};for(let[o,n]of Object.entries(r))o in this.state&&this.state[o]!==r[o]&&(this.state[o]=n,t[o]=n);this.handleUpdate(t)}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.getSystems().collisionSystem.showCollisionBoxes(),this.core.render()):this.core.getSystems().collisionSystem.hideCollisionBoxes())}};d();var mh=9,qH=!1,N4=.1;function ez(e,r,t){for(let o=0;o<r;o++){let n=(t&16711680)>>16,i=(t&65280)>>8,a=t&255;e[o*3]=n/255,e[o*3+1]=i/255,e[o*3+2]=a/255}}var Fx=class{constructor(r,t,o){m(this,"state");m(this,"renderer");m(this,"renderService");m(this,"pickingTexture");m(this,"pickingMaterial");m(this,"pixelBuffer");m(this,"width",0);m(this,"height",0);m(this,"scale",1/2);m(this,"color",1);m(this,"convertTo3DMapPosition");m(this,"destroyed",!1);m(this,"enabled",!1);m(this,"backgroundId",16777215);m(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 dC(this.width,this.height,{format:iC,type:nC,internalFormat:"RGBA"})});m(this,"shouldShowByXY",(r,t,o)=>{if(this.pixelBuffer==null)return!1;let n=r+(this.height-t-1)*this.width,i=this.pixelBuffer[n*4],a=this.pixelBuffer[n*4+1],l=this.pixelBuffer[n*4+2],c=i<<16|a<<8|l;return c===o||c===this.backgroundId});m(this,"activeOccluders",new Set);m(this,"update",()=>{if(!this.enabled||this.destroyed||(this.activeOccluders.clear(),this.activeOccluders.add(this.backgroundId),!this.pickingTexture||!this.pixelBuffer))return;let r,t;for(let n of this.state.geometry3DIdsInScene){let i=this.state.geometry3DMap.get(n);if(i&&i instanceof hr&&i.userData.occluderFeature!=null&&i.userData.occluderId!=null&&(this.activeOccluders.add(i.userData.occluderId),i.userData.occluderDirty)){if(r=i.userData.occluderFeature,r.geometry.type==="Polygon"){let a=R1(r,this.convertTo3DMapPosition,{color:"white",height:N4});t=this.createOccluderMesh(a,i.userData.occluderId),i.add(t)}else if(r.geometry.type==="MultiPolygon"){let a=B1(r,this.convertTo3DMapPosition,{color:"white",height:N4});t=this.createOccluderMesh(a,i.userData.occluderId),i?.add(t)}i.userData.occluderDirty=!1}}this.renderer.setRenderTarget(this.pickingTexture);let o=new ar(this.backgroundId);this.renderer.setClearColor(o),this.renderer.clear(),this.state.cameraObject.layers.disableAll(),this.state.cameraObject.layers.enable(mh),this.renderer.render(this.state.entityScene.parent,this.state.cameraObject),this.renderer.setRenderTarget(null),this.state.cameraObject.layers.disable(mh),qH?this.renderService.enabledLayers.add(mh):this.renderService.enabledLayers.delete(mh),this.renderer.readRenderTargetPixelsAsync(this.pickingTexture,0,0,this.width,this.height,this.pixelBuffer).then(()=>{if(!this.destroyed)for(let n of this.state.geometry2DIdsInScene){let i=this.state.geometry2DMap.get(n);if(i&&i?.occluderId!=null&&this.activeOccluders.has(i?.occluderId)){let a=i.components[0].projection,l=Math.floor(a.x*this.scale),c=Math.floor(a.y*this.scale),p=this.shouldShowByXY(l,c,i.occluderId);i.components[0].isOccluded=!p}}}).catch(n=>{this.destroyed||A.error(n)})});if(this.state=r,this.convertTo3DMapPosition=t,o?.renderer==null)throw new Error("No Renderer");this.renderService=o,this.renderer=o.renderer,this.resize(),this.pickingMaterial=new _a({glslVersion:lC,vertexShader:`
495
+ }`;var L4="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAAAAAB5Gfe6AAAQkHpUWHRSYXcgcHJvZmlsZSB0eXBlIGV4aWYAAHjarZpZciQ7rkT/uYpeAicQ5HI4mr0dvOX3ATOl0li3q3SVJkUqFMEBcHc4IuX2///fcf/hK7cSXRatpZXi+cott9h5U/3j63EMPt+fL1/h+fPdeff6NnJMHNPjD2U/7+qcl183aH6eH+/PO52PN7E+B3qZ+Tlgspkjb57X1edAKT7Oh+fvrj3v6/nNdp7ftd057abHnz78npVgLGG8FF3cKSTPz2oXJFaQWuocCz9D0mhnEu8Tx54k6dexc98F77vY+f48n96HwvnyvKB8iNHzfJCvY3cj9HZF4dfM7/6QZ4j+7deb2J2z6jn7sbueC5Eq7rmpl63cd1w4GCrd2wov5Vt4r/fVeFW2OMnYIpuD13ShhUi0T8hhhR5O2Pc4w2SJOe5IuGOMM6Z7rhL+FudNSrZXOFFJz3KpkqtJ1hKn4+tawp233flmqMy8AlfGwGCBOz693Fcn/+b1OtA5Bt0QfH2NFeuKFnCWYZmzn1xFQsJ5xlRufO/LvcGNf5PYRAblhrmywe7HY4gh4Re20s1z4jrx2fkHNYKu5wCEiLmFxYREBnwJSUIJXmPUEIhjJT+dlceU4yADQSSu4A65SamQnBptbu7RcK+NEh+nkRYSIZBGSQ0EIlk5C/jRXMFQlyTZiUgRlSpNekklFymlaDGN6po0q2hR1apNe001V6mlaq211d5iS0iYtNLUtdpa651JO0N37u5c0fuII408ZJSho442+gQ+M0+ZZeqss82+4koL+q+y1K262uo7bKC085Zdtu662+4HrJ108pFTjp562umvWXtm9X3WwofM/T5r4Zk1y1i+1+mvrHFa9WWIYHIiljMyFnMg42oZANDRcuZryDla5ixnvkVIIZGsBbHkrGAZI4N5hygnvObuV+Z+mzcn+Y/yFr/LnLPU/RuZc5a6Z+Y+5+2LrK1+K0q6CTIWWkx9OggbF+zaY+1Wk/766H46wF8ONFY+O8hBMEc7oc4Vdh+8JsE+PUSrVjr70Zz1+H56PH3o9sRR1ql5Ha8bUMQxpe89Tki8Sb0tE23cw3DcfEo+ugnj2G3WEmononVfoag71pVjR+EmAE53eT5tqYfEHl/7ThMusaI+St0jktFa9gKnreiQqCNpZ2mJdSkbaiK6DrovYR4/JhJfRsx5d5EVZnEIPetHnU5KynJPTSuCPuC0lOuXH7n1DNq7DpUtHbhM5lDA0c2bnDCJoOObMnyj+aPjPwx0yiDUxKKsg35VnRnBEVhonKwK5hOk5NttUrhr2+tMOXkPJb1RZ+iAelYjL2MuO3pGRQ78GdxwOOaTAcJZcewq7ilB1RJCSozUdSEdwVJVb6asiBsHH1Bqgbiv3Cmkkis6ktVnZGRRwMNJjUA3Ao2127YWdhAIblxF51hzMcZsVZc0r0dJo5Liqfn41Q+q193SGhhkMkgaLJRNnEpqBtyVvbcVffIk+LE9QPFBTMTQe0aWkMXMnx3dy5sfHreDE60Ql50E+SqRcmfK16L2p0Ol8JFATu3qASXy7SvmiGW2cdMBxsty44CvtLogfGlv7WkCSV0WId2270EaD5Ym40cs+SAwZuNjPSTywAvEfLmzQhtLDntfCnhl/fNmUNnzyA2g76Zn0SP+c+I6bCC0FONUQ4L50e95dif+DH/m9htQjBEhPPpOjYjmm2ChbfEMIUaYtAIxmWJHlilLU8ZRs9pCsHbDpFaRgZljz2QandjDIBPZDGTuoZW1KdlYh52ALzisKJRNWSQmLAWx8iv9mGttT15bBc2oxd57bZtVF98CYtK3UH22Yd/A7WaKa+ZjNTOXEzNhMJ5kmQOvfzsbxbZALJ2xwGBjX2HFQybhi7kpbA7DVpS3RxMJwFyHwGk5gs6a4lrRHVqhYT0QTJC9UZcC9Yrelkn6yXch68NKNtG7CiU3vf/zMZAYXPWdrR9XZ/ctMV1sJQ2wJEGxzaHs7LmmHIwnUwbwnNAapBY9xhE19DNJW3ua0dDk/AjwITacR0PqZxkbyJ+E5jYbxI84x1TBE+y90hwDCYZIM0tqAKPZfCzFrbH8kYCm3eqQkZ2+2GovcL8Suokyg8yyCJes6dcouSLiNSLb0ETJU+/N/WFsBBSOXBbm9Cwp4CzlOag7ro7R2vC19nSsCPmAjIEMiobFwaoVXhjTU2XMpgEsDH/L3Sx54OCTMUSXI/IIA2V4QcLQpwVz12pInI0bY56pIQ2BSGRLL+yLfZ7JkiimbK+aepsbwRStpokx5gCqe1hjdMAwcINbkk5jmedrNRAG5pUXPe0sZIoXy1h7lSDxApzheg24JeDNtDS1oBDBUC4iWZFilBPhZx0Kqx2lihpbG9q4sYidksCN4yRYhNM4nxfBbTi4E3AT6B3igbvs9Gv8ZkHsIfdlep+2HelEDbkJdNjqZQ90B7k6OIoFfkkPNoY+z0gzACa1f2qcBYxVJpT2QQgS19dKQlbC24S92xiEAFRKB5Uy1qrBgOtwIge55G0kRPfIytGx0tMOrGfrijB2FHOk/TKcMjDTMPeBo4FnXD5cQ8vtdgoAN0yuzZQHQI09wm/5vAB6RHyI9rYKiZ6YWC6rbaiLmDtoaToC1bViXQFNtgWsOfEEKCleC3GWPSfgQWRQWMgw/9FDgvOZrFAT3SmsA3DLbqlsSppQG5QeOjPXavUUkxF/qgLM05vW5o7UakuBqo2ZW8Nj0LB7imVJC9QSA+wd7RPztIUZ80xQZq0ROrc8CSVncWzkTA/RwmunldCPAQKjqVC7bhRuTIv0plbk7gOX4m5OAi2YesYZ0KBQRToG8iv9x8dgGtgECYRBeEU87OxoSc8epu+s7Mq/MN0VbBT19dii7ekO66UZwdAMtoAVQd13J5nwZe98OgGslmVqAGBkeLZNVNVlWpV18qihntXKnBZvrDIVgFpx4q5poLqREOVplMPSpTF2KvjBAzDpprkruXIaaUmUD4Xo2yrGWcYlixKIwRFjl0jPQhKznUXZAoSjlg9c/NwAI4p3Q/w5bCNfhUZS7bGfqesHqKAlyZZxZgNrhGevZXccaqBys4NEqB3Vqfptji9uUrhCL6yXFqxtm0hhLyYU3Tjd8I/HZaWD1oyVjnG5hhpCN5yHSf8BQUZlVNd00OP4M0TK+JSM7iqWi01SinFkCQXWxiZJLqqAHiEt3G3I2WYd46KU9pIJIOkoRQYCcEAAPguHo0Y4k8Hl6SW50MoW0uZU8jJOUghKo38Nl5ZSwsJNAUC2/lFZWkfMjrU8dFrTjHpJnUrLCILQIxINiYdQlDXaE/razQ4jjQluN5jW1Eh/S7yYvI5gigSjdLYU9TiFXAcHjISiLhQd9obb3OQmwY+YqVwiBMCkOGLXaK/ljBShh56c1g0uyIb2lBRKO7ZTAFncw5c5UGjGSy3CsI1Jt2mtruZkfhBZmbR+842Yu1eDiWEl0V6LZcGem6Ct+LW4Wy3oAjyNObazKBHomhJ3HMKEKHgiGksH+Ig1nTidfNMyA+oYHqVFaRGLiQreVLc9GvQgftKjW9cfUSKNYL80rqU7Um2rwqQJR1ai31Wq7vzKJEsFHDj0bAEMUKXgvfD5bWbaLPBTKz1Nk/Fg+GUZvUzFw80CLaKtPAACVAWrismh863FU4IJ0716SXBUNVb/SDMVvZgDt34CXoOq1JKvg0n08gPHTwXBNgD5W8pZZ8E9EVWcv1DZMB2NFysIwkqBSaH5QRmsAHdkHB+UANvLJvFpQKAahSmYTLEd2AFO+5rsqRRU6sVv5IP0wsSPLcWsbC1Y95mte71CUm6RJJWwkg6Q4k+xWMM0ByElJPQ6j2ED5hY42ALpZRytx9RlgQlJLijzhKi5eX5JBSIRGfo9o2xhd/0aWku8OS+4D9ZnovHDQMPaYo4qm2mlZbUnd7pR6oQj29Z2BqJ9n3LRT+MTLu3IR+ZP2TCPh3EDw8H1NHpoT7FibNYU8WHd9ESHcY12aDOQCUBddi4Ucp+4yuzz8ybcCCu1h8zvzXhDN4HYLq1R+U0xzUqg5QSA3iSBgdDouy55Ifx0DaeEhgezxBRGmoEJ6AJitVuzwtKPlUskHgU2F0LS7AFIwW5jPu0RUL7sp+fkNk0ee8P6uXYgl40WM+cdCOW21r13e0ivt0ff/mYcUfrQZWs2BiN6G+MDTGz1BKORmUTNQp9YGSHFxAeTkQrKd6FoVUogyytW25OLy3OpaO5oZCQp46aPzb5LnJiFEIwAKkmbYVYIjzVv3vj7rA6HignEeQAXTAHKDhoD7Uujh0QjtsB6fTP1NzO7T1Nzq4F1GnfHdXCG1Yxjwdtjf+PGRGTzEtEAUCz7KLfTdItLwCXuSOAzVjaZB6LvbUZhYGWmifSZlcMDnGHPd6gPeiK9erhpiw7ZP9ahTrMhFDa1J53m9ri2DloziqGETTcVSppCbTDDjExg6RrZ6cPEzB8XArEjQSB29odrUoLyoS/65RfM9fprGGjlHpbhGgbYD8MtmW1eFcAWX5dbcMHcl8sUI2k+H7GPW9VrArw3G+BefcCrCaAT/N53YLvP26Uy0kMFnDEZz0DJkmQqEOlL7SlKweYhH8gxpYeAYi0f9magqPbMYZuUI6007lSZQoyoGfYQHsNRzHXR3MMINTSMZpq1KD2A5MDJgtMLdRU6R4CEOJcKGiIJ7K6P/vAM6xpECHI8rRHsaEj6smkngAUjXTzrRoSI48ZpHOqgOY5OejKVdpnmiYUChQnVdIPa6ekGqRSRgEO119oDHOiIUQ5ciYVgaF1oG8Udo8WYtD+DEi8D/w8rAJE2k2PoyV0oMtpauxreaFjpujAvxFlwBhjuNqM9P0IfI5iD8Nh8y1kG4igjJkDNkOijnlLhItAd9lhRd670yNRTu95cR/Xuu0c5WO4DEFk5YQAPtLvU4TYPGRh4APPEDNiuuwR6SC21JoFbQBBMr+zJmT32QplNI6p16PbculN/pCX1wAyTWGTeJ774aln0gvQikw7TmkfsNbdQNs0adutYUDqNtGc0RqngUYdhUYuHSL1/eLrgvqDTC5neu++vufRkEgP9D2T64Kg/c4n+s7k3dDr3me8nOr0c72MRNmgF7D4WySPP0YAI/bI4eixwc7K13QiRiL85A8fnSsUj+mvTrsZtVUEQZ6sTpVafW8nYJZyaZS0U+0xIb6et9PhhtoObozQbjKAoDf6eiFgx1UUvpUYj1GweH0MNMrofhynfWn7+KYu7n5r83hN9aqm+6qjcH7dUlgvZVLV3xqq4fbP16qv+eofuTz43eomAqfS7GBAB9zEE31WJ37eVIPtdGN5A8nMYPvvLt8t2/V/6gM19G4g/hIL7UXf9JgbuLRZ+AoW//AzyMxTcWyz8BAruLRZ+AgX3r3y2+mT/PwfiN1DoVI+QT3CZDmvb8022JeYb6HiQPQpPPvboFB+i1MZdcqWZqthHmix6vttw0UAI1z8oEnGwVe++c7JamxslC+8xKJE41XJmug1npz+6CUAKyURd9gSxo+kWxvtZth848GBlws/0SKjYhmbZ9IiV+mcGBSdWHk8sqSr2zz5J7QME/0yD+z4Pe+JuGn1MV/vUyZwOHojWPlmPXgf9CuoeN9UAT+FGwaLg44v3dWe6QpvuL3Ln/p3k/2AgqNDcfwHgqUmIIqn+hwAAAAJiS0dEAACqjSMyAAAACXBIWXMAAAsSAAALEgHS3X78AAAAB3RJTUUH4wYRESAMujenGAAAB9FJREFUeNrtnWlsFVUUx899fS1gUoKioEY+WBRUEohGkUhAKxgEjSgGoRGB4AJCNKAIJBJZJSiyGYMKKkIoLlEUKhUraxFkKUE2kU1aCrRgW2jpg9f29R2/sBTo67v3zL2zvfP73MzM+XU6mf+5504BGIZhGIZhGIZhGIZhGMZGGq3JvSmR62++BXHH7Ylbf9ouRMT99yVq/e0PICIiHumUmPV3PooXOf5EItafXoCXOdUn8ep/pgjrUDY40ervX4JXUTEiocoXL5/FawiNEwlU/6hzeB3hqQljQIwJYT3UzEkQA2JiGOslsiAhDIgZ1RiD6NIEMBD8NIKxyQr6vv7FtdgQa31uILg0ig2zsZmv4//yePUj7rjNv/U3yUEJ/r7Xr/XfvBmlOPKwT+vfhpIUdvdj/Wm7UZpTz/mv/g4HUYGyQb5r/+SjEhXD/VV/j5OoSGisj16LRe9iVCY8xTcGxIulSKBmtk8MiKHlSMIn8ViMqkQivojHgfcuIJ0VAc/XPzmMVljrcQOBmdVojY1NvVx/8mcRtEqeh+NxypJatM6+ezxb/7Io6uBwR4/e/1moicJunvz956A2ip/1Xv3Nt6JGSgd6rf47/0KtlHssHrfZi5rxVDwWDx5C7XgoHotHC9AANbO8YqBXERohMt8bv/8X/kNDRDM9cA+IgWVojhWuNxAYXo4mWePyeBwYHUKz5Lo6HidNvICmybvVxfXPqEbz7Gvr2vrn1KAdHH7IpX//8yNoD8dcGY+TM6NoF26MxzLTL26Mx0majtM4q5ed7yhNulVsd5WAxqset/mGS6/d5CIBLXI62/7I6ZKyzjUC0rIfsP+hE3zkxt9c8vy7tPnJbiKfuyP+Xdn8ZDeuiMei+zF0juWOGyBNv+iMxw4bEBkl6CzOxmPx6ll0mryWDtb/ViU6z17H4rEYG0I3cMiheByYFEZ34Ew8Dn5UjW7BiXisY/rFDfGYmgWCCwcngXto0q08z1YBSUsy3NWgb5Qe2WSjgJRlfdy2RJPcNXm9bQIarexpsP5VdxHjcbMcm2Q3/5P64i71U8k/ELuLNsVjcct2cnST+rGg+Jo4XmhLPBZ376GOfoOkAIB5NWTHxuu/nzj9ElkA8gLgA+pLlvF43IU4/VI9G1QEAHnIPjfVaP1PnqRdVngKqAkActDMa2Hw/u9zijjjNg5UBcBr1FbD3jbG6h9QSruk8ovfyFESABnUWSNT8VgMI06/lF7aBqomAJ4n3m+G4nHgbeJfZfHljcCKAqDHcWo87m2g/gnE53LhlS+lqQqATv9S4/FL2u//qcT2T34XoAuAdvuJBspf11z/LOKbyYG6q4bqAqDVTqKByjFa21/U6ZfdaWBNADTdTDQQnqSv/pRMYjrZevVLCUUAiF+JBqpnaqv/J2I+zb3mxZwkAMTPDq8ep1A3P/1y3ZOEJABgiaPxuOnvxLN/B7oEwELq/sPl1utvSdz8VPsl6BMAn1AbBKut1t96F+3ENXOFTgFiehXRwAZL8Vi0JW5+qppW7+HIAgDGnyca2G4hHouOh2knvTARdAuAkedsj8cinTj9Ujka9AuAV87YHI/F08TNT2eHgQkB0I/aIDhGmuIU/YnnKxkAZgTAU8SGHC0eDyJufiqKfTKrAqBrPtFAiXo8HlFBO1VBA7ebZQHQifhUVo7H4p2QgQeOdQHQbp8t8Tg4idj+2dPgwJIGAdBqhw3xmDz9EuelQ4cASP3DeDwOziW+ecdbldEiACDbcDxOWkBs/8QNHpoEAPXjLNFMmfpv+IZ4+PjRU5cAWGwwHqcQNz/J2NUmAMgjavHjMfEPTGpvvz4BQH1MrzMkoHoW2CsAppEaBFskemQUA+HJYLcAeJfQINgpNVuvbiA0FuwXAG8qNwh2S07WqxqQ/saPXgEwRDGu7W8te2Q1A6XSH0HWLAD6nVa5zoPS9asZKJb/DLZuAdDzhPx1Hu2gkobkDRQq/J8w7QJAfstevuI3+WQN1F39dkAAtP9H7jpPdFVtiMgZOKC0Z9aAAEiT+mrbScLQjIyBXWngtABokRf/kKefonRF4xvYqrjmYEQApG6Md8SyvrS+eDwDG5QbzUYExL3QMxnUlZGGD5wFbhEADQ7YVwyhr401YCD6LbhHACyK3SA4N9TK6mhMA5EvwE0CYF6sBkFopLXl8exYq9/gLgHwYf3x+PxoqwMC9RoIvw9uE1D/gH3VeOsjItnSq9/OCqhvwL5qAoABA5XU28qsAHjj2tW8mukABgzEXP12WgAMvrpBEPkYwICB2KvfjguAvnUH7GvnARgwUGRhEt24gLoD9tGvAAwYKLDyySzzAqDzpQH76CIAAwYOWtqNYoMAaH9xwP57AAMG9ljbj2SHALhjJyLijwAGDGyzuCPNFgGQuhlxpfw1yR94dfAxi5cmojI/lRyx+rtaX9XDhADr2CVABc//JycWwAJYAAtgASyABbAAFsACWAALYAEsgAWwABbAAlgAC2ABLIAFsAAWwAJYAAtgASyABbAAFsACWAALYAEsgAWwABbAAlgAC2ABLIAFsAAWwAJYAAtgASyABbAAFsACWAALYAEsgAWwABbAAlgAC2ABLIAFsAAWwAJYAAtgASyABbAAFsACWIDToH8FyJUWtVWAALedDoFhGIZhGIZhGIZhGIYxyf+YwEMsIhMo/AAAAABJRU5ErkJggg==";var YH=new bp;function _4(e,r,t){let{breakpoint:o,width:n,accentColor:i,completeFraction:a,isVertical:l,visibleThroughGeometry:c,dashed:p}=r,{color:u}=t,f=!0,h=0,b=1/0,x=r.displayArrowsOnPath,T=!0,v=x,I=typeof n=="object"?Number(n.output[o])/2:n/2,M=typeof n=="object"?Number(n.output[o+1]??n.output[o])/2:n/2,O=(t.altitude??0)+JH,C=0;e[0].z+=O;for(let H=1;H<e.length;++H){e[H].z+=O;let P=e[H].x-e[H-1].x,q=e[H].z-e[H-1].z;if(l)C+=Math.sqrt(P*P+q*q);else{let K=e[H].y-e[H-1].y;C+=Math.sqrt(P*P+K*K+q*q)}}if(!l){let H=e[0],P=e[e.length-1];e.push(P.clone().setZ(P.z-.01)),e.unshift(H.clone().setZ(H.z-.01))}let E=new pC;v&&(E=YH.load(L4),E.colorSpace=zg);let _=new ar(u),G=new ar(i),R={vertexes:{type:"f",value:1},resolution:{type:"v2",value:new Me(1,1)},cameraParameters:{type:"v2",value:new Me(h,0)},complete:{type:"f",value:f?0:1},color:{type:"c",value:_},pathLength:{type:"f",value:C},nearRadius:{type:"f",value:I},farRadius:{type:"f",value:M},nearZoom:{type:"f",value:h},farZoom:{type:"f",value:b},pulseColor:{type:"c",value:G},pulse:{type:"f",value:0},pulseLength:{type:"f",value:.075},pathIsVertical:{type:"b",value:l},arrowAnimationTimer:{type:"f",value:0},arrowTexture:{type:"t",value:E},displayArrowsOnPath:{type:"b",value:x},showPulse:{type:"b",value:T},opacityMultiplier:{type:"f",value:1},dashed:{type:"b",value:p}},N=new gC(e);N.curveType="catmullrom",N.tension=0;let X=30,z=8,ee=X*e.length,re=new bC(N,ee,I,z,!1),ue=new Float32Array(re.attributes.position.count);for(let H=e.length;H<ue.length;H++)ue[H]=H;re.setAttribute("vertexIndex",new po(ue,1));let Ce=new Float32Array(re.attributes.position.count),Oe=new po(Ce,1);for(let H=0;H<=ee;H++)for(let P=0;P<=z;++P)Oe.setX(H*(z+1)+P,H/ee);re.setAttribute("pathDistance",Oe);let Pe=new Float32Array(re.attributes.normal.count*3),Fe=new po(Pe,3);for(let H=0;H<ee;H++){let P=re.tangents[H];for(let q=0;q<=z;++q)Fe.setXYZ(H*(z+1)+q,P.x,P.y,P.z)}re.setAttribute("pathTangent",Fe);let ce=new Float32Array(re.attributes.normal.count*3),Ee=new po(ce,3);for(let H=0;H<ee;H++){let P=re.tangents[H];var ye,Ge,Ie;l?(ye=P.x*P.y,Ge=-1+P.y*P.y,Ie=P.z*P.y):(ye=-P.x*P.z,Ge=-P.y*P.z,Ie=1-P.z*P.z);let q=Math.sqrt(ye*ye+Ge*Ge+Ie*Ie);q===0&&(q=1);let K=ye/q,Q=Ge/q,De=Ie/q;for(let xt=0;xt<=z;++xt)Ee.setXYZ(H*(z+1)+xt,K,Q,De)}re.setAttribute("pathNormal",Ee);let Xe=new _a({uniforms:R,vertexShader:Tx,fragmentShader:Z2});Xe.transparent=!0,Xe.alphaTest=.5,R.resolution.value.x=1,R.resolution.value.y=1,R.vertexes.value=ue.length,R.arrowTexture.value.wrapS=cm,R.arrowTexture.value.wrapT=cm,R.arrowTexture.value.anisotropy=16;let se=new Le(re,Xe),nt=se.clone(),dt={...R,opacityMultiplier:{type:"f",value:.25},pathIsVertical:{type:"b",value:l}};dt.complete.value=1,nt.material=new _a({uniforms:dt,vertexShader:Tx,fragmentShader:Z2}),nt.material.transparent=!0,nt.material.alphaTest=.5,nt.material.depthWrite=!1,nt.material.depthTest=!1,dt.resolution.value.x=1,dt.resolution.value.y=1,dt.vertexes.value=ue.length,dt.arrowTexture.value.wrapS=cm,dt.arrowTexture.value.wrapT=cm,dt.arrowTexture.value.anisotropy=16,dt.complete.value=a,se.userData=nt.userData=r.mesh.userData;let $t=r.mesh;if(!c){let H=new _a({uniforms:R,vertexShader:Tx,fragmentShader:A4}),P=new Le(re,H);P.name="stencil",P.material.colorWrite=!1,P.material.stencilWrite=!0,P.material.stencilRef=1,P.material.stencilFunc=lC,P.material.stencilZPass=Zg,P.material.stencilZFail=Zg,P.material.stencilFail=Zg,P.material.depthWrite=!1,P.material.depthTest=!1,P.userData=r.mesh.userData,$t.add(P),$t.add(nt),nt.renderOrder=0,se.renderOrder=1}if($t.add(se),l){let H=new sr().setFromObject(se),P=new ae;H.getCenter(P),$t.children.forEach(q=>{q.geometry.center(),q.position.copy(P)})}c&&(se.material.stencilWrite=!0,se.material.stencilRef=1,se.material.stencilFunc=aC,se.material.stencilZPass=Wg,se.material.stencilZFail=Wg,se.material.stencilFail=Wg,se.material.needsUpdate=!0,se.layers.disableAll(),se.layers.enable(ly.ALWAYS_ON_TOP)),re.computeBoundingBox();let k=new ae;return re.boundingBox.getCenter(k),{mesh:$t,material:Xe,center:k}}var JH=.15;var KH=.5,uh=class extends ke{constructor(t,o,n,i){super();m(this,"rendererState");m(this,"verticalDistanceDirty",!0);m(this,"convertTo3DMapPosition");m(this,"getParentContainer");m(this,"convertZoomLevelToAltitude");this.rendererState=t,this.convertTo3DMapPosition=o,this.getParentContainer=n,this.convertZoomLevelToAltitude=i}update(t,o,n){let i,a=!1;for(let l of this.rendererState.geometry3DIdsInScene)if(i=this.rendererState.geometry3DMap.get(l),i&&i.type==="path"&&i.components[0].type==="path"){let c=i.components[0],p=i.components[1],u=c.isVertical&&this.verticalDistanceDirty;if(!(c instanceof Il))continue;let f=[];if(c.dirty||p.dirty||u){if(c.mesh.parent!=null)for(let h=c.mesh.children.length-1;h>=0;h--)Ht(c.mesh.children[0]);if(c.feature.features.length===2&&c.feature.features[0].properties.parentId&&c.feature.features[1].properties.parentId){let h=c.feature.features[0],b=c.feature.features[c.feature.features.length-1],x,T,v=h.geometry.coordinates[2]||0,I=b.geometry.coordinates[2]||0;h.properties.parentId&&(x=this.getParentContainer(h.properties.parentId,!0),x!=null&&x.altitude!=null&&(v+=x.altitude,c.isVertical=!0)),b.properties.parentId&&(T=this.getParentContainer(b.properties.parentId,!0),T!=null&&T.altitude!=null&&(I+=T.altitude,c.isVertical=!0));let M=this.convertTo3DMapPosition(h.geometry.coordinates[1],h.geometry.coordinates[0],v),O=this.convertTo3DMapPosition(b.geometry.coordinates[1],b.geometry.coordinates[0],I);Math.abs(M.z-O.z)>KH&&x!=null&&x.visible&&T!=null&&T.visible&&(f=[M,O])}else{let h=c.feature.features;for(let b=0;b<h.length;b++)if(b===0||!oM(h[b].geometry.coordinates,h[b-1].geometry.coordinates)){let x=this.convertTo3DMapPosition(h[b].geometry.coordinates[1],h[b].geometry.coordinates[0],h[b].geometry.coordinates[2]||0);f.push(x)}}if(f.length>1){let{mesh:h,material:b,center:x}=_4(f,c,{color:p.color,altitude:p.altitude,isVertical:c.isVertical});c.mesh=h,c.material=b,c.position=x}c.dirty&&typeof c.width=="object"&&c.width.on==="zoom-level"&&(c.altitudeBreakpoints=c.width.input.map(h=>this.convertZoomLevelToAltitude(h))),c.dirty=!1}p.dirty&&(c.mesh.children.forEach(h=>{h.name!=="stencil"&&(h.material.uniforms.color.value.set(p.color),h.material.visible=p.visible,h.material.needsUpdate=!0)}),c.mesh.position.z=p.altitude,p.dirty=!1),c.material&&(c.mesh.children.forEach(h=>{let b=h.material.uniforms;if(h.name==="stencil"){c.materialDirty&&(b.complete.value=c.completeFraction);return}if(typeof c.width=="object"&&c.width.on==="zoom-level"){c.altitudeBreakpoints&&c.altitudeBreakpoints.length>2&&A.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 x=FC(n,c.altitudeBreakpoints?.slice(0,2)??[t,o]);c.breakpoint=x,b.nearZoom.value=c.altitudeBreakpoints?.[x]??t,b.farZoom.value=c.altitudeBreakpoints?.[x+1]??o,b.nearRadius.value=Number(c.width.output[x])/2,b.farRadius.value=Number(c.width.output[x+1]??c.width.output[x])/2}b.cameraParameters.value.x=n,c.materialDirty&&(b.displayArrowsOnPath.value=c.displayArrowsOnPath,b.pulseColor.value.set(c.accentColor),b.complete.value=c.completeFraction,typeof c.width=="number"&&(b.nearZoom.value=t,b.farZoom.value=o,b.nearRadius.value=Number(c.width)/2,b.farRadius.value=Number(c.width)/2))}),c.displayArrowsOnPath&&c.animateArrowsOnPath&&(c.mesh.children.forEach(h=>{h.name!=="stencil"&&(h.material.uniforms.arrowAnimationTimer.value=performance.now()/3e3,h.material.needsUpdate=!0)}),a=!0),c.materialDirty=!1)}this.verticalDistanceDirty=!1,a&&this.publish("animate:path")}};d();var pr,Ou,ua,Cx=class{constructor(r){m(this,"rendererState");m(this,"dirty",!1);S(this,pr);S(this,Ou);S(this,ua);this.rendererState=r}updateOne(r){if(r instanceof Mt&&r.components[0]instanceof fr&&r.components[1]instanceof Ri&&r.parentObject3D instanceof Wn&&(w(this,pr,r.components[0]),w(this,ua,r.components[1]),s(this,pr).detached&&s(this,pr).dirty&&s(this,pr).mesh!=null&&s(this,pr).material!=null&&s(this,pr).batchedProps!=null)){w(this,Ou,r.parentObject3D),s(this,pr).visible=!1;let t=new ar(s(this,ua).color),o=s(this,ua).opacity*Cp(r),n=new dM({color:t,side:Ms,opacity:o??1,transparent:o!==void 0?o<1:!1},1,s(this,pr).material.repeatYFactor),i=new BM(1,s(this,pr).batchedProps.positionCount,0,n),a=x4(s(this,pr),i);if(a==null)return;i.userData={entities:{0:r.id},detached:!0},s(this,pr).instanceIndex=a,s(this,pr).material.setColor(s(this,pr).instanceIndex,t,s(this,ua).topColor?new ar(s(this,ua).topColor):t),s(this,pr).mesh=i,s(this,pr).material=n,s(this,Ou).add(i),s(this,pr).dirty=!1}}update(){if(!this.dirty)return;let r;for(let t of this.rendererState.geometry3DIdsInScene)r=this.rendererState.geometry3DMap.get(t),this.updateOne(r);this.dirty=!1,this.cleanup()}cleanup(){w(this,pr,void 0),w(this,Ou,void 0),w(this,ua,void 0)}};pr=new WeakMap,Ou=new WeakMap,ua=new WeakMap;d();d();function R4(e,r,t){if(e.batchedProps?.range&&e.mesh){let o=r||1e-4,n=o/Math.max(t,1e-4);return px(e.mesh.geometry,e.batchedProps.range,o,0),e.material&&(e.material.repeatYFactor=n),e.currentHeight=o,!0}return!1}function B4(e,r,t,o,n,i){return e.mesh&&e.instanceIndex!==-1?(e.mesh.getMatrixAt(e.instanceIndex,t),t.decompose(o,n,i),o.z=r,t.compose(o,n,i),e.mesh.setMatrixAt(e.instanceIndex,t),e.altitude=r,!0):!1}var bi,ds,wx,Ox,Ex,Px,Mx=class{constructor(r){m(this,"rendererState");m(this,"dirty",!1);S(this,bi);S(this,ds);S(this,wx,new Hn);S(this,Ox,new ae);S(this,Ex,new Xg);S(this,Px,new ae);this.rendererState=r}updateOne(r){if(r instanceof Mt&&r.type==="geometry"&&r.components[1]?.dirty&&(w(this,bi,r.components[0]),w(this,ds,r.components[1]),r.type==="geometry")){let t=!1;s(this,ds).height!==s(this,bi).currentHeight&&(t=R4(s(this,bi),s(this,ds).height,s(this,ds).initialHeight)),s(this,ds).altitude!==s(this,bi).altitude&&(t=B4(s(this,bi),s(this,ds).altitude,s(this,wx),s(this,Ox),s(this,Ex),s(this,Px))),t&&s(this,bi).mesh!=null&&s(this,bi).mesh.computeBoundingSphere()}}update(){let r;for(let t of this.rendererState.geometry3DIdsInScene)r=this.rendererState.geometry3DMap.get(t),this.updateOne(r);this.cleanup()}cleanup(){w(this,bi,void 0),w(this,ds,void 0)}};bi=new WeakMap,ds=new WeakMap,wx=new WeakMap,Ox=new WeakMap,Ex=new WeakMap,Px=new WeakMap;d();var QH={showPolygonLabelTextAreaMesh:!1,showEnvMap:!1,showCollisionBoxes:!1},Fx=class{constructor(r){m(this,"state",QH);m(this,"core");this.core=r}update(r){let t={};for(let[o,n]of Object.entries(r))o in this.state&&this.state[o]!==r[o]&&(this.state[o]=n,t[o]=n);this.handleUpdate(t)}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.getSystems().collisionSystem.showCollisionBoxes(),this.core.render()):this.core.getSystems().collisionSystem.hideCollisionBoxes())}};d();var mh=9,qH=!1,N4=.1;function ez(e,r,t){for(let o=0;o<r;o++){let n=(t&16711680)>>16,i=(t&65280)>>8,a=t&255;e[o*3]=n/255,e[o*3+1]=i/255,e[o*3+2]=a/255}}var Dx=class{constructor(r,t,o){m(this,"state");m(this,"renderer");m(this,"renderService");m(this,"pickingTexture");m(this,"pickingMaterial");m(this,"pixelBuffer");m(this,"width",0);m(this,"height",0);m(this,"scale",1/2);m(this,"color",1);m(this,"convertTo3DMapPosition");m(this,"destroyed",!1);m(this,"enabled",!1);m(this,"backgroundId",16777215);m(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 uC(this.width,this.height,{format:sC,type:iC,internalFormat:"RGBA"})});m(this,"shouldShowByXY",(r,t,o)=>{if(this.pixelBuffer==null)return!1;let n=r+(this.height-t-1)*this.width,i=this.pixelBuffer[n*4],a=this.pixelBuffer[n*4+1],l=this.pixelBuffer[n*4+2],c=i<<16|a<<8|l;return c===o||c===this.backgroundId});m(this,"activeOccluders",new Set);m(this,"update",()=>{if(!this.enabled||this.destroyed||(this.activeOccluders.clear(),this.activeOccluders.add(this.backgroundId),!this.pickingTexture||!this.pixelBuffer))return;let r,t;for(let n of this.state.geometry3DIdsInScene){let i=this.state.geometry3DMap.get(n);if(i&&i instanceof hr&&i.userData.occluderFeature!=null&&i.userData.occluderId!=null&&(this.activeOccluders.add(i.userData.occluderId),i.userData.occluderDirty)){if(r=i.userData.occluderFeature,r.geometry.type==="Polygon"){let a=B1(r,this.convertTo3DMapPosition,{color:"white",height:N4});t=this.createOccluderMesh(a,i.userData.occluderId),i.add(t)}else if(r.geometry.type==="MultiPolygon"){let a=N1(r,this.convertTo3DMapPosition,{color:"white",height:N4});t=this.createOccluderMesh(a,i.userData.occluderId),i?.add(t)}i.userData.occluderDirty=!1}}this.renderer.setRenderTarget(this.pickingTexture);let o=new ar(this.backgroundId);this.renderer.setClearColor(o),this.renderer.clear(),this.state.cameraObject.layers.disableAll(),this.state.cameraObject.layers.enable(mh),this.renderer.render(this.state.entityScene.parent,this.state.cameraObject),this.renderer.setRenderTarget(null),this.state.cameraObject.layers.disable(mh),qH?this.renderService.enabledLayers.add(mh):this.renderService.enabledLayers.delete(mh),this.renderer.readRenderTargetPixelsAsync(this.pickingTexture,0,0,this.width,this.height,this.pixelBuffer).then(()=>{if(!this.destroyed)for(let n of this.state.geometry2DIdsInScene){let i=this.state.geometry2DMap.get(n);if(i&&i?.occluderId!=null&&this.activeOccluders.has(i?.occluderId)){let a=i.components[0].projection,l=Math.floor(a.x*this.scale),c=Math.floor(a.y*this.scale),p=this.shouldShowByXY(l,c,i.occluderId);i.components[0].isOccluded=!p}}}).catch(n=>{this.destroyed||A.error(n)})});if(this.state=r,this.convertTo3DMapPosition=t,o?.renderer==null)throw new Error("No Renderer");this.renderService=o,this.renderer=o.renderer,this.resize(),this.pickingMaterial=new _a({glslVersion:cC,vertexShader:`
496
496
  attribute vec3 color;
497
497
  varying vec3 vColor;
498
498
  void main() {
@@ -506,7 +506,7 @@ void main(void) {
506
506
  void main() {
507
507
  fragColor = vec4(vColor, 1.0);
508
508
  }
509
- `})}applyId(r,t){let o=r.attributes.position,n=new Float32Array(o.count*3);ez(n,o.count,t),r.setAttribute("color",new po(n,3))}createOccluderMesh(r,t){let o=new Le(r,this.pickingMaterial);return o.layers.set(mh),this.applyId(o.geometry,t),o.userData.occluderId=t,o}reserveOccluderId(){return this.color++,this.color}enable(){this.enabled=!0}disable(){this.enabled=!1}destroy(){this.destroyed=!0,this.pickingTexture?.dispose(),this.pickingMaterial.dispose(),this.pickingTexture=void 0,this.pixelBuffer=void 0}};d();var Dx=class{constructor(r){this.state=r;m(this,"dirty",!0)}update(){if(this.dirty){for(let r of this.state.geometry3DIdsInScene){let t=this.state.geometry3DMap.get(r);if(t instanceof Mt&&t.type==="geometry"&&t.components[0]?.geometry!=null){let o=t.components[0];o.geometry&&(o.geometry.dispose(),o.geometry=void 0)}}this.dirty=!1}}};var j4=new Ei;var{DEFAULT_PITCH:K2,DEFAULT_BEARING:Q2,DEFAULT_ZOOM_LEVEL:q2,DEFAULT_MIN_ZOOM_LEVEL:tz,DEFAULT_MAX_ZOOM_LEVEL:rz}=ui,oz=Ue.radToDeg(.6435011087932844),Jt,Vt,Gc,fh,Eu,wl,Uc,Pu,Jr,X2,j,_n,Vc,ct,bi,Kt,Rn,_r,B,hh,Tr,Ct,G4,U4,V4,ma,gh,yh,bh,xh,Fu,kx,vh,Du,Ih,$c,Y2,Hc,Sh,Th,To,Co,J2,Ax,Lx,ku,Ch,Z2=class extends ke{constructor(t,o={}){super();S(this,Jr);m(this,"options");m(this,"container");m(this,"Debug");S(this,Jt);S(this,Vt);S(this,Gc);S(this,fh);S(this,Eu);S(this,wl);S(this,Uc);S(this,Pu);m(this,"rendererDomElement");S(this,j,{geometry3DMap:new Map,geometry2DMap:new Map,geometry2DIdsInScene:new Set,geometry3DIdsInScene:new Set,geometryGroupIdsToLoad:new Set,entityScene:new hr("__scene"),hoverColor:"#f6efff",text3dHoverColor:"white",insetsPadding:ay,shouldMeasureCanvas:!0,pixelRatio:this.resolutionScale,canvasWidth:0,canvasHeight:0,internalTweenGroup:new W1,externalTweenGroup:new W1,cameraObject:new v0,naturalBearing:0,containerOffset:[0,0],useStandaloneCamera:!1});S(this,_n,{});S(this,Vc,new AbortController);m(this,"camera");S(this,ct);S(this,bi);S(this,Kt);S(this,Rn);S(this,_r);S(this,B,{});S(this,hh,window.matchMedia("screen and (min-resolution: 2dppx)"));m(this,"map");S(this,Tr,()=>{this.aborted||!s(this,B)?.renderSystem||(s(this,B).renderSystem.twoDdirty=!0)});S(this,Ct,()=>{this.aborted||!s(this,B)?.renderSystem||(s(this,B).renderSystem.threeDdirty=!0)});S(this,ma,"standalone");S(this,gh,()=>{s(this,B).geometryDisposalSystem.dirty=!0,this.render()});S(this,yh,t=>Math.trunc(t*10)/10);S(this,bh,()=>{W(this,Jr,X2).call(this,Tp()),s(this,B).twoDDrawSystem.dirty=!0,s(this,Fu).call(this,void 0,void 0,!0)});S(this,xh,()=>{s(this,Fu).call(this)});S(this,Fu,(t,o,n=!1)=>{let i=t??this.rendererDomElement.clientWidth,a=o??this.rendererDomElement.clientHeight;if((i===0||a===0)&&!n)return;s(this,j).canvasWidth=i,s(this,j).canvasHeight=a,W(this,Jr,X2).call(this,Tp()),s(this,$c).call(this),W(this,Jr,V4).call(this),s(this,B).cameraSystem.resize(this.canvasWidth,this.canvasHeight),s(this,B).cameraSystem.dirty=!0,s(this,B).watermarkSystem.resize(this.canvasWidth,this.canvasHeight),s(this,B).htmlControlsSystem.resize(this.canvasWidth),s(this,B).geometryInFocusSystem.resize(),s(this,B).occlusion2DSystem.resize();let{top:l,left:c}=this.container.getBoundingClientRect();s(this,j).containerOffset=[l,c],this.publish("resize"),this.render()});S(this,kx,()=>{this.renderSync()});S(this,vh,new ae);S(this,Du,(t,o)=>{let n=this.mode==="standalone"?s(this,Vt):this.viewCamera;if(s(this,Vt).position.z+this.camera.elevation>o.z){s(this,vh).copy(o);let i=s(this,vh).project(n),a=(i.x+1)/2*this.canvasWidth-0/2,l=(-i.y+1)/2*this.canvasHeight-0/2,c=s(this,yh).call(this,a),p=s(this,yh).call(this,l);t.x=c,t.y=p}else t.x=-1e3,t.y=-1e3});S(this,Ih,(t,o)=>{s(this,_r).setBufferSize(t,o),s(this,Vt).aspect=t/o,s(this,Vt).updateProjectionMatrix(),s(this,Vt).updateMatrixWorld(!0),s(this,Eu).x=t,s(this,Eu).y=o});S(this,$c,()=>{let t=s(this,j).canvasWidth=this.rendererDomElement.clientWidth,o=s(this,j).canvasHeight=this.rendererDomElement.clientHeight,n=Math.floor(t*this.resolutionScale),i=Math.floor(o*this.resolutionScale);s(this,Ih).call(this,n,i),this.map?.resize(),s(this,j).shouldMeasureCanvas=!1});m(this,"getParentContainer",(t,o=!0)=>{if(!t)return o?s(this,j).entityScene:void 0;if(typeof t=="string"||typeof t=="number"){let n=s(this,j).geometry3DMap.get(t);return n instanceof hr?n:(A.warn(`Parent (${typeof t=="object"?t.id:t}) is not a valid container, adding to scene`),o?s(this,j).entityScene:void 0)}else if(t.type==="group-container"){let n=s(this,j).geometry3DMap.get(t.id);if(n instanceof hr)return n}return o?s(this,j).entityScene:void 0});m(this,"showCollisionBoxes",()=>{s(this,B).collisionSystem.showCollisionBoxes(),this.render()});m(this,"hideCollisionBoxes",()=>{s(this,B).collisionSystem.hideCollisionBoxes(),this.render()});m(this,"projectScreenXYToCoordinate",(t,o,n=!1)=>{let i=this.container.getBoundingClientRect(),a=(t-i.left)/s(this,j).canvasWidth*2-1,l=-((o-i.top)/s(this,j).canvasHeight)*2+1,c=new Me(a,l),p,u;if(n?(j4.setFromCamera(c,s(this,Vt)),p=j4.intersectObject(s(this,wl),!1)[0]?.point):(p=s(this,B).interactionSystem.getThreeDIntersectsFromXY(c)?.[0]?.point,u=s(this,B).interactionSystem.getGroupContainerIntersectsFromXY(c)),p)return{coordinate:this.convert3DMapPositionToCoordinate(p),groupContainers:u}});m(this,"projectCoordinateToScreenXY",t=>{let o=this.convertTo3DMapPosition(t[1],t[0],t[2]||0),n=new Me;return s(this,Du).call(this,n,o),{x:n.x,y:n.y}});m(this,"convert3DMapPositionToCoordinate",t=>{let{lat:o,lon:n}=cy(s(this,j).center?.[1]??0,s(this,j).center?.[0]??0,t.x,t.y);return[n,o,t.z]});m(this,"setBackgroundColor",(t,o)=>{s(this,_r).setBackgroundColor(t,o)});m(this,"getMetresPerPixel",()=>{let t=this.container.clientWidth,o=this.container.clientHeight/2,n=this.projectScreenXYToCoordinate(0,o,!0),i=this.projectScreenXYToCoordinate(t,o,!0);return n==null||i==null?void 0:ry(n.coordinate,i.coordinate)/t});m(this,"hideOutdoorLayersUnderPoint",(t,o)=>{!this.map||o?.length===0||(s(this,B).outdoorLayersSystem.hideLayersUnderPoint(t,o),this.render())});m(this,"hideOutdoorLayersIntersectingPolygons",(t,o,n)=>{s(this,B).outdoorLayersSystem.hideLayersIntersectingPolygons(t,o,n),this.render()});S(this,Hc,new Jg);S(this,Sh,new $n);S(this,Th,t=>{A.error("Render failed: ",t,t.stack??"No stack trace available"),this.publish("render-error",{error:t})});m(this,"render",()=>{if(!(s(this,B)?.renderSystem==null||this.aborted))if(this.map&&(this.mode==="outdoors-interleaved"||this.mode==="outdoors-overlay"))this.map.triggerRepaint();else return s(this,B).renderSystem.update().catch(s(this,Th))});m(this,"renderSync",()=>this.aborted?Promise.resolve():s(this,B).renderSystem.update(!0).catch(s(this,Th)));S(this,To,gm(()=>{this.publish("user-interaction-start",void 0)},0,!0));S(this,Co,gm(()=>{this.publish("user-interaction-end",void 0),this.render()},0,!0));m(this,"on",(t,o)=>{this.aborted||(super.on(t,o),["outdoor-view-loaded","outdoor-style-loaded"].includes(t)&&this.mode==="standalone"&&y.env.NODE_ENV!=="test"&&(A.warn(`"${t}" was subscribed to but outdoor view is disabled. The event has been triggered immediately. Enable outdoor view or remove the listener.`),this.publish(t)))});m(this,"off",(t,o)=>{super.off(t,o)});m(this,"getCursor",()=>s(this,B).interactionSystem.getCursor());S(this,Ax,()=>{if(s(this,j).entityScene.removeEventListener("childadded",s(this,Ct)),s(this,j).entityScene.removeEventListener("childadded",s(this,Tr)),s(this,j).entityScene.removeEventListener("childremoved",s(this,Ct)),s(this,j).entityScene.removeEventListener("childremoved",s(this,Tr)),window.removeEventListener("resize",s(this,xh),!1),s(this,hh).removeEventListener("change",s(this,bh)),this.map){for(let t in s(this,_n))for(let o of s(this,_n)[t])this.map.off(t,o);w(this,_n,{})}this._subscribers={}});S(this,Lx,()=>{try{s(this,ma)!=="outdoors-overlay"&&(this.map&&this.map.remove(),this.container&&this.rendererDomElement&&this.container.contains(this.rendererDomElement)&&this.container.removeChild(this.rendererDomElement)),this.container&&(s(this,Rn)&&this.container.contains(s(this,Rn))&&this.container.removeChild(s(this,Rn)),s(this,ct)&&this.container.contains(s(this,ct))&&this.container.removeChild(s(this,ct)))}catch(t){A.warn("Error during DOM cleanup, some elements may not have been removed:",t)}});m(this,"destroy",()=>{s(this,B)&&(this.aborted||s(this,Vc).abort(),s(this,Ax).call(this),this.remove("__scene"),s(this,B).renderSystem.destroy(),s(this,B).cameraSystem.dispose(),s(this,B).exporterSystem.destroy(),s(this,B).outdoorLayersSystem.destroy(),s(this,B).borderSystem.destroy(),s(this,B).drawSystem.destroy(),s(this,Uc)&&s(this,Uc).disconnect(),s(this,_r).destroy(),s(this,Jt)?.traverse(t=>{Ht(t),"dispose"in t&&typeof t.dispose=="function"&&t.dispose()}),w(this,Jt,void 0),s(this,B).htmlControlsSystem.destroy(),s(this,B).collisionSystem.destroy(),s(this,B).interactionSystem.destroy(),s(this,B).domMutationSystem.destroy(),s(this,B).geometryInFocusSystem.destroy(),s(this,B).occlusion2DSystem.destroy(),w(this,B,void 0),s(this,Lx).call(this),w(this,_r,void 0))});S(this,ku,new ae);S(this,Ch,new ae);if(w(this,Vc,new AbortController),s(this,j).useStandaloneCamera=o.useStandaloneCamera??!1,s(this,j).naturalBearing=o.naturalBearing??0,this.convertTo3DMapPosition=this.convertTo3DMapPosition.bind(this),!t.clientWidth||!t.clientHeight)throw new Error("[MappedinJS] Container width and height must be greater than 0");this.convertTo3DMapPosition=this.convertTo3DMapPosition.bind(this),(o.mode==="outdoors-interleaved"||o.mode==="outdoors-overlay")&&o.map&&(w(this,ma,o.mode),this.map=o.map),s(this,j).entityScene.addEventListener("childadded",()=>{s(this,Ct).call(this),s(this,Tr).call(this)}),s(this,j).entityScene.addEventListener("childremoved",()=>{s(this,Ct).call(this),s(this,Tr).call(this)}),s(this,j).geometry3DMap.set(s(this,j).entityScene.userData.entityId,s(this,j).entityScene),o.center&&(s(this,j).center=o.center?[...o.center]:[0,0]),this.options=o,this.container=t,W(this,Jr,G4).call(this),W(this,Jr,U4).call(this),s(this,B).htmlControlsSystem=new ax(this.container,{outdoorEnabled:!!this.map}),s(this,ma)!=="outdoors-overlay"&&s(this,B).htmlControlsSystem.addAttributionControl(this.options.attribution),window.MappedinDebug||(window.MappedinDebug={}),y.env.NODE_ENV==="test"&&(window.MappedinDebug.mapViewCoreInstance=this),w(this,_r,new O1({antialias:typeof o.antialias=="boolean"?o.antialias:!0,alpha:!1,canvas:this.mode!=="standalone"?o.gl?.canvas:void 0,onWebGLContextCreationError:o.onWebGLContextCreationError,onWebGLContextLost:o.onWebGLContextLost,onWebGLContextRestored:x=>{o.onWebGLContextRestored?.(x),s(this,Tr).call(this),s(this,Ct).call(this),this.render()},onWebGLRendererError:o.onWebGLRendererError,backgroundColor:o.backgroundColor||"#ffffff",backgroundAlpha:o.backgroundAlpha??1})),w(this,Jt,new Ra),s(this,ma)!=="standalone"&&s(this,Jt).add(oM()),s(this,Jt).add(s(this,j).entityScene);let n=window.__THREE_DEVTOOLS__;y.env.NODE_ENV==="dev"&&typeof n<"u"&&(n.dispatchEvent(new CustomEvent("observe",{detail:s(this,Jt)})),n.dispatchEvent(new CustomEvent("observe",{detail:s(this,_r)}))),w(this,Vt,new v0(oz,this.aspect,50,1e5)),s(this,j).cameraObject=s(this,Vt),w(this,fh,new mC),s(this,Vt).renderOrder=999;let i=new ws;i.add(s(this,Vt)),w(this,Pu,new ws),s(this,Pu).add(i),s(this,Jt).add(s(this,Pu)),s(this,Vt).updateProjectionMatrix(),s(this,Vt).updateMatrixWorld(!0),this.referenceMap={scale:1,latitude:0,longitude:0,getNorth:()=>0,georeference:[{target:{x:0,y:0}},{target:{x:0,y:0}},{target:{x:0,y:0}},{target:{x:0,y:0}}]},this.rendererDomElement=s(this,_r).domElement(),w(this,Eu,new Me);let a=new Os(1e6,1e6),l=new Nr({color:0,visible:!1});w(this,wl,new Le(a,l)),s(this,wl).name="worldPlane",s(this,Jt).add(s(this,wl)),o.gl?.canvas||t.appendChild(this.rendererDomElement),window.addEventListener("resize",s(this,xh),!1),s(this,hh).addEventListener("change",s(this,bh)),typeof ResizeObserver=="function"&&y.env?.NODE_ENV!=="test"&&(w(this,Uc,new ResizeObserver($C(x=>{s(this,Fu).call(this,x[0].contentRect.width,x[0].contentRect.height)},50))),s(this,Uc)?.observe(t)),t.classList.add("mappedin-map"),this.rendererDomElement.style.width=globalThis.MappedinDebug?.TEST_IOS?"1080px":"100%",this.rendererDomElement.style.height=globalThis.MappedinDebug?.TEST_IOS?"1920px":"100%",y.env.NODE_ENV==="test"&&this.rendererDomElement.setAttribute("data-testid","mappedin-canvas"),this.mode!=="outdoors-overlay"&&this.rendererDomElement.tabIndex!==void 0&&this.rendererDomElement.removeAttribute("tabindex"),s(this,j).canvasWidth=this.rendererDomElement.clientWidth,s(this,j).canvasHeight=this.rendererDomElement.clientHeight,this.rendererDomElement.style.touchAction="manipulation";let c=this.canvasWidth,p=this.canvasHeight;s(this,B).watermarkSystem=new ox(s(this,Vt),s(this,j),o?.watermark),s(this,B).watermarkSystem.on("texture-loaded",this.render),s(this,j).shouldMeasureCanvas=!0,s(this,j).pixelRatio=this.resolutionScale,s(this,Ih).call(this,Math.floor(c*this.resolutionScale),Math.floor(p*this.resolutionScale));let u=new ey(16777215,.3*Math.PI);u.position.set(-150,-150,350),s(this,Jt).add(u);let f=new xC(16777215,.741*Math.PI);s(this,Jt).add(f),s(this,B).cameraSystem=new Ac(s(this,Vt),s(this,Jt),s(this,_r).renderer,s(this,j),{mode:this.mode,canvasHeight:p,canvasWidth:c}),s(this,B).cameraSystem.on("user-dolly-start",s(this,To)),s(this,B).cameraSystem.on("user-pan-start",s(this,To)),s(this,B).cameraSystem.on("user-rotate-start",s(this,To)),s(this,B).cameraSystem.on("user-zoom-start",s(this,To)),s(this,B).cameraSystem.on("user-tilt-start",s(this,To)),s(this,B).cameraSystem.on("user-pedestal-start",s(this,To)),s(this,B).cameraSystem.on("user-dolly-end",s(this,Co)),s(this,B).cameraSystem.on("user-pan-end",s(this,Co)),s(this,B).cameraSystem.on("user-rotate-end",s(this,Co)),s(this,B).cameraSystem.on("user-zoom-end",s(this,Co)),s(this,B).cameraSystem.on("user-tilt-end",s(this,Co)),s(this,B).cameraSystem.on("user-pedestal-end",s(this,Co)),s(this,B).cameraSystem.on("change",()=>{this.publish("camera-change",this.camera),s(this,B).geometryInFocusSystem&&(s(this,B).geometryInFocusSystem.cameraDirty=!0),this.render()}),this.onAbort(()=>{s(this,B).cameraSystem.off("user-dolly-start",s(this,To)),s(this,B).cameraSystem.off("user-pan-start",s(this,To)),s(this,B).cameraSystem.off("user-rotate-start",s(this,To)),s(this,B).cameraSystem.off("user-zoom-start",s(this,To)),s(this,B).cameraSystem.off("user-tilt-start",s(this,To)),s(this,B).cameraSystem.off("user-pedestal-start",s(this,To)),s(this,B).cameraSystem.off("user-dolly-end",s(this,Co)),s(this,B).cameraSystem.off("user-pan-end",s(this,Co)),s(this,B).cameraSystem.off("user-rotate-end",s(this,Co)),s(this,B).cameraSystem.off("user-zoom-end",s(this,Co)),s(this,B).cameraSystem.off("user-tilt-end",s(this,Co)),s(this,B).cameraSystem.off("user-pedestal-end",s(this,Co)),s(this,B).renderSystem.off("measure-canvas",s(this,$c)),s(this,B).cameraSystem.off("change",this.render)}),s(this,B).pathSystem=new uh(s(this,j),this.convertTo3DMapPosition,this.getParentContainer,s(this,B).cameraSystem.convertZoomLevelToAltitude),s(this,B).pathSystem.on("animate:path",this.render),this.onAbort(()=>{s(this,B).pathSystem.off("animate:path",this.render)}),s(this,B).panBoundsSystem=new sx(s(this,j),s(this,B).cameraSystem);let h=()=>{let{panBounds:x,fov:T,convertAltitudeToZoomLevel:v}=s(this,B).cameraSystem;if(s(this,B).panBoundsSystem.autoMinZoomLevel){if(x.radius<=0)return;let I=Math.min(s(this,j).canvasWidth/s(this,j).canvasHeight,1),M=T*Math.PI/180*I,O=Math.tan(M/2),{radius:C,center:E}=s(this,B).cameraSystem.panBounds,_=C/O,G=this.getThreeCamera().getWorldPosition(new ae),R=E.distanceTo(G),N=Math.abs(G.z-E.z),X=_*N/R,z=v(X);tM(z,this.camera.minZoomLevel)&&this.camera.setMinZoomLevel(z)}this.publish("pan-bounds-change",s(this,B).cameraSystem.panBounds)};s(this,B).panBoundsSystem.on("update",h),this.onAbort(()=>{s(this,B).panBoundsSystem.off("update",h)}),this.camera=new rx(this,s(this,B),s(this,j)),this.camera.setZoomLevel(o.zoomLevel??q2),this.camera.setBearing(o.bearing??Q2),this.camera.setPitch(o.pitch??K2),this.camera.setMaxZoomLevel(rz),this.camera.setMinZoomLevel(tz),s(this,B).domVisiblitySystem=new G1(s(this,j),s(this,Rn)),s(this,B).domMutationSystem=new tx(s(this,j),s(this,Rn)),s(this,B).domMutationSystem.on("dimensions-update",()=>{s(this,B).collisionSystem.collidersDirty=!0,this.render()}),s(this,B).domDrawSystem=new ex(s(this,j)),s(this,B).collisionSystem=new P1(s(this,bi),s(this,j),(o.useCollisionWorker??!0)&&(o.useWorkers??!0)),s(this,B).twoDDrawSystem=new V1(s(this,j),s(this,Kt),o.transformImageRequest),s(this,B).twoDDrawSystem.on("img:loaded",this.render),s(this,B).interactionSystem=new Nf(this.rendererDomElement,s(this,j),s(this,Vt),s(this,wl),s(this,B).cameraSystem.isUserInteracting),s(this,B).interactionSystem.on("doubletap-with-onefinger",x=>{s(this,B).cameraSystem.enableZoom&&this.camera.animateTo({center:this.projectScreenXYToCoordinate(x.clientX,x.clientY)?.coordinate,zoomLevel:this.camera.zoomLevel+1,duration:D0,easing:"ease-out"})}),s(this,B).interactionSystem.on("singletap-with-twofinger",()=>{s(this,B).cameraSystem.enableZoom&&this.camera.animateTo({zoomLevel:this.camera.zoomLevel-1,duration:D0,easing:"ease-out"})}),s(this,B).interactionSystem.on("hover",this.render),s(this,B).interactionSystem.on("click",x=>{if(x.entity2D?.id==="watermark"&&typeof s(this,B).watermarkSystem.options.onClick=="function"&&s(this,B).watermarkSystem.options.interactive){s(this,B).watermarkSystem.options.onClick();return}let T=x.entity3D?[x.entity3D?.id]:[];x.entity3D?.parentObject3D?.userData?.entityId&&T.push(x.entity3D?.parentObject3D?.userData?.entityId),this.publish("click",{coordinate:this.convert3DMapPositionToCoordinate(x.position),geometry:T,paths:x.entity3D?.components[0]instanceof Il?[x.entity3D.id]:[],markers:x.entity2D?.components[0]instanceof Ds?[x.entity2D.id]:[],models:x.entity3D?.components[0]instanceof xl?[x.entity3D.id]:[],labels:x.entity2D?.components[0]instanceof Fs?[x.entity2D.id]:[],containers:Array.isArray(x.groupContainers)?x.groupContainers.map(v=>v.userData.entityId):[],pointerEvent:x.pointerEvent})}),s(this,B).interactionSystem.on("hover",x=>{x.position&&this.publish("hover",{coordinate:this.convert3DMapPositionToCoordinate(x.position),geometry:x.entity3D?[x.entity3D?.id]:[],paths:x.entity3D?.components[0]instanceof Il?[x.entity3D.id]:[],markers:x.entity2D?.components[0]instanceof Ds?[x.entity2D.id]:[],models:x.entity3D?.components[0]instanceof xl?[x.entity3D.id]:[],labels:x.entity2D?.components[0]instanceof Fs?[x.entity2D.id]:[],containers:Array.isArray(x.groupContainers)?x.groupContainers.map(T=>T.userData.entityId):[]})}),s(this,B).geometryInFocusSystem=new yx(s(this,j),s(this,Vt));let b=x=>{this.publish("geometry-in-focus",x)};s(this,B).geometryInFocusSystem.on("geometry-in-focus",b),this.onAbort(()=>{s(this,B).geometryInFocusSystem.off("geometry-in-focus",b)}),s(this,B).twoDVisiblitySystem=new H1(s(this,j)),s(this,B).drawSystem=new $1(s(this,j),this.convertTo3DMapPosition),s(this,B).drawSystem.on("texture-loaded",this.render),s(this,B).twoDProjectionSystem=new U1(s(this,j),s(this,Du)),s(this,B).exporterSystem=new jf(s(this,j)),s(this,B).meshOptimizationSystem=new j1(s(this,j),this.convertTo3DMapPosition),s(this,B).meshOptimizationSystem.on("model-loaded",this.render),s(this,B).meshOptimizationSystem.on("geometry-2d-added",this.render),s(this,B).meshOptimizationSystem.on("geometry-group-added",s(this,gh)),this.onAbort(()=>{s(this,B).meshOptimizationSystem.off("model-loaded",this.render),s(this,B).meshOptimizationSystem.off("geometry-2d-added",this.render),s(this,B).meshOptimizationSystem.off("geometry-group-added",s(this,gh))}),s(this,B).meshDetachmentSystem=new Tx(s(this,j)),s(this,B).meshModificationSystem=new Cx(s(this,j)),s(this,B).geometryDisposalSystem=new Dx(s(this,j)),s(this,B).borderSystem=new _M(s(this,j),this.convertTo3DMapPosition),s(this,B).customGeometrySystem=new lx(s(this,j),this.convertTo3DMapPosition),s(this,B).outlineInterpolationSystem=new dx(s(this,j)),s(this,B).renderSystem=new z1(s(this,_r),s(this,j),this.mode,s(this,Jt),s(this,Vt),this.viewCamera,s(this,B)),s(this,B).imageSystem=new gx(s(this,j),this.convertTo3DMapPosition,s(this,Du),o.bearing,o.naturalBearing,o.imagePlacementOptions),s(this,B).text3DSystem=new iM(s(this,j),this.convertTo3DMapPosition,o.useWorkers??!0),s(this,B).text3DSystem.on("render",this.render),s(this,B).imageSystem.on("image-loaded",this.render),s(this,B).renderSystem.on("pre-render",()=>this.publish("pre-render")),s(this,B).renderSystem.on("post-render",()=>this.publish("post-render")),s(this,B).renderSystem.on("measure-canvas",s(this,$c)),this.onAbort(()=>{s(this,B).renderSystem.off("pre-render",()=>this.publish("pre-render")),s(this,B).renderSystem.off("post-render",()=>this.publish("post-render")),s(this,B).renderSystem.off("measure-canvas",s(this,$c))}),s(this,B).outdoorLayersSystem=new vx(this.map),s(this,B).occlusion2DSystem=new Fx(s(this,j),this.convertTo3DMapPosition,s(this,_r)),o.occlusionEnabled&&s(this,B).occlusion2DSystem.enable(),this.Debug=new Px(this),o.environment!==!1&&w(this,Gc,W(this,Jr,J2).call(this)),s(this,kx).call(this)}get viewCamera(){return s(this,fh)}get canvasWidth(){return s(this,j).canvasWidth}get canvasHeight(){return s(this,j).canvasHeight}get resolutionScale(){return this.map?._getClampedPixelRatio(this.canvasWidth,this.canvasHeight)??Tp()}get aspect(){return this.canvasWidth/this.canvasHeight}get mode(){return s(this,ma)}addGroupContainer(t,o,n){if(!s(this,j).geometry3DMap.has(t)&&!s(this,j).geometry2DMap.has(t)){let i=new hr(t);i.addEventListener("childadded",()=>{s(this,Ct).call(this),s(this,Tr).call(this)}),i.addEventListener("childremoved",()=>{s(this,Ct).call(this),s(this,Tr).call(this)}),o?.visible!==void 0&&(i.visible=o.visible),o?.altitude!==void 0&&i.setAltitude(o.altitude),o?.interactive!==void 0&&zo(i,o.interactive,s(this,j)),o?.focusable!==void 0&&hy(i,o.focusable),o?.preloadGeometry!==void 0&&(i.userData.preloadGeometry=o.preloadGeometry),s(this,j).geometry3DMap.set(t,i);let a=this.getParentContainer(n);a instanceof hr&&a.addEntity(i),s(this,Ct).call(this),this.render()}else A.error(`Group container with ID '${t}' already exists. The group container cannot be added.`);return{id:t,type:"group-container"}}addCustomGeometry(t,o,n,i,a){if(s(this,j).geometry3DMap.has(t))A.error(`Custom geometry with ID '${t}' already exists. The custom geometry cannot be added.`);else{let l=new Tu(o,n),c=new Mt(l,new _i(i));i?.interactive!==void 0&&zo(c,i.interactive,s(this,j)),c.id=t,l.mesh.userData={entityId:t,type:"custom-geometry"},s(this,j).geometry3DMap.set(c.id,c);let p=this.getParentContainer(a);a&&p instanceof hr?p.addEntity(c):s(this,j).entityScene.addEntity(c),s(this,Ct).call(this),this.render()}return{id:t,type:"custom-geometry"}}addGeometryGroup(t,o,n,i){if(!s(this,j).geometry3DMap.has(t)&&!s(this,j).geometry2DMap.has(t)){let a=new zn(t);a.addEventListener("childadded",()=>{s(this,Ct).call(this),s(this,Tr).call(this)}),a.addEventListener("childremoved",()=>{s(this,Ct).call(this),s(this,Tr).call(this)}),a.userData.dirty=!0,s(this,j).geometry3DMap.set(t,a);for(let c of o.features){if(c.geometry==null||!["Polygon","MultiPolygon","LineString","MultiLineString"].includes(c.geometry.type))continue;let p=c?.id||c?.properties?.id||ut(),{visible:u,altitude:f,...h}=n||{color:RM},b=s(this,B).meshOptimizationSystem.createEntityFromFeature(p,c,{outline:!0,...h});s(this,j).geometry3DMap.set(p,b),a.userData.entities3D.add(p)}a.setVisible(n?.visible??!0),n?.altitude!=null&&a.setAltitude(n.altitude);let l=this.getParentContainer(i);l instanceof hr&&l.addEntity(a),s(this,Ct).call(this),this.render()}else A.error(`Geometry group with ID '${t}' already exists. The geometry group cannot be added.`);return s(this,B).outlineInterpolationSystem.geometries3DDirty=!0,{id:t,type:"geometry-group"}}addOccluder(t,o){let n=this.getParentContainer(o),i=s(this,B).occlusion2DSystem.reserveOccluderId();return n?.addOccluderFeature(t,i),i}addImage(t,o,n,i){try{S4(t,o,n)}catch(a){A.error(a);return}if(!s(this,j).geometry3DMap.has(t)&&!s(this,j).geometry2DMap.has(t)){let a=new hx(o),l=new Mt(a,new _i(n));l.id=t||ut(),a.mesh.userData={entityId:l.id,type:"path"},s(this,j).geometry3DMap.set(l.id,l);let c=this.getParentContainer(i);c instanceof hr&&c.addEntity(l),s(this,Ct).call(this),this.render()}else A.error(`Image with ID '${t}' already exists. The image cannot be added.`);return{id:t,type:"image"}}addModelGroup(t,o,n,{parent:i,onComplete:a}={}){try{YD(t,o,n)}catch(l){A.error(l);return}if(!s(this,j).geometry3DMap.has(t)&&!s(this,j).geometry2DMap.has(t)){let l=new zn(t);l.addEventListener("childadded",()=>{s(this,Ct).call(this),s(this,Tr).call(this)}),l.addEventListener("childremoved",()=>{s(this,Ct).call(this),s(this,Tr).call(this)}),s(this,j).geometry3DMap.set(t,l),l.userData.dirty=!0,l.userData.modelURL=n.url;for(let p of o.features){let u=p.id||p.properties.id||ut(),f=s(this,B).meshOptimizationSystem.createModelFromFeature(u,p,{...n});(p.properties.interactive!==void 0||n.interactive!=null)&&zo(f,p.properties.interactive??n.interactive,s(this,j)),f.parentId=l.userData.entityId,s(this,j).geometry3DMap.set(u,f),l.userData.entities3D.add(u)}let c=this.getParentContainer(i);c instanceof hr&&c.addEntity(l),s(this,Ct).call(this),this.render()?.then(a)}else A.error(`Model group with ID '${t}' already exists. The model group cannot be added.`);return{id:t,type:"geometry-group"}}addMarker2D(t,o,n,i){let a=n?.id;try{VC(t,o,n||{})}catch(l){A.error(l);return}if(a===void 0||!s(this,j).geometry2DMap.has(a)&&!s(this,j).geometry3DMap.has(a)){let l=W(this,Jr,Y2).call(this,t,new Ds(o,n),n?.occluderId,n?.verticalOffset);l.id=a||String(l.id),a=l.id,n?.interactive!=null&&n.interactive!=="pointer-events-auto"&&zo(l,n?.interactive,s(this,j));let c=typeof n?.attachTo=="string"||typeof n?.attachTo=="number"?s(this,j).geometry3DMap.get(n.attachTo):void 0;c instanceof Mt&&c.attach(l),this.getParentContainer(i)?.addEntity(l),this.render()}else A.error(`Marker2D with ID '${a}' already exists. The marker cannot be added.`);return{id:a,type:"marker"}}addText3D(t,o,n,i){if(!s(this,j).geometry3DMap.has(t)&&!s(this,j).geometry2DMap.has(t)){let a=new my({...o,properties:{...o.properties,id:t,content:o.properties.text}}),l=new Mt(a,new ym(n?.appearance));l.id=t,a.mesh.userData.entityId=t.toString(),a.mesh.userData.type="text3d",s(this,j).geometry3DMap.set(t,l);let c=this.getParentContainer(i);c instanceof hr&&c.addEntity(l),s(this,Ct).call(this),this.render()}else A.error(`Text3D with ID '${t}' already exists. The text3d cannot be added.`);return{id:t,type:"text3d"}}labelText3D(t,o,n={}){try{if(!o||!t)throw new Error("content and meshGeometryId are required");lM.parse(n)}catch(p){A.error(p);return}let i=s(this,j).geometry3DMap.get(t);if(i?.type!=="geometry"){A.error(".labelText3D failed: target incorrect");return}let a=i?.components[0];if(!a.feature.properties.textArea)return;if(a.textEntityId){let p=s(this,j).geometry3DMap.get(a.textEntityId);if(p?.type!=="text3d"){A.error(".labelText3D failed: existing text3d not found");return}return{id:p.id,type:p.type}}let l=new my({type:"Feature",geometry:{coordinates:a.feature.properties.textArea?.position,type:"Point"},properties:{textArea:a.feature.properties.textArea,content:o,id:ut()}});l.polygonEntityId=t;let c=new Mt(l,new ym(n?.appearance));return a.textEntityId=c.id.toString(),l.mesh.userData.entityId=c.id.toString(),l.mesh.userData.type="text3d",s(this,j).geometry3DMap.set(c.id.toString(),c),n.parentId&&this.getParentContainer(n.parentId)?.addEntity(c),this.render(),{id:c.id,type:"text3d"}}addLabel2D(t,o,n,i){let a=n?.id;try{GC(t,o,n||{})}catch(l){A.error(l);return}if(a===void 0||!s(this,j).geometry2DMap.has(a)&&!s(this,j).geometry3DMap.has(a)){let l=W(this,Jr,Y2).call(this,t,new Fs(o,n||{},s(this,j)),n?.occluderId,n?.verticalOffset);l.id=a||String(l.id),a=l.id,n?.interactive!=null&&zo(l,n?.interactive,s(this,j));let c=typeof n?.attachTo=="string"||typeof n?.attachTo=="number"?s(this,j).geometry3DMap.get(n.attachTo):void 0;c instanceof Mt&&c.attach(l),this.getParentContainer(i)?.addEntity(l),s(this,Tr).call(this),this.render()}else A.error(`Label2D with ID '${a}' already exists. The label cannot be added.`);return{id:a,type:"label"}}addPath(t,o={},n){try{r4(t,o||{})}catch(c){A.error(c);return}let i=new Il(t,FM(o)),a=new Mt(i,new _i({color:o?.color??"#ff834c",altitude:o?.verticalOffset??.1}));a.id=o?.id||ut(),i.mesh.userData={entityId:a.id,type:"path"},s(this,j).geometry3DMap.set(a.id,a),o?.interactive!=null&&zo(a,o?.interactive,s(this,j));let l=this.getParentContainer(n);return l instanceof hr&&l.addEntity(a),s(this,Ct).call(this),this.render(),{id:a.id,type:"path"}}updateWatermark(t){s(this,B).watermarkSystem.options=t,s(this,B).watermarkSystem.dirty=!0,s(this,B).collisionSystem.collidersDirty=!0,this.render()}remove(t){let o;if(typeof t=="string"||typeof t=="number"?(o=s(this,j).geometry2DMap.get(t),o==null&&(o=s(this,j).geometry3DMap.get(t))):typeof t.id=="string"||typeof t.id=="number"?(o=s(this,j).geometry2DMap.get(t.id),o==null&&(o=s(this,j).geometry3DMap.get(t.id))):o=t,o!=null){if(o.type==="custom-geometry")s(this,j).geometry3DMap.delete(o.id),o.object3d&&Ht(o.object3d);else if(o.type==="group-container"){s(this,j).geometry3DMap.delete(o.userData.entityId);for(let i of o.childrenIds.values())this.remove(i),o.userData.entities2D.delete(i);let n=o.components[1];n&&n.focusMesh&&Ht(n.focusMesh),Ht(o)}else if(o.type==="geometry-group"){s(this,j).geometry3DMap.delete(o.userData.entityId);for(let n of o.userData.entities3D.values())this.remove(n),o.userData.entities3D.delete(n);Ht(o)}else if(o.type==="geometry"||o.type==="model"||o.type==="path"){let n=o.components[0],i=o.components[4];if(o.entities2D.size>0){for(let l of o.entities2D.values())this.remove(l);o.removeAllEntities()}let a=o.parentObject3D?.userData.entityId??o.parentId;if(a){let l=s(this,j).geometry3DMap.get(a);l instanceof zn&&l.userData.entities3D.delete(o.id)}if(o.object3d&&Ht(o.object3d),o.type==="geometry"){let l=o.components[3];l&&(l.enabled=!1,l.dirty=!0)}i&&"focusMesh"in i&&i.focusMesh!=null&&Ht(i.focusMesh),"textMesh"in n&&n.textMesh!=null&&this.remove(n.textMesh.userData.entityId),s(this,j).geometry3DMap.delete(o.id)}else if(o.type==="marker"||o.type==="label"){let n=o.attachedTo;if(n){let i=s(this,j).geometry3DMap.get(n);i instanceof Mt&&i.detach(o)}o.object3d&&Ht(o.object3d),o.type==="label"&&delete s(this,B).twoDDrawSystem.textCache[o.id],s(this,j).geometry2DMap.delete(o.id)}else if(o.type==="image")o.object3d&&Ht(o.object3d),s(this,j).geometry3DMap.delete(o.id);else if(o.type==="text3d"){Ht(o.object3d);let{batchedText:n,textMesh:i,polygonEntityId:a}=o.components[0];if(i&&(n&&n.removeText(i),Ht(i)),a){s(this,B).text3DSystem.remove(a);let l=s(this,j).geometry3DMap.get(a);l?.type==="geometry"&&(l.components[0].textMesh=void 0,l.components[0].textEntityId=void 0)}s(this,j).geometry3DMap.delete(o.id)}s(this,Ct).call(this),s(this,Tr).call(this),this.render()}}getScene(){return this.getState("__scene")}getThreeScene(){return s(this,Jt)}getThreeCamera(){return s(this,Vt)}async setEnvironment(t){if(s(this,Jt))if(t==="basic"){s(this,Gc)||w(this,Gc,W(this,Jr,J2).call(this));let o=await s(this,Gc);s(this,Jt).environment=o}else s(this,Jt).environment=null}getEnvironment(){return s(this,Jt)?.environment?"basic":!1}getCurrentSceneGLTF(t){return s(this,B).exporterSystem.getCurrentSceneGLTF(t)}getBoundingArea(t){(s(this,B).renderSystem.threeDdirty||s(this,B).renderSystem.twoDdirty)&&this.renderSync();let o=new sr;if(t==null)o.setFromObject(s(this,j).entityScene);else{let n=Sp(s(this,j),t);if(n?.type==="geometry"&&n?.object3d!=null){let i=n.components[0],a=i instanceof fr?i.geometry:void 0;i.mesh instanceof Kg&&a?(a.computeBoundingBox(),a.boundingBox&&o.union(a.boundingBox)):o.setFromObject(n.object3d)}else(n?.type==="geometry-group"||n?.type==="group-container")&&n?.userData.entityId!=null&&o.setFromObject(n)}if(Bl(o))return zC(o).map(this.convert3DMapPositionToCoordinate)}hasState(t){return Sp(s(this,j),t)!=null}getState(t){if(t==null)return{type:"map-view",hoverColor:s(this,j).hoverColor,text3dHoverColor:s(this,j).text3dHoverColor};let o=Sp(s(this,j),t);if(o?.type==="custom-geometry"){let n=o.components[0],i=o.components[1];return{id:o.id,type:"custom-geometry",visible:i.visible,altitude:i.altitude,parent:o.parentObject3D?.userData.entityId,position:this.convert3DMapPositionToCoordinate(n.position)}}else if(o?.type==="geometry-group"){let n=Array.from(o.userData.entities3D.values()),i=n?.[0],a=i?this.getState(i):{};return{id:o.userData.entityId,type:"geometry-group",visible:o.visible,altitude:o.altitude,color:a?.color,initialColor:a?.initialColor,side:a?.side??"double",opacity:a?.opacity,height:a?.height,texture:a?.texture,topColor:a?.topColor,topTexture:a?.topTexture,interactive:a?.interactive,children:n,bevel:a?.bevel}}else{if(o?.type==="group-container")return{id:o.userData.entityId,type:"group-container",visible:o.visible,altitude:o.getWorldPosition(nz).z??0,opacity:o.opacity,interactive:!!o.components[0],children:Array.from(o.childrenIds.values()).map(n=>this.getState(n)).filter(Boolean)};if(o?.type==="label"){let n=o.components[0],i=o.object3d.parent,a=i?.userData.entityId;return{id:o.id,type:"label",text:n.text||"",parent:{id:a,type:i?.type},position:this.convert3DMapPositionToCoordinate(o.position),enabled:n.enabled,visible:n.visible,initialRank:fm(n.initialRank),options:{rank:fm(n.rank),appearance:n.appearance,interactive:o.components[1]!=null,verticalOffset:o.verticalOffset,attachTo:o.attachedTo}}}else if(o?.type==="marker"){let n=o.components[0],i=o.object3d.parent,a=i?.userData.entityId;return{id:o.id,type:"marker",enabled:n.enabled,visible:n.visible,placement:n.options.placement,dynamicResize:n.options.dynamicResize,parent:{id:a,type:i?.type},position:this.convert3DMapPositionToCoordinate(o.position),element:n.containerEl,initialRank:fm(n.initialRank),contentHTML:n.contentHtml,options:{rank:fm(n.rank),interactive:o.components[1]!=null||!1,verticalOffset:o.verticalOffset,attachTo:o.attachedTo,lowPriorityPin:n.options.lowPriorityPin}}}else if(o?.type==="geometry"){let{color:n,hoverColor:i,initialColor:a,initialTopColor:l,topColor:c,altitude:p}=o.components[1],u=o.components[0],f=o.components[1],h=o.components[1],b=o.components[2],x=o.components[3],T=o.parentObject3D;return{id:o.id,type:"geometry",opacity:h.opacity,initialColor:a,color:n,focusable:f!=null&&f.focusMesh!=null,initialTopColor:l,topColor:c,side:h.side,hoverColor:i,hovered:!!b?.hover,height:h.height,visible:h.visible,outline:x?.enabled,showImage:h.showImage,texture:h.texture,topTexture:h.topTexture,flipImageToFaceCamera:h.flipImageToFaceCamera,enableImageCollisions:h.enableImageCollisions,parent:{id:T?.userData.entityId,type:T?.type},altitude:p,bevel:h.bevel,position:this.convert3DMapPositionToCoordinate(u.position),interactive:o.components[2]!=null,borderVisible:h.borderVisible,borderColor:h.borderColor,borderWidth:h.borderWidth}}else if(o?.type==="model"){let n=o.components[0],i=o.components[1],a=o.components[2];return{id:o.id,type:"model",position:n.mesh?this.convert3DMapPositionToCoordinate(n.mesh?.getWorldPosition(new ae)):this.convert3DMapPositionToCoordinate(n.position),interactive:a!=null,material:i.material,parent:o.parentObject3D?.parent?{id:o.parentObject3D.parent.userData.entityId,type:o.parentObject3D.parent.type}:void 0,visible:i.visible,verticalOffset:i.verticalOffset,color:i.color,opacity:i.opacity,rotation:i.rotation??Op,scale:i.scale??wp}}else if(o?.type==="path"){let n=o.components[0],i=o.components[2],a=o.components[1];return{id:o.id,type:"path",position:this.convert3DMapPositionToCoordinate(n.position),visible:a.visible,interactive:i!=null,completeFraction:n.completeFraction,color:a.color,accentColor:n.accentColor,width:n.width,animateArrowsOnPath:n.animateArrowsOnPath,displayArrowsOnPath:n.displayArrowsOnPath,verticalOffset:a.altitude}}else if(o?.type==="image"){let n=o.components[0];return{id:o.id,type:"image",position:this.convert3DMapPositionToCoordinate(n.position),visible:o.components[1].visible,verticalOffset:n.feature.properties.verticalOffset??0,opacity:o.components[1].opacity,flipImageToFaceCamera:o.components[1].flipImageToFaceCamera,width:n.feature.properties.width??0,height:n.feature.properties.height??0,rotation:n.feature.properties.rotation??0}}else if(o?.type==="text3d"&&o.components[0]instanceof my&&"textArea"in o.components[0].feature.properties){DM(o);let n=o.components[0],i=o.components[1],{textMesh:a}=n,l=n.mesh?.parent;l instanceof hr&&l.children.find(u=>u.type==="batchedtext")?.getWorldPosition(s(this,Ch)),s(this,ku).set(0,0,0);let c=a?a.getWorldPosition(s(this,ku)):s(this,ku);return Object.assign({},Mp,i.getState(),{id:o.id,type:"text3d",position:this.convert3DMapPositionToCoordinate(c.add(s(this,Ch))),visible:n.visible??!1,content:n.feature.properties.content??""})}else return}}setState(t,o){if(typeof t=="object"&&o==null){"hoverColor"in t&&(um(t.hoverColor)?s(this,j).hoverColor=t.hoverColor??s(this,j).hoverColor:A.warn(`Failed to update global hover color. Invalid color "${t.hoverColor}".`)),"text3dHoverColor"in t&&(s(this,j).text3dHoverColor=t.text3dHoverColor??s(this,j).text3dHoverColor);return}let n=Sp(s(this,j),t);if(n!=null){if(n.type==="custom-geometry"){let i=s(this,j).geometry3DMap.get(n.id);if(i instanceof Mt&&i.components[0]instanceof Tu){let a=o;Ua(n,s(this,j),a.visible),Ep(n,a.altitude),N0(n,a.position,this.convertTo3DMapPosition),j0(n,this.getParentContainer(a.parent,!1)),zo(n,a.interactive,s(this,j))&&s(this,Ct).call(this)}}else if(n.type==="path"){let i=o;zo(n,i.interactive,s(this,j))&&s(this,Ct).call(this),Ep(n,i.verticalOffset),PM(n,s(this,j),i)}else if(n.type==="model"){let i=o;zo(n,i.interactive,s(this,j))&&s(this,Ct).call(this),Ua(n,s(this,j),i.visible),AM(n,i)}else if(n.type==="group-container"){let i=o;Ua(n,s(this,j),i.visible)&&(s(this,B).pathSystem.verticalDistanceDirty=!0,s(this,B).geometryInFocusSystem.focusablesDirty=!0),Ep(n,i.altitude)&&(s(this,B).pathSystem.verticalDistanceDirty=!0),zo(n,i.interactive,s(this,j))&&s(this,Ct).call(this),fy(n,s(this,j),i.opacity)&&(s(this,B).outlineInterpolationSystem.outlineOpacitiesDirty=!0),i.preloadGeometry&&n.userData.preloadGeometry!==!0&&(n.userData.preloadGeometry=!0,s(this,B).outlineInterpolationSystem.geometries3DDirty=!0),hy(n,i.focusable)&&(s(this,B).geometryInFocusSystem.focusablesDirty=!0)}else if(n.type==="geometry-group"){let i=o;Ua(n,s(this,j),i.visible),fM(n,s(this,j),i),U0(n,s(this,j),i.outline),i.height!=null&&B0(n,s(this,j),i.height),Ep(n,i.altitude),CM(n,s(this,j),i),hM(n,s(this,j),i.shading),fy(n,s(this,j),i.opacity)&&(s(this,B).outlineInterpolationSystem.outlineOpacitiesDirty=!0),zo(n,i.interactive,s(this,j))&&(s(this,Ct).call(this),s(this,Tr).call(this)),V0(n,s(this,j),i.side)}else if(n.type==="geometry"){if(n.components[0]instanceof fr){let i=o;Ua(n,s(this,j),i.visible),U0(n,s(this,j),i.outline),gM(n,i),hy(n,i.focusable)&&(s(this,B).geometryInFocusSystem.focusablesDirty=!0),OM(n,i.renderOrder)&&(s(this,B).meshDetachmentSystem.dirty=!0),wM(n,i.opacity)&&(s(this,B).meshDetachmentSystem.dirty=!0,s(this,B).interactionSystem.dirty3D=!0,s(this,B).outlineInterpolationSystem.outlineOpacitiesDirty=!0),G0(n,i.flipImageToFaceCamera),TM(n,i.enableImageCollisions),Ep(n,i.altitude),i.height!=null&&B0(n,s(this,j),i.height),MM(n,i)&&(s(this,B).meshDetachmentSystem.dirty=!0),yM(n,i),IM(n,i.hoverColor),zo(n,i.interactive,s(this,j)),SM(n,i.hovered),V0(n,s(this,j),i.side),EM(n,i)}s(this,Ct).call(this)}else if(n.type==="label"||n.type==="marker"){let i=o;vM(n,o,s(this,j)),xM(n,o,s(this,j))&&(s(this,Tr).call(this),s(this,B).domMutationSystem.dirty=!0),N0(n,i.position,this.convertTo3DMapPosition),j0(n,this.getParentContainer(i.parent,!1))&&(s(this,Tr).call(this),s(this,B).panBoundsSystem.dirty=!0),bM(n,i.enabled),Ua(n,s(this,j),i.visible)}else if(n.type==="image"){let i=o;Ua(n,s(this,j),i.visible),fy(n,s(this,j),i.opacity),G0(n,i.flipImageToFaceCamera)}else if(n.type==="text3d"){let i=o;kM(n,s(this,j),i)}this.render()}}convertTo3DMapPosition(t,o,n=0,i){if(Array.isArray(t))return this.convertTo3DMapPosition(t[1],t[0],t[2]??n,typeof o=="function"?o:void 0);if(typeof o!="number")throw new Error("convertTo3DMapPosition failed: longitude must be a number");let{x:a,y:l}=py(s(this,j).center?.[1]??0,s(this,j).center?.[0]??0,t,o);return i?(i.set(a,l,n),i):new ae(a,l,n)}get backgroundColor(){return typeof s(this,_r).backgroundColor=="string"?s(this,_r).backgroundColor:`#${s(this,_r).backgroundColor.getHexString()}`}get backgroundAlpha(){return s(this,_r).backgroundAlpha}getThreeRenderer(){return s(this,_r)}getCenter(t){let o=Array.isArray(t)?t:this.getBoundingArea(t);return o?eM(o):void 0}isInView(t){let o=Sp(s(this,j),t);if(s(this,Sh).identity().multiply(s(this,Vt).projectionMatrix).multiply(s(this,Vt).matrixWorldInverse),s(this,Hc).setFromProjectionMatrix(s(this,Sh)),o instanceof P0)return s(this,Hc).containsPoint(o.position);if(o instanceof Mt){let n=o?.components[0];if(n instanceof Tu||n instanceof xl)return s(this,Hc).containsPoint(this.convertTo3DMapPosition(n.feature.geometry.coordinates));if(n instanceof fr){let i=new sr(this.convertTo3DMapPosition(n.featureBbox[1],n.featureBbox[0],0),this.convertTo3DMapPosition(n.featureBbox[3],n.featureBbox[2],0));return s(this,Hc).intersectsBox(i)}}return!1}queryGeometry2DInView(t){let{screenOffsets:o,fullyContains:n}=t??{},[i,a,l,c]=nM(this.container,o),p=new rt(i,a,l,c);return s(this,B).collisionSystem.visibleCollidersQTree.queryRect(p).filter(b=>n?p.contains(b):p.intersects(b)).map(b=>s(this,j).geometry2DMap.get(b.userData.entityId)).filter(b=>b!=null).filter(b=>b.components[0]instanceof Fs||b.components[0]instanceof Ds).map(b=>b.id.toString())}onMapLibreEvent(t,o){if(!this.map){A.warn(`Tried to add event listener "${t}" but MapLibre map is not initialized.`);return}this.map.on(t,o),s(this,_n)[t]=s(this,_n)[t]||[],s(this,_n)[t].push(o)}offMapLibreEvent(t,o){!this.map||!Array.isArray(s(this,_n)[t])||(this.map.off(t,o),s(this,_n)[t]=s(this,_n)[t].filter(n=>n!==o))}get aborted(){return s(this,Vc).signal.aborted}onAbort(t){s(this,Vc).signal.addEventListener("abort",t,{once:!0})}getSystems(){return s(this,B)}getInternalState(){return s(this,j)}getInternalTweenGroup(){return s(this,j).internalTweenGroup}getExternalTweenGroup(){return s(this,j).externalTweenGroup}computeMinZOffsetBetweenContainers(t,o,n){if(!t||!o)return-1;xp(t,"group-container"),xp(o,"group-container");let i=dy(t,this.getThreeCamera()),a=o.clone(),l=dy(a,this.getThreeCamera());if(!Bl(i)||!Bl(l))return-1;let c=0,p;n&&this.container.querySelectorAll(".debug-box").forEach(f=>f.remove());do{if(c>1e4)return-1;if(c+=20,a.position.z=c,a.updateMatrixWorld(),l.makeEmpty(),dy(a,s(this,Vt),l),p=i.intersectsBox(l),n){let u=_0(i,"blue",this.container),f=_0(l,p?"red":"green",this.container);u.classList.add("debug-box"),f.classList.add("debug-box")}}while(p);return c}};Jt=new WeakMap,Vt=new WeakMap,Gc=new WeakMap,fh=new WeakMap,Eu=new WeakMap,wl=new WeakMap,Uc=new WeakMap,Pu=new WeakMap,Jr=new WeakSet,X2=function(t){s(this,ma)!=="outdoors-overlay"&&this.map?.setPixelRatio(t),s(this,j).pixelRatio=this.resolutionScale},j=new WeakMap,_n=new WeakMap,Vc=new WeakMap,ct=new WeakMap,bi=new WeakMap,Kt=new WeakMap,Rn=new WeakMap,_r=new WeakMap,B=new WeakMap,hh=new WeakMap,Tr=new WeakMap,Ct=new WeakMap,G4=function(){w(this,ct,document.createElement("div")),s(this,ct).classList.add("mappedin__smart-collision-engine__container"),w(this,bi,document.createElement("canvas")),s(this,bi).classList.add("mappedin__smart-collision-engine-debug__container"),this.container.appendChild(s(this,ct)),w(this,Kt,document.createElement("canvas")),s(this,Kt).classList.add("mappedin__smart-collision-engine__container"),s(this,Kt).width=s(this,ct).clientWidth*this.resolutionScale,s(this,Kt).height=s(this,ct).clientHeight*this.resolutionScale,s(this,Kt).style.width=s(this,ct).clientWidth+"px",s(this,Kt).style.height=s(this,ct).clientHeight+"px",s(this,ct).appendChild(s(this,bi)),s(this,ct).appendChild(s(this,Kt)),s(this,bi).width=s(this,ct).clientWidth,s(this,bi).height=s(this,ct).clientHeight,s(this,Kt).width=s(this,ct).clientWidth*this.resolutionScale,s(this,Kt).height=s(this,ct).clientHeight*this.resolutionScale,s(this,Kt).style.width=s(this,ct).clientWidth+"px",s(this,Kt).style.height=s(this,ct).clientHeight+"px"},U4=function(){w(this,Rn,document.createElement("div")),s(this,Rn).classList.add("mappedin-2d-entities"),Object.assign(s(this,Rn).style,{position:"absolute",top:"0",left:"0",bottom:"0",right:"0",pointerEvents:"none","transform-style":"preserve-3d"}),this.container.appendChild(s(this,Rn))},V4=function(){s(this,Kt).width=s(this,ct).clientWidth*this.resolutionScale,s(this,Kt).height=s(this,ct).clientHeight*this.resolutionScale,s(this,Kt).style.width=s(this,ct).clientWidth+"px",s(this,Kt).style.height=s(this,ct).clientHeight+"px",s(this,bi).width=s(this,ct).clientWidth,s(this,bi).height=s(this,ct).clientHeight,s(this,Kt).width=s(this,ct).clientWidth*this.resolutionScale,s(this,Kt).height=s(this,ct).clientHeight*this.resolutionScale,s(this,Kt).style.width=s(this,ct).clientWidth+"px",s(this,Kt).style.height=s(this,ct).clientHeight+"px",s(this,B).collisionSystem.collidersDirty=!0},ma=new WeakMap,gh=new WeakMap,yh=new WeakMap,bh=new WeakMap,xh=new WeakMap,Fu=new WeakMap,kx=new WeakMap,vh=new WeakMap,Du=new WeakMap,Ih=new WeakMap,$c=new WeakMap,Y2=function(t,o,n,i){let a=new P0(o,this.convertTo3DMapPosition(t[1],t[0],t[2]||0),i);return a.occluderId=n??s(this,B).occlusion2DSystem.backgroundId,s(this,j).geometry2DMap.set(a.id,a),a},Hc=new WeakMap,Sh=new WeakMap,Th=new WeakMap,To=new WeakMap,Co=new WeakMap,J2=async function(){return vl.load(FD).then(t=>(s(this,Jt)&&(s(this,Jt).environment?.dispose(),t.mapping=oC,s(this,Jt).environment=t,this.render()),t))},Ax=new WeakMap,Lx=new WeakMap,ku=new WeakMap,Ch=new WeakMap;var nz=new ae,eT=Z2;d();function iz(e,r){sz(e,r)(e.getScene(),r),az(e,r),r.addFolder("Export").add({export:async()=>{let a=await e.getCurrentSceneGLTF({binary:!0}),l=new Blob([a],{type:"application/octet-stream"});var c=document.createElement("a");document.body.appendChild(c),c.style.display="none";let p=window.URL.createObjectURL(l);c.href=p,c.download="scene.glb",c.click(),window.URL.revokeObjectURL(p)}},"export");let n=r.addFolder("Camera"),i={get bearing(){return e.camera.bearing},set bearing(a){e.camera.setBearing(a)},get pitch(){return e.camera.pitch},set pitch(a){e.camera.setPitch(a)},get zoomLevel(){return e.camera.zoomLevel},set zoomLevel(a){e.camera.setZoomLevel(a)}};n.add(i,"bearing",-359,359,1),n.add(i,"pitch",e.camera.minPitch,e.camera.maxPitch,1),n.add(i,"zoomLevel",e.camera.minZoomLevel,e.camera.maxZoomLevel,.1)}function sz(e,r){let t=r;return function o(n,i){let a=i.addFolder(`${[n.type]} ${n.id.slice(0,16)}`);if(i.close(),n.type==="geometry"||n.type==="model"||n.type==="path"||n.type==="image"){let l={get height(){let c=e.getState(n.id);return c?.type==="geometry"?c.height:0},set height(c){e.getState(n.id)?.type==="geometry"&&e.setState(n,{height:c})},set flipImageToFaceCamera(c){e.getState(n.id)?.type==="image"&&e.setState(n,{flipImageToFaceCamera:c})},get flipImageToFaceCamera(){let c=e.getState(n.id);return c?.type==="image"?c.flipImageToFaceCamera:!1},set visible(c){let p=e.getState(n.id);(p?.type==="geometry"||p?.type==="path"||p?.type==="image")&&e.setState(n,{visible:c})},get visible(){let c=e.getState(n.id);return c?.type==="geometry"||c?.type==="path"||c?.type==="image"?c.visible:!1},set outline(c){e.getState(n.id)?.type==="geometry"&&e.setState(n,{outline:c})},get outline(){let c=e.getState(n.id);return c?.type==="geometry"?c.outline:!1},get opacity(){let c=e.getState(n.id);return c?.type==="geometry"?c.opacity:1},set opacity(c){let p=e.getState(n.id);p?.type==="geometry"&&e.setState(p,{opacity:c})},get color(){let c=e.getState(n.id);return c?.type==="geometry"&&c.color?BC(c.color).toHexString():"#ffffff"},set color(c){let p=e.getState(n.id);p?.type==="geometry"&&e.setState(p,{color:c})},set interactive(c){let p=e.getState(n.id);(p?.type==="geometry"||p?.type==="model"||p?.type==="path")&&(e.setState(n,{interactive:c}),t.controllersRecursive().forEach(u=>u.updateDisplay()))},get interactive(){let c=e.getState(n.id);return c?.type==="geometry"||c?.type==="model"||c?.type==="path"?c.interactive:!1},get completeFraction(){let c=e.getState(n.id);return c?.type==="path"?c.completeFraction:1},set completeFraction(c){let p=e.getState(n.id);p?.type==="path"&&e.setState(p,{completeFraction:c})},focus:()=>{}};a.add(l,"focus").onChange(()=>{let c=e.getState(n.id);c?.type==="model"||c?.type==="path"||c?.type==="image"?e.camera.focusOn([c.position]):c?.type==="geometry"&&e.camera.focusOn(e.getBoundingArea(c))}),a.add(l,"visible"),n.type==="image"?a.add(l,"flipImageToFaceCamera"):(a.add(l,"interactive"),n.type==="path"&&a.add(l,"completeFraction",0,1,.1),n.type!=="model"&&(a.addColor(l,"color"),a.add(l,"outline"))),n.type==="geometry"&&(a.add(l,"height"),a.add(l,"opacity",0,1,.1))}else if(n.type==="marker"){let l={get interactive(){let c=e.getState(n.id);return c?.type==="marker"?c.options?.interactive:!1},set interactive(c){let p=e.getState(n.id);p?.type==="marker"&&(e.setState(p,{options:{interactive:c}}),t.controllersRecursive().forEach(u=>u.updateDisplay()))},focus:()=>{}};a.add(l,"focus").onChange(()=>{let c=e.getState(n.id);c?.type==="marker"&&e.camera.focusOn([c.position])}),a.add(l,"interactive")}else if(n.type==="label"){let l={get interactive(){let c=e.getState(n.id);return c?.type==="label"?c.options?.interactive:!1},set interactive(c){let p=e.getState(n.id);p?.type==="label"&&(e.setState(p,{options:{interactive:c}}),t.controllersRecursive().forEach(u=>u.updateDisplay()))},get text(){let c=e.getState(n.id);return c?.type==="label"?c.text:""},set text(c){let p=e.getState(n.id);p?.type==="label"&&e.setState(p,{text:c})},get"Text Color"(){let c=e.getState(n.id);return c?.type==="label"?c.options.appearance?.textColor:"#000000"},set"Text Color"(c){e.getState(n.id)?.type==="label"&&e.setState(n.id,{text:l.text,options:{appearance:{textColor:c}}})},get"Text Size"(){let c=e.getState(n.id);return c?.type==="label"?c.options.appearance?.textSize:10},set"Text Size"(c){let p=e.getState(n.id);p?.type==="label"&&e.setState(p,{text:l.text,options:{appearance:{textSize:c}}})},get"Icon Size"(){let c=e.getState(n.id);return c?.type==="label"?c.options.appearance?.iconSize:10},set"Icon Size"(c){let p=e.getState(n.id);p?.type==="label"&&e.setState(p,{text:l.text,options:{appearance:{iconSize:c}}})},get"Pin Color"(){let c=e.getState(n.id);return c?.type==="label"?c.options.appearance?.pinColor:"#000000"},set"Pin Color"(c){let p=e.getState(n.id);p?.type==="label"&&e.setState(p,{text:l.text,options:{appearance:{pinColor:c}}})},get"Pin Color Inactive"(){let c=e.getState(n.id);return c?.type==="label"?c.options.appearance?.pinColorInactive:"#000000"},set"Pin Color Inactive"(c){let p=e.getState(n.id);p?.type==="label"&&e.setState(p,{text:l.text,options:{appearance:{pinColorInactive:c}}})},get"Pin Outline Color"(){let c=e.getState(n.id);return c?.type==="label"?c.options.appearance?.pinOutlineColor:"#000000"},set"Pin Outline Color"(c){let p=e.getState(n.id);p?.type==="label"&&e.setState(p,{text:l.text,options:{appearance:{pinOutlineColor:c}}})},get"Pin Outline Color Inactive"(){let c=e.getState(n.id);return c?.type==="label"?c.options.appearance?.pinOutlineColorInactive:"#000000"},set"Pin Outline Color Inactive"(c){let p=e.getState(n.id);p?.type==="label"&&e.setState(p,{text:l.text,options:{appearance:{pinOutlineColorInactive:c}}})},focus:()=>{}};a.add(l,"focus").onChange(()=>{let c=e.getState(n.id);c?.type==="label"&&e.camera.focusOn([c.position])}),a.add(l,"interactive"),a.add(l,"text"),a.add(l,"Text Size",10,50),a.add(l,"Icon Size",10,50),a.addColor(l,"Text Color"),a.addColor(l,"Active Background Color"),a.addColor(l,"Inactive Background Color"),a.addColor(l,"Active Foreground Color"),a.addColor(l,"Inactive Foreground Color")}else if(n.type==="geometry-group"){let l={get opacity(){let c=e.getState(n.id);return c?.type==="geometry-group"?c.opacity:1},set opacity(c){e.getState(n.id)?.type==="geometry-group"&&e.setState(n,{opacity:c})},set visible(c){e.getState(n.id)?.type==="geometry-group"&&e.setState(n,{visible:c})},get visible(){let c=e.getState(n.id);return c?.type==="geometry-group"?c.visible:!1},set outline(c){e.getState(n.id)?.type==="geometry-group"&&e.setState(n,{outline:c})},get outline(){let c=e.getState(n.id);return c?.type==="geometry-group"?c.outline:!1},set altitude(c){e.getState(n.id)?.type==="geometry-group"&&e.setState(n,{altitude:c})},get altitude(){let c=e.getState(n.id);return c?.type==="geometry-group"?c.altitude:0},set interactive(c){e.getState(n.id)?.type==="geometry-group"&&(e.setState(n,{interactive:c}),t.controllersRecursive().forEach(u=>u.updateDisplay()))},get interactive(){let c=e.getState(n.id);return c?.type==="geometry-group"?c.interactive:!1},get shadingStart(){let c=e.getState(n.id);return c?.type==="geometry-group"?c.shading?.start??0:0},set shadingStart(c){let p=e.getState(n.id);p?.type==="geometry-group"&&e.setState(p,{shading:{start:c}})},get shadingEnd(){let c=e.getState(n.id);return c?.type==="geometry-group"?c.shading?.end??0:0},set shadingEnd(c){let p=e.getState(n.id);p?.type==="geometry-group"&&e.setState(p,{shading:{end:c}})},get shadingIntensity(){let c=e.getState(n.id);return c?.type==="geometry-group"?c.shading?.intensity??0:0},set shadingIntensity(c){let p=e.getState(n.id);p?.type==="geometry-group"&&e.setState(p,{shading:{intensity:c}})}};a.add(l,"visible"),a.add(l,"opacity",0,1,.1),a.add(l,"interactive"),a.add(l,"outline"),a.add(l,"altitude",0,100,1),a.add(l,"shadingStart",0,1,.1),a.add(l,"shadingEnd",0,1,.1),a.add(l,"shadingIntensity",0,1,.1)}else if(n.type==="group-container"){let l={set visible(c){e.getState(n.id)?.type==="group-container"&&e.setState(n,{visible:c})},get visible(){let c=e.getState(n.id);return c?.type==="group-container"?c.visible:!1},set interactive(c){let p=e.getState(n.id);p?.type==="group-container"&&(e.setState(p,{interactive:c}),t.controllersRecursive().forEach(u=>u.updateDisplay()))},get interactive(){let c=e.getState(n.id);return c?.type==="group-container"?c.interactive:!1}};a.add(l,"visible"),a.add(l,"interactive")}if(a.close(),n.children)for(let l of n.children.values())o(l,a)}}function az(e,r){let t=r.addFolder("Watermark"),o={padding:16,iconOnly:!1,position:"bottom-left",color:"dark",scale:1};t.add(o,"padding",0,100,1),t.add(o,"scale",.5,1.5,.1),t.add(o,"color",["dark","light"]),t.add(o,"position",["top-left","top-right","bottom-left","bottom-right","center","top","bottom","left","right"]),t.add(o,"iconOnly"),t.onChange(()=>{e.updateWatermark(o)})}var $4="https://tiles-cdn.mappedin.com/styles/mappedin/style.json",cz="https://auth.mappedin.com/oauth2/token";var _x="";function tT(e){_x=e,HC(e)}var Pc="";function rT(e){Pc=e}async function H4(e,r){let t=r?.useWorkers??!0,o={...r,watermark:r?.watermark,attribution:r?.attribution,antialias:r?.antialias,occlusionEnabled:r?.occlusionEnabled,transformImageRequest:r?.transformImageRequest,naturalBearing:r?.naturalBearing??0,imagePlacementOptions:r?.imagePlacementOptions,onWebGLContextCreationError:r?.onWebGLContextCreationError,onWebGLContextLost:r?.onWebGLContextLost,onWebGLContextRestored:r?.onWebGLContextRestored,onWebGLRendererError:r?.onWebGLRendererError,useStandaloneCamera:r?.useStandaloneCamera??!1,useCollisionWorker:r?.useCollisionWorker??!0,useWorkers:t};if(t===!0&&r?.outdoorView?.enabled){let{Map:n,MercatorCoordinate:i}=await import("./outdoor-context-v5-5KBHPW76.js"),a=r.outdoorView.headers;a==null&&(a=await QC(cz));let l=r.center||[0,0],c=new n({container:e,style:r.outdoorView.style||$4,center:l,attributionControl:!1,zoom:r.zoomLevel??q2,pitch:r.pitch??K2,bearing:r.bearing??Q2,transformRequest:XC(a),trackResize:!1,pixelRatio:r.outdoorView.lowDpi?1:Tp(),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}),p=c.painter.context.gl,u=new eT(e,{center:l,zoomLevel:c.getZoom(),pitch:c.getPitch(),bearing:c.getBearing(),gl:p,map:c,mode:"outdoors-interleaved",...o}),f={center:c.getCenter().toArray(),zoom:c.getZoom(),bearing:c.getBearing(),pitch:c.getPitch(),elevation:c.getCenterElevation()};c.setMinZoom(u.camera.minZoomLevel),c.setMaxZoom(u.camera.maxZoomLevel),c.setMaxPitch(u.camera.maxPitch),c.setMinPitch(u.camera.minPitch),u.on("camera-change",E=>{f.center=E.center,f.zoom=E.zoomLevel,f.bearing=E.bearing,f.pitch=E.pitch,f.elevation=E.elevation,c.jumpTo(f)});let h=i.fromLngLat(l,0),b=KC(h,u.viewCamera,()=>{u.renderSync()}),x=async()=>{c&&(c.addLayer(b),u.renderSync())};u.onMapLibreEvent("style.load",x);let T=!1,v=!1,I=()=>{c&&(T||(u.publish("outdoor-view-loaded"),T=!0),v||(v=!0,u.publish("outdoor-style-loaded")))};u.onMapLibreEvent("idle",I);let M=E=>{E&&(E.sourceDataType==="metadata"||E.sourceDataType==="visibility"||E.dataType==="style"||E.type==="terrain")&&u.getSystems().htmlControlsSystem.updateData(c)},O=E=>{c&&E&&E.dataType==="style"&&E.type==="styledata"&&(v=!1),M(E)};u.onMapLibreEvent("styledata",O),u.onMapLibreEvent("sourcedata",M),u.onMapLibreEvent("terrain",M);let C=E=>{if(E.error?.url===$4){A.error(`Failed to load outdoor view style, possibly due to invalid token "${a["x-mappedin-tiles-key"]}"`);return}A.warn(E)};return u.onMapLibreEvent("error",C),u}else return new eT(e,o)}d();d();d();d();var Mh=class Mh{constructor(r,t,o){m(this,"id");m(this,"text");m(this,"target");m(this,"__type",Mh.__type);this.id=r,this.text=t,this.target=o}static is(r){return r.__type===Mh.__type}get focusTarget(){return this.target.anchorTarget}};m(Mh,"__type","label");var fa=Mh;d();var zc,Au=class Au{constructor(r,t,o){m(this,"id");S(this,zc);m(this,"__type",Au.__type);m(this,"contentEl");this.id=r,this.contentEl=t,w(this,zc,o)}get target(){return s(this,zc)}get coordinate(){return s(this,zc).anchorTarget}toJSON(){return{id:this.id,__type:Au.__type,target:this.target,coordinate:this.coordinate}}static is(r){return r.__type===Au.__type}get focusTarget(){return this.target.anchorTarget}updateTarget(r){w(this,zc,r)}};zc=new WeakMap,m(Au,"__type","marker");var ds=Au;d();var Oh,Eh,wh=class wh{constructor(r,t,o){S(this,Oh);S(this,Eh);m(this,"target");m(this,"__type",wh.__type);w(this,Oh,r),w(this,Eh,t),this.target=o}static is(r){return r.__type===wh.__type}get id(){return s(this,Oh)}get url(){return s(this,Eh)}};Oh=new WeakMap,Eh=new WeakMap,m(wh,"__type","image-3d");var Wc=wh;d();var Zc,Lu=class Lu{constructor(r,t,o){m(this,"id");m(this,"groupId");m(this,"__type",Lu.__type);S(this,Zc);this.id=r,this.groupId=t,w(this,Zc,o)}get target(){return s(this,Zc)}static is(r){return r.__type===Lu.__type}updateTarget(r){w(this,Zc,r)}toJSON(){return{id:this.id,__type:Lu.__type,groupId:this.groupId,target:s(this,Zc)}}};Zc=new WeakMap,m(Lu,"__type","model");var Xc=Lu;d();var Ph=class Ph{constructor(r,t){m(this,"id");m(this,"coordinates");m(this,"__type",Ph.__type);this.id=r,this.coordinates=t}static is(r){return r.__type===Ph.__type}get focusTarget(){return this.coordinates}};m(Ph,"__type","path-segment");var Ru=Ph,_u=class _u{constructor(r,t,o,n){m(this,"id");m(this,"animation");m(this,"coordinates");m(this,"segments");m(this,"__type",_u.__type);this.id=r,this.animation=t,this.coordinates=o,this.segments=n.map(({id:i,coordinates:a})=>new Ru(i.toString(),a))}static is(r){return r.__type===_u.__type}get focusTarget(){return this.coordinates}toJSON(){return{__type:_u.__type,id:this.id,coordinates:this.coordinates,segments:this.segments}}};m(_u,"__type","path");var Bn=_u;d();var pz=7,Ol,Yc,Fh=class{constructor(r,t){S(this,Ol);S(this,Yc);w(this,Ol,r),w(this,Yc,t?.precision??pz)}toJSON(){return{center:this.center,bearing:this.bearing,pitch:this.pitch,zoomLevel:this.zoomLevel}}get center(){let r=s(this,Ol).center;if(s(this,Yc)===-1)return r;let t=Fi(r.latitude,s(this,Yc)),o=Fi(r.longitude,s(this,Yc));return new fe({latitude:t,longitude:o,floorId:r.floorId,verticalOffset:r.verticalOffset})}get bearing(){return s(this,Ol).bearing}get pitch(){return s(this,Ol).pitch}get zoomLevel(){return Fi(s(this,Ol).zoomLevel,5)}};Ol=new WeakMap,Yc=new WeakMap;d();var Dh=class Dh{constructor(r){m(this,"id");m(this,"__type",Dh.__type);this.id=r}static is(r){return r.__type===Dh.__type}get focusTarget(){return this}};m(Dh,"__type","shape");var ha=Dh;d();var kh=class kh{constructor(r,t){m(this,"id");m(this,"target");m(this,"__type",kh.__type);this.id=r,this.target=t}static is(r){return r.__type===kh.__type}};m(kh,"__type","text-3d");var El=kh;d();d();d();var dz=new Map([["search-16x16",`<svg viewBox="0 0 16 16">
509
+ `})}applyId(r,t){let o=r.attributes.position,n=new Float32Array(o.count*3);ez(n,o.count,t),r.setAttribute("color",new po(n,3))}createOccluderMesh(r,t){let o=new Le(r,this.pickingMaterial);return o.layers.set(mh),this.applyId(o.geometry,t),o.userData.occluderId=t,o}reserveOccluderId(){return this.color++,this.color}enable(){this.enabled=!0}disable(){this.enabled=!1}destroy(){this.destroyed=!0,this.pickingTexture?.dispose(),this.pickingMaterial.dispose(),this.pickingTexture=void 0,this.pixelBuffer=void 0}};d();var kx=class{constructor(r){this.state=r;m(this,"dirty",!0)}update(){if(this.dirty){for(let r of this.state.geometry3DIdsInScene){let t=this.state.geometry3DMap.get(r);if(t instanceof Mt&&t.type==="geometry"&&t.components[0]?.geometry!=null){let o=t.components[0];o.geometry&&(o.geometry.dispose(),o.geometry=void 0)}}this.dirty=!1}}};var j4=new Pi;var{DEFAULT_PITCH:Q2,DEFAULT_BEARING:q2,DEFAULT_ZOOM_LEVEL:eT,DEFAULT_MIN_ZOOM_LEVEL:tz,DEFAULT_MAX_ZOOM_LEVEL:rz}=mi,oz=Ue.radToDeg(.6435011087932844),Jt,Vt,Gc,fh,Eu,wl,Uc,Pu,Jr,Y2,j,_n,Vc,ct,xi,Kt,Rn,_r,B,hh,Tr,Ct,G4,U4,V4,ma,gh,yh,bh,xh,Fu,Ax,vh,Du,Ih,$c,J2,Hc,Sh,Th,To,Co,K2,Lx,_x,ku,Ch,X2=class extends ke{constructor(t,o={}){super();S(this,Jr);m(this,"options");m(this,"container");m(this,"Debug");S(this,Jt);S(this,Vt);S(this,Gc);S(this,fh);S(this,Eu);S(this,wl);S(this,Uc);S(this,Pu);m(this,"rendererDomElement");S(this,j,{geometry3DMap:new Map,geometry2DMap:new Map,geometry2DIdsInScene:new Set,geometry3DIdsInScene:new Set,geometryGroupIdsToLoad:new Set,entityScene:new hr("__scene"),hoverColor:"#f6efff",text3dHoverColor:"white",insetsPadding:ay,shouldMeasureCanvas:!0,pixelRatio:this.resolutionScale,canvasWidth:0,canvasHeight:0,internalTweenGroup:new Z1,externalTweenGroup:new Z1,cameraObject:new I0,naturalBearing:0,containerOffset:[0,0],useStandaloneCamera:!1});S(this,_n,{});S(this,Vc,new AbortController);m(this,"camera");S(this,ct);S(this,xi);S(this,Kt);S(this,Rn);S(this,_r);S(this,B,{});S(this,hh,window.matchMedia("screen and (min-resolution: 2dppx)"));m(this,"map");S(this,Tr,()=>{this.aborted||!s(this,B)?.renderSystem||(s(this,B).renderSystem.twoDdirty=!0)});S(this,Ct,()=>{this.aborted||!s(this,B)?.renderSystem||(s(this,B).renderSystem.threeDdirty=!0)});S(this,ma,"standalone");S(this,gh,()=>{s(this,B).geometryDisposalSystem.dirty=!0,this.render()});S(this,yh,t=>Math.trunc(t*10)/10);S(this,bh,()=>{W(this,Jr,Y2).call(this,Tp()),s(this,B).twoDDrawSystem.dirty=!0,s(this,Fu).call(this,void 0,void 0,!0)});S(this,xh,()=>{s(this,Fu).call(this)});S(this,Fu,(t,o,n=!1)=>{let i=t??this.rendererDomElement.clientWidth,a=o??this.rendererDomElement.clientHeight;if((i===0||a===0)&&!n)return;s(this,j).canvasWidth=i,s(this,j).canvasHeight=a,W(this,Jr,Y2).call(this,Tp()),s(this,$c).call(this),W(this,Jr,V4).call(this),s(this,B).cameraSystem.resize(this.canvasWidth,this.canvasHeight),s(this,B).cameraSystem.dirty=!0,s(this,B).watermarkSystem.resize(this.canvasWidth,this.canvasHeight),s(this,B).htmlControlsSystem.resize(this.canvasWidth),s(this,B).geometryInFocusSystem.resize(),s(this,B).occlusion2DSystem.resize();let{top:l,left:c}=this.container.getBoundingClientRect();s(this,j).containerOffset=[l,c],this.publish("resize"),this.render()});S(this,Ax,()=>{this.renderSync()});S(this,vh,new ae);S(this,Du,(t,o)=>{let n=this.mode==="standalone"?s(this,Vt):this.viewCamera;if(s(this,Vt).position.z+this.camera.elevation>o.z){s(this,vh).copy(o);let i=s(this,vh).project(n),a=(i.x+1)/2*this.canvasWidth-0/2,l=(-i.y+1)/2*this.canvasHeight-0/2,c=s(this,yh).call(this,a),p=s(this,yh).call(this,l);t.x=c,t.y=p}else t.x=-1e3,t.y=-1e3});S(this,Ih,(t,o)=>{s(this,_r).setBufferSize(t,o),s(this,Vt).aspect=t/o,s(this,Vt).updateProjectionMatrix(),s(this,Vt).updateMatrixWorld(!0),s(this,Eu).x=t,s(this,Eu).y=o});S(this,$c,()=>{let t=s(this,j).canvasWidth=this.rendererDomElement.clientWidth,o=s(this,j).canvasHeight=this.rendererDomElement.clientHeight,n=Math.floor(t*this.resolutionScale),i=Math.floor(o*this.resolutionScale);s(this,Ih).call(this,n,i),this.map?.resize(),s(this,j).shouldMeasureCanvas=!1});m(this,"getParentContainer",(t,o=!0)=>{if(!t)return o?s(this,j).entityScene:void 0;if(typeof t=="string"||typeof t=="number"){let n=s(this,j).geometry3DMap.get(t);return n instanceof hr?n:(A.warn(`Parent (${typeof t=="object"?t.id:t}) is not a valid container, adding to scene`),o?s(this,j).entityScene:void 0)}else if(t.type==="group-container"){let n=s(this,j).geometry3DMap.get(t.id);if(n instanceof hr)return n}return o?s(this,j).entityScene:void 0});m(this,"showCollisionBoxes",()=>{s(this,B).collisionSystem.showCollisionBoxes(),this.render()});m(this,"hideCollisionBoxes",()=>{s(this,B).collisionSystem.hideCollisionBoxes(),this.render()});m(this,"projectScreenXYToCoordinate",(t,o,n=!1)=>{let i=this.container.getBoundingClientRect(),a=(t-i.left)/s(this,j).canvasWidth*2-1,l=-((o-i.top)/s(this,j).canvasHeight)*2+1,c=new Me(a,l),p,u;if(n?(j4.setFromCamera(c,s(this,Vt)),p=j4.intersectObject(s(this,wl),!1)[0]?.point):(p=s(this,B).interactionSystem.getThreeDIntersectsFromXY(c)?.[0]?.point,u=s(this,B).interactionSystem.getGroupContainerIntersectsFromXY(c)),p)return{coordinate:this.convert3DMapPositionToCoordinate(p),groupContainers:u}});m(this,"projectCoordinateToScreenXY",t=>{let o=this.convertTo3DMapPosition(t[1],t[0],t[2]||0),n=new Me;return s(this,Du).call(this,n,o),{x:n.x,y:n.y}});m(this,"convert3DMapPositionToCoordinate",t=>{let{lat:o,lon:n}=cy(s(this,j).center?.[1]??0,s(this,j).center?.[0]??0,t.x,t.y);return[n,o,t.z]});m(this,"setBackgroundColor",(t,o)=>{s(this,_r).setBackgroundColor(t,o)});m(this,"getMetresPerPixel",()=>{let t=this.container.clientWidth,o=this.container.clientHeight/2,n=this.projectScreenXYToCoordinate(0,o,!0),i=this.projectScreenXYToCoordinate(t,o,!0);return n==null||i==null?void 0:ry(n.coordinate,i.coordinate)/t});m(this,"hideOutdoorLayersUnderPoint",(t,o)=>{!this.map||o?.length===0||(s(this,B).outdoorLayersSystem.hideLayersUnderPoint(t,o),this.render())});m(this,"hideOutdoorLayersIntersectingPolygons",(t,o,n)=>{s(this,B).outdoorLayersSystem.hideLayersIntersectingPolygons(t,o,n),this.render()});S(this,Hc,new Jg);S(this,Sh,new Hn);S(this,Th,t=>{A.error("Render failed: ",t,t.stack??"No stack trace available"),this.publish("render-error",{error:t})});m(this,"render",()=>{if(!(s(this,B)?.renderSystem==null||this.aborted))if(this.map&&(this.mode==="outdoors-interleaved"||this.mode==="outdoors-overlay"))this.map.triggerRepaint();else return s(this,B).renderSystem.update().catch(s(this,Th))});m(this,"renderSync",()=>this.aborted?Promise.resolve():s(this,B).renderSystem.update(!0).catch(s(this,Th)));S(this,To,gm(()=>{this.publish("user-interaction-start",void 0)},0,!0));S(this,Co,gm(()=>{this.publish("user-interaction-end",void 0),this.render()},0,!0));m(this,"on",(t,o)=>{this.aborted||(super.on(t,o),["outdoor-view-loaded","outdoor-style-loaded"].includes(t)&&this.mode==="standalone"&&y.env.NODE_ENV!=="test"&&(A.warn(`"${t}" was subscribed to but outdoor view is disabled. The event has been triggered immediately. Enable outdoor view or remove the listener.`),this.publish(t)))});m(this,"off",(t,o)=>{super.off(t,o)});m(this,"getCursor",()=>s(this,B).interactionSystem.getCursor());S(this,Lx,()=>{if(s(this,j).entityScene.removeEventListener("childadded",s(this,Ct)),s(this,j).entityScene.removeEventListener("childadded",s(this,Tr)),s(this,j).entityScene.removeEventListener("childremoved",s(this,Ct)),s(this,j).entityScene.removeEventListener("childremoved",s(this,Tr)),window.removeEventListener("resize",s(this,xh),!1),s(this,hh).removeEventListener("change",s(this,bh)),this.map){for(let t in s(this,_n))for(let o of s(this,_n)[t])this.map.off(t,o);w(this,_n,{})}this._subscribers={}});S(this,_x,()=>{try{s(this,ma)!=="outdoors-overlay"&&(this.map&&this.map.remove(),this.container&&this.rendererDomElement&&this.container.contains(this.rendererDomElement)&&this.container.removeChild(this.rendererDomElement)),this.container&&(s(this,Rn)&&this.container.contains(s(this,Rn))&&this.container.removeChild(s(this,Rn)),s(this,ct)&&this.container.contains(s(this,ct))&&this.container.removeChild(s(this,ct)))}catch(t){A.warn("Error during DOM cleanup, some elements may not have been removed:",t)}});m(this,"destroy",()=>{s(this,B)&&(this.aborted||s(this,Vc).abort(),s(this,Lx).call(this),this.remove("__scene"),s(this,B).renderSystem.destroy(),s(this,B).cameraSystem.dispose(),s(this,B).exporterSystem.destroy(),s(this,B).outdoorLayersSystem.destroy(),s(this,B).borderSystem.destroy(),s(this,B).drawSystem.destroy(),s(this,Uc)&&s(this,Uc).disconnect(),s(this,_r).destroy(),s(this,Jt)?.traverse(t=>{Ht(t),"dispose"in t&&typeof t.dispose=="function"&&t.dispose()}),w(this,Jt,void 0),s(this,B).htmlControlsSystem.destroy(),s(this,B).collisionSystem.destroy(),s(this,B).interactionSystem.destroy(),s(this,B).domMutationSystem.destroy(),s(this,B).geometryInFocusSystem.destroy(),s(this,B).occlusion2DSystem.destroy(),w(this,B,void 0),s(this,_x).call(this),w(this,_r,void 0))});S(this,ku,new ae);S(this,Ch,new ae);if(w(this,Vc,new AbortController),s(this,j).useStandaloneCamera=o.useStandaloneCamera??!1,s(this,j).naturalBearing=o.naturalBearing??0,this.convertTo3DMapPosition=this.convertTo3DMapPosition.bind(this),!t.clientWidth||!t.clientHeight)throw new Error("[MappedinJS] Container width and height must be greater than 0");this.convertTo3DMapPosition=this.convertTo3DMapPosition.bind(this),(o.mode==="outdoors-interleaved"||o.mode==="outdoors-overlay")&&o.map&&(w(this,ma,o.mode),this.map=o.map),s(this,j).entityScene.addEventListener("childadded",()=>{s(this,Ct).call(this),s(this,Tr).call(this)}),s(this,j).entityScene.addEventListener("childremoved",()=>{s(this,Ct).call(this),s(this,Tr).call(this)}),s(this,j).geometry3DMap.set(s(this,j).entityScene.userData.entityId,s(this,j).entityScene),o.center&&(s(this,j).center=o.center?[...o.center]:[0,0]),this.options=o,this.container=t,W(this,Jr,G4).call(this),W(this,Jr,U4).call(this),s(this,B).htmlControlsSystem=new lx(this.container,{outdoorEnabled:!!this.map}),s(this,ma)!=="outdoors-overlay"&&s(this,B).htmlControlsSystem.addAttributionControl(this.options.attribution),window.MappedinDebug||(window.MappedinDebug={}),y.env.NODE_ENV==="test"&&(window.MappedinDebug.mapViewCoreInstance=this),w(this,_r,new E1({antialias:typeof o.antialias=="boolean"?o.antialias:!0,alpha:!1,canvas:this.mode!=="standalone"?o.gl?.canvas:void 0,onWebGLContextCreationError:o.onWebGLContextCreationError,onWebGLContextLost:o.onWebGLContextLost,onWebGLContextRestored:x=>{o.onWebGLContextRestored?.(x),s(this,Tr).call(this),s(this,Ct).call(this),this.render()},onWebGLRendererError:o.onWebGLRendererError,backgroundColor:o.backgroundColor||"#ffffff",backgroundAlpha:o.backgroundAlpha??1})),w(this,Jt,new Ra),s(this,ma)!=="standalone"&&s(this,Jt).add(nM()),s(this,Jt).add(s(this,j).entityScene);let n=window.__THREE_DEVTOOLS__;y.env.NODE_ENV==="dev"&&typeof n<"u"&&(n.dispatchEvent(new CustomEvent("observe",{detail:s(this,Jt)})),n.dispatchEvent(new CustomEvent("observe",{detail:s(this,_r)}))),w(this,Vt,new I0(oz,this.aspect,50,1e5)),s(this,j).cameraObject=s(this,Vt),w(this,fh,new fC),s(this,Vt).renderOrder=999;let i=new ws;i.add(s(this,Vt)),w(this,Pu,new ws),s(this,Pu).add(i),s(this,Jt).add(s(this,Pu)),s(this,Vt).updateProjectionMatrix(),s(this,Vt).updateMatrixWorld(!0),this.referenceMap={scale:1,latitude:0,longitude:0,getNorth:()=>0,georeference:[{target:{x:0,y:0}},{target:{x:0,y:0}},{target:{x:0,y:0}},{target:{x:0,y:0}}]},this.rendererDomElement=s(this,_r).domElement(),w(this,Eu,new Me);let a=new Os(1e6,1e6),l=new Nr({color:0,visible:!1});w(this,wl,new Le(a,l)),s(this,wl).name="worldPlane",s(this,Jt).add(s(this,wl)),o.gl?.canvas||t.appendChild(this.rendererDomElement),window.addEventListener("resize",s(this,xh),!1),s(this,hh).addEventListener("change",s(this,bh)),typeof ResizeObserver=="function"&&y.env?.NODE_ENV!=="test"&&(w(this,Uc,new ResizeObserver(HC(x=>{s(this,Fu).call(this,x[0].contentRect.width,x[0].contentRect.height)},50))),s(this,Uc)?.observe(t)),t.classList.add("mappedin-map"),this.rendererDomElement.style.width=globalThis.MappedinDebug?.TEST_IOS?"1080px":"100%",this.rendererDomElement.style.height=globalThis.MappedinDebug?.TEST_IOS?"1920px":"100%",y.env.NODE_ENV==="test"&&this.rendererDomElement.setAttribute("data-testid","mappedin-canvas"),this.mode!=="outdoors-overlay"&&this.rendererDomElement.tabIndex!==void 0&&this.rendererDomElement.removeAttribute("tabindex"),s(this,j).canvasWidth=this.rendererDomElement.clientWidth,s(this,j).canvasHeight=this.rendererDomElement.clientHeight,this.rendererDomElement.style.touchAction="manipulation";let c=this.canvasWidth,p=this.canvasHeight;s(this,B).watermarkSystem=new nx(s(this,Vt),s(this,j),o?.watermark),s(this,B).watermarkSystem.on("texture-loaded",this.render),s(this,j).shouldMeasureCanvas=!0,s(this,j).pixelRatio=this.resolutionScale,s(this,Ih).call(this,Math.floor(c*this.resolutionScale),Math.floor(p*this.resolutionScale));let u=new ey(16777215,.3*Math.PI);u.position.set(-150,-150,350),s(this,Jt).add(u);let f=new vC(16777215,.741*Math.PI);s(this,Jt).add(f),s(this,B).cameraSystem=new Ac(s(this,Vt),s(this,Jt),s(this,_r).renderer,s(this,j),{mode:this.mode,canvasHeight:p,canvasWidth:c}),s(this,B).cameraSystem.on("user-dolly-start",s(this,To)),s(this,B).cameraSystem.on("user-pan-start",s(this,To)),s(this,B).cameraSystem.on("user-rotate-start",s(this,To)),s(this,B).cameraSystem.on("user-zoom-start",s(this,To)),s(this,B).cameraSystem.on("user-tilt-start",s(this,To)),s(this,B).cameraSystem.on("user-pedestal-start",s(this,To)),s(this,B).cameraSystem.on("user-dolly-end",s(this,Co)),s(this,B).cameraSystem.on("user-pan-end",s(this,Co)),s(this,B).cameraSystem.on("user-rotate-end",s(this,Co)),s(this,B).cameraSystem.on("user-zoom-end",s(this,Co)),s(this,B).cameraSystem.on("user-tilt-end",s(this,Co)),s(this,B).cameraSystem.on("user-pedestal-end",s(this,Co)),s(this,B).cameraSystem.on("change",()=>{this.publish("camera-change",this.camera),s(this,B).geometryInFocusSystem&&(s(this,B).geometryInFocusSystem.cameraDirty=!0),this.render()}),this.onAbort(()=>{s(this,B).cameraSystem.off("user-dolly-start",s(this,To)),s(this,B).cameraSystem.off("user-pan-start",s(this,To)),s(this,B).cameraSystem.off("user-rotate-start",s(this,To)),s(this,B).cameraSystem.off("user-zoom-start",s(this,To)),s(this,B).cameraSystem.off("user-tilt-start",s(this,To)),s(this,B).cameraSystem.off("user-pedestal-start",s(this,To)),s(this,B).cameraSystem.off("user-dolly-end",s(this,Co)),s(this,B).cameraSystem.off("user-pan-end",s(this,Co)),s(this,B).cameraSystem.off("user-rotate-end",s(this,Co)),s(this,B).cameraSystem.off("user-zoom-end",s(this,Co)),s(this,B).cameraSystem.off("user-tilt-end",s(this,Co)),s(this,B).cameraSystem.off("user-pedestal-end",s(this,Co)),s(this,B).renderSystem.off("measure-canvas",s(this,$c)),s(this,B).cameraSystem.off("change",this.render)}),s(this,B).pathSystem=new uh(s(this,j),this.convertTo3DMapPosition,this.getParentContainer,s(this,B).cameraSystem.convertZoomLevelToAltitude),s(this,B).pathSystem.on("animate:path",this.render),this.onAbort(()=>{s(this,B).pathSystem.off("animate:path",this.render)}),s(this,B).panBoundsSystem=new ax(s(this,j),s(this,B).cameraSystem);let h=()=>{let{panBounds:x,fov:T,convertAltitudeToZoomLevel:v}=s(this,B).cameraSystem;if(s(this,B).panBoundsSystem.autoMinZoomLevel){if(x.radius<=0)return;let I=Math.min(s(this,j).canvasWidth/s(this,j).canvasHeight,1),M=T*Math.PI/180*I,O=Math.tan(M/2),{radius:C,center:E}=s(this,B).cameraSystem.panBounds,_=C/O,G=this.getThreeCamera().getWorldPosition(new ae),R=E.distanceTo(G),N=Math.abs(G.z-E.z),X=_*N/R,z=v(X);rM(z,this.camera.minZoomLevel)&&this.camera.setMinZoomLevel(z)}this.publish("pan-bounds-change",s(this,B).cameraSystem.panBounds)};s(this,B).panBoundsSystem.on("update",h),this.onAbort(()=>{s(this,B).panBoundsSystem.off("update",h)}),this.camera=new ox(this,s(this,B),s(this,j)),this.camera.setZoomLevel(o.zoomLevel??eT),this.camera.setBearing(o.bearing??q2),this.camera.setPitch(o.pitch??Q2),this.camera.setMaxZoomLevel(rz),this.camera.setMinZoomLevel(tz),s(this,B).domVisiblitySystem=new U1(s(this,j),s(this,Rn)),s(this,B).domMutationSystem=new rx(s(this,j),s(this,Rn)),s(this,B).domMutationSystem.on("dimensions-update",()=>{s(this,B).collisionSystem.collidersDirty=!0,this.render()}),s(this,B).domDrawSystem=new tx(s(this,j)),s(this,B).collisionSystem=new F1(s(this,xi),s(this,j),(o.useCollisionWorker??!0)&&(o.useWorkers??!0)),s(this,B).twoDDrawSystem=new $1(s(this,j),s(this,Kt),o.transformImageRequest),s(this,B).twoDDrawSystem.on("img:loaded",this.render),s(this,B).interactionSystem=new Nf(this.rendererDomElement,s(this,j),s(this,Vt),s(this,wl),s(this,B).cameraSystem.isUserInteracting),s(this,B).interactionSystem.on("doubletap-with-onefinger",x=>{s(this,B).cameraSystem.enableZoom&&this.camera.animateTo({center:this.projectScreenXYToCoordinate(x.clientX,x.clientY)?.coordinate,zoomLevel:this.camera.zoomLevel+1,duration:k0,easing:"ease-out"})}),s(this,B).interactionSystem.on("singletap-with-twofinger",()=>{s(this,B).cameraSystem.enableZoom&&this.camera.animateTo({zoomLevel:this.camera.zoomLevel-1,duration:k0,easing:"ease-out"})}),s(this,B).interactionSystem.on("hover",this.render),s(this,B).interactionSystem.on("click",x=>{if(x.entity2D?.id==="watermark"&&typeof s(this,B).watermarkSystem.options.onClick=="function"&&s(this,B).watermarkSystem.options.interactive){s(this,B).watermarkSystem.options.onClick();return}let T=x.entity3D?[x.entity3D?.id]:[];x.entity3D?.parentObject3D?.userData?.entityId&&T.push(x.entity3D?.parentObject3D?.userData?.entityId),this.publish("click",{coordinate:this.convert3DMapPositionToCoordinate(x.position),geometry:T,paths:x.entity3D?.components[0]instanceof Il?[x.entity3D.id]:[],markers:x.entity2D?.components[0]instanceof Ds?[x.entity2D.id]:[],models:x.entity3D?.components[0]instanceof xl?[x.entity3D.id]:[],labels:x.entity2D?.components[0]instanceof Fs?[x.entity2D.id]:[],containers:Array.isArray(x.groupContainers)?x.groupContainers.map(v=>v.userData.entityId):[],pointerEvent:x.pointerEvent})}),s(this,B).interactionSystem.on("hover",x=>{x.position&&this.publish("hover",{coordinate:this.convert3DMapPositionToCoordinate(x.position),geometry:x.entity3D?[x.entity3D?.id]:[],paths:x.entity3D?.components[0]instanceof Il?[x.entity3D.id]:[],markers:x.entity2D?.components[0]instanceof Ds?[x.entity2D.id]:[],models:x.entity3D?.components[0]instanceof xl?[x.entity3D.id]:[],labels:x.entity2D?.components[0]instanceof Fs?[x.entity2D.id]:[],containers:Array.isArray(x.groupContainers)?x.groupContainers.map(T=>T.userData.entityId):[]})}),s(this,B).geometryInFocusSystem=new bx(s(this,j),s(this,Vt));let b=x=>{this.publish("geometry-in-focus",x)};s(this,B).geometryInFocusSystem.on("geometry-in-focus",b),this.onAbort(()=>{s(this,B).geometryInFocusSystem.off("geometry-in-focus",b)}),s(this,B).twoDVisiblitySystem=new z1(s(this,j)),s(this,B).drawSystem=new H1(s(this,j),this.convertTo3DMapPosition),s(this,B).drawSystem.on("texture-loaded",this.render),s(this,B).twoDProjectionSystem=new V1(s(this,j),s(this,Du)),s(this,B).exporterSystem=new jf(s(this,j)),s(this,B).meshOptimizationSystem=new G1(s(this,j),this.convertTo3DMapPosition),s(this,B).meshOptimizationSystem.on("model-loaded",this.render),s(this,B).meshOptimizationSystem.on("geometry-2d-added",this.render),s(this,B).meshOptimizationSystem.on("geometry-group-added",s(this,gh)),this.onAbort(()=>{s(this,B).meshOptimizationSystem.off("model-loaded",this.render),s(this,B).meshOptimizationSystem.off("geometry-2d-added",this.render),s(this,B).meshOptimizationSystem.off("geometry-group-added",s(this,gh))}),s(this,B).meshDetachmentSystem=new Cx(s(this,j)),s(this,B).meshModificationSystem=new Mx(s(this,j)),s(this,B).geometryDisposalSystem=new kx(s(this,j)),s(this,B).borderSystem=new _M(s(this,j),this.convertTo3DMapPosition),s(this,B).customGeometrySystem=new cx(s(this,j),this.convertTo3DMapPosition),s(this,B).outlineInterpolationSystem=new ux(s(this,j)),s(this,B).renderSystem=new W1(s(this,_r),s(this,j),this.mode,s(this,Jt),s(this,Vt),this.viewCamera,s(this,B)),s(this,B).imageSystem=new yx(s(this,j),this.convertTo3DMapPosition,s(this,Du),o.bearing,o.naturalBearing,o.imagePlacementOptions),s(this,B).text3DSystem=new sM(s(this,j),this.convertTo3DMapPosition,o.useWorkers??!0),s(this,B).text3DSystem.on("render",this.render),s(this,B).imageSystem.on("image-loaded",this.render),s(this,B).renderSystem.on("pre-render",()=>this.publish("pre-render")),s(this,B).renderSystem.on("post-render",()=>this.publish("post-render")),s(this,B).renderSystem.on("measure-canvas",s(this,$c)),this.onAbort(()=>{s(this,B).renderSystem.off("pre-render",()=>this.publish("pre-render")),s(this,B).renderSystem.off("post-render",()=>this.publish("post-render")),s(this,B).renderSystem.off("measure-canvas",s(this,$c))}),s(this,B).outdoorLayersSystem=new Ix(this.map),s(this,B).occlusion2DSystem=new Dx(s(this,j),this.convertTo3DMapPosition,s(this,_r)),o.occlusionEnabled&&s(this,B).occlusion2DSystem.enable(),this.Debug=new Fx(this),o.environment!==!1&&w(this,Gc,W(this,Jr,K2).call(this)),s(this,Ax).call(this)}get viewCamera(){return s(this,fh)}get canvasWidth(){return s(this,j).canvasWidth}get canvasHeight(){return s(this,j).canvasHeight}get resolutionScale(){return this.map?._getClampedPixelRatio(this.canvasWidth,this.canvasHeight)??Tp()}get aspect(){return this.canvasWidth/this.canvasHeight}get mode(){return s(this,ma)}addGroupContainer(t,o,n){if(!s(this,j).geometry3DMap.has(t)&&!s(this,j).geometry2DMap.has(t)){let i=new hr(t);i.addEventListener("childadded",()=>{s(this,Ct).call(this),s(this,Tr).call(this)}),i.addEventListener("childremoved",()=>{s(this,Ct).call(this),s(this,Tr).call(this)}),o?.visible!==void 0&&(i.visible=o.visible),o?.altitude!==void 0&&i.setAltitude(o.altitude),o?.interactive!==void 0&&zo(i,o.interactive,s(this,j)),o?.focusable!==void 0&&gy(i,o.focusable),o?.preloadGeometry!==void 0&&(i.userData.preloadGeometry=o.preloadGeometry),s(this,j).geometry3DMap.set(t,i);let a=this.getParentContainer(n);a instanceof hr&&a.addEntity(i),s(this,Ct).call(this),this.render()}else A.error(`Group container with ID '${t}' already exists. The group container cannot be added.`);return{id:t,type:"group-container"}}addCustomGeometry(t,o,n,i,a){if(s(this,j).geometry3DMap.has(t))A.error(`Custom geometry with ID '${t}' already exists. The custom geometry cannot be added.`);else{let l=new Tu(o,n),c=new Mt(l,new Ri(i));i?.interactive!==void 0&&zo(c,i.interactive,s(this,j)),c.id=t,l.mesh.userData={entityId:t,type:"custom-geometry"},s(this,j).geometry3DMap.set(c.id,c);let p=this.getParentContainer(a);a&&p instanceof hr?p.addEntity(c):s(this,j).entityScene.addEntity(c),s(this,Ct).call(this),this.render()}return{id:t,type:"custom-geometry"}}addGeometryGroup(t,o,n,i){if(!s(this,j).geometry3DMap.has(t)&&!s(this,j).geometry2DMap.has(t)){let a=new Wn(t);a.addEventListener("childadded",()=>{s(this,Ct).call(this),s(this,Tr).call(this)}),a.addEventListener("childremoved",()=>{s(this,Ct).call(this),s(this,Tr).call(this)}),a.userData.dirty=!0,s(this,j).geometry3DMap.set(t,a);for(let c of o.features){if(c.geometry==null||!["Polygon","MultiPolygon","LineString","MultiLineString"].includes(c.geometry.type))continue;let p=c?.id||c?.properties?.id||ut(),{visible:u,altitude:f,...h}=n||{color:RM},b=s(this,B).meshOptimizationSystem.createEntityFromFeature(p,c,{outline:!0,...h});s(this,j).geometry3DMap.set(p,b),a.userData.entities3D.add(p)}a.setVisible(n?.visible??!0),n?.altitude!=null&&a.setAltitude(n.altitude);let l=this.getParentContainer(i);l instanceof hr&&l.addEntity(a),s(this,Ct).call(this),this.render()}else A.error(`Geometry group with ID '${t}' already exists. The geometry group cannot be added.`);return s(this,B).outlineInterpolationSystem.geometries3DDirty=!0,{id:t,type:"geometry-group"}}addOccluder(t,o){let n=this.getParentContainer(o),i=s(this,B).occlusion2DSystem.reserveOccluderId();return n?.addOccluderFeature(t,i),i}addImage(t,o,n,i){try{S4(t,o,n)}catch(a){A.error(a);return}if(!s(this,j).geometry3DMap.has(t)&&!s(this,j).geometry2DMap.has(t)){let a=new gx(o),l=new Mt(a,new Ri(n));l.id=t||ut(),a.mesh.userData={entityId:l.id,type:"path"},s(this,j).geometry3DMap.set(l.id,l);let c=this.getParentContainer(i);c instanceof hr&&c.addEntity(l),s(this,Ct).call(this),this.render()}else A.error(`Image with ID '${t}' already exists. The image cannot be added.`);return{id:t,type:"image"}}addModelGroup(t,o,n,{parent:i,onComplete:a}={}){try{YD(t,o,n)}catch(l){A.error(l);return}if(!s(this,j).geometry3DMap.has(t)&&!s(this,j).geometry2DMap.has(t)){let l=new Wn(t);l.addEventListener("childadded",()=>{s(this,Ct).call(this),s(this,Tr).call(this)}),l.addEventListener("childremoved",()=>{s(this,Ct).call(this),s(this,Tr).call(this)}),s(this,j).geometry3DMap.set(t,l),l.userData.dirty=!0,l.userData.modelURL=n.url;for(let p of o.features){let u=p.id||p.properties.id||ut(),f=s(this,B).meshOptimizationSystem.createModelFromFeature(u,p,{...n});(p.properties.interactive!==void 0||n.interactive!=null)&&zo(f,p.properties.interactive??n.interactive,s(this,j)),f.parentId=l.userData.entityId,s(this,j).geometry3DMap.set(u,f),l.userData.entities3D.add(u)}let c=this.getParentContainer(i);c instanceof hr&&c.addEntity(l),s(this,Ct).call(this),this.render()?.then(a)}else A.error(`Model group with ID '${t}' already exists. The model group cannot be added.`);return{id:t,type:"geometry-group"}}addMarker2D(t,o,n,i){let a=n?.id;try{$C(t,o,n||{})}catch(l){A.error(l);return}if(a===void 0||!s(this,j).geometry2DMap.has(a)&&!s(this,j).geometry3DMap.has(a)){let l=W(this,Jr,J2).call(this,t,new Ds(o,n),n?.occluderId,n?.verticalOffset);l.id=a||String(l.id),a=l.id,n?.interactive!=null&&n.interactive!=="pointer-events-auto"&&zo(l,n?.interactive,s(this,j)),n?.enabled!=null&&fy(l,n.enabled);let c=typeof n?.attachTo=="string"||typeof n?.attachTo=="number"?s(this,j).geometry3DMap.get(n.attachTo):void 0;c instanceof Mt&&c.attach(l),this.getParentContainer(i)?.addEntity(l),this.render()}else A.error(`Marker2D with ID '${a}' already exists. The marker cannot be added.`);return{id:a,type:"marker"}}addText3D(t,o,n,i){if(!s(this,j).geometry3DMap.has(t)&&!s(this,j).geometry2DMap.has(t)){let a=new my({...o,properties:{...o.properties,id:t,content:o.properties.text}}),l=new Mt(a,new ym(n?.appearance));l.id=t,a.mesh.userData.entityId=t.toString(),a.mesh.userData.type="text3d",s(this,j).geometry3DMap.set(t,l);let c=this.getParentContainer(i);c instanceof hr&&c.addEntity(l),s(this,Ct).call(this),this.render()}else A.error(`Text3D with ID '${t}' already exists. The text3d cannot be added.`);return{id:t,type:"text3d"}}labelText3D(t,o,n={}){try{if(!o||!t)throw new Error("content and meshGeometryId are required");cM.parse(n)}catch(p){A.error(p);return}let i=s(this,j).geometry3DMap.get(t);if(i?.type!=="geometry"){A.error(".labelText3D failed: target incorrect");return}let a=i?.components[0];if(!a.feature.properties.textArea)return;if(a.textEntityId){let p=s(this,j).geometry3DMap.get(a.textEntityId);if(p?.type!=="text3d"){A.error(".labelText3D failed: existing text3d not found");return}return{id:p.id,type:p.type}}let l=new my({type:"Feature",geometry:{coordinates:a.feature.properties.textArea?.position,type:"Point"},properties:{textArea:a.feature.properties.textArea,content:o,id:ut()}});l.polygonEntityId=t;let c=new Mt(l,new ym(n?.appearance));return a.textEntityId=c.id.toString(),l.mesh.userData.entityId=c.id.toString(),l.mesh.userData.type="text3d",s(this,j).geometry3DMap.set(c.id.toString(),c),n.parentId&&this.getParentContainer(n.parentId)?.addEntity(c),this.render(),{id:c.id,type:"text3d"}}addLabel2D(t,o,n,i){let a=n?.id;try{UC(t,o,n||{})}catch(l){A.error(l);return}if(a===void 0||!s(this,j).geometry2DMap.has(a)&&!s(this,j).geometry3DMap.has(a)){let l=W(this,Jr,J2).call(this,t,new Fs(o,n||{},s(this,j)),n?.occluderId,n?.verticalOffset);l.id=a||String(l.id),a=l.id,n?.interactive!=null&&zo(l,n?.interactive,s(this,j)),n?.enabled!=null&&fy(l,n.enabled);let c=typeof n?.attachTo=="string"||typeof n?.attachTo=="number"?s(this,j).geometry3DMap.get(n.attachTo):void 0;c instanceof Mt&&c.attach(l),this.getParentContainer(i)?.addEntity(l),s(this,Tr).call(this),this.render()}else A.error(`Label2D with ID '${a}' already exists. The label cannot be added.`);return{id:a,type:"label"}}addPath(t,o={},n){try{r4(t,o||{})}catch(c){A.error(c);return}let i=new Il(t,FM(o)),a=new Mt(i,new Ri({color:o?.color??"#ff834c",altitude:o?.verticalOffset??.1}));a.id=o?.id||ut(),i.mesh.userData={entityId:a.id,type:"path"},s(this,j).geometry3DMap.set(a.id,a),o?.interactive!=null&&zo(a,o?.interactive,s(this,j));let l=this.getParentContainer(n);return l instanceof hr&&l.addEntity(a),s(this,Ct).call(this),this.render(),{id:a.id,type:"path"}}updateWatermark(t){s(this,B).watermarkSystem.options=t,s(this,B).watermarkSystem.dirty=!0,s(this,B).collisionSystem.collidersDirty=!0,this.render()}remove(t){let o;if(typeof t=="string"||typeof t=="number"?(o=s(this,j).geometry2DMap.get(t),o==null&&(o=s(this,j).geometry3DMap.get(t))):typeof t.id=="string"||typeof t.id=="number"?(o=s(this,j).geometry2DMap.get(t.id),o==null&&(o=s(this,j).geometry3DMap.get(t.id))):o=t,o!=null){if(o.type==="custom-geometry")s(this,j).geometry3DMap.delete(o.id),o.object3d&&Ht(o.object3d);else if(o.type==="group-container"){s(this,j).geometry3DMap.delete(o.userData.entityId);for(let i of o.childrenIds.values())this.remove(i),o.userData.entities2D.delete(i);let n=o.components[1];n&&n.focusMesh&&Ht(n.focusMesh),Ht(o)}else if(o.type==="geometry-group"){s(this,j).geometry3DMap.delete(o.userData.entityId);for(let n of o.userData.entities3D.values())this.remove(n),o.userData.entities3D.delete(n);Ht(o)}else if(o.type==="geometry"||o.type==="model"||o.type==="path"){let n=o.components[0],i=o.components[4];if(o.entities2D.size>0){for(let l of o.entities2D.values())this.remove(l);o.removeAllEntities()}let a=o.parentObject3D?.userData.entityId??o.parentId;if(a){let l=s(this,j).geometry3DMap.get(a);l instanceof Wn&&l.userData.entities3D.delete(o.id)}if(o.object3d&&Ht(o.object3d),o.type==="geometry"){let l=o.components[3];l&&(l.enabled=!1,l.dirty=!0)}i&&"focusMesh"in i&&i.focusMesh!=null&&Ht(i.focusMesh),"textMesh"in n&&n.textMesh!=null&&this.remove(n.textMesh.userData.entityId),s(this,j).geometry3DMap.delete(o.id)}else if(o.type==="marker"||o.type==="label"){let n=o.attachedTo;if(n){let i=s(this,j).geometry3DMap.get(n);i instanceof Mt&&i.detach(o)}o.object3d&&Ht(o.object3d),o.type==="label"&&delete s(this,B).twoDDrawSystem.textCache[o.id],s(this,j).geometry2DMap.delete(o.id)}else if(o.type==="image")o.object3d&&Ht(o.object3d),s(this,j).geometry3DMap.delete(o.id);else if(o.type==="text3d"){Ht(o.object3d);let{batchedText:n,textMesh:i,polygonEntityId:a}=o.components[0];if(i&&(n&&n.removeText(i),Ht(i)),a){s(this,B).text3DSystem.remove(a);let l=s(this,j).geometry3DMap.get(a);l?.type==="geometry"&&(l.components[0].textMesh=void 0,l.components[0].textEntityId=void 0)}s(this,j).geometry3DMap.delete(o.id)}s(this,Ct).call(this),s(this,Tr).call(this),this.render()}}getScene(){return this.getState("__scene")}getThreeScene(){return s(this,Jt)}getThreeCamera(){return s(this,Vt)}async setEnvironment(t){if(s(this,Jt))if(t==="basic"){s(this,Gc)||w(this,Gc,W(this,Jr,K2).call(this));let o=await s(this,Gc);s(this,Jt).environment=o}else s(this,Jt).environment=null}getEnvironment(){return s(this,Jt)?.environment?"basic":!1}getCurrentSceneGLTF(t){return s(this,B).exporterSystem.getCurrentSceneGLTF(t)}getBoundingArea(t){(s(this,B).renderSystem.threeDdirty||s(this,B).renderSystem.twoDdirty)&&this.renderSync();let o=new sr;if(t==null)o.setFromObject(s(this,j).entityScene);else{let n=Sp(s(this,j),t);if(n?.type==="geometry"&&n?.object3d!=null){let i=n.components[0],a=i instanceof fr?i.geometry:void 0;i.mesh instanceof Kg&&a?(a.computeBoundingBox(),a.boundingBox&&o.union(a.boundingBox)):o.setFromObject(n.object3d)}else(n?.type==="geometry-group"||n?.type==="group-container")&&n?.userData.entityId!=null&&o.setFromObject(n)}if(Bl(o))return WC(o).map(this.convert3DMapPositionToCoordinate)}hasState(t){return Sp(s(this,j),t)!=null}getState(t){if(t==null)return{type:"map-view",hoverColor:s(this,j).hoverColor,text3dHoverColor:s(this,j).text3dHoverColor};let o=Sp(s(this,j),t);if(o?.type==="custom-geometry"){let n=o.components[0],i=o.components[1];return{id:o.id,type:"custom-geometry",visible:i.visible,altitude:i.altitude,parent:o.parentObject3D?.userData.entityId,position:this.convert3DMapPositionToCoordinate(n.position)}}else if(o?.type==="geometry-group"){let n=Array.from(o.userData.entities3D.values()),i=n?.[0],a=i?this.getState(i):{};return{id:o.userData.entityId,type:"geometry-group",visible:o.visible,altitude:o.altitude,color:a?.color,initialColor:a?.initialColor,side:a?.side??"double",opacity:a?.opacity,height:a?.height,texture:a?.texture,topColor:a?.topColor,topTexture:a?.topTexture,interactive:a?.interactive,children:n,bevel:a?.bevel}}else{if(o?.type==="group-container")return{id:o.userData.entityId,type:"group-container",visible:o.visible,altitude:o.getWorldPosition(nz).z??0,opacity:o.opacity,interactive:!!o.components[0],children:Array.from(o.childrenIds.values()).map(n=>this.getState(n)).filter(Boolean)};if(o?.type==="label"){let n=o.components[0],i=o.object3d.parent,a=i?.userData.entityId;return{id:o.id,type:"label",text:n.text||"",parent:{id:a,type:i?.type},position:this.convert3DMapPositionToCoordinate(o.position),enabled:n.enabled,visible:n.visible,initialRank:fm(n.initialRank),options:{rank:fm(n.rank),appearance:n.appearance,interactive:o.components[1]!=null,verticalOffset:o.verticalOffset,attachTo:o.attachedTo}}}else if(o?.type==="marker"){let n=o.components[0],i=o.object3d.parent,a=i?.userData.entityId;return{id:o.id,type:"marker",enabled:n.enabled,visible:n.visible,placement:n.options.placement,dynamicResize:n.options.dynamicResize,parent:{id:a,type:i?.type},position:this.convert3DMapPositionToCoordinate(o.position),element:n.containerEl,initialRank:fm(n.initialRank),contentHTML:n.contentHtml,options:{rank:fm(n.rank),interactive:o.components[1]!=null||!1,verticalOffset:o.verticalOffset,attachTo:o.attachedTo,lowPriorityPin:n.options.lowPriorityPin}}}else if(o?.type==="geometry"){let{color:n,hoverColor:i,initialColor:a,initialTopColor:l,topColor:c,altitude:p}=o.components[1],u=o.components[0],f=o.components[1],h=o.components[1],b=o.components[2],x=o.components[3],T=o.parentObject3D;return{id:o.id,type:"geometry",opacity:h.opacity,initialColor:a,color:n,focusable:f!=null&&f.focusMesh!=null,initialTopColor:l,topColor:c,side:h.side,hoverColor:i,hovered:!!b?.hover,height:h.height,visible:h.visible,outline:x?.enabled,showImage:h.showImage,texture:h.texture,topTexture:h.topTexture,flipImageToFaceCamera:h.flipImageToFaceCamera,enableImageCollisions:h.enableImageCollisions,parent:{id:T?.userData.entityId,type:T?.type},altitude:p,bevel:h.bevel,position:this.convert3DMapPositionToCoordinate(u.position),interactive:o.components[2]!=null,borderVisible:h.borderVisible,borderColor:h.borderColor,borderWidth:h.borderWidth}}else if(o?.type==="model"){let n=o.components[0],i=o.components[1],a=o.components[2];return{id:o.id,type:"model",position:n.mesh?this.convert3DMapPositionToCoordinate(n.mesh?.getWorldPosition(new ae)):this.convert3DMapPositionToCoordinate(n.position),interactive:a!=null,material:i.material,parent:o.parentObject3D?.parent?{id:o.parentObject3D.parent.userData.entityId,type:o.parentObject3D.parent.type}:void 0,visible:i.visible,verticalOffset:i.verticalOffset,color:i.color,opacity:i.opacity,rotation:i.rotation??Op,scale:i.scale??wp}}else if(o?.type==="path"){let n=o.components[0],i=o.components[2],a=o.components[1];return{id:o.id,type:"path",position:this.convert3DMapPositionToCoordinate(n.position),visible:a.visible,interactive:i!=null,completeFraction:n.completeFraction,color:a.color,accentColor:n.accentColor,width:n.width,animateArrowsOnPath:n.animateArrowsOnPath,displayArrowsOnPath:n.displayArrowsOnPath,verticalOffset:a.altitude}}else if(o?.type==="image"){let n=o.components[0];return{id:o.id,type:"image",position:this.convert3DMapPositionToCoordinate(n.position),visible:o.components[1].visible,verticalOffset:n.feature.properties.verticalOffset??0,opacity:o.components[1].opacity,flipImageToFaceCamera:o.components[1].flipImageToFaceCamera,width:n.feature.properties.width??0,height:n.feature.properties.height??0,rotation:n.feature.properties.rotation??0}}else if(o?.type==="text3d"&&o.components[0]instanceof my&&"textArea"in o.components[0].feature.properties){DM(o);let n=o.components[0],i=o.components[1],{textMesh:a}=n,l=n.mesh?.parent;l instanceof hr&&l.children.find(u=>u.type==="batchedtext")?.getWorldPosition(s(this,Ch)),s(this,ku).set(0,0,0);let c=a?a.getWorldPosition(s(this,ku)):s(this,ku);return Object.assign({},Mp,i.getState(),{id:o.id,type:"text3d",position:this.convert3DMapPositionToCoordinate(c.add(s(this,Ch))),visible:n.visible??!1,content:n.feature.properties.content??""})}else return}}setState(t,o){if(typeof t=="object"&&o==null){"hoverColor"in t&&(um(t.hoverColor)?s(this,j).hoverColor=t.hoverColor??s(this,j).hoverColor:A.warn(`Failed to update global hover color. Invalid color "${t.hoverColor}".`)),"text3dHoverColor"in t&&(s(this,j).text3dHoverColor=t.text3dHoverColor??s(this,j).text3dHoverColor);return}let n=Sp(s(this,j),t);if(n!=null){if(n.type==="custom-geometry"){let i=s(this,j).geometry3DMap.get(n.id);if(i instanceof Mt&&i.components[0]instanceof Tu){let a=o;Ua(n,s(this,j),a.visible),Ep(n,a.altitude),j0(n,a.position,this.convertTo3DMapPosition),G0(n,this.getParentContainer(a.parent,!1)),zo(n,a.interactive,s(this,j))&&s(this,Ct).call(this)}}else if(n.type==="path"){let i=o;zo(n,i.interactive,s(this,j))&&s(this,Ct).call(this),Ep(n,i.verticalOffset),PM(n,s(this,j),i)}else if(n.type==="model"){let i=o;zo(n,i.interactive,s(this,j))&&s(this,Ct).call(this),Ua(n,s(this,j),i.visible),AM(n,i)}else if(n.type==="group-container"){let i=o;Ua(n,s(this,j),i.visible)&&(s(this,B).pathSystem.verticalDistanceDirty=!0,s(this,B).geometryInFocusSystem.focusablesDirty=!0),Ep(n,i.altitude)&&(s(this,B).pathSystem.verticalDistanceDirty=!0),zo(n,i.interactive,s(this,j))&&s(this,Ct).call(this),hy(n,s(this,j),i.opacity)&&(s(this,B).outlineInterpolationSystem.outlineOpacitiesDirty=!0),i.preloadGeometry&&n.userData.preloadGeometry!==!0&&(n.userData.preloadGeometry=!0,s(this,B).outlineInterpolationSystem.geometries3DDirty=!0),gy(n,i.focusable)&&(s(this,B).geometryInFocusSystem.focusablesDirty=!0)}else if(n.type==="geometry-group"){let i=o;Ua(n,s(this,j),i.visible),hM(n,s(this,j),i),V0(n,s(this,j),i.outline),i.height!=null&&N0(n,s(this,j),i.height),Ep(n,i.altitude),CM(n,s(this,j),i),gM(n,s(this,j),i.shading),hy(n,s(this,j),i.opacity)&&(s(this,B).outlineInterpolationSystem.outlineOpacitiesDirty=!0),zo(n,i.interactive,s(this,j))&&(s(this,Ct).call(this),s(this,Tr).call(this)),$0(n,s(this,j),i.side)}else if(n.type==="geometry"){if(n.components[0]instanceof fr){let i=o;Ua(n,s(this,j),i.visible),V0(n,s(this,j),i.outline),yM(n,i),gy(n,i.focusable)&&(s(this,B).geometryInFocusSystem.focusablesDirty=!0),OM(n,i.renderOrder)&&(s(this,B).meshDetachmentSystem.dirty=!0),wM(n,i.opacity)&&(s(this,B).meshDetachmentSystem.dirty=!0,s(this,B).interactionSystem.dirty3D=!0,s(this,B).outlineInterpolationSystem.outlineOpacitiesDirty=!0),U0(n,i.flipImageToFaceCamera),TM(n,i.enableImageCollisions),Ep(n,i.altitude),i.height!=null&&N0(n,s(this,j),i.height),MM(n,i)&&(s(this,B).meshDetachmentSystem.dirty=!0),bM(n,i),IM(n,i.hoverColor),zo(n,i.interactive,s(this,j)),SM(n,i.hovered),$0(n,s(this,j),i.side),EM(n,i)}s(this,Ct).call(this)}else if(n.type==="label"||n.type==="marker"){let i=o;vM(n,o,s(this,j)),xM(n,o,s(this,j))&&(s(this,Tr).call(this),s(this,B).domMutationSystem.dirty=!0),j0(n,i.position,this.convertTo3DMapPosition),G0(n,this.getParentContainer(i.parent,!1))&&(s(this,Tr).call(this),s(this,B).panBoundsSystem.dirty=!0),fy(n,i.enabled),Ua(n,s(this,j),i.visible)}else if(n.type==="image"){let i=o;Ua(n,s(this,j),i.visible),hy(n,s(this,j),i.opacity),U0(n,i.flipImageToFaceCamera)}else if(n.type==="text3d"){let i=o;kM(n,s(this,j),i)}this.render()}}convertTo3DMapPosition(t,o,n=0,i){if(Array.isArray(t))return this.convertTo3DMapPosition(t[1],t[0],t[2]??n,typeof o=="function"?o:void 0);if(typeof o!="number")throw new Error("convertTo3DMapPosition failed: longitude must be a number");let{x:a,y:l}=py(s(this,j).center?.[1]??0,s(this,j).center?.[0]??0,t,o);return i?(i.set(a,l,n),i):new ae(a,l,n)}get backgroundColor(){return typeof s(this,_r).backgroundColor=="string"?s(this,_r).backgroundColor:`#${s(this,_r).backgroundColor.getHexString()}`}get backgroundAlpha(){return s(this,_r).backgroundAlpha}getThreeRenderer(){return s(this,_r)}getCenter(t){let o=Array.isArray(t)?t:this.getBoundingArea(t);return o?tM(o):void 0}isInView(t){let o=Sp(s(this,j),t);if(s(this,Sh).identity().multiply(s(this,Vt).projectionMatrix).multiply(s(this,Vt).matrixWorldInverse),s(this,Hc).setFromProjectionMatrix(s(this,Sh)),o instanceof F0)return s(this,Hc).containsPoint(o.position);if(o instanceof Mt){let n=o?.components[0];if(n instanceof Tu||n instanceof xl)return s(this,Hc).containsPoint(this.convertTo3DMapPosition(n.feature.geometry.coordinates));if(n instanceof fr){let i=new sr(this.convertTo3DMapPosition(n.featureBbox[1],n.featureBbox[0],0),this.convertTo3DMapPosition(n.featureBbox[3],n.featureBbox[2],0));return s(this,Hc).intersectsBox(i)}}return!1}queryGeometry2DInView(t){let{screenOffsets:o,fullyContains:n}=t??{},[i,a,l,c]=iM(this.container,o),p=new rt(i,a,l,c);return s(this,B).collisionSystem.visibleCollidersQTree.queryRect(p).filter(b=>n?p.contains(b):p.intersects(b)).map(b=>s(this,j).geometry2DMap.get(b.userData.entityId)).filter(b=>b!=null).filter(b=>b.components[0]instanceof Fs||b.components[0]instanceof Ds).map(b=>b.id.toString())}onMapLibreEvent(t,o){if(!this.map){A.warn(`Tried to add event listener "${t}" but MapLibre map is not initialized.`);return}this.map.on(t,o),s(this,_n)[t]=s(this,_n)[t]||[],s(this,_n)[t].push(o)}offMapLibreEvent(t,o){!this.map||!Array.isArray(s(this,_n)[t])||(this.map.off(t,o),s(this,_n)[t]=s(this,_n)[t].filter(n=>n!==o))}get aborted(){return s(this,Vc).signal.aborted}onAbort(t){s(this,Vc).signal.addEventListener("abort",t,{once:!0})}getSystems(){return s(this,B)}getInternalState(){return s(this,j)}getInternalTweenGroup(){return s(this,j).internalTweenGroup}getExternalTweenGroup(){return s(this,j).externalTweenGroup}computeMinZOffsetBetweenContainers(t,o,n){if(!t||!o)return-1;xp(t,"group-container"),xp(o,"group-container");let i=dy(t,this.getThreeCamera()),a=o.clone(),l=dy(a,this.getThreeCamera());if(!Bl(i)||!Bl(l))return-1;let c=0,p;n&&this.container.querySelectorAll(".debug-box").forEach(f=>f.remove());do{if(c>1e4)return-1;if(c+=20,a.position.z=c,a.updateMatrixWorld(),l.makeEmpty(),dy(a,s(this,Vt),l),p=i.intersectsBox(l),n){let u=R0(i,"blue",this.container),f=R0(l,p?"red":"green",this.container);u.classList.add("debug-box"),f.classList.add("debug-box")}}while(p);return c}};Jt=new WeakMap,Vt=new WeakMap,Gc=new WeakMap,fh=new WeakMap,Eu=new WeakMap,wl=new WeakMap,Uc=new WeakMap,Pu=new WeakMap,Jr=new WeakSet,Y2=function(t){s(this,ma)!=="outdoors-overlay"&&this.map?.setPixelRatio(t),s(this,j).pixelRatio=this.resolutionScale},j=new WeakMap,_n=new WeakMap,Vc=new WeakMap,ct=new WeakMap,xi=new WeakMap,Kt=new WeakMap,Rn=new WeakMap,_r=new WeakMap,B=new WeakMap,hh=new WeakMap,Tr=new WeakMap,Ct=new WeakMap,G4=function(){w(this,ct,document.createElement("div")),s(this,ct).classList.add("mappedin__smart-collision-engine__container"),w(this,xi,document.createElement("canvas")),s(this,xi).classList.add("mappedin__smart-collision-engine-debug__container"),this.container.appendChild(s(this,ct)),w(this,Kt,document.createElement("canvas")),s(this,Kt).classList.add("mappedin__smart-collision-engine__container"),s(this,Kt).width=s(this,ct).clientWidth*this.resolutionScale,s(this,Kt).height=s(this,ct).clientHeight*this.resolutionScale,s(this,Kt).style.width=s(this,ct).clientWidth+"px",s(this,Kt).style.height=s(this,ct).clientHeight+"px",s(this,ct).appendChild(s(this,xi)),s(this,ct).appendChild(s(this,Kt)),s(this,xi).width=s(this,ct).clientWidth,s(this,xi).height=s(this,ct).clientHeight,s(this,Kt).width=s(this,ct).clientWidth*this.resolutionScale,s(this,Kt).height=s(this,ct).clientHeight*this.resolutionScale,s(this,Kt).style.width=s(this,ct).clientWidth+"px",s(this,Kt).style.height=s(this,ct).clientHeight+"px"},U4=function(){w(this,Rn,document.createElement("div")),s(this,Rn).classList.add("mappedin-2d-entities"),Object.assign(s(this,Rn).style,{position:"absolute",top:"0",left:"0",bottom:"0",right:"0",pointerEvents:"none","transform-style":"preserve-3d"}),this.container.appendChild(s(this,Rn))},V4=function(){s(this,Kt).width=s(this,ct).clientWidth*this.resolutionScale,s(this,Kt).height=s(this,ct).clientHeight*this.resolutionScale,s(this,Kt).style.width=s(this,ct).clientWidth+"px",s(this,Kt).style.height=s(this,ct).clientHeight+"px",s(this,xi).width=s(this,ct).clientWidth,s(this,xi).height=s(this,ct).clientHeight,s(this,Kt).width=s(this,ct).clientWidth*this.resolutionScale,s(this,Kt).height=s(this,ct).clientHeight*this.resolutionScale,s(this,Kt).style.width=s(this,ct).clientWidth+"px",s(this,Kt).style.height=s(this,ct).clientHeight+"px",s(this,B).collisionSystem.collidersDirty=!0},ma=new WeakMap,gh=new WeakMap,yh=new WeakMap,bh=new WeakMap,xh=new WeakMap,Fu=new WeakMap,Ax=new WeakMap,vh=new WeakMap,Du=new WeakMap,Ih=new WeakMap,$c=new WeakMap,J2=function(t,o,n,i){let a=new F0(o,this.convertTo3DMapPosition(t[1],t[0],t[2]||0),i);return a.occluderId=n??s(this,B).occlusion2DSystem.backgroundId,s(this,j).geometry2DMap.set(a.id,a),a},Hc=new WeakMap,Sh=new WeakMap,Th=new WeakMap,To=new WeakMap,Co=new WeakMap,K2=async function(){return vl.load(FD).then(t=>(s(this,Jt)&&(s(this,Jt).environment?.dispose(),t.mapping=nC,s(this,Jt).environment=t,this.render()),t))},Lx=new WeakMap,_x=new WeakMap,ku=new WeakMap,Ch=new WeakMap;var nz=new ae,tT=X2;d();function iz(e,r){sz(e,r)(e.getScene(),r),az(e,r),r.addFolder("Export").add({export:async()=>{let a=await e.getCurrentSceneGLTF({binary:!0}),l=new Blob([a],{type:"application/octet-stream"});var c=document.createElement("a");document.body.appendChild(c),c.style.display="none";let p=window.URL.createObjectURL(l);c.href=p,c.download="scene.glb",c.click(),window.URL.revokeObjectURL(p)}},"export");let n=r.addFolder("Camera"),i={get bearing(){return e.camera.bearing},set bearing(a){e.camera.setBearing(a)},get pitch(){return e.camera.pitch},set pitch(a){e.camera.setPitch(a)},get zoomLevel(){return e.camera.zoomLevel},set zoomLevel(a){e.camera.setZoomLevel(a)}};n.add(i,"bearing",-359,359,1),n.add(i,"pitch",e.camera.minPitch,e.camera.maxPitch,1),n.add(i,"zoomLevel",e.camera.minZoomLevel,e.camera.maxZoomLevel,.1)}function sz(e,r){let t=r;return function o(n,i){let a=i.addFolder(`${[n.type]} ${n.id.slice(0,16)}`);if(i.close(),n.type==="geometry"||n.type==="model"||n.type==="path"||n.type==="image"){let l={get height(){let c=e.getState(n.id);return c?.type==="geometry"?c.height:0},set height(c){e.getState(n.id)?.type==="geometry"&&e.setState(n,{height:c})},set flipImageToFaceCamera(c){e.getState(n.id)?.type==="image"&&e.setState(n,{flipImageToFaceCamera:c})},get flipImageToFaceCamera(){let c=e.getState(n.id);return c?.type==="image"?c.flipImageToFaceCamera:!1},set visible(c){let p=e.getState(n.id);(p?.type==="geometry"||p?.type==="path"||p?.type==="image")&&e.setState(n,{visible:c})},get visible(){let c=e.getState(n.id);return c?.type==="geometry"||c?.type==="path"||c?.type==="image"?c.visible:!1},set outline(c){e.getState(n.id)?.type==="geometry"&&e.setState(n,{outline:c})},get outline(){let c=e.getState(n.id);return c?.type==="geometry"?c.outline:!1},get opacity(){let c=e.getState(n.id);return c?.type==="geometry"?c.opacity:1},set opacity(c){let p=e.getState(n.id);p?.type==="geometry"&&e.setState(p,{opacity:c})},get color(){let c=e.getState(n.id);return c?.type==="geometry"&&c.color?NC(c.color).toHexString():"#ffffff"},set color(c){let p=e.getState(n.id);p?.type==="geometry"&&e.setState(p,{color:c})},set interactive(c){let p=e.getState(n.id);(p?.type==="geometry"||p?.type==="model"||p?.type==="path")&&(e.setState(n,{interactive:c}),t.controllersRecursive().forEach(u=>u.updateDisplay()))},get interactive(){let c=e.getState(n.id);return c?.type==="geometry"||c?.type==="model"||c?.type==="path"?c.interactive:!1},get completeFraction(){let c=e.getState(n.id);return c?.type==="path"?c.completeFraction:1},set completeFraction(c){let p=e.getState(n.id);p?.type==="path"&&e.setState(p,{completeFraction:c})},focus:()=>{}};a.add(l,"focus").onChange(()=>{let c=e.getState(n.id);c?.type==="model"||c?.type==="path"||c?.type==="image"?e.camera.focusOn([c.position]):c?.type==="geometry"&&e.camera.focusOn(e.getBoundingArea(c))}),a.add(l,"visible"),n.type==="image"?a.add(l,"flipImageToFaceCamera"):(a.add(l,"interactive"),n.type==="path"&&a.add(l,"completeFraction",0,1,.1),n.type!=="model"&&(a.addColor(l,"color"),a.add(l,"outline"))),n.type==="geometry"&&(a.add(l,"height"),a.add(l,"opacity",0,1,.1))}else if(n.type==="marker"){let l={get interactive(){let c=e.getState(n.id);return c?.type==="marker"?c.options?.interactive:!1},set interactive(c){let p=e.getState(n.id);p?.type==="marker"&&(e.setState(p,{options:{interactive:c}}),t.controllersRecursive().forEach(u=>u.updateDisplay()))},focus:()=>{}};a.add(l,"focus").onChange(()=>{let c=e.getState(n.id);c?.type==="marker"&&e.camera.focusOn([c.position])}),a.add(l,"interactive")}else if(n.type==="label"){let l={get interactive(){let c=e.getState(n.id);return c?.type==="label"?c.options?.interactive:!1},set interactive(c){let p=e.getState(n.id);p?.type==="label"&&(e.setState(p,{options:{interactive:c}}),t.controllersRecursive().forEach(u=>u.updateDisplay()))},get text(){let c=e.getState(n.id);return c?.type==="label"?c.text:""},set text(c){let p=e.getState(n.id);p?.type==="label"&&e.setState(p,{text:c})},get"Text Color"(){let c=e.getState(n.id);return c?.type==="label"?c.options.appearance?.textColor:"#000000"},set"Text Color"(c){e.getState(n.id)?.type==="label"&&e.setState(n.id,{text:l.text,options:{appearance:{textColor:c}}})},get"Text Size"(){let c=e.getState(n.id);return c?.type==="label"?c.options.appearance?.textSize:10},set"Text Size"(c){let p=e.getState(n.id);p?.type==="label"&&e.setState(p,{text:l.text,options:{appearance:{textSize:c}}})},get"Icon Size"(){let c=e.getState(n.id);return c?.type==="label"?c.options.appearance?.iconSize:10},set"Icon Size"(c){let p=e.getState(n.id);p?.type==="label"&&e.setState(p,{text:l.text,options:{appearance:{iconSize:c}}})},get"Pin Color"(){let c=e.getState(n.id);return c?.type==="label"?c.options.appearance?.pinColor:"#000000"},set"Pin Color"(c){let p=e.getState(n.id);p?.type==="label"&&e.setState(p,{text:l.text,options:{appearance:{pinColor:c}}})},get"Pin Color Inactive"(){let c=e.getState(n.id);return c?.type==="label"?c.options.appearance?.pinColorInactive:"#000000"},set"Pin Color Inactive"(c){let p=e.getState(n.id);p?.type==="label"&&e.setState(p,{text:l.text,options:{appearance:{pinColorInactive:c}}})},get"Pin Outline Color"(){let c=e.getState(n.id);return c?.type==="label"?c.options.appearance?.pinOutlineColor:"#000000"},set"Pin Outline Color"(c){let p=e.getState(n.id);p?.type==="label"&&e.setState(p,{text:l.text,options:{appearance:{pinOutlineColor:c}}})},get"Pin Outline Color Inactive"(){let c=e.getState(n.id);return c?.type==="label"?c.options.appearance?.pinOutlineColorInactive:"#000000"},set"Pin Outline Color Inactive"(c){let p=e.getState(n.id);p?.type==="label"&&e.setState(p,{text:l.text,options:{appearance:{pinOutlineColorInactive:c}}})},focus:()=>{}};a.add(l,"focus").onChange(()=>{let c=e.getState(n.id);c?.type==="label"&&e.camera.focusOn([c.position])}),a.add(l,"interactive"),a.add(l,"text"),a.add(l,"Text Size",10,50),a.add(l,"Icon Size",10,50),a.addColor(l,"Text Color"),a.addColor(l,"Active Background Color"),a.addColor(l,"Inactive Background Color"),a.addColor(l,"Active Foreground Color"),a.addColor(l,"Inactive Foreground Color")}else if(n.type==="geometry-group"){let l={get opacity(){let c=e.getState(n.id);return c?.type==="geometry-group"?c.opacity:1},set opacity(c){e.getState(n.id)?.type==="geometry-group"&&e.setState(n,{opacity:c})},set visible(c){e.getState(n.id)?.type==="geometry-group"&&e.setState(n,{visible:c})},get visible(){let c=e.getState(n.id);return c?.type==="geometry-group"?c.visible:!1},set outline(c){e.getState(n.id)?.type==="geometry-group"&&e.setState(n,{outline:c})},get outline(){let c=e.getState(n.id);return c?.type==="geometry-group"?c.outline:!1},set altitude(c){e.getState(n.id)?.type==="geometry-group"&&e.setState(n,{altitude:c})},get altitude(){let c=e.getState(n.id);return c?.type==="geometry-group"?c.altitude:0},set interactive(c){e.getState(n.id)?.type==="geometry-group"&&(e.setState(n,{interactive:c}),t.controllersRecursive().forEach(u=>u.updateDisplay()))},get interactive(){let c=e.getState(n.id);return c?.type==="geometry-group"?c.interactive:!1},get shadingStart(){let c=e.getState(n.id);return c?.type==="geometry-group"?c.shading?.start??0:0},set shadingStart(c){let p=e.getState(n.id);p?.type==="geometry-group"&&e.setState(p,{shading:{start:c}})},get shadingEnd(){let c=e.getState(n.id);return c?.type==="geometry-group"?c.shading?.end??0:0},set shadingEnd(c){let p=e.getState(n.id);p?.type==="geometry-group"&&e.setState(p,{shading:{end:c}})},get shadingIntensity(){let c=e.getState(n.id);return c?.type==="geometry-group"?c.shading?.intensity??0:0},set shadingIntensity(c){let p=e.getState(n.id);p?.type==="geometry-group"&&e.setState(p,{shading:{intensity:c}})}};a.add(l,"visible"),a.add(l,"opacity",0,1,.1),a.add(l,"interactive"),a.add(l,"outline"),a.add(l,"altitude",0,100,1),a.add(l,"shadingStart",0,1,.1),a.add(l,"shadingEnd",0,1,.1),a.add(l,"shadingIntensity",0,1,.1)}else if(n.type==="group-container"){let l={set visible(c){e.getState(n.id)?.type==="group-container"&&e.setState(n,{visible:c})},get visible(){let c=e.getState(n.id);return c?.type==="group-container"?c.visible:!1},set interactive(c){let p=e.getState(n.id);p?.type==="group-container"&&(e.setState(p,{interactive:c}),t.controllersRecursive().forEach(u=>u.updateDisplay()))},get interactive(){let c=e.getState(n.id);return c?.type==="group-container"?c.interactive:!1}};a.add(l,"visible"),a.add(l,"interactive")}if(a.close(),n.children)for(let l of n.children.values())o(l,a)}}function az(e,r){let t=r.addFolder("Watermark"),o={padding:16,iconOnly:!1,position:"bottom-left",color:"dark",scale:1};t.add(o,"padding",0,100,1),t.add(o,"scale",.5,1.5,.1),t.add(o,"color",["dark","light"]),t.add(o,"position",["top-left","top-right","bottom-left","bottom-right","center","top","bottom","left","right"]),t.add(o,"iconOnly"),t.onChange(()=>{e.updateWatermark(o)})}var $4="https://tiles-cdn.mappedin.com/styles/mappedin/style.json",cz="https://auth.mappedin.com/oauth2/token";var Rx="";function rT(e){Rx=e,zC(e)}var Pc="";function oT(e){Pc=e}async function H4(e,r){let t=r?.useWorkers??!0,o={...r,watermark:r?.watermark,attribution:r?.attribution,antialias:r?.antialias,occlusionEnabled:r?.occlusionEnabled,transformImageRequest:r?.transformImageRequest,naturalBearing:r?.naturalBearing??0,imagePlacementOptions:r?.imagePlacementOptions,onWebGLContextCreationError:r?.onWebGLContextCreationError,onWebGLContextLost:r?.onWebGLContextLost,onWebGLContextRestored:r?.onWebGLContextRestored,onWebGLRendererError:r?.onWebGLRendererError,useStandaloneCamera:r?.useStandaloneCamera??!1,useCollisionWorker:r?.useCollisionWorker??!0,useWorkers:t};if(t===!0&&r?.outdoorView?.enabled){let{Map:n,MercatorCoordinate:i}=await import("./outdoor-context-v5-XNL42GDZ.js"),a=r.outdoorView.headers;a==null&&(a=await qC(cz));let l=r.center||[0,0],c=new n({container:e,style:r.outdoorView.style||$4,center:l,attributionControl:!1,zoom:r.zoomLevel??eT,pitch:r.pitch??Q2,bearing:r.bearing??q2,transformRequest:YC(a),trackResize:!1,pixelRatio:r.outdoorView.lowDpi?1:Tp(),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}),p=c.painter.context.gl,u=new tT(e,{center:l,zoomLevel:c.getZoom(),pitch:c.getPitch(),bearing:c.getBearing(),gl:p,map:c,mode:"outdoors-interleaved",...o}),f={center:c.getCenter().toArray(),zoom:c.getZoom(),bearing:c.getBearing(),pitch:c.getPitch(),elevation:c.getCenterElevation()};c.setMinZoom(u.camera.minZoomLevel),c.setMaxZoom(u.camera.maxZoomLevel),c.setMaxPitch(u.camera.maxPitch),c.setMinPitch(u.camera.minPitch),u.on("camera-change",E=>{f.center=E.center,f.zoom=E.zoomLevel,f.bearing=E.bearing,f.pitch=E.pitch,f.elevation=E.elevation,c.jumpTo(f)});let h=i.fromLngLat(l,0),b=QC(h,u.viewCamera,()=>{u.renderSync()}),x=async()=>{c&&(c.addLayer(b),u.renderSync())};u.onMapLibreEvent("style.load",x);let T=!1,v=!1,I=()=>{c&&(T||(u.publish("outdoor-view-loaded"),T=!0),v||(v=!0,u.publish("outdoor-style-loaded")))};u.onMapLibreEvent("idle",I);let M=E=>{E&&(E.sourceDataType==="metadata"||E.sourceDataType==="visibility"||E.dataType==="style"||E.type==="terrain")&&u.getSystems().htmlControlsSystem.updateData(c)},O=E=>{c&&E&&E.dataType==="style"&&E.type==="styledata"&&(v=!1),M(E)};u.onMapLibreEvent("styledata",O),u.onMapLibreEvent("sourcedata",M),u.onMapLibreEvent("terrain",M);let C=E=>{if(E.error?.url===$4){A.error(`Failed to load outdoor view style, possibly due to invalid token "${a["x-mappedin-tiles-key"]}"`);return}A.warn(E)};return u.onMapLibreEvent("error",C),u}else return new tT(e,o)}d();d();d();d();var Mh=class Mh{constructor(r,t,o){m(this,"id");m(this,"text");m(this,"target");m(this,"__type",Mh.__type);this.id=r,this.text=t,this.target=o}static is(r){return r.__type===Mh.__type}get focusTarget(){return this.target.anchorTarget}};m(Mh,"__type","label");var fa=Mh;d();var zc,Au=class Au{constructor(r,t,o){m(this,"id");S(this,zc);m(this,"__type",Au.__type);m(this,"contentEl");this.id=r,this.contentEl=t,w(this,zc,o)}get target(){return s(this,zc)}get coordinate(){return s(this,zc).anchorTarget}toJSON(){return{id:this.id,__type:Au.__type,target:this.target,coordinate:this.coordinate}}static is(r){return r.__type===Au.__type}get focusTarget(){return this.target.anchorTarget}updateTarget(r){w(this,zc,r)}};zc=new WeakMap,m(Au,"__type","marker");var us=Au;d();var Oh,Eh,wh=class wh{constructor(r,t,o){S(this,Oh);S(this,Eh);m(this,"target");m(this,"__type",wh.__type);w(this,Oh,r),w(this,Eh,t),this.target=o}static is(r){return r.__type===wh.__type}get id(){return s(this,Oh)}get url(){return s(this,Eh)}};Oh=new WeakMap,Eh=new WeakMap,m(wh,"__type","image-3d");var Wc=wh;d();var Zc,Lu=class Lu{constructor(r,t,o){m(this,"id");m(this,"groupId");m(this,"__type",Lu.__type);S(this,Zc);this.id=r,this.groupId=t,w(this,Zc,o)}get target(){return s(this,Zc)}static is(r){return r.__type===Lu.__type}updateTarget(r){w(this,Zc,r)}toJSON(){return{id:this.id,__type:Lu.__type,groupId:this.groupId,target:s(this,Zc)}}};Zc=new WeakMap,m(Lu,"__type","model");var Xc=Lu;d();var Ph=class Ph{constructor(r,t){m(this,"id");m(this,"coordinates");m(this,"__type",Ph.__type);this.id=r,this.coordinates=t}static is(r){return r.__type===Ph.__type}get focusTarget(){return this.coordinates}};m(Ph,"__type","path-segment");var Ru=Ph,_u=class _u{constructor(r,t,o,n){m(this,"id");m(this,"animation");m(this,"coordinates");m(this,"segments");m(this,"__type",_u.__type);this.id=r,this.animation=t,this.coordinates=o,this.segments=n.map(({id:i,coordinates:a})=>new Ru(i.toString(),a))}static is(r){return r.__type===_u.__type}get focusTarget(){return this.coordinates}toJSON(){return{__type:_u.__type,id:this.id,coordinates:this.coordinates,segments:this.segments}}};m(_u,"__type","path");var Bn=_u;d();var pz=7,Ol,Yc,Fh=class{constructor(r,t){S(this,Ol);S(this,Yc);w(this,Ol,r),w(this,Yc,t?.precision??pz)}toJSON(){return{center:this.center,bearing:this.bearing,pitch:this.pitch,zoomLevel:this.zoomLevel}}get center(){let r=s(this,Ol).center;if(s(this,Yc)===-1)return r;let t=Di(r.latitude,s(this,Yc)),o=Di(r.longitude,s(this,Yc));return new fe({latitude:t,longitude:o,floorId:r.floorId,verticalOffset:r.verticalOffset})}get bearing(){return s(this,Ol).bearing}get pitch(){return s(this,Ol).pitch}get zoomLevel(){return Di(s(this,Ol).zoomLevel,5)}};Ol=new WeakMap,Yc=new WeakMap;d();var Dh=class Dh{constructor(r){m(this,"id");m(this,"__type",Dh.__type);this.id=r}static is(r){return r.__type===Dh.__type}get focusTarget(){return this}};m(Dh,"__type","shape");var ha=Dh;d();var kh=class kh{constructor(r,t){m(this,"id");m(this,"target");m(this,"__type",kh.__type);this.id=r,this.target=t}static is(r){return r.__type===kh.__type}};m(kh,"__type","text-3d");var El=kh;d();d();d();var dz=new Map([["search-16x16",`<svg viewBox="0 0 16 16">
510
510
  <path
511
511
  fillRule="evenodd"
512
512
  clipRule="evenodd"
@@ -724,9 +724,9 @@ void main(void) {
724
724
  fill="${e}"
725
725
  />
726
726
  </svg>
727
- `,oT="#722ED1",nT="#1890FF",W4=({type:e="departure",color:r=nT})=>`<div class="dropped-pin-wrapper">
727
+ `,nT="#722ED1",iT="#1890FF",W4=({type:e="departure",color:r=iT})=>`<div class="dropped-pin-wrapper">
728
728
  ${e==="departure"?mz(r):fz(r)}
729
- </div>`,hz=e=>{switch(e){case"default":return 28;case"selection":return 28;case"navigation":return 32}},Z4=({type:e="stairs",color:r=oT,direction:t="up"})=>{let o=hz("default"),n=o/2+2,i=t&&t!=="none";return`<div class="mappedin-connection-marker">
729
+ </div>`,hz=e=>{switch(e){case"default":return 28;case"selection":return 28;case"navigation":return 32}},Z4=({type:e="stairs",color:r=nT,direction:t="up"})=>{let o=hz("default"),n=o/2+2,i=t&&t!=="none";return`<div class="mappedin-connection-marker">
730
730
  <div class="connection-circle"
731
731
  role="button"
732
732
  style="background:${r}; width:${o}px; height:${o}px;"
@@ -751,8 +751,8 @@ void main(void) {
751
751
  </div>
752
752
  </div>
753
753
  </div>`:""}
754
- </div>`};d();var X4=async e=>new Promise(r=>setTimeout(r,e));var gz=.01,yz=.02,bz={drawDuration:1e3,color:"#40A9FF",interactive:!1,accentColor:"blue",width:{on:"zoom-level",input:[17,22],output:[2,.5]},displayArrowsOnPath:!1,animateArrowsOnPath:!1},xz={drawDuration:1e3,color:"#B3DDFF",interactive:!1,accentColor:"#40A9FF",width:{on:"zoom-level",input:[17,22],output:[2,.5]},displayArrowsOnPath:!1,animateArrowsOnPath:!1},Pl={setMapOnConnectionClick:!0,setMapToDeparture:!0,createMarkers:{departure:!0,destination:!0,connection:!0},pathOptions:bz,inactivePathOptions:xz,markerOptions:{departureColor:nT,destinationColor:oT},animatePathDrawing:!0},ga,us,Nn,$e,Rh,ya,Jc,nr,$o,lo,jn,Fl,ot,Y4,J4,Ah,K4,iT,Lh,Rx,Bu,sT,Nu,_h=class{constructor(r,t,o){S(this,ot);S(this,ga,new Map);S(this,us);S(this,Nn);S(this,$e,Pl);S(this,Rh);S(this,ya);S(this,Jc);S(this,nr,[]);S(this,$o);S(this,lo,new Map);S(this,jn,new Map);S(this,Fl,new Map);S(this,Nu,r=>{if(s(this,$e).createMarkers?.connection&&r.markers.length>0){let{instruction:t}=s(this,ga).get(r.markers[0]);t?.action.toFloor&&(s(this,$e).setMapOnConnectionClick&&this.currentMap.setFloor(t.action.toFloor.id,"navigation-connection-click"),s(this,Nn).publish("navigation-connection-click",{instruction:t,fromFloor:t.action.fromFloor,toFloor:t.action.toFloor}))}});w(this,us,r),w(this,Rh,o),w(this,Nn,t)}get currentMap(){return s(this,Rh).call(this)}get isMultiFloor(){if(!s(this,nr).length)return!1;let r=new Set;for(let t of s(this,nr))for(let o of t.coordinates)if(o.floorId&&(r.add(o.floorId),r.size>1))return!0;return!1}getPathById(r){return s(this,lo).get(r)}getMarkerById(r){return s(this,ga).get(r)}get paths(){let r=new Set;return s(this,lo).forEach(({path:t})=>r.add(t)),Array.from(r)}get activeDirections(){return s(this,Fl).get(s(this,$o))}get activePath(){if(s(this,$o))return s(this,lo).get(s(this,$o).id)?.path}get floorStacks(){let r=s(this,Nn).getMapData();if(!s(this,nr).length||!r)return[];let t=new Set;for(let o of s(this,nr))for(let n of o.coordinates)if(n.floorId){let i=r.getById("floor",n.floorId);i&&t.add(i.floorStack)}return Array.from(t)}get floors(){let r=s(this,Nn).getMapData();if(!s(this,nr).length||!r)return[];let t=new Set;for(let o of s(this,nr))for(let n of o.coordinates)if(n.floorId){let i=r.getById("floor",n.floorId);i&&t.add(i)}return Array.from(t)}setActivePathByIndex(r){let t=s(this,nr)[r];if(!s(this,nr).length){A.warn("Cannot set an active path before drawing. Call Navigation.draw() first.");return}if(!s(this,nr)[r]){A.warn(`Direction #${r} does not exist`);return}let o=s(this,jn).get(t);if(!o){A.warn("The direction is not a part of muli-direcional path");return}W(this,ot,Rx).call(this,o)}setActivePath(r){if(!s(this,nr).length){A.warn("Cannot set an active path before drawing. Call Navigation.draw() first.");return}if(!s(this,Fl).get(r)){A.warn(`Path "${r.id}" is not a part of muli-direcional path`);return}W(this,ot,Rx).call(this,r)}setActivePathByDirections(r){if(!s(this,nr).length){A.warn("[setActivePathByDirections] Cannot set an active path before drawing. Call Navigation.draw() first.");return}let t=s(this,jn).get(r);if(!t){let o=s(this,nr).find(n=>n.id===r.id);if(!o){A.warn("[setActivePathByDirections] Cannot find directions for id");return}t=s(this,jn).get(o)}if(!t){A.warn("[setActivePathByDirections] Cannot find path for directions");return}W(this,ot,Rx).call(this,t)}drawSync(r,t={}){s(this,Jc)&&this.clear(),w(this,Jc,!0),W(this,ot,iT).call(this,t);let o=Array.isArray(r)?r:[r],n=o[0],i=o[o.length-1],a=n.coordinates[0];w(this,nr,o),a.floorId&&s(this,$e).setMapToDeparture&&this.currentMap.setFloor(a.floorId),s(this,$e).createMarkers?.departure&&W(this,ot,Bu).call(this,n.coordinates[0],"departure",n.instructions[0]);for(let l=0;l<o.length;l++){let c=o[l],p=l?{...s(this,$e).inactivePathOptions}:{...s(this,$e).pathOptions};if(c.coordinates.length<2){A.warn("Directions must have at least 2 coordinates");return}let u=this.currentMap.Paths.add(c.coordinates,{...p,animateDrawing:s(this,$e).animatePathDrawing,verticalOffset:W(this,ot,Ah).call(this,l===0?"active":"inactive")}),f=u.paths.map(b=>b.id.toString()),h=new Bn(ut(),u.animation,c.coordinates,u.paths);for(let b of f){s(this,lo).set(b,{path:h,entityIds:f});let x=l?{...s(this,$e).inactivePathOptions}:{...s(this,$e).pathOptions};s(this,us).setState(b,x)}s(this,lo).set(h.id,{path:h,entityIds:f}),s(this,jn).set(c,h),s(this,Fl).set(h,c),s(this,$e).createMarkers?.connection&&W(this,ot,sT).call(this,c.instructions,"connection"),l===0&&(w(this,$o,s(this,jn).get(s(this,nr)[0])),s(this,us).on("click",s(this,Nu)))}s(this,$e).createMarkers?.destination&&W(this,ot,Bu).call(this,i.coordinates[i.coordinates.length-1],"destination",i.instructions[i.instructions.length-1]),s(this,Nn).mapObjects.forEach(l=>{l.processFloorChange(l.currentFloorId)}),W(this,ot,Lh).call(this)}async draw(r,t={}){s(this,ya)&&this.clear(),W(this,ot,iT).call(this,t);let o=Array.isArray(r)?r:[r],i=o[0].coordinates[0];return w(this,nr,o),i.floorId&&s(this,$e).setMapToDeparture&&this.currentMap.setFloor(i.floorId),W(this,ot,K4).call(this,o)}clear(){s(this,ga).forEach((r,t)=>{this.currentMap.Markers.remove(t.toString())}),s(this,ga).clear(),s(this,lo).forEach(({path:r,entityIds:t})=>{s(this,lo).delete(r.id),t.forEach(o=>s(this,lo).delete(o)),this.currentMap.Paths.remove(t)}),s(this,ya)&&(s(this,ya).cancel(),w(this,ya,void 0)),s(this,Jc)&&w(this,Jc,!1),w(this,nr,[]),s(this,jn).clear(),s(this,Fl).clear(),w(this,$o,void 0),s(this,us).off("click",s(this,Nu)),s(this,Nn).mapObjects.forEach(r=>{r.processFloorChange(r.currentFloorId)}),W(this,ot,Lh).call(this)}};ga=new WeakMap,us=new WeakMap,Nn=new WeakMap,$e=new WeakMap,Rh=new WeakMap,ya=new WeakMap,Jc=new WeakMap,nr=new WeakMap,$o=new WeakMap,lo=new WeakMap,jn=new WeakMap,Fl=new WeakMap,ot=new WeakSet,Y4=function(r){return r!=null&&["TakeConnection","ExitConnection","TakeVortex","ExitVortex"].includes(r.type)},J4=function(){if(!s(this,$o))return;let r=s(this,lo).get(s(this,$o).id);if(r)for(let t of s(this,lo).values())if(t.path.id===s(this,$o).id)for(let o of r.path.segments)this.currentMap.api.updateState(o,{verticalOffset:W(this,ot,Ah).call(this,"active")});else this.currentMap.api.updateState(t.path,{verticalOffset:W(this,ot,Ah).call(this,"inactive")})},Ah=function(r){return r==="active"?yz+(s(this,$e).pathOptions?.verticalOffset??0):gz+(s(this,$e).inactivePathOptions?.verticalOffset??0)},K4=function(r){let t=r[0],o=r[r.length-1],n=!1;return w(this,ya,{promise:new Promise(async i=>{if(y.env.NODE_ENV!=="test"&&await X4(500),n||!r.length){i();return}s(this,$e).createMarkers?.departure&&W(this,ot,Bu).call(this,t.coordinates[0],"departure",t.instructions[0]);for(let a=0;a<r.length;a++){let l=r[a],c=a===0?{...s(this,$e).pathOptions}:{...s(this,$e).inactivePathOptions};if(l.coordinates.length<2){A.warn("Directions must have at least 2 coordinates"),i();return}let p=this.currentMap.Paths.add(l.coordinates,{...c,animateDrawing:s(this,$e).animatePathDrawing,verticalOffset:W(this,ot,Ah).call(this,a===0?"active":"inactive")}),u=p.paths.map(h=>h.id.toString()),f=new Bn(ut(),p.animation,l.coordinates,p.paths);for(let h of u)s(this,lo).set(h,{path:f,entityIds:u});if(s(this,lo).set(f.id,{path:f,entityIds:u}),s(this,jn).set(l,f),s(this,Fl).set(f,l),a===0&&(w(this,$o,s(this,jn).get(s(this,nr)[0])),s(this,us).on("click",s(this,Nu))),y.env.NODE_ENV!=="test"&&await p.animation,n){i();return}s(this,$e).createMarkers?.connection&&W(this,ot,sT).call(this,l.instructions,"connection")}if(s(this,$e).createMarkers?.destination&&W(this,ot,Bu).call(this,o.coordinates[o.coordinates.length-1],"destination",o.instructions[o.instructions.length-1]),n){i();return}s(this,Nn).mapObjects.forEach(a=>{a.processFloorChange(a.currentFloorId)}),W(this,ot,Lh).call(this),i()}),cancel:()=>{n=!0}}),s(this,ya).promise},iT=function(r){w(this,$e,{setMapOnConnectionClick:r.setMapOnConnectionClick??Pl.setMapOnConnectionClick,setMapToDeparture:r.setMapToDeparture??Pl.setMapToDeparture,pathOptions:{...Pl.pathOptions,...r.pathOptions},inactivePathOptions:{...Pl.inactivePathOptions,...r.inactivePathOptions},createMarkers:{...Pl.createMarkers,...r.createMarkers},markerOptions:{...Pl.markerOptions,...r.markerOptions},animatePathDrawing:r.animatePathDrawing??Pl.animatePathDrawing})},Lh=function(){s(this,Nn).publish("navigation-state-change",{isMultiFloor:this.isMultiFloor,floorStacks:this.floorStacks,floors:this.floors,activeDirections:this.activeDirections,activePath:this.activePath,paths:this.paths})},Rx=function(r){w(this,$o,r),s(this,nr).forEach(t=>{let o=s(this,jn).get(t);if(o){let n=s(this,lo).get(o.id),i=n.path.id===s(this,$o).id?{...s(this,$e).pathOptions}:{...s(this,$e).inactivePathOptions};n.entityIds.forEach(a=>{s(this,us).setState(a,i)})}}),s(this,Nn).publish("navigation-active-path-change",{directions:this.activeDirections,path:this.activePath}),W(this,ot,J4).call(this),W(this,ot,Lh).call(this)},Bu=function(r,t,o){if(t==="connection"&&o){let n=o.action.type==="ExitConnection"?s(this,$e).markerOptions.departureColor:s(this,$e).markerOptions.destinationColor,i;if(typeof s(this,$e).createMarkers?.connection=="function"){let l=s(this,$e).createMarkers.connection(o);s(this,us).setState(l.id.toString(),{options:{interactive:!0}}),i={id:l.id,type:"marker"}}else i=this.currentMap.Markers.add(o.coordinate,Z4({type:o.action.connection?.type??o.action.connectionType,color:n,direction:o.action.direction}),{interactive:!0,placement:"top",rank:"always-visible"});let a=this.currentMap.Markers.getContentEl(i.id.toString());if(!a)throw new Error("marker component should exist");s(this,ga).set(i.id,{instruction:o,marker:new ds(i.id.toString(),a,o.coordinate)})}else{let n=t==="departure"?s(this,$e).markerOptions.departureColor:s(this,$e).markerOptions.destinationColor,i;typeof s(this,$e).createMarkers?.departure=="function"&&t==="departure"?i={id:s(this,$e).createMarkers.departure(o).id,type:"marker"}:typeof s(this,$e).createMarkers?.destination=="function"&&t==="destination"?i={id:s(this,$e).createMarkers.destination(o).id,type:"marker"}:i=this.currentMap.Markers.add(r,W4({type:t,color:n}),{placement:"top",rank:"always-visible"}),s(this,ga).set(i.id,void 0)}},sT=function(r,t){r.filter(n=>W(this,ot,Y4).call(this,n.action)).forEach(n=>{W(this,ot,Bu).call(this,n.coordinate,t,n)})},Nu=new WeakMap;d();var Te,Nh,ba,Bx,aT,Bh=class{constructor(r){S(this,ba);S(this,Te);S(this,Nh);m(this,"interactions",{set:r=>{r?.pan!=null&&(s(this,Te).getSystems().cameraSystem.enablePan=r.pan),r?.zoom!=null&&(s(this,Te).getSystems().cameraSystem.enableZoom=r.zoom),r?.bearingAndPitch!=null&&(s(this,Te).getSystems().cameraSystem.enableRotate=r.bearingAndPitch)},enable:()=>{s(this,Te).getSystems().cameraSystem.enablePan=!0,s(this,Te).getSystems().cameraSystem.enableZoom=!0,s(this,Te).getSystems().cameraSystem.enableRotate=!0},disable:()=>{s(this,Te).getSystems().cameraSystem.enablePan=!1,s(this,Te).getSystems().cameraSystem.enableZoom=!1,s(this,Te).getSystems().cameraSystem.enableRotate=!1}});m(this,"setMinPitch",r=>{s(this,Te).camera.setMinPitch(r)});m(this,"setMaxPitch",r=>{s(this,Te).camera.setMaxPitch(r)});m(this,"setMinZoomLevel",r=>{s(this,Te).camera.setMinZoomLevel(r,!0)});m(this,"setMaxZoomLevel",r=>{s(this,Te).camera.setMaxZoomLevel(r)});w(this,Nh,r),w(this,Te,r.core)}setScreenOffsets(r){s(this,Te).camera.setInsetPadding(r)}get screenOffsets(){return s(this,Te).camera.insetsPadding}get panMode(){return s(this,Te).camera.panMode}setPanMode(r){if(r!=="default"&&r!=="elevation")throw new Error("Invalid pan mode");r!==this.panMode&&s(this,Te).camera.setPanMode(r)}getFocusOnTransform(r,t){let o=s(this,Te).camera.getCameraFrameForCoordinates(W(this,ba,aT).call(this,r),{pitch:t?.pitch,bearing:t?.bearing,padding:t?.screenOffsets||this.screenOffsets,maxZoomLevel:t?.maxZoomLevel,verticalPadding:t?.axisAlignedPadding?.vertical,minZoomLevel:t?.minZoomLevel,duration:t?.duration,easing:t?.easing});return{center:new fe(o.center[1],o.center[0]),zoomLevel:o.zoomLevel,bearing:t?.bearing??this.bearing,pitch:t?.pitch??this.pitch}}focusOn(r,t){return s(this,Te).camera.focusOn(W(this,ba,aT).call(this,r),{pitch:t?.pitch,bearing:t?.bearing,padding:t?.screenOffsets||this.screenOffsets,maxZoomLevel:t?.maxZoomLevel,minZoomLevel:t?.minZoomLevel,duration:t?.duration,verticalPadding:t?.axisAlignedPadding?.vertical,easing:t?.easing})}animateTo(r,t){let{center:o,zoomLevel:n,bearing:i,pitch:a}=r,l=o??this.center;return s(this,Te).camera.animateTo({center:o!=null?[l.longitude,l.latitude,s(this,Te).camera.elevation]:void 0,zoomLevel:n,bearing:i,pitch:a,duration:t?.duration??600,easing:t?.easing})}set(r){let{center:t=this.center,zoomLevel:o=this.zoomLevel,bearing:n=this.bearing,pitch:i=this.pitch}=r,a=[t.longitude,t.latitude];s(this,Te).camera.setCenter(a),s(this,Te).camera.setZoomLevel(o),s(this,Te).camera.setBearing(n),s(this,Te).camera.setPitch(i)}get center(){let r=s(this,Te).camera.center;return new fe(r[1],r[0],void 0)}setAutoMinZoomLevel(r){s(this,Te).camera.setAutoMinZoomLevel(r)}get autoMinZoomLevel(){return s(this,Te).camera.autoMinZoomLevel}get zoomLevel(){return s(this,Te).camera.zoomLevel}get pitch(){return s(this,Te).camera.pitch}get minPitch(){return s(this,Te).camera.minPitch}get maxPitch(){return s(this,Te).camera.maxPitch}get bearing(){let r=s(this,Te).camera.bearing;return(r<0?r+360:r)%360}get minZoomLevel(){return s(this,Te).camera.minZoomLevel}get maxZoomLevel(){return s(this,Te).camera.maxZoomLevel}setElevation(r){s(this,Te).camera.setElevation(r)}get elevation(){return s(this,Te).camera.elevation}animateElevation(r,t){return s(this,Te).camera.animateElevation(r,t)}updateFacadesInView(){s(this,Te).getSystems().geometryInFocusSystem.raycast()}};Te=new WeakMap,Nh=new WeakMap,ba=new WeakSet,Bx=function(r){let t=s(this,Te).camera.elevation;return fe.is(r)&&r.floorId!=null?s(this,Te).getState(r.floorId)?.altitude??t:Bo.is(r)?s(this,Te).getState(r.id)?.altitude??t:"floor"in r&&Bo.is(r.floor)?s(this,Te).getState(r.floor.id)?.altitude??t:t},aT=function(r){let t=[],n=(Array.isArray(r)?r:[r]).flatMap(i=>i?.focusTarget??[i]);for(let i of n)if(i!=null)if(fe.is(i)){let a=W(this,ba,Bx).call(this,i);t.push([i.longitude,i.latitude,a])}else if(i?.id!=null){let a=W(this,ba,Bx).call(this,i);if(Bo.is(i)&&s(this,Nh).getMapDataInternal()?.enterpriseMode){t.push(i.id);continue}else if("geoJSON"in i&&i.geoJSON.geometry.coordinates.length>0){_C(i.geoJSON,c=>{t.push([c[0],c[1],a])});continue}let l=s(this,Te).getBoundingArea(i.id);if(l)t.push(...l.map(c=>[c[0],c[1],a]));else if("geoJSONBoundingBox"in i){let c=W(this,ba,Bx).call(this,i);if(i.geoJSONBoundingBox!=null){let p=[[i.geoJSONBoundingBox[0],i.geoJSONBoundingBox[1],c],[i.geoJSONBoundingBox[2],i.geoJSONBoundingBox[3],c]];t.push(...p)}}}else _S(i)&&t.push(i);return t};d();var ju,jh=class{constructor({currentMapGetter:r}){S(this,ju);w(this,ju,r)}get currentMap(){return s(this,ju).call(this)}async getCurrentSceneGLTF(r){let t=s(this,ju).call(this);return t?t?.Exporter.getCurrentSceneGLTF(r):(A.error("There is no map to export. Please load a map first."),new Blob)}};ju=new WeakMap;d();var xi,Uh,Gh=class{constructor({currentMapGetter:r}){S(this,xi,new Map);S(this,Uh);w(this,Uh,r)}get currentMap(){return s(this,Uh).call(this)}getAll(){return Array.from(s(this,xi).values()).map(r=>r.label)}getById(r){return s(this,xi).get(r)}add(r,t,o){let n=r.anchorTarget,i=this.currentMap;if(!i)throw new Error("currentMap should exist");let a=i.Labels.add(n,t,{...o,attachTo:iu(r),rank:o?.rank==null||o?.rank==="initial"?"medium":o.rank}),l=new fa(a.id.toString(),t,r);return s(this,xi).set(l.id,{label:l,entityId:l.id}),l}__EXPERIMENTAL__all(r){let t=[];return this.currentMap?.Labels.all({onCreate:(o,n,i)=>{let a=new fa(o.toString(),n,i);s(this,xi).set(a.id,{label:a,entityId:a.id}),t.push(a)},labelOptions:r}),t}remove(r){let t=s(this,xi).get(r.id);t&&(this.currentMap?.Labels.remove(t),s(this,xi).delete(r.id.toString()))}removeAll(){let r=[];return s(this,xi).forEach(({label:t})=>{this.remove(t),r.push(t),s(this,xi).delete(t.id.toString())}),r}};xi=new WeakMap,Uh=new WeakMap;d();d();var Nx={altitude:0,height:1,color:"#ffffff",opacity:1,width:.15},Q4={opacity:.25,color:"#a7d1ec",height:.8,width:.05,altitude:.1,cap:"square",visible:!1},q4={color:"red",opacity:.2,height:Nx.height+.1,visible:!0,borderVisible:!1,borderColor:"red",borderWidth:.1},ek=.5,vi=class{constructor(r,t,o=new Map){m(this,"containerId");m(this,"layers");m(this,"renderer");this.containerId=t,this.layers=o,this.renderer=r}get visible(){return this.renderer.getState(this.containerId).visible}setVisible(r){this.renderer.setState(this.containerId,{visible:r})}},tk=0,Kc,Vh=class{constructor(r,t,o,n,i,a,l,c){m(this,"id");m(this,"name");m(this,"elevation");m(this,"containerId");m(this,"externalId");m(this,"metadata");m(this,"shortName");m(this,"subtitle");m(this,"occluderId");m(this,"loaded",!1);m(this,"styleMap",{});m(this,"obstructions");m(this,"entrances");m(this,"spaces");m(this,"floorImages");m(this,"floorText");m(this,"areas");m(this,"renderer");m(this,"mapObject");m(this,"options");m(this,"layers",new Map);m(this,"footprint");m(this,"floorStackId");m(this,"multiFloorView");m(this,"mapDataInternal");m(this,"facadesByStyleId",new Map);S(this,Kc);m(this,"load",()=>{if(this.loaded||this.obstructions==null&&this.spaces==null)return this;this.loaded=!0;let r=this.renderer.addGroupContainer(`${ts}-${this.id}`,{},this.id);this.layers.set(ts,new vi(this.renderer,r.id.toString()));let t=this.renderer.addGroupContainer(`${ai}-${this.id}`,{},this.id);this.layers.set(ai,new vi(this.renderer,t.id.toString()));let o=this.renderer.addGroupContainer(`${rr}-${this.id}`,{},this.id);this.layers.set(rr,new vi(this.renderer,o.id.toString()));let n=this.renderer.addGroupContainer(`${rs}-${this.id}`,{},this.id);if(this.layers.set(rs,new vi(this.renderer,n.id.toString())),this.footprint?.geometry!=null&&this.footprint?.geometry.coordinates.length!==0){let i=Nx;if(this.obstructions!=null&&this.obstructions.features.length>0){let c=this.obstructions.features.filter(p=>p.geometry.type==="LineString"&&p.properties.kind?.toLowerCase()==="wall"&&p.properties.footprintComponent===!0);c!=null&&c.length>0&&(i=this.styleMap[c[0].properties?.id])}let a=this.renderer.addGeometryGroup(`Footprint-${this.id}`,{features:[{geometry:this.footprint.geometry,properties:{id:`Footprint-Floor-${this.id}`}}]},{...i,height:this.multiFloorView?.floorGap??10,altitude:0,outline:this.options.style?.outlines??!0,visible:!1,opacity:this.elevation<0?1:.4,side:this.elevation<0?"back":"front",color:this.elevation<0?"#F0EEE8":i.color,renderOrder:2},this.id);this.layers.set(Vd,new vi(this.renderer,a.id.toString()));let l=this.renderer.addGroupContainer(`${al}-${this.id}`,{},this.id);this.layers.set(al,new vi(this.renderer,l.id.toString()))}if(this.spaces!=null&&this.spaces.features.length>0){let i=[],a=new Map;this.spaces.features.filter(u=>u.geometry.type==="Polygon"&&u.properties.kind?.toLowerCase()!=="void").forEach(u=>{let f=this.mapDataInternal?.facadesBySpaceId[u.properties.id];if(f){let h=a.get(f.id)||[];a.set(f.id,[...h,u])}else i.push(u)});let l=f1(i,this.styleMap),c=this.renderer.addGroupContainer(`spaces-${this.id}`,{},o),p=0;for(let[u,f]of l){let h=this.renderer.addGeometryGroup(`Spaces-${this.id}-${p}`,{features:f},nu(u,this.options),c);p++;let b=c.id.toString();this.layers.get(rr).layers.set(u.id||b,h.id.toString())}if(a.size>0){let u=this.renderer.addGroupContainer(`${fc}-${this.id}`,{},this.id);this.layers.set(fc,new vi(this.renderer,u.id.toString()));for(let[f,h]of a){let b=this.renderer.addGroupContainer(f,{focusable:!0},u),x=this.renderer.addGroupContainer(`${f}-geometry`,{},b),T=f1(h,this.styleMap),v=0;for(let[I,M]of T){let O=this.renderer.addGeometryGroup(`Facades-${this.id}-${f}-${v}`,{features:M},{...nu(I,this.options),renderOrder:3},x);v++;let C=I.id||O.id.toString();this.layers.get(fc).layers.set(`${f}-${C}`,O.id.toString()),this.facadesByStyleId.has(C)?this.facadesByStyleId.get(C)?.push(f):this.facadesByStyleId.set(C,[f])}}}}if(this.obstructions!=null&&this.obstructions.features.length>0){let i=this.obstructions.features.filter(x=>x.geometry.type==="Polygon"&&(x.properties.kind==="object"||x.properties.kind==="unknown")),a=f1(i,this.styleMap),l=this.renderer.addGroupContainer(`objects-${this.id}`,{},o),c=0;for(let[x,T]of a){let v=this.renderer.addGeometryGroup(`Objects-${this.id}-${c}`,{features:T},nu(x,this.options),l);c++;let I=l.id.toString();this.layers.get(rr).layers.set(x.id||I,v.id.toString())}let p=this.obstructions.features.filter(x=>x.geometry.type==="LineString"&&x.properties.kind?.toLowerCase()==="wall"&&x.properties.footprintComponent===!1),u=this.obstructions.features.filter(x=>x.geometry.type==="LineString"&&x.properties.kind?.toLowerCase()==="wall"&&x.properties.footprintComponent===!0),f=this.entrances,h=Nx,b=Nx;if(p!=null&&p.length>0){let x=this.styleMap[p[0].properties?.id];x!=null&&(h={...x}),b=h;let{walls:T,entrances:v}=o2(p,f?.features||[]),I=Math.max(h.height-.11,ek),M={...Q4,height:I},O=this.renderer.addGeometryGroup(`InteriorDoors-${this.id}`,v,M,o);this.layers.get(rr).layers.set(Gd,O.id.toString());let C=this.renderer.addGeometryGroup(`Walls-${this.id}`,{features:[T]},nu(h,this.options),o);this.layers.get(rr).layers.set(sl,C.id.toString())}if(u!=null&&u.length>0){let x=this.styleMap[u[0].properties?.id];x!=null&&(b={...x,id:es});let{walls:T,entrances:v}=o2(u,f?.features||[]),I=Math.max(b.height-.11,ek),M={...Q4,height:I},O=this.renderer.addGeometryGroup(`ExteriorDoors-${this.id}`,v,M,o);this.layers.get(rr).layers.set(Ud,O.id.toString());let C=this.renderer.addGeometryGroup(`ExteriorWalls-${this.id}`,{features:[T]},nu(b,this.options),o);this.layers.get(rr).layers.set(es,C.id.toString())}}if(this.floorImages!=null){let i=this.renderer.addGroupContainer(`images-${this.id}`,{},this.id);for(let a of this.floorImages.features||[])if(!("anchorId"in a.properties||"anchorId"in a.properties&&a.properties?.anchorId==null)){let l=W5(a,tk);this.mapObject.api.Image3D.add(new fe({latitude:a.geometry.coordinates[1],longitude:a.geometry.coordinates[0],floorId:this.id}),a.properties.path,{id:l,flipImageToFaceCamera:this.options.flipImagesToFaceCamera??!0,...a.properties}),tk++}this.layers.set($d,new vi(this.renderer,i.id.toString()))}if(this.floorText!=null)for(let i of this.floorText.features||[]){let a=0;"geometryId"in i.properties?a=this.renderer.getState(i.properties.geometryId)?.height??0:a=i.properties.verticalOffset??0,this.renderer.addText3D(ut(),{...i,properties:{...i.properties,verticalOffset:a}},{},this.id)}if(this.areas!=null){let i=this.renderer.addGroupContainer(`areas-${this.id}`,{},this.id);this.layers.set(US,new vi(this.renderer,i.id.toString()));let a=this.renderer.addGeometryGroup(`Areas-${this.id}`,{features:this.areas.features},{color:q4.color},i);for(let l of this.areas.features||[])this.renderer.setState(l.properties.id,{...q4,visible:!1});this.layers.get(US).layers.set(a.id.toString(),a.id.toString())}return this.multiFloorView?.enabled&&this.renderer.setState(this.id,{altitude:this.elevation*this.multiFloorView.floorGap}),this.renderer.render(),this});this.mapObject=o,this.renderer=o.renderer,this.id=t.id,this.options=i;let p=this.renderer.addGroupContainer(this.id,{visible:!1,interactive:!0,preloadGeometry:i.preloadFloors?.map(u=>u.id).includes(t.id)},r);this.containerId=p.id.toString(),this.externalId=t.externalId,this.metadata=t.metadata,this.shortName=t.shortName,this.subtitle=t.subtitle,this.name=t.name,this.elevation=t.elevation,a!=null&&l!=null&&(this.styleMap=l,this.spaces=a.space[this.id],this.entrances=a.entrance[this.id],this.areas=a.area?.[this.id],this.obstructions=a.obstruction[this.id],this.floorImages=a.floorImages?.[this.id],this.floorText=a.enterprise?.floorText?.[this.id],this.footprint=a["floor.geojson"]?.features.find(u=>u.properties.id===t.id)),this.floorStackId=r,this.multiFloorView=n,this.mapDataInternal=c}get geoJSONBoundingBox(){if(s(this,Kc))return s(this,Kc);if(!this.footprint){A.warn(`Attempting to get bounding box with no footprint for floor ${this.id}`);return}return w(this,Kc,h1(this.footprint)),s(this,Kc)}addOccluder(){let r=this.layers.get(al);if(r==null||r.containerId==null||this.footprint==null){A.warn(`Tried to add occluder to floor ${this.id} but the floor does not have an occlusion layer.`);return}this.occluderId=this.renderer.addOccluder(this.footprint,r.containerId)}get hasFacadeGeometry(){return this.facadesByStyleId.size>0}get visible(){return this.renderer.getState(this.containerId).visible}setVisible(r){this.renderer.setState(this.containerId,{visible:r})}};Kc=new WeakMap;d();var Gu,$h=class{constructor(r,t,o,n){m(this,"id");m(this,"externalId");m(this,"name");m(this,"type");m(this,"floorIds");m(this,"defaultFloorId");m(this,"floorObjects",[]);m(this,"floorObjectsByElevation",new Map);m(this,"metadata");m(this,"containerId");m(this,"facade");m(this,"renderer");S(this,Gu);this.id=r.id,this.externalId=r.externalId,this.name=r.name,this.type=r.type,this.metadata=r.metadata,this.floorIds=r.floors??r.maps,this.defaultFloorId=r.defaultFloor,this.renderer=o;let i=o.addGroupContainer(this.id,{visible:!0,interactive:!0},t);this.containerId=i.id.toString(),this.facade=n}get defaultFloor(){if(s(this,Gu)==null){if(this.floorObjects.length===0)throw new wr(`No floors in floor stack (${this.id}). Could not get default floor.`);let r;this.defaultFloorId&&(r=this.floorObjects.find(t=>t.id===this.defaultFloorId)),r||(r=this.floorObjects.reduce((t,o)=>Math.abs(o.elevation)<Math.abs(t.elevation)?o:t)),w(this,Gu,r)}return s(this,Gu)}get isOutdoors(){return this.type?.toLowerCase()==="outdoor"?!0:this.facade!=null?!1:this.floorObjects.some(t=>t.hasFacadeGeometry)}addFloor(r){if(this.floorObjectsByElevation.has(r.elevation)){A.error(`Floor with same elevation ${r.elevation} already exists in Stack (${this.id}). Floor (${r.id}) will not be added.`);return}this.floorObjects.push(r),this.floorObjectsByElevation.set(r.elevation,r),this.facade&&this.renderer.setState(r.containerId,{focusable:!0})}loadAllFloors(){for(let r of this.floorObjects)r.load(),!this.isOutdoors&&!r.hasFacadeGeometry&&r.footprint!=null&&r.addOccluder()}};Gu=new WeakMap;d();function cT(e,r,t,o){let n={outdoorOpacity:1,floorStates:[]},i=e.sort((u,f)=>u.elevation-f.elevation),a=Math.min(0,i[0].elevation),l=i[i.length-1].elevation,c,p;for(let u=a;u<=l;u++){let f=i.find(v=>v.elevation===u);if(f==null){u>=0&&(c==null?c=u:p=u);continue}let h=0,b=u<0?Math.abs(f.elevation)*t:t,x=!1;if(c===0&&p!=null){let v=t*p;h=-v,b=v,x=!0}else if(c!=null&&p!=null){let v=c,I=e.find(O=>O.elevation===v-1),M=n.floorStates.find(O=>O.floor===I);if(M){let O=t*(p-c+2);M.state.footprint={...M.state.footprint,altitude:0,height:O,visible:!0}}}c=void 0,p=void 0;let T={floor:f,state:{type:"floor",visible:!1,geometry:{visible:!1},labels:{enabled:!1},markers:{enabled:!1},footprint:{visible:!1},occlusion:{enabled:!1}}};n.floorStates.push(T),f.id===r.id?(T.state.visible=!0,T.state.geometry.visible=!0,T.state.labels.enabled=!0,T.state.markers.enabled=!0,T.state.occlusion.enabled=!0,(f.elevation<0||x)&&(f.elevation<0&&(n.outdoorOpacity=.2),T.state.footprint.height=b,T.state.footprint.altitude=h,T.state.footprint.visible=!0)):o.includes(f.id)&&f.elevation<r.elevation?(T.state.visible=!0,T.state.geometry.visible=!0,T.state.markers.enabled=!0,T.state.occlusion.enabled=!0,T.state.footprint.visible=!0,f.elevation<0?(T.state.footprint.height=b,T.state.footprint.altitude=h,n.outdoorOpacity=.2):(T.state.footprint.height=b,T.state.footprint.altitude=h)):r.elevation>0&&f.elevation<r.elevation&&f.elevation>=0&&(T.state.visible=!0,T.state.footprint.visible=!0,T.state.footprint.height=t,T.state.footprint.altitude=h)}return n}var ms,Hh=class extends ke{constructor(t,o,n,i){super();m(this,"floorStacksById",new Map);m(this,"floorsById",new Map);m(this,"startingFloorId","");m(this,"currentFloorId","");m(this,"currentFloorStackId","");m(this,"outdoorFloorStacks",new Set);m(this,"id");m(this,"renderer");m(this,"api");m(this,"mvf");m(this,"options",{});m(this,"styleMap");m(this,"animations",new Map);m(this,"Models",{add:(t,o,n)=>{let{floorId:i,scale:a,...l}=n,c=i?this.floorsById.get(i):this.currentFloor,p={...l};a!=null&&(p.scale=Array.isArray(n.scale)?n.scale:[n.scale,n.scale,n.scale]);let u=this.renderer.addModelGroup(t,{type:"FeatureCollection",features:o.map(f=>({type:"Feature",properties:{id:ut(),rotation:n.rotation,scale:p.scale,interactive:n.interactive,verticalOffset:f.verticalOffset+(n.verticalOffset??0)},geometry:{type:"Point",coordinates:Dn(f)}}))},p,{parent:c.id});if(u==null)throw new wr("error creating model");return this.renderer.getState(u).children},remove:(t,o)=>{this.renderer.remove(t),this.renderer.getState(o).children.length===0&&this.renderer.remove(o)}});m(this,"Image3D",{add:(t,o,n)=>{let{floorId:i,flipImageToFaceCamera:a,...l}=n,c=i?this.floorsById.get(i):this.currentFloor,p={type:"Feature",properties:l,geometry:{type:"Point",coordinates:t}};return this.renderer.addImage(n.id??ut(),p,{url:o,flipImageToFaceCamera:a??!1},c.id)},remove:t=>{this.renderer.remove(t)},removeAll:()=>{}});m(this,"Markers",{add:(t,o,n)=>{let i=i2(t,this.floorsById,this.api.mapObjects[0].floorsById.get("default-floor")),{attachTo:a,...l}=n,c=l;l.rank==="initial"&&(c.rank="medium");let p=i.layers.get(ai),u=this.renderer.addMarker2D(Dn(t),o,{...c,occluderId:i?.occluderId,attachTo:a},p?.containerId);if(!u)throw new wr("Failed to create Marker");return u},remove:t=>{this.renderer.remove(t)},getContentEl:t=>{let o=this.renderer.getState(t);if(o?.type==="marker")return o.element},removeAll:()=>{},setPosition:(t,o,n)=>{let i=this.renderer.getState(t),a=n?this.floorsById.get(n):this.currentFloor;if(!i){A.error(`Failed to retrieve state for Marker with id "${t}".`);return}if(i.type!=="marker"){A.error(`Geometry with id "${t}" is not of type "marker".`);return}this.renderer.setState(i,{position:o,parent:a?.layers.get(ai)?.containerId})},animateTo:(t,o,n,i)=>{let a=this.renderer.getState(t),l=n?this.floorsById.get(n):this.currentFloor;if(!a)return A.error(`Failed to retrieve state for Marker with id "${t}".`),Promise.resolve();if(a.type!=="marker")return A.error(`Geometry with id "${t}" is not of type "marker".`),Promise.resolve();let c={duration:1e3,easing:"ease-in-out",...i};this.cancelAnimation(t);let p=new di({lon:a.position[0],lat:a.position[1]}).to({lon:o[0],lat:o[1]},c.duration).easing(as[c.easing]).onUpdate(({lon:u,lat:f})=>{if(!this.renderer.getState(t))this.cancelAnimation(t);else{let b=l?.layers.get(ai)?.containerId;b&&this.Markers.setPosition(t,[u,f],b)}}).start();return this.renderer.getInternalTweenGroup().add(p),this.renderer.render(),this.animations.set(t,p),n2(p).then(()=>{this.animations.delete(t)})}});m(this,"Exporter",{getCurrentSceneGLTF:async t=>this.renderer.getCurrentSceneGLTF(t)});m(this,"Shapes",{add:(t,o,n)=>{let i=n?.floorId?this.floorsById.get(n?.floorId):this.currentFloor,a="shape-"+ut();return this.renderer.addGeometryGroup(a,t,o,i.id),a},remove:t=>(this.renderer.remove(t.id),t.id)});m(this,"Text3D",{label:(t,o,n)=>{if(!this.api.getMapDataInternal()?.enterpriseMode){A.warn("Enterprise mode is not enabled, skipping label creation");return}let i=rk(this.renderer,t,o,n);if(i)return{textInfo:i,target:t}},labelAll:(t={})=>{if(!this.api.getMapDataInternal()?.enterpriseMode)return A.warn("Enterprise mode is not enabled, skipping label creation"),[];let o=this.api.getMapData();if(!o)return[];let n=[];return o.getByType("space").forEach(i=>{if(i.locations[0]){let a=rk(this.renderer,i,i.locations[0]?.name??i.name,t);a&&n.push({textInfo:a,target:i})}}),n},remove:t=>{if(!this.api.getMapDataInternal()?.enterpriseMode){A.warn("Remove text label only works in enterprise mode");return}return this.renderer.remove(t),t}});m(this,"Labels",{all:({onCreate:t,labelOptions:o={}})=>{for(let n of Object.entries(this.mvf.space)){let[i,a]=n;a&&a.features.forEach(l=>{let c=this.api.getMapData()?.getById("space",l.properties.id);if(!c)return;let p=this.styleMap[l.properties.id]?.showImage,u=l.properties.details?.images,h={icon:(p&&u?.[0]?.url?{icon:u[0].url}:{}).icon,...o.appearance},x=(i?this.floorsById.get(i):this.currentFloor).layers.get(ts);if(l.properties.center&&c.name!==""){let T=this.renderer.addLabel2D(l.properties.center,c.name,{id:l.properties.id+"-label",...o,appearance:h,rank:o.rank,attachTo:iu(c)},vr.is(c)?c.id:x?.containerId);T&&t(T.id,c.name,c)}})}},add:(t,o,n={})=>{let{attachTo:i,...a}=n,l=i2(t,this.floorsById,this.api.mapObjects[0].floorsById.get("default-floor")),c=l.layers.get(ts),p=this.renderer.addLabel2D(Dn(t),o,{...a,occluderId:l.occluderId,attachTo:i},c?.containerId);if(!p)throw new wr("label creating failed");return p},remove:({entityId:t})=>{this.renderer.remove(t)},removeAll:()=>{}});m(this,"Paths",{add:(t,o)=>{let n=o?.animateDrawing??!0,i=[],a=t[0].floorId||"root",l=0;for(let p of t){let{floorId:u="root",latitude:f,longitude:h}=p;u!==a&&(l++,a=u),i[l]==null&&i.push({floorId:u,coordinates:[]});let b=u===p.floorId?p:new fe({longitude:h,latitude:f,floorId:u});i[l].coordinates.push(b)}let c=i.reduce((p,{floorId:u,coordinates:f},h)=>{if(h!==0){let T=i[h-1],v=T.coordinates[T.coordinates.length-1],I=f[0],M=Dn(v),O=Dn(I),C=this.renderer.addPath({type:"FeatureCollection",features:[{type:"Feature",properties:{parentId:T.floorId},geometry:{type:"Point",coordinates:M}},{type:"Feature",properties:{parentId:u},geometry:{type:"Point",coordinates:O}}]},o,this.id);C&&(n&&this.renderer.setState(C.id,{completeFraction:0}),p.push({...C,coordinates:[v,I]}))}if(f.length<2)return p;let b=this.floorsById.get(u)?.layers.get(rs)?.containerId,x=this.renderer.addPath({type:"FeatureCollection",features:f.map(T=>({type:"Feature",properties:{},geometry:{type:"Point",coordinates:Dn(T)}}))},o,b??u);return x&&(n&&this.renderer.setState(x.id,{completeFraction:0}),p.push({...x,coordinates:f})),p},[]);if(n){let p=[],u=this.api.getMapData();return c.forEach(f=>{let h=z5(f,u,this.api);p.push(new di({fraction:0}).to({fraction:1},h?o?.drawDuration??1500:0).onUpdate(b=>{this.renderer.setState(f.id,{completeFraction:b.fraction})}))}),p.forEach((f,h)=>{h<p.length-1&&f.chain(p[h+1]),this.renderer.getInternalTweenGroup().add(f)}),p[0].start(),this.renderer.render(),this.animations.set(c[0].id.toString(),p[0]),{paths:c,animation:n2(p[p.length-1]).then(()=>{this.animations.delete(c[0].id.toString())})}}else return{paths:c,animation:Promise.resolve()}},remove:t=>{t.forEach(o=>{this.cancelAnimation(o),this.renderer.remove(o)})}});S(this,ms,{enabled:!1,floorGap:10,updateCameraElevationOnFloorChange:!0});this.renderer=i.core,this.api=i,this.id=t,this.renderer.addGroupContainer(t,{},"root"),this.options=n??{},this.mvf=o?.mvf??{};let a=V5(this.mvf["styles.json"]||{});if(this.styleMap=a,w(this,ms,{enabled:!1,floorGap:10,updateCameraElevationOnFloorChange:!0,...n?.multiFloorView}),!o){this.id!=="outdoors-container"&&A.warn(`Map (${this.id}) created with no data.`);let p=new $h({id:"default-stack",externalId:"default-stack",name:"Default Stack",maps:["default-floor"]},this.id,this.renderer);this.floorStacksById.set(p.id,p),this.currentFloorStackId=p.id;let u=new Vh(p.id,{id:"default-floor",externalId:"default-floor",name:"Default Floor",elevation:0},this,s(this,ms),n??{});this.floorsById.set(u.id,u),p.addFloor(u),this.setFloor(u.id);return}let l=o.getMVFFeatureByType("floor-stack");if(l==null||l.length===0)throw new wr("MVF does not contain any Floor Stacks.");for(let p of l){let u=new $h(p,this.id,this.renderer,this.mvf.facade?.[p.id]);if(u.floorIds.length!==0){for(let f of u.floorIds){let h=o.getMVFFeatureById("floor",f);if(h!=null){let b=this.mvf.space[h.id],x=this.mvf.obstruction[h.id];if((b==null||b.features.length===0)&&(x==null||x.features.length===0))continue;let T=new Vh(u.id,h,this,s(this,ms),n??{},this.mvf,a,o);this.floorsById.set(T.id,T),u.addFloor(T)}}this.floorStacksById.set(p.id,u),this.currentFloorStackId||(this.currentFloorStackId=p.id)}}for(let[p]of Object.entries(o.facadesBySpaceId)){let u=o.getById("space",p);u&&(this.outdoorFloorStacks.add(u.floor.floorStack.id),this.floorsById.get(u.floor.id)?.setVisible(!0))}let c=this.mvf.enterprise?.venue.defaultMap;if(n?.initialFloor){let p=yf(n.initialFloor);p&&this.floorsById.has(p)?c=p:A.error(`Invalid initial floor specified (${n.initialFloor}), using default behavior instead`)}c||(c=this.currentFloorStack.defaultFloor.id),this.startingFloorId=c}get currentFloorStack(){let t=this.floorStacksById.get(this.currentFloorStackId);if(!t)throw new wr(`Current floor stack with id "${this.currentFloorStackId}" not found`);return t}setFloorStack(t,o){if(this.currentFloorStackId===t)return;let n=this.floorStacksById.get(t);if(n==null){A.error(`Invalid floor stack passed to setFloorStack (${t}), the floor stack was not changed. Current floor stack is still ${this.currentFloorStack.id}.`);return}if(n.floorObjects.length===0){A.error(`Floor stack (${t}) has no floors. The floor stack was not changed. Current floor stack is still ${this.currentFloorStack.id}.`);return}this.setFloor(n.defaultFloor.id,o)}get currentFloor(){let t=this.floorsById.get(this.currentFloorId);if(!t)throw new wr(`Floor with id "${this.currentFloorId}" not found`);return t}get floors(){return Array.from(this.floorsById.values())}processFloorChange(t){if(this.api.manualFloorVisibility===!0)return;let o=this.api.getMapDataInternal()?.getById("floor",t),n=this.api.getMapDataInternal()?.getById("floor-stack",this.currentFloorStackId);if(o&&n)if(!s(this,ms)?.enabled||o.floorStack.id!==n?.id)for(let i of this.floorStacksById.values())i.floorObjects.forEach(a=>{a.id!==t&&a.setVisible(!1)});else{let i=cT(n.floors,o,s(this,ms).floorGap,this.api.Navigation?.floors?.map(a=>a.id)||[]);this.api?.Outdoor?.setOpacity(i.outdoorOpacity),i.floorStates.forEach(a=>{if(a.floor){let l=this.api.getMapData()?.getById("floor",a.floor.id);l&&this.api.updateState(l,a.state)}}),s(this,ms).updateCameraElevationOnFloorChange&&this.api.Camera.setElevation(o.elevation*s(this,ms).floorGap)}}setFloor(t,o){if(this.currentFloorId===t)return;if(!this.floorsById.get(t)){A.error(`Invalid floor passed to setFloor (${t}), the floor was not changed. Current floor is still ${this.currentFloor.id}`);return}let i=this.currentFloorId;this.publish("floor-change-start",{previousFloorId:i,floorId:t,reason:o}),this.currentFloorStack&&this.processFloorChange(t),this.currentFloorId=t,this.currentFloorStackId=this.currentFloor.floorStackId,this.currentFloor.setVisible(!0),this.updatePathLayersVisibility(),this.publish("floor-change",{reason:o,floorId:this.currentFloor.id,previousFloorId:i})}updatePathLayersVisibility(){let t=this.api.hidePathsNotOnCurrentFloor===!0&&!this.options.multiFloorView?.enabled;for(let o of this.floorsById.values()){let n=o.layers.get(rs);if(!n)continue;let i=!t||o.id===this.currentFloor.id;n.setVisible(i)}}cancelAnimation(t){let o=this.animations.get(t);o&&(o.stop(),this.animations.delete(t),this.renderer.getInternalTweenGroup().remove(o))}loadAllFloors(){for(let t of this.floorStacksById.values())t.loadAllFloors()}};ms=new WeakMap;function rk(e,r,t,o){return e.labelText3D(r.id,t??r.name,{...o,parentId:r.floor.id})}d();var Gn,Wh,zh=class{constructor({currentMapGetter:r}){S(this,Gn,new Map);S(this,Wh);w(this,Wh,r)}get currentMap(){return s(this,Wh).call(this)}getAll(){return Array.from(s(this,Gn).values()).map(({marker:r})=>r)}getById(r){return s(this,Gn).get(r)}add(r,t,o){let n=r.anchorTarget;if(!n)throw new Error("get coordinate failed");let i=this.currentMap;if(!i)throw new Error("currentMap should exist");let a=i.Markers.add(n,t,{...o,rank:o?.rank||"medium",dynamicResize:o?.dynamicResize??!0,attachTo:iu(r)});if(a==null)throw new Error("error creating marker");let l=i.Markers.getContentEl(a.id.toString());if(!l)throw new Error("marker component should exist");let c=new ds(a.id.toString(),l,r);return s(this,Gn).set(c.id,{marker:c,entityId:a.id.toString()}),c}remove(r){let t=s(this,Gn).get(r.id);t&&(this.currentMap?.Markers.remove(t.entityId),s(this,Gn).delete(r.id.toString()))}removeAll(){let r=[];return s(this,Gn).forEach(({marker:t})=>{this.remove(t),r.push(t),s(this,Gn).delete(t.id.toString())}),r}setPosition(r,t){let o=t.anchorTarget;if(!o){A.error("Cannot determine coordinate from target.");return}let n=this.currentMap;if(!n){A.error("Cannot determine the current map.");return}let i=s(this,Gn).get(r.id);if(!i){A.error(`Cannot find the Marker with id "${r.id}".`);return}n.Markers.setPosition(i.entityId,Dn(o),o.floorId??n.currentFloorId),i.marker.updateTarget(t)}animateTo(r,t,o){let n=t.anchorTarget;if(!n)return A.error("Cannot determine coordinate from target."),Promise.resolve();let i=this.currentMap;if(!i)return A.error("Cannot determine the current map."),Promise.resolve();let a=s(this,Gn).get(r.id);return a?(a.marker.updateTarget(t),i.Markers.animateTo(a.entityId,Dn(n),n.floorId??i.currentFloorId,o)):(A.error(`Cannot find the Marker with id "${r.id}".`),Promise.resolve())}};Gn=new WeakMap,Wh=new WeakMap;d();var xa,Xh,Zh=class{constructor({currentMapGetter:r}){S(this,xa,new Map);S(this,Xh);w(this,Xh,r)}get currentMap(){return s(this,Xh).call(this)}getById(r){return s(this,xa).get(r)}add(r,t,o){let n=r.anchorTarget;if(!n)throw new Error("Target does not implement IAnchorable.");let i=this.currentMap;if(!i)throw new Error("currentMap should exist");let a=i.Image3D.add(Dn(n),t,{...o,floorId:n.floorId,verticalOffset:n.verticalOffset+(o.verticalOffset??0)});if(!a)throw new Error("image component should exist");let l=new Wc(a.id.toString(),t,r);return s(this,xa).set(l.id,{image:l,entityId:a.id.toString()}),l}remove(r){let t=s(this,xa).get(r.id);t&&(this.currentMap?.Image3D.remove(t.entityId),s(this,xa).delete(r.id.toString()))}removeAll(){let r=[];return s(this,xa).forEach(({image:t})=>{this.remove(t),r.push(t),s(this,xa).delete(t.id.toString())}),r}};xa=new WeakMap,Xh=new WeakMap;d();var fs,Jh,Yh=class{constructor({currentMapGetter:r}){S(this,fs,new Map);S(this,Jh);w(this,Jh,r)}get currentMap(){return s(this,Jh).call(this)}getById(r){return s(this,fs).get(r)}add(r,t,o){let n=[r],i=n.reduce((c,p)=>p?(c.has(p.floorId)||c.set(p.floorId,[]),c.get(p.floorId)?.push(p),c):(A.error("Cannot determine coordinate from options."),c),new Map);if(!n.length)throw new Error("targets should not be empty when adding a model");let a=this.currentMap;if(!a)throw new Error("currentMap should exist");let l=[];return i.forEach((c,p)=>{let u=ut();a.Models.add(u,c,{...o,url:t,floorId:p}).forEach(h=>{let b=new Xc(h.toString(),u,c[0]);s(this,fs).set(b.id,{model:b,entityId:h.toString(),groupId:u}),l.push(b)})}),l[0]}remove(r){let t=s(this,fs).get(r.id);t&&(this.currentMap?.Models.remove(t.entityId,t.groupId),s(this,fs).delete(r.id.toString()))}removeAll(){let r=[];return s(this,fs).forEach(({model:t})=>{let o=s(this,fs).get(t.id);o&&(r.push(t),this.currentMap?.Models.remove(o.entityId,o.groupId),s(this,fs).delete(t.id.toString()))}),r}};fs=new WeakMap,Jh=new WeakMap;d();var hs,Qh,Kh=class{constructor({currentMapGetter:r}){S(this,hs,new Map);S(this,Qh);w(this,Qh,r)}get currentMap(){return s(this,Qh).call(this)}getById(r){return s(this,hs).get(r)}add(r,t){let o=this.currentMap;if(!o)throw new Error("currentMap should exist");let n=o.Paths.add(r,t),i=n.paths.map(l=>l.id.toString()),a=new Bn(ut(),n.animation,r,n.paths);for(let l of i)s(this,hs).set(l,{path:a,entityIds:i});return s(this,hs).set(a.id,{path:a,entityIds:i}),a}remove(r){let t=s(this,hs).get(r.id);t&&(this.currentMap?.Paths.remove(t.entityIds),s(this,hs).delete(r.id),t.entityIds.forEach(o=>s(this,hs).delete(o)))}removeAll(){let r=[];return s(this,hs).forEach(({path:t})=>{this.remove(t),r.push(t)}),r}};hs=new WeakMap,Qh=new WeakMap;d();d();var Wk=hp(Ak(),1),Zk=hp(UC(),1);d();var ng="blue-dot",Lk="blue-dot-accuracy-ring";var IT="#2266ff",dZ="#808080",_k="#f5f5f5";var Rk={radius:10,color:IT,inactiveColor:dZ,heading:{color:IT,opacity:.7,displayWhenInactive:!1},accuracyRing:{color:IT,opacity:.3},timeout:3e4,watchDevicePosition:!0,debug:!1,accuracyThreshold:50,initialState:"hidden"};d();var Bk="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAkklEQVRoge3awQ3AIAxD0VAMYf+F0yUixbL8JshXuLSwIqJCwDc9QBeZEOy9p2doAQDTM7TQ2cg5Z3qGFjpHS2YjDiGDe+/0DC0cwkYpJKdnaIFMkY1kymzEIVQcwsYhbPDem56hhc5GHELGIWwcwsYhbJS+2R1CxSFsdH5iO4SMr97Y6FxPqxytVVV+HcTEIWx+9mcIqHSOm9QAAAAASUVORK5CYII=";d();var Nk=(e,r,t=0)=>{if(Math.abs(e)>=Math.PI)throw new Error("Sector angle too wide!");let o=t/Math.tan(e/2),n=t/Math.sin(e/2),i=n+r,a=10,l=new Na;l.moveTo(-n*Math.sin(e/2),n*Math.cos(e/2)-o);for(let c=0;c<a;c++)l.lineTo(-(i*Math.sin(e/2-e/a*c)),i*Math.cos(e/2-e/a*c)-o);for(let c=0;c<a;c++)l.lineTo(-(t*Math.sin(Math.PI/-2+Math.PI/a*c)),t*Math.cos(Math.PI/-2+Math.PI/a*c));return new ja(l,{depth:.1,bevelEnabled:!1,UVGenerator:mZ(r)})},ST=(e,r,t)=>{let n=Math.sqrt(Math.pow(e,2)+Math.pow(r,2))/t;return n>1?n=1:n<0&&(n=0),new Me(0,n)},mZ=e=>({generateTopUV:(r,t,o,n,i)=>{let a=t[o*3],l=t[o*3+1],c=t[n*3],p=t[n*3+1],u=t[i*3],f=t[i*3+1];return[ST(a,l,e),ST(c,p,e),ST(u,f,e)]},generateSideWallUV:()=>[new Me(0,1),new Me(0,1),new Me(0,1),new Me(0,1)]});function jk(e,r){if(r==null)return e;let t={latitude:e?.latitude,longitude:e?.longitude,accuracy:e?.accuracy,floor:e?.floor,heading:e?.heading,timestamp:e?.timestamp};return"latitude"in r&&(t.latitude=r?.latitude==null||r.latitude==="device"?e?.latitude:r.latitude),"longitude"in r&&(t.longitude=r.longitude==null||r.longitude==="device"?e?.longitude:r.longitude),"accuracy"in r&&(t.accuracy=r.accuracy==="device"?e?.accuracy:r.accuracy),"floor"in r&&(t.floor=r.floor==="device"?e?.floor:r.floor),"heading"in r&&(t.heading=r.heading==="device"?e?.heading:r.heading),"timestamp"in r&&(t.timestamp=r.timestamp),t}function fZ([e,r],[t,o],[n,i]){let a=t-e,l=o-r,c=a**2+l**2;if(c===0)return;let p=((n-e)*a+(i-r)*l)/c,u;p<=0?u=[e,r]:p>=1?u=[t,o]:u=[e+p*a,r+p*l];let f=ry([n,i],u);return{proportion:Math.max(0,Math.min(1,p)),intersection:u,distance:f}}function Gk(e,r){if(e==null||e.length<2)return;let t=Number.MAX_SAFE_INTEGER,o,n=0,i=0;for(let a=0;a<e.length-1;a++){let l=e[a],c=e[a+1],p=fZ(l,c,r);p!=null&&p.distance<t&&(t=p.distance,o=p.intersection,n=a,i=p.proportion)}if(o)return{intersection:o,distance:t,segmentIndex:n,proportion:i}}function Uk(e,r){let t=new Oi({color:e,opacity:r,transparent:!0,depthTest:!1,depthWrite:!1}),o=.35,n=.35*4,i=Nk(Math.PI/6,n,o);new bp().load(Bk,l=>{t.alphaMap=l,t.needsUpdate=!0});let a=new Le(i,t);return a.position.z=-.05,a.renderOrder=0,a}function Vk(e,r){let t=new Qg(1,1,.05,32),o=new Oi({transparent:!0,color:e,opacity:r,depthTest:!1,depthWrite:!1}),n=new Le(t,o);return n.scale.set(0,0,.05),n.renderOrder=1,n.rotation.x=Math.PI/2,n}function $k(e){let r=new Qg(.35,.35,.07,32),t=new Oi({transparent:!0,color:_k,depthTest:!1,depthWrite:!1}),o=new Le(r,t);o.renderOrder=2;let n=new Qg(.35*.8,.35*.8,.01,32),i=new Oi({transparent:!0,color:e,depthTest:!1,depthWrite:!1}),a=new Le(n,i);return a.renderOrder=3,o.rotation.x=Math.PI/2,o.position.z=.07/2,a.rotation.x=Math.PI/2,a.position.z=.07,{outerMesh:o,innerMesh:a}}var Xk=hp(Hk(),1);var Re,Rr,ep,gs,cn,Cr,Ta,tp,rp,op,st,Ho,ig,Ca,Et,sg,ag,zu,Yx,Jx,Kx,lg,Qx,cg,qx,pg,e0,Ii,Ma,Wu,t0,kl,Zu,ys,dg,r0,o0,Xu=class extends ke{constructor(t,o){super();S(this,Re);S(this,Rr);S(this,ep,null);m(this,"primaryGeometry");m(this,"secondaryGeometry");S(this,gs);S(this,cn);S(this,Cr);S(this,Ta);S(this,tp);S(this,rp);S(this,op);S(this,st,Rk);S(this,Ho,1);S(this,ig);S(this,Ca);S(this,Et,new Xx);m(this,"bounds");m(this,"state","disabled");m(this,"following",!1);S(this,sg,t=>s(this,Rr).getMapData()?.getById("floor",t));S(this,ag,t=>{let o;if(t!=null){let n=s(this,Rr).currentMap?.currentFloorStack.floorObjectsByElevation.get(t);o=n?s(this,sg).call(this,n.id):void 0}return o});S(this,zu,()=>this.state!=="hidden"&&this.state!=="disabled");S(this,Yx,(t,o)=>{s(this,e0).call(this),t.scale.set(s(this,Ho),s(this,Ho),s(this,Ho)),t.position.z=.07/2*s(this,Ho),o.scale.set(s(this,Ho),s(this,Ho),s(this,Ho)),o.position.z=.07*s(this,Ho),this.state==="active"?o.material.color.set(s(this,st).color):this.state==="inactive"&&o.material.color.set(s(this,st).inactiveColor)});S(this,Jx,t=>{let o=this.heading;if(o!=null){t.visible=!0,s(this,op)&&s(this,op).stop();let{start:n,end:i}=oy(t.rotation.z,-Ue.degToRad(o));w(this,op,new di({rotation:n}).to({rotation:i},150).onUpdate(({rotation:l})=>{t.rotation.z=l}).start()),s(this,Re).getInternalTweenGroup().add(s(this,op)),t.scale.set(s(this,Ho),s(this,Ho),1);let a=this.state==="inactive"?s(this,st).inactiveColor:s(this,st).heading.color;t.material.color.set(a)}else t.visible=!1});S(this,Kx,(t,o)=>{if(this.state==="active"){let i=this.accuracy;i!=null?(t.visible=!0,s(this,rp)&&s(this,rp).stop(),w(this,rp,new di({scale:t.scale.x}).to({scale:i/2},150).onUpdate(({scale:a})=>{t.scale.set(a,1,a)}).start()),s(this,Re).getInternalTweenGroup().add(s(this,rp))):t.visible=!1}else t.visible=!1;this.state==="active"||this.state==="inactive"&&s(this,st).heading.displayWhenInactive?s(this,Jx).call(this,o):o.visible=!1});S(this,lg,t=>{if(!s(this,zu).call(this))return;let[o,n]=t.children;!o||!n||s(this,Yx).call(this,o,n)});S(this,Qx,t=>{if(!s(this,zu).call(this))return;let[,,o,n]=t.children;!o||!n||s(this,Kx).call(this,o,n)});S(this,cg,(t,o)=>{let n;try{n=xZ.parse(jk(t,s(this,cn)))}catch(l){s(this,Ii).call(this,"error"),A.error("BlueDot: Position parse failed",l instanceof F.ZodError?l.message:String(l));return}s(this,st).debug&&A.log("BlueDot: Parsed position",n);let{min:i,max:a}=this.bounds||{};if(i!=null&&a!=null&&isFinite(i.x)&&isFinite(i.y)&&isFinite(a.x)&&isFinite(a.y)){let l=s(this,Re).convertTo3DMapPosition(n.latitude,n.longitude,0);if(!(l.x>=i.x&&l.x<=a.x&&l.y>=i.y&&l.y<=a.y)){A.warn(`BlueDot: Position [${n.longitude}, ${n.latitude}] is outside map bounds. Position update will be discarded.`);return}}if(s(this,r0).call(this,n.accuracy)){if(o?.silent||s(this,Ii).call(this,"position-update"),!s(this,zu).call(this)){A.warn(`BlueDot: Cannot update position because BlueDot state is '${this.state}'. BlueDot must be enabled first.`);return}s(this,qx).call(this,n,o)}});S(this,qx,(t,o)=>{w(this,Cr,t),o?.silent||(s(this,pg).call(this),s(this,Rr).getMapDataInternal()?.Analytics.updateState({userPosition:{bluedotTimestamp:Date.now(),latitude:t.latitude,longitude:t.longitude,floorLevel:t.floor?.elevation,accuracy:t.accuracy}}));let n,i=0;if(!this.primaryGeometry)n=[t.longitude,t.latitude,0],i=t.floor?.id?s(this,Re).getState(t.floor?.id).altitude:0,s(this,Et).matrixAutoUpdate=!1,s(this,Et).userData.floorId=t.floor?.id,this.primaryGeometry=s(this,Re).addCustomGeometry(ng,{type:"Feature",properties:{},geometry:{type:"Point",coordinates:n}},{setup:c=>{let p=this.state==="inactive"?s(this,st).inactiveColor:s(this,st).color,{outerMesh:u,innerMesh:f}=$k(p);s(this,Et).add(u),s(this,Et).add(f),c.add(s(this,Et));let h=s(this,Et).userData.floorId?s(this,Re).getState(s(this,Et).userData.floorId):void 0;h?.altitude!=null?s(this,Et).matrix.elements[14]=h?.altitude:s(this,Et).matrix.identity(),s(this,lg).call(this,s(this,Et))},update:()=>{let c=s(this,Et).userData.floorId?s(this,Re).getState(s(this,Et).userData.floorId):void 0;c?.altitude!=null?s(this,Et).matrix.elements[14]=c?.altitude:s(this,Et).matrix.identity(),s(this,lg).call(this,s(this,Et))}},{visible:!0,interactive:!0}),this.secondaryGeometry=s(this,Re).addCustomGeometry(Lk,{type:"Feature",properties:{},geometry:{type:"Point",coordinates:n}},{setup:()=>{let c=Vk(s(this,st).accuracyRing.color,s(this,st).accuracyRing.opacity),p=Uk(s(this,st).heading.color,s(this,st).heading.opacity);s(this,Et).add(c),s(this,Et).add(p),p.visible=!1,c.visible=!1},update:()=>{s(this,Qx).call(this,s(this,Et))}},{visible:!0,interactive:!1});else{let c=s(this,Re).getState(this.primaryGeometry);if(n=[c.position[0],c.position[1],0],s(this,Et).userData.floorId){let p=s(this,Re).getState(s(this,Et).userData.floorId);i=(c.position[2]??0)+(p?.altitude??0)}}if(s(this,tp)&&s(this,tp).stop(),s(this,Et).userData.floorId!==t.floor?.id){let c=t.floor?.id?s(this,Re).getState(t.floor?.id).altitude:0,p=i;s(this,Et).userData.floorId=t.floor?.id,n[2]=p-c}let a=[t.longitude,t.latitude,0],l=c=>{let p={position:c};this.primaryGeometry&&this.secondaryGeometry&&s(this,Re).setState(this.primaryGeometry,p),this.secondaryGeometry&&s(this,Re).setState(this.secondaryGeometry,p)};o?.animate===!1?l(a):(w(this,tp,new di(n).to(a,1e3).easing(Vo.Cubic.Out).onUpdate(l).start()),s(this,Re).getInternalTweenGroup().add(s(this,tp))),o?.silent||this.publish("blue-dot-position-update",{floor:this.floor,heading:this.heading,accuracy:this.accuracy,coordinate:this.coordinate}),s(this,Re).render()});m(this,"onPositionUpdate",t=>{if(this.state==="disabled")return;try{bZ.parse(t)}catch(n){s(this,Ii).call(this,"error"),A.error("BlueDot: Browser sent invalid position",n instanceof F.ZodError?n.message:String(n));return}w(this,gs,{latitude:t.coords?.latitude,longitude:t.coords?.longitude,accuracy:t.coords?.accuracy,heading:t.coords?.heading,floor:s(this,ag).call(this,t.coords?.floorLevel),timestamp:t.timestamp});let o=s(this,gs);if(s(this,Wu)){let n=s(this,o0).call(this,s(this,gs));if(n===void 0){s(this,st).debug&&A.log("BlueDot: Position update discarded by position processor");return}o=n}s(this,cg).call(this,o)});m(this,"onPositionError",t=>{switch(s(this,Ii).call(this,"error"),t.code){case t.PERMISSION_DENIED:A.error("Geolocation permission denied by the user.",t),s(this,Rr).getMapDataInternal()?.Analytics.sendWatchPositionDenied();break;case t.POSITION_UNAVAILABLE:A.error("Geolocation position unavailable.",t);break;case t.TIMEOUT:A.error("Geolocation request timed out.",t);break;default:A.error("An unknown geolocation error occurred.",t);break}this.publish("blue-dot-position-error",t)});S(this,pg,()=>{s(this,Ta)&&clearTimeout(s(this,Ta)),typeof s(this,st).timeout=="number"&&s(this,st).timeout<1/0&&w(this,Ta,setTimeout(()=>{s(this,st).debug&&A.log(`BlueDot: Position timed out after ${s(this,st).timeout}ms`),s(this,Ii).call(this,"timeout"),s(this,Re).render()},s(this,st).timeout))});S(this,e0,()=>{let t=Math.round(s(this,Re).camera.zoomLevel*1e5);if(t!==s(this,ig)){w(this,ig,t);let o=s(this,Re).getMetresPerPixel()??1;w(this,Ho,Math.max(s(this,st).radius/(.35/o),1))}});S(this,Ii,t=>{let o=yZ[this.state].actions[t];if(o){switch(s(this,st).debug&&A.log(`BlueDot: Transitioning from ${this.state} to ${o} using ${t}`),o){case"hidden":case"disabled":this.primaryGeometry&&s(this,Re).setState(this.primaryGeometry,{visible:!1}),this.secondaryGeometry&&s(this,Re).setState(this.secondaryGeometry,{visible:!1});break;case"active":case"inactive":this.primaryGeometry&&s(this,Re).setState(this.primaryGeometry,{visible:!0}),this.secondaryGeometry&&s(this,Re).setState(this.secondaryGeometry,{visible:!0});break}this.state!==o&&(this.state=o,this.publish("blue-dot-state-change",{state:o,action:t}))}else A.warn(`BlueDot: Invalid state transition from ${this.state} to ${o} using ${t}`)});S(this,Ma);S(this,Wu);S(this,t0,()=>{if(s(this,Ma)==null&&s(this,Rr).Navigation.activeDirections!=null){let o=(Array.isArray(s(this,Rr).Navigation.activeDirections)?s(this,Rr).Navigation.activeDirections.flatMap(n=>n.coordinates):s(this,Rr).Navigation.activeDirections.coordinates).filter(n=>n.floorId===s(this,Rr).currentFloor.id);w(this,Ma,(0,Xk.default)(o.map(n=>({x:n.longitude,y:n.latitude})),1e-5).map(n=>[n.x,n.y]))}return s(this,Ma)});S(this,kl,()=>{s(this,Re).camera.isAnimating&&s(this,Re).camera.cancelAnimation(),s(this,ys)&&(this.off("blue-dot-position-update",s(this,ys)),w(this,ys,void 0)),this.following=!1,w(this,Ma,void 0),s(this,Re).off("user-interaction-start",s(this,kl)),s(this,Rr).off("navigation-active-path-change",s(this,Zu)),this.publish("blue-dot-follow-change",{following:!1})});S(this,Zu,()=>{w(this,Ma,void 0)});S(this,ys);m(this,"follow",(t,o)=>{if(t===!1){s(this,kl).call(this);return}t!=="position-only"&&o?.bearing!=null&&A.warn(`BlueDot: Camera bearing option will be ignored in follow mode '${t}'. To control the bearing manually, use mode 'position-only'.`);let n={zoomLevel:o?.zoomLevel??21,bearing:t==="position-only"?o?.bearing:void 0,pitch:o?.pitch??45,duration:o?.duration??1e3,easing:o?.easing??"ease-in-out"};this.following?s(this,ys)&&this.off("blue-dot-position-update",s(this,ys)):(this.following=!0,s(this,Re).on("user-interaction-start",s(this,kl)),s(this,Rr).on("navigation-active-path-change",s(this,Zu))),w(this,ys,i=>{let{coordinate:a,heading:l,floor:c}=i;if(n.center=[a.longitude,a.latitude],c!=null&&c.id!==s(this,Rr).currentFloor.id&&(s(this,Rr).currentMap.setFloor(c.id),w(this,Ma,void 0)),t==="position-and-heading")n.bearing=l??void 0;else if(t==="position-and-path-direction"){let p=s(this,t0).call(this);if(p!=null){let u=Gk(p,[a.longitude,a.latitude]);if(u!=null){let f=p[u.segmentIndex],h=p[u.segmentIndex+1];n.bearing=MC(f,h)}}}s(this,Re).camera.animateTo(n)}),this.on("blue-dot-position-update",s(this,ys)),this.publish("blue-dot-follow-change",{following:!0,mode:t})});S(this,dg,t=>{this.bounds=t});S(this,r0,t=>{if(t==null)return this.state!=="disabled";let o=t<=s(this,st).accuracyThreshold;return s(this,st).debug&&!o&&A.log(`BlueDot: Dropping position update with accuracy ${t}m (exceeds threshold ${s(this,st).accuracyThreshold}m)`),o});S(this,o0,t=>{let o={latitude:s(this,Cr)?.latitude,longitude:s(this,Cr)?.longitude,accuracy:s(this,Cr)?.accuracy,heading:s(this,Cr)?.heading,floor:s(this,Cr)?.floor,timestamp:s(this,Cr)?.timestamp};try{return s(this,Wu).call(this,o,t)}catch(n){return A.error("BlueDot: Position processor callback threw an error",n instanceof Error?n.message:String(n)),t}});w(this,Re,t),w(this,Rr,o)}get heading(){return s(this,Cr)?.heading}get accuracy(){return s(this,Cr)?.accuracy}get coordinate(){if(s(this,Cr)!=null)return(s(this,Ca)==null||this.floor?.id!==s(this,Ca).floorId||s(this,Cr).latitude!==s(this,Ca).latitude||s(this,Cr).longitude!==s(this,Ca).longitude)&&w(this,Ca,new fe(s(this,Cr).latitude,s(this,Cr).longitude,this.floor?.id)),s(this,Ca)}get floor(){return s(this,Cr)?.floor}enable(t){w(this,st,(0,Wk.default)({},t,s(this,st))),s(this,Ii).call(this,"enable"),s(this,st).initialState==="inactive"&&s(this,Ii).call(this,"initialize"),this.watchDevicePosition(s(this,st).watchDevicePosition),this.bounds||(this.bounds=s(this,Re).getSystems().cameraSystem.panBounds,s(this,Re).on("pan-bounds-change",s(this,dg)))}updateState(t){let o=s(this,st).watchDevicePosition;w(this,st,(0,Zk.default)({},s(this,st),t)),t.watchDevicePosition!=null&&t.watchDevicePosition!==o&&this.watchDevicePosition(t.watchDevicePosition),t.timeout!=null&&this.state==="active"&&s(this,pg).call(this),s(this,Re).render()}disable(){s(this,Re).remove(s(this,Et).id),w(this,Et,new Xx),this.primaryGeometry&&(s(this,Re).remove(this.primaryGeometry.id),this.primaryGeometry=void 0),this.secondaryGeometry&&(s(this,Re).remove(this.secondaryGeometry.id),this.secondaryGeometry=void 0),s(this,Ta)&&(clearTimeout(s(this,Ta)),w(this,Ta,void 0)),this.following&&s(this,kl).call(this),this.watchDevicePosition(!1),w(this,Cr,void 0),w(this,cn,void 0),s(this,Ii).call(this,"disable"),s(this,Re).off("user-interaction-start",s(this,kl)),s(this,Rr).off("navigation-active-path-change",s(this,Zu)),s(this,Re).off("pan-bounds-change",s(this,dg))}watchDevicePosition(t){if(s(this,ep)&&(navigator.geolocation.clearWatch(s(this,ep)),w(this,ep,null)),s(this,gs)&&w(this,gs,void 0),t){if(this.state==="disabled"){A.warn("BlueDot must be enabled before watching browser position.");return}w(this,ep,navigator.geolocation.watchPosition(this.onPositionUpdate,this.onPositionError,{enableHighAccuracy:!0}))}}update(t,o){t==null?w(this,cn,void 0):"coords"in t?w(this,cn,Object.assign({},s(this,cn),{latitude:t.coords.latitude,longitude:t.coords.longitude,accuracy:t.coords.accuracy,heading:t.coords.heading,floor:s(this,ag).call(this,t.coords.floorLevel),timestamp:t.timestamp})):(w(this,cn,Object.assign({},s(this,cn),t)),"floorOrFloorId"in t&&(s(this,cn).floor=typeof t.floorOrFloorId=="string"&&t.floorOrFloorId!=="device"?s(this,sg).call(this,t.floorOrFloorId):t.floorOrFloorId)),(s(this,cn)?.latitude!=null&&s(this,cn)?.longitude!=null||s(this,gs)!=null)&&s(this,cg).call(this,s(this,gs),o)}setPositionProcessor(t){w(this,Wu,t)}};Re=new WeakMap,Rr=new WeakMap,ep=new WeakMap,gs=new WeakMap,cn=new WeakMap,Cr=new WeakMap,Ta=new WeakMap,tp=new WeakMap,rp=new WeakMap,op=new WeakMap,st=new WeakMap,Ho=new WeakMap,ig=new WeakMap,Ca=new WeakMap,Et=new WeakMap,sg=new WeakMap,ag=new WeakMap,zu=new WeakMap,Yx=new WeakMap,Jx=new WeakMap,Kx=new WeakMap,lg=new WeakMap,Qx=new WeakMap,cg=new WeakMap,qx=new WeakMap,pg=new WeakMap,e0=new WeakMap,Ii=new WeakMap,Ma=new WeakMap,Wu=new WeakMap,t0=new WeakMap,kl=new WeakMap,Zu=new WeakMap,ys=new WeakMap,dg=new WeakMap,r0=new WeakMap,o0=new WeakMap;var yZ={hidden:{actions:{enable:"hidden",error:"hidden","position-update":"active",initialize:"inactive",disable:"disabled",timeout:"hidden"}},active:{actions:{enable:"active",disable:"disabled","position-update":"active",error:"inactive",timeout:"inactive"}},inactive:{actions:{enable:"inactive",disable:"disabled","position-update":"active",error:"inactive",timeout:"inactive"}},disabled:{actions:{enable:"hidden",disable:"disabled"}}},bZ=F.object({coords:F.object({latitude:F.number(),longitude:F.number(),accuracy:F.number(),altitude:F.number().optional().nullable(),altitudeAccuracy:F.number().optional().nullable(),heading:F.number().optional().nullable(),speed:F.number().optional().nullable(),floorLevel:F.number().optional().nullable()}),timestamp:F.number()}),xZ=F.object({latitude:F.number(),longitude:F.number(),floor:F.custom().optional(),accuracy:F.number().optional(),heading:F.number().optional().nullable(),timestamp:F.number().optional()}),Xx=class extends ws{constructor(){super(...arguments);m(this,"children",[]);m(this,"userData",{})}};d();var wa,mg,ug=class{constructor({currentMapGetter:r}){S(this,wa,new Map);S(this,mg);w(this,mg,r)}get currentMap(){return s(this,mg).call(this)}getById(r){return s(this,wa).get(r)}add(r,t,o){let n=this.currentMap;if(!n)throw new Error("currentMap should exist");let i=n.Shapes.add(r,t||{},{floorId:o?.id}),a=new ha(i);return s(this,wa).set(a.id,a),a}remove(r){s(this,wa).get(r.id)&&(this.currentMap?.Shapes.remove(r),s(this,wa).delete(r.id.toString()))}removeAll(){let r=[];return s(this,wa).forEach(t=>{this.remove(t),r.push(t.id),s(this,wa).delete(t.id.toString())}),r}};wa=new WeakMap,mg=new WeakMap;d();var hg,fg=class{constructor({currentMapGetter:r}){S(this,hg);w(this,hg,r)}get currentMap(){return s(this,hg).call(this)}setFromStyleCollection(r){for(let t in r)for(let o of this.currentMap?.floors||[]){if(r[t]==null||!o.layers.has(rr))continue;let n=o.layers.get(rr);if(n?.layers.has(t)&&"color"in r[t]){let l=n.layers.get(t);l&&this.currentMap?.renderer.setState(l,{color:r[t].color})}if(n&&t===sl&&!(es in r)){let l=n.layers.get(es);l&&"color"in r[t]&&this.currentMap?.renderer.setState(l,{color:r[t].color})}if(!o.layers.has(fc))continue;let i=o.layers.get(fc),a=o.facadesByStyleId.get(t);if(a&&a.length>0)for(let l of a){let c=i.layers.get(`${l}-${t}`);c&&"color"in r[t]&&this.currentMap?.renderer.setState(c,{color:r[t].color})}}}};hg=new WeakMap;d();var TT={opacity:1},co,gg,yg,Al,Oa,np,CT,Yk,Yu=class{constructor(r,t){S(this,np);S(this,co);S(this,gg,[]);S(this,yg,{opacity:"initial"});S(this,Al,{opacity:new Map});S(this,Oa,new Set);w(this,co,r),w(this,gg,t||[]);let o=s(this,co).map;o&&o.on("idle",()=>{s(this,Al).opacity.size||W(this,np,CT).call(this,o)})}setStyle(r){if(s(this,co).map){s(this,co).map?.setStyle(r),s(this,Oa).size&&(s(this,Oa).clear(),this.hide()),W(this,np,Yk).call(this),W(this,np,CT).call(this,s(this,co).map),this.setOpacity(s(this,yg).opacity),s(this,co).map?.moveLayer(F0);for(let[t,o,n]of s(this,gg)||[])s(this,co).hideOutdoorLayersIntersectingPolygons(t,o,n)}}get map(){return s(this,co).map}get enabled(){return!!s(this,co).map}get visible(){return s(this,Oa).size===0}show(){let r=s(this,co).map;if(!r)return;let t=r.getStyle().layers;t&&(t.forEach(o=>{s(this,Oa).has(o.id)&&r.setLayoutProperty(o.id,"visibility","visible")}),s(this,Oa).clear())}hide(r=[]){let t=s(this,co).map;if(!t)return;let o=t.getStyle().layers;o&&o.forEach(n=>{let i=t.getLayoutProperty(n.id,"visibility");!r.includes(n.id)&&i!=="none"&&(t.setLayoutProperty(n.id,"visibility","none"),s(this,Oa).add(n.id))})}setOpacity(r,t=[]){let o=s(this,co).map;if(!o)return;let n=s(this,co).map?.getStyle?.()?.layers;n&&o.once("idle",()=>{n.forEach(i=>{let a=o.getLayoutProperty(i.id,"visibility");if(!t.includes(i.id)&&a!=="none")try{let l=s(this,Al).opacity.get(i.id);l!==void 0&&(i.id==="background"||(i.type==="symbol"?(o.setPaintProperty(i.id,"icon-opacity",r==="initial"?l[0]:r),o.setPaintProperty(i.id,"text-opacity",r==="initial"?l[1]:r)):o.setPaintProperty(i.id,`${i.type}-opacity`,r==="initial"?l[0]:r)),s(this,yg).opacity=r)}catch(l){A.warn("Error setting opacity:",l)}})})}};co=new WeakMap,gg=new WeakMap,yg=new WeakMap,Al=new WeakMap,Oa=new WeakMap,np=new WeakSet,CT=function(r){let t=r.getStyle().layers;t&&t.forEach(o=>{r.getLayoutProperty(o.id,"visibility")!=="none"&&(o.id==="background"||(o.type==="symbol"?s(this,Al).opacity.set(o.id,[r.getPaintProperty(o.id,"icon-opacity")??TT.opacity,r.getPaintProperty(o.id,"text-opacity")??TT.opacity]):s(this,Al).opacity.set(o.id,[r.getPaintProperty(o.id,`${o.type}-opacity`)??TT.opacity,void 0])))})},Yk=function(){Object.values(s(this,Al)).forEach(r=>r.clear())};d();function vZ(){R0(!1)}var Ea,Pa,Ll,bg=class{constructor({currentMapGetter:r}){S(this,Ea);S(this,Pa,new Map);S(this,Ll,new Map);w(this,Ea,r)}labelAll(r={}){let t=[],o=new Set;return s(this,Ea).call(this)?.Text3D.labelAll(r)?.forEach(({textInfo:n,target:i})=>{let a=n.id.toString(),l=s(this,Ll).get(a);if(l){o.has(a)||t.push(l.text3DView),o.add(a);return}o.add(a);let c=new El(a,i);s(this,Pa).set(c.id,{targetId:i.id,text3d:a,text3DView:c}),s(this,Ll).set(a,{text3DView:c}),t.push(c)}),t}label(r,t,o={}){if(s(this,Ea).call(this))if(vr.is(r)){let i=s(this,Ea).call(this)?.Text3D.label(r,t,o);if(!i)return;let a=i.textInfo.id.toString(),l=s(this,Ll).get(a);if(l)return l.text3DView;let c=new El(a,i.target);return s(this,Pa).set(c.id,{targetId:i.target.id,text3d:a,text3DView:c}),s(this,Ll).set(a,{text3DView:c}),c}else throw new Error("Non-space target is not supported")}remove(r){let t=typeof r=="string"?r:r.id,o=s(this,Pa).get(t);o&&(s(this,Ea).call(this)?.Text3D.remove(o.text3d),s(this,Pa).delete(t),s(this,Ll).delete(o.text3d))}removeAll(){s(this,Pa).forEach(r=>{s(this,Ea).call(this)?.Text3D.remove(r.text3d)}),s(this,Pa).clear()}};Ea=new WeakMap,Pa=new WeakMap,Ll=new WeakMap;d();d();d();function Jk(e){try{let r=e.shape;if("type"in r){let t=r.type;if(t instanceof F.ZodOptional&&(t=t._def.innerType),"value"in t)return String(t.value);if(t instanceof F.ZodDefault&&"value"in t._def.innerType)return String(t._def.innerType.value)}return"unknown"}catch{return"unknown"}}function Kk(e){if(e.success)return[];let r=e.error.flatten();return Object.keys(r.fieldErrors)}function Qk(e,r){e.length>0&&A.warn(`${e.length} invalid field(s) in ${r??"unknown"} state: ${e.join(", ")}`)}function Nt(e,r,t){if(r==null||typeof r!="object")return{};let o=e.partial().safeParse(r);if(o.success)return o.data;let n=Kk(o);t?.warn&&Qk(n,Jk(e));let i={};for(let a of Object.keys(r))!n.includes(a)&&a in e.shape&&(i[a]=r[a]);return i}function Br(e,r,t){let o=e.safeParse(r);if(o.success)return o.data;if(t?.warn===!0){let n=Kk(o);Qk(n,Jk(e))}return r}var qk="doors",ip=J.object({type:J.literal(qk).default(qk),color:J.string().default("#ffffff"),topColor:J.string().optional(),texture:J.object({url:J.string().optional()}).optional(),topTexture:J.object({url:J.string().optional()}).optional(),visible:J.boolean().default(!1),opacity:J.number().default(1)}),P_e=ip.partial(),F_e=ip.strict();function eA(e){let{color:r,topColor:t,texture:o,topTexture:n,visible:i,opacity:a}=e;return Br(ip,{visible:i,color:r,topColor:t,opacity:a,texture:o?{url:o}:void 0,topTexture:n?{url:n}:void 0})}function n0(e,r){let t={};return r==null||(e.color&&(e.color==="initial"?t.color=r.initialColor:t.color=e.color),e.topColor&&(e.topColor==="initial"?t.topColor=r.initialTopColor:t.topColor=e.topColor),e.visible!==void 0&&(t.visible=e.visible),e.texture?.url!==void 0&&(t.texture=e.texture.url),e.topTexture?.url!==void 0&&(t.topTexture=e.topTexture.url),e.opacity!==void 0&&(t.opacity=e.opacity)),t}d();var tA="facade",xg=F.object({type:F.literal(tA).default(tA),opacity:F.number().default(1),visible:F.boolean().default(!0)}),__e=xg.partial(),R_e=xg.strict();function rA(e){return Br(xg,{opacity:e.opacity,visible:e.visible})}d();var Fa="floor",oA=`${Fa}.footprint`,nA=`${Fa}.geometry`,iA=`${Fa}.labels`,sA=`${Fa}.markers`,aA=`${Fa}.images`,lA=`${Fa}.occlusion`,cA=`${Fa}.paths`,vg=F.object({type:F.literal(oA).default(oA),altitude:F.number().default(0),visible:F.boolean().default(!1),height:F.number().default(0),opacity:F.number().default(1),side:F.enum(["double","front","back"]),color:F.string().default("#ffffff")}),Ig=F.object({type:F.literal(nA).default(nA),opacity:F.number().default(1),visible:F.boolean().default(!0)}),Sg=F.object({type:F.literal(iA).default(iA),enabled:F.boolean().default(!0)}),Tg=F.object({type:F.literal(sA).default(sA),enabled:F.boolean().default(!0)}),Cg=F.object({type:F.literal(aA).default(aA),visible:F.boolean().default(!0)}),Mg=F.object({type:F.literal(lA).default(lA),enabled:F.boolean().default(!0)}),wg=F.object({type:F.literal(cA).default(cA),visible:F.boolean().default(!0)}),Og=F.object({type:F.literal(Fa).default(Fa),visible:F.boolean().default(!1),altitude:F.number().default(0)}),IZ=F.object({...Og.shape,geometry:Ig,labels:Sg,markers:Tg,images:Cg,footprint:vg,occlusion:Mg,paths:wg}),$_e=F.object({...Og.shape,geometry:Ig.partial(),labels:Sg.partial(),markers:Tg.partial(),images:Cg.partial(),footprint:vg.partial(),occlusion:Mg.partial(),paths:wg.partial()}).partial(),H_e=F.object({...Og.shape,geometry:Ig.strict(),labels:Sg.strict(),markers:Tg.strict(),images:Cg.strict(),footprint:vg.strict(),occlusion:Mg.strict(),paths:wg.strict()});function pA(e,r,t){if(!r){A.error("Floor is not defined. Cannot get floor state.");return}let o=r.layers.get(rr),n=o?t?.getState(o.containerId):void 0,i=r.layers.get(ts),a=r.layers.get(ai),l=r.layers.get(Vd),c=l?t?.getState(l.containerId):void 0,p=r.layers.get(al),u=p?t?.getState(p.containerId):void 0,f=r.layers.get($d),h=f?t?.getState(f.containerId):void 0,b=r.layers.get(rs),x=b?t?.getState(b.containerId):void 0;return Br(IZ,{geometry:{opacity:n?.opacity,visible:n?.visible},labels:{enabled:i?.visible},markers:{enabled:a?.visible},footprint:{altitude:c?.altitude,visible:c?.visible,height:c?.height,opacity:c?.opacity,side:c?.side,color:c?.color},images:{visible:h?.visible},occlusion:{enabled:u?.visible},paths:{visible:x?.visible},visible:e.visible,altitude:e.altitude})}d();var dA="geometry",Ju=F.object({type:F.literal(dA).default(dA),visible:F.boolean().default(!0),color:F.union([F.string(),F.literal("initial")]).default("#ffffff"),topColor:F.union([F.string(),F.literal("initial")]).optional(),hoverColor:F.union([F.string(),F.literal("initial")]).optional(),interactive:F.boolean().default(!1),opacity:F.number().default(1),height:F.number().default(0),altitude:F.number().default(0),texture:F.object({url:F.string()}).optional(),topTexture:F.object({url:F.string()}).optional(),flipImageToFaceCamera:F.boolean().default(!1),enableImageCollisions:F.boolean().default(!1),borderVisible:F.boolean().default(!1),borderColor:F.string().optional(),borderWidth:F.number().optional()}),Y_e=Ju.partial(),J_e=Ju.strict();function uA(e,r){let t=r?.altitude?e.altitude+r.altitude:e.altitude,{interactive:o,hoverColor:n,color:i,visible:a,opacity:l,height:c,texture:p,topTexture:u,flipImageToFaceCamera:f,enableImageCollisions:h,topColor:b,borderVisible:x,borderColor:T,borderWidth:v}=e;return Br(Ju,{interactive:o,hoverColor:n,color:i,visible:a,opacity:l,height:c,texture:p?{url:e.texture}:void 0,topTexture:u?{url:u}:void 0,flipImageToFaceCamera:f,enableImageCollisions:h,topColor:b,altitude:t,borderVisible:x,borderColor:T,borderWidth:v})}function mA(e,r,t){let o={};return r==null||(e.color&&(e.color==="initial"?o.color=r.initialColor:o.color=e.color),e.topColor&&(e.topColor==="initial"?o.topColor=r.initialTopColor:o.topColor=e.topColor),e.visible!==void 0&&(o.visible=e.visible),e.texture?.url!==void 0&&(o.texture=e.texture.url),e.topTexture?.url!==void 0&&(o.topTexture=e.topTexture.url),e.hoverColor!==void 0&&(o.hoverColor=e.hoverColor),e.interactive!==void 0&&(o.interactive=e.interactive),e.height!==void 0&&(o.height=e.height),e.opacity!==void 0&&(o.opacity=e.opacity),e.flipImageToFaceCamera!==void 0&&(o.flipImageToFaceCamera=e.flipImageToFaceCamera),e.enableImageCollisions!==void 0&&(o.enableImageCollisions=e.enableImageCollisions),e.altitude!==void 0&&(o.altitude=e.altitude-(t?.altitude??0)),e.borderVisible!==void 0&&(o.borderVisible=e.borderVisible),e.borderColor!==void 0&&(o.borderColor=e.borderColor),e.borderWidth!==void 0&&(o.borderWidth=e.borderWidth)),o}d();var MT="label",wT=J.object({type:J.literal(MT).default(MT),text:J.string(),rank:J.custom(e=>sy.safeParse(e).success||e==="initial"),appearance:J.custom(e=>NC.safeParse(e).success),interactive:J.boolean().default(!1),enabled:J.boolean().default(!0),textPlacement:J.union([J.enum(M0),J.array(J.enum(M0))]).default(w0)}),r8e=wT.partial();function fA(e){let{text:r,enabled:t,options:o}=e;return{type:MT,text:r??"",appearance:jC(o?.appearance??{}),rank:o?.rank??"medium",enabled:t??!0,interactive:o?.interactive??!1,textPlacement:o?.textPlacement??w0}}function hA(e,r){let t={options:{}};if(!t.options)throw new Error("options should exist");return e.text&&(t.text=e.text),e.appearance&&(t.options.appearance=e.appearance),e.textPlacement&&(t.options.textPlacement=e.textPlacement),e.rank!=null&&(e.rank==="initial"?t.options.rank=r.initialRank||2:t.options.rank=e.rank),e.enabled!==void 0&&(t.enabled=e.enabled),e.interactive!==void 0&&(t.options.interactive=e.interactive),e.enabled!==void 0&&(t.enabled=e.enabled),t}d();var OT="marker",ET=J.object({type:J.literal(OT).default(OT),rank:J.custom(e=>sy.safeParse(e).success||e==="initial"),placement:J.union([J.enum(O0),J.array(J.enum(O0))]).optional(),interactive:J.union([J.boolean(),J.literal("pointer-events-auto")]).default(!1),dynamicResize:J.boolean().default(!0),enabled:J.boolean().default(!0),zIndex:J.number().optional(),lowPriorityPin:J.object({enabled:J.boolean().optional(),size:J.number().positive().optional(),color:J.string().optional()}).optional(),element:J.custom(e=>e instanceof HTMLElement,{message:"Must be an HTMLElement instance"}),contentHTML:J.string()}),c8e=ET.omit({element:!0}).partial();function gA(e,r){let t=r?.target?r.target.anchorTarget:void 0,{enabled:o,placement:n,element:i,dynamicResize:a,contentHTML:l,options:c,position:p,parent:u}=e,f=typeof u=="object"?u.id:u;return t==null&&(t=new fe({latitude:p?.[1]??0,longitude:p?.[0]??0,floorId:f?.toString()})),{type:OT,rank:c?.rank??"medium",interactive:c?.interactive??!1,enabled:o??!0,element:i,placement:n??[],zIndex:c?.zIndex,dynamicResize:a??!0,lowPriorityPin:c?.lowPriorityPin,contentHTML:l??""}}function yA(e,r){let t={};return t.options={},e.rank!=null&&(e.rank==="initial"?t.options.rank=r.initialRank||2:t.options.rank=e.rank),e.dynamicResize!=null&&(t.options.dynamicResize=e.dynamicResize),e.enabled!=null&&(t.enabled=e.enabled),e.interactive!=null&&(t.options.interactive=e.interactive),e.enabled!==null&&(t.enabled=e.enabled),e.contentHTML!==void 0&&(t.contentHTML=e.contentHTML),e.placement!=null&&(t.placement=e.placement),t}d();var bA="path",i0={color:"#4b90e2",width:1,completeFraction:0,visible:!0,verticalOffset:.1},Ku=J.object({type:J.literal(bA).default(bA),color:J.string().default(i0.color),width:J.union([J.number(),J.any()]),completeFraction:J.number().default(i0.completeFraction),visible:J.boolean().default(i0.visible),verticalOffset:J.number().default(i0.verticalOffset)}),f8e=Ku.partial(),h8e=Ku.strict();function xA(e){let{color:r,visible:t,width:o,verticalOffset:n,completeFraction:i}=e;return Br(Ku,{color:r,visible:t,width:o,verticalOffset:n,completeFraction:i})}d();var vA="shape",Eg=F.object({type:F.literal(vA).default(vA),visible:F.boolean().default(!0),altitude:F.number().default(0),color:F.string().default("#ffffff"),height:F.number().default(0),opacity:F.number().default(1),interactive:F.boolean().default(!1),bevel:F.object({enabled:F.boolean().optional(),thickness:F.number().optional(),size:F.number().optional(),offset:F.number().optional(),segments:F.number().optional()}).optional()}),I8e=Eg.partial(),S8e=Eg.strict();function IA(e){let{altitude:r,visible:t,color:o,opacity:n,interactive:i,height:a,children:l,bevel:c}=e;if(l==null||l.length<1){A.error("Expected at least one child for Shape. Cannot get shape state.");return}return Br(Eg,{altitude:r,visible:t,color:o,height:a,opacity:n,interactive:i,bevel:c})}d();var SA="text3d",TA=J.object({type:J.literal(SA).default(SA),position:J.custom(e=>e instanceof fe,{message:"Must be a Coordinate instance"})}),CA=sM.extend({...TA.shape}),MA=aM.extend({...TA.shape}).partial(),P8e=CA.strict();function wA(e){let{position:r,visible:t,color:o,flipToFaceCamera:n,font:i,fontSize:a,outlineColor:l,outlineOpacity:c,outlineBlur:p,outlineWidth:u,outlineOffsetX:f,outlineOffsetY:h,strokeWidth:b,strokeOpacity:x,strokeColor:T,fillOpacity:v,hoverColor:I}=e;return Br(CA,{position:new fe({latitude:r?.[1]??0,longitude:r?.[0]??0}),visible:t,color:o,flipToFaceCamera:n,font:i,fontSize:a,outlineColor:l,outlineOpacity:c,outlineBlur:p,outlineWidth:u,outlineOffsetX:f,outlineOffsetY:h,strokeWidth:b,strokeOpacity:x,strokeColor:T,fillOpacity:v,hoverColor:I})}d();var OA="walls",Qu=J.object({type:J.literal(OA).default(OA),color:J.string().default("#ffffff"),topColor:J.string().optional(),texture:J.object({url:J.string()}).or(J.undefined()),topTexture:J.object({url:J.string()}).or(J.undefined()),visible:J.boolean().default(!0),height:J.number().default(0),opacity:J.number().default(1)}),L8e=Qu.partial(),_8e=Qu.strict();function EA(e){let{color:r,topColor:t,texture:o,topTexture:n,visible:i,height:a,opacity:l}=e;return Br(Qu,{visible:i,color:r,topColor:t,texture:o?{url:o}:void 0,topTexture:n?{url:n}:void 0,height:a,opacity:l})}function PT(e,r){let t={};return r==null||(e.color&&(e.color==="initial"?t.color=r.initialColor:t.color=e.color),e.topColor&&(e.topColor==="initial"?t.topColor=r.initialTopColor:t.topColor=e.topColor),e.visible!==void 0&&(t.visible=e.visible),e.texture?.url!==void 0&&(t.texture=e.texture.url),e.topTexture?.url!==void 0&&(t.topTexture=e.topTexture.url),e.height!==void 0&&(t.height=e.height),e.opacity!==void 0&&(t.opacity=e.opacity)),t}d();var FT="image3d",DT=F.object({type:F.literal(FT).default(FT),visible:F.boolean().default(!0),opacity:F.number().min(0).max(1).default(1),position:F.custom(e=>e instanceof fe,{message:"Must be a Coordinate instance"}),width:F.number().default(1),height:F.number().default(1),rotation:F.number().default(0),verticalOffset:F.number().default(0),flipImagesToFaceCamera:F.boolean().default(!1)}),G8e=DT.partial();function PA(e){let{position:r}=e;return{type:FT,visible:e.visible??!0,opacity:e.opacity??1,position:new fe({latitude:r?.[1]??0,longitude:r?.[0]??0,verticalOffset:r?.[2]}),width:e.width??1,height:e.height??1,rotation:e.rotation??0,verticalOffset:e.verticalOffset??0,flipImagesToFaceCamera:e.flipImageToFaceCamera??!1}}d();var FA="model",kT=S2.extend({type:F.literal(FA).default(FA),color:F.string().optional(),position:F.custom(e=>e instanceof fe,{message:"Must be a Coordinate instance"}),visible:F.boolean().default(!0),rotation:F.tuple([F.number(),F.number(),F.number()]).default([0,0,0]),scale:F.tuple([F.number(),F.number(),F.number()]).default([1,1,1]),verticalOffset:F.number().default(0),opacity:F.number().default(1),material:F.record(F.string(),T2).optional(),interactive:F.boolean().default(!1)}),DA=kT.extend({scale:F.union([F.number(),F.tuple([F.number(),F.number(),F.number()])]),rotation:F.union([F.number(),F.tuple([F.number(),F.number(),F.number()])])}).partial(),Z8e=kT.strict();function kA(e){let{color:r,position:t,rotation:o,scale:n,visible:i,interactive:a,opacity:l,material:c,verticalOffset:p,parent:u}=e,f=typeof u=="object"?u?.id?.toString():u?.toString();return Br(kT,{color:r,position:new fe({latitude:t?.[1]??0,longitude:t?.[0]??0,verticalOffset:t?.[2],floorId:f}),rotation:o,scale:n,visible:i,interactive:a,opacity:l,material:c,verticalOffset:p})}d();d();function AA(e,r){[...e.getByType("space"),...e.getByType("object")].forEach(t=>{t.name==null||t.name===""||r.updateState(t,{interactive:!0})})}d();d();d();var{entries:$A,setPrototypeOf:LA,isFrozen:SZ,getPrototypeOf:TZ,getOwnPropertyDescriptor:CZ}=Object,{freeze:wo,seal:Un,create:HA}=Object,{apply:NT,construct:jT}=typeof Reflect<"u"&&Reflect;wo||(wo=function(r){return r});Un||(Un=function(r){return r});NT||(NT=function(r,t,o){return r.apply(t,o)});jT||(jT=function(r,t){return new r(...t)});var s0=Oo(Array.prototype.forEach),MZ=Oo(Array.prototype.lastIndexOf),_A=Oo(Array.prototype.pop),Pg=Oo(Array.prototype.push),wZ=Oo(Array.prototype.splice),l0=Oo(String.prototype.toLowerCase),AT=Oo(String.prototype.toString),RA=Oo(String.prototype.match),Fg=Oo(String.prototype.replace),OZ=Oo(String.prototype.indexOf),EZ=Oo(String.prototype.trim),Si=Oo(Object.prototype.hasOwnProperty),Mo=Oo(RegExp.prototype.test),Dg=PZ(TypeError);function Oo(e){return function(r){r instanceof RegExp&&(r.lastIndex=0);for(var t=arguments.length,o=new Array(t>1?t-1:0),n=1;n<t;n++)o[n-1]=arguments[n];return NT(e,r,o)}}function PZ(e){return function(){for(var r=arguments.length,t=new Array(r),o=0;o<r;o++)t[o]=arguments[o];return jT(e,t)}}function je(e,r){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:l0;LA&&LA(e,null);let o=r.length;for(;o--;){let n=r[o];if(typeof n=="string"){let i=t(n);i!==n&&(SZ(r)||(r[o]=i),n=i)}e[n]=!0}return e}function FZ(e){for(let r=0;r<e.length;r++)Si(e,r)||(e[r]=null);return e}function Da(e){let r=HA(null);for(let[t,o]of $A(e))Si(e,t)&&(Array.isArray(o)?r[t]=FZ(o):o&&typeof o=="object"&&o.constructor===Object?r[t]=Da(o):r[t]=o);return r}function kg(e,r){for(;e!==null;){let o=CZ(e,r);if(o){if(o.get)return Oo(o.get);if(typeof o.value=="function")return Oo(o.value)}e=TZ(e)}function t(){return null}return t}var BA=wo(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),LT=wo(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),_T=wo(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),DZ=wo(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),RT=wo(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),kZ=wo(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),NA=wo(["#text"]),jA=wo(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),BT=wo(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),GA=wo(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),a0=wo(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),AZ=Un(/\{\{[\w\W]*|[\w\W]*\}\}/gm),LZ=Un(/<%[\w\W]*|[\w\W]*%>/gm),_Z=Un(/\$\{[\w\W]*/gm),RZ=Un(/^data-[\-\w.\u00B7-\uFFFF]+$/),BZ=Un(/^aria-[\-\w]+$/),zA=Un(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),NZ=Un(/^(?:\w+script|data):/i),jZ=Un(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),WA=Un(/^html$/i),GZ=Un(/^[a-z][.\w]*(-[.\w]+)+$/i),UA=Object.freeze({__proto__:null,ARIA_ATTR:BZ,ATTR_WHITESPACE:jZ,CUSTOM_ELEMENT:GZ,DATA_ATTR:RZ,DOCTYPE_NAME:WA,ERB_EXPR:LZ,IS_ALLOWED_URI:zA,IS_SCRIPT_OR_DATA:NZ,MUSTACHE_EXPR:AZ,TMPLIT_EXPR:_Z}),Ag={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},UZ=function(){return typeof window>"u"?null:window},VZ=function(r,t){if(typeof r!="object"||typeof r.createPolicy!="function")return null;let o=null,n="data-tt-policy-suffix";t&&t.hasAttribute(n)&&(o=t.getAttribute(n));let i="dompurify"+(o?"#"+o:"");try{return r.createPolicy(i,{createHTML(a){return a},createScriptURL(a){return a}})}catch{return console.warn("TrustedTypes policy "+i+" could not be created."),null}},VA=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function ZA(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:UZ(),r=he=>ZA(he);if(r.version="3.2.6",r.removed=[],!e||!e.document||e.document.nodeType!==Ag.document||!e.Element)return r.isSupported=!1,r;let{document:t}=e,o=t,n=o.currentScript,{DocumentFragment:i,HTMLTemplateElement:a,Node:l,Element:c,NodeFilter:p,NamedNodeMap:u=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:f,DOMParser:h,trustedTypes:b}=e,x=c.prototype,T=kg(x,"cloneNode"),v=kg(x,"remove"),I=kg(x,"nextSibling"),M=kg(x,"childNodes"),O=kg(x,"parentNode");if(typeof a=="function"){let he=t.createElement("template");he.content&&he.content.ownerDocument&&(t=he.content.ownerDocument)}let C,E="",{implementation:_,createNodeIterator:G,createDocumentFragment:R,getElementsByTagName:N}=t,{importNode:X}=o,z=VA();r.isSupported=typeof $A=="function"&&typeof O=="function"&&_&&_.createHTMLDocument!==void 0;let{MUSTACHE_EXPR:ee,ERB_EXPR:re,TMPLIT_EXPR:ue,DATA_ATTR:Ce,ARIA_ATTR:Oe,IS_SCRIPT_OR_DATA:Pe,ATTR_WHITESPACE:Fe,CUSTOM_ELEMENT:ce}=UA,{IS_ALLOWED_URI:Ee}=UA,ye=null,Ge=je({},[...BA,...LT,..._T,...RT,...NA]),Ie=null,Xe=je({},[...jA,...BT,...GA,...a0]),se=Object.seal(HA(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),nt=null,dt=null,$t=!0,k=!0,H=!1,P=!0,q=!1,K=!0,Q=!1,De=!1,xt=!1,dr=!1,ir=!1,ur=!1,Mi=!0,lp=!1,nm="user-content-",cp=!0,Rl=!1,ka={},vs=null,Gg=je({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),u0=null,im=je({},["audio","video","img","source","image","track"]),Aa=null,Ug=je({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),pp="http://www.w3.org/1998/Math/MathML",dp="http://www.w3.org/2000/svg",Is="http://www.w3.org/1999/xhtml",up=Is,m0=!1,f0=null,g7=je({},[pp,dp,Is],AT),Vg=je({},["mi","mo","mn","ms","mtext"]),$g=je({},["annotation-xml"]),y7=je({},["title","style","font","a","script"]),sm=null,b7=["application/xhtml+xml","text/html"],x7="text/html",Mr=null,mp=null,v7=t.createElement("form"),HT=function(L){return L instanceof RegExp||L instanceof Function},h0=function(){let L=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(mp&&mp===L)){if((!L||typeof L!="object")&&(L={}),L=Da(L),sm=b7.indexOf(L.PARSER_MEDIA_TYPE)===-1?x7:L.PARSER_MEDIA_TYPE,Mr=sm==="application/xhtml+xml"?AT:l0,ye=Si(L,"ALLOWED_TAGS")?je({},L.ALLOWED_TAGS,Mr):Ge,Ie=Si(L,"ALLOWED_ATTR")?je({},L.ALLOWED_ATTR,Mr):Xe,f0=Si(L,"ALLOWED_NAMESPACES")?je({},L.ALLOWED_NAMESPACES,AT):g7,Aa=Si(L,"ADD_URI_SAFE_ATTR")?je(Da(Ug),L.ADD_URI_SAFE_ATTR,Mr):Ug,u0=Si(L,"ADD_DATA_URI_TAGS")?je(Da(im),L.ADD_DATA_URI_TAGS,Mr):im,vs=Si(L,"FORBID_CONTENTS")?je({},L.FORBID_CONTENTS,Mr):Gg,nt=Si(L,"FORBID_TAGS")?je({},L.FORBID_TAGS,Mr):Da({}),dt=Si(L,"FORBID_ATTR")?je({},L.FORBID_ATTR,Mr):Da({}),ka=Si(L,"USE_PROFILES")?L.USE_PROFILES:!1,$t=L.ALLOW_ARIA_ATTR!==!1,k=L.ALLOW_DATA_ATTR!==!1,H=L.ALLOW_UNKNOWN_PROTOCOLS||!1,P=L.ALLOW_SELF_CLOSE_IN_ATTR!==!1,q=L.SAFE_FOR_TEMPLATES||!1,K=L.SAFE_FOR_XML!==!1,Q=L.WHOLE_DOCUMENT||!1,dr=L.RETURN_DOM||!1,ir=L.RETURN_DOM_FRAGMENT||!1,ur=L.RETURN_TRUSTED_TYPE||!1,xt=L.FORCE_BODY||!1,Mi=L.SANITIZE_DOM!==!1,lp=L.SANITIZE_NAMED_PROPS||!1,cp=L.KEEP_CONTENT!==!1,Rl=L.IN_PLACE||!1,Ee=L.ALLOWED_URI_REGEXP||zA,up=L.NAMESPACE||Is,Vg=L.MATHML_TEXT_INTEGRATION_POINTS||Vg,$g=L.HTML_INTEGRATION_POINTS||$g,se=L.CUSTOM_ELEMENT_HANDLING||{},L.CUSTOM_ELEMENT_HANDLING&&HT(L.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(se.tagNameCheck=L.CUSTOM_ELEMENT_HANDLING.tagNameCheck),L.CUSTOM_ELEMENT_HANDLING&&HT(L.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(se.attributeNameCheck=L.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),L.CUSTOM_ELEMENT_HANDLING&&typeof L.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(se.allowCustomizedBuiltInElements=L.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),q&&(k=!1),ir&&(dr=!0),ka&&(ye=je({},NA),Ie=[],ka.html===!0&&(je(ye,BA),je(Ie,jA)),ka.svg===!0&&(je(ye,LT),je(Ie,BT),je(Ie,a0)),ka.svgFilters===!0&&(je(ye,_T),je(Ie,BT),je(Ie,a0)),ka.mathMl===!0&&(je(ye,RT),je(Ie,GA),je(Ie,a0))),L.ADD_TAGS&&(ye===Ge&&(ye=Da(ye)),je(ye,L.ADD_TAGS,Mr)),L.ADD_ATTR&&(Ie===Xe&&(Ie=Da(Ie)),je(Ie,L.ADD_ATTR,Mr)),L.ADD_URI_SAFE_ATTR&&je(Aa,L.ADD_URI_SAFE_ATTR,Mr),L.FORBID_CONTENTS&&(vs===Gg&&(vs=Da(vs)),je(vs,L.FORBID_CONTENTS,Mr)),cp&&(ye["#text"]=!0),Q&&je(ye,["html","head","body"]),ye.table&&(je(ye,["tbody"]),delete nt.tbody),L.TRUSTED_TYPES_POLICY){if(typeof L.TRUSTED_TYPES_POLICY.createHTML!="function")throw Dg('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof L.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Dg('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');C=L.TRUSTED_TYPES_POLICY,E=C.createHTML("")}else C===void 0&&(C=VZ(b,n)),C!==null&&typeof E=="string"&&(E=C.createHTML(""));wo&&wo(L),mp=L}},zT=je({},[...LT,..._T,...DZ]),WT=je({},[...RT,...kZ]),I7=function(L){let Y=O(L);(!Y||!Y.tagName)&&(Y={namespaceURI:up,tagName:"template"});let pe=l0(L.tagName),Gt=l0(Y.tagName);return f0[L.namespaceURI]?L.namespaceURI===dp?Y.namespaceURI===Is?pe==="svg":Y.namespaceURI===pp?pe==="svg"&&(Gt==="annotation-xml"||Vg[Gt]):!!zT[pe]:L.namespaceURI===pp?Y.namespaceURI===Is?pe==="math":Y.namespaceURI===dp?pe==="math"&&$g[Gt]:!!WT[pe]:L.namespaceURI===Is?Y.namespaceURI===dp&&!$g[Gt]||Y.namespaceURI===pp&&!Vg[Gt]?!1:!WT[pe]&&(y7[pe]||!zT[pe]):!!(sm==="application/xhtml+xml"&&f0[L.namespaceURI]):!1},wi=function(L){Pg(r.removed,{element:L});try{O(L).removeChild(L)}catch{v(L)}},fp=function(L,Y){try{Pg(r.removed,{attribute:Y.getAttributeNode(L),from:Y})}catch{Pg(r.removed,{attribute:null,from:Y})}if(Y.removeAttribute(L),L==="is")if(dr||ir)try{wi(Y)}catch{}else try{Y.setAttribute(L,"")}catch{}},ZT=function(L){let Y=null,pe=null;if(xt)L="<remove></remove>"+L;else{let mr=RA(L,/^[\r\n\t ]+/);pe=mr&&mr[0]}sm==="application/xhtml+xml"&&up===Is&&(L='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+L+"</body></html>");let Gt=C?C.createHTML(L):L;if(up===Is)try{Y=new h().parseFromString(Gt,sm)}catch{}if(!Y||!Y.documentElement){Y=_.createDocument(up,"template",null);try{Y.documentElement.innerHTML=m0?E:Gt}catch{}}let Kr=Y.body||Y.documentElement;return L&&pe&&Kr.insertBefore(t.createTextNode(pe),Kr.childNodes[0]||null),up===Is?N.call(Y,Q?"html":"body")[0]:Q?Y.documentElement:Kr},XT=function(L){return G.call(L.ownerDocument||L,L,p.SHOW_ELEMENT|p.SHOW_COMMENT|p.SHOW_TEXT|p.SHOW_PROCESSING_INSTRUCTION|p.SHOW_CDATA_SECTION,null)},g0=function(L){return L instanceof f&&(typeof L.nodeName!="string"||typeof L.textContent!="string"||typeof L.removeChild!="function"||!(L.attributes instanceof u)||typeof L.removeAttribute!="function"||typeof L.setAttribute!="function"||typeof L.namespaceURI!="string"||typeof L.insertBefore!="function"||typeof L.hasChildNodes!="function")},YT=function(L){return typeof l=="function"&&L instanceof l};function Ss(he,L,Y){s0(he,pe=>{pe.call(r,L,Y,mp)})}let JT=function(L){let Y=null;if(Ss(z.beforeSanitizeElements,L,null),g0(L))return wi(L),!0;let pe=Mr(L.nodeName);if(Ss(z.uponSanitizeElement,L,{tagName:pe,allowedTags:ye}),K&&L.hasChildNodes()&&!YT(L.firstElementChild)&&Mo(/<[/\w!]/g,L.innerHTML)&&Mo(/<[/\w!]/g,L.textContent)||L.nodeType===Ag.progressingInstruction||K&&L.nodeType===Ag.comment&&Mo(/<[/\w]/g,L.data))return wi(L),!0;if(!ye[pe]||nt[pe]){if(!nt[pe]&&QT(pe)&&(se.tagNameCheck instanceof RegExp&&Mo(se.tagNameCheck,pe)||se.tagNameCheck instanceof Function&&se.tagNameCheck(pe)))return!1;if(cp&&!vs[pe]){let Gt=O(L)||L.parentNode,Kr=M(L)||L.childNodes;if(Kr&&Gt){let mr=Kr.length;for(let Eo=mr-1;Eo>=0;--Eo){let Ts=T(Kr[Eo],!0);Ts.__removalCount=(L.__removalCount||0)+1,Gt.insertBefore(Ts,I(L))}}}return wi(L),!0}return L instanceof c&&!I7(L)||(pe==="noscript"||pe==="noembed"||pe==="noframes")&&Mo(/<\/no(script|embed|frames)/i,L.innerHTML)?(wi(L),!0):(q&&L.nodeType===Ag.text&&(Y=L.textContent,s0([ee,re,ue],Gt=>{Y=Fg(Y,Gt," ")}),L.textContent!==Y&&(Pg(r.removed,{element:L.cloneNode()}),L.textContent=Y)),Ss(z.afterSanitizeElements,L,null),!1)},KT=function(L,Y,pe){if(Mi&&(Y==="id"||Y==="name")&&(pe in t||pe in v7))return!1;if(!(k&&!dt[Y]&&Mo(Ce,Y))){if(!($t&&Mo(Oe,Y))){if(!Ie[Y]||dt[Y]){if(!(QT(L)&&(se.tagNameCheck instanceof RegExp&&Mo(se.tagNameCheck,L)||se.tagNameCheck instanceof Function&&se.tagNameCheck(L))&&(se.attributeNameCheck instanceof RegExp&&Mo(se.attributeNameCheck,Y)||se.attributeNameCheck instanceof Function&&se.attributeNameCheck(Y))||Y==="is"&&se.allowCustomizedBuiltInElements&&(se.tagNameCheck instanceof RegExp&&Mo(se.tagNameCheck,pe)||se.tagNameCheck instanceof Function&&se.tagNameCheck(pe))))return!1}else if(!Aa[Y]){if(!Mo(Ee,Fg(pe,Fe,""))){if(!((Y==="src"||Y==="xlink:href"||Y==="href")&&L!=="script"&&OZ(pe,"data:")===0&&u0[L])){if(!(H&&!Mo(Pe,Fg(pe,Fe,"")))){if(pe)return!1}}}}}}return!0},QT=function(L){return L!=="annotation-xml"&&RA(L,ce)},qT=function(L){Ss(z.beforeSanitizeAttributes,L,null);let{attributes:Y}=L;if(!Y||g0(L))return;let pe={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Ie,forceKeepAttr:void 0},Gt=Y.length;for(;Gt--;){let Kr=Y[Gt],{name:mr,namespaceURI:Eo,value:Ts}=Kr,am=Mr(mr),y0=Ts,Qr=mr==="value"?y0:EZ(y0);if(pe.attrName=am,pe.attrValue=Qr,pe.keepAttr=!0,pe.forceKeepAttr=void 0,Ss(z.uponSanitizeAttribute,L,pe),Qr=pe.attrValue,lp&&(am==="id"||am==="name")&&(fp(mr,L),Qr=nm+Qr),K&&Mo(/((--!?|])>)|<\/(style|title)/i,Qr)){fp(mr,L);continue}if(pe.forceKeepAttr)continue;if(!pe.keepAttr){fp(mr,L);continue}if(!P&&Mo(/\/>/i,Qr)){fp(mr,L);continue}q&&s0([ee,re,ue],tC=>{Qr=Fg(Qr,tC," ")});let eC=Mr(L.nodeName);if(!KT(eC,am,Qr)){fp(mr,L);continue}if(C&&typeof b=="object"&&typeof b.getAttributeType=="function"&&!Eo)switch(b.getAttributeType(eC,am)){case"TrustedHTML":{Qr=C.createHTML(Qr);break}case"TrustedScriptURL":{Qr=C.createScriptURL(Qr);break}}if(Qr!==y0)try{Eo?L.setAttributeNS(Eo,mr,Qr):L.setAttribute(mr,Qr),g0(L)?wi(L):_A(r.removed)}catch{fp(mr,L)}}Ss(z.afterSanitizeAttributes,L,null)},S7=function he(L){let Y=null,pe=XT(L);for(Ss(z.beforeSanitizeShadowDOM,L,null);Y=pe.nextNode();)Ss(z.uponSanitizeShadowNode,Y,null),JT(Y),qT(Y),Y.content instanceof i&&he(Y.content);Ss(z.afterSanitizeShadowDOM,L,null)};return r.sanitize=function(he){let L=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},Y=null,pe=null,Gt=null,Kr=null;if(m0=!he,m0&&(he="<!-->"),typeof he!="string"&&!YT(he))if(typeof he.toString=="function"){if(he=he.toString(),typeof he!="string")throw Dg("dirty is not a string, aborting")}else throw Dg("toString is not a function");if(!r.isSupported)return he;if(De||h0(L),r.removed=[],typeof he=="string"&&(Rl=!1),Rl){if(he.nodeName){let Ts=Mr(he.nodeName);if(!ye[Ts]||nt[Ts])throw Dg("root node is forbidden and cannot be sanitized in-place")}}else if(he instanceof l)Y=ZT("<!---->"),pe=Y.ownerDocument.importNode(he,!0),pe.nodeType===Ag.element&&pe.nodeName==="BODY"||pe.nodeName==="HTML"?Y=pe:Y.appendChild(pe);else{if(!dr&&!q&&!Q&&he.indexOf("<")===-1)return C&&ur?C.createHTML(he):he;if(Y=ZT(he),!Y)return dr?null:ur?E:""}Y&&xt&&wi(Y.firstChild);let mr=XT(Rl?he:Y);for(;Gt=mr.nextNode();)JT(Gt),qT(Gt),Gt.content instanceof i&&S7(Gt.content);if(Rl)return he;if(dr){if(ir)for(Kr=R.call(Y.ownerDocument);Y.firstChild;)Kr.appendChild(Y.firstChild);else Kr=Y;return(Ie.shadowroot||Ie.shadowrootmode)&&(Kr=X.call(o,Kr,!0)),Kr}let Eo=Q?Y.outerHTML:Y.innerHTML;return Q&&ye["!doctype"]&&Y.ownerDocument&&Y.ownerDocument.doctype&&Y.ownerDocument.doctype.name&&Mo(WA,Y.ownerDocument.doctype.name)&&(Eo="<!DOCTYPE "+Y.ownerDocument.doctype.name+`>
755
- `+Eo),q&&s0([ee,re,ue],Ts=>{Eo=Fg(Eo,Ts," ")}),C&&ur?C.createHTML(Eo):Eo},r.setConfig=function(){let he=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};h0(he),De=!0},r.clearConfig=function(){mp=null,De=!1},r.isValidAttribute=function(he,L,Y){mp||h0({});let pe=Mr(he),Gt=Mr(L);return KT(pe,Gt,Y)},r.addHook=function(he,L){typeof L=="function"&&Pg(z[he],L)},r.removeHook=function(he,L){if(L!==void 0){let Y=MZ(z[he],L);return Y===-1?void 0:wZ(z[he],Y,1)[0]}return _A(z[he])},r.removeHooks=function(he){z[he]=[]},r.removeAllHooks=function(){z=VA()},r}var XA=ZA();var $Z={"connection-stairs-12x12":`<svg viewBox="0 0 12 12" stroke="none">
754
+ </div>`};d();var X4=async e=>new Promise(r=>setTimeout(r,e));var gz=.01,yz=.02,bz={drawDuration:1e3,color:"#40A9FF",interactive:!1,accentColor:"blue",width:{on:"zoom-level",input:[17,22],output:[2,.5]},displayArrowsOnPath:!1,animateArrowsOnPath:!1},xz={drawDuration:1e3,color:"#B3DDFF",interactive:!1,accentColor:"#40A9FF",width:{on:"zoom-level",input:[17,22],output:[2,.5]},displayArrowsOnPath:!1,animateArrowsOnPath:!1},Pl={setMapOnConnectionClick:!0,setMapToDeparture:!0,createMarkers:{departure:!0,destination:!0,connection:!0},pathOptions:bz,inactivePathOptions:xz,markerOptions:{departureColor:iT,destinationColor:nT},animatePathDrawing:!0},ga,ms,Nn,$e,Rh,ya,Jc,nr,$o,lo,jn,Fl,ot,Y4,J4,Ah,K4,sT,Lh,Bx,Bu,aT,Nu,_h=class{constructor(r,t,o){S(this,ot);S(this,ga,new Map);S(this,ms);S(this,Nn);S(this,$e,Pl);S(this,Rh);S(this,ya);S(this,Jc);S(this,nr,[]);S(this,$o);S(this,lo,new Map);S(this,jn,new Map);S(this,Fl,new Map);S(this,Nu,r=>{if(s(this,$e).createMarkers?.connection&&r.markers.length>0){let{instruction:t}=s(this,ga).get(r.markers[0]);t?.action.toFloor&&(s(this,$e).setMapOnConnectionClick&&this.currentMap.setFloor(t.action.toFloor.id,"navigation-connection-click"),s(this,Nn).publish("navigation-connection-click",{instruction:t,fromFloor:t.action.fromFloor,toFloor:t.action.toFloor}))}});w(this,ms,r),w(this,Rh,o),w(this,Nn,t)}get currentMap(){return s(this,Rh).call(this)}get isMultiFloor(){if(!s(this,nr).length)return!1;let r=new Set;for(let t of s(this,nr))for(let o of t.coordinates)if(o.floorId&&(r.add(o.floorId),r.size>1))return!0;return!1}getPathById(r){return s(this,lo).get(r)}getMarkerById(r){return s(this,ga).get(r)}get paths(){let r=new Set;return s(this,lo).forEach(({path:t})=>r.add(t)),Array.from(r)}get activeDirections(){return s(this,Fl).get(s(this,$o))}get activePath(){if(s(this,$o))return s(this,lo).get(s(this,$o).id)?.path}get floorStacks(){let r=s(this,Nn).getMapData();if(!s(this,nr).length||!r)return[];let t=new Set;for(let o of s(this,nr))for(let n of o.coordinates)if(n.floorId){let i=r.getById("floor",n.floorId);i&&t.add(i.floorStack)}return Array.from(t)}get floors(){let r=s(this,Nn).getMapData();if(!s(this,nr).length||!r)return[];let t=new Set;for(let o of s(this,nr))for(let n of o.coordinates)if(n.floorId){let i=r.getById("floor",n.floorId);i&&t.add(i)}return Array.from(t)}setActivePathByIndex(r){let t=s(this,nr)[r];if(!s(this,nr).length){A.warn("Cannot set an active path before drawing. Call Navigation.draw() first.");return}if(!s(this,nr)[r]){A.warn(`Direction #${r} does not exist`);return}let o=s(this,jn).get(t);if(!o){A.warn("The direction is not a part of muli-direcional path");return}W(this,ot,Bx).call(this,o)}setActivePath(r){if(!s(this,nr).length){A.warn("Cannot set an active path before drawing. Call Navigation.draw() first.");return}if(!s(this,Fl).get(r)){A.warn(`Path "${r.id}" is not a part of muli-direcional path`);return}W(this,ot,Bx).call(this,r)}setActivePathByDirections(r){if(!s(this,nr).length){A.warn("[setActivePathByDirections] Cannot set an active path before drawing. Call Navigation.draw() first.");return}let t=s(this,jn).get(r);if(!t){let o=s(this,nr).find(n=>n.id===r.id);if(!o){A.warn("[setActivePathByDirections] Cannot find directions for id");return}t=s(this,jn).get(o)}if(!t){A.warn("[setActivePathByDirections] Cannot find path for directions");return}W(this,ot,Bx).call(this,t)}drawSync(r,t={}){s(this,Jc)&&this.clear(),w(this,Jc,!0),W(this,ot,sT).call(this,t);let o=Array.isArray(r)?r:[r],n=o[0],i=o[o.length-1],a=n.coordinates[0];w(this,nr,o),a.floorId&&s(this,$e).setMapToDeparture&&this.currentMap.setFloor(a.floorId),s(this,$e).createMarkers?.departure&&W(this,ot,Bu).call(this,n.coordinates[0],"departure",n.instructions[0]);for(let l=0;l<o.length;l++){let c=o[l],p=l?{...s(this,$e).inactivePathOptions}:{...s(this,$e).pathOptions};if(c.coordinates.length<2){A.warn("Directions must have at least 2 coordinates");return}let u=this.currentMap.Paths.add(c.coordinates,{...p,animateDrawing:s(this,$e).animatePathDrawing,verticalOffset:W(this,ot,Ah).call(this,l===0?"active":"inactive")}),f=u.paths.map(b=>b.id.toString()),h=new Bn(ut(),u.animation,c.coordinates,u.paths);for(let b of f){s(this,lo).set(b,{path:h,entityIds:f});let x=l?{...s(this,$e).inactivePathOptions}:{...s(this,$e).pathOptions};s(this,ms).setState(b,x)}s(this,lo).set(h.id,{path:h,entityIds:f}),s(this,jn).set(c,h),s(this,Fl).set(h,c),s(this,$e).createMarkers?.connection&&W(this,ot,aT).call(this,c.instructions,"connection"),l===0&&(w(this,$o,s(this,jn).get(s(this,nr)[0])),s(this,ms).on("click",s(this,Nu)))}s(this,$e).createMarkers?.destination&&W(this,ot,Bu).call(this,i.coordinates[i.coordinates.length-1],"destination",i.instructions[i.instructions.length-1]),s(this,Nn).mapObjects.forEach(l=>{l.processFloorChange(l.currentFloorId)}),W(this,ot,Lh).call(this)}async draw(r,t={}){s(this,ya)&&this.clear(),W(this,ot,sT).call(this,t);let o=Array.isArray(r)?r:[r],i=o[0].coordinates[0];return w(this,nr,o),i.floorId&&s(this,$e).setMapToDeparture&&this.currentMap.setFloor(i.floorId),W(this,ot,K4).call(this,o)}clear(){s(this,ga).forEach((r,t)=>{this.currentMap.Markers.remove(t.toString())}),s(this,ga).clear(),s(this,lo).forEach(({path:r,entityIds:t})=>{s(this,lo).delete(r.id),t.forEach(o=>s(this,lo).delete(o)),this.currentMap.Paths.remove(t)}),s(this,ya)&&(s(this,ya).cancel(),w(this,ya,void 0)),s(this,Jc)&&w(this,Jc,!1),w(this,nr,[]),s(this,jn).clear(),s(this,Fl).clear(),w(this,$o,void 0),s(this,ms).off("click",s(this,Nu)),s(this,Nn).mapObjects.forEach(r=>{r.processFloorChange(r.currentFloorId)}),W(this,ot,Lh).call(this)}};ga=new WeakMap,ms=new WeakMap,Nn=new WeakMap,$e=new WeakMap,Rh=new WeakMap,ya=new WeakMap,Jc=new WeakMap,nr=new WeakMap,$o=new WeakMap,lo=new WeakMap,jn=new WeakMap,Fl=new WeakMap,ot=new WeakSet,Y4=function(r){return r!=null&&["TakeConnection","ExitConnection","TakeVortex","ExitVortex"].includes(r.type)},J4=function(){if(!s(this,$o))return;let r=s(this,lo).get(s(this,$o).id);if(r)for(let t of s(this,lo).values())if(t.path.id===s(this,$o).id)for(let o of r.path.segments)this.currentMap.api.updateState(o,{verticalOffset:W(this,ot,Ah).call(this,"active")});else this.currentMap.api.updateState(t.path,{verticalOffset:W(this,ot,Ah).call(this,"inactive")})},Ah=function(r){return r==="active"?yz+(s(this,$e).pathOptions?.verticalOffset??0):gz+(s(this,$e).inactivePathOptions?.verticalOffset??0)},K4=function(r){let t=r[0],o=r[r.length-1],n=!1;return w(this,ya,{promise:new Promise(async i=>{if(y.env.NODE_ENV!=="test"&&await X4(500),n||!r.length){i();return}s(this,$e).createMarkers?.departure&&W(this,ot,Bu).call(this,t.coordinates[0],"departure",t.instructions[0]);for(let a=0;a<r.length;a++){let l=r[a],c=a===0?{...s(this,$e).pathOptions}:{...s(this,$e).inactivePathOptions};if(l.coordinates.length<2){A.warn("Directions must have at least 2 coordinates"),i();return}let p=this.currentMap.Paths.add(l.coordinates,{...c,animateDrawing:s(this,$e).animatePathDrawing,verticalOffset:W(this,ot,Ah).call(this,a===0?"active":"inactive")}),u=p.paths.map(h=>h.id.toString()),f=new Bn(ut(),p.animation,l.coordinates,p.paths);for(let h of u)s(this,lo).set(h,{path:f,entityIds:u});if(s(this,lo).set(f.id,{path:f,entityIds:u}),s(this,jn).set(l,f),s(this,Fl).set(f,l),a===0&&(w(this,$o,s(this,jn).get(s(this,nr)[0])),s(this,ms).on("click",s(this,Nu))),y.env.NODE_ENV!=="test"&&await p.animation,n){i();return}s(this,$e).createMarkers?.connection&&W(this,ot,aT).call(this,l.instructions,"connection")}if(s(this,$e).createMarkers?.destination&&W(this,ot,Bu).call(this,o.coordinates[o.coordinates.length-1],"destination",o.instructions[o.instructions.length-1]),n){i();return}s(this,Nn).mapObjects.forEach(a=>{a.processFloorChange(a.currentFloorId)}),W(this,ot,Lh).call(this),i()}),cancel:()=>{n=!0}}),s(this,ya).promise},sT=function(r){w(this,$e,{setMapOnConnectionClick:r.setMapOnConnectionClick??Pl.setMapOnConnectionClick,setMapToDeparture:r.setMapToDeparture??Pl.setMapToDeparture,pathOptions:{...Pl.pathOptions,...r.pathOptions},inactivePathOptions:{...Pl.inactivePathOptions,...r.inactivePathOptions},createMarkers:{...Pl.createMarkers,...r.createMarkers},markerOptions:{...Pl.markerOptions,...r.markerOptions},animatePathDrawing:r.animatePathDrawing??Pl.animatePathDrawing})},Lh=function(){s(this,Nn).publish("navigation-state-change",{isMultiFloor:this.isMultiFloor,floorStacks:this.floorStacks,floors:this.floors,activeDirections:this.activeDirections,activePath:this.activePath,paths:this.paths})},Bx=function(r){w(this,$o,r),s(this,nr).forEach(t=>{let o=s(this,jn).get(t);if(o){let n=s(this,lo).get(o.id),i=n.path.id===s(this,$o).id?{...s(this,$e).pathOptions}:{...s(this,$e).inactivePathOptions};n.entityIds.forEach(a=>{s(this,ms).setState(a,i)})}}),s(this,Nn).publish("navigation-active-path-change",{directions:this.activeDirections,path:this.activePath}),W(this,ot,J4).call(this),W(this,ot,Lh).call(this)},Bu=function(r,t,o){if(t==="connection"&&o){let n=o.action.type==="ExitConnection"?s(this,$e).markerOptions.departureColor:s(this,$e).markerOptions.destinationColor,i;if(typeof s(this,$e).createMarkers?.connection=="function"){let l=s(this,$e).createMarkers.connection(o);s(this,ms).setState(l.id.toString(),{options:{interactive:!0}}),i={id:l.id,type:"marker"}}else i=this.currentMap.Markers.add(o.coordinate,Z4({type:o.action.connection?.type??o.action.connectionType,color:n,direction:o.action.direction}),{interactive:!0,placement:"top",rank:"always-visible"});let a=this.currentMap.Markers.getContentEl(i.id.toString());if(!a)throw new Error("marker component should exist");s(this,ga).set(i.id,{instruction:o,marker:new us(i.id.toString(),a,o.coordinate)})}else{let n=t==="departure"?s(this,$e).markerOptions.departureColor:s(this,$e).markerOptions.destinationColor,i;typeof s(this,$e).createMarkers?.departure=="function"&&t==="departure"?i={id:s(this,$e).createMarkers.departure(o).id,type:"marker"}:typeof s(this,$e).createMarkers?.destination=="function"&&t==="destination"?i={id:s(this,$e).createMarkers.destination(o).id,type:"marker"}:i=this.currentMap.Markers.add(r,W4({type:t,color:n}),{placement:"top",rank:"always-visible"}),s(this,ga).set(i.id,void 0)}},aT=function(r,t){r.filter(n=>W(this,ot,Y4).call(this,n.action)).forEach(n=>{W(this,ot,Bu).call(this,n.coordinate,t,n)})},Nu=new WeakMap;d();var Te,Nh,ba,Nx,lT,Bh=class{constructor(r){S(this,ba);S(this,Te);S(this,Nh);m(this,"interactions",{set:r=>{r?.pan!=null&&(s(this,Te).getSystems().cameraSystem.enablePan=r.pan),r?.zoom!=null&&(s(this,Te).getSystems().cameraSystem.enableZoom=r.zoom),r?.bearingAndPitch!=null&&(s(this,Te).getSystems().cameraSystem.enableRotate=r.bearingAndPitch)},enable:()=>{s(this,Te).getSystems().cameraSystem.enablePan=!0,s(this,Te).getSystems().cameraSystem.enableZoom=!0,s(this,Te).getSystems().cameraSystem.enableRotate=!0},disable:()=>{s(this,Te).getSystems().cameraSystem.enablePan=!1,s(this,Te).getSystems().cameraSystem.enableZoom=!1,s(this,Te).getSystems().cameraSystem.enableRotate=!1}});m(this,"setMinPitch",r=>{s(this,Te).camera.setMinPitch(r)});m(this,"setMaxPitch",r=>{s(this,Te).camera.setMaxPitch(r)});m(this,"setMinZoomLevel",r=>{s(this,Te).camera.setMinZoomLevel(r,!0)});m(this,"setMaxZoomLevel",r=>{s(this,Te).camera.setMaxZoomLevel(r)});w(this,Nh,r),w(this,Te,r.core)}setScreenOffsets(r){s(this,Te).camera.setInsetPadding(r)}get screenOffsets(){return s(this,Te).camera.insetsPadding}get panMode(){return s(this,Te).camera.panMode}setPanMode(r){if(r!=="default"&&r!=="elevation")throw new Error("Invalid pan mode");r!==this.panMode&&s(this,Te).camera.setPanMode(r)}getFocusOnTransform(r,t){let o=s(this,Te).camera.getCameraFrameForCoordinates(W(this,ba,lT).call(this,r),{pitch:t?.pitch,bearing:t?.bearing,padding:t?.screenOffsets||this.screenOffsets,maxZoomLevel:t?.maxZoomLevel,verticalPadding:t?.axisAlignedPadding?.vertical,minZoomLevel:t?.minZoomLevel,duration:t?.duration,easing:t?.easing});return{center:new fe(o.center[1],o.center[0]),zoomLevel:o.zoomLevel,bearing:t?.bearing??this.bearing,pitch:t?.pitch??this.pitch}}focusOn(r,t){return s(this,Te).camera.focusOn(W(this,ba,lT).call(this,r),{pitch:t?.pitch,bearing:t?.bearing,padding:t?.screenOffsets||this.screenOffsets,maxZoomLevel:t?.maxZoomLevel,minZoomLevel:t?.minZoomLevel,duration:t?.duration,verticalPadding:t?.axisAlignedPadding?.vertical,easing:t?.easing})}animateTo(r,t){let{center:o,zoomLevel:n,bearing:i,pitch:a}=r,l=o??this.center;return s(this,Te).camera.animateTo({center:o!=null?[l.longitude,l.latitude,s(this,Te).camera.elevation]:void 0,zoomLevel:n,bearing:i,pitch:a,duration:t?.duration??600,easing:t?.easing})}set(r){let{center:t=this.center,zoomLevel:o=this.zoomLevel,bearing:n=this.bearing,pitch:i=this.pitch}=r,a=[t.longitude,t.latitude];s(this,Te).camera.setCenter(a),s(this,Te).camera.setZoomLevel(o),s(this,Te).camera.setBearing(n),s(this,Te).camera.setPitch(i)}get center(){let r=s(this,Te).camera.center;return new fe(r[1],r[0],void 0)}setAutoMinZoomLevel(r){s(this,Te).camera.setAutoMinZoomLevel(r)}get autoMinZoomLevel(){return s(this,Te).camera.autoMinZoomLevel}get zoomLevel(){return s(this,Te).camera.zoomLevel}get pitch(){return s(this,Te).camera.pitch}get minPitch(){return s(this,Te).camera.minPitch}get maxPitch(){return s(this,Te).camera.maxPitch}get bearing(){let r=s(this,Te).camera.bearing;return(r<0?r+360:r)%360}get minZoomLevel(){return s(this,Te).camera.minZoomLevel}get maxZoomLevel(){return s(this,Te).camera.maxZoomLevel}setElevation(r){s(this,Te).camera.setElevation(r)}get elevation(){return s(this,Te).camera.elevation}animateElevation(r,t){return s(this,Te).camera.animateElevation(r,t)}updateFacadesInView(){s(this,Te).getSystems().geometryInFocusSystem.raycast()}};Te=new WeakMap,Nh=new WeakMap,ba=new WeakSet,Nx=function(r){let t=s(this,Te).camera.elevation;return fe.is(r)&&r.floorId!=null?s(this,Te).getState(r.floorId)?.altitude??t:Bo.is(r)?s(this,Te).getState(r.id)?.altitude??t:"floor"in r&&Bo.is(r.floor)?s(this,Te).getState(r.floor.id)?.altitude??t:t},lT=function(r){let t=[],n=(Array.isArray(r)?r:[r]).flatMap(i=>i?.focusTarget??[i]);for(let i of n)if(i!=null)if(fe.is(i)){let a=W(this,ba,Nx).call(this,i);t.push([i.longitude,i.latitude,a])}else if(i?.id!=null){let a=W(this,ba,Nx).call(this,i);if(Bo.is(i)&&s(this,Nh).getMapDataInternal()?.enterpriseMode){t.push(i.id);continue}else if("geoJSON"in i&&i.geoJSON.geometry.coordinates.length>0){RC(i.geoJSON,c=>{t.push([c[0],c[1],a])});continue}let l=s(this,Te).getBoundingArea(i.id);if(l)t.push(...l.map(c=>[c[0],c[1],a]));else if("geoJSONBoundingBox"in i){let c=W(this,ba,Nx).call(this,i);if(i.geoJSONBoundingBox!=null){let p=[[i.geoJSONBoundingBox[0],i.geoJSONBoundingBox[1],c],[i.geoJSONBoundingBox[2],i.geoJSONBoundingBox[3],c]];t.push(...p)}}}else RS(i)&&t.push(i);return t};d();var ju,jh=class{constructor({currentMapGetter:r}){S(this,ju);w(this,ju,r)}get currentMap(){return s(this,ju).call(this)}async getCurrentSceneGLTF(r){let t=s(this,ju).call(this);return t?t?.Exporter.getCurrentSceneGLTF(r):(A.error("There is no map to export. Please load a map first."),new Blob)}};ju=new WeakMap;d();var vi,Uh,Gh=class{constructor({currentMapGetter:r}){S(this,vi,new Map);S(this,Uh);w(this,Uh,r)}get currentMap(){return s(this,Uh).call(this)}getAll(){return Array.from(s(this,vi).values()).map(r=>r.label)}getById(r){return s(this,vi).get(r)}add(r,t,o){let n=r.anchorTarget,i=this.currentMap;if(!i)throw new Error("currentMap should exist");let a=i.Labels.add(n,t,{...o,attachTo:iu(r),rank:o?.rank==null||o?.rank==="initial"?"medium":o.rank}),l=new fa(a.id.toString(),t,r);return s(this,vi).set(l.id,{label:l,entityId:l.id}),l}__EXPERIMENTAL__all(r){let t=[];return this.currentMap?.Labels.all({onCreate:(o,n,i)=>{let a=new fa(o.toString(),n,i);s(this,vi).set(a.id,{label:a,entityId:a.id}),t.push(a)},labelOptions:r}),t}remove(r){let t=s(this,vi).get(r.id);t&&(this.currentMap?.Labels.remove(t),s(this,vi).delete(r.id.toString()))}removeAll(){let r=[];return s(this,vi).forEach(({label:t})=>{this.remove(t),r.push(t),s(this,vi).delete(t.id.toString())}),r}};vi=new WeakMap,Uh=new WeakMap;d();d();var jx={altitude:0,height:1,color:"#ffffff",opacity:1,width:.15},Q4={opacity:.25,color:"#a7d1ec",height:.8,width:.05,altitude:.1,cap:"square",visible:!1},q4={color:"red",opacity:.2,height:jx.height+.1,visible:!0,borderVisible:!1,borderColor:"red",borderWidth:.1},ek=.5,Ii=class{constructor(r,t,o=new Map){m(this,"containerId");m(this,"layers");m(this,"renderer");this.containerId=t,this.layers=o,this.renderer=r}get visible(){return this.renderer.getState(this.containerId).visible}setVisible(r){this.renderer.setState(this.containerId,{visible:r})}},tk=0,Kc,Vh=class{constructor(r,t,o,n,i,a,l,c){m(this,"id");m(this,"name");m(this,"elevation");m(this,"containerId");m(this,"externalId");m(this,"metadata");m(this,"shortName");m(this,"subtitle");m(this,"occluderId");m(this,"loaded",!1);m(this,"styleMap",{});m(this,"obstructions");m(this,"entrances");m(this,"spaces");m(this,"floorImages");m(this,"floorText");m(this,"areas");m(this,"renderer");m(this,"mapObject");m(this,"options");m(this,"layers",new Map);m(this,"footprint");m(this,"floorStackId");m(this,"multiFloorView");m(this,"mapDataInternal");m(this,"facadesByStyleId",new Map);S(this,Kc);m(this,"load",()=>{if(this.loaded||this.obstructions==null&&this.spaces==null)return this;this.loaded=!0;let r=this.renderer.addGroupContainer(`${rs}-${this.id}`,{},this.id);this.layers.set(rs,new Ii(this.renderer,r.id.toString()));let t=this.renderer.addGroupContainer(`${li}-${this.id}`,{},this.id);this.layers.set(li,new Ii(this.renderer,t.id.toString()));let o=this.renderer.addGroupContainer(`${rr}-${this.id}`,{},this.id);this.layers.set(rr,new Ii(this.renderer,o.id.toString()));let n=this.renderer.addGroupContainer(`${os}-${this.id}`,{},this.id);if(this.layers.set(os,new Ii(this.renderer,n.id.toString())),this.footprint?.geometry!=null&&this.footprint?.geometry.coordinates.length!==0){let i=jx;if(this.obstructions!=null&&this.obstructions.features.length>0){let c=this.obstructions.features.filter(p=>p.geometry.type==="LineString"&&p.properties.kind?.toLowerCase()==="wall"&&p.properties.footprintComponent===!0);c!=null&&c.length>0&&(i=this.styleMap[c[0].properties?.id])}let a=this.renderer.addGeometryGroup(`Footprint-${this.id}`,{features:[{geometry:this.footprint.geometry,properties:{id:`Footprint-Floor-${this.id}`}}]},{...i,height:this.multiFloorView?.floorGap??10,altitude:0,outline:this.options.style?.outlines??!0,visible:!1,opacity:this.elevation<0?1:.4,side:this.elevation<0?"back":"front",color:this.elevation<0?"#F0EEE8":i.color,renderOrder:2},this.id);this.layers.set(Vd,new Ii(this.renderer,a.id.toString()));let l=this.renderer.addGroupContainer(`${al}-${this.id}`,{},this.id);this.layers.set(al,new Ii(this.renderer,l.id.toString()))}if(this.spaces!=null&&this.spaces.features.length>0){let i=[],a=new Map;this.spaces.features.filter(u=>u.geometry.type==="Polygon"&&u.properties.kind?.toLowerCase()!=="void").forEach(u=>{let f=this.mapDataInternal?.facadesBySpaceId[u.properties.id];if(f){let h=a.get(f.id)||[];a.set(f.id,[...h,u])}else i.push(u)});let l=h1(i,this.styleMap),c=this.renderer.addGroupContainer(`spaces-${this.id}`,{},o),p=0;for(let[u,f]of l){let h=this.renderer.addGeometryGroup(`Spaces-${this.id}-${p}`,{features:f},nu(u,this.options),c);p++;let b=c.id.toString();this.layers.get(rr).layers.set(u.id||b,h.id.toString())}if(a.size>0){let u=this.renderer.addGroupContainer(`${fc}-${this.id}`,{},this.id);this.layers.set(fc,new Ii(this.renderer,u.id.toString()));for(let[f,h]of a){let b=this.renderer.addGroupContainer(f,{focusable:!0},u),x=this.renderer.addGroupContainer(`${f}-geometry`,{},b),T=h1(h,this.styleMap),v=0;for(let[I,M]of T){let O=this.renderer.addGeometryGroup(`Facades-${this.id}-${f}-${v}`,{features:M},{...nu(I,this.options),renderOrder:3},x);v++;let C=I.id||O.id.toString();this.layers.get(fc).layers.set(`${f}-${C}`,O.id.toString()),this.facadesByStyleId.has(C)?this.facadesByStyleId.get(C)?.push(f):this.facadesByStyleId.set(C,[f])}}}}if(this.obstructions!=null&&this.obstructions.features.length>0){let i=this.obstructions.features.filter(x=>x.geometry.type==="Polygon"&&(x.properties.kind==="object"||x.properties.kind==="unknown")),a=h1(i,this.styleMap),l=this.renderer.addGroupContainer(`objects-${this.id}`,{},o),c=0;for(let[x,T]of a){let v=this.renderer.addGeometryGroup(`Objects-${this.id}-${c}`,{features:T},nu(x,this.options),l);c++;let I=l.id.toString();this.layers.get(rr).layers.set(x.id||I,v.id.toString())}let p=this.obstructions.features.filter(x=>x.geometry.type==="LineString"&&x.properties.kind?.toLowerCase()==="wall"&&x.properties.footprintComponent===!1),u=this.obstructions.features.filter(x=>x.geometry.type==="LineString"&&x.properties.kind?.toLowerCase()==="wall"&&x.properties.footprintComponent===!0),f=this.entrances,h=jx,b=jx;if(p!=null&&p.length>0){let x=this.styleMap[p[0].properties?.id];x!=null&&(h={...x}),b=h;let{walls:T,entrances:v}=n2(p,f?.features||[]),I=Math.max(h.height-.11,ek),M={...Q4,height:I},O=this.renderer.addGeometryGroup(`InteriorDoors-${this.id}`,v,M,o);this.layers.get(rr).layers.set(Gd,O.id.toString());let C=this.renderer.addGeometryGroup(`Walls-${this.id}`,{features:[T]},nu(h,this.options),o);this.layers.get(rr).layers.set(sl,C.id.toString())}if(u!=null&&u.length>0){let x=this.styleMap[u[0].properties?.id];x!=null&&(b={...x,id:ts});let{walls:T,entrances:v}=n2(u,f?.features||[]),I=Math.max(b.height-.11,ek),M={...Q4,height:I},O=this.renderer.addGeometryGroup(`ExteriorDoors-${this.id}`,v,M,o);this.layers.get(rr).layers.set(Ud,O.id.toString());let C=this.renderer.addGeometryGroup(`ExteriorWalls-${this.id}`,{features:[T]},nu(b,this.options),o);this.layers.get(rr).layers.set(ts,C.id.toString())}}if(this.floorImages!=null){let i=this.renderer.addGroupContainer(`images-${this.id}`,{},this.id);for(let a of this.floorImages.features||[])if(!("anchorId"in a.properties||"anchorId"in a.properties&&a.properties?.anchorId==null)){let l=W5(a,tk);this.mapObject.api.Image3D.add(new fe({latitude:a.geometry.coordinates[1],longitude:a.geometry.coordinates[0],floorId:this.id}),a.properties.path,{id:l,flipImageToFaceCamera:this.options.flipImagesToFaceCamera??!0,...a.properties}),tk++}this.layers.set($d,new Ii(this.renderer,i.id.toString()))}if(this.floorText!=null)for(let i of this.floorText.features||[]){let a=0;"geometryId"in i.properties?a=this.renderer.getState(i.properties.geometryId)?.height??0:a=i.properties.verticalOffset??0,this.renderer.addText3D(ut(),{...i,properties:{...i.properties,verticalOffset:a}},{},this.id)}if(this.areas!=null){let i=this.renderer.addGroupContainer(`areas-${this.id}`,{},this.id);this.layers.set(VS,new Ii(this.renderer,i.id.toString()));let a=this.renderer.addGeometryGroup(`Areas-${this.id}`,{features:this.areas.features},{color:q4.color},i);for(let l of this.areas.features||[])this.renderer.setState(l.properties.id,{...q4,visible:!1});this.layers.get(VS).layers.set(a.id.toString(),a.id.toString())}return this.multiFloorView?.enabled&&this.renderer.setState(this.id,{altitude:this.elevation*this.multiFloorView.floorGap}),this.renderer.render(),this});this.mapObject=o,this.renderer=o.renderer,this.id=t.id,this.options=i;let p=this.renderer.addGroupContainer(this.id,{visible:!1,interactive:!0,preloadGeometry:i.preloadFloors?.map(u=>u.id).includes(t.id)},r);this.containerId=p.id.toString(),this.externalId=t.externalId,this.metadata=t.metadata,this.shortName=t.shortName,this.subtitle=t.subtitle,this.name=t.name,this.elevation=t.elevation,a!=null&&l!=null&&(this.styleMap=l,this.spaces=a.space[this.id],this.entrances=a.entrance[this.id],this.areas=a.area?.[this.id],this.obstructions=a.obstruction[this.id],this.floorImages=a.floorImages?.[this.id],this.floorText=a.enterprise?.floorText?.[this.id],this.footprint=a["floor.geojson"]?.features.find(u=>u.properties.id===t.id)),this.floorStackId=r,this.multiFloorView=n,this.mapDataInternal=c}get geoJSONBoundingBox(){if(s(this,Kc))return s(this,Kc);if(!this.footprint){A.warn(`Attempting to get bounding box with no footprint for floor ${this.id}`);return}return w(this,Kc,g1(this.footprint)),s(this,Kc)}addOccluder(){let r=this.layers.get(al);if(r==null||r.containerId==null||this.footprint==null){A.warn(`Tried to add occluder to floor ${this.id} but the floor does not have an occlusion layer.`);return}this.occluderId=this.renderer.addOccluder(this.footprint,r.containerId)}get hasFacadeGeometry(){return this.facadesByStyleId.size>0}get visible(){return this.renderer.getState(this.containerId).visible}setVisible(r){this.renderer.setState(this.containerId,{visible:r})}};Kc=new WeakMap;d();var Gu,$h=class{constructor(r,t,o,n){m(this,"id");m(this,"externalId");m(this,"name");m(this,"type");m(this,"floorIds");m(this,"defaultFloorId");m(this,"floorObjects",[]);m(this,"floorObjectsByElevation",new Map);m(this,"metadata");m(this,"containerId");m(this,"facade");m(this,"renderer");S(this,Gu);this.id=r.id,this.externalId=r.externalId,this.name=r.name,this.type=r.type,this.metadata=r.metadata,this.floorIds=r.floors??r.maps,this.defaultFloorId=r.defaultFloor,this.renderer=o;let i=o.addGroupContainer(this.id,{visible:!0,interactive:!0},t);this.containerId=i.id.toString(),this.facade=n}get defaultFloor(){if(s(this,Gu)==null){if(this.floorObjects.length===0)throw new wr(`No floors in floor stack (${this.id}). Could not get default floor.`);let r;this.defaultFloorId&&(r=this.floorObjects.find(t=>t.id===this.defaultFloorId)),r||(r=this.floorObjects.reduce((t,o)=>Math.abs(o.elevation)<Math.abs(t.elevation)?o:t)),w(this,Gu,r)}return s(this,Gu)}get isOutdoors(){return this.type?.toLowerCase()==="outdoor"?!0:this.facade!=null?!1:this.floorObjects.some(t=>t.hasFacadeGeometry)}addFloor(r){if(this.floorObjectsByElevation.has(r.elevation)){A.error(`Floor with same elevation ${r.elevation} already exists in Stack (${this.id}). Floor (${r.id}) will not be added.`);return}this.floorObjects.push(r),this.floorObjectsByElevation.set(r.elevation,r),this.facade&&this.renderer.setState(r.containerId,{focusable:!0})}loadAllFloors(){for(let r of this.floorObjects)r.load(),!this.isOutdoors&&!r.hasFacadeGeometry&&r.footprint!=null&&r.addOccluder()}};Gu=new WeakMap;d();function pT(e,r,t,o){let n={outdoorOpacity:1,floorStates:[]},i=e.sort((u,f)=>u.elevation-f.elevation),a=Math.min(0,i[0].elevation),l=i[i.length-1].elevation,c,p;for(let u=a;u<=l;u++){let f=i.find(v=>v.elevation===u);if(f==null){u>=0&&(c==null?c=u:p=u);continue}let h=0,b=u<0?Math.abs(f.elevation)*t:t,x=!1;if(c===0&&p!=null){let v=t*p;h=-v,b=v,x=!0}else if(c!=null&&p!=null){let v=c,I=e.find(O=>O.elevation===v-1),M=n.floorStates.find(O=>O.floor===I);if(M){let O=t*(p-c+2);M.state.footprint={...M.state.footprint,altitude:0,height:O,visible:!0}}}c=void 0,p=void 0;let T={floor:f,state:{type:"floor",visible:!1,geometry:{visible:!1},labels:{enabled:!1},markers:{enabled:!1},footprint:{visible:!1},occlusion:{enabled:!1}}};n.floorStates.push(T),f.id===r.id?(T.state.visible=!0,T.state.geometry.visible=!0,T.state.labels.enabled=!0,T.state.markers.enabled=!0,T.state.occlusion.enabled=!0,(f.elevation<0||x)&&(f.elevation<0&&(n.outdoorOpacity=.2),T.state.footprint.height=b,T.state.footprint.altitude=h,T.state.footprint.visible=!0)):o.includes(f.id)&&f.elevation<r.elevation?(T.state.visible=!0,T.state.geometry.visible=!0,T.state.markers.enabled=!0,T.state.occlusion.enabled=!0,T.state.footprint.visible=!0,f.elevation<0?(T.state.footprint.height=b,T.state.footprint.altitude=h,n.outdoorOpacity=.2):(T.state.footprint.height=b,T.state.footprint.altitude=h)):r.elevation>0&&f.elevation<r.elevation&&f.elevation>=0&&(T.state.visible=!0,T.state.footprint.visible=!0,T.state.footprint.height=t,T.state.footprint.altitude=h)}return n}var fs,Hh=class extends ke{constructor(t,o,n,i){super();m(this,"floorStacksById",new Map);m(this,"floorsById",new Map);m(this,"startingFloorId","");m(this,"currentFloorId","");m(this,"currentFloorStackId","");m(this,"outdoorFloorStacks",new Set);m(this,"id");m(this,"renderer");m(this,"api");m(this,"mvf");m(this,"options",{});m(this,"styleMap");m(this,"animations",new Map);m(this,"Models",{add:(t,o,n)=>{let{floorId:i,scale:a,...l}=n,c=i?this.floorsById.get(i):this.currentFloor,p={...l};a!=null&&(p.scale=Array.isArray(n.scale)?n.scale:[n.scale,n.scale,n.scale]);let u=this.renderer.addModelGroup(t,{type:"FeatureCollection",features:o.map(f=>({type:"Feature",properties:{id:ut(),rotation:n.rotation,scale:p.scale,interactive:n.interactive,verticalOffset:f.verticalOffset+(n.verticalOffset??0)},geometry:{type:"Point",coordinates:Dn(f)}}))},p,{parent:c.id});if(u==null)throw new wr("error creating model");return this.renderer.getState(u).children},remove:(t,o)=>{this.renderer.remove(t),this.renderer.getState(o).children.length===0&&this.renderer.remove(o)}});m(this,"Image3D",{add:(t,o,n)=>{let{floorId:i,flipImageToFaceCamera:a,...l}=n,c=i?this.floorsById.get(i):this.currentFloor,p={type:"Feature",properties:l,geometry:{type:"Point",coordinates:t}};return this.renderer.addImage(n.id??ut(),p,{url:o,flipImageToFaceCamera:a??!1},c.id)},remove:t=>{this.renderer.remove(t)},removeAll:()=>{}});m(this,"Markers",{add:(t,o,n)=>{let i=s2(t,this.floorsById,this.api.mapObjects[0].floorsById.get("default-floor")),{attachTo:a,...l}=n,c=l;l.rank==="initial"&&(c.rank="medium");let p=i.layers.get(li),u=this.renderer.addMarker2D(Dn(t),o,{...c,occluderId:i?.occluderId,attachTo:a},p?.containerId);if(!u)throw new wr("Failed to create Marker");return u},remove:t=>{this.renderer.remove(t)},getContentEl:t=>{let o=this.renderer.getState(t);if(o?.type==="marker")return o.element},removeAll:()=>{},setPosition:(t,o,n)=>{let i=this.renderer.getState(t),a=n?this.floorsById.get(n):this.currentFloor;if(!i){A.error(`Failed to retrieve state for Marker with id "${t}".`);return}if(i.type!=="marker"){A.error(`Geometry with id "${t}" is not of type "marker".`);return}this.renderer.setState(i,{position:o,parent:a?.layers.get(li)?.containerId})},animateTo:(t,o,n,i)=>{let a=this.renderer.getState(t),l=n?this.floorsById.get(n):this.currentFloor;if(!a)return A.error(`Failed to retrieve state for Marker with id "${t}".`),Promise.resolve();if(a.type!=="marker")return A.error(`Geometry with id "${t}" is not of type "marker".`),Promise.resolve();let c={duration:1e3,easing:"ease-in-out",...i};this.cancelAnimation(t);let p=new ui({lon:a.position[0],lat:a.position[1]}).to({lon:o[0],lat:o[1]},c.duration).easing(ls[c.easing]).onUpdate(({lon:u,lat:f})=>{if(!this.renderer.getState(t))this.cancelAnimation(t);else{let b=l?.layers.get(li)?.containerId;b&&this.Markers.setPosition(t,[u,f],b)}}).start();return this.renderer.getInternalTweenGroup().add(p),this.renderer.render(),this.animations.set(t,p),i2(p).then(()=>{this.animations.delete(t)})}});m(this,"Exporter",{getCurrentSceneGLTF:async t=>this.renderer.getCurrentSceneGLTF(t)});m(this,"Shapes",{add:(t,o,n)=>{let i=n?.floorId?this.floorsById.get(n?.floorId):this.currentFloor,a="shape-"+ut();return this.renderer.addGeometryGroup(a,t,o,i.id),a},remove:t=>(this.renderer.remove(t.id),t.id)});m(this,"Text3D",{label:(t,o,n)=>{if(!this.api.getMapDataInternal()?.enterpriseMode){A.warn("Enterprise mode is not enabled, skipping label creation");return}let i=rk(this.renderer,t,o,n);if(i)return{textInfo:i,target:t}},labelAll:(t={})=>{if(!this.api.getMapDataInternal()?.enterpriseMode)return A.warn("Enterprise mode is not enabled, skipping label creation"),[];let o=this.api.getMapData();if(!o)return[];let n=[];return o.getByType("space").forEach(i=>{if(i.locations[0]){let a=rk(this.renderer,i,i.locations[0]?.name??i.name,t);a&&n.push({textInfo:a,target:i})}}),n},remove:t=>{if(!this.api.getMapDataInternal()?.enterpriseMode){A.warn("Remove text label only works in enterprise mode");return}return this.renderer.remove(t),t}});m(this,"Labels",{all:({onCreate:t,labelOptions:o={}})=>{for(let n of Object.entries(this.mvf.space)){let[i,a]=n;a&&a.features.forEach(l=>{let c=this.api.getMapData()?.getById("space",l.properties.id);if(!c)return;let p=this.styleMap[l.properties.id]?.showImage,u=l.properties.details?.images,h={icon:(p&&u?.[0]?.url?{icon:u[0].url}:{}).icon,...o.appearance},x=(i?this.floorsById.get(i):this.currentFloor).layers.get(rs);if(l.properties.center&&c.name!==""){let T=this.renderer.addLabel2D(l.properties.center,c.name,{id:l.properties.id+"-label",...o,appearance:h,rank:o.rank,attachTo:iu(c)},vr.is(c)?c.id:x?.containerId);T&&t(T.id,c.name,c)}})}},add:(t,o,n={})=>{let{attachTo:i,...a}=n,l=s2(t,this.floorsById,this.api.mapObjects[0].floorsById.get("default-floor")),c=l.layers.get(rs),p=this.renderer.addLabel2D(Dn(t),o,{...a,occluderId:l.occluderId,attachTo:i},c?.containerId);if(!p)throw new wr("label creating failed");return p},remove:({entityId:t})=>{this.renderer.remove(t)},removeAll:()=>{}});m(this,"Paths",{add:(t,o)=>{let n=o?.animateDrawing??!0,i=[],a=t[0].floorId||"root",l=0;for(let p of t){let{floorId:u="root",latitude:f,longitude:h}=p;u!==a&&(l++,a=u),i[l]==null&&i.push({floorId:u,coordinates:[]});let b=u===p.floorId?p:new fe({longitude:h,latitude:f,floorId:u});i[l].coordinates.push(b)}let c=i.reduce((p,{floorId:u,coordinates:f},h)=>{if(h!==0){let T=i[h-1],v=T.coordinates[T.coordinates.length-1],I=f[0],M=Dn(v),O=Dn(I),C=this.renderer.addPath({type:"FeatureCollection",features:[{type:"Feature",properties:{parentId:T.floorId},geometry:{type:"Point",coordinates:M}},{type:"Feature",properties:{parentId:u},geometry:{type:"Point",coordinates:O}}]},o,this.id);C&&(n&&this.renderer.setState(C.id,{completeFraction:0}),p.push({...C,coordinates:[v,I]}))}if(f.length<2)return p;let b=this.floorsById.get(u)?.layers.get(os)?.containerId,x=this.renderer.addPath({type:"FeatureCollection",features:f.map(T=>({type:"Feature",properties:{},geometry:{type:"Point",coordinates:Dn(T)}}))},o,b??u);return x&&(n&&this.renderer.setState(x.id,{completeFraction:0}),p.push({...x,coordinates:f})),p},[]);if(n){let p=[],u=this.api.getMapData();return c.forEach(f=>{let h=z5(f,u,this.api);p.push(new ui({fraction:0}).to({fraction:1},h?o?.drawDuration??1500:0).onUpdate(b=>{this.renderer.setState(f.id,{completeFraction:b.fraction})}))}),p.forEach((f,h)=>{h<p.length-1&&f.chain(p[h+1]),this.renderer.getInternalTweenGroup().add(f)}),p[0].start(),this.renderer.render(),this.animations.set(c[0].id.toString(),p[0]),{paths:c,animation:i2(p[p.length-1]).then(()=>{this.animations.delete(c[0].id.toString())})}}else return{paths:c,animation:Promise.resolve()}},remove:t=>{t.forEach(o=>{this.cancelAnimation(o),this.renderer.remove(o)})}});S(this,fs,{enabled:!1,floorGap:10,updateCameraElevationOnFloorChange:!0});this.renderer=i.core,this.api=i,this.id=t,this.renderer.addGroupContainer(t,{},"root"),this.options=n??{},this.mvf=o?.mvf??{};let a=V5(this.mvf["styles.json"]||{});if(this.styleMap=a,w(this,fs,{enabled:!1,floorGap:10,updateCameraElevationOnFloorChange:!0,...n?.multiFloorView}),!o){this.id!=="outdoors-container"&&A.warn(`Map (${this.id}) created with no data.`);let p=new $h({id:"default-stack",externalId:"default-stack",name:"Default Stack",maps:["default-floor"]},this.id,this.renderer);this.floorStacksById.set(p.id,p),this.currentFloorStackId=p.id;let u=new Vh(p.id,{id:"default-floor",externalId:"default-floor",name:"Default Floor",elevation:0},this,s(this,fs),n??{});this.floorsById.set(u.id,u),p.addFloor(u),this.setFloor(u.id);return}let l=o.getMVFFeatureByType("floor-stack");if(l==null||l.length===0)throw new wr("MVF does not contain any Floor Stacks.");for(let p of l){let u=new $h(p,this.id,this.renderer,this.mvf.facade?.[p.id]);if(u.floorIds.length!==0){for(let f of u.floorIds){let h=o.getMVFFeatureById("floor",f);if(h!=null){let b=this.mvf.space[h.id],x=this.mvf.obstruction[h.id];if((b==null||b.features.length===0)&&(x==null||x.features.length===0))continue;let T=new Vh(u.id,h,this,s(this,fs),n??{},this.mvf,a,o);this.floorsById.set(T.id,T),u.addFloor(T)}}this.floorStacksById.set(p.id,u),this.currentFloorStackId||(this.currentFloorStackId=p.id)}}for(let[p]of Object.entries(o.facadesBySpaceId)){let u=o.getById("space",p);u&&(this.outdoorFloorStacks.add(u.floor.floorStack.id),this.floorsById.get(u.floor.id)?.setVisible(!0))}let c=this.mvf.enterprise?.venue.defaultMap;if(n?.initialFloor){let p=yf(n.initialFloor);p&&this.floorsById.has(p)?c=p:A.error(`Invalid initial floor specified (${n.initialFloor}), using default behavior instead`)}c||(c=this.currentFloorStack.defaultFloor.id),this.startingFloorId=c}get currentFloorStack(){let t=this.floorStacksById.get(this.currentFloorStackId);if(!t)throw new wr(`Current floor stack with id "${this.currentFloorStackId}" not found`);return t}setFloorStack(t,o){if(this.currentFloorStackId===t)return;let n=this.floorStacksById.get(t);if(n==null){A.error(`Invalid floor stack passed to setFloorStack (${t}), the floor stack was not changed. Current floor stack is still ${this.currentFloorStack.id}.`);return}if(n.floorObjects.length===0){A.error(`Floor stack (${t}) has no floors. The floor stack was not changed. Current floor stack is still ${this.currentFloorStack.id}.`);return}this.setFloor(n.defaultFloor.id,o)}get currentFloor(){let t=this.floorsById.get(this.currentFloorId);if(!t)throw new wr(`Floor with id "${this.currentFloorId}" not found`);return t}get floors(){return Array.from(this.floorsById.values())}processFloorChange(t){if(this.api.manualFloorVisibility===!0)return;let o=this.api.getMapDataInternal()?.getById("floor",t),n=this.api.getMapDataInternal()?.getById("floor-stack",this.currentFloorStackId);if(o&&n)if(!s(this,fs)?.enabled||o.floorStack.id!==n?.id)for(let i of this.floorStacksById.values())i.floorObjects.forEach(a=>{a.id!==t&&a.setVisible(!1)});else{let i=pT(n.floors,o,s(this,fs).floorGap,this.api.Navigation?.floors?.map(a=>a.id)||[]);this.api?.Outdoor?.setOpacity(i.outdoorOpacity),i.floorStates.forEach(a=>{if(a.floor){let l=this.api.getMapData()?.getById("floor",a.floor.id);l&&this.api.updateState(l,a.state)}}),s(this,fs).updateCameraElevationOnFloorChange&&this.api.Camera.setElevation(o.elevation*s(this,fs).floorGap)}}setFloor(t,o){if(this.currentFloorId===t)return;if(!this.floorsById.get(t)){A.error(`Invalid floor passed to setFloor (${t}), the floor was not changed. Current floor is still ${this.currentFloor.id}`);return}let i=this.currentFloorId;this.publish("floor-change-start",{previousFloorId:i,floorId:t,reason:o}),this.currentFloorStack&&this.processFloorChange(t),this.currentFloorId=t,this.currentFloorStackId=this.currentFloor.floorStackId,this.currentFloor.setVisible(!0),this.updatePathLayersVisibility(),this.publish("floor-change",{reason:o,floorId:this.currentFloor.id,previousFloorId:i})}updatePathLayersVisibility(){let t=this.api.hidePathsNotOnCurrentFloor===!0&&!this.options.multiFloorView?.enabled;for(let o of this.floorsById.values()){let n=o.layers.get(os);if(!n)continue;let i=!t||o.id===this.currentFloor.id;n.setVisible(i)}}cancelAnimation(t){let o=this.animations.get(t);o&&(o.stop(),this.animations.delete(t),this.renderer.getInternalTweenGroup().remove(o))}loadAllFloors(){for(let t of this.floorStacksById.values())t.loadAllFloors()}};fs=new WeakMap;function rk(e,r,t,o){return e.labelText3D(r.id,t??r.name,{...o,parentId:r.floor.id})}d();var Gn,Wh,zh=class{constructor({currentMapGetter:r}){S(this,Gn,new Map);S(this,Wh);w(this,Wh,r)}get currentMap(){return s(this,Wh).call(this)}getAll(){return Array.from(s(this,Gn).values()).map(({marker:r})=>r)}getById(r){return s(this,Gn).get(r)}add(r,t,o){let n=r.anchorTarget;if(!n)throw new Error("get coordinate failed");let i=this.currentMap;if(!i)throw new Error("currentMap should exist");let a=i.Markers.add(n,t,{...o,rank:o?.rank||"medium",dynamicResize:o?.dynamicResize??!0,attachTo:iu(r)});if(a==null)throw new Error("error creating marker");let l=i.Markers.getContentEl(a.id.toString());if(!l)throw new Error("marker component should exist");let c=new us(a.id.toString(),l,r);return s(this,Gn).set(c.id,{marker:c,entityId:a.id.toString()}),c}remove(r){let t=s(this,Gn).get(r.id);t&&(this.currentMap?.Markers.remove(t.entityId),s(this,Gn).delete(r.id.toString()))}removeAll(){let r=[];return s(this,Gn).forEach(({marker:t})=>{this.remove(t),r.push(t),s(this,Gn).delete(t.id.toString())}),r}setPosition(r,t){let o=t.anchorTarget;if(!o){A.error("Cannot determine coordinate from target.");return}let n=this.currentMap;if(!n){A.error("Cannot determine the current map.");return}let i=s(this,Gn).get(r.id);if(!i){A.error(`Cannot find the Marker with id "${r.id}".`);return}n.Markers.setPosition(i.entityId,Dn(o),o.floorId??n.currentFloorId),i.marker.updateTarget(t)}animateTo(r,t,o){let n=t.anchorTarget;if(!n)return A.error("Cannot determine coordinate from target."),Promise.resolve();let i=this.currentMap;if(!i)return A.error("Cannot determine the current map."),Promise.resolve();let a=s(this,Gn).get(r.id);return a?(a.marker.updateTarget(t),i.Markers.animateTo(a.entityId,Dn(n),n.floorId??i.currentFloorId,o)):(A.error(`Cannot find the Marker with id "${r.id}".`),Promise.resolve())}};Gn=new WeakMap,Wh=new WeakMap;d();var xa,Xh,Zh=class{constructor({currentMapGetter:r}){S(this,xa,new Map);S(this,Xh);w(this,Xh,r)}get currentMap(){return s(this,Xh).call(this)}getById(r){return s(this,xa).get(r)}add(r,t,o){let n=r.anchorTarget;if(!n)throw new Error("Target does not implement IAnchorable.");let i=this.currentMap;if(!i)throw new Error("currentMap should exist");let a=i.Image3D.add(Dn(n),t,{...o,floorId:n.floorId,verticalOffset:n.verticalOffset+(o.verticalOffset??0)});if(!a)throw new Error("image component should exist");let l=new Wc(a.id.toString(),t,r);return s(this,xa).set(l.id,{image:l,entityId:a.id.toString()}),l}remove(r){let t=s(this,xa).get(r.id);t&&(this.currentMap?.Image3D.remove(t.entityId),s(this,xa).delete(r.id.toString()))}removeAll(){let r=[];return s(this,xa).forEach(({image:t})=>{this.remove(t),r.push(t),s(this,xa).delete(t.id.toString())}),r}};xa=new WeakMap,Xh=new WeakMap;d();var hs,Jh,Yh=class{constructor({currentMapGetter:r}){S(this,hs,new Map);S(this,Jh);w(this,Jh,r)}get currentMap(){return s(this,Jh).call(this)}getById(r){return s(this,hs).get(r)}add(r,t,o){let n=[r],i=n.reduce((c,p)=>p?(c.has(p.floorId)||c.set(p.floorId,[]),c.get(p.floorId)?.push(p),c):(A.error("Cannot determine coordinate from options."),c),new Map);if(!n.length)throw new Error("targets should not be empty when adding a model");let a=this.currentMap;if(!a)throw new Error("currentMap should exist");let l=[];return i.forEach((c,p)=>{let u=ut();a.Models.add(u,c,{...o,url:t,floorId:p}).forEach(h=>{let b=new Xc(h.toString(),u,c[0]);s(this,hs).set(b.id,{model:b,entityId:h.toString(),groupId:u}),l.push(b)})}),l[0]}remove(r){let t=s(this,hs).get(r.id);t&&(this.currentMap?.Models.remove(t.entityId,t.groupId),s(this,hs).delete(r.id.toString()))}removeAll(){let r=[];return s(this,hs).forEach(({model:t})=>{let o=s(this,hs).get(t.id);o&&(r.push(t),this.currentMap?.Models.remove(o.entityId,o.groupId),s(this,hs).delete(t.id.toString()))}),r}};hs=new WeakMap,Jh=new WeakMap;d();var gs,Qh,Kh=class{constructor({currentMapGetter:r}){S(this,gs,new Map);S(this,Qh);w(this,Qh,r)}get currentMap(){return s(this,Qh).call(this)}getById(r){return s(this,gs).get(r)}add(r,t){let o=this.currentMap;if(!o)throw new Error("currentMap should exist");let n=o.Paths.add(r,t),i=n.paths.map(l=>l.id.toString()),a=new Bn(ut(),n.animation,r,n.paths);for(let l of i)s(this,gs).set(l,{path:a,entityIds:i});return s(this,gs).set(a.id,{path:a,entityIds:i}),a}remove(r){let t=s(this,gs).get(r.id);t&&(this.currentMap?.Paths.remove(t.entityIds),s(this,gs).delete(r.id),t.entityIds.forEach(o=>s(this,gs).delete(o)))}removeAll(){let r=[];return s(this,gs).forEach(({path:t})=>{this.remove(t),r.push(t)}),r}};gs=new WeakMap,Qh=new WeakMap;d();d();var Wk=hp(Ak(),1),Zk=hp(VC(),1);d();var ng="blue-dot",Lk="blue-dot-accuracy-ring";var ST="#2266ff",dZ="#808080",_k="#f5f5f5";var Rk={radius:10,color:ST,inactiveColor:dZ,heading:{color:ST,opacity:.7,displayWhenInactive:!1},accuracyRing:{color:ST,opacity:.3},timeout:3e4,watchDevicePosition:!0,debug:!1,accuracyThreshold:50,initialState:"hidden"};d();var Bk="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAkklEQVRoge3awQ3AIAxD0VAMYf+F0yUixbL8JshXuLSwIqJCwDc9QBeZEOy9p2doAQDTM7TQ2cg5Z3qGFjpHS2YjDiGDe+/0DC0cwkYpJKdnaIFMkY1kymzEIVQcwsYhbPDem56hhc5GHELGIWwcwsYhbJS+2R1CxSFsdH5iO4SMr97Y6FxPqxytVVV+HcTEIWx+9mcIqHSOm9QAAAAASUVORK5CYII=";d();var Nk=(e,r,t=0)=>{if(Math.abs(e)>=Math.PI)throw new Error("Sector angle too wide!");let o=t/Math.tan(e/2),n=t/Math.sin(e/2),i=n+r,a=10,l=new Na;l.moveTo(-n*Math.sin(e/2),n*Math.cos(e/2)-o);for(let c=0;c<a;c++)l.lineTo(-(i*Math.sin(e/2-e/a*c)),i*Math.cos(e/2-e/a*c)-o);for(let c=0;c<a;c++)l.lineTo(-(t*Math.sin(Math.PI/-2+Math.PI/a*c)),t*Math.cos(Math.PI/-2+Math.PI/a*c));return new ja(l,{depth:.1,bevelEnabled:!1,UVGenerator:mZ(r)})},TT=(e,r,t)=>{let n=Math.sqrt(Math.pow(e,2)+Math.pow(r,2))/t;return n>1?n=1:n<0&&(n=0),new Me(0,n)},mZ=e=>({generateTopUV:(r,t,o,n,i)=>{let a=t[o*3],l=t[o*3+1],c=t[n*3],p=t[n*3+1],u=t[i*3],f=t[i*3+1];return[TT(a,l,e),TT(c,p,e),TT(u,f,e)]},generateSideWallUV:()=>[new Me(0,1),new Me(0,1),new Me(0,1),new Me(0,1)]});function jk(e,r){if(r==null)return e;let t={latitude:e?.latitude,longitude:e?.longitude,accuracy:e?.accuracy,floor:e?.floor,heading:e?.heading,timestamp:e?.timestamp};return"latitude"in r&&(t.latitude=r?.latitude==null||r.latitude==="device"?e?.latitude:r.latitude),"longitude"in r&&(t.longitude=r.longitude==null||r.longitude==="device"?e?.longitude:r.longitude),"accuracy"in r&&(t.accuracy=r.accuracy==="device"?e?.accuracy:r.accuracy),"floor"in r&&(t.floor=r.floor==="device"?e?.floor:r.floor),"heading"in r&&(t.heading=r.heading==="device"?e?.heading:r.heading),"timestamp"in r&&(t.timestamp=r.timestamp),t}function fZ([e,r],[t,o],[n,i]){let a=t-e,l=o-r,c=a**2+l**2;if(c===0)return;let p=((n-e)*a+(i-r)*l)/c,u;p<=0?u=[e,r]:p>=1?u=[t,o]:u=[e+p*a,r+p*l];let f=ry([n,i],u);return{proportion:Math.max(0,Math.min(1,p)),intersection:u,distance:f}}function Gk(e,r){if(e==null||e.length<2)return;let t=Number.MAX_SAFE_INTEGER,o,n=0,i=0;for(let a=0;a<e.length-1;a++){let l=e[a],c=e[a+1],p=fZ(l,c,r);p!=null&&p.distance<t&&(t=p.distance,o=p.intersection,n=a,i=p.proportion)}if(o)return{intersection:o,distance:t,segmentIndex:n,proportion:i}}function Uk(e,r){let t=new Ei({color:e,opacity:r,transparent:!0,depthTest:!1,depthWrite:!1}),o=.35,n=.35*4,i=Nk(Math.PI/6,n,o);new bp().load(Bk,l=>{t.alphaMap=l,t.needsUpdate=!0});let a=new Le(i,t);return a.position.z=-.05,a.renderOrder=0,a}function Vk(e,r){let t=new Qg(1,1,.05,32),o=new Ei({transparent:!0,color:e,opacity:r,depthTest:!1,depthWrite:!1}),n=new Le(t,o);return n.scale.set(0,0,.05),n.renderOrder=1,n.rotation.x=Math.PI/2,n}function $k(e){let r=new Qg(.35,.35,.07,32),t=new Ei({transparent:!0,color:_k,depthTest:!1,depthWrite:!1}),o=new Le(r,t);o.renderOrder=2;let n=new Qg(.35*.8,.35*.8,.01,32),i=new Ei({transparent:!0,color:e,depthTest:!1,depthWrite:!1}),a=new Le(n,i);return a.renderOrder=3,o.rotation.x=Math.PI/2,o.position.z=.07/2,a.rotation.x=Math.PI/2,a.position.z=.07,{outerMesh:o,innerMesh:a}}var Xk=hp(Hk(),1);var Re,Rr,ep,ys,cn,Cr,Ta,tp,rp,op,st,Ho,ig,Ca,Et,sg,ag,zu,Jx,Kx,Qx,lg,qx,cg,e0,pg,t0,Si,Ma,Wu,r0,kl,Zu,bs,dg,o0,n0,Xu=class extends ke{constructor(t,o){super();S(this,Re);S(this,Rr);S(this,ep,null);m(this,"primaryGeometry");m(this,"secondaryGeometry");S(this,ys);S(this,cn);S(this,Cr);S(this,Ta);S(this,tp);S(this,rp);S(this,op);S(this,st,Rk);S(this,Ho,1);S(this,ig);S(this,Ca);S(this,Et,new Yx);m(this,"bounds");m(this,"state","disabled");m(this,"following",!1);S(this,sg,t=>s(this,Rr).getMapData()?.getById("floor",t));S(this,ag,t=>{let o;if(t!=null){let n=s(this,Rr).currentMap?.currentFloorStack.floorObjectsByElevation.get(t);o=n?s(this,sg).call(this,n.id):void 0}return o});S(this,zu,()=>this.state!=="hidden"&&this.state!=="disabled");S(this,Jx,(t,o)=>{s(this,t0).call(this),t.scale.set(s(this,Ho),s(this,Ho),s(this,Ho)),t.position.z=.07/2*s(this,Ho),o.scale.set(s(this,Ho),s(this,Ho),s(this,Ho)),o.position.z=.07*s(this,Ho),this.state==="active"?o.material.color.set(s(this,st).color):this.state==="inactive"&&o.material.color.set(s(this,st).inactiveColor)});S(this,Kx,t=>{let o=this.heading;if(o!=null){t.visible=!0,s(this,op)&&s(this,op).stop();let{start:n,end:i}=oy(t.rotation.z,-Ue.degToRad(o));w(this,op,new ui({rotation:n}).to({rotation:i},150).onUpdate(({rotation:l})=>{t.rotation.z=l}).start()),s(this,Re).getInternalTweenGroup().add(s(this,op)),t.scale.set(s(this,Ho),s(this,Ho),1);let a=this.state==="inactive"?s(this,st).inactiveColor:s(this,st).heading.color;t.material.color.set(a)}else t.visible=!1});S(this,Qx,(t,o)=>{if(this.state==="active"){let i=this.accuracy;i!=null?(t.visible=!0,s(this,rp)&&s(this,rp).stop(),w(this,rp,new ui({scale:t.scale.x}).to({scale:i/2},150).onUpdate(({scale:a})=>{t.scale.set(a,1,a)}).start()),s(this,Re).getInternalTweenGroup().add(s(this,rp))):t.visible=!1}else t.visible=!1;this.state==="active"||this.state==="inactive"&&s(this,st).heading.displayWhenInactive?s(this,Kx).call(this,o):o.visible=!1});S(this,lg,t=>{if(!s(this,zu).call(this))return;let[o,n]=t.children;!o||!n||s(this,Jx).call(this,o,n)});S(this,qx,t=>{if(!s(this,zu).call(this))return;let[,,o,n]=t.children;!o||!n||s(this,Qx).call(this,o,n)});S(this,cg,(t,o)=>{let n;try{n=xZ.parse(jk(t,s(this,cn)))}catch(l){s(this,Si).call(this,"error"),A.error("BlueDot: Position parse failed",l instanceof F.ZodError?l.message:String(l));return}s(this,st).debug&&A.log("BlueDot: Parsed position",n);let{min:i,max:a}=this.bounds||{};if(i!=null&&a!=null&&isFinite(i.x)&&isFinite(i.y)&&isFinite(a.x)&&isFinite(a.y)){let l=s(this,Re).convertTo3DMapPosition(n.latitude,n.longitude,0);if(!(l.x>=i.x&&l.x<=a.x&&l.y>=i.y&&l.y<=a.y)){A.warn(`BlueDot: Position [${n.longitude}, ${n.latitude}] is outside map bounds. Position update will be discarded.`);return}}if(s(this,o0).call(this,n.accuracy)){if(o?.silent||s(this,Si).call(this,"position-update"),!s(this,zu).call(this)){A.warn(`BlueDot: Cannot update position because BlueDot state is '${this.state}'. BlueDot must be enabled first.`);return}s(this,e0).call(this,n,o)}});S(this,e0,(t,o)=>{w(this,Cr,t),o?.silent||(s(this,pg).call(this),s(this,Rr).getMapDataInternal()?.Analytics.updateState({userPosition:{bluedotTimestamp:Date.now(),latitude:t.latitude,longitude:t.longitude,floorLevel:t.floor?.elevation,accuracy:t.accuracy}}));let n,i=0;if(!this.primaryGeometry)n=[t.longitude,t.latitude,0],i=t.floor?.id?s(this,Re).getState(t.floor?.id).altitude:0,s(this,Et).matrixAutoUpdate=!1,s(this,Et).userData.floorId=t.floor?.id,this.primaryGeometry=s(this,Re).addCustomGeometry(ng,{type:"Feature",properties:{},geometry:{type:"Point",coordinates:n}},{setup:c=>{let p=this.state==="inactive"?s(this,st).inactiveColor:s(this,st).color,{outerMesh:u,innerMesh:f}=$k(p);s(this,Et).add(u),s(this,Et).add(f),c.add(s(this,Et));let h=s(this,Et).userData.floorId?s(this,Re).getState(s(this,Et).userData.floorId):void 0;h?.altitude!=null?s(this,Et).matrix.elements[14]=h?.altitude:s(this,Et).matrix.identity(),s(this,lg).call(this,s(this,Et))},update:()=>{let c=s(this,Et).userData.floorId?s(this,Re).getState(s(this,Et).userData.floorId):void 0;c?.altitude!=null?s(this,Et).matrix.elements[14]=c?.altitude:s(this,Et).matrix.identity(),s(this,lg).call(this,s(this,Et))}},{visible:!0,interactive:!0}),this.secondaryGeometry=s(this,Re).addCustomGeometry(Lk,{type:"Feature",properties:{},geometry:{type:"Point",coordinates:n}},{setup:()=>{let c=Vk(s(this,st).accuracyRing.color,s(this,st).accuracyRing.opacity),p=Uk(s(this,st).heading.color,s(this,st).heading.opacity);s(this,Et).add(c),s(this,Et).add(p),p.visible=!1,c.visible=!1},update:()=>{s(this,qx).call(this,s(this,Et))}},{visible:!0,interactive:!1});else{let c=s(this,Re).getState(this.primaryGeometry);if(n=[c.position[0],c.position[1],0],s(this,Et).userData.floorId){let p=s(this,Re).getState(s(this,Et).userData.floorId);i=(c.position[2]??0)+(p?.altitude??0)}}if(s(this,tp)&&s(this,tp).stop(),s(this,Et).userData.floorId!==t.floor?.id){let c=t.floor?.id?s(this,Re).getState(t.floor?.id).altitude:0,p=i;s(this,Et).userData.floorId=t.floor?.id,n[2]=p-c}let a=[t.longitude,t.latitude,0],l=c=>{let p={position:c};this.primaryGeometry&&this.secondaryGeometry&&s(this,Re).setState(this.primaryGeometry,p),this.secondaryGeometry&&s(this,Re).setState(this.secondaryGeometry,p)};o?.animate===!1?l(a):(w(this,tp,new ui(n).to(a,1e3).easing(Vo.Cubic.Out).onUpdate(l).start()),s(this,Re).getInternalTweenGroup().add(s(this,tp))),o?.silent||this.publish("blue-dot-position-update",{floor:this.floor,heading:this.heading,accuracy:this.accuracy,coordinate:this.coordinate}),s(this,Re).render()});m(this,"onPositionUpdate",t=>{if(this.state==="disabled")return;try{bZ.parse(t)}catch(n){s(this,Si).call(this,"error"),A.error("BlueDot: Browser sent invalid position",n instanceof F.ZodError?n.message:String(n));return}w(this,ys,{latitude:t.coords?.latitude,longitude:t.coords?.longitude,accuracy:t.coords?.accuracy,heading:t.coords?.heading,floor:s(this,ag).call(this,t.coords?.floorLevel),timestamp:t.timestamp});let o=s(this,ys);if(s(this,Wu)){let n=s(this,n0).call(this,s(this,ys));if(n===void 0){s(this,st).debug&&A.log("BlueDot: Position update discarded by position processor");return}o=n}s(this,cg).call(this,o)});m(this,"onPositionError",t=>{switch(s(this,Si).call(this,"error"),t.code){case t.PERMISSION_DENIED:A.error("Geolocation permission denied by the user.",t),s(this,Rr).getMapDataInternal()?.Analytics.sendWatchPositionDenied();break;case t.POSITION_UNAVAILABLE:A.error("Geolocation position unavailable.",t);break;case t.TIMEOUT:A.error("Geolocation request timed out.",t);break;default:A.error("An unknown geolocation error occurred.",t);break}this.publish("blue-dot-position-error",t)});S(this,pg,()=>{s(this,Ta)&&clearTimeout(s(this,Ta)),typeof s(this,st).timeout=="number"&&s(this,st).timeout<1/0&&w(this,Ta,setTimeout(()=>{s(this,st).debug&&A.log(`BlueDot: Position timed out after ${s(this,st).timeout}ms`),s(this,Si).call(this,"timeout"),s(this,Re).render()},s(this,st).timeout))});S(this,t0,()=>{let t=Math.round(s(this,Re).camera.zoomLevel*1e5);if(t!==s(this,ig)){w(this,ig,t);let o=s(this,Re).getMetresPerPixel()??1;w(this,Ho,Math.max(s(this,st).radius/(.35/o),1))}});S(this,Si,t=>{let o=yZ[this.state].actions[t];if(o){switch(s(this,st).debug&&A.log(`BlueDot: Transitioning from ${this.state} to ${o} using ${t}`),o){case"hidden":case"disabled":this.primaryGeometry&&s(this,Re).setState(this.primaryGeometry,{visible:!1}),this.secondaryGeometry&&s(this,Re).setState(this.secondaryGeometry,{visible:!1});break;case"active":case"inactive":this.primaryGeometry&&s(this,Re).setState(this.primaryGeometry,{visible:!0}),this.secondaryGeometry&&s(this,Re).setState(this.secondaryGeometry,{visible:!0});break}this.state!==o&&(this.state=o,this.publish("blue-dot-state-change",{state:o,action:t}))}else A.warn(`BlueDot: Invalid state transition from ${this.state} to ${o} using ${t}`)});S(this,Ma);S(this,Wu);S(this,r0,()=>{if(s(this,Ma)==null&&s(this,Rr).Navigation.activeDirections!=null){let o=(Array.isArray(s(this,Rr).Navigation.activeDirections)?s(this,Rr).Navigation.activeDirections.flatMap(n=>n.coordinates):s(this,Rr).Navigation.activeDirections.coordinates).filter(n=>n.floorId===s(this,Rr).currentFloor.id);w(this,Ma,(0,Xk.default)(o.map(n=>({x:n.longitude,y:n.latitude})),1e-5).map(n=>[n.x,n.y]))}return s(this,Ma)});S(this,kl,()=>{s(this,Re).camera.isAnimating&&s(this,Re).camera.cancelAnimation(),s(this,bs)&&(this.off("blue-dot-position-update",s(this,bs)),w(this,bs,void 0)),this.following=!1,w(this,Ma,void 0),s(this,Re).off("user-interaction-start",s(this,kl)),s(this,Rr).off("navigation-active-path-change",s(this,Zu)),this.publish("blue-dot-follow-change",{following:!1})});S(this,Zu,()=>{w(this,Ma,void 0)});S(this,bs);m(this,"follow",(t,o)=>{if(t===!1){s(this,kl).call(this);return}t!=="position-only"&&o?.bearing!=null&&A.warn(`BlueDot: Camera bearing option will be ignored in follow mode '${t}'. To control the bearing manually, use mode 'position-only'.`);let n={zoomLevel:o?.zoomLevel??21,bearing:t==="position-only"?o?.bearing:void 0,pitch:o?.pitch??45,duration:o?.duration??1e3,easing:o?.easing??"ease-in-out"};this.following?s(this,bs)&&this.off("blue-dot-position-update",s(this,bs)):(this.following=!0,s(this,Re).on("user-interaction-start",s(this,kl)),s(this,Rr).on("navigation-active-path-change",s(this,Zu))),w(this,bs,i=>{let{coordinate:a,heading:l,floor:c}=i;if(n.center=[a.longitude,a.latitude],c!=null&&c.id!==s(this,Rr).currentFloor.id&&(s(this,Rr).currentMap.setFloor(c.id),w(this,Ma,void 0)),t==="position-and-heading")n.bearing=l??void 0;else if(t==="position-and-path-direction"){let p=s(this,r0).call(this);if(p!=null){let u=Gk(p,[a.longitude,a.latitude]);if(u!=null){let f=p[u.segmentIndex],h=p[u.segmentIndex+1];n.bearing=wC(f,h)}}}s(this,Re).camera.animateTo(n)}),this.on("blue-dot-position-update",s(this,bs)),this.publish("blue-dot-follow-change",{following:!0,mode:t})});S(this,dg,t=>{this.bounds=t});S(this,o0,t=>{if(t==null)return this.state!=="disabled";let o=t<=s(this,st).accuracyThreshold;return s(this,st).debug&&!o&&A.log(`BlueDot: Dropping position update with accuracy ${t}m (exceeds threshold ${s(this,st).accuracyThreshold}m)`),o});S(this,n0,t=>{let o={latitude:s(this,Cr)?.latitude,longitude:s(this,Cr)?.longitude,accuracy:s(this,Cr)?.accuracy,heading:s(this,Cr)?.heading,floor:s(this,Cr)?.floor,timestamp:s(this,Cr)?.timestamp};try{return s(this,Wu).call(this,o,t)}catch(n){return A.error("BlueDot: Position processor callback threw an error",n instanceof Error?n.message:String(n)),t}});w(this,Re,t),w(this,Rr,o)}get heading(){return s(this,Cr)?.heading}get accuracy(){return s(this,Cr)?.accuracy}get coordinate(){if(s(this,Cr)!=null)return(s(this,Ca)==null||this.floor?.id!==s(this,Ca).floorId||s(this,Cr).latitude!==s(this,Ca).latitude||s(this,Cr).longitude!==s(this,Ca).longitude)&&w(this,Ca,new fe(s(this,Cr).latitude,s(this,Cr).longitude,this.floor?.id)),s(this,Ca)}get floor(){return s(this,Cr)?.floor}enable(t){w(this,st,(0,Wk.default)({},t,s(this,st))),s(this,Si).call(this,"enable"),s(this,st).initialState==="inactive"&&s(this,Si).call(this,"initialize"),this.watchDevicePosition(s(this,st).watchDevicePosition),this.bounds||(this.bounds=s(this,Re).getSystems().cameraSystem.panBounds,s(this,Re).on("pan-bounds-change",s(this,dg)))}updateState(t){let o=s(this,st).watchDevicePosition;w(this,st,(0,Zk.default)({},s(this,st),t)),t.watchDevicePosition!=null&&t.watchDevicePosition!==o&&this.watchDevicePosition(t.watchDevicePosition),t.timeout!=null&&this.state==="active"&&s(this,pg).call(this),s(this,Re).render()}disable(){s(this,Re).remove(s(this,Et).id),w(this,Et,new Yx),this.primaryGeometry&&(s(this,Re).remove(this.primaryGeometry.id),this.primaryGeometry=void 0),this.secondaryGeometry&&(s(this,Re).remove(this.secondaryGeometry.id),this.secondaryGeometry=void 0),s(this,Ta)&&(clearTimeout(s(this,Ta)),w(this,Ta,void 0)),this.following&&s(this,kl).call(this),this.watchDevicePosition(!1),w(this,Cr,void 0),w(this,cn,void 0),s(this,Si).call(this,"disable"),s(this,Re).off("user-interaction-start",s(this,kl)),s(this,Rr).off("navigation-active-path-change",s(this,Zu)),s(this,Re).off("pan-bounds-change",s(this,dg))}watchDevicePosition(t){if(s(this,ep)&&(navigator.geolocation.clearWatch(s(this,ep)),w(this,ep,null)),s(this,ys)&&w(this,ys,void 0),t){if(this.state==="disabled"){A.warn("BlueDot must be enabled before watching browser position.");return}w(this,ep,navigator.geolocation.watchPosition(this.onPositionUpdate,this.onPositionError,{enableHighAccuracy:!0}))}}update(t,o){t==null?w(this,cn,void 0):"coords"in t?w(this,cn,Object.assign({},s(this,cn),{latitude:t.coords.latitude,longitude:t.coords.longitude,accuracy:t.coords.accuracy,heading:t.coords.heading,floor:s(this,ag).call(this,t.coords.floorLevel),timestamp:t.timestamp})):(w(this,cn,Object.assign({},s(this,cn),t)),"floorOrFloorId"in t&&(s(this,cn).floor=typeof t.floorOrFloorId=="string"&&t.floorOrFloorId!=="device"?s(this,sg).call(this,t.floorOrFloorId):t.floorOrFloorId)),(s(this,cn)?.latitude!=null&&s(this,cn)?.longitude!=null||s(this,ys)!=null)&&s(this,cg).call(this,s(this,ys),o)}setPositionProcessor(t){w(this,Wu,t)}};Re=new WeakMap,Rr=new WeakMap,ep=new WeakMap,ys=new WeakMap,cn=new WeakMap,Cr=new WeakMap,Ta=new WeakMap,tp=new WeakMap,rp=new WeakMap,op=new WeakMap,st=new WeakMap,Ho=new WeakMap,ig=new WeakMap,Ca=new WeakMap,Et=new WeakMap,sg=new WeakMap,ag=new WeakMap,zu=new WeakMap,Jx=new WeakMap,Kx=new WeakMap,Qx=new WeakMap,lg=new WeakMap,qx=new WeakMap,cg=new WeakMap,e0=new WeakMap,pg=new WeakMap,t0=new WeakMap,Si=new WeakMap,Ma=new WeakMap,Wu=new WeakMap,r0=new WeakMap,kl=new WeakMap,Zu=new WeakMap,bs=new WeakMap,dg=new WeakMap,o0=new WeakMap,n0=new WeakMap;var yZ={hidden:{actions:{enable:"hidden",error:"hidden","position-update":"active",initialize:"inactive",disable:"disabled",timeout:"hidden"}},active:{actions:{enable:"active",disable:"disabled","position-update":"active",error:"inactive",timeout:"inactive"}},inactive:{actions:{enable:"inactive",disable:"disabled","position-update":"active",error:"inactive",timeout:"inactive"}},disabled:{actions:{enable:"hidden",disable:"disabled"}}},bZ=F.object({coords:F.object({latitude:F.number(),longitude:F.number(),accuracy:F.number(),altitude:F.number().optional().nullable(),altitudeAccuracy:F.number().optional().nullable(),heading:F.number().optional().nullable(),speed:F.number().optional().nullable(),floorLevel:F.number().optional().nullable()}),timestamp:F.number()}),xZ=F.object({latitude:F.number(),longitude:F.number(),floor:F.custom().optional(),accuracy:F.number().optional(),heading:F.number().optional().nullable(),timestamp:F.number().optional()}),Yx=class extends ws{constructor(){super(...arguments);m(this,"children",[]);m(this,"userData",{})}};d();var wa,mg,ug=class{constructor({currentMapGetter:r}){S(this,wa,new Map);S(this,mg);w(this,mg,r)}get currentMap(){return s(this,mg).call(this)}getById(r){return s(this,wa).get(r)}add(r,t,o){let n=this.currentMap;if(!n)throw new Error("currentMap should exist");let i=n.Shapes.add(r,t||{},{floorId:o?.id}),a=new ha(i);return s(this,wa).set(a.id,a),a}remove(r){s(this,wa).get(r.id)&&(this.currentMap?.Shapes.remove(r),s(this,wa).delete(r.id.toString()))}removeAll(){let r=[];return s(this,wa).forEach(t=>{this.remove(t),r.push(t.id),s(this,wa).delete(t.id.toString())}),r}};wa=new WeakMap,mg=new WeakMap;d();var hg,fg=class{constructor({currentMapGetter:r}){S(this,hg);w(this,hg,r)}get currentMap(){return s(this,hg).call(this)}setFromStyleCollection(r){for(let t in r)for(let o of this.currentMap?.floors||[]){if(r[t]==null||!o.layers.has(rr))continue;let n=o.layers.get(rr);if(n?.layers.has(t)&&"color"in r[t]){let l=n.layers.get(t);l&&this.currentMap?.renderer.setState(l,{color:r[t].color})}if(n&&t===sl&&!(ts in r)){let l=n.layers.get(ts);l&&"color"in r[t]&&this.currentMap?.renderer.setState(l,{color:r[t].color})}if(!o.layers.has(fc))continue;let i=o.layers.get(fc),a=o.facadesByStyleId.get(t);if(a&&a.length>0)for(let l of a){let c=i.layers.get(`${l}-${t}`);c&&"color"in r[t]&&this.currentMap?.renderer.setState(c,{color:r[t].color})}}}};hg=new WeakMap;d();var CT={opacity:1},co,gg,yg,Al,Oa,np,MT,Yk,Yu=class{constructor(r,t){S(this,np);S(this,co);S(this,gg,[]);S(this,yg,{opacity:"initial"});S(this,Al,{opacity:new Map});S(this,Oa,new Set);w(this,co,r),w(this,gg,t||[]);let o=s(this,co).map;o&&o.on("idle",()=>{s(this,Al).opacity.size||W(this,np,MT).call(this,o)})}setStyle(r){if(s(this,co).map){s(this,co).map?.setStyle(r),s(this,Oa).size&&(s(this,Oa).clear(),this.hide()),W(this,np,Yk).call(this),W(this,np,MT).call(this,s(this,co).map),this.setOpacity(s(this,yg).opacity),s(this,co).map?.moveLayer(D0);for(let[t,o,n]of s(this,gg)||[])s(this,co).hideOutdoorLayersIntersectingPolygons(t,o,n)}}get map(){return s(this,co).map}get enabled(){return!!s(this,co).map}get visible(){return s(this,Oa).size===0}show(){let r=s(this,co).map;if(!r)return;let t=r.getStyle().layers;t&&(t.forEach(o=>{s(this,Oa).has(o.id)&&r.setLayoutProperty(o.id,"visibility","visible")}),s(this,Oa).clear())}hide(r=[]){let t=s(this,co).map;if(!t)return;let o=t.getStyle().layers;o&&o.forEach(n=>{let i=t.getLayoutProperty(n.id,"visibility");!r.includes(n.id)&&i!=="none"&&(t.setLayoutProperty(n.id,"visibility","none"),s(this,Oa).add(n.id))})}setOpacity(r,t=[]){let o=s(this,co).map;if(!o)return;let n=s(this,co).map?.getStyle?.()?.layers;n&&o.once("idle",()=>{n.forEach(i=>{let a=o.getLayoutProperty(i.id,"visibility");if(!t.includes(i.id)&&a!=="none")try{let l=s(this,Al).opacity.get(i.id);l!==void 0&&(i.id==="background"||(i.type==="symbol"?(o.setPaintProperty(i.id,"icon-opacity",r==="initial"?l[0]:r),o.setPaintProperty(i.id,"text-opacity",r==="initial"?l[1]:r)):o.setPaintProperty(i.id,`${i.type}-opacity`,r==="initial"?l[0]:r)),s(this,yg).opacity=r)}catch(l){A.warn("Error setting opacity:",l)}})})}};co=new WeakMap,gg=new WeakMap,yg=new WeakMap,Al=new WeakMap,Oa=new WeakMap,np=new WeakSet,MT=function(r){let t=r.getStyle().layers;t&&t.forEach(o=>{r.getLayoutProperty(o.id,"visibility")!=="none"&&(o.id==="background"||(o.type==="symbol"?s(this,Al).opacity.set(o.id,[r.getPaintProperty(o.id,"icon-opacity")??CT.opacity,r.getPaintProperty(o.id,"text-opacity")??CT.opacity]):s(this,Al).opacity.set(o.id,[r.getPaintProperty(o.id,`${o.type}-opacity`)??CT.opacity,void 0])))})},Yk=function(){Object.values(s(this,Al)).forEach(r=>r.clear())};d();function vZ(){B0(!1)}var Ea,Pa,Ll,bg=class{constructor({currentMapGetter:r}){S(this,Ea);S(this,Pa,new Map);S(this,Ll,new Map);w(this,Ea,r)}labelAll(r={}){let t=[],o=new Set;return s(this,Ea).call(this)?.Text3D.labelAll(r)?.forEach(({textInfo:n,target:i})=>{let a=n.id.toString(),l=s(this,Ll).get(a);if(l){o.has(a)||t.push(l.text3DView),o.add(a);return}o.add(a);let c=new El(a,i);s(this,Pa).set(c.id,{targetId:i.id,text3d:a,text3DView:c}),s(this,Ll).set(a,{text3DView:c}),t.push(c)}),t}label(r,t,o={}){if(s(this,Ea).call(this))if(vr.is(r)){let i=s(this,Ea).call(this)?.Text3D.label(r,t,o);if(!i)return;let a=i.textInfo.id.toString(),l=s(this,Ll).get(a);if(l)return l.text3DView;let c=new El(a,i.target);return s(this,Pa).set(c.id,{targetId:i.target.id,text3d:a,text3DView:c}),s(this,Ll).set(a,{text3DView:c}),c}else throw new Error("Non-space target is not supported")}remove(r){let t=typeof r=="string"?r:r.id,o=s(this,Pa).get(t);o&&(s(this,Ea).call(this)?.Text3D.remove(o.text3d),s(this,Pa).delete(t),s(this,Ll).delete(o.text3d))}removeAll(){s(this,Pa).forEach(r=>{s(this,Ea).call(this)?.Text3D.remove(r.text3d)}),s(this,Pa).clear()}};Ea=new WeakMap,Pa=new WeakMap,Ll=new WeakMap;d();d();d();function Jk(e){try{let r=e.shape;if("type"in r){let t=r.type;if(t instanceof F.ZodOptional&&(t=t._def.innerType),"value"in t)return String(t.value);if(t instanceof F.ZodDefault&&"value"in t._def.innerType)return String(t._def.innerType.value)}return"unknown"}catch{return"unknown"}}function Kk(e){if(e.success)return[];let r=e.error.flatten();return Object.keys(r.fieldErrors)}function Qk(e,r){e.length>0&&A.warn(`${e.length} invalid field(s) in ${r??"unknown"} state: ${e.join(", ")}`)}function Nt(e,r,t){if(r==null||typeof r!="object")return{};let o=e.partial().safeParse(r);if(o.success)return o.data;let n=Kk(o);t?.warn&&Qk(n,Jk(e));let i={};for(let a of Object.keys(r))!n.includes(a)&&a in e.shape&&(i[a]=r[a]);return i}function Br(e,r,t){let o=e.safeParse(r);if(o.success)return o.data;if(t?.warn===!0){let n=Kk(o);Qk(n,Jk(e))}return r}var qk="doors",ip=J.object({type:J.literal(qk).default(qk),color:J.string().default("#ffffff"),topColor:J.string().optional(),texture:J.object({url:J.string().optional()}).optional(),topTexture:J.object({url:J.string().optional()}).optional(),visible:J.boolean().default(!1),opacity:J.number().default(1)}),P_e=ip.partial(),F_e=ip.strict();function eA(e){let{color:r,topColor:t,texture:o,topTexture:n,visible:i,opacity:a}=e;return Br(ip,{visible:i,color:r,topColor:t,opacity:a,texture:o?{url:o}:void 0,topTexture:n?{url:n}:void 0})}function i0(e,r){let t={};return r==null||(e.color&&(e.color==="initial"?t.color=r.initialColor:t.color=e.color),e.topColor&&(e.topColor==="initial"?t.topColor=r.initialTopColor:t.topColor=e.topColor),e.visible!==void 0&&(t.visible=e.visible),e.texture?.url!==void 0&&(t.texture=e.texture.url),e.topTexture?.url!==void 0&&(t.topTexture=e.topTexture.url),e.opacity!==void 0&&(t.opacity=e.opacity)),t}d();var tA="facade",xg=F.object({type:F.literal(tA).default(tA),opacity:F.number().default(1),visible:F.boolean().default(!0)}),__e=xg.partial(),R_e=xg.strict();function rA(e){return Br(xg,{opacity:e.opacity,visible:e.visible})}d();var Fa="floor",oA=`${Fa}.footprint`,nA=`${Fa}.geometry`,iA=`${Fa}.labels`,sA=`${Fa}.markers`,aA=`${Fa}.images`,lA=`${Fa}.occlusion`,cA=`${Fa}.paths`,vg=F.object({type:F.literal(oA).default(oA),altitude:F.number().default(0),visible:F.boolean().default(!1),height:F.number().default(0),opacity:F.number().default(1),side:F.enum(["double","front","back"]),color:F.string().default("#ffffff")}),Ig=F.object({type:F.literal(nA).default(nA),opacity:F.number().default(1),visible:F.boolean().default(!0)}),Sg=F.object({type:F.literal(iA).default(iA),enabled:F.boolean().default(!0)}),Tg=F.object({type:F.literal(sA).default(sA),enabled:F.boolean().default(!0)}),Cg=F.object({type:F.literal(aA).default(aA),visible:F.boolean().default(!0)}),Mg=F.object({type:F.literal(lA).default(lA),enabled:F.boolean().default(!0)}),wg=F.object({type:F.literal(cA).default(cA),visible:F.boolean().default(!0)}),Og=F.object({type:F.literal(Fa).default(Fa),visible:F.boolean().default(!1),altitude:F.number().default(0)}),IZ=F.object({...Og.shape,geometry:Ig,labels:Sg,markers:Tg,images:Cg,footprint:vg,occlusion:Mg,paths:wg}),$_e=F.object({...Og.shape,geometry:Ig.partial(),labels:Sg.partial(),markers:Tg.partial(),images:Cg.partial(),footprint:vg.partial(),occlusion:Mg.partial(),paths:wg.partial()}).partial(),H_e=F.object({...Og.shape,geometry:Ig.strict(),labels:Sg.strict(),markers:Tg.strict(),images:Cg.strict(),footprint:vg.strict(),occlusion:Mg.strict(),paths:wg.strict()});function pA(e,r,t){if(!r){A.error("Floor is not defined. Cannot get floor state.");return}let o=r.layers.get(rr),n=o?t?.getState(o.containerId):void 0,i=r.layers.get(rs),a=r.layers.get(li),l=r.layers.get(Vd),c=l?t?.getState(l.containerId):void 0,p=r.layers.get(al),u=p?t?.getState(p.containerId):void 0,f=r.layers.get($d),h=f?t?.getState(f.containerId):void 0,b=r.layers.get(os),x=b?t?.getState(b.containerId):void 0;return Br(IZ,{geometry:{opacity:n?.opacity,visible:n?.visible},labels:{enabled:i?.visible},markers:{enabled:a?.visible},footprint:{altitude:c?.altitude,visible:c?.visible,height:c?.height,opacity:c?.opacity,side:c?.side,color:c?.color},images:{visible:h?.visible},occlusion:{enabled:u?.visible},paths:{visible:x?.visible},visible:e.visible,altitude:e.altitude})}d();var dA="geometry",Ju=F.object({type:F.literal(dA).default(dA),visible:F.boolean().default(!0),color:F.union([F.string(),F.literal("initial")]).default("#ffffff"),topColor:F.union([F.string(),F.literal("initial")]).optional(),hoverColor:F.union([F.string(),F.literal("initial")]).optional(),interactive:F.boolean().default(!1),opacity:F.number().default(1),height:F.number().default(0),altitude:F.number().default(0),texture:F.object({url:F.string()}).optional(),topTexture:F.object({url:F.string()}).optional(),flipImageToFaceCamera:F.boolean().default(!1),enableImageCollisions:F.boolean().default(!1),borderVisible:F.boolean().default(!1),borderColor:F.string().optional(),borderWidth:F.number().optional()}),Y_e=Ju.partial(),J_e=Ju.strict();function uA(e,r){let t=r?.altitude?e.altitude+r.altitude:e.altitude,{interactive:o,hoverColor:n,color:i,visible:a,opacity:l,height:c,texture:p,topTexture:u,flipImageToFaceCamera:f,enableImageCollisions:h,topColor:b,borderVisible:x,borderColor:T,borderWidth:v}=e;return Br(Ju,{interactive:o,hoverColor:n,color:i,visible:a,opacity:l,height:c,texture:p?{url:e.texture}:void 0,topTexture:u?{url:u}:void 0,flipImageToFaceCamera:f,enableImageCollisions:h,topColor:b,altitude:t,borderVisible:x,borderColor:T,borderWidth:v})}function mA(e,r,t){let o={};return r==null||(e.color&&(e.color==="initial"?o.color=r.initialColor:o.color=e.color),e.topColor&&(e.topColor==="initial"?o.topColor=r.initialTopColor:o.topColor=e.topColor),e.visible!==void 0&&(o.visible=e.visible),e.texture?.url!==void 0&&(o.texture=e.texture.url),e.topTexture?.url!==void 0&&(o.topTexture=e.topTexture.url),e.hoverColor!==void 0&&(o.hoverColor=e.hoverColor),e.interactive!==void 0&&(o.interactive=e.interactive),e.height!==void 0&&(o.height=e.height),e.opacity!==void 0&&(o.opacity=e.opacity),e.flipImageToFaceCamera!==void 0&&(o.flipImageToFaceCamera=e.flipImageToFaceCamera),e.enableImageCollisions!==void 0&&(o.enableImageCollisions=e.enableImageCollisions),e.altitude!==void 0&&(o.altitude=e.altitude-(t?.altitude??0)),e.borderVisible!==void 0&&(o.borderVisible=e.borderVisible),e.borderColor!==void 0&&(o.borderColor=e.borderColor),e.borderWidth!==void 0&&(o.borderWidth=e.borderWidth)),o}d();var wT="label",OT=J.object({type:J.literal(wT).default(wT),text:J.string(),rank:J.custom(e=>sy.safeParse(e).success||e==="initial"),appearance:J.custom(e=>jC.safeParse(e).success),interactive:J.boolean().default(!1),enabled:J.boolean().default(!0),textPlacement:J.union([J.enum(w0),J.array(J.enum(w0))]).default(O0)}),r8e=OT.partial();function fA(e){let{text:r,enabled:t,options:o}=e;return{type:wT,text:r??"",appearance:GC(o?.appearance??{}),rank:o?.rank??"medium",enabled:t??!0,interactive:o?.interactive??!1,textPlacement:o?.textPlacement??O0}}function hA(e,r){let t={options:{}};if(!t.options)throw new Error("options should exist");return e.text&&(t.text=e.text),e.appearance&&(t.options.appearance=e.appearance),e.textPlacement&&(t.options.textPlacement=e.textPlacement),e.rank!=null&&(e.rank==="initial"?t.options.rank=r.initialRank||2:t.options.rank=e.rank),e.enabled!==void 0&&(t.enabled=e.enabled),e.interactive!==void 0&&(t.options.interactive=e.interactive),e.enabled!==void 0&&(t.enabled=e.enabled),t}d();var ET="marker",PT=J.object({type:J.literal(ET).default(ET),rank:J.custom(e=>sy.safeParse(e).success||e==="initial"),placement:J.union([J.enum(E0),J.array(J.enum(E0))]).optional(),interactive:J.union([J.boolean(),J.literal("pointer-events-auto")]).default(!1),dynamicResize:J.boolean().default(!0),enabled:J.boolean().default(!0),zIndex:J.number().optional(),lowPriorityPin:J.object({enabled:J.boolean().optional(),size:J.number().positive().optional(),color:J.string().optional()}).optional(),element:J.custom(e=>e instanceof HTMLElement,{message:"Must be an HTMLElement instance"}),contentHTML:J.string()}),c8e=PT.omit({element:!0}).partial();function gA(e,r){let t=r?.target?r.target.anchorTarget:void 0,{enabled:o,placement:n,element:i,dynamicResize:a,contentHTML:l,options:c,position:p,parent:u}=e,f=typeof u=="object"?u.id:u;return t==null&&(t=new fe({latitude:p?.[1]??0,longitude:p?.[0]??0,floorId:f?.toString()})),{type:ET,rank:c?.rank??"medium",interactive:c?.interactive??!1,enabled:o??!0,element:i,placement:n??[],zIndex:c?.zIndex,dynamicResize:a??!0,lowPriorityPin:c?.lowPriorityPin,contentHTML:l??""}}function yA(e,r){let t={};return t.options={},e.rank!=null&&(e.rank==="initial"?t.options.rank=r.initialRank||2:t.options.rank=e.rank),e.dynamicResize!=null&&(t.options.dynamicResize=e.dynamicResize),e.enabled!=null&&(t.enabled=e.enabled),e.interactive!=null&&(t.options.interactive=e.interactive),e.enabled!==null&&(t.enabled=e.enabled),e.contentHTML!==void 0&&(t.contentHTML=e.contentHTML),e.placement!=null&&(t.placement=e.placement),t}d();var bA="path",s0={color:"#4b90e2",width:1,completeFraction:0,visible:!0,verticalOffset:.1},Ku=J.object({type:J.literal(bA).default(bA),color:J.string().default(s0.color),width:J.union([J.number(),J.any()]),completeFraction:J.number().default(s0.completeFraction),visible:J.boolean().default(s0.visible),verticalOffset:J.number().default(s0.verticalOffset)}),f8e=Ku.partial(),h8e=Ku.strict();function xA(e){let{color:r,visible:t,width:o,verticalOffset:n,completeFraction:i}=e;return Br(Ku,{color:r,visible:t,width:o,verticalOffset:n,completeFraction:i})}d();var vA="shape",Eg=F.object({type:F.literal(vA).default(vA),visible:F.boolean().default(!0),altitude:F.number().default(0),color:F.string().default("#ffffff"),height:F.number().default(0),opacity:F.number().default(1),interactive:F.boolean().default(!1),bevel:F.object({enabled:F.boolean().optional(),thickness:F.number().optional(),size:F.number().optional(),offset:F.number().optional(),segments:F.number().optional()}).optional()}),I8e=Eg.partial(),S8e=Eg.strict();function IA(e){let{altitude:r,visible:t,color:o,opacity:n,interactive:i,height:a,children:l,bevel:c}=e;if(l==null||l.length<1){A.error("Expected at least one child for Shape. Cannot get shape state.");return}return Br(Eg,{altitude:r,visible:t,color:o,height:a,opacity:n,interactive:i,bevel:c})}d();var SA="text3d",TA=J.object({type:J.literal(SA).default(SA),position:J.custom(e=>e instanceof fe,{message:"Must be a Coordinate instance"})}),CA=aM.extend({...TA.shape}),MA=lM.extend({...TA.shape}).partial(),P8e=CA.strict();function wA(e){let{position:r,visible:t,color:o,flipToFaceCamera:n,font:i,fontSize:a,outlineColor:l,outlineOpacity:c,outlineBlur:p,outlineWidth:u,outlineOffsetX:f,outlineOffsetY:h,strokeWidth:b,strokeOpacity:x,strokeColor:T,fillOpacity:v,hoverColor:I}=e;return Br(CA,{position:new fe({latitude:r?.[1]??0,longitude:r?.[0]??0}),visible:t,color:o,flipToFaceCamera:n,font:i,fontSize:a,outlineColor:l,outlineOpacity:c,outlineBlur:p,outlineWidth:u,outlineOffsetX:f,outlineOffsetY:h,strokeWidth:b,strokeOpacity:x,strokeColor:T,fillOpacity:v,hoverColor:I})}d();var OA="walls",Qu=J.object({type:J.literal(OA).default(OA),color:J.string().default("#ffffff"),topColor:J.string().optional(),texture:J.object({url:J.string()}).or(J.undefined()),topTexture:J.object({url:J.string()}).or(J.undefined()),visible:J.boolean().default(!0),height:J.number().default(0),opacity:J.number().default(1)}),L8e=Qu.partial(),_8e=Qu.strict();function EA(e){let{color:r,topColor:t,texture:o,topTexture:n,visible:i,height:a,opacity:l}=e;return Br(Qu,{visible:i,color:r,topColor:t,texture:o?{url:o}:void 0,topTexture:n?{url:n}:void 0,height:a,opacity:l})}function FT(e,r){let t={};return r==null||(e.color&&(e.color==="initial"?t.color=r.initialColor:t.color=e.color),e.topColor&&(e.topColor==="initial"?t.topColor=r.initialTopColor:t.topColor=e.topColor),e.visible!==void 0&&(t.visible=e.visible),e.texture?.url!==void 0&&(t.texture=e.texture.url),e.topTexture?.url!==void 0&&(t.topTexture=e.topTexture.url),e.height!==void 0&&(t.height=e.height),e.opacity!==void 0&&(t.opacity=e.opacity)),t}d();var DT="image3d",kT=F.object({type:F.literal(DT).default(DT),visible:F.boolean().default(!0),opacity:F.number().min(0).max(1).default(1),position:F.custom(e=>e instanceof fe,{message:"Must be a Coordinate instance"}),width:F.number().default(1),height:F.number().default(1),rotation:F.number().default(0),verticalOffset:F.number().default(0),flipImagesToFaceCamera:F.boolean().default(!1)}),G8e=kT.partial();function PA(e){let{position:r}=e;return{type:DT,visible:e.visible??!0,opacity:e.opacity??1,position:new fe({latitude:r?.[1]??0,longitude:r?.[0]??0,verticalOffset:r?.[2]}),width:e.width??1,height:e.height??1,rotation:e.rotation??0,verticalOffset:e.verticalOffset??0,flipImagesToFaceCamera:e.flipImageToFaceCamera??!1}}d();var FA="model",AT=T2.extend({type:F.literal(FA).default(FA),color:F.string().optional(),position:F.custom(e=>e instanceof fe,{message:"Must be a Coordinate instance"}),visible:F.boolean().default(!0),rotation:F.tuple([F.number(),F.number(),F.number()]).default([0,0,0]),scale:F.tuple([F.number(),F.number(),F.number()]).default([1,1,1]),verticalOffset:F.number().default(0),opacity:F.number().default(1),material:F.record(F.string(),C2).optional(),interactive:F.boolean().default(!1)}),DA=AT.extend({scale:F.union([F.number(),F.tuple([F.number(),F.number(),F.number()])]),rotation:F.union([F.number(),F.tuple([F.number(),F.number(),F.number()])])}).partial(),Z8e=AT.strict();function kA(e){let{color:r,position:t,rotation:o,scale:n,visible:i,interactive:a,opacity:l,material:c,verticalOffset:p,parent:u}=e,f=typeof u=="object"?u?.id?.toString():u?.toString();return Br(AT,{color:r,position:new fe({latitude:t?.[1]??0,longitude:t?.[0]??0,verticalOffset:t?.[2],floorId:f}),rotation:o,scale:n,visible:i,interactive:a,opacity:l,material:c,verticalOffset:p})}d();d();function AA(e,r){[...e.getByType("space"),...e.getByType("object")].forEach(t=>{t.name==null||t.name===""||r.updateState(t,{interactive:!0})})}d();d();d();var{entries:$A,setPrototypeOf:LA,isFrozen:SZ,getPrototypeOf:TZ,getOwnPropertyDescriptor:CZ}=Object,{freeze:wo,seal:Un,create:HA}=Object,{apply:jT,construct:GT}=typeof Reflect<"u"&&Reflect;wo||(wo=function(r){return r});Un||(Un=function(r){return r});jT||(jT=function(r,t,o){return r.apply(t,o)});GT||(GT=function(r,t){return new r(...t)});var a0=Oo(Array.prototype.forEach),MZ=Oo(Array.prototype.lastIndexOf),_A=Oo(Array.prototype.pop),Pg=Oo(Array.prototype.push),wZ=Oo(Array.prototype.splice),c0=Oo(String.prototype.toLowerCase),LT=Oo(String.prototype.toString),RA=Oo(String.prototype.match),Fg=Oo(String.prototype.replace),OZ=Oo(String.prototype.indexOf),EZ=Oo(String.prototype.trim),Ti=Oo(Object.prototype.hasOwnProperty),Mo=Oo(RegExp.prototype.test),Dg=PZ(TypeError);function Oo(e){return function(r){r instanceof RegExp&&(r.lastIndex=0);for(var t=arguments.length,o=new Array(t>1?t-1:0),n=1;n<t;n++)o[n-1]=arguments[n];return jT(e,r,o)}}function PZ(e){return function(){for(var r=arguments.length,t=new Array(r),o=0;o<r;o++)t[o]=arguments[o];return GT(e,t)}}function je(e,r){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:c0;LA&&LA(e,null);let o=r.length;for(;o--;){let n=r[o];if(typeof n=="string"){let i=t(n);i!==n&&(SZ(r)||(r[o]=i),n=i)}e[n]=!0}return e}function FZ(e){for(let r=0;r<e.length;r++)Ti(e,r)||(e[r]=null);return e}function Da(e){let r=HA(null);for(let[t,o]of $A(e))Ti(e,t)&&(Array.isArray(o)?r[t]=FZ(o):o&&typeof o=="object"&&o.constructor===Object?r[t]=Da(o):r[t]=o);return r}function kg(e,r){for(;e!==null;){let o=CZ(e,r);if(o){if(o.get)return Oo(o.get);if(typeof o.value=="function")return Oo(o.value)}e=TZ(e)}function t(){return null}return t}var BA=wo(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),_T=wo(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),RT=wo(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),DZ=wo(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),BT=wo(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),kZ=wo(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),NA=wo(["#text"]),jA=wo(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),NT=wo(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),GA=wo(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),l0=wo(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),AZ=Un(/\{\{[\w\W]*|[\w\W]*\}\}/gm),LZ=Un(/<%[\w\W]*|[\w\W]*%>/gm),_Z=Un(/\$\{[\w\W]*/gm),RZ=Un(/^data-[\-\w.\u00B7-\uFFFF]+$/),BZ=Un(/^aria-[\-\w]+$/),zA=Un(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),NZ=Un(/^(?:\w+script|data):/i),jZ=Un(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),WA=Un(/^html$/i),GZ=Un(/^[a-z][.\w]*(-[.\w]+)+$/i),UA=Object.freeze({__proto__:null,ARIA_ATTR:BZ,ATTR_WHITESPACE:jZ,CUSTOM_ELEMENT:GZ,DATA_ATTR:RZ,DOCTYPE_NAME:WA,ERB_EXPR:LZ,IS_ALLOWED_URI:zA,IS_SCRIPT_OR_DATA:NZ,MUSTACHE_EXPR:AZ,TMPLIT_EXPR:_Z}),Ag={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},UZ=function(){return typeof window>"u"?null:window},VZ=function(r,t){if(typeof r!="object"||typeof r.createPolicy!="function")return null;let o=null,n="data-tt-policy-suffix";t&&t.hasAttribute(n)&&(o=t.getAttribute(n));let i="dompurify"+(o?"#"+o:"");try{return r.createPolicy(i,{createHTML(a){return a},createScriptURL(a){return a}})}catch{return console.warn("TrustedTypes policy "+i+" could not be created."),null}},VA=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function ZA(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:UZ(),r=he=>ZA(he);if(r.version="3.2.6",r.removed=[],!e||!e.document||e.document.nodeType!==Ag.document||!e.Element)return r.isSupported=!1,r;let{document:t}=e,o=t,n=o.currentScript,{DocumentFragment:i,HTMLTemplateElement:a,Node:l,Element:c,NodeFilter:p,NamedNodeMap:u=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:f,DOMParser:h,trustedTypes:b}=e,x=c.prototype,T=kg(x,"cloneNode"),v=kg(x,"remove"),I=kg(x,"nextSibling"),M=kg(x,"childNodes"),O=kg(x,"parentNode");if(typeof a=="function"){let he=t.createElement("template");he.content&&he.content.ownerDocument&&(t=he.content.ownerDocument)}let C,E="",{implementation:_,createNodeIterator:G,createDocumentFragment:R,getElementsByTagName:N}=t,{importNode:X}=o,z=VA();r.isSupported=typeof $A=="function"&&typeof O=="function"&&_&&_.createHTMLDocument!==void 0;let{MUSTACHE_EXPR:ee,ERB_EXPR:re,TMPLIT_EXPR:ue,DATA_ATTR:Ce,ARIA_ATTR:Oe,IS_SCRIPT_OR_DATA:Pe,ATTR_WHITESPACE:Fe,CUSTOM_ELEMENT:ce}=UA,{IS_ALLOWED_URI:Ee}=UA,ye=null,Ge=je({},[...BA,..._T,...RT,...BT,...NA]),Ie=null,Xe=je({},[...jA,...NT,...GA,...l0]),se=Object.seal(HA(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),nt=null,dt=null,$t=!0,k=!0,H=!1,P=!0,q=!1,K=!0,Q=!1,De=!1,xt=!1,dr=!1,ir=!1,ur=!1,wi=!0,lp=!1,nm="user-content-",cp=!0,Rl=!1,ka={},vs=null,Gg=je({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),m0=null,im=je({},["audio","video","img","source","image","track"]),Aa=null,Ug=je({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),pp="http://www.w3.org/1998/Math/MathML",dp="http://www.w3.org/2000/svg",Is="http://www.w3.org/1999/xhtml",up=Is,f0=!1,h0=null,g7=je({},[pp,dp,Is],LT),Vg=je({},["mi","mo","mn","ms","mtext"]),$g=je({},["annotation-xml"]),y7=je({},["title","style","font","a","script"]),sm=null,b7=["application/xhtml+xml","text/html"],x7="text/html",Mr=null,mp=null,v7=t.createElement("form"),zT=function(L){return L instanceof RegExp||L instanceof Function},g0=function(){let L=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(mp&&mp===L)){if((!L||typeof L!="object")&&(L={}),L=Da(L),sm=b7.indexOf(L.PARSER_MEDIA_TYPE)===-1?x7:L.PARSER_MEDIA_TYPE,Mr=sm==="application/xhtml+xml"?LT:c0,ye=Ti(L,"ALLOWED_TAGS")?je({},L.ALLOWED_TAGS,Mr):Ge,Ie=Ti(L,"ALLOWED_ATTR")?je({},L.ALLOWED_ATTR,Mr):Xe,h0=Ti(L,"ALLOWED_NAMESPACES")?je({},L.ALLOWED_NAMESPACES,LT):g7,Aa=Ti(L,"ADD_URI_SAFE_ATTR")?je(Da(Ug),L.ADD_URI_SAFE_ATTR,Mr):Ug,m0=Ti(L,"ADD_DATA_URI_TAGS")?je(Da(im),L.ADD_DATA_URI_TAGS,Mr):im,vs=Ti(L,"FORBID_CONTENTS")?je({},L.FORBID_CONTENTS,Mr):Gg,nt=Ti(L,"FORBID_TAGS")?je({},L.FORBID_TAGS,Mr):Da({}),dt=Ti(L,"FORBID_ATTR")?je({},L.FORBID_ATTR,Mr):Da({}),ka=Ti(L,"USE_PROFILES")?L.USE_PROFILES:!1,$t=L.ALLOW_ARIA_ATTR!==!1,k=L.ALLOW_DATA_ATTR!==!1,H=L.ALLOW_UNKNOWN_PROTOCOLS||!1,P=L.ALLOW_SELF_CLOSE_IN_ATTR!==!1,q=L.SAFE_FOR_TEMPLATES||!1,K=L.SAFE_FOR_XML!==!1,Q=L.WHOLE_DOCUMENT||!1,dr=L.RETURN_DOM||!1,ir=L.RETURN_DOM_FRAGMENT||!1,ur=L.RETURN_TRUSTED_TYPE||!1,xt=L.FORCE_BODY||!1,wi=L.SANITIZE_DOM!==!1,lp=L.SANITIZE_NAMED_PROPS||!1,cp=L.KEEP_CONTENT!==!1,Rl=L.IN_PLACE||!1,Ee=L.ALLOWED_URI_REGEXP||zA,up=L.NAMESPACE||Is,Vg=L.MATHML_TEXT_INTEGRATION_POINTS||Vg,$g=L.HTML_INTEGRATION_POINTS||$g,se=L.CUSTOM_ELEMENT_HANDLING||{},L.CUSTOM_ELEMENT_HANDLING&&zT(L.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(se.tagNameCheck=L.CUSTOM_ELEMENT_HANDLING.tagNameCheck),L.CUSTOM_ELEMENT_HANDLING&&zT(L.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(se.attributeNameCheck=L.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),L.CUSTOM_ELEMENT_HANDLING&&typeof L.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(se.allowCustomizedBuiltInElements=L.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),q&&(k=!1),ir&&(dr=!0),ka&&(ye=je({},NA),Ie=[],ka.html===!0&&(je(ye,BA),je(Ie,jA)),ka.svg===!0&&(je(ye,_T),je(Ie,NT),je(Ie,l0)),ka.svgFilters===!0&&(je(ye,RT),je(Ie,NT),je(Ie,l0)),ka.mathMl===!0&&(je(ye,BT),je(Ie,GA),je(Ie,l0))),L.ADD_TAGS&&(ye===Ge&&(ye=Da(ye)),je(ye,L.ADD_TAGS,Mr)),L.ADD_ATTR&&(Ie===Xe&&(Ie=Da(Ie)),je(Ie,L.ADD_ATTR,Mr)),L.ADD_URI_SAFE_ATTR&&je(Aa,L.ADD_URI_SAFE_ATTR,Mr),L.FORBID_CONTENTS&&(vs===Gg&&(vs=Da(vs)),je(vs,L.FORBID_CONTENTS,Mr)),cp&&(ye["#text"]=!0),Q&&je(ye,["html","head","body"]),ye.table&&(je(ye,["tbody"]),delete nt.tbody),L.TRUSTED_TYPES_POLICY){if(typeof L.TRUSTED_TYPES_POLICY.createHTML!="function")throw Dg('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof L.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Dg('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');C=L.TRUSTED_TYPES_POLICY,E=C.createHTML("")}else C===void 0&&(C=VZ(b,n)),C!==null&&typeof E=="string"&&(E=C.createHTML(""));wo&&wo(L),mp=L}},WT=je({},[..._T,...RT,...DZ]),ZT=je({},[...BT,...kZ]),I7=function(L){let Y=O(L);(!Y||!Y.tagName)&&(Y={namespaceURI:up,tagName:"template"});let pe=c0(L.tagName),Gt=c0(Y.tagName);return h0[L.namespaceURI]?L.namespaceURI===dp?Y.namespaceURI===Is?pe==="svg":Y.namespaceURI===pp?pe==="svg"&&(Gt==="annotation-xml"||Vg[Gt]):!!WT[pe]:L.namespaceURI===pp?Y.namespaceURI===Is?pe==="math":Y.namespaceURI===dp?pe==="math"&&$g[Gt]:!!ZT[pe]:L.namespaceURI===Is?Y.namespaceURI===dp&&!$g[Gt]||Y.namespaceURI===pp&&!Vg[Gt]?!1:!ZT[pe]&&(y7[pe]||!WT[pe]):!!(sm==="application/xhtml+xml"&&h0[L.namespaceURI]):!1},Oi=function(L){Pg(r.removed,{element:L});try{O(L).removeChild(L)}catch{v(L)}},fp=function(L,Y){try{Pg(r.removed,{attribute:Y.getAttributeNode(L),from:Y})}catch{Pg(r.removed,{attribute:null,from:Y})}if(Y.removeAttribute(L),L==="is")if(dr||ir)try{Oi(Y)}catch{}else try{Y.setAttribute(L,"")}catch{}},XT=function(L){let Y=null,pe=null;if(xt)L="<remove></remove>"+L;else{let mr=RA(L,/^[\r\n\t ]+/);pe=mr&&mr[0]}sm==="application/xhtml+xml"&&up===Is&&(L='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+L+"</body></html>");let Gt=C?C.createHTML(L):L;if(up===Is)try{Y=new h().parseFromString(Gt,sm)}catch{}if(!Y||!Y.documentElement){Y=_.createDocument(up,"template",null);try{Y.documentElement.innerHTML=f0?E:Gt}catch{}}let Kr=Y.body||Y.documentElement;return L&&pe&&Kr.insertBefore(t.createTextNode(pe),Kr.childNodes[0]||null),up===Is?N.call(Y,Q?"html":"body")[0]:Q?Y.documentElement:Kr},YT=function(L){return G.call(L.ownerDocument||L,L,p.SHOW_ELEMENT|p.SHOW_COMMENT|p.SHOW_TEXT|p.SHOW_PROCESSING_INSTRUCTION|p.SHOW_CDATA_SECTION,null)},y0=function(L){return L instanceof f&&(typeof L.nodeName!="string"||typeof L.textContent!="string"||typeof L.removeChild!="function"||!(L.attributes instanceof u)||typeof L.removeAttribute!="function"||typeof L.setAttribute!="function"||typeof L.namespaceURI!="string"||typeof L.insertBefore!="function"||typeof L.hasChildNodes!="function")},JT=function(L){return typeof l=="function"&&L instanceof l};function Ss(he,L,Y){a0(he,pe=>{pe.call(r,L,Y,mp)})}let KT=function(L){let Y=null;if(Ss(z.beforeSanitizeElements,L,null),y0(L))return Oi(L),!0;let pe=Mr(L.nodeName);if(Ss(z.uponSanitizeElement,L,{tagName:pe,allowedTags:ye}),K&&L.hasChildNodes()&&!JT(L.firstElementChild)&&Mo(/<[/\w!]/g,L.innerHTML)&&Mo(/<[/\w!]/g,L.textContent)||L.nodeType===Ag.progressingInstruction||K&&L.nodeType===Ag.comment&&Mo(/<[/\w]/g,L.data))return Oi(L),!0;if(!ye[pe]||nt[pe]){if(!nt[pe]&&qT(pe)&&(se.tagNameCheck instanceof RegExp&&Mo(se.tagNameCheck,pe)||se.tagNameCheck instanceof Function&&se.tagNameCheck(pe)))return!1;if(cp&&!vs[pe]){let Gt=O(L)||L.parentNode,Kr=M(L)||L.childNodes;if(Kr&&Gt){let mr=Kr.length;for(let Eo=mr-1;Eo>=0;--Eo){let Ts=T(Kr[Eo],!0);Ts.__removalCount=(L.__removalCount||0)+1,Gt.insertBefore(Ts,I(L))}}}return Oi(L),!0}return L instanceof c&&!I7(L)||(pe==="noscript"||pe==="noembed"||pe==="noframes")&&Mo(/<\/no(script|embed|frames)/i,L.innerHTML)?(Oi(L),!0):(q&&L.nodeType===Ag.text&&(Y=L.textContent,a0([ee,re,ue],Gt=>{Y=Fg(Y,Gt," ")}),L.textContent!==Y&&(Pg(r.removed,{element:L.cloneNode()}),L.textContent=Y)),Ss(z.afterSanitizeElements,L,null),!1)},QT=function(L,Y,pe){if(wi&&(Y==="id"||Y==="name")&&(pe in t||pe in v7))return!1;if(!(k&&!dt[Y]&&Mo(Ce,Y))){if(!($t&&Mo(Oe,Y))){if(!Ie[Y]||dt[Y]){if(!(qT(L)&&(se.tagNameCheck instanceof RegExp&&Mo(se.tagNameCheck,L)||se.tagNameCheck instanceof Function&&se.tagNameCheck(L))&&(se.attributeNameCheck instanceof RegExp&&Mo(se.attributeNameCheck,Y)||se.attributeNameCheck instanceof Function&&se.attributeNameCheck(Y))||Y==="is"&&se.allowCustomizedBuiltInElements&&(se.tagNameCheck instanceof RegExp&&Mo(se.tagNameCheck,pe)||se.tagNameCheck instanceof Function&&se.tagNameCheck(pe))))return!1}else if(!Aa[Y]){if(!Mo(Ee,Fg(pe,Fe,""))){if(!((Y==="src"||Y==="xlink:href"||Y==="href")&&L!=="script"&&OZ(pe,"data:")===0&&m0[L])){if(!(H&&!Mo(Pe,Fg(pe,Fe,"")))){if(pe)return!1}}}}}}return!0},qT=function(L){return L!=="annotation-xml"&&RA(L,ce)},eC=function(L){Ss(z.beforeSanitizeAttributes,L,null);let{attributes:Y}=L;if(!Y||y0(L))return;let pe={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Ie,forceKeepAttr:void 0},Gt=Y.length;for(;Gt--;){let Kr=Y[Gt],{name:mr,namespaceURI:Eo,value:Ts}=Kr,am=Mr(mr),b0=Ts,Qr=mr==="value"?b0:EZ(b0);if(pe.attrName=am,pe.attrValue=Qr,pe.keepAttr=!0,pe.forceKeepAttr=void 0,Ss(z.uponSanitizeAttribute,L,pe),Qr=pe.attrValue,lp&&(am==="id"||am==="name")&&(fp(mr,L),Qr=nm+Qr),K&&Mo(/((--!?|])>)|<\/(style|title)/i,Qr)){fp(mr,L);continue}if(pe.forceKeepAttr)continue;if(!pe.keepAttr){fp(mr,L);continue}if(!P&&Mo(/\/>/i,Qr)){fp(mr,L);continue}q&&a0([ee,re,ue],rC=>{Qr=Fg(Qr,rC," ")});let tC=Mr(L.nodeName);if(!QT(tC,am,Qr)){fp(mr,L);continue}if(C&&typeof b=="object"&&typeof b.getAttributeType=="function"&&!Eo)switch(b.getAttributeType(tC,am)){case"TrustedHTML":{Qr=C.createHTML(Qr);break}case"TrustedScriptURL":{Qr=C.createScriptURL(Qr);break}}if(Qr!==b0)try{Eo?L.setAttributeNS(Eo,mr,Qr):L.setAttribute(mr,Qr),y0(L)?Oi(L):_A(r.removed)}catch{fp(mr,L)}}Ss(z.afterSanitizeAttributes,L,null)},S7=function he(L){let Y=null,pe=YT(L);for(Ss(z.beforeSanitizeShadowDOM,L,null);Y=pe.nextNode();)Ss(z.uponSanitizeShadowNode,Y,null),KT(Y),eC(Y),Y.content instanceof i&&he(Y.content);Ss(z.afterSanitizeShadowDOM,L,null)};return r.sanitize=function(he){let L=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},Y=null,pe=null,Gt=null,Kr=null;if(f0=!he,f0&&(he="<!-->"),typeof he!="string"&&!JT(he))if(typeof he.toString=="function"){if(he=he.toString(),typeof he!="string")throw Dg("dirty is not a string, aborting")}else throw Dg("toString is not a function");if(!r.isSupported)return he;if(De||g0(L),r.removed=[],typeof he=="string"&&(Rl=!1),Rl){if(he.nodeName){let Ts=Mr(he.nodeName);if(!ye[Ts]||nt[Ts])throw Dg("root node is forbidden and cannot be sanitized in-place")}}else if(he instanceof l)Y=XT("<!---->"),pe=Y.ownerDocument.importNode(he,!0),pe.nodeType===Ag.element&&pe.nodeName==="BODY"||pe.nodeName==="HTML"?Y=pe:Y.appendChild(pe);else{if(!dr&&!q&&!Q&&he.indexOf("<")===-1)return C&&ur?C.createHTML(he):he;if(Y=XT(he),!Y)return dr?null:ur?E:""}Y&&xt&&Oi(Y.firstChild);let mr=YT(Rl?he:Y);for(;Gt=mr.nextNode();)KT(Gt),eC(Gt),Gt.content instanceof i&&S7(Gt.content);if(Rl)return he;if(dr){if(ir)for(Kr=R.call(Y.ownerDocument);Y.firstChild;)Kr.appendChild(Y.firstChild);else Kr=Y;return(Ie.shadowroot||Ie.shadowrootmode)&&(Kr=X.call(o,Kr,!0)),Kr}let Eo=Q?Y.outerHTML:Y.innerHTML;return Q&&ye["!doctype"]&&Y.ownerDocument&&Y.ownerDocument.doctype&&Y.ownerDocument.doctype.name&&Mo(WA,Y.ownerDocument.doctype.name)&&(Eo="<!DOCTYPE "+Y.ownerDocument.doctype.name+`>
755
+ `+Eo),q&&a0([ee,re,ue],Ts=>{Eo=Fg(Eo,Ts," ")}),C&&ur?C.createHTML(Eo):Eo},r.setConfig=function(){let he=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};g0(he),De=!0},r.clearConfig=function(){mp=null,De=!1},r.isValidAttribute=function(he,L,Y){mp||g0({});let pe=Mr(he),Gt=Mr(L);return QT(pe,Gt,Y)},r.addHook=function(he,L){typeof L=="function"&&Pg(z[he],L)},r.removeHook=function(he,L){if(L!==void 0){let Y=MZ(z[he],L);return Y===-1?void 0:wZ(z[he],Y,1)[0]}return _A(z[he])},r.removeHooks=function(he){z[he]=[]},r.removeAllHooks=function(){z=VA()},r}var XA=ZA();var $Z={"connection-stairs-12x12":`<svg viewBox="0 0 12 12" stroke="none">
756
756
  <path d="M1.625 8.1875C1.625 8.01491 1.76491 7.875 1.9375 7.875H4.75V9.4375C4.75 9.61009 4.61009 9.75 4.4375 9.75H1.9375C1.76491 9.75 1.625 9.61009 1.625 9.4375V8.1875Z" />
757
757
  <path d="M3.5 6.3125C3.5 6.13991 3.63991 6 3.8125 6H6.625V7.5625C6.625 7.73509 6.48509 7.875 6.3125 7.875H3.5V6.3125Z" />
758
758
  <path d="M5.375 4.4375C5.375 4.26491 5.51491 4.125 5.6875 4.125H8.5V5.6875C8.5 5.86009 8.36009 6 8.1875 6H5.375V4.4375Z" />
@@ -783,7 +783,7 @@ void main(void) {
783
783
  d="M11.2374 9.75H10.5V4.5C10.5 4.30109 10.421 4.11032 10.2804 3.96967C10.1397 3.82902 9.94894 3.75 9.75003 3.75H7.68753C7.6378 3.75 7.59011 3.76976 7.55495 3.80492C7.51978 3.84008 7.50003 3.88777 7.50003 3.9375V9.75H6.75003V1.51922C6.75127 1.4024 6.72592 1.28683 6.67589 1.18125C6.62587 1.07567 6.55248 0.982864 6.46128 0.909845C6.33697 0.812924 6.18528 0.757635 6.02776 0.751829C5.87024 0.746023 5.71489 0.789995 5.58378 0.877501L1.83378 3.375C1.73091 3.44364 1.6466 3.53664 1.58837 3.64574C1.53014 3.75484 1.4998 3.87665 1.50003 4.00031V9.75H0.762687C0.66578 9.74857 0.571927 9.78389 0.500006 9.84885C0.428085 9.91382 0.383432 10.0036 0.37503 10.1002C0.371625 10.1515 0.378802 10.2029 0.396116 10.2513C0.413431 10.2997 0.440513 10.344 0.47568 10.3815C0.510847 10.419 0.553349 10.4489 0.600545 10.4693C0.647741 10.4897 0.698623 10.5001 0.75003 10.5H11.25C11.3014 10.5001 11.3523 10.4897 11.3995 10.4693C11.4467 10.4489 11.4892 10.419 11.5244 10.3815C11.5595 10.344 11.5866 10.2997 11.6039 10.2513C11.6213 10.2029 11.6284 10.1515 11.625 10.1002C11.6166 10.0036 11.572 9.91382 11.5001 9.84885C11.4281 9.78389 11.3343 9.74857 11.2374 9.75ZM3.56253 8.625C3.56264 8.67641 3.55219 8.72729 3.53181 8.77449C3.51143 8.82168 3.48156 8.86418 3.44406 8.89935C3.40657 8.93452 3.36224 8.9616 3.31383 8.97892C3.26543 8.99623 3.21398 9.00341 3.16269 9C3.06605 8.99159 2.9762 8.94688 2.91122 8.87485C2.84624 8.80283 2.81098 8.70886 2.81253 8.61188V7.88766C2.81121 7.79078 2.84657 7.69699 2.91151 7.62509C2.97645 7.55319 3.06618 7.50851 3.16269 7.5C3.21398 7.4966 3.26543 7.50377 3.31383 7.52109C3.36224 7.5384 3.40657 7.56548 3.44406 7.60065C3.48156 7.63582 3.51143 7.67832 3.53181 7.72552C3.55219 7.77271 3.56264 7.82359 3.56253 7.875V8.625ZM3.56253 6C3.56264 6.05141 3.55219 6.10229 3.53181 6.14949C3.51143 6.19668 3.48156 6.23918 3.44406 6.27435C3.40657 6.30952 3.36224 6.3366 3.31383 6.35392C3.26543 6.37123 3.21398 6.37841 3.16269 6.375C3.06609 6.36649 2.9763 6.32174 2.91135 6.24974C2.84639 6.17774 2.81109 6.08383 2.81253 5.98688V5.26266C2.81121 5.16578 2.84657 5.07199 2.91151 5.00009C2.97645 4.92819 3.06618 4.88351 3.16269 4.875C3.21398 4.8716 3.26543 4.87877 3.31383 4.89609C3.36224 4.9134 3.40657 4.94048 3.44406 4.97565C3.48156 5.01082 3.51143 5.05332 3.53181 5.10052C3.55219 5.14771 3.56264 5.19859 3.56253 5.25V6ZM5.43753 8.625C5.43764 8.67641 5.42719 8.72729 5.40681 8.77449C5.38643 8.82168 5.35656 8.86418 5.31906 8.89935C5.28157 8.93452 5.23724 8.9616 5.18883 8.97892C5.14043 8.99623 5.08898 9.00341 5.03769 9C4.94122 8.9916 4.8515 8.94702 4.78654 8.8752C4.72159 8.80338 4.68622 8.70964 4.68753 8.61281V7.88766C4.68633 7.79086 4.72174 7.69718 4.78667 7.62539C4.8516 7.55359 4.94126 7.50897 5.03769 7.50047C5.08898 7.49706 5.14043 7.50424 5.18883 7.52156C5.23724 7.53887 5.28157 7.56595 5.31906 7.60112C5.35656 7.63629 5.38643 7.67879 5.40681 7.72598C5.42719 7.77318 5.43764 7.82406 5.43753 7.87547V8.625ZM5.43753 6C5.43764 6.05141 5.42719 6.10229 5.40681 6.14949C5.38643 6.19668 5.35656 6.23918 5.31906 6.27435C5.28157 6.30952 5.23724 6.3366 5.18883 6.35392C5.14043 6.37123 5.08898 6.37841 5.03769 6.375C4.94126 6.3665 4.8516 6.32188 4.78667 6.25008C4.72174 6.17829 4.68633 6.08461 4.68753 5.98781V5.26266C4.68633 5.16586 4.72174 5.07218 4.78667 5.00039C4.8516 4.92859 4.94126 4.88397 5.03769 4.87547C5.08898 4.87206 5.14043 4.87924 5.18883 4.89656C5.23724 4.91387 5.28157 4.94095 5.31906 4.97612C5.35656 5.01129 5.38643 5.05379 5.40681 5.10098C5.42719 5.14818 5.43764 5.19906 5.43753 5.25047V6Z"
784
784
  stroke="none"
785
785
  />
786
- </svg>`},HZ=/<svg([^>]*)>/g;function YA(e,r,t){let o=$Z[e];return o?o.replace(HZ,`<svg$1 xmlns="http://www.w3.org/2000/svg" style="fill:${r}; width:${t}px; height:${t}px">`):null}function zZ(e){return XA.sanitize(e,{USE_PROFILES:{svg:!0}})}function WZ(e,r){let n=new DOMParser().parseFromString(e,"image/svg+xml").documentElement;return n==null||n.tagName==="parsererror"||n.tagName.toLowerCase()!=="svg"?(A.error("Failed to parse SVG",{svg:e,tagName:n?.tagName}),e):(r!=null&&(n.setAttribute("color",r),n.querySelectorAll("*").forEach(l=>{(l.getAttribute("fill")!=null||l.tagName==="path")&&l.getAttribute("fill")!=="none"&&l.setAttribute("fill","currentColor"),l.getAttribute("stroke")!=null&&l.getAttribute("stroke")!=="none"&&l.setAttribute("stroke","currentColor")})),new XMLSerializer().serializeToString(n))}async function JA(e,r){let t="";try{if(e.trim()==="")throw new Error("URL is empty!");r?.style==="fill"&&(e=e.replace(".svg","-fill.svg"));let o=await tn()(e),n=o.headers.get("content-type");if(n?.includes("image/svg+xml")){let i=await o.text();return t=zZ(i),r?.color!=null&&(t=WZ(t,r.color)),{icon:t,type:"svg"}}else{if(n?.includes("image"))return{icon:e,type:"image"};throw new Error(`Expected SVG or Image content, but received: ${n}`)}}catch(o){return A.error(`Failed to fetch icon from ${e}.`,o),null}}d();function KA(e){return e.locationProfiles.some(r=>r.categories.some(t=>t.name.includes("Restroom")))}function QA(e){return e.locationProfiles.some(r=>r.categories.some(t=>t.name.includes("Parking")))}var sp={default:"#3D5676",connection:"#128387",washroom:"#3161B4",point:"#AD468F",parking:"#418425",door:"#A0552C"},Lg={elevator:"connection-elevator-12x12",escalator:"connection-stairs-12x12",stairs:"connection-stairs-12x12",point:"point-of-interest-12x12",door:"door-12x12",building:"building-12x12"};function ZZ(e){let r=null;if(an.is(e))switch(e.type){case"elevator":r=Lg.elevator;break;case"escalator":case"stairs":default:r=Lg.stairs}else sn.is(e)?r=Lg.point:go.is(e)?r=Lg.door:Ar.is(e)&&(r=Lg.building);return r!=null?YA(r,"#FFFFFF",12):null}function qA(e){return an.is(e)?sp.connection:Ar.is(e)?sp.default:KA(e)?sp.washroom:QA(e)?sp.parking:sn.is(e)?sp.point:go.is(e)?sp.door:sp.default}async function XZ(e,r){let t=null,o="locationProfiles"in e?e.locationProfiles.find(n=>n.icon!=null)?.icon:null;if(o?.url!=null&&(t=await JA(o.url,{color:r.color,style:"fill"})),t==null){let n=ZZ(e);n!=null&&(t={icon:n,type:"svg"})}return t}async function YZ(e){return an.is(e)||go.is(e)?"low":sn.is(e)||Ar.is(e)?"high":"medium"}async function JZ(e){let r={appearance:{color:qA(e),pinOutlineColor:qA(e),iconPadding:8,iconSize:24,textSize:12.5,iconScale:{on:"zoom-level",input:[18,20],output:[.7,1]}},rank:await YZ(e),interactive:!0},t=await XZ(e,{color:"#FFFFFF"});return t!=null&&(r.appearance.icon=t.icon,t.type==="svg"?Ar.is(e)&&(r.appearance.iconSize=30,r.appearance.iconPadding=10):t.type==="image"&&(r.appearance.iconSize=48,r.appearance.iconPadding=2,r.appearance.pinOutlineColor="#FFFFFF",r.rank="high")),r}function e7(e,r){let t=[...e.getByType("connection"),...e.getByType("point-of-interest"),...e.getByType("space"),...e.getByType("object"),...e.getByType("door"),...e.getByType("facade")].flatMap(async o=>{let n=[],i=await JZ(o);return an.is(o)?n=o.coordinates.map(a=>r.Labels.add(a,o.name,i)):Ar.is(o)?o.spaces.length>0&&o.floorStack.name!=null&&o.floorStack.name!==""&&n.push(r.Labels.add(o.spaces[0],o.floorStack.name,i)):"name"in o&&o.name!=null&&o.name!==""&&n.push(r.Labels.add(o,o.name,i)),n});return Promise.all(t).then(o=>o.flat())}async function t7(e,r){let t=[e7(e,r),AA(e,r)],[o]=await Promise.all(t);return{labels:o}}var c0=.05,Rg,Bg,_g=class extends ke{constructor(t,o,n){super();m(this,"core");m(this,"mapObjects",[]);m(this,"id");m(this,"mapDataExternal",{});m(this,"mapsByFloorId",{});m(this,"mapData");m(this,"currentMap");m(this,"hiddenOutdoorGeometries",[]);m(this,"lastFacadeIntersected");S(this,Rg,!1);S(this,Bg,!1);m(this,"mapView");m(this,"externalPubSub");m(this,"Camera");m(this,"Labels");m(this,"Text3D");m(this,"Markers");m(this,"Models");m(this,"Paths");m(this,"Exporter");m(this,"Navigation");m(this,"Outdoor");m(this,"BlueDot");m(this,"Shapes");m(this,"Style");m(this,"Image3D");m(this,"update",()=>{this.core.render()});this.core=t,this.mapView=o,this.externalPubSub=n,this.Camera=new Bh(this),this.id=this.core.addGroupContainer("root").id.toString();let i=new Hh("outdoors-container",void 0,void 0,this);this.mapObjects.push(i),this.currentMap=i,this.core.on("pre-render",()=>{n.publish("pre-render")}),this.core.on("post-render",()=>{n.publish("post-render")}),this.core.on("resize",()=>{n.publish("resize")}),this.core.on("render-error",({error:u})=>{n.publish("render-error",{error:new rC(u instanceof Error?u.message:"Unknown error")})});let a=u=>{let f=this.getMapDataObject(u);switch(f?.__type){case"facade":return f;case"floor":return f.floorStack.facade;default:return null}};this.core.on("geometry-in-focus",u=>{let f=new Set;for(let h of u){let b=a(h);b&&f.add(b)}n.publish("facades-in-view-change",{facades:Array.from(f)})}),this.core.getSystems().renderSystem.on("camera-state-change",()=>{n.publish("state-change-internal",{Camera:this.getCameraState()})});let l=new Fh(this.Camera,{precision:7});this.core.on("camera-change",()=>{n.publish("camera-change",l)});let c=u=>f=>{let h=[],b=[],x=[],T=[];f.labels.forEach(R=>{let N=this.Labels.getById(R.toString());N&&h.push(N.label)}),f.markers.forEach(R=>{let N=this.Markers.getById(R.toString())||this.Navigation.getMarkerById(R.toString());N&&b.push(N.marker)}),f.models.forEach(R=>{let N=this.Models.getById(R.toString());N&&x.push(N.model)}),f.paths.forEach(R=>{let N=this.Paths.getById(R.toString())||this.Navigation.getPathById(R.toString());N&&T.push(N.path)});let v=f.geometry.includes(ng),I=f.geometry.filter(R=>R!==ng),M;I.length>0&&(M=I.map(R=>this.getMapDataInternal()?.getById("space",R)).filter(Boolean)[0],M||(M=I.map(R=>this.getMapDataInternal()?.getById("object",R)).filter(Boolean)[0]),M||(M=I.map(R=>this.Shapes.getById(R)).filter(Boolean)[0]));let O=f.containers.reduce((R,N)=>{let X=this.getMapDataInternal()?.getById("floor",N);return X&&Bo.is(X)&&R.push(X),R},[]),C,E=0;if(O.length>0){C=O[0].id;let R=this.core.getState(C);E=f.coordinate[2]?f.coordinate[2]-R.altitude:E}let _;this.lastFacadeIntersected&&this.lastFacadeIntersected.spaces.forEach(R=>{this.core.setState(R.id,{hovered:!1})}),M&&vr.is(M)&&(_=I.map(R=>this.getMapDataInternal()?.facadesBySpaceId[R]).filter(Boolean)[0],_&&_.spaces.forEach(R=>{this.core.setState(R.id,{hovered:!0})})),this.lastFacadeIntersected=_;let G={coordinate:new fe({latitude:f.coordinate[1],longitude:f.coordinate[0],floorId:C,verticalOffset:E}),spaces:M&&vr.is(M)?[M]:[],objects:M&&No.is(M)?[M]:[],shapes:M&&ha.is(M)?[M]:[],markers:b,labels:h,models:x,paths:T,floors:O,facades:_?[_]:[]};"pointerEvent"in f&&(G.pointerEvent=f.pointerEvent),v&&(u==="click"?this.BlueDot.publish("click",{coordinate:new fe({longitude:f.coordinate[0],latitude:f.coordinate[1]})}):u==="hover"&&this.BlueDot.publish("hover")),n.publish(u,G)};this.core.on("hover",c("hover")),this.core.on("click",c("click")),this.core.on("user-interaction-start",()=>{n.publish("user-interaction-start")}),this.core.on("user-interaction-end",()=>{n.publish("user-interaction-end")});let p={currentMapGetter:()=>this.currentMap};this.Markers=new zh(p),this.Models=new Yh(p),this.Labels=new Gh(p),this.Text3D=new bg(p),this.Exporter=new jh(p),this.Paths=new Kh(p),this.Navigation=new _h(this.core,this,p.currentMapGetter),this.on("navigation-state-change",u=>{this.externalPubSub.publish("state-change-internal",{Navigation:u})}),this.on("navigation-connection-click",u=>{this.externalPubSub.publish("navigation-connection-click",u)}),this.on("navigation-active-path-change",u=>{this.externalPubSub.publish("navigation-active-path-change",u)}),this.BlueDot=new Xu(this.core,this),this.BlueDot.on("blue-dot-position-update",()=>{this._publishBlueDotState({coordinate:this.BlueDot.coordinate,heading:this.BlueDot.heading,accuracy:this.BlueDot.accuracy,floor:this.BlueDot.floor})}),this.BlueDot.on("blue-dot-state-change",()=>{this._publishBlueDotState({state:this.BlueDot.state})}),this.BlueDot.on("blue-dot-follow-change",()=>{this._publishBlueDotState({following:this.BlueDot.following})}),this.Outdoor=new Yu(this.core,this.hiddenOutdoorGeometries),this.Outdoor.enabled&&(this.core.on("outdoor-view-loaded",()=>{n.publish("outdoor-view-loaded")}),this.core.on("outdoor-style-loaded",()=>{n.publish("outdoor-style-loaded")})),this.Image3D=new Zh(p),this.Shapes=new ug(p),this.Style=new fg(p)}get manualFloorVisibility(){return s(this,Rg)}set manualFloorVisibility(t){w(this,Rg,t),this.externalPubSub.publish("state-change-internal",{manualFloorVisibility:t})}get hidePathsNotOnCurrentFloor(){return s(this,Bg)}set hidePathsNotOnCurrentFloor(t){w(this,Bg,t),this.currentMap?.updatePathLayersVisibility()}preloadFloors(t){t.forEach(o=>{o instanceof Bo&&this.core.setState(o.id,{preloadGeometry:!0})})}updateState(t,o){if(o==null||typeof o!="object")return;if(t==="interior-walls"){this.currentMap.floors.forEach(i=>{let a=i.layers.get(rr);if(a){let l=a.layers.get(sl);l&&this.core.hasState(l)&&this.core.setState(l,PT(Nt(Qu,o,{warn:!0}),this.core.getState(l)))}});return}if(t==="exterior-walls"){this.currentMap.floors.forEach(i=>{let a=i.layers.get(rr);if(a){let l=a.layers.get(es);l&&this.core.hasState(l)&&this.core.setState(l,PT(Nt(Qu,o,{warn:!0}),this.core.getState(l)))}});return}if(t==="interior-doors"){this.currentMap.floors.forEach(i=>{let a=i.layers.get(rr);if(a){let l=a.layers.get(Gd);l&&this.core.hasState(l)&&this.core.setState(l,n0(Nt(ip,o,{warn:!0}),this.core.getState(l)))}});return}if(t==="exterior-doors"){this.currentMap.floors.forEach(i=>{let a=i.layers.get(rr);if(a){let l=a.layers.get(Ud);l&&this.core.hasState(l)&&this.core.setState(l,n0(Nt(ip,o,{warn:!0}),this.core.getState(l)))}});return}let n=typeof t=="string"?this.getMapDataObject(t):t;if(n){if(n.__type!==Bn.__type&&!this.core.hasState(n.id)){A.warn(`Failed to update state for "${n.id}". No ${n.__type} found with that ID.`);return}if(fa.is(n))return this.core.setState(n.id,hA(Nt(wT,o,{warn:!0}),this.core.getState(n.id)));if(ds.is(n))return this.core.setState(n.id,yA(Nt(ET,o,{warn:!0}),this.core.getState(n.id)));if(vr.is(n)||No.is(n)){let i=this.core.getState(n.id);if(i!=null){let a=i.parent&&i.parent.type==="geometry-group"?this.core.getState(i.parent):void 0;this.core.setState(n.id,mA(Nt(Ju,o,{warn:!0}),i,a))}}if(si.is(n)&&this.core.setState(n.id,Nt(Ju,o,{warn:!0})),Wc.is(n)&&this.core.setState(n.id,Nt(DT,o,{warn:!0})),go.is(n)&&this.core.setState(n.id,n0(Nt(ip,o,{warn:!0}),this.core.getState(n.id))),ha.is(n)&&this.core.setState(n.id,Nt(Eg,o,{warn:!0})),Xc.is(n)){let{position:i,scale:a,rotation:l,...c}=Nt(DA,o,{warn:!0}),p=c;i&&(p.position=[i.longitude,i.latitude,i.verticalOffset]),a!=null&&(Array.isArray(a)?p.scale=a:p.scale=[a,a,a]),l!=null&&(Array.isArray(l)?p.rotation=l:p.rotation=[l,l,l]),i&&n.updateTarget(i),this.core.setState(n.id,p)}if(Bo.is(n)){let i=this.currentMap.floorsById.get(n.id);if(i==null)return;let a=Nt(Og,o,{warn:!0});this.core.setState(n.id,a);let l=i.layers.get(rr);l!=null&&"geometry"in o&&o.geometry&&this.core.setState(l.containerId,Nt(Ig,o.geometry,{warn:!0}));let c=i.layers.get(ts);if(c!=null&&"labels"in o&&o.labels){let x=Nt(Sg,o.labels,{warn:!0});"enabled"in x&&typeof x.enabled=="boolean"&&c.setVisible(x.enabled)}let p=i.layers.get(ai);if(p!=null&&"markers"in o&&o.markers){let x=Nt(Tg,o.markers,{warn:!0});"enabled"in x&&typeof x.enabled=="boolean"&&p.setVisible(x.enabled)}let u=i.layers.get(Vd);u!=null&&"footprint"in o&&o.footprint&&this.core.setState(u.containerId,Nt(vg,o.footprint,{warn:!0}));let f=i.layers.get(al);if(f!=null&&"occlusion"in o&&o.occlusion){let x=Nt(Mg,o.occlusion,{warn:!0});"enabled"in x&&typeof x.enabled=="boolean"&&f.setVisible(x.enabled)}let h=i.layers.get($d);if(h!=null&&"images"in o&&o.images){let x=Nt(Cg,o.images,{warn:!0});"visible"in x&&typeof x.visible=="boolean"&&h.setVisible(x.visible)}let b=i.layers.get(rs);if(b!=null&&"paths"in o&&o.paths!=null){let x=Nt(wg,o.paths,{warn:!0});x.visible!=null&&typeof x.visible=="boolean"&&b.setVisible(x.visible)}}if(Ar.is(n)){let i=this.core.getState(n.id);for(let a of i.children)a.type==="group-container"&&this.core.setState(a.id,Nt(xg,o,{warn:!0}))}if(El.is(n)&&this.core.setState(n.id,Nt(MA,o,{warn:!0})),Bn.is(n))for(let i of n.segments)this.core.setState(i.id,Nt(Ku,o,{warn:!0}));Ru.is(n)&&this.core.setState(n.id,Nt(Ku,o,{warn:!0}))}}getMapDataObject(t){return this.getMapDataInternal()?.getMapDataById(t)}getMapDataInternal(){if(this.mapData)return wm(this.mapData)}getMapData(){return this.mapData}addMap(t,o){return new Promise(n=>{let i;try{i=wm(t)}catch(h){A.error("Error adding map",h),n(t);return}this.mapDataExternal[t.mapName]=t,this.mapData=t;let{mvf:a}=i,l=a["manifest.geojson"].features[0].geometry.coordinates;this.core.mode!=="outdoors-overlay"&&this.Camera.set({center:new fe(l[1],l[0])});let c=a["manifest.geojson"].features[0].properties.name,p=new Hh(`mapObject-${c}`,i,o,this);this.currentMap=p,this.currentMap.loadAllFloors(),this.currentMap.setFloor(this.currentMap.startingFloorId);let u=this.core.getBoundingArea(p.currentFloor.id);u==null&&A.error("Could not determine bounding box for map:",p.currentFloor.id);let f=o?.outdoorView?.layersHiddenByGeometry??[];if(f.length>0){let h,b=[];for(let x of p.floorStacksById.values())if(x.defaultFloor.footprint&&x.defaultFloor.footprint.geometry!=null&&x.defaultFloor.footprint.geometry?.coordinates.length>0){let T=x.defaultFloor.footprint,v=h1(T);h==null?h=v:H5(h,v),b.push(T)}b.length>0&&h!=null&&(this.core.hideOutdoorLayersIntersectingPolygons(h,b,f),this.hiddenOutdoorGeometries.push([h,b,f]))}if(this.mapObjects.push(p),i.getMVFFeatureByType("floor").forEach(h=>{this.mapsByFloorId[h.id]=p}),p.on("floor-change-start",h=>{this.externalPubSub.publish("floor-change-start",{reason:h.reason,floor:this.getMapDataInternal()?.getById("floor",h.floorId)??this.currentFloor,previousFloor:this.getMapDataInternal()?.getById("floor",h.previousFloorId)??this.currentFloor})}),p.on("floor-change",h=>{this.externalPubSub.publish("floor-change",{reason:h.reason,floor:this.currentFloor,previousFloor:this.getMapDataInternal()?.getById("floor",h.previousFloorId)??this.currentFloor}),this.externalPubSub.publish("state-change-internal",{currentFloor:this.currentFloor,currentFloorStack:this.currentFloorStack})}),o?.zoomLevel!=null)this.core.camera.setZoomLevel(o.zoomLevel),n(t);else if(this.core.mode!=="outdoors-overlay"&&u){let h=o?.screenOffsets??{top:c0*this.core.canvasHeight,left:c0*this.core.canvasWidth,right:c0*this.core.canvasWidth,bottom:c0*this.core.canvasHeight};this.core.camera.focusOn(u,{duration:D5,padding:h}).then(()=>{this.Camera.setElevation(this.currentFloor.elevation),n(t)})}else n(t)})}setFloor(t,o){return this.currentMap.setFloor(yf(t),o)}setFloorStack(t,o){return this.currentMap.setFloorStack(yf(t),o)}updateWatermark(t){this.core.updateWatermark(t)}get currentFloorStack(){let t=this.currentMap.currentFloorStack.id;if(!t)throw new wr("Missing currentFloorStack.");let o=this.mapData?.getById("floor-stack",t);if(!o)throw new wr("FloorStack was not found in map data.");return o}get currentFloor(){let t=this.currentMap.currentFloor.id;if(!t)throw new wr("Missing currentFloor object from GeoJsonApi");let o=this.mapData?.getById("floor",t);if(!o)throw new wr("Missing currentFloor");return o}getState(t){typeof t=="object"&&Bn.is(t)&&A.warn("Cannot get state of a Path directly. Use getState() on individual segments within Path.segments[] instead.");let o=$5(t,this),n=this.core.getState(o);if(n){if(["interior-walls","exterior-walls"].includes(t)&&n.type==="geometry-group")return EA(n);if(["interior-doors","exterior-doors"].includes(t)&&n.type==="geometry-group")return eA(n);if(n.type==="geometry"){let i;return"parent"in n&&n.parent&&n.parent.type==="geometry-group"&&(i=this.core.getState(n.parent)),uA(n,i)}else{if(n.type==="label"&&n.options.appearance&&n.options.rank!==void 0&&n.options.interactive!==void 0)return fA(n);if(n.type==="marker"&&n.options?.rank!==void 0&&n.options.interactive!==void 0)return gA(n,this.Markers.getById(n.id.toString())?.marker);if(n.type==="model")return kA(n);if(n.type==="image")return PA(n);if(n.type==="text3d")return wA(n);if(n.type==="geometry-group"&&t&&typeof t!="string"&&ha.is(t))return IA(n);if(n.type==="path")return xA(n);if(n.type==="group-container"&&typeof t!="string"&&Bo.is(t))return pA(n,this.currentMap.floorsById.get(t.id),this.core);if(n.type==="group-container"&&n.children.length>0&&typeof t!="string"&&Ar.is(t)){let i=this.core.getState(n.children[0].id);return rA(i)}}}}setHoverColor(t){this.core.setState({hoverColor:t})}getHoverColor(){let t=this.core.getState();return t?.type==="map-view"?t.hoverColor:void 0}createCoordinateFromScreenCoordinate(t,o,n){if(n!=null){let p=this.core.projectScreenXYToCoordinate(t,o,!0);return p?new fe(p.coordinate[1],p.coordinate[0],n.id):void 0}let i=this.core.projectScreenXYToCoordinate(t,o);if(i==null||i.coordinate==null)return;let{coordinate:a,groupContainers:l}=i,c=l?.find(p=>{let u=p.userData.entityId.toString();return u.includes("f_")||u.includes("m_")})?.userData.entityId.toString();return new fe(a[1],a[0],c)}getScreenCoordinateFromCoordinate(t){let o=0;if(t.floorId!=null){let n=this.mapData?.getById("floor",t.floorId);n!=null&&(o=this.getState(n)?.altitude??0)}return this.core.projectCoordinateToScreenXY([t.longitude,t.latitude,o])}isInView(t){return this.core.isInView(typeof t=="string"?t:t.id)}getInView(t,o){let n=this.core.queryGeometry2DInView({screenOffsets:o?.screenOffsets,fullyContains:o?.fullyContains});if(n.length===0)return[];let i=[];switch(t){case fa.__type:i=n.map(a=>this.Labels.getById(a)).filter(a=>a!=null).map(a=>a.label);break;case ds.__type:i=n.map(a=>this.Markers.getById(a)).filter(a=>a!=null).map(a=>a.marker)}return i}async __EXPERIMENTAL__auto(){let t=this.getMapDataInternal();if(!t)throw new Error("Map data not found");return await t7(t,this)}tween(t){let o=new di(t);return this.core.getExternalTweenGroup().add(o),this.core.render(),o}removeTween(t){this.core.getExternalTweenGroup().remove(t)}tweenGroup(){return this.core.getExternalTweenGroup()}get __core(){return this.core}getCameraState(){return this.core.camera.getState()}getNavigationState(){return{isMultiFloor:this.Navigation.isMultiFloor,floorStacks:this.Navigation.floorStacks,floors:this.Navigation.floors,activeDirections:this.Navigation.activeDirections,activePath:this.Navigation.activePath,paths:this.Navigation.paths}}getAllState(){return{currentFloor:this.currentFloor,currentFloorStack:this.currentFloorStack,Camera:this.getCameraState(),Navigation:this.getNavigationState(),manualFloorVisibility:this.manualFloorVisibility}}publishAllState(){this.externalPubSub.publish("state-change-internal",this.getAllState())}clear(){this.Navigation.clear(),this.BlueDot.disable(),this.Shapes.removeAll(),this.Paths.removeAll(),this.Models.removeAll(),this.Markers.removeAll(),this.Image3D.removeAll(),this.Labels.removeAll()}destroy(){this.clear(),this.core.destroy()}_publishBlueDotState(t){let o;if(t)o=t;else{let{state:n,following:i,heading:a,accuracy:l,coordinate:c,floor:p}=this.BlueDot;o={state:n,following:i,heading:a,accuracy:l,coordinate:c,floor:p}}this.externalPubSub.publish("state-change-internal",{BlueDot:o})}getOptimalVisualDistanceBetweenFloors(t,o=!1){let n=this.currentMap;if(!n){A.error("Cannot compute optimal visual distance between floors. Missing current map.");return}if(t.length<2){A.warn("Cannot compute optimal visual distance between floors. Must provide at least 2 floors.");return}let i=n.renderer.getInternalState().geometry3DMap.get(t[0].id),a=n.renderer.getInternalState().geometry3DMap.get(t[1].id);if(!i||!a){A.warn("Cannot compute optimal visual distance between floors. Floors not found in current map.");return}if(xp(i,"group-container"),xp(a,"group-container"),o){let c=new sr;c.setFromObject(i);let p=new sr;if(p.setFromObject(a),i.children.forEach(v=>{v instanceof Le&&v.userData.debugBox&&Ht(v)}),a.children.forEach(v=>{v instanceof Le&&v.userData.debugBox&&Ht(v)}),!Bl(c)||!Bl(p))return;let u=new Hn(c.max.x-c.min.x,c.max.y-c.min.y,c.max.z-c.min.z),f=new Nr({color:255,transparent:!0,opacity:.5}),h=new Le(u,f);h.position.set((c.min.x+c.max.x)/2,(c.min.y+c.max.y)/2,(c.min.z+c.max.z)/2),h.userData.debugBox=!0;let b=new Hn(p.max.x-p.min.x,p.max.y-p.min.y,p.max.z-p.min.z),x=new Nr({color:"cyan",transparent:!0,opacity:.5}),T=new Le(b,x);T.position.set((p.min.x+p.max.x)/2,(p.min.y+p.max.y)/2,(p.min.z+p.max.z)/2),T.userData.debugBox=!0,i.add(h),a.add(T)}let l=n.renderer.computeMinZOffsetBetweenContainers(i,a);if(l!==-1)return l}};Rg=new WeakMap,Bg=new WeakMap;function KZ(e){if(e===""){rT(""),tT("");return}tT(`${e}/${A0}`),rT(`${e}/${k0}`)}d();var p0=class{constructor(r){m(this,"state");m(this,"update");this.update=r.Debug.update.bind(r.Debug),this.state=r.Debug.state}};d();var r7=J.object({environment:J.union([J.literal("basic"),J.literal(!1)]).optional(),text3d:J.object({hoverColor:J.string().optional()}).optional(),geometry:J.object({hoverColor:J.string().optional()}).optional(),backgroundColor:J.string().optional(),backgroundAlpha:J.number().optional()}).strict();d();var GT=hp(UC(),1);var QZ=(e,r)=>{let t={},o=(n,i,a)=>{for(let l in i){let c=n[l],p=i[l];typeof p=="object"&&!Array.isArray(p)&&p!==null&&typeof c=="object"&&!Array.isArray(c)&&c!==null?(a[l]={},o(c,p,a[l])):a[l]=c}};return o(e,r,t),t},o7=(e,r)=>{let t=QZ(e,r),o=(0,GT.default)({},t,r),n=(0,GT.default)({},t),i=(a,l,c,p=n)=>{for(let u in l){let f=a[u],h=l[u];if(typeof h=="number"&&typeof f=="number")p[u]=f+(h-f)*c;else if(typeof h=="string"&&typeof f=="string"){if(um(f)&&um(h)){let b=S0(f),x=S0(h);b&&x?p[u]=wC([b[0]+(x[0]-b[0])*c,b[1]+(x[1]-b[1])*c,b[2]+(x[2]-b[2])*c]):A.warn(`Color "${u}" could not be animated!`)}}else typeof h=="object"&&h!==null&&typeof f=="object"&&f!==null?i(f,h,c,p[u]):A.warn(`Value "${u}" could not be animated!`)}};return a=>(a=Math.min(Math.max(a,0),1),a===0?e:a===1?o:(i(t,r,a),n))};var ap,ne,bs,Ng=class{constructor(r){S(this,ap);S(this,ne);S(this,bs);m(this,"Camera");m(this,"Labels");m(this,"Text3D");m(this,"Markers");m(this,"Image3D");m(this,"Models");m(this,"Paths");m(this,"Exporter");m(this,"Navigation");m(this,"__BlueDot");m(this,"Style");m(this,"Shapes");m(this,"Outdoor");m(this,"update",()=>{s(this,ne).core.render()});m(this,"__LEGACY_GET_DIRECTIONS_SYNC",(r,t,o)=>s(this,ne).getMapData()?.__LEGACY_GET_DIRECTIONS_SYNC(r,t,o)??void 0);m(this,"getDirections",(r,t,o)=>s(this,ne).getMapData()?.getDirections(r,t,o)??Promise.resolve(void 0));m(this,"__LEGACY_GET_DIRECTIONS_MULTI_DESTINATION_SYNC",(r,t,o)=>s(this,ne).getMapData()?.__LEGACY_GET_DIRECTIONS_MULTI_DESTINATION_SYNC(r,t,o)??void 0);m(this,"getDirectionsMultiDestination",(r,t,o)=>s(this,ne).getMapData()?.getDirectionsMultiDestination(r,t,o)??Promise.resolve(void 0));m(this,"on",(r,t)=>{s(this,ap).on(r,t)});m(this,"off",(r,t)=>{s(this,ap).off(r,t)});m(this,"Debug");w(this,ap,new ke),w(this,bs,r);let t=new _g(r,this,s(this,ap));w(this,ne,t),this.Camera=s(this,ne).Camera,this.Markers=s(this,ne).Markers,this.Models=s(this,ne).Models,this.Labels=s(this,ne).Labels,this.Text3D=s(this,ne).Text3D,this.Exporter=s(this,ne).Exporter,this.Paths=s(this,ne).Paths,this.Navigation=s(this,ne).Navigation,this.__BlueDot=s(this,ne).BlueDot,this.Shapes=s(this,ne).Shapes,this.Style=s(this,ne).Style,this.Outdoor=s(this,ne).Outdoor,this.Image3D=s(this,ne).Image3D,s(this,bs).container.dataset.version=y.env.npm_package_version,this.Debug=new p0(s(this,ne).core)}updateState(r,t){return s(this,ne).updateState(r,t)}animateState(r,t,o){let n=s(this,ne).getState(r);if(n==null)return A.warn(`Cannot animate state of ${r}.`),new Promise(p=>p({result:"completed"}));let i=o7(n,t),a=s(this,ne).tween({percent:0}).to({percent:1},o?.duration??1e3).onUpdate(({percent:c})=>{s(this,ne).updateState(r,i(c))});o?.easing&&o.easing in as&&a.easing(as[o.easing]);let l=new Promise(c=>{a.onComplete(()=>{s(this,ne).removeTween(a),c({result:"completed"})}).onStop(()=>{s(this,ne).removeTween(a),c({result:"cancelled"})}),a.start()});return l.cancel=()=>{a.stop(),s(this,ne).updateState(r,i(0))},l}updateGlobalState(r){try{r7.parse(r)}catch(t){A.error("updateGlobalState",t);return}if(typeof r=="object"){let t={};if(r.text3d?.hoverColor&&(t.text3dHoverColor=r.text3d.hoverColor),r.geometry?.hoverColor&&(t.hoverColor=r.geometry.hoverColor),r.backgroundColor||r.backgroundAlpha!==void 0){let o=r.backgroundColor??s(this,ne).core.backgroundColor,n=r.backgroundAlpha??s(this,ne).core.backgroundAlpha;s(this,ne).core.setBackgroundColor(o,n)}r.environment!=null&&s(this,ne).core.setEnvironment(r.environment),s(this,ne).core.setState(t)}}get options(){return L5(s(this,ne).currentMap.options)}getGlobalState(){let r=s(this,ne).core.getState();return{backgroundColor:s(this,ne).core.backgroundColor,backgroundAlpha:s(this,ne).core.backgroundAlpha,environment:s(this,ne).core.getEnvironment(),geometry:{hoverColor:r.hoverColor},text3d:{hoverColor:r.text3dHoverColor}}}getMapData(){if(s(this,ne).mapData==null)throw new wr("MapData not found.");return s(this,ne).mapData}getDimensions(){return{width:s(this,bs).canvasWidth,height:s(this,bs).canvasHeight}}addMap(r,t){return s(this,ne).addMap(r,t)}setFloor(r,t){return s(this,ne).setFloor(r,t?.context)}setFloorStack(r,t){return s(this,ne).setFloorStack(r,t?.context)}preloadFloors(r){s(this,ne).preloadFloors(r)}tween(r){return s(this,ne).tween(r)}removeTween(r){s(this,ne).removeTween(r)}get tweenGroup(){return s(this,ne).tweenGroup()}get currentFloorStack(){return s(this,ne).currentFloorStack}get currentFloor(){return s(this,ne).currentFloor}updateWatermark(r){s(this,ne).updateWatermark(r)}getState(r){return s(this,ne).getState(r)}setHoverColor(r){s(this,ne).setHoverColor(r)}getHoverColor(){return s(this,ne).getHoverColor()}convertAltitudeToMercatorZoomLevel(r){return s(this,ne).core.getSystems().cameraSystem.convertAltitudeToZoomLevel(r)}convertMercatorZoomLevelToAltitude(r){return s(this,ne).core.getSystems().cameraSystem.convertZoomLevelToAltitude(r)}isInView(r){return s(this,ne).isInView(r)}getInView(r,t){return s(this,ne).getInView(r,t)}getDistance(r,t){return s(this,ne).getMapData()?.getDistance(r,t)}createCoordinate(r,t,o){return typeof r=="object"?new fe(r):new fe(r,t,o?.id)}createCoordinateFromScreenCoordinate(r,t,o){return s(this,ne).createCoordinateFromScreenCoordinate(r,t,o)}getScreenCoordinateFromCoordinate(r){return s(this,ne).getScreenCoordinateFromCoordinate(r)}__EXPERIMENTAL__auto(){s(this,ne).__EXPERIMENTAL__auto()}get __core(){if(y.env.INTERNAL==="true")return s(this,ne).core;throw new Error("__core is not available.")}get container(){return s(this,bs).container}publishAllState(){s(this,ne).publishAllState()}clear(){s(this,ne).clear()}destroy(){s(this,ne).destroy()}async enableDebug(r={}){let{Inspector:t}=await import("./inspector-HQV23IML.js");await new t(this,s(this,ne)).enable(r)}async takeScreenshot(){return await s(this,bs).renderSync(),s(this,bs).rendererDomElement.toDataURL("image/png")}get manualFloorVisibility(){return s(this,ne).manualFloorVisibility}set manualFloorVisibility(r){s(this,ne).manualFloorVisibility=r}getOptimalVisualDistanceBetweenFloors(r){return s(this,ne).getOptimalVisualDistanceBetweenFloors(r)}get __INTERNAL__hidePathsNotOnCurrentFloor(){return s(this,ne).hidePathsNotOnCurrentFloor}set __INTERNAL__hidePathsNotOnCurrentFloor(r){s(this,ne).hidePathsNotOnCurrentFloor=!!r}};ap=new WeakMap,ne=new WeakMap,bs=new WeakMap;d();var qZ=1e3*60*60*2,_l,em,kt,xs,Ti,Vn,Ci,tm,rm,jg,jt,n7,i7,qu,d0,UT,VT,$T,om=class{constructor(r,t){S(this,jt);S(this,_l,new ke);S(this,em);S(this,kt);S(this,xs);S(this,Ti);S(this,Vn);S(this,Ci);S(this,tm);S(this,rm);S(this,jg,()=>{"key"in s(this,kt)&&"secret"in s(this,kt)&&W(this,jt,qu).call(this),W(this,jt,d0).call(this)});m(this,"on",(r,t)=>s(this,_l).on(r,t));m(this,"off",(r,t)=>s(this,_l).off(r,t));w(this,em,r),w(this,kt,t)}setMapIds(r){w(this,em,r)}setEnterprise(r){s(this,kt).enterprise=r}async readySync(){if((!("key"in s(this,kt))||!("secret"in s(this,kt)))&&!("accessToken"in s(this,kt))){A.error("No API keys or access token provided! Cannot preload tokens.");return}let r=[W(this,jt,qu).call(this),null];s(this,kt).enterprise||(r[1]=this.getSasTokensAsync());let[t,o]=await Promise.all(r);W(this,jt,$T).call(this),W(this,jt,UT).call(this,t),o!=null&&W(this,jt,VT).call(this,o),dm()&&globalThis.addEventListener?.("focus",s(this,jg))}async refreshing(){let r=[];return s(this,xs)!=null&&r.push(s(this,xs)),s(this,Ti)!=null&&r.push(s(this,Ti)),Promise.all(r)}getAccessTokenAsync(){return W(this,jt,qu).call(this)}getSasTokensAsync(){return W(this,jt,d0).call(this)}getAccessToken(){return s(this,Vn)==null?(A.error("Tokens must be loaded before reading synchronously! Try awaiting readySync() first."),{token:""}):s(this,Vn)}getSasToken(r){return this.isEnterpriseMode()?(A.error("SAS tokens are not available in the enterprise mode!"),{token:""}):s(this,Ci)==null?(A.error("Tokens must be loaded before reading synchronously! Try awaiting readySync() first."),{token:""}):r in s(this,Ci).tokens?s(this,Ci).tokens[r]:(A.error(`SAS token for map ${r} not found!`),{token:""})}isEnterpriseMode(){return s(this,kt).enterprise??!1}destroy(){W(this,jt,$T).call(this),s(this,_l).destroy(),dm()&&globalThis.removeEventListener("focus",s(this,jg))}};_l=new WeakMap,em=new WeakMap,kt=new WeakMap,xs=new WeakMap,Ti=new WeakMap,Vn=new WeakMap,Ci=new WeakMap,tm=new WeakMap,rm=new WeakMap,jg=new WeakMap,jt=new WeakSet,n7=function(r){let t=r.token!==s(this,Vn)?.token;w(this,Vn,r),t&&s(this,_l).publish("access-token-refreshed",{accessToken:r})},i7=function(r){let t=JSON.stringify(r.tokens)!==JSON.stringify(s(this,Ci)?.tokens);w(this,Ci,r),t&&s(this,_l).publish("sas-tokens-refreshed",{sasTokens:r.tokens})},qu=async function(r=!1){if("accessToken"in s(this,kt)&&typeof s(this,kt).accessToken=="string"){let t={token:s(this,kt).accessToken,expires:Date.now()+72e5};return w(this,Vn,t),t}if(!("key"in s(this,kt))||!("secret"in s(this,kt))||typeof s(this,kt).key!="string"||typeof s(this,kt).secret!="string")throw new Error("No API keys or access token provided!");return s(this,xs)!=null?s(this,xs):s(this,Vn)!=null&&s(this,Vn).expires!=null&&s(this,Vn).expires>Date.now()&&!r?s(this,Vn):(w(this,xs,mf({...s(this,kt),key:s(this,kt).key,secret:s(this,kt).secret},s(this,kt).enterprise??!1).then(t=>{let o={token:t.accessToken,expires:t.expiresTimestamp*1e3};return W(this,jt,n7).call(this,o),o}).catch(t=>{throw t}).finally(()=>{w(this,xs,void 0)})),s(this,xs))},d0=async function(r=!1){return this.isEnterpriseMode()?{tokens:{},expires:1/0}:s(this,Ti)!=null?s(this,Ti):s(this,Ci)!=null&&s(this,Ci).expires>Date.now()&&!r?s(this,Ci):(w(this,Ti,new Promise((t,o)=>{W(this,jt,qu).call(this).then(n=>{let i={},a=s(this,em).map(l=>aS({...s(this,kt),mapId:l},n.token).then(c=>{i[l]={token:c.token,expires:c.expires}}).catch(c=>{A.error(`Error getting SAS token for map ${l}:`,c)}));Promise.all(a).then(()=>{let l={tokens:i,expires:Math.min(...Object.values(i).map(c=>c.expires??1/0))};W(this,jt,i7).call(this,l),t(l)})}).catch(n=>{o(n)})})),s(this,Ti).catch(t=>{throw t}).finally(()=>{w(this,Ti,void 0)}),s(this,Ti))},UT=function(r){if(!("key"in s(this,kt))||!("secret"in s(this,kt)))return;let t=r.expires!=null?r.expires-Date.now():qZ;isFinite(t)&&w(this,tm,setTimeout(()=>{W(this,jt,qu).call(this,!0).then(o=>{W(this,jt,UT).call(this,o)})},t-qF))},VT=function(r){let t=r.expires-Date.now();isFinite(t)&&w(this,rm,setTimeout(()=>{W(this,jt,d0).call(this,!0).then(o=>{W(this,jt,VT).call(this,o)})},t-r5))},$T=function(){s(this,tm)!=null&&clearTimeout(s(this,tm)),s(this,rm)!=null&&clearTimeout(s(this,rm))};d();var eX=async(e,r)=>{let t=("mvfVersion"in(r??{})?r?.mvfVersion:void 0)??("options"in e&&"version"in(e.options??{})?e.options?.version:void 0),o={prefetchTokens:!0,...r||{},mvfVersion:t},n,i=tl();i.updateByUserOption(o);let a={};if("type"in e&&typeof e.type=="string"){if(a.enterprise=e.options?.enterprise,e.type==="binary"&&e.main instanceof Uint8Array){n=await t1(e.main,o.mvfVersion),a.languagePacks=[];for(let x of e.languagePacks??[])x.localePack instanceof Uint8Array&&a.languagePacks.push({language:x.language,localePack:await Sd(x.localePack)})}else if(e.type==="json")n=e.main,a.languagePacks=e.languagePacks??[];else throw new Error("Invalid backup type");e.type==="binary"&&e.main instanceof Uint8Array&&(a.binaryBundle=e.main)}else n=e,a.enterprise=n.enterprise!=null;i.setEnterprise(a.enterprise??!1);let l=e1(n),c=l.length>0?l:[o.mapId];o.baseAuthUri=i.getBaseAuthUri();let p=new om(c,{...o,enterprise:a.enterprise}),u;if("accessToken"in o&&o.accessToken)u=o.accessToken;else if("key"in o&&"secret"in o){let x;try{x=await p.getAccessTokenAsync()}catch(T){A.error("Failed getting token during hydrateMapData",T)}u=x?.token||""}if(a.outdoorViewToken=u,a.env=i,a.getMapDataOptions=o,o.prefetchTokens)try{await p.readySync()}catch(x){A.error("Failed to ready token manager!",x)}Rf()&&(a.enterprise&&A.warn("forceEnterpriseLocations is enabled, but the map is already an enterprise map!"),o.mvfVersion!=="3.0.0"&&A.warn("mvfVersion must be '3.0.0' when forceEnterpriseLocations is enabled!"));let f=new Ec(n,a);u&&f.Analytics.init({accessToken:u,mapId:o.mapId,key:"key"in o?o.key:void 0,secret:"secret"in o?o.secret:void 0,...o.analytics,baseUri:i.getAnalyticsBaseUri(),context:o.analytics?.context});let h=new Mm(f),b=f.findPreferredLanguage({languageCode:o.language,fallbackToNavigatorLanguage:!1});if(b)try{await h.changeLanguage(b.code)}catch{}return typeof r?.onMVFParsed=="function"&&r.onMVFParsed(n),h};d();var s7=(e,{id:r}={})=>{let t=Array.isArray(e)?e:[e];if(!t.every(i=>typeof i=="string"))return;let o=t.join(""),n=null;if(r){let i=document.getElementById(r);i instanceof HTMLStyleElement&&(n=i)}n==null&&(n=document.createElement("style")),r&&r!==""&&(n.id=r),n.textContent=o,document.head.appendChild(n)};var a7=`:root {
786
+ </svg>`},HZ=/<svg([^>]*)>/g;function YA(e,r,t){let o=$Z[e];return o?o.replace(HZ,`<svg$1 xmlns="http://www.w3.org/2000/svg" style="fill:${r}; width:${t}px; height:${t}px">`):null}function zZ(e){return XA.sanitize(e,{USE_PROFILES:{svg:!0}})}function WZ(e,r){let n=new DOMParser().parseFromString(e,"image/svg+xml").documentElement;return n==null||n.tagName==="parsererror"||n.tagName.toLowerCase()!=="svg"?(A.error("Failed to parse SVG",{svg:e,tagName:n?.tagName}),e):(r!=null&&(n.setAttribute("color",r),n.querySelectorAll("*").forEach(l=>{(l.getAttribute("fill")!=null||l.tagName==="path")&&l.getAttribute("fill")!=="none"&&l.setAttribute("fill","currentColor"),l.getAttribute("stroke")!=null&&l.getAttribute("stroke")!=="none"&&l.setAttribute("stroke","currentColor")})),new XMLSerializer().serializeToString(n))}async function JA(e,r){let t="";try{if(e.trim()==="")throw new Error("URL is empty!");r?.style==="fill"&&(e=e.replace(".svg","-fill.svg"));let o=await tn()(e),n=o.headers.get("content-type");if(n?.includes("image/svg+xml")){let i=await o.text();return t=zZ(i),r?.color!=null&&(t=WZ(t,r.color)),{icon:t,type:"svg"}}else{if(n?.includes("image"))return{icon:e,type:"image"};throw new Error(`Expected SVG or Image content, but received: ${n}`)}}catch(o){return A.error(`Failed to fetch icon from ${e}.`,o),null}}d();function KA(e){return e.locationProfiles.some(r=>r.categories.some(t=>t.name.includes("Restroom")))}function QA(e){return e.locationProfiles.some(r=>r.categories.some(t=>t.name.includes("Parking")))}var sp={default:"#3D5676",connection:"#128387",washroom:"#3161B4",point:"#AD468F",parking:"#418425",door:"#A0552C"},Lg={elevator:"connection-elevator-12x12",escalator:"connection-stairs-12x12",stairs:"connection-stairs-12x12",point:"point-of-interest-12x12",door:"door-12x12",building:"building-12x12"};function ZZ(e){let r=null;if(an.is(e))switch(e.type){case"elevator":r=Lg.elevator;break;case"escalator":case"stairs":default:r=Lg.stairs}else sn.is(e)?r=Lg.point:go.is(e)?r=Lg.door:Ar.is(e)&&(r=Lg.building);return r!=null?YA(r,"#FFFFFF",12):null}function qA(e){return an.is(e)?sp.connection:Ar.is(e)?sp.default:KA(e)?sp.washroom:QA(e)?sp.parking:sn.is(e)?sp.point:go.is(e)?sp.door:sp.default}async function XZ(e,r){let t=null,o="locationProfiles"in e?e.locationProfiles.find(n=>n.icon!=null)?.icon:null;if(o?.url!=null&&(t=await JA(o.url,{color:r.color,style:"fill"})),t==null){let n=ZZ(e);n!=null&&(t={icon:n,type:"svg"})}return t}async function YZ(e){return an.is(e)||go.is(e)?"low":sn.is(e)||Ar.is(e)?"high":"medium"}async function JZ(e){let r={appearance:{color:qA(e),pinOutlineColor:qA(e),iconPadding:8,iconSize:24,textSize:12.5,iconScale:{on:"zoom-level",input:[18,20],output:[.7,1]}},rank:await YZ(e),interactive:!0},t=await XZ(e,{color:"#FFFFFF"});return t!=null&&(r.appearance.icon=t.icon,t.type==="svg"?Ar.is(e)&&(r.appearance.iconSize=30,r.appearance.iconPadding=10):t.type==="image"&&(r.appearance.iconSize=48,r.appearance.iconPadding=2,r.appearance.pinOutlineColor="#FFFFFF",r.rank="high")),r}function e7(e,r){let t=[...e.getByType("connection"),...e.getByType("point-of-interest"),...e.getByType("space"),...e.getByType("object"),...e.getByType("door"),...e.getByType("facade")].flatMap(async o=>{let n=[],i=await JZ(o);return an.is(o)?n=o.coordinates.map(a=>r.Labels.add(a,o.name,i)):Ar.is(o)?o.spaces.length>0&&o.floorStack.name!=null&&o.floorStack.name!==""&&n.push(r.Labels.add(o.spaces[0],o.floorStack.name,i)):"name"in o&&o.name!=null&&o.name!==""&&n.push(r.Labels.add(o,o.name,i)),n});return Promise.all(t).then(o=>o.flat())}async function t7(e,r){let t=[e7(e,r),AA(e,r)],[o]=await Promise.all(t);return{labels:o}}var p0=.05,Rg,Bg,_g=class extends ke{constructor(t,o,n){super();m(this,"core");m(this,"mapObjects",[]);m(this,"id");m(this,"mapDataExternal",{});m(this,"mapsByFloorId",{});m(this,"mapData");m(this,"currentMap");m(this,"hiddenOutdoorGeometries",[]);m(this,"lastFacadeIntersected");S(this,Rg,!1);S(this,Bg,!1);m(this,"mapView");m(this,"externalPubSub");m(this,"Camera");m(this,"Labels");m(this,"Text3D");m(this,"Markers");m(this,"Models");m(this,"Paths");m(this,"Exporter");m(this,"Navigation");m(this,"Outdoor");m(this,"BlueDot");m(this,"Shapes");m(this,"Style");m(this,"Image3D");m(this,"update",()=>{this.core.render()});this.core=t,this.mapView=o,this.externalPubSub=n,this.Camera=new Bh(this),this.id=this.core.addGroupContainer("root").id.toString();let i=new Hh("outdoors-container",void 0,void 0,this);this.mapObjects.push(i),this.currentMap=i,this.core.on("pre-render",()=>{n.publish("pre-render")}),this.core.on("post-render",()=>{n.publish("post-render")}),this.core.on("resize",()=>{n.publish("resize")}),this.core.on("render-error",({error:u})=>{n.publish("render-error",{error:new oC(u instanceof Error?u.message:"Unknown error")})});let a=u=>{let f=this.getMapDataObject(u);switch(f?.__type){case"facade":return f;case"floor":return f.floorStack.facade;default:return null}};this.core.on("geometry-in-focus",u=>{let f=new Set;for(let h of u){let b=a(h);b&&f.add(b)}n.publish("facades-in-view-change",{facades:Array.from(f)})}),this.core.getSystems().renderSystem.on("camera-state-change",()=>{n.publish("state-change-internal",{Camera:this.getCameraState()})});let l=new Fh(this.Camera,{precision:7});this.core.on("camera-change",()=>{n.publish("camera-change",l)});let c=u=>f=>{let h=[],b=[],x=[],T=[];f.labels.forEach(R=>{let N=this.Labels.getById(R.toString());N&&h.push(N.label)}),f.markers.forEach(R=>{let N=this.Markers.getById(R.toString())||this.Navigation.getMarkerById(R.toString());N&&b.push(N.marker)}),f.models.forEach(R=>{let N=this.Models.getById(R.toString());N&&x.push(N.model)}),f.paths.forEach(R=>{let N=this.Paths.getById(R.toString())||this.Navigation.getPathById(R.toString());N&&T.push(N.path)});let v=f.geometry.includes(ng),I=f.geometry.filter(R=>R!==ng),M;I.length>0&&(M=I.map(R=>this.getMapDataInternal()?.getById("space",R)).filter(Boolean)[0],M||(M=I.map(R=>this.getMapDataInternal()?.getById("object",R)).filter(Boolean)[0]),M||(M=I.map(R=>this.Shapes.getById(R)).filter(Boolean)[0]));let O=f.containers.reduce((R,N)=>{let X=this.getMapDataInternal()?.getById("floor",N);return X&&Bo.is(X)&&R.push(X),R},[]),C,E=0;if(O.length>0){C=O[0].id;let R=this.core.getState(C);E=f.coordinate[2]?f.coordinate[2]-R.altitude:E}let _;this.lastFacadeIntersected&&this.lastFacadeIntersected.spaces.forEach(R=>{this.core.setState(R.id,{hovered:!1})}),M&&vr.is(M)&&(_=I.map(R=>this.getMapDataInternal()?.facadesBySpaceId[R]).filter(Boolean)[0],_&&_.spaces.forEach(R=>{this.core.setState(R.id,{hovered:!0})})),this.lastFacadeIntersected=_;let G={coordinate:new fe({latitude:f.coordinate[1],longitude:f.coordinate[0],floorId:C,verticalOffset:E}),spaces:M&&vr.is(M)?[M]:[],objects:M&&No.is(M)?[M]:[],shapes:M&&ha.is(M)?[M]:[],markers:b,labels:h,models:x,paths:T,floors:O,facades:_?[_]:[]};"pointerEvent"in f&&(G.pointerEvent=f.pointerEvent),v&&(u==="click"?this.BlueDot.publish("click",{coordinate:new fe({longitude:f.coordinate[0],latitude:f.coordinate[1]})}):u==="hover"&&this.BlueDot.publish("hover")),n.publish(u,G)};this.core.on("hover",c("hover")),this.core.on("click",c("click")),this.core.on("user-interaction-start",()=>{n.publish("user-interaction-start")}),this.core.on("user-interaction-end",()=>{n.publish("user-interaction-end")});let p={currentMapGetter:()=>this.currentMap};this.Markers=new zh(p),this.Models=new Yh(p),this.Labels=new Gh(p),this.Text3D=new bg(p),this.Exporter=new jh(p),this.Paths=new Kh(p),this.Navigation=new _h(this.core,this,p.currentMapGetter),this.on("navigation-state-change",u=>{this.externalPubSub.publish("state-change-internal",{Navigation:u})}),this.on("navigation-connection-click",u=>{this.externalPubSub.publish("navigation-connection-click",u)}),this.on("navigation-active-path-change",u=>{this.externalPubSub.publish("navigation-active-path-change",u)}),this.BlueDot=new Xu(this.core,this),this.BlueDot.on("blue-dot-position-update",()=>{this._publishBlueDotState({coordinate:this.BlueDot.coordinate,heading:this.BlueDot.heading,accuracy:this.BlueDot.accuracy,floor:this.BlueDot.floor})}),this.BlueDot.on("blue-dot-state-change",()=>{this._publishBlueDotState({state:this.BlueDot.state})}),this.BlueDot.on("blue-dot-follow-change",()=>{this._publishBlueDotState({following:this.BlueDot.following})}),this.Outdoor=new Yu(this.core,this.hiddenOutdoorGeometries),this.Outdoor.enabled&&(this.core.on("outdoor-view-loaded",()=>{n.publish("outdoor-view-loaded")}),this.core.on("outdoor-style-loaded",()=>{n.publish("outdoor-style-loaded")})),this.Image3D=new Zh(p),this.Shapes=new ug(p),this.Style=new fg(p)}get manualFloorVisibility(){return s(this,Rg)}set manualFloorVisibility(t){w(this,Rg,t),this.externalPubSub.publish("state-change-internal",{manualFloorVisibility:t})}get hidePathsNotOnCurrentFloor(){return s(this,Bg)}set hidePathsNotOnCurrentFloor(t){w(this,Bg,t),this.currentMap?.updatePathLayersVisibility()}preloadFloors(t){t.forEach(o=>{o instanceof Bo&&this.core.setState(o.id,{preloadGeometry:!0})})}updateState(t,o){if(o==null||typeof o!="object")return;if(t==="interior-walls"){this.currentMap.floors.forEach(i=>{let a=i.layers.get(rr);if(a){let l=a.layers.get(sl);l&&this.core.hasState(l)&&this.core.setState(l,FT(Nt(Qu,o,{warn:!0}),this.core.getState(l)))}});return}if(t==="exterior-walls"){this.currentMap.floors.forEach(i=>{let a=i.layers.get(rr);if(a){let l=a.layers.get(ts);l&&this.core.hasState(l)&&this.core.setState(l,FT(Nt(Qu,o,{warn:!0}),this.core.getState(l)))}});return}if(t==="interior-doors"){this.currentMap.floors.forEach(i=>{let a=i.layers.get(rr);if(a){let l=a.layers.get(Gd);l&&this.core.hasState(l)&&this.core.setState(l,i0(Nt(ip,o,{warn:!0}),this.core.getState(l)))}});return}if(t==="exterior-doors"){this.currentMap.floors.forEach(i=>{let a=i.layers.get(rr);if(a){let l=a.layers.get(Ud);l&&this.core.hasState(l)&&this.core.setState(l,i0(Nt(ip,o,{warn:!0}),this.core.getState(l)))}});return}let n=typeof t=="string"?this.getMapDataObject(t):t;if(n){if(n.__type!==Bn.__type&&!this.core.hasState(n.id)){A.warn(`Failed to update state for "${n.id}". No ${n.__type} found with that ID.`);return}if(fa.is(n))return this.core.setState(n.id,hA(Nt(OT,o,{warn:!0}),this.core.getState(n.id)));if(us.is(n))return this.core.setState(n.id,yA(Nt(PT,o,{warn:!0}),this.core.getState(n.id)));if(vr.is(n)||No.is(n)){let i=this.core.getState(n.id);if(i!=null){let a=i.parent&&i.parent.type==="geometry-group"?this.core.getState(i.parent):void 0;this.core.setState(n.id,mA(Nt(Ju,o,{warn:!0}),i,a))}}if(ai.is(n)&&this.core.setState(n.id,Nt(Ju,o,{warn:!0})),Wc.is(n)&&this.core.setState(n.id,Nt(kT,o,{warn:!0})),go.is(n)&&this.core.setState(n.id,i0(Nt(ip,o,{warn:!0}),this.core.getState(n.id))),ha.is(n)&&this.core.setState(n.id,Nt(Eg,o,{warn:!0})),Xc.is(n)){let{position:i,scale:a,rotation:l,...c}=Nt(DA,o,{warn:!0}),p=c;i&&(p.position=[i.longitude,i.latitude,i.verticalOffset]),a!=null&&(Array.isArray(a)?p.scale=a:p.scale=[a,a,a]),l!=null&&(Array.isArray(l)?p.rotation=l:p.rotation=[l,l,l]),i&&n.updateTarget(i),this.core.setState(n.id,p)}if(Bo.is(n)){let i=this.currentMap.floorsById.get(n.id);if(i==null)return;let a=Nt(Og,o,{warn:!0});this.core.setState(n.id,a);let l=i.layers.get(rr);l!=null&&"geometry"in o&&o.geometry&&this.core.setState(l.containerId,Nt(Ig,o.geometry,{warn:!0}));let c=i.layers.get(rs);if(c!=null&&"labels"in o&&o.labels){let x=Nt(Sg,o.labels,{warn:!0});"enabled"in x&&typeof x.enabled=="boolean"&&c.setVisible(x.enabled)}let p=i.layers.get(li);if(p!=null&&"markers"in o&&o.markers){let x=Nt(Tg,o.markers,{warn:!0});"enabled"in x&&typeof x.enabled=="boolean"&&p.setVisible(x.enabled)}let u=i.layers.get(Vd);u!=null&&"footprint"in o&&o.footprint&&this.core.setState(u.containerId,Nt(vg,o.footprint,{warn:!0}));let f=i.layers.get(al);if(f!=null&&"occlusion"in o&&o.occlusion){let x=Nt(Mg,o.occlusion,{warn:!0});"enabled"in x&&typeof x.enabled=="boolean"&&f.setVisible(x.enabled)}let h=i.layers.get($d);if(h!=null&&"images"in o&&o.images){let x=Nt(Cg,o.images,{warn:!0});"visible"in x&&typeof x.visible=="boolean"&&h.setVisible(x.visible)}let b=i.layers.get(os);if(b!=null&&"paths"in o&&o.paths!=null){let x=Nt(wg,o.paths,{warn:!0});x.visible!=null&&typeof x.visible=="boolean"&&b.setVisible(x.visible)}}if(Ar.is(n)){let i=this.core.getState(n.id);for(let a of i.children)a.type==="group-container"&&this.core.setState(a.id,Nt(xg,o,{warn:!0}))}if(El.is(n)&&this.core.setState(n.id,Nt(MA,o,{warn:!0})),Bn.is(n))for(let i of n.segments)this.core.setState(i.id,Nt(Ku,o,{warn:!0}));Ru.is(n)&&this.core.setState(n.id,Nt(Ku,o,{warn:!0}))}}getMapDataObject(t){return this.getMapDataInternal()?.getMapDataById(t)}getMapDataInternal(){if(this.mapData)return wm(this.mapData)}getMapData(){return this.mapData}addMap(t,o){return new Promise(n=>{let i;try{i=wm(t)}catch(h){A.error("Error adding map",h),n(t);return}this.mapDataExternal[t.mapName]=t,this.mapData=t;let{mvf:a}=i,l=a["manifest.geojson"].features[0].geometry.coordinates;this.core.mode!=="outdoors-overlay"&&this.Camera.set({center:new fe(l[1],l[0])});let c=a["manifest.geojson"].features[0].properties.name,p=new Hh(`mapObject-${c}`,i,o,this);this.currentMap=p,this.currentMap.loadAllFloors(),this.currentMap.setFloor(this.currentMap.startingFloorId);let u=this.core.getBoundingArea(p.currentFloor.id);u==null&&A.error("Could not determine bounding box for map:",p.currentFloor.id);let f=o?.outdoorView?.layersHiddenByGeometry??[];if(f.length>0){let h,b=[];for(let x of p.floorStacksById.values())if(x.defaultFloor.footprint&&x.defaultFloor.footprint.geometry!=null&&x.defaultFloor.footprint.geometry?.coordinates.length>0){let T=x.defaultFloor.footprint,v=g1(T);h==null?h=v:H5(h,v),b.push(T)}b.length>0&&h!=null&&(this.core.hideOutdoorLayersIntersectingPolygons(h,b,f),this.hiddenOutdoorGeometries.push([h,b,f]))}if(this.mapObjects.push(p),i.getMVFFeatureByType("floor").forEach(h=>{this.mapsByFloorId[h.id]=p}),p.on("floor-change-start",h=>{this.externalPubSub.publish("floor-change-start",{reason:h.reason,floor:this.getMapDataInternal()?.getById("floor",h.floorId)??this.currentFloor,previousFloor:this.getMapDataInternal()?.getById("floor",h.previousFloorId)??this.currentFloor})}),p.on("floor-change",h=>{this.externalPubSub.publish("floor-change",{reason:h.reason,floor:this.currentFloor,previousFloor:this.getMapDataInternal()?.getById("floor",h.previousFloorId)??this.currentFloor}),this.externalPubSub.publish("state-change-internal",{currentFloor:this.currentFloor,currentFloorStack:this.currentFloorStack})}),o?.zoomLevel!=null)this.core.camera.setZoomLevel(o.zoomLevel),n(t);else if(this.core.mode!=="outdoors-overlay"&&u){let h=o?.screenOffsets??{top:p0*this.core.canvasHeight,left:p0*this.core.canvasWidth,right:p0*this.core.canvasWidth,bottom:p0*this.core.canvasHeight};this.core.camera.focusOn(u,{duration:D5,padding:h}).then(()=>{this.Camera.setElevation(this.currentFloor.elevation),n(t)})}else n(t)})}setFloor(t,o){return this.currentMap.setFloor(yf(t),o)}setFloorStack(t,o){return this.currentMap.setFloorStack(yf(t),o)}updateWatermark(t){this.core.updateWatermark(t)}get currentFloorStack(){let t=this.currentMap.currentFloorStack.id;if(!t)throw new wr("Missing currentFloorStack.");let o=this.mapData?.getById("floor-stack",t);if(!o)throw new wr("FloorStack was not found in map data.");return o}get currentFloor(){let t=this.currentMap.currentFloor.id;if(!t)throw new wr("Missing currentFloor object from GeoJsonApi");let o=this.mapData?.getById("floor",t);if(!o)throw new wr("Missing currentFloor");return o}getState(t){typeof t=="object"&&Bn.is(t)&&A.warn("Cannot get state of a Path directly. Use getState() on individual segments within Path.segments[] instead.");let o=$5(t,this),n=this.core.getState(o);if(n){if(["interior-walls","exterior-walls"].includes(t)&&n.type==="geometry-group")return EA(n);if(["interior-doors","exterior-doors"].includes(t)&&n.type==="geometry-group")return eA(n);if(n.type==="geometry"){let i;return"parent"in n&&n.parent&&n.parent.type==="geometry-group"&&(i=this.core.getState(n.parent)),uA(n,i)}else{if(n.type==="label"&&n.options.appearance&&n.options.rank!==void 0&&n.options.interactive!==void 0)return fA(n);if(n.type==="marker"&&n.options?.rank!==void 0&&n.options.interactive!==void 0)return gA(n,this.Markers.getById(n.id.toString())?.marker);if(n.type==="model")return kA(n);if(n.type==="image")return PA(n);if(n.type==="text3d")return wA(n);if(n.type==="geometry-group"&&t&&typeof t!="string"&&ha.is(t))return IA(n);if(n.type==="path")return xA(n);if(n.type==="group-container"&&typeof t!="string"&&Bo.is(t))return pA(n,this.currentMap.floorsById.get(t.id),this.core);if(n.type==="group-container"&&n.children.length>0&&typeof t!="string"&&Ar.is(t)){let i=this.core.getState(n.children[0].id);return rA(i)}}}}setHoverColor(t){this.core.setState({hoverColor:t})}getHoverColor(){let t=this.core.getState();return t?.type==="map-view"?t.hoverColor:void 0}createCoordinateFromScreenCoordinate(t,o,n){if(n!=null){let p=this.core.projectScreenXYToCoordinate(t,o,!0);return p?new fe(p.coordinate[1],p.coordinate[0],n.id):void 0}let i=this.core.projectScreenXYToCoordinate(t,o);if(i==null||i.coordinate==null)return;let{coordinate:a,groupContainers:l}=i,c=l?.find(p=>{let u=p.userData.entityId.toString();return u.includes("f_")||u.includes("m_")})?.userData.entityId.toString();return new fe(a[1],a[0],c)}getScreenCoordinateFromCoordinate(t){let o=0;if(t.floorId!=null){let n=this.mapData?.getById("floor",t.floorId);n!=null&&(o=this.getState(n)?.altitude??0)}return this.core.projectCoordinateToScreenXY([t.longitude,t.latitude,o])}isInView(t){return this.core.isInView(typeof t=="string"?t:t.id)}getInView(t,o){let n=this.core.queryGeometry2DInView({screenOffsets:o?.screenOffsets,fullyContains:o?.fullyContains});if(n.length===0)return[];let i=[];switch(t){case fa.__type:i=n.map(a=>this.Labels.getById(a)).filter(a=>a!=null).map(a=>a.label);break;case us.__type:i=n.map(a=>this.Markers.getById(a)).filter(a=>a!=null).map(a=>a.marker)}return i}async __EXPERIMENTAL__auto(){let t=this.getMapDataInternal();if(!t)throw new Error("Map data not found");return await t7(t,this)}tween(t){let o=new ui(t);return this.core.getExternalTweenGroup().add(o),this.core.render(),o}removeTween(t){this.core.getExternalTweenGroup().remove(t)}tweenGroup(){return this.core.getExternalTweenGroup()}get __core(){return this.core}getCameraState(){return this.core.camera.getState()}getNavigationState(){return{isMultiFloor:this.Navigation.isMultiFloor,floorStacks:this.Navigation.floorStacks,floors:this.Navigation.floors,activeDirections:this.Navigation.activeDirections,activePath:this.Navigation.activePath,paths:this.Navigation.paths}}getAllState(){return{currentFloor:this.currentFloor,currentFloorStack:this.currentFloorStack,Camera:this.getCameraState(),Navigation:this.getNavigationState(),manualFloorVisibility:this.manualFloorVisibility}}publishAllState(){this.externalPubSub.publish("state-change-internal",this.getAllState())}clear(){this.Navigation.clear(),this.BlueDot.disable(),this.Shapes.removeAll(),this.Paths.removeAll(),this.Models.removeAll(),this.Markers.removeAll(),this.Image3D.removeAll(),this.Labels.removeAll()}destroy(){this.clear(),this.core.destroy()}_publishBlueDotState(t){let o;if(t)o=t;else{let{state:n,following:i,heading:a,accuracy:l,coordinate:c,floor:p}=this.BlueDot;o={state:n,following:i,heading:a,accuracy:l,coordinate:c,floor:p}}this.externalPubSub.publish("state-change-internal",{BlueDot:o})}getOptimalVisualDistanceBetweenFloors(t,o=!1){let n=this.currentMap;if(!n){A.error("Cannot compute optimal visual distance between floors. Missing current map.");return}if(t.length<2){A.warn("Cannot compute optimal visual distance between floors. Must provide at least 2 floors.");return}let i=n.renderer.getInternalState().geometry3DMap.get(t[0].id),a=n.renderer.getInternalState().geometry3DMap.get(t[1].id);if(!i||!a){A.warn("Cannot compute optimal visual distance between floors. Floors not found in current map.");return}if(xp(i,"group-container"),xp(a,"group-container"),o){let c=new sr;c.setFromObject(i);let p=new sr;if(p.setFromObject(a),i.children.forEach(v=>{v instanceof Le&&v.userData.debugBox&&Ht(v)}),a.children.forEach(v=>{v instanceof Le&&v.userData.debugBox&&Ht(v)}),!Bl(c)||!Bl(p))return;let u=new zn(c.max.x-c.min.x,c.max.y-c.min.y,c.max.z-c.min.z),f=new Nr({color:255,transparent:!0,opacity:.5}),h=new Le(u,f);h.position.set((c.min.x+c.max.x)/2,(c.min.y+c.max.y)/2,(c.min.z+c.max.z)/2),h.userData.debugBox=!0;let b=new zn(p.max.x-p.min.x,p.max.y-p.min.y,p.max.z-p.min.z),x=new Nr({color:"cyan",transparent:!0,opacity:.5}),T=new Le(b,x);T.position.set((p.min.x+p.max.x)/2,(p.min.y+p.max.y)/2,(p.min.z+p.max.z)/2),T.userData.debugBox=!0,i.add(h),a.add(T)}let l=n.renderer.computeMinZOffsetBetweenContainers(i,a);if(l!==-1)return l}};Rg=new WeakMap,Bg=new WeakMap;function KZ(e){if(e===""){oT(""),rT("");return}rT(`${e}/${L0}`),oT(`${e}/${A0}`)}d();var d0=class{constructor(r){m(this,"state");m(this,"update");this.update=r.Debug.update.bind(r.Debug),this.state=r.Debug.state}};d();var r7=J.object({environment:J.union([J.literal("basic"),J.literal(!1)]).optional(),text3d:J.object({hoverColor:J.string().optional()}).optional(),geometry:J.object({hoverColor:J.string().optional()}).optional(),backgroundColor:J.string().optional(),backgroundAlpha:J.number().optional()}).strict();d();var UT=hp(VC(),1);var QZ=(e,r)=>{let t={},o=(n,i,a)=>{for(let l in i){let c=n[l],p=i[l];typeof p=="object"&&!Array.isArray(p)&&p!==null&&typeof c=="object"&&!Array.isArray(c)&&c!==null?(a[l]={},o(c,p,a[l])):a[l]=c}};return o(e,r,t),t},o7=(e,r)=>{let t=QZ(e,r),o=(0,UT.default)({},t,r),n=(0,UT.default)({},t),i=(a,l,c,p=n)=>{for(let u in l){let f=a[u],h=l[u];if(typeof h=="number"&&typeof f=="number")p[u]=f+(h-f)*c;else if(typeof h=="string"&&typeof f=="string"){if(um(f)&&um(h)){let b=T0(f),x=T0(h);b&&x?p[u]=OC([b[0]+(x[0]-b[0])*c,b[1]+(x[1]-b[1])*c,b[2]+(x[2]-b[2])*c]):A.warn(`Color "${u}" could not be animated!`)}}else typeof h=="object"&&h!==null&&typeof f=="object"&&f!==null?i(f,h,c,p[u]):A.warn(`Value "${u}" could not be animated!`)}};return a=>(a=Math.min(Math.max(a,0),1),a===0?e:a===1?o:(i(t,r,a),n))};var ap,ne,Vn,Ng=class{constructor(r){S(this,ap);S(this,ne);S(this,Vn);m(this,"Camera");m(this,"Labels");m(this,"Text3D");m(this,"Markers");m(this,"Image3D");m(this,"Models");m(this,"Paths");m(this,"Exporter");m(this,"Navigation");m(this,"__BlueDot");m(this,"Style");m(this,"Shapes");m(this,"Outdoor");m(this,"update",()=>{s(this,ne).core.render()});m(this,"__LEGACY_GET_DIRECTIONS_SYNC",(r,t,o)=>s(this,ne).getMapData()?.__LEGACY_GET_DIRECTIONS_SYNC(r,t,o)??void 0);m(this,"getDirections",(r,t,o)=>s(this,ne).getMapData()?.getDirections(r,t,o)??Promise.resolve(void 0));m(this,"__LEGACY_GET_DIRECTIONS_MULTI_DESTINATION_SYNC",(r,t,o)=>s(this,ne).getMapData()?.__LEGACY_GET_DIRECTIONS_MULTI_DESTINATION_SYNC(r,t,o)??void 0);m(this,"getDirectionsMultiDestination",(r,t,o)=>s(this,ne).getMapData()?.getDirectionsMultiDestination(r,t,o)??Promise.resolve(void 0));m(this,"on",(r,t)=>{s(this,ap).on(r,t)});m(this,"off",(r,t)=>{s(this,ap).off(r,t)});m(this,"Debug");w(this,ap,new ke),w(this,Vn,r);let t=new _g(r,this,s(this,ap));w(this,ne,t),this.Camera=s(this,ne).Camera,this.Markers=s(this,ne).Markers,this.Models=s(this,ne).Models,this.Labels=s(this,ne).Labels,this.Text3D=s(this,ne).Text3D,this.Exporter=s(this,ne).Exporter,this.Paths=s(this,ne).Paths,this.Navigation=s(this,ne).Navigation,this.__BlueDot=s(this,ne).BlueDot,this.Shapes=s(this,ne).Shapes,this.Style=s(this,ne).Style,this.Outdoor=s(this,ne).Outdoor,this.Image3D=s(this,ne).Image3D,s(this,Vn).container.dataset.version=y.env.npm_package_version,this.Debug=new d0(s(this,ne).core)}updateState(r,t){return s(this,ne).updateState(r,t)}animateState(r,t,o){let n=s(this,ne).getState(r);if(n==null)return A.warn(`Cannot animate state of ${r}.`),new Promise(p=>p({result:"completed"}));let i=o7(n,t),a=s(this,ne).tween({percent:0}).to({percent:1},o?.duration??1e3).onUpdate(({percent:c})=>{s(this,ne).updateState(r,i(c))});o?.easing&&o.easing in ls&&a.easing(ls[o.easing]);let l=new Promise(c=>{a.onComplete(()=>{s(this,ne).removeTween(a),c({result:"completed"})}).onStop(()=>{s(this,ne).removeTween(a),c({result:"cancelled"})}),a.start()});return l.cancel=()=>{a.stop(),s(this,ne).updateState(r,i(0))},l}updateGlobalState(r){try{r7.parse(r)}catch(t){A.error("updateGlobalState",t);return}if(typeof r=="object"){let t={};if(r.text3d?.hoverColor&&(t.text3dHoverColor=r.text3d.hoverColor),r.geometry?.hoverColor&&(t.hoverColor=r.geometry.hoverColor),r.backgroundColor||r.backgroundAlpha!==void 0){let o=r.backgroundColor??s(this,ne).core.backgroundColor,n=r.backgroundAlpha??s(this,ne).core.backgroundAlpha;s(this,ne).core.setBackgroundColor(o,n)}r.environment!=null&&s(this,ne).core.setEnvironment(r.environment),s(this,ne).core.setState(t)}}get options(){return L5(s(this,ne).currentMap.options)}getGlobalState(){let r=s(this,ne).core.getState();return{backgroundColor:s(this,ne).core.backgroundColor,backgroundAlpha:s(this,ne).core.backgroundAlpha,environment:s(this,ne).core.getEnvironment(),geometry:{hoverColor:r.hoverColor},text3d:{hoverColor:r.text3dHoverColor}}}getMapData(){if(s(this,ne).mapData==null)throw new wr("MapData not found.");return s(this,ne).mapData}getDimensions(){return{width:s(this,Vn).canvasWidth,height:s(this,Vn).canvasHeight}}addMap(r,t){return s(this,ne).addMap(r,t)}setFloor(r,t){return s(this,ne).setFloor(r,t?.context)}setFloorStack(r,t){return s(this,ne).setFloorStack(r,t?.context)}preloadFloors(r){s(this,ne).preloadFloors(r)}tween(r){return s(this,ne).tween(r)}removeTween(r){s(this,ne).removeTween(r)}get tweenGroup(){return s(this,ne).tweenGroup()}get currentFloorStack(){return s(this,ne).currentFloorStack}get currentFloor(){return s(this,ne).currentFloor}updateWatermark(r){s(this,ne).updateWatermark(r)}getState(r){return s(this,ne).getState(r)}setHoverColor(r){s(this,ne).setHoverColor(r)}getHoverColor(){return s(this,ne).getHoverColor()}convertAltitudeToMercatorZoomLevel(r){return s(this,ne).core.getSystems().cameraSystem.convertAltitudeToZoomLevel(r)}convertMercatorZoomLevelToAltitude(r){return s(this,ne).core.getSystems().cameraSystem.convertZoomLevelToAltitude(r)}isInView(r){return s(this,ne).isInView(r)}getInView(r,t){return s(this,ne).getInView(r,t)}getDistance(r,t){return s(this,ne).getMapData()?.getDistance(r,t)}createCoordinate(r,t,o){return typeof r=="object"?new fe(r):new fe(r,t,o?.id)}createCoordinateFromScreenCoordinate(r,t,o){return s(this,ne).createCoordinateFromScreenCoordinate(r,t,o)}getScreenCoordinateFromCoordinate(r){return s(this,ne).getScreenCoordinateFromCoordinate(r)}__EXPERIMENTAL__auto(){s(this,ne).__EXPERIMENTAL__auto()}get __core(){if(y.env.INTERNAL==="true")return s(this,ne).core;throw new Error("__core is not available.")}get container(){return s(this,Vn).container}publishAllState(){s(this,ne).publishAllState()}clear(){s(this,ne).clear()}destroy(){s(this,ne).destroy()}async enableDebug(r={}){let{Inspector:t}=await import("./inspector-RGAT354S.js");await new t(this,s(this,ne)).enable(r)}async takeScreenshot(r){let t={withOutdoorContext:r?.withOutdoorContext??!1},o=s(this,Vn).rendererDomElement;if(t.withOutdoorContext){let n=s(this,Vn).map;if(!n)return await s(this,Vn).renderSync(),o.toDataURL("image/png");n.loaded()||await new Promise(c=>{n.once("idle",c)});let i=n.getCanvas(),a=document.createElement("canvas"),l=a.getContext("2d");if(a.width=o.width,a.height=o.height,!l)throw new Error("Failed to get 2D context for composite canvas");return l.drawImage(i,0,0,a.width,a.height),l.drawImage(o,0,0,a.width,a.height),a.toDataURL("image/png")}return await s(this,Vn).renderSync(),o.toDataURL("image/png")}get manualFloorVisibility(){return s(this,ne).manualFloorVisibility}set manualFloorVisibility(r){s(this,ne).manualFloorVisibility=r}getOptimalVisualDistanceBetweenFloors(r){return s(this,ne).getOptimalVisualDistanceBetweenFloors(r)}get __INTERNAL__hidePathsNotOnCurrentFloor(){return s(this,ne).hidePathsNotOnCurrentFloor}set __INTERNAL__hidePathsNotOnCurrentFloor(r){s(this,ne).hidePathsNotOnCurrentFloor=!!r}};ap=new WeakMap,ne=new WeakMap,Vn=new WeakMap;d();var qZ=1e3*60*60*2,_l,em,kt,xs,Ci,$n,Mi,tm,rm,jg,jt,n7,i7,qu,u0,VT,$T,HT,om=class{constructor(r,t){S(this,jt);S(this,_l,new ke);S(this,em);S(this,kt);S(this,xs);S(this,Ci);S(this,$n);S(this,Mi);S(this,tm);S(this,rm);S(this,jg,()=>{"key"in s(this,kt)&&"secret"in s(this,kt)&&W(this,jt,qu).call(this),W(this,jt,u0).call(this)});m(this,"on",(r,t)=>s(this,_l).on(r,t));m(this,"off",(r,t)=>s(this,_l).off(r,t));w(this,em,r),w(this,kt,t)}setMapIds(r){w(this,em,r)}setEnterprise(r){s(this,kt).enterprise=r}async readySync(){if((!("key"in s(this,kt))||!("secret"in s(this,kt)))&&!("accessToken"in s(this,kt))){A.error("No API keys or access token provided! Cannot preload tokens.");return}let r=[W(this,jt,qu).call(this),null];s(this,kt).enterprise||(r[1]=this.getSasTokensAsync());let[t,o]=await Promise.all(r);W(this,jt,HT).call(this),W(this,jt,VT).call(this,t),o!=null&&W(this,jt,$T).call(this,o),dm()&&globalThis.addEventListener?.("focus",s(this,jg))}async refreshing(){let r=[];return s(this,xs)!=null&&r.push(s(this,xs)),s(this,Ci)!=null&&r.push(s(this,Ci)),Promise.all(r)}getAccessTokenAsync(){return W(this,jt,qu).call(this)}getSasTokensAsync(){return W(this,jt,u0).call(this)}getAccessToken(){return s(this,$n)==null?(A.error("Tokens must be loaded before reading synchronously! Try awaiting readySync() first."),{token:""}):s(this,$n)}getSasToken(r){return this.isEnterpriseMode()?(A.error("SAS tokens are not available in the enterprise mode!"),{token:""}):s(this,Mi)==null?(A.error("Tokens must be loaded before reading synchronously! Try awaiting readySync() first."),{token:""}):r in s(this,Mi).tokens?s(this,Mi).tokens[r]:(A.error(`SAS token for map ${r} not found!`),{token:""})}isEnterpriseMode(){return s(this,kt).enterprise??!1}destroy(){W(this,jt,HT).call(this),s(this,_l).destroy(),dm()&&globalThis.removeEventListener("focus",s(this,jg))}};_l=new WeakMap,em=new WeakMap,kt=new WeakMap,xs=new WeakMap,Ci=new WeakMap,$n=new WeakMap,Mi=new WeakMap,tm=new WeakMap,rm=new WeakMap,jg=new WeakMap,jt=new WeakSet,n7=function(r){let t=r.token!==s(this,$n)?.token;w(this,$n,r),t&&s(this,_l).publish("access-token-refreshed",{accessToken:r})},i7=function(r){let t=JSON.stringify(r.tokens)!==JSON.stringify(s(this,Mi)?.tokens);w(this,Mi,r),t&&s(this,_l).publish("sas-tokens-refreshed",{sasTokens:r.tokens})},qu=async function(r=!1){if("accessToken"in s(this,kt)&&typeof s(this,kt).accessToken=="string"){let t={token:s(this,kt).accessToken,expires:Date.now()+72e5};return w(this,$n,t),t}if(!("key"in s(this,kt))||!("secret"in s(this,kt))||typeof s(this,kt).key!="string"||typeof s(this,kt).secret!="string")throw new Error("No API keys or access token provided!");return s(this,xs)!=null?s(this,xs):s(this,$n)!=null&&s(this,$n).expires!=null&&s(this,$n).expires>Date.now()&&!r?s(this,$n):(w(this,xs,mf({...s(this,kt),key:s(this,kt).key,secret:s(this,kt).secret},s(this,kt).enterprise??!1).then(t=>{let o={token:t.accessToken,expires:t.expiresTimestamp*1e3};return W(this,jt,n7).call(this,o),o}).catch(t=>{throw t}).finally(()=>{w(this,xs,void 0)})),s(this,xs))},u0=async function(r=!1){return this.isEnterpriseMode()?{tokens:{},expires:1/0}:s(this,Ci)!=null?s(this,Ci):s(this,Mi)!=null&&s(this,Mi).expires>Date.now()&&!r?s(this,Mi):(w(this,Ci,new Promise((t,o)=>{W(this,jt,qu).call(this).then(n=>{let i={},a=s(this,em).map(l=>lS({...s(this,kt),mapId:l},n.token).then(c=>{i[l]={token:c.token,expires:c.expires}}).catch(c=>{A.error(`Error getting SAS token for map ${l}:`,c)}));Promise.all(a).then(()=>{let l={tokens:i,expires:Math.min(...Object.values(i).map(c=>c.expires??1/0))};W(this,jt,i7).call(this,l),t(l)})}).catch(n=>{o(n)})})),s(this,Ci).catch(t=>{throw t}).finally(()=>{w(this,Ci,void 0)}),s(this,Ci))},VT=function(r){if(!("key"in s(this,kt))||!("secret"in s(this,kt)))return;let t=r.expires!=null?r.expires-Date.now():qZ;isFinite(t)&&w(this,tm,setTimeout(()=>{W(this,jt,qu).call(this,!0).then(o=>{W(this,jt,VT).call(this,o)})},t-qF))},$T=function(r){let t=r.expires-Date.now();isFinite(t)&&w(this,rm,setTimeout(()=>{W(this,jt,u0).call(this,!0).then(o=>{W(this,jt,$T).call(this,o)})},t-r5))},HT=function(){s(this,tm)!=null&&clearTimeout(s(this,tm)),s(this,rm)!=null&&clearTimeout(s(this,rm))};d();var eX=async(e,r)=>{let t=("mvfVersion"in(r??{})?r?.mvfVersion:void 0)??("options"in e&&"version"in(e.options??{})?e.options?.version:void 0),o={prefetchTokens:!0,...r||{},mvfVersion:t},n,i=tl();i.updateByUserOption(o);let a={};if("type"in e&&typeof e.type=="string"){if(a.enterprise=e.options?.enterprise,e.type==="binary"&&e.main instanceof Uint8Array){n=await r1(e.main,o.mvfVersion),a.languagePacks=[];for(let x of e.languagePacks??[])x.localePack instanceof Uint8Array&&a.languagePacks.push({language:x.language,localePack:await Sd(x.localePack)})}else if(e.type==="json")n=e.main,a.languagePacks=e.languagePacks??[];else throw new Error("Invalid backup type");e.type==="binary"&&e.main instanceof Uint8Array&&(a.binaryBundle=e.main)}else n=e,a.enterprise=n.enterprise!=null;i.setEnterprise(a.enterprise??!1);let l=t1(n),c=l.length>0?l:[o.mapId];o.baseAuthUri=i.getBaseAuthUri();let p=new om(c,{...o,enterprise:a.enterprise}),u;if("accessToken"in o&&o.accessToken)u=o.accessToken;else if("key"in o&&"secret"in o){let x;try{x=await p.getAccessTokenAsync()}catch(T){A.error("Failed getting token during hydrateMapData",T)}u=x?.token||""}if(a.outdoorViewToken=u,a.env=i,a.getMapDataOptions=o,o.prefetchTokens)try{await p.readySync()}catch(x){A.error("Failed to ready token manager!",x)}Rf()&&(a.enterprise&&A.warn("forceEnterpriseLocations is enabled, but the map is already an enterprise map!"),o.mvfVersion!=="3.0.0"&&A.warn("mvfVersion must be '3.0.0' when forceEnterpriseLocations is enabled!"));let f=new Ec(n,a);u&&f.Analytics.init({accessToken:u,mapId:o.mapId,key:"key"in o?o.key:void 0,secret:"secret"in o?o.secret:void 0,...o.analytics,baseUri:i.getAnalyticsBaseUri(),context:o.analytics?.context});let h=new Mm(f),b=f.findPreferredLanguage({languageCode:o.language,fallbackToNavigatorLanguage:!1});if(b)try{await h.changeLanguage(b.code)}catch{}return typeof r?.onMVFParsed=="function"&&r.onMVFParsed(n),h};d();var s7=(e,{id:r}={})=>{let t=Array.isArray(e)?e:[e];if(!t.every(i=>typeof i=="string"))return;let o=t.join(""),n=null;if(r){let i=document.getElementById(r);i instanceof HTMLStyleElement&&(n=i)}n==null&&(n=document.createElement("style")),r&&r!==""&&(n.id=r),n.textContent=o,document.head.appendChild(n)};var a7=`:root {
787
787
  --pin-shadow-hover-scale: 0.9;
788
788
  --pin-shadow-width: 12px;
789
789
  --pin-shadow-height: 5px;
@@ -1986,7 +1986,7 @@ a.maplibregl-ctrl-logo.maplibregl-compact {
1986
1986
  left: 0 !important;
1987
1987
  z-index: 99999;
1988
1988
  }
1989
- `;d();function aX(e){if(!(!e.languages||!dm()||!globalThis.navigator?.languages?.length))for(let r=0;r<globalThis.navigator.languages.length;r++){let t=e.languages.find(o=>o.code.toLowerCase()===globalThis.navigator.languages[r].toLowerCase());if(t)return{code:t.code,name:t.name}}}function g2(e,r){let t=r?.languageCode??"",o=r?.fallbackToNavigatorLanguage??!0,n=e?.languages?.find(a=>a.code.toLowerCase()===t.toLowerCase()),i;if(n)i=n;else if(o??!0)try{let a=aX(e);a&&(i=a)}catch(a){A.error("fallbackToNavigatorLanguage is set, however, there was an error getting the navigator language",a)}return i??e.defaultLanguage}var lX=[a7,l7,c7,p7,d7,u7],m7;function jNe(e){m7=e}var GNe=async(e,r)=>{let t,o=tl();r&&o.updateByUserOption(r);try{r&&(t=(await mf({...r,baseAuthUri:o.getBaseAuthUri()})).accessToken)}catch(a){A.warn("Getting access token failed. Outdoor map disabled.",a)}let n=new Ec(e,{outdoorViewToken:t,languagePacks:r?.languagePacks,env:o});return new Mm(n)},f7=!1;function UNe(e){f7=e}var h7=!1;function VNe(e){h7=e}function Rf(){return h7}var cX=async e=>{let r=f7,t,o=tl();o.updateByUserOption(e);let n={prefetchTokens:!0,...e,fallbackToNavigatorLanguage:e.fallbackToNavigatorLanguage??!0},i=new om([n.mapId],n);if("accessToken"in n&&n.accessToken){t=n.accessToken;let{aud:v,sub:I}=ty(t);(k5.some(M=>v.includes(M))||I&&I.startsWith("client"))&&(r=!0,o.setEnterprise(r),i.setEnterprise(r))}else if("key"in n&&"secret"in n){if(n.key.startsWith("mipk_"))throw new Error(`Partner API keys detected!
1989
+ `;d();function aX(e){if(!(!e.languages||!dm()||!globalThis.navigator?.languages?.length))for(let r=0;r<globalThis.navigator.languages.length;r++){let t=e.languages.find(o=>o.code.toLowerCase()===globalThis.navigator.languages[r].toLowerCase());if(t)return{code:t.code,name:t.name}}}function y2(e,r){let t=r?.languageCode??"",o=r?.fallbackToNavigatorLanguage??!0,n=e?.languages?.find(a=>a.code.toLowerCase()===t.toLowerCase()),i;if(n)i=n;else if(o??!0)try{let a=aX(e);a&&(i=a)}catch(a){A.error("fallbackToNavigatorLanguage is set, however, there was an error getting the navigator language",a)}return i??e.defaultLanguage}var lX=[a7,l7,c7,p7,d7,u7],m7;function jNe(e){m7=e}var GNe=async(e,r)=>{let t,o=tl();r&&o.updateByUserOption(r);try{r&&(t=(await mf({...r,baseAuthUri:o.getBaseAuthUri()})).accessToken)}catch(a){A.warn("Getting access token failed. Outdoor map disabled.",a)}let n=new Ec(e,{outdoorViewToken:t,languagePacks:r?.languagePacks,env:o});return new Mm(n)},f7=!1;function UNe(e){f7=e}var h7=!1;function VNe(e){h7=e}function Rf(){return h7}var cX=async e=>{let r=f7,t,o=tl();o.updateByUserOption(e);let n={prefetchTokens:!0,...e,fallbackToNavigatorLanguage:e.fallbackToNavigatorLanguage??!0},i=new om([n.mapId],n);if("accessToken"in n&&n.accessToken){t=n.accessToken;let{aud:v,sub:I}=ty(t);(k5.some(M=>v.includes(M))||I&&I.startsWith("client"))&&(r=!0,o.setEnterprise(r),i.setEnterprise(r))}else if("key"in n&&"secret"in n){if(n.key.startsWith("mipk_"))throw new Error(`Partner API keys detected!
1990
1990
 
1991
- Partner API keys should not be passed directly to the SDK. See https://developer.mappedin.com/docs/rest-apis/partner for more details.`);n.key.startsWith("mik_")||(r=!0,o.setEnterprise(r),i.setEnterprise(r)),n.baseAuthUri=o.getBaseAuthUri(),t=(await i.getAccessTokenAsync()).token}else throw new Error("Missing key or secret.");n.layoutId!=null&&(r?n.layoutId!=="draft"&&A.warn('Invalid layoutId! Use "draft" to load draft data or leave unspecified to load live data.'):A.warn("layoutId is currently unsupported!")),n.baseUri=o.getBaseUri();let a=performance.now(),l,c;if(r){let v={...n,venue:n.mapId,clientId:n.key,clientSecret:n.secret,version:"1.0.0",perspective:n.viewId,useDraftData:n.layoutId==="draft"},I=await pS(v);l=I.compressed,c=I.localePacks}else l=await dS(n,t);let p=performance.now(),u=await t1(l,n.mvfVersion),f=performance.now();typeof e.onMVFParsed=="function"&&e.onMVFParsed(u);let h=e1(u);if(h.length>0?i.setMapIds(h):i.setMapIds([n.mapId]),n.prefetchTokens)try{await i.readySync()}catch(v){A.error("Failed to ready token manager!",v)}Rf()&&(r&&A.warn("forceEnterpriseLocations is enabled, but the map is already an enterprise map!"),n.mvfVersion!=="3.0.0"&&A.warn("mvfVersion must be '3.0.0' when forceEnterpriseLocations is enabled!"));let b=new Ec(u,{env:o,outdoorViewToken:t,tokenManager:i,enterprise:r,localePacksUrls:c,binaryBundle:l,getMapDataOptions:n}),x=new Mm(b,{search:e.search});b.Analytics.init({accessToken:t,mapId:n.mapId,key:"key"in n?n.key:void 0,secret:"secret"in n?n.secret:void 0,...n.analytics,baseUri:o.getAnalyticsBaseUri(),context:n.analytics?.context}),b.Analytics.sendGetMapDataEvent({parseDuration:f-p,downloadDuration:p-a,viewId:n.viewId});let T=b.findPreferredLanguage({languageCode:n.language,fallbackToNavigatorLanguage:n.fallbackToNavigatorLanguage});if(T)try{await x.changeLanguage(T.code)}catch{}return x},$Ne=cX,pX=async()=>{if(Pc===""||_x==="")return!1;let e=[fetch(Pc,{mode:"same-origin"}),fetch(_x,{mode:"same-origin"})],[r,t]=[{ok:!1},{ok:!1}];try{[r,t]=await Promise.all(e)}catch{}return{collision:r.ok,maplibre:t.ok}},dX=async(e,r,t)=>{let o=performance.now(),n=$S(t,r);n&&VS(n),(n.injectStyles??!0)&&s7(lX,{id:"mappedin__styles"});let i=A5(r.outdoorViewToken??""),a=wm(r);n.outdoorView?.style&&a.envControl.updateTileServerBaseUrl(n.outdoorView?.style);let l=!1,c=!1,p=await pX();p&&(p.collision||(l=!0),p.maplibre||(c=!0));let u=await H4(e,{center:[r.mapCenter.longitude,r.mapCenter.latitude],bearing:n.bearing,pitch:n.pitch,zoomLevel:n.zoomLevel,backgroundAlpha:n.style?.backgroundAlpha,backgroundColor:n.style?.backgroundColor,outdoorView:!c&&n.outdoorView?.token?{headers:{"x-mappedin-tiles-key":n.outdoorView?.token},style:r.getEnv().tileServerUri,enabled:!!n.outdoorView?.enabled,lowDpi:n.outdoorView?.lowDpi}:void 0,watermark:{...n.watermark,visible:n.watermark?.visible??(!a.enterpriseMode&&!i.remove_watermark),onClick:m7||void 0},attribution:n.attribution,antialias:typeof n.antialiasing=="boolean"?n.antialiasing:!!n.antialiasing?.enabled,accessToken:r.outdoorViewToken,occlusionEnabled:!0,transformImageRequest:a.enterpriseMode?void 0:a.transformImageRequest,naturalBearing:r.naturalBearing,imagePlacementOptions:n.imagePlacementOptions,onWebGLContextCreationError:n.onWebGLContextCreationError,onWebGLContextLost:n.onWebGLContextLost,onWebGLContextRestored:n.onWebGLContextRestored,onWebGLRendererError:n.onWebGLRendererError,useStandaloneCamera:n.useStandaloneCamera??!1,useWorkers:!(n.disableWorkers??!1),useCollisionWorker:!l}),f=new Ng(u);return await f.addMap(r,n),a.Analytics.sendMapViewLoadedEvent({firstRenderDuration:performance.now()-o,dimension:f.getDimensions(),collisionWorkerDisabled:l,outdoorsWorkerDisabled:c}),f},HNe=()=>y.env.npm_package_version,zNe=dX;export{fe as a,wn as b,ic as c,ac as d,si as e,go as f,vr as g,Bo as h,YV as i,an as j,No as k,sn as l,na as m,c1 as n,Ar as o,qi as p,p1 as q,t2 as r,uS as s,mS as t,t1 as u,N5 as v,r2 as w,j5 as x,u1 as y,m1 as z,ml as A,Ic as B,d1 as C,Ak as D,kD as E,as as F,iz as G,cT as H,vZ as I,MT as J,OT as K,KZ as L,Ng as M,eX as N,g2 as O,jNe as P,GNe as Q,UNe as R,VNe as S,Rf as T,cX as U,$Ne as V,pX as W,dX as X,HNe as Y,zNe as Z};
1992
- //# sourceMappingURL=chunk-GAHPB2XK.js.map
1991
+ Partner API keys should not be passed directly to the SDK. See https://developer.mappedin.com/docs/rest-apis/partner for more details.`);n.key.startsWith("mik_")||(r=!0,o.setEnterprise(r),i.setEnterprise(r)),n.baseAuthUri=o.getBaseAuthUri(),t=(await i.getAccessTokenAsync()).token}else throw new Error("Missing key or secret.");n.layoutId!=null&&(r?n.layoutId!=="draft"&&A.warn('Invalid layoutId! Use "draft" to load draft data or leave unspecified to load live data.'):A.warn("layoutId is currently unsupported!")),n.baseUri=o.getBaseUri();let a=performance.now(),l,c;if(r){let v={...n,venue:n.mapId,clientId:n.key,clientSecret:n.secret,version:"1.0.0",perspective:n.viewId,useDraftData:n.layoutId==="draft"},I=await dS(v);l=I.compressed,c=I.localePacks}else l=await uS(n,t);let p=performance.now(),u=await r1(l,n.mvfVersion),f=performance.now();typeof e.onMVFParsed=="function"&&e.onMVFParsed(u);let h=t1(u);if(h.length>0?i.setMapIds(h):i.setMapIds([n.mapId]),n.prefetchTokens)try{await i.readySync()}catch(v){A.error("Failed to ready token manager!",v)}Rf()&&(r&&A.warn("forceEnterpriseLocations is enabled, but the map is already an enterprise map!"),n.mvfVersion!=="3.0.0"&&A.warn("mvfVersion must be '3.0.0' when forceEnterpriseLocations is enabled!"));let b=new Ec(u,{env:o,outdoorViewToken:t,tokenManager:i,enterprise:r,localePacksUrls:c,binaryBundle:l,getMapDataOptions:n}),x=new Mm(b,{search:e.search});b.Analytics.init({accessToken:t,mapId:n.mapId,key:"key"in n?n.key:void 0,secret:"secret"in n?n.secret:void 0,...n.analytics,baseUri:o.getAnalyticsBaseUri(),context:n.analytics?.context}),b.Analytics.sendGetMapDataEvent({parseDuration:f-p,downloadDuration:p-a,viewId:n.viewId});let T=b.findPreferredLanguage({languageCode:n.language,fallbackToNavigatorLanguage:n.fallbackToNavigatorLanguage});if(T)try{await x.changeLanguage(T.code)}catch{}return x},$Ne=cX,pX=async()=>{if(Pc===""||Rx==="")return!1;let e=[fetch(Pc,{mode:"same-origin"}),fetch(Rx,{mode:"same-origin"})],[r,t]=[{ok:!1},{ok:!1}];try{[r,t]=await Promise.all(e)}catch{}return{collision:r.ok,maplibre:t.ok}},dX=async(e,r,t)=>{let o=performance.now(),n=HS(t,r);n&&$S(n),(n.injectStyles??!0)&&s7(lX,{id:"mappedin__styles"});let i=A5(r.outdoorViewToken??""),a=wm(r);n.outdoorView?.style&&a.envControl.updateTileServerBaseUrl(n.outdoorView?.style);let l=!1,c=!1,p=await pX();p&&(p.collision||(l=!0),p.maplibre||(c=!0));let u=await H4(e,{center:[r.mapCenter.longitude,r.mapCenter.latitude],bearing:n.bearing,pitch:n.pitch,zoomLevel:n.zoomLevel,backgroundAlpha:n.style?.backgroundAlpha,backgroundColor:n.style?.backgroundColor,outdoorView:!c&&n.outdoorView?.token?{headers:{"x-mappedin-tiles-key":n.outdoorView?.token},style:r.getEnv().tileServerUri,enabled:!!n.outdoorView?.enabled,lowDpi:n.outdoorView?.lowDpi}:void 0,watermark:{...n.watermark,visible:n.watermark?.visible??(!a.enterpriseMode&&!i.remove_watermark),onClick:m7||void 0},attribution:n.attribution,antialias:typeof n.antialiasing=="boolean"?n.antialiasing:!!n.antialiasing?.enabled,accessToken:r.outdoorViewToken,occlusionEnabled:!0,transformImageRequest:a.enterpriseMode?void 0:a.transformImageRequest,naturalBearing:r.naturalBearing,imagePlacementOptions:n.imagePlacementOptions,onWebGLContextCreationError:n.onWebGLContextCreationError,onWebGLContextLost:n.onWebGLContextLost,onWebGLContextRestored:n.onWebGLContextRestored,onWebGLRendererError:n.onWebGLRendererError,useStandaloneCamera:n.useStandaloneCamera??!1,useWorkers:!(n.disableWorkers??!1),useCollisionWorker:!l}),f=new Ng(u);return await f.addMap(r,n),a.Analytics.sendMapViewLoadedEvent({firstRenderDuration:performance.now()-o,dimension:f.getDimensions(),collisionWorkerDisabled:l,outdoorsWorkerDisabled:c}),f},HNe=()=>y.env.npm_package_version,zNe=dX;export{fe as a,wn as b,ic as c,ac as d,ai as e,go as f,vr as g,Bo as h,YV as i,an as j,No as k,sn as l,na as m,p1 as n,Ar as o,es as p,d1 as q,r2 as r,mS as s,fS as t,r1 as u,N5 as v,o2 as w,j5 as x,m1 as y,f1 as z,ml as A,Ic as B,u1 as C,Ak as D,kD as E,ls as F,iz as G,pT as H,vZ as I,wT as J,ET as K,KZ as L,Ng as M,eX as N,y2 as O,jNe as P,GNe as Q,UNe as R,VNe as S,Rf as T,cX as U,$Ne as V,pX as W,dX as X,HNe as Y,zNe as Z};
1992
+ //# sourceMappingURL=chunk-3E7RBW5P.js.map