@mappedin/mappedin-js 6.1.0 → 6.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import{$ as M6,$a as K6,A as b6,Aa as N6,Ab as Vs,B as Gu,Ba as $6,Bb as Gh,C as v6,Cb as Db,D as x6,Da as Lh,Db as hE,E as sb,Ea as Rh,Eb as gE,F as Vi,Fa as j6,Fb as Oc,G as Ph,Ga as U6,Gb as Tb,H as La,Ha as G6,Hb as zh,I as zu,Ia as z6,Ib as yE,J as I6,Ja as V6,Jb as wb,K as E6,Ka as bb,Kb as bE,L as C6,La as H6,Lb as vE,M as S6,Ma as Z6,Mb as xE,N as pm,Na as wc,Nb as IE,O as On,Oa as W6,Ob as EE,P as D6,Pa as X6,Pb as CE,Q as ub,Qa as Nh,Qb as SE,R as Hi,Ra as vb,Rb as Zi,S as T6,Sa as J6,Sb as DE,T as Cc,Ta as hm,Tb as Ht,U as kh,Ua as Fc,Ub as TE,V as Sc,Va as $h,Vb as wE,W as dm,Wa as Mc,Wb as Wi,X as w6,Xa as Ac,Xb as FE,Y as lb,Ya as Y6,Yb as sr,Z as cb,Za as xb,Zb as ei,_ as F6,_b as yr,aa as A6,ab as q6,ba as Ra,bb as Q6,c as R,ca as l8,cb as jh,d as Mr,da as pb,db as eE,e as WI,ea as O6,eb as tE,f as nb,fa as Na,fb as rE,g as Gi,ga as B6,gb as nE,h as d6,ha as P6,hb as oE,i as Oh,ia as k6,ib as gm,j as m6,ja as db,jb as Vu,k as zi,ka as _6,kb as iE,l as f6,la as mb,lb as Xn,m as Uu,ma as zs,mb as aE,n as lm,na as ft,nb as sE,o as h6,oa as _h,ob as uE,p as go,pa as mm,pb as Ib,q as ib,qa as fb,qb as lE,r as Ec,ra as yo,rb as Eb,s as It,sa as hb,sb as Cb,t as Bh,ta as gb,tb as Uh,u as Oe,ua as yb,ub as cE,v as _a,va as L6,vb as pE,w as cm,wa as Dc,wb as dE,x as ab,xa as R6,xb as mE,y as g6,ya as Tc,yb as Sb,z as y6,za as fm,zb as fE}from"./chunk-C5ID5LHV.js";import{a as bo}from"./chunk-RIFXMIJM.js";import{$a as Ah,B as yh,D as bh,Da as i6,E as js,Ea as vc,F as vh,Fa as a6,G as xh,Ga as xc,H as Ih,Ha as Ic,I as Eh,Ia as Qo,Ja as Fh,K as KI,Ka as s6,L as Je,La as sm,M as ke,Na as um,Q as qI,R as QI,S as e6,T as Ch,U as ie,V as dr,W as t6,X as Wn,Xa as Mh,Y as bc,Z as ju,_ as ar,a as p,aa as gr,ab as u6,b as y,ba as dn,ca as Sh,d as gh,da as Pe,e as $u,ea as qo,eb as l6,f as om,g as ka,ga as Us,gb as Ui,h as XI,ha as r6,i as im,ia as ob,ib as c6,ja as Dh,ka as Gs,kb as p6,r as JI,sa as ji,t as YI,ta as n6,ua as Th,va as wh,wa as o6,ya as am}from"./chunk-DBCMQGTD.js";import{b as Nu,c as $s,d as rb,e as m,f as a,g as C,h as T,i as z}from"./chunk-ROCNZJLL.js";var BT=Nu((U3,G3)=>{p();(function(e,r){typeof U3=="object"&&typeof G3<"u"?G3.exports=r():typeof define=="function"&&define.amd?define(r):(e=e||self,e.TinyQueue=r())})(U3,function(){"use strict";var e=function(n,o){if(n===void 0&&(n=[]),o===void 0&&(o=r),this.data=n,this.length=this.data.length,this.compare=o,this.length>0)for(var i=(this.length>>1)-1;i>=0;i--)this._down(i)};e.prototype.push=function(n){this.data.push(n),this.length++,this._up(this.length-1)},e.prototype.pop=function(){if(this.length!==0){var n=this.data[0],o=this.data.pop();return this.length--,this.length>0&&(this.data[0]=o,this._down(0)),n}},e.prototype.peek=function(){return this.data[0]},e.prototype._up=function(n){for(var o=this,i=o.data,s=o.compare,u=i[n];n>0;){var l=n-1>>1,c=i[l];if(s(u,c)>=0)break;i[n]=c,n=l}i[n]=u},e.prototype._down=function(n){for(var o=this,i=o.data,s=o.compare,u=this.length>>1,l=i[n];n<u;){var c=(n<<1)+1,d=i[c],f=c+1;if(f<this.length&&s(i[f],d)<0&&(c=f,d=i[f]),s(d,l)>=0)break;i[n]=d,n=c}i[n]=l};function r(t,n){return t<n?-1:t>n?1:0}return e})});var kT=Nu((Z1e,z3)=>{"use strict";p();var Ty=BT();Ty.default&&(Ty=Ty.default);z3.exports=PT;z3.exports.default=PT;function PT(e,r,t){r=r||1;for(var n,o,i,s,u=0;u<e[0].length;u++){var l=e[0][u];(!u||l[0]<n)&&(n=l[0]),(!u||l[1]<o)&&(o=l[1]),(!u||l[0]>i)&&(i=l[0]),(!u||l[1]>s)&&(s=l[1])}var c=i-n,d=s-o,f=Math.min(c,d),h=f/2;if(f===0){var b=[n,o];return b.distance=0,b}for(var I=new Ty(void 0,aU),E=n;E<i;E+=f)for(var v=o;v<s;v+=f)I.push(new nu(E+h,v+h,h,e));var x=uU(e),D=new nu(n+c/2,o+d/2,0,e);D.d>x.d&&(x=D);for(var w=I.length;I.length;){var S=I.pop();S.d>x.d&&(x=S,t&&console.log("found best %d after %d probes",Math.round(1e4*S.d)/1e4,w)),!(S.max-x.d<=r)&&(h=S.h/2,I.push(new nu(S.x-h,S.y-h,h,e)),I.push(new nu(S.x+h,S.y-h,h,e)),I.push(new nu(S.x-h,S.y+h,h,e)),I.push(new nu(S.x+h,S.y+h,h,e)),w+=4)}t&&(console.log("num probes: "+w),console.log("best distance: "+x.d));var F=[x.x,x.y];return F.distance=x.d,F}function aU(e,r){return r.max-e.max}function nu(e,r,t,n){this.x=e,this.y=r,this.h=t,this.d=sU(e,r,n),this.max=this.d+this.h*Math.SQRT2}function sU(e,r,t){for(var n=!1,o=1/0,i=0;i<t.length;i++)for(var s=t[i],u=0,l=s.length,c=l-1;u<l;c=u++){var d=s[u],f=s[c];d[1]>r!=f[1]>r&&e<(f[0]-d[0])*(r-d[1])/(f[1]-d[1])+d[0]&&(n=!n),o=Math.min(o,lU(e,r,d,f))}return o===0?0:(n?1:-1)*Math.sqrt(o)}function uU(e){for(var r=0,t=0,n=0,o=e[0],i=0,s=o.length,u=s-1;i<s;u=i++){var l=o[i],c=o[u],d=l[0]*c[1]-c[0]*l[1];t+=(l[0]+c[0])*d,n+=(l[1]+c[1])*d,r+=d*3}return r===0?new nu(o[0][0],o[0][1],0,e):new nu(t/r,n/r,0,e)}function lU(e,r,t,n){var o=t[0],i=t[1],s=n[0]-o,u=n[1]-i;if(s!==0||u!==0){var l=((e-o)*s+(r-i)*u)/(s*s+u*u);l>1?(o=n[0],i=n[1]):l>0&&(o+=s*l,i+=u*l)}return s=e-o,u=r-i,s*s+u*u}});var dw=Nu((sx,ux)=>{p();(function(e,r){typeof sx=="object"&&typeof ux<"u"?ux.exports=r():typeof define=="function"&&define.amd?define(r):(e=e||self).RBush=r()})(sx,function(){"use strict";function e(v,x,D,w,S){(function F(P,L,N,$,W){for(;$>N;){if($-N>600){var V=$-N+1,q=L-N+1,se=Math.log(V),ue=.5*Math.exp(2*se/3),ce=.5*Math.sqrt(se*ue*(V-ue)/V)*(q-V/2<0?-1:1),de=Math.max(N,Math.floor(L-q*ue/V+ce)),Ee=Math.min($,Math.floor(L+(V-q)*ue/V+ce));F(P,L,de,Ee,W)}var he=P[L],ne=N,Ce=$;for(r(P,N,L),W(P[$],he)>0&&r(P,N,$);ne<Ce;){for(r(P,ne,Ce),ne++,Ce--;W(P[ne],he)<0;)ne++;for(;W(P[Ce],he)>0;)Ce--}W(P[N],he)===0?r(P,N,Ce):r(P,++Ce,$),Ce<=L&&(N=Ce+1),L<=Ce&&($=Ce-1)}})(v,x,D||0,w||v.length-1,S||t)}function r(v,x,D){var w=v[x];v[x]=v[D],v[D]=w}function t(v,x){return v<x?-1:v>x?1:0}var n=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 o(v,x,D){if(!D)return x.indexOf(v);for(var w=0;w<x.length;w++)if(D(v,x[w]))return w;return-1}function i(v,x){s(v,0,v.children.length,x,v)}function s(v,x,D,w,S){S||(S=I(null)),S.minX=1/0,S.minY=1/0,S.maxX=-1/0,S.maxY=-1/0;for(var F=x;F<D;F++){var P=v.children[F];u(S,v.leaf?w(P):P)}return S}function u(v,x){return v.minX=Math.min(v.minX,x.minX),v.minY=Math.min(v.minY,x.minY),v.maxX=Math.max(v.maxX,x.maxX),v.maxY=Math.max(v.maxY,x.maxY),v}function l(v,x){return v.minX-x.minX}function c(v,x){return v.minY-x.minY}function d(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,x){return v.minX<=x.minX&&v.minY<=x.minY&&x.maxX<=v.maxX&&x.maxY<=v.maxY}function b(v,x){return x.minX<=v.maxX&&x.minY<=v.maxY&&x.maxX>=v.minX&&x.maxY>=v.minY}function I(v){return{children:v,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function E(v,x,D,w,S){for(var F=[x,D];F.length;)if(!((D=F.pop())-(x=F.pop())<=w)){var P=x+Math.ceil((D-x)/w/2)*w;e(v,P,x,D,S),F.push(x,P,P,D)}}return n.prototype.all=function(){return this._all(this.data,[])},n.prototype.search=function(v){var x=this.data,D=[];if(!b(v,x))return D;for(var w=this.toBBox,S=[];x;){for(var F=0;F<x.children.length;F++){var P=x.children[F],L=x.leaf?w(P):P;b(v,L)&&(x.leaf?D.push(P):h(v,L)?this._all(P,D):S.push(P))}x=S.pop()}return D},n.prototype.collides=function(v){var x=this.data;if(!b(v,x))return!1;for(var D=[];x;){for(var w=0;w<x.children.length;w++){var S=x.children[w],F=x.leaf?this.toBBox(S):S;if(b(v,F)){if(x.leaf||h(v,F))return!0;D.push(S)}}x=D.pop()}return!1},n.prototype.load=function(v){if(!v||!v.length)return this;if(v.length<this._minEntries){for(var x=0;x<v.length;x++)this.insert(v[x]);return this}var D=this._build(v.slice(),0,v.length-1,0);if(this.data.children.length)if(this.data.height===D.height)this._splitRoot(this.data,D);else{if(this.data.height<D.height){var w=this.data;this.data=D,D=w}this._insert(D,this.data.height-D.height-1,!0)}else this.data=D;return this},n.prototype.insert=function(v){return v&&this._insert(v,this.data.height-1),this},n.prototype.clear=function(){return this.data=I([]),this},n.prototype.remove=function(v,x){if(!v)return this;for(var D,w,S,F=this.data,P=this.toBBox(v),L=[],N=[];F||L.length;){if(F||(F=L.pop(),w=L[L.length-1],D=N.pop(),S=!0),F.leaf){var $=o(v,F.children,x);if($!==-1)return F.children.splice($,1),L.push(F),this._condense(L),this}S||F.leaf||!h(F,P)?w?(D++,F=w.children[D],S=!1):F=null:(L.push(F),N.push(D),D=0,w=F,F=F.children[0])}return this},n.prototype.toBBox=function(v){return v},n.prototype.compareMinX=function(v,x){return v.minX-x.minX},n.prototype.compareMinY=function(v,x){return v.minY-x.minY},n.prototype.toJSON=function(){return this.data},n.prototype.fromJSON=function(v){return this.data=v,this},n.prototype._all=function(v,x){for(var D=[];v;)v.leaf?x.push.apply(x,v.children):D.push.apply(D,v.children),v=D.pop();return x},n.prototype._build=function(v,x,D,w){var S,F=D-x+1,P=this._maxEntries;if(F<=P)return i(S=I(v.slice(x,D+1)),this.toBBox),S;w||(w=Math.ceil(Math.log(F)/Math.log(P)),P=Math.ceil(F/Math.pow(P,w-1))),(S=I([])).leaf=!1,S.height=w;var L=Math.ceil(F/P),N=L*Math.ceil(Math.sqrt(P));E(v,x,D,N,this.compareMinX);for(var $=x;$<=D;$+=N){var W=Math.min($+N-1,D);E(v,$,W,L,this.compareMinY);for(var V=$;V<=W;V+=L){var q=Math.min(V+L-1,W);S.children.push(this._build(v,V,q,w-1))}}return i(S,this.toBBox),S},n.prototype._chooseSubtree=function(v,x,D,w){for(;w.push(x),!x.leaf&&w.length-1!==D;){for(var S=1/0,F=1/0,P=void 0,L=0;L<x.children.length;L++){var N=x.children[L],$=d(N),W=(V=v,q=N,(Math.max(q.maxX,V.maxX)-Math.min(q.minX,V.minX))*(Math.max(q.maxY,V.maxY)-Math.min(q.minY,V.minY))-$);W<F?(F=W,S=$<S?$:S,P=N):W===F&&$<S&&(S=$,P=N)}x=P||x.children[0]}var V,q;return x},n.prototype._insert=function(v,x,D){var w=D?v:this.toBBox(v),S=[],F=this._chooseSubtree(w,this.data,x,S);for(F.children.push(v),u(F,w);x>=0&&S[x].children.length>this._maxEntries;)this._split(S,x),x--;this._adjustParentBBoxes(w,S,x)},n.prototype._split=function(v,x){var D=v[x],w=D.children.length,S=this._minEntries;this._chooseSplitAxis(D,S,w);var F=this._chooseSplitIndex(D,S,w),P=I(D.children.splice(F,D.children.length-F));P.height=D.height,P.leaf=D.leaf,i(D,this.toBBox),i(P,this.toBBox),x?v[x-1].children.push(P):this._splitRoot(D,P)},n.prototype._splitRoot=function(v,x){this.data=I([v,x]),this.data.height=v.height+1,this.data.leaf=!1,i(this.data,this.toBBox)},n.prototype._chooseSplitIndex=function(v,x,D){for(var w,S,F,P,L,N,$,W=1/0,V=1/0,q=x;q<=D-x;q++){var se=s(v,0,q,this.toBBox),ue=s(v,q,D,this.toBBox),ce=(S=se,F=ue,P=void 0,L=void 0,N=void 0,$=void 0,P=Math.max(S.minX,F.minX),L=Math.max(S.minY,F.minY),N=Math.min(S.maxX,F.maxX),$=Math.min(S.maxY,F.maxY),Math.max(0,N-P)*Math.max(0,$-L)),de=d(se)+d(ue);ce<W?(W=ce,w=q,V=de<V?de:V):ce===W&&de<V&&(V=de,w=q)}return w||D-x},n.prototype._chooseSplitAxis=function(v,x,D){var w=v.leaf?this.compareMinX:l,S=v.leaf?this.compareMinY:c;this._allDistMargin(v,x,D,w)<this._allDistMargin(v,x,D,S)&&v.children.sort(w)},n.prototype._allDistMargin=function(v,x,D,w){v.children.sort(w);for(var S=this.toBBox,F=s(v,0,x,S),P=s(v,D-x,D,S),L=f(F)+f(P),N=x;N<D-x;N++){var $=v.children[N];u(F,v.leaf?S($):$),L+=f(F)}for(var W=D-x-1;W>=x;W--){var V=v.children[W];u(P,v.leaf?S(V):V),L+=f(P)}return L},n.prototype._adjustParentBBoxes=function(v,x,D){for(var w=D;w>=0;w--)u(x[w],v)},n.prototype._condense=function(v){for(var x=v.length-1,D=void 0;x>=0;x--)v[x].children.length===0?x>0?(D=v[x-1].children).splice(D.indexOf(v[x]),1):this.clear():i(v[x],this.toBBox)},n})});var mx=Nu(De=>{"use strict";p();Object.defineProperty(De,"__esModule",{value:!0});De.earthRadius=63710088e-1;De.factors={centimeters:De.earthRadius*100,centimetres:De.earthRadius*100,degrees:De.earthRadius/111325,feet:De.earthRadius*3.28084,inches:De.earthRadius*39.37,kilometers:De.earthRadius/1e3,kilometres:De.earthRadius/1e3,meters:De.earthRadius,metres:De.earthRadius,miles:De.earthRadius/1609.344,millimeters:De.earthRadius*1e3,millimetres:De.earthRadius*1e3,nauticalmiles:De.earthRadius/1852,radians:1,yards:De.earthRadius*1.0936};De.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/De.earthRadius,yards:1.0936133};De.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 au(e,r,t){t===void 0&&(t={});var n={type:"Feature"};return(t.id===0||t.id)&&(n.id=t.id),t.bbox&&(n.bbox=t.bbox),n.properties=r||{},n.geometry=e,n}De.feature=au;function hG(e,r,t){switch(t===void 0&&(t={}),e){case"Point":return lx(r).geometry;case"LineString":return px(r).geometry;case"Polygon":return cx(r).geometry;case"MultiPoint":return fw(r).geometry;case"MultiLineString":return mw(r).geometry;case"MultiPolygon":return hw(r).geometry;default:throw new Error(e+" is invalid")}}De.geometry=hG;function lx(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(!Py(e[0])||!Py(e[1]))throw new Error("coordinates must contain numbers");var n={type:"Point",coordinates:e};return au(n,r,t)}De.point=lx;function gG(e,r,t){return t===void 0&&(t={}),ky(e.map(function(n){return lx(n,r)}),t)}De.points=gG;function cx(e,r,t){t===void 0&&(t={});for(var n=0,o=e;n<o.length;n++){var i=o[n];if(i.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var s=0;s<i[i.length-1].length;s++)if(i[i.length-1][s]!==i[0][s])throw new Error("First and last Position are not equivalent.")}var u={type:"Polygon",coordinates:e};return au(u,r,t)}De.polygon=cx;function yG(e,r,t){return t===void 0&&(t={}),ky(e.map(function(n){return cx(n,r)}),t)}De.polygons=yG;function px(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 n={type:"LineString",coordinates:e};return au(n,r,t)}De.lineString=px;function bG(e,r,t){return t===void 0&&(t={}),ky(e.map(function(n){return px(n,r)}),t)}De.lineStrings=bG;function ky(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}De.featureCollection=ky;function mw(e,r,t){t===void 0&&(t={});var n={type:"MultiLineString",coordinates:e};return au(n,r,t)}De.multiLineString=mw;function fw(e,r,t){t===void 0&&(t={});var n={type:"MultiPoint",coordinates:e};return au(n,r,t)}De.multiPoint=fw;function hw(e,r,t){t===void 0&&(t={});var n={type:"MultiPolygon",coordinates:e};return au(n,r,t)}De.multiPolygon=hw;function vG(e,r,t){t===void 0&&(t={});var n={type:"GeometryCollection",geometries:e};return au(n,r,t)}De.geometryCollection=vG;function xG(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}De.round=xG;function gw(e,r){r===void 0&&(r="kilometers");var t=De.factors[r];if(!t)throw new Error(r+" units is invalid");return e*t}De.radiansToLength=gw;function dx(e,r){r===void 0&&(r="kilometers");var t=De.factors[r];if(!t)throw new Error(r+" units is invalid");return e/t}De.lengthToRadians=dx;function IG(e,r){return yw(dx(e,r))}De.lengthToDegrees=IG;function EG(e){var r=e%360;return r<0&&(r+=360),r}De.bearingToAzimuth=EG;function yw(e){var r=e%(2*Math.PI);return r*180/Math.PI}De.radiansToDegrees=yw;function CG(e){var r=e%360;return r*Math.PI/180}De.degreesToRadians=CG;function SG(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 gw(dx(e,r),t)}De.convertLength=SG;function DG(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 n=De.areaFactors[r];if(!n)throw new Error("invalid original units");var o=De.areaFactors[t];if(!o)throw new Error("invalid final units");return e/n*o}De.convertArea=DG;function Py(e){return!isNaN(e)&&e!==null&&!Array.isArray(e)}De.isNumber=Py;function TG(e){return!!e&&e.constructor===Object}De.isObject=TG;function wG(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(!Py(r))throw new Error("bbox must only contain numbers")})}De.validateBBox=wG;function FG(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")}De.validateId=FG});var hx=Nu(xr=>{"use strict";p();Object.defineProperty(xr,"__esModule",{value:!0});var cn=mx();function ff(e,r,t){if(e!==null)for(var n,o,i,s,u,l,c,d=0,f=0,h,b=e.type,I=b==="FeatureCollection",E=b==="Feature",v=I?e.features.length:1,x=0;x<v;x++){c=I?e.features[x].geometry:E?e.geometry:e,h=c?c.type==="GeometryCollection":!1,u=h?c.geometries.length:1;for(var D=0;D<u;D++){var w=0,S=0;if(s=h?c.geometries[D]:c,s!==null){l=s.coordinates;var F=s.type;switch(d=t&&(F==="Polygon"||F==="MultiPolygon")?1:0,F){case null:break;case"Point":if(r(l,f,x,w,S)===!1)return!1;f++,w++;break;case"LineString":case"MultiPoint":for(n=0;n<l.length;n++){if(r(l[n],f,x,w,S)===!1)return!1;f++,F==="MultiPoint"&&w++}F==="LineString"&&w++;break;case"Polygon":case"MultiLineString":for(n=0;n<l.length;n++){for(o=0;o<l[n].length-d;o++){if(r(l[n][o],f,x,w,S)===!1)return!1;f++}F==="MultiLineString"&&w++,F==="Polygon"&&S++}F==="Polygon"&&w++;break;case"MultiPolygon":for(n=0;n<l.length;n++){for(S=0,o=0;o<l[n].length;o++){for(i=0;i<l[n][o].length-d;i++){if(r(l[n][o][i],f,x,w,S)===!1)return!1;f++}S++}w++}break;case"GeometryCollection":for(n=0;n<s.geometries.length;n++)if(ff(s.geometries[n],r,t)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function MG(e,r,t,n){var o=t;return ff(e,function(i,s,u,l,c){s===0&&t===void 0?o=i:o=r(o,i,s,u,l,c)},n),o}function bw(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 AG(e,r,t){var n=t;return bw(e,function(o,i){i===0&&t===void 0?n=o:n=r(n,o,i)}),n}function vw(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 OG(e,r,t){var n=t;return vw(e,function(o,i){i===0&&t===void 0?n=o:n=r(n,o,i)}),n}function BG(e){var r=[];return ff(e,function(t){r.push(t)}),r}function fx(e,r){var t,n,o,i,s,u,l,c,d,f,h=0,b=e.type==="FeatureCollection",I=e.type==="Feature",E=b?e.features.length:1;for(t=0;t<E;t++){for(u=b?e.features[t].geometry:I?e.geometry:e,c=b?e.features[t].properties:I?e.properties:{},d=b?e.features[t].bbox:I?e.bbox:void 0,f=b?e.features[t].id:I?e.id:void 0,l=u?u.type==="GeometryCollection":!1,s=l?u.geometries.length:1,o=0;o<s;o++){if(i=l?u.geometries[o]:u,i===null){if(r(null,h,c,d,f)===!1)return!1;continue}switch(i.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(r(i,h,c,d,f)===!1)return!1;break}case"GeometryCollection":{for(n=0;n<i.geometries.length;n++)if(r(i.geometries[n],h,c,d,f)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}h++}}function PG(e,r,t){var n=t;return fx(e,function(o,i,s,u,l){i===0&&t===void 0?n=o:n=r(n,o,i,s,u,l)}),n}function _y(e,r){fx(e,function(t,n,o,i,s){var u=t===null?null:t.type;switch(u){case null:case"Point":case"LineString":case"Polygon":return r(cn.feature(t,o,{bbox:i,id:s}),n,0)===!1?!1:void 0}var l;switch(u){case"MultiPoint":l="Point";break;case"MultiLineString":l="LineString";break;case"MultiPolygon":l="Polygon";break}for(var c=0;c<t.coordinates.length;c++){var d=t.coordinates[c],f={type:l,coordinates:d};if(r(cn.feature(f,o),n,c)===!1)return!1}})}function kG(e,r,t){var n=t;return _y(e,function(o,i,s){i===0&&s===0&&t===void 0?n=o:n=r(n,o,i,s)}),n}function xw(e,r){_y(e,function(t,n,o){var i=0;if(t.geometry){var s=t.geometry.type;if(!(s==="Point"||s==="MultiPoint")){var u,l=0,c=0,d=0;if(ff(t,function(f,h,b,I,E){if(u===void 0||n>l||I>c||E>d){u=f,l=n,c=I,d=E,i=0;return}var v=cn.lineString([u,f],t.properties);if(r(v,n,o,E,i)===!1)return!1;i++,u=f})===!1)return!1}}})}function _G(e,r,t){var n=t,o=!1;return xw(e,function(i,s,u,l,c){o===!1&&t===void 0?n=i:n=r(n,i,s,u,l,c),o=!0}),n}function Iw(e,r){if(!e)throw new Error("geojson is required");_y(e,function(t,n,o){if(t.geometry!==null){var i=t.geometry.type,s=t.geometry.coordinates;switch(i){case"LineString":if(r(t,n,o,0,0)===!1)return!1;break;case"Polygon":for(var u=0;u<s.length;u++)if(r(cn.lineString(s[u],t.properties),n,o,u)===!1)return!1;break}}})}function LG(e,r,t){var n=t;return Iw(e,function(o,i,s,u){i===0&&t===void 0?n=o:n=r(n,o,i,s,u)}),n}function RG(e,r){if(r=r||{},!cn.isObject(r))throw new Error("options is invalid");var t=r.featureIndex||0,n=r.multiFeatureIndex||0,o=r.geometryIndex||0,i=r.segmentIndex||0,s=r.properties,u;switch(e.type){case"FeatureCollection":t<0&&(t=e.features.length+t),s=s||e.features[t].properties,u=e.features[t].geometry;break;case"Feature":s=s||e.properties,u=e.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":u=e;break;default:throw new Error("geojson is invalid")}if(u===null)return null;var l=u.coordinates;switch(u.type){case"Point":case"MultiPoint":return null;case"LineString":return i<0&&(i=l.length+i-1),cn.lineString([l[i],l[i+1]],s,r);case"Polygon":return o<0&&(o=l.length+o),i<0&&(i=l[o].length+i-1),cn.lineString([l[o][i],l[o][i+1]],s,r);case"MultiLineString":return n<0&&(n=l.length+n),i<0&&(i=l[n].length+i-1),cn.lineString([l[n][i],l[n][i+1]],s,r);case"MultiPolygon":return n<0&&(n=l.length+n),o<0&&(o=l[n].length+o),i<0&&(i=l[n][o].length-i-1),cn.lineString([l[n][o][i],l[n][o][i+1]],s,r)}throw new Error("geojson is invalid")}function NG(e,r){if(r=r||{},!cn.isObject(r))throw new Error("options is invalid");var t=r.featureIndex||0,n=r.multiFeatureIndex||0,o=r.geometryIndex||0,i=r.coordIndex||0,s=r.properties,u;switch(e.type){case"FeatureCollection":t<0&&(t=e.features.length+t),s=s||e.features[t].properties,u=e.features[t].geometry;break;case"Feature":s=s||e.properties,u=e.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":u=e;break;default:throw new Error("geojson is invalid")}if(u===null)return null;var l=u.coordinates;switch(u.type){case"Point":return cn.point(l,s,r);case"MultiPoint":return n<0&&(n=l.length+n),cn.point(l[n],s,r);case"LineString":return i<0&&(i=l.length+i),cn.point(l[i],s,r);case"Polygon":return o<0&&(o=l.length+o),i<0&&(i=l[o].length+i),cn.point(l[o][i],s,r);case"MultiLineString":return n<0&&(n=l.length+n),i<0&&(i=l[n].length+i),cn.point(l[n][i],s,r);case"MultiPolygon":return n<0&&(n=l.length+n),o<0&&(o=l[n].length+o),i<0&&(i=l[n][o].length-i),cn.point(l[n][o][i],s,r)}throw new Error("geojson is invalid")}xr.coordAll=BG;xr.coordEach=ff;xr.coordReduce=MG;xr.featureEach=vw;xr.featureReduce=OG;xr.findPoint=NG;xr.findSegment=RG;xr.flattenEach=_y;xr.flattenReduce=kG;xr.geomEach=fx;xr.geomReduce=PG;xr.lineEach=Iw;xr.lineReduce=LG;xr.propEach=bw;xr.propReduce=AG;xr.segmentEach=xw;xr.segmentReduce=_G});var Ew=Nu(yx=>{"use strict";p();Object.defineProperty(yx,"__esModule",{value:!0});var $G=hx();function gx(e){var r=[1/0,1/0,-1/0,-1/0];return $G.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}gx.default=gx;yx.default=gx});var ww=Nu((Cve,bx)=>{p();var ca=dw(),Sw=mx(),Dw=hx(),Mp=Ew().default,jG=Dw.featureEach,Ive=Dw.coordEach,Eve=Sw.polygon,Cw=Sw.featureCollection;function Tw(e){var r=new ca(e);return r.insert=function(t){if(t.type!=="Feature")throw new Error("invalid feature");return t.bbox=t.bbox?t.bbox:Mp(t),ca.prototype.insert.call(this,t)},r.load=function(t){var n=[];return Array.isArray(t)?t.forEach(function(o){if(o.type!=="Feature")throw new Error("invalid features");o.bbox=o.bbox?o.bbox:Mp(o),n.push(o)}):jG(t,function(o){if(o.type!=="Feature")throw new Error("invalid features");o.bbox=o.bbox?o.bbox:Mp(o),n.push(o)}),ca.prototype.load.call(this,n)},r.remove=function(t,n){if(t.type!=="Feature")throw new Error("invalid feature");return t.bbox=t.bbox?t.bbox:Mp(t),ca.prototype.remove.call(this,t,n)},r.clear=function(){return ca.prototype.clear.call(this)},r.search=function(t){var n=ca.prototype.search.call(this,this.toBBox(t));return Cw(n)},r.collides=function(t){return ca.prototype.collides.call(this,this.toBBox(t))},r.all=function(){var t=ca.prototype.all.call(this);return Cw(t)},r.toJSON=function(){return ca.prototype.toJSON.call(this)},r.fromJSON=function(t){return ca.prototype.fromJSON.call(this,t)},r.toBBox=function(t){var n;if(t.bbox)n=t.bbox;else if(Array.isArray(t)&&t.length===4)n=t;else if(Array.isArray(t)&&t.length===6)n=[t[0],t[1],t[3],t[4]];else if(t.type==="Feature")n=Mp(t);else if(t.type==="FeatureCollection")n=Mp(t);else throw new Error("invalid geojson");return{minX:n[0],minY:n[1],maxX:n[2],maxY:n[3]}},r}bx.exports=Tw;bx.exports.default=Tw});p();p();p();p();p();p();var ym=e=>e!=null;var c8=function(){let r=globalThis.fetch;return{fetch(...t){if(!ym(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}}}(),ME=c8.fetch;var kE=["websdk","web","webv2","kiosk-v2","mobile","iossdk","androidsdk","reactnativesdk","gen7","bespoke","reactsdk"],AE=kE[0],_E="https://api-gateway.mappedin.com/track-analytics/a/",LE="deny-watchposition",RE="load-mapview",NE="load-mapdata",$E="change-language",jE="query-directions";var Xi,vo,$a,Mb,Vh,Bc=class{constructor(){C(this,$a);C(this,Xi,Object.freeze({}));C(this,vo);m(this,"oneTimeEventsSent",new Set);m(this,"sendGetDirectionsEvent",ib((r,t,n)=>{let o={start:r,end:t,type:"location_to_location"};return n!==void 0&&(o.accessible=n),this.sendAnalyticEvent(jE,o)},2500));T(this,vo,z(this,$a,Vh).call(this,a(this,Xi)))}init(r){this.reset(),this.updateStateWithOptions(r)}reset(){T(this,Xi,{}),T(this,vo,z(this,$a,Vh).call(this,{})),this.oneTimeEventsSent.clear()}updateStateWithOptions(r){return T(this,Xi,Object.freeze(Object.assign({},a(this,Xi),r))),T(this,vo,z(this,$a,Vh).call(this,r)),z(this,$a,Mb).call(this,a(this,vo)),a(this,vo)}updateState(r){let t={...r};t.mapId&&(t.analyticsBaseUrl=Fb({...a(this,vo),mapId:t.mapId})),t.context&&(t.context=PE(t.context)),t.baseUri&&(t.analyticsBaseUrl=Fb({baseUri:t.baseUri,mapId:a(this,vo).mapId})),Object.assign(a(this,vo),t),this.handleStateUpdate(r),z(this,$a,Mb).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:n}=this.getState();return!!(r&&t)||!!n}getState(){return a(this,vo)}getContext(){return this.getState().context||a(this,Xi).context||AE}getSessionId(){return this.getState().sessionId||a(this,Xi).sessionId||BE()}getDeviceId(){return this.getState().deviceId||a(this,Xi).deviceId||OE()}sendAnalyticEvent(r,t={}){let n=this.getState(),o=p8(n.analyticsBaseUrl,r),i={"mi-context":this.getContext(),"mi-session":this.getSessionId(),"mi-device":this.getDeviceId()};if(n.logEvents&&R.log("Analytics.track",o,i),!n.sendEvents)return Promise.resolve();if(!this.authReady)return R.warn("Auth needs to be ready to send analytics.");let s={...t,g:n.geolocationMode,sdk_version:n.version};return n.userPosition&&Object.assign(s,n.userPosition),i["Content-Type"]="application/json",n.accessToken?i.Authorization=`Bearer ${n.accessToken}`:n.noAuth||n.secret&&n.key&&(i["x-mappedin-key"]=btoa(n.key),i["x-mappedin-secret"]=btoa(n.secret)),ME(o,{method:"POST",mode:"cors",headers:i,body:JSON.stringify(s)})}capture(r,t){if(m8.includes(r))return R.warn(`${r} event is sent internally.`),Promise.resolve();let n=d8.includes(r)?r.slice(1):r;return this.sendAnalyticEvent(n,t)}sendGetMapDataEvent(r){return this.sendAnalyticEvent(NE,r)}sendChangeLanguageEvent(r){return this.sendAnalyticEvent($E,r)}sendWatchPositionDenied(){return this.sendAnalyticEvent(LE)}sendMapViewLoadedEvent({firstRenderDuration:r,dimension:t,collisionWorkerDisabled:n,outdoorsWorkerDisabled:o}){return this.sendAnalyticEvent(RE,{type:"3d",firstRenderDuration:r,width:t.width,height:t.height,devicePixelRatio:globalThis.devicePixelRatio||1,collisionWorkerDisabled:n,outdoorsWorkerDisabled:o})}sendBlueDotEvents(r){if(!((r==="found-floor"||r==="found-position")&&this.oneTimeEventsSent.has(r)))return this.oneTimeEventsSent.add(r),this.sendAnalyticEvent(r)}};Xi=new WeakMap,vo=new WeakMap,$a=new WeakSet,Mb=function(r){r.sessionId&&_a.getInstance().saveSessionData("id",r.sessionId),r.deviceId&&_a.getInstance().saveLocalData("deviceId",r.deviceId)},Vh=function(r){let t=r.baseUri??_E;return{baseUri:t,analyticsBaseUrl:Fb({...r,baseUri:t}),version:y?.env?.npm_package_version||"v6",deviceId:r.deviceId||OE(),accessToken:r.accessToken,mapId:r.mapId,sessionId:r.sessionId||BE(),platformString:r.platformString||"",context:PE(r.context)||AE,geolocationMode:!1,sendEvents:r.sendEvents??!0,logEvents:r.logEvents??!1,noAuth:r.noAuth||!1,key:r.key,secret:r.secret}};function Fb({mapId:e,baseUri:r=_E}){return`${r}${e}/`}function OE(){return _a.getInstance().loadLocalData("deviceId")}function BE(){return _a.getInstance().loadSessionData("id")}function p8(e,r){return e+r}function PE(e){return kE.find(r=>r===e)}var d8=["$select-location","$select-category","$query-suggest","$query-search"],m8=[RE,NE,jE,LE,$E],LZ=new Bc,xo,bm=class{constructor(r){C(this,xo);m(this,"capture");m(this,"updateState");T(this,xo,r),this.capture=a(this,xo).capture.bind(a(this,xo)),this.updateState=a(this,xo).updateState.bind(a(this,xo))}getState(){let{sessionId:r,deviceId:t,...n}=a(this,xo).getState();return n}getContext(){return a(this,xo).getContext()}getSessionId(){return a(this,xo).getSessionId()}getDeviceId(){return a(this,xo).getDeviceId()}};xo=new WeakMap;p();p();var xm,Im,Em,vm=class{constructor(r,t,{enabled:n=!1}={}){C(this,xm);m(this,"searchInstance");C(this,Im);C(this,Em);m(this,"enabled",!1);T(this,xm,r),T(this,Im,t),T(this,Em,()=>{this.searchInstance?.then(o=>o.populate())}),n&&this.enable()}async query(r,t={}){if(this.enabled||await this.enable(),!this.searchInstance)return R.error("Search should be enabled by now"),{places:[],enterpriseLocations:[],enterpriseCategories:[]};try{return await(await this.searchInstance).search(r,t)}catch(n){return R.error("Search.query failed due to",n),{places:[],enterpriseLocations:[],enterpriseCategories:[]}}}async suggest(r,t={}){if(this.enabled||await this.enable(),!this.searchInstance)return R.error("Search should be enabled by now"),[];try{return await(await this.searchInstance).suggest(r,t)}catch(n){return R.error("Search.suggest failed due to",n),[]}}async enable(){this.enabled||(this.enabled=!0,this.searchInstance||(this.searchInstance=import("./internal-HTTM4ECA.js").then(({InternalSearch:r})=>new r(a(this,xm)))),a(this,Im).on("language-change",a(this,Em)),await this.searchInstance)}};xm=new WeakMap,Im=new WeakMap,Em=new WeakMap;var UE=new WeakMap,Hu,Nt,Ab=class{constructor(r,{search:t}={}){C(this,Hu);C(this,Nt);m(this,"Analytics");m(this,"Search");m(this,"Query");m(this,"internal");m(this,"on",(r,t)=>{a(this,Hu).on(r,t)});m(this,"off",(r,t)=>{a(this,Hu).off(r,t)});m(this,"__LEGACY_GET_DIRECTIONS_SYNC",(r,t,n)=>a(this,Nt).__LEGACY_GET_DIRECTIONS_SYNC(r,t,n));m(this,"getDirections",(r,t,n)=>a(this,Nt).getDirections(r,t,n));m(this,"__LEGACY_GET_DIRECTIONS_MULTI_DESTINATION_SYNC",(r,t,n)=>a(this,Nt).__LEGACY_GET_DIRECTIONS_MULTI_DESTINATION_SYNC(r,t,n));m(this,"getDirectionsMultiDestination",(r,t,n)=>a(this,Nt).getDirectionsMultiDestination(r,t,n));T(this,Hu,new Oe),T(this,Nt,r),UE.set(this,r),this.Analytics=new bm(r.Analytics),this.Query=r.Query,this.internal=r,this.Search=new vm(this,r,{enabled:t?.enabled}),a(this,Nt).on("language-change",n=>{a(this,Hu).publish("language-change",n)})}getEnv(){return a(this,Nt).getEnv()}getAccessToken(){return a(this,Nt).tokenManager?.getAccessToken().token}get mapName(){return a(this,Nt).mapName}get mapId(){return a(this,Nt).getMapDataOptions?.mapId}get mapCenter(){return a(this,Nt).mapCenter}get organizationId(){return a(this,Nt).organizationId}get outdoorViewToken(){return a(this,Nt).outdoorViewToken}getByType(r){return a(this,Nt).getByType(r)}getById(r,t){return a(this,Nt).getById(r,t)}getByExternalId(r,t){return a(this,Nt).getByExternalId(r,t)}getGeoJSON(r){return r.geoJSON}async changeLanguage(r){return a(this,Nt).changeLanguage(r)}get currentLanguage(){return a(this,Nt).currentLanguage}get naturalBearing(){return a(this,Nt).naturalBearing??0}getDistance(r,t){return a(this,Nt).getDistance(r,t)}toBinaryBundle({downloadLanguagePacks:r=!0}={}){return a(this,Nt).toBinaryBundle({downloadLanguagePacks:r})}toJSONBundle({downloadLanguagePacks:r=!0}={}){return a(this,Nt).toJSONBundle({downloadLanguagePacks:r})}};Hu=new WeakMap,Nt=new WeakMap;var Cm=Ab;function Sm(e){let r=UE.get(e);if(!r)throw new Error("MapDataInternal not found");return r}p();p();p();p();p();p();p();p();p();p();p();p();p();p();p();p();p();p();p();p();p();p();var Hh={accessible:"accessible",outdoors:"outdoors",public:"public"};p();p();p();p();p();p();var Ye={};$s(Ye,{HasPropertyKey:()=>f8,IsArray:()=>rn,IsAsyncIterator:()=>Ob,IsBigInt:()=>Dm,IsBoolean:()=>Hs,IsDate:()=>Zu,IsFunction:()=>Bb,IsIterator:()=>Pb,IsNull:()=>kb,IsNumber:()=>ti,IsObject:()=>Et,IsRegExp:()=>Tm,IsString:()=>Bt,IsSymbol:()=>_b,IsUint8Array:()=>ja,IsUndefined:()=>Zt});p();function f8(e,r){return r in e}function Ob(e){return Et(e)&&!rn(e)&&!ja(e)&&Symbol.asyncIterator in e}function rn(e){return Array.isArray(e)}function Dm(e){return typeof e=="bigint"}function Hs(e){return typeof e=="boolean"}function Zu(e){return e instanceof globalThis.Date}function Bb(e){return typeof e=="function"}function Pb(e){return Et(e)&&!rn(e)&&!ja(e)&&Symbol.iterator in e}function kb(e){return e===null}function ti(e){return typeof e=="number"}function Et(e){return typeof e=="object"&&e!==null}function Tm(e){return e instanceof globalThis.RegExp}function Bt(e){return typeof e=="string"}function _b(e){return typeof e=="symbol"}function ja(e){return e instanceof globalThis.Uint8Array}function Zt(e){return e===void 0}function h8(e){return e.map(r=>Zh(r))}function g8(e){return new Date(e.getTime())}function y8(e){return new Uint8Array(e)}function b8(e){return new RegExp(e.source,e.flags)}function v8(e){let r={};for(let t of Object.getOwnPropertyNames(e))r[t]=Zh(e[t]);for(let t of Object.getOwnPropertySymbols(e))r[t]=Zh(e[t]);return r}function Zh(e){return rn(e)?h8(e):Zu(e)?g8(e):ja(e)?y8(e):Tm(e)?b8(e):Et(e)?v8(e):e}function $t(e){return Zh(e)}function GE(e){return e.map(r=>wm(r))}function wm(e,r){return r===void 0?$t(e):$t({...r,...e})}p();p();p();function Wh(e){return Be(e)&&Symbol.asyncIterator in e}function Xh(e){return Be(e)&&Symbol.iterator in e}function Lb(e){return Be(e)&&(Object.getPrototypeOf(e)===Object.prototype||Object.getPrototypeOf(e)===null)}function Jh(e){return e instanceof Promise}function mn(e){return e instanceof Date&&Number.isFinite(e.getTime())}function zE(e){return e instanceof globalThis.Map}function VE(e){return e instanceof globalThis.Set}function Io(e){return ArrayBuffer.isView(e)}function Pc(e){return e instanceof globalThis.Uint8Array}function Te(e,r){return r in e}function Be(e){return e!==null&&typeof e=="object"}function Me(e){return Array.isArray(e)&&!ArrayBuffer.isView(e)}function Wt(e){return e===void 0}function Ua(e){return e===null}function Ji(e){return typeof e=="boolean"}function ye(e){return typeof e=="number"}function Yh(e){return Number.isInteger(e)}function Gr(e){return typeof e=="bigint"}function He(e){return typeof e=="string"}function Zs(e){return typeof e=="function"}function Ga(e){return typeof e=="symbol"}function zr(e){return Gr(e)||Ji(e)||Ua(e)||ye(e)||He(e)||Ga(e)||Wt(e)}var mt;(function(e){e.InstanceMode="default",e.ExactOptionalPropertyTypes=!1,e.AllowArrayObject=!1,e.AllowNaN=!1,e.AllowNullVoid=!1;function r(s,u){return e.ExactOptionalPropertyTypes?u in s:s[u]!==void 0}e.IsExactOptionalProperty=r;function t(s){let u=Be(s);return e.AllowArrayObject?u:u&&!Me(s)}e.IsObjectLike=t;function n(s){return t(s)&&!(s instanceof Date)&&!(s instanceof Uint8Array)}e.IsRecordLike=n;function o(s){return e.AllowNaN?ye(s):Number.isFinite(s)}e.IsNumberLike=o;function i(s){let u=Wt(s);return e.AllowNullVoid?u||s===null:u}e.IsVoidLike=i})(mt||(mt={}));p();function x8(e){return globalThis.Object.freeze(e).map(r=>Fm(r))}function I8(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 rn(e)?x8(e):Zu(e)?e:ja(e)?e:Tm(e)?e:Et(e)?I8(e):e}function H(e,r){let t=r!==void 0?{...r,...e}:e;switch(mt.InstanceMode){case"freeze":return Fm(t);case"clone":return $t(t);default:return t}}p();var Se=class extends Error{constructor(r){super(r)}};p();p();p();var jt=Symbol.for("TypeBox.Transform"),za=Symbol.for("TypeBox.Readonly"),fn=Symbol.for("TypeBox.Optional"),Eo=Symbol.for("TypeBox.Hint"),j=Symbol.for("TypeBox.Kind");function HE(e){return Et(e)&&e[za]==="Readonly"}function Yi(e){return Et(e)&&e[fn]==="Optional"}function Rb(e){return Ke(e,"Any")}function Va(e){return Ke(e,"Array")}function Mm(e){return Ke(e,"AsyncIterator")}function Nb(e){return Ke(e,"BigInt")}function $b(e){return Ke(e,"Boolean")}function Am(e){return Ke(e,"Constructor")}function E8(e){return Ke(e,"Date")}function Om(e){return Ke(e,"Function")}function Wu(e){return Ke(e,"Integer")}function ur(e){return Ke(e,"Intersect")}function Bm(e){return Ke(e,"Iterator")}function Ke(e,r){return Et(e)&&j in e&&e[j]===r}function Ha(e){return Ke(e,"Literal")}function Jn(e){return Ke(e,"MappedKey")}function Ut(e){return Ke(e,"MappedResult")}function Ws(e){return Ke(e,"Never")}function C8(e){return Ke(e,"Not")}function S8(e){return Ke(e,"Null")}function Xu(e){return Ke(e,"Number")}function br(e){return Ke(e,"Object")}function Ju(e){return Ke(e,"Promise")}function jb(e){return Ke(e,"Record")}function Ub(e){return Ke(e,"Ref")}function Gb(e){return Ke(e,"RegExp")}function Pm(e){return Ke(e,"String")}function D8(e){return Ke(e,"Symbol")}function Yn(e){return Ke(e,"TemplateLiteral")}function T8(e){return Ke(e,"This")}function kc(e){return Et(e)&&jt in e}function ri(e){return Ke(e,"Tuple")}function w8(e){return Ke(e,"Undefined")}function st(e){return Ke(e,"Union")}function F8(e){return Ke(e,"Uint8Array")}function M8(e){return Ke(e,"Unknown")}function A8(e){return Ke(e,"Unsafe")}function O8(e){return Ke(e,"Void")}function Xs(e){return Et(e)&&j in e&&Bt(e[j])}function ni(e){return Rb(e)||Va(e)||$b(e)||Nb(e)||Mm(e)||Am(e)||E8(e)||Om(e)||Wu(e)||ur(e)||Bm(e)||Ha(e)||Jn(e)||Ut(e)||Ws(e)||C8(e)||S8(e)||Xu(e)||br(e)||Ju(e)||jb(e)||Ub(e)||Gb(e)||Pm(e)||D8(e)||Yn(e)||T8(e)||ri(e)||w8(e)||st(e)||F8(e)||M8(e)||A8(e)||O8(e)||Xs(e)}var M={};$s(M,{IsAny:()=>JE,IsArray:()=>YE,IsAsyncIterator:()=>KE,IsBigInt:()=>qE,IsBoolean:()=>QE,IsConstructor:()=>eC,IsDate:()=>tC,IsFunction:()=>rC,IsInteger:()=>nC,IsIntersect:()=>oC,IsIterator:()=>iC,IsKind:()=>MC,IsKindOf:()=>We,IsLiteral:()=>_m,IsLiteralBoolean:()=>N8,IsLiteralNumber:()=>sC,IsLiteralString:()=>aC,IsLiteralValue:()=>uC,IsMappedKey:()=>lC,IsMappedResult:()=>cC,IsNever:()=>pC,IsNot:()=>dC,IsNull:()=>mC,IsNumber:()=>fC,IsObject:()=>hC,IsOptional:()=>R8,IsPromise:()=>gC,IsProperties:()=>Zb,IsReadonly:()=>L8,IsRecord:()=>yC,IsRecursive:()=>$8,IsRef:()=>bC,IsRegExp:()=>vC,IsSchema:()=>Ze,IsString:()=>xC,IsSymbol:()=>IC,IsTemplateLiteral:()=>EC,IsThis:()=>CC,IsTransform:()=>Pt,IsTuple:()=>SC,IsUint8Array:()=>DC,IsUndefined:()=>_c,IsUnion:()=>Wb,IsUnionLiteral:()=>j8,IsUnknown:()=>TC,IsUnsafe:()=>wC,IsVoid:()=>FC,TypeGuardUnknownTypeError:()=>zb});p();var zb=class extends Se{},P8=["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 ZE(e){try{return new RegExp(e),!0}catch{return!1}}function Vb(e){if(!Bt(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 WE(e){return Hb(e)||Ze(e)}function km(e){return Zt(e)||Dm(e)}function Ft(e){return Zt(e)||ti(e)}function Hb(e){return Zt(e)||Hs(e)}function ht(e){return Zt(e)||Bt(e)}function k8(e){return Zt(e)||Bt(e)&&Vb(e)&&ZE(e)}function _8(e){return Zt(e)||Bt(e)&&Vb(e)}function XE(e){return Zt(e)||Ze(e)}function L8(e){return Et(e)&&e[za]==="Readonly"}function R8(e){return Et(e)&&e[fn]==="Optional"}function JE(e){return We(e,"Any")&&ht(e.$id)}function YE(e){return We(e,"Array")&&e.type==="array"&&ht(e.$id)&&Ze(e.items)&&Ft(e.minItems)&&Ft(e.maxItems)&&Hb(e.uniqueItems)&&XE(e.contains)&&Ft(e.minContains)&&Ft(e.maxContains)}function KE(e){return We(e,"AsyncIterator")&&e.type==="AsyncIterator"&&ht(e.$id)&&Ze(e.items)}function qE(e){return We(e,"BigInt")&&e.type==="bigint"&&ht(e.$id)&&km(e.exclusiveMaximum)&&km(e.exclusiveMinimum)&&km(e.maximum)&&km(e.minimum)&&km(e.multipleOf)}function QE(e){return We(e,"Boolean")&&e.type==="boolean"&&ht(e.$id)}function eC(e){return We(e,"Constructor")&&e.type==="Constructor"&&ht(e.$id)&&rn(e.parameters)&&e.parameters.every(r=>Ze(r))&&Ze(e.returns)}function tC(e){return We(e,"Date")&&e.type==="Date"&&ht(e.$id)&&Ft(e.exclusiveMaximumTimestamp)&&Ft(e.exclusiveMinimumTimestamp)&&Ft(e.maximumTimestamp)&&Ft(e.minimumTimestamp)&&Ft(e.multipleOfTimestamp)}function rC(e){return We(e,"Function")&&e.type==="Function"&&ht(e.$id)&&rn(e.parameters)&&e.parameters.every(r=>Ze(r))&&Ze(e.returns)}function nC(e){return We(e,"Integer")&&e.type==="integer"&&ht(e.$id)&&Ft(e.exclusiveMaximum)&&Ft(e.exclusiveMinimum)&&Ft(e.maximum)&&Ft(e.minimum)&&Ft(e.multipleOf)}function Zb(e){return Et(e)&&Object.entries(e).every(([r,t])=>Vb(r)&&Ze(t))}function oC(e){return We(e,"Intersect")&&!(Bt(e.type)&&e.type!=="object")&&rn(e.allOf)&&e.allOf.every(r=>Ze(r)&&!Pt(r))&&ht(e.type)&&(Hb(e.unevaluatedProperties)||XE(e.unevaluatedProperties))&&ht(e.$id)}function iC(e){return We(e,"Iterator")&&e.type==="Iterator"&&ht(e.$id)&&Ze(e.items)}function We(e,r){return Et(e)&&j in e&&e[j]===r}function aC(e){return _m(e)&&Bt(e.const)}function sC(e){return _m(e)&&ti(e.const)}function N8(e){return _m(e)&&Hs(e.const)}function _m(e){return We(e,"Literal")&&ht(e.$id)&&uC(e.const)}function uC(e){return Hs(e)||ti(e)||Bt(e)}function lC(e){return We(e,"MappedKey")&&rn(e.keys)&&e.keys.every(r=>ti(r)||Bt(r))}function cC(e){return We(e,"MappedResult")&&Zb(e.properties)}function pC(e){return We(e,"Never")&&Et(e.not)&&Object.getOwnPropertyNames(e.not).length===0}function dC(e){return We(e,"Not")&&Ze(e.not)}function mC(e){return We(e,"Null")&&e.type==="null"&&ht(e.$id)}function fC(e){return We(e,"Number")&&e.type==="number"&&ht(e.$id)&&Ft(e.exclusiveMaximum)&&Ft(e.exclusiveMinimum)&&Ft(e.maximum)&&Ft(e.minimum)&&Ft(e.multipleOf)}function hC(e){return We(e,"Object")&&e.type==="object"&&ht(e.$id)&&Zb(e.properties)&&WE(e.additionalProperties)&&Ft(e.minProperties)&&Ft(e.maxProperties)}function gC(e){return We(e,"Promise")&&e.type==="Promise"&&ht(e.$id)&&Ze(e.item)}function yC(e){return We(e,"Record")&&e.type==="object"&&ht(e.$id)&&WE(e.additionalProperties)&&Et(e.patternProperties)&&(r=>{let t=Object.getOwnPropertyNames(r.patternProperties);return t.length===1&&ZE(t[0])&&Et(r.patternProperties)&&Ze(r.patternProperties[t[0]])})(e)}function $8(e){return Et(e)&&Eo in e&&e[Eo]==="Recursive"}function bC(e){return We(e,"Ref")&&ht(e.$id)&&Bt(e.$ref)}function vC(e){return We(e,"RegExp")&&ht(e.$id)&&Bt(e.source)&&Bt(e.flags)&&Ft(e.maxLength)&&Ft(e.minLength)}function xC(e){return We(e,"String")&&e.type==="string"&&ht(e.$id)&&Ft(e.minLength)&&Ft(e.maxLength)&&k8(e.pattern)&&_8(e.format)}function IC(e){return We(e,"Symbol")&&e.type==="symbol"&&ht(e.$id)}function EC(e){return We(e,"TemplateLiteral")&&e.type==="string"&&Bt(e.pattern)&&e.pattern[0]==="^"&&e.pattern[e.pattern.length-1]==="$"}function CC(e){return We(e,"This")&&ht(e.$id)&&Bt(e.$ref)}function Pt(e){return Et(e)&&jt in e}function SC(e){return We(e,"Tuple")&&e.type==="array"&&ht(e.$id)&&ti(e.minItems)&&ti(e.maxItems)&&e.minItems===e.maxItems&&(Zt(e.items)&&Zt(e.additionalItems)&&e.minItems===0||rn(e.items)&&e.items.every(r=>Ze(r)))}function _c(e){return We(e,"Undefined")&&e.type==="undefined"&&ht(e.$id)}function j8(e){return Wb(e)&&e.anyOf.every(r=>aC(r)||sC(r))}function Wb(e){return We(e,"Union")&&ht(e.$id)&&Et(e)&&rn(e.anyOf)&&e.anyOf.every(r=>Ze(r))}function DC(e){return We(e,"Uint8Array")&&e.type==="Uint8Array"&&ht(e.$id)&&Ft(e.minByteLength)&&Ft(e.maxByteLength)}function TC(e){return We(e,"Unknown")&&ht(e.$id)}function wC(e){return We(e,"Unsafe")}function FC(e){return We(e,"Void")&&e.type==="void"&&ht(e.$id)}function MC(e){return Et(e)&&j in e&&Bt(e[j])&&!P8.includes(e[j])}function Ze(e){return Et(e)&&(JE(e)||YE(e)||QE(e)||qE(e)||KE(e)||eC(e)||tC(e)||rC(e)||nC(e)||oC(e)||iC(e)||_m(e)||lC(e)||cC(e)||pC(e)||dC(e)||mC(e)||fC(e)||hC(e)||gC(e)||yC(e)||bC(e)||vC(e)||xC(e)||IC(e)||EC(e)||CC(e)||SC(e)||_c(e)||Wb(e)||DC(e)||TC(e)||wC(e)||FC(e)||MC(e))}p();var Xb="(true|false)",Lm="(0|[1-9][0-9]*)",Jb="(.*)",U8="(?!.*)",hX=`^${Xb}$`,Za=`^${Lm}$`,Wa=`^${Jb}$`,AC=`^${U8}$`;p();var Bn={};$s(Bn,{Clear:()=>z8,Delete:()=>V8,Entries:()=>G8,Get:()=>W8,Has:()=>H8,Set:()=>Z8});p();var Lc=new Map;function G8(){return new Map(Lc)}function z8(){return Lc.clear()}function V8(e){return Lc.delete(e)}function H8(e){return Lc.has(e)}function Z8(e,r){Lc.set(e,r)}function W8(e){return Lc.get(e)}var Ar={};$s(Ar,{Clear:()=>J8,Delete:()=>Y8,Entries:()=>X8,Get:()=>Q8,Has:()=>K8,Set:()=>q8});p();var Rc=new Map;function X8(){return new Map(Rc)}function J8(){return Rc.clear()}function Y8(e){return Rc.delete(e)}function K8(e){return Rc.has(e)}function q8(e,r){Rc.set(e,r)}function Q8(e){return Rc.get(e)}p();function OC(e,r){return e.includes(r)}function BC(e){return[...new Set(e)]}function e9(e,r){return e.filter(t=>r.includes(t))}function t9(e,r){return e.reduce((t,n)=>e9(t,n),r)}function PC(e){return e.length===1?e[0]:e.length>1?t9(e.slice(1),e[0]):[]}function kC(e){let r=[];for(let t of e)r.push(...t);return r}p();function Js(e){return H({[j]:"Any"},e)}p();function Kh(e,r){return H({[j]:"Array",type:"array",items:e},r)}p();function qh(e,r){return H({[j]:"AsyncIterator",type:"AsyncIterator",items:e},r)}p();p();p();function r9(e,r){let{[r]:t,...n}=e;return n}function er(e,r){return r.reduce((t,n)=>r9(t,n),e)}p();function gt(e){return H({[j]:"Never",not:{}},e)}p();p();function qe(e){return H({[j]:"MappedResult",properties:e})}p();p();function Qh(e,r,t){return H({[j]:"Constructor",type:"Constructor",parameters:e,returns:r},t)}p();function Ys(e,r,t){return H({[j]:"Function",type:"Function",parameters:e,returns:r},t)}p();p();p();p();function Rm(e,r){return H({[j]:"Union",anyOf:e},r)}function n9(e){return e.some(r=>Yi(r))}function _C(e){return e.map(r=>Yi(r)?o9(r):r)}function o9(e){return er(e,[fn])}function i9(e,r){return n9(e)?Pn(Rm(_C(e),r)):Rm(_C(e),r)}function Ki(e,r){return e.length===0?gt(r):e.length===1?H(e[0],r):i9(e,r)}p();function yt(e,r){return e.length===0?gt(r):e.length===1?H(e[0],r):Rm(e,r)}p();p();p();var eg=class extends Se{};function a9(e){return e.replace(/\\\$/g,"$").replace(/\\\*/g,"*").replace(/\\\^/g,"^").replace(/\\\|/g,"|").replace(/\\\(/g,"(").replace(/\\\)/g,")")}function Yb(e,r,t){return e[r]===t&&e.charCodeAt(r-1)!==92}function Xa(e,r){return Yb(e,r,"(")}function Nm(e,r){return Yb(e,r,")")}function LC(e,r){return Yb(e,r,"|")}function s9(e){if(!(Xa(e,0)&&Nm(e,e.length-1)))return!1;let r=0;for(let t=0;t<e.length;t++)if(Xa(e,t)&&(r+=1),Nm(e,t)&&(r-=1),r===0&&t!==e.length-1)return!1;return!0}function u9(e){return e.slice(1,e.length-1)}function l9(e){let r=0;for(let t=0;t<e.length;t++)if(Xa(e,t)&&(r+=1),Nm(e,t)&&(r-=1),LC(e,t)&&r===0)return!0;return!1}function c9(e){for(let r=0;r<e.length;r++)if(Xa(e,r))return!0;return!1}function p9(e){let[r,t]=[0,0],n=[];for(let i=0;i<e.length;i++)if(Xa(e,i)&&(r+=1),Nm(e,i)&&(r-=1),LC(e,i)&&r===0){let s=e.slice(t,i);s.length>0&&n.push(Nc(s)),t=i+1}let o=e.slice(t);return o.length>0&&n.push(Nc(o)),n.length===0?{type:"const",const:""}:n.length===1?n[0]:{type:"or",expr:n}}function d9(e){function r(o,i){if(!Xa(o,i))throw new eg("TemplateLiteralParser: Index must point to open parens");let s=0;for(let u=i;u<o.length;u++)if(Xa(o,u)&&(s+=1),Nm(o,u)&&(s-=1),s===0)return[i,u];throw new eg("TemplateLiteralParser: Unclosed group parens in expression")}function t(o,i){for(let s=i;s<o.length;s++)if(Xa(o,s))return[i,s];return[i,o.length]}let n=[];for(let o=0;o<e.length;o++)if(Xa(e,o)){let[i,s]=r(e,o),u=e.slice(i,s+1);n.push(Nc(u)),o=s}else{let[i,s]=t(e,o),u=e.slice(i,s);u.length>0&&n.push(Nc(u)),o=s-1}return n.length===0?{type:"const",const:""}:n.length===1?n[0]:{type:"and",expr:n}}function Nc(e){return s9(e)?Nc(u9(e)):l9(e)?p9(e):c9(e)?d9(e):{type:"const",const:a9(e)}}function $c(e){return Nc(e.slice(1,e.length-1))}var Kb=class extends Se{};function m9(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 f9(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 h9(e){return e.type==="const"&&e.const===".*"}function Yu(e){return m9(e)||h9(e)?!1:f9(e)?!0:e.type==="and"?e.expr.every(r=>Yu(r)):e.type==="or"?e.expr.every(r=>Yu(r)):e.type==="const"?!0:(()=>{throw new Kb("Unknown expression type")})()}function tg(e){let r=$c(e.pattern);return Yu(r)}p();var qb=class extends Se{};function*RC(e){if(e.length===1)return yield*e[0];for(let r of e[0])for(let t of RC(e.slice(1)))yield`${r}${t}`}function*g9(e){return yield*RC(e.expr.map(r=>[...$m(r)]))}function*y9(e){for(let r of e.expr)yield*$m(r)}function*b9(e){return yield e.const}function*$m(e){return e.type==="and"?yield*g9(e):e.type==="or"?yield*y9(e):e.type==="const"?yield*b9(e):(()=>{throw new qb("Unknown expression")})()}function jc(e){let r=$c(e.pattern);return Yu(r)?[...$m(r)]:[]}p();p();function lt(e,r){return H({[j]:"Literal",const:e,type:typeof e},r)}p();function rg(e){return H({[j]:"Boolean",type:"boolean"},e)}p();function Uc(e){return H({[j]:"BigInt",type:"bigint"},e)}p();function qi(e){return H({[j]:"Number",type:"number"},e)}p();function Co(e){return H({[j]:"String",type:"string"},e)}function*v9(e){let r=e.trim().replace(/"|'/g,"");return r==="boolean"?yield rg():r==="number"?yield qi():r==="bigint"?yield Uc():r==="string"?yield Co():yield(()=>{let t=r.split("|").map(n=>lt(n.trim()));return t.length===0?gt():t.length===1?t[0]:Ki(t)})()}function*x9(e){if(e[1]!=="{"){let r=lt("$"),t=Qb(e.slice(1));return yield*[r,...t]}for(let r=2;r<e.length;r++)if(e[r]==="}"){let t=v9(e.slice(2,r)),n=Qb(e.slice(r+1));return yield*[...t,...n]}yield lt(e)}function*Qb(e){for(let r=0;r<e.length;r++)if(e[r]==="$"){let t=lt(e.slice(0,r)),n=x9(e.slice(r));return yield*[t,...n]}yield lt(e)}function NC(e){return[...Qb(e)]}p();var ev=class extends Se{};function I9(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function $C(e,r){return Yn(e)?e.pattern.slice(1,e.pattern.length-1):st(e)?`(${e.anyOf.map(t=>$C(t,r)).join("|")})`:Xu(e)?`${r}${Lm}`:Wu(e)?`${r}${Lm}`:Nb(e)?`${r}${Lm}`:Pm(e)?`${r}${Jb}`:Ha(e)?`${r}${I9(e.const.toString())}`:$b(e)?`${r}${Xb}`:(()=>{throw new ev(`Unexpected Kind '${e[j]}'`)})()}function tv(e){return`^${e.map(r=>$C(r,"")).join("")}$`}p();function Ku(e){let t=jc(e).map(n=>lt(n));return Ki(t)}p();function ng(e,r){let t=Bt(e)?tv(NC(e)):tv(e);return H({[j]:"TemplateLiteral",type:"string",pattern:t},r)}function E9(e){return jc(e).map(t=>t.toString())}function C9(e){let r=[];for(let t of e)r.push(...kn(t));return r}function S9(e){return[e.toString()]}function kn(e){return[...new Set(Yn(e)?E9(e):st(e)?C9(e.anyOf):Ha(e)?S9(e.const):Xu(e)?["[number]"]:Wu(e)?["[number]"]:[])]}p();function D9(e,r,t){let n={};for(let o of Object.getOwnPropertyNames(r))n[o]=Gc(e,kn(r[o]),t);return n}function T9(e,r,t){return D9(e,r.properties,t)}function jC(e,r,t){let n=T9(e,r,t);return qe(n)}function GC(e,r){return e.map(t=>zC(t,r))}function w9(e){return e.filter(r=>!Ws(r))}function F9(e,r){return og(w9(GC(e,r)))}function M9(e){return e.some(r=>Ws(r))?[]:e}function A9(e,r){return Ki(M9(GC(e,r)))}function O9(e,r){return r in e?e[r]:r==="[number]"?Ki(e):gt()}function B9(e,r){return r==="[number]"?e:gt()}function P9(e,r){return r in e?e[r]:gt()}function zC(e,r){return ur(e)?F9(e.allOf,r):st(e)?A9(e.anyOf,r):ri(e)?O9(e.items??[],r):Va(e)?B9(e.items,r):br(e)?P9(e.properties,r):gt()}function jm(e,r){return r.map(t=>zC(e,t))}function UC(e,r){return Ki(jm(e,r))}function Gc(e,r,t){return Ut(r)?jC(e,r,t):Jn(r)?VC(e,r,t):H(ni(r)?UC(e,kn(r)):UC(e,r),t)}function k9(e,r,t){return{[r]:Gc(e,[r],$t(t))}}function _9(e,r,t){return r.reduce((n,o)=>({...n,...k9(e,o,t)}),{})}function L9(e,r,t){return _9(e,r.keys,t)}function VC(e,r,t){let n=L9(e,r,t);return qe(n)}p();function ig(e,r){return H({[j]:"Iterator",type:"Iterator",items:e},r)}p();function R9(e){let r=[];for(let t in e)Yi(e[t])||r.push(t);return r}function N9(e,r){let t=R9(e),n=t.length>0?{[j]:"Object",type:"object",properties:e,required:t}:{[j]:"Object",type:"object",properties:e};return H(n,r)}var Ct=N9;p();function ag(e,r){return H({[j]:"Promise",type:"Promise",item:e},r)}p();p();function $9(e){return H(er(e,[za]))}function j9(e){return H({...e,[za]:"Readonly"})}function U9(e,r){return r===!1?$9(e):j9(e)}function So(e,r){let t=r??!0;return Ut(e)?HC(e,t):U9(e,t)}function G9(e,r){let t={};for(let n of globalThis.Object.getOwnPropertyNames(e))t[n]=So(e[n],r);return t}function z9(e,r){return G9(e.properties,r)}function HC(e,r){let t=z9(e,r);return qe(t)}p();function Qi(e,r){return H(e.length>0?{[j]:"Tuple",type:"array",items:e,additionalItems:!1,minItems:e.length,maxItems:e.length}:{[j]:"Tuple",type:"array",minItems:e.length,maxItems:e.length},r)}function ZC(e,r){return e in r?Do(e,r[e]):qe(r)}function V9(e){return{[e]:lt(e)}}function H9(e){let r={};for(let t of e)r[t]=lt(t);return r}function Z9(e,r){return OC(r,e)?V9(e):H9(r)}function W9(e,r){let t=Z9(e,r);return ZC(e,t)}function Um(e,r){return r.map(t=>Do(e,t))}function X9(e,r){let t={};for(let n of globalThis.Object.getOwnPropertyNames(r))t[n]=Do(e,r[n]);return t}function Do(e,r){let t={...r};return Yi(r)?Pn(Do(e,er(r,[fn]))):HE(r)?So(Do(e,er(r,[za]))):Ut(r)?ZC(e,r.properties):Jn(r)?W9(e,r.keys):Am(r)?Qh(Um(e,r.parameters),Do(e,r.returns),t):Om(r)?Ys(Um(e,r.parameters),Do(e,r.returns),t):Mm(r)?qh(Do(e,r.items),t):Bm(r)?ig(Do(e,r.items),t):ur(r)?_n(Um(e,r.allOf),t):st(r)?yt(Um(e,r.anyOf),t):ri(r)?Qi(Um(e,r.items??[]),t):br(r)?Ct(X9(e,r.properties),t):Va(r)?Kh(Do(e,r.items),t):Ju(r)?ag(Do(e,r.item),t):r}function J9(e,r){let t={};for(let n of e)t[n]=Do(n,r);return t}function WC(e,r,t){let n=ni(e)?kn(e):e,o=r({[j]:"MappedKey",keys:n}),i=J9(n,o);return Ct(i,t)}p();function Y9(e){return H(er(e,[fn]))}function K9(e){return H({...e,[fn]:"Optional"})}function q9(e,r){return r===!1?Y9(e):K9(e)}function Pn(e,r){let t=r??!0;return Ut(e)?XC(e,t):q9(e,t)}function Q9(e,r){let t={};for(let n of globalThis.Object.getOwnPropertyNames(e))t[n]=Pn(e[n],r);return t}function eB(e,r){return Q9(e.properties,r)}function XC(e,r){let t=eB(e,r);return qe(t)}p();function Gm(e,r={}){let t=e.every(o=>br(o)),n=ni(r.unevaluatedProperties)?{unevaluatedProperties:r.unevaluatedProperties}:{};return H(r.unevaluatedProperties===!1||ni(r.unevaluatedProperties)||t?{...n,[j]:"Intersect",type:"object",allOf:e}:{...n,[j]:"Intersect",allOf:e},r)}function tB(e){return e.every(r=>Yi(r))}function rB(e){return er(e,[fn])}function JC(e){return e.map(r=>Yi(r)?rB(r):r)}function nB(e,r){return tB(e)?Pn(Gm(JC(e),r)):Gm(JC(e),r)}function og(e,r={}){if(e.length===0)return gt(r);if(e.length===1)return H(e[0],r);if(e.some(t=>kc(t)))throw new Error("Cannot intersect transform types");return nB(e,r)}p();function _n(e,r){if(e.length===0)return gt(r);if(e.length===1)return H(e[0],r);if(e.some(t=>kc(t)))throw new Error("Cannot intersect transform types");return Gm(e,r)}function YC(e){return e.map(r=>rv(r))}function oB(e){return _n(YC(e))}function iB(e){return yt(YC(e))}function aB(e){return rv(e)}function rv(e){return ur(e)?oB(e.allOf):st(e)?iB(e.anyOf):Ju(e)?aB(e.item):e}function KC(e,r){return H(rv(e),r)}p();p();p();p();function qC(e){let r=[];for(let t of e)r.push(Or(t));return r}function sB(e){let r=qC(e);return kC(r)}function uB(e){let r=qC(e);return PC(r)}function lB(e){return e.map((r,t)=>t.toString())}function cB(e){return["[number]"]}function pB(e){return globalThis.Object.getOwnPropertyNames(e)}function dB(e){return nv?globalThis.Object.getOwnPropertyNames(e).map(t=>t[0]==="^"&&t[t.length-1]==="$"?t.slice(1,t.length-1):t):[]}function Or(e){return ur(e)?sB(e.allOf):st(e)?uB(e.anyOf):ri(e)?lB(e.items??[]):Va(e)?cB(e.items):br(e)?pB(e.properties):jb(e)?dB(e.patternProperties):[]}var nv=!1;function Ja(e){nv=!0;let r=Or(e);return nv=!1,`^(${r.map(n=>`(${n})`).join("|")})$`}function mB(e){return e.map(r=>r==="[number]"?qi():lt(r))}function sg(e,r){if(Ut(e))return QC(e,r);{let t=Or(e),n=mB(t),o=Ki(n);return H(o,r)}}function fB(e,r){let t={};for(let n of globalThis.Object.getOwnPropertyNames(e))t[n]=sg(e[n],$t(r));return t}function hB(e,r){return fB(e.properties,r)}function QC(e,r){let t=hB(e,r);return qe(t)}p();function Ks(e){let r=Or(e),t=jm(e,r);return r.map((n,o)=>[r[o],t[o]])}function gB(e){let r=[];for(let t of e)r.push(...Or(t));return BC(r)}function yB(e){return e.filter(r=>!Ws(r))}function bB(e,r){let t=[];for(let n of e)t.push(...jm(n,[r]));return yB(t)}function vB(e,r){let t={};for(let n of r)t[n]=og(bB(e,n));return t}function eS(e,r){let t=gB(e),n=vB(e,t);return Ct(n,r)}p();p();function ug(e){return H({[j]:"Date",type:"Date"},e)}p();function lg(e){return H({[j]:"Null",type:"null"},e)}p();function cg(e){return H({[j]:"Symbol",type:"symbol"},e)}p();function pg(e){return H({[j]:"Undefined",type:"undefined"},e)}p();function dg(e){return H({[j]:"Uint8Array",type:"Uint8Array"},e)}p();function Ya(e){return H({[j]:"Unknown"},e)}function xB(e){return e.map(r=>ov(r,!1))}function IB(e){let r={};for(let t of globalThis.Object.getOwnPropertyNames(e))r[t]=So(ov(e[t],!1));return r}function mg(e,r){return r===!0?e:So(e)}function ov(e,r){return Ob(e)?mg(Js(),r):Pb(e)?mg(Js(),r):rn(e)?So(Qi(xB(e))):ja(e)?dg():Zu(e)?ug():Et(e)?mg(Ct(IB(e)),r):Bb(e)?mg(Ys([],Ya()),r):Zt(e)?pg():kb(e)?lg():_b(e)?cg():Dm(e)?Uc():ti(e)?lt(e):Hs(e)?lt(e):Bt(e)?lt(e):Ct({})}function tS(e,r){return H(ov(e,!0),r)}p();function rS(e,r){return Qi(e.parameters,r)}p();function zm(e,r){return e.map(t=>oi(t,r))}function EB(e,r){let t={};for(let n of globalThis.Object.getOwnPropertyNames(e))t[n]=oi(e[n],r);return t}function CB(e,r){return e.parameters=zm(e.parameters,r),e.returns=oi(e.returns,r),e}function SB(e,r){return e.parameters=zm(e.parameters,r),e.returns=oi(e.returns,r),e}function DB(e,r){return e.allOf=zm(e.allOf,r),e}function TB(e,r){return e.anyOf=zm(e.anyOf,r),e}function wB(e,r){return Zt(e.items)||(e.items=zm(e.items,r)),e}function FB(e,r){return e.items=oi(e.items,r),e}function MB(e,r){return e.properties=EB(e.properties,r),e}function AB(e,r){return e.item=oi(e.item,r),e}function OB(e,r){return e.items=oi(e.items,r),e}function BB(e,r){return e.items=oi(e.items,r),e}function PB(e,r){let t=r.find(o=>o.$id===e.$ref);if(t===void 0)throw Error(`Unable to dereference schema with $id ${e.$ref}`);let n=er(t,["$id"]);return oi(n,r)}function kB(e,r){return Am(e)?CB(e,r):Om(e)?SB(e,r):ur(e)?DB(e,r):st(e)?TB(e,r):ri(e)?wB(e,r):Va(e)?FB(e,r):br(e)?MB(e,r):Ju(e)?AB(e,r):Mm(e)?OB(e,r):Bm(e)?BB(e,r):Ub(e)?PB(e,r):e}function oi(e,r){return kB(wm(e),GE(r))}p();function nS(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]),o=[...new Set(t)].map(i=>lt(i));return yt(o,{...r,[Eo]:"Enum"})}p();p();p();var av=class extends Se{},G;(function(e){e[e.Union=0]="Union",e[e.True=1]="True",e[e.False=2]="False"})(G||(G={}));function To(e){return e===G.False?e:G.True}function zc(e){throw new av(e)}function mr(e){return M.IsNever(e)||M.IsIntersect(e)||M.IsUnion(e)||M.IsUnknown(e)||M.IsAny(e)}function fr(e,r){return M.IsNever(r)?cS(e,r):M.IsIntersect(r)?fg(e,r):M.IsUnion(r)?cv(e,r):M.IsUnknown(r)?fS(e,r):M.IsAny(r)?lv(e,r):zc("StructuralRight")}function lv(e,r){return G.True}function _B(e,r){return M.IsIntersect(r)?fg(e,r):M.IsUnion(r)&&r.anyOf.some(t=>M.IsAny(t)||M.IsUnknown(t))?G.True:M.IsUnion(r)?G.Union:M.IsUnknown(r)||M.IsAny(r)?G.True:G.Union}function LB(e,r){return M.IsUnknown(e)?G.False:M.IsAny(e)?G.Union:M.IsNever(e)?G.True:G.False}function RB(e,r){return M.IsObject(r)&&hg(r)?G.True:mr(r)?fr(e,r):M.IsArray(r)?To(bt(e.items,r.items)):G.False}function NB(e,r){return mr(r)?fr(e,r):M.IsAsyncIterator(r)?To(bt(e.items,r.items)):G.False}function $B(e,r){return mr(r)?fr(e,r):M.IsObject(r)?nn(e,r):M.IsRecord(r)?wo(e,r):M.IsBigInt(r)?G.True:G.False}function uS(e,r){return M.IsLiteralBoolean(e)||M.IsBoolean(e)?G.True:G.False}function jB(e,r){return mr(r)?fr(e,r):M.IsObject(r)?nn(e,r):M.IsRecord(r)?wo(e,r):M.IsBoolean(r)?G.True:G.False}function UB(e,r){return mr(r)?fr(e,r):M.IsObject(r)?nn(e,r):M.IsConstructor(r)?e.parameters.length>r.parameters.length?G.False:e.parameters.every((t,n)=>To(bt(r.parameters[n],t))===G.True)?To(bt(e.returns,r.returns)):G.False:G.False}function GB(e,r){return mr(r)?fr(e,r):M.IsObject(r)?nn(e,r):M.IsRecord(r)?wo(e,r):M.IsDate(r)?G.True:G.False}function zB(e,r){return mr(r)?fr(e,r):M.IsObject(r)?nn(e,r):M.IsFunction(r)?e.parameters.length>r.parameters.length?G.False:e.parameters.every((t,n)=>To(bt(r.parameters[n],t))===G.True)?To(bt(e.returns,r.returns)):G.False:G.False}function lS(e,r){return M.IsLiteral(e)&&Ye.IsNumber(e.const)||M.IsNumber(e)||M.IsInteger(e)?G.True:G.False}function VB(e,r){return M.IsInteger(r)||M.IsNumber(r)?G.True:mr(r)?fr(e,r):M.IsObject(r)?nn(e,r):M.IsRecord(r)?wo(e,r):G.False}function fg(e,r){return r.allOf.every(t=>bt(e,t)===G.True)?G.True:G.False}function HB(e,r){return e.allOf.some(t=>bt(t,r)===G.True)?G.True:G.False}function ZB(e,r){return mr(r)?fr(e,r):M.IsIterator(r)?To(bt(e.items,r.items)):G.False}function WB(e,r){return M.IsLiteral(r)&&r.const===e.const?G.True:mr(r)?fr(e,r):M.IsObject(r)?nn(e,r):M.IsRecord(r)?wo(e,r):M.IsString(r)?mS(e,r):M.IsNumber(r)?pS(e,r):M.IsInteger(r)?lS(e,r):M.IsBoolean(r)?uS(e,r):G.False}function cS(e,r){return G.False}function XB(e,r){return G.True}function oS(e){let[r,t]=[e,0];for(;M.IsNot(r);)r=r.not,t+=1;return t%2===0?r:Ya()}function JB(e,r){return M.IsNot(e)?bt(oS(e),r):M.IsNot(r)?bt(e,oS(r)):zc("Invalid fallthrough for Not")}function YB(e,r){return mr(r)?fr(e,r):M.IsObject(r)?nn(e,r):M.IsRecord(r)?wo(e,r):M.IsNull(r)?G.True:G.False}function pS(e,r){return M.IsLiteralNumber(e)||M.IsNumber(e)||M.IsInteger(e)?G.True:G.False}function KB(e,r){return mr(r)?fr(e,r):M.IsObject(r)?nn(e,r):M.IsRecord(r)?wo(e,r):M.IsInteger(r)||M.IsNumber(r)?G.True:G.False}function Ln(e,r){return Object.getOwnPropertyNames(e.properties).length===r}function iS(e){return hg(e)}function aS(e){return Ln(e,0)||Ln(e,1)&&"description"in e.properties&&M.IsUnion(e.properties.description)&&e.properties.description.anyOf.length===2&&(M.IsString(e.properties.description.anyOf[0])&&M.IsUndefined(e.properties.description.anyOf[1])||M.IsString(e.properties.description.anyOf[1])&&M.IsUndefined(e.properties.description.anyOf[0]))}function iv(e){return Ln(e,0)}function sS(e){return Ln(e,0)}function qB(e){return Ln(e,0)}function QB(e){return Ln(e,0)}function eP(e){return hg(e)}function tP(e){let r=qi();return Ln(e,0)||Ln(e,1)&&"length"in e.properties&&To(bt(e.properties.length,r))===G.True}function rP(e){return Ln(e,0)}function hg(e){let r=qi();return Ln(e,0)||Ln(e,1)&&"length"in e.properties&&To(bt(e.properties.length,r))===G.True}function nP(e){let r=Ys([Js()],Js());return Ln(e,0)||Ln(e,1)&&"then"in e.properties&&To(bt(e.properties.then,r))===G.True}function dS(e,r){return bt(e,r)===G.False||M.IsOptional(e)&&!M.IsOptional(r)?G.False:G.True}function nn(e,r){return M.IsUnknown(e)?G.False:M.IsAny(e)?G.Union:M.IsNever(e)||M.IsLiteralString(e)&&iS(r)||M.IsLiteralNumber(e)&&iv(r)||M.IsLiteralBoolean(e)&&sS(r)||M.IsSymbol(e)&&aS(r)||M.IsBigInt(e)&&qB(r)||M.IsString(e)&&iS(r)||M.IsSymbol(e)&&aS(r)||M.IsNumber(e)&&iv(r)||M.IsInteger(e)&&iv(r)||M.IsBoolean(e)&&sS(r)||M.IsUint8Array(e)&&eP(r)||M.IsDate(e)&&QB(r)||M.IsConstructor(e)&&rP(r)||M.IsFunction(e)&&tP(r)?G.True:M.IsRecord(e)&&M.IsString(sv(e))?r[Eo]==="Record"?G.True:G.False:M.IsRecord(e)&&M.IsNumber(sv(e))?Ln(r,0)?G.True:G.False:G.False}function oP(e,r){return mr(r)?fr(e,r):M.IsRecord(r)?wo(e,r):M.IsObject(r)?(()=>{for(let t of Object.getOwnPropertyNames(r.properties)){if(!(t in e.properties)&&!M.IsOptional(r.properties[t]))return G.False;if(M.IsOptional(r.properties[t]))return G.True;if(dS(e.properties[t],r.properties[t])===G.False)return G.False}return G.True})():G.False}function iP(e,r){return mr(r)?fr(e,r):M.IsObject(r)&&nP(r)?G.True:M.IsPromise(r)?To(bt(e.item,r.item)):G.False}function sv(e){return Za in e.patternProperties?qi():Wa in e.patternProperties?Co():zc("Unknown record key pattern")}function uv(e){return Za in e.patternProperties?e.patternProperties[Za]:Wa in e.patternProperties?e.patternProperties[Wa]:zc("Unable to get record value schema")}function wo(e,r){let[t,n]=[sv(r),uv(r)];return M.IsLiteralString(e)&&M.IsNumber(t)&&To(bt(e,n))===G.True?G.True:M.IsUint8Array(e)&&M.IsNumber(t)||M.IsString(e)&&M.IsNumber(t)||M.IsArray(e)&&M.IsNumber(t)?bt(e,n):M.IsObject(e)?(()=>{for(let o of Object.getOwnPropertyNames(e.properties))if(dS(n,e.properties[o])===G.False)return G.False;return G.True})():G.False}function aP(e,r){return mr(r)?fr(e,r):M.IsObject(r)?nn(e,r):M.IsRecord(r)?bt(uv(e),uv(r)):G.False}function sP(e,r){let t=M.IsRegExp(e)?Co():e,n=M.IsRegExp(r)?Co():r;return bt(t,n)}function mS(e,r){return M.IsLiteral(e)&&Ye.IsString(e.const)||M.IsString(e)?G.True:G.False}function uP(e,r){return mr(r)?fr(e,r):M.IsObject(r)?nn(e,r):M.IsRecord(r)?wo(e,r):M.IsString(r)?G.True:G.False}function lP(e,r){return mr(r)?fr(e,r):M.IsObject(r)?nn(e,r):M.IsRecord(r)?wo(e,r):M.IsSymbol(r)?G.True:G.False}function cP(e,r){return M.IsTemplateLiteral(e)?bt(Ku(e),r):M.IsTemplateLiteral(r)?bt(e,Ku(r)):zc("Invalid fallthrough for TemplateLiteral")}function pP(e,r){return M.IsArray(r)&&e.items!==void 0&&e.items.every(t=>bt(t,r.items)===G.True)}function dP(e,r){return M.IsNever(e)?G.True:M.IsUnknown(e)?G.False:M.IsAny(e)?G.Union:G.False}function mP(e,r){return mr(r)?fr(e,r):M.IsObject(r)&&hg(r)||M.IsArray(r)&&pP(e,r)?G.True:M.IsTuple(r)?Ye.IsUndefined(e.items)&&!Ye.IsUndefined(r.items)||!Ye.IsUndefined(e.items)&&Ye.IsUndefined(r.items)?G.False:Ye.IsUndefined(e.items)&&!Ye.IsUndefined(r.items)||e.items.every((t,n)=>bt(t,r.items[n])===G.True)?G.True:G.False:G.False}function fP(e,r){return mr(r)?fr(e,r):M.IsObject(r)?nn(e,r):M.IsRecord(r)?wo(e,r):M.IsUint8Array(r)?G.True:G.False}function hP(e,r){return mr(r)?fr(e,r):M.IsObject(r)?nn(e,r):M.IsRecord(r)?wo(e,r):M.IsVoid(r)?bP(e,r):M.IsUndefined(r)?G.True:G.False}function cv(e,r){return r.anyOf.some(t=>bt(e,t)===G.True)?G.True:G.False}function gP(e,r){return e.anyOf.every(t=>bt(t,r)===G.True)?G.True:G.False}function fS(e,r){return G.True}function yP(e,r){return M.IsNever(r)?cS(e,r):M.IsIntersect(r)?fg(e,r):M.IsUnion(r)?cv(e,r):M.IsAny(r)?lv(e,r):M.IsString(r)?mS(e,r):M.IsNumber(r)?pS(e,r):M.IsInteger(r)?lS(e,r):M.IsBoolean(r)?uS(e,r):M.IsArray(r)?LB(e,r):M.IsTuple(r)?dP(e,r):M.IsObject(r)?nn(e,r):M.IsUnknown(r)?G.True:G.False}function bP(e,r){return M.IsUndefined(e)||M.IsUndefined(e)?G.True:G.False}function vP(e,r){return M.IsIntersect(r)?fg(e,r):M.IsUnion(r)?cv(e,r):M.IsUnknown(r)?fS(e,r):M.IsAny(r)?lv(e,r):M.IsObject(r)?nn(e,r):M.IsVoid(r)?G.True:G.False}function bt(e,r){return M.IsTemplateLiteral(e)||M.IsTemplateLiteral(r)?cP(e,r):M.IsRegExp(e)||M.IsRegExp(r)?sP(e,r):M.IsNot(e)||M.IsNot(r)?JB(e,r):M.IsAny(e)?_B(e,r):M.IsArray(e)?RB(e,r):M.IsBigInt(e)?$B(e,r):M.IsBoolean(e)?jB(e,r):M.IsAsyncIterator(e)?NB(e,r):M.IsConstructor(e)?UB(e,r):M.IsDate(e)?GB(e,r):M.IsFunction(e)?zB(e,r):M.IsInteger(e)?VB(e,r):M.IsIntersect(e)?HB(e,r):M.IsIterator(e)?ZB(e,r):M.IsLiteral(e)?WB(e,r):M.IsNever(e)?XB(e,r):M.IsNull(e)?YB(e,r):M.IsNumber(e)?KB(e,r):M.IsObject(e)?oP(e,r):M.IsRecord(e)?aP(e,r):M.IsString(e)?uP(e,r):M.IsSymbol(e)?lP(e,r):M.IsTuple(e)?mP(e,r):M.IsPromise(e)?iP(e,r):M.IsUint8Array(e)?fP(e,r):M.IsUndefined(e)?hP(e,r):M.IsUnion(e)?gP(e,r):M.IsUnknown(e)?yP(e,r):M.IsVoid(e)?vP(e,r):zc(`Unknown left type operand '${e[j]}'`)}function qs(e,r){return bt(e,r)}p();p();p();function xP(e,r,t,n,o){let i={};for(let s of globalThis.Object.getOwnPropertyNames(e))i[s]=Vc(e[s],r,t,n,$t(o));return i}function IP(e,r,t,n,o){return xP(e.properties,r,t,n,o)}function hS(e,r,t,n,o){let i=IP(e,r,t,n,o);return qe(i)}function EP(e,r,t,n){let o=qs(e,r);return o===G.Union?yt([t,n]):o===G.True?t:n}function Vc(e,r,t,n,o){return Ut(e)?hS(e,r,t,n,o):Jn(e)?H(gS(e,r,t,n,o)):H(EP(e,r,t,n),o)}function CP(e,r,t,n,o){return{[e]:Vc(lt(e),r,t,n,$t(o))}}function SP(e,r,t,n,o){return e.reduce((i,s)=>({...i,...CP(s,r,t,n,o)}),{})}function DP(e,r,t,n,o){return SP(e.keys,r,t,n,o)}function gS(e,r,t,n,o){let i=DP(e,r,t,n,o);return qe(i)}p();function TP(e){return e.allOf.every(r=>Ka(r))}function wP(e){return e.anyOf.some(r=>Ka(r))}function FP(e){return!Ka(e.not)}function Ka(e){return e[j]==="Intersect"?TP(e):e[j]==="Union"?wP(e):e[j]==="Not"?FP(e):e[j]==="Undefined"}p();function yS(e,r){return Hc(Ku(e),r)}function MP(e,r){let t=e.filter(n=>qs(n,r)===G.False);return t.length===1?t[0]:yt(t)}function Hc(e,r,t={}){return Yn(e)?H(yS(e,r),t):Ut(e)?H(bS(e,r),t):H(st(e)?MP(e.anyOf,r):qs(e,r)!==G.False?gt():e,t)}function AP(e,r){let t={};for(let n of globalThis.Object.getOwnPropertyNames(e))t[n]=Hc(e[n],r);return t}function OP(e,r){return AP(e.properties,r)}function bS(e,r){let t=OP(e,r);return qe(t)}p();p();p();function vS(e,r){return Zc(Ku(e),r)}function BP(e,r){let t=e.filter(n=>qs(n,r)!==G.False);return t.length===1?t[0]:yt(t)}function Zc(e,r,t){return Yn(e)?H(vS(e,r),t):Ut(e)?H(xS(e,r),t):H(st(e)?BP(e.anyOf,r):qs(e,r)!==G.False?e:gt(),t)}function PP(e,r){let t={};for(let n of globalThis.Object.getOwnPropertyNames(e))t[n]=Zc(e[n],r);return t}function kP(e,r){return PP(e.properties,r)}function xS(e,r){let t=kP(e,r);return qe(t)}p();function IS(e,r){return H(e.returns,r)}p();function ES(e){return H({[j]:"Integer",type:"integer"},e)}p();p();p();function _P(e,r,t){return{[e]:ii(lt(e),r,$t(t))}}function LP(e,r,t){return e.reduce((o,i)=>({...o,..._P(i,r,t)}),{})}function RP(e,r,t){return LP(e.keys,r,t)}function CS(e,r,t){let n=RP(e,r,t);return qe(n)}function NP(e){let[r,t]=[e.slice(0,1),e.slice(1)];return[r.toLowerCase(),t].join("")}function $P(e){let[r,t]=[e.slice(0,1),e.slice(1)];return[r.toUpperCase(),t].join("")}function jP(e){return e.toUpperCase()}function UP(e){return e.toLowerCase()}function GP(e,r,t){let n=$c(e.pattern);if(!Yu(n))return{...e,pattern:SS(e.pattern,r)};let s=[...$m(n)].map(c=>lt(c)),u=DS(s,r),l=yt(u);return ng([l],t)}function SS(e,r){return typeof e=="string"?r==="Uncapitalize"?NP(e):r==="Capitalize"?$P(e):r==="Uppercase"?jP(e):r==="Lowercase"?UP(e):e:e.toString()}function DS(e,r){return e.map(t=>ii(t,r))}function ii(e,r,t={}){return Jn(e)?CS(e,r,t):Yn(e)?GP(e,r,t):st(e)?yt(DS(e.anyOf,r),t):Ha(e)?lt(SS(e.const,r),t):H(e,t)}function TS(e,r={}){return ii(e,"Capitalize",r)}p();function wS(e,r={}){return ii(e,"Lowercase",r)}p();function FS(e,r={}){return ii(e,"Uncapitalize",r)}p();function MS(e,r={}){return ii(e,"Uppercase",r)}p();function AS(e,r){return H({[j]:"Not",not:e},r)}p();p();p();function zP(e,r,t){let n={};for(let o of globalThis.Object.getOwnPropertyNames(e))n[o]=Wc(e[o],r,$t(t));return n}function VP(e,r,t){return zP(e.properties,r,t)}function OS(e,r,t){let n=VP(e,r,t);return qe(n)}function HP(e,r){return e.map(t=>pv(t,r))}function ZP(e,r){return e.map(t=>pv(t,r))}function WP(e,r){let{[r]:t,...n}=e;return n}function XP(e,r){return r.reduce((t,n)=>WP(t,n),e)}function JP(e,r){let t=er(e,[jt,"$id","required","properties"]),n=XP(e.properties,r);return Ct(n,t)}function pv(e,r){return ur(e)?_n(HP(e.allOf,r)):st(e)?yt(ZP(e.anyOf,r)):br(e)?JP(e,r):Ct({})}function Wc(e,r,t){if(Jn(r))return BS(e,r,t);if(Ut(e))return OS(e,r,t);let n=ni(r)?kn(r):r;return H({...pv(e,n),...t})}function YP(e,r,t){return{[r]:Wc(e,[r],$t(t))}}function KP(e,r,t){return r.reduce((n,o)=>({...n,...YP(e,o,t)}),{})}function qP(e,r,t){return KP(e,r.keys,t)}function BS(e,r,t){let n=qP(e,r,t);return qe(n)}p();function PS(e,r){return Qi(e.parameters,r)}p();p();function kS(e){return e.map(r=>_S(r))}function QP(e){let r={};for(let t of globalThis.Object.getOwnPropertyNames(e))r[t]=Pn(e[t]);return r}function ek(e){let r=er(e,[jt,"$id","required","properties"]),t=QP(e.properties);return Ct(t,r)}function _S(e){return ur(e)?_n(kS(e.allOf)):st(e)?yt(kS(e.anyOf)):br(e)?ek(e):Ct({})}function gg(e,r){return Ut(e)?LS(e,r):H({..._S(e),...r})}function tk(e,r){let t={};for(let n of globalThis.Object.getOwnPropertyNames(e))t[n]=gg(e[n],$t(r));return t}function rk(e,r){return tk(e.properties,r)}function LS(e,r){let t=rk(e,r);return qe(t)}p();p();p();function nk(e,r,t){let n={};for(let o of globalThis.Object.getOwnPropertyNames(e))n[o]=Xc(e[o],r,$t(t));return n}function ok(e,r,t){return nk(e.properties,r,t)}function RS(e,r,t){let n=ok(e,r,t);return qe(n)}function ik(e,r){return e.map(t=>dv(t,r))}function ak(e,r){return e.map(t=>dv(t,r))}function sk(e,r){let t={};for(let n of r)n in e&&(t[n]=e[n]);return t}function uk(e,r){let t=er(e,[jt,"$id","required","properties"]),n=sk(e.properties,r);return Ct(n,t)}function dv(e,r){return ur(e)?_n(ik(e.allOf,r)):st(e)?yt(ak(e.anyOf,r)):br(e)?uk(e,r):Ct({})}function Xc(e,r,t){if(Jn(r))return NS(e,r,t);if(Ut(e))return RS(e,r,t);let n=ni(r)?kn(r):r;return H({...dv(e,n),...t})}function lk(e,r,t){return{[r]:Xc(e,[r],$t(t))}}function ck(e,r,t){return r.reduce((n,o)=>({...n,...lk(e,o,t)}),{})}function pk(e,r,t){return ck(e,r.keys,t)}function NS(e,r,t){let n=pk(e,r,t);return qe(n)}p();function $S(e){return So(Pn(e))}p();function qu(e,r,t){return H({[j]:"Record",type:"object",patternProperties:{[e]:r}},t)}function mv(e,r,t){let n={};for(let o of e)n[o]=r;return Ct(n,{...t,[Eo]:"Record"})}function dk(e,r,t){return tg(e)?mv(kn(e),r,t):qu(e.pattern,r,t)}function mk(e,r,t){return mv(kn(yt(e)),r,t)}function fk(e,r,t){return mv([e.toString()],r,t)}function hk(e,r,t){return qu(e.source,r,t)}function gk(e,r,t){let n=Zt(e.pattern)?Wa:e.pattern;return qu(n,r,t)}function yk(e,r,t){return qu(Wa,r,t)}function bk(e,r,t){return qu(AC,r,t)}function vk(e,r,t){return qu(Za,r,t)}function xk(e,r,t){return qu(Za,r,t)}function jS(e,r,t={}){return st(e)?mk(e.anyOf,r,t):Yn(e)?dk(e,r,t):Ha(e)?fk(e.const,r,t):Wu(e)?vk(e,r,t):Xu(e)?xk(e,r,t):Gb(e)?hk(e,r,t):Pm(e)?gk(e,r,t):Rb(e)?yk(e,r,t):Ws(e)?bk(e,r,t):gt(t)}p();var Ik=0;function US(e,r={}){Zt(r.$id)&&(r.$id=`T${Ik++}`);let t=wm(e({[j]:"This",$ref:`${r.$id}`}));return t.$id=r.$id,H({[Eo]:"Recursive",...t},r)}p();function GS(e,r){if(Bt(e))return H({[j]:"Ref",$ref:e},r);if(Zt(e.$id))throw new Error("Reference target type must specify an $id");return H({[j]:"Ref",$ref:e.$id},r)}p();function zS(e,r){let t=Bt(e)?new globalThis.RegExp(e):e;return H({[j]:"RegExp",type:"RegExp",source:t.source,flags:t.flags},r)}p();p();function VS(e){return e.map(r=>HS(r))}function Ek(e){let r={};for(let t of globalThis.Object.getOwnPropertyNames(e))r[t]=er(e[t],[fn]);return r}function Ck(e){let r=er(e,[jt,"$id","required","properties"]),t=Ek(e.properties);return Ct(t,r)}function HS(e){return ur(e)?_n(VS(e.allOf)):st(e)?yt(VS(e.anyOf)):br(e)?Ck(e):Ct({})}function yg(e,r){return Ut(e)?ZS(e,r):H({...HS(e),...r})}function Sk(e,r){let t={};for(let n of globalThis.Object.getOwnPropertyNames(e))t[n]=yg(e[n],r);return t}function Dk(e,r){return Sk(e.properties,r)}function ZS(e,r){let t=Dk(e,r);return qe(t)}p();function Tk(e){return ur(e)?e.allOf:st(e)?e.anyOf:ri(e)?e.items??[]:[]}function WS(e){return Tk(e)}p();function XS(e,r){return H(e.returns,r)}p();function JS(e){return JSON.parse(JSON.stringify(e))}p();var fv=class{constructor(r){this.schema=r}Decode(r){return new hv(this.schema,r)}},hv=class{constructor(r,t){this.schema=r,this.decode=t}EncodeTransform(r,t){let i={Encode:s=>t[jt].Encode(r(s)),Decode:s=>this.decode(t[jt].Decode(s))};return{...t,[jt]:i}}EncodeSchema(r,t){let n={Decode:this.decode,Encode:r};return{...t,[jt]:n}}Encode(r){return kc(this.schema)?this.EncodeTransform(r,this.schema):this.EncodeSchema(r,this.schema)}};function YS(e){return new fv(e)}p();function bg(e={}){return H({[j]:e[j]??"Unsafe"},e)}p();function KS(e){return H({[j]:"Void",type:"void"},e)}p();var gv={};$s(gv,{Any:()=>Js,Array:()=>Kh,AsyncIterator:()=>qh,Awaited:()=>KC,BigInt:()=>Uc,Boolean:()=>rg,Capitalize:()=>TS,Composite:()=>eS,Const:()=>tS,Constructor:()=>Qh,ConstructorParameters:()=>rS,Date:()=>ug,Deref:()=>oi,Enum:()=>nS,Exclude:()=>Hc,Extends:()=>Vc,Extract:()=>Zc,Function:()=>Ys,Index:()=>Gc,InstanceType:()=>IS,Integer:()=>ES,Intersect:()=>_n,Iterator:()=>ig,KeyOf:()=>sg,Literal:()=>lt,Lowercase:()=>wS,Mapped:()=>WC,Never:()=>gt,Not:()=>AS,Null:()=>lg,Number:()=>qi,Object:()=>Ct,Omit:()=>Wc,Optional:()=>Pn,Parameters:()=>PS,Partial:()=>gg,Pick:()=>Xc,Promise:()=>ag,Readonly:()=>So,ReadonlyOptional:()=>$S,Record:()=>jS,Recursive:()=>US,Ref:()=>GS,RegExp:()=>zS,Required:()=>yg,Rest:()=>WS,ReturnType:()=>XS,Strict:()=>JS,String:()=>Co,Symbol:()=>cg,TemplateLiteral:()=>ng,Transform:()=>YS,Tuple:()=>Qi,Uint8Array:()=>dg,Uncapitalize:()=>FS,Undefined:()=>pg,Union:()=>yt,Unknown:()=>Ya,Unsafe:()=>bg,Uppercase:()=>MS,Void:()=>KS});p();var g=gv;p();var Vm=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."}),yv=g.Partial(Vm,{$id:"Details",description:"Additional information about a given entity."}),Kn=g.Object({details:g.Optional(g.Ref(yv))},{$id:"WithDetails"}),Qu=e=>{let r=[...e].sort(),t=g.Pick(Vm,e),n=g.Omit(Vm,e);return g.Object({details:g.Intersect([t,g.Partial(n)])},{$id:`WithRequiredDetails_${r.join("_")}`})},bv=[Vm,yv];p();var Jc=g.Number({$id:"Longitude",minimum:-180,maximum:180,description:"A WGS 84-compatible longitude coordinate value."}),Yc=g.Number({$id:"Latitude",minimum:-90,maximum:90,description:"A WGS 84-compatible latitude coordinate value."}),el=g.Tuple([g.Ref(Jc),g.Ref(Yc)],{$id:"Position",minItems:2,maxItems:2,description:"A valid WGS 84 position consisting of a longitude value, followed by a latitude value."}),on=g.Object({type:g.Literal("Point"),coordinates:g.Ref(el)},{$id:"Point",description:"An RFC-7946 compatible GeoJSON Point geometry."}),vg=g.Object({type:g.Literal("MultiPoint"),coordinates:g.Array(g.Ref(el))},{$id:"MultiPoint",description:"An RFC-7946 compatible GeoJSON MultiPoint geometry."}),xg=g.Object({type:g.Literal("LineString"),coordinates:g.Array(g.Ref(el),{minItems:2,description:"At least two positions are required."})},{$id:"LineString",description:"An RFC-7946 compatible GeoJSON LineString geometry."}),Ig=g.Object({type:g.Literal("MultiLineString"),coordinates:g.Array(g.Array(g.Ref(el),{minItems:2}))},{$id:"MultiLineString",description:"An RFC-7946 compatible GeoJSON MultiLineString geometry."}),qS=g.Array(g.Ref(el),{$id:"LinearRing",minItems:4,description:"A linear ring is a building block of a polygon or multi-polygon."}),vv=g.Array(g.Ref(qS),{$id:"LinearRings",minItems:1,description:"A collection of linear rings, at least one of which is the exterior ring of a polygon."}),Kc=g.Object({type:g.Literal("Polygon"),coordinates:g.Ref(vv)},{$id:"Polygon",description:"An RFC-7946 compatible GeoJSON Polygon geometry."}),qc=g.Object({type:g.Literal("MultiPolygon"),coordinates:g.Array(g.Ref(vv))},{$id:"MultiPolygon",description:"An RFC-7946 compatible GeoJSON MultiPolygon geometry."}),Vr=(e,r,t)=>g.Object({type:g.Literal("Feature"),geometry:e,properties:r},t),hn=(e,r,t)=>g.Object({type:g.Literal("FeatureCollection"),features:g.Array(e,t)},r),xv=[Jc,Yc,el,on,vg,xg,Ig,qS,vv,Kc,qc];p();var tr=(e,r)=>g.Unsafe(g.String({$id:r,pattern:`^${e}_[A-Za-z0-9-]+$`})),an=tr("g","GeometryId"),ze=tr("f","FloorId"),Iv=[an,ze];p();p();p();var Eg=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}}},Cg=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 QS(r(this.value))}mapAsync(r){return r(this.value).then(t=>QS(t))}mapOr(r,t){return this.map(r).unwrapOr(t)}mapOrAsync(r,t){return this.mapAsync(r).then(n=>n.unwrapOr(t))}mapOrElse(r,t){return this.map(r).unwrapOrElse(t)}mapOrElseAsync(r,t){return this.mapAsync(r).then(n=>n.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:Qs()}or(r){return this}orElse(r){return this}xor(r){return r.isSome()?Qs():this}toString(){return`Some(${this.value})`}okOr(r){return te(this.value)}okOrElse(r){return te(this.value)}iter(){return new Eg(this.value)}[Symbol.iterator](){return this.iter()}zip(r){return r.isSome()?Qc([this.value,r.value]):Qs()}zipWith(r,t){return r.isSome()?Qc(t(this.value,r.value)):Qs()}get[Symbol.toStringTag](){return"Some"}},Sg=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 oe(r)}okOrElse(r){return oe(r())}iter(){return new Eg(null)}[Symbol.iterator](){return this.iter()}zip(r){return this}zipWith(r,t){return this}get[Symbol.toStringTag](){return"None"}},Qc=e=>new Cg(e),Qs=()=>new Sg,QS=e=>e instanceof Cg||e instanceof Sg?e:e==null?Qs():Qc(e);var Dg=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}}},Ev=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 Qc(this.value)}err(){return Qs()}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 te(r(this.value))}async mapAsync(r){return r(this.value).then(te)}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 Dg(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"}},Cv=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 Qs()}err(){return Qc(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 Dg(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"}},te=e=>new Ev(e),oe=e=>new Cv(e);p();var Rn;(function(e){e.GeometryMissingError="GeometryMissingError",e.FloorMissingError="FloorMissingError",e.UnknownFloorError="UnknownFloorError",e.UnknownGeometryError="UnknownGeometryError",e.DuplicateIdError="DuplicateIdError"})(Rn||(Rn={}));p();p();p();p();var Sv=class extends Se{constructor(r){super(`Duplicate type kind '${r}' detected`)}},Hm=class extends Se{constructor(r){super(`Duplicate string format '${r}' detected`)}},Tg;(function(e){function r(n,o){if(Ar.Has(n))throw new Sv(n);return Ar.Set(n,o),(i={})=>bg({...i,[j]:n})}e.Type=r;function t(n,o){if(Bn.Has(n))throw new Hm(n);return Bn.Set(n,o),n}e.Format=t})(Tg||(Tg={}));p();function wk(e){switch(e.errorType){case U.ArrayContains:return"Expected array to contain at least one matching value";case U.ArrayMaxContains:return`Expected array to contain no more than ${e.schema.maxContains} matching values`;case U.ArrayMinContains:return`Expected array to contain at least ${e.schema.minContains} matching values`;case U.ArrayMaxItems:return`Expected array length to be less or equal to ${e.schema.maxItems}`;case U.ArrayMinItems:return`Expected array length to be greater or equal to ${e.schema.minItems}`;case U.ArrayUniqueItems:return"Expected array elements to be unique";case U.Array:return"Expected array";case U.AsyncIterator:return"Expected AsyncIterator";case U.BigIntExclusiveMaximum:return`Expected bigint to be less than ${e.schema.exclusiveMaximum}`;case U.BigIntExclusiveMinimum:return`Expected bigint to be greater than ${e.schema.exclusiveMinimum}`;case U.BigIntMaximum:return`Expected bigint to be less or equal to ${e.schema.maximum}`;case U.BigIntMinimum:return`Expected bigint to be greater or equal to ${e.schema.minimum}`;case U.BigIntMultipleOf:return`Expected bigint to be a multiple of ${e.schema.multipleOf}`;case U.BigInt:return"Expected bigint";case U.Boolean:return"Expected boolean";case U.DateExclusiveMinimumTimestamp:return`Expected Date timestamp to be greater than ${e.schema.exclusiveMinimumTimestamp}`;case U.DateExclusiveMaximumTimestamp:return`Expected Date timestamp to be less than ${e.schema.exclusiveMaximumTimestamp}`;case U.DateMinimumTimestamp:return`Expected Date timestamp to be greater or equal to ${e.schema.minimumTimestamp}`;case U.DateMaximumTimestamp:return`Expected Date timestamp to be less or equal to ${e.schema.maximumTimestamp}`;case U.DateMultipleOfTimestamp:return`Expected Date timestamp to be a multiple of ${e.schema.multipleOfTimestamp}`;case U.Date:return"Expected Date";case U.Function:return"Expected function";case U.IntegerExclusiveMaximum:return`Expected integer to be less than ${e.schema.exclusiveMaximum}`;case U.IntegerExclusiveMinimum:return`Expected integer to be greater than ${e.schema.exclusiveMinimum}`;case U.IntegerMaximum:return`Expected integer to be less or equal to ${e.schema.maximum}`;case U.IntegerMinimum:return`Expected integer to be greater or equal to ${e.schema.minimum}`;case U.IntegerMultipleOf:return`Expected integer to be a multiple of ${e.schema.multipleOf}`;case U.Integer:return"Expected integer";case U.IntersectUnevaluatedProperties:return"Unexpected property";case U.Intersect:return"Expected all values to match";case U.Iterator:return"Expected Iterator";case U.Literal:return`Expected ${typeof e.schema.const=="string"?`'${e.schema.const}'`:e.schema.const}`;case U.Never:return"Never";case U.Not:return"Value should not match";case U.Null:return"Expected null";case U.NumberExclusiveMaximum:return`Expected number to be less than ${e.schema.exclusiveMaximum}`;case U.NumberExclusiveMinimum:return`Expected number to be greater than ${e.schema.exclusiveMinimum}`;case U.NumberMaximum:return`Expected number to be less or equal to ${e.schema.maximum}`;case U.NumberMinimum:return`Expected number to be greater or equal to ${e.schema.minimum}`;case U.NumberMultipleOf:return`Expected number to be a multiple of ${e.schema.multipleOf}`;case U.Number:return"Expected number";case U.Object:return"Expected object";case U.ObjectAdditionalProperties:return"Unexpected property";case U.ObjectMaxProperties:return`Expected object to have no more than ${e.schema.maxProperties} properties`;case U.ObjectMinProperties:return`Expected object to have at least ${e.schema.minProperties} properties`;case U.ObjectRequiredProperty:return"Expected required property";case U.Promise:return"Expected Promise";case U.RegExp:return"Expected string to match regular expression";case U.StringFormatUnknown:return`Unknown format '${e.schema.format}'`;case U.StringFormat:return`Expected string to match '${e.schema.format}' format`;case U.StringMaxLength:return`Expected string length less or equal to ${e.schema.maxLength}`;case U.StringMinLength:return`Expected string length greater or equal to ${e.schema.minLength}`;case U.StringPattern:return`Expected string to match '${e.schema.pattern}'`;case U.String:return"Expected string";case U.Symbol:return"Expected symbol";case U.TupleLength:return`Expected tuple to have ${e.schema.maxItems||0} elements`;case U.Tuple:return"Expected tuple";case U.Uint8ArrayMaxByteLength:return`Expected byte length less or equal to ${e.schema.maxByteLength}`;case U.Uint8ArrayMinByteLength:return`Expected byte length greater or equal to ${e.schema.minByteLength}`;case U.Uint8Array:return"Expected Uint8Array";case U.Undefined:return"Expected undefined";case U.Union:return"Expected union value";case U.Void:return"Expected void";case U.Kind:return`Expected kind '${e.schema[j]}'`;default:return"Unknown error type"}}var Fk=wk;function e5(){return Fk}p();var Dv=class extends Se{constructor(r){super(`Unable to dereference schema with $id '${r.$ref}'`),this.schema=r}};function Mk(e,r){let t=r.find(n=>n.$id===e.$ref);if(t===void 0)throw new Dv(e);return Qe(t,r)}function Fo(e,r){return!He(e.$id)||r.some(t=>t.$id===e.$id)||r.push(e),r}function Qe(e,r){return e[j]==="This"||e[j]==="Ref"?Mk(e,r):e}p();var Tv=class extends Se{constructor(r){super("Unable to hash value"),this.value=r}},qn;(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"})(qn||(qn={}));var ep=BigInt("14695981039346656037"),[Ak,Ok]=[BigInt("1099511628211"),BigInt("18446744073709551616")],Bk=Array.from({length:256}).map((e,r)=>BigInt(r)),t5=new Float64Array(1),r5=new DataView(t5.buffer),n5=new Uint8Array(t5.buffer);function*Pk(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 kk(e){sn(qn.Array);for(let r of e)tp(r)}function _k(e){sn(qn.Boolean),sn(e?1:0)}function Lk(e){sn(qn.BigInt),r5.setBigInt64(0,e);for(let r of n5)sn(r)}function Rk(e){sn(qn.Date),tp(e.getTime())}function Nk(e){sn(qn.Null)}function $k(e){sn(qn.Number),r5.setFloat64(0,e);for(let r of n5)sn(r)}function jk(e){sn(qn.Object);for(let r of globalThis.Object.getOwnPropertyNames(e).sort())tp(r),tp(e[r])}function Uk(e){sn(qn.String);for(let r=0;r<e.length;r++)for(let t of Pk(e.charCodeAt(r)))sn(t)}function Gk(e){sn(qn.Symbol),tp(e.description)}function zk(e){sn(qn.Uint8Array);for(let r=0;r<e.length;r++)sn(e[r])}function Vk(e){return sn(qn.Undefined)}function tp(e){if(Me(e))return kk(e);if(Ji(e))return _k(e);if(Gr(e))return Lk(e);if(mn(e))return Rk(e);if(Ua(e))return Nk(e);if(ye(e))return $k(e);if(Be(e))return jk(e);if(He(e))return Uk(e);if(Ga(e))return Gk(e);if(Pc(e))return zk(e);if(Wt(e))return Vk(e);throw new Tv(e)}function sn(e){ep=ep^Bk[e],ep=ep*Ak%Ok}function eu(e){return ep=BigInt("14695981039346656037"),tp(e),ep}p();var wv=class extends Se{constructor(r){super("Unknown type"),this.schema=r}};function Hk(e){return e[j]==="Any"||e[j]==="Unknown"}function je(e){return e!==void 0}function Zk(e,r,t){return!0}function Wk(e,r,t){if(!Me(t)||je(e.minItems)&&!(t.length>=e.minItems)||je(e.maxItems)&&!(t.length<=e.maxItems)||!t.every(i=>Hr(e.items,r,i))||e.uniqueItems===!0&&!function(){let i=new Set;for(let s of t){let u=eu(s);if(i.has(u))return!1;i.add(u)}return!0}())return!1;if(!(je(e.contains)||ye(e.minContains)||ye(e.maxContains)))return!0;let n=je(e.contains)?e.contains:gt(),o=t.reduce((i,s)=>Hr(n,r,s)?i+1:i,0);return!(o===0||ye(e.minContains)&&o<e.minContains||ye(e.maxContains)&&o>e.maxContains)}function Xk(e,r,t){return Wh(t)}function Jk(e,r,t){return!(!Gr(t)||je(e.exclusiveMaximum)&&!(t<e.exclusiveMaximum)||je(e.exclusiveMinimum)&&!(t>e.exclusiveMinimum)||je(e.maximum)&&!(t<=e.maximum)||je(e.minimum)&&!(t>=e.minimum)||je(e.multipleOf)&&t%e.multipleOf!==BigInt(0))}function Yk(e,r,t){return Ji(t)}function Kk(e,r,t){return Hr(e.returns,r,t.prototype)}function qk(e,r,t){return!(!mn(t)||je(e.exclusiveMaximumTimestamp)&&!(t.getTime()<e.exclusiveMaximumTimestamp)||je(e.exclusiveMinimumTimestamp)&&!(t.getTime()>e.exclusiveMinimumTimestamp)||je(e.maximumTimestamp)&&!(t.getTime()<=e.maximumTimestamp)||je(e.minimumTimestamp)&&!(t.getTime()>=e.minimumTimestamp)||je(e.multipleOfTimestamp)&&t.getTime()%e.multipleOfTimestamp!==0)}function Qk(e,r,t){return Zs(t)}function e_(e,r,t){return!(!Yh(t)||je(e.exclusiveMaximum)&&!(t<e.exclusiveMaximum)||je(e.exclusiveMinimum)&&!(t>e.exclusiveMinimum)||je(e.maximum)&&!(t<=e.maximum)||je(e.minimum)&&!(t>=e.minimum)||je(e.multipleOf)&&t%e.multipleOf!==0)}function t_(e,r,t){let n=e.allOf.every(o=>Hr(o,r,t));if(e.unevaluatedProperties===!1){let o=new RegExp(Ja(e)),i=Object.getOwnPropertyNames(t).every(s=>o.test(s));return n&&i}else if(Ze(e.unevaluatedProperties)){let o=new RegExp(Ja(e)),i=Object.getOwnPropertyNames(t).every(s=>o.test(s)||Hr(e.unevaluatedProperties,r,t[s]));return n&&i}else return n}function r_(e,r,t){return Xh(t)}function n_(e,r,t){return t===e.const}function o_(e,r,t){return!1}function i_(e,r,t){return!Hr(e.not,r,t)}function a_(e,r,t){return Ua(t)}function s_(e,r,t){return!(!mt.IsNumberLike(t)||je(e.exclusiveMaximum)&&!(t<e.exclusiveMaximum)||je(e.exclusiveMinimum)&&!(t>e.exclusiveMinimum)||je(e.minimum)&&!(t>=e.minimum)||je(e.maximum)&&!(t<=e.maximum)||je(e.multipleOf)&&t%e.multipleOf!==0)}function u_(e,r,t){if(!mt.IsObjectLike(t)||je(e.minProperties)&&!(Object.getOwnPropertyNames(t).length>=e.minProperties)||je(e.maxProperties)&&!(Object.getOwnPropertyNames(t).length<=e.maxProperties))return!1;let n=Object.getOwnPropertyNames(e.properties);for(let o of n){let i=e.properties[o];if(e.required&&e.required.includes(o)){if(!Hr(i,r,t[o])||(Ka(i)||Hk(i))&&!(o in t))return!1}else if(mt.IsExactOptionalProperty(t,o)&&!Hr(i,r,t[o]))return!1}if(e.additionalProperties===!1){let o=Object.getOwnPropertyNames(t);return e.required&&e.required.length===n.length&&o.length===n.length?!0:o.every(i=>n.includes(i))}else return typeof e.additionalProperties=="object"?Object.getOwnPropertyNames(t).every(i=>n.includes(i)||Hr(e.additionalProperties,r,t[i])):!0}function l_(e,r,t){return Jh(t)}function c_(e,r,t){if(!mt.IsRecordLike(t)||je(e.minProperties)&&!(Object.getOwnPropertyNames(t).length>=e.minProperties)||je(e.maxProperties)&&!(Object.getOwnPropertyNames(t).length<=e.maxProperties))return!1;let[n,o]=Object.entries(e.patternProperties)[0],i=new RegExp(n),s=Object.entries(t).every(([c,d])=>i.test(c)?Hr(o,r,d):!0),u=typeof e.additionalProperties=="object"?Object.entries(t).every(([c,d])=>i.test(c)?!0:Hr(e.additionalProperties,r,d)):!0,l=e.additionalProperties===!1?Object.getOwnPropertyNames(t).every(c=>i.test(c)):!0;return s&&u&&l}function p_(e,r,t){return Hr(Qe(e,r),r,t)}function d_(e,r,t){let n=new RegExp(e.source,e.flags);return je(e.minLength)&&!(t.length>=e.minLength)||je(e.maxLength)&&!(t.length<=e.maxLength)?!1:n.test(t)}function m_(e,r,t){return!He(t)||je(e.minLength)&&!(t.length>=e.minLength)||je(e.maxLength)&&!(t.length<=e.maxLength)||je(e.pattern)&&!new RegExp(e.pattern).test(t)?!1:je(e.format)?Bn.Has(e.format)?Bn.Get(e.format)(t):!1:!0}function f_(e,r,t){return Ga(t)}function h_(e,r,t){return He(t)&&new RegExp(e.pattern).test(t)}function g_(e,r,t){return Hr(Qe(e,r),r,t)}function y_(e,r,t){if(!Me(t)||e.items===void 0&&t.length!==0||t.length!==e.maxItems)return!1;if(!e.items)return!0;for(let n=0;n<e.items.length;n++)if(!Hr(e.items[n],r,t[n]))return!1;return!0}function b_(e,r,t){return Wt(t)}function v_(e,r,t){return e.anyOf.some(n=>Hr(n,r,t))}function x_(e,r,t){return!(!Pc(t)||je(e.maxByteLength)&&!(t.length<=e.maxByteLength)||je(e.minByteLength)&&!(t.length>=e.minByteLength))}function I_(e,r,t){return!0}function E_(e,r,t){return mt.IsVoidLike(t)}function C_(e,r,t){return Ar.Has(e[j])?Ar.Get(e[j])(e,t):!1}function Hr(e,r,t){let n=je(e.$id)?[...r,e]:r,o=e;switch(o[j]){case"Any":return Zk(o,n,t);case"Array":return Wk(o,n,t);case"AsyncIterator":return Xk(o,n,t);case"BigInt":return Jk(o,n,t);case"Boolean":return Yk(o,n,t);case"Constructor":return Kk(o,n,t);case"Date":return qk(o,n,t);case"Function":return Qk(o,n,t);case"Integer":return e_(o,n,t);case"Intersect":return t_(o,n,t);case"Iterator":return r_(o,n,t);case"Literal":return n_(o,n,t);case"Never":return o_(o,n,t);case"Not":return i_(o,n,t);case"Null":return a_(o,n,t);case"Number":return s_(o,n,t);case"Object":return u_(o,n,t);case"Promise":return l_(o,n,t);case"Record":return c_(o,n,t);case"Ref":return p_(o,n,t);case"RegExp":return d_(o,n,t);case"String":return m_(o,n,t);case"Symbol":return f_(o,n,t);case"TemplateLiteral":return h_(o,n,t);case"This":return g_(o,n,t);case"Tuple":return y_(o,n,t);case"Undefined":return b_(o,n,t);case"Union":return v_(o,n,t);case"Uint8Array":return x_(o,n,t);case"Unknown":return I_(o,n,t);case"Void":return E_(o,n,t);default:if(!Ar.Has(o[j]))throw new wv(o);return C_(o,n,t)}}function Le(...e){return e.length===3?Hr(e[0],e[1],e[2]):Hr(e[0],[],e[1])}var U;(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"})(U||(U={}));var Fv=class extends Se{constructor(r){super("Unknown type"),this.schema=r}};function qa(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function Ue(e){return e!==void 0}var Mo=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 ee(e,r,t,n,o=[]){return{type:e,schema:r,path:t,value:n,message:e5()({errorType:e,path:t,schema:r,value:n,errors:o}),errors:o}}function*S_(e,r,t,n){}function*D_(e,r,t,n){if(!Me(n))return yield ee(U.Array,e,t,n);Ue(e.minItems)&&!(n.length>=e.minItems)&&(yield ee(U.ArrayMinItems,e,t,n)),Ue(e.maxItems)&&!(n.length<=e.maxItems)&&(yield ee(U.ArrayMaxItems,e,t,n));for(let s=0;s<n.length;s++)yield*Zr(e.items,r,`${t}/${s}`,n[s]);if(e.uniqueItems===!0&&!function(){let s=new Set;for(let u of n){let l=eu(u);if(s.has(l))return!1;s.add(l)}return!0}()&&(yield ee(U.ArrayUniqueItems,e,t,n)),!(Ue(e.contains)||Ue(e.minContains)||Ue(e.maxContains)))return;let o=Ue(e.contains)?e.contains:gt(),i=n.reduce((s,u,l)=>Zr(o,r,`${t}${l}`,u).next().done===!0?s+1:s,0);i===0&&(yield ee(U.ArrayContains,e,t,n)),ye(e.minContains)&&i<e.minContains&&(yield ee(U.ArrayMinContains,e,t,n)),ye(e.maxContains)&&i>e.maxContains&&(yield ee(U.ArrayMaxContains,e,t,n))}function*T_(e,r,t,n){Wh(n)||(yield ee(U.AsyncIterator,e,t,n))}function*w_(e,r,t,n){if(!Gr(n))return yield ee(U.BigInt,e,t,n);Ue(e.exclusiveMaximum)&&!(n<e.exclusiveMaximum)&&(yield ee(U.BigIntExclusiveMaximum,e,t,n)),Ue(e.exclusiveMinimum)&&!(n>e.exclusiveMinimum)&&(yield ee(U.BigIntExclusiveMinimum,e,t,n)),Ue(e.maximum)&&!(n<=e.maximum)&&(yield ee(U.BigIntMaximum,e,t,n)),Ue(e.minimum)&&!(n>=e.minimum)&&(yield ee(U.BigIntMinimum,e,t,n)),Ue(e.multipleOf)&&n%e.multipleOf!==BigInt(0)&&(yield ee(U.BigIntMultipleOf,e,t,n))}function*F_(e,r,t,n){Ji(n)||(yield ee(U.Boolean,e,t,n))}function*M_(e,r,t,n){yield*Zr(e.returns,r,t,n.prototype)}function*A_(e,r,t,n){if(!mn(n))return yield ee(U.Date,e,t,n);Ue(e.exclusiveMaximumTimestamp)&&!(n.getTime()<e.exclusiveMaximumTimestamp)&&(yield ee(U.DateExclusiveMaximumTimestamp,e,t,n)),Ue(e.exclusiveMinimumTimestamp)&&!(n.getTime()>e.exclusiveMinimumTimestamp)&&(yield ee(U.DateExclusiveMinimumTimestamp,e,t,n)),Ue(e.maximumTimestamp)&&!(n.getTime()<=e.maximumTimestamp)&&(yield ee(U.DateMaximumTimestamp,e,t,n)),Ue(e.minimumTimestamp)&&!(n.getTime()>=e.minimumTimestamp)&&(yield ee(U.DateMinimumTimestamp,e,t,n)),Ue(e.multipleOfTimestamp)&&n.getTime()%e.multipleOfTimestamp!==0&&(yield ee(U.DateMultipleOfTimestamp,e,t,n))}function*O_(e,r,t,n){Zs(n)||(yield ee(U.Function,e,t,n))}function*B_(e,r,t,n){if(!Yh(n))return yield ee(U.Integer,e,t,n);Ue(e.exclusiveMaximum)&&!(n<e.exclusiveMaximum)&&(yield ee(U.IntegerExclusiveMaximum,e,t,n)),Ue(e.exclusiveMinimum)&&!(n>e.exclusiveMinimum)&&(yield ee(U.IntegerExclusiveMinimum,e,t,n)),Ue(e.maximum)&&!(n<=e.maximum)&&(yield ee(U.IntegerMaximum,e,t,n)),Ue(e.minimum)&&!(n>=e.minimum)&&(yield ee(U.IntegerMinimum,e,t,n)),Ue(e.multipleOf)&&n%e.multipleOf!==0&&(yield ee(U.IntegerMultipleOf,e,t,n))}function*P_(e,r,t,n){let o=!1;for(let i of e.allOf)for(let s of Zr(i,r,t,n))o=!0,yield s;if(o)return yield ee(U.Intersect,e,t,n);if(e.unevaluatedProperties===!1){let i=new RegExp(Ja(e));for(let s of Object.getOwnPropertyNames(n))i.test(s)||(yield ee(U.IntersectUnevaluatedProperties,e,`${t}/${s}`,n))}if(typeof e.unevaluatedProperties=="object"){let i=new RegExp(Ja(e));for(let s of Object.getOwnPropertyNames(n))if(!i.test(s)){let u=Zr(e.unevaluatedProperties,r,`${t}/${s}`,n[s]).next();u.done||(yield u.value)}}}function*k_(e,r,t,n){Xh(n)||(yield ee(U.Iterator,e,t,n))}function*__(e,r,t,n){n!==e.const&&(yield ee(U.Literal,e,t,n))}function*L_(e,r,t,n){yield ee(U.Never,e,t,n)}function*R_(e,r,t,n){Zr(e.not,r,t,n).next().done===!0&&(yield ee(U.Not,e,t,n))}function*N_(e,r,t,n){Ua(n)||(yield ee(U.Null,e,t,n))}function*$_(e,r,t,n){if(!mt.IsNumberLike(n))return yield ee(U.Number,e,t,n);Ue(e.exclusiveMaximum)&&!(n<e.exclusiveMaximum)&&(yield ee(U.NumberExclusiveMaximum,e,t,n)),Ue(e.exclusiveMinimum)&&!(n>e.exclusiveMinimum)&&(yield ee(U.NumberExclusiveMinimum,e,t,n)),Ue(e.maximum)&&!(n<=e.maximum)&&(yield ee(U.NumberMaximum,e,t,n)),Ue(e.minimum)&&!(n>=e.minimum)&&(yield ee(U.NumberMinimum,e,t,n)),Ue(e.multipleOf)&&n%e.multipleOf!==0&&(yield ee(U.NumberMultipleOf,e,t,n))}function*j_(e,r,t,n){if(!mt.IsObjectLike(n))return yield ee(U.Object,e,t,n);Ue(e.minProperties)&&!(Object.getOwnPropertyNames(n).length>=e.minProperties)&&(yield ee(U.ObjectMinProperties,e,t,n)),Ue(e.maxProperties)&&!(Object.getOwnPropertyNames(n).length<=e.maxProperties)&&(yield ee(U.ObjectMaxProperties,e,t,n));let o=Array.isArray(e.required)?e.required:[],i=Object.getOwnPropertyNames(e.properties),s=Object.getOwnPropertyNames(n);for(let u of o)s.includes(u)||(yield ee(U.ObjectRequiredProperty,e.properties[u],`${t}/${qa(u)}`,void 0));if(e.additionalProperties===!1)for(let u of s)i.includes(u)||(yield ee(U.ObjectAdditionalProperties,e,`${t}/${qa(u)}`,n[u]));if(typeof e.additionalProperties=="object")for(let u of s)i.includes(u)||(yield*Zr(e.additionalProperties,r,`${t}/${qa(u)}`,n[u]));for(let u of i){let l=e.properties[u];e.required&&e.required.includes(u)?(yield*Zr(l,r,`${t}/${qa(u)}`,n[u]),Ka(e)&&!(u in n)&&(yield ee(U.ObjectRequiredProperty,l,`${t}/${qa(u)}`,void 0))):mt.IsExactOptionalProperty(n,u)&&(yield*Zr(l,r,`${t}/${qa(u)}`,n[u]))}}function*U_(e,r,t,n){Jh(n)||(yield ee(U.Promise,e,t,n))}function*G_(e,r,t,n){if(!mt.IsRecordLike(n))return yield ee(U.Object,e,t,n);Ue(e.minProperties)&&!(Object.getOwnPropertyNames(n).length>=e.minProperties)&&(yield ee(U.ObjectMinProperties,e,t,n)),Ue(e.maxProperties)&&!(Object.getOwnPropertyNames(n).length<=e.maxProperties)&&(yield ee(U.ObjectMaxProperties,e,t,n));let[o,i]=Object.entries(e.patternProperties)[0],s=new RegExp(o);for(let[u,l]of Object.entries(n))s.test(u)&&(yield*Zr(i,r,`${t}/${qa(u)}`,l));if(typeof e.additionalProperties=="object")for(let[u,l]of Object.entries(n))s.test(u)||(yield*Zr(e.additionalProperties,r,`${t}/${qa(u)}`,l));if(e.additionalProperties===!1){for(let[u,l]of Object.entries(n))if(!s.test(u))return yield ee(U.ObjectAdditionalProperties,e,`${t}/${qa(u)}`,l)}}function*z_(e,r,t,n){yield*Zr(Qe(e,r),r,t,n)}function*V_(e,r,t,n){if(!He(n))return yield ee(U.String,e,t,n);if(Ue(e.minLength)&&!(n.length>=e.minLength)&&(yield ee(U.StringMinLength,e,t,n)),Ue(e.maxLength)&&!(n.length<=e.maxLength)&&(yield ee(U.StringMaxLength,e,t,n)),!new RegExp(e.source,e.flags).test(n))return yield ee(U.RegExp,e,t,n)}function*H_(e,r,t,n){if(!He(n))return yield ee(U.String,e,t,n);Ue(e.minLength)&&!(n.length>=e.minLength)&&(yield ee(U.StringMinLength,e,t,n)),Ue(e.maxLength)&&!(n.length<=e.maxLength)&&(yield ee(U.StringMaxLength,e,t,n)),He(e.pattern)&&(new RegExp(e.pattern).test(n)||(yield ee(U.StringPattern,e,t,n))),He(e.format)&&(Bn.Has(e.format)?Bn.Get(e.format)(n)||(yield ee(U.StringFormat,e,t,n)):yield ee(U.StringFormatUnknown,e,t,n))}function*Z_(e,r,t,n){Ga(n)||(yield ee(U.Symbol,e,t,n))}function*W_(e,r,t,n){if(!He(n))return yield ee(U.String,e,t,n);new RegExp(e.pattern).test(n)||(yield ee(U.StringPattern,e,t,n))}function*X_(e,r,t,n){yield*Zr(Qe(e,r),r,t,n)}function*J_(e,r,t,n){if(!Me(n))return yield ee(U.Tuple,e,t,n);if(e.items===void 0&&n.length!==0)return yield ee(U.TupleLength,e,t,n);if(n.length!==e.maxItems)return yield ee(U.TupleLength,e,t,n);if(e.items)for(let o=0;o<e.items.length;o++)yield*Zr(e.items[o],r,`${t}/${o}`,n[o])}function*Y_(e,r,t,n){Wt(n)||(yield ee(U.Undefined,e,t,n))}function*K_(e,r,t,n){if(Le(e,r,n))return;let o=e.anyOf.map(i=>new Mo(Zr(i,r,t,n)));yield ee(U.Union,e,t,n,o)}function*q_(e,r,t,n){if(!Pc(n))return yield ee(U.Uint8Array,e,t,n);Ue(e.maxByteLength)&&!(n.length<=e.maxByteLength)&&(yield ee(U.Uint8ArrayMaxByteLength,e,t,n)),Ue(e.minByteLength)&&!(n.length>=e.minByteLength)&&(yield ee(U.Uint8ArrayMinByteLength,e,t,n))}function*Q_(e,r,t,n){}function*eL(e,r,t,n){mt.IsVoidLike(n)||(yield ee(U.Void,e,t,n))}function*tL(e,r,t,n){Ar.Get(e[j])(e,n)||(yield ee(U.Kind,e,t,n))}function*Zr(e,r,t,n){let o=Ue(e.$id)?[...r,e]:r,i=e;switch(i[j]){case"Any":return yield*S_(i,o,t,n);case"Array":return yield*D_(i,o,t,n);case"AsyncIterator":return yield*T_(i,o,t,n);case"BigInt":return yield*w_(i,o,t,n);case"Boolean":return yield*F_(i,o,t,n);case"Constructor":return yield*M_(i,o,t,n);case"Date":return yield*A_(i,o,t,n);case"Function":return yield*O_(i,o,t,n);case"Integer":return yield*B_(i,o,t,n);case"Intersect":return yield*P_(i,o,t,n);case"Iterator":return yield*k_(i,o,t,n);case"Literal":return yield*__(i,o,t,n);case"Never":return yield*L_(i,o,t,n);case"Not":return yield*R_(i,o,t,n);case"Null":return yield*N_(i,o,t,n);case"Number":return yield*$_(i,o,t,n);case"Object":return yield*j_(i,o,t,n);case"Promise":return yield*U_(i,o,t,n);case"Record":return yield*G_(i,o,t,n);case"Ref":return yield*z_(i,o,t,n);case"RegExp":return yield*V_(i,o,t,n);case"String":return yield*H_(i,o,t,n);case"Symbol":return yield*Z_(i,o,t,n);case"TemplateLiteral":return yield*W_(i,o,t,n);case"This":return yield*X_(i,o,t,n);case"Tuple":return yield*J_(i,o,t,n);case"Undefined":return yield*Y_(i,o,t,n);case"Union":return yield*K_(i,o,t,n);case"Uint8Array":return yield*q_(i,o,t,n);case"Unknown":return yield*Q_(i,o,t,n);case"Void":return yield*eL(i,o,t,n);default:if(!Ar.Has(i[j]))throw new Fv(e);return yield*tL(i,o,t,n)}}function ea(...e){let r=e.length===3?Zr(e[0],e[1],"",e[2]):Zr(e[0],[],"",e[1]);return new Mo(r)}p();p();var rL=function(e,r,t,n,o){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof r=="function"?e!==r||!o:!r.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(e,t):o?o.value=t:r.set(e,t),t},i5=function(e,r,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof r=="function"?e!==r||!n:!r.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(e):n?n.value:r.get(e)},Mv,wg,a5,Av=class extends Se{constructor(r){let t=r.First();super(t===void 0?"Invalid Value":t.message),Mv.add(this),wg.set(this,void 0),rL(this,wg,r,"f"),this.error=t}Errors(){return new Mo(i5(this,Mv,"m",a5).call(this))}};wg=new WeakMap,Mv=new WeakSet,a5=function*(){this.error&&(yield this.error),yield*i5(this,wg,"f")};function o5(e,r,t){if(!Le(e,r,t))throw new Av(ea(e,r,t))}function Fg(...e){return e.length===3?o5(e[0],e[1],e[2]):o5(e[0],[],e[1])}p();p();p();function nL(e){let r={};for(let t of Object.getOwnPropertyNames(e))r[t]=et(e[t]);for(let t of Object.getOwnPropertySymbols(e))r[t]=et(e[t]);return r}function oL(e){return e.map(r=>et(r))}function iL(e){return e.slice()}function aL(e){return new Map(et([...e.entries()]))}function sL(e){return new Set(et([...e.entries()]))}function uL(e){return new Date(e.toISOString())}function et(e){if(Me(e))return oL(e);if(mn(e))return uL(e);if(Io(e))return iL(e);if(zE(e))return aL(e);if(VE(e))return sL(e);if(Be(e))return nL(e);if(zr(e))return e;throw new Error("ValueClone: Unable to clone value")}var Qn=class extends Se{constructor(r,t){super(t),this.schema=r}};function tt(e){return Zs(e)?e():et(e)}function lL(e,r){return Te(e,"default")?tt(e.default):{}}function cL(e,r){if(e.uniqueItems===!0&&!Te(e,"default"))throw new Qn(e,"Array with the uniqueItems constraint requires a default value");if("contains"in e&&!Te(e,"default"))throw new Qn(e,"Array with the contains constraint requires a default value");return"default"in e?tt(e.default):e.minItems!==void 0?Array.from({length:e.minItems}).map(t=>eo(e.items,r)):[]}function pL(e,r){return Te(e,"default")?tt(e.default):async function*(){}()}function dL(e,r){return Te(e,"default")?tt(e.default):BigInt(0)}function mL(e,r){return Te(e,"default")?tt(e.default):!1}function fL(e,r){if(Te(e,"default"))return tt(e.default);{let t=eo(e.returns,r);return typeof t=="object"&&!Array.isArray(t)?class{constructor(){for(let[n,o]of Object.entries(t)){let i=this;i[n]=o}}}:class{}}}function hL(e,r){return Te(e,"default")?tt(e.default):e.minimumTimestamp!==void 0?new Date(e.minimumTimestamp):new Date}function gL(e,r){return Te(e,"default")?tt(e.default):()=>eo(e.returns,r)}function yL(e,r){return Te(e,"default")?tt(e.default):e.minimum!==void 0?e.minimum:0}function bL(e,r){if(Te(e,"default"))return tt(e.default);{let t=e.allOf.reduce((n,o)=>{let i=eo(o,r);return typeof i=="object"?{...n,...i}:i},{});if(!Le(e,r,t))throw new Qn(e,"Intersect produced invalid value. Consider using a default value.");return t}}function vL(e,r){return Te(e,"default")?tt(e.default):function*(){}()}function xL(e,r){return Te(e,"default")?tt(e.default):e.const}function IL(e,r){if(Te(e,"default"))return tt(e.default);throw new Qn(e,"Never types cannot be created. Consider using a default value.")}function EL(e,r){if(Te(e,"default"))return tt(e.default);throw new Qn(e,"Not types must have a default value")}function CL(e,r){return Te(e,"default")?tt(e.default):null}function SL(e,r){return Te(e,"default")?tt(e.default):e.minimum!==void 0?e.minimum:0}function DL(e,r){if(Te(e,"default"))return tt(e.default);{let t=new Set(e.required),n={};for(let[o,i]of Object.entries(e.properties))t.has(o)&&(n[o]=eo(i,r));return n}}function TL(e,r){return Te(e,"default")?tt(e.default):Promise.resolve(eo(e.item,r))}function wL(e,r){let[t,n]=Object.entries(e.patternProperties)[0];if(Te(e,"default"))return tt(e.default);if(t===Wa||t===Za)return{};{let o=t.slice(1,t.length-1).split("|"),i={};for(let s of o)i[s]=eo(n,r);return i}}function FL(e,r){return Te(e,"default")?tt(e.default):eo(Qe(e,r),r)}function ML(e,r){if(Te(e,"default"))return tt(e.default);throw new Qn(e,"RegExp types cannot be created. Consider using a default value.")}function AL(e,r){if(e.pattern!==void 0){if(Te(e,"default"))return tt(e.default);throw new Qn(e,"String types with patterns must specify a default value")}else if(e.format!==void 0){if(Te(e,"default"))return tt(e.default);throw new Qn(e,"String types with formats must specify a default value")}else return Te(e,"default")?tt(e.default):e.minLength!==void 0?Array.from({length:e.minLength}).map(()=>" ").join(""):""}function OL(e,r){return Te(e,"default")?tt(e.default):"value"in e?Symbol.for(e.value):Symbol()}function BL(e,r){if(Te(e,"default"))return tt(e.default);if(!tg(e))throw new Qn(e,"Can only create template literals that produce a finite variants. Consider using a default value.");return jc(e)[0]}function PL(e,r){if(s5++>UL)throw new Qn(e,"Cannot create recursive type as it appears possibly infinite. Consider using a default.");return Te(e,"default")?tt(e.default):eo(Qe(e,r),r)}function kL(e,r){return Te(e,"default")?tt(e.default):e.items===void 0?[]:Array.from({length:e.minItems}).map((t,n)=>eo(e.items[n],r))}function _L(e,r){if(Te(e,"default"))return tt(e.default)}function LL(e,r){if(Te(e,"default"))return tt(e.default);if(e.anyOf.length===0)throw new Error("ValueCreate.Union: Cannot create Union with zero variants");return eo(e.anyOf[0],r)}function RL(e,r){return Te(e,"default")?tt(e.default):e.minByteLength!==void 0?new Uint8Array(e.minByteLength):new Uint8Array(0)}function NL(e,r){return Te(e,"default")?tt(e.default):{}}function $L(e,r){if(Te(e,"default"))return tt(e.default)}function jL(e,r){if(Te(e,"default"))return tt(e.default);throw new Error("User defined types must specify a default value")}function eo(e,r){let t=Fo(e,r),n=e;switch(n[j]){case"Any":return lL(n,t);case"Array":return cL(n,t);case"AsyncIterator":return pL(n,t);case"BigInt":return dL(n,t);case"Boolean":return mL(n,t);case"Constructor":return fL(n,t);case"Date":return hL(n,t);case"Function":return gL(n,t);case"Integer":return yL(n,t);case"Intersect":return bL(n,t);case"Iterator":return vL(n,t);case"Literal":return xL(n,t);case"Never":return IL(n,t);case"Not":return EL(n,t);case"Null":return CL(n,t);case"Number":return SL(n,t);case"Object":return DL(n,t);case"Promise":return TL(n,t);case"Record":return wL(n,t);case"Ref":return FL(n,t);case"RegExp":return ML(n,t);case"String":return AL(n,t);case"Symbol":return OL(n,t);case"TemplateLiteral":return BL(n,t);case"This":return PL(n,t);case"Tuple":return kL(n,t);case"Undefined":return _L(n,t);case"Union":return LL(n,t);case"Uint8Array":return RL(n,t);case"Unknown":return NL(n,t);case"Void":return $L(n,t);default:if(!Ar.Has(n[j]))throw new Qn(n,"Unknown type");return jL(n,t)}}var UL=512,s5=0;function Ao(...e){return s5=0,e.length===2?eo(e[0],e[1]):eo(e[0],[])}var Mg=class extends Se{constructor(r,t){super(t),this.schema=r}};function GL(e,r,t){if(e[j]==="Object"&&typeof t=="object"&&!Ua(t)){let n=e,o=Object.getOwnPropertyNames(t),i=Object.entries(n.properties),[s,u]=[1/i.length,i.length];return i.reduce((l,[c,d])=>{let f=d[j]==="Literal"&&d.const===t[c]?u:0,h=Le(d,r,t[c])?s:0,b=o.includes(c)?s:0;return l+(f+h+b)},0)}else return Le(e,r,t)?1:0}function zL(e,r,t){let n=e.anyOf.map(s=>Qe(s,r)),[o,i]=[n[0],0];for(let s of n){let u=GL(s,r,t);u>i&&(o=s,i=u)}return o}function VL(e,r,t){if("default"in e)return typeof t=="function"?e.default:et(e.default);{let n=zL(e,r,t);return Ov(n,r,t)}}function HL(e,r,t){return Le(e,r,t)?et(t):Ao(e,r)}function ZL(e,r,t){return Le(e,r,t)?t:Ao(e,r)}function WL(e,r,t){if(Le(e,r,t))return et(t);let n=Me(t)?et(t):Ao(e,r),o=ye(e.minItems)&&n.length<e.minItems?[...n,...Array.from({length:e.minItems-n.length},()=>null)]:n,s=(ye(e.maxItems)&&o.length>e.maxItems?o.slice(0,e.maxItems):o).map(l=>ta(e.items,r,l));if(e.uniqueItems!==!0)return s;let u=[...new Set(s)];if(!Le(e,r,u))throw new Mg(e,"Array cast produced invalid data due to uniqueItems constraint");return u}function XL(e,r,t){if(Le(e,r,t))return Ao(e,r);let n=new Set(e.returns.required||[]),o=function(){};for(let[i,s]of Object.entries(e.returns.properties))!n.has(i)&&t.prototype[i]===void 0||(o.prototype[i]=ta(s,r,t.prototype[i]));return o}function JL(e,r,t){let n=Ao(e,r),o=Be(n)&&Be(t)?{...n,...t}:t;return Le(e,r,o)?o:Ao(e,r)}function YL(e,r,t){throw new Mg(e,"Never types cannot be cast")}function KL(e,r,t){if(Le(e,r,t))return t;if(t===null||typeof t!="object")return Ao(e,r);let n=new Set(e.required||[]),o={};for(let[i,s]of Object.entries(e.properties))!n.has(i)&&t[i]===void 0||(o[i]=ta(s,r,t[i]));if(typeof e.additionalProperties=="object"){let i=Object.getOwnPropertyNames(e.properties);for(let s of Object.getOwnPropertyNames(t))i.includes(s)||(o[s]=ta(e.additionalProperties,r,t[s]))}return o}function qL(e,r,t){if(Le(e,r,t))return et(t);if(t===null||typeof t!="object"||Array.isArray(t)||t instanceof Date)return Ao(e,r);let n=Object.getOwnPropertyNames(e.patternProperties)[0],o=e.patternProperties[n],i={};for(let[s,u]of Object.entries(t))i[s]=ta(o,r,u);return i}function QL(e,r,t){return ta(Qe(e,r),r,t)}function eR(e,r,t){return ta(Qe(e,r),r,t)}function tR(e,r,t){return Le(e,r,t)?et(t):Me(t)?e.items===void 0?[]:e.items.map((n,o)=>ta(n,r,t[o])):Ao(e,r)}function rR(e,r,t){return Le(e,r,t)?et(t):VL(e,r,t)}function ta(e,r,t){let n=He(e.$id)?[...r,e]:r,o=e;switch(e[j]){case"Array":return WL(o,n,t);case"Constructor":return XL(o,n,t);case"Intersect":return JL(o,n,t);case"Never":return YL(o,n,t);case"Object":return KL(o,n,t);case"Record":return qL(o,n,t);case"Ref":return QL(o,n,t);case"This":return eR(o,n,t);case"Tuple":return tR(o,n,t);case"Union":return rR(o,n,t);case"Date":case"Symbol":case"Uint8Array":return HL(e,r,t);default:return ZL(o,n,t)}}function Ov(...e){return e.length===3?ta(e[0],e[1],e[2]):ta(e[0],[],e[1])}p();function nR(e){return Xs(e)&&e[j]!=="Unsafe"}function oR(e,r,t){return Me(t)?t.map(n=>to(e.items,r,n)):t}function iR(e,r,t){let n=e.unevaluatedProperties,i=e.allOf.map(u=>to(u,r,et(t))).reduce((u,l)=>Be(l)?{...u,...l}:l,{});if(!Be(t)||!Be(i)||!Xs(n))return i;let s=Or(e);for(let u of Object.getOwnPropertyNames(t))s.includes(u)||Le(n,r,t[u])&&(i[u]=to(n,r,t[u]));return i}function aR(e,r,t){if(!Be(t)||Me(t))return t;let n=e.additionalProperties;for(let o of Object.getOwnPropertyNames(t)){if(Te(e.properties,o)){t[o]=to(e.properties[o],r,t[o]);continue}if(Xs(n)&&Le(n,r,t[o])){t[o]=to(n,r,t[o]);continue}delete t[o]}return t}function sR(e,r,t){if(!Be(t))return t;let n=e.additionalProperties,o=Object.getOwnPropertyNames(t),[i,s]=Object.entries(e.patternProperties)[0],u=new RegExp(i);for(let l of o){if(u.test(l)){t[l]=to(s,r,t[l]);continue}if(Xs(n)&&Le(n,r,t[l])){t[l]=to(n,r,t[l]);continue}delete t[l]}return t}function uR(e,r,t){return to(Qe(e,r),r,t)}function lR(e,r,t){return to(Qe(e,r),r,t)}function cR(e,r,t){if(!Me(t))return t;if(Wt(e.items))return[];let n=Math.min(t.length,e.items.length);for(let o=0;o<n;o++)t[o]=to(e.items[o],r,t[o]);return t.length>n?t.slice(0,n):t}function pR(e,r,t){for(let n of e.anyOf)if(nR(n)&&Le(n,r,t))return to(n,r,t);return t}function to(e,r,t){let n=He(e.$id)?[...r,e]:r,o=e;switch(o[j]){case"Array":return oR(o,n,t);case"Intersect":return iR(o,n,t);case"Object":return aR(o,n,t);case"Record":return sR(o,n,t);case"Ref":return uR(o,n,t);case"This":return lR(o,n,t);case"Tuple":return cR(o,n,t);case"Union":return pR(o,n,t);default:return t}}function Ag(...e){return e.length===3?to(e[0],e[1],e[2]):to(e[0],[],e[1])}p();function Og(e){return He(e)&&!isNaN(e)&&!isNaN(parseFloat(e))}function dR(e){return Gr(e)||Ji(e)||ye(e)}function Zm(e){return e===!0||ye(e)&&e===1||Gr(e)&&e===BigInt("1")||He(e)&&(e.toLowerCase()==="true"||e==="1")}function Wm(e){return e===!1||ye(e)&&(e===0||Object.is(e,-0))||Gr(e)&&e===BigInt("0")||He(e)&&(e.toLowerCase()==="false"||e==="0"||e==="-0")}function mR(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 fR(e){return He(e)&&/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)?$/i.test(e)}function hR(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 gR(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 yR(e){return He(e)&&/^\d\d\d\d-[0-1]\d-[0-3]\d$/i.test(e)}function bR(e,r){let t=l5(e);return t===r?t:e}function vR(e,r){let t=c5(e);return t===r?t:e}function xR(e,r){let t=u5(e);return t===r?t:e}function IR(e,r){return He(e.const)?bR(r,e.const):ye(e.const)?vR(r,e.const):Ji(e.const)?xR(r,e.const):r}function u5(e){return Zm(e)?!0:Wm(e)?!1:e}function ER(e){let r=t=>t.split(".")[0];return Og(e)?BigInt(r(e)):ye(e)?BigInt(Math.trunc(e)):Wm(e)?BigInt(0):Zm(e)?BigInt(1):e}function l5(e){return dR(e)?e.toString():Ga(e)&&e.description!==void 0?e.description.toString():e}function c5(e){return Og(e)?parseFloat(e):Zm(e)?1:Wm(e)?0:e}function CR(e){return Og(e)?parseInt(e):ye(e)?e|0:Zm(e)?1:Wm(e)?0:e}function SR(e){return He(e)&&e.toLowerCase()==="null"?null:e}function DR(e){return He(e)&&e==="undefined"?void 0:e}function TR(e){return mn(e)?e:ye(e)?new Date(e):Zm(e)?new Date(1):Wm(e)?new Date(0):Og(e)?new Date(parseInt(e)):fR(e)?new Date(`1970-01-01T${e}.000Z`):mR(e)?new Date(`1970-01-01T${e}`):gR(e)?new Date(`${e}.000Z`):hR(e)?new Date(e):yR(e)?new Date(`${e}T00:00:00.000Z`):e}function wR(e,r,t){return(Me(t)?t:[t]).map(o=>ra(e.items,r,o))}function FR(e,r,t){return ER(t)}function MR(e,r,t){return u5(t)}function AR(e,r,t){return TR(t)}function OR(e,r,t){return CR(t)}function BR(e,r,t){return e.allOf.reduce((n,o)=>ra(o,r,n),t)}function PR(e,r,t){return IR(e,t)}function kR(e,r,t){return SR(t)}function _R(e,r,t){return c5(t)}function LR(e,r,t){if(!Be(t))return t;for(let n of Object.getOwnPropertyNames(e.properties))Te(t,n)&&(t[n]=ra(e.properties[n],r,t[n]));return t}function RR(e,r,t){if(!Be(t))return t;let o=Object.getOwnPropertyNames(e.patternProperties)[0],i=e.patternProperties[o];for(let[s,u]of Object.entries(t))t[s]=ra(i,r,u);return t}function NR(e,r,t){return ra(Qe(e,r),r,t)}function $R(e,r,t){return l5(t)}function jR(e,r,t){return He(t)||ye(t)?Symbol(t):t}function UR(e,r,t){return ra(Qe(e,r),r,t)}function GR(e,r,t){return Me(t)&&!Wt(e.items)?t.map((o,i)=>i<e.items.length?ra(e.items[i],r,o):o):t}function zR(e,r,t){return DR(t)}function VR(e,r,t){for(let n of e.anyOf){let o=ra(n,r,et(t));if(Le(n,r,o))return o}return t}function ra(e,r,t){let n=Fo(e,r),o=e;switch(e[j]){case"Array":return wR(o,n,t);case"BigInt":return FR(o,n,t);case"Boolean":return MR(o,n,t);case"Date":return AR(o,n,t);case"Integer":return OR(o,n,t);case"Intersect":return BR(o,n,t);case"Literal":return PR(o,n,t);case"Null":return kR(o,n,t);case"Number":return _R(o,n,t);case"Object":return LR(o,n,t);case"Record":return RR(o,n,t);case"Ref":return NR(o,n,t);case"String":return $R(o,n,t);case"Symbol":return jR(o,n,t);case"This":return UR(o,n,t);case"Tuple":return GR(o,n,t);case"Undefined":return zR(o,n,t);case"Union":return VR(o,n,t);default:return t}}function Bg(...e){return e.length===3?ra(e[0],e[1],e[2]):ra(e[0],[],e[1])}p();p();var rp=class extends Se{constructor(r,t,n){super("Unable to decode value as it does not match the expected schema"),this.schema=r,this.value=t,this.error=n}},tl=class extends Se{constructor(r,t,n,o){super(o instanceof Error?o.message:"Unknown error"),this.schema=r,this.path=t,this.value=n,this.error=o}};function Xt(e,r,t){try{return Pt(e)?e[jt].Decode(t):t}catch(n){throw new tl(e,r,t,n)}}function HR(e,r,t,n){return Me(n)?Xt(e,t,n.map((o,i)=>na(e.items,r,`${t}/${i}`,o))):Xt(e,t,n)}function ZR(e,r,t,n){if(!Be(n)||zr(n))return Xt(e,t,n);let o=Ks(e),i=o.map(d=>d[0]),s={...n};for(let[d,f]of o)d in s&&(s[d]=na(f,r,`${t}/${d}`,s[d]));if(!Pt(e.unevaluatedProperties))return Xt(e,t,s);let u=Object.getOwnPropertyNames(s),l=e.unevaluatedProperties,c={...s};for(let d of u)i.includes(d)||(c[d]=Xt(l,`${t}/${d}`,c[d]));return Xt(e,t,c)}function WR(e,r,t,n){return Xt(e,t,na(e.not,r,t,n))}function XR(e,r,t,n){if(!Be(n))return Xt(e,t,n);let o=Or(e),i={...n};for(let c of o)Te(i,c)&&(Wt(i[c])&&(!_c(e.properties[c])||mt.IsExactOptionalProperty(i,c))||(i[c]=na(e.properties[c],r,`${t}/${c}`,i[c])));if(!Ze(e.additionalProperties))return Xt(e,t,i);let s=Object.getOwnPropertyNames(i),u=e.additionalProperties,l={...i};for(let c of s)o.includes(c)||(l[c]=Xt(u,`${t}/${c}`,l[c]));return Xt(e,t,l)}function JR(e,r,t,n){if(!Be(n))return Xt(e,t,n);let o=Object.getOwnPropertyNames(e.patternProperties)[0],i=new RegExp(o),s={...n};for(let d of Object.getOwnPropertyNames(n))i.test(d)&&(s[d]=na(e.patternProperties[o],r,`${t}/${d}`,s[d]));if(!Ze(e.additionalProperties))return Xt(e,t,s);let u=Object.getOwnPropertyNames(s),l=e.additionalProperties,c={...s};for(let d of u)i.test(d)||(c[d]=Xt(l,`${t}/${d}`,c[d]));return Xt(e,t,c)}function YR(e,r,t,n){let o=Qe(e,r);return Xt(e,t,na(o,r,t,n))}function KR(e,r,t,n){let o=Qe(e,r);return Xt(e,t,na(o,r,t,n))}function qR(e,r,t,n){return Me(n)&&Me(e.items)?Xt(e,t,e.items.map((o,i)=>na(o,r,`${t}/${i}`,n[i]))):Xt(e,t,n)}function QR(e,r,t,n){for(let o of e.anyOf){if(!Le(o,r,n))continue;let i=na(o,r,t,n);return Xt(e,t,i)}return Xt(e,t,n)}function na(e,r,t,n){let o=Fo(e,r),i=e;switch(e[j]){case"Array":return HR(i,o,t,n);case"Intersect":return ZR(i,o,t,n);case"Not":return WR(i,o,t,n);case"Object":return XR(i,o,t,n);case"Record":return JR(i,o,t,n);case"Ref":return YR(i,o,t,n);case"Symbol":return Xt(i,t,n);case"This":return KR(i,o,t,n);case"Tuple":return qR(i,o,t,n);case"Union":return QR(i,o,t,n);default:return Xt(i,t,n)}}function np(e,r,t){return na(e,r,"",t)}p();var op=class extends Se{constructor(r,t,n){super("The encoded value does not match the expected schema"),this.schema=r,this.value=t,this.error=n}},rl=class extends Se{constructor(r,t,n,o){super(`${o instanceof Error?o.message:"Unknown error"}`),this.schema=r,this.path=t,this.value=n,this.error=o}};function un(e,r,t){try{return Pt(e)?e[jt].Encode(t):t}catch(n){throw new rl(e,r,t,n)}}function eN(e,r,t,n){let o=un(e,t,n);return Me(o)?o.map((i,s)=>oa(e.items,r,`${t}/${s}`,i)):o}function tN(e,r,t,n){let o=un(e,t,n);if(!Be(n)||zr(n))return o;let i=Ks(e),s=i.map(f=>f[0]),u={...o};for(let[f,h]of i)f in u&&(u[f]=oa(h,r,`${t}/${f}`,u[f]));if(!Pt(e.unevaluatedProperties))return u;let l=Object.getOwnPropertyNames(u),c=e.unevaluatedProperties,d={...u};for(let f of l)s.includes(f)||(d[f]=un(c,`${t}/${f}`,d[f]));return d}function rN(e,r,t,n){return un(e.not,t,un(e,t,n))}function nN(e,r,t,n){let o=un(e,t,n);if(!Be(o))return o;let i=Or(e),s={...o};for(let d of i)Te(s,d)&&(Wt(s[d])&&(!_c(e.properties[d])||mt.IsExactOptionalProperty(s,d))||(s[d]=oa(e.properties[d],r,`${t}/${d}`,s[d])));if(!Ze(e.additionalProperties))return s;let u=Object.getOwnPropertyNames(s),l=e.additionalProperties,c={...s};for(let d of u)i.includes(d)||(c[d]=un(l,`${t}/${d}`,c[d]));return c}function oN(e,r,t,n){let o=un(e,t,n);if(!Be(n))return o;let i=Object.getOwnPropertyNames(e.patternProperties)[0],s=new RegExp(i),u={...o};for(let f of Object.getOwnPropertyNames(n))s.test(f)&&(u[f]=oa(e.patternProperties[i],r,`${t}/${f}`,u[f]));if(!Ze(e.additionalProperties))return u;let l=Object.getOwnPropertyNames(u),c=e.additionalProperties,d={...u};for(let f of l)s.test(f)||(d[f]=un(c,`${t}/${f}`,d[f]));return d}function iN(e,r,t,n){let o=Qe(e,r),i=oa(o,r,t,n);return un(e,t,i)}function aN(e,r,t,n){let o=Qe(e,r),i=oa(o,r,t,n);return un(e,t,i)}function sN(e,r,t,n){let o=un(e,t,n);return Me(e.items)?e.items.map((i,s)=>oa(i,r,`${t}/${s}`,o[s])):[]}function uN(e,r,t,n){for(let o of e.anyOf){if(!Le(o,r,n))continue;let i=oa(o,r,t,n);return un(e,t,i)}for(let o of e.anyOf){let i=oa(o,r,t,n);if(Le(e,r,i))return un(e,t,i)}return un(e,t,n)}function oa(e,r,t,n){let o=Fo(e,r),i=e;switch(e[j]){case"Array":return eN(i,o,t,n);case"Intersect":return tN(i,o,t,n);case"Not":return rN(i,o,t,n);case"Object":return nN(i,o,t,n);case"Record":return oN(i,o,t,n);case"Ref":return iN(i,o,t,n);case"This":return aN(i,o,t,n);case"Tuple":return sN(i,o,t,n);case"Union":return uN(i,o,t,n);default:return un(i,t,n)}}function Pg(e,r,t){return oa(e,r,"",t)}p();function lN(e,r){return Pt(e)||Br(e.items,r)}function cN(e,r){return Pt(e)||Br(e.items,r)}function pN(e,r){return Pt(e)||Br(e.returns,r)||e.parameters.some(t=>Br(t,r))}function dN(e,r){return Pt(e)||Br(e.returns,r)||e.parameters.some(t=>Br(t,r))}function mN(e,r){return Pt(e)||Pt(e.unevaluatedProperties)||e.allOf.some(t=>Br(t,r))}function fN(e,r){return Pt(e)||Br(e.items,r)}function hN(e,r){return Pt(e)||Br(e.not,r)}function gN(e,r){return Pt(e)||Object.values(e.properties).some(t=>Br(t,r))||Ze(e.additionalProperties)&&Br(e.additionalProperties,r)}function yN(e,r){return Pt(e)||Br(e.item,r)}function bN(e,r){let t=Object.getOwnPropertyNames(e.patternProperties)[0],n=e.patternProperties[t];return Pt(e)||Br(n,r)||Ze(e.additionalProperties)&&Pt(e.additionalProperties)}function vN(e,r){return Pt(e)?!0:Br(Qe(e,r),r)}function xN(e,r){return Pt(e)?!0:Br(Qe(e,r),r)}function IN(e,r){return Pt(e)||!Wt(e.items)&&e.items.some(t=>Br(t,r))}function EN(e,r){return Pt(e)||e.anyOf.some(t=>Br(t,r))}function Br(e,r){let t=Fo(e,r),n=e;if(e.$id&&Bv.has(e.$id))return!1;switch(e.$id&&Bv.add(e.$id),e[j]){case"Array":return lN(n,t);case"AsyncIterator":return cN(n,t);case"Constructor":return pN(n,t);case"Function":return dN(n,t);case"Intersect":return mN(n,t);case"Iterator":return fN(n,t);case"Not":return hN(n,t);case"Object":return gN(n,t);case"Promise":return yN(n,t);case"Record":return bN(n,t);case"Ref":return vN(n,t);case"This":return xN(n,t);case"Tuple":return IN(n,t);case"Union":return EN(n,t);default:return Pt(e)}}var Bv=new Set;function ia(e,r){return Bv.clear(),Br(e,r)}function p5(...e){let[r,t,n]=e.length===3?[e[0],e[1],e[2]]:[e[0],[],e[1]];if(!Le(r,t,n))throw new rp(r,n,ea(r,t,n).First());return ia(r,t)?np(r,t,n):n}p();function Qa(e,r){let t=Te(e,"default")?e.default:void 0,n=Zs(t)?t():et(t);return Wt(r)?n:Be(r)&&Be(n)?Object.assign(n,r):r}function Pv(e){return Xs(e)&&"default"in e}function CN(e,r,t){let n=Qa(e,t);if(!Me(n))return n;for(let o=0;o<n.length;o++)n[o]=ro(e.items,r,n[o]);return n}function SN(e,r,t){return mn(t)?t:Qa(e,t)}function DN(e,r,t){let n=Qa(e,t);return e.allOf.reduce((o,i)=>{let s=ro(i,r,n);return Be(s)?{...o,...s}:s},{})}function TN(e,r,t){let n=Qa(e,t);if(!Be(n))return n;let o=Object.getOwnPropertyNames(e.properties);for(let i of o){let s=ro(e.properties[i],r,n[i]);Wt(s)||(n[i]=ro(e.properties[i],r,n[i]))}if(!Pv(e.additionalProperties))return n;for(let i of Object.getOwnPropertyNames(n))o.includes(i)||(n[i]=ro(e.additionalProperties,r,n[i]));return n}function wN(e,r,t){let n=Qa(e,t);if(!Be(n))return n;let o=e.additionalProperties,[i,s]=Object.entries(e.patternProperties)[0],u=new RegExp(i);for(let l of Object.getOwnPropertyNames(n))u.test(l)&&Pv(s)&&(n[l]=ro(s,r,n[l]));if(!Pv(o))return n;for(let l of Object.getOwnPropertyNames(n))u.test(l)||(n[l]=ro(o,r,n[l]));return n}function FN(e,r,t){return ro(Qe(e,r),r,Qa(e,t))}function MN(e,r,t){return ro(Qe(e,r),r,t)}function AN(e,r,t){let n=Qa(e,t);if(!Me(n)||Wt(e.items))return n;let[o,i]=[e.items,Math.max(e.items.length,n.length)];for(let s=0;s<i;s++)s<o.length&&(n[s]=ro(o[s],r,n[s]));return n}function ON(e,r,t){let n=Qa(e,t);for(let o of e.anyOf){let i=ro(o,r,et(n));if(Le(o,r,i))return i}return n}function ro(e,r,t){let n=Fo(e,r),o=e;switch(o[j]){case"Array":return CN(o,n,t);case"Date":return SN(o,n,t);case"Intersect":return DN(o,n,t);case"Object":return TN(o,n,t);case"Record":return wN(o,n,t);case"Ref":return FN(o,n,t);case"This":return MN(o,n,t);case"Tuple":return AN(o,n,t);case"Union":return ON(o,n,t);default:return Qa(o,t)}}function kg(...e){return e.length===3?ro(e[0],e[1],e[2]):ro(e[0],[],e[1])}p();p();var ai={};$s(ai,{Delete:()=>PN,Format:()=>Xm,Get:()=>_N,Has:()=>kN,Set:()=>BN,ValuePointerRootDeleteError:()=>Lg,ValuePointerRootSetError:()=>_g});p();var _g=class extends Se{constructor(r,t,n){super("Cannot set root value"),this.value=r,this.path=t,this.update=n}},Lg=class extends Se{constructor(r,t){super("Cannot delete root value"),this.value=r,this.path=t}};function d5(e){return e.indexOf("~")===-1?e:e.replace(/~1/g,"/").replace(/~0/g,"~")}function*Xm(e){if(e==="")return;let[r,t]=[0,0];for(let n=0;n<e.length;n++)e.charAt(n)==="/"?(n===0||(t=n,yield d5(e.slice(r,t))),r=n+1):t=n;yield d5(e.slice(r))}function BN(e,r,t){if(r==="")throw new _g(e,r,t);let[n,o,i]=[null,e,""];for(let s of Xm(r))o[s]===void 0&&(o[s]={}),n=o,o=o[s],i=s;n[i]=t}function PN(e,r){if(r==="")throw new Lg(e,r);let[t,n,o]=[null,e,""];for(let i of Xm(r)){if(n[i]===void 0||n[i]===null)return;t=n,n=n[i],o=i}if(Array.isArray(t)){let i=parseInt(o);t.splice(i,1)}else delete t[o]}function kN(e,r){if(r==="")return!0;let[t,n,o]=[null,e,""];for(let i of Xm(r)){if(n[i]===void 0)return!1;t=n,n=n[i],o=i}return Object.getOwnPropertyNames(t).includes(o)}function _N(e,r){if(r==="")return e;let t=e;for(let n of Xm(r)){if(t[n]===void 0)return;t=t[n]}return t}p();function LN(e,r){if(!Be(r))return!1;let t=[...Object.keys(e),...Object.getOwnPropertySymbols(e)],n=[...Object.keys(r),...Object.getOwnPropertySymbols(r)];return t.length!==n.length?!1:t.every(o=>nl(e[o],r[o]))}function RN(e,r){return mn(r)&&e.getTime()===r.getTime()}function NN(e,r){return!Me(r)||e.length!==r.length?!1:e.every((t,n)=>nl(t,r[n]))}function $N(e,r){return!Io(r)||e.length!==r.length||Object.getPrototypeOf(e).constructor.name!==Object.getPrototypeOf(r).constructor.name?!1:e.every((t,n)=>nl(t,r[n]))}function jN(e,r){return e===r}function nl(e,r){if(mn(e))return RN(e,r);if(Io(e))return $N(e,r);if(Me(e))return NN(e,r);if(Be(e))return LN(e,r);if(zr(e))return jN(e,r);throw new Error("ValueEquals: Unable to compare value")}var UN=Ct({type:lt("insert"),path:Co(),value:Ya()}),GN=Ct({type:lt("update"),path:Co(),value:Ya()}),zN=Ct({type:lt("delete"),path:Co()}),f5=yt([UN,GN,zN]),Rg=class extends Se{constructor(r,t){super(t),this.value=r}};function Ng(e,r){return{type:"update",path:e,value:r}}function h5(e,r){return{type:"insert",path:e,value:r}}function g5(e){return{type:"delete",path:e}}function m5(e){if(globalThis.Object.getOwnPropertySymbols(e).length>0)throw new Rg(e,"Cannot diff objects with symbols")}function*VN(e,r,t){if(m5(r),m5(t),!Lb(t))return yield Ng(e,t);let n=globalThis.Object.getOwnPropertyNames(r),o=globalThis.Object.getOwnPropertyNames(t);for(let i of o)Te(r,i)||(yield h5(`${e}/${i}`,t[i]));for(let i of n)Te(t,i)&&(nl(r,t)||(yield*$g(`${e}/${i}`,r[i],t[i])));for(let i of n)Te(t,i)||(yield g5(`${e}/${i}`))}function*HN(e,r,t){if(!Me(t))return yield Ng(e,t);for(let n=0;n<Math.min(r.length,t.length);n++)yield*$g(`${e}/${n}`,r[n],t[n]);for(let n=0;n<t.length;n++)n<r.length||(yield h5(`${e}/${n}`,t[n]));for(let n=r.length-1;n>=0;n--)n<t.length||(yield g5(`${e}/${n}`))}function*ZN(e,r,t){if(!Io(t)||r.length!==t.length||globalThis.Object.getPrototypeOf(r).constructor.name!==globalThis.Object.getPrototypeOf(t).constructor.name)return yield Ng(e,t);for(let n=0;n<Math.min(r.length,t.length);n++)yield*$g(`${e}/${n}`,r[n],t[n])}function*WN(e,r,t){r!==t&&(yield Ng(e,t))}function*$g(e,r,t){if(Lb(r))return yield*VN(e,r,t);if(Me(r))return yield*HN(e,r,t);if(Io(r))return yield*ZN(e,r,t);if(zr(r))return yield*WN(e,r,t);throw new Rg(r,"Unable to diff value")}function y5(e,r){return[...$g("",e,r)]}function XN(e){return e.length>0&&e[0].path===""&&e[0].type==="update"}function JN(e){return e.length===0}function b5(e,r){if(XN(r))return et(r[0].value);if(JN(r))return et(e);let t=et(e);for(let n of r)switch(n.type){case"insert":{ai.Set(t,n.path,n.value);break}case"update":{ai.Set(t,n.path,n.value);break}case"delete":{ai.Delete(t,n.path);break}}return t}p();function v5(...e){let[r,t,n]=e.length===3?[e[0],e[1],e[2]]:[e[0],[],e[1]],o=ia(r,t)?Pg(r,t,n):n;if(!Le(r,t,o))throw new op(r,o,ea(r,t,o).First());return o}p();var jg=class extends Se{constructor(r){super(r)}};function YN(e,r,t,n){if(!Be(t))ai.Set(e,r,et(n));else{let o=Object.getOwnPropertyNames(t),i=Object.getOwnPropertyNames(n);for(let s of o)i.includes(s)||delete t[s];for(let s of i)o.includes(s)||(t[s]=null);for(let s of i)kv(e,`${r}/${s}`,t[s],n[s])}}function KN(e,r,t,n){if(!Me(t))ai.Set(e,r,et(n));else{for(let o=0;o<n.length;o++)kv(e,`${r}/${o}`,t[o],n[o]);t.splice(n.length)}}function qN(e,r,t,n){if(Io(t)&&t.length===n.length)for(let o=0;o<t.length;o++)t[o]=n[o];else ai.Set(e,r,et(n))}function QN(e,r,t,n){t!==n&&ai.Set(e,r,n)}function kv(e,r,t,n){if(Me(n))return KN(e,r,t,n);if(Io(n))return qN(e,r,t,n);if(Be(n))return YN(e,r,t,n);if(zr(n))return QN(e,r,t,n)}function x5(e){return Io(e)||zr(e)}function e$(e,r){return Be(e)&&Me(r)||Me(e)&&Be(r)}function I5(e,r){if(x5(e)||x5(r))throw new jg("Only object and array types can be mutated at the root level");if(e$(e,r))throw new jg("Cannot assign due type mismatch of assignable values");kv(e,"",e,r)}p();var t$=[(e,r,t)=>et(t),(e,r,t)=>kg(e,r,t),(e,r,t)=>Ag(e,r,t),(e,r,t)=>Bg(e,r,t),(e,r,t)=>(Fg(e,r,t),t),(e,r,t)=>ia(e,r)?np(e,r,t):t];function E5(e,r,t){return t$.reduce((n,o)=>o(e,r,n),t)}function C5(...e){return e.length===3?E5(e[0],e[1],e[2]):E5(e[0],[],e[1])}p();var si={};$s(si,{Assert:()=>Fg,Cast:()=>Ov,Check:()=>Le,Clean:()=>Ag,Clone:()=>et,Convert:()=>Bg,Create:()=>Ao,Decode:()=>p5,Default:()=>kg,Diff:()=>y5,Edit:()=>f5,Encode:()=>v5,Equal:()=>nl,Errors:()=>ea,Hash:()=>eu,Mutate:()=>I5,Parse:()=>C5,Patch:()=>b5,ValueErrorIterator:()=>Mo});p();p();var S5={},r$=function(e,r,t,n,o){var i=new Worker(S5[r]||(S5[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(s){var u=s.data,l=u.$e$;if(l){var c=new Error(l[0]);c.code=l[1],c.stack=l[2],o(c,null)}else o(null,u)},i.postMessage(t,n),i},St=Uint8Array,gn=Uint16Array,qm=Int32Array,lp=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]),cp=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]),Jm=new St([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),w5=function(e,r){for(var t=new gn(31),n=0;n<31;++n)t[n]=r+=1<<e[n-1];for(var o=new qm(t[30]),n=1;n<30;++n)for(var i=t[n];i<t[n+1];++i)o[i]=i-t[n]<<5|n;return{b:t,r:o}},F5=w5(lp,2),jv=F5.b,Hg=F5.r;jv[28]=258,Hg[258]=28;var M5=w5(cp,0),A5=M5.b,Lv=M5.r,Ym=new gn(32768);for(ct=0;ct<32768;++ct)es=(ct&43690)>>1|(ct&21845)<<1,es=(es&52428)>>2|(es&13107)<<2,es=(es&61680)>>4|(es&3855)<<4,Ym[ct]=((es&65280)>>8|(es&255)<<8)>>1;var es,ct,Bo=function(e,r,t){for(var n=e.length,o=0,i=new gn(r);o<n;++o)e[o]&&++i[e[o]-1];var s=new gn(r);for(o=1;o<r;++o)s[o]=s[o-1]+i[o-1]<<1;var u;if(t){u=new gn(1<<r);var l=15-r;for(o=0;o<n;++o)if(e[o])for(var c=o<<4|e[o],d=r-e[o],f=s[e[o]-1]++<<d,h=f|(1<<d)-1;f<=h;++f)u[Ym[f]>>l]=c}else for(u=new gn(n),o=0;o<n;++o)e[o]&&(u[o]=Ym[s[e[o]-1]++]>>15-e[o]);return u},ts=new St(288);for(ct=0;ct<144;++ct)ts[ct]=8;var ct;for(ct=144;ct<256;++ct)ts[ct]=9;var ct;for(ct=256;ct<280;++ct)ts[ct]=7;var ct;for(ct=280;ct<288;++ct)ts[ct]=8;var ct,sp=new St(32);for(ct=0;ct<32;++ct)sp[ct]=5;var ct,O5=Bo(ts,9,0),B5=Bo(ts,9,1),P5=Bo(sp,5,0),k5=Bo(sp,5,1),Gg=function(e){for(var r=e[0],t=1;t<e.length;++t)e[t]>r&&(r=e[t]);return r},Oo=function(e,r,t){var n=r/8|0;return(e[n]|e[n+1]<<8)>>(r&7)&t},zg=function(e,r){var t=r/8|0;return(e[t]|e[t+1]<<8|e[t+2]<<16)>>(r&7)},Qm=function(e){return(e+7)/8|0},tu=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))},Jg={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},_5=["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"],Jt=function(e,r,t){var n=new Error(r||_5[e]);if(n.code=e,Error.captureStackTrace&&Error.captureStackTrace(n,Jt),!t)throw n;return n},L5=function(e,r,t,n){var o=e.length,i=n?n.length:0;if(!o||r.f&&!r.l)return t||new St(0);var s=!t,u=s||r.i!=2,l=r.i;s&&(t=new St(o*3));var c=function(O){var Q=t.length;if(O>Q){var X=new St(Math.max(Q*2,O));X.set(t),t=X}},d=r.f||0,f=r.p||0,h=r.b||0,b=r.l,I=r.d,E=r.m,v=r.n,x=o*8;do{if(!b){d=Oo(e,f,1);var D=Oo(e,f+1,3);if(f+=3,D)if(D==1)b=B5,I=k5,E=9,v=5;else if(D==2){var P=Oo(e,f,31)+257,L=Oo(e,f+10,15)+4,N=P+Oo(e,f+5,31)+1;f+=14;for(var $=new St(N),W=new St(19),V=0;V<L;++V)W[Jm[V]]=Oo(e,f+V*3,7);f+=L*3;for(var q=Gg(W),se=(1<<q)-1,ue=Bo(W,q,1),V=0;V<N;){var ce=ue[Oo(e,f,se)];f+=ce&15;var w=ce>>4;if(w<16)$[V++]=w;else{var de=0,Ee=0;for(w==16?(Ee=3+Oo(e,f,3),f+=2,de=$[V-1]):w==17?(Ee=3+Oo(e,f,7),f+=3):w==18&&(Ee=11+Oo(e,f,127),f+=7);Ee--;)$[V++]=de}}var he=$.subarray(0,P),ne=$.subarray(P);E=Gg(he),v=Gg(ne),b=Bo(he,E,1),I=Bo(ne,v,1)}else Jt(1);else{var w=Qm(f)+4,S=e[w-4]|e[w-3]<<8,F=w+S;if(F>o){l&&Jt(0);break}u&&c(h+S),t.set(e.subarray(w,F),h),r.b=h+=S,r.p=f=F*8,r.f=d;continue}if(f>x){l&&Jt(0);break}}u&&c(h+131072);for(var Ce=(1<<E)-1,xe=(1<<v)-1,Re=f;;Re=f){var de=b[zg(e,f)&Ce],we=de>>4;if(f+=de&15,f>x){l&&Jt(0);break}if(de||Jt(2),we<256)t[h++]=we;else if(we==256){Re=f,b=null;break}else{var Ve=we-254;if(we>264){var V=we-257,me=lp[V];Ve=Oo(e,f,(1<<me)-1)+jv[V],f+=me}var at=I[zg(e,f)&xe],xt=at>>4;at||Jt(3),f+=at&15;var ne=A5[xt];if(xt>3){var me=cp[xt];ne+=zg(e,f)&(1<<me)-1,f+=me}if(f>x){l&&Jt(0);break}u&&c(h+131072);var Ot=h+Ve;if(h<ne){var A=i-ne,Z=Math.min(ne,Ot);for(A+h<0&&Jt(3);h<Z;++h)t[h]=n[A+h]}for(;h<Ot;++h)t[h]=t[h-ne]}}r.l=b,r.p=Re,r.b=h,r.f=d,b&&(d=1,r.m=E,r.d=I,r.n=v)}while(!d);return h!=t.length&&s?tu(t,0,h):t.subarray(0,h)},aa=function(e,r,t){t<<=r&7;var n=r/8|0;e[n]|=t,e[n+1]|=t>>8},ip=function(e,r,t){t<<=r&7;var n=r/8|0;e[n]|=t,e[n+1]|=t>>8,e[n+2]|=t>>16},Vg=function(e,r){for(var t=[],n=0;n<e.length;++n)e[n]&&t.push({s:n,f:e[n]});var o=t.length,i=t.slice();if(!o)return{t:Gv,l:0};if(o==1){var s=new St(t[0].s+1);return s[t[0].s]=1,{t:s,l:1}}t.sort(function(F,P){return F.f-P.f}),t.push({s:-1,f:25001});var u=t[0],l=t[1],c=0,d=1,f=2;for(t[0]={s:-1,f:u.f+l.f,l:u,r:l};d!=o-1;)u=t[t[c].f<t[f].f?c++:f++],l=t[c!=d&&t[c].f<t[f].f?c++:f++],t[d++]={s:-1,f:u.f+l.f,l:u,r:l};for(var h=i[0].s,n=1;n<o;++n)i[n].s>h&&(h=i[n].s);var b=new gn(h+1),I=Zg(t[d-1],b,0);if(I>r){var n=0,E=0,v=I-r,x=1<<v;for(i.sort(function(P,L){return b[L.s]-b[P.s]||P.f-L.f});n<o;++n){var D=i[n].s;if(b[D]>r)E+=x-(1<<I-b[D]),b[D]=r;else break}for(E>>=v;E>0;){var w=i[n].s;b[w]<r?E-=1<<r-b[w]++-1:++n}for(;n>=0&&E;--n){var S=i[n].s;b[S]==r&&(--b[S],++E)}I=r}return{t:new St(b),l:I}},Zg=function(e,r,t){return e.s==-1?Math.max(Zg(e.l,r,t+1),Zg(e.r,r,t+1)):r[e.s]=t},Rv=function(e){for(var r=e.length;r&&!e[--r];);for(var t=new gn(++r),n=0,o=e[0],i=1,s=function(l){t[n++]=l},u=1;u<=r;++u)if(e[u]==o&&u!=r)++i;else{if(!o&&i>2){for(;i>138;i-=138)s(32754);i>2&&(s(i>10?i-11<<5|28690:i-3<<5|12305),i=0)}else if(i>3){for(s(o),--i;i>6;i-=6)s(8304);i>2&&(s(i-3<<5|8208),i=0)}for(;i--;)s(o);i=1,o=e[u]}return{c:t.subarray(0,n),n:r}},ap=function(e,r){for(var t=0,n=0;n<r.length;++n)t+=e[n]*r[n];return t},Uv=function(e,r,t){var n=t.length,o=Qm(r+2);e[o]=n&255,e[o+1]=n>>8,e[o+2]=e[o]^255,e[o+3]=e[o+1]^255;for(var i=0;i<n;++i)e[o+i+4]=t[i];return(o+4+n)*8},Nv=function(e,r,t,n,o,i,s,u,l,c,d){aa(r,d++,t),++o[256];for(var f=Vg(o,15),h=f.t,b=f.l,I=Vg(i,15),E=I.t,v=I.l,x=Rv(h),D=x.c,w=x.n,S=Rv(E),F=S.c,P=S.n,L=new gn(19),N=0;N<D.length;++N)++L[D[N]&31];for(var N=0;N<F.length;++N)++L[F[N]&31];for(var $=Vg(L,7),W=$.t,V=$.l,q=19;q>4&&!W[Jm[q-1]];--q);var se=c+5<<3,ue=ap(o,ts)+ap(i,sp)+s,ce=ap(o,h)+ap(i,E)+s+14+3*q+ap(L,W)+2*L[16]+3*L[17]+7*L[18];if(l>=0&&se<=ue&&se<=ce)return Uv(r,d,e.subarray(l,l+c));var de,Ee,he,ne;if(aa(r,d,1+(ce<ue)),d+=2,ce<ue){de=Bo(h,b,0),Ee=h,he=Bo(E,v,0),ne=E;var Ce=Bo(W,V,0);aa(r,d,w-257),aa(r,d+5,P-1),aa(r,d+10,q-4),d+=14;for(var N=0;N<q;++N)aa(r,d+3*N,W[Jm[N]]);d+=3*q;for(var xe=[D,F],Re=0;Re<2;++Re)for(var we=xe[Re],N=0;N<we.length;++N){var Ve=we[N]&31;aa(r,d,Ce[Ve]),d+=W[Ve],Ve>15&&(aa(r,d,we[N]>>5&127),d+=we[N]>>12)}}else de=O5,Ee=ts,he=P5,ne=sp;for(var N=0;N<u;++N){var me=n[N];if(me>255){var Ve=me>>18&31;ip(r,d,de[Ve+257]),d+=Ee[Ve+257],Ve>7&&(aa(r,d,me>>23&31),d+=lp[Ve]);var at=me&31;ip(r,d,he[at]),d+=ne[at],at>3&&(ip(r,d,me>>5&8191),d+=cp[at])}else ip(r,d,de[me]),d+=Ee[me]}return ip(r,d,de[256]),d+Ee[256]},R5=new qm([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Gv=new St(0),N5=function(e,r,t,n,o,i){var s=i.z||e.length,u=new St(n+s+5*(1+Math.ceil(s/7e3))+o),l=u.subarray(n,u.length-o),c=i.l,d=(i.r||0)&7;if(r){d&&(l[0]=i.r>>3);for(var f=R5[r-1],h=f>>13,b=f&8191,I=(1<<t)-1,E=i.p||new gn(32768),v=i.h||new gn(I+1),x=Math.ceil(t/3),D=2*x,w=function(Y){return(e[Y]^e[Y+1]<<x^e[Y+2]<<D)&I},S=new qm(25e3),F=new gn(288),P=new gn(32),L=0,N=0,$=i.i||0,W=0,V=i.w||0,q=0;$+2<s;++$){var se=w($),ue=$&32767,ce=v[se];if(E[ue]=ce,v[se]=ue,V<=$){var de=s-$;if((L>7e3||W>24576)&&(de>423||!c)){d=Nv(e,l,0,S,F,P,N,W,q,$-q,d),W=L=N=0,q=$;for(var Ee=0;Ee<286;++Ee)F[Ee]=0;for(var Ee=0;Ee<30;++Ee)P[Ee]=0}var he=2,ne=0,Ce=b,xe=ue-ce&32767;if(de>2&&se==w($-xe))for(var Re=Math.min(h,de)-1,we=Math.min(32767,$),Ve=Math.min(258,de);xe<=we&&--Ce&&ue!=ce;){if(e[$+he]==e[$+he-xe]){for(var me=0;me<Ve&&e[$+me]==e[$+me-xe];++me);if(me>he){if(he=me,ne=xe,me>Re)break;for(var at=Math.min(xe,me-2),xt=0,Ee=0;Ee<at;++Ee){var Ot=$-xe+Ee&32767,A=E[Ot],Z=Ot-A&32767;Z>xt&&(xt=Z,ce=Ot)}}}ue=ce,ce=E[ue],xe+=ue-ce&32767}if(ne){S[W++]=268435456|Hg[he]<<18|Lv[ne];var O=Hg[he]&31,Q=Lv[ne]&31;N+=lp[O]+cp[Q],++F[257+O],++P[Q],V=$+he,++L}else S[W++]=e[$],++F[e[$]]}}for($=Math.max($,V);$<s;++$)S[W++]=e[$],++F[e[$]];d=Nv(e,l,c,S,F,P,N,W,q,$-q,d),c||(i.r=d&7|l[d/8|0]<<3,d-=7,i.h=v,i.p=E,i.i=$,i.w=V)}else{for(var $=i.w||0;$<s+c;$+=65535){var X=$+65535;X>=s&&(l[d/8|0]=c,X=s),d=Uv(l,d+1,e.subarray($,X))}i.i=s}return tu(u,0,n+Qm(d)+o)},n$=function(){for(var e=new Int32Array(256),r=0;r<256;++r){for(var t=r,n=9;--n;)t=(t&1&&-306674912)^t>>>1;e[r]=t}return e}(),$5=function(){var e=-1;return{p:function(r){for(var t=e,n=0;n<r.length;++n)t=n$[t&255^r[n]]^t>>>8;e=t},d:function(){return~e}}};var j5=function(e,r,t,n,o){if(!o&&(o={l:1},r.dictionary)){var i=r.dictionary.subarray(-32768),s=new St(i.length+e.length);s.set(i),s.set(e,i.length),e=s,o.w=i.length}return N5(e,r.level==null?6:r.level,r.mem==null?o.l?Math.ceil(Math.max(8,Math.min(13,Math.log(e.length)))*1.5):20:12+r.mem,t,n,o)},Yg=function(e,r){var t={};for(var n in e)t[n]=e[n];for(var n in r)t[n]=r[n];return t},D5=function(e,r,t){for(var n=e(),o=e.toString(),i=o.slice(o.indexOf("[")+1,o.lastIndexOf("]")).replace(/\s+/g,"").split(","),s=0;s<n.length;++s){var u=n[s],l=i[s];if(typeof u=="function"){r+=";"+l+"=";var c=u.toString();if(u.prototype)if(c.indexOf("[native code]")!=-1){var d=c.indexOf(" ",8)+1;r+=c.slice(d,c.indexOf("(",d))}else{r+=c;for(var f in u.prototype)r+=";"+l+".prototype."+f+"="+u.prototype[f].toString()}else r+=c}else t[l]=u}return r},Ug=[],o$=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},i$=function(e,r,t,n){if(!Ug[t]){for(var o="",i={},s=e.length-1,u=0;u<s;++u)o=D5(e[u],o,i);Ug[t]={c:D5(e[s],o,i),e:i}}var l=Yg({},Ug[t].e);return r$(Ug[t].c+";onmessage=function(e){for(var k in e.data)self[k]=e.data[k];onmessage="+r.toString()+"}",t,l,o$(l),n)},a$=function(){return[St,gn,qm,lp,cp,Jm,jv,A5,B5,k5,Ym,_5,Bo,Gg,Oo,zg,Qm,tu,Jt,L5,Qg,Kg,U5]},s$=function(){return[St,gn,qm,lp,cp,Jm,Hg,Lv,O5,ts,P5,sp,Ym,R5,Gv,Bo,aa,ip,Vg,Zg,Rv,ap,Uv,Nv,Qm,tu,N5,j5,qg,Kg]};var Kg=function(e){return postMessage(e,[e.buffer])},U5=function(e){return e&&{out:e.size&&new St(e.size),dictionary:e.dictionary}},G5=function(e,r,t,n,o,i){var s=i$(t,n,o,function(u,l){s.terminate(),i(u,l)});return s.postMessage([e,r],r.consume?[e.buffer]:[]),function(){s.terminate()}};var ui=function(e,r){return e[r]|e[r+1]<<8},Xr=function(e,r){return(e[r]|e[r+1]<<8|e[r+2]<<16|e[r+3]<<24)>>>0},_v=function(e,r){return Xr(e,r)+Xr(e,r+4)*4294967296},Wr=function(e,r,t){for(;t;++r)e[r]=t,t>>>=8};function u$(e,r,t){return t||(t=r,r={}),typeof t!="function"&&Jt(7),G5(e,r,[s$],function(n){return Kg(qg(n.data[0],n.data[1]))},0,t)}function qg(e,r){return j5(e,r||{},0,0)}function l$(e,r,t){return t||(t=r,r={}),typeof t!="function"&&Jt(7),G5(e,r,[a$],function(n){return Kg(Qg(n.data[0],U5(n.data[1])))},1,t)}function Qg(e,r){return L5(e,{i:2},r&&r.out,r&&r.dictionary)}var zv=function(e,r,t,n){for(var o in e){var i=e[o],s=r+o,u=n;Array.isArray(i)&&(u=Yg(n,i[1]),i=i[0]),i instanceof St?t[s]=[i,u]:(t[s+="/"]=[new St(0),u],zv(i,s,t,n))}},T5=typeof TextEncoder<"u"&&new TextEncoder,$v=typeof TextDecoder<"u"&&new TextDecoder,c$=0;try{$v.decode(Gv,{stream:!0}),c$=1}catch{}var p$=function(e){for(var r="",t=0;;){var n=e[t++],o=(n>127)+(n>223)+(n>239);if(t+o>e.length)return{s:r,r:tu(e,t-1)};o?o==3?(n=((n&15)<<18|(e[t++]&63)<<12|(e[t++]&63)<<6|e[t++]&63)-65536,r+=String.fromCharCode(55296|n>>10,56320|n&1023)):o&1?r+=String.fromCharCode((n&31)<<6|e[t++]&63):r+=String.fromCharCode((n&15)<<12|(e[t++]&63)<<6|e[t++]&63):r+=String.fromCharCode(n)}};function up(e,r){if(r){for(var t=new St(e.length),n=0;n<e.length;++n)t[n]=e.charCodeAt(n);return t}if(T5)return T5.encode(e);for(var o=e.length,i=new St(e.length+(e.length>>1)),s=0,u=function(d){i[s++]=d},n=0;n<o;++n){if(s+5>i.length){var l=new St(s+8+(o-n<<1));l.set(i),i=l}var c=e.charCodeAt(n);c<128||r?u(c):c<2048?(u(192|c>>6),u(128|c&63)):c>55295&&c<57344?(c=65536+(c&1047552)|e.charCodeAt(++n)&1023,u(240|c>>18),u(128|c>>12&63),u(128|c>>6&63),u(128|c&63)):(u(224|c>>12),u(128|c>>6&63),u(128|c&63))}return tu(i,0,s)}function Vv(e,r){if(r){for(var t="",n=0;n<e.length;n+=16384)t+=String.fromCharCode.apply(null,e.subarray(n,n+16384));return t}else{if($v)return $v.decode(e);var o=p$(e),i=o.s,t=o.r;return t.length&&Jt(8),i}}var z5=function(e,r){return r+30+ui(e,r+26)+ui(e,r+28)},V5=function(e,r,t){var n=ui(e,r+28),o=Vv(e.subarray(r+46,r+46+n),!(ui(e,r+8)&2048)),i=r+46+n,s=Xr(e,r+20),u=t&&s==4294967295?d$(e,i):[s,Xr(e,r+24),Xr(e,r+42)],l=u[0],c=u[1],d=u[2];return[ui(e,r+10),l,c,o,i+ui(e,r+30)+ui(e,r+32),d]},d$=function(e,r){for(;ui(e,r)!=1;r+=4+ui(e,r+2));return[_v(e,r+12),_v(e,r+4),_v(e,r+20)]},Km=function(e){var r=0;if(e)for(var t in e){var n=e[t].length;n>65535&&Jt(9),r+=n+4}return r},Wg=function(e,r,t,n,o,i,s,u){var l=n.length,c=t.extra,d=u&&u.length,f=Km(c);Wr(e,r,s!=null?33639248:67324752),r+=4,s!=null&&(e[r++]=20,e[r++]=t.os),e[r]=20,r+=2,e[r++]=t.flag<<1|(i<0&&8),e[r++]=o&&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)&&Jt(10),Wr(e,r,b<<25|h.getMonth()+1<<21|h.getDate()<<16|h.getHours()<<11|h.getMinutes()<<5|h.getSeconds()>>1),r+=4,i!=-1&&(Wr(e,r,t.crc),Wr(e,r+4,i<0?-i-2:i),Wr(e,r+8,t.size)),Wr(e,r+12,l),Wr(e,r+14,f),r+=16,s!=null&&(Wr(e,r,d),Wr(e,r+6,t.attrs),Wr(e,r+10,s),r+=14),e.set(n,r),r+=l,f)for(var I in c){var E=c[I],v=E.length;Wr(e,r,+I),Wr(e,r+2,v),e.set(E,r+4),r+=4+v}return d&&(e.set(u,r),r+=d),r},H5=function(e,r,t,n,o){Wr(e,r,101010256),Wr(e,r+8,t),Wr(e,r+10,t),Wr(e,r+12,n),Wr(e,r+16,o)};function Z5(e,r,t){t||(t=r,r={}),typeof t!="function"&&Jt(7);var n={};zv(e,"",n,r);var o=Object.keys(n),i=o.length,s=0,u=0,l=i,c=new Array(i),d=[],f=function(){for(var v=0;v<d.length;++v)d[v]()},h=function(v,x){Xg(function(){t(v,x)})};Xg(function(){h=t});var b=function(){var v=new St(u+22),x=s,D=u-s;u=0;for(var w=0;w<l;++w){var S=c[w];try{var F=S.c.length;Wg(v,u,S,S.f,S.u,F);var P=30+S.f.length+Km(S.extra),L=u+P;v.set(S.c,L),Wg(v,s,S,S.f,S.u,F,u,S.m),s+=16+P+(S.m?S.m.length:0),u=L+F}catch(N){return h(N,null)}}H5(v,s,c.length,D,x),h(null,v)};i||b();for(var I=function(v){var x=o[v],D=n[x],w=D[0],S=D[1],F=$5(),P=w.length;F.p(w);var L=up(x),N=L.length,$=S.comment,W=$&&up($),V=W&&W.length,q=Km(S.extra),se=S.level==0?0:8,ue=function(ce,de){if(ce)f(),h(ce,null);else{var Ee=de.length;c[v]=Yg(S,{size:P,crc:F.d(),c:de,f:L,m:W,u:N!=x.length||W&&$.length!=V,compression:se}),s+=30+N+q+Ee,u+=76+2*(N+q)+(V||0)+Ee,--i||b()}};if(N>65535&&ue(Jt(11,0,1),null),!se)ue(null,w);else if(P<16e4)try{ue(null,qg(w,S))}catch(ce){ue(ce,null)}else d.push(u$(w,S,ue))},E=0;E<l;++E)I(E);return f}function W5(e,r){r||(r={});var t={},n=[];zv(e,"",t,r);var o=0,i=0;for(var s in t){var u=t[s],l=u[0],c=u[1],d=c.level==0?0:8,f=up(s),h=f.length,b=c.comment,I=b&&up(b),E=I&&I.length,v=Km(c.extra);h>65535&&Jt(11);var x=d?qg(l,c):l,D=x.length,w=$5();w.p(l),n.push(Yg(c,{size:l.length,crc:w.d(),c:x,f,m:I,u:h!=s.length||I&&b.length!=E,o,compression:d})),o+=30+h+v+D,i+=76+2*(h+v)+(E||0)+D}for(var S=new St(i+22),F=o,P=i-o,L=0;L<n.length;++L){var f=n[L];Wg(S,f.o,f,f.f,f.u,f.c.length);var N=30+f.f.length+Km(f.extra);S.set(f.c,f.o+N),Wg(S,o,f,f.f,f.u,f.c.length,f.o,f.m),o+=16+N+(f.m?f.m.length:0)}return H5(S,o,n.length,P,F),S}var Xg=typeof queueMicrotask=="function"?queueMicrotask:typeof setTimeout=="function"?setTimeout:function(e){e()};function X5(e,r,t){t||(t=r,r={}),typeof t!="function"&&Jt(7);var n=[],o=function(){for(var v=0;v<n.length;++v)n[v]()},i={},s=function(v,x){Xg(function(){t(v,x)})};Xg(function(){s=t});for(var u=e.length-22;Xr(e,u)!=101010256;--u)if(!u||e.length-u>65558)return s(Jt(13,0,1),null),o;var l=ui(e,u+8);if(l){var c=l,d=Xr(e,u+16),f=d==4294967295||c==65535;if(f){var h=Xr(e,u-12);f=Xr(e,h)==101075792,f&&(c=l=Xr(e,h+32),d=Xr(e,h+48))}for(var b=r&&r.filter,I=function(v){var x=V5(e,d,f),D=x[0],w=x[1],S=x[2],F=x[3],P=x[4],L=x[5],N=z5(e,L);d=P;var $=function(V,q){V?(o(),s(V,null)):(q&&(i[F]=q),--l||s(null,i))};if(!b||b({name:F,size:w,originalSize:S,compression:D}))if(!D)$(null,tu(e,N,N+w));else if(D==8){var W=e.subarray(N,N+w);if(S<524288||w>.8*S)try{$(null,Qg(W,{out:new St(S)}))}catch(V){$(V,null)}else n.push(l$(W,{size:S},$))}else $(Jt(14,"unknown compression type "+D,1),null);else $(null,null)},E=0;E<c;++E)I(E)}else s(null,{});return o}function J5(e,r){for(var t={},n=e.length-22;Xr(e,n)!=101010256;--n)(!n||e.length-n>65558)&&Jt(13);var o=ui(e,n+8);if(!o)return{};var i=Xr(e,n+16),s=i==4294967295||o==65535;if(s){var u=Xr(e,n-12);s=Xr(e,u)==101075792,s&&(o=Xr(e,u+32),i=Xr(e,u+48))}for(var l=r&&r.filter,c=0;c<o;++c){var d=V5(e,i,s),f=d[0],h=d[1],b=d[2],I=d[3],E=d[4],v=d[5],x=z5(e,v);i=E,(!l||l({name:I,size:h,originalSize:b,compression:f}))&&(f?f==8?t[I]=Qg(e.subarray(x,x+h),{out:new St(b)}):Jt(14,"unknown compression type "+f):t[I]=tu(e,x,x+h))}return t}p();var m$=e=>{if(e!=null)return e.trim()===""?void 0:e},f$=e=>e!=null,ey=(e,r,t=0)=>{if(M.IsNull(e))return"null";if(M.IsUndefined(e))return"undefined";if(M.IsString(e))return"<string>";if(M.IsNumber(e))return"<number>";if(M.IsBoolean(e))return"<boolean>";if(M.IsLiteral(e))return typeof e.const=="string"?`'${e.const}'`:`${e.const}`;if(M.IsRef(e)){let n=r.find(o=>o.$id===e.$ref);return n==null?e.$ref:ey(n,r,t)}if(M.IsArray(e))return`${ey(e.items,r,t+1)}[]`;if(M.IsUnion(e)&&(!(e.anyOf.length>5)||e.$id==null)){let o=`${e.anyOf.map(i=>ey(i,r,t+1)).filter(f$).join(" | ")}`;return t>0?`(${o})`:o}return e.$id??""},h$=(e,r,t)=>{let n=r.message;return M.IsUnion(r.schema)&&(n=`Expected one of: ${ey(r.schema,t)}`),`${`#/definitions/${e}${m$(r.path)??""}`}: ${n}`},ty=(e,r,t)=>{let n=r.First();if(n!=null)return h$(e,n,t)};var pp;(function(e){e.Archive="Archive",e.Validate="Validate",e.Encode="Encode",e.Unknown="Unknown"})(pp||(pp={}));var dp=class extends Error{constructor(t,n){super(n);m(this,"name");m(this,"kind");this.name="CompressError",this.kind=t}},g$=e=>new dp(pp.Archive,e.message),y$=e=>{let r=Object.values(Jg);return e instanceof Error&&"code"in e&&typeof e.code=="number"&&r.includes(e.code)},b$=(e,r,t)=>new dp(pp.Validate,ty(e,r,t)??"Unknown validate error"),v$=e=>new dp(pp.Encode,e.message),x$=e=>new dp(pp.Unknown,e instanceof Error?e.message:String(e)),ef=(e,r,t)=>r instanceof rl?v$(r):r instanceof Mo?b$(e,r,t):y$(r)?g$(r):x$(r);p();var mp;(function(e){e.Unarchive="Unarchive",e.Validate="Validate",e.Decode="Decode",e.Unknown="Unknown"})(mp||(mp={}));var fp=class extends Error{constructor(t,n){super(n);m(this,"name");m(this,"kind");this.name="DecompressError",this.kind=t}},I$=e=>new fp(mp.Unarchive,e.message),E$=e=>{let r=Object.values(Jg);return e instanceof Error&&"code"in e&&typeof e.code=="number"&&r.includes(e.code)},C$=(e,r,t)=>new fp(mp.Validate,ty(e,r,t)??"Unknown validate error"),S$=e=>new fp(mp.Decode,e.message),D$=e=>new fp(mp.Unknown,e instanceof Error?e.message:String(e)),tf=(e,r,t)=>r instanceof tl?S$(r):r instanceof Mo?C$(e,r,t):E$(r)?I$(r):D$(r);var Y5=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,n]of Object.entries(e)){let o=r===""?t:`${r}.${t}`;yield*Y5(n,o)}}},T$=(e,r)=>e===""?r:r.startsWith("[")?`${e}${r}`:`${e}.${r}`,rr=(e,r,t)=>{let n=new Set;for(let[o,i]of Y5(e)){let s=r(i);if(n.has(s))return oe({kind:Rn.DuplicateIdError,properties:{id:s,path:T$(t,o)}});n.add(s)}return te(!0)};var K5=e=>e.floors==null?oe({kind:Rn.FloorMissingError,properties:null}):rr(e.floors.features,r=>r.properties.id,"floors");var q5=g.Intersect([g.Object({id:g.Ref(ze),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}))}),Kn],{$id:"FloorProperties"}),Q5=Vr(g.Union([g.Ref(Kc),g.Ref(qc),g.Null()]),g.Ref(q5),{$id:"FloorFeature"}),eD=hn(g.Ref(Q5),{$id:"FloorCollection"}),w$=g.Object({floors:g.Ref(eD)}),tD={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:K5,schema:w$,references:[q5,Q5,eD]};p();p();var nr=e=>g.Unsafe(e);p();var Xe=e=>Object.keys(e);p();p();var F$=e=>new Map(e.floors?.features.map(r=>[r.properties.id,r])??[]),li=e=>{let r=F$(e);return n=>{let o=r.get(n);return o==null?oe({kind:Rn.UnknownFloorError,properties:{floorId:n}}):te(o)}};var rD=e=>{if(e.floors==null)return oe({kind:Rn.FloorMissingError,properties:null});if(e.geometry==null)return oe({kind:Rn.GeometryMissingError,properties:null});let r=rr(e.geometry,n=>n.properties.id,"geometry");if(r.isErr())return r;let t=li(e);for(let n of Xe(e.geometry)){let o=t(n);if(o.isErr())return o}return te(!0)};var nD=g.Intersect([g.Object({id:g.Ref(an)}),Kn],{$id:"GeometryProperties"}),oD=Vr(g.Union([g.Ref(on),g.Ref(vg),g.Ref(xg),g.Ref(Ig),g.Ref(Kc),g.Ref(qc)]),g.Ref(nD),{$id:"GeometryFeature"}),iD=hn(g.Ref(oD),{$id:"GeometryCollection"}),M$=g.Object({geometry:nr(g.Record(ze,g.Ref(iD),{additionalProperties:!1}))},{$id:"GeometrySchema"}),A$=/^geometry\/(.*)\.geojson$/,aD={name:"core:geometry",schema:M$,intoBundle:function*(e){if(e.geometry!=null)for(let r of Xe(e.geometry))yield{path:`geometry/${r}.geojson`,contents:e.geometry[r]}},fromBundle:(e,r,t)=>{let n=e.match(A$)?.[1];if(n)return{geometry:{[n]:t(r)}}},references:[nD,oD,iD],integrityCheck:rD};p();var Hv=g.Object({type:g.Literal("file"),name:g.String({description:"The name of the file."})},{$id:"ManifestFile"}),sD=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(Hv)]),{minItems:1,description:"The children of the folder."})}),{$id:"ManifestFolder"}),uD=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(sD),g.Ref(Hv)]),{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(ze,{description:"The default floor ID of the map."})),language:g.Optional(g.String({description:"The language code of the map."}))},{$id:"ManifestProperties"}),lD=hn(Vr(on,g.Ref(uD)),{$id:"ManifestCollection"},{minItems:1,maxItems:1}),O$=g.Object({manifest:g.Ref(lD)}),cD={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:O$,references:[Hv,sD,uD,lD]};p();p();p();p();var Zv=class extends Se{constructor(t){super(`Unable to dereference schema with $id '${t.$ref}'`);m(this,"schema");this.schema=t}};function B$(e,r){let t=r.find(n=>n.$id===e.$ref);if(t===void 0)throw new Zv(e);return ol(t,r)}function ry(e,r){return!Ye.IsString(e.$id)||r.some(t=>t.$id===e.$id)||r.push(e),r}function ol(e,r){return e[j]==="This"||e[j]==="Ref"?B$(e,r):e}p();function P$(e,r,t){let n=e.get(r);if(n!==void 0)return n;let o=ia(r,t);return e.set(r,o),o}function ny(){let e=new WeakMap;return{HasTransform:(r,t)=>P$(e,r,t)}}function Yt(e,r,t){try{return M.IsTransform(e)?e[jt].Decode(t):t}catch(n){throw new tl(e,r,t,n)}}function k$(e,r,t,n,o){return Ye.IsArray(n)?Yt(e,t,n.map((i,s)=>sa(e.items,r,`${t}/${s}`,i,o))):Yt(e,t,n)}function _$(e,r,t,n,o){if(!Ye.IsObject(n)||zr(n))return Yt(e,t,n);let i=Ks(e),s=i.map(f=>f[0]),u={...n};for(let[f,h]of i)f in u&&(u[f]=sa(h,r,`${t}/${f}`,u[f],o));if(!M.IsTransform(e.unevaluatedProperties))return Yt(e,t,u);let l=Object.getOwnPropertyNames(u),c=e.unevaluatedProperties,d={...u};for(let f of l)s.includes(f)||(d[f]=Yt(c,`${t}/${f}`,d[f]));return Yt(e,t,d)}function L$(e,r,t,n,o){return Yt(e,t,sa(e.not,r,t,n,o))}function R$(e,r,t,n,o){if(!Ye.IsObject(n))return Yt(e,t,n);let i=Or(e),s={...n};for(let d of i)Ye.HasPropertyKey(s,d)&&(Ye.IsUndefined(s[d])&&(!M.IsUndefined(e.properties[d])||mt.IsExactOptionalProperty(s,d))||(s[d]=sa(e.properties[d],r,`${t}/${d}`,s[d],o)));if(!M.IsSchema(e.additionalProperties))return Yt(e,t,s);let u=Object.getOwnPropertyNames(s),l=e.additionalProperties,c={...s};for(let d of u)i.includes(d)||(c[d]=Yt(l,`${t}/${d}`,c[d]));return Yt(e,t,c)}function N$(e,r,t,n,o){if(!Ye.IsObject(n))return Yt(e,t,n);let i=Object.getOwnPropertyNames(e.patternProperties)[0],s=new RegExp(i),u={...n};for(let f of Object.getOwnPropertyNames(n))s.test(f)&&(u[f]=sa(e.patternProperties[i],r,`${t}/${f}`,u[f],o));if(!M.IsSchema(e.additionalProperties))return Yt(e,t,u);let l=Object.getOwnPropertyNames(u),c=e.additionalProperties,d={...u};for(let f of l)s.test(f)||(d[f]=Yt(c,`${t}/${f}`,d[f]));return Yt(e,t,d)}function $$(e,r,t,n,o){let i=ol(e,r);return Yt(e,t,sa(i,r,t,n,o))}function j$(e,r,t,n,o){let i=ol(e,r);return Yt(e,t,sa(i,r,t,n,o))}function U$(e,r,t,n,o){return Ye.IsArray(n)&&Ye.IsArray(e.items)?Yt(e,t,e.items.map((i,s)=>sa(i,r,`${t}/${s}`,n[s],o))):Yt(e,t,n)}function G$(e,r,t,n,o){for(let i of e.anyOf){if(!si.Check(i,r,n))continue;let s=sa(i,r,t,n,o);return Yt(e,t,s)}return Yt(e,t,n)}function sa(e,r,t,n,o){if(!o.HasTransform(e,r))return n;let i=ry(e,r),s=e;switch(e[j]){case"Array":return k$(s,i,t,n,o);case"Intersect":return _$(s,i,t,n,o);case"Not":return L$(s,i,t,n,o);case"Object":return R$(s,i,t,n,o);case"Record":return N$(s,i,t,n,o);case"Ref":return $$(s,i,t,n,o);case"Symbol":return Yt(s,t,n);case"This":return j$(s,i,t,n,o);case"Tuple":return U$(s,i,t,n,o);case"Union":return G$(s,i,t,n,o);default:return Yt(s,t,n)}}function pD(e,r,t){let n=ny();return sa(e,r,"",t,n)}p();function ln(e,r,t){try{return M.IsTransform(e)?e[jt].Encode(t):t}catch(n){throw new rl(e,r,t,n)}}function z$(e,r,t,n,o){let i=ln(e,t,n);return Ye.IsArray(i)?i.map((s,u)=>ua(e.items,r,`${t}/${u}`,s,o)):i}function V$(e,r,t,n,o){let i=ln(e,t,n);if(!Ye.IsObject(n)||zr(n))return i;let s=Ks(e),u=s.map(h=>h[0]),l={...i};for(let[h,b]of s)h in l&&(l[h]=ua(b,r,`${t}/${h}`,l[h],o));if(!M.IsTransform(e.unevaluatedProperties))return l;let c=Object.getOwnPropertyNames(l),d=e.unevaluatedProperties,f={...l};for(let h of c)u.includes(h)||(f[h]=ln(d,`${t}/${h}`,f[h]));return f}function H$(e,r,t,n){return ln(e.not,t,ln(e,t,n))}function Z$(e,r,t,n,o){let i=ln(e,t,n);if(!Ye.IsObject(i))return i;let s=Or(e),u={...i};for(let f of s)Ye.HasPropertyKey(u,f)&&(Ye.IsUndefined(u[f])&&(!M.IsUndefined(e.properties[f])||mt.IsExactOptionalProperty(u,f))||(u[f]=ua(e.properties[f],r,`${t}/${f}`,u[f],o)));if(!M.IsSchema(e.additionalProperties))return u;let l=Object.getOwnPropertyNames(u),c=e.additionalProperties,d={...u};for(let f of l)s.includes(f)||(d[f]=ln(c,`${t}/${f}`,d[f]));return d}function W$(e,r,t,n,o){let i=ln(e,t,n);if(!Ye.IsObject(n))return i;let s=Object.getOwnPropertyNames(e.patternProperties)[0],u=new RegExp(s),l={...i};for(let h of Object.getOwnPropertyNames(n))u.test(h)&&(l[h]=ua(e.patternProperties[s],r,`${t}/${h}`,l[h],o));if(!M.IsSchema(e.additionalProperties))return l;let c=Object.getOwnPropertyNames(l),d=e.additionalProperties,f={...l};for(let h of c)u.test(h)||(f[h]=ln(d,`${t}/${h}`,f[h]));return f}function X$(e,r,t,n,o){let i=ol(e,r),s=ua(i,r,t,n,o);return ln(e,t,s)}function J$(e,r,t,n,o){let i=ol(e,r),s=ua(i,r,t,n,o);return ln(e,t,s)}function Y$(e,r,t,n,o){let i=ln(e,t,n);return Ye.IsArray(e.items)?e.items.map((s,u)=>ua(s,r,`${t}/${u}`,i[u],o)):[]}function K$(e,r,t,n,o){for(let i of e.anyOf){if(!si.Check(i,r,n))continue;let s=ua(i,r,t,n,o);return ln(e,t,s)}for(let i of e.anyOf){let s=ua(i,r,t,n,o);if(si.Check(e,r,s))return ln(e,t,s)}return ln(e,t,n)}function ua(e,r,t,n,o){if(!o.HasTransform(e,r))return n;let i=ry(e,r),s=e;switch(e[j]){case"Array":return z$(s,i,t,n,o);case"Intersect":return V$(s,i,t,n,o);case"Not":return H$(s,i,t,n);case"Object":return Z$(s,i,t,n,o);case"Record":return W$(s,i,t,n,o);case"Ref":return X$(s,i,t,n,o);case"This":return J$(s,i,t,n,o);case"Tuple":return Y$(s,i,t,n,o);case"Union":return K$(s,i,t,n,o);default:return ln(s,t,n)}}function dD(e,r,t){let n=ny();return ua(e,r,"",t,n)}p();var Wv=class{constructor(r,t,n,o){this.schema=r,this.references=t,this.checkFunc=n,this.code=o,this.hasTransform=ia(r,t)}Code(){return this.code}Errors(r){return ea(this.schema,this.references,r)}Check(r){return this.checkFunc(r)}Decode(r){if(!this.checkFunc(r))throw new rp(this.schema,r,this.Errors(r).First());return this.hasTransform?np(this.schema,this.references,r):r}Encode(r){let t=this.hasTransform?Pg(this.schema,this.references,r):r;if(!this.checkFunc(t))throw new op(this.schema,r,this.Errors(r).First());return t}},rs;(function(e){function r(i){return i===36}e.DollarSign=r;function t(i){return i===95}e.IsUnderscore=t;function n(i){return i>=65&&i<=90||i>=97&&i<=122}e.IsAlpha=n;function o(i){return i>=48&&i<=57}e.IsNumeric=o})(rs||(rs={}));var oy;(function(e){function r(i){return i.length===0?!1:rs.IsNumeric(i.charCodeAt(0))}function t(i){if(r(i))return!1;for(let s=0;s<i.length;s++){let u=i.charCodeAt(s);if(!(rs.IsAlpha(u)||rs.IsNumeric(u)||rs.DollarSign(u)||rs.IsUnderscore(u)))return!1}return!0}function n(i){return i.replace(/'/g,"\\'")}function o(i,s){return t(s)?`${i}.${s}`:`${i}['${n(s)}']`}e.Encode=o})(oy||(oy={}));var Xv;(function(e){function r(t){let n=[];for(let o=0;o<t.length;o++){let i=t.charCodeAt(o);rs.IsNumeric(i)||rs.IsAlpha(i)?n.push(t.charAt(o)):n.push(`_${i}_`)}return n.join("").replace(/__/g,"_")}e.Encode=r})(Xv||(Xv={}));var Jv;(function(e){function r(t){return t.replace(/'/g,"\\'")}e.Escape=r})(Jv||(Jv={}));var Yv=class extends Se{constructor(r){super("Unknown type"),this.schema=r}},iy=class extends Se{constructor(r){super("Preflight validation check failed to guard for the given schema"),this.schema=r}},il;(function(e){function r(s,u,l){return mt.ExactOptionalPropertyTypes?`('${u}' in ${s} ? ${l} : true)`:`(${oy.Encode(s,u)} !== undefined ? ${l} : true)`}e.IsExactOptionalProperty=r;function t(s){return mt.AllowArrayObject?`(typeof ${s} === 'object' && ${s} !== null)`:`(typeof ${s} === 'object' && ${s} !== null && !Array.isArray(${s}))`}e.IsObjectLike=t;function n(s){return mt.AllowArrayObject?`(typeof ${s} === 'object' && ${s} !== null && !(${s} instanceof Date) && !(${s} instanceof Uint8Array))`:`(typeof ${s} === 'object' && ${s} !== null && !Array.isArray(${s}) && !(${s} instanceof Date) && !(${s} instanceof Uint8Array))`}e.IsRecordLike=n;function o(s){return mt.AllowNaN?`typeof ${s} === 'number'`:`Number.isFinite(${s})`}e.IsNumberLike=o;function i(s){return mt.AllowNullVoid?`(${s} === undefined || ${s} === null)`:`${s} === undefined`}e.IsVoidLike=i})(il||(il={}));var ay;(function(e){function r(A){return A[j]==="Any"||A[j]==="Unknown"}function*t(A,Z,O){yield"true"}function*n(A,Z,O){yield`Array.isArray(${O})`;let[Q,X]=[Ve("value","any"),Ve("acc","number")];ye(A.maxItems)&&(yield`${O}.length <= ${A.maxItems}`),ye(A.minItems)&&(yield`${O}.length >= ${A.minItems}`);let Y=Ce(A.items,Z,"value");if(yield`${O}.every((${Q}) => ${Y})`,Ze(A.contains)||ye(A.minContains)||ye(A.maxContains)){let K=Ze(A.contains)?A.contains:gt(),ae=Ce(K,Z,"value"),$e=ye(A.minContains)?[`(count >= ${A.minContains})`]:[],Rt=ye(A.maxContains)?[`(count <= ${A.maxContains})`]:[],ir=`const count = value.reduce((${X}, ${Q}) => ${ae} ? acc + 1 : acc, 0)`,ho=["(count > 0)",...$e,...Rt].join(" && ");yield`((${Q}) => { ${ir}; return ${ho}})(${O})`}A.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 } )(${O})`)}function*o(A,Z,O){yield`(typeof value === 'object' && Symbol.asyncIterator in ${O})`}function*i(A,Z,O){yield`(typeof ${O} === 'bigint')`,Gr(A.exclusiveMaximum)&&(yield`${O} < BigInt(${A.exclusiveMaximum})`),Gr(A.exclusiveMinimum)&&(yield`${O} > BigInt(${A.exclusiveMinimum})`),Gr(A.maximum)&&(yield`${O} <= BigInt(${A.maximum})`),Gr(A.minimum)&&(yield`${O} >= BigInt(${A.minimum})`),Gr(A.multipleOf)&&(yield`(${O} % BigInt(${A.multipleOf})) === 0`)}function*s(A,Z,O){yield`(typeof ${O} === 'boolean')`}function*u(A,Z,O){yield*he(A.returns,Z,`${O}.prototype`)}function*l(A,Z,O){yield`(${O} instanceof Date) && Number.isFinite(${O}.getTime())`,ye(A.exclusiveMaximumTimestamp)&&(yield`${O}.getTime() < ${A.exclusiveMaximumTimestamp}`),ye(A.exclusiveMinimumTimestamp)&&(yield`${O}.getTime() > ${A.exclusiveMinimumTimestamp}`),ye(A.maximumTimestamp)&&(yield`${O}.getTime() <= ${A.maximumTimestamp}`),ye(A.minimumTimestamp)&&(yield`${O}.getTime() >= ${A.minimumTimestamp}`),ye(A.multipleOfTimestamp)&&(yield`(${O}.getTime() % ${A.multipleOfTimestamp}) === 0`)}function*c(A,Z,O){yield`(typeof ${O} === 'function')`}function*d(A,Z,O){yield`Number.isInteger(${O})`,ye(A.exclusiveMaximum)&&(yield`${O} < ${A.exclusiveMaximum}`),ye(A.exclusiveMinimum)&&(yield`${O} > ${A.exclusiveMinimum}`),ye(A.maximum)&&(yield`${O} <= ${A.maximum}`),ye(A.minimum)&&(yield`${O} >= ${A.minimum}`),ye(A.multipleOf)&&(yield`(${O} % ${A.multipleOf}) === 0`)}function*f(A,Z,O){let Q=A.allOf.map(X=>Ce(X,Z,O)).join(" && ");if(A.unevaluatedProperties===!1){let X=Re(`${new RegExp(Ja(A))};`),Y=`Object.getOwnPropertyNames(${O}).every(key => ${X}.test(key))`;yield`(${Q} && ${Y})`}else if(Ze(A.unevaluatedProperties)){let X=Re(`${new RegExp(Ja(A))};`),Y=`Object.getOwnPropertyNames(${O}).every(key => ${X}.test(key) || ${Ce(A.unevaluatedProperties,Z,`${O}[key]`)})`;yield`(${Q} && ${Y})`}else yield`(${Q})`}function*h(A,Z,O){yield`(typeof value === 'object' && Symbol.iterator in ${O})`}function*b(A,Z,O){typeof A.const=="number"||typeof A.const=="boolean"?yield`(${O} === ${A.const})`:yield`(${O} === '${Jv.Escape(A.const)}')`}function*I(A,Z,O){yield"false"}function*E(A,Z,O){yield`(!${Ce(A.not,Z,O)})`}function*v(A,Z,O){yield`(${O} === null)`}function*x(A,Z,O){yield il.IsNumberLike(O),ye(A.exclusiveMaximum)&&(yield`${O} < ${A.exclusiveMaximum}`),ye(A.exclusiveMinimum)&&(yield`${O} > ${A.exclusiveMinimum}`),ye(A.maximum)&&(yield`${O} <= ${A.maximum}`),ye(A.minimum)&&(yield`${O} >= ${A.minimum}`),ye(A.multipleOf)&&(yield`(${O} % ${A.multipleOf}) === 0`)}function*D(A,Z,O){yield il.IsObjectLike(O),ye(A.minProperties)&&(yield`Object.getOwnPropertyNames(${O}).length >= ${A.minProperties}`),ye(A.maxProperties)&&(yield`Object.getOwnPropertyNames(${O}).length <= ${A.maxProperties}`);let Q=Object.getOwnPropertyNames(A.properties);for(let X of Q){let Y=oy.Encode(O,X),K=A.properties[X];if(A.required&&A.required.includes(X))yield*he(K,Z,Y),(Ka(K)||r(K))&&(yield`('${X}' in ${O})`);else{let ae=Ce(K,Z,Y);yield il.IsExactOptionalProperty(O,X,ae)}}if(A.additionalProperties===!1)if(A.required&&A.required.length===Q.length)yield`Object.getOwnPropertyNames(${O}).length === ${Q.length}`;else{let X=`[${Q.map(Y=>`'${Y}'`).join(", ")}]`;yield`Object.getOwnPropertyNames(${O}).every(key => ${X}.includes(key))`}if(typeof A.additionalProperties=="object"){let X=Ce(A.additionalProperties,Z,`${O}[key]`),Y=`[${Q.map(K=>`'${K}'`).join(", ")}]`;yield`(Object.getOwnPropertyNames(${O}).every(key => ${Y}.includes(key) || ${X}))`}}function*w(A,Z,O){yield`(typeof value === 'object' && typeof ${O}.then === 'function')`}function*S(A,Z,O){yield il.IsRecordLike(O),ye(A.minProperties)&&(yield`Object.getOwnPropertyNames(${O}).length >= ${A.minProperties}`),ye(A.maxProperties)&&(yield`Object.getOwnPropertyNames(${O}).length <= ${A.maxProperties}`);let[Q,X]=Object.entries(A.patternProperties)[0],Y=Re(`${new RegExp(Q)}`),K=Ce(X,Z,"value"),ae=Ze(A.additionalProperties)?Ce(A.additionalProperties,Z,O):A.additionalProperties===!1?"false":"true",$e=`(${Y}.test(key) ? ${K} : ${ae})`;yield`(Object.entries(${O}).every(([key, value]) => ${$e}))`}function*F(A,Z,O){let Q=Qe(A,Z);if(ne.functions.has(A.$ref))return yield`${xe(A.$ref)}(${O})`;yield*he(Q,Z,O)}function*P(A,Z,O){let Q=Re(`${new RegExp(A.source,A.flags)};`);yield`(typeof ${O} === 'string')`,ye(A.maxLength)&&(yield`${O}.length <= ${A.maxLength}`),ye(A.minLength)&&(yield`${O}.length >= ${A.minLength}`),yield`${Q}.test(${O})`}function*L(A,Z,O){yield`(typeof ${O} === 'string')`,ye(A.maxLength)&&(yield`${O}.length <= ${A.maxLength}`),ye(A.minLength)&&(yield`${O}.length >= ${A.minLength}`),A.pattern!==void 0&&(yield`${Re(`${new RegExp(A.pattern)};`)}.test(${O})`),A.format!==void 0&&(yield`format('${A.format}', ${O})`)}function*N(A,Z,O){yield`(typeof ${O} === 'symbol')`}function*$(A,Z,O){yield`(typeof ${O} === 'string')`,yield`${Re(`${new RegExp(A.pattern)};`)}.test(${O})`}function*W(A,Z,O){yield`${xe(A.$ref)}(${O})`}function*V(A,Z,O){if(yield`Array.isArray(${O})`,A.items===void 0)return yield`${O}.length === 0`;yield`(${O}.length === ${A.maxItems})`;for(let Q=0;Q<A.items.length;Q++)yield`${Ce(A.items[Q],Z,`${O}[${Q}]`)}`}function*q(A,Z,O){yield`${O} === undefined`}function*se(A,Z,O){yield`(${A.anyOf.map(X=>Ce(X,Z,O)).join(" || ")})`}function*ue(A,Z,O){yield`${O} instanceof Uint8Array`,ye(A.maxByteLength)&&(yield`(${O}.length <= ${A.maxByteLength})`),ye(A.minByteLength)&&(yield`(${O}.length >= ${A.minByteLength})`)}function*ce(A,Z,O){yield"true"}function*de(A,Z,O){yield il.IsVoidLike(O)}function*Ee(A,Z,O){let Q=ne.instances.size;ne.instances.set(Q,A),yield`kind('${A[j]}', ${Q}, ${O})`}function*he(A,Z,O,Q=!0){let X=He(A.$id)?[...Z,A]:Z,Y=A;if(Q&&He(A.$id)){let K=xe(A.$id);if(ne.functions.has(K))return yield`${K}(${O})`;{let ae=we(K,A,Z,"value",!1);return ne.functions.set(K,ae),yield`${K}(${O})`}}switch(Y[j]){case"Any":return yield*t(Y,X,O);case"Array":return yield*n(Y,X,O);case"AsyncIterator":return yield*o(Y,X,O);case"BigInt":return yield*i(Y,X,O);case"Boolean":return yield*s(Y,X,O);case"Constructor":return yield*u(Y,X,O);case"Date":return yield*l(Y,X,O);case"Function":return yield*c(Y,X,O);case"Integer":return yield*d(Y,X,O);case"Intersect":return yield*f(Y,X,O);case"Iterator":return yield*h(Y,X,O);case"Literal":return yield*b(Y,X,O);case"Never":return yield*I(Y,X,O);case"Not":return yield*E(Y,X,O);case"Null":return yield*v(Y,X,O);case"Number":return yield*x(Y,X,O);case"Object":return yield*D(Y,X,O);case"Promise":return yield*w(Y,X,O);case"Record":return yield*S(Y,X,O);case"Ref":return yield*F(Y,X,O);case"RegExp":return yield*P(Y,X,O);case"String":return yield*L(Y,X,O);case"Symbol":return yield*N(Y,X,O);case"TemplateLiteral":return yield*$(Y,X,O);case"This":return yield*W(Y,X,O);case"Tuple":return yield*V(Y,X,O);case"Undefined":return yield*q(Y,X,O);case"Union":return yield*se(Y,X,O);case"Uint8Array":return yield*ue(Y,X,O);case"Unknown":return yield*ce(Y,X,O);case"Void":return yield*de(Y,X,O);default:if(!Ar.Has(Y[j]))throw new Yv(A);return yield*Ee(Y,X,O)}}let ne={language:"javascript",functions:new Map,variables:new Map,instances:new Map};function Ce(A,Z,O,Q=!0){return`(${[...he(A,Z,O,Q)].join(" && ")})`}function xe(A){return`check_${Xv.Encode(A)}`}function Re(A){let Z=`local_${ne.variables.size}`;return ne.variables.set(Z,`const ${Z} = ${A}`),Z}function we(A,Z,O,Q,X=!0){let[Y,K]=[`
1
+ import{$ as M6,$a as K6,A as b6,Aa as N6,Ab as Vs,B as Gu,Ba as $6,Bb as Gh,C as v6,Cb as Db,D as x6,Da as Lh,Db as hE,E as sb,Ea as Rh,Eb as gE,F as Vi,Fa as j6,Fb as Oc,G as Ph,Ga as U6,Gb as Tb,H as La,Ha as G6,Hb as zh,I as zu,Ia as z6,Ib as yE,J as I6,Ja as V6,Jb as wb,K as E6,Ka as bb,Kb as bE,L as C6,La as H6,Lb as vE,M as S6,Ma as Z6,Mb as xE,N as pm,Na as wc,Nb as IE,O as On,Oa as W6,Ob as EE,P as D6,Pa as X6,Pb as CE,Q as ub,Qa as Nh,Qb as SE,R as Hi,Ra as vb,Rb as Zi,S as T6,Sa as J6,Sb as DE,T as Cc,Ta as hm,Tb as Ht,U as kh,Ua as Fc,Ub as TE,V as Sc,Va as $h,Vb as wE,W as dm,Wa as Mc,Wb as Wi,X as w6,Xa as Ac,Xb as FE,Y as lb,Ya as Y6,Yb as sr,Z as cb,Za as xb,Zb as ei,_ as F6,_b as yr,aa as A6,ab as q6,ba as Ra,bb as Q6,c as R,ca as l8,cb as jh,d as Mr,da as pb,db as eE,e as WI,ea as O6,eb as tE,f as nb,fa as Na,fb as rE,g as Gi,ga as B6,gb as nE,h as d6,ha as P6,hb as oE,i as Oh,ia as k6,ib as gm,j as m6,ja as db,jb as Vu,k as zi,ka as _6,kb as iE,l as f6,la as mb,lb as Xn,m as Uu,ma as zs,mb as aE,n as lm,na as ft,nb as sE,o as h6,oa as _h,ob as uE,p as go,pa as mm,pb as Ib,q as ib,qa as fb,qb as lE,r as Ec,ra as yo,rb as Eb,s as It,sa as hb,sb as Cb,t as Bh,ta as gb,tb as Uh,u as Oe,ua as yb,ub as cE,v as _a,va as L6,vb as pE,w as cm,wa as Dc,wb as dE,x as ab,xa as R6,xb as mE,y as g6,ya as Tc,yb as Sb,z as y6,za as fm,zb as fE}from"./chunk-BXSPZW2B.js";import{a as bo}from"./chunk-DERUYKVE.js";import{$a as Ah,B as yh,D as bh,Da as i6,E as js,Ea as vc,F as vh,Fa as a6,G as xh,Ga as xc,H as Ih,Ha as Ic,I as Eh,Ia as Qo,Ja as Fh,K as KI,Ka as s6,L as Je,La as sm,M as ke,Na as um,Q as qI,R as QI,S as e6,T as Ch,U as ie,V as dr,W as t6,X as Wn,Xa as Mh,Y as bc,Z as ju,_ as ar,a as p,aa as gr,ab as u6,b as y,ba as dn,ca as Sh,d as gh,da as Pe,e as $u,ea as qo,eb as l6,f as om,g as ka,ga as Us,gb as Ui,h as XI,ha as r6,i as im,ia as ob,ib as c6,ja as Dh,ka as Gs,kb as p6,r as JI,sa as ji,t as YI,ta as n6,ua as Th,va as wh,wa as o6,ya as am}from"./chunk-PH2HNHTP.js";import{b as Nu,c as $s,d as rb,e as m,f as a,g as C,h as T,i as z}from"./chunk-ROCNZJLL.js";var BT=Nu((U3,G3)=>{p();(function(e,r){typeof U3=="object"&&typeof G3<"u"?G3.exports=r():typeof define=="function"&&define.amd?define(r):(e=e||self,e.TinyQueue=r())})(U3,function(){"use strict";var e=function(n,o){if(n===void 0&&(n=[]),o===void 0&&(o=r),this.data=n,this.length=this.data.length,this.compare=o,this.length>0)for(var i=(this.length>>1)-1;i>=0;i--)this._down(i)};e.prototype.push=function(n){this.data.push(n),this.length++,this._up(this.length-1)},e.prototype.pop=function(){if(this.length!==0){var n=this.data[0],o=this.data.pop();return this.length--,this.length>0&&(this.data[0]=o,this._down(0)),n}},e.prototype.peek=function(){return this.data[0]},e.prototype._up=function(n){for(var o=this,i=o.data,s=o.compare,u=i[n];n>0;){var l=n-1>>1,c=i[l];if(s(u,c)>=0)break;i[n]=c,n=l}i[n]=u},e.prototype._down=function(n){for(var o=this,i=o.data,s=o.compare,u=this.length>>1,l=i[n];n<u;){var c=(n<<1)+1,d=i[c],f=c+1;if(f<this.length&&s(i[f],d)<0&&(c=f,d=i[f]),s(d,l)>=0)break;i[n]=d,n=c}i[n]=l};function r(t,n){return t<n?-1:t>n?1:0}return e})});var kT=Nu((Z1e,z3)=>{"use strict";p();var Ty=BT();Ty.default&&(Ty=Ty.default);z3.exports=PT;z3.exports.default=PT;function PT(e,r,t){r=r||1;for(var n,o,i,s,u=0;u<e[0].length;u++){var l=e[0][u];(!u||l[0]<n)&&(n=l[0]),(!u||l[1]<o)&&(o=l[1]),(!u||l[0]>i)&&(i=l[0]),(!u||l[1]>s)&&(s=l[1])}var c=i-n,d=s-o,f=Math.min(c,d),h=f/2;if(f===0){var b=[n,o];return b.distance=0,b}for(var I=new Ty(void 0,aU),E=n;E<i;E+=f)for(var v=o;v<s;v+=f)I.push(new nu(E+h,v+h,h,e));var x=uU(e),D=new nu(n+c/2,o+d/2,0,e);D.d>x.d&&(x=D);for(var w=I.length;I.length;){var S=I.pop();S.d>x.d&&(x=S,t&&console.log("found best %d after %d probes",Math.round(1e4*S.d)/1e4,w)),!(S.max-x.d<=r)&&(h=S.h/2,I.push(new nu(S.x-h,S.y-h,h,e)),I.push(new nu(S.x+h,S.y-h,h,e)),I.push(new nu(S.x-h,S.y+h,h,e)),I.push(new nu(S.x+h,S.y+h,h,e)),w+=4)}t&&(console.log("num probes: "+w),console.log("best distance: "+x.d));var F=[x.x,x.y];return F.distance=x.d,F}function aU(e,r){return r.max-e.max}function nu(e,r,t,n){this.x=e,this.y=r,this.h=t,this.d=sU(e,r,n),this.max=this.d+this.h*Math.SQRT2}function sU(e,r,t){for(var n=!1,o=1/0,i=0;i<t.length;i++)for(var s=t[i],u=0,l=s.length,c=l-1;u<l;c=u++){var d=s[u],f=s[c];d[1]>r!=f[1]>r&&e<(f[0]-d[0])*(r-d[1])/(f[1]-d[1])+d[0]&&(n=!n),o=Math.min(o,lU(e,r,d,f))}return o===0?0:(n?1:-1)*Math.sqrt(o)}function uU(e){for(var r=0,t=0,n=0,o=e[0],i=0,s=o.length,u=s-1;i<s;u=i++){var l=o[i],c=o[u],d=l[0]*c[1]-c[0]*l[1];t+=(l[0]+c[0])*d,n+=(l[1]+c[1])*d,r+=d*3}return r===0?new nu(o[0][0],o[0][1],0,e):new nu(t/r,n/r,0,e)}function lU(e,r,t,n){var o=t[0],i=t[1],s=n[0]-o,u=n[1]-i;if(s!==0||u!==0){var l=((e-o)*s+(r-i)*u)/(s*s+u*u);l>1?(o=n[0],i=n[1]):l>0&&(o+=s*l,i+=u*l)}return s=e-o,u=r-i,s*s+u*u}});var dw=Nu((sx,ux)=>{p();(function(e,r){typeof sx=="object"&&typeof ux<"u"?ux.exports=r():typeof define=="function"&&define.amd?define(r):(e=e||self).RBush=r()})(sx,function(){"use strict";function e(v,x,D,w,S){(function F(P,L,N,$,W){for(;$>N;){if($-N>600){var V=$-N+1,q=L-N+1,se=Math.log(V),ue=.5*Math.exp(2*se/3),ce=.5*Math.sqrt(se*ue*(V-ue)/V)*(q-V/2<0?-1:1),de=Math.max(N,Math.floor(L-q*ue/V+ce)),Ee=Math.min($,Math.floor(L+(V-q)*ue/V+ce));F(P,L,de,Ee,W)}var he=P[L],ne=N,Ce=$;for(r(P,N,L),W(P[$],he)>0&&r(P,N,$);ne<Ce;){for(r(P,ne,Ce),ne++,Ce--;W(P[ne],he)<0;)ne++;for(;W(P[Ce],he)>0;)Ce--}W(P[N],he)===0?r(P,N,Ce):r(P,++Ce,$),Ce<=L&&(N=Ce+1),L<=Ce&&($=Ce-1)}})(v,x,D||0,w||v.length-1,S||t)}function r(v,x,D){var w=v[x];v[x]=v[D],v[D]=w}function t(v,x){return v<x?-1:v>x?1:0}var n=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 o(v,x,D){if(!D)return x.indexOf(v);for(var w=0;w<x.length;w++)if(D(v,x[w]))return w;return-1}function i(v,x){s(v,0,v.children.length,x,v)}function s(v,x,D,w,S){S||(S=I(null)),S.minX=1/0,S.minY=1/0,S.maxX=-1/0,S.maxY=-1/0;for(var F=x;F<D;F++){var P=v.children[F];u(S,v.leaf?w(P):P)}return S}function u(v,x){return v.minX=Math.min(v.minX,x.minX),v.minY=Math.min(v.minY,x.minY),v.maxX=Math.max(v.maxX,x.maxX),v.maxY=Math.max(v.maxY,x.maxY),v}function l(v,x){return v.minX-x.minX}function c(v,x){return v.minY-x.minY}function d(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,x){return v.minX<=x.minX&&v.minY<=x.minY&&x.maxX<=v.maxX&&x.maxY<=v.maxY}function b(v,x){return x.minX<=v.maxX&&x.minY<=v.maxY&&x.maxX>=v.minX&&x.maxY>=v.minY}function I(v){return{children:v,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function E(v,x,D,w,S){for(var F=[x,D];F.length;)if(!((D=F.pop())-(x=F.pop())<=w)){var P=x+Math.ceil((D-x)/w/2)*w;e(v,P,x,D,S),F.push(x,P,P,D)}}return n.prototype.all=function(){return this._all(this.data,[])},n.prototype.search=function(v){var x=this.data,D=[];if(!b(v,x))return D;for(var w=this.toBBox,S=[];x;){for(var F=0;F<x.children.length;F++){var P=x.children[F],L=x.leaf?w(P):P;b(v,L)&&(x.leaf?D.push(P):h(v,L)?this._all(P,D):S.push(P))}x=S.pop()}return D},n.prototype.collides=function(v){var x=this.data;if(!b(v,x))return!1;for(var D=[];x;){for(var w=0;w<x.children.length;w++){var S=x.children[w],F=x.leaf?this.toBBox(S):S;if(b(v,F)){if(x.leaf||h(v,F))return!0;D.push(S)}}x=D.pop()}return!1},n.prototype.load=function(v){if(!v||!v.length)return this;if(v.length<this._minEntries){for(var x=0;x<v.length;x++)this.insert(v[x]);return this}var D=this._build(v.slice(),0,v.length-1,0);if(this.data.children.length)if(this.data.height===D.height)this._splitRoot(this.data,D);else{if(this.data.height<D.height){var w=this.data;this.data=D,D=w}this._insert(D,this.data.height-D.height-1,!0)}else this.data=D;return this},n.prototype.insert=function(v){return v&&this._insert(v,this.data.height-1),this},n.prototype.clear=function(){return this.data=I([]),this},n.prototype.remove=function(v,x){if(!v)return this;for(var D,w,S,F=this.data,P=this.toBBox(v),L=[],N=[];F||L.length;){if(F||(F=L.pop(),w=L[L.length-1],D=N.pop(),S=!0),F.leaf){var $=o(v,F.children,x);if($!==-1)return F.children.splice($,1),L.push(F),this._condense(L),this}S||F.leaf||!h(F,P)?w?(D++,F=w.children[D],S=!1):F=null:(L.push(F),N.push(D),D=0,w=F,F=F.children[0])}return this},n.prototype.toBBox=function(v){return v},n.prototype.compareMinX=function(v,x){return v.minX-x.minX},n.prototype.compareMinY=function(v,x){return v.minY-x.minY},n.prototype.toJSON=function(){return this.data},n.prototype.fromJSON=function(v){return this.data=v,this},n.prototype._all=function(v,x){for(var D=[];v;)v.leaf?x.push.apply(x,v.children):D.push.apply(D,v.children),v=D.pop();return x},n.prototype._build=function(v,x,D,w){var S,F=D-x+1,P=this._maxEntries;if(F<=P)return i(S=I(v.slice(x,D+1)),this.toBBox),S;w||(w=Math.ceil(Math.log(F)/Math.log(P)),P=Math.ceil(F/Math.pow(P,w-1))),(S=I([])).leaf=!1,S.height=w;var L=Math.ceil(F/P),N=L*Math.ceil(Math.sqrt(P));E(v,x,D,N,this.compareMinX);for(var $=x;$<=D;$+=N){var W=Math.min($+N-1,D);E(v,$,W,L,this.compareMinY);for(var V=$;V<=W;V+=L){var q=Math.min(V+L-1,W);S.children.push(this._build(v,V,q,w-1))}}return i(S,this.toBBox),S},n.prototype._chooseSubtree=function(v,x,D,w){for(;w.push(x),!x.leaf&&w.length-1!==D;){for(var S=1/0,F=1/0,P=void 0,L=0;L<x.children.length;L++){var N=x.children[L],$=d(N),W=(V=v,q=N,(Math.max(q.maxX,V.maxX)-Math.min(q.minX,V.minX))*(Math.max(q.maxY,V.maxY)-Math.min(q.minY,V.minY))-$);W<F?(F=W,S=$<S?$:S,P=N):W===F&&$<S&&(S=$,P=N)}x=P||x.children[0]}var V,q;return x},n.prototype._insert=function(v,x,D){var w=D?v:this.toBBox(v),S=[],F=this._chooseSubtree(w,this.data,x,S);for(F.children.push(v),u(F,w);x>=0&&S[x].children.length>this._maxEntries;)this._split(S,x),x--;this._adjustParentBBoxes(w,S,x)},n.prototype._split=function(v,x){var D=v[x],w=D.children.length,S=this._minEntries;this._chooseSplitAxis(D,S,w);var F=this._chooseSplitIndex(D,S,w),P=I(D.children.splice(F,D.children.length-F));P.height=D.height,P.leaf=D.leaf,i(D,this.toBBox),i(P,this.toBBox),x?v[x-1].children.push(P):this._splitRoot(D,P)},n.prototype._splitRoot=function(v,x){this.data=I([v,x]),this.data.height=v.height+1,this.data.leaf=!1,i(this.data,this.toBBox)},n.prototype._chooseSplitIndex=function(v,x,D){for(var w,S,F,P,L,N,$,W=1/0,V=1/0,q=x;q<=D-x;q++){var se=s(v,0,q,this.toBBox),ue=s(v,q,D,this.toBBox),ce=(S=se,F=ue,P=void 0,L=void 0,N=void 0,$=void 0,P=Math.max(S.minX,F.minX),L=Math.max(S.minY,F.minY),N=Math.min(S.maxX,F.maxX),$=Math.min(S.maxY,F.maxY),Math.max(0,N-P)*Math.max(0,$-L)),de=d(se)+d(ue);ce<W?(W=ce,w=q,V=de<V?de:V):ce===W&&de<V&&(V=de,w=q)}return w||D-x},n.prototype._chooseSplitAxis=function(v,x,D){var w=v.leaf?this.compareMinX:l,S=v.leaf?this.compareMinY:c;this._allDistMargin(v,x,D,w)<this._allDistMargin(v,x,D,S)&&v.children.sort(w)},n.prototype._allDistMargin=function(v,x,D,w){v.children.sort(w);for(var S=this.toBBox,F=s(v,0,x,S),P=s(v,D-x,D,S),L=f(F)+f(P),N=x;N<D-x;N++){var $=v.children[N];u(F,v.leaf?S($):$),L+=f(F)}for(var W=D-x-1;W>=x;W--){var V=v.children[W];u(P,v.leaf?S(V):V),L+=f(P)}return L},n.prototype._adjustParentBBoxes=function(v,x,D){for(var w=D;w>=0;w--)u(x[w],v)},n.prototype._condense=function(v){for(var x=v.length-1,D=void 0;x>=0;x--)v[x].children.length===0?x>0?(D=v[x-1].children).splice(D.indexOf(v[x]),1):this.clear():i(v[x],this.toBBox)},n})});var mx=Nu(De=>{"use strict";p();Object.defineProperty(De,"__esModule",{value:!0});De.earthRadius=63710088e-1;De.factors={centimeters:De.earthRadius*100,centimetres:De.earthRadius*100,degrees:De.earthRadius/111325,feet:De.earthRadius*3.28084,inches:De.earthRadius*39.37,kilometers:De.earthRadius/1e3,kilometres:De.earthRadius/1e3,meters:De.earthRadius,metres:De.earthRadius,miles:De.earthRadius/1609.344,millimeters:De.earthRadius*1e3,millimetres:De.earthRadius*1e3,nauticalmiles:De.earthRadius/1852,radians:1,yards:De.earthRadius*1.0936};De.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/De.earthRadius,yards:1.0936133};De.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 au(e,r,t){t===void 0&&(t={});var n={type:"Feature"};return(t.id===0||t.id)&&(n.id=t.id),t.bbox&&(n.bbox=t.bbox),n.properties=r||{},n.geometry=e,n}De.feature=au;function hG(e,r,t){switch(t===void 0&&(t={}),e){case"Point":return lx(r).geometry;case"LineString":return px(r).geometry;case"Polygon":return cx(r).geometry;case"MultiPoint":return fw(r).geometry;case"MultiLineString":return mw(r).geometry;case"MultiPolygon":return hw(r).geometry;default:throw new Error(e+" is invalid")}}De.geometry=hG;function lx(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(!Py(e[0])||!Py(e[1]))throw new Error("coordinates must contain numbers");var n={type:"Point",coordinates:e};return au(n,r,t)}De.point=lx;function gG(e,r,t){return t===void 0&&(t={}),ky(e.map(function(n){return lx(n,r)}),t)}De.points=gG;function cx(e,r,t){t===void 0&&(t={});for(var n=0,o=e;n<o.length;n++){var i=o[n];if(i.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var s=0;s<i[i.length-1].length;s++)if(i[i.length-1][s]!==i[0][s])throw new Error("First and last Position are not equivalent.")}var u={type:"Polygon",coordinates:e};return au(u,r,t)}De.polygon=cx;function yG(e,r,t){return t===void 0&&(t={}),ky(e.map(function(n){return cx(n,r)}),t)}De.polygons=yG;function px(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 n={type:"LineString",coordinates:e};return au(n,r,t)}De.lineString=px;function bG(e,r,t){return t===void 0&&(t={}),ky(e.map(function(n){return px(n,r)}),t)}De.lineStrings=bG;function ky(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}De.featureCollection=ky;function mw(e,r,t){t===void 0&&(t={});var n={type:"MultiLineString",coordinates:e};return au(n,r,t)}De.multiLineString=mw;function fw(e,r,t){t===void 0&&(t={});var n={type:"MultiPoint",coordinates:e};return au(n,r,t)}De.multiPoint=fw;function hw(e,r,t){t===void 0&&(t={});var n={type:"MultiPolygon",coordinates:e};return au(n,r,t)}De.multiPolygon=hw;function vG(e,r,t){t===void 0&&(t={});var n={type:"GeometryCollection",geometries:e};return au(n,r,t)}De.geometryCollection=vG;function xG(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}De.round=xG;function gw(e,r){r===void 0&&(r="kilometers");var t=De.factors[r];if(!t)throw new Error(r+" units is invalid");return e*t}De.radiansToLength=gw;function dx(e,r){r===void 0&&(r="kilometers");var t=De.factors[r];if(!t)throw new Error(r+" units is invalid");return e/t}De.lengthToRadians=dx;function IG(e,r){return yw(dx(e,r))}De.lengthToDegrees=IG;function EG(e){var r=e%360;return r<0&&(r+=360),r}De.bearingToAzimuth=EG;function yw(e){var r=e%(2*Math.PI);return r*180/Math.PI}De.radiansToDegrees=yw;function CG(e){var r=e%360;return r*Math.PI/180}De.degreesToRadians=CG;function SG(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 gw(dx(e,r),t)}De.convertLength=SG;function DG(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 n=De.areaFactors[r];if(!n)throw new Error("invalid original units");var o=De.areaFactors[t];if(!o)throw new Error("invalid final units");return e/n*o}De.convertArea=DG;function Py(e){return!isNaN(e)&&e!==null&&!Array.isArray(e)}De.isNumber=Py;function TG(e){return!!e&&e.constructor===Object}De.isObject=TG;function wG(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(!Py(r))throw new Error("bbox must only contain numbers")})}De.validateBBox=wG;function FG(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")}De.validateId=FG});var hx=Nu(xr=>{"use strict";p();Object.defineProperty(xr,"__esModule",{value:!0});var cn=mx();function ff(e,r,t){if(e!==null)for(var n,o,i,s,u,l,c,d=0,f=0,h,b=e.type,I=b==="FeatureCollection",E=b==="Feature",v=I?e.features.length:1,x=0;x<v;x++){c=I?e.features[x].geometry:E?e.geometry:e,h=c?c.type==="GeometryCollection":!1,u=h?c.geometries.length:1;for(var D=0;D<u;D++){var w=0,S=0;if(s=h?c.geometries[D]:c,s!==null){l=s.coordinates;var F=s.type;switch(d=t&&(F==="Polygon"||F==="MultiPolygon")?1:0,F){case null:break;case"Point":if(r(l,f,x,w,S)===!1)return!1;f++,w++;break;case"LineString":case"MultiPoint":for(n=0;n<l.length;n++){if(r(l[n],f,x,w,S)===!1)return!1;f++,F==="MultiPoint"&&w++}F==="LineString"&&w++;break;case"Polygon":case"MultiLineString":for(n=0;n<l.length;n++){for(o=0;o<l[n].length-d;o++){if(r(l[n][o],f,x,w,S)===!1)return!1;f++}F==="MultiLineString"&&w++,F==="Polygon"&&S++}F==="Polygon"&&w++;break;case"MultiPolygon":for(n=0;n<l.length;n++){for(S=0,o=0;o<l[n].length;o++){for(i=0;i<l[n][o].length-d;i++){if(r(l[n][o][i],f,x,w,S)===!1)return!1;f++}S++}w++}break;case"GeometryCollection":for(n=0;n<s.geometries.length;n++)if(ff(s.geometries[n],r,t)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function MG(e,r,t,n){var o=t;return ff(e,function(i,s,u,l,c){s===0&&t===void 0?o=i:o=r(o,i,s,u,l,c)},n),o}function bw(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 AG(e,r,t){var n=t;return bw(e,function(o,i){i===0&&t===void 0?n=o:n=r(n,o,i)}),n}function vw(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 OG(e,r,t){var n=t;return vw(e,function(o,i){i===0&&t===void 0?n=o:n=r(n,o,i)}),n}function BG(e){var r=[];return ff(e,function(t){r.push(t)}),r}function fx(e,r){var t,n,o,i,s,u,l,c,d,f,h=0,b=e.type==="FeatureCollection",I=e.type==="Feature",E=b?e.features.length:1;for(t=0;t<E;t++){for(u=b?e.features[t].geometry:I?e.geometry:e,c=b?e.features[t].properties:I?e.properties:{},d=b?e.features[t].bbox:I?e.bbox:void 0,f=b?e.features[t].id:I?e.id:void 0,l=u?u.type==="GeometryCollection":!1,s=l?u.geometries.length:1,o=0;o<s;o++){if(i=l?u.geometries[o]:u,i===null){if(r(null,h,c,d,f)===!1)return!1;continue}switch(i.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(r(i,h,c,d,f)===!1)return!1;break}case"GeometryCollection":{for(n=0;n<i.geometries.length;n++)if(r(i.geometries[n],h,c,d,f)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}h++}}function PG(e,r,t){var n=t;return fx(e,function(o,i,s,u,l){i===0&&t===void 0?n=o:n=r(n,o,i,s,u,l)}),n}function _y(e,r){fx(e,function(t,n,o,i,s){var u=t===null?null:t.type;switch(u){case null:case"Point":case"LineString":case"Polygon":return r(cn.feature(t,o,{bbox:i,id:s}),n,0)===!1?!1:void 0}var l;switch(u){case"MultiPoint":l="Point";break;case"MultiLineString":l="LineString";break;case"MultiPolygon":l="Polygon";break}for(var c=0;c<t.coordinates.length;c++){var d=t.coordinates[c],f={type:l,coordinates:d};if(r(cn.feature(f,o),n,c)===!1)return!1}})}function kG(e,r,t){var n=t;return _y(e,function(o,i,s){i===0&&s===0&&t===void 0?n=o:n=r(n,o,i,s)}),n}function xw(e,r){_y(e,function(t,n,o){var i=0;if(t.geometry){var s=t.geometry.type;if(!(s==="Point"||s==="MultiPoint")){var u,l=0,c=0,d=0;if(ff(t,function(f,h,b,I,E){if(u===void 0||n>l||I>c||E>d){u=f,l=n,c=I,d=E,i=0;return}var v=cn.lineString([u,f],t.properties);if(r(v,n,o,E,i)===!1)return!1;i++,u=f})===!1)return!1}}})}function _G(e,r,t){var n=t,o=!1;return xw(e,function(i,s,u,l,c){o===!1&&t===void 0?n=i:n=r(n,i,s,u,l,c),o=!0}),n}function Iw(e,r){if(!e)throw new Error("geojson is required");_y(e,function(t,n,o){if(t.geometry!==null){var i=t.geometry.type,s=t.geometry.coordinates;switch(i){case"LineString":if(r(t,n,o,0,0)===!1)return!1;break;case"Polygon":for(var u=0;u<s.length;u++)if(r(cn.lineString(s[u],t.properties),n,o,u)===!1)return!1;break}}})}function LG(e,r,t){var n=t;return Iw(e,function(o,i,s,u){i===0&&t===void 0?n=o:n=r(n,o,i,s,u)}),n}function RG(e,r){if(r=r||{},!cn.isObject(r))throw new Error("options is invalid");var t=r.featureIndex||0,n=r.multiFeatureIndex||0,o=r.geometryIndex||0,i=r.segmentIndex||0,s=r.properties,u;switch(e.type){case"FeatureCollection":t<0&&(t=e.features.length+t),s=s||e.features[t].properties,u=e.features[t].geometry;break;case"Feature":s=s||e.properties,u=e.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":u=e;break;default:throw new Error("geojson is invalid")}if(u===null)return null;var l=u.coordinates;switch(u.type){case"Point":case"MultiPoint":return null;case"LineString":return i<0&&(i=l.length+i-1),cn.lineString([l[i],l[i+1]],s,r);case"Polygon":return o<0&&(o=l.length+o),i<0&&(i=l[o].length+i-1),cn.lineString([l[o][i],l[o][i+1]],s,r);case"MultiLineString":return n<0&&(n=l.length+n),i<0&&(i=l[n].length+i-1),cn.lineString([l[n][i],l[n][i+1]],s,r);case"MultiPolygon":return n<0&&(n=l.length+n),o<0&&(o=l[n].length+o),i<0&&(i=l[n][o].length-i-1),cn.lineString([l[n][o][i],l[n][o][i+1]],s,r)}throw new Error("geojson is invalid")}function NG(e,r){if(r=r||{},!cn.isObject(r))throw new Error("options is invalid");var t=r.featureIndex||0,n=r.multiFeatureIndex||0,o=r.geometryIndex||0,i=r.coordIndex||0,s=r.properties,u;switch(e.type){case"FeatureCollection":t<0&&(t=e.features.length+t),s=s||e.features[t].properties,u=e.features[t].geometry;break;case"Feature":s=s||e.properties,u=e.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":u=e;break;default:throw new Error("geojson is invalid")}if(u===null)return null;var l=u.coordinates;switch(u.type){case"Point":return cn.point(l,s,r);case"MultiPoint":return n<0&&(n=l.length+n),cn.point(l[n],s,r);case"LineString":return i<0&&(i=l.length+i),cn.point(l[i],s,r);case"Polygon":return o<0&&(o=l.length+o),i<0&&(i=l[o].length+i),cn.point(l[o][i],s,r);case"MultiLineString":return n<0&&(n=l.length+n),i<0&&(i=l[n].length+i),cn.point(l[n][i],s,r);case"MultiPolygon":return n<0&&(n=l.length+n),o<0&&(o=l[n].length+o),i<0&&(i=l[n][o].length-i),cn.point(l[n][o][i],s,r)}throw new Error("geojson is invalid")}xr.coordAll=BG;xr.coordEach=ff;xr.coordReduce=MG;xr.featureEach=vw;xr.featureReduce=OG;xr.findPoint=NG;xr.findSegment=RG;xr.flattenEach=_y;xr.flattenReduce=kG;xr.geomEach=fx;xr.geomReduce=PG;xr.lineEach=Iw;xr.lineReduce=LG;xr.propEach=bw;xr.propReduce=AG;xr.segmentEach=xw;xr.segmentReduce=_G});var Ew=Nu(yx=>{"use strict";p();Object.defineProperty(yx,"__esModule",{value:!0});var $G=hx();function gx(e){var r=[1/0,1/0,-1/0,-1/0];return $G.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}gx.default=gx;yx.default=gx});var ww=Nu((Cve,bx)=>{p();var ca=dw(),Sw=mx(),Dw=hx(),Mp=Ew().default,jG=Dw.featureEach,Ive=Dw.coordEach,Eve=Sw.polygon,Cw=Sw.featureCollection;function Tw(e){var r=new ca(e);return r.insert=function(t){if(t.type!=="Feature")throw new Error("invalid feature");return t.bbox=t.bbox?t.bbox:Mp(t),ca.prototype.insert.call(this,t)},r.load=function(t){var n=[];return Array.isArray(t)?t.forEach(function(o){if(o.type!=="Feature")throw new Error("invalid features");o.bbox=o.bbox?o.bbox:Mp(o),n.push(o)}):jG(t,function(o){if(o.type!=="Feature")throw new Error("invalid features");o.bbox=o.bbox?o.bbox:Mp(o),n.push(o)}),ca.prototype.load.call(this,n)},r.remove=function(t,n){if(t.type!=="Feature")throw new Error("invalid feature");return t.bbox=t.bbox?t.bbox:Mp(t),ca.prototype.remove.call(this,t,n)},r.clear=function(){return ca.prototype.clear.call(this)},r.search=function(t){var n=ca.prototype.search.call(this,this.toBBox(t));return Cw(n)},r.collides=function(t){return ca.prototype.collides.call(this,this.toBBox(t))},r.all=function(){var t=ca.prototype.all.call(this);return Cw(t)},r.toJSON=function(){return ca.prototype.toJSON.call(this)},r.fromJSON=function(t){return ca.prototype.fromJSON.call(this,t)},r.toBBox=function(t){var n;if(t.bbox)n=t.bbox;else if(Array.isArray(t)&&t.length===4)n=t;else if(Array.isArray(t)&&t.length===6)n=[t[0],t[1],t[3],t[4]];else if(t.type==="Feature")n=Mp(t);else if(t.type==="FeatureCollection")n=Mp(t);else throw new Error("invalid geojson");return{minX:n[0],minY:n[1],maxX:n[2],maxY:n[3]}},r}bx.exports=Tw;bx.exports.default=Tw});p();p();p();p();p();p();var ym=e=>e!=null;var c8=function(){let r=globalThis.fetch;return{fetch(...t){if(!ym(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}}}(),ME=c8.fetch;var kE=["websdk","web","webv2","kiosk-v2","mobile","iossdk","androidsdk","reactnativesdk","gen7","bespoke","reactsdk"],AE=kE[0],_E="https://api-gateway.mappedin.com/track-analytics/a/",LE="deny-watchposition",RE="load-mapview",NE="load-mapdata",$E="change-language",jE="query-directions";var Xi,vo,$a,Mb,Vh,Bc=class{constructor(){C(this,$a);C(this,Xi,Object.freeze({}));C(this,vo);m(this,"oneTimeEventsSent",new Set);m(this,"sendGetDirectionsEvent",ib((r,t,n)=>{let o={start:r,end:t,type:"location_to_location"};return n!==void 0&&(o.accessible=n),this.sendAnalyticEvent(jE,o)},2500));T(this,vo,z(this,$a,Vh).call(this,a(this,Xi)))}init(r){this.reset(),this.updateStateWithOptions(r)}reset(){T(this,Xi,{}),T(this,vo,z(this,$a,Vh).call(this,{})),this.oneTimeEventsSent.clear()}updateStateWithOptions(r){return T(this,Xi,Object.freeze(Object.assign({},a(this,Xi),r))),T(this,vo,z(this,$a,Vh).call(this,r)),z(this,$a,Mb).call(this,a(this,vo)),a(this,vo)}updateState(r){let t={...r};t.mapId&&(t.analyticsBaseUrl=Fb({...a(this,vo),mapId:t.mapId})),t.context&&(t.context=PE(t.context)),t.baseUri&&(t.analyticsBaseUrl=Fb({baseUri:t.baseUri,mapId:a(this,vo).mapId})),Object.assign(a(this,vo),t),this.handleStateUpdate(r),z(this,$a,Mb).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:n}=this.getState();return!!(r&&t)||!!n}getState(){return a(this,vo)}getContext(){return this.getState().context||a(this,Xi).context||AE}getSessionId(){return this.getState().sessionId||a(this,Xi).sessionId||BE()}getDeviceId(){return this.getState().deviceId||a(this,Xi).deviceId||OE()}sendAnalyticEvent(r,t={}){let n=this.getState(),o=p8(n.analyticsBaseUrl,r),i={"mi-context":this.getContext(),"mi-session":this.getSessionId(),"mi-device":this.getDeviceId()};if(n.logEvents&&R.log("Analytics.track",o,i),!n.sendEvents)return Promise.resolve();if(!this.authReady)return R.warn("Auth needs to be ready to send analytics.");let s={...t,g:n.geolocationMode,sdk_version:n.version};return n.userPosition&&Object.assign(s,n.userPosition),i["Content-Type"]="application/json",n.accessToken?i.Authorization=`Bearer ${n.accessToken}`:n.noAuth||n.secret&&n.key&&(i["x-mappedin-key"]=btoa(n.key),i["x-mappedin-secret"]=btoa(n.secret)),ME(o,{method:"POST",mode:"cors",headers:i,body:JSON.stringify(s)})}capture(r,t){if(m8.includes(r))return R.warn(`${r} event is sent internally.`),Promise.resolve();let n=d8.includes(r)?r.slice(1):r;return this.sendAnalyticEvent(n,t)}sendGetMapDataEvent(r){return this.sendAnalyticEvent(NE,r)}sendChangeLanguageEvent(r){return this.sendAnalyticEvent($E,r)}sendWatchPositionDenied(){return this.sendAnalyticEvent(LE)}sendMapViewLoadedEvent({firstRenderDuration:r,dimension:t,collisionWorkerDisabled:n,outdoorsWorkerDisabled:o}){return this.sendAnalyticEvent(RE,{type:"3d",firstRenderDuration:r,width:t.width,height:t.height,devicePixelRatio:globalThis.devicePixelRatio||1,collisionWorkerDisabled:n,outdoorsWorkerDisabled:o})}sendBlueDotEvents(r){if(!((r==="found-floor"||r==="found-position")&&this.oneTimeEventsSent.has(r)))return this.oneTimeEventsSent.add(r),this.sendAnalyticEvent(r)}};Xi=new WeakMap,vo=new WeakMap,$a=new WeakSet,Mb=function(r){r.sessionId&&_a.getInstance().saveSessionData("id",r.sessionId),r.deviceId&&_a.getInstance().saveLocalData("deviceId",r.deviceId)},Vh=function(r){let t=r.baseUri??_E;return{baseUri:t,analyticsBaseUrl:Fb({...r,baseUri:t}),version:y?.env?.npm_package_version||"v6",deviceId:r.deviceId||OE(),accessToken:r.accessToken,mapId:r.mapId,sessionId:r.sessionId||BE(),platformString:r.platformString||"",context:PE(r.context)||AE,geolocationMode:!1,sendEvents:r.sendEvents??!0,logEvents:r.logEvents??!1,noAuth:r.noAuth||!1,key:r.key,secret:r.secret}};function Fb({mapId:e,baseUri:r=_E}){return`${r}${e}/`}function OE(){return _a.getInstance().loadLocalData("deviceId")}function BE(){return _a.getInstance().loadSessionData("id")}function p8(e,r){return e+r}function PE(e){return kE.find(r=>r===e)}var d8=["$select-location","$select-category","$query-suggest","$query-search"],m8=[RE,NE,jE,LE,$E],LZ=new Bc,xo,bm=class{constructor(r){C(this,xo);m(this,"capture");m(this,"updateState");T(this,xo,r),this.capture=a(this,xo).capture.bind(a(this,xo)),this.updateState=a(this,xo).updateState.bind(a(this,xo))}getState(){let{sessionId:r,deviceId:t,...n}=a(this,xo).getState();return n}getContext(){return a(this,xo).getContext()}getSessionId(){return a(this,xo).getSessionId()}getDeviceId(){return a(this,xo).getDeviceId()}};xo=new WeakMap;p();p();var xm,Im,Em,vm=class{constructor(r,t,{enabled:n=!1}={}){C(this,xm);m(this,"searchInstance");C(this,Im);C(this,Em);m(this,"enabled",!1);T(this,xm,r),T(this,Im,t),T(this,Em,()=>{this.searchInstance?.then(o=>o.populate())}),n&&this.enable()}async query(r,t={}){if(this.enabled||await this.enable(),!this.searchInstance)return R.error("Search should be enabled by now"),{places:[],enterpriseLocations:[],enterpriseCategories:[]};try{return await(await this.searchInstance).search(r,t)}catch(n){return R.error("Search.query failed due to",n),{places:[],enterpriseLocations:[],enterpriseCategories:[]}}}async suggest(r,t={}){if(this.enabled||await this.enable(),!this.searchInstance)return R.error("Search should be enabled by now"),[];try{return await(await this.searchInstance).suggest(r,t)}catch(n){return R.error("Search.suggest failed due to",n),[]}}async enable(){this.enabled||(this.enabled=!0,this.searchInstance||(this.searchInstance=import("./internal-3J7P44P6.js").then(({InternalSearch:r})=>new r(a(this,xm)))),a(this,Im).on("language-change",a(this,Em)),await this.searchInstance)}};xm=new WeakMap,Im=new WeakMap,Em=new WeakMap;var UE=new WeakMap,Hu,Nt,Ab=class{constructor(r,{search:t}={}){C(this,Hu);C(this,Nt);m(this,"Analytics");m(this,"Search");m(this,"Query");m(this,"internal");m(this,"on",(r,t)=>{a(this,Hu).on(r,t)});m(this,"off",(r,t)=>{a(this,Hu).off(r,t)});m(this,"__LEGACY_GET_DIRECTIONS_SYNC",(r,t,n)=>a(this,Nt).__LEGACY_GET_DIRECTIONS_SYNC(r,t,n));m(this,"getDirections",(r,t,n)=>a(this,Nt).getDirections(r,t,n));m(this,"__LEGACY_GET_DIRECTIONS_MULTI_DESTINATION_SYNC",(r,t,n)=>a(this,Nt).__LEGACY_GET_DIRECTIONS_MULTI_DESTINATION_SYNC(r,t,n));m(this,"getDirectionsMultiDestination",(r,t,n)=>a(this,Nt).getDirectionsMultiDestination(r,t,n));T(this,Hu,new Oe),T(this,Nt,r),UE.set(this,r),this.Analytics=new bm(r.Analytics),this.Query=r.Query,this.internal=r,this.Search=new vm(this,r,{enabled:t?.enabled}),a(this,Nt).on("language-change",n=>{a(this,Hu).publish("language-change",n)})}getEnv(){return a(this,Nt).getEnv()}getAccessToken(){return a(this,Nt).tokenManager?.getAccessToken().token}get mapName(){return a(this,Nt).mapName}get mapId(){return a(this,Nt).getMapDataOptions?.mapId}get mapCenter(){return a(this,Nt).mapCenter}get organizationId(){return a(this,Nt).organizationId}get outdoorViewToken(){return a(this,Nt).outdoorViewToken}getByType(r){return a(this,Nt).getByType(r)}getById(r,t){return a(this,Nt).getById(r,t)}getByExternalId(r,t){return a(this,Nt).getByExternalId(r,t)}getGeoJSON(r){return r.geoJSON}async changeLanguage(r){return a(this,Nt).changeLanguage(r)}get currentLanguage(){return a(this,Nt).currentLanguage}get naturalBearing(){return a(this,Nt).naturalBearing??0}getDistance(r,t){return a(this,Nt).getDistance(r,t)}toBinaryBundle({downloadLanguagePacks:r=!0}={}){return a(this,Nt).toBinaryBundle({downloadLanguagePacks:r})}toJSONBundle({downloadLanguagePacks:r=!0}={}){return a(this,Nt).toJSONBundle({downloadLanguagePacks:r})}};Hu=new WeakMap,Nt=new WeakMap;var Cm=Ab;function Sm(e){let r=UE.get(e);if(!r)throw new Error("MapDataInternal not found");return r}p();p();p();p();p();p();p();p();p();p();p();p();p();p();p();p();p();p();p();p();p();p();var Hh={accessible:"accessible",outdoors:"outdoors",public:"public"};p();p();p();p();p();p();var Ye={};$s(Ye,{HasPropertyKey:()=>f8,IsArray:()=>rn,IsAsyncIterator:()=>Ob,IsBigInt:()=>Dm,IsBoolean:()=>Hs,IsDate:()=>Zu,IsFunction:()=>Bb,IsIterator:()=>Pb,IsNull:()=>kb,IsNumber:()=>ti,IsObject:()=>Et,IsRegExp:()=>Tm,IsString:()=>Bt,IsSymbol:()=>_b,IsUint8Array:()=>ja,IsUndefined:()=>Zt});p();function f8(e,r){return r in e}function Ob(e){return Et(e)&&!rn(e)&&!ja(e)&&Symbol.asyncIterator in e}function rn(e){return Array.isArray(e)}function Dm(e){return typeof e=="bigint"}function Hs(e){return typeof e=="boolean"}function Zu(e){return e instanceof globalThis.Date}function Bb(e){return typeof e=="function"}function Pb(e){return Et(e)&&!rn(e)&&!ja(e)&&Symbol.iterator in e}function kb(e){return e===null}function ti(e){return typeof e=="number"}function Et(e){return typeof e=="object"&&e!==null}function Tm(e){return e instanceof globalThis.RegExp}function Bt(e){return typeof e=="string"}function _b(e){return typeof e=="symbol"}function ja(e){return e instanceof globalThis.Uint8Array}function Zt(e){return e===void 0}function h8(e){return e.map(r=>Zh(r))}function g8(e){return new Date(e.getTime())}function y8(e){return new Uint8Array(e)}function b8(e){return new RegExp(e.source,e.flags)}function v8(e){let r={};for(let t of Object.getOwnPropertyNames(e))r[t]=Zh(e[t]);for(let t of Object.getOwnPropertySymbols(e))r[t]=Zh(e[t]);return r}function Zh(e){return rn(e)?h8(e):Zu(e)?g8(e):ja(e)?y8(e):Tm(e)?b8(e):Et(e)?v8(e):e}function $t(e){return Zh(e)}function GE(e){return e.map(r=>wm(r))}function wm(e,r){return r===void 0?$t(e):$t({...r,...e})}p();p();p();function Wh(e){return Be(e)&&Symbol.asyncIterator in e}function Xh(e){return Be(e)&&Symbol.iterator in e}function Lb(e){return Be(e)&&(Object.getPrototypeOf(e)===Object.prototype||Object.getPrototypeOf(e)===null)}function Jh(e){return e instanceof Promise}function mn(e){return e instanceof Date&&Number.isFinite(e.getTime())}function zE(e){return e instanceof globalThis.Map}function VE(e){return e instanceof globalThis.Set}function Io(e){return ArrayBuffer.isView(e)}function Pc(e){return e instanceof globalThis.Uint8Array}function Te(e,r){return r in e}function Be(e){return e!==null&&typeof e=="object"}function Me(e){return Array.isArray(e)&&!ArrayBuffer.isView(e)}function Wt(e){return e===void 0}function Ua(e){return e===null}function Ji(e){return typeof e=="boolean"}function ye(e){return typeof e=="number"}function Yh(e){return Number.isInteger(e)}function Gr(e){return typeof e=="bigint"}function He(e){return typeof e=="string"}function Zs(e){return typeof e=="function"}function Ga(e){return typeof e=="symbol"}function zr(e){return Gr(e)||Ji(e)||Ua(e)||ye(e)||He(e)||Ga(e)||Wt(e)}var mt;(function(e){e.InstanceMode="default",e.ExactOptionalPropertyTypes=!1,e.AllowArrayObject=!1,e.AllowNaN=!1,e.AllowNullVoid=!1;function r(s,u){return e.ExactOptionalPropertyTypes?u in s:s[u]!==void 0}e.IsExactOptionalProperty=r;function t(s){let u=Be(s);return e.AllowArrayObject?u:u&&!Me(s)}e.IsObjectLike=t;function n(s){return t(s)&&!(s instanceof Date)&&!(s instanceof Uint8Array)}e.IsRecordLike=n;function o(s){return e.AllowNaN?ye(s):Number.isFinite(s)}e.IsNumberLike=o;function i(s){let u=Wt(s);return e.AllowNullVoid?u||s===null:u}e.IsVoidLike=i})(mt||(mt={}));p();function x8(e){return globalThis.Object.freeze(e).map(r=>Fm(r))}function I8(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 rn(e)?x8(e):Zu(e)?e:ja(e)?e:Tm(e)?e:Et(e)?I8(e):e}function H(e,r){let t=r!==void 0?{...r,...e}:e;switch(mt.InstanceMode){case"freeze":return Fm(t);case"clone":return $t(t);default:return t}}p();var Se=class extends Error{constructor(r){super(r)}};p();p();p();var jt=Symbol.for("TypeBox.Transform"),za=Symbol.for("TypeBox.Readonly"),fn=Symbol.for("TypeBox.Optional"),Eo=Symbol.for("TypeBox.Hint"),j=Symbol.for("TypeBox.Kind");function HE(e){return Et(e)&&e[za]==="Readonly"}function Yi(e){return Et(e)&&e[fn]==="Optional"}function Rb(e){return Ke(e,"Any")}function Va(e){return Ke(e,"Array")}function Mm(e){return Ke(e,"AsyncIterator")}function Nb(e){return Ke(e,"BigInt")}function $b(e){return Ke(e,"Boolean")}function Am(e){return Ke(e,"Constructor")}function E8(e){return Ke(e,"Date")}function Om(e){return Ke(e,"Function")}function Wu(e){return Ke(e,"Integer")}function ur(e){return Ke(e,"Intersect")}function Bm(e){return Ke(e,"Iterator")}function Ke(e,r){return Et(e)&&j in e&&e[j]===r}function Ha(e){return Ke(e,"Literal")}function Jn(e){return Ke(e,"MappedKey")}function Ut(e){return Ke(e,"MappedResult")}function Ws(e){return Ke(e,"Never")}function C8(e){return Ke(e,"Not")}function S8(e){return Ke(e,"Null")}function Xu(e){return Ke(e,"Number")}function br(e){return Ke(e,"Object")}function Ju(e){return Ke(e,"Promise")}function jb(e){return Ke(e,"Record")}function Ub(e){return Ke(e,"Ref")}function Gb(e){return Ke(e,"RegExp")}function Pm(e){return Ke(e,"String")}function D8(e){return Ke(e,"Symbol")}function Yn(e){return Ke(e,"TemplateLiteral")}function T8(e){return Ke(e,"This")}function kc(e){return Et(e)&&jt in e}function ri(e){return Ke(e,"Tuple")}function w8(e){return Ke(e,"Undefined")}function st(e){return Ke(e,"Union")}function F8(e){return Ke(e,"Uint8Array")}function M8(e){return Ke(e,"Unknown")}function A8(e){return Ke(e,"Unsafe")}function O8(e){return Ke(e,"Void")}function Xs(e){return Et(e)&&j in e&&Bt(e[j])}function ni(e){return Rb(e)||Va(e)||$b(e)||Nb(e)||Mm(e)||Am(e)||E8(e)||Om(e)||Wu(e)||ur(e)||Bm(e)||Ha(e)||Jn(e)||Ut(e)||Ws(e)||C8(e)||S8(e)||Xu(e)||br(e)||Ju(e)||jb(e)||Ub(e)||Gb(e)||Pm(e)||D8(e)||Yn(e)||T8(e)||ri(e)||w8(e)||st(e)||F8(e)||M8(e)||A8(e)||O8(e)||Xs(e)}var M={};$s(M,{IsAny:()=>JE,IsArray:()=>YE,IsAsyncIterator:()=>KE,IsBigInt:()=>qE,IsBoolean:()=>QE,IsConstructor:()=>eC,IsDate:()=>tC,IsFunction:()=>rC,IsInteger:()=>nC,IsIntersect:()=>oC,IsIterator:()=>iC,IsKind:()=>MC,IsKindOf:()=>We,IsLiteral:()=>_m,IsLiteralBoolean:()=>N8,IsLiteralNumber:()=>sC,IsLiteralString:()=>aC,IsLiteralValue:()=>uC,IsMappedKey:()=>lC,IsMappedResult:()=>cC,IsNever:()=>pC,IsNot:()=>dC,IsNull:()=>mC,IsNumber:()=>fC,IsObject:()=>hC,IsOptional:()=>R8,IsPromise:()=>gC,IsProperties:()=>Zb,IsReadonly:()=>L8,IsRecord:()=>yC,IsRecursive:()=>$8,IsRef:()=>bC,IsRegExp:()=>vC,IsSchema:()=>Ze,IsString:()=>xC,IsSymbol:()=>IC,IsTemplateLiteral:()=>EC,IsThis:()=>CC,IsTransform:()=>Pt,IsTuple:()=>SC,IsUint8Array:()=>DC,IsUndefined:()=>_c,IsUnion:()=>Wb,IsUnionLiteral:()=>j8,IsUnknown:()=>TC,IsUnsafe:()=>wC,IsVoid:()=>FC,TypeGuardUnknownTypeError:()=>zb});p();var zb=class extends Se{},P8=["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 ZE(e){try{return new RegExp(e),!0}catch{return!1}}function Vb(e){if(!Bt(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 WE(e){return Hb(e)||Ze(e)}function km(e){return Zt(e)||Dm(e)}function Ft(e){return Zt(e)||ti(e)}function Hb(e){return Zt(e)||Hs(e)}function ht(e){return Zt(e)||Bt(e)}function k8(e){return Zt(e)||Bt(e)&&Vb(e)&&ZE(e)}function _8(e){return Zt(e)||Bt(e)&&Vb(e)}function XE(e){return Zt(e)||Ze(e)}function L8(e){return Et(e)&&e[za]==="Readonly"}function R8(e){return Et(e)&&e[fn]==="Optional"}function JE(e){return We(e,"Any")&&ht(e.$id)}function YE(e){return We(e,"Array")&&e.type==="array"&&ht(e.$id)&&Ze(e.items)&&Ft(e.minItems)&&Ft(e.maxItems)&&Hb(e.uniqueItems)&&XE(e.contains)&&Ft(e.minContains)&&Ft(e.maxContains)}function KE(e){return We(e,"AsyncIterator")&&e.type==="AsyncIterator"&&ht(e.$id)&&Ze(e.items)}function qE(e){return We(e,"BigInt")&&e.type==="bigint"&&ht(e.$id)&&km(e.exclusiveMaximum)&&km(e.exclusiveMinimum)&&km(e.maximum)&&km(e.minimum)&&km(e.multipleOf)}function QE(e){return We(e,"Boolean")&&e.type==="boolean"&&ht(e.$id)}function eC(e){return We(e,"Constructor")&&e.type==="Constructor"&&ht(e.$id)&&rn(e.parameters)&&e.parameters.every(r=>Ze(r))&&Ze(e.returns)}function tC(e){return We(e,"Date")&&e.type==="Date"&&ht(e.$id)&&Ft(e.exclusiveMaximumTimestamp)&&Ft(e.exclusiveMinimumTimestamp)&&Ft(e.maximumTimestamp)&&Ft(e.minimumTimestamp)&&Ft(e.multipleOfTimestamp)}function rC(e){return We(e,"Function")&&e.type==="Function"&&ht(e.$id)&&rn(e.parameters)&&e.parameters.every(r=>Ze(r))&&Ze(e.returns)}function nC(e){return We(e,"Integer")&&e.type==="integer"&&ht(e.$id)&&Ft(e.exclusiveMaximum)&&Ft(e.exclusiveMinimum)&&Ft(e.maximum)&&Ft(e.minimum)&&Ft(e.multipleOf)}function Zb(e){return Et(e)&&Object.entries(e).every(([r,t])=>Vb(r)&&Ze(t))}function oC(e){return We(e,"Intersect")&&!(Bt(e.type)&&e.type!=="object")&&rn(e.allOf)&&e.allOf.every(r=>Ze(r)&&!Pt(r))&&ht(e.type)&&(Hb(e.unevaluatedProperties)||XE(e.unevaluatedProperties))&&ht(e.$id)}function iC(e){return We(e,"Iterator")&&e.type==="Iterator"&&ht(e.$id)&&Ze(e.items)}function We(e,r){return Et(e)&&j in e&&e[j]===r}function aC(e){return _m(e)&&Bt(e.const)}function sC(e){return _m(e)&&ti(e.const)}function N8(e){return _m(e)&&Hs(e.const)}function _m(e){return We(e,"Literal")&&ht(e.$id)&&uC(e.const)}function uC(e){return Hs(e)||ti(e)||Bt(e)}function lC(e){return We(e,"MappedKey")&&rn(e.keys)&&e.keys.every(r=>ti(r)||Bt(r))}function cC(e){return We(e,"MappedResult")&&Zb(e.properties)}function pC(e){return We(e,"Never")&&Et(e.not)&&Object.getOwnPropertyNames(e.not).length===0}function dC(e){return We(e,"Not")&&Ze(e.not)}function mC(e){return We(e,"Null")&&e.type==="null"&&ht(e.$id)}function fC(e){return We(e,"Number")&&e.type==="number"&&ht(e.$id)&&Ft(e.exclusiveMaximum)&&Ft(e.exclusiveMinimum)&&Ft(e.maximum)&&Ft(e.minimum)&&Ft(e.multipleOf)}function hC(e){return We(e,"Object")&&e.type==="object"&&ht(e.$id)&&Zb(e.properties)&&WE(e.additionalProperties)&&Ft(e.minProperties)&&Ft(e.maxProperties)}function gC(e){return We(e,"Promise")&&e.type==="Promise"&&ht(e.$id)&&Ze(e.item)}function yC(e){return We(e,"Record")&&e.type==="object"&&ht(e.$id)&&WE(e.additionalProperties)&&Et(e.patternProperties)&&(r=>{let t=Object.getOwnPropertyNames(r.patternProperties);return t.length===1&&ZE(t[0])&&Et(r.patternProperties)&&Ze(r.patternProperties[t[0]])})(e)}function $8(e){return Et(e)&&Eo in e&&e[Eo]==="Recursive"}function bC(e){return We(e,"Ref")&&ht(e.$id)&&Bt(e.$ref)}function vC(e){return We(e,"RegExp")&&ht(e.$id)&&Bt(e.source)&&Bt(e.flags)&&Ft(e.maxLength)&&Ft(e.minLength)}function xC(e){return We(e,"String")&&e.type==="string"&&ht(e.$id)&&Ft(e.minLength)&&Ft(e.maxLength)&&k8(e.pattern)&&_8(e.format)}function IC(e){return We(e,"Symbol")&&e.type==="symbol"&&ht(e.$id)}function EC(e){return We(e,"TemplateLiteral")&&e.type==="string"&&Bt(e.pattern)&&e.pattern[0]==="^"&&e.pattern[e.pattern.length-1]==="$"}function CC(e){return We(e,"This")&&ht(e.$id)&&Bt(e.$ref)}function Pt(e){return Et(e)&&jt in e}function SC(e){return We(e,"Tuple")&&e.type==="array"&&ht(e.$id)&&ti(e.minItems)&&ti(e.maxItems)&&e.minItems===e.maxItems&&(Zt(e.items)&&Zt(e.additionalItems)&&e.minItems===0||rn(e.items)&&e.items.every(r=>Ze(r)))}function _c(e){return We(e,"Undefined")&&e.type==="undefined"&&ht(e.$id)}function j8(e){return Wb(e)&&e.anyOf.every(r=>aC(r)||sC(r))}function Wb(e){return We(e,"Union")&&ht(e.$id)&&Et(e)&&rn(e.anyOf)&&e.anyOf.every(r=>Ze(r))}function DC(e){return We(e,"Uint8Array")&&e.type==="Uint8Array"&&ht(e.$id)&&Ft(e.minByteLength)&&Ft(e.maxByteLength)}function TC(e){return We(e,"Unknown")&&ht(e.$id)}function wC(e){return We(e,"Unsafe")}function FC(e){return We(e,"Void")&&e.type==="void"&&ht(e.$id)}function MC(e){return Et(e)&&j in e&&Bt(e[j])&&!P8.includes(e[j])}function Ze(e){return Et(e)&&(JE(e)||YE(e)||QE(e)||qE(e)||KE(e)||eC(e)||tC(e)||rC(e)||nC(e)||oC(e)||iC(e)||_m(e)||lC(e)||cC(e)||pC(e)||dC(e)||mC(e)||fC(e)||hC(e)||gC(e)||yC(e)||bC(e)||vC(e)||xC(e)||IC(e)||EC(e)||CC(e)||SC(e)||_c(e)||Wb(e)||DC(e)||TC(e)||wC(e)||FC(e)||MC(e))}p();var Xb="(true|false)",Lm="(0|[1-9][0-9]*)",Jb="(.*)",U8="(?!.*)",hX=`^${Xb}$`,Za=`^${Lm}$`,Wa=`^${Jb}$`,AC=`^${U8}$`;p();var Bn={};$s(Bn,{Clear:()=>z8,Delete:()=>V8,Entries:()=>G8,Get:()=>W8,Has:()=>H8,Set:()=>Z8});p();var Lc=new Map;function G8(){return new Map(Lc)}function z8(){return Lc.clear()}function V8(e){return Lc.delete(e)}function H8(e){return Lc.has(e)}function Z8(e,r){Lc.set(e,r)}function W8(e){return Lc.get(e)}var Ar={};$s(Ar,{Clear:()=>J8,Delete:()=>Y8,Entries:()=>X8,Get:()=>Q8,Has:()=>K8,Set:()=>q8});p();var Rc=new Map;function X8(){return new Map(Rc)}function J8(){return Rc.clear()}function Y8(e){return Rc.delete(e)}function K8(e){return Rc.has(e)}function q8(e,r){Rc.set(e,r)}function Q8(e){return Rc.get(e)}p();function OC(e,r){return e.includes(r)}function BC(e){return[...new Set(e)]}function e9(e,r){return e.filter(t=>r.includes(t))}function t9(e,r){return e.reduce((t,n)=>e9(t,n),r)}function PC(e){return e.length===1?e[0]:e.length>1?t9(e.slice(1),e[0]):[]}function kC(e){let r=[];for(let t of e)r.push(...t);return r}p();function Js(e){return H({[j]:"Any"},e)}p();function Kh(e,r){return H({[j]:"Array",type:"array",items:e},r)}p();function qh(e,r){return H({[j]:"AsyncIterator",type:"AsyncIterator",items:e},r)}p();p();p();function r9(e,r){let{[r]:t,...n}=e;return n}function er(e,r){return r.reduce((t,n)=>r9(t,n),e)}p();function gt(e){return H({[j]:"Never",not:{}},e)}p();p();function qe(e){return H({[j]:"MappedResult",properties:e})}p();p();function Qh(e,r,t){return H({[j]:"Constructor",type:"Constructor",parameters:e,returns:r},t)}p();function Ys(e,r,t){return H({[j]:"Function",type:"Function",parameters:e,returns:r},t)}p();p();p();p();function Rm(e,r){return H({[j]:"Union",anyOf:e},r)}function n9(e){return e.some(r=>Yi(r))}function _C(e){return e.map(r=>Yi(r)?o9(r):r)}function o9(e){return er(e,[fn])}function i9(e,r){return n9(e)?Pn(Rm(_C(e),r)):Rm(_C(e),r)}function Ki(e,r){return e.length===0?gt(r):e.length===1?H(e[0],r):i9(e,r)}p();function yt(e,r){return e.length===0?gt(r):e.length===1?H(e[0],r):Rm(e,r)}p();p();p();var eg=class extends Se{};function a9(e){return e.replace(/\\\$/g,"$").replace(/\\\*/g,"*").replace(/\\\^/g,"^").replace(/\\\|/g,"|").replace(/\\\(/g,"(").replace(/\\\)/g,")")}function Yb(e,r,t){return e[r]===t&&e.charCodeAt(r-1)!==92}function Xa(e,r){return Yb(e,r,"(")}function Nm(e,r){return Yb(e,r,")")}function LC(e,r){return Yb(e,r,"|")}function s9(e){if(!(Xa(e,0)&&Nm(e,e.length-1)))return!1;let r=0;for(let t=0;t<e.length;t++)if(Xa(e,t)&&(r+=1),Nm(e,t)&&(r-=1),r===0&&t!==e.length-1)return!1;return!0}function u9(e){return e.slice(1,e.length-1)}function l9(e){let r=0;for(let t=0;t<e.length;t++)if(Xa(e,t)&&(r+=1),Nm(e,t)&&(r-=1),LC(e,t)&&r===0)return!0;return!1}function c9(e){for(let r=0;r<e.length;r++)if(Xa(e,r))return!0;return!1}function p9(e){let[r,t]=[0,0],n=[];for(let i=0;i<e.length;i++)if(Xa(e,i)&&(r+=1),Nm(e,i)&&(r-=1),LC(e,i)&&r===0){let s=e.slice(t,i);s.length>0&&n.push(Nc(s)),t=i+1}let o=e.slice(t);return o.length>0&&n.push(Nc(o)),n.length===0?{type:"const",const:""}:n.length===1?n[0]:{type:"or",expr:n}}function d9(e){function r(o,i){if(!Xa(o,i))throw new eg("TemplateLiteralParser: Index must point to open parens");let s=0;for(let u=i;u<o.length;u++)if(Xa(o,u)&&(s+=1),Nm(o,u)&&(s-=1),s===0)return[i,u];throw new eg("TemplateLiteralParser: Unclosed group parens in expression")}function t(o,i){for(let s=i;s<o.length;s++)if(Xa(o,s))return[i,s];return[i,o.length]}let n=[];for(let o=0;o<e.length;o++)if(Xa(e,o)){let[i,s]=r(e,o),u=e.slice(i,s+1);n.push(Nc(u)),o=s}else{let[i,s]=t(e,o),u=e.slice(i,s);u.length>0&&n.push(Nc(u)),o=s-1}return n.length===0?{type:"const",const:""}:n.length===1?n[0]:{type:"and",expr:n}}function Nc(e){return s9(e)?Nc(u9(e)):l9(e)?p9(e):c9(e)?d9(e):{type:"const",const:a9(e)}}function $c(e){return Nc(e.slice(1,e.length-1))}var Kb=class extends Se{};function m9(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 f9(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 h9(e){return e.type==="const"&&e.const===".*"}function Yu(e){return m9(e)||h9(e)?!1:f9(e)?!0:e.type==="and"?e.expr.every(r=>Yu(r)):e.type==="or"?e.expr.every(r=>Yu(r)):e.type==="const"?!0:(()=>{throw new Kb("Unknown expression type")})()}function tg(e){let r=$c(e.pattern);return Yu(r)}p();var qb=class extends Se{};function*RC(e){if(e.length===1)return yield*e[0];for(let r of e[0])for(let t of RC(e.slice(1)))yield`${r}${t}`}function*g9(e){return yield*RC(e.expr.map(r=>[...$m(r)]))}function*y9(e){for(let r of e.expr)yield*$m(r)}function*b9(e){return yield e.const}function*$m(e){return e.type==="and"?yield*g9(e):e.type==="or"?yield*y9(e):e.type==="const"?yield*b9(e):(()=>{throw new qb("Unknown expression")})()}function jc(e){let r=$c(e.pattern);return Yu(r)?[...$m(r)]:[]}p();p();function lt(e,r){return H({[j]:"Literal",const:e,type:typeof e},r)}p();function rg(e){return H({[j]:"Boolean",type:"boolean"},e)}p();function Uc(e){return H({[j]:"BigInt",type:"bigint"},e)}p();function qi(e){return H({[j]:"Number",type:"number"},e)}p();function Co(e){return H({[j]:"String",type:"string"},e)}function*v9(e){let r=e.trim().replace(/"|'/g,"");return r==="boolean"?yield rg():r==="number"?yield qi():r==="bigint"?yield Uc():r==="string"?yield Co():yield(()=>{let t=r.split("|").map(n=>lt(n.trim()));return t.length===0?gt():t.length===1?t[0]:Ki(t)})()}function*x9(e){if(e[1]!=="{"){let r=lt("$"),t=Qb(e.slice(1));return yield*[r,...t]}for(let r=2;r<e.length;r++)if(e[r]==="}"){let t=v9(e.slice(2,r)),n=Qb(e.slice(r+1));return yield*[...t,...n]}yield lt(e)}function*Qb(e){for(let r=0;r<e.length;r++)if(e[r]==="$"){let t=lt(e.slice(0,r)),n=x9(e.slice(r));return yield*[t,...n]}yield lt(e)}function NC(e){return[...Qb(e)]}p();var ev=class extends Se{};function I9(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function $C(e,r){return Yn(e)?e.pattern.slice(1,e.pattern.length-1):st(e)?`(${e.anyOf.map(t=>$C(t,r)).join("|")})`:Xu(e)?`${r}${Lm}`:Wu(e)?`${r}${Lm}`:Nb(e)?`${r}${Lm}`:Pm(e)?`${r}${Jb}`:Ha(e)?`${r}${I9(e.const.toString())}`:$b(e)?`${r}${Xb}`:(()=>{throw new ev(`Unexpected Kind '${e[j]}'`)})()}function tv(e){return`^${e.map(r=>$C(r,"")).join("")}$`}p();function Ku(e){let t=jc(e).map(n=>lt(n));return Ki(t)}p();function ng(e,r){let t=Bt(e)?tv(NC(e)):tv(e);return H({[j]:"TemplateLiteral",type:"string",pattern:t},r)}function E9(e){return jc(e).map(t=>t.toString())}function C9(e){let r=[];for(let t of e)r.push(...kn(t));return r}function S9(e){return[e.toString()]}function kn(e){return[...new Set(Yn(e)?E9(e):st(e)?C9(e.anyOf):Ha(e)?S9(e.const):Xu(e)?["[number]"]:Wu(e)?["[number]"]:[])]}p();function D9(e,r,t){let n={};for(let o of Object.getOwnPropertyNames(r))n[o]=Gc(e,kn(r[o]),t);return n}function T9(e,r,t){return D9(e,r.properties,t)}function jC(e,r,t){let n=T9(e,r,t);return qe(n)}function GC(e,r){return e.map(t=>zC(t,r))}function w9(e){return e.filter(r=>!Ws(r))}function F9(e,r){return og(w9(GC(e,r)))}function M9(e){return e.some(r=>Ws(r))?[]:e}function A9(e,r){return Ki(M9(GC(e,r)))}function O9(e,r){return r in e?e[r]:r==="[number]"?Ki(e):gt()}function B9(e,r){return r==="[number]"?e:gt()}function P9(e,r){return r in e?e[r]:gt()}function zC(e,r){return ur(e)?F9(e.allOf,r):st(e)?A9(e.anyOf,r):ri(e)?O9(e.items??[],r):Va(e)?B9(e.items,r):br(e)?P9(e.properties,r):gt()}function jm(e,r){return r.map(t=>zC(e,t))}function UC(e,r){return Ki(jm(e,r))}function Gc(e,r,t){return Ut(r)?jC(e,r,t):Jn(r)?VC(e,r,t):H(ni(r)?UC(e,kn(r)):UC(e,r),t)}function k9(e,r,t){return{[r]:Gc(e,[r],$t(t))}}function _9(e,r,t){return r.reduce((n,o)=>({...n,...k9(e,o,t)}),{})}function L9(e,r,t){return _9(e,r.keys,t)}function VC(e,r,t){let n=L9(e,r,t);return qe(n)}p();function ig(e,r){return H({[j]:"Iterator",type:"Iterator",items:e},r)}p();function R9(e){let r=[];for(let t in e)Yi(e[t])||r.push(t);return r}function N9(e,r){let t=R9(e),n=t.length>0?{[j]:"Object",type:"object",properties:e,required:t}:{[j]:"Object",type:"object",properties:e};return H(n,r)}var Ct=N9;p();function ag(e,r){return H({[j]:"Promise",type:"Promise",item:e},r)}p();p();function $9(e){return H(er(e,[za]))}function j9(e){return H({...e,[za]:"Readonly"})}function U9(e,r){return r===!1?$9(e):j9(e)}function So(e,r){let t=r??!0;return Ut(e)?HC(e,t):U9(e,t)}function G9(e,r){let t={};for(let n of globalThis.Object.getOwnPropertyNames(e))t[n]=So(e[n],r);return t}function z9(e,r){return G9(e.properties,r)}function HC(e,r){let t=z9(e,r);return qe(t)}p();function Qi(e,r){return H(e.length>0?{[j]:"Tuple",type:"array",items:e,additionalItems:!1,minItems:e.length,maxItems:e.length}:{[j]:"Tuple",type:"array",minItems:e.length,maxItems:e.length},r)}function ZC(e,r){return e in r?Do(e,r[e]):qe(r)}function V9(e){return{[e]:lt(e)}}function H9(e){let r={};for(let t of e)r[t]=lt(t);return r}function Z9(e,r){return OC(r,e)?V9(e):H9(r)}function W9(e,r){let t=Z9(e,r);return ZC(e,t)}function Um(e,r){return r.map(t=>Do(e,t))}function X9(e,r){let t={};for(let n of globalThis.Object.getOwnPropertyNames(r))t[n]=Do(e,r[n]);return t}function Do(e,r){let t={...r};return Yi(r)?Pn(Do(e,er(r,[fn]))):HE(r)?So(Do(e,er(r,[za]))):Ut(r)?ZC(e,r.properties):Jn(r)?W9(e,r.keys):Am(r)?Qh(Um(e,r.parameters),Do(e,r.returns),t):Om(r)?Ys(Um(e,r.parameters),Do(e,r.returns),t):Mm(r)?qh(Do(e,r.items),t):Bm(r)?ig(Do(e,r.items),t):ur(r)?_n(Um(e,r.allOf),t):st(r)?yt(Um(e,r.anyOf),t):ri(r)?Qi(Um(e,r.items??[]),t):br(r)?Ct(X9(e,r.properties),t):Va(r)?Kh(Do(e,r.items),t):Ju(r)?ag(Do(e,r.item),t):r}function J9(e,r){let t={};for(let n of e)t[n]=Do(n,r);return t}function WC(e,r,t){let n=ni(e)?kn(e):e,o=r({[j]:"MappedKey",keys:n}),i=J9(n,o);return Ct(i,t)}p();function Y9(e){return H(er(e,[fn]))}function K9(e){return H({...e,[fn]:"Optional"})}function q9(e,r){return r===!1?Y9(e):K9(e)}function Pn(e,r){let t=r??!0;return Ut(e)?XC(e,t):q9(e,t)}function Q9(e,r){let t={};for(let n of globalThis.Object.getOwnPropertyNames(e))t[n]=Pn(e[n],r);return t}function eB(e,r){return Q9(e.properties,r)}function XC(e,r){let t=eB(e,r);return qe(t)}p();function Gm(e,r={}){let t=e.every(o=>br(o)),n=ni(r.unevaluatedProperties)?{unevaluatedProperties:r.unevaluatedProperties}:{};return H(r.unevaluatedProperties===!1||ni(r.unevaluatedProperties)||t?{...n,[j]:"Intersect",type:"object",allOf:e}:{...n,[j]:"Intersect",allOf:e},r)}function tB(e){return e.every(r=>Yi(r))}function rB(e){return er(e,[fn])}function JC(e){return e.map(r=>Yi(r)?rB(r):r)}function nB(e,r){return tB(e)?Pn(Gm(JC(e),r)):Gm(JC(e),r)}function og(e,r={}){if(e.length===0)return gt(r);if(e.length===1)return H(e[0],r);if(e.some(t=>kc(t)))throw new Error("Cannot intersect transform types");return nB(e,r)}p();function _n(e,r){if(e.length===0)return gt(r);if(e.length===1)return H(e[0],r);if(e.some(t=>kc(t)))throw new Error("Cannot intersect transform types");return Gm(e,r)}function YC(e){return e.map(r=>rv(r))}function oB(e){return _n(YC(e))}function iB(e){return yt(YC(e))}function aB(e){return rv(e)}function rv(e){return ur(e)?oB(e.allOf):st(e)?iB(e.anyOf):Ju(e)?aB(e.item):e}function KC(e,r){return H(rv(e),r)}p();p();p();p();function qC(e){let r=[];for(let t of e)r.push(Or(t));return r}function sB(e){let r=qC(e);return kC(r)}function uB(e){let r=qC(e);return PC(r)}function lB(e){return e.map((r,t)=>t.toString())}function cB(e){return["[number]"]}function pB(e){return globalThis.Object.getOwnPropertyNames(e)}function dB(e){return nv?globalThis.Object.getOwnPropertyNames(e).map(t=>t[0]==="^"&&t[t.length-1]==="$"?t.slice(1,t.length-1):t):[]}function Or(e){return ur(e)?sB(e.allOf):st(e)?uB(e.anyOf):ri(e)?lB(e.items??[]):Va(e)?cB(e.items):br(e)?pB(e.properties):jb(e)?dB(e.patternProperties):[]}var nv=!1;function Ja(e){nv=!0;let r=Or(e);return nv=!1,`^(${r.map(n=>`(${n})`).join("|")})$`}function mB(e){return e.map(r=>r==="[number]"?qi():lt(r))}function sg(e,r){if(Ut(e))return QC(e,r);{let t=Or(e),n=mB(t),o=Ki(n);return H(o,r)}}function fB(e,r){let t={};for(let n of globalThis.Object.getOwnPropertyNames(e))t[n]=sg(e[n],$t(r));return t}function hB(e,r){return fB(e.properties,r)}function QC(e,r){let t=hB(e,r);return qe(t)}p();function Ks(e){let r=Or(e),t=jm(e,r);return r.map((n,o)=>[r[o],t[o]])}function gB(e){let r=[];for(let t of e)r.push(...Or(t));return BC(r)}function yB(e){return e.filter(r=>!Ws(r))}function bB(e,r){let t=[];for(let n of e)t.push(...jm(n,[r]));return yB(t)}function vB(e,r){let t={};for(let n of r)t[n]=og(bB(e,n));return t}function eS(e,r){let t=gB(e),n=vB(e,t);return Ct(n,r)}p();p();function ug(e){return H({[j]:"Date",type:"Date"},e)}p();function lg(e){return H({[j]:"Null",type:"null"},e)}p();function cg(e){return H({[j]:"Symbol",type:"symbol"},e)}p();function pg(e){return H({[j]:"Undefined",type:"undefined"},e)}p();function dg(e){return H({[j]:"Uint8Array",type:"Uint8Array"},e)}p();function Ya(e){return H({[j]:"Unknown"},e)}function xB(e){return e.map(r=>ov(r,!1))}function IB(e){let r={};for(let t of globalThis.Object.getOwnPropertyNames(e))r[t]=So(ov(e[t],!1));return r}function mg(e,r){return r===!0?e:So(e)}function ov(e,r){return Ob(e)?mg(Js(),r):Pb(e)?mg(Js(),r):rn(e)?So(Qi(xB(e))):ja(e)?dg():Zu(e)?ug():Et(e)?mg(Ct(IB(e)),r):Bb(e)?mg(Ys([],Ya()),r):Zt(e)?pg():kb(e)?lg():_b(e)?cg():Dm(e)?Uc():ti(e)?lt(e):Hs(e)?lt(e):Bt(e)?lt(e):Ct({})}function tS(e,r){return H(ov(e,!0),r)}p();function rS(e,r){return Qi(e.parameters,r)}p();function zm(e,r){return e.map(t=>oi(t,r))}function EB(e,r){let t={};for(let n of globalThis.Object.getOwnPropertyNames(e))t[n]=oi(e[n],r);return t}function CB(e,r){return e.parameters=zm(e.parameters,r),e.returns=oi(e.returns,r),e}function SB(e,r){return e.parameters=zm(e.parameters,r),e.returns=oi(e.returns,r),e}function DB(e,r){return e.allOf=zm(e.allOf,r),e}function TB(e,r){return e.anyOf=zm(e.anyOf,r),e}function wB(e,r){return Zt(e.items)||(e.items=zm(e.items,r)),e}function FB(e,r){return e.items=oi(e.items,r),e}function MB(e,r){return e.properties=EB(e.properties,r),e}function AB(e,r){return e.item=oi(e.item,r),e}function OB(e,r){return e.items=oi(e.items,r),e}function BB(e,r){return e.items=oi(e.items,r),e}function PB(e,r){let t=r.find(o=>o.$id===e.$ref);if(t===void 0)throw Error(`Unable to dereference schema with $id ${e.$ref}`);let n=er(t,["$id"]);return oi(n,r)}function kB(e,r){return Am(e)?CB(e,r):Om(e)?SB(e,r):ur(e)?DB(e,r):st(e)?TB(e,r):ri(e)?wB(e,r):Va(e)?FB(e,r):br(e)?MB(e,r):Ju(e)?AB(e,r):Mm(e)?OB(e,r):Bm(e)?BB(e,r):Ub(e)?PB(e,r):e}function oi(e,r){return kB(wm(e),GE(r))}p();function nS(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]),o=[...new Set(t)].map(i=>lt(i));return yt(o,{...r,[Eo]:"Enum"})}p();p();p();var av=class extends Se{},G;(function(e){e[e.Union=0]="Union",e[e.True=1]="True",e[e.False=2]="False"})(G||(G={}));function To(e){return e===G.False?e:G.True}function zc(e){throw new av(e)}function mr(e){return M.IsNever(e)||M.IsIntersect(e)||M.IsUnion(e)||M.IsUnknown(e)||M.IsAny(e)}function fr(e,r){return M.IsNever(r)?cS(e,r):M.IsIntersect(r)?fg(e,r):M.IsUnion(r)?cv(e,r):M.IsUnknown(r)?fS(e,r):M.IsAny(r)?lv(e,r):zc("StructuralRight")}function lv(e,r){return G.True}function _B(e,r){return M.IsIntersect(r)?fg(e,r):M.IsUnion(r)&&r.anyOf.some(t=>M.IsAny(t)||M.IsUnknown(t))?G.True:M.IsUnion(r)?G.Union:M.IsUnknown(r)||M.IsAny(r)?G.True:G.Union}function LB(e,r){return M.IsUnknown(e)?G.False:M.IsAny(e)?G.Union:M.IsNever(e)?G.True:G.False}function RB(e,r){return M.IsObject(r)&&hg(r)?G.True:mr(r)?fr(e,r):M.IsArray(r)?To(bt(e.items,r.items)):G.False}function NB(e,r){return mr(r)?fr(e,r):M.IsAsyncIterator(r)?To(bt(e.items,r.items)):G.False}function $B(e,r){return mr(r)?fr(e,r):M.IsObject(r)?nn(e,r):M.IsRecord(r)?wo(e,r):M.IsBigInt(r)?G.True:G.False}function uS(e,r){return M.IsLiteralBoolean(e)||M.IsBoolean(e)?G.True:G.False}function jB(e,r){return mr(r)?fr(e,r):M.IsObject(r)?nn(e,r):M.IsRecord(r)?wo(e,r):M.IsBoolean(r)?G.True:G.False}function UB(e,r){return mr(r)?fr(e,r):M.IsObject(r)?nn(e,r):M.IsConstructor(r)?e.parameters.length>r.parameters.length?G.False:e.parameters.every((t,n)=>To(bt(r.parameters[n],t))===G.True)?To(bt(e.returns,r.returns)):G.False:G.False}function GB(e,r){return mr(r)?fr(e,r):M.IsObject(r)?nn(e,r):M.IsRecord(r)?wo(e,r):M.IsDate(r)?G.True:G.False}function zB(e,r){return mr(r)?fr(e,r):M.IsObject(r)?nn(e,r):M.IsFunction(r)?e.parameters.length>r.parameters.length?G.False:e.parameters.every((t,n)=>To(bt(r.parameters[n],t))===G.True)?To(bt(e.returns,r.returns)):G.False:G.False}function lS(e,r){return M.IsLiteral(e)&&Ye.IsNumber(e.const)||M.IsNumber(e)||M.IsInteger(e)?G.True:G.False}function VB(e,r){return M.IsInteger(r)||M.IsNumber(r)?G.True:mr(r)?fr(e,r):M.IsObject(r)?nn(e,r):M.IsRecord(r)?wo(e,r):G.False}function fg(e,r){return r.allOf.every(t=>bt(e,t)===G.True)?G.True:G.False}function HB(e,r){return e.allOf.some(t=>bt(t,r)===G.True)?G.True:G.False}function ZB(e,r){return mr(r)?fr(e,r):M.IsIterator(r)?To(bt(e.items,r.items)):G.False}function WB(e,r){return M.IsLiteral(r)&&r.const===e.const?G.True:mr(r)?fr(e,r):M.IsObject(r)?nn(e,r):M.IsRecord(r)?wo(e,r):M.IsString(r)?mS(e,r):M.IsNumber(r)?pS(e,r):M.IsInteger(r)?lS(e,r):M.IsBoolean(r)?uS(e,r):G.False}function cS(e,r){return G.False}function XB(e,r){return G.True}function oS(e){let[r,t]=[e,0];for(;M.IsNot(r);)r=r.not,t+=1;return t%2===0?r:Ya()}function JB(e,r){return M.IsNot(e)?bt(oS(e),r):M.IsNot(r)?bt(e,oS(r)):zc("Invalid fallthrough for Not")}function YB(e,r){return mr(r)?fr(e,r):M.IsObject(r)?nn(e,r):M.IsRecord(r)?wo(e,r):M.IsNull(r)?G.True:G.False}function pS(e,r){return M.IsLiteralNumber(e)||M.IsNumber(e)||M.IsInteger(e)?G.True:G.False}function KB(e,r){return mr(r)?fr(e,r):M.IsObject(r)?nn(e,r):M.IsRecord(r)?wo(e,r):M.IsInteger(r)||M.IsNumber(r)?G.True:G.False}function Ln(e,r){return Object.getOwnPropertyNames(e.properties).length===r}function iS(e){return hg(e)}function aS(e){return Ln(e,0)||Ln(e,1)&&"description"in e.properties&&M.IsUnion(e.properties.description)&&e.properties.description.anyOf.length===2&&(M.IsString(e.properties.description.anyOf[0])&&M.IsUndefined(e.properties.description.anyOf[1])||M.IsString(e.properties.description.anyOf[1])&&M.IsUndefined(e.properties.description.anyOf[0]))}function iv(e){return Ln(e,0)}function sS(e){return Ln(e,0)}function qB(e){return Ln(e,0)}function QB(e){return Ln(e,0)}function eP(e){return hg(e)}function tP(e){let r=qi();return Ln(e,0)||Ln(e,1)&&"length"in e.properties&&To(bt(e.properties.length,r))===G.True}function rP(e){return Ln(e,0)}function hg(e){let r=qi();return Ln(e,0)||Ln(e,1)&&"length"in e.properties&&To(bt(e.properties.length,r))===G.True}function nP(e){let r=Ys([Js()],Js());return Ln(e,0)||Ln(e,1)&&"then"in e.properties&&To(bt(e.properties.then,r))===G.True}function dS(e,r){return bt(e,r)===G.False||M.IsOptional(e)&&!M.IsOptional(r)?G.False:G.True}function nn(e,r){return M.IsUnknown(e)?G.False:M.IsAny(e)?G.Union:M.IsNever(e)||M.IsLiteralString(e)&&iS(r)||M.IsLiteralNumber(e)&&iv(r)||M.IsLiteralBoolean(e)&&sS(r)||M.IsSymbol(e)&&aS(r)||M.IsBigInt(e)&&qB(r)||M.IsString(e)&&iS(r)||M.IsSymbol(e)&&aS(r)||M.IsNumber(e)&&iv(r)||M.IsInteger(e)&&iv(r)||M.IsBoolean(e)&&sS(r)||M.IsUint8Array(e)&&eP(r)||M.IsDate(e)&&QB(r)||M.IsConstructor(e)&&rP(r)||M.IsFunction(e)&&tP(r)?G.True:M.IsRecord(e)&&M.IsString(sv(e))?r[Eo]==="Record"?G.True:G.False:M.IsRecord(e)&&M.IsNumber(sv(e))?Ln(r,0)?G.True:G.False:G.False}function oP(e,r){return mr(r)?fr(e,r):M.IsRecord(r)?wo(e,r):M.IsObject(r)?(()=>{for(let t of Object.getOwnPropertyNames(r.properties)){if(!(t in e.properties)&&!M.IsOptional(r.properties[t]))return G.False;if(M.IsOptional(r.properties[t]))return G.True;if(dS(e.properties[t],r.properties[t])===G.False)return G.False}return G.True})():G.False}function iP(e,r){return mr(r)?fr(e,r):M.IsObject(r)&&nP(r)?G.True:M.IsPromise(r)?To(bt(e.item,r.item)):G.False}function sv(e){return Za in e.patternProperties?qi():Wa in e.patternProperties?Co():zc("Unknown record key pattern")}function uv(e){return Za in e.patternProperties?e.patternProperties[Za]:Wa in e.patternProperties?e.patternProperties[Wa]:zc("Unable to get record value schema")}function wo(e,r){let[t,n]=[sv(r),uv(r)];return M.IsLiteralString(e)&&M.IsNumber(t)&&To(bt(e,n))===G.True?G.True:M.IsUint8Array(e)&&M.IsNumber(t)||M.IsString(e)&&M.IsNumber(t)||M.IsArray(e)&&M.IsNumber(t)?bt(e,n):M.IsObject(e)?(()=>{for(let o of Object.getOwnPropertyNames(e.properties))if(dS(n,e.properties[o])===G.False)return G.False;return G.True})():G.False}function aP(e,r){return mr(r)?fr(e,r):M.IsObject(r)?nn(e,r):M.IsRecord(r)?bt(uv(e),uv(r)):G.False}function sP(e,r){let t=M.IsRegExp(e)?Co():e,n=M.IsRegExp(r)?Co():r;return bt(t,n)}function mS(e,r){return M.IsLiteral(e)&&Ye.IsString(e.const)||M.IsString(e)?G.True:G.False}function uP(e,r){return mr(r)?fr(e,r):M.IsObject(r)?nn(e,r):M.IsRecord(r)?wo(e,r):M.IsString(r)?G.True:G.False}function lP(e,r){return mr(r)?fr(e,r):M.IsObject(r)?nn(e,r):M.IsRecord(r)?wo(e,r):M.IsSymbol(r)?G.True:G.False}function cP(e,r){return M.IsTemplateLiteral(e)?bt(Ku(e),r):M.IsTemplateLiteral(r)?bt(e,Ku(r)):zc("Invalid fallthrough for TemplateLiteral")}function pP(e,r){return M.IsArray(r)&&e.items!==void 0&&e.items.every(t=>bt(t,r.items)===G.True)}function dP(e,r){return M.IsNever(e)?G.True:M.IsUnknown(e)?G.False:M.IsAny(e)?G.Union:G.False}function mP(e,r){return mr(r)?fr(e,r):M.IsObject(r)&&hg(r)||M.IsArray(r)&&pP(e,r)?G.True:M.IsTuple(r)?Ye.IsUndefined(e.items)&&!Ye.IsUndefined(r.items)||!Ye.IsUndefined(e.items)&&Ye.IsUndefined(r.items)?G.False:Ye.IsUndefined(e.items)&&!Ye.IsUndefined(r.items)||e.items.every((t,n)=>bt(t,r.items[n])===G.True)?G.True:G.False:G.False}function fP(e,r){return mr(r)?fr(e,r):M.IsObject(r)?nn(e,r):M.IsRecord(r)?wo(e,r):M.IsUint8Array(r)?G.True:G.False}function hP(e,r){return mr(r)?fr(e,r):M.IsObject(r)?nn(e,r):M.IsRecord(r)?wo(e,r):M.IsVoid(r)?bP(e,r):M.IsUndefined(r)?G.True:G.False}function cv(e,r){return r.anyOf.some(t=>bt(e,t)===G.True)?G.True:G.False}function gP(e,r){return e.anyOf.every(t=>bt(t,r)===G.True)?G.True:G.False}function fS(e,r){return G.True}function yP(e,r){return M.IsNever(r)?cS(e,r):M.IsIntersect(r)?fg(e,r):M.IsUnion(r)?cv(e,r):M.IsAny(r)?lv(e,r):M.IsString(r)?mS(e,r):M.IsNumber(r)?pS(e,r):M.IsInteger(r)?lS(e,r):M.IsBoolean(r)?uS(e,r):M.IsArray(r)?LB(e,r):M.IsTuple(r)?dP(e,r):M.IsObject(r)?nn(e,r):M.IsUnknown(r)?G.True:G.False}function bP(e,r){return M.IsUndefined(e)||M.IsUndefined(e)?G.True:G.False}function vP(e,r){return M.IsIntersect(r)?fg(e,r):M.IsUnion(r)?cv(e,r):M.IsUnknown(r)?fS(e,r):M.IsAny(r)?lv(e,r):M.IsObject(r)?nn(e,r):M.IsVoid(r)?G.True:G.False}function bt(e,r){return M.IsTemplateLiteral(e)||M.IsTemplateLiteral(r)?cP(e,r):M.IsRegExp(e)||M.IsRegExp(r)?sP(e,r):M.IsNot(e)||M.IsNot(r)?JB(e,r):M.IsAny(e)?_B(e,r):M.IsArray(e)?RB(e,r):M.IsBigInt(e)?$B(e,r):M.IsBoolean(e)?jB(e,r):M.IsAsyncIterator(e)?NB(e,r):M.IsConstructor(e)?UB(e,r):M.IsDate(e)?GB(e,r):M.IsFunction(e)?zB(e,r):M.IsInteger(e)?VB(e,r):M.IsIntersect(e)?HB(e,r):M.IsIterator(e)?ZB(e,r):M.IsLiteral(e)?WB(e,r):M.IsNever(e)?XB(e,r):M.IsNull(e)?YB(e,r):M.IsNumber(e)?KB(e,r):M.IsObject(e)?oP(e,r):M.IsRecord(e)?aP(e,r):M.IsString(e)?uP(e,r):M.IsSymbol(e)?lP(e,r):M.IsTuple(e)?mP(e,r):M.IsPromise(e)?iP(e,r):M.IsUint8Array(e)?fP(e,r):M.IsUndefined(e)?hP(e,r):M.IsUnion(e)?gP(e,r):M.IsUnknown(e)?yP(e,r):M.IsVoid(e)?vP(e,r):zc(`Unknown left type operand '${e[j]}'`)}function qs(e,r){return bt(e,r)}p();p();p();function xP(e,r,t,n,o){let i={};for(let s of globalThis.Object.getOwnPropertyNames(e))i[s]=Vc(e[s],r,t,n,$t(o));return i}function IP(e,r,t,n,o){return xP(e.properties,r,t,n,o)}function hS(e,r,t,n,o){let i=IP(e,r,t,n,o);return qe(i)}function EP(e,r,t,n){let o=qs(e,r);return o===G.Union?yt([t,n]):o===G.True?t:n}function Vc(e,r,t,n,o){return Ut(e)?hS(e,r,t,n,o):Jn(e)?H(gS(e,r,t,n,o)):H(EP(e,r,t,n),o)}function CP(e,r,t,n,o){return{[e]:Vc(lt(e),r,t,n,$t(o))}}function SP(e,r,t,n,o){return e.reduce((i,s)=>({...i,...CP(s,r,t,n,o)}),{})}function DP(e,r,t,n,o){return SP(e.keys,r,t,n,o)}function gS(e,r,t,n,o){let i=DP(e,r,t,n,o);return qe(i)}p();function TP(e){return e.allOf.every(r=>Ka(r))}function wP(e){return e.anyOf.some(r=>Ka(r))}function FP(e){return!Ka(e.not)}function Ka(e){return e[j]==="Intersect"?TP(e):e[j]==="Union"?wP(e):e[j]==="Not"?FP(e):e[j]==="Undefined"}p();function yS(e,r){return Hc(Ku(e),r)}function MP(e,r){let t=e.filter(n=>qs(n,r)===G.False);return t.length===1?t[0]:yt(t)}function Hc(e,r,t={}){return Yn(e)?H(yS(e,r),t):Ut(e)?H(bS(e,r),t):H(st(e)?MP(e.anyOf,r):qs(e,r)!==G.False?gt():e,t)}function AP(e,r){let t={};for(let n of globalThis.Object.getOwnPropertyNames(e))t[n]=Hc(e[n],r);return t}function OP(e,r){return AP(e.properties,r)}function bS(e,r){let t=OP(e,r);return qe(t)}p();p();p();function vS(e,r){return Zc(Ku(e),r)}function BP(e,r){let t=e.filter(n=>qs(n,r)!==G.False);return t.length===1?t[0]:yt(t)}function Zc(e,r,t){return Yn(e)?H(vS(e,r),t):Ut(e)?H(xS(e,r),t):H(st(e)?BP(e.anyOf,r):qs(e,r)!==G.False?e:gt(),t)}function PP(e,r){let t={};for(let n of globalThis.Object.getOwnPropertyNames(e))t[n]=Zc(e[n],r);return t}function kP(e,r){return PP(e.properties,r)}function xS(e,r){let t=kP(e,r);return qe(t)}p();function IS(e,r){return H(e.returns,r)}p();function ES(e){return H({[j]:"Integer",type:"integer"},e)}p();p();p();function _P(e,r,t){return{[e]:ii(lt(e),r,$t(t))}}function LP(e,r,t){return e.reduce((o,i)=>({...o,..._P(i,r,t)}),{})}function RP(e,r,t){return LP(e.keys,r,t)}function CS(e,r,t){let n=RP(e,r,t);return qe(n)}function NP(e){let[r,t]=[e.slice(0,1),e.slice(1)];return[r.toLowerCase(),t].join("")}function $P(e){let[r,t]=[e.slice(0,1),e.slice(1)];return[r.toUpperCase(),t].join("")}function jP(e){return e.toUpperCase()}function UP(e){return e.toLowerCase()}function GP(e,r,t){let n=$c(e.pattern);if(!Yu(n))return{...e,pattern:SS(e.pattern,r)};let s=[...$m(n)].map(c=>lt(c)),u=DS(s,r),l=yt(u);return ng([l],t)}function SS(e,r){return typeof e=="string"?r==="Uncapitalize"?NP(e):r==="Capitalize"?$P(e):r==="Uppercase"?jP(e):r==="Lowercase"?UP(e):e:e.toString()}function DS(e,r){return e.map(t=>ii(t,r))}function ii(e,r,t={}){return Jn(e)?CS(e,r,t):Yn(e)?GP(e,r,t):st(e)?yt(DS(e.anyOf,r),t):Ha(e)?lt(SS(e.const,r),t):H(e,t)}function TS(e,r={}){return ii(e,"Capitalize",r)}p();function wS(e,r={}){return ii(e,"Lowercase",r)}p();function FS(e,r={}){return ii(e,"Uncapitalize",r)}p();function MS(e,r={}){return ii(e,"Uppercase",r)}p();function AS(e,r){return H({[j]:"Not",not:e},r)}p();p();p();function zP(e,r,t){let n={};for(let o of globalThis.Object.getOwnPropertyNames(e))n[o]=Wc(e[o],r,$t(t));return n}function VP(e,r,t){return zP(e.properties,r,t)}function OS(e,r,t){let n=VP(e,r,t);return qe(n)}function HP(e,r){return e.map(t=>pv(t,r))}function ZP(e,r){return e.map(t=>pv(t,r))}function WP(e,r){let{[r]:t,...n}=e;return n}function XP(e,r){return r.reduce((t,n)=>WP(t,n),e)}function JP(e,r){let t=er(e,[jt,"$id","required","properties"]),n=XP(e.properties,r);return Ct(n,t)}function pv(e,r){return ur(e)?_n(HP(e.allOf,r)):st(e)?yt(ZP(e.anyOf,r)):br(e)?JP(e,r):Ct({})}function Wc(e,r,t){if(Jn(r))return BS(e,r,t);if(Ut(e))return OS(e,r,t);let n=ni(r)?kn(r):r;return H({...pv(e,n),...t})}function YP(e,r,t){return{[r]:Wc(e,[r],$t(t))}}function KP(e,r,t){return r.reduce((n,o)=>({...n,...YP(e,o,t)}),{})}function qP(e,r,t){return KP(e,r.keys,t)}function BS(e,r,t){let n=qP(e,r,t);return qe(n)}p();function PS(e,r){return Qi(e.parameters,r)}p();p();function kS(e){return e.map(r=>_S(r))}function QP(e){let r={};for(let t of globalThis.Object.getOwnPropertyNames(e))r[t]=Pn(e[t]);return r}function ek(e){let r=er(e,[jt,"$id","required","properties"]),t=QP(e.properties);return Ct(t,r)}function _S(e){return ur(e)?_n(kS(e.allOf)):st(e)?yt(kS(e.anyOf)):br(e)?ek(e):Ct({})}function gg(e,r){return Ut(e)?LS(e,r):H({..._S(e),...r})}function tk(e,r){let t={};for(let n of globalThis.Object.getOwnPropertyNames(e))t[n]=gg(e[n],$t(r));return t}function rk(e,r){return tk(e.properties,r)}function LS(e,r){let t=rk(e,r);return qe(t)}p();p();p();function nk(e,r,t){let n={};for(let o of globalThis.Object.getOwnPropertyNames(e))n[o]=Xc(e[o],r,$t(t));return n}function ok(e,r,t){return nk(e.properties,r,t)}function RS(e,r,t){let n=ok(e,r,t);return qe(n)}function ik(e,r){return e.map(t=>dv(t,r))}function ak(e,r){return e.map(t=>dv(t,r))}function sk(e,r){let t={};for(let n of r)n in e&&(t[n]=e[n]);return t}function uk(e,r){let t=er(e,[jt,"$id","required","properties"]),n=sk(e.properties,r);return Ct(n,t)}function dv(e,r){return ur(e)?_n(ik(e.allOf,r)):st(e)?yt(ak(e.anyOf,r)):br(e)?uk(e,r):Ct({})}function Xc(e,r,t){if(Jn(r))return NS(e,r,t);if(Ut(e))return RS(e,r,t);let n=ni(r)?kn(r):r;return H({...dv(e,n),...t})}function lk(e,r,t){return{[r]:Xc(e,[r],$t(t))}}function ck(e,r,t){return r.reduce((n,o)=>({...n,...lk(e,o,t)}),{})}function pk(e,r,t){return ck(e,r.keys,t)}function NS(e,r,t){let n=pk(e,r,t);return qe(n)}p();function $S(e){return So(Pn(e))}p();function qu(e,r,t){return H({[j]:"Record",type:"object",patternProperties:{[e]:r}},t)}function mv(e,r,t){let n={};for(let o of e)n[o]=r;return Ct(n,{...t,[Eo]:"Record"})}function dk(e,r,t){return tg(e)?mv(kn(e),r,t):qu(e.pattern,r,t)}function mk(e,r,t){return mv(kn(yt(e)),r,t)}function fk(e,r,t){return mv([e.toString()],r,t)}function hk(e,r,t){return qu(e.source,r,t)}function gk(e,r,t){let n=Zt(e.pattern)?Wa:e.pattern;return qu(n,r,t)}function yk(e,r,t){return qu(Wa,r,t)}function bk(e,r,t){return qu(AC,r,t)}function vk(e,r,t){return qu(Za,r,t)}function xk(e,r,t){return qu(Za,r,t)}function jS(e,r,t={}){return st(e)?mk(e.anyOf,r,t):Yn(e)?dk(e,r,t):Ha(e)?fk(e.const,r,t):Wu(e)?vk(e,r,t):Xu(e)?xk(e,r,t):Gb(e)?hk(e,r,t):Pm(e)?gk(e,r,t):Rb(e)?yk(e,r,t):Ws(e)?bk(e,r,t):gt(t)}p();var Ik=0;function US(e,r={}){Zt(r.$id)&&(r.$id=`T${Ik++}`);let t=wm(e({[j]:"This",$ref:`${r.$id}`}));return t.$id=r.$id,H({[Eo]:"Recursive",...t},r)}p();function GS(e,r){if(Bt(e))return H({[j]:"Ref",$ref:e},r);if(Zt(e.$id))throw new Error("Reference target type must specify an $id");return H({[j]:"Ref",$ref:e.$id},r)}p();function zS(e,r){let t=Bt(e)?new globalThis.RegExp(e):e;return H({[j]:"RegExp",type:"RegExp",source:t.source,flags:t.flags},r)}p();p();function VS(e){return e.map(r=>HS(r))}function Ek(e){let r={};for(let t of globalThis.Object.getOwnPropertyNames(e))r[t]=er(e[t],[fn]);return r}function Ck(e){let r=er(e,[jt,"$id","required","properties"]),t=Ek(e.properties);return Ct(t,r)}function HS(e){return ur(e)?_n(VS(e.allOf)):st(e)?yt(VS(e.anyOf)):br(e)?Ck(e):Ct({})}function yg(e,r){return Ut(e)?ZS(e,r):H({...HS(e),...r})}function Sk(e,r){let t={};for(let n of globalThis.Object.getOwnPropertyNames(e))t[n]=yg(e[n],r);return t}function Dk(e,r){return Sk(e.properties,r)}function ZS(e,r){let t=Dk(e,r);return qe(t)}p();function Tk(e){return ur(e)?e.allOf:st(e)?e.anyOf:ri(e)?e.items??[]:[]}function WS(e){return Tk(e)}p();function XS(e,r){return H(e.returns,r)}p();function JS(e){return JSON.parse(JSON.stringify(e))}p();var fv=class{constructor(r){this.schema=r}Decode(r){return new hv(this.schema,r)}},hv=class{constructor(r,t){this.schema=r,this.decode=t}EncodeTransform(r,t){let i={Encode:s=>t[jt].Encode(r(s)),Decode:s=>this.decode(t[jt].Decode(s))};return{...t,[jt]:i}}EncodeSchema(r,t){let n={Decode:this.decode,Encode:r};return{...t,[jt]:n}}Encode(r){return kc(this.schema)?this.EncodeTransform(r,this.schema):this.EncodeSchema(r,this.schema)}};function YS(e){return new fv(e)}p();function bg(e={}){return H({[j]:e[j]??"Unsafe"},e)}p();function KS(e){return H({[j]:"Void",type:"void"},e)}p();var gv={};$s(gv,{Any:()=>Js,Array:()=>Kh,AsyncIterator:()=>qh,Awaited:()=>KC,BigInt:()=>Uc,Boolean:()=>rg,Capitalize:()=>TS,Composite:()=>eS,Const:()=>tS,Constructor:()=>Qh,ConstructorParameters:()=>rS,Date:()=>ug,Deref:()=>oi,Enum:()=>nS,Exclude:()=>Hc,Extends:()=>Vc,Extract:()=>Zc,Function:()=>Ys,Index:()=>Gc,InstanceType:()=>IS,Integer:()=>ES,Intersect:()=>_n,Iterator:()=>ig,KeyOf:()=>sg,Literal:()=>lt,Lowercase:()=>wS,Mapped:()=>WC,Never:()=>gt,Not:()=>AS,Null:()=>lg,Number:()=>qi,Object:()=>Ct,Omit:()=>Wc,Optional:()=>Pn,Parameters:()=>PS,Partial:()=>gg,Pick:()=>Xc,Promise:()=>ag,Readonly:()=>So,ReadonlyOptional:()=>$S,Record:()=>jS,Recursive:()=>US,Ref:()=>GS,RegExp:()=>zS,Required:()=>yg,Rest:()=>WS,ReturnType:()=>XS,Strict:()=>JS,String:()=>Co,Symbol:()=>cg,TemplateLiteral:()=>ng,Transform:()=>YS,Tuple:()=>Qi,Uint8Array:()=>dg,Uncapitalize:()=>FS,Undefined:()=>pg,Union:()=>yt,Unknown:()=>Ya,Unsafe:()=>bg,Uppercase:()=>MS,Void:()=>KS});p();var g=gv;p();var Vm=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."}),yv=g.Partial(Vm,{$id:"Details",description:"Additional information about a given entity."}),Kn=g.Object({details:g.Optional(g.Ref(yv))},{$id:"WithDetails"}),Qu=e=>{let r=[...e].sort(),t=g.Pick(Vm,e),n=g.Omit(Vm,e);return g.Object({details:g.Intersect([t,g.Partial(n)])},{$id:`WithRequiredDetails_${r.join("_")}`})},bv=[Vm,yv];p();var Jc=g.Number({$id:"Longitude",minimum:-180,maximum:180,description:"A WGS 84-compatible longitude coordinate value."}),Yc=g.Number({$id:"Latitude",minimum:-90,maximum:90,description:"A WGS 84-compatible latitude coordinate value."}),el=g.Tuple([g.Ref(Jc),g.Ref(Yc)],{$id:"Position",minItems:2,maxItems:2,description:"A valid WGS 84 position consisting of a longitude value, followed by a latitude value."}),on=g.Object({type:g.Literal("Point"),coordinates:g.Ref(el)},{$id:"Point",description:"An RFC-7946 compatible GeoJSON Point geometry."}),vg=g.Object({type:g.Literal("MultiPoint"),coordinates:g.Array(g.Ref(el))},{$id:"MultiPoint",description:"An RFC-7946 compatible GeoJSON MultiPoint geometry."}),xg=g.Object({type:g.Literal("LineString"),coordinates:g.Array(g.Ref(el),{minItems:2,description:"At least two positions are required."})},{$id:"LineString",description:"An RFC-7946 compatible GeoJSON LineString geometry."}),Ig=g.Object({type:g.Literal("MultiLineString"),coordinates:g.Array(g.Array(g.Ref(el),{minItems:2}))},{$id:"MultiLineString",description:"An RFC-7946 compatible GeoJSON MultiLineString geometry."}),qS=g.Array(g.Ref(el),{$id:"LinearRing",minItems:4,description:"A linear ring is a building block of a polygon or multi-polygon."}),vv=g.Array(g.Ref(qS),{$id:"LinearRings",minItems:1,description:"A collection of linear rings, at least one of which is the exterior ring of a polygon."}),Kc=g.Object({type:g.Literal("Polygon"),coordinates:g.Ref(vv)},{$id:"Polygon",description:"An RFC-7946 compatible GeoJSON Polygon geometry."}),qc=g.Object({type:g.Literal("MultiPolygon"),coordinates:g.Array(g.Ref(vv))},{$id:"MultiPolygon",description:"An RFC-7946 compatible GeoJSON MultiPolygon geometry."}),Vr=(e,r,t)=>g.Object({type:g.Literal("Feature"),geometry:e,properties:r},t),hn=(e,r,t)=>g.Object({type:g.Literal("FeatureCollection"),features:g.Array(e,t)},r),xv=[Jc,Yc,el,on,vg,xg,Ig,qS,vv,Kc,qc];p();var tr=(e,r)=>g.Unsafe(g.String({$id:r,pattern:`^${e}_[A-Za-z0-9-]+$`})),an=tr("g","GeometryId"),ze=tr("f","FloorId"),Iv=[an,ze];p();p();p();var Eg=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}}},Cg=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 QS(r(this.value))}mapAsync(r){return r(this.value).then(t=>QS(t))}mapOr(r,t){return this.map(r).unwrapOr(t)}mapOrAsync(r,t){return this.mapAsync(r).then(n=>n.unwrapOr(t))}mapOrElse(r,t){return this.map(r).unwrapOrElse(t)}mapOrElseAsync(r,t){return this.mapAsync(r).then(n=>n.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:Qs()}or(r){return this}orElse(r){return this}xor(r){return r.isSome()?Qs():this}toString(){return`Some(${this.value})`}okOr(r){return te(this.value)}okOrElse(r){return te(this.value)}iter(){return new Eg(this.value)}[Symbol.iterator](){return this.iter()}zip(r){return r.isSome()?Qc([this.value,r.value]):Qs()}zipWith(r,t){return r.isSome()?Qc(t(this.value,r.value)):Qs()}get[Symbol.toStringTag](){return"Some"}},Sg=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 oe(r)}okOrElse(r){return oe(r())}iter(){return new Eg(null)}[Symbol.iterator](){return this.iter()}zip(r){return this}zipWith(r,t){return this}get[Symbol.toStringTag](){return"None"}},Qc=e=>new Cg(e),Qs=()=>new Sg,QS=e=>e instanceof Cg||e instanceof Sg?e:e==null?Qs():Qc(e);var Dg=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}}},Ev=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 Qc(this.value)}err(){return Qs()}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 te(r(this.value))}async mapAsync(r){return r(this.value).then(te)}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 Dg(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"}},Cv=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 Qs()}err(){return Qc(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 Dg(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"}},te=e=>new Ev(e),oe=e=>new Cv(e);p();var Rn;(function(e){e.GeometryMissingError="GeometryMissingError",e.FloorMissingError="FloorMissingError",e.UnknownFloorError="UnknownFloorError",e.UnknownGeometryError="UnknownGeometryError",e.DuplicateIdError="DuplicateIdError"})(Rn||(Rn={}));p();p();p();p();var Sv=class extends Se{constructor(r){super(`Duplicate type kind '${r}' detected`)}},Hm=class extends Se{constructor(r){super(`Duplicate string format '${r}' detected`)}},Tg;(function(e){function r(n,o){if(Ar.Has(n))throw new Sv(n);return Ar.Set(n,o),(i={})=>bg({...i,[j]:n})}e.Type=r;function t(n,o){if(Bn.Has(n))throw new Hm(n);return Bn.Set(n,o),n}e.Format=t})(Tg||(Tg={}));p();function wk(e){switch(e.errorType){case U.ArrayContains:return"Expected array to contain at least one matching value";case U.ArrayMaxContains:return`Expected array to contain no more than ${e.schema.maxContains} matching values`;case U.ArrayMinContains:return`Expected array to contain at least ${e.schema.minContains} matching values`;case U.ArrayMaxItems:return`Expected array length to be less or equal to ${e.schema.maxItems}`;case U.ArrayMinItems:return`Expected array length to be greater or equal to ${e.schema.minItems}`;case U.ArrayUniqueItems:return"Expected array elements to be unique";case U.Array:return"Expected array";case U.AsyncIterator:return"Expected AsyncIterator";case U.BigIntExclusiveMaximum:return`Expected bigint to be less than ${e.schema.exclusiveMaximum}`;case U.BigIntExclusiveMinimum:return`Expected bigint to be greater than ${e.schema.exclusiveMinimum}`;case U.BigIntMaximum:return`Expected bigint to be less or equal to ${e.schema.maximum}`;case U.BigIntMinimum:return`Expected bigint to be greater or equal to ${e.schema.minimum}`;case U.BigIntMultipleOf:return`Expected bigint to be a multiple of ${e.schema.multipleOf}`;case U.BigInt:return"Expected bigint";case U.Boolean:return"Expected boolean";case U.DateExclusiveMinimumTimestamp:return`Expected Date timestamp to be greater than ${e.schema.exclusiveMinimumTimestamp}`;case U.DateExclusiveMaximumTimestamp:return`Expected Date timestamp to be less than ${e.schema.exclusiveMaximumTimestamp}`;case U.DateMinimumTimestamp:return`Expected Date timestamp to be greater or equal to ${e.schema.minimumTimestamp}`;case U.DateMaximumTimestamp:return`Expected Date timestamp to be less or equal to ${e.schema.maximumTimestamp}`;case U.DateMultipleOfTimestamp:return`Expected Date timestamp to be a multiple of ${e.schema.multipleOfTimestamp}`;case U.Date:return"Expected Date";case U.Function:return"Expected function";case U.IntegerExclusiveMaximum:return`Expected integer to be less than ${e.schema.exclusiveMaximum}`;case U.IntegerExclusiveMinimum:return`Expected integer to be greater than ${e.schema.exclusiveMinimum}`;case U.IntegerMaximum:return`Expected integer to be less or equal to ${e.schema.maximum}`;case U.IntegerMinimum:return`Expected integer to be greater or equal to ${e.schema.minimum}`;case U.IntegerMultipleOf:return`Expected integer to be a multiple of ${e.schema.multipleOf}`;case U.Integer:return"Expected integer";case U.IntersectUnevaluatedProperties:return"Unexpected property";case U.Intersect:return"Expected all values to match";case U.Iterator:return"Expected Iterator";case U.Literal:return`Expected ${typeof e.schema.const=="string"?`'${e.schema.const}'`:e.schema.const}`;case U.Never:return"Never";case U.Not:return"Value should not match";case U.Null:return"Expected null";case U.NumberExclusiveMaximum:return`Expected number to be less than ${e.schema.exclusiveMaximum}`;case U.NumberExclusiveMinimum:return`Expected number to be greater than ${e.schema.exclusiveMinimum}`;case U.NumberMaximum:return`Expected number to be less or equal to ${e.schema.maximum}`;case U.NumberMinimum:return`Expected number to be greater or equal to ${e.schema.minimum}`;case U.NumberMultipleOf:return`Expected number to be a multiple of ${e.schema.multipleOf}`;case U.Number:return"Expected number";case U.Object:return"Expected object";case U.ObjectAdditionalProperties:return"Unexpected property";case U.ObjectMaxProperties:return`Expected object to have no more than ${e.schema.maxProperties} properties`;case U.ObjectMinProperties:return`Expected object to have at least ${e.schema.minProperties} properties`;case U.ObjectRequiredProperty:return"Expected required property";case U.Promise:return"Expected Promise";case U.RegExp:return"Expected string to match regular expression";case U.StringFormatUnknown:return`Unknown format '${e.schema.format}'`;case U.StringFormat:return`Expected string to match '${e.schema.format}' format`;case U.StringMaxLength:return`Expected string length less or equal to ${e.schema.maxLength}`;case U.StringMinLength:return`Expected string length greater or equal to ${e.schema.minLength}`;case U.StringPattern:return`Expected string to match '${e.schema.pattern}'`;case U.String:return"Expected string";case U.Symbol:return"Expected symbol";case U.TupleLength:return`Expected tuple to have ${e.schema.maxItems||0} elements`;case U.Tuple:return"Expected tuple";case U.Uint8ArrayMaxByteLength:return`Expected byte length less or equal to ${e.schema.maxByteLength}`;case U.Uint8ArrayMinByteLength:return`Expected byte length greater or equal to ${e.schema.minByteLength}`;case U.Uint8Array:return"Expected Uint8Array";case U.Undefined:return"Expected undefined";case U.Union:return"Expected union value";case U.Void:return"Expected void";case U.Kind:return`Expected kind '${e.schema[j]}'`;default:return"Unknown error type"}}var Fk=wk;function e5(){return Fk}p();var Dv=class extends Se{constructor(r){super(`Unable to dereference schema with $id '${r.$ref}'`),this.schema=r}};function Mk(e,r){let t=r.find(n=>n.$id===e.$ref);if(t===void 0)throw new Dv(e);return Qe(t,r)}function Fo(e,r){return!He(e.$id)||r.some(t=>t.$id===e.$id)||r.push(e),r}function Qe(e,r){return e[j]==="This"||e[j]==="Ref"?Mk(e,r):e}p();var Tv=class extends Se{constructor(r){super("Unable to hash value"),this.value=r}},qn;(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"})(qn||(qn={}));var ep=BigInt("14695981039346656037"),[Ak,Ok]=[BigInt("1099511628211"),BigInt("18446744073709551616")],Bk=Array.from({length:256}).map((e,r)=>BigInt(r)),t5=new Float64Array(1),r5=new DataView(t5.buffer),n5=new Uint8Array(t5.buffer);function*Pk(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 kk(e){sn(qn.Array);for(let r of e)tp(r)}function _k(e){sn(qn.Boolean),sn(e?1:0)}function Lk(e){sn(qn.BigInt),r5.setBigInt64(0,e);for(let r of n5)sn(r)}function Rk(e){sn(qn.Date),tp(e.getTime())}function Nk(e){sn(qn.Null)}function $k(e){sn(qn.Number),r5.setFloat64(0,e);for(let r of n5)sn(r)}function jk(e){sn(qn.Object);for(let r of globalThis.Object.getOwnPropertyNames(e).sort())tp(r),tp(e[r])}function Uk(e){sn(qn.String);for(let r=0;r<e.length;r++)for(let t of Pk(e.charCodeAt(r)))sn(t)}function Gk(e){sn(qn.Symbol),tp(e.description)}function zk(e){sn(qn.Uint8Array);for(let r=0;r<e.length;r++)sn(e[r])}function Vk(e){return sn(qn.Undefined)}function tp(e){if(Me(e))return kk(e);if(Ji(e))return _k(e);if(Gr(e))return Lk(e);if(mn(e))return Rk(e);if(Ua(e))return Nk(e);if(ye(e))return $k(e);if(Be(e))return jk(e);if(He(e))return Uk(e);if(Ga(e))return Gk(e);if(Pc(e))return zk(e);if(Wt(e))return Vk(e);throw new Tv(e)}function sn(e){ep=ep^Bk[e],ep=ep*Ak%Ok}function eu(e){return ep=BigInt("14695981039346656037"),tp(e),ep}p();var wv=class extends Se{constructor(r){super("Unknown type"),this.schema=r}};function Hk(e){return e[j]==="Any"||e[j]==="Unknown"}function je(e){return e!==void 0}function Zk(e,r,t){return!0}function Wk(e,r,t){if(!Me(t)||je(e.minItems)&&!(t.length>=e.minItems)||je(e.maxItems)&&!(t.length<=e.maxItems)||!t.every(i=>Hr(e.items,r,i))||e.uniqueItems===!0&&!function(){let i=new Set;for(let s of t){let u=eu(s);if(i.has(u))return!1;i.add(u)}return!0}())return!1;if(!(je(e.contains)||ye(e.minContains)||ye(e.maxContains)))return!0;let n=je(e.contains)?e.contains:gt(),o=t.reduce((i,s)=>Hr(n,r,s)?i+1:i,0);return!(o===0||ye(e.minContains)&&o<e.minContains||ye(e.maxContains)&&o>e.maxContains)}function Xk(e,r,t){return Wh(t)}function Jk(e,r,t){return!(!Gr(t)||je(e.exclusiveMaximum)&&!(t<e.exclusiveMaximum)||je(e.exclusiveMinimum)&&!(t>e.exclusiveMinimum)||je(e.maximum)&&!(t<=e.maximum)||je(e.minimum)&&!(t>=e.minimum)||je(e.multipleOf)&&t%e.multipleOf!==BigInt(0))}function Yk(e,r,t){return Ji(t)}function Kk(e,r,t){return Hr(e.returns,r,t.prototype)}function qk(e,r,t){return!(!mn(t)||je(e.exclusiveMaximumTimestamp)&&!(t.getTime()<e.exclusiveMaximumTimestamp)||je(e.exclusiveMinimumTimestamp)&&!(t.getTime()>e.exclusiveMinimumTimestamp)||je(e.maximumTimestamp)&&!(t.getTime()<=e.maximumTimestamp)||je(e.minimumTimestamp)&&!(t.getTime()>=e.minimumTimestamp)||je(e.multipleOfTimestamp)&&t.getTime()%e.multipleOfTimestamp!==0)}function Qk(e,r,t){return Zs(t)}function e_(e,r,t){return!(!Yh(t)||je(e.exclusiveMaximum)&&!(t<e.exclusiveMaximum)||je(e.exclusiveMinimum)&&!(t>e.exclusiveMinimum)||je(e.maximum)&&!(t<=e.maximum)||je(e.minimum)&&!(t>=e.minimum)||je(e.multipleOf)&&t%e.multipleOf!==0)}function t_(e,r,t){let n=e.allOf.every(o=>Hr(o,r,t));if(e.unevaluatedProperties===!1){let o=new RegExp(Ja(e)),i=Object.getOwnPropertyNames(t).every(s=>o.test(s));return n&&i}else if(Ze(e.unevaluatedProperties)){let o=new RegExp(Ja(e)),i=Object.getOwnPropertyNames(t).every(s=>o.test(s)||Hr(e.unevaluatedProperties,r,t[s]));return n&&i}else return n}function r_(e,r,t){return Xh(t)}function n_(e,r,t){return t===e.const}function o_(e,r,t){return!1}function i_(e,r,t){return!Hr(e.not,r,t)}function a_(e,r,t){return Ua(t)}function s_(e,r,t){return!(!mt.IsNumberLike(t)||je(e.exclusiveMaximum)&&!(t<e.exclusiveMaximum)||je(e.exclusiveMinimum)&&!(t>e.exclusiveMinimum)||je(e.minimum)&&!(t>=e.minimum)||je(e.maximum)&&!(t<=e.maximum)||je(e.multipleOf)&&t%e.multipleOf!==0)}function u_(e,r,t){if(!mt.IsObjectLike(t)||je(e.minProperties)&&!(Object.getOwnPropertyNames(t).length>=e.minProperties)||je(e.maxProperties)&&!(Object.getOwnPropertyNames(t).length<=e.maxProperties))return!1;let n=Object.getOwnPropertyNames(e.properties);for(let o of n){let i=e.properties[o];if(e.required&&e.required.includes(o)){if(!Hr(i,r,t[o])||(Ka(i)||Hk(i))&&!(o in t))return!1}else if(mt.IsExactOptionalProperty(t,o)&&!Hr(i,r,t[o]))return!1}if(e.additionalProperties===!1){let o=Object.getOwnPropertyNames(t);return e.required&&e.required.length===n.length&&o.length===n.length?!0:o.every(i=>n.includes(i))}else return typeof e.additionalProperties=="object"?Object.getOwnPropertyNames(t).every(i=>n.includes(i)||Hr(e.additionalProperties,r,t[i])):!0}function l_(e,r,t){return Jh(t)}function c_(e,r,t){if(!mt.IsRecordLike(t)||je(e.minProperties)&&!(Object.getOwnPropertyNames(t).length>=e.minProperties)||je(e.maxProperties)&&!(Object.getOwnPropertyNames(t).length<=e.maxProperties))return!1;let[n,o]=Object.entries(e.patternProperties)[0],i=new RegExp(n),s=Object.entries(t).every(([c,d])=>i.test(c)?Hr(o,r,d):!0),u=typeof e.additionalProperties=="object"?Object.entries(t).every(([c,d])=>i.test(c)?!0:Hr(e.additionalProperties,r,d)):!0,l=e.additionalProperties===!1?Object.getOwnPropertyNames(t).every(c=>i.test(c)):!0;return s&&u&&l}function p_(e,r,t){return Hr(Qe(e,r),r,t)}function d_(e,r,t){let n=new RegExp(e.source,e.flags);return je(e.minLength)&&!(t.length>=e.minLength)||je(e.maxLength)&&!(t.length<=e.maxLength)?!1:n.test(t)}function m_(e,r,t){return!He(t)||je(e.minLength)&&!(t.length>=e.minLength)||je(e.maxLength)&&!(t.length<=e.maxLength)||je(e.pattern)&&!new RegExp(e.pattern).test(t)?!1:je(e.format)?Bn.Has(e.format)?Bn.Get(e.format)(t):!1:!0}function f_(e,r,t){return Ga(t)}function h_(e,r,t){return He(t)&&new RegExp(e.pattern).test(t)}function g_(e,r,t){return Hr(Qe(e,r),r,t)}function y_(e,r,t){if(!Me(t)||e.items===void 0&&t.length!==0||t.length!==e.maxItems)return!1;if(!e.items)return!0;for(let n=0;n<e.items.length;n++)if(!Hr(e.items[n],r,t[n]))return!1;return!0}function b_(e,r,t){return Wt(t)}function v_(e,r,t){return e.anyOf.some(n=>Hr(n,r,t))}function x_(e,r,t){return!(!Pc(t)||je(e.maxByteLength)&&!(t.length<=e.maxByteLength)||je(e.minByteLength)&&!(t.length>=e.minByteLength))}function I_(e,r,t){return!0}function E_(e,r,t){return mt.IsVoidLike(t)}function C_(e,r,t){return Ar.Has(e[j])?Ar.Get(e[j])(e,t):!1}function Hr(e,r,t){let n=je(e.$id)?[...r,e]:r,o=e;switch(o[j]){case"Any":return Zk(o,n,t);case"Array":return Wk(o,n,t);case"AsyncIterator":return Xk(o,n,t);case"BigInt":return Jk(o,n,t);case"Boolean":return Yk(o,n,t);case"Constructor":return Kk(o,n,t);case"Date":return qk(o,n,t);case"Function":return Qk(o,n,t);case"Integer":return e_(o,n,t);case"Intersect":return t_(o,n,t);case"Iterator":return r_(o,n,t);case"Literal":return n_(o,n,t);case"Never":return o_(o,n,t);case"Not":return i_(o,n,t);case"Null":return a_(o,n,t);case"Number":return s_(o,n,t);case"Object":return u_(o,n,t);case"Promise":return l_(o,n,t);case"Record":return c_(o,n,t);case"Ref":return p_(o,n,t);case"RegExp":return d_(o,n,t);case"String":return m_(o,n,t);case"Symbol":return f_(o,n,t);case"TemplateLiteral":return h_(o,n,t);case"This":return g_(o,n,t);case"Tuple":return y_(o,n,t);case"Undefined":return b_(o,n,t);case"Union":return v_(o,n,t);case"Uint8Array":return x_(o,n,t);case"Unknown":return I_(o,n,t);case"Void":return E_(o,n,t);default:if(!Ar.Has(o[j]))throw new wv(o);return C_(o,n,t)}}function Le(...e){return e.length===3?Hr(e[0],e[1],e[2]):Hr(e[0],[],e[1])}var U;(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"})(U||(U={}));var Fv=class extends Se{constructor(r){super("Unknown type"),this.schema=r}};function qa(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function Ue(e){return e!==void 0}var Mo=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 ee(e,r,t,n,o=[]){return{type:e,schema:r,path:t,value:n,message:e5()({errorType:e,path:t,schema:r,value:n,errors:o}),errors:o}}function*S_(e,r,t,n){}function*D_(e,r,t,n){if(!Me(n))return yield ee(U.Array,e,t,n);Ue(e.minItems)&&!(n.length>=e.minItems)&&(yield ee(U.ArrayMinItems,e,t,n)),Ue(e.maxItems)&&!(n.length<=e.maxItems)&&(yield ee(U.ArrayMaxItems,e,t,n));for(let s=0;s<n.length;s++)yield*Zr(e.items,r,`${t}/${s}`,n[s]);if(e.uniqueItems===!0&&!function(){let s=new Set;for(let u of n){let l=eu(u);if(s.has(l))return!1;s.add(l)}return!0}()&&(yield ee(U.ArrayUniqueItems,e,t,n)),!(Ue(e.contains)||Ue(e.minContains)||Ue(e.maxContains)))return;let o=Ue(e.contains)?e.contains:gt(),i=n.reduce((s,u,l)=>Zr(o,r,`${t}${l}`,u).next().done===!0?s+1:s,0);i===0&&(yield ee(U.ArrayContains,e,t,n)),ye(e.minContains)&&i<e.minContains&&(yield ee(U.ArrayMinContains,e,t,n)),ye(e.maxContains)&&i>e.maxContains&&(yield ee(U.ArrayMaxContains,e,t,n))}function*T_(e,r,t,n){Wh(n)||(yield ee(U.AsyncIterator,e,t,n))}function*w_(e,r,t,n){if(!Gr(n))return yield ee(U.BigInt,e,t,n);Ue(e.exclusiveMaximum)&&!(n<e.exclusiveMaximum)&&(yield ee(U.BigIntExclusiveMaximum,e,t,n)),Ue(e.exclusiveMinimum)&&!(n>e.exclusiveMinimum)&&(yield ee(U.BigIntExclusiveMinimum,e,t,n)),Ue(e.maximum)&&!(n<=e.maximum)&&(yield ee(U.BigIntMaximum,e,t,n)),Ue(e.minimum)&&!(n>=e.minimum)&&(yield ee(U.BigIntMinimum,e,t,n)),Ue(e.multipleOf)&&n%e.multipleOf!==BigInt(0)&&(yield ee(U.BigIntMultipleOf,e,t,n))}function*F_(e,r,t,n){Ji(n)||(yield ee(U.Boolean,e,t,n))}function*M_(e,r,t,n){yield*Zr(e.returns,r,t,n.prototype)}function*A_(e,r,t,n){if(!mn(n))return yield ee(U.Date,e,t,n);Ue(e.exclusiveMaximumTimestamp)&&!(n.getTime()<e.exclusiveMaximumTimestamp)&&(yield ee(U.DateExclusiveMaximumTimestamp,e,t,n)),Ue(e.exclusiveMinimumTimestamp)&&!(n.getTime()>e.exclusiveMinimumTimestamp)&&(yield ee(U.DateExclusiveMinimumTimestamp,e,t,n)),Ue(e.maximumTimestamp)&&!(n.getTime()<=e.maximumTimestamp)&&(yield ee(U.DateMaximumTimestamp,e,t,n)),Ue(e.minimumTimestamp)&&!(n.getTime()>=e.minimumTimestamp)&&(yield ee(U.DateMinimumTimestamp,e,t,n)),Ue(e.multipleOfTimestamp)&&n.getTime()%e.multipleOfTimestamp!==0&&(yield ee(U.DateMultipleOfTimestamp,e,t,n))}function*O_(e,r,t,n){Zs(n)||(yield ee(U.Function,e,t,n))}function*B_(e,r,t,n){if(!Yh(n))return yield ee(U.Integer,e,t,n);Ue(e.exclusiveMaximum)&&!(n<e.exclusiveMaximum)&&(yield ee(U.IntegerExclusiveMaximum,e,t,n)),Ue(e.exclusiveMinimum)&&!(n>e.exclusiveMinimum)&&(yield ee(U.IntegerExclusiveMinimum,e,t,n)),Ue(e.maximum)&&!(n<=e.maximum)&&(yield ee(U.IntegerMaximum,e,t,n)),Ue(e.minimum)&&!(n>=e.minimum)&&(yield ee(U.IntegerMinimum,e,t,n)),Ue(e.multipleOf)&&n%e.multipleOf!==0&&(yield ee(U.IntegerMultipleOf,e,t,n))}function*P_(e,r,t,n){let o=!1;for(let i of e.allOf)for(let s of Zr(i,r,t,n))o=!0,yield s;if(o)return yield ee(U.Intersect,e,t,n);if(e.unevaluatedProperties===!1){let i=new RegExp(Ja(e));for(let s of Object.getOwnPropertyNames(n))i.test(s)||(yield ee(U.IntersectUnevaluatedProperties,e,`${t}/${s}`,n))}if(typeof e.unevaluatedProperties=="object"){let i=new RegExp(Ja(e));for(let s of Object.getOwnPropertyNames(n))if(!i.test(s)){let u=Zr(e.unevaluatedProperties,r,`${t}/${s}`,n[s]).next();u.done||(yield u.value)}}}function*k_(e,r,t,n){Xh(n)||(yield ee(U.Iterator,e,t,n))}function*__(e,r,t,n){n!==e.const&&(yield ee(U.Literal,e,t,n))}function*L_(e,r,t,n){yield ee(U.Never,e,t,n)}function*R_(e,r,t,n){Zr(e.not,r,t,n).next().done===!0&&(yield ee(U.Not,e,t,n))}function*N_(e,r,t,n){Ua(n)||(yield ee(U.Null,e,t,n))}function*$_(e,r,t,n){if(!mt.IsNumberLike(n))return yield ee(U.Number,e,t,n);Ue(e.exclusiveMaximum)&&!(n<e.exclusiveMaximum)&&(yield ee(U.NumberExclusiveMaximum,e,t,n)),Ue(e.exclusiveMinimum)&&!(n>e.exclusiveMinimum)&&(yield ee(U.NumberExclusiveMinimum,e,t,n)),Ue(e.maximum)&&!(n<=e.maximum)&&(yield ee(U.NumberMaximum,e,t,n)),Ue(e.minimum)&&!(n>=e.minimum)&&(yield ee(U.NumberMinimum,e,t,n)),Ue(e.multipleOf)&&n%e.multipleOf!==0&&(yield ee(U.NumberMultipleOf,e,t,n))}function*j_(e,r,t,n){if(!mt.IsObjectLike(n))return yield ee(U.Object,e,t,n);Ue(e.minProperties)&&!(Object.getOwnPropertyNames(n).length>=e.minProperties)&&(yield ee(U.ObjectMinProperties,e,t,n)),Ue(e.maxProperties)&&!(Object.getOwnPropertyNames(n).length<=e.maxProperties)&&(yield ee(U.ObjectMaxProperties,e,t,n));let o=Array.isArray(e.required)?e.required:[],i=Object.getOwnPropertyNames(e.properties),s=Object.getOwnPropertyNames(n);for(let u of o)s.includes(u)||(yield ee(U.ObjectRequiredProperty,e.properties[u],`${t}/${qa(u)}`,void 0));if(e.additionalProperties===!1)for(let u of s)i.includes(u)||(yield ee(U.ObjectAdditionalProperties,e,`${t}/${qa(u)}`,n[u]));if(typeof e.additionalProperties=="object")for(let u of s)i.includes(u)||(yield*Zr(e.additionalProperties,r,`${t}/${qa(u)}`,n[u]));for(let u of i){let l=e.properties[u];e.required&&e.required.includes(u)?(yield*Zr(l,r,`${t}/${qa(u)}`,n[u]),Ka(e)&&!(u in n)&&(yield ee(U.ObjectRequiredProperty,l,`${t}/${qa(u)}`,void 0))):mt.IsExactOptionalProperty(n,u)&&(yield*Zr(l,r,`${t}/${qa(u)}`,n[u]))}}function*U_(e,r,t,n){Jh(n)||(yield ee(U.Promise,e,t,n))}function*G_(e,r,t,n){if(!mt.IsRecordLike(n))return yield ee(U.Object,e,t,n);Ue(e.minProperties)&&!(Object.getOwnPropertyNames(n).length>=e.minProperties)&&(yield ee(U.ObjectMinProperties,e,t,n)),Ue(e.maxProperties)&&!(Object.getOwnPropertyNames(n).length<=e.maxProperties)&&(yield ee(U.ObjectMaxProperties,e,t,n));let[o,i]=Object.entries(e.patternProperties)[0],s=new RegExp(o);for(let[u,l]of Object.entries(n))s.test(u)&&(yield*Zr(i,r,`${t}/${qa(u)}`,l));if(typeof e.additionalProperties=="object")for(let[u,l]of Object.entries(n))s.test(u)||(yield*Zr(e.additionalProperties,r,`${t}/${qa(u)}`,l));if(e.additionalProperties===!1){for(let[u,l]of Object.entries(n))if(!s.test(u))return yield ee(U.ObjectAdditionalProperties,e,`${t}/${qa(u)}`,l)}}function*z_(e,r,t,n){yield*Zr(Qe(e,r),r,t,n)}function*V_(e,r,t,n){if(!He(n))return yield ee(U.String,e,t,n);if(Ue(e.minLength)&&!(n.length>=e.minLength)&&(yield ee(U.StringMinLength,e,t,n)),Ue(e.maxLength)&&!(n.length<=e.maxLength)&&(yield ee(U.StringMaxLength,e,t,n)),!new RegExp(e.source,e.flags).test(n))return yield ee(U.RegExp,e,t,n)}function*H_(e,r,t,n){if(!He(n))return yield ee(U.String,e,t,n);Ue(e.minLength)&&!(n.length>=e.minLength)&&(yield ee(U.StringMinLength,e,t,n)),Ue(e.maxLength)&&!(n.length<=e.maxLength)&&(yield ee(U.StringMaxLength,e,t,n)),He(e.pattern)&&(new RegExp(e.pattern).test(n)||(yield ee(U.StringPattern,e,t,n))),He(e.format)&&(Bn.Has(e.format)?Bn.Get(e.format)(n)||(yield ee(U.StringFormat,e,t,n)):yield ee(U.StringFormatUnknown,e,t,n))}function*Z_(e,r,t,n){Ga(n)||(yield ee(U.Symbol,e,t,n))}function*W_(e,r,t,n){if(!He(n))return yield ee(U.String,e,t,n);new RegExp(e.pattern).test(n)||(yield ee(U.StringPattern,e,t,n))}function*X_(e,r,t,n){yield*Zr(Qe(e,r),r,t,n)}function*J_(e,r,t,n){if(!Me(n))return yield ee(U.Tuple,e,t,n);if(e.items===void 0&&n.length!==0)return yield ee(U.TupleLength,e,t,n);if(n.length!==e.maxItems)return yield ee(U.TupleLength,e,t,n);if(e.items)for(let o=0;o<e.items.length;o++)yield*Zr(e.items[o],r,`${t}/${o}`,n[o])}function*Y_(e,r,t,n){Wt(n)||(yield ee(U.Undefined,e,t,n))}function*K_(e,r,t,n){if(Le(e,r,n))return;let o=e.anyOf.map(i=>new Mo(Zr(i,r,t,n)));yield ee(U.Union,e,t,n,o)}function*q_(e,r,t,n){if(!Pc(n))return yield ee(U.Uint8Array,e,t,n);Ue(e.maxByteLength)&&!(n.length<=e.maxByteLength)&&(yield ee(U.Uint8ArrayMaxByteLength,e,t,n)),Ue(e.minByteLength)&&!(n.length>=e.minByteLength)&&(yield ee(U.Uint8ArrayMinByteLength,e,t,n))}function*Q_(e,r,t,n){}function*eL(e,r,t,n){mt.IsVoidLike(n)||(yield ee(U.Void,e,t,n))}function*tL(e,r,t,n){Ar.Get(e[j])(e,n)||(yield ee(U.Kind,e,t,n))}function*Zr(e,r,t,n){let o=Ue(e.$id)?[...r,e]:r,i=e;switch(i[j]){case"Any":return yield*S_(i,o,t,n);case"Array":return yield*D_(i,o,t,n);case"AsyncIterator":return yield*T_(i,o,t,n);case"BigInt":return yield*w_(i,o,t,n);case"Boolean":return yield*F_(i,o,t,n);case"Constructor":return yield*M_(i,o,t,n);case"Date":return yield*A_(i,o,t,n);case"Function":return yield*O_(i,o,t,n);case"Integer":return yield*B_(i,o,t,n);case"Intersect":return yield*P_(i,o,t,n);case"Iterator":return yield*k_(i,o,t,n);case"Literal":return yield*__(i,o,t,n);case"Never":return yield*L_(i,o,t,n);case"Not":return yield*R_(i,o,t,n);case"Null":return yield*N_(i,o,t,n);case"Number":return yield*$_(i,o,t,n);case"Object":return yield*j_(i,o,t,n);case"Promise":return yield*U_(i,o,t,n);case"Record":return yield*G_(i,o,t,n);case"Ref":return yield*z_(i,o,t,n);case"RegExp":return yield*V_(i,o,t,n);case"String":return yield*H_(i,o,t,n);case"Symbol":return yield*Z_(i,o,t,n);case"TemplateLiteral":return yield*W_(i,o,t,n);case"This":return yield*X_(i,o,t,n);case"Tuple":return yield*J_(i,o,t,n);case"Undefined":return yield*Y_(i,o,t,n);case"Union":return yield*K_(i,o,t,n);case"Uint8Array":return yield*q_(i,o,t,n);case"Unknown":return yield*Q_(i,o,t,n);case"Void":return yield*eL(i,o,t,n);default:if(!Ar.Has(i[j]))throw new Fv(e);return yield*tL(i,o,t,n)}}function ea(...e){let r=e.length===3?Zr(e[0],e[1],"",e[2]):Zr(e[0],[],"",e[1]);return new Mo(r)}p();p();var rL=function(e,r,t,n,o){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof r=="function"?e!==r||!o:!r.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(e,t):o?o.value=t:r.set(e,t),t},i5=function(e,r,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof r=="function"?e!==r||!n:!r.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(e):n?n.value:r.get(e)},Mv,wg,a5,Av=class extends Se{constructor(r){let t=r.First();super(t===void 0?"Invalid Value":t.message),Mv.add(this),wg.set(this,void 0),rL(this,wg,r,"f"),this.error=t}Errors(){return new Mo(i5(this,Mv,"m",a5).call(this))}};wg=new WeakMap,Mv=new WeakSet,a5=function*(){this.error&&(yield this.error),yield*i5(this,wg,"f")};function o5(e,r,t){if(!Le(e,r,t))throw new Av(ea(e,r,t))}function Fg(...e){return e.length===3?o5(e[0],e[1],e[2]):o5(e[0],[],e[1])}p();p();p();function nL(e){let r={};for(let t of Object.getOwnPropertyNames(e))r[t]=et(e[t]);for(let t of Object.getOwnPropertySymbols(e))r[t]=et(e[t]);return r}function oL(e){return e.map(r=>et(r))}function iL(e){return e.slice()}function aL(e){return new Map(et([...e.entries()]))}function sL(e){return new Set(et([...e.entries()]))}function uL(e){return new Date(e.toISOString())}function et(e){if(Me(e))return oL(e);if(mn(e))return uL(e);if(Io(e))return iL(e);if(zE(e))return aL(e);if(VE(e))return sL(e);if(Be(e))return nL(e);if(zr(e))return e;throw new Error("ValueClone: Unable to clone value")}var Qn=class extends Se{constructor(r,t){super(t),this.schema=r}};function tt(e){return Zs(e)?e():et(e)}function lL(e,r){return Te(e,"default")?tt(e.default):{}}function cL(e,r){if(e.uniqueItems===!0&&!Te(e,"default"))throw new Qn(e,"Array with the uniqueItems constraint requires a default value");if("contains"in e&&!Te(e,"default"))throw new Qn(e,"Array with the contains constraint requires a default value");return"default"in e?tt(e.default):e.minItems!==void 0?Array.from({length:e.minItems}).map(t=>eo(e.items,r)):[]}function pL(e,r){return Te(e,"default")?tt(e.default):async function*(){}()}function dL(e,r){return Te(e,"default")?tt(e.default):BigInt(0)}function mL(e,r){return Te(e,"default")?tt(e.default):!1}function fL(e,r){if(Te(e,"default"))return tt(e.default);{let t=eo(e.returns,r);return typeof t=="object"&&!Array.isArray(t)?class{constructor(){for(let[n,o]of Object.entries(t)){let i=this;i[n]=o}}}:class{}}}function hL(e,r){return Te(e,"default")?tt(e.default):e.minimumTimestamp!==void 0?new Date(e.minimumTimestamp):new Date}function gL(e,r){return Te(e,"default")?tt(e.default):()=>eo(e.returns,r)}function yL(e,r){return Te(e,"default")?tt(e.default):e.minimum!==void 0?e.minimum:0}function bL(e,r){if(Te(e,"default"))return tt(e.default);{let t=e.allOf.reduce((n,o)=>{let i=eo(o,r);return typeof i=="object"?{...n,...i}:i},{});if(!Le(e,r,t))throw new Qn(e,"Intersect produced invalid value. Consider using a default value.");return t}}function vL(e,r){return Te(e,"default")?tt(e.default):function*(){}()}function xL(e,r){return Te(e,"default")?tt(e.default):e.const}function IL(e,r){if(Te(e,"default"))return tt(e.default);throw new Qn(e,"Never types cannot be created. Consider using a default value.")}function EL(e,r){if(Te(e,"default"))return tt(e.default);throw new Qn(e,"Not types must have a default value")}function CL(e,r){return Te(e,"default")?tt(e.default):null}function SL(e,r){return Te(e,"default")?tt(e.default):e.minimum!==void 0?e.minimum:0}function DL(e,r){if(Te(e,"default"))return tt(e.default);{let t=new Set(e.required),n={};for(let[o,i]of Object.entries(e.properties))t.has(o)&&(n[o]=eo(i,r));return n}}function TL(e,r){return Te(e,"default")?tt(e.default):Promise.resolve(eo(e.item,r))}function wL(e,r){let[t,n]=Object.entries(e.patternProperties)[0];if(Te(e,"default"))return tt(e.default);if(t===Wa||t===Za)return{};{let o=t.slice(1,t.length-1).split("|"),i={};for(let s of o)i[s]=eo(n,r);return i}}function FL(e,r){return Te(e,"default")?tt(e.default):eo(Qe(e,r),r)}function ML(e,r){if(Te(e,"default"))return tt(e.default);throw new Qn(e,"RegExp types cannot be created. Consider using a default value.")}function AL(e,r){if(e.pattern!==void 0){if(Te(e,"default"))return tt(e.default);throw new Qn(e,"String types with patterns must specify a default value")}else if(e.format!==void 0){if(Te(e,"default"))return tt(e.default);throw new Qn(e,"String types with formats must specify a default value")}else return Te(e,"default")?tt(e.default):e.minLength!==void 0?Array.from({length:e.minLength}).map(()=>" ").join(""):""}function OL(e,r){return Te(e,"default")?tt(e.default):"value"in e?Symbol.for(e.value):Symbol()}function BL(e,r){if(Te(e,"default"))return tt(e.default);if(!tg(e))throw new Qn(e,"Can only create template literals that produce a finite variants. Consider using a default value.");return jc(e)[0]}function PL(e,r){if(s5++>UL)throw new Qn(e,"Cannot create recursive type as it appears possibly infinite. Consider using a default.");return Te(e,"default")?tt(e.default):eo(Qe(e,r),r)}function kL(e,r){return Te(e,"default")?tt(e.default):e.items===void 0?[]:Array.from({length:e.minItems}).map((t,n)=>eo(e.items[n],r))}function _L(e,r){if(Te(e,"default"))return tt(e.default)}function LL(e,r){if(Te(e,"default"))return tt(e.default);if(e.anyOf.length===0)throw new Error("ValueCreate.Union: Cannot create Union with zero variants");return eo(e.anyOf[0],r)}function RL(e,r){return Te(e,"default")?tt(e.default):e.minByteLength!==void 0?new Uint8Array(e.minByteLength):new Uint8Array(0)}function NL(e,r){return Te(e,"default")?tt(e.default):{}}function $L(e,r){if(Te(e,"default"))return tt(e.default)}function jL(e,r){if(Te(e,"default"))return tt(e.default);throw new Error("User defined types must specify a default value")}function eo(e,r){let t=Fo(e,r),n=e;switch(n[j]){case"Any":return lL(n,t);case"Array":return cL(n,t);case"AsyncIterator":return pL(n,t);case"BigInt":return dL(n,t);case"Boolean":return mL(n,t);case"Constructor":return fL(n,t);case"Date":return hL(n,t);case"Function":return gL(n,t);case"Integer":return yL(n,t);case"Intersect":return bL(n,t);case"Iterator":return vL(n,t);case"Literal":return xL(n,t);case"Never":return IL(n,t);case"Not":return EL(n,t);case"Null":return CL(n,t);case"Number":return SL(n,t);case"Object":return DL(n,t);case"Promise":return TL(n,t);case"Record":return wL(n,t);case"Ref":return FL(n,t);case"RegExp":return ML(n,t);case"String":return AL(n,t);case"Symbol":return OL(n,t);case"TemplateLiteral":return BL(n,t);case"This":return PL(n,t);case"Tuple":return kL(n,t);case"Undefined":return _L(n,t);case"Union":return LL(n,t);case"Uint8Array":return RL(n,t);case"Unknown":return NL(n,t);case"Void":return $L(n,t);default:if(!Ar.Has(n[j]))throw new Qn(n,"Unknown type");return jL(n,t)}}var UL=512,s5=0;function Ao(...e){return s5=0,e.length===2?eo(e[0],e[1]):eo(e[0],[])}var Mg=class extends Se{constructor(r,t){super(t),this.schema=r}};function GL(e,r,t){if(e[j]==="Object"&&typeof t=="object"&&!Ua(t)){let n=e,o=Object.getOwnPropertyNames(t),i=Object.entries(n.properties),[s,u]=[1/i.length,i.length];return i.reduce((l,[c,d])=>{let f=d[j]==="Literal"&&d.const===t[c]?u:0,h=Le(d,r,t[c])?s:0,b=o.includes(c)?s:0;return l+(f+h+b)},0)}else return Le(e,r,t)?1:0}function zL(e,r,t){let n=e.anyOf.map(s=>Qe(s,r)),[o,i]=[n[0],0];for(let s of n){let u=GL(s,r,t);u>i&&(o=s,i=u)}return o}function VL(e,r,t){if("default"in e)return typeof t=="function"?e.default:et(e.default);{let n=zL(e,r,t);return Ov(n,r,t)}}function HL(e,r,t){return Le(e,r,t)?et(t):Ao(e,r)}function ZL(e,r,t){return Le(e,r,t)?t:Ao(e,r)}function WL(e,r,t){if(Le(e,r,t))return et(t);let n=Me(t)?et(t):Ao(e,r),o=ye(e.minItems)&&n.length<e.minItems?[...n,...Array.from({length:e.minItems-n.length},()=>null)]:n,s=(ye(e.maxItems)&&o.length>e.maxItems?o.slice(0,e.maxItems):o).map(l=>ta(e.items,r,l));if(e.uniqueItems!==!0)return s;let u=[...new Set(s)];if(!Le(e,r,u))throw new Mg(e,"Array cast produced invalid data due to uniqueItems constraint");return u}function XL(e,r,t){if(Le(e,r,t))return Ao(e,r);let n=new Set(e.returns.required||[]),o=function(){};for(let[i,s]of Object.entries(e.returns.properties))!n.has(i)&&t.prototype[i]===void 0||(o.prototype[i]=ta(s,r,t.prototype[i]));return o}function JL(e,r,t){let n=Ao(e,r),o=Be(n)&&Be(t)?{...n,...t}:t;return Le(e,r,o)?o:Ao(e,r)}function YL(e,r,t){throw new Mg(e,"Never types cannot be cast")}function KL(e,r,t){if(Le(e,r,t))return t;if(t===null||typeof t!="object")return Ao(e,r);let n=new Set(e.required||[]),o={};for(let[i,s]of Object.entries(e.properties))!n.has(i)&&t[i]===void 0||(o[i]=ta(s,r,t[i]));if(typeof e.additionalProperties=="object"){let i=Object.getOwnPropertyNames(e.properties);for(let s of Object.getOwnPropertyNames(t))i.includes(s)||(o[s]=ta(e.additionalProperties,r,t[s]))}return o}function qL(e,r,t){if(Le(e,r,t))return et(t);if(t===null||typeof t!="object"||Array.isArray(t)||t instanceof Date)return Ao(e,r);let n=Object.getOwnPropertyNames(e.patternProperties)[0],o=e.patternProperties[n],i={};for(let[s,u]of Object.entries(t))i[s]=ta(o,r,u);return i}function QL(e,r,t){return ta(Qe(e,r),r,t)}function eR(e,r,t){return ta(Qe(e,r),r,t)}function tR(e,r,t){return Le(e,r,t)?et(t):Me(t)?e.items===void 0?[]:e.items.map((n,o)=>ta(n,r,t[o])):Ao(e,r)}function rR(e,r,t){return Le(e,r,t)?et(t):VL(e,r,t)}function ta(e,r,t){let n=He(e.$id)?[...r,e]:r,o=e;switch(e[j]){case"Array":return WL(o,n,t);case"Constructor":return XL(o,n,t);case"Intersect":return JL(o,n,t);case"Never":return YL(o,n,t);case"Object":return KL(o,n,t);case"Record":return qL(o,n,t);case"Ref":return QL(o,n,t);case"This":return eR(o,n,t);case"Tuple":return tR(o,n,t);case"Union":return rR(o,n,t);case"Date":case"Symbol":case"Uint8Array":return HL(e,r,t);default:return ZL(o,n,t)}}function Ov(...e){return e.length===3?ta(e[0],e[1],e[2]):ta(e[0],[],e[1])}p();function nR(e){return Xs(e)&&e[j]!=="Unsafe"}function oR(e,r,t){return Me(t)?t.map(n=>to(e.items,r,n)):t}function iR(e,r,t){let n=e.unevaluatedProperties,i=e.allOf.map(u=>to(u,r,et(t))).reduce((u,l)=>Be(l)?{...u,...l}:l,{});if(!Be(t)||!Be(i)||!Xs(n))return i;let s=Or(e);for(let u of Object.getOwnPropertyNames(t))s.includes(u)||Le(n,r,t[u])&&(i[u]=to(n,r,t[u]));return i}function aR(e,r,t){if(!Be(t)||Me(t))return t;let n=e.additionalProperties;for(let o of Object.getOwnPropertyNames(t)){if(Te(e.properties,o)){t[o]=to(e.properties[o],r,t[o]);continue}if(Xs(n)&&Le(n,r,t[o])){t[o]=to(n,r,t[o]);continue}delete t[o]}return t}function sR(e,r,t){if(!Be(t))return t;let n=e.additionalProperties,o=Object.getOwnPropertyNames(t),[i,s]=Object.entries(e.patternProperties)[0],u=new RegExp(i);for(let l of o){if(u.test(l)){t[l]=to(s,r,t[l]);continue}if(Xs(n)&&Le(n,r,t[l])){t[l]=to(n,r,t[l]);continue}delete t[l]}return t}function uR(e,r,t){return to(Qe(e,r),r,t)}function lR(e,r,t){return to(Qe(e,r),r,t)}function cR(e,r,t){if(!Me(t))return t;if(Wt(e.items))return[];let n=Math.min(t.length,e.items.length);for(let o=0;o<n;o++)t[o]=to(e.items[o],r,t[o]);return t.length>n?t.slice(0,n):t}function pR(e,r,t){for(let n of e.anyOf)if(nR(n)&&Le(n,r,t))return to(n,r,t);return t}function to(e,r,t){let n=He(e.$id)?[...r,e]:r,o=e;switch(o[j]){case"Array":return oR(o,n,t);case"Intersect":return iR(o,n,t);case"Object":return aR(o,n,t);case"Record":return sR(o,n,t);case"Ref":return uR(o,n,t);case"This":return lR(o,n,t);case"Tuple":return cR(o,n,t);case"Union":return pR(o,n,t);default:return t}}function Ag(...e){return e.length===3?to(e[0],e[1],e[2]):to(e[0],[],e[1])}p();function Og(e){return He(e)&&!isNaN(e)&&!isNaN(parseFloat(e))}function dR(e){return Gr(e)||Ji(e)||ye(e)}function Zm(e){return e===!0||ye(e)&&e===1||Gr(e)&&e===BigInt("1")||He(e)&&(e.toLowerCase()==="true"||e==="1")}function Wm(e){return e===!1||ye(e)&&(e===0||Object.is(e,-0))||Gr(e)&&e===BigInt("0")||He(e)&&(e.toLowerCase()==="false"||e==="0"||e==="-0")}function mR(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 fR(e){return He(e)&&/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)?$/i.test(e)}function hR(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 gR(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 yR(e){return He(e)&&/^\d\d\d\d-[0-1]\d-[0-3]\d$/i.test(e)}function bR(e,r){let t=l5(e);return t===r?t:e}function vR(e,r){let t=c5(e);return t===r?t:e}function xR(e,r){let t=u5(e);return t===r?t:e}function IR(e,r){return He(e.const)?bR(r,e.const):ye(e.const)?vR(r,e.const):Ji(e.const)?xR(r,e.const):r}function u5(e){return Zm(e)?!0:Wm(e)?!1:e}function ER(e){let r=t=>t.split(".")[0];return Og(e)?BigInt(r(e)):ye(e)?BigInt(Math.trunc(e)):Wm(e)?BigInt(0):Zm(e)?BigInt(1):e}function l5(e){return dR(e)?e.toString():Ga(e)&&e.description!==void 0?e.description.toString():e}function c5(e){return Og(e)?parseFloat(e):Zm(e)?1:Wm(e)?0:e}function CR(e){return Og(e)?parseInt(e):ye(e)?e|0:Zm(e)?1:Wm(e)?0:e}function SR(e){return He(e)&&e.toLowerCase()==="null"?null:e}function DR(e){return He(e)&&e==="undefined"?void 0:e}function TR(e){return mn(e)?e:ye(e)?new Date(e):Zm(e)?new Date(1):Wm(e)?new Date(0):Og(e)?new Date(parseInt(e)):fR(e)?new Date(`1970-01-01T${e}.000Z`):mR(e)?new Date(`1970-01-01T${e}`):gR(e)?new Date(`${e}.000Z`):hR(e)?new Date(e):yR(e)?new Date(`${e}T00:00:00.000Z`):e}function wR(e,r,t){return(Me(t)?t:[t]).map(o=>ra(e.items,r,o))}function FR(e,r,t){return ER(t)}function MR(e,r,t){return u5(t)}function AR(e,r,t){return TR(t)}function OR(e,r,t){return CR(t)}function BR(e,r,t){return e.allOf.reduce((n,o)=>ra(o,r,n),t)}function PR(e,r,t){return IR(e,t)}function kR(e,r,t){return SR(t)}function _R(e,r,t){return c5(t)}function LR(e,r,t){if(!Be(t))return t;for(let n of Object.getOwnPropertyNames(e.properties))Te(t,n)&&(t[n]=ra(e.properties[n],r,t[n]));return t}function RR(e,r,t){if(!Be(t))return t;let o=Object.getOwnPropertyNames(e.patternProperties)[0],i=e.patternProperties[o];for(let[s,u]of Object.entries(t))t[s]=ra(i,r,u);return t}function NR(e,r,t){return ra(Qe(e,r),r,t)}function $R(e,r,t){return l5(t)}function jR(e,r,t){return He(t)||ye(t)?Symbol(t):t}function UR(e,r,t){return ra(Qe(e,r),r,t)}function GR(e,r,t){return Me(t)&&!Wt(e.items)?t.map((o,i)=>i<e.items.length?ra(e.items[i],r,o):o):t}function zR(e,r,t){return DR(t)}function VR(e,r,t){for(let n of e.anyOf){let o=ra(n,r,et(t));if(Le(n,r,o))return o}return t}function ra(e,r,t){let n=Fo(e,r),o=e;switch(e[j]){case"Array":return wR(o,n,t);case"BigInt":return FR(o,n,t);case"Boolean":return MR(o,n,t);case"Date":return AR(o,n,t);case"Integer":return OR(o,n,t);case"Intersect":return BR(o,n,t);case"Literal":return PR(o,n,t);case"Null":return kR(o,n,t);case"Number":return _R(o,n,t);case"Object":return LR(o,n,t);case"Record":return RR(o,n,t);case"Ref":return NR(o,n,t);case"String":return $R(o,n,t);case"Symbol":return jR(o,n,t);case"This":return UR(o,n,t);case"Tuple":return GR(o,n,t);case"Undefined":return zR(o,n,t);case"Union":return VR(o,n,t);default:return t}}function Bg(...e){return e.length===3?ra(e[0],e[1],e[2]):ra(e[0],[],e[1])}p();p();var rp=class extends Se{constructor(r,t,n){super("Unable to decode value as it does not match the expected schema"),this.schema=r,this.value=t,this.error=n}},tl=class extends Se{constructor(r,t,n,o){super(o instanceof Error?o.message:"Unknown error"),this.schema=r,this.path=t,this.value=n,this.error=o}};function Xt(e,r,t){try{return Pt(e)?e[jt].Decode(t):t}catch(n){throw new tl(e,r,t,n)}}function HR(e,r,t,n){return Me(n)?Xt(e,t,n.map((o,i)=>na(e.items,r,`${t}/${i}`,o))):Xt(e,t,n)}function ZR(e,r,t,n){if(!Be(n)||zr(n))return Xt(e,t,n);let o=Ks(e),i=o.map(d=>d[0]),s={...n};for(let[d,f]of o)d in s&&(s[d]=na(f,r,`${t}/${d}`,s[d]));if(!Pt(e.unevaluatedProperties))return Xt(e,t,s);let u=Object.getOwnPropertyNames(s),l=e.unevaluatedProperties,c={...s};for(let d of u)i.includes(d)||(c[d]=Xt(l,`${t}/${d}`,c[d]));return Xt(e,t,c)}function WR(e,r,t,n){return Xt(e,t,na(e.not,r,t,n))}function XR(e,r,t,n){if(!Be(n))return Xt(e,t,n);let o=Or(e),i={...n};for(let c of o)Te(i,c)&&(Wt(i[c])&&(!_c(e.properties[c])||mt.IsExactOptionalProperty(i,c))||(i[c]=na(e.properties[c],r,`${t}/${c}`,i[c])));if(!Ze(e.additionalProperties))return Xt(e,t,i);let s=Object.getOwnPropertyNames(i),u=e.additionalProperties,l={...i};for(let c of s)o.includes(c)||(l[c]=Xt(u,`${t}/${c}`,l[c]));return Xt(e,t,l)}function JR(e,r,t,n){if(!Be(n))return Xt(e,t,n);let o=Object.getOwnPropertyNames(e.patternProperties)[0],i=new RegExp(o),s={...n};for(let d of Object.getOwnPropertyNames(n))i.test(d)&&(s[d]=na(e.patternProperties[o],r,`${t}/${d}`,s[d]));if(!Ze(e.additionalProperties))return Xt(e,t,s);let u=Object.getOwnPropertyNames(s),l=e.additionalProperties,c={...s};for(let d of u)i.test(d)||(c[d]=Xt(l,`${t}/${d}`,c[d]));return Xt(e,t,c)}function YR(e,r,t,n){let o=Qe(e,r);return Xt(e,t,na(o,r,t,n))}function KR(e,r,t,n){let o=Qe(e,r);return Xt(e,t,na(o,r,t,n))}function qR(e,r,t,n){return Me(n)&&Me(e.items)?Xt(e,t,e.items.map((o,i)=>na(o,r,`${t}/${i}`,n[i]))):Xt(e,t,n)}function QR(e,r,t,n){for(let o of e.anyOf){if(!Le(o,r,n))continue;let i=na(o,r,t,n);return Xt(e,t,i)}return Xt(e,t,n)}function na(e,r,t,n){let o=Fo(e,r),i=e;switch(e[j]){case"Array":return HR(i,o,t,n);case"Intersect":return ZR(i,o,t,n);case"Not":return WR(i,o,t,n);case"Object":return XR(i,o,t,n);case"Record":return JR(i,o,t,n);case"Ref":return YR(i,o,t,n);case"Symbol":return Xt(i,t,n);case"This":return KR(i,o,t,n);case"Tuple":return qR(i,o,t,n);case"Union":return QR(i,o,t,n);default:return Xt(i,t,n)}}function np(e,r,t){return na(e,r,"",t)}p();var op=class extends Se{constructor(r,t,n){super("The encoded value does not match the expected schema"),this.schema=r,this.value=t,this.error=n}},rl=class extends Se{constructor(r,t,n,o){super(`${o instanceof Error?o.message:"Unknown error"}`),this.schema=r,this.path=t,this.value=n,this.error=o}};function un(e,r,t){try{return Pt(e)?e[jt].Encode(t):t}catch(n){throw new rl(e,r,t,n)}}function eN(e,r,t,n){let o=un(e,t,n);return Me(o)?o.map((i,s)=>oa(e.items,r,`${t}/${s}`,i)):o}function tN(e,r,t,n){let o=un(e,t,n);if(!Be(n)||zr(n))return o;let i=Ks(e),s=i.map(f=>f[0]),u={...o};for(let[f,h]of i)f in u&&(u[f]=oa(h,r,`${t}/${f}`,u[f]));if(!Pt(e.unevaluatedProperties))return u;let l=Object.getOwnPropertyNames(u),c=e.unevaluatedProperties,d={...u};for(let f of l)s.includes(f)||(d[f]=un(c,`${t}/${f}`,d[f]));return d}function rN(e,r,t,n){return un(e.not,t,un(e,t,n))}function nN(e,r,t,n){let o=un(e,t,n);if(!Be(o))return o;let i=Or(e),s={...o};for(let d of i)Te(s,d)&&(Wt(s[d])&&(!_c(e.properties[d])||mt.IsExactOptionalProperty(s,d))||(s[d]=oa(e.properties[d],r,`${t}/${d}`,s[d])));if(!Ze(e.additionalProperties))return s;let u=Object.getOwnPropertyNames(s),l=e.additionalProperties,c={...s};for(let d of u)i.includes(d)||(c[d]=un(l,`${t}/${d}`,c[d]));return c}function oN(e,r,t,n){let o=un(e,t,n);if(!Be(n))return o;let i=Object.getOwnPropertyNames(e.patternProperties)[0],s=new RegExp(i),u={...o};for(let f of Object.getOwnPropertyNames(n))s.test(f)&&(u[f]=oa(e.patternProperties[i],r,`${t}/${f}`,u[f]));if(!Ze(e.additionalProperties))return u;let l=Object.getOwnPropertyNames(u),c=e.additionalProperties,d={...u};for(let f of l)s.test(f)||(d[f]=un(c,`${t}/${f}`,d[f]));return d}function iN(e,r,t,n){let o=Qe(e,r),i=oa(o,r,t,n);return un(e,t,i)}function aN(e,r,t,n){let o=Qe(e,r),i=oa(o,r,t,n);return un(e,t,i)}function sN(e,r,t,n){let o=un(e,t,n);return Me(e.items)?e.items.map((i,s)=>oa(i,r,`${t}/${s}`,o[s])):[]}function uN(e,r,t,n){for(let o of e.anyOf){if(!Le(o,r,n))continue;let i=oa(o,r,t,n);return un(e,t,i)}for(let o of e.anyOf){let i=oa(o,r,t,n);if(Le(e,r,i))return un(e,t,i)}return un(e,t,n)}function oa(e,r,t,n){let o=Fo(e,r),i=e;switch(e[j]){case"Array":return eN(i,o,t,n);case"Intersect":return tN(i,o,t,n);case"Not":return rN(i,o,t,n);case"Object":return nN(i,o,t,n);case"Record":return oN(i,o,t,n);case"Ref":return iN(i,o,t,n);case"This":return aN(i,o,t,n);case"Tuple":return sN(i,o,t,n);case"Union":return uN(i,o,t,n);default:return un(i,t,n)}}function Pg(e,r,t){return oa(e,r,"",t)}p();function lN(e,r){return Pt(e)||Br(e.items,r)}function cN(e,r){return Pt(e)||Br(e.items,r)}function pN(e,r){return Pt(e)||Br(e.returns,r)||e.parameters.some(t=>Br(t,r))}function dN(e,r){return Pt(e)||Br(e.returns,r)||e.parameters.some(t=>Br(t,r))}function mN(e,r){return Pt(e)||Pt(e.unevaluatedProperties)||e.allOf.some(t=>Br(t,r))}function fN(e,r){return Pt(e)||Br(e.items,r)}function hN(e,r){return Pt(e)||Br(e.not,r)}function gN(e,r){return Pt(e)||Object.values(e.properties).some(t=>Br(t,r))||Ze(e.additionalProperties)&&Br(e.additionalProperties,r)}function yN(e,r){return Pt(e)||Br(e.item,r)}function bN(e,r){let t=Object.getOwnPropertyNames(e.patternProperties)[0],n=e.patternProperties[t];return Pt(e)||Br(n,r)||Ze(e.additionalProperties)&&Pt(e.additionalProperties)}function vN(e,r){return Pt(e)?!0:Br(Qe(e,r),r)}function xN(e,r){return Pt(e)?!0:Br(Qe(e,r),r)}function IN(e,r){return Pt(e)||!Wt(e.items)&&e.items.some(t=>Br(t,r))}function EN(e,r){return Pt(e)||e.anyOf.some(t=>Br(t,r))}function Br(e,r){let t=Fo(e,r),n=e;if(e.$id&&Bv.has(e.$id))return!1;switch(e.$id&&Bv.add(e.$id),e[j]){case"Array":return lN(n,t);case"AsyncIterator":return cN(n,t);case"Constructor":return pN(n,t);case"Function":return dN(n,t);case"Intersect":return mN(n,t);case"Iterator":return fN(n,t);case"Not":return hN(n,t);case"Object":return gN(n,t);case"Promise":return yN(n,t);case"Record":return bN(n,t);case"Ref":return vN(n,t);case"This":return xN(n,t);case"Tuple":return IN(n,t);case"Union":return EN(n,t);default:return Pt(e)}}var Bv=new Set;function ia(e,r){return Bv.clear(),Br(e,r)}function p5(...e){let[r,t,n]=e.length===3?[e[0],e[1],e[2]]:[e[0],[],e[1]];if(!Le(r,t,n))throw new rp(r,n,ea(r,t,n).First());return ia(r,t)?np(r,t,n):n}p();function Qa(e,r){let t=Te(e,"default")?e.default:void 0,n=Zs(t)?t():et(t);return Wt(r)?n:Be(r)&&Be(n)?Object.assign(n,r):r}function Pv(e){return Xs(e)&&"default"in e}function CN(e,r,t){let n=Qa(e,t);if(!Me(n))return n;for(let o=0;o<n.length;o++)n[o]=ro(e.items,r,n[o]);return n}function SN(e,r,t){return mn(t)?t:Qa(e,t)}function DN(e,r,t){let n=Qa(e,t);return e.allOf.reduce((o,i)=>{let s=ro(i,r,n);return Be(s)?{...o,...s}:s},{})}function TN(e,r,t){let n=Qa(e,t);if(!Be(n))return n;let o=Object.getOwnPropertyNames(e.properties);for(let i of o){let s=ro(e.properties[i],r,n[i]);Wt(s)||(n[i]=ro(e.properties[i],r,n[i]))}if(!Pv(e.additionalProperties))return n;for(let i of Object.getOwnPropertyNames(n))o.includes(i)||(n[i]=ro(e.additionalProperties,r,n[i]));return n}function wN(e,r,t){let n=Qa(e,t);if(!Be(n))return n;let o=e.additionalProperties,[i,s]=Object.entries(e.patternProperties)[0],u=new RegExp(i);for(let l of Object.getOwnPropertyNames(n))u.test(l)&&Pv(s)&&(n[l]=ro(s,r,n[l]));if(!Pv(o))return n;for(let l of Object.getOwnPropertyNames(n))u.test(l)||(n[l]=ro(o,r,n[l]));return n}function FN(e,r,t){return ro(Qe(e,r),r,Qa(e,t))}function MN(e,r,t){return ro(Qe(e,r),r,t)}function AN(e,r,t){let n=Qa(e,t);if(!Me(n)||Wt(e.items))return n;let[o,i]=[e.items,Math.max(e.items.length,n.length)];for(let s=0;s<i;s++)s<o.length&&(n[s]=ro(o[s],r,n[s]));return n}function ON(e,r,t){let n=Qa(e,t);for(let o of e.anyOf){let i=ro(o,r,et(n));if(Le(o,r,i))return i}return n}function ro(e,r,t){let n=Fo(e,r),o=e;switch(o[j]){case"Array":return CN(o,n,t);case"Date":return SN(o,n,t);case"Intersect":return DN(o,n,t);case"Object":return TN(o,n,t);case"Record":return wN(o,n,t);case"Ref":return FN(o,n,t);case"This":return MN(o,n,t);case"Tuple":return AN(o,n,t);case"Union":return ON(o,n,t);default:return Qa(o,t)}}function kg(...e){return e.length===3?ro(e[0],e[1],e[2]):ro(e[0],[],e[1])}p();p();var ai={};$s(ai,{Delete:()=>PN,Format:()=>Xm,Get:()=>_N,Has:()=>kN,Set:()=>BN,ValuePointerRootDeleteError:()=>Lg,ValuePointerRootSetError:()=>_g});p();var _g=class extends Se{constructor(r,t,n){super("Cannot set root value"),this.value=r,this.path=t,this.update=n}},Lg=class extends Se{constructor(r,t){super("Cannot delete root value"),this.value=r,this.path=t}};function d5(e){return e.indexOf("~")===-1?e:e.replace(/~1/g,"/").replace(/~0/g,"~")}function*Xm(e){if(e==="")return;let[r,t]=[0,0];for(let n=0;n<e.length;n++)e.charAt(n)==="/"?(n===0||(t=n,yield d5(e.slice(r,t))),r=n+1):t=n;yield d5(e.slice(r))}function BN(e,r,t){if(r==="")throw new _g(e,r,t);let[n,o,i]=[null,e,""];for(let s of Xm(r))o[s]===void 0&&(o[s]={}),n=o,o=o[s],i=s;n[i]=t}function PN(e,r){if(r==="")throw new Lg(e,r);let[t,n,o]=[null,e,""];for(let i of Xm(r)){if(n[i]===void 0||n[i]===null)return;t=n,n=n[i],o=i}if(Array.isArray(t)){let i=parseInt(o);t.splice(i,1)}else delete t[o]}function kN(e,r){if(r==="")return!0;let[t,n,o]=[null,e,""];for(let i of Xm(r)){if(n[i]===void 0)return!1;t=n,n=n[i],o=i}return Object.getOwnPropertyNames(t).includes(o)}function _N(e,r){if(r==="")return e;let t=e;for(let n of Xm(r)){if(t[n]===void 0)return;t=t[n]}return t}p();function LN(e,r){if(!Be(r))return!1;let t=[...Object.keys(e),...Object.getOwnPropertySymbols(e)],n=[...Object.keys(r),...Object.getOwnPropertySymbols(r)];return t.length!==n.length?!1:t.every(o=>nl(e[o],r[o]))}function RN(e,r){return mn(r)&&e.getTime()===r.getTime()}function NN(e,r){return!Me(r)||e.length!==r.length?!1:e.every((t,n)=>nl(t,r[n]))}function $N(e,r){return!Io(r)||e.length!==r.length||Object.getPrototypeOf(e).constructor.name!==Object.getPrototypeOf(r).constructor.name?!1:e.every((t,n)=>nl(t,r[n]))}function jN(e,r){return e===r}function nl(e,r){if(mn(e))return RN(e,r);if(Io(e))return $N(e,r);if(Me(e))return NN(e,r);if(Be(e))return LN(e,r);if(zr(e))return jN(e,r);throw new Error("ValueEquals: Unable to compare value")}var UN=Ct({type:lt("insert"),path:Co(),value:Ya()}),GN=Ct({type:lt("update"),path:Co(),value:Ya()}),zN=Ct({type:lt("delete"),path:Co()}),f5=yt([UN,GN,zN]),Rg=class extends Se{constructor(r,t){super(t),this.value=r}};function Ng(e,r){return{type:"update",path:e,value:r}}function h5(e,r){return{type:"insert",path:e,value:r}}function g5(e){return{type:"delete",path:e}}function m5(e){if(globalThis.Object.getOwnPropertySymbols(e).length>0)throw new Rg(e,"Cannot diff objects with symbols")}function*VN(e,r,t){if(m5(r),m5(t),!Lb(t))return yield Ng(e,t);let n=globalThis.Object.getOwnPropertyNames(r),o=globalThis.Object.getOwnPropertyNames(t);for(let i of o)Te(r,i)||(yield h5(`${e}/${i}`,t[i]));for(let i of n)Te(t,i)&&(nl(r,t)||(yield*$g(`${e}/${i}`,r[i],t[i])));for(let i of n)Te(t,i)||(yield g5(`${e}/${i}`))}function*HN(e,r,t){if(!Me(t))return yield Ng(e,t);for(let n=0;n<Math.min(r.length,t.length);n++)yield*$g(`${e}/${n}`,r[n],t[n]);for(let n=0;n<t.length;n++)n<r.length||(yield h5(`${e}/${n}`,t[n]));for(let n=r.length-1;n>=0;n--)n<t.length||(yield g5(`${e}/${n}`))}function*ZN(e,r,t){if(!Io(t)||r.length!==t.length||globalThis.Object.getPrototypeOf(r).constructor.name!==globalThis.Object.getPrototypeOf(t).constructor.name)return yield Ng(e,t);for(let n=0;n<Math.min(r.length,t.length);n++)yield*$g(`${e}/${n}`,r[n],t[n])}function*WN(e,r,t){r!==t&&(yield Ng(e,t))}function*$g(e,r,t){if(Lb(r))return yield*VN(e,r,t);if(Me(r))return yield*HN(e,r,t);if(Io(r))return yield*ZN(e,r,t);if(zr(r))return yield*WN(e,r,t);throw new Rg(r,"Unable to diff value")}function y5(e,r){return[...$g("",e,r)]}function XN(e){return e.length>0&&e[0].path===""&&e[0].type==="update"}function JN(e){return e.length===0}function b5(e,r){if(XN(r))return et(r[0].value);if(JN(r))return et(e);let t=et(e);for(let n of r)switch(n.type){case"insert":{ai.Set(t,n.path,n.value);break}case"update":{ai.Set(t,n.path,n.value);break}case"delete":{ai.Delete(t,n.path);break}}return t}p();function v5(...e){let[r,t,n]=e.length===3?[e[0],e[1],e[2]]:[e[0],[],e[1]],o=ia(r,t)?Pg(r,t,n):n;if(!Le(r,t,o))throw new op(r,o,ea(r,t,o).First());return o}p();var jg=class extends Se{constructor(r){super(r)}};function YN(e,r,t,n){if(!Be(t))ai.Set(e,r,et(n));else{let o=Object.getOwnPropertyNames(t),i=Object.getOwnPropertyNames(n);for(let s of o)i.includes(s)||delete t[s];for(let s of i)o.includes(s)||(t[s]=null);for(let s of i)kv(e,`${r}/${s}`,t[s],n[s])}}function KN(e,r,t,n){if(!Me(t))ai.Set(e,r,et(n));else{for(let o=0;o<n.length;o++)kv(e,`${r}/${o}`,t[o],n[o]);t.splice(n.length)}}function qN(e,r,t,n){if(Io(t)&&t.length===n.length)for(let o=0;o<t.length;o++)t[o]=n[o];else ai.Set(e,r,et(n))}function QN(e,r,t,n){t!==n&&ai.Set(e,r,n)}function kv(e,r,t,n){if(Me(n))return KN(e,r,t,n);if(Io(n))return qN(e,r,t,n);if(Be(n))return YN(e,r,t,n);if(zr(n))return QN(e,r,t,n)}function x5(e){return Io(e)||zr(e)}function e$(e,r){return Be(e)&&Me(r)||Me(e)&&Be(r)}function I5(e,r){if(x5(e)||x5(r))throw new jg("Only object and array types can be mutated at the root level");if(e$(e,r))throw new jg("Cannot assign due type mismatch of assignable values");kv(e,"",e,r)}p();var t$=[(e,r,t)=>et(t),(e,r,t)=>kg(e,r,t),(e,r,t)=>Ag(e,r,t),(e,r,t)=>Bg(e,r,t),(e,r,t)=>(Fg(e,r,t),t),(e,r,t)=>ia(e,r)?np(e,r,t):t];function E5(e,r,t){return t$.reduce((n,o)=>o(e,r,n),t)}function C5(...e){return e.length===3?E5(e[0],e[1],e[2]):E5(e[0],[],e[1])}p();var si={};$s(si,{Assert:()=>Fg,Cast:()=>Ov,Check:()=>Le,Clean:()=>Ag,Clone:()=>et,Convert:()=>Bg,Create:()=>Ao,Decode:()=>p5,Default:()=>kg,Diff:()=>y5,Edit:()=>f5,Encode:()=>v5,Equal:()=>nl,Errors:()=>ea,Hash:()=>eu,Mutate:()=>I5,Parse:()=>C5,Patch:()=>b5,ValueErrorIterator:()=>Mo});p();p();var S5={},r$=function(e,r,t,n,o){var i=new Worker(S5[r]||(S5[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(s){var u=s.data,l=u.$e$;if(l){var c=new Error(l[0]);c.code=l[1],c.stack=l[2],o(c,null)}else o(null,u)},i.postMessage(t,n),i},St=Uint8Array,gn=Uint16Array,qm=Int32Array,lp=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]),cp=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]),Jm=new St([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),w5=function(e,r){for(var t=new gn(31),n=0;n<31;++n)t[n]=r+=1<<e[n-1];for(var o=new qm(t[30]),n=1;n<30;++n)for(var i=t[n];i<t[n+1];++i)o[i]=i-t[n]<<5|n;return{b:t,r:o}},F5=w5(lp,2),jv=F5.b,Hg=F5.r;jv[28]=258,Hg[258]=28;var M5=w5(cp,0),A5=M5.b,Lv=M5.r,Ym=new gn(32768);for(ct=0;ct<32768;++ct)es=(ct&43690)>>1|(ct&21845)<<1,es=(es&52428)>>2|(es&13107)<<2,es=(es&61680)>>4|(es&3855)<<4,Ym[ct]=((es&65280)>>8|(es&255)<<8)>>1;var es,ct,Bo=function(e,r,t){for(var n=e.length,o=0,i=new gn(r);o<n;++o)e[o]&&++i[e[o]-1];var s=new gn(r);for(o=1;o<r;++o)s[o]=s[o-1]+i[o-1]<<1;var u;if(t){u=new gn(1<<r);var l=15-r;for(o=0;o<n;++o)if(e[o])for(var c=o<<4|e[o],d=r-e[o],f=s[e[o]-1]++<<d,h=f|(1<<d)-1;f<=h;++f)u[Ym[f]>>l]=c}else for(u=new gn(n),o=0;o<n;++o)e[o]&&(u[o]=Ym[s[e[o]-1]++]>>15-e[o]);return u},ts=new St(288);for(ct=0;ct<144;++ct)ts[ct]=8;var ct;for(ct=144;ct<256;++ct)ts[ct]=9;var ct;for(ct=256;ct<280;++ct)ts[ct]=7;var ct;for(ct=280;ct<288;++ct)ts[ct]=8;var ct,sp=new St(32);for(ct=0;ct<32;++ct)sp[ct]=5;var ct,O5=Bo(ts,9,0),B5=Bo(ts,9,1),P5=Bo(sp,5,0),k5=Bo(sp,5,1),Gg=function(e){for(var r=e[0],t=1;t<e.length;++t)e[t]>r&&(r=e[t]);return r},Oo=function(e,r,t){var n=r/8|0;return(e[n]|e[n+1]<<8)>>(r&7)&t},zg=function(e,r){var t=r/8|0;return(e[t]|e[t+1]<<8|e[t+2]<<16)>>(r&7)},Qm=function(e){return(e+7)/8|0},tu=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))},Jg={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},_5=["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"],Jt=function(e,r,t){var n=new Error(r||_5[e]);if(n.code=e,Error.captureStackTrace&&Error.captureStackTrace(n,Jt),!t)throw n;return n},L5=function(e,r,t,n){var o=e.length,i=n?n.length:0;if(!o||r.f&&!r.l)return t||new St(0);var s=!t,u=s||r.i!=2,l=r.i;s&&(t=new St(o*3));var c=function(O){var Q=t.length;if(O>Q){var X=new St(Math.max(Q*2,O));X.set(t),t=X}},d=r.f||0,f=r.p||0,h=r.b||0,b=r.l,I=r.d,E=r.m,v=r.n,x=o*8;do{if(!b){d=Oo(e,f,1);var D=Oo(e,f+1,3);if(f+=3,D)if(D==1)b=B5,I=k5,E=9,v=5;else if(D==2){var P=Oo(e,f,31)+257,L=Oo(e,f+10,15)+4,N=P+Oo(e,f+5,31)+1;f+=14;for(var $=new St(N),W=new St(19),V=0;V<L;++V)W[Jm[V]]=Oo(e,f+V*3,7);f+=L*3;for(var q=Gg(W),se=(1<<q)-1,ue=Bo(W,q,1),V=0;V<N;){var ce=ue[Oo(e,f,se)];f+=ce&15;var w=ce>>4;if(w<16)$[V++]=w;else{var de=0,Ee=0;for(w==16?(Ee=3+Oo(e,f,3),f+=2,de=$[V-1]):w==17?(Ee=3+Oo(e,f,7),f+=3):w==18&&(Ee=11+Oo(e,f,127),f+=7);Ee--;)$[V++]=de}}var he=$.subarray(0,P),ne=$.subarray(P);E=Gg(he),v=Gg(ne),b=Bo(he,E,1),I=Bo(ne,v,1)}else Jt(1);else{var w=Qm(f)+4,S=e[w-4]|e[w-3]<<8,F=w+S;if(F>o){l&&Jt(0);break}u&&c(h+S),t.set(e.subarray(w,F),h),r.b=h+=S,r.p=f=F*8,r.f=d;continue}if(f>x){l&&Jt(0);break}}u&&c(h+131072);for(var Ce=(1<<E)-1,xe=(1<<v)-1,Re=f;;Re=f){var de=b[zg(e,f)&Ce],we=de>>4;if(f+=de&15,f>x){l&&Jt(0);break}if(de||Jt(2),we<256)t[h++]=we;else if(we==256){Re=f,b=null;break}else{var Ve=we-254;if(we>264){var V=we-257,me=lp[V];Ve=Oo(e,f,(1<<me)-1)+jv[V],f+=me}var at=I[zg(e,f)&xe],xt=at>>4;at||Jt(3),f+=at&15;var ne=A5[xt];if(xt>3){var me=cp[xt];ne+=zg(e,f)&(1<<me)-1,f+=me}if(f>x){l&&Jt(0);break}u&&c(h+131072);var Ot=h+Ve;if(h<ne){var A=i-ne,Z=Math.min(ne,Ot);for(A+h<0&&Jt(3);h<Z;++h)t[h]=n[A+h]}for(;h<Ot;++h)t[h]=t[h-ne]}}r.l=b,r.p=Re,r.b=h,r.f=d,b&&(d=1,r.m=E,r.d=I,r.n=v)}while(!d);return h!=t.length&&s?tu(t,0,h):t.subarray(0,h)},aa=function(e,r,t){t<<=r&7;var n=r/8|0;e[n]|=t,e[n+1]|=t>>8},ip=function(e,r,t){t<<=r&7;var n=r/8|0;e[n]|=t,e[n+1]|=t>>8,e[n+2]|=t>>16},Vg=function(e,r){for(var t=[],n=0;n<e.length;++n)e[n]&&t.push({s:n,f:e[n]});var o=t.length,i=t.slice();if(!o)return{t:Gv,l:0};if(o==1){var s=new St(t[0].s+1);return s[t[0].s]=1,{t:s,l:1}}t.sort(function(F,P){return F.f-P.f}),t.push({s:-1,f:25001});var u=t[0],l=t[1],c=0,d=1,f=2;for(t[0]={s:-1,f:u.f+l.f,l:u,r:l};d!=o-1;)u=t[t[c].f<t[f].f?c++:f++],l=t[c!=d&&t[c].f<t[f].f?c++:f++],t[d++]={s:-1,f:u.f+l.f,l:u,r:l};for(var h=i[0].s,n=1;n<o;++n)i[n].s>h&&(h=i[n].s);var b=new gn(h+1),I=Zg(t[d-1],b,0);if(I>r){var n=0,E=0,v=I-r,x=1<<v;for(i.sort(function(P,L){return b[L.s]-b[P.s]||P.f-L.f});n<o;++n){var D=i[n].s;if(b[D]>r)E+=x-(1<<I-b[D]),b[D]=r;else break}for(E>>=v;E>0;){var w=i[n].s;b[w]<r?E-=1<<r-b[w]++-1:++n}for(;n>=0&&E;--n){var S=i[n].s;b[S]==r&&(--b[S],++E)}I=r}return{t:new St(b),l:I}},Zg=function(e,r,t){return e.s==-1?Math.max(Zg(e.l,r,t+1),Zg(e.r,r,t+1)):r[e.s]=t},Rv=function(e){for(var r=e.length;r&&!e[--r];);for(var t=new gn(++r),n=0,o=e[0],i=1,s=function(l){t[n++]=l},u=1;u<=r;++u)if(e[u]==o&&u!=r)++i;else{if(!o&&i>2){for(;i>138;i-=138)s(32754);i>2&&(s(i>10?i-11<<5|28690:i-3<<5|12305),i=0)}else if(i>3){for(s(o),--i;i>6;i-=6)s(8304);i>2&&(s(i-3<<5|8208),i=0)}for(;i--;)s(o);i=1,o=e[u]}return{c:t.subarray(0,n),n:r}},ap=function(e,r){for(var t=0,n=0;n<r.length;++n)t+=e[n]*r[n];return t},Uv=function(e,r,t){var n=t.length,o=Qm(r+2);e[o]=n&255,e[o+1]=n>>8,e[o+2]=e[o]^255,e[o+3]=e[o+1]^255;for(var i=0;i<n;++i)e[o+i+4]=t[i];return(o+4+n)*8},Nv=function(e,r,t,n,o,i,s,u,l,c,d){aa(r,d++,t),++o[256];for(var f=Vg(o,15),h=f.t,b=f.l,I=Vg(i,15),E=I.t,v=I.l,x=Rv(h),D=x.c,w=x.n,S=Rv(E),F=S.c,P=S.n,L=new gn(19),N=0;N<D.length;++N)++L[D[N]&31];for(var N=0;N<F.length;++N)++L[F[N]&31];for(var $=Vg(L,7),W=$.t,V=$.l,q=19;q>4&&!W[Jm[q-1]];--q);var se=c+5<<3,ue=ap(o,ts)+ap(i,sp)+s,ce=ap(o,h)+ap(i,E)+s+14+3*q+ap(L,W)+2*L[16]+3*L[17]+7*L[18];if(l>=0&&se<=ue&&se<=ce)return Uv(r,d,e.subarray(l,l+c));var de,Ee,he,ne;if(aa(r,d,1+(ce<ue)),d+=2,ce<ue){de=Bo(h,b,0),Ee=h,he=Bo(E,v,0),ne=E;var Ce=Bo(W,V,0);aa(r,d,w-257),aa(r,d+5,P-1),aa(r,d+10,q-4),d+=14;for(var N=0;N<q;++N)aa(r,d+3*N,W[Jm[N]]);d+=3*q;for(var xe=[D,F],Re=0;Re<2;++Re)for(var we=xe[Re],N=0;N<we.length;++N){var Ve=we[N]&31;aa(r,d,Ce[Ve]),d+=W[Ve],Ve>15&&(aa(r,d,we[N]>>5&127),d+=we[N]>>12)}}else de=O5,Ee=ts,he=P5,ne=sp;for(var N=0;N<u;++N){var me=n[N];if(me>255){var Ve=me>>18&31;ip(r,d,de[Ve+257]),d+=Ee[Ve+257],Ve>7&&(aa(r,d,me>>23&31),d+=lp[Ve]);var at=me&31;ip(r,d,he[at]),d+=ne[at],at>3&&(ip(r,d,me>>5&8191),d+=cp[at])}else ip(r,d,de[me]),d+=Ee[me]}return ip(r,d,de[256]),d+Ee[256]},R5=new qm([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Gv=new St(0),N5=function(e,r,t,n,o,i){var s=i.z||e.length,u=new St(n+s+5*(1+Math.ceil(s/7e3))+o),l=u.subarray(n,u.length-o),c=i.l,d=(i.r||0)&7;if(r){d&&(l[0]=i.r>>3);for(var f=R5[r-1],h=f>>13,b=f&8191,I=(1<<t)-1,E=i.p||new gn(32768),v=i.h||new gn(I+1),x=Math.ceil(t/3),D=2*x,w=function(Y){return(e[Y]^e[Y+1]<<x^e[Y+2]<<D)&I},S=new qm(25e3),F=new gn(288),P=new gn(32),L=0,N=0,$=i.i||0,W=0,V=i.w||0,q=0;$+2<s;++$){var se=w($),ue=$&32767,ce=v[se];if(E[ue]=ce,v[se]=ue,V<=$){var de=s-$;if((L>7e3||W>24576)&&(de>423||!c)){d=Nv(e,l,0,S,F,P,N,W,q,$-q,d),W=L=N=0,q=$;for(var Ee=0;Ee<286;++Ee)F[Ee]=0;for(var Ee=0;Ee<30;++Ee)P[Ee]=0}var he=2,ne=0,Ce=b,xe=ue-ce&32767;if(de>2&&se==w($-xe))for(var Re=Math.min(h,de)-1,we=Math.min(32767,$),Ve=Math.min(258,de);xe<=we&&--Ce&&ue!=ce;){if(e[$+he]==e[$+he-xe]){for(var me=0;me<Ve&&e[$+me]==e[$+me-xe];++me);if(me>he){if(he=me,ne=xe,me>Re)break;for(var at=Math.min(xe,me-2),xt=0,Ee=0;Ee<at;++Ee){var Ot=$-xe+Ee&32767,A=E[Ot],Z=Ot-A&32767;Z>xt&&(xt=Z,ce=Ot)}}}ue=ce,ce=E[ue],xe+=ue-ce&32767}if(ne){S[W++]=268435456|Hg[he]<<18|Lv[ne];var O=Hg[he]&31,Q=Lv[ne]&31;N+=lp[O]+cp[Q],++F[257+O],++P[Q],V=$+he,++L}else S[W++]=e[$],++F[e[$]]}}for($=Math.max($,V);$<s;++$)S[W++]=e[$],++F[e[$]];d=Nv(e,l,c,S,F,P,N,W,q,$-q,d),c||(i.r=d&7|l[d/8|0]<<3,d-=7,i.h=v,i.p=E,i.i=$,i.w=V)}else{for(var $=i.w||0;$<s+c;$+=65535){var X=$+65535;X>=s&&(l[d/8|0]=c,X=s),d=Uv(l,d+1,e.subarray($,X))}i.i=s}return tu(u,0,n+Qm(d)+o)},n$=function(){for(var e=new Int32Array(256),r=0;r<256;++r){for(var t=r,n=9;--n;)t=(t&1&&-306674912)^t>>>1;e[r]=t}return e}(),$5=function(){var e=-1;return{p:function(r){for(var t=e,n=0;n<r.length;++n)t=n$[t&255^r[n]]^t>>>8;e=t},d:function(){return~e}}};var j5=function(e,r,t,n,o){if(!o&&(o={l:1},r.dictionary)){var i=r.dictionary.subarray(-32768),s=new St(i.length+e.length);s.set(i),s.set(e,i.length),e=s,o.w=i.length}return N5(e,r.level==null?6:r.level,r.mem==null?o.l?Math.ceil(Math.max(8,Math.min(13,Math.log(e.length)))*1.5):20:12+r.mem,t,n,o)},Yg=function(e,r){var t={};for(var n in e)t[n]=e[n];for(var n in r)t[n]=r[n];return t},D5=function(e,r,t){for(var n=e(),o=e.toString(),i=o.slice(o.indexOf("[")+1,o.lastIndexOf("]")).replace(/\s+/g,"").split(","),s=0;s<n.length;++s){var u=n[s],l=i[s];if(typeof u=="function"){r+=";"+l+"=";var c=u.toString();if(u.prototype)if(c.indexOf("[native code]")!=-1){var d=c.indexOf(" ",8)+1;r+=c.slice(d,c.indexOf("(",d))}else{r+=c;for(var f in u.prototype)r+=";"+l+".prototype."+f+"="+u.prototype[f].toString()}else r+=c}else t[l]=u}return r},Ug=[],o$=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},i$=function(e,r,t,n){if(!Ug[t]){for(var o="",i={},s=e.length-1,u=0;u<s;++u)o=D5(e[u],o,i);Ug[t]={c:D5(e[s],o,i),e:i}}var l=Yg({},Ug[t].e);return r$(Ug[t].c+";onmessage=function(e){for(var k in e.data)self[k]=e.data[k];onmessage="+r.toString()+"}",t,l,o$(l),n)},a$=function(){return[St,gn,qm,lp,cp,Jm,jv,A5,B5,k5,Ym,_5,Bo,Gg,Oo,zg,Qm,tu,Jt,L5,Qg,Kg,U5]},s$=function(){return[St,gn,qm,lp,cp,Jm,Hg,Lv,O5,ts,P5,sp,Ym,R5,Gv,Bo,aa,ip,Vg,Zg,Rv,ap,Uv,Nv,Qm,tu,N5,j5,qg,Kg]};var Kg=function(e){return postMessage(e,[e.buffer])},U5=function(e){return e&&{out:e.size&&new St(e.size),dictionary:e.dictionary}},G5=function(e,r,t,n,o,i){var s=i$(t,n,o,function(u,l){s.terminate(),i(u,l)});return s.postMessage([e,r],r.consume?[e.buffer]:[]),function(){s.terminate()}};var ui=function(e,r){return e[r]|e[r+1]<<8},Xr=function(e,r){return(e[r]|e[r+1]<<8|e[r+2]<<16|e[r+3]<<24)>>>0},_v=function(e,r){return Xr(e,r)+Xr(e,r+4)*4294967296},Wr=function(e,r,t){for(;t;++r)e[r]=t,t>>>=8};function u$(e,r,t){return t||(t=r,r={}),typeof t!="function"&&Jt(7),G5(e,r,[s$],function(n){return Kg(qg(n.data[0],n.data[1]))},0,t)}function qg(e,r){return j5(e,r||{},0,0)}function l$(e,r,t){return t||(t=r,r={}),typeof t!="function"&&Jt(7),G5(e,r,[a$],function(n){return Kg(Qg(n.data[0],U5(n.data[1])))},1,t)}function Qg(e,r){return L5(e,{i:2},r&&r.out,r&&r.dictionary)}var zv=function(e,r,t,n){for(var o in e){var i=e[o],s=r+o,u=n;Array.isArray(i)&&(u=Yg(n,i[1]),i=i[0]),i instanceof St?t[s]=[i,u]:(t[s+="/"]=[new St(0),u],zv(i,s,t,n))}},T5=typeof TextEncoder<"u"&&new TextEncoder,$v=typeof TextDecoder<"u"&&new TextDecoder,c$=0;try{$v.decode(Gv,{stream:!0}),c$=1}catch{}var p$=function(e){for(var r="",t=0;;){var n=e[t++],o=(n>127)+(n>223)+(n>239);if(t+o>e.length)return{s:r,r:tu(e,t-1)};o?o==3?(n=((n&15)<<18|(e[t++]&63)<<12|(e[t++]&63)<<6|e[t++]&63)-65536,r+=String.fromCharCode(55296|n>>10,56320|n&1023)):o&1?r+=String.fromCharCode((n&31)<<6|e[t++]&63):r+=String.fromCharCode((n&15)<<12|(e[t++]&63)<<6|e[t++]&63):r+=String.fromCharCode(n)}};function up(e,r){if(r){for(var t=new St(e.length),n=0;n<e.length;++n)t[n]=e.charCodeAt(n);return t}if(T5)return T5.encode(e);for(var o=e.length,i=new St(e.length+(e.length>>1)),s=0,u=function(d){i[s++]=d},n=0;n<o;++n){if(s+5>i.length){var l=new St(s+8+(o-n<<1));l.set(i),i=l}var c=e.charCodeAt(n);c<128||r?u(c):c<2048?(u(192|c>>6),u(128|c&63)):c>55295&&c<57344?(c=65536+(c&1047552)|e.charCodeAt(++n)&1023,u(240|c>>18),u(128|c>>12&63),u(128|c>>6&63),u(128|c&63)):(u(224|c>>12),u(128|c>>6&63),u(128|c&63))}return tu(i,0,s)}function Vv(e,r){if(r){for(var t="",n=0;n<e.length;n+=16384)t+=String.fromCharCode.apply(null,e.subarray(n,n+16384));return t}else{if($v)return $v.decode(e);var o=p$(e),i=o.s,t=o.r;return t.length&&Jt(8),i}}var z5=function(e,r){return r+30+ui(e,r+26)+ui(e,r+28)},V5=function(e,r,t){var n=ui(e,r+28),o=Vv(e.subarray(r+46,r+46+n),!(ui(e,r+8)&2048)),i=r+46+n,s=Xr(e,r+20),u=t&&s==4294967295?d$(e,i):[s,Xr(e,r+24),Xr(e,r+42)],l=u[0],c=u[1],d=u[2];return[ui(e,r+10),l,c,o,i+ui(e,r+30)+ui(e,r+32),d]},d$=function(e,r){for(;ui(e,r)!=1;r+=4+ui(e,r+2));return[_v(e,r+12),_v(e,r+4),_v(e,r+20)]},Km=function(e){var r=0;if(e)for(var t in e){var n=e[t].length;n>65535&&Jt(9),r+=n+4}return r},Wg=function(e,r,t,n,o,i,s,u){var l=n.length,c=t.extra,d=u&&u.length,f=Km(c);Wr(e,r,s!=null?33639248:67324752),r+=4,s!=null&&(e[r++]=20,e[r++]=t.os),e[r]=20,r+=2,e[r++]=t.flag<<1|(i<0&&8),e[r++]=o&&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)&&Jt(10),Wr(e,r,b<<25|h.getMonth()+1<<21|h.getDate()<<16|h.getHours()<<11|h.getMinutes()<<5|h.getSeconds()>>1),r+=4,i!=-1&&(Wr(e,r,t.crc),Wr(e,r+4,i<0?-i-2:i),Wr(e,r+8,t.size)),Wr(e,r+12,l),Wr(e,r+14,f),r+=16,s!=null&&(Wr(e,r,d),Wr(e,r+6,t.attrs),Wr(e,r+10,s),r+=14),e.set(n,r),r+=l,f)for(var I in c){var E=c[I],v=E.length;Wr(e,r,+I),Wr(e,r+2,v),e.set(E,r+4),r+=4+v}return d&&(e.set(u,r),r+=d),r},H5=function(e,r,t,n,o){Wr(e,r,101010256),Wr(e,r+8,t),Wr(e,r+10,t),Wr(e,r+12,n),Wr(e,r+16,o)};function Z5(e,r,t){t||(t=r,r={}),typeof t!="function"&&Jt(7);var n={};zv(e,"",n,r);var o=Object.keys(n),i=o.length,s=0,u=0,l=i,c=new Array(i),d=[],f=function(){for(var v=0;v<d.length;++v)d[v]()},h=function(v,x){Xg(function(){t(v,x)})};Xg(function(){h=t});var b=function(){var v=new St(u+22),x=s,D=u-s;u=0;for(var w=0;w<l;++w){var S=c[w];try{var F=S.c.length;Wg(v,u,S,S.f,S.u,F);var P=30+S.f.length+Km(S.extra),L=u+P;v.set(S.c,L),Wg(v,s,S,S.f,S.u,F,u,S.m),s+=16+P+(S.m?S.m.length:0),u=L+F}catch(N){return h(N,null)}}H5(v,s,c.length,D,x),h(null,v)};i||b();for(var I=function(v){var x=o[v],D=n[x],w=D[0],S=D[1],F=$5(),P=w.length;F.p(w);var L=up(x),N=L.length,$=S.comment,W=$&&up($),V=W&&W.length,q=Km(S.extra),se=S.level==0?0:8,ue=function(ce,de){if(ce)f(),h(ce,null);else{var Ee=de.length;c[v]=Yg(S,{size:P,crc:F.d(),c:de,f:L,m:W,u:N!=x.length||W&&$.length!=V,compression:se}),s+=30+N+q+Ee,u+=76+2*(N+q)+(V||0)+Ee,--i||b()}};if(N>65535&&ue(Jt(11,0,1),null),!se)ue(null,w);else if(P<16e4)try{ue(null,qg(w,S))}catch(ce){ue(ce,null)}else d.push(u$(w,S,ue))},E=0;E<l;++E)I(E);return f}function W5(e,r){r||(r={});var t={},n=[];zv(e,"",t,r);var o=0,i=0;for(var s in t){var u=t[s],l=u[0],c=u[1],d=c.level==0?0:8,f=up(s),h=f.length,b=c.comment,I=b&&up(b),E=I&&I.length,v=Km(c.extra);h>65535&&Jt(11);var x=d?qg(l,c):l,D=x.length,w=$5();w.p(l),n.push(Yg(c,{size:l.length,crc:w.d(),c:x,f,m:I,u:h!=s.length||I&&b.length!=E,o,compression:d})),o+=30+h+v+D,i+=76+2*(h+v)+(E||0)+D}for(var S=new St(i+22),F=o,P=i-o,L=0;L<n.length;++L){var f=n[L];Wg(S,f.o,f,f.f,f.u,f.c.length);var N=30+f.f.length+Km(f.extra);S.set(f.c,f.o+N),Wg(S,o,f,f.f,f.u,f.c.length,f.o,f.m),o+=16+N+(f.m?f.m.length:0)}return H5(S,o,n.length,P,F),S}var Xg=typeof queueMicrotask=="function"?queueMicrotask:typeof setTimeout=="function"?setTimeout:function(e){e()};function X5(e,r,t){t||(t=r,r={}),typeof t!="function"&&Jt(7);var n=[],o=function(){for(var v=0;v<n.length;++v)n[v]()},i={},s=function(v,x){Xg(function(){t(v,x)})};Xg(function(){s=t});for(var u=e.length-22;Xr(e,u)!=101010256;--u)if(!u||e.length-u>65558)return s(Jt(13,0,1),null),o;var l=ui(e,u+8);if(l){var c=l,d=Xr(e,u+16),f=d==4294967295||c==65535;if(f){var h=Xr(e,u-12);f=Xr(e,h)==101075792,f&&(c=l=Xr(e,h+32),d=Xr(e,h+48))}for(var b=r&&r.filter,I=function(v){var x=V5(e,d,f),D=x[0],w=x[1],S=x[2],F=x[3],P=x[4],L=x[5],N=z5(e,L);d=P;var $=function(V,q){V?(o(),s(V,null)):(q&&(i[F]=q),--l||s(null,i))};if(!b||b({name:F,size:w,originalSize:S,compression:D}))if(!D)$(null,tu(e,N,N+w));else if(D==8){var W=e.subarray(N,N+w);if(S<524288||w>.8*S)try{$(null,Qg(W,{out:new St(S)}))}catch(V){$(V,null)}else n.push(l$(W,{size:S},$))}else $(Jt(14,"unknown compression type "+D,1),null);else $(null,null)},E=0;E<c;++E)I(E)}else s(null,{});return o}function J5(e,r){for(var t={},n=e.length-22;Xr(e,n)!=101010256;--n)(!n||e.length-n>65558)&&Jt(13);var o=ui(e,n+8);if(!o)return{};var i=Xr(e,n+16),s=i==4294967295||o==65535;if(s){var u=Xr(e,n-12);s=Xr(e,u)==101075792,s&&(o=Xr(e,u+32),i=Xr(e,u+48))}for(var l=r&&r.filter,c=0;c<o;++c){var d=V5(e,i,s),f=d[0],h=d[1],b=d[2],I=d[3],E=d[4],v=d[5],x=z5(e,v);i=E,(!l||l({name:I,size:h,originalSize:b,compression:f}))&&(f?f==8?t[I]=Qg(e.subarray(x,x+h),{out:new St(b)}):Jt(14,"unknown compression type "+f):t[I]=tu(e,x,x+h))}return t}p();var m$=e=>{if(e!=null)return e.trim()===""?void 0:e},f$=e=>e!=null,ey=(e,r,t=0)=>{if(M.IsNull(e))return"null";if(M.IsUndefined(e))return"undefined";if(M.IsString(e))return"<string>";if(M.IsNumber(e))return"<number>";if(M.IsBoolean(e))return"<boolean>";if(M.IsLiteral(e))return typeof e.const=="string"?`'${e.const}'`:`${e.const}`;if(M.IsRef(e)){let n=r.find(o=>o.$id===e.$ref);return n==null?e.$ref:ey(n,r,t)}if(M.IsArray(e))return`${ey(e.items,r,t+1)}[]`;if(M.IsUnion(e)&&(!(e.anyOf.length>5)||e.$id==null)){let o=`${e.anyOf.map(i=>ey(i,r,t+1)).filter(f$).join(" | ")}`;return t>0?`(${o})`:o}return e.$id??""},h$=(e,r,t)=>{let n=r.message;return M.IsUnion(r.schema)&&(n=`Expected one of: ${ey(r.schema,t)}`),`${`#/definitions/${e}${m$(r.path)??""}`}: ${n}`},ty=(e,r,t)=>{let n=r.First();if(n!=null)return h$(e,n,t)};var pp;(function(e){e.Archive="Archive",e.Validate="Validate",e.Encode="Encode",e.Unknown="Unknown"})(pp||(pp={}));var dp=class extends Error{constructor(t,n){super(n);m(this,"name");m(this,"kind");this.name="CompressError",this.kind=t}},g$=e=>new dp(pp.Archive,e.message),y$=e=>{let r=Object.values(Jg);return e instanceof Error&&"code"in e&&typeof e.code=="number"&&r.includes(e.code)},b$=(e,r,t)=>new dp(pp.Validate,ty(e,r,t)??"Unknown validate error"),v$=e=>new dp(pp.Encode,e.message),x$=e=>new dp(pp.Unknown,e instanceof Error?e.message:String(e)),ef=(e,r,t)=>r instanceof rl?v$(r):r instanceof Mo?b$(e,r,t):y$(r)?g$(r):x$(r);p();var mp;(function(e){e.Unarchive="Unarchive",e.Validate="Validate",e.Decode="Decode",e.Unknown="Unknown"})(mp||(mp={}));var fp=class extends Error{constructor(t,n){super(n);m(this,"name");m(this,"kind");this.name="DecompressError",this.kind=t}},I$=e=>new fp(mp.Unarchive,e.message),E$=e=>{let r=Object.values(Jg);return e instanceof Error&&"code"in e&&typeof e.code=="number"&&r.includes(e.code)},C$=(e,r,t)=>new fp(mp.Validate,ty(e,r,t)??"Unknown validate error"),S$=e=>new fp(mp.Decode,e.message),D$=e=>new fp(mp.Unknown,e instanceof Error?e.message:String(e)),tf=(e,r,t)=>r instanceof tl?S$(r):r instanceof Mo?C$(e,r,t):E$(r)?I$(r):D$(r);var Y5=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,n]of Object.entries(e)){let o=r===""?t:`${r}.${t}`;yield*Y5(n,o)}}},T$=(e,r)=>e===""?r:r.startsWith("[")?`${e}${r}`:`${e}.${r}`,rr=(e,r,t)=>{let n=new Set;for(let[o,i]of Y5(e)){let s=r(i);if(n.has(s))return oe({kind:Rn.DuplicateIdError,properties:{id:s,path:T$(t,o)}});n.add(s)}return te(!0)};var K5=e=>e.floors==null?oe({kind:Rn.FloorMissingError,properties:null}):rr(e.floors.features,r=>r.properties.id,"floors");var q5=g.Intersect([g.Object({id:g.Ref(ze),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}))}),Kn],{$id:"FloorProperties"}),Q5=Vr(g.Union([g.Ref(Kc),g.Ref(qc),g.Null()]),g.Ref(q5),{$id:"FloorFeature"}),eD=hn(g.Ref(Q5),{$id:"FloorCollection"}),w$=g.Object({floors:g.Ref(eD)}),tD={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:K5,schema:w$,references:[q5,Q5,eD]};p();p();var nr=e=>g.Unsafe(e);p();var Xe=e=>Object.keys(e);p();p();var F$=e=>new Map(e.floors?.features.map(r=>[r.properties.id,r])??[]),li=e=>{let r=F$(e);return n=>{let o=r.get(n);return o==null?oe({kind:Rn.UnknownFloorError,properties:{floorId:n}}):te(o)}};var rD=e=>{if(e.floors==null)return oe({kind:Rn.FloorMissingError,properties:null});if(e.geometry==null)return oe({kind:Rn.GeometryMissingError,properties:null});let r=rr(e.geometry,n=>n.properties.id,"geometry");if(r.isErr())return r;let t=li(e);for(let n of Xe(e.geometry)){let o=t(n);if(o.isErr())return o}return te(!0)};var nD=g.Intersect([g.Object({id:g.Ref(an)}),Kn],{$id:"GeometryProperties"}),oD=Vr(g.Union([g.Ref(on),g.Ref(vg),g.Ref(xg),g.Ref(Ig),g.Ref(Kc),g.Ref(qc)]),g.Ref(nD),{$id:"GeometryFeature"}),iD=hn(g.Ref(oD),{$id:"GeometryCollection"}),M$=g.Object({geometry:nr(g.Record(ze,g.Ref(iD),{additionalProperties:!1}))},{$id:"GeometrySchema"}),A$=/^geometry\/(.*)\.geojson$/,aD={name:"core:geometry",schema:M$,intoBundle:function*(e){if(e.geometry!=null)for(let r of Xe(e.geometry))yield{path:`geometry/${r}.geojson`,contents:e.geometry[r]}},fromBundle:(e,r,t)=>{let n=e.match(A$)?.[1];if(n)return{geometry:{[n]:t(r)}}},references:[nD,oD,iD],integrityCheck:rD};p();var Hv=g.Object({type:g.Literal("file"),name:g.String({description:"The name of the file."})},{$id:"ManifestFile"}),sD=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(Hv)]),{minItems:1,description:"The children of the folder."})}),{$id:"ManifestFolder"}),uD=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(sD),g.Ref(Hv)]),{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(ze,{description:"The default floor ID of the map."})),language:g.Optional(g.String({description:"The language code of the map."}))},{$id:"ManifestProperties"}),lD=hn(Vr(on,g.Ref(uD)),{$id:"ManifestCollection"},{minItems:1,maxItems:1}),O$=g.Object({manifest:g.Ref(lD)}),cD={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:O$,references:[Hv,sD,uD,lD]};p();p();p();p();var Zv=class extends Se{constructor(t){super(`Unable to dereference schema with $id '${t.$ref}'`);m(this,"schema");this.schema=t}};function B$(e,r){let t=r.find(n=>n.$id===e.$ref);if(t===void 0)throw new Zv(e);return ol(t,r)}function ry(e,r){return!Ye.IsString(e.$id)||r.some(t=>t.$id===e.$id)||r.push(e),r}function ol(e,r){return e[j]==="This"||e[j]==="Ref"?B$(e,r):e}p();function P$(e,r,t){let n=e.get(r);if(n!==void 0)return n;let o=ia(r,t);return e.set(r,o),o}function ny(){let e=new WeakMap;return{HasTransform:(r,t)=>P$(e,r,t)}}function Yt(e,r,t){try{return M.IsTransform(e)?e[jt].Decode(t):t}catch(n){throw new tl(e,r,t,n)}}function k$(e,r,t,n,o){return Ye.IsArray(n)?Yt(e,t,n.map((i,s)=>sa(e.items,r,`${t}/${s}`,i,o))):Yt(e,t,n)}function _$(e,r,t,n,o){if(!Ye.IsObject(n)||zr(n))return Yt(e,t,n);let i=Ks(e),s=i.map(f=>f[0]),u={...n};for(let[f,h]of i)f in u&&(u[f]=sa(h,r,`${t}/${f}`,u[f],o));if(!M.IsTransform(e.unevaluatedProperties))return Yt(e,t,u);let l=Object.getOwnPropertyNames(u),c=e.unevaluatedProperties,d={...u};for(let f of l)s.includes(f)||(d[f]=Yt(c,`${t}/${f}`,d[f]));return Yt(e,t,d)}function L$(e,r,t,n,o){return Yt(e,t,sa(e.not,r,t,n,o))}function R$(e,r,t,n,o){if(!Ye.IsObject(n))return Yt(e,t,n);let i=Or(e),s={...n};for(let d of i)Ye.HasPropertyKey(s,d)&&(Ye.IsUndefined(s[d])&&(!M.IsUndefined(e.properties[d])||mt.IsExactOptionalProperty(s,d))||(s[d]=sa(e.properties[d],r,`${t}/${d}`,s[d],o)));if(!M.IsSchema(e.additionalProperties))return Yt(e,t,s);let u=Object.getOwnPropertyNames(s),l=e.additionalProperties,c={...s};for(let d of u)i.includes(d)||(c[d]=Yt(l,`${t}/${d}`,c[d]));return Yt(e,t,c)}function N$(e,r,t,n,o){if(!Ye.IsObject(n))return Yt(e,t,n);let i=Object.getOwnPropertyNames(e.patternProperties)[0],s=new RegExp(i),u={...n};for(let f of Object.getOwnPropertyNames(n))s.test(f)&&(u[f]=sa(e.patternProperties[i],r,`${t}/${f}`,u[f],o));if(!M.IsSchema(e.additionalProperties))return Yt(e,t,u);let l=Object.getOwnPropertyNames(u),c=e.additionalProperties,d={...u};for(let f of l)s.test(f)||(d[f]=Yt(c,`${t}/${f}`,d[f]));return Yt(e,t,d)}function $$(e,r,t,n,o){let i=ol(e,r);return Yt(e,t,sa(i,r,t,n,o))}function j$(e,r,t,n,o){let i=ol(e,r);return Yt(e,t,sa(i,r,t,n,o))}function U$(e,r,t,n,o){return Ye.IsArray(n)&&Ye.IsArray(e.items)?Yt(e,t,e.items.map((i,s)=>sa(i,r,`${t}/${s}`,n[s],o))):Yt(e,t,n)}function G$(e,r,t,n,o){for(let i of e.anyOf){if(!si.Check(i,r,n))continue;let s=sa(i,r,t,n,o);return Yt(e,t,s)}return Yt(e,t,n)}function sa(e,r,t,n,o){if(!o.HasTransform(e,r))return n;let i=ry(e,r),s=e;switch(e[j]){case"Array":return k$(s,i,t,n,o);case"Intersect":return _$(s,i,t,n,o);case"Not":return L$(s,i,t,n,o);case"Object":return R$(s,i,t,n,o);case"Record":return N$(s,i,t,n,o);case"Ref":return $$(s,i,t,n,o);case"Symbol":return Yt(s,t,n);case"This":return j$(s,i,t,n,o);case"Tuple":return U$(s,i,t,n,o);case"Union":return G$(s,i,t,n,o);default:return Yt(s,t,n)}}function pD(e,r,t){let n=ny();return sa(e,r,"",t,n)}p();function ln(e,r,t){try{return M.IsTransform(e)?e[jt].Encode(t):t}catch(n){throw new rl(e,r,t,n)}}function z$(e,r,t,n,o){let i=ln(e,t,n);return Ye.IsArray(i)?i.map((s,u)=>ua(e.items,r,`${t}/${u}`,s,o)):i}function V$(e,r,t,n,o){let i=ln(e,t,n);if(!Ye.IsObject(n)||zr(n))return i;let s=Ks(e),u=s.map(h=>h[0]),l={...i};for(let[h,b]of s)h in l&&(l[h]=ua(b,r,`${t}/${h}`,l[h],o));if(!M.IsTransform(e.unevaluatedProperties))return l;let c=Object.getOwnPropertyNames(l),d=e.unevaluatedProperties,f={...l};for(let h of c)u.includes(h)||(f[h]=ln(d,`${t}/${h}`,f[h]));return f}function H$(e,r,t,n){return ln(e.not,t,ln(e,t,n))}function Z$(e,r,t,n,o){let i=ln(e,t,n);if(!Ye.IsObject(i))return i;let s=Or(e),u={...i};for(let f of s)Ye.HasPropertyKey(u,f)&&(Ye.IsUndefined(u[f])&&(!M.IsUndefined(e.properties[f])||mt.IsExactOptionalProperty(u,f))||(u[f]=ua(e.properties[f],r,`${t}/${f}`,u[f],o)));if(!M.IsSchema(e.additionalProperties))return u;let l=Object.getOwnPropertyNames(u),c=e.additionalProperties,d={...u};for(let f of l)s.includes(f)||(d[f]=ln(c,`${t}/${f}`,d[f]));return d}function W$(e,r,t,n,o){let i=ln(e,t,n);if(!Ye.IsObject(n))return i;let s=Object.getOwnPropertyNames(e.patternProperties)[0],u=new RegExp(s),l={...i};for(let h of Object.getOwnPropertyNames(n))u.test(h)&&(l[h]=ua(e.patternProperties[s],r,`${t}/${h}`,l[h],o));if(!M.IsSchema(e.additionalProperties))return l;let c=Object.getOwnPropertyNames(l),d=e.additionalProperties,f={...l};for(let h of c)u.test(h)||(f[h]=ln(d,`${t}/${h}`,f[h]));return f}function X$(e,r,t,n,o){let i=ol(e,r),s=ua(i,r,t,n,o);return ln(e,t,s)}function J$(e,r,t,n,o){let i=ol(e,r),s=ua(i,r,t,n,o);return ln(e,t,s)}function Y$(e,r,t,n,o){let i=ln(e,t,n);return Ye.IsArray(e.items)?e.items.map((s,u)=>ua(s,r,`${t}/${u}`,i[u],o)):[]}function K$(e,r,t,n,o){for(let i of e.anyOf){if(!si.Check(i,r,n))continue;let s=ua(i,r,t,n,o);return ln(e,t,s)}for(let i of e.anyOf){let s=ua(i,r,t,n,o);if(si.Check(e,r,s))return ln(e,t,s)}return ln(e,t,n)}function ua(e,r,t,n,o){if(!o.HasTransform(e,r))return n;let i=ry(e,r),s=e;switch(e[j]){case"Array":return z$(s,i,t,n,o);case"Intersect":return V$(s,i,t,n,o);case"Not":return H$(s,i,t,n);case"Object":return Z$(s,i,t,n,o);case"Record":return W$(s,i,t,n,o);case"Ref":return X$(s,i,t,n,o);case"This":return J$(s,i,t,n,o);case"Tuple":return Y$(s,i,t,n,o);case"Union":return K$(s,i,t,n,o);default:return ln(s,t,n)}}function dD(e,r,t){let n=ny();return ua(e,r,"",t,n)}p();var Wv=class{constructor(r,t,n,o){this.schema=r,this.references=t,this.checkFunc=n,this.code=o,this.hasTransform=ia(r,t)}Code(){return this.code}Errors(r){return ea(this.schema,this.references,r)}Check(r){return this.checkFunc(r)}Decode(r){if(!this.checkFunc(r))throw new rp(this.schema,r,this.Errors(r).First());return this.hasTransform?np(this.schema,this.references,r):r}Encode(r){let t=this.hasTransform?Pg(this.schema,this.references,r):r;if(!this.checkFunc(t))throw new op(this.schema,r,this.Errors(r).First());return t}},rs;(function(e){function r(i){return i===36}e.DollarSign=r;function t(i){return i===95}e.IsUnderscore=t;function n(i){return i>=65&&i<=90||i>=97&&i<=122}e.IsAlpha=n;function o(i){return i>=48&&i<=57}e.IsNumeric=o})(rs||(rs={}));var oy;(function(e){function r(i){return i.length===0?!1:rs.IsNumeric(i.charCodeAt(0))}function t(i){if(r(i))return!1;for(let s=0;s<i.length;s++){let u=i.charCodeAt(s);if(!(rs.IsAlpha(u)||rs.IsNumeric(u)||rs.DollarSign(u)||rs.IsUnderscore(u)))return!1}return!0}function n(i){return i.replace(/'/g,"\\'")}function o(i,s){return t(s)?`${i}.${s}`:`${i}['${n(s)}']`}e.Encode=o})(oy||(oy={}));var Xv;(function(e){function r(t){let n=[];for(let o=0;o<t.length;o++){let i=t.charCodeAt(o);rs.IsNumeric(i)||rs.IsAlpha(i)?n.push(t.charAt(o)):n.push(`_${i}_`)}return n.join("").replace(/__/g,"_")}e.Encode=r})(Xv||(Xv={}));var Jv;(function(e){function r(t){return t.replace(/'/g,"\\'")}e.Escape=r})(Jv||(Jv={}));var Yv=class extends Se{constructor(r){super("Unknown type"),this.schema=r}},iy=class extends Se{constructor(r){super("Preflight validation check failed to guard for the given schema"),this.schema=r}},il;(function(e){function r(s,u,l){return mt.ExactOptionalPropertyTypes?`('${u}' in ${s} ? ${l} : true)`:`(${oy.Encode(s,u)} !== undefined ? ${l} : true)`}e.IsExactOptionalProperty=r;function t(s){return mt.AllowArrayObject?`(typeof ${s} === 'object' && ${s} !== null)`:`(typeof ${s} === 'object' && ${s} !== null && !Array.isArray(${s}))`}e.IsObjectLike=t;function n(s){return mt.AllowArrayObject?`(typeof ${s} === 'object' && ${s} !== null && !(${s} instanceof Date) && !(${s} instanceof Uint8Array))`:`(typeof ${s} === 'object' && ${s} !== null && !Array.isArray(${s}) && !(${s} instanceof Date) && !(${s} instanceof Uint8Array))`}e.IsRecordLike=n;function o(s){return mt.AllowNaN?`typeof ${s} === 'number'`:`Number.isFinite(${s})`}e.IsNumberLike=o;function i(s){return mt.AllowNullVoid?`(${s} === undefined || ${s} === null)`:`${s} === undefined`}e.IsVoidLike=i})(il||(il={}));var ay;(function(e){function r(A){return A[j]==="Any"||A[j]==="Unknown"}function*t(A,Z,O){yield"true"}function*n(A,Z,O){yield`Array.isArray(${O})`;let[Q,X]=[Ve("value","any"),Ve("acc","number")];ye(A.maxItems)&&(yield`${O}.length <= ${A.maxItems}`),ye(A.minItems)&&(yield`${O}.length >= ${A.minItems}`);let Y=Ce(A.items,Z,"value");if(yield`${O}.every((${Q}) => ${Y})`,Ze(A.contains)||ye(A.minContains)||ye(A.maxContains)){let K=Ze(A.contains)?A.contains:gt(),ae=Ce(K,Z,"value"),$e=ye(A.minContains)?[`(count >= ${A.minContains})`]:[],Rt=ye(A.maxContains)?[`(count <= ${A.maxContains})`]:[],ir=`const count = value.reduce((${X}, ${Q}) => ${ae} ? acc + 1 : acc, 0)`,ho=["(count > 0)",...$e,...Rt].join(" && ");yield`((${Q}) => { ${ir}; return ${ho}})(${O})`}A.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 } )(${O})`)}function*o(A,Z,O){yield`(typeof value === 'object' && Symbol.asyncIterator in ${O})`}function*i(A,Z,O){yield`(typeof ${O} === 'bigint')`,Gr(A.exclusiveMaximum)&&(yield`${O} < BigInt(${A.exclusiveMaximum})`),Gr(A.exclusiveMinimum)&&(yield`${O} > BigInt(${A.exclusiveMinimum})`),Gr(A.maximum)&&(yield`${O} <= BigInt(${A.maximum})`),Gr(A.minimum)&&(yield`${O} >= BigInt(${A.minimum})`),Gr(A.multipleOf)&&(yield`(${O} % BigInt(${A.multipleOf})) === 0`)}function*s(A,Z,O){yield`(typeof ${O} === 'boolean')`}function*u(A,Z,O){yield*he(A.returns,Z,`${O}.prototype`)}function*l(A,Z,O){yield`(${O} instanceof Date) && Number.isFinite(${O}.getTime())`,ye(A.exclusiveMaximumTimestamp)&&(yield`${O}.getTime() < ${A.exclusiveMaximumTimestamp}`),ye(A.exclusiveMinimumTimestamp)&&(yield`${O}.getTime() > ${A.exclusiveMinimumTimestamp}`),ye(A.maximumTimestamp)&&(yield`${O}.getTime() <= ${A.maximumTimestamp}`),ye(A.minimumTimestamp)&&(yield`${O}.getTime() >= ${A.minimumTimestamp}`),ye(A.multipleOfTimestamp)&&(yield`(${O}.getTime() % ${A.multipleOfTimestamp}) === 0`)}function*c(A,Z,O){yield`(typeof ${O} === 'function')`}function*d(A,Z,O){yield`Number.isInteger(${O})`,ye(A.exclusiveMaximum)&&(yield`${O} < ${A.exclusiveMaximum}`),ye(A.exclusiveMinimum)&&(yield`${O} > ${A.exclusiveMinimum}`),ye(A.maximum)&&(yield`${O} <= ${A.maximum}`),ye(A.minimum)&&(yield`${O} >= ${A.minimum}`),ye(A.multipleOf)&&(yield`(${O} % ${A.multipleOf}) === 0`)}function*f(A,Z,O){let Q=A.allOf.map(X=>Ce(X,Z,O)).join(" && ");if(A.unevaluatedProperties===!1){let X=Re(`${new RegExp(Ja(A))};`),Y=`Object.getOwnPropertyNames(${O}).every(key => ${X}.test(key))`;yield`(${Q} && ${Y})`}else if(Ze(A.unevaluatedProperties)){let X=Re(`${new RegExp(Ja(A))};`),Y=`Object.getOwnPropertyNames(${O}).every(key => ${X}.test(key) || ${Ce(A.unevaluatedProperties,Z,`${O}[key]`)})`;yield`(${Q} && ${Y})`}else yield`(${Q})`}function*h(A,Z,O){yield`(typeof value === 'object' && Symbol.iterator in ${O})`}function*b(A,Z,O){typeof A.const=="number"||typeof A.const=="boolean"?yield`(${O} === ${A.const})`:yield`(${O} === '${Jv.Escape(A.const)}')`}function*I(A,Z,O){yield"false"}function*E(A,Z,O){yield`(!${Ce(A.not,Z,O)})`}function*v(A,Z,O){yield`(${O} === null)`}function*x(A,Z,O){yield il.IsNumberLike(O),ye(A.exclusiveMaximum)&&(yield`${O} < ${A.exclusiveMaximum}`),ye(A.exclusiveMinimum)&&(yield`${O} > ${A.exclusiveMinimum}`),ye(A.maximum)&&(yield`${O} <= ${A.maximum}`),ye(A.minimum)&&(yield`${O} >= ${A.minimum}`),ye(A.multipleOf)&&(yield`(${O} % ${A.multipleOf}) === 0`)}function*D(A,Z,O){yield il.IsObjectLike(O),ye(A.minProperties)&&(yield`Object.getOwnPropertyNames(${O}).length >= ${A.minProperties}`),ye(A.maxProperties)&&(yield`Object.getOwnPropertyNames(${O}).length <= ${A.maxProperties}`);let Q=Object.getOwnPropertyNames(A.properties);for(let X of Q){let Y=oy.Encode(O,X),K=A.properties[X];if(A.required&&A.required.includes(X))yield*he(K,Z,Y),(Ka(K)||r(K))&&(yield`('${X}' in ${O})`);else{let ae=Ce(K,Z,Y);yield il.IsExactOptionalProperty(O,X,ae)}}if(A.additionalProperties===!1)if(A.required&&A.required.length===Q.length)yield`Object.getOwnPropertyNames(${O}).length === ${Q.length}`;else{let X=`[${Q.map(Y=>`'${Y}'`).join(", ")}]`;yield`Object.getOwnPropertyNames(${O}).every(key => ${X}.includes(key))`}if(typeof A.additionalProperties=="object"){let X=Ce(A.additionalProperties,Z,`${O}[key]`),Y=`[${Q.map(K=>`'${K}'`).join(", ")}]`;yield`(Object.getOwnPropertyNames(${O}).every(key => ${Y}.includes(key) || ${X}))`}}function*w(A,Z,O){yield`(typeof value === 'object' && typeof ${O}.then === 'function')`}function*S(A,Z,O){yield il.IsRecordLike(O),ye(A.minProperties)&&(yield`Object.getOwnPropertyNames(${O}).length >= ${A.minProperties}`),ye(A.maxProperties)&&(yield`Object.getOwnPropertyNames(${O}).length <= ${A.maxProperties}`);let[Q,X]=Object.entries(A.patternProperties)[0],Y=Re(`${new RegExp(Q)}`),K=Ce(X,Z,"value"),ae=Ze(A.additionalProperties)?Ce(A.additionalProperties,Z,O):A.additionalProperties===!1?"false":"true",$e=`(${Y}.test(key) ? ${K} : ${ae})`;yield`(Object.entries(${O}).every(([key, value]) => ${$e}))`}function*F(A,Z,O){let Q=Qe(A,Z);if(ne.functions.has(A.$ref))return yield`${xe(A.$ref)}(${O})`;yield*he(Q,Z,O)}function*P(A,Z,O){let Q=Re(`${new RegExp(A.source,A.flags)};`);yield`(typeof ${O} === 'string')`,ye(A.maxLength)&&(yield`${O}.length <= ${A.maxLength}`),ye(A.minLength)&&(yield`${O}.length >= ${A.minLength}`),yield`${Q}.test(${O})`}function*L(A,Z,O){yield`(typeof ${O} === 'string')`,ye(A.maxLength)&&(yield`${O}.length <= ${A.maxLength}`),ye(A.minLength)&&(yield`${O}.length >= ${A.minLength}`),A.pattern!==void 0&&(yield`${Re(`${new RegExp(A.pattern)};`)}.test(${O})`),A.format!==void 0&&(yield`format('${A.format}', ${O})`)}function*N(A,Z,O){yield`(typeof ${O} === 'symbol')`}function*$(A,Z,O){yield`(typeof ${O} === 'string')`,yield`${Re(`${new RegExp(A.pattern)};`)}.test(${O})`}function*W(A,Z,O){yield`${xe(A.$ref)}(${O})`}function*V(A,Z,O){if(yield`Array.isArray(${O})`,A.items===void 0)return yield`${O}.length === 0`;yield`(${O}.length === ${A.maxItems})`;for(let Q=0;Q<A.items.length;Q++)yield`${Ce(A.items[Q],Z,`${O}[${Q}]`)}`}function*q(A,Z,O){yield`${O} === undefined`}function*se(A,Z,O){yield`(${A.anyOf.map(X=>Ce(X,Z,O)).join(" || ")})`}function*ue(A,Z,O){yield`${O} instanceof Uint8Array`,ye(A.maxByteLength)&&(yield`(${O}.length <= ${A.maxByteLength})`),ye(A.minByteLength)&&(yield`(${O}.length >= ${A.minByteLength})`)}function*ce(A,Z,O){yield"true"}function*de(A,Z,O){yield il.IsVoidLike(O)}function*Ee(A,Z,O){let Q=ne.instances.size;ne.instances.set(Q,A),yield`kind('${A[j]}', ${Q}, ${O})`}function*he(A,Z,O,Q=!0){let X=He(A.$id)?[...Z,A]:Z,Y=A;if(Q&&He(A.$id)){let K=xe(A.$id);if(ne.functions.has(K))return yield`${K}(${O})`;{let ae=we(K,A,Z,"value",!1);return ne.functions.set(K,ae),yield`${K}(${O})`}}switch(Y[j]){case"Any":return yield*t(Y,X,O);case"Array":return yield*n(Y,X,O);case"AsyncIterator":return yield*o(Y,X,O);case"BigInt":return yield*i(Y,X,O);case"Boolean":return yield*s(Y,X,O);case"Constructor":return yield*u(Y,X,O);case"Date":return yield*l(Y,X,O);case"Function":return yield*c(Y,X,O);case"Integer":return yield*d(Y,X,O);case"Intersect":return yield*f(Y,X,O);case"Iterator":return yield*h(Y,X,O);case"Literal":return yield*b(Y,X,O);case"Never":return yield*I(Y,X,O);case"Not":return yield*E(Y,X,O);case"Null":return yield*v(Y,X,O);case"Number":return yield*x(Y,X,O);case"Object":return yield*D(Y,X,O);case"Promise":return yield*w(Y,X,O);case"Record":return yield*S(Y,X,O);case"Ref":return yield*F(Y,X,O);case"RegExp":return yield*P(Y,X,O);case"String":return yield*L(Y,X,O);case"Symbol":return yield*N(Y,X,O);case"TemplateLiteral":return yield*$(Y,X,O);case"This":return yield*W(Y,X,O);case"Tuple":return yield*V(Y,X,O);case"Undefined":return yield*q(Y,X,O);case"Union":return yield*se(Y,X,O);case"Uint8Array":return yield*ue(Y,X,O);case"Unknown":return yield*ce(Y,X,O);case"Void":return yield*de(Y,X,O);default:if(!Ar.Has(Y[j]))throw new Yv(A);return yield*Ee(Y,X,O)}}let ne={language:"javascript",functions:new Map,variables:new Map,instances:new Map};function Ce(A,Z,O,Q=!0){return`(${[...he(A,Z,O,Q)].join(" && ")})`}function xe(A){return`check_${Xv.Encode(A)}`}function Re(A){let Z=`local_${ne.variables.size}`;return ne.variables.set(Z,`const ${Z} = ${A}`),Z}function we(A,Z,O,Q,X=!0){let[Y,K]=[`
2
2
  `,ir=>"".padStart(ir," ")],ae=Ve("value","any"),$e=me("boolean"),Rt=[...he(Z,O,Q,X)].map(ir=>`${K(4)}${ir}`).join(` &&${Y}`);return`function ${A}(${ae})${$e} {${Y}${K(2)}return (${Y}${Rt}${Y}${K(2)})
3
3
  }`}function Ve(A,Z){let O=ne.language==="typescript"?`: ${Z}`:"";return`${A}${O}`}function me(A){return ne.language==="typescript"?`: ${A}`:""}function at(A,Z,O){let Q=we("check",A,Z,"value"),X=Ve("value","any"),Y=me("boolean"),K=[...ne.functions.values()],ae=[...ne.variables.values()],$e=He(A.$id)?`return function check(${X})${Y} {
4
4
  return ${xe(A.$id)}(value)
@@ -9,7 +9,7 @@ import{$ as M6,$a as K6,A as b6,Aa as N6,Ab as Vs,B as Gu,Ba as $6,Bb as Gh,C as
9
9
  Pos: ${n.position?.toArray().join(", ")}`,"#fdffb6")}),this.on("hover",n=>{this.queueDebugMessage(`HOVER
10
10
  3D: ${n.entity3D?.id}
11
11
  2D: ${n.entity2D?.id}
12
- Pos: ${n.position?.toArray().join(", ")}`,"#caffbf")})}get _state(){return this.state}queueDebugMessage(t,n){let o=document.createElement("pre");o.style.maxWidth="300px",o.style.transition="opacity 500ms cubic-bezier(0.4, 0, 0.2, 1)",o.style.backgroundColor=n,o.textContent=t,this.debugPanel?.prepend(o),setTimeout(()=>{o.style.opacity="0",setTimeout(()=>{o.remove()},500)},2500)}getCursor(){return this.cursor}};Ed=new WeakMap;function tM(e,r,t){let n=e.components[2];n&&n.hover!==!0&&(n.hover=r?"user-interaction":!1,n.dirty=!0);let o=e.components[0].textMesh?.userData.entityId;if(!o)return;let i=t.geometry3DMap.get(o);i?.type==="text3d"&&(i.components[1].hoverByPolygon=r,i.components[1].dirty=!0)}function Uz(e,r,t){return r?"grabbing":e?"pointer":t?"grabbing":"grab"}function Gz(e){let r=e;for(;r?.parent;){if(r instanceof Gs)return;if(r.userData.isSingleModel)return r;r=r.parent}}function zz(e,r){let t=Gz(e);return t?r.get(t.userData.entityId):void 0}p();p();var jl,ba,p1,xu,rM,$f,d1,nM,oM,jf,m1,Uf,Gf,f1,Nf=class{constructor(r){C(this,xu);C(this,jl,null);C(this,ba);m(this,"getCurrentSceneGLTF",async r=>{let t={onlyVisible:!0,binary:!0,light:!0,scale:1,...r},n=await z(this,xu,rM).call(this),o=a(this,p1).call(this,t),i=await n.parseAsync(o,{trs:!1,maxTextureSize:1/0,onlyVisible:t.onlyVisible,binary:t.binary,scale:t.scale}),s;if(i instanceof ArrayBuffer)s=new Blob([i],{type:"application/octet-stream"});else{let u=JSON.stringify(i,null,2);s=new Blob([u],{type:"text/plain"})}return s});C(this,p1,r=>{let{scale:t,light:n,onlyVisible:o}=r,i=new Gs,s=new dr().setFromObject(a(this,ba).entityScene);if(a(this,$f).call(this,a(this,ba).entityScene,i,o),n){let u=new Ah(16777215,.3*Math.PI);u.position.set(0,Math.max(s.max.x,s.max.y)*t*.5,s.max.y*t*4),u.lookAt(0,0,-1),u.target.position.set(0,0,-1),u.add(u.target),i.add(u)}return i});C(this,$f,(r,t,n)=>{r.material&&(r instanceof wh?z(this,xu,nM).call(this,r).forEach(o=>t.add(o)):r instanceof am&&t.add(z(this,xu,oM).call(this,r))),r.children.forEach(o=>{(!n||o.visible)&&a(this,$f).call(this,o,t,n)})});C(this,d1,(r,t,n)=>{let o=new sm({color:new ar(r),metalness:0});return o.opacity=t,o.transparent=n,o});C(this,jf,r=>{let{geometry:t,material:n,position:o,rotation:i,quaternion:s,scale:u}=r;if(!t?.isBufferGeometry)return r;let l=t.attributes.position,c=t.attributes.normal,d=t.attributes.uv;return a(this,m1).call(this,l,c),a(this,Gf).call(this,o,u,i,s),d&&a(this,f1).call(this,d),n?.map&&t.type==="PlaneGeometry"&&(r.side=ka),r});C(this,m1,(r,t)=>{let n=new ie,o=new ie;for(let i=0;i<r.count;i++)n.fromBufferAttribute(r,i),a(this,Uf).call(this,n),r.setXYZ(i,n.x,n.y,n.z),t&&(o.fromBufferAttribute(t,i),a(this,Uf).call(this,o),t.setXYZ(i,o.x,o.y,o.z))});C(this,Uf,r=>{let t=r.y;r.y=r.z,r.z=-t});C(this,Gf,(r,t,n,o)=>{let i=r.y;r.y=r.z,r.z=-i;let s=t.y;if(t.y=t.z,t.z=s,n instanceof bc)n.order="YXZ",n.set(n.x,n.y,n.z,n.order);else{let u=o.y;o.set(o.x,o.z,-u,o.w)}});C(this,f1,r=>{for(let t=0;t<r.count;t++){let n=r.getX(t),o=r.getY(t);r.setXY(t,n,o)}});T(this,ba,r),a(this,ba).entityScene=r.entityScene,a(this,ba).geometry3DMap=r.geometry3DMap}destroy(){T(this,jl,null)}};jl=new WeakMap,ba=new WeakMap,p1=new WeakMap,xu=new WeakSet,rM=async function(){if(!a(this,jl)){let{GLTFExporter:r}=await import("./GLTFExporter-AEIYURV6.js");T(this,jl,new r)}return a(this,jl)},$f=new WeakMap,d1=new WeakMap,nM=function(r){let t=[],o=(r.userData?.entities?Object.values(r.userData?.entities):[]).map(s=>a(this,ba).geometry3DMap.get(s)),i=new Map;return o.forEach(s=>{if(!s||!(s instanceof ft))return;let u=s.components[1],l=s.components[2];if(!u.visible||u instanceof Wi&&u.opacity===0||u instanceof hm||u instanceof $h)return;let d=`${l?.hover?u.hoverColor||a(this,ba).hoverColor:u.color}-${u.opacity}-${Number(u.visible)}`;i.has(d)||i.set(d,[]),i.get(d)?.push(s)}),i.forEach((s,u)=>{let[l,c,d]=u.split("-"),f=s.reduce((E,v)=>{if(v.type==="custom-geometry")return E;let x=v.components[0];return"geometry"in x&&x.geometry instanceof Sh&&E.push(x.geometry),E},[]),h=a(this,d1).call(this,l,Number(c),r.material.transparent),b=bo(f,!0),I=new Pe(b,h);I.position.copy(r.position),I.rotation.copy(r.rotation),I.scale.copy(r.scale),I.visible=!!d,a(this,Gf).call(this,I.position,I.scale,I.rotation,I.quaternion),t.push(a(this,jf).call(this,I))}),t},oM=function(r){let t=r.geometry.clone(),n=r.material,o=new gr({color:n.color,side:ka});o.opacity=n.opacity,o.transparent=n.transparent;let i=new am(t,o);return i.position.copy(r.position),i.rotation.copy(r.rotation),i.scale.copy(r.scale),i.visible=r.visible,a(this,jf).call(this,i)},jf=new WeakMap,m1=new WeakMap,Uf=new WeakMap,Gf=new WeakMap,f1=new WeakMap;p();p();var Vz="gray",Hz=.1,zf=100,m2=new Zi.ClipperOffset;function Zz(e,r){m2.Clear(),r/=2;let t=e.map(o=>({X:o.x*zf,Y:o.y*zf}));m2.AddPath(t,Zi.JoinType.jtMiter,Zi.EndType.etClosedPolygon);let n=new Zi.Paths;return m2.Execute(n,r*zf),n.length?n.map(i=>i.map(s=>({x:s.X/zf,y:s.Y/zf}))):[e]}function g1(e,r,t){let{color:n=Vz,opacity:o=1,altitude:i=0,height:s=Hz}=t||{};Array.isArray(o)&&(o=1);let u={min:{x:1/0,y:1/0,z:i},max:{x:-1/0,y:-1/0,z:s+i},center:{x:0,y:0,z:(s+i)/2}},c=e.geometry.coordinates[0].map(b=>{let I=r(b[1],b[0]);return u.min.x=Math.min(u.min.x,I.x),u.min.y=Math.min(u.min.y,I.y),u.max.x=Math.max(u.max.x,I.x),u.max.y=Math.max(u.max.y,I.y),I});e.properties?.style?.edgeOffset!=null&&e.properties.style.edgeOffset!==0||e.properties?.image!=null?c=Zz(c,e.properties?.style?.edgeOffset||0):c=[c];let d=[];for(let b of c){let I=new xc;I.moveTo(b[0].x,b[0].y),b.slice(1).forEach(D=>I.lineTo(D.x,D.y)),I.lineTo(b[0].x,b[0].y);let E=e.geometry.coordinates.slice(1);I.holes=E.map(D=>{let w=D.map(F=>r(F[1],F[0])),S=new vc;return S.moveTo(w[0].x,w[0].y),w.slice(1).forEach(F=>S.lineTo(F.x,F.y)),S.lineTo(w[0].x,w[0].y),S});let v=mm(t?.bevel,s),x=new Ic(I,v);x.userData={style:{color:n,opacity:o},usedBevelSettings:v},d.push(x)}if(d.length===1)return d[0];let f=bo(d);d.forEach(b=>b.dispose());let h=mm(t?.bevel,s);return f.userData={style:{color:n,opacity:o},usedBevelSettings:h,_split:!0},f}p();var Wz="gray",Xz=.1;function y1(e,r,t){let{color:n=Wz,opacity:o=1,altitude:i=0,height:s=Xz}=t||{};Array.isArray(o)&&(o=1);let u={min:{x:1/0,y:1/0,z:i},max:{x:-1/0,y:-1/0,z:s+i}},l=mm(t?.bevel,s),c=[];e.geometry.coordinates.forEach(f=>{let h=new xc,b=f[0].map(v=>{let x=r(v[1],v[0]);return u.min.x=Math.min(u.min.x,x.x),u.min.y=Math.min(u.min.y,x.y),u.max.x=Math.max(u.max.x,x.x),u.max.y=Math.max(u.max.y,x.y),x});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 I=f.slice(1);h.holes=I.map(v=>{let x=v.map(w=>r(w[1],w[0])),D=new vc;return D.moveTo(x[0].x,x[0].y),x.slice(1).forEach(w=>D.lineTo(w.x,w.y)),D.lineTo(x[0].x,x[0].y),D});let E=new Ic(h,l);c.push(E)});let d=bo(c);return c.forEach(f=>f.dispose()),d.translate(0,0,i||0),d.userData={style:{color:n,opacity:o},usedBevelSettings:l},d}p();var In=100,Jz=.22,Yz=.01;function iM(e,r,t={}){let{width:n=Jz,height:o=Yz,color:i="gray",opacity:s=1,altitude:u=0}=t,l={min:{x:1/0,y:1/0,z:u},max:{x:-1/0,y:-1/0,z:u+o}},c={bevelEnabled:!1,depth:o},d=new Zi.ClipperOffset,f=e.geometry.coordinates.map(E=>E.map(v=>r(v[1],v[0])));d.AddPaths(f.map(E=>E.map(v=>({X:v.x*In,Y:v.y*In}))),Zi.JoinType.jsMiter,Zi.EndType.etOpenRound);let h=new Zi.PolyTree;d.Execute(h,n/2*In);let b=[];for(let E of h.m_AllPolys){let v=new xc;if(E.IsHole())continue;l.min.x=Math.min(l.min.x,E.m_polygon[0].X),l.min.y=Math.min(l.min.y,E.m_polygon[0].Y),l.max.x=Math.max(l.max.x,E.m_polygon[0].X),l.max.y=Math.max(l.max.y,E.m_polygon[0].Y);let x=E.m_polygon;v.moveTo(x[0].X/In,x[0].Y/In),x.slice(1).forEach(D=>v.lineTo(D.X/In,D.Y/In)),v.lineTo(x[0].X/In,x[0].Y/In),v.holes=E.m_Childs.map(D=>{let w=new vc,S=D.m_polygon;return w.moveTo(S[0].X/In,S[0].Y/In),S.slice(1).forEach(F=>w.lineTo(F.X/In,F.Y/In)),w.lineTo(S[0].X/In,S[0].Y/In),w}),b.push(new Ic(v,c))}let I=bo(b);return I.translate(0,0,u||0),I.userData={style:{color:i,opacity:s}},d.Clear(),I}p();p();import{z as b1}from"zod";var Cd=b1.object({type:b1.enum(["Point"]),coordinates:b1.array(b1.number()).min(2).max(3)});import{z as At}from"zod";var f2=At.object({rotation:At.array(At.number()).length(3).optional(),altitude:At.number().optional(),scale:At.array(At.number()).length(3).optional(),interactive:At.boolean().optional(),verticalOffset:At.number().optional(),id:At.union([At.number(),At.string()]).optional()}),Kz=At.object({type:At.enum(["Feature"]),geometry:Cd,properties:f2}),qz=At.object({type:At.enum(["FeatureCollection"]),features:At.array(Kz)}),h2=At.object({color:At.string()}),Qz=At.object({url:At.string(),color:At.string().optional(),opacity:At.number().optional(),material:At.record(At.string(),h2).optional()});function sM(e,r,t){At.union([At.number(),At.string()]).parse(e),qz.parse(r),Qz.parse(t)}var Vf,Hf,Zf,Sd,xi,Iu=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);C(this,Vf,!0);m(this,"color",new ar);m(this,"clippingPlane");m(this,"position",new ie);C(this,Hf,0);C(this,Zf,1);C(this,Sd,yo.GEOMETRY);C(this,xi,!1);this.feature=r}get visible(){return this.mesh?.visible??a(this,Vf)}set visible(r){T(this,Vf,r),this.mesh&&(this.mesh.visible=r)}setOpacity(){}setColor(){}get altitude(){return a(this,Hf)}set altitude(r){this.mesh&&(this.mesh.position.z=r,T(this,Hf,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(Je.degToRad(r[0]),Je.degToRad(r[1]),Je.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 a(this,Zf)}set opacity(r){if(this.mesh){if(this.mesh.children[0]instanceof ji){for(let t of this.mesh.children)if(t instanceof ji){t.userData?.originalOpacity===void 0&&(t.userData.originalOpacity=t.material.opacity);let n=Gu(r,0,t.userData?.originalOpacity,0,1);t.material.opacity=n,t.material.transparent=n<1,t.material.needsUpdate=!0}}else this.mesh?.traverse(t=>{t instanceof Pe&&t.material&&(Array.isArray(t.material)?t.material.forEach(n=>{aM(n,r)}):aM(t.material,r))});T(this,Zf,r)}}get renderOrder(){return a(this,Sd)}set renderOrder(r){if(!(!this.mesh||r===a(this,Sd)))if(T(this,Sd,r),this.mesh.children[0]instanceof ji){this.mesh.renderOrder=r;for(let t of this.mesh.children)t instanceof ji&&(t.material.depthWrite=!a(this,xi),t.material.depthTest=!a(this,xi),t.material.needsUpdate=!0)}else this.mesh?.traverse(t=>{t instanceof Pe&&t.material&&(t.renderOrder=r,Array.isArray(t.material)?t.material.forEach(n=>{n.depthWrite=!a(this,xi),n.depthTest=!a(this,xi),n.needsUpdate=!0}):(t.material.depthWrite=!a(this,xi),t.material.depthTest=!a(this,xi),t.material.needsUpdate=!0))})}get visibleThroughGeometry(){return a(this,xi)}set visibleThroughGeometry(r){T(this,xi,r)}};Vf=new WeakMap,Hf=new WeakMap,Zf=new WeakMap,Sd=new WeakMap,xi=new WeakMap;function aM(e,r){e.opacity!==r&&(r===1?(e.opacity=1,e.transparent=!1):(e.opacity=r,e.transparent=!0),e.needsUpdate=!0)}p();function v1(e){let r=e.components[0],t=e.components[1];t.opacity!=null&&t.opacity!==r.opacity&&(r.opacity=t.opacity);let n=t.material,o=t.color;if(n||o){let u=eV(o,n);r.mesh?.traverse(l=>{l instanceof Pe&&l.material&&(Array.isArray(l.material)?l.material.forEach(c=>{u[c.name]?(c.color.set(u[c.name].color),c.vertexColors=!1):c.color.set(o)}):u[l.material.name]?(l.material.color.set(u[l.material.name].color),l.material.vertexColors=!1):l.material.color.set(o))})}let i=r.feature.geometry.coordinates[2]??0,s=t.verticalOffset+i;r.altitude!==s&&(r.altitude=s),t.visible!==r.visible&&(r.visible=t.visible),t.rotation&&r.setRotation(t.rotation),t.scale&&r.setScale(t.scale),t.visibleThroughGeometry!==r.visibleThroughGeometry&&(r.visibleThroughGeometry=t.visibleThroughGeometry)}function eV(e,r){let t={};if(r)for(let n in r)r[n].color&&(t[n]={color:r[n].color});if(e){let n=["Default","Fabric","Mpdn_Logo","CouchLogo"];for(let o of n)t[o]||(t[o]={color:e})}return t}function uM(e,r){let t=e.components[0],o=e.components[1].verticalOffset??0,i=t.feature.geometry.coordinates.slice();i[2]=(i[2]??0)+o,t.mesh?t.mesh.position.copy(r(i)):t.position.copy(r(i))}function vs(e){return e instanceof sr?e.material:null}function lM(e){return e.side===om?"back":e.side===$u?"front":"double"}function cM(e,r){e.side=r==="back"?om:r==="front"?$u:ka}function tV(e){let{color:r,opacity:t,topColor:n,texture:o,topTexture:i}=e;return`${r}${t}${n||""}${o||""}${i||""}`}var x1=class extends Oe{constructor(t,n){super();m(this,"state");m(this,"convertTo3DMapPosition");m(this,"loader");m(this,"optimizePromise",[]);this.state=t,this.convertTo3DMapPosition=n}async getGLTFLoader(){if(this.loader)return this.loader;let{GLTFLoader:t}=await import("./GLTFLoader-YNJUYSBY.js");return this.loader=new t,this.loader}createEntityFromFeature(t,n,o){let i=new sr(n),s=n?.properties?.bevel,u=o&&"bevel"in o?o.bevel:void 0,l;u?l={...s,...u}:s&&(l=s);let c=new ft(i,new Wi({...o,url:n.properties?.image?.path,bevel:l}));return o?.outline&&(c.components[3]=new eE(nE(o.color))),o?.focusable&&(c.components[4]=new gm),n.properties?.textures!=null&&Array.isArray(n.properties.textures)&&n.properties.textures.length>0?c.components[6]=new Vu(n.properties.textures.find(d=>d.face==="side"),n.properties.textures.find(d=>d.face==="top")):(o!=null&&"texture"in o&&o.texture!=null||o!=null&&"topTexture"in o&&o.topTexture!=null)&&(c.components[6]=new Vu(o.texture,o.topTexture)),c.id=t,c}createModelFromFeature(t,n,o){let i=new Iu(n),s={...o};n.properties.verticalOffset!=null&&(s.verticalOffset=n.properties.verticalOffset),n.properties.rotation!=null&&(s.rotation=n.properties.rotation),n.properties.scale!=null&&(s.scale=n.properties.scale);let u=new $h(s),l=new ft(i,u);return l.id=t,l}populateEntityMesh(t,n){let o=t.components[0];o.geometry=n,o.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:n.attributes.position.count},o.currentHeight=t.components[1].height,o.dirty=!1}async populateModelGroup(t,n,o){let i=new Wn,s=new bc,u=new Ch,l=new ie,c=new zs,d=await this.getGLTFLoader(),f=new Promise(h=>{let b=E=>{"entities3D"in o.userData&&(o.userData.entities3D.size>1?E.scene.traverse(v=>{let x=v;if("isMesh"in x&&x.isMesh===!0){let D=new ji(x.geometry,x.material,t.size);D.userData={entities:{}},c.add(D),o.add(c)}}):(E.scene.traverse(v=>{"isMesh"in v&&v.isMesh===!0&&(v.position.set(0,0,0),v.rotation.set(0,0,0),v.scale.set(1,1,1),v.updateMatrix())}),c.add(E.scene),o.add(c),c.userData.isSingleModel=!0,c.userData.entityId=t.values().next().value,c.userData.type="model")),h()};if(n.trimStart().startsWith("{")||n.startsWith("data:")&&n.includes("application/json")){let E=n.startsWith("data:")?atob(n.split(",")[1]):n;d.parse(E,"",b)}else d.load(n,b)});return this.optimizePromise.push(f.then(()=>{let h=0,b;for(let I of t.values()){if(b=this.state.geometry3DMap.get(I),!b||b?.type!=="model")continue;let E=b.components[0],v=b.components[1],x=b.components[0].feature;E.mesh=c,E.instanceIndex=h,v1(b),b.components[1].dirty=!1;let{x:D,y:w}=this.convertTo3DMapPosition(x.geometry.coordinates[1],x.geometry.coordinates[0],0);E.position.set(D,w,E.altitude),s.set(Je.degToRad(v.rotation?.[0]??Ac[0]),Je.degToRad(v.rotation?.[1]??Ac[1]),Je.degToRad(v.rotation?.[2]??Ac[2])),l.set(v.scale?.[0]??Mc[0],v.scale?.[1]??Mc[1],v.scale?.[2]??Mc[2]),u.setFromEuler(s),i.compose(E.position,u,l),c.children.forEach(S=>{!b||b?.type!=="model"||!(S instanceof ji)||(S.setMatrixAt(h,i),S.userData.entities[h]=b.id)}),E.mesh.userData.isSingleModel&&(E.mesh.matrix.copy(i),E.mesh.matrix.decompose(E.mesh.position,E.mesh.quaternion,E.mesh.scale)),h++}this.publish("model-loaded")})),c}populateEntityGroup(t){let n,o,i,s;for(let u of t.values())s=this.state.geometry3DMap.get(u),s.components[0]instanceof sr&&(o=s.components[0].feature,i=s.components[1],o.geometry.type==="Polygon"?(n=g1(o,this.convertTo3DMapPosition,i),o.properties?.textures&&o.properties.textures.length>0&&oE(n,o.properties.textures,this.state.naturalBearing,this.convertTo3DMapPosition),this.populateEntityMesh(s,n)):o.geometry.type==="MultiPolygon"?(n=y1(o,this.convertTo3DMapPosition,i),this.populateEntityMesh(s,n)):o.geometry.type==="LineString"?(n=DE(o,this.convertTo3DMapPosition,i),this.populateEntityMesh(s,n)):o.geometry.type==="MultiLineString"&&(n=iM(o,this.convertTo3DMapPosition,i),this.populateEntityMesh(s,n)));return t}update(){for(let t of this.state.geometryGroupIdsToLoad.values()){let n=this.state.geometry3DMap.get(t);if(n instanceof ei&&n.userData.dirty){if(n.userData.modelURL)n.userData.modelURL&&(this.populateModelGroup(n.userData.entities3D,n.userData.modelURL,n),n.userData.dirty=!1);else try{this.populateEntityGroup(n.userData.entities3D)}catch(s){R.warn(s)}let o,i={};for(let s of n.userData.entities3D.values()){o=this.state.geometry3DMap.get(s);let u=o?.components[0];if(o?.type==="geometry"){let l=o.components[1],c=tV(l);i[c]===void 0&&(i[c]={style:l,entities:[]}),i[c].entities.push(o)}else u&&"mesh"in u&&u.mesh&&u.mesh?.parent!==n&&n.add(u.mesh)}for(let s in i){let u=rE(i[s].entities,i[s].style);n.add(u)}for(let s of n.userData.entities3D.values())if(o=this.state.geometry3DMap.get(s),o!=null&&o.entities2D.size>0)for(let u of o.entities2D.values())u&&(o.attach(u),this.publish("geometry-2d-added"));this.publish("geometry-group-added"),n.userData.dirty=!1}}return Promise.resolve()}};p();var I1=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 n=r.components[0];(!n.enabled||!n.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 n=r.components[0];n instanceof Na&&n.enabled&&n.markerContainer&&!this.domTree.contains(n.markerContainer)&&(n.markerContainer.userData={entityId:r.id},this.domTree.appendChild(n.markerContainer),n.updateDimensions())}this.dirty=!1}}};p();var E1=class{constructor(r,t){m(this,"state");m(this,"project");this.state=r,this.project=t}update(){let r,t=0,n=0,o,i;for(let s of this.state.geometry2DIdsInScene)if(r=this.state.geometry2DMap.get(s),r){i=r.components[0];let u=r.attachedTo?this.state.geometry3DMap.get(r.attachedTo):void 0;if(u instanceof ft)if(this.state.geometry3DIdsInScene.has(u.id)){o=u.components[1],i=r.components[0],(o.dirty||r.components[0].attachedDirty)&&(t=o.height,n=o.altitude,r.setAltitude(t+n));let l=o.visible;i.visible!==l&&(i.visible=l)}else i.visible===!0&&(i.visible=!1);this.project(r.components[0].projection,r.position),r.components[0].attachedDirty=!1}}};p();p();p();var rV=function(){let r,t;return n=>{if((!t||!t)&&(r=document.createElement("canvas"),r.width=500*n,r.height=500*n,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}}}(),pM=({text:e,size:r,maxWidth:t,pixelRatio:n,maxLines:o=2,lineHeight:i=1.2,options:s={strokeText:!0}})=>{let u=`bold ${r*n}px 'InterUI-Regular', Helvetica Neue, Arial, sans-serif`,{measureCanvasContext:l}=rV(n);l.font=u;let c=[],d=e.split(" "),f=0,h=0,b=0;for(;h<d.length;){let x=d[h];if(f===o&&f>0){c[f-1]+="...";break}if(c[f]==null&&(c[f]=x,h++),d.length===1){c[f]=x;break}if(d[h]==null)break;let{width:D}=l.measureText(c[f]+" "+d[h]);D<=t*n?(c[f]+=" "+d[h],h++):f++}c.forEach(x=>{let{width:D}=l.measureText(x);b=Math.max(D,b)});let I=r*n*i,E=c.length*I;return{maxWidth:b,maxHeight:E,lines:c.length,draw:(x,D,w)=>{c.length===1?(s.strokeText&&x.strokeText(c[0],D,w),x.fillText(c[0],D,w)):(s.strokeText&&(x.strokeText(c[0],D,w-I/2),x.strokeText(c[1],D,w+I/2)),x.fillText(c[0],D,w-I/2),x.fillText(c[1],D,w+I/2))}}};p();function dM(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 C1=class extends Oe{constructor(t,n,o){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 n=this.state.pixelRatio;this.colliderContext.clearRect(0,0,this.colliderCanvas.width,this.colliderCanvas.height);let o,i,s,u,l,c,d;for(let f of this.state.geometry2DIdsInScene)if(d=this.state.geometry2DMap.get(f),d!=null&&(c=d.components[0],c instanceof Ra&&!d.disposed)){if(l=c.appearance.iconVisible,c.appearance.icon!=null&&l!=null){let b=typeof l=="boolean"?l:t>=l;b!==c.iconVisible&&(c.iconVisible=b,c.dirty=!0)}if((c.dirty||this.dirty)&&c.calculatePinSize(),i={active:c.appearance.pinColor,inactive:c.appearance.pinColorInactive},s={active:c.appearance.pinOutlineColor,inactive:c.appearance.pinOutlineColorInactive},u=zi(c.pinSize,2),o=`${i.active}-${i.inactive}-${s.active}-${s.inactive}-${u}-${c.iconVisible}`,c.labelCacheId=o,(!this.pinCache[o]||this.dirty)&&(this.prepare(c,o,this.colliderContext),c.dirty=!0),(c.appearance.icon&&(!c.imageHash||c.pinDirty)||this.dirty)&&this.cacheImage(c),this.textCache[c.id]==null||c.textDirty||this.dirty){c.dirty=!0,this.textCache[c.id]={};let{textDrawFn:b,width:I,height:E}=this.processText(c.text,c.appearance.textSize,c.appearance.maxWidth,c.appearance.maxLines,c.appearance.lineHeight);["left","center","right"].forEach(v=>{this.textCache[c.id][v]=this.textToCanvas(b,c.appearance.textSize,v,I,E,c.appearance.textColor,c.appearance.textOutlineColor)}),c.dimensions={width:Math.ceil(I/n),height:Math.ceil(E/n)}}let h=1;if(c.appearance.iconScale)if(typeof c.appearance.iconScale=="number")h=c.appearance.iconScale;else{let{on:b,input:I,output:E,easing:v}=c.appearance.iconScale;b==="zoom-level"?h=x6(t,I,E,v??"linear"):R.warn(`Unsupported interpolation property: ${b}`)}c.recomputeCurrentStrategy(c.iconVisible?h:1),c.canShow&&c.visible&&(c.enabled||c.visibilityNeedsUpdate!==!1)&&this.draw(c,o,this.colliderContext),c.textDirty=!1,c.pinDirty=!1}this.dirty=!1});m(this,"processText",(t,n,o,i,s)=>{let u=this.state.pixelRatio,{draw:l,maxWidth:c,maxHeight:d}=pM({text:t,size:n,pixelRatio:u,maxWidth:o,maxLines:i,lineHeight:s});return{textDrawFn:l,width:c+2.5*u*2,height:d+2.5*u*2}});m(this,"textToCanvas",(t,n,o,i,s,u,l)=>{let c=this.state.pixelRatio,d,f=i,h=s;window.OffscreenCanvas!=null&&!N6()?d=new OffscreenCanvas(f,h):(d=document.createElement("canvas"),d.width=f,d.height=h,d.style.width=f+"px",d.style.height=h+"px");let b=d.getContext("2d",{willReadFrequently:!0});if(!b)return;let I=2.5*c;b.textAlign=o,b.font=`bold ${n*c}px 'InterUI-Regular', Helvetica Neue, Arial, sans-serif`,b.textBaseline="middle",b.lineJoin="miter",b.miterLimit=2,b.strokeStyle="white",b.lineWidth=I,b.fillStyle=u,b.strokeStyle=l;let E=o==="left"?I/2:o==="center"?f/2:f-I/2;return t(b,E,(h+I/2)/2),d});m(this,"cacheImage",t=>{if(!t.appearance.icon)return;let n=V6(t.appearance.icon);this.imagePromiseCache[n]||(this.imagePromiseCache[n]=new Promise(o=>{this.transformRequest(t.appearance.icon).then(i=>{let s=dM(i.url);s.onload=()=>{this.imageCache[n]=s,this.publish("img:loaded"),o(s)}})})),t.imageHash!==n&&(t.imageHash=n,this.imagePromiseCache[n].then(()=>{t.dirty=!0}))});m(this,"createPinCanvas",(t,n,o,i,s=1)=>{let u,l=this.state.pixelRatio,c=t.totalPinSize*2*l*s;window.OffscreenCanvas!=null?u=new OffscreenCanvas(c,c):(u=document.createElement("canvas"),u.width=c,u.height=c,u.style.width=c/l+"px",u.style.height=c/l+"px");let d=u.getContext("2d");return d.shadowColor="rgba(0,0,0,0.3)",d.shadowOffsetY=2*l,d.shadowBlur=5*l,d.beginPath(),d.arc(c/2,c/2,(n/2+2.5*l/2)*s,0,2*Math.PI),d.fillStyle=o,d.fill(),d.beginPath(),d.arc(c/2,c/2,n/2*s,0,2*Math.PI),d.shadowColor="transparent",d.fillStyle=i,d.fill(),u});m(this,"prepare",(t,n,o)=>{let i=this.state.pixelRatio;o.lineWidth=4*i;let s=typeof t.appearance.iconScale=="number"?[t.appearance.iconScale]:t.appearance.iconScale==null?[]:t.appearance.iconScale.output,u=s.length>0?Math.max(...s):void 0,l=this.createPinCanvas(t,t.pinSize,t.appearance.pinOutlineColor,t.appearance.pinColor,u),c=this.createPinCanvas(t,3.5*i,t.appearance.pinOutlineColorInactive,t.appearance.pinColorInactive,u);this.pinCache[n]=[l,c]});this.state=t,this.colliderCanvas=n,this.colliderContext=n.getContext("2d"),this.transformRequestFunc=o}draw(t,n,o){if(!t.canShow||!t.visible)return;o.save(),o.globalAlpha=t.currentOpacity;let i=this.state.pixelRatio,s=t.projection.x*i,u=t.projection.y*i,l=t.style.pinVisibility===1?this.pinCache[n][0]:this.pinCache[n][1],c=t.style.pinVisibility===1?t.scaledPinSize*i:t.totalPinSize*i;if(t.style.pinVisibility!==0&&o.drawImage(l,s-c,u-c,c*2,c*2),t.appearance.icon&&t.iconVisible&&t.imageHash&&t.appearance.iconSize&&this.imageCache[t.imageHash]&&t.style.pinVisibility===1){let d=this.imageCache[t.imageHash],f=(t.scaledPinSize-t.scaledIconPadding)*i,h=t.appearance.iconFit,b=f,I=f,E=`${t.imageHash}_${h}`;if(this.imageDimensionsCache[E])b=this.imageDimensionsCache[E].width,I=this.imageDimensionsCache[E].height;else{let v=d.width*i,x=d.height*i;if(h==="contain"){let D=Math.sqrt(v**2+x**2),w=f/D;b=v*w,I=x*w}if(h==="cover"){let D=f/v,w=f/x,S=Math.max(D,w);b=v*S,I=x*S}}o.save(),o.beginPath(),o.arc(s,u,f/2,0,2*Math.PI),o.closePath(),t?.appearance?.iconOverflow!=="visible"&&o.clip(),o.drawImage(d,s-b/2,u-I/2,b,I),o.restore()}t.style.textLabelVisible&&t.style.textAlign!=null&&t.style.left!=null&&t.style.top!=null&&o.drawImage(this.textCache[t.id][t.style.textAlign],s+t.style.left*i,u+t.style.top*i),o.restore()}};p();function sV(e,r){let t=e.components[2],n=e.components[1];return t?.hover?[n.hoverColor||r,n.hoverColor||r]:[n.color,n.topColor||n.color]}var S1=class{constructor(r,t){m(this,"state");m(this,"convertTo3DMapPosition");this.convertTo3DMapPosition=t,this.state=r}determineTextureVisiblity(r,t,n){let o=vs(r);(o?.texture!=null||o?.topTexture!=null)&&(n?.hover&&o.texturesVisible?o.hideTextures(r.instanceIndex):o.texturesVisible||o.showTextures(r.instanceIndex),t.texture==null&&o.removeSideTexture(r.instanceIndex),t.topTexture==null&&o.removeTopTexture(r.instanceIndex))}update(){let r,t,n;for(let o of this.state.geometry3DIdsInScene)if(n=this.state.geometry3DMap.get(o),n&&(n.type==="geometry"||n.type==="custom-geometry")&&(n.components[1]?.dirty||n.components[2]?.dirty)){let i=n.components[0],s=n.components[1];t=n.components[2];let u=sV(n,this.state.hoverColor);i.setColor(u[0],u[1]);let l=vs(i);if(s.visible!==i.visible&&(i.visible=s.visible,i instanceof sr&&i.textMesh)){let d=this.state.geometry3DMap.get(i.textMesh.userData.entityId);d?.type==="text3d"&&d.components[0].polygonEntityId!=null&&(d.components[0].visible=s.visible)}s.altitude!==i.altitude&&(i.altitude=s.altitude);let c=s.opacity*wc(n);if(c!==i.opacity&&(i.opacity=c),s.renderOrder!==i.renderOrder&&(i.renderOrder=s.renderOrder),l&&s.side!==lM(l)&&cM(l,s.side),i instanceof sr&&s.shading!=null&&(s.shading?.start!==vs(i)?.getGradientShading().start||s.shading?.end!==vs(i)?.getGradientShading().end||s.shading?.intensity!==vs(i)?.getGradientShading().intensity)&&vs(i)?.setGradientShading(s.shading?.start??0,s.shading?.end??0,s.shading?.intensity??0),s.dirty=!1,i instanceof sr){let d=n.components[6];d instanceof Vu&&this.determineTextureVisiblity(i,d,t)}n.components[2]&&(n.components[2].dirty=!1)}else if(n?.type==="model")n.components[1].dirty&&(v1(n),n.components[1].dirty=!1),n.components[0].positionDirty&&(uM(n,this.convertTo3DMapPosition),n.components[0].positionDirty=!1);else if(n?.type==="image"&&n.components[1]?.dirty){r=n.components[0];let i=n.components[1];i.visible!==r.visible&&(r.visible=i.visible),i.dirty=!1}else if(n?.type==="text3d"&&n.components[1]?.dirty&&n.components[0].polygonEntityId!=null){r=n.components[0];let i=n.components[1];i.visible!=null&&i.visible!==r.visible&&(r.visible=i.visible);let{textMesh:s}=r;if(s){Object.assign(s,i.getState());let u=i.hoverColor??this.state.text3dHoverColor;s.color=i.hoverByPolygon?u:i.color??Fc.color,s.outlineColor=i.hoverByPolygon?u:i.outlineColor??Fc.outlineColor,s.strokeColor=i.hoverByPolygon?u:i.strokeColor??Fc.strokeColor}i.dirty=!1}}};p();var D1=class extends Oe{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,n;for(let o of this.state.geometry2DIdsInScene)t=this.state.geometry2DMap.get(o),t&&(n=t.components[0],n instanceof Ra&&(n.visibilityNeedsUpdate==="show"?(n.canShow=!0,this.animating.set(n,[n.currentOpacity,n.appearance.opacity??1])):n.visibilityNeedsUpdate==="hide"&&this.animating.set(n,[n.currentOpacity,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[n,[o,i]]of this.animating.entries()){let s=i===1?this.showDuration:this.hideDuration,u=(t-this.startTime)/s;n.currentOpacity=Gu(u,0,1,o,i,i===0?y6:b6),t-this.startTime>=s&&(i===1?n.canShow=!0:i===0&&(n.canShow=!1),n.visibilityNeedsUpdate=!1,this.animating.delete(n))}this.publish("draw:2d"),this.animating.size>0&&this.publish("animate:2d")}};p();var T1=class extends Oe{constructor(t,n,o,i,s,u,l){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 n=this.commitRenderState();return this.paint(),n}else return this.frameId?Promise.resolve():new Promise((n,o)=>{this.frameId=requestAnimationFrame(()=>this.renderer?.renderer==null?n():this.mode==="standalone"?this.commitRenderState()?.then(()=>{this.paint(),n()}).catch(i=>{o(i)}):n())})});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(),U6(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(),j6(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 n=this.systems.meshOptimizationSystem.update();n&&t.push(n),this.systems.borderSystem.update(),this.systems.meshModificationSystem.update(),this.systems.meshDetachmentSystem.update(),this.systems.renderOrderSystem.update(),this.systems.clippingPlaneSystem.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 o=this.needs2DRecompute;return this.nextFrame=requestAnimationFrame(()=>{this.systems.collisionSystem.update(this.systems.watermarkSystem.width,this.systems.watermarkSystem.height,this.systems.watermarkSystem.options.position,!o,this.systems.imageSystem.currentImageScreenBBoxes)}),this.systems.textureSystem.update(),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"),this.needs2DRecompute=!1,Promise.all(t)}catch(t){return Promise.reject(t)}});this.renderer=t,this.state=n,this.mode=o,this.scene=i,this.cameraObject=s,this.viewCamera=u,this.systems=l,this.systems.collisionSystem.on("visibility-changed",this.updateEntities2D),this.systems.twoDVisiblitySystem.on("draw:2d",this.drawEntities2D),this.systems.twoDVisiblitySystem.on("animate:2d",this.animate2D),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)}};p();import{z as Kt}from"zod";var uV=Kt.object({interactive:Kt.boolean().optional(),id:Kt.string().optional(),width:Kt.union([Kt.number(),Kt.object({on:Kt.literal("zoom-level").optional(),input:Kt.array(Kt.number()).nonempty(),output:Kt.array(Kt.number()).nonempty(),easing:Kt.string().optional()})]).optional(),accentColor:Kt.string().optional(),displayArrowsOnPath:Kt.boolean().optional(),animateArrowsOnPath:Kt.boolean().optional(),visibleThroughGeometry:Kt.boolean().optional(),dashed:Kt.boolean().optional()}),lV=Kt.object({type:Kt.enum(["Feature"]),geometry:Cd,properties:Kt.object({parentId:Kt.any().optional()})});function mM(e,r){Kt.object({features:Kt.array(lV)}).parse(e),uV.parse(r)}var Wf,Eu=class{constructor(r,t){m(this,"type","path");m(this,"mesh",new zs);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,"highlightStartFraction",0);m(this,"highlightEndFraction",0);m(this,"highlightCompleteFraction",1);m(this,"highlightWidthMultiplier",1.1);m(this,"highlightColor","red");m(this,"dashed",!1);m(this,"isVertical",!1);m(this,"dirty",!0);m(this,"materialDirty",!0);m(this,"position",new ie);C(this,Wf,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 a(this,Wf)}set altitude(r){this.mesh&&(this.mesh.position.z=r,T(this,Wf,r))}set complete(r){this.material&&(this.material.uniforms.complete.value=r,this.material.needsUpdate=!0)}};Wf=new WeakMap;p();p();p();var zo=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-zo.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?zo.Bounce.In(e*2)*.5:zo.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}}}}),Xf=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=[],n=0;n<arguments.length;n++)t[n]=arguments[n];for(var o=0,i=t;o<i.length;o++){var s=i[o];(r=s._group)===null||r===void 0||r.remove(s),s._group=this,this._tweens[s.getId()]=s,this._tweensAddedDuringUpdate[s.getId()]=s}},e.prototype.remove=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];for(var n=0,o=r;n<o.length;n++){var i=o[n];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=Xf()),t===void 0&&(t=!0);var n=Object.keys(this._tweens);if(n.length!==0)for(;n.length>0;){this._tweensAddedDuringUpdate={};for(var o=0;o<n.length;o++){var i=this._tweens[n[o]],s=!t;i&&i.update(r,s)===!1&&!t&&this.remove(i)}n=Object.keys(this._tweensAddedDuringUpdate)}},e}(),Dd={Linear:function(e,r){var t=e.length-1,n=t*r,o=Math.floor(n),i=Dd.Utils.Linear;return r<0?i(e[0],e[1],n):r>1?i(e[t],e[t-1],t-n):i(e[o],e[o+1>t?t:o+1],n-o)},Bezier:function(e,r){for(var t=0,n=e.length-1,o=Math.pow,i=Dd.Utils.Bernstein,s=0;s<=n;s++)t+=o(1-r,n-s)*o(r,s)*e[s]*i(n,s);return t},CatmullRom:function(e,r){var t=e.length-1,n=t*r,o=Math.floor(n),i=Dd.Utils.CatmullRom;return e[0]===e[t]?(r<0&&(o=Math.floor(n=t*(1+r))),i(e[(o-1+t)%t],e[o],e[(o+1)%t],e[(o+2)%t],n-o)):r<0?e[0]-(i(e[0],e[0],e[1],e[1],-n)-e[0]):r>1?e[t]-(i(e[t],e[t],e[t-1],e[t-1],n-t)-e[t]):i(e[o?o-1:0],e[o],e[t<o+1?t:o+1],e[t<o+2?t:o+2],n-o)},Utils:{Linear:function(e,r,t){return(r-e)*t+e},Bernstein:function(e,r){var t=Dd.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 n=r;n>1;n--)t*=n;return e[r]=t,t}}(),CatmullRom:function(e,r,t,n,o){var i=(t-e)*.5,s=(n-r)*.5,u=o*o,l=o*u;return(2*r-2*t+i+s)*l+(-3*r+3*t-2*i-s)*u+i*o+r}}},fM=function(){function e(){}return e.nextId=function(){return e._nextId++},e._nextId=0,e}(),y2=new w1,Ii=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=zo.Linear.None,this._interpolationFunction=Dd.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=fM.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=y2,y2.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=Xf()),t===void 0&&(t=!1),this._isPlaying)return this;if(this._repeat=this._initialRepeat,this._reversed){this._reversed=!1;for(var n in this._valuesStartRepeat)this._swapEndStartRepeatValues(n),this._valuesStart[n]=this._valuesStartRepeat[n]}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 o={};for(var i in this._valuesEnd)o[i]=this._valuesEnd[i];this._valuesEnd=o}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,n,o,i){for(var s in n){var u=r[s],l=Array.isArray(u),c=l?"array":typeof u,d=!l&&Array.isArray(n[s]);if(!(c==="undefined"||c==="function")){if(d){var f=n[s];if(f.length===0)continue;for(var h=[u],b=0,I=f.length;b<I;b+=1){var E=this._handleRelativeValue(u,f[b]);if(isNaN(E)){d=!1,console.warn("Found invalid interpolation list. Skipping.");break}h.push(E)}d&&(n[s]=h)}if((c==="object"||l)&&u&&!d){t[s]=l?[]:{};var v=u;for(var x in v)t[s][x]=v[x];o[s]=l?[]:{};var f=n[s];if(!this._isDynamic){var D={};for(var x in f)D[x]=f[x];n[s]=f=D}this._setupProperties(v,t[s],f,o[s],i)}else(typeof t[s]>"u"||i)&&(t[s]=u),l||(t[s]*=1),d?o[s]=n[s].slice().reverse():o[s]=t[s]||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=Xf()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=r,this)},e.prototype.resume=function(r){return r===void 0&&(r=Xf()),!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=zo.Linear.None),this._easingFunction=r,this},e.prototype.interpolation=function(r){return r===void 0&&(r=Dd.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 n=this,o;if(r===void 0&&(r=Xf()),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 s=r-this._startTime,u=this._duration+((o=this._repeatDelayTime)!==null&&o!==void 0?o:this._delayTime),l=this._duration+this._repeat*u,c=function(){if(n._duration===0||s>l)return 1;var E=Math.trunc(s/u),v=s-E*u,x=Math.min(v/n._duration,1);return x===0&&s===n._duration?1:x},d=c(),f=this._easingFunction(d);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,f),this._onUpdateCallback&&this._onUpdateCallback(this._object,d),this._duration===0||s>=this._duration)if(this._repeat>0){var h=Math.min(Math.trunc((s-this._duration)/u)+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+=u*h,this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1,!0}else{this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var b=0,I=this._chainedTweens.length;b<I;b++)this._chainedTweens[b].start(this._startTime+this._duration,!1);return this._isPlaying=!1,!1}return!0},e.prototype._updateProperties=function(r,t,n,o){for(var i in n)if(t[i]!==void 0){var s=t[i]||0,u=n[i],l=Array.isArray(r[i]),c=Array.isArray(u),d=!l&&c;d?r[i]=this._interpolationFunction(u,o):typeof u=="object"&&u?this._updateProperties(r[i],s,u,o):(u=this._handleRelativeValue(s,u),typeof u=="number"&&(r[i]=s+(u-s)*o))}},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],n=this._valuesEnd[r];typeof n=="string"?this._valuesStartRepeat[r]=this._valuesStartRepeat[r]+parseFloat(n):this._valuesStartRepeat[r]=this._valuesEnd[r],this._valuesEnd[r]=t},e.autoStartOnUpdate=!1,e}();var w7e=fM.nextId,va=y2,F7e=va.getAll.bind(va),M7e=va.removeAll.bind(va),A7e=va.add.bind(va),O7e=va.remove.bind(va),B7e=va.update.bind(va);p();p();p();var hM=(e,r)=>(r-e+Math.PI)%(Math.PI*2)+Math.PI*2%(Math.PI*2)-Math.PI,gM=(e,r)=>new ke(e.clientX-r.offsetLeft,e.clientY-r.offsetTop),b2=(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),v2=(e,r)=>new ke((e.x+r.x)/2,(e.y+r.y)/2),x2=e=>{let r=0,{wheelDelta:t,detail:n}=e;return t!==void 0?r=t:n!==void 0&&(r=-n),r};var F1=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=b2(r,t),this.lastDistance=Jf(r,t),this.totalDistance=0,this.first=r,this.second=t}update(r,t){let n=Jf(r,t);this.input1=r,this.input2=t;let o=b2(r,t);this.lastAngle=o,this.lastDistance=n,this.totalDistance+=(Jf(this.first,r)+Jf(this.second,t))/2,this.first=v2(this.first,r),this.second=v2(this.second,t)}};p();var Yf=class{constructor(r,t,n){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=n,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 ke(this.viewCoordinate.x,this.viewCoordinate.y);this.raycaster=this.raycaster||new Ui,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 ke(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 Ei={};$s(Ei,{BLOCK_MERCATOR_ZOOM_LEVEL:()=>pV,CLIPPING_RADIUS:()=>Kf,CONTROL_OPTIONS:()=>cV,DEFAULT_ANIMATION_DURATION:()=>D2,DEFAULT_BEARING:()=>gV,DEFAULT_MAX_ZOOM_LEVEL:()=>fV,DEFAULT_MIN_ZOOM_LEVEL:()=>T2,DEFAULT_PITCH:()=>hV,DEFAULT_ZOOM_LEVEL:()=>mV,EVENTS:()=>B1,MAPLIBRE_TILE_SIZE:()=>M1,MAX_LAT:()=>E2,MAX_MERCATOR_ZOOM_LEVEL:()=>O1,MIN_LAT:()=>I2,MIN_MERCATOR_ZOOM_LEVEL:()=>A1,ROOM_MERCATOR_ZOOM_LEVEL:()=>dV,TWO_PI:()=>C2,WHEEL_ZOOM_MULTIPLIER:()=>S2,ZRANGE:()=>Td});p();var M1=512,I2=-85.051129,E2=85.051129,Kf=1e4,cV={chain:"chain",cancel:"cancel"},C2=Math.PI*2,Td=100,S2=1e4,A1=0,O1=24,pV=17,dV=20,D2=200,B1=["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"],mV=18,T2=12,fV=22,hV=0,gV=0;var P1=!1,yV=!1;var k1,Ul=class extends Oe{constructor(t,n,o,i,s){super();m(this,"dirty",!1);m(this,"zoomDirty",!1);m(this,"rotationDirty",!1);m(this,"panDirty",!1);m(this,"stateDirty",!1);C(this,k1,T2);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 ie(1/0,1/0),max:new ie(-1/0,-1/0),center:new ie(0,0,0),radius:1/0});m(this,"minTilt",0);m(this,"maxTilt",1.2);m(this,"MOUSE_BUTTONS",{ORBIT:gh.RIGHT,ZOOM:gh.MIDDLE,PAN:gh.LEFT});m(this,"camera");m(this,"scene");m(this,"renderer");m(this,"elevation");m(this,"orbit");m(this,"cameraPlane");m(this,"raycaster",new Ui);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 l6(!0));m(this,"coords",{mouse:new ke,rotateStart:new ke,rotateEnd:new ke,rotateDelta:new ke,panStart:new ie,panCameraStart:new ie,panEnd:new ie,panDelta:new ie,initialShiftPos:new ke,initialPedestal:0,floorAnchor:new ie});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 n=this.raycaster.intersectObject(this.cameraPlane,!1)[0];return n?n.point:new ie});m(this,"isUserInteracting",()=>this.userInteracting);m(this,"getPosition",()=>new ie(this.orbit.position.x,this.orbit.position.y,this.orbit.position.z));m(this,"getPedestal",()=>this.orbit.position.z);m(this,"pan",(t,n)=>{isNaN(t)||isNaN(n)||(this.setPosition(this.orbit.position.x+t,this.orbit.position.y+n),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,n)=>{t===void 0||n===void 0||isNaN(t)||isNaN(n)||(this.state===-1&&this.publish("pan-start"),this.updateCameraPosition(t,n),this.publish("position-updated"),this.publish("change"),this.state===-1&&this.publish("pan-end"),this.dirty=!0,this.stateDirty=!0)});m(this,"updateCameraPosition",(t,n)=>{let o=t-this.panBounds.center.x,i=n-this.panBounds.center.y,s=Math.sqrt(o*o+i*i);if(this.stayInsideBounds&&s>this.panBounds.radius){let u=Math.atan2(i,o),l={x:Math.cos(u)*this.panBounds.radius+this.panBounds.center.x,y:Math.sin(u)*this.panBounds.radius+this.panBounds.center.y};this.orbit.position.x=l.x,this.orbit.position.y=l.y}else this.orbit.position.x=t,this.orbit.position.y=n});m(this,"tilt",t=>{if(isNaN(t))return;this.state===-1&&this.publish("rotate-start");let n=this.stayInsideBounds?Math.max(Math.min(t+this.getTilt(),this.maxTilt),this.minTilt):t+this.getTilt();n!==this.elevation.rotation.x&&(this.elevation.rotation.x=n,this.publish("tilt-updated")),this.publish("change"),this.state===-1&&this.publish("rotate-end"),this.stateDirty=!0});m(this,"zoomIn",(t,n,o)=>{let i=this.getZoomAltitude();this.animateCamera({zoom:i/1.5},t,n,o)});m(this,"zoomOut",(t,n,o)=>{let i=this.getZoomAltitude();this.animateCamera({zoom:i*1.5},t,n,o)});m(this,"getRotation",()=>(-this.orbit.rotation.z+Math.PI*2)%(Math.PI*2));m(this,"cancelAnimation",()=>{let t=Array.from(this.tweens.keys());if(t.length<1)return;let n=t[t.length-1];n.state===7&&this.publish("multi-cancel",{zooming:!0,rotating:!0,tilting:!0}),this.completeTween(n)});m(this,"animateCamera",(t,n,o,i,s,u)=>{let l={interruptible:!0,...u},c={},d={},f=this.getPosition();if(t.position!=null&&(t.position.x!==void 0&&(c.x=f.x,d.x=t.position.x),t.position.y!==void 0&&(c.y=f.y,d.y=t.position.y),t.position.z!==void 0&&(c.z=f.z,d.z=t.position.z)),t.zoom!==void 0&&(c.zoom=this.stayInsideBounds?Math.min(Math.max(this.getZoomAltitude(),this.getZoomScaledMin()),this.getZoomScaledMax()):this.getZoomAltitude(),this.viewState==="multi_floor"||!this.stayInsideBounds?d.zoom=t.zoom:d.zoom=Math.min(Math.max(t.zoom,this.getZoomScaledMin()),this.getZoomScaledMax())),t.rotation!==void 0){let{start:w,end:S}=f6(this.getRotation(),t.rotation);c.rotation=w,d.rotation=S}t.tilt!==void 0&&(c.tilt=this.getTilt(),this.viewState==="multi_floor"||!this.stayInsideBounds?d.tilt=t.tilt:d.tilt=Math.max(Math.min(t.tilt,this.maxTilt),this.minTilt));let h=c.zoom!==d.zoom,b=c.rotation!==d.rotation,I=c.tilt!==d.tilt,E=new Ii(c).to(d,y.env.TESTING?0:n).onUpdate(w=>{this.setMulti({x:w.x,y:w.y,z:w.z},w.zoom,w.rotation,w.tilt)}).onComplete(()=>{this.completeTween(E),this.publish("multi-end",{zooming:h,rotating:b,tilting:I}),i&&i()}).onStart(()=>{this.state!==7&&(this.state=7,E.state=7,this.publish("multi-start",{zooming:h,rotating:b,tilting:I})),this.publish("change")});this.rendererState.internalTweenGroup.add(E);let v=Array.from(this.tweens.entries()),x=v[v.length-1],D=!1;return x!=null&&(x[1].interruptible?(typeof x[1].cancelledCallback=="function"&&x[1].cancelledCallback(),this.completeTween(x[0])):(D=!0,x[0].chain(E))),this.tweens.set(E,{cancelledCallback:s,interruptible:l.interruptible}),o?E.easing(o):E.easing(zo.Quadratic.In),!t.doNotAutoStart&&!D&&(E.start(),this.publish("change")),E.cameraAnimation=!0,E});m(this,"setMulti",(t,n,o,i,s=!0)=>{this.state===-1&&this.publish("multi-start");let u=!1;t!=null&&(t.x!==void 0&&!isNaN(t.x)&&t.y!==void 0&&!isNaN(t.y)&&(this.updateCameraPosition(t.x,t.y),u=!0),t.z!==void 0&&!isNaN(t.z)&&(this.setPedestal(t.z,!0,!1),u=!0)),u&&this.publish("position-updated");let l={zooming:!1,tilting:!!n,rotating:!1};if(n!==void 0&&!isNaN(n)){let c=this.stayInsideBounds?Math.min(Math.max(n,this.getZoomScaledMin()),this.getZoomScaledMax()):n;c!==this.camera.position.z&&(l.zooming=!0,this.camera.position.z=c,this.publish("zoom-updated"),this.zoomDirty=!0,this.viewState==="multi_floor"?n>Kf&&(this.camera.near=n-Kf,this.camera.far=n+Kf):(this.camera.near=n/Td,this.camera.far=n*Td),this.camera.updateProjectionMatrix())}if(o!==void 0&&!isNaN(o)&&o!==this.getRotation()&&(l.rotating=!0,this.orbit.rotation.z=-o,this.publish("rotation-updated")),i!==void 0&&!isNaN(i)){let c=this.stayInsideBounds?Math.max(Math.min(i,this.maxTilt),this.minTilt):i;c!==this.elevation.rotation.x&&(l.tilting=!0,this.elevation.rotation.x=c,this.publish("tilt-updated"))}s&&this.publish("change"),this.state===-1&&this.publish("multi-end",l),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,n)=>{if(isNaN(t))return;this.state===-1&&!n&&this.publish("rotate-start");let o=-(t%C2);o!==this.orbit.rotation.z&&(this.orbit.rotation.z=o,n||this.publish("rotation-updated")),n||this.publish("change"),this.state===-1&&!n&&this.publish("rotate-end"),this.dirty=!0,this.rotationDirty=!0,n||(this.stateDirty=!0)});m(this,"setZoomAltitude",t=>{if(isNaN(t))return;this.state===-1&&this.publish("zoom-start");let n=this.stayInsideBounds?Math.min(Math.max(t,this.getZoomScaledMin()),this.getZoomScaledMax()):t;n!==this.camera.position.z&&(this.camera.position.z=n,this.publish("zoom-updated"),this.zoomDirty=!0),this.camera.near=n/Td,this.camera.far=n*Td,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,n)=>{if(isNaN(t))return;this.state===-1&&!n&&this.publish("rotate-start");let o=this.stayInsideBounds?Math.max(Math.min(t,this.maxTilt),this.minTilt):t;o!==this.elevation.rotation.x&&(this.elevation.rotation.x=o,n||this.publish("tilt-updated")),n||this.publish("change"),this.state===-1&&!n&&this.publish("rotate-end"),this.dirty=!0,n||(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 n=this.getZoomAltitude()-t;this.camera.position.z=this.stayInsideBounds?Math.min(Math.max(n,this.minZoomAltitude*this.zoomFactor),this.maxZoomAltitude*this.zoomFactor):n,this.publish("zoom-updated"),this.zoomDirty=!0,this.publish("change"),this.state===-1&&this.publish("zoom-end"),this.stateDirty=!0});m(this,"getProjectionScaleFactor",(t,n,o)=>bb(t,n,o));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,n=!1,o=!0)=>{typeof t=="number"&&!isNaN(t)&&(this.orbit.position.z=t,n&&(this.publishPedestalChangeEvent(t),this.publish("pedestal-change",{pedestal:t})),this.publish("change"),this.dirty=!0,o&&(this.stateDirty=!0))});m(this,"dispose",()=>{for(let t of B1)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=P1?2e3:1e10,n=P1?100:1,o=new Qo(t,t,n,n),i=new gr({color:0,wireframe:P1,visible:P1}),s=new Pe(o,i);return this.scene.add(s),s});m(this,"addEventListeners",()=>{let{domElement:t}=this.renderer;for(let n of B1)n.endsWith("start")?(this.on(n,this.setCameraMoving),n.startsWith("user")&&this.on(n,this.setUserInteracting)):(n.endsWith("end")||n.endsWith("cancel"))&&(this.on(n,this.unsetCameraMoving),n.startsWith("user")&&this.on(n,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 F1(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 n={...this.touch.inputs.first},o={...this.touch.inputs.second},i=new ke(this.touch.touches[0].x,this.touch.touches[0].y),s=new ke(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 u=n.y<i.y&&o.y<s.y,l=n.y>i.y&&o.y>s.y;this.enableRotate&&this.state!==4&&(l||u)?(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 n=Object.hasOwn(t,"x")?new ke(t.x,t.y):this.touch.touches[0],o=this.raycastToFloor(n);this.coords.panEnd.set(o.x,o.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,n=this.touch.touches[0].y-this.touch.touches[1].y;this.zoomStart=this.getZoomAltitude();let o=new ke(this.touch.touches[0].x-t/2,this.touch.touches[0].y-n/2);this.coords.floorAnchor=this.raycastToFloor(o),this.orbit.updateMatrixWorld(),this.touch.anchor1=new Yf(this.touch.touches[0],this.camera,this.cameraPlane),this.touch.anchor2=new Yf(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,n=this.touch.inputs.second;this.touch.anchor1.viewCoordinate={x:t.x,y:t.y},this.touch.anchor2.viewCoordinate={x:n.x,y:n.y};let o=this.makeTransformFromTouchAnchors(this.touch.anchor1,this.touch.anchor2);o&&this.setCameraFromTransformMatrix(o),this.orbit.updateMatrixWorld(),this.touch.anchor1.updateAnchorState(this.camera,t),this.touch.anchor2.updateAnchorState(this.camera,n)});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 n=Object.hasOwn(t,"x")?new ke(t.x,t.y):this.touch.touches[0],o=this.raycastToFloor(n);this.coords.panStart.set(o.x,o.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 n=this.getZoomAltitude(),o=n-x2(t)*n/S2*this.zoomSpeed;if(this.setZoomAltitude(o),this.enablePan){let i=o/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 n=new bc;n.setFromRotationMatrix(t,"ZYX");let o=(t.elements[14]-this.cameraPlane.position.z)/Math.cos(n.x),i=n.z,s=new ie(0,0,1);s.applyEuler(n),s.setLength(o);let u=new ie;u.setFromMatrixPosition(t),u.sub(s),this.enablePan&&this.setPosition(u.x,u.y),this.enableZoom&&this.setZoomAltitude(o),this.enableRotate&&this.setRotation(-i)});m(this,"makeTransformFromTouchAnchors",(t,n)=>{this.orbit.updateMatrixWorld(),this.camera.updateProjectionMatrix();let o=this.camera.projectionMatrix.clone(),i=t.worldCoordinate,s=n.worldCoordinate,u=t.reUnproject(),l=n.reUnproject();if(!u||!l||!i||!s)return null;let c=t.viewCoordinate,d=n.viewCoordinate,f=s.x-i.x,h=s.y-i.y,b=Math.atan2(h,f),I=l.x-u.x,E=l.y-u.y,v=Math.atan2(E,I),x=hM(b,v),D=new Wn;D.makeRotationZ(-x);let w=D.clone();w.multiply(t.snapHolderMatrix);let S=(mh,mc,fc)=>mh.elements[(mc-1)*4+fc-1],F=S(o,1,1)*S(w,1,1)-c.x*S(o,3,4)*S(w,3,1),P=S(o,1,1)*S(w,1,2)-c.x*S(o,3,4)*S(w,3,2),L=S(o,1,1)*S(w,1,3)-c.x*S(o,3,4)*S(w,3,3),N=i.x*F+i.y*P+i.z*L,$=S(o,2,2)*S(w,2,1)-c.y*S(o,3,4)*S(w,3,1),W=S(o,2,2)*S(w,2,2)-c.y*S(o,3,4)*S(w,3,2),V=S(o,2,2)*S(w,2,3)-c.y*S(o,3,4)*S(w,3,3),q=i.x*$+i.y*W+i.z*V,se=S(o,1,1)*S(w,1,1)-d.x*S(o,3,4)*S(w,3,1),ue=S(o,1,1)*S(w,1,2)-d.x*S(o,3,4)*S(w,3,2),ce=S(o,1,1)*S(w,1,3)-d.x*S(o,3,4)*S(w,3,3),de=s.x*se+s.y*ue+s.z*ce,Ee=S(o,2,2)*S(w,2,1)-d.y*S(o,3,4)*S(w,3,1),he=S(o,2,2)*S(w,2,2)-d.y*S(o,3,4)*S(w,3,2),ne=S(o,2,2)*S(w,2,3)-d.y*S(o,3,4)*S(w,3,3),Ce=s.x*Ee+s.y*he+s.z*ne,xe=Math.abs(se-F),Re=Math.abs(ue-P),we=Math.abs(ce-L),Ve=Math.abs(se-$),me=Math.abs(ue-W),at=Math.abs(ce-V),xt=Math.abs(Ee-F),Ot=Math.abs(he-P),A=Math.abs(ne-L),Z=Math.abs(Ee-$),O=Math.abs(he-W),Q=Math.abs(ne-V),X=Math.min(xe+Re+we,Ve+me+at),Y=Math.min(xt+Ot+A,Z+O+Q);X<Y&&(se=Ee,ue=he,ce=ne,de=Ce);let K=$*L-F*V,ae=W*L-P*V,$e=q*L-N*V,Rt=se*V-$*ce,ir=ue*V-W*ce,ho=de*V-q*ce,Ni=(ho*ae-$e*ir)/(Rt*ae-K*ir),em=(ho*K-$e*Rt)/(ir*K-ae*Rt),dc=W*F-P*$,Ru=V*F-L*$,Rs=q*F-N*$,Aa=ue*$-W*se,dh=ce*$-V*se,tm=((de*$-q*se)*dc-Rs*Aa)/(dh*dc-Ru*Aa),Ns=w.clone();return Ns.elements[12]=Ni,Ns.elements[13]=em,Ns.elements[14]=tm,tm>0?Ns: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 n=0,o=t.touches.length;n<o;n++){let i=t.touches[n],s=gM(i,this.touch.origin);this.touch.touches.push(new ke(s.x/this.renderer.domElement.width*this.rendererState.pixelRatio*2-1,-(s.y/this.renderer.domElement.height*this.rendererState.pixelRatio)*2+1))}this.coords.mouse=this.touch.touches[0]});m(this,"canScrollZoom",t=>{let n=x2(t),o=this.getZoomAltitude();return!(n<0&&o===this.getZoomScaledMax()||n>0&&o===this.getZoomScaledMin())});m(this,"mouseToScene",t=>{let n=this.getMousePos(t);return this.coords.mouse.x=n.x/this.renderer.domElement.width*this.rendererState.pixelRatio*2-1,this.coords.mouse.y=-(n.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 n=new ke(t.clientX,t.clientY);this.coords.initialShiftPos=n,this.coords.initialPedestal=this.getPedestal(),this.pedestalScaleFactor=bb(this.camera.fov,this.renderer.domElement.clientHeight,this.getZoomAltitude()),this.publish("pedestal-start"),this.publish("user-pedestal-start")});m(this,"handleMouseMovePedestal",t=>{let n={x:t.clientX,y:t.clientY},o=this.coords.initialPedestal+this.pedestalScaleFactor*(n.y-this.coords.initialShiftPos.y);this.stayInsideBounds&&(o<this.minPedestal?o=Math.max(o,this.minPedestal):o>this.maxPedestal&&(o=Math.min(o,this.maxPedestal))),o!==this.getPedestal()&&this.setPedestal(o,!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",fm(()=>{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[,n]=this.center,o=this.computeMetersPerPixelFromAltitude(t),i=Math.cos(Je.degToRad(n))*2*Math.PI*nb/o;return Je.clamp(Math.log2(i/512),A1,O1)});m(this,"convertZoomLevelToAltitude",t=>this.computeMetersPerPixelFromZoomLevel(t)*this.options.canvasHeight/2/Math.tan(Je.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 ju);this.camera=t,this.renderer=o,this.rendererState=i,this.scene=n,this.options=s,this.elevation=t.parent,this.orbit=this.elevation.parent,this.cameraPlane=this.createCameraPlane(),this.zoomStart=t.position.z,s.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 a(this,k1)}get minZoomLevel(){return this.convertAltitudeToZoomLevel(this.maxZoomAltitude)}setMinZoomLevel(t){this.maxZoomAltitude=this.convertZoomLevelToAltitude(t),this.stateDirty=!0}get scrollPercent(){let t=this.minPedestal,n=this.maxPedestal,o=this.getPedestal();return o=Math.min(o,n),o=Math.max(o,t),(o-t)/(n-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:n,lon:o}=Lh(this.rendererState.center?.[1]??0,this.rendererState.center?.[0]??0,t.x,t.y);return[o,n]}setCenter(t,n){let{x:o,y:i}=Rh(this.rendererState.center?.[1]??0,this.rendererState.center?.[0]??0,n,t);this.setPosition(o,i)}get isAnimating(){return this.rendererState.internalTweenGroup.getAll().some(t=>t.cameraAnimation)}getCameraFrameForCoordinates(t,n){let o=n.minZoom!==void 0?n.minZoom:this.minZoomAltitude,i=n.maxZoom!==void 0?n.maxZoom:this.maxZoomAltitude,s=this.options.canvasWidth,u=this.options.canvasHeight,l=this.getRotation(),c=this.getTilt(),d=this.getPosition();this.setRotation(n.rotation??l,!0),this.setTilt(n.tilt??c,!0);let f=yM(t,{canvasWidth:s,canvasHeight:u,paddingOption:n.padding,verticalPadding:n.verticalPadding,minZoom:o,maxZoom:i,position:d,camera:this.camera,orbit:this.orbit});return this.setRotation(l,!0),this.setTilt(c,!0),{center:f.position,zoomLevel:this.convertAltitudeToZoomLevel(f.zoom)}}focusOn(t,n){if(yV){this.debugContainer&&Ht(this.debugContainer);let v=new qo(4,4,4),x=new gr({color:65280,depthTest:!1}),D=new ji(v,x,t.length),w=new Wn;t.forEach((S,F)=>{w.setPosition(S),D.setMatrixAt(F,w)}),D.instanceMatrix.needsUpdate=!0,this.debugContainer.add(D),this.scene.add(this.debugContainer)}let o=n.curve,i=n.callback,s=n.cancelledCallback,u=n.minZoom!==void 0?n.minZoom:this.minZoomAltitude,l=n.maxZoom!==void 0?n.maxZoom:this.maxZoomAltitude,c=this.options.canvasWidth,d=this.options.canvasHeight,f;n.duration!==void 0?f=n.duration:y.env.TESTING==="true"?f=0:f=D2;let h=n.padding,b=this.getRotation(),I=this.getTilt();n.rotation!=null&&this.setRotation(n.rotation),n.tilt!=null&&this.setTilt(n.tilt);let E=yM(t,{canvasHeight:d,paddingOption:h,canvasWidth:c,minZoom:u,maxZoom:l,camera:this.camera,orbit:this.orbit,position:this.getPosition(),verticalPadding:n.verticalPadding});this.setRotation(b),this.setTilt(I),this.animateCamera({position:E.position,tilt:n.tilt,rotation:n.rotation,zoom:E.zoom},f,o,i,s,n)}resize(t,n){this.options.canvasWidth=t,this.options.canvasHeight=n}computeMetersPerPixelFromZoomLevel(t){let[,n]=this.center,o=Je.clamp(t,A1,O1),i=Math.pow(2,o),s=Je.clamp(n,I2,E2),u=i*512;return Math.cos(Je.degToRad(s))*Math.PI*2*nb/u}computeMetersPerPixelFromAltitude(t){return t*2*Math.tan(Je.degToRad(this.camera.fov)/2)/this.options.canvasHeight}getCurrentMetersPerPixel(){return this.computeMetersPerPixelFromAltitude(this.getZoomAltitude())}};k1=new WeakMap,m(Ul,"CAMERA_FRAME_PADDING_SIDES",["top","bottom","left","right"]);function yM(e,{canvasWidth:r,orbit:t,paddingOption:n,verticalPadding:o=0,canvasHeight:i,minZoom:s,maxZoom:u,camera:l,position:c}){let d={zoom:s,position:c};if(e.length===0)return d;for(let K of Ul.CAMERA_FRAME_PADDING_SIDES)typeof n[K]!="number"&&(n[K]=0);let f=n.type==="portion"?{top:n.top*i,bottom:n.bottom*i,left:n.left*r,right:n.right*r,type:"pixel"}:n;if(f.left+f.right>=r||f.top+f.bottom>=i)return d;t.updateMatrixWorld();let h=l.matrixWorldInverse,b=l.fov*(Math.PI/180)/2,I=b,v=Math.atan(Math.tan(b)*(r/i)),x=new ie(1/0,1/0,1/0),D=new ie(-1/0,-1/0,-1/0),w=new dr,S=new ie;for(let K=0,ae=e.length;K<ae;K++)S.copy(e[K]),w.expandByPoint(S),S.applyMatrix4(h),x.min(S),D.max(S),S.copy(e[K]),S.z-=o,S.applyMatrix4(h),x.min(S),D.max(S),S.copy(e[K]),S.z+=o,S.applyMatrix4(h),x.min(S),D.max(S);let F=D.x-x.x,P=D.y-x.y,L=r-f.left-f.right,N=i-f.top-f.bottom,$=(D.x+x.x)/2,W=(D.y+x.y)/2,V=F/L,q=P/N,se=s,ue=u,ce=se*Math.tan(v)*2,de=ue*Math.tan(v)*2,Ee=ce/r,he=de/r,ne=Math.max(V,q);ne=Je.clamp(ne,Ee,he);let Ce=L*ne,xe=N*ne,Re={min:{x:$-Ce/2-f.left*ne,y:W-xe/2-f.bottom*ne},max:{x:$+Ce/2+f.right*ne,y:W+xe/2+f.top*ne}},we=(Re.min.x+Re.max.x)/2,Ve=(Re.min.y+Re.max.y)/2,me=w.getCenter(new ie),at=Math.abs(we-Re.min.x),xt=Math.abs(Ve-Re.min.y),Ot=at/Math.tan(v),A=xt/Math.tan(I),Z=new ie;Z.set(we,Ve,D.z+Math.max(Ot,A)),Z.applyMatrix4(l.matrixWorld);let O=new ie;O.set(we,Ve,D.z),O.applyMatrix4(l.matrixWorld);let Q=new ie().subVectors(O,Z),X=(me.z-Z.z)/Q.z,Y=new ie().copy(Z).add(Q.clone().multiplyScalar(X));return O.set(Y.x,Y.y,Y.z),Z.sub(O),{position:Y,zoom:Z.length()}}p();var bV=300,qf,Qf,_1=class{constructor(r){m(this,"state");C(this,qf,new ie);C(this,Qf,new ie);this.state=r}update(r){let t,n;this.state.cameraObject.getWorldPosition(a(this,Qf));for(let o of this.state.geometry2DIdsInScene)if(t=this.state.geometry2DMap.get(o),t&&(n=t.components[0],n&&"containerEl"in n&&n.markerContainer!=null)){if(n.visibilityNeedsUpdate!==!1&&(n.visibilityNeedsUpdate==="show"?n.canShow=!0:n.canShow=!1),(n.canShow&&n.visible===!0||n.animation?.pending===!0)&&!n.offscreen)if(n.options.zIndex!=null)n.markerContainer.style.transform=`translate3D(${n.projection.x}px, ${n.projection.y}px, ${n.options.zIndex}px)`;else{t.object3d.getWorldPosition(a(this,qf));let i=a(this,Qf).distanceTo(a(this,qf));n.markerContainer.style.transform=`translate3D(${n.projection.x}px, ${n.projection.y}px, ${-i}px)`}if(n.canShow===!0&&n.visible===!0?n.markerContainer.style.pointerEvents=r?"none":n.pointerEvents:n.markerContainer.style.pointerEvents="none",n.currentStrategyIndex===-1&&n.visible&&n.visibilityNeedsUpdate==="show")continue;n.visibilityNeedsUpdate!==!1&&!n.offscreen&&(n.visibilityNeedsUpdate==="show"&&(n.markerContainer.style.opacity="0"),n.animation&&n.animation.cancel(),n.animation=n.markerContainer.animate([{opacity:n.canShow&&n.visible?"1":"0"}],{duration:bV,easing:"ease-in-out",fill:"forwards"}),n.visibilityNeedsUpdate=!1)}}};qf=new WeakMap,Qf=new WeakMap;p();var L1=class extends Oe{constructor(t,n){super();m(this,"state");m(this,"dirty",!0);m(this,"domTree");m(this,"observers",new Map);m(this,"updateDimensions",t=>{t.forEach(n=>{let i=n.target.parentElement?.getAttribute("data-marker-id");if(i){let s=this.state.geometry2DMap.get(i),u=s?.components[0];s&&u instanceof Na&&(u.updateDimensions(n.contentRect.width,n.contentRect.height),u.collisionDirty=!0)}}),this.publish("dimensions-update")});this.state=t,this.domTree=n}setupObserver(){if(this.observers){for(let o of this.observers.values())o.disconnect();this.observers.clear()}let t,n;for(let o of this.domTree.children){let i=o.getAttribute("data-marker-id");if(i!=null&&(t=this.state.geometry2DMap.get(i),n=t.components[0],n.options?.dynamicResize)){let s=new ResizeObserver(this.updateDimensions);s.observe(n.containerEl),this.observers.set(o.userData.entityId,s)}}}update(){this.dirty&&(this.setupObserver(),this.dirty=!1)}destroy(){for(let t of this.observers.values())t.disconnect();this.observers.clear()}};p();var vV=0,xV=90,IV=(y.env.NODE_ENV==="test",!1),xa={linear:zo.Linear.None,"ease-in":zo.Quadratic.In,"ease-out":zo.Quadratic.Out,"ease-in-out":zo.Quadratic.InOut},EV=-50,fe,Fe,xs,e0,t0,F2,R1=class{constructor(r,t,n){C(this,t0);C(this,fe);C(this,Fe);C(this,xs);C(this,e0);T(this,fe,r),T(this,Fe,t),T(this,xs,n),a(this,fe).map&&a(this,fe).map.transform.setMinElevationForCurrentTile(EV),a(this,Fe).cameraSystem.on("pedestal-change",({pedestal:o})=>{a(this,Fe).cameraSystem.setCameraPlaneElevation(o)})}get center(){return a(this,fe).mode==="outdoors-overlay"&&a(this,fe).map?a(this,fe).map.getCenter?.().toArray():a(this,Fe).cameraSystem.center}setCenter(r){if(a(this,fe).mode==="outdoors-overlay"&&a(this,fe).map){a(this,fe).map?.setCenter(r),a(this,Fe).interactionSystem.handleHover();return}a(this,Fe).cameraSystem.setCenter(r[0],r[1]),a(this,Fe).interactionSystem.handleHover()}get zoomLevel(){return a(this,fe).mode==="outdoors-overlay"&&a(this,fe).map?a(this,fe).map?.getZoom():a(this,Fe).cameraSystem.getZoomLevel()}setZoomLevel(r){a(this,fe).mode==="outdoors-overlay"&&a(this,fe).map&&a(this,fe).map?.setZoom(r),a(this,Fe).cameraSystem.setZoomLevel(Gi(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 a(this,Fe).cameraSystem.isAnimating}cancelAnimation(){a(this,Fe).cameraSystem.cancelAnimation()}get maxZoomLevel(){return a(this,Fe).cameraSystem.maxZoomLevel}get minZoomLevel(){return a(this,Fe).cameraSystem.minZoomLevel}setAutoMinZoomLevel(r){a(this,Fe).panBoundsSystem.autoMinZoomLevel=r,r&&(a(this,Fe).panBoundsSystem.dirty=!0,a(this,Fe).panBoundsSystem.update())}get autoMinZoomLevel(){return a(this,Fe).panBoundsSystem.autoMinZoomLevel}setMinZoomLevel(r,t=!1){t&&this.setAutoMinZoomLevel(!1);let n=Gi(r,Ei.MIN_MERCATOR_ZOOM_LEVEL,this.maxZoomLevel,`setMinZoomLevel was clamped. minZoomLevel must be between ${Ei.MIN_MERCATOR_ZOOM_LEVEL} and maxZoomLevel.`);a(this,Fe).cameraSystem.setMinZoomLevel(n),this.zoomLevel<n&&this.setZoomLevel(n),a(this,fe).map?.setMinZoom(n)}setMaxZoomLevel(r){let t=Gi(r,this.minZoomLevel,Ei.MAX_MERCATOR_ZOOM_LEVEL,`setMaxZoomLevel was clamped. maxZoomLevel must be between minZoomLevel and ${Ei.MAX_MERCATOR_ZOOM_LEVEL}.`);a(this,Fe).cameraSystem.setMaxZoomLevel(t),this.zoomLevel>t&&this.setZoomLevel(t),a(this,fe).map?.setMaxZoom(t)}get maxPitch(){return a(this,fe).mode==="outdoors-overlay"&&a(this,fe).map?a(this,fe).map?.getMaxPitch?.():Je.radToDeg(a(this,Fe).cameraSystem.maxTilt)}get minPitch(){return a(this,fe).mode==="outdoors-overlay"&&a(this,fe).map?a(this,fe).map?.getMinPitch?.():Je.radToDeg(a(this,Fe).cameraSystem.minTilt)}setMinPitch(r){let t=Math.max(vV,r);a(this,fe).map?.setMinPitch(t),a(this,Fe).cameraSystem.minTilt=Je.degToRad(t)}setMaxPitch(r){let t=Math.min(xV,r);a(this,fe).map?.setMaxPitch(t),a(this,Fe).cameraSystem.maxTilt=Je.degToRad(t)}get bearing(){return a(this,fe).mode==="outdoors-overlay"&&a(this,fe).map?a(this,fe).map?.getBearing():Je.radToDeg(a(this,Fe).cameraSystem.getRotation())}setBearing(r){if(a(this,fe).mode==="outdoors-overlay"&&a(this,fe).map){a(this,fe).map?.setBearing(r);return}a(this,Fe).cameraSystem.setRotation(Je.degToRad(r))}get pitch(){return a(this,fe).mode==="outdoors-overlay"&&a(this,fe).map?a(this,fe).map?.getPitch():Je.radToDeg(a(this,Fe).cameraSystem.getTilt())}setPitch(r){if(a(this,fe).mode==="outdoors-overlay"&&a(this,fe).map){a(this,fe).map?.setPitch(r);return}a(this,Fe).cameraSystem.setTilt(Je.degToRad(Gi(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 a(this,Fe).cameraSystem.getPedestal()}setElevation(r){a(this,Fe).cameraSystem.setPedestal(r,!0)}animateElevation(r,t){return a(this,e0)&&a(this,e0).stop(),new Promise(n=>{a(this,Fe).cameraSystem.animateCamera({position:{z:r}},t?.duration||300,xa[t?.easing||"ease-in-out"],n,n,{interruptible:t?.interruptible??!0})})}get insetsPadding(){return a(this,xs).insetsPadding}get panMode(){return a(this,Fe).cameraSystem.enablePan===!1&&a(this,Fe).cameraSystem.enablePedestal===!0?"elevation":"default"}setPanMode(r){if(r!=="default"&&r!=="elevation")throw new Error("Invalid pan mode");r!==this.panMode&&(r==="default"?(a(this,Fe).cameraSystem.enablePan=!0,a(this,Fe).cameraSystem.enablePedestal=!1):(a(this,Fe).cameraSystem.enablePan=!1,a(this,Fe).cameraSystem.enablePedestal=!0))}setInsetPadding(r){a(this,xs).insetsPadding=Object.assign({},a(this,xs).insetsPadding,r)}animateTo(r){if(a(this,fe).mode==="outdoors-overlay"&&a(this,fe).map)return a(this,fe).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?a(this,fe).convertTo3DMapPosition(r.center[1],r.center[0],r.center[2]||this.elevation):void 0,n=r.zoomLevel!==void 0?a(this,Fe).cameraSystem.convertZoomLevelToAltitude(Gi(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,o=r.bearing!==void 0?Je.degToRad(r.bearing):void 0,i=r.pitch!==void 0?Je.degToRad(Gi(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(s=>{a(this,Fe).cameraSystem.animateCamera({position:t,zoom:n,rotation:o,tilt:i},r.duration||0,xa[r.easing||"ease-in-out"],()=>{a(this,Fe).interactionSystem.handleHover(),s()},s,{interruptible:r?.interruptible??!0})})}getCameraFrameForCoordinates(r,t){let n=z(this,t0,F2).call(this,t||{},()=>Promise.resolve()),{pointCloud:o}=bM(r,a(this,fe),a(this,xs).geometry3DMap);if(o.length===0)return R.error("No valid coordinates found in targets:",r),{center:this.center,zoomLevel:this.zoomLevel};let{center:i,zoomLevel:s}=a(this,Fe).cameraSystem.getCameraFrameForCoordinates(o,n);return{center:a(this,fe).convert3DMapPositionToCoordinate(i),zoomLevel:s}}focusOn(r,t){let{pointCloud:n,geoBounds:o,firstPosition:i}=bM(r,a(this,fe),a(this,xs).geometry3DMap);return n.length===0?(R.error("No valid coordinates found in targets:",r),Promise.resolve()):a(this,fe).mode==="outdoors-overlay"&&a(this,fe).map?(n.length===1&&i?a(this,fe).map?.flyTo({center:[i[0],i[1]],duration:t?.duration||a(this,fe).map.getBearing(),animate:!0,bearing:t?.bearing===void 0?a(this,fe).map.getBearing():t?.bearing,pitch:t?.pitch===void 0?a(this,fe).map.getPitch():t?.pitch,zoom:t?.maxZoomLevel||a(this,fe).map.getMaxZoom()}):(IV&&CV(a(this,fe),o),a(this,fe).map?.fitBounds(o,{duration:t?.duration??Ei.DEFAULT_ANIMATION_DURATION,bearing:t?.bearing===void 0?a(this,fe).map.getBearing():t?.bearing,pitch:t?.pitch===void 0?a(this,fe).map.getPitch():t?.pitch,maxZoom:t?.maxZoomLevel??a(this,fe).map.getMaxZoom()})),a(this,Fe).interactionSystem.handleHover(),Promise.resolve()):new Promise(s=>{a(this,Fe).cameraSystem.focusOn(n,z(this,t0,F2).call(this,t||{},s))})}};fe=new WeakMap,Fe=new WeakMap,xs=new WeakMap,e0=new WeakMap,t0=new WeakSet,F2=function(r,t){return{minZoom:r?.maxZoomLevel===void 0?void 0:a(this,Fe).cameraSystem.convertZoomLevelToAltitude(Gi(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:a(this,Fe).cameraSystem.convertZoomLevelToAltitude(Gi(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({},_h,r?.padding):this.insetsPadding,curve:xa[r?.easing||"ease-in-out"],rotation:r?.bearing===void 0?void 0:Je.degToRad(r.bearing),tilt:r?.pitch!==void 0?Je.degToRad(Gi(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:()=>{a(this,Fe).interactionSystem.handleHover(),t()},cancelledCallback:t,interruptible:r?.interruptible??!0,verticalPadding:r?.verticalPadding}};function w2(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 bM(e,r,t){let n=[],o=[1/0,1/0,-1/0,-1/0],i=null;if(!e||!Array.isArray(e)||e.length===0)return{pointCloud:n,geoBounds:o,firstPosition:i};let s=r.getSystems().renderSystem;for(let u of e)if(typeof u=="string"){(s.threeDdirty||s.twoDdirty)&&r.renderSync();let l=t.get(u);if(!l){R.error("Entity not found with id:",u);continue}let c=new dr;R6(r,"userData"in l?l.userData.entityId??l.id:l.id,n,c,l instanceof yr?l.position.z:void 0);let d=r.convert3DMapPositionToCoordinate(c.min),f=r.convert3DMapPositionToCoordinate(c.max);w2(o,d),w2(o,f),i||(i=r.convert3DMapPositionToCoordinate(c.getCenter(new ie)))}else n.push(r.convertTo3DMapPosition(u[1],u[0],u[2]||0)),w2(o,u),i||(i=u);return{pointCloud:n,geoBounds:o,firstPosition:i}}function CV(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}})}p();p();var vM=`uniform vec4 uSize;
12
+ Pos: ${n.position?.toArray().join(", ")}`,"#caffbf")})}get _state(){return this.state}queueDebugMessage(t,n){let o=document.createElement("pre");o.style.maxWidth="300px",o.style.transition="opacity 500ms cubic-bezier(0.4, 0, 0.2, 1)",o.style.backgroundColor=n,o.textContent=t,this.debugPanel?.prepend(o),setTimeout(()=>{o.style.opacity="0",setTimeout(()=>{o.remove()},500)},2500)}getCursor(){return this.cursor}};Ed=new WeakMap;function tM(e,r,t){let n=e.components[2];n&&n.hover!==!0&&(n.hover=r?"user-interaction":!1,n.dirty=!0);let o=e.components[0].textMesh?.userData.entityId;if(!o)return;let i=t.geometry3DMap.get(o);i?.type==="text3d"&&(i.components[1].hoverByPolygon=r,i.components[1].dirty=!0)}function Uz(e,r,t){return r?"grabbing":e?"pointer":t?"grabbing":"grab"}function Gz(e){let r=e;for(;r?.parent;){if(r instanceof Gs)return;if(r.userData.isSingleModel)return r;r=r.parent}}function zz(e,r){let t=Gz(e);return t?r.get(t.userData.entityId):void 0}p();p();var jl,ba,p1,xu,rM,$f,d1,nM,oM,jf,m1,Uf,Gf,f1,Nf=class{constructor(r){C(this,xu);C(this,jl,null);C(this,ba);m(this,"getCurrentSceneGLTF",async r=>{let t={onlyVisible:!0,binary:!0,light:!0,scale:1,...r},n=await z(this,xu,rM).call(this),o=a(this,p1).call(this,t),i=await n.parseAsync(o,{trs:!1,maxTextureSize:1/0,onlyVisible:t.onlyVisible,binary:t.binary,scale:t.scale}),s;if(i instanceof ArrayBuffer)s=new Blob([i],{type:"application/octet-stream"});else{let u=JSON.stringify(i,null,2);s=new Blob([u],{type:"text/plain"})}return s});C(this,p1,r=>{let{scale:t,light:n,onlyVisible:o}=r,i=new Gs,s=new dr().setFromObject(a(this,ba).entityScene);if(a(this,$f).call(this,a(this,ba).entityScene,i,o),n){let u=new Ah(16777215,.3*Math.PI);u.position.set(0,Math.max(s.max.x,s.max.y)*t*.5,s.max.y*t*4),u.lookAt(0,0,-1),u.target.position.set(0,0,-1),u.add(u.target),i.add(u)}return i});C(this,$f,(r,t,n)=>{r.material&&(r instanceof wh?z(this,xu,nM).call(this,r).forEach(o=>t.add(o)):r instanceof am&&t.add(z(this,xu,oM).call(this,r))),r.children.forEach(o=>{(!n||o.visible)&&a(this,$f).call(this,o,t,n)})});C(this,d1,(r,t,n)=>{let o=new sm({color:new ar(r),metalness:0});return o.opacity=t,o.transparent=n,o});C(this,jf,r=>{let{geometry:t,material:n,position:o,rotation:i,quaternion:s,scale:u}=r;if(!t?.isBufferGeometry)return r;let l=t.attributes.position,c=t.attributes.normal,d=t.attributes.uv;return a(this,m1).call(this,l,c),a(this,Gf).call(this,o,u,i,s),d&&a(this,f1).call(this,d),n?.map&&t.type==="PlaneGeometry"&&(r.side=ka),r});C(this,m1,(r,t)=>{let n=new ie,o=new ie;for(let i=0;i<r.count;i++)n.fromBufferAttribute(r,i),a(this,Uf).call(this,n),r.setXYZ(i,n.x,n.y,n.z),t&&(o.fromBufferAttribute(t,i),a(this,Uf).call(this,o),t.setXYZ(i,o.x,o.y,o.z))});C(this,Uf,r=>{let t=r.y;r.y=r.z,r.z=-t});C(this,Gf,(r,t,n,o)=>{let i=r.y;r.y=r.z,r.z=-i;let s=t.y;if(t.y=t.z,t.z=s,n instanceof bc)n.order="YXZ",n.set(n.x,n.y,n.z,n.order);else{let u=o.y;o.set(o.x,o.z,-u,o.w)}});C(this,f1,r=>{for(let t=0;t<r.count;t++){let n=r.getX(t),o=r.getY(t);r.setXY(t,n,o)}});T(this,ba,r),a(this,ba).entityScene=r.entityScene,a(this,ba).geometry3DMap=r.geometry3DMap}destroy(){T(this,jl,null)}};jl=new WeakMap,ba=new WeakMap,p1=new WeakMap,xu=new WeakSet,rM=async function(){if(!a(this,jl)){let{GLTFExporter:r}=await import("./GLTFExporter-SP6DUMPM.js");T(this,jl,new r)}return a(this,jl)},$f=new WeakMap,d1=new WeakMap,nM=function(r){let t=[],o=(r.userData?.entities?Object.values(r.userData?.entities):[]).map(s=>a(this,ba).geometry3DMap.get(s)),i=new Map;return o.forEach(s=>{if(!s||!(s instanceof ft))return;let u=s.components[1],l=s.components[2];if(!u.visible||u instanceof Wi&&u.opacity===0||u instanceof hm||u instanceof $h)return;let d=`${l?.hover?u.hoverColor||a(this,ba).hoverColor:u.color}-${u.opacity}-${Number(u.visible)}`;i.has(d)||i.set(d,[]),i.get(d)?.push(s)}),i.forEach((s,u)=>{let[l,c,d]=u.split("-"),f=s.reduce((E,v)=>{if(v.type==="custom-geometry")return E;let x=v.components[0];return"geometry"in x&&x.geometry instanceof Sh&&E.push(x.geometry),E},[]),h=a(this,d1).call(this,l,Number(c),r.material.transparent),b=bo(f,!0),I=new Pe(b,h);I.position.copy(r.position),I.rotation.copy(r.rotation),I.scale.copy(r.scale),I.visible=!!d,a(this,Gf).call(this,I.position,I.scale,I.rotation,I.quaternion),t.push(a(this,jf).call(this,I))}),t},oM=function(r){let t=r.geometry.clone(),n=r.material,o=new gr({color:n.color,side:ka});o.opacity=n.opacity,o.transparent=n.transparent;let i=new am(t,o);return i.position.copy(r.position),i.rotation.copy(r.rotation),i.scale.copy(r.scale),i.visible=r.visible,a(this,jf).call(this,i)},jf=new WeakMap,m1=new WeakMap,Uf=new WeakMap,Gf=new WeakMap,f1=new WeakMap;p();p();var Vz="gray",Hz=.1,zf=100,m2=new Zi.ClipperOffset;function Zz(e,r){m2.Clear(),r/=2;let t=e.map(o=>({X:o.x*zf,Y:o.y*zf}));m2.AddPath(t,Zi.JoinType.jtMiter,Zi.EndType.etClosedPolygon);let n=new Zi.Paths;return m2.Execute(n,r*zf),n.length?n.map(i=>i.map(s=>({x:s.X/zf,y:s.Y/zf}))):[e]}function g1(e,r,t){let{color:n=Vz,opacity:o=1,altitude:i=0,height:s=Hz}=t||{};Array.isArray(o)&&(o=1);let u={min:{x:1/0,y:1/0,z:i},max:{x:-1/0,y:-1/0,z:s+i},center:{x:0,y:0,z:(s+i)/2}},c=e.geometry.coordinates[0].map(b=>{let I=r(b[1],b[0]);return u.min.x=Math.min(u.min.x,I.x),u.min.y=Math.min(u.min.y,I.y),u.max.x=Math.max(u.max.x,I.x),u.max.y=Math.max(u.max.y,I.y),I});e.properties?.style?.edgeOffset!=null&&e.properties.style.edgeOffset!==0||e.properties?.image!=null?c=Zz(c,e.properties?.style?.edgeOffset||0):c=[c];let d=[];for(let b of c){let I=new xc;I.moveTo(b[0].x,b[0].y),b.slice(1).forEach(D=>I.lineTo(D.x,D.y)),I.lineTo(b[0].x,b[0].y);let E=e.geometry.coordinates.slice(1);I.holes=E.map(D=>{let w=D.map(F=>r(F[1],F[0])),S=new vc;return S.moveTo(w[0].x,w[0].y),w.slice(1).forEach(F=>S.lineTo(F.x,F.y)),S.lineTo(w[0].x,w[0].y),S});let v=mm(t?.bevel,s),x=new Ic(I,v);x.userData={style:{color:n,opacity:o},usedBevelSettings:v},d.push(x)}if(d.length===1)return d[0];let f=bo(d);d.forEach(b=>b.dispose());let h=mm(t?.bevel,s);return f.userData={style:{color:n,opacity:o},usedBevelSettings:h,_split:!0},f}p();var Wz="gray",Xz=.1;function y1(e,r,t){let{color:n=Wz,opacity:o=1,altitude:i=0,height:s=Xz}=t||{};Array.isArray(o)&&(o=1);let u={min:{x:1/0,y:1/0,z:i},max:{x:-1/0,y:-1/0,z:s+i}},l=mm(t?.bevel,s),c=[];e.geometry.coordinates.forEach(f=>{let h=new xc,b=f[0].map(v=>{let x=r(v[1],v[0]);return u.min.x=Math.min(u.min.x,x.x),u.min.y=Math.min(u.min.y,x.y),u.max.x=Math.max(u.max.x,x.x),u.max.y=Math.max(u.max.y,x.y),x});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 I=f.slice(1);h.holes=I.map(v=>{let x=v.map(w=>r(w[1],w[0])),D=new vc;return D.moveTo(x[0].x,x[0].y),x.slice(1).forEach(w=>D.lineTo(w.x,w.y)),D.lineTo(x[0].x,x[0].y),D});let E=new Ic(h,l);c.push(E)});let d=bo(c);return c.forEach(f=>f.dispose()),d.translate(0,0,i||0),d.userData={style:{color:n,opacity:o},usedBevelSettings:l},d}p();var In=100,Jz=.22,Yz=.01;function iM(e,r,t={}){let{width:n=Jz,height:o=Yz,color:i="gray",opacity:s=1,altitude:u=0}=t,l={min:{x:1/0,y:1/0,z:u},max:{x:-1/0,y:-1/0,z:u+o}},c={bevelEnabled:!1,depth:o},d=new Zi.ClipperOffset,f=e.geometry.coordinates.map(E=>E.map(v=>r(v[1],v[0])));d.AddPaths(f.map(E=>E.map(v=>({X:v.x*In,Y:v.y*In}))),Zi.JoinType.jsMiter,Zi.EndType.etOpenRound);let h=new Zi.PolyTree;d.Execute(h,n/2*In);let b=[];for(let E of h.m_AllPolys){let v=new xc;if(E.IsHole())continue;l.min.x=Math.min(l.min.x,E.m_polygon[0].X),l.min.y=Math.min(l.min.y,E.m_polygon[0].Y),l.max.x=Math.max(l.max.x,E.m_polygon[0].X),l.max.y=Math.max(l.max.y,E.m_polygon[0].Y);let x=E.m_polygon;v.moveTo(x[0].X/In,x[0].Y/In),x.slice(1).forEach(D=>v.lineTo(D.X/In,D.Y/In)),v.lineTo(x[0].X/In,x[0].Y/In),v.holes=E.m_Childs.map(D=>{let w=new vc,S=D.m_polygon;return w.moveTo(S[0].X/In,S[0].Y/In),S.slice(1).forEach(F=>w.lineTo(F.X/In,F.Y/In)),w.lineTo(S[0].X/In,S[0].Y/In),w}),b.push(new Ic(v,c))}let I=bo(b);return I.translate(0,0,u||0),I.userData={style:{color:i,opacity:s}},d.Clear(),I}p();p();import{z as b1}from"zod";var Cd=b1.object({type:b1.enum(["Point"]),coordinates:b1.array(b1.number()).min(2).max(3)});import{z as At}from"zod";var f2=At.object({rotation:At.array(At.number()).length(3).optional(),altitude:At.number().optional(),scale:At.array(At.number()).length(3).optional(),interactive:At.boolean().optional(),verticalOffset:At.number().optional(),id:At.union([At.number(),At.string()]).optional()}),Kz=At.object({type:At.enum(["Feature"]),geometry:Cd,properties:f2}),qz=At.object({type:At.enum(["FeatureCollection"]),features:At.array(Kz)}),h2=At.object({color:At.string()}),Qz=At.object({url:At.string(),color:At.string().optional(),opacity:At.number().optional(),material:At.record(At.string(),h2).optional()});function sM(e,r,t){At.union([At.number(),At.string()]).parse(e),qz.parse(r),Qz.parse(t)}var Vf,Hf,Zf,Sd,xi,Iu=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);C(this,Vf,!0);m(this,"color",new ar);m(this,"clippingPlane");m(this,"position",new ie);C(this,Hf,0);C(this,Zf,1);C(this,Sd,yo.GEOMETRY);C(this,xi,!1);this.feature=r}get visible(){return this.mesh?.visible??a(this,Vf)}set visible(r){T(this,Vf,r),this.mesh&&(this.mesh.visible=r)}setOpacity(){}setColor(){}get altitude(){return a(this,Hf)}set altitude(r){this.mesh&&(this.mesh.position.z=r,T(this,Hf,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(Je.degToRad(r[0]),Je.degToRad(r[1]),Je.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 a(this,Zf)}set opacity(r){if(this.mesh){if(this.mesh.children[0]instanceof ji){for(let t of this.mesh.children)if(t instanceof ji){t.userData?.originalOpacity===void 0&&(t.userData.originalOpacity=t.material.opacity);let n=Gu(r,0,t.userData?.originalOpacity,0,1);t.material.opacity=n,t.material.transparent=n<1,t.material.needsUpdate=!0}}else this.mesh?.traverse(t=>{t instanceof Pe&&t.material&&(Array.isArray(t.material)?t.material.forEach(n=>{aM(n,r)}):aM(t.material,r))});T(this,Zf,r)}}get renderOrder(){return a(this,Sd)}set renderOrder(r){if(!(!this.mesh||r===a(this,Sd)))if(T(this,Sd,r),this.mesh.children[0]instanceof ji){this.mesh.renderOrder=r;for(let t of this.mesh.children)t instanceof ji&&(t.material.depthWrite=!a(this,xi),t.material.depthTest=!a(this,xi),t.material.needsUpdate=!0)}else this.mesh?.traverse(t=>{t instanceof Pe&&t.material&&(t.renderOrder=r,Array.isArray(t.material)?t.material.forEach(n=>{n.depthWrite=!a(this,xi),n.depthTest=!a(this,xi),n.needsUpdate=!0}):(t.material.depthWrite=!a(this,xi),t.material.depthTest=!a(this,xi),t.material.needsUpdate=!0))})}get visibleThroughGeometry(){return a(this,xi)}set visibleThroughGeometry(r){T(this,xi,r)}};Vf=new WeakMap,Hf=new WeakMap,Zf=new WeakMap,Sd=new WeakMap,xi=new WeakMap;function aM(e,r){e.opacity!==r&&(r===1?(e.opacity=1,e.transparent=!1):(e.opacity=r,e.transparent=!0),e.needsUpdate=!0)}p();function v1(e){let r=e.components[0],t=e.components[1];t.opacity!=null&&t.opacity!==r.opacity&&(r.opacity=t.opacity);let n=t.material,o=t.color;if(n||o){let u=eV(o,n);r.mesh?.traverse(l=>{l instanceof Pe&&l.material&&(Array.isArray(l.material)?l.material.forEach(c=>{u[c.name]?(c.color.set(u[c.name].color),c.vertexColors=!1):c.color.set(o)}):u[l.material.name]?(l.material.color.set(u[l.material.name].color),l.material.vertexColors=!1):l.material.color.set(o))})}let i=r.feature.geometry.coordinates[2]??0,s=t.verticalOffset+i;r.altitude!==s&&(r.altitude=s),t.visible!==r.visible&&(r.visible=t.visible),t.rotation&&r.setRotation(t.rotation),t.scale&&r.setScale(t.scale),t.visibleThroughGeometry!==r.visibleThroughGeometry&&(r.visibleThroughGeometry=t.visibleThroughGeometry)}function eV(e,r){let t={};if(r)for(let n in r)r[n].color&&(t[n]={color:r[n].color});if(e){let n=["Default","Fabric","Mpdn_Logo","CouchLogo"];for(let o of n)t[o]||(t[o]={color:e})}return t}function uM(e,r){let t=e.components[0],o=e.components[1].verticalOffset??0,i=t.feature.geometry.coordinates.slice();i[2]=(i[2]??0)+o,t.mesh?t.mesh.position.copy(r(i)):t.position.copy(r(i))}function vs(e){return e instanceof sr?e.material:null}function lM(e){return e.side===om?"back":e.side===$u?"front":"double"}function cM(e,r){e.side=r==="back"?om:r==="front"?$u:ka}function tV(e){let{color:r,opacity:t,topColor:n,texture:o,topTexture:i}=e;return`${r}${t}${n||""}${o||""}${i||""}`}var x1=class extends Oe{constructor(t,n){super();m(this,"state");m(this,"convertTo3DMapPosition");m(this,"loader");m(this,"optimizePromise",[]);this.state=t,this.convertTo3DMapPosition=n}async getGLTFLoader(){if(this.loader)return this.loader;let{GLTFLoader:t}=await import("./GLTFLoader-EN5T7GIO.js");return this.loader=new t,this.loader}createEntityFromFeature(t,n,o){let i=new sr(n),s=n?.properties?.bevel,u=o&&"bevel"in o?o.bevel:void 0,l;u?l={...s,...u}:s&&(l=s);let c=new ft(i,new Wi({...o,url:n.properties?.image?.path,bevel:l}));return o?.outline&&(c.components[3]=new eE(nE(o.color))),o?.focusable&&(c.components[4]=new gm),n.properties?.textures!=null&&Array.isArray(n.properties.textures)&&n.properties.textures.length>0?c.components[6]=new Vu(n.properties.textures.find(d=>d.face==="side"),n.properties.textures.find(d=>d.face==="top")):(o!=null&&"texture"in o&&o.texture!=null||o!=null&&"topTexture"in o&&o.topTexture!=null)&&(c.components[6]=new Vu(o.texture,o.topTexture)),c.id=t,c}createModelFromFeature(t,n,o){let i=new Iu(n),s={...o};n.properties.verticalOffset!=null&&(s.verticalOffset=n.properties.verticalOffset),n.properties.rotation!=null&&(s.rotation=n.properties.rotation),n.properties.scale!=null&&(s.scale=n.properties.scale);let u=new $h(s),l=new ft(i,u);return l.id=t,l}populateEntityMesh(t,n){let o=t.components[0];o.geometry=n,o.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:n.attributes.position.count},o.currentHeight=t.components[1].height,o.dirty=!1}async populateModelGroup(t,n,o){let i=new Wn,s=new bc,u=new Ch,l=new ie,c=new zs,d=await this.getGLTFLoader(),f=new Promise(h=>{let b=E=>{"entities3D"in o.userData&&(o.userData.entities3D.size>1?E.scene.traverse(v=>{let x=v;if("isMesh"in x&&x.isMesh===!0){let D=new ji(x.geometry,x.material,t.size);D.userData={entities:{}},c.add(D),o.add(c)}}):(E.scene.traverse(v=>{"isMesh"in v&&v.isMesh===!0&&(v.position.set(0,0,0),v.rotation.set(0,0,0),v.scale.set(1,1,1),v.updateMatrix())}),c.add(E.scene),o.add(c),c.userData.isSingleModel=!0,c.userData.entityId=t.values().next().value,c.userData.type="model")),h()};if(n.trimStart().startsWith("{")||n.startsWith("data:")&&n.includes("application/json")){let E=n.startsWith("data:")?atob(n.split(",")[1]):n;d.parse(E,"",b)}else d.load(n,b)});return this.optimizePromise.push(f.then(()=>{let h=0,b;for(let I of t.values()){if(b=this.state.geometry3DMap.get(I),!b||b?.type!=="model")continue;let E=b.components[0],v=b.components[1],x=b.components[0].feature;E.mesh=c,E.instanceIndex=h,v1(b),b.components[1].dirty=!1;let{x:D,y:w}=this.convertTo3DMapPosition(x.geometry.coordinates[1],x.geometry.coordinates[0],0);E.position.set(D,w,E.altitude),s.set(Je.degToRad(v.rotation?.[0]??Ac[0]),Je.degToRad(v.rotation?.[1]??Ac[1]),Je.degToRad(v.rotation?.[2]??Ac[2])),l.set(v.scale?.[0]??Mc[0],v.scale?.[1]??Mc[1],v.scale?.[2]??Mc[2]),u.setFromEuler(s),i.compose(E.position,u,l),c.children.forEach(S=>{!b||b?.type!=="model"||!(S instanceof ji)||(S.setMatrixAt(h,i),S.userData.entities[h]=b.id)}),E.mesh.userData.isSingleModel&&(E.mesh.matrix.copy(i),E.mesh.matrix.decompose(E.mesh.position,E.mesh.quaternion,E.mesh.scale)),h++}this.publish("model-loaded")})),c}populateEntityGroup(t){let n,o,i,s;for(let u of t.values())s=this.state.geometry3DMap.get(u),s.components[0]instanceof sr&&(o=s.components[0].feature,i=s.components[1],o.geometry.type==="Polygon"?(n=g1(o,this.convertTo3DMapPosition,i),o.properties?.textures&&o.properties.textures.length>0&&oE(n,o.properties.textures,this.state.naturalBearing,this.convertTo3DMapPosition),this.populateEntityMesh(s,n)):o.geometry.type==="MultiPolygon"?(n=y1(o,this.convertTo3DMapPosition,i),this.populateEntityMesh(s,n)):o.geometry.type==="LineString"?(n=DE(o,this.convertTo3DMapPosition,i),this.populateEntityMesh(s,n)):o.geometry.type==="MultiLineString"&&(n=iM(o,this.convertTo3DMapPosition,i),this.populateEntityMesh(s,n)));return t}update(){for(let t of this.state.geometryGroupIdsToLoad.values()){let n=this.state.geometry3DMap.get(t);if(n instanceof ei&&n.userData.dirty){if(n.userData.modelURL)n.userData.modelURL&&(this.populateModelGroup(n.userData.entities3D,n.userData.modelURL,n),n.userData.dirty=!1);else try{this.populateEntityGroup(n.userData.entities3D)}catch(s){R.warn(s)}let o,i={};for(let s of n.userData.entities3D.values()){o=this.state.geometry3DMap.get(s);let u=o?.components[0];if(o?.type==="geometry"){let l=o.components[1],c=tV(l);i[c]===void 0&&(i[c]={style:l,entities:[]}),i[c].entities.push(o)}else u&&"mesh"in u&&u.mesh&&u.mesh?.parent!==n&&n.add(u.mesh)}for(let s in i){let u=rE(i[s].entities,i[s].style);n.add(u)}for(let s of n.userData.entities3D.values())if(o=this.state.geometry3DMap.get(s),o!=null&&o.entities2D.size>0)for(let u of o.entities2D.values())u&&(o.attach(u),this.publish("geometry-2d-added"));this.publish("geometry-group-added"),n.userData.dirty=!1}}return Promise.resolve()}};p();var I1=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 n=r.components[0];(!n.enabled||!n.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 n=r.components[0];n instanceof Na&&n.enabled&&n.markerContainer&&!this.domTree.contains(n.markerContainer)&&(n.markerContainer.userData={entityId:r.id},this.domTree.appendChild(n.markerContainer),n.updateDimensions())}this.dirty=!1}}};p();var E1=class{constructor(r,t){m(this,"state");m(this,"project");this.state=r,this.project=t}update(){let r,t=0,n=0,o,i;for(let s of this.state.geometry2DIdsInScene)if(r=this.state.geometry2DMap.get(s),r){i=r.components[0];let u=r.attachedTo?this.state.geometry3DMap.get(r.attachedTo):void 0;if(u instanceof ft)if(this.state.geometry3DIdsInScene.has(u.id)){o=u.components[1],i=r.components[0],(o.dirty||r.components[0].attachedDirty)&&(t=o.height,n=o.altitude,r.setAltitude(t+n));let l=o.visible;i.visible!==l&&(i.visible=l)}else i.visible===!0&&(i.visible=!1);this.project(r.components[0].projection,r.position),r.components[0].attachedDirty=!1}}};p();p();p();var rV=function(){let r,t;return n=>{if((!t||!t)&&(r=document.createElement("canvas"),r.width=500*n,r.height=500*n,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}}}(),pM=({text:e,size:r,maxWidth:t,pixelRatio:n,maxLines:o=2,lineHeight:i=1.2,options:s={strokeText:!0}})=>{let u=`bold ${r*n}px 'InterUI-Regular', Helvetica Neue, Arial, sans-serif`,{measureCanvasContext:l}=rV(n);l.font=u;let c=[],d=e.split(" "),f=0,h=0,b=0;for(;h<d.length;){let x=d[h];if(f===o&&f>0){c[f-1]+="...";break}if(c[f]==null&&(c[f]=x,h++),d.length===1){c[f]=x;break}if(d[h]==null)break;let{width:D}=l.measureText(c[f]+" "+d[h]);D<=t*n?(c[f]+=" "+d[h],h++):f++}c.forEach(x=>{let{width:D}=l.measureText(x);b=Math.max(D,b)});let I=r*n*i,E=c.length*I;return{maxWidth:b,maxHeight:E,lines:c.length,draw:(x,D,w)=>{c.length===1?(s.strokeText&&x.strokeText(c[0],D,w),x.fillText(c[0],D,w)):(s.strokeText&&(x.strokeText(c[0],D,w-I/2),x.strokeText(c[1],D,w+I/2)),x.fillText(c[0],D,w-I/2),x.fillText(c[1],D,w+I/2))}}};p();function dM(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 C1=class extends Oe{constructor(t,n,o){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 n=this.state.pixelRatio;this.colliderContext.clearRect(0,0,this.colliderCanvas.width,this.colliderCanvas.height);let o,i,s,u,l,c,d;for(let f of this.state.geometry2DIdsInScene)if(d=this.state.geometry2DMap.get(f),d!=null&&(c=d.components[0],c instanceof Ra&&!d.disposed)){if(l=c.appearance.iconVisible,c.appearance.icon!=null&&l!=null){let b=typeof l=="boolean"?l:t>=l;b!==c.iconVisible&&(c.iconVisible=b,c.dirty=!0)}if((c.dirty||this.dirty)&&c.calculatePinSize(),i={active:c.appearance.pinColor,inactive:c.appearance.pinColorInactive},s={active:c.appearance.pinOutlineColor,inactive:c.appearance.pinOutlineColorInactive},u=zi(c.pinSize,2),o=`${i.active}-${i.inactive}-${s.active}-${s.inactive}-${u}-${c.iconVisible}`,c.labelCacheId=o,(!this.pinCache[o]||this.dirty)&&(this.prepare(c,o,this.colliderContext),c.dirty=!0),(c.appearance.icon&&(!c.imageHash||c.pinDirty)||this.dirty)&&this.cacheImage(c),this.textCache[c.id]==null||c.textDirty||this.dirty){c.dirty=!0,this.textCache[c.id]={};let{textDrawFn:b,width:I,height:E}=this.processText(c.text,c.appearance.textSize,c.appearance.maxWidth,c.appearance.maxLines,c.appearance.lineHeight);["left","center","right"].forEach(v=>{this.textCache[c.id][v]=this.textToCanvas(b,c.appearance.textSize,v,I,E,c.appearance.textColor,c.appearance.textOutlineColor)}),c.dimensions={width:Math.ceil(I/n),height:Math.ceil(E/n)}}let h=1;if(c.appearance.iconScale)if(typeof c.appearance.iconScale=="number")h=c.appearance.iconScale;else{let{on:b,input:I,output:E,easing:v}=c.appearance.iconScale;b==="zoom-level"?h=x6(t,I,E,v??"linear"):R.warn(`Unsupported interpolation property: ${b}`)}c.recomputeCurrentStrategy(c.iconVisible?h:1),c.canShow&&c.visible&&(c.enabled||c.visibilityNeedsUpdate!==!1)&&this.draw(c,o,this.colliderContext),c.textDirty=!1,c.pinDirty=!1}this.dirty=!1});m(this,"processText",(t,n,o,i,s)=>{let u=this.state.pixelRatio,{draw:l,maxWidth:c,maxHeight:d}=pM({text:t,size:n,pixelRatio:u,maxWidth:o,maxLines:i,lineHeight:s});return{textDrawFn:l,width:c+2.5*u*2,height:d+2.5*u*2}});m(this,"textToCanvas",(t,n,o,i,s,u,l)=>{let c=this.state.pixelRatio,d,f=i,h=s;window.OffscreenCanvas!=null&&!N6()?d=new OffscreenCanvas(f,h):(d=document.createElement("canvas"),d.width=f,d.height=h,d.style.width=f+"px",d.style.height=h+"px");let b=d.getContext("2d",{willReadFrequently:!0});if(!b)return;let I=2.5*c;b.textAlign=o,b.font=`bold ${n*c}px 'InterUI-Regular', Helvetica Neue, Arial, sans-serif`,b.textBaseline="middle",b.lineJoin="miter",b.miterLimit=2,b.strokeStyle="white",b.lineWidth=I,b.fillStyle=u,b.strokeStyle=l;let E=o==="left"?I/2:o==="center"?f/2:f-I/2;return t(b,E,(h+I/2)/2),d});m(this,"cacheImage",t=>{if(!t.appearance.icon)return;let n=V6(t.appearance.icon);this.imagePromiseCache[n]||(this.imagePromiseCache[n]=new Promise(o=>{this.transformRequest(t.appearance.icon).then(i=>{let s=dM(i.url);s.onload=()=>{this.imageCache[n]=s,this.publish("img:loaded"),o(s)}})})),t.imageHash!==n&&(t.imageHash=n,this.imagePromiseCache[n].then(()=>{t.dirty=!0}))});m(this,"createPinCanvas",(t,n,o,i,s=1)=>{let u,l=this.state.pixelRatio,c=t.totalPinSize*2*l*s;window.OffscreenCanvas!=null?u=new OffscreenCanvas(c,c):(u=document.createElement("canvas"),u.width=c,u.height=c,u.style.width=c/l+"px",u.style.height=c/l+"px");let d=u.getContext("2d");return d.shadowColor="rgba(0,0,0,0.3)",d.shadowOffsetY=2*l,d.shadowBlur=5*l,d.beginPath(),d.arc(c/2,c/2,(n/2+2.5*l/2)*s,0,2*Math.PI),d.fillStyle=o,d.fill(),d.beginPath(),d.arc(c/2,c/2,n/2*s,0,2*Math.PI),d.shadowColor="transparent",d.fillStyle=i,d.fill(),u});m(this,"prepare",(t,n,o)=>{let i=this.state.pixelRatio;o.lineWidth=4*i;let s=typeof t.appearance.iconScale=="number"?[t.appearance.iconScale]:t.appearance.iconScale==null?[]:t.appearance.iconScale.output,u=s.length>0?Math.max(...s):void 0,l=this.createPinCanvas(t,t.pinSize,t.appearance.pinOutlineColor,t.appearance.pinColor,u),c=this.createPinCanvas(t,3.5*i,t.appearance.pinOutlineColorInactive,t.appearance.pinColorInactive,u);this.pinCache[n]=[l,c]});this.state=t,this.colliderCanvas=n,this.colliderContext=n.getContext("2d"),this.transformRequestFunc=o}draw(t,n,o){if(!t.canShow||!t.visible)return;o.save(),o.globalAlpha=t.currentOpacity;let i=this.state.pixelRatio,s=t.projection.x*i,u=t.projection.y*i,l=t.style.pinVisibility===1?this.pinCache[n][0]:this.pinCache[n][1],c=t.style.pinVisibility===1?t.scaledPinSize*i:t.totalPinSize*i;if(t.style.pinVisibility!==0&&o.drawImage(l,s-c,u-c,c*2,c*2),t.appearance.icon&&t.iconVisible&&t.imageHash&&t.appearance.iconSize&&this.imageCache[t.imageHash]&&t.style.pinVisibility===1){let d=this.imageCache[t.imageHash],f=(t.scaledPinSize-t.scaledIconPadding)*i,h=t.appearance.iconFit,b=f,I=f,E=`${t.imageHash}_${h}`;if(this.imageDimensionsCache[E])b=this.imageDimensionsCache[E].width,I=this.imageDimensionsCache[E].height;else{let v=d.width*i,x=d.height*i;if(h==="contain"){let D=Math.sqrt(v**2+x**2),w=f/D;b=v*w,I=x*w}if(h==="cover"){let D=f/v,w=f/x,S=Math.max(D,w);b=v*S,I=x*S}}o.save(),o.beginPath(),o.arc(s,u,f/2,0,2*Math.PI),o.closePath(),t?.appearance?.iconOverflow!=="visible"&&o.clip(),o.drawImage(d,s-b/2,u-I/2,b,I),o.restore()}t.style.textLabelVisible&&t.style.textAlign!=null&&t.style.left!=null&&t.style.top!=null&&o.drawImage(this.textCache[t.id][t.style.textAlign],s+t.style.left*i,u+t.style.top*i),o.restore()}};p();function sV(e,r){let t=e.components[2],n=e.components[1];return t?.hover?[n.hoverColor||r,n.hoverColor||r]:[n.color,n.topColor||n.color]}var S1=class{constructor(r,t){m(this,"state");m(this,"convertTo3DMapPosition");this.convertTo3DMapPosition=t,this.state=r}determineTextureVisiblity(r,t,n){let o=vs(r);(o?.texture!=null||o?.topTexture!=null)&&(n?.hover&&o.texturesVisible?o.hideTextures(r.instanceIndex):o.texturesVisible||o.showTextures(r.instanceIndex),t.texture==null&&o.removeSideTexture(r.instanceIndex),t.topTexture==null&&o.removeTopTexture(r.instanceIndex))}update(){let r,t,n;for(let o of this.state.geometry3DIdsInScene)if(n=this.state.geometry3DMap.get(o),n&&(n.type==="geometry"||n.type==="custom-geometry")&&(n.components[1]?.dirty||n.components[2]?.dirty)){let i=n.components[0],s=n.components[1];t=n.components[2];let u=sV(n,this.state.hoverColor);i.setColor(u[0],u[1]);let l=vs(i);if(s.visible!==i.visible&&(i.visible=s.visible,i instanceof sr&&i.textMesh)){let d=this.state.geometry3DMap.get(i.textMesh.userData.entityId);d?.type==="text3d"&&d.components[0].polygonEntityId!=null&&(d.components[0].visible=s.visible)}s.altitude!==i.altitude&&(i.altitude=s.altitude);let c=s.opacity*wc(n);if(c!==i.opacity&&(i.opacity=c),s.renderOrder!==i.renderOrder&&(i.renderOrder=s.renderOrder),l&&s.side!==lM(l)&&cM(l,s.side),i instanceof sr&&s.shading!=null&&(s.shading?.start!==vs(i)?.getGradientShading().start||s.shading?.end!==vs(i)?.getGradientShading().end||s.shading?.intensity!==vs(i)?.getGradientShading().intensity)&&vs(i)?.setGradientShading(s.shading?.start??0,s.shading?.end??0,s.shading?.intensity??0),s.dirty=!1,i instanceof sr){let d=n.components[6];d instanceof Vu&&this.determineTextureVisiblity(i,d,t)}n.components[2]&&(n.components[2].dirty=!1)}else if(n?.type==="model")n.components[1].dirty&&(v1(n),n.components[1].dirty=!1),n.components[0].positionDirty&&(uM(n,this.convertTo3DMapPosition),n.components[0].positionDirty=!1);else if(n?.type==="image"&&n.components[1]?.dirty){r=n.components[0];let i=n.components[1];i.visible!==r.visible&&(r.visible=i.visible),i.dirty=!1}else if(n?.type==="text3d"&&n.components[1]?.dirty&&n.components[0].polygonEntityId!=null){r=n.components[0];let i=n.components[1];i.visible!=null&&i.visible!==r.visible&&(r.visible=i.visible);let{textMesh:s}=r;if(s){Object.assign(s,i.getState());let u=i.hoverColor??this.state.text3dHoverColor;s.color=i.hoverByPolygon?u:i.color??Fc.color,s.outlineColor=i.hoverByPolygon?u:i.outlineColor??Fc.outlineColor,s.strokeColor=i.hoverByPolygon?u:i.strokeColor??Fc.strokeColor}i.dirty=!1}}};p();var D1=class extends Oe{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,n;for(let o of this.state.geometry2DIdsInScene)t=this.state.geometry2DMap.get(o),t&&(n=t.components[0],n instanceof Ra&&(n.visibilityNeedsUpdate==="show"?(n.canShow=!0,this.animating.set(n,[n.currentOpacity,n.appearance.opacity??1])):n.visibilityNeedsUpdate==="hide"&&this.animating.set(n,[n.currentOpacity,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[n,[o,i]]of this.animating.entries()){let s=i===1?this.showDuration:this.hideDuration,u=(t-this.startTime)/s;n.currentOpacity=Gu(u,0,1,o,i,i===0?y6:b6),t-this.startTime>=s&&(i===1?n.canShow=!0:i===0&&(n.canShow=!1),n.visibilityNeedsUpdate=!1,this.animating.delete(n))}this.publish("draw:2d"),this.animating.size>0&&this.publish("animate:2d")}};p();var T1=class extends Oe{constructor(t,n,o,i,s,u,l){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 n=this.commitRenderState();return this.paint(),n}else return this.frameId?Promise.resolve():new Promise((n,o)=>{this.frameId=requestAnimationFrame(()=>this.renderer?.renderer==null?n():this.mode==="standalone"?this.commitRenderState()?.then(()=>{this.paint(),n()}).catch(i=>{o(i)}):n())})});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(),U6(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(),j6(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 n=this.systems.meshOptimizationSystem.update();n&&t.push(n),this.systems.borderSystem.update(),this.systems.meshModificationSystem.update(),this.systems.meshDetachmentSystem.update(),this.systems.renderOrderSystem.update(),this.systems.clippingPlaneSystem.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 o=this.needs2DRecompute;return this.nextFrame=requestAnimationFrame(()=>{this.systems.collisionSystem.update(this.systems.watermarkSystem.width,this.systems.watermarkSystem.height,this.systems.watermarkSystem.options.position,!o,this.systems.imageSystem.currentImageScreenBBoxes)}),this.systems.textureSystem.update(),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"),this.needs2DRecompute=!1,Promise.all(t)}catch(t){return Promise.reject(t)}});this.renderer=t,this.state=n,this.mode=o,this.scene=i,this.cameraObject=s,this.viewCamera=u,this.systems=l,this.systems.collisionSystem.on("visibility-changed",this.updateEntities2D),this.systems.twoDVisiblitySystem.on("draw:2d",this.drawEntities2D),this.systems.twoDVisiblitySystem.on("animate:2d",this.animate2D),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)}};p();import{z as Kt}from"zod";var uV=Kt.object({interactive:Kt.boolean().optional(),id:Kt.string().optional(),width:Kt.union([Kt.number(),Kt.object({on:Kt.literal("zoom-level").optional(),input:Kt.array(Kt.number()).nonempty(),output:Kt.array(Kt.number()).nonempty(),easing:Kt.string().optional()})]).optional(),accentColor:Kt.string().optional(),displayArrowsOnPath:Kt.boolean().optional(),animateArrowsOnPath:Kt.boolean().optional(),visibleThroughGeometry:Kt.boolean().optional(),dashed:Kt.boolean().optional()}),lV=Kt.object({type:Kt.enum(["Feature"]),geometry:Cd,properties:Kt.object({parentId:Kt.any().optional()})});function mM(e,r){Kt.object({features:Kt.array(lV)}).parse(e),uV.parse(r)}var Wf,Eu=class{constructor(r,t){m(this,"type","path");m(this,"mesh",new zs);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,"highlightStartFraction",0);m(this,"highlightEndFraction",0);m(this,"highlightCompleteFraction",1);m(this,"highlightWidthMultiplier",1.1);m(this,"highlightColor","red");m(this,"dashed",!1);m(this,"isVertical",!1);m(this,"dirty",!0);m(this,"materialDirty",!0);m(this,"position",new ie);C(this,Wf,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 a(this,Wf)}set altitude(r){this.mesh&&(this.mesh.position.z=r,T(this,Wf,r))}set complete(r){this.material&&(this.material.uniforms.complete.value=r,this.material.needsUpdate=!0)}};Wf=new WeakMap;p();p();p();var zo=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-zo.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?zo.Bounce.In(e*2)*.5:zo.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}}}}),Xf=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=[],n=0;n<arguments.length;n++)t[n]=arguments[n];for(var o=0,i=t;o<i.length;o++){var s=i[o];(r=s._group)===null||r===void 0||r.remove(s),s._group=this,this._tweens[s.getId()]=s,this._tweensAddedDuringUpdate[s.getId()]=s}},e.prototype.remove=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];for(var n=0,o=r;n<o.length;n++){var i=o[n];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=Xf()),t===void 0&&(t=!0);var n=Object.keys(this._tweens);if(n.length!==0)for(;n.length>0;){this._tweensAddedDuringUpdate={};for(var o=0;o<n.length;o++){var i=this._tweens[n[o]],s=!t;i&&i.update(r,s)===!1&&!t&&this.remove(i)}n=Object.keys(this._tweensAddedDuringUpdate)}},e}(),Dd={Linear:function(e,r){var t=e.length-1,n=t*r,o=Math.floor(n),i=Dd.Utils.Linear;return r<0?i(e[0],e[1],n):r>1?i(e[t],e[t-1],t-n):i(e[o],e[o+1>t?t:o+1],n-o)},Bezier:function(e,r){for(var t=0,n=e.length-1,o=Math.pow,i=Dd.Utils.Bernstein,s=0;s<=n;s++)t+=o(1-r,n-s)*o(r,s)*e[s]*i(n,s);return t},CatmullRom:function(e,r){var t=e.length-1,n=t*r,o=Math.floor(n),i=Dd.Utils.CatmullRom;return e[0]===e[t]?(r<0&&(o=Math.floor(n=t*(1+r))),i(e[(o-1+t)%t],e[o],e[(o+1)%t],e[(o+2)%t],n-o)):r<0?e[0]-(i(e[0],e[0],e[1],e[1],-n)-e[0]):r>1?e[t]-(i(e[t],e[t],e[t-1],e[t-1],n-t)-e[t]):i(e[o?o-1:0],e[o],e[t<o+1?t:o+1],e[t<o+2?t:o+2],n-o)},Utils:{Linear:function(e,r,t){return(r-e)*t+e},Bernstein:function(e,r){var t=Dd.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 n=r;n>1;n--)t*=n;return e[r]=t,t}}(),CatmullRom:function(e,r,t,n,o){var i=(t-e)*.5,s=(n-r)*.5,u=o*o,l=o*u;return(2*r-2*t+i+s)*l+(-3*r+3*t-2*i-s)*u+i*o+r}}},fM=function(){function e(){}return e.nextId=function(){return e._nextId++},e._nextId=0,e}(),y2=new w1,Ii=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=zo.Linear.None,this._interpolationFunction=Dd.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=fM.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=y2,y2.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=Xf()),t===void 0&&(t=!1),this._isPlaying)return this;if(this._repeat=this._initialRepeat,this._reversed){this._reversed=!1;for(var n in this._valuesStartRepeat)this._swapEndStartRepeatValues(n),this._valuesStart[n]=this._valuesStartRepeat[n]}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 o={};for(var i in this._valuesEnd)o[i]=this._valuesEnd[i];this._valuesEnd=o}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,n,o,i){for(var s in n){var u=r[s],l=Array.isArray(u),c=l?"array":typeof u,d=!l&&Array.isArray(n[s]);if(!(c==="undefined"||c==="function")){if(d){var f=n[s];if(f.length===0)continue;for(var h=[u],b=0,I=f.length;b<I;b+=1){var E=this._handleRelativeValue(u,f[b]);if(isNaN(E)){d=!1,console.warn("Found invalid interpolation list. Skipping.");break}h.push(E)}d&&(n[s]=h)}if((c==="object"||l)&&u&&!d){t[s]=l?[]:{};var v=u;for(var x in v)t[s][x]=v[x];o[s]=l?[]:{};var f=n[s];if(!this._isDynamic){var D={};for(var x in f)D[x]=f[x];n[s]=f=D}this._setupProperties(v,t[s],f,o[s],i)}else(typeof t[s]>"u"||i)&&(t[s]=u),l||(t[s]*=1),d?o[s]=n[s].slice().reverse():o[s]=t[s]||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=Xf()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=r,this)},e.prototype.resume=function(r){return r===void 0&&(r=Xf()),!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=zo.Linear.None),this._easingFunction=r,this},e.prototype.interpolation=function(r){return r===void 0&&(r=Dd.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 n=this,o;if(r===void 0&&(r=Xf()),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 s=r-this._startTime,u=this._duration+((o=this._repeatDelayTime)!==null&&o!==void 0?o:this._delayTime),l=this._duration+this._repeat*u,c=function(){if(n._duration===0||s>l)return 1;var E=Math.trunc(s/u),v=s-E*u,x=Math.min(v/n._duration,1);return x===0&&s===n._duration?1:x},d=c(),f=this._easingFunction(d);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,f),this._onUpdateCallback&&this._onUpdateCallback(this._object,d),this._duration===0||s>=this._duration)if(this._repeat>0){var h=Math.min(Math.trunc((s-this._duration)/u)+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+=u*h,this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1,!0}else{this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var b=0,I=this._chainedTweens.length;b<I;b++)this._chainedTweens[b].start(this._startTime+this._duration,!1);return this._isPlaying=!1,!1}return!0},e.prototype._updateProperties=function(r,t,n,o){for(var i in n)if(t[i]!==void 0){var s=t[i]||0,u=n[i],l=Array.isArray(r[i]),c=Array.isArray(u),d=!l&&c;d?r[i]=this._interpolationFunction(u,o):typeof u=="object"&&u?this._updateProperties(r[i],s,u,o):(u=this._handleRelativeValue(s,u),typeof u=="number"&&(r[i]=s+(u-s)*o))}},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],n=this._valuesEnd[r];typeof n=="string"?this._valuesStartRepeat[r]=this._valuesStartRepeat[r]+parseFloat(n):this._valuesStartRepeat[r]=this._valuesEnd[r],this._valuesEnd[r]=t},e.autoStartOnUpdate=!1,e}();var w7e=fM.nextId,va=y2,F7e=va.getAll.bind(va),M7e=va.removeAll.bind(va),A7e=va.add.bind(va),O7e=va.remove.bind(va),B7e=va.update.bind(va);p();p();p();var hM=(e,r)=>(r-e+Math.PI)%(Math.PI*2)+Math.PI*2%(Math.PI*2)-Math.PI,gM=(e,r)=>new ke(e.clientX-r.offsetLeft,e.clientY-r.offsetTop),b2=(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),v2=(e,r)=>new ke((e.x+r.x)/2,(e.y+r.y)/2),x2=e=>{let r=0,{wheelDelta:t,detail:n}=e;return t!==void 0?r=t:n!==void 0&&(r=-n),r};var F1=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=b2(r,t),this.lastDistance=Jf(r,t),this.totalDistance=0,this.first=r,this.second=t}update(r,t){let n=Jf(r,t);this.input1=r,this.input2=t;let o=b2(r,t);this.lastAngle=o,this.lastDistance=n,this.totalDistance+=(Jf(this.first,r)+Jf(this.second,t))/2,this.first=v2(this.first,r),this.second=v2(this.second,t)}};p();var Yf=class{constructor(r,t,n){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=n,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 ke(this.viewCoordinate.x,this.viewCoordinate.y);this.raycaster=this.raycaster||new Ui,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 ke(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 Ei={};$s(Ei,{BLOCK_MERCATOR_ZOOM_LEVEL:()=>pV,CLIPPING_RADIUS:()=>Kf,CONTROL_OPTIONS:()=>cV,DEFAULT_ANIMATION_DURATION:()=>D2,DEFAULT_BEARING:()=>gV,DEFAULT_MAX_ZOOM_LEVEL:()=>fV,DEFAULT_MIN_ZOOM_LEVEL:()=>T2,DEFAULT_PITCH:()=>hV,DEFAULT_ZOOM_LEVEL:()=>mV,EVENTS:()=>B1,MAPLIBRE_TILE_SIZE:()=>M1,MAX_LAT:()=>E2,MAX_MERCATOR_ZOOM_LEVEL:()=>O1,MIN_LAT:()=>I2,MIN_MERCATOR_ZOOM_LEVEL:()=>A1,ROOM_MERCATOR_ZOOM_LEVEL:()=>dV,TWO_PI:()=>C2,WHEEL_ZOOM_MULTIPLIER:()=>S2,ZRANGE:()=>Td});p();var M1=512,I2=-85.051129,E2=85.051129,Kf=1e4,cV={chain:"chain",cancel:"cancel"},C2=Math.PI*2,Td=100,S2=1e4,A1=0,O1=24,pV=17,dV=20,D2=200,B1=["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"],mV=18,T2=12,fV=22,hV=0,gV=0;var P1=!1,yV=!1;var k1,Ul=class extends Oe{constructor(t,n,o,i,s){super();m(this,"dirty",!1);m(this,"zoomDirty",!1);m(this,"rotationDirty",!1);m(this,"panDirty",!1);m(this,"stateDirty",!1);C(this,k1,T2);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 ie(1/0,1/0),max:new ie(-1/0,-1/0),center:new ie(0,0,0),radius:1/0});m(this,"minTilt",0);m(this,"maxTilt",1.2);m(this,"MOUSE_BUTTONS",{ORBIT:gh.RIGHT,ZOOM:gh.MIDDLE,PAN:gh.LEFT});m(this,"camera");m(this,"scene");m(this,"renderer");m(this,"elevation");m(this,"orbit");m(this,"cameraPlane");m(this,"raycaster",new Ui);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 l6(!0));m(this,"coords",{mouse:new ke,rotateStart:new ke,rotateEnd:new ke,rotateDelta:new ke,panStart:new ie,panCameraStart:new ie,panEnd:new ie,panDelta:new ie,initialShiftPos:new ke,initialPedestal:0,floorAnchor:new ie});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 n=this.raycaster.intersectObject(this.cameraPlane,!1)[0];return n?n.point:new ie});m(this,"isUserInteracting",()=>this.userInteracting);m(this,"getPosition",()=>new ie(this.orbit.position.x,this.orbit.position.y,this.orbit.position.z));m(this,"getPedestal",()=>this.orbit.position.z);m(this,"pan",(t,n)=>{isNaN(t)||isNaN(n)||(this.setPosition(this.orbit.position.x+t,this.orbit.position.y+n),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,n)=>{t===void 0||n===void 0||isNaN(t)||isNaN(n)||(this.state===-1&&this.publish("pan-start"),this.updateCameraPosition(t,n),this.publish("position-updated"),this.publish("change"),this.state===-1&&this.publish("pan-end"),this.dirty=!0,this.stateDirty=!0)});m(this,"updateCameraPosition",(t,n)=>{let o=t-this.panBounds.center.x,i=n-this.panBounds.center.y,s=Math.sqrt(o*o+i*i);if(this.stayInsideBounds&&s>this.panBounds.radius){let u=Math.atan2(i,o),l={x:Math.cos(u)*this.panBounds.radius+this.panBounds.center.x,y:Math.sin(u)*this.panBounds.radius+this.panBounds.center.y};this.orbit.position.x=l.x,this.orbit.position.y=l.y}else this.orbit.position.x=t,this.orbit.position.y=n});m(this,"tilt",t=>{if(isNaN(t))return;this.state===-1&&this.publish("rotate-start");let n=this.stayInsideBounds?Math.max(Math.min(t+this.getTilt(),this.maxTilt),this.minTilt):t+this.getTilt();n!==this.elevation.rotation.x&&(this.elevation.rotation.x=n,this.publish("tilt-updated")),this.publish("change"),this.state===-1&&this.publish("rotate-end"),this.stateDirty=!0});m(this,"zoomIn",(t,n,o)=>{let i=this.getZoomAltitude();this.animateCamera({zoom:i/1.5},t,n,o)});m(this,"zoomOut",(t,n,o)=>{let i=this.getZoomAltitude();this.animateCamera({zoom:i*1.5},t,n,o)});m(this,"getRotation",()=>(-this.orbit.rotation.z+Math.PI*2)%(Math.PI*2));m(this,"cancelAnimation",()=>{let t=Array.from(this.tweens.keys());if(t.length<1)return;let n=t[t.length-1];n.state===7&&this.publish("multi-cancel",{zooming:!0,rotating:!0,tilting:!0}),this.completeTween(n)});m(this,"animateCamera",(t,n,o,i,s,u)=>{let l={interruptible:!0,...u},c={},d={},f=this.getPosition();if(t.position!=null&&(t.position.x!==void 0&&(c.x=f.x,d.x=t.position.x),t.position.y!==void 0&&(c.y=f.y,d.y=t.position.y),t.position.z!==void 0&&(c.z=f.z,d.z=t.position.z)),t.zoom!==void 0&&(c.zoom=this.stayInsideBounds?Math.min(Math.max(this.getZoomAltitude(),this.getZoomScaledMin()),this.getZoomScaledMax()):this.getZoomAltitude(),this.viewState==="multi_floor"||!this.stayInsideBounds?d.zoom=t.zoom:d.zoom=Math.min(Math.max(t.zoom,this.getZoomScaledMin()),this.getZoomScaledMax())),t.rotation!==void 0){let{start:w,end:S}=f6(this.getRotation(),t.rotation);c.rotation=w,d.rotation=S}t.tilt!==void 0&&(c.tilt=this.getTilt(),this.viewState==="multi_floor"||!this.stayInsideBounds?d.tilt=t.tilt:d.tilt=Math.max(Math.min(t.tilt,this.maxTilt),this.minTilt));let h=c.zoom!==d.zoom,b=c.rotation!==d.rotation,I=c.tilt!==d.tilt,E=new Ii(c).to(d,y.env.TESTING?0:n).onUpdate(w=>{this.setMulti({x:w.x,y:w.y,z:w.z},w.zoom,w.rotation,w.tilt)}).onComplete(()=>{this.completeTween(E),this.publish("multi-end",{zooming:h,rotating:b,tilting:I}),i&&i()}).onStart(()=>{this.state!==7&&(this.state=7,E.state=7,this.publish("multi-start",{zooming:h,rotating:b,tilting:I})),this.publish("change")});this.rendererState.internalTweenGroup.add(E);let v=Array.from(this.tweens.entries()),x=v[v.length-1],D=!1;return x!=null&&(x[1].interruptible?(typeof x[1].cancelledCallback=="function"&&x[1].cancelledCallback(),this.completeTween(x[0])):(D=!0,x[0].chain(E))),this.tweens.set(E,{cancelledCallback:s,interruptible:l.interruptible}),o?E.easing(o):E.easing(zo.Quadratic.In),!t.doNotAutoStart&&!D&&(E.start(),this.publish("change")),E.cameraAnimation=!0,E});m(this,"setMulti",(t,n,o,i,s=!0)=>{this.state===-1&&this.publish("multi-start");let u=!1;t!=null&&(t.x!==void 0&&!isNaN(t.x)&&t.y!==void 0&&!isNaN(t.y)&&(this.updateCameraPosition(t.x,t.y),u=!0),t.z!==void 0&&!isNaN(t.z)&&(this.setPedestal(t.z,!0,!1),u=!0)),u&&this.publish("position-updated");let l={zooming:!1,tilting:!!n,rotating:!1};if(n!==void 0&&!isNaN(n)){let c=this.stayInsideBounds?Math.min(Math.max(n,this.getZoomScaledMin()),this.getZoomScaledMax()):n;c!==this.camera.position.z&&(l.zooming=!0,this.camera.position.z=c,this.publish("zoom-updated"),this.zoomDirty=!0,this.viewState==="multi_floor"?n>Kf&&(this.camera.near=n-Kf,this.camera.far=n+Kf):(this.camera.near=n/Td,this.camera.far=n*Td),this.camera.updateProjectionMatrix())}if(o!==void 0&&!isNaN(o)&&o!==this.getRotation()&&(l.rotating=!0,this.orbit.rotation.z=-o,this.publish("rotation-updated")),i!==void 0&&!isNaN(i)){let c=this.stayInsideBounds?Math.max(Math.min(i,this.maxTilt),this.minTilt):i;c!==this.elevation.rotation.x&&(l.tilting=!0,this.elevation.rotation.x=c,this.publish("tilt-updated"))}s&&this.publish("change"),this.state===-1&&this.publish("multi-end",l),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,n)=>{if(isNaN(t))return;this.state===-1&&!n&&this.publish("rotate-start");let o=-(t%C2);o!==this.orbit.rotation.z&&(this.orbit.rotation.z=o,n||this.publish("rotation-updated")),n||this.publish("change"),this.state===-1&&!n&&this.publish("rotate-end"),this.dirty=!0,this.rotationDirty=!0,n||(this.stateDirty=!0)});m(this,"setZoomAltitude",t=>{if(isNaN(t))return;this.state===-1&&this.publish("zoom-start");let n=this.stayInsideBounds?Math.min(Math.max(t,this.getZoomScaledMin()),this.getZoomScaledMax()):t;n!==this.camera.position.z&&(this.camera.position.z=n,this.publish("zoom-updated"),this.zoomDirty=!0),this.camera.near=n/Td,this.camera.far=n*Td,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,n)=>{if(isNaN(t))return;this.state===-1&&!n&&this.publish("rotate-start");let o=this.stayInsideBounds?Math.max(Math.min(t,this.maxTilt),this.minTilt):t;o!==this.elevation.rotation.x&&(this.elevation.rotation.x=o,n||this.publish("tilt-updated")),n||this.publish("change"),this.state===-1&&!n&&this.publish("rotate-end"),this.dirty=!0,n||(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 n=this.getZoomAltitude()-t;this.camera.position.z=this.stayInsideBounds?Math.min(Math.max(n,this.minZoomAltitude*this.zoomFactor),this.maxZoomAltitude*this.zoomFactor):n,this.publish("zoom-updated"),this.zoomDirty=!0,this.publish("change"),this.state===-1&&this.publish("zoom-end"),this.stateDirty=!0});m(this,"getProjectionScaleFactor",(t,n,o)=>bb(t,n,o));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,n=!1,o=!0)=>{typeof t=="number"&&!isNaN(t)&&(this.orbit.position.z=t,n&&(this.publishPedestalChangeEvent(t),this.publish("pedestal-change",{pedestal:t})),this.publish("change"),this.dirty=!0,o&&(this.stateDirty=!0))});m(this,"dispose",()=>{for(let t of B1)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=P1?2e3:1e10,n=P1?100:1,o=new Qo(t,t,n,n),i=new gr({color:0,wireframe:P1,visible:P1}),s=new Pe(o,i);return this.scene.add(s),s});m(this,"addEventListeners",()=>{let{domElement:t}=this.renderer;for(let n of B1)n.endsWith("start")?(this.on(n,this.setCameraMoving),n.startsWith("user")&&this.on(n,this.setUserInteracting)):(n.endsWith("end")||n.endsWith("cancel"))&&(this.on(n,this.unsetCameraMoving),n.startsWith("user")&&this.on(n,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 F1(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 n={...this.touch.inputs.first},o={...this.touch.inputs.second},i=new ke(this.touch.touches[0].x,this.touch.touches[0].y),s=new ke(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 u=n.y<i.y&&o.y<s.y,l=n.y>i.y&&o.y>s.y;this.enableRotate&&this.state!==4&&(l||u)?(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 n=Object.hasOwn(t,"x")?new ke(t.x,t.y):this.touch.touches[0],o=this.raycastToFloor(n);this.coords.panEnd.set(o.x,o.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,n=this.touch.touches[0].y-this.touch.touches[1].y;this.zoomStart=this.getZoomAltitude();let o=new ke(this.touch.touches[0].x-t/2,this.touch.touches[0].y-n/2);this.coords.floorAnchor=this.raycastToFloor(o),this.orbit.updateMatrixWorld(),this.touch.anchor1=new Yf(this.touch.touches[0],this.camera,this.cameraPlane),this.touch.anchor2=new Yf(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,n=this.touch.inputs.second;this.touch.anchor1.viewCoordinate={x:t.x,y:t.y},this.touch.anchor2.viewCoordinate={x:n.x,y:n.y};let o=this.makeTransformFromTouchAnchors(this.touch.anchor1,this.touch.anchor2);o&&this.setCameraFromTransformMatrix(o),this.orbit.updateMatrixWorld(),this.touch.anchor1.updateAnchorState(this.camera,t),this.touch.anchor2.updateAnchorState(this.camera,n)});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 n=Object.hasOwn(t,"x")?new ke(t.x,t.y):this.touch.touches[0],o=this.raycastToFloor(n);this.coords.panStart.set(o.x,o.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 n=this.getZoomAltitude(),o=n-x2(t)*n/S2*this.zoomSpeed;if(this.setZoomAltitude(o),this.enablePan){let i=o/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 n=new bc;n.setFromRotationMatrix(t,"ZYX");let o=(t.elements[14]-this.cameraPlane.position.z)/Math.cos(n.x),i=n.z,s=new ie(0,0,1);s.applyEuler(n),s.setLength(o);let u=new ie;u.setFromMatrixPosition(t),u.sub(s),this.enablePan&&this.setPosition(u.x,u.y),this.enableZoom&&this.setZoomAltitude(o),this.enableRotate&&this.setRotation(-i)});m(this,"makeTransformFromTouchAnchors",(t,n)=>{this.orbit.updateMatrixWorld(),this.camera.updateProjectionMatrix();let o=this.camera.projectionMatrix.clone(),i=t.worldCoordinate,s=n.worldCoordinate,u=t.reUnproject(),l=n.reUnproject();if(!u||!l||!i||!s)return null;let c=t.viewCoordinate,d=n.viewCoordinate,f=s.x-i.x,h=s.y-i.y,b=Math.atan2(h,f),I=l.x-u.x,E=l.y-u.y,v=Math.atan2(E,I),x=hM(b,v),D=new Wn;D.makeRotationZ(-x);let w=D.clone();w.multiply(t.snapHolderMatrix);let S=(mh,mc,fc)=>mh.elements[(mc-1)*4+fc-1],F=S(o,1,1)*S(w,1,1)-c.x*S(o,3,4)*S(w,3,1),P=S(o,1,1)*S(w,1,2)-c.x*S(o,3,4)*S(w,3,2),L=S(o,1,1)*S(w,1,3)-c.x*S(o,3,4)*S(w,3,3),N=i.x*F+i.y*P+i.z*L,$=S(o,2,2)*S(w,2,1)-c.y*S(o,3,4)*S(w,3,1),W=S(o,2,2)*S(w,2,2)-c.y*S(o,3,4)*S(w,3,2),V=S(o,2,2)*S(w,2,3)-c.y*S(o,3,4)*S(w,3,3),q=i.x*$+i.y*W+i.z*V,se=S(o,1,1)*S(w,1,1)-d.x*S(o,3,4)*S(w,3,1),ue=S(o,1,1)*S(w,1,2)-d.x*S(o,3,4)*S(w,3,2),ce=S(o,1,1)*S(w,1,3)-d.x*S(o,3,4)*S(w,3,3),de=s.x*se+s.y*ue+s.z*ce,Ee=S(o,2,2)*S(w,2,1)-d.y*S(o,3,4)*S(w,3,1),he=S(o,2,2)*S(w,2,2)-d.y*S(o,3,4)*S(w,3,2),ne=S(o,2,2)*S(w,2,3)-d.y*S(o,3,4)*S(w,3,3),Ce=s.x*Ee+s.y*he+s.z*ne,xe=Math.abs(se-F),Re=Math.abs(ue-P),we=Math.abs(ce-L),Ve=Math.abs(se-$),me=Math.abs(ue-W),at=Math.abs(ce-V),xt=Math.abs(Ee-F),Ot=Math.abs(he-P),A=Math.abs(ne-L),Z=Math.abs(Ee-$),O=Math.abs(he-W),Q=Math.abs(ne-V),X=Math.min(xe+Re+we,Ve+me+at),Y=Math.min(xt+Ot+A,Z+O+Q);X<Y&&(se=Ee,ue=he,ce=ne,de=Ce);let K=$*L-F*V,ae=W*L-P*V,$e=q*L-N*V,Rt=se*V-$*ce,ir=ue*V-W*ce,ho=de*V-q*ce,Ni=(ho*ae-$e*ir)/(Rt*ae-K*ir),em=(ho*K-$e*Rt)/(ir*K-ae*Rt),dc=W*F-P*$,Ru=V*F-L*$,Rs=q*F-N*$,Aa=ue*$-W*se,dh=ce*$-V*se,tm=((de*$-q*se)*dc-Rs*Aa)/(dh*dc-Ru*Aa),Ns=w.clone();return Ns.elements[12]=Ni,Ns.elements[13]=em,Ns.elements[14]=tm,tm>0?Ns: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 n=0,o=t.touches.length;n<o;n++){let i=t.touches[n],s=gM(i,this.touch.origin);this.touch.touches.push(new ke(s.x/this.renderer.domElement.width*this.rendererState.pixelRatio*2-1,-(s.y/this.renderer.domElement.height*this.rendererState.pixelRatio)*2+1))}this.coords.mouse=this.touch.touches[0]});m(this,"canScrollZoom",t=>{let n=x2(t),o=this.getZoomAltitude();return!(n<0&&o===this.getZoomScaledMax()||n>0&&o===this.getZoomScaledMin())});m(this,"mouseToScene",t=>{let n=this.getMousePos(t);return this.coords.mouse.x=n.x/this.renderer.domElement.width*this.rendererState.pixelRatio*2-1,this.coords.mouse.y=-(n.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 n=new ke(t.clientX,t.clientY);this.coords.initialShiftPos=n,this.coords.initialPedestal=this.getPedestal(),this.pedestalScaleFactor=bb(this.camera.fov,this.renderer.domElement.clientHeight,this.getZoomAltitude()),this.publish("pedestal-start"),this.publish("user-pedestal-start")});m(this,"handleMouseMovePedestal",t=>{let n={x:t.clientX,y:t.clientY},o=this.coords.initialPedestal+this.pedestalScaleFactor*(n.y-this.coords.initialShiftPos.y);this.stayInsideBounds&&(o<this.minPedestal?o=Math.max(o,this.minPedestal):o>this.maxPedestal&&(o=Math.min(o,this.maxPedestal))),o!==this.getPedestal()&&this.setPedestal(o,!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",fm(()=>{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[,n]=this.center,o=this.computeMetersPerPixelFromAltitude(t),i=Math.cos(Je.degToRad(n))*2*Math.PI*nb/o;return Je.clamp(Math.log2(i/512),A1,O1)});m(this,"convertZoomLevelToAltitude",t=>this.computeMetersPerPixelFromZoomLevel(t)*this.options.canvasHeight/2/Math.tan(Je.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 ju);this.camera=t,this.renderer=o,this.rendererState=i,this.scene=n,this.options=s,this.elevation=t.parent,this.orbit=this.elevation.parent,this.cameraPlane=this.createCameraPlane(),this.zoomStart=t.position.z,s.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 a(this,k1)}get minZoomLevel(){return this.convertAltitudeToZoomLevel(this.maxZoomAltitude)}setMinZoomLevel(t){this.maxZoomAltitude=this.convertZoomLevelToAltitude(t),this.stateDirty=!0}get scrollPercent(){let t=this.minPedestal,n=this.maxPedestal,o=this.getPedestal();return o=Math.min(o,n),o=Math.max(o,t),(o-t)/(n-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:n,lon:o}=Lh(this.rendererState.center?.[1]??0,this.rendererState.center?.[0]??0,t.x,t.y);return[o,n]}setCenter(t,n){let{x:o,y:i}=Rh(this.rendererState.center?.[1]??0,this.rendererState.center?.[0]??0,n,t);this.setPosition(o,i)}get isAnimating(){return this.rendererState.internalTweenGroup.getAll().some(t=>t.cameraAnimation)}getCameraFrameForCoordinates(t,n){let o=n.minZoom!==void 0?n.minZoom:this.minZoomAltitude,i=n.maxZoom!==void 0?n.maxZoom:this.maxZoomAltitude,s=this.options.canvasWidth,u=this.options.canvasHeight,l=this.getRotation(),c=this.getTilt(),d=this.getPosition();this.setRotation(n.rotation??l,!0),this.setTilt(n.tilt??c,!0);let f=yM(t,{canvasWidth:s,canvasHeight:u,paddingOption:n.padding,verticalPadding:n.verticalPadding,minZoom:o,maxZoom:i,position:d,camera:this.camera,orbit:this.orbit});return this.setRotation(l,!0),this.setTilt(c,!0),{center:f.position,zoomLevel:this.convertAltitudeToZoomLevel(f.zoom)}}focusOn(t,n){if(yV){this.debugContainer&&Ht(this.debugContainer);let v=new qo(4,4,4),x=new gr({color:65280,depthTest:!1}),D=new ji(v,x,t.length),w=new Wn;t.forEach((S,F)=>{w.setPosition(S),D.setMatrixAt(F,w)}),D.instanceMatrix.needsUpdate=!0,this.debugContainer.add(D),this.scene.add(this.debugContainer)}let o=n.curve,i=n.callback,s=n.cancelledCallback,u=n.minZoom!==void 0?n.minZoom:this.minZoomAltitude,l=n.maxZoom!==void 0?n.maxZoom:this.maxZoomAltitude,c=this.options.canvasWidth,d=this.options.canvasHeight,f;n.duration!==void 0?f=n.duration:y.env.TESTING==="true"?f=0:f=D2;let h=n.padding,b=this.getRotation(),I=this.getTilt();n.rotation!=null&&this.setRotation(n.rotation),n.tilt!=null&&this.setTilt(n.tilt);let E=yM(t,{canvasHeight:d,paddingOption:h,canvasWidth:c,minZoom:u,maxZoom:l,camera:this.camera,orbit:this.orbit,position:this.getPosition(),verticalPadding:n.verticalPadding});this.setRotation(b),this.setTilt(I),this.animateCamera({position:E.position,tilt:n.tilt,rotation:n.rotation,zoom:E.zoom},f,o,i,s,n)}resize(t,n){this.options.canvasWidth=t,this.options.canvasHeight=n}computeMetersPerPixelFromZoomLevel(t){let[,n]=this.center,o=Je.clamp(t,A1,O1),i=Math.pow(2,o),s=Je.clamp(n,I2,E2),u=i*512;return Math.cos(Je.degToRad(s))*Math.PI*2*nb/u}computeMetersPerPixelFromAltitude(t){return t*2*Math.tan(Je.degToRad(this.camera.fov)/2)/this.options.canvasHeight}getCurrentMetersPerPixel(){return this.computeMetersPerPixelFromAltitude(this.getZoomAltitude())}};k1=new WeakMap,m(Ul,"CAMERA_FRAME_PADDING_SIDES",["top","bottom","left","right"]);function yM(e,{canvasWidth:r,orbit:t,paddingOption:n,verticalPadding:o=0,canvasHeight:i,minZoom:s,maxZoom:u,camera:l,position:c}){let d={zoom:s,position:c};if(e.length===0)return d;for(let K of Ul.CAMERA_FRAME_PADDING_SIDES)typeof n[K]!="number"&&(n[K]=0);let f=n.type==="portion"?{top:n.top*i,bottom:n.bottom*i,left:n.left*r,right:n.right*r,type:"pixel"}:n;if(f.left+f.right>=r||f.top+f.bottom>=i)return d;t.updateMatrixWorld();let h=l.matrixWorldInverse,b=l.fov*(Math.PI/180)/2,I=b,v=Math.atan(Math.tan(b)*(r/i)),x=new ie(1/0,1/0,1/0),D=new ie(-1/0,-1/0,-1/0),w=new dr,S=new ie;for(let K=0,ae=e.length;K<ae;K++)S.copy(e[K]),w.expandByPoint(S),S.applyMatrix4(h),x.min(S),D.max(S),S.copy(e[K]),S.z-=o,S.applyMatrix4(h),x.min(S),D.max(S),S.copy(e[K]),S.z+=o,S.applyMatrix4(h),x.min(S),D.max(S);let F=D.x-x.x,P=D.y-x.y,L=r-f.left-f.right,N=i-f.top-f.bottom,$=(D.x+x.x)/2,W=(D.y+x.y)/2,V=F/L,q=P/N,se=s,ue=u,ce=se*Math.tan(v)*2,de=ue*Math.tan(v)*2,Ee=ce/r,he=de/r,ne=Math.max(V,q);ne=Je.clamp(ne,Ee,he);let Ce=L*ne,xe=N*ne,Re={min:{x:$-Ce/2-f.left*ne,y:W-xe/2-f.bottom*ne},max:{x:$+Ce/2+f.right*ne,y:W+xe/2+f.top*ne}},we=(Re.min.x+Re.max.x)/2,Ve=(Re.min.y+Re.max.y)/2,me=w.getCenter(new ie),at=Math.abs(we-Re.min.x),xt=Math.abs(Ve-Re.min.y),Ot=at/Math.tan(v),A=xt/Math.tan(I),Z=new ie;Z.set(we,Ve,D.z+Math.max(Ot,A)),Z.applyMatrix4(l.matrixWorld);let O=new ie;O.set(we,Ve,D.z),O.applyMatrix4(l.matrixWorld);let Q=new ie().subVectors(O,Z),X=(me.z-Z.z)/Q.z,Y=new ie().copy(Z).add(Q.clone().multiplyScalar(X));return O.set(Y.x,Y.y,Y.z),Z.sub(O),{position:Y,zoom:Z.length()}}p();var bV=300,qf,Qf,_1=class{constructor(r){m(this,"state");C(this,qf,new ie);C(this,Qf,new ie);this.state=r}update(r){let t,n;this.state.cameraObject.getWorldPosition(a(this,Qf));for(let o of this.state.geometry2DIdsInScene)if(t=this.state.geometry2DMap.get(o),t&&(n=t.components[0],n&&"containerEl"in n&&n.markerContainer!=null)){if(n.visibilityNeedsUpdate!==!1&&(n.visibilityNeedsUpdate==="show"?n.canShow=!0:n.canShow=!1),(n.canShow&&n.visible===!0||n.animation?.pending===!0)&&!n.offscreen)if(n.options.zIndex!=null)n.markerContainer.style.transform=`translate3D(${n.projection.x}px, ${n.projection.y}px, ${n.options.zIndex}px)`;else{t.object3d.getWorldPosition(a(this,qf));let i=a(this,Qf).distanceTo(a(this,qf));n.markerContainer.style.transform=`translate3D(${n.projection.x}px, ${n.projection.y}px, ${-i}px)`}if(n.canShow===!0&&n.visible===!0?n.markerContainer.style.pointerEvents=r?"none":n.pointerEvents:n.markerContainer.style.pointerEvents="none",n.currentStrategyIndex===-1&&n.visible&&n.visibilityNeedsUpdate==="show")continue;n.visibilityNeedsUpdate!==!1&&!n.offscreen&&(n.visibilityNeedsUpdate==="show"&&(n.markerContainer.style.opacity="0"),n.animation&&n.animation.cancel(),n.animation=n.markerContainer.animate([{opacity:n.canShow&&n.visible?"1":"0"}],{duration:bV,easing:"ease-in-out",fill:"forwards"}),n.visibilityNeedsUpdate=!1)}}};qf=new WeakMap,Qf=new WeakMap;p();var L1=class extends Oe{constructor(t,n){super();m(this,"state");m(this,"dirty",!0);m(this,"domTree");m(this,"observers",new Map);m(this,"updateDimensions",t=>{t.forEach(n=>{let i=n.target.parentElement?.getAttribute("data-marker-id");if(i){let s=this.state.geometry2DMap.get(i),u=s?.components[0];s&&u instanceof Na&&(u.updateDimensions(n.contentRect.width,n.contentRect.height),u.collisionDirty=!0)}}),this.publish("dimensions-update")});this.state=t,this.domTree=n}setupObserver(){if(this.observers){for(let o of this.observers.values())o.disconnect();this.observers.clear()}let t,n;for(let o of this.domTree.children){let i=o.getAttribute("data-marker-id");if(i!=null&&(t=this.state.geometry2DMap.get(i),n=t.components[0],n.options?.dynamicResize)){let s=new ResizeObserver(this.updateDimensions);s.observe(n.containerEl),this.observers.set(o.userData.entityId,s)}}}update(){this.dirty&&(this.setupObserver(),this.dirty=!1)}destroy(){for(let t of this.observers.values())t.disconnect();this.observers.clear()}};p();var vV=0,xV=90,IV=(y.env.NODE_ENV==="test",!1),xa={linear:zo.Linear.None,"ease-in":zo.Quadratic.In,"ease-out":zo.Quadratic.Out,"ease-in-out":zo.Quadratic.InOut},EV=-50,fe,Fe,xs,e0,t0,F2,R1=class{constructor(r,t,n){C(this,t0);C(this,fe);C(this,Fe);C(this,xs);C(this,e0);T(this,fe,r),T(this,Fe,t),T(this,xs,n),a(this,fe).map&&a(this,fe).map.transform.setMinElevationForCurrentTile(EV),a(this,Fe).cameraSystem.on("pedestal-change",({pedestal:o})=>{a(this,Fe).cameraSystem.setCameraPlaneElevation(o)})}get center(){return a(this,fe).mode==="outdoors-overlay"&&a(this,fe).map?a(this,fe).map.getCenter?.().toArray():a(this,Fe).cameraSystem.center}setCenter(r){if(a(this,fe).mode==="outdoors-overlay"&&a(this,fe).map){a(this,fe).map?.setCenter(r),a(this,Fe).interactionSystem.handleHover();return}a(this,Fe).cameraSystem.setCenter(r[0],r[1]),a(this,Fe).interactionSystem.handleHover()}get zoomLevel(){return a(this,fe).mode==="outdoors-overlay"&&a(this,fe).map?a(this,fe).map?.getZoom():a(this,Fe).cameraSystem.getZoomLevel()}setZoomLevel(r){a(this,fe).mode==="outdoors-overlay"&&a(this,fe).map&&a(this,fe).map?.setZoom(r),a(this,Fe).cameraSystem.setZoomLevel(Gi(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 a(this,Fe).cameraSystem.isAnimating}cancelAnimation(){a(this,Fe).cameraSystem.cancelAnimation()}get maxZoomLevel(){return a(this,Fe).cameraSystem.maxZoomLevel}get minZoomLevel(){return a(this,Fe).cameraSystem.minZoomLevel}setAutoMinZoomLevel(r){a(this,Fe).panBoundsSystem.autoMinZoomLevel=r,r&&(a(this,Fe).panBoundsSystem.dirty=!0,a(this,Fe).panBoundsSystem.update())}get autoMinZoomLevel(){return a(this,Fe).panBoundsSystem.autoMinZoomLevel}setMinZoomLevel(r,t=!1){t&&this.setAutoMinZoomLevel(!1);let n=Gi(r,Ei.MIN_MERCATOR_ZOOM_LEVEL,this.maxZoomLevel,`setMinZoomLevel was clamped. minZoomLevel must be between ${Ei.MIN_MERCATOR_ZOOM_LEVEL} and maxZoomLevel.`);a(this,Fe).cameraSystem.setMinZoomLevel(n),this.zoomLevel<n&&this.setZoomLevel(n),a(this,fe).map?.setMinZoom(n)}setMaxZoomLevel(r){let t=Gi(r,this.minZoomLevel,Ei.MAX_MERCATOR_ZOOM_LEVEL,`setMaxZoomLevel was clamped. maxZoomLevel must be between minZoomLevel and ${Ei.MAX_MERCATOR_ZOOM_LEVEL}.`);a(this,Fe).cameraSystem.setMaxZoomLevel(t),this.zoomLevel>t&&this.setZoomLevel(t),a(this,fe).map?.setMaxZoom(t)}get maxPitch(){return a(this,fe).mode==="outdoors-overlay"&&a(this,fe).map?a(this,fe).map?.getMaxPitch?.():Je.radToDeg(a(this,Fe).cameraSystem.maxTilt)}get minPitch(){return a(this,fe).mode==="outdoors-overlay"&&a(this,fe).map?a(this,fe).map?.getMinPitch?.():Je.radToDeg(a(this,Fe).cameraSystem.minTilt)}setMinPitch(r){let t=Math.max(vV,r);a(this,fe).map?.setMinPitch(t),a(this,Fe).cameraSystem.minTilt=Je.degToRad(t)}setMaxPitch(r){let t=Math.min(xV,r);a(this,fe).map?.setMaxPitch(t),a(this,Fe).cameraSystem.maxTilt=Je.degToRad(t)}get bearing(){return a(this,fe).mode==="outdoors-overlay"&&a(this,fe).map?a(this,fe).map?.getBearing():Je.radToDeg(a(this,Fe).cameraSystem.getRotation())}setBearing(r){if(a(this,fe).mode==="outdoors-overlay"&&a(this,fe).map){a(this,fe).map?.setBearing(r);return}a(this,Fe).cameraSystem.setRotation(Je.degToRad(r))}get pitch(){return a(this,fe).mode==="outdoors-overlay"&&a(this,fe).map?a(this,fe).map?.getPitch():Je.radToDeg(a(this,Fe).cameraSystem.getTilt())}setPitch(r){if(a(this,fe).mode==="outdoors-overlay"&&a(this,fe).map){a(this,fe).map?.setPitch(r);return}a(this,Fe).cameraSystem.setTilt(Je.degToRad(Gi(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 a(this,Fe).cameraSystem.getPedestal()}setElevation(r){a(this,Fe).cameraSystem.setPedestal(r,!0)}animateElevation(r,t){return a(this,e0)&&a(this,e0).stop(),new Promise(n=>{a(this,Fe).cameraSystem.animateCamera({position:{z:r}},t?.duration||300,xa[t?.easing||"ease-in-out"],n,n,{interruptible:t?.interruptible??!0})})}get insetsPadding(){return a(this,xs).insetsPadding}get panMode(){return a(this,Fe).cameraSystem.enablePan===!1&&a(this,Fe).cameraSystem.enablePedestal===!0?"elevation":"default"}setPanMode(r){if(r!=="default"&&r!=="elevation")throw new Error("Invalid pan mode");r!==this.panMode&&(r==="default"?(a(this,Fe).cameraSystem.enablePan=!0,a(this,Fe).cameraSystem.enablePedestal=!1):(a(this,Fe).cameraSystem.enablePan=!1,a(this,Fe).cameraSystem.enablePedestal=!0))}setInsetPadding(r){a(this,xs).insetsPadding=Object.assign({},a(this,xs).insetsPadding,r)}animateTo(r){if(a(this,fe).mode==="outdoors-overlay"&&a(this,fe).map)return a(this,fe).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?a(this,fe).convertTo3DMapPosition(r.center[1],r.center[0],r.center[2]||this.elevation):void 0,n=r.zoomLevel!==void 0?a(this,Fe).cameraSystem.convertZoomLevelToAltitude(Gi(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,o=r.bearing!==void 0?Je.degToRad(r.bearing):void 0,i=r.pitch!==void 0?Je.degToRad(Gi(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(s=>{a(this,Fe).cameraSystem.animateCamera({position:t,zoom:n,rotation:o,tilt:i},r.duration||0,xa[r.easing||"ease-in-out"],()=>{a(this,Fe).interactionSystem.handleHover(),s()},s,{interruptible:r?.interruptible??!0})})}getCameraFrameForCoordinates(r,t){let n=z(this,t0,F2).call(this,t||{},()=>Promise.resolve()),{pointCloud:o}=bM(r,a(this,fe),a(this,xs).geometry3DMap);if(o.length===0)return R.error("No valid coordinates found in targets:",r),{center:this.center,zoomLevel:this.zoomLevel};let{center:i,zoomLevel:s}=a(this,Fe).cameraSystem.getCameraFrameForCoordinates(o,n);return{center:a(this,fe).convert3DMapPositionToCoordinate(i),zoomLevel:s}}focusOn(r,t){let{pointCloud:n,geoBounds:o,firstPosition:i}=bM(r,a(this,fe),a(this,xs).geometry3DMap);return n.length===0?(R.error("No valid coordinates found in targets:",r),Promise.resolve()):a(this,fe).mode==="outdoors-overlay"&&a(this,fe).map?(n.length===1&&i?a(this,fe).map?.flyTo({center:[i[0],i[1]],duration:t?.duration||a(this,fe).map.getBearing(),animate:!0,bearing:t?.bearing===void 0?a(this,fe).map.getBearing():t?.bearing,pitch:t?.pitch===void 0?a(this,fe).map.getPitch():t?.pitch,zoom:t?.maxZoomLevel||a(this,fe).map.getMaxZoom()}):(IV&&CV(a(this,fe),o),a(this,fe).map?.fitBounds(o,{duration:t?.duration??Ei.DEFAULT_ANIMATION_DURATION,bearing:t?.bearing===void 0?a(this,fe).map.getBearing():t?.bearing,pitch:t?.pitch===void 0?a(this,fe).map.getPitch():t?.pitch,maxZoom:t?.maxZoomLevel??a(this,fe).map.getMaxZoom()})),a(this,Fe).interactionSystem.handleHover(),Promise.resolve()):new Promise(s=>{a(this,Fe).cameraSystem.focusOn(n,z(this,t0,F2).call(this,t||{},s))})}};fe=new WeakMap,Fe=new WeakMap,xs=new WeakMap,e0=new WeakMap,t0=new WeakSet,F2=function(r,t){return{minZoom:r?.maxZoomLevel===void 0?void 0:a(this,Fe).cameraSystem.convertZoomLevelToAltitude(Gi(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:a(this,Fe).cameraSystem.convertZoomLevelToAltitude(Gi(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({},_h,r?.padding):this.insetsPadding,curve:xa[r?.easing||"ease-in-out"],rotation:r?.bearing===void 0?void 0:Je.degToRad(r.bearing),tilt:r?.pitch!==void 0?Je.degToRad(Gi(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:()=>{a(this,Fe).interactionSystem.handleHover(),t()},cancelledCallback:t,interruptible:r?.interruptible??!0,verticalPadding:r?.verticalPadding}};function w2(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 bM(e,r,t){let n=[],o=[1/0,1/0,-1/0,-1/0],i=null;if(!e||!Array.isArray(e)||e.length===0)return{pointCloud:n,geoBounds:o,firstPosition:i};let s=r.getSystems().renderSystem;for(let u of e)if(typeof u=="string"){(s.threeDdirty||s.twoDdirty)&&r.renderSync();let l=t.get(u);if(!l){R.error("Entity not found with id:",u);continue}let c=new dr;R6(r,"userData"in l?l.userData.entityId??l.id:l.id,n,c,l instanceof yr?l.position.z:void 0);let d=r.convert3DMapPositionToCoordinate(c.min),f=r.convert3DMapPositionToCoordinate(c.max);w2(o,d),w2(o,f),i||(i=r.convert3DMapPositionToCoordinate(c.getCenter(new ie)))}else n.push(r.convertTo3DMapPosition(u[1],u[0],u[2]||0)),w2(o,u),i||(i=u);return{pointCloud:n,geoBounds:o,firstPosition:i}}function CV(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}})}p();p();var vM=`uniform vec4 uSize;
13
13
  varying vec2 vUv;
14
14
  void main() {
15
15
  vUv = uv;
@@ -839,7 +839,7 @@ void main(void) {
839
839
  <path style=" stroke:none;fill-rule:nonzero;fill:rgb(94.117647%,94.117647%,94.117647%);fill-opacity:1;" d="M 2.25 7.5 L 2.25 7.125 L 9.75 7.125 L 9.75 7.5 Z M 2.25 7.5 "/>
840
840
  <path style=" stroke:none;fill-rule:nonzero;fill:rgb(94.117647%,94.117647%,94.117647%);fill-opacity:1;" d="M 2.25 10.125 L 2.25 9.75 L 9.75 9.75 L 9.75 10.125 Z M 2.25 10.125 "/>
841
841
  </g>
842
- </svg>`},sZ=/<svg([^>]*)>/g;function _O(e,r,t){let n=aZ[e];return n?n.replace(sZ,`<svg$1 xmlns="http://www.w3.org/2000/svg" style="fill:${r}; width:${t}px; height:${t}px">`):null}function uZ(e){return kO.sanitize(e,{USE_PROFILES:{svg:!0}})}function lZ(e,r){let o=new DOMParser().parseFromString(e,"image/svg+xml").documentElement;return o==null||o.tagName==="parsererror"||o.tagName.toLowerCase()!=="svg"?(R.error("Failed to parse SVG",{svg:e,tagName:o?.tagName}),e):(r!=null&&(o.setAttribute("color",r),o.querySelectorAll("*").forEach(u=>{(u.getAttribute("fill")!=null||u.tagName==="path")&&u.getAttribute("fill")!=="none"&&u.setAttribute("fill","currentColor"),u.getAttribute("stroke")!=null&&u.getAttribute("stroke")!=="none"&&u.setAttribute("stroke","currentColor")})),new XMLSerializer().serializeToString(o))}async function LO(e,r){let t="";try{if(e.trim()==="")throw new Error("URL is empty!");r?.style==="fill"&&(e=e.replace(".svg","-fill.svg"));let n=await oo()(e),o=n.headers.get("content-type");if(o?.includes("image/svg+xml")){let i=await n.text();return t=uZ(i),r?.color!=null&&(t=lZ(t,r.color)),{icon:t,type:"svg"}}else{if(o?.includes("image"))return{icon:e,type:"image"};throw new Error(`Expected SVG or Image content, but received: ${o}`)}}catch(n){return R.error(`Failed to fetch icon from ${e}.`,n),null}}p();function RO(e){return e.locationProfiles.some(r=>r.categories.some(t=>t.name.includes("Restroom")))}function NO(e){return e.locationProfiles.some(r=>r.categories.some(t=>t.name.includes("Parking")))}var cc={default:"#3D5676",connection:"#128387",washroom:"#3161B4",point:"#AD468F",parking:"#418425",door:"#A0552C"},Xd={elevator:"connection-elevator-12x12",escalator:"connection-stairs-12x12",stairs:"connection-stairs-12x12",point:"point-of-interest-12x12",door:"door-12x12",building:"building-12x12",ladder:"ladder-12x12"};function cZ(e){let r=null;if(lo.is(e))switch(e.type){case"elevator":r=Xd.elevator;break;case"ladder":r=Xd.ladder;break;case"escalator":case"stairs":default:r=Xd.stairs}else uo.is(e)?r=Xd.point:yn.is(e)?r=Xd.door:Rr.is(e)&&(r=Xd.building);return r!=null?_O(r,"#FFFFFF",12):null}function $O(e){return lo.is(e)?cc.connection:Rr.is(e)?cc.default:RO(e)?cc.washroom:NO(e)?cc.parking:uo.is(e)?cc.point:yn.is(e)?cc.door:cc.default}async function pZ(e,r){let t=null,n="locationProfiles"in e?e.locationProfiles.find(o=>o.icon!=null)?.icon:null;if(n?.url!=null&&(t=await LO(n.url,{color:r.color,style:"fill"})),t==null){let o=cZ(e);o!=null&&(t={icon:o,type:"svg"})}return t}async function dZ(e){return lo.is(e)||yn.is(e)?"low":uo.is(e)||Rr.is(e)?"high":"medium"}async function mZ(e){let r={appearance:{color:$O(e),pinOutlineColor:$O(e),iconPadding:8,iconSize:24,textSize:12.5,iconScale:{on:"zoom-level",input:[18,20],output:[.7,1]}},rank:await dZ(e),interactive:!0},t=await pZ(e,{color:"#FFFFFF"});return t!=null&&(r.appearance.icon=t.icon,t.type==="svg"?Rr.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 jO(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 n=>{let o=[],i=await mZ(n);return lo.is(n)?o=n.coordinates.map(s=>r.Labels.add(s,n.name,i)):Rr.is(n)?n.spaces.length>0&&n.floorStack.name!=null&&n.floorStack.name!==""&&o.push(r.Labels.add(n.spaces[0],n.floorStack.name,i)):"name"in n&&n.name!=null&&n.name!==""&&o.push(r.Labels.add(n,n.name,i)),o});return Promise.all(t).then(n=>n.flat())}async function UO(e,r){let t=[jO(e,r),vO(e,r)],[n]=await Promise.all(t);return{labels:n}}var W4=.05,uh,lh,sh=class extends Oe{constructor(t,n,o){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");C(this,uh,!1);C(this,lh,!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,"Shapes");m(this,"Style");m(this,"Image3D");m(this,"update",()=>{this.core.render()});this.core=t,this.mapView=n,this.externalPubSub=o,this.Camera=new B0(this),this.id=this.core.addGroupContainer("root").id.toString();let i=new $0("outdoors-container",void 0,void 0,this);this.mapObjects.push(i),this.currentMap=i,this.core.on("pre-render",()=>{o.publish("pre-render")}),this.core.on("post-render",()=>{o.publish("post-render")}),this.core.on("resize",()=>{o.publish("resize")}),this.core.on("render-error",({error:d})=>{o.publish("render-error",{error:new WI(d instanceof Error?d.message:"Unknown error")})});let s=d=>{let f=this.getMapDataObject(d);switch(f?.__type){case"facade":return f;case"floor":return f.floorStack.facade;default:return null}};this.core.on("geometry-in-focus",d=>{let f=new Set;for(let h of d){let b=s(h);b&&f.add(b)}o.publish("facades-in-view-change",{facades:Array.from(f)})}),this.core.getSystems().renderSystem.on("camera-state-change",()=>{o.publish("state-change-internal",{Camera:this.getCameraState()})});let u=new w0(this.Camera,{precision:7});this.core.on("camera-change",()=>{o.publish("camera-change",u)}),this.core.on("pan-bounds-change",d=>{o.publish("camera-bounds-change",Hy(d,this.core.convert3DMapPositionToCoordinate))});let l=d=>f=>{let h=[],b=[],I=[],E=[];f.labels.forEach(L=>{let N=this.Labels.getById(L.toString());N&&h.push(N.label)}),f.markers.forEach(L=>{let N=this.Markers.getById(L.toString())||this.Navigation.getMarkerById(L.toString());N&&b.push(N.marker)}),f.models.forEach(L=>{let N=this.Models.getById(L.toString());N&&I.push(N.model)}),f.paths.forEach(L=>{let N=this.Paths.getById(L.toString());N&&E.push(N)});let v=f.geometry,x;v.length>0&&(x=v.map(L=>this.getMapDataInternal()?.getById("space",L)).filter(Boolean)[0],x||(x=v.map(L=>this.getMapDataInternal()?.getById("object",L)).filter(Boolean)[0]),x||(x=v.map(L=>this.getMapDataInternal()?.getById("area",L)).filter(Boolean)[0]),x||(x=v.map(L=>this.Shapes.getById(L)).filter(Boolean)[0]));let D=f.containers.reduce((L,N)=>{let $=this.getMapDataInternal()?.getById("floor",N);return $&&jn.is($)&&L.push($),L},[]),w,S=0;if(D.length>0){w=D[0].id;let L=this.core.getState(w);S=f.coordinate[2]?f.coordinate[2]-L.altitude:S}let F;this.lastFacadeIntersected&&this.lastFacadeIntersected.spaces.forEach(L=>{this.core.setState(L.id,{hovered:!1})}),x&&Er.is(x)&&(F=v.map(L=>this.getMapDataInternal()?.facadesBySpaceId[L]).filter(Boolean)[0],F&&F.spaces.forEach(L=>{this.core.setState(L.id,{hovered:!0})})),this.lastFacadeIntersected=F;let P={coordinate:new ge({latitude:f.coordinate[1],longitude:f.coordinate[0],floorId:w,verticalOffset:S}),spaces:x&&Er.is(x)?[x]:[],objects:x&&Un.is(x)?[x]:[],areas:x&&Lo.is(x)?[x]:[],shapes:x&&ws.is(x)?[x]:[],markers:b,labels:h,models:I,paths:E,floors:D,facades:F?[F]:[]};"pointerEvent"in f&&(P.pointerEvent=f.pointerEvent),o.publish(d,P)};this.core.on("hover",l("hover")),this.core.on("click",l("click")),this.core.on("user-interaction-start",()=>{o.publish("user-interaction-start")}),this.core.on("user-interaction-end",()=>{o.publish("user-interaction-end")});let c={currentMapGetter:()=>this.currentMap};this.Markers=new j0(c),this.Models=new V0(c),this.Labels=new _0(c),this.Text3D=new eh(c),this.Exporter=new k0(c),this.Paths=new Z0(c),this.Navigation=new O0(this),this.on("navigation-state-change",d=>{this.externalPubSub.publish("state-change-internal",{Navigation:d})}),this.on("navigation-connection-click",d=>{this.externalPubSub.publish("navigation-connection-click",d)}),this.on("navigation-active-path-change",d=>{this.externalPubSub.publish("navigation-active-path-change",d)}),this.Outdoor=new Wd(this.core,this.hiddenOutdoorGeometries),this.Outdoor.enabled&&(this.core.on("outdoor-view-loaded",()=>{o.publish("outdoor-view-loaded")}),this.core.on("outdoor-style-loaded",()=>{o.publish("outdoor-style-loaded")})),this.Image3D=new G0(c),this.Shapes=new X0(c),this.Style=new Y0(c)}get manualFloorVisibility(){return a(this,uh)}set manualFloorVisibility(t){T(this,uh,t),this.externalPubSub.publish("state-change-internal",{manualFloorVisibility:t})}get hidePathsNotOnCurrentFloor(){return a(this,lh)}set hidePathsNotOnCurrentFloor(t){T(this,lh,t),this.currentMap?.updatePathLayersVisibility()}preloadFloors(t){t.forEach(n=>{n instanceof jn&&this.core.setState(n.id,{preloadGeometry:!0})})}updateState(t,n){if(n==null||typeof n!="object")return;if(t==="interior-walls"){this.currentMap.floors.forEach(i=>{let s=i.layers.get(or);if(s){let u=s.layers.get(lu);u&&this.core.hasState(u)&&this.core.setState(u,II(wt(xI,n,{warn:!0}),this.core.getState(u)))}});return}if(t==="exterior-walls"){this.currentMap.floors.forEach(i=>{let s=i.layers.get(or);if(s){let u=s.layers.get(ma);u&&this.core.hasState(u)&&this.core.setState(u,II(wt(xI,n,{warn:!0}),this.core.getState(u)))}});return}if(t==="interior-doors"){this.currentMap.floors.forEach(i=>{let s=i.layers.get(or);if(s){let u=s.layers.get(Vp);u&&this.core.hasState(u)&&this.core.setState(u,B4(wt(O4,n,{warn:!0}),this.core.getState(u)))}});return}if(t==="exterior-doors"){this.currentMap.floors.forEach(i=>{let s=i.layers.get(or);if(s){let u=s.layers.get(Hp);u&&this.core.hasState(u)&&this.core.setState(u,B4(wt(O4,n,{warn:!0}),this.core.getState(u)))}});return}let o=typeof t=="string"?this.getMapDataObject(t):t;if(o){if(o.__type!==Fi.__type&&!this.core.hasState(o.id)){R.warn(`Failed to update state for "${o.id}". No ${o.__type} found with that ID.`);return}if(Ts.is(o))return this.core.setState(o.id,qA(wt(YA,n,{warn:!0}),this.core.getState(o.id)));if(Ca.is(o))return this.core.setState(o.id,tO(wt(QA,n,{warn:!0}),this.core.getState(o.id)));if(Er.is(o)||Un.is(o)){let i=this.core.getState(o.id);i!=null&&this.core.setState(o.id,JA(wt(dI,n,{warn:!0}),i))}if(Lo.is(o)&&this.core.setState(o.id,wt(dI,n,{warn:!0})),tc.is(o)&&this.core.setState(o.id,wt(fO,n,{warn:!0})),yn.is(o)&&this.core.setState(o.id,B4(wt(O4,n,{warn:!0}),this.core.getState(o.id))),ws.is(o)&&this.core.setState(o.id,aO(wt(bI,n,{warn:!0}))),nc.is(o)){let{position:i,scale:s,rotation:u,...l}=wt(yO,n,{warn:!0}),c=l;i&&(c.position=[i.longitude,i.latitude,i.verticalOffset]),s!=null&&(Array.isArray(s)?c.scale=s:c.scale=[s,s,s]),u!=null&&(Array.isArray(u)?c.rotation=u:c.rotation=[u,u,u]),i&&o.updateTarget(i),this.core.setState(o.id,c)}if(jn.is(o)){let i=this.currentMap.floorsById.get(o.id);if(i==null)return;let s=wt(HA,n,{warn:!0});this.core.setState(o.id,s);let u=i.layers.get(or);u!=null&&"geometry"in n&&n.geometry&&this.core.setState(u.containerId,wt(NA,n.geometry,{warn:!0}));let l=i.layers.get(fa);if(l!=null&&"labels"in n&&n.labels){let E=wt($A,n.labels,{warn:!0});"enabled"in E&&typeof E.enabled=="boolean"&&l.setVisible(E.enabled)}let c=i.layers.get(yi);if(c!=null&&"markers"in n&&n.markers){let E=wt(jA,n.markers,{warn:!0});"enabled"in E&&typeof E.enabled=="boolean"&&c.setVisible(E.enabled)}let d=i.layers.get(Zp);d!=null&&"footprint"in n&&n.footprint&&this.core.setState(d.containerId,wt(RA,n.footprint,{warn:!0}));let f=i.layers.get(xl);if(f!=null&&"occlusion"in n&&n.occlusion){let E=wt(GA,n.occlusion,{warn:!0});"enabled"in E&&typeof E.enabled=="boolean"&&f.setVisible(E.enabled)}let h=i.layers.get(Wp);if(h!=null&&"images"in n&&n.images){let E=wt(UA,n.images,{warn:!0});"visible"in E&&typeof E.visible=="boolean"&&h.setVisible(E.visible)}let b=i.layers.get(ha);if(b!=null&&"paths"in n&&n.paths!=null){let E=wt(zA,n.paths,{warn:!0});E.visible!=null&&typeof E.visible=="boolean"&&b.setVisible(E.visible)}let I=i.layers.get(Il);if(I!=null&&"areas"in n&&n.areas!=null){let E=wt(VA,n.areas,{warn:!0});E.visible!=null&&typeof E.visible=="boolean"&&I.setVisible(E.visible)}}if(Rr.is(o)){let i=this.core.getState(o.id);for(let s of i.children)s.type==="group-container"&&this.core.setState(s.id,wt(wA,n,{warn:!0}))}if(Ou.is(o)&&this.core.setState(o.id,wt(cO,n,{warn:!0})),Fi.is(o))for(let i of o.segments)this.core.setState(i.id,wt(gI,n,{warn:!0}));Mu.is(o)&&this.core.setState(o.id,wt(gI,n,{warn:!0}))}}getMapDataObject(t){return this.getMapDataInternal()?.getMapDataById(t)}getMapDataInternal(){if(this.mapData)return Sm(this.mapData)}getMapData(){return this.mapData}addMap(t,n){return new Promise(o=>{let i;try{i=Sm(t)}catch(h){R.error("Error adding map",h),o(t);return}this.mapDataExternal[t.mapName]=t,this.mapData=t;let{mvf:s}=i,u=s["manifest.geojson"].features[0].geometry.coordinates;this.core.mode!=="outdoors-overlay"&&this.Camera.set({center:new ge(u[1],u[0])});let l=s["manifest.geojson"].features[0].properties.name,c=new $0(`mapObject-${l}`,i,n,this);this.currentMap=c,this.currentMap.loadAllFloors(),this.currentMap.setFloor(this.currentMap.startingFloorId);let d=this.core.getBoundingArea(c.currentFloor.id);d==null&&R.error("Could not determine bounding box for map:",c.currentFloor.id);let f=n?.outdoorView?.layersHiddenByGeometry??[];if(f.length>0){let h,b=[];for(let I of c.floorStacksById.values())if(I.defaultFloor.footprint&&I.defaultFloor.footprint.geometry!=null&&I.defaultFloor.footprint.geometry?.coordinates.length>0){let E=I.defaultFloor.footprint,v=Vy(E);h==null?h=v:Ww(h,v),b.push(E)}b.length>0&&h!=null&&(this.core.hideOutdoorLayersIntersectingPolygons(h,b,f),this.hiddenOutdoorGeometries.push([h,b,f]))}if(this.mapObjects.push(c),i.getMVFFeatureByType("floor").forEach(h=>{this.mapsByFloorId[h.id]=c}),c.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})}),c.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})}),n?.zoomLevel!=null)this.core.camera.setZoomLevel(n.zoomLevel),o(t);else if(this.core.mode!=="outdoors-overlay"&&d){let h=n?.screenOffsets??{top:W4*this.core.canvasHeight,left:W4*this.core.canvasWidth,right:W4*this.core.canvasWidth,bottom:W4*this.core.canvasHeight};this.core.camera.focusOn(d,{duration:kw,padding:h}).then(()=>{this.Camera.setElevation(this.currentFloor.elevation),o(t)})}else o(t)})}setFloor(t,n){return this.currentMap.setFloor(yf(t),n)}setFloorStack(t,n){return this.currentMap.setFloorStack(yf(t),n)}updateWatermark(t){this.core.updateWatermark(t)}get currentFloorStack(){let t=this.currentMap.currentFloorStack.id;if(!t)throw new Mr("Missing currentFloorStack.");let n=this.mapData?.getById("floor-stack",t);if(!n)throw new Mr("FloorStack was not found in map data.");return n}get currentFloor(){let t=this.currentMap.currentFloor.id;if(!t)throw new Mr("Missing currentFloor object from GeoJsonApi");let n=this.mapData?.getById("floor",t);if(!n)throw new Mr("Missing currentFloor");return n}getState(t){typeof t=="object"&&Fi.is(t)&&R.warn("Cannot get state of a Path directly. Use getState() on individual segments within Path.segments[] instead.");let n=Zw(t,this),o=this.core.getState(n);if(o){if(["interior-walls","exterior-walls"].includes(t)&&o.type==="geometry-group")return mO(o);if(["interior-doors","exterior-doors"].includes(t)&&o.type==="geometry-group")return DA(o);if(o.type==="geometry")return XA(o);if(o.type==="label"&&o.options.appearance&&o.options.rank!==void 0&&o.options.interactive!==void 0)return KA(o);if(o.type==="marker"&&o.options?.rank!==void 0&&o.options.interactive!==void 0)return eO(o,this.Markers.getById(o.id.toString())?.marker);if(o.type==="model")return bO(o);if(o.type==="image")return hO(o);if(o.type==="text3d")return pO(o);if(o.type==="geometry-group"&&t&&typeof t!="string"&&ws.is(t))return iO(o);if(o.type==="path")return nO(o);if(o.type==="group-container"&&typeof t!="string"&&jn.is(t))return ZA(o,this.currentMap.floorsById.get(t.id),this.core);if(o.type==="group-container"&&o.children.length>0&&typeof t!="string"&&Rr.is(t)){let i=this.core.getState(o.children[0].id);return FA(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,n,o){if(o!=null){let c=this.core.projectScreenXYToCoordinate(t,n,!0);return c?new ge(c.coordinate[1],c.coordinate[0],o.id):void 0}let i=this.core.projectScreenXYToCoordinate(t,n);if(i==null||i.coordinate==null)return;let{coordinate:s,groupContainers:u}=i,l=u?.find(c=>{let d=c.userData.entityId.toString();return d.includes("f_")||d.includes("m_")})?.userData.entityId.toString();return new ge(s[1],s[0],l)}getScreenCoordinateFromCoordinate(t){let n=0;if(t.floorId!=null){let o=this.mapData?.getById("floor",t.floorId);o!=null&&(n=this.getState(o)?.altitude??0)}return this.core.projectCoordinateToScreenXY([t.longitude,t.latitude,n])}isInView(t){return this.core.isInView(typeof t=="string"?t:t.id)}getInView(t,n){let o=this.core.queryGeometry2DInView({screenOffsets:n?.screenOffsets,fullyContains:n?.fullyContains});if(o.length===0)return[];let i=[];switch(t){case Ts.__type:i=o.map(s=>this.Labels.getById(s)).filter(s=>s!=null).map(s=>s.label);break;case Ca.__type:i=o.map(s=>this.Markers.getById(s)).filter(s=>s!=null).map(s=>s.marker)}return i}async __EXPERIMENTAL__auto(){let t=this.getMapDataInternal();if(!t)throw new Error("Map data not found");return await UO(t,this)}tween(t){let n=new Ii(t);return this.core.getExternalTweenGroup().add(n),this.core.render(),n}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.Shapes.removeAll(),this.Paths.removeAll(),this.Models.removeAll(),this.Markers.removeAll(),this.Image3D.removeAll(),this.Labels.removeAll()}destroy(){this.clear(),this.core.destroy()}getOptimalVisualDistanceBetweenFloors(t,n=!1){let o=this.currentMap;if(!o){R.error("Cannot compute optimal visual distance between floors. Missing current map.");return}if(t.length<2){R.warn("Cannot compute optimal visual distance between floors. Must provide at least 2 floors.");return}let i=o.renderer.getInternalState().geometry3DMap.get(t[0].id),s=o.renderer.getInternalState().geometry3DMap.get(t[1].id);if(!i||!s){R.warn("Cannot compute optimal visual distance between floors. Floors not found in current map.");return}if(Ec(i,"group-container"),Ec(s,"group-container"),n){let l=new dr;l.setFromObject(i);let c=new dr;if(c.setFromObject(s),i.children.forEach(v=>{v instanceof Pe&&v.userData.debugBox&&Ht(v)}),s.children.forEach(v=>{v instanceof Pe&&v.userData.debugBox&&Ht(v)}),!Uu(l)||!Uu(c))return;let d=new qo(l.max.x-l.min.x,l.max.y-l.min.y,l.max.z-l.min.z),f=new gr({color:255,transparent:!0,opacity:.5}),h=new Pe(d,f);h.position.set((l.min.x+l.max.x)/2,(l.min.y+l.max.y)/2,(l.min.z+l.max.z)/2),h.userData.debugBox=!0;let b=new qo(c.max.x-c.min.x,c.max.y-c.min.y,c.max.z-c.min.z),I=new gr({color:"cyan",transparent:!0,opacity:.5}),E=new Pe(b,I);E.position.set((c.min.x+c.max.x)/2,(c.min.y+c.max.y)/2,(c.min.z+c.max.z)/2),E.userData.debugBox=!0,i.add(h),s.add(E)}let u=o.renderer.computeMinZOffsetBetweenContainers(i,s);if(u!==-1)return u}};uh=new WeakMap,lh=new WeakMap;function fZ(e){if(e===""){Y2(""),J2("");return}J2(`${e}/${yb}`),Y2(`${e}/${gb}`)}p();var X4=class{constructor(r){m(this,"state");m(this,"update");this.update=r.Debug.update.bind(r.Debug),this.state=r.Debug.state}};p();import Fa from"zod";var GO=Fa.strictObject({environment:Fa.union([Fa.literal("basic"),Fa.literal(!1)]).optional(),text3d:Fa.object({hoverColor:Fa.string().optional()}).optional(),geometry:Fa.object({hoverColor:Fa.string().optional()}).optional(),backgroundColor:Fa.string().optional(),backgroundAlpha:Fa.number().optional()});p();var OI=rb(l8(),1);var hZ=(e,r)=>{let t={},n=(o,i,s)=>{for(let u in i){let l=o[u],c=i[u];typeof c=="object"&&!Array.isArray(c)&&c!==null&&typeof l=="object"&&!Array.isArray(l)&&l!==null?(s[u]={},n(l,c,s[u])):s[u]=l}};return n(e,r,t),t},zO=(e,r)=>{let t=hZ(e,r),n=(0,OI.default)({},t,r),o=(0,OI.default)({},t),i=(s,u,l,c=o)=>{for(let d in u){let f=s[d],h=u[d];if(typeof h=="number"&&typeof f=="number")c[d]=f+(h-f)*l;else if(typeof h=="string"&&typeof f=="string"){if(cm(f)&&cm(h)){let b=ab(f),I=ab(h);b&&I?c[d]=g6([b[0]+(I[0]-b[0])*l,b[1]+(I[1]-b[1])*l,b[2]+(I[2]-b[2])*l]):R.warn(`Color "${d}" could not be animated!`)}}else typeof h=="object"&&h!==null&&typeof f=="object"&&f!==null?i(f,h,l,c[d]):R.warn(`Value "${d}" could not be animated!`)}};return s=>(s=Math.min(Math.max(s,0),1),s===0?e:s===1?n:(i(t,r,s),o))};var pc,re,Yo,ch=class{constructor(r){C(this,pc);C(this,re);C(this,Yo);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,"Style");m(this,"Shapes");m(this,"Outdoor");m(this,"update",()=>{a(this,re).core.render()});m(this,"__LEGACY_GET_DIRECTIONS_SYNC",(r,t,n)=>a(this,re).getMapData()?.__LEGACY_GET_DIRECTIONS_SYNC(r,t,n)??void 0);m(this,"getDirections",(r,t,n)=>a(this,re).getMapData()?.getDirections(r,t,n)??Promise.resolve(void 0));m(this,"__LEGACY_GET_DIRECTIONS_MULTI_DESTINATION_SYNC",(r,t,n)=>a(this,re).getMapData()?.__LEGACY_GET_DIRECTIONS_MULTI_DESTINATION_SYNC(r,t,n)??void 0);m(this,"getDirectionsMultiDestination",(r,t,n)=>a(this,re).getMapData()?.getDirectionsMultiDestination(r,t,n)??Promise.resolve(void 0));m(this,"on",(r,t)=>{a(this,pc).on(r,t)});m(this,"off",(r,t)=>{a(this,pc).off(r,t)});m(this,"Debug");T(this,pc,new Oe),T(this,Yo,r);let t=new sh(r,this,a(this,pc));T(this,re,t),this.Camera=a(this,re).Camera,this.Markers=a(this,re).Markers,this.Models=a(this,re).Models,this.Labels=a(this,re).Labels,this.Text3D=a(this,re).Text3D,this.Exporter=a(this,re).Exporter,this.Paths=a(this,re).Paths,this.Navigation=a(this,re).Navigation,this.Shapes=a(this,re).Shapes,this.Style=a(this,re).Style,this.Outdoor=a(this,re).Outdoor,this.Image3D=a(this,re).Image3D,a(this,Yo).container.dataset.version=y.env.npm_package_version,this.Debug=new X4(a(this,re).core)}updateState(r,t){return a(this,re).updateState(r,t)}animateState(r,t,n){let o=a(this,re).getState(r);if(o==null)return R.warn(`Cannot animate state of ${r}.`),new Promise(c=>c({result:"completed"}));let i=zO(o,t),s=a(this,re).tween({percent:0}).to({percent:1},n?.duration??1e3).onUpdate(({percent:l})=>{a(this,re).updateState(r,i(l))});n?.easing&&n.easing in xa&&s.easing(xa[n.easing]);let u=new Promise(l=>{s.onComplete(()=>{a(this,re).removeTween(s),l({result:"completed"})}).onStop(()=>{a(this,re).removeTween(s),l({result:"cancelled"})}),s.start()});return u.cancel=()=>{s.stop(),a(this,re).updateState(r,i(0))},u}updateGlobalState(r){try{GO.parse(r)}catch(t){R.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 n=r.backgroundColor??a(this,re).core.backgroundColor,o=r.backgroundAlpha??a(this,re).core.backgroundAlpha;a(this,re).core.setBackgroundColor(n,o)}r.environment!=null&&a(this,re).core.setEnvironment(r.environment),a(this,re).core.setState(t)}}get options(){return Rw(a(this,re).currentMap.options)}getGlobalState(){let r=a(this,re).core.getState();return{backgroundColor:a(this,re).core.backgroundColor,backgroundAlpha:a(this,re).core.backgroundAlpha,environment:a(this,re).core.getEnvironment(),geometry:{hoverColor:r.hoverColor},text3d:{hoverColor:r.text3dHoverColor}}}getMapData(){if(a(this,re).mapData==null)throw new Mr("MapData not found.");return a(this,re).mapData}getDimensions(){return{width:a(this,Yo).canvasWidth,height:a(this,Yo).canvasHeight}}addMap(r,t){return a(this,re).addMap(r,t)}setFloor(r,t){return a(this,re).setFloor(r,t?.context)}setFloorStack(r,t){return a(this,re).setFloorStack(r,t?.context)}preloadFloors(r){a(this,re).preloadFloors(r)}tween(r){return a(this,re).tween(r)}removeTween(r){a(this,re).removeTween(r)}get tweenGroup(){return a(this,re).tweenGroup()}get currentFloorStack(){return a(this,re).currentFloorStack}get currentFloor(){return a(this,re).currentFloor}updateWatermark(r){a(this,re).updateWatermark(r)}getState(r){return a(this,re).getState(r)}setHoverColor(r){a(this,re).setHoverColor(r)}getHoverColor(){return a(this,re).getHoverColor()}convertAltitudeToMercatorZoomLevel(r){return a(this,re).core.getSystems().cameraSystem.convertAltitudeToZoomLevel(r)}convertMercatorZoomLevelToAltitude(r){return a(this,re).core.getSystems().cameraSystem.convertZoomLevelToAltitude(r)}isInView(r){return a(this,re).isInView(r)}getInView(r,t){return a(this,re).getInView(r,t)}getMetersPerPixel(){return a(this,re).core.getMetersPerPixel()}getDistance(r,t){return a(this,re).getMapData()?.getDistance(r,t)}createCoordinate(r,t,n){return typeof r=="object"?new ge(r):new ge(r,t,n?.id)}createCoordinateFromScreenCoordinate(r,t,n){return a(this,re).createCoordinateFromScreenCoordinate(r,t,n)}getScreenCoordinateFromCoordinate(r){return a(this,re).getScreenCoordinateFromCoordinate(r)}__EXPERIMENTAL__auto(){return a(this,re).__EXPERIMENTAL__auto()}get __core(){if(y.env.INTERNAL==="true")return a(this,re).core;throw new Error("__core is not available.")}get container(){return a(this,Yo).container}publishAllState(){a(this,re).publishAllState()}clear(){a(this,re).clear()}destroy(){a(this,re).destroy()}async enableDebug(r={}){let{Inspector:t}=await import("./inspector-J5CSSXEZ.js");await new t(this,a(this,re)).enable(r)}async takeScreenshot(r){let t={withOutdoorContext:r?.withOutdoorContext??!1},n=a(this,Yo).rendererDomElement;if(t.withOutdoorContext){let o=a(this,Yo).map;if(!o)return await a(this,Yo).renderSync(),n.toDataURL("image/png");o.loaded()||await new Promise(l=>{o.once("idle",l)});let i=o.getCanvas(),s=document.createElement("canvas"),u=s.getContext("2d");if(s.width=n.width,s.height=n.height,!u)throw new Error("Failed to get 2D context for composite canvas");return u.drawImage(i,0,0,s.width,s.height),u.drawImage(n,0,0,s.width,s.height),s.toDataURL("image/png")}return await a(this,Yo).renderSync(),n.toDataURL("image/png")}get manualFloorVisibility(){return a(this,re).manualFloorVisibility}set manualFloorVisibility(r){a(this,re).manualFloorVisibility=r}getOptimalVisualDistanceBetweenFloors(r){return a(this,re).getOptimalVisualDistanceBetweenFloors(r)}get __INTERNAL__hidePathsNotOnCurrentFloor(){return a(this,re).hidePathsNotOnCurrentFloor}set __INTERNAL__hidePathsNotOnCurrentFloor(r){a(this,re).hidePathsNotOnCurrentFloor=!!r}};pc=new WeakMap,re=new WeakMap,Yo=new WeakMap;p();var gZ=1e3*60*60*2,Lu,Yd,Lt,Ma,Li,Ko,Ri,Kd,qd,ph,Gt,VO,HO,Jd,J4,BI,PI,kI,Qd=class{constructor(r,t){C(this,Gt);C(this,Lu,new Oe);C(this,Yd);C(this,Lt);C(this,Ma);C(this,Li);C(this,Ko);C(this,Ri);C(this,Kd);C(this,qd);C(this,ph,()=>{"key"in a(this,Lt)&&"secret"in a(this,Lt)&&z(this,Gt,Jd).call(this),z(this,Gt,J4).call(this)});m(this,"on",(r,t)=>a(this,Lu).on(r,t));m(this,"off",(r,t)=>a(this,Lu).off(r,t));T(this,Yd,r),T(this,Lt,t)}setMapIds(r){T(this,Yd,r)}setEnterprise(r){a(this,Lt).enterprise=r}async readySync(){if((!("key"in a(this,Lt))||!("secret"in a(this,Lt)))&&!("accessToken"in a(this,Lt))){R.error("No API keys or access token provided! Cannot preload tokens.");return}let r=[z(this,Gt,Jd).call(this),null];a(this,Lt).enterprise||(r[1]=this.getSasTokensAsync());let[t,n]=await Promise.all(r);z(this,Gt,kI).call(this),z(this,Gt,BI).call(this,t),n!=null&&z(this,Gt,PI).call(this,n),lm()&&globalThis.addEventListener?.("focus",a(this,ph))}async refreshing(){let r=[];return a(this,Ma)!=null&&r.push(a(this,Ma)),a(this,Li)!=null&&r.push(a(this,Li)),Promise.all(r)}getAccessTokenAsync(){return z(this,Gt,Jd).call(this)}getSasTokensAsync(){return z(this,Gt,J4).call(this)}getAccessToken(){return a(this,Ko)==null?(R.error("Tokens must be loaded before reading synchronously! Try awaiting readySync() first."),{token:""}):a(this,Ko)}getSasToken(r){return this.isEnterpriseMode()?(R.error("SAS tokens are not available in the enterprise mode!"),{token:""}):a(this,Ri)==null?(R.error("Tokens must be loaded before reading synchronously! Try awaiting readySync() first."),{token:""}):r in a(this,Ri).tokens?a(this,Ri).tokens[r]:(R.error(`SAS token for map ${r} not found!`),{token:""})}isEnterpriseMode(){return a(this,Lt).enterprise??!1}destroy(){z(this,Gt,kI).call(this),a(this,Lu).destroy(),lm()&&globalThis.removeEventListener("focus",a(this,ph))}};Lu=new WeakMap,Yd=new WeakMap,Lt=new WeakMap,Ma=new WeakMap,Li=new WeakMap,Ko=new WeakMap,Ri=new WeakMap,Kd=new WeakMap,qd=new WeakMap,ph=new WeakMap,Gt=new WeakSet,VO=function(r){let t=r.token!==a(this,Ko)?.token;T(this,Ko,r),t&&a(this,Lu).publish("access-token-refreshed",{accessToken:r})},HO=function(r){let t=JSON.stringify(r.tokens)!==JSON.stringify(a(this,Ri)?.tokens);T(this,Ri,r),t&&a(this,Lu).publish("sas-tokens-refreshed",{sasTokens:r.tokens})},Jd=async function(r=!1){if("accessToken"in a(this,Lt)&&typeof a(this,Lt).accessToken=="string"){let t={token:a(this,Lt).accessToken,expires:Date.now()+72e5};return T(this,Ko,t),t}if(!("key"in a(this,Lt))||!("secret"in a(this,Lt))||typeof a(this,Lt).key!="string"||typeof a(this,Lt).secret!="string")throw new Error("No API keys or access token provided!");return a(this,Ma)!=null?a(this,Ma):a(this,Ko)!=null&&a(this,Ko).expires!=null&&a(this,Ko).expires>Date.now()&&!r?a(this,Ko):(T(this,Ma,pf({...a(this,Lt),key:a(this,Lt).key,secret:a(this,Lt).secret},a(this,Lt).enterprise??!1).then(t=>{let n={token:t.accessToken,expires:t.expiresTimestamp*1e3};return z(this,Gt,VO).call(this,n),n}).catch(t=>{throw t}).finally(()=>{T(this,Ma,void 0)})),a(this,Ma))},J4=async function(r=!1){return this.isEnterpriseMode()?{tokens:{},expires:1/0}:a(this,Li)!=null?a(this,Li):a(this,Ri)!=null&&a(this,Ri).expires>Date.now()&&!r?a(this,Ri):(T(this,Li,new Promise((t,n)=>{z(this,Gt,Jd).call(this).then(o=>{let i={},s=a(this,Yd).map(u=>Z3({...a(this,Lt),mapId:u},o.token).then(l=>{i[u]={token:l.token,expires:l.expires}}).catch(l=>{R.error(`Error getting SAS token for map ${u}:`,l)}));Promise.all(s).then(()=>{let u={tokens:i,expires:Math.min(...Object.values(i).map(l=>l.expires??1/0))};z(this,Gt,HO).call(this,u),t(u)})}).catch(o=>{n(o)})})),a(this,Li).catch(t=>{throw t}).finally(()=>{T(this,Li,void 0)}),a(this,Li))},BI=function(r){if(!("key"in a(this,Lt))||!("secret"in a(this,Lt)))return;let t=r.expires!=null?r.expires-Date.now():gZ;isFinite(t)&&T(this,Kd,setTimeout(()=>{z(this,Gt,Jd).call(this,!0).then(n=>{z(this,Gt,BI).call(this,n)})},t-XT))},PI=function(r){let t=r.expires-Date.now();isFinite(t)&&T(this,qd,setTimeout(()=>{z(this,Gt,J4).call(this,!0).then(n=>{z(this,Gt,PI).call(this,n)})},t-KT))},kI=function(){a(this,Kd)!=null&&clearTimeout(a(this,Kd)),a(this,qd)!=null&&clearTimeout(a(this,qd))};p();var yZ=async(e,r)=>{let t=("mvfVersion"in(r??{})?r?.mvfVersion:void 0)??("options"in e&&"version"in(e.options??{})?e.options?.version:void 0),n={prefetchTokens:!0,...r||{},mvfVersion:t},o,i=ou();i.updateByUserOption(n);let s={};if("type"in e&&typeof e.type=="string"){if(s.enterprise=e.options?.enterprise,e.type==="binary"&&e.main instanceof Uint8Array){o=await Ay(e.main,n.mvfVersion),s.languagePacks=[];for(let I of e.languagePacks??[])I.localePack instanceof Uint8Array&&s.languagePacks.push({language:I.language,localePack:await Tp(I.localePack)})}else if(e.type==="json")o=e.main,s.languagePacks=e.languagePacks??[];else throw new Error("Invalid backup type");e.type==="binary"&&e.main instanceof Uint8Array&&(s.binaryBundle=e.main)}else o=e,s.enterprise=o.enterprise!=null;i.setEnterprise(s.enterprise??!1);let u=My(o),l=u.length>0?u:[n.mapId];n.baseAuthUri=i.getBaseAuthUri();let c=new Qd(l,{...n,enterprise:s.enterprise}),d;if("accessToken"in n&&n.accessToken)d=n.accessToken;else if("key"in n&&"secret"in n){let I;try{I=await c.getAccessTokenAsync()}catch(E){R.error("Failed getting token during hydrateMapData",E)}d=I?.token||""}if(s.outdoorViewToken=d,s.env=i,s.getMapDataOptions=n,n.prefetchTokens)try{await c.readySync()}catch(I){R.error("Failed to ready token manager!",I)}_f()&&(s.enterprise&&R.warn("forceEnterpriseLocations is enabled, but the map is already an enterprise map!"),n.mvfVersion!=="3.0.0"&&R.warn("mvfVersion must be '3.0.0' when forceEnterpriseLocations is enabled!"));let f=new Nl(o,s);d&&f.Analytics.init({accessToken:d,mapId:n.mapId,key:"key"in n?n.key:void 0,secret:"secret"in n?n.secret:void 0,...n.analytics,baseUri:i.getAnalyticsBaseUri(),context:n.analytics?.context});let h=new Cm(f),b=f.findPreferredLanguage({languageCode:n.language,fallbackToNavigatorLanguage:!1});if(b)try{await h.changeLanguage(b.code)}catch{}return typeof r?.onMVFParsed=="function"&&r.onMVFParsed(o),h};p();var ZO=(e,{id:r}={})=>{let t=Array.isArray(e)?e:[e];if(!t.every(i=>typeof i=="string"))return;let n=t.join(""),o=null;if(r){let i=document.getElementById(r);i instanceof HTMLStyleElement&&(o=i)}o==null&&(o=document.createElement("style")),r&&r!==""&&(o.id=r),o.textContent=n,document.head.appendChild(o)};var WO=`:root {
842
+ </svg>`},sZ=/<svg([^>]*)>/g;function _O(e,r,t){let n=aZ[e];return n?n.replace(sZ,`<svg$1 xmlns="http://www.w3.org/2000/svg" style="fill:${r}; width:${t}px; height:${t}px">`):null}function uZ(e){return kO.sanitize(e,{USE_PROFILES:{svg:!0}})}function lZ(e,r){let o=new DOMParser().parseFromString(e,"image/svg+xml").documentElement;return o==null||o.tagName==="parsererror"||o.tagName.toLowerCase()!=="svg"?(R.error("Failed to parse SVG",{svg:e,tagName:o?.tagName}),e):(r!=null&&(o.setAttribute("color",r),o.querySelectorAll("*").forEach(u=>{(u.getAttribute("fill")!=null||u.tagName==="path")&&u.getAttribute("fill")!=="none"&&u.setAttribute("fill","currentColor"),u.getAttribute("stroke")!=null&&u.getAttribute("stroke")!=="none"&&u.setAttribute("stroke","currentColor")})),new XMLSerializer().serializeToString(o))}async function LO(e,r){let t="";try{if(e.trim()==="")throw new Error("URL is empty!");r?.style==="fill"&&(e=e.replace(".svg","-fill.svg"));let n=await oo()(e),o=n.headers.get("content-type");if(o?.includes("image/svg+xml")){let i=await n.text();return t=uZ(i),r?.color!=null&&(t=lZ(t,r.color)),{icon:t,type:"svg"}}else{if(o?.includes("image"))return{icon:e,type:"image"};throw new Error(`Expected SVG or Image content, but received: ${o}`)}}catch(n){return R.error(`Failed to fetch icon from ${e}.`,n),null}}p();function RO(e){return e.locationProfiles.some(r=>r.categories.some(t=>t.name.includes("Restroom")))}function NO(e){return e.locationProfiles.some(r=>r.categories.some(t=>t.name.includes("Parking")))}var cc={default:"#3D5676",connection:"#128387",washroom:"#3161B4",point:"#AD468F",parking:"#418425",door:"#A0552C"},Xd={elevator:"connection-elevator-12x12",escalator:"connection-stairs-12x12",stairs:"connection-stairs-12x12",point:"point-of-interest-12x12",door:"door-12x12",building:"building-12x12",ladder:"ladder-12x12"};function cZ(e){let r=null;if(lo.is(e))switch(e.type){case"elevator":r=Xd.elevator;break;case"ladder":r=Xd.ladder;break;case"escalator":case"stairs":default:r=Xd.stairs}else uo.is(e)?r=Xd.point:yn.is(e)?r=Xd.door:Rr.is(e)&&(r=Xd.building);return r!=null?_O(r,"#FFFFFF",12):null}function $O(e){return lo.is(e)?cc.connection:Rr.is(e)?cc.default:RO(e)?cc.washroom:NO(e)?cc.parking:uo.is(e)?cc.point:yn.is(e)?cc.door:cc.default}async function pZ(e,r){let t=null,n="locationProfiles"in e?e.locationProfiles.find(o=>o.icon!=null)?.icon:null;if(n?.url!=null&&(t=await LO(n.url,{color:r.color,style:"fill"})),t==null){let o=cZ(e);o!=null&&(t={icon:o,type:"svg"})}return t}async function dZ(e){return lo.is(e)||yn.is(e)?"low":uo.is(e)||Rr.is(e)?"high":"medium"}async function mZ(e){let r={appearance:{color:$O(e),pinOutlineColor:$O(e),iconPadding:8,iconSize:24,textSize:12.5,iconScale:{on:"zoom-level",input:[18,20],output:[.7,1]}},rank:await dZ(e),interactive:!0},t=await pZ(e,{color:"#FFFFFF"});return t!=null&&(r.appearance.icon=t.icon,t.type==="svg"?Rr.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 jO(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 n=>{let o=[],i=await mZ(n);return lo.is(n)?o=n.coordinates.map(s=>r.Labels.add(s,n.name,i)):Rr.is(n)?n.spaces.length>0&&n.floorStack.name!=null&&n.floorStack.name!==""&&o.push(r.Labels.add(n.spaces[0],n.floorStack.name,i)):"name"in n&&n.name!=null&&n.name!==""&&o.push(r.Labels.add(n,n.name,i)),o});return Promise.all(t).then(n=>n.flat())}async function UO(e,r){let t=[jO(e,r),vO(e,r)],[n]=await Promise.all(t);return{labels:n}}var W4=.05,uh,lh,sh=class extends Oe{constructor(t,n,o){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");C(this,uh,!1);C(this,lh,!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,"Shapes");m(this,"Style");m(this,"Image3D");m(this,"update",()=>{this.core.render()});this.core=t,this.mapView=n,this.externalPubSub=o,this.Camera=new B0(this),this.id=this.core.addGroupContainer("root").id.toString();let i=new $0("outdoors-container",void 0,void 0,this);this.mapObjects.push(i),this.currentMap=i,this.core.on("pre-render",()=>{o.publish("pre-render")}),this.core.on("post-render",()=>{o.publish("post-render")}),this.core.on("resize",()=>{o.publish("resize")}),this.core.on("render-error",({error:d})=>{o.publish("render-error",{error:new WI(d instanceof Error?d.message:"Unknown error")})});let s=d=>{let f=this.getMapDataObject(d);switch(f?.__type){case"facade":return f;case"floor":return f.floorStack.facade;default:return null}};this.core.on("geometry-in-focus",d=>{let f=new Set;for(let h of d){let b=s(h);b&&f.add(b)}o.publish("facades-in-view-change",{facades:Array.from(f)})}),this.core.getSystems().renderSystem.on("camera-state-change",()=>{o.publish("state-change-internal",{Camera:this.getCameraState()})});let u=new w0(this.Camera,{precision:7});this.core.on("camera-change",()=>{o.publish("camera-change",u)}),this.core.on("pan-bounds-change",d=>{o.publish("camera-bounds-change",Hy(d,this.core.convert3DMapPositionToCoordinate))});let l=d=>f=>{let h=[],b=[],I=[],E=[];f.labels.forEach(L=>{let N=this.Labels.getById(L.toString());N&&h.push(N.label)}),f.markers.forEach(L=>{let N=this.Markers.getById(L.toString())||this.Navigation.getMarkerById(L.toString());N&&b.push(N.marker)}),f.models.forEach(L=>{let N=this.Models.getById(L.toString());N&&I.push(N.model)}),f.paths.forEach(L=>{let N=this.Paths.getById(L.toString());N&&E.push(N)});let v=f.geometry,x;v.length>0&&(x=v.map(L=>this.getMapDataInternal()?.getById("space",L)).filter(Boolean)[0],x||(x=v.map(L=>this.getMapDataInternal()?.getById("object",L)).filter(Boolean)[0]),x||(x=v.map(L=>this.getMapDataInternal()?.getById("area",L)).filter(Boolean)[0]),x||(x=v.map(L=>this.Shapes.getById(L)).filter(Boolean)[0]));let D=f.containers.reduce((L,N)=>{let $=this.getMapDataInternal()?.getById("floor",N);return $&&jn.is($)&&L.push($),L},[]),w,S=0;if(D.length>0){w=D[0].id;let L=this.core.getState(w);S=f.coordinate[2]?f.coordinate[2]-L.altitude:S}let F;this.lastFacadeIntersected&&this.lastFacadeIntersected.spaces.forEach(L=>{this.core.setState(L.id,{hovered:!1})}),x&&Er.is(x)&&(F=v.map(L=>this.getMapDataInternal()?.facadesBySpaceId[L]).filter(Boolean)[0],F&&F.spaces.forEach(L=>{this.core.setState(L.id,{hovered:!0})})),this.lastFacadeIntersected=F;let P={coordinate:new ge({latitude:f.coordinate[1],longitude:f.coordinate[0],floorId:w,verticalOffset:S}),spaces:x&&Er.is(x)?[x]:[],objects:x&&Un.is(x)?[x]:[],areas:x&&Lo.is(x)?[x]:[],shapes:x&&ws.is(x)?[x]:[],markers:b,labels:h,models:I,paths:E,floors:D,facades:F?[F]:[]};"pointerEvent"in f&&(P.pointerEvent=f.pointerEvent),o.publish(d,P)};this.core.on("hover",l("hover")),this.core.on("click",l("click")),this.core.on("user-interaction-start",()=>{o.publish("user-interaction-start")}),this.core.on("user-interaction-end",()=>{o.publish("user-interaction-end")});let c={currentMapGetter:()=>this.currentMap};this.Markers=new j0(c),this.Models=new V0(c),this.Labels=new _0(c),this.Text3D=new eh(c),this.Exporter=new k0(c),this.Paths=new Z0(c),this.Navigation=new O0(this),this.on("navigation-state-change",d=>{this.externalPubSub.publish("state-change-internal",{Navigation:d})}),this.on("navigation-connection-click",d=>{this.externalPubSub.publish("navigation-connection-click",d)}),this.on("navigation-active-path-change",d=>{this.externalPubSub.publish("navigation-active-path-change",d)}),this.Outdoor=new Wd(this.core,this.hiddenOutdoorGeometries),this.Outdoor.enabled&&(this.core.on("outdoor-view-loaded",()=>{o.publish("outdoor-view-loaded")}),this.core.on("outdoor-style-loaded",()=>{o.publish("outdoor-style-loaded")})),this.Image3D=new G0(c),this.Shapes=new X0(c),this.Style=new Y0(c)}get manualFloorVisibility(){return a(this,uh)}set manualFloorVisibility(t){T(this,uh,t),this.externalPubSub.publish("state-change-internal",{manualFloorVisibility:t})}get hidePathsNotOnCurrentFloor(){return a(this,lh)}set hidePathsNotOnCurrentFloor(t){T(this,lh,t),this.currentMap?.updatePathLayersVisibility()}preloadFloors(t){t.forEach(n=>{n instanceof jn&&this.core.setState(n.id,{preloadGeometry:!0})})}updateState(t,n){if(n==null||typeof n!="object")return;if(t==="interior-walls"){this.currentMap.floors.forEach(i=>{let s=i.layers.get(or);if(s){let u=s.layers.get(lu);u&&this.core.hasState(u)&&this.core.setState(u,II(wt(xI,n,{warn:!0}),this.core.getState(u)))}});return}if(t==="exterior-walls"){this.currentMap.floors.forEach(i=>{let s=i.layers.get(or);if(s){let u=s.layers.get(ma);u&&this.core.hasState(u)&&this.core.setState(u,II(wt(xI,n,{warn:!0}),this.core.getState(u)))}});return}if(t==="interior-doors"){this.currentMap.floors.forEach(i=>{let s=i.layers.get(or);if(s){let u=s.layers.get(Vp);u&&this.core.hasState(u)&&this.core.setState(u,B4(wt(O4,n,{warn:!0}),this.core.getState(u)))}});return}if(t==="exterior-doors"){this.currentMap.floors.forEach(i=>{let s=i.layers.get(or);if(s){let u=s.layers.get(Hp);u&&this.core.hasState(u)&&this.core.setState(u,B4(wt(O4,n,{warn:!0}),this.core.getState(u)))}});return}let o=typeof t=="string"?this.getMapDataObject(t):t;if(o){if(o.__type!==Fi.__type&&!this.core.hasState(o.id)){R.warn(`Failed to update state for "${o.id}". No ${o.__type} found with that ID.`);return}if(Ts.is(o))return this.core.setState(o.id,qA(wt(YA,n,{warn:!0}),this.core.getState(o.id)));if(Ca.is(o))return this.core.setState(o.id,tO(wt(QA,n,{warn:!0}),this.core.getState(o.id)));if(Er.is(o)||Un.is(o)){let i=this.core.getState(o.id);i!=null&&this.core.setState(o.id,JA(wt(dI,n,{warn:!0}),i))}if(Lo.is(o)&&this.core.setState(o.id,wt(dI,n,{warn:!0})),tc.is(o)&&this.core.setState(o.id,wt(fO,n,{warn:!0})),yn.is(o)&&this.core.setState(o.id,B4(wt(O4,n,{warn:!0}),this.core.getState(o.id))),ws.is(o)&&this.core.setState(o.id,aO(wt(bI,n,{warn:!0}))),nc.is(o)){let{position:i,scale:s,rotation:u,...l}=wt(yO,n,{warn:!0}),c=l;i&&(c.position=[i.longitude,i.latitude,i.verticalOffset]),s!=null&&(Array.isArray(s)?c.scale=s:c.scale=[s,s,s]),u!=null&&(Array.isArray(u)?c.rotation=u:c.rotation=[u,u,u]),i&&o.updateTarget(i),this.core.setState(o.id,c)}if(jn.is(o)){let i=this.currentMap.floorsById.get(o.id);if(i==null)return;let s=wt(HA,n,{warn:!0});this.core.setState(o.id,s);let u=i.layers.get(or);u!=null&&"geometry"in n&&n.geometry&&this.core.setState(u.containerId,wt(NA,n.geometry,{warn:!0}));let l=i.layers.get(fa);if(l!=null&&"labels"in n&&n.labels){let E=wt($A,n.labels,{warn:!0});"enabled"in E&&typeof E.enabled=="boolean"&&l.setVisible(E.enabled)}let c=i.layers.get(yi);if(c!=null&&"markers"in n&&n.markers){let E=wt(jA,n.markers,{warn:!0});"enabled"in E&&typeof E.enabled=="boolean"&&c.setVisible(E.enabled)}let d=i.layers.get(Zp);d!=null&&"footprint"in n&&n.footprint&&this.core.setState(d.containerId,wt(RA,n.footprint,{warn:!0}));let f=i.layers.get(xl);if(f!=null&&"occlusion"in n&&n.occlusion){let E=wt(GA,n.occlusion,{warn:!0});"enabled"in E&&typeof E.enabled=="boolean"&&f.setVisible(E.enabled)}let h=i.layers.get(Wp);if(h!=null&&"images"in n&&n.images){let E=wt(UA,n.images,{warn:!0});"visible"in E&&typeof E.visible=="boolean"&&h.setVisible(E.visible)}let b=i.layers.get(ha);if(b!=null&&"paths"in n&&n.paths!=null){let E=wt(zA,n.paths,{warn:!0});E.visible!=null&&typeof E.visible=="boolean"&&b.setVisible(E.visible)}let I=i.layers.get(Il);if(I!=null&&"areas"in n&&n.areas!=null){let E=wt(VA,n.areas,{warn:!0});E.visible!=null&&typeof E.visible=="boolean"&&I.setVisible(E.visible)}}if(Rr.is(o)){let i=this.core.getState(o.id);for(let s of i.children)s.type==="group-container"&&this.core.setState(s.id,wt(wA,n,{warn:!0}))}if(Ou.is(o)&&this.core.setState(o.id,wt(cO,n,{warn:!0})),Fi.is(o))for(let i of o.segments)this.core.setState(i.id,wt(gI,n,{warn:!0}));Mu.is(o)&&this.core.setState(o.id,wt(gI,n,{warn:!0}))}}getMapDataObject(t){return this.getMapDataInternal()?.getMapDataById(t)}getMapDataInternal(){if(this.mapData)return Sm(this.mapData)}getMapData(){return this.mapData}addMap(t,n){return new Promise(o=>{let i;try{i=Sm(t)}catch(h){R.error("Error adding map",h),o(t);return}this.mapDataExternal[t.mapName]=t,this.mapData=t;let{mvf:s}=i,u=s["manifest.geojson"].features[0].geometry.coordinates;this.core.mode!=="outdoors-overlay"&&this.Camera.set({center:new ge(u[1],u[0])});let l=s["manifest.geojson"].features[0].properties.name,c=new $0(`mapObject-${l}`,i,n,this);this.currentMap=c,this.currentMap.loadAllFloors(),this.currentMap.setFloor(this.currentMap.startingFloorId);let d=this.core.getBoundingArea(c.currentFloor.id);d==null&&R.error("Could not determine bounding box for map:",c.currentFloor.id);let f=n?.outdoorView?.layersHiddenByGeometry??[];if(f.length>0){let h,b=[];for(let I of c.floorStacksById.values())if(I.defaultFloor.footprint&&I.defaultFloor.footprint.geometry!=null&&I.defaultFloor.footprint.geometry?.coordinates.length>0){let E=I.defaultFloor.footprint,v=Vy(E);h==null?h=v:Ww(h,v),b.push(E)}b.length>0&&h!=null&&(this.core.hideOutdoorLayersIntersectingPolygons(h,b,f),this.hiddenOutdoorGeometries.push([h,b,f]))}if(this.mapObjects.push(c),i.getMVFFeatureByType("floor").forEach(h=>{this.mapsByFloorId[h.id]=c}),c.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})}),c.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})}),n?.zoomLevel!=null)this.core.camera.setZoomLevel(n.zoomLevel),o(t);else if(this.core.mode!=="outdoors-overlay"&&d){let h=n?.screenOffsets??{top:W4*this.core.canvasHeight,left:W4*this.core.canvasWidth,right:W4*this.core.canvasWidth,bottom:W4*this.core.canvasHeight};this.core.camera.focusOn(d,{duration:kw,padding:h}).then(()=>{this.Camera.setElevation(this.currentFloor.elevation),o(t)})}else o(t)})}setFloor(t,n){return this.currentMap.setFloor(yf(t),n)}setFloorStack(t,n){return this.currentMap.setFloorStack(yf(t),n)}updateWatermark(t){this.core.updateWatermark(t)}get currentFloorStack(){let t=this.currentMap.currentFloorStack.id;if(!t)throw new Mr("Missing currentFloorStack.");let n=this.mapData?.getById("floor-stack",t);if(!n)throw new Mr("FloorStack was not found in map data.");return n}get currentFloor(){let t=this.currentMap.currentFloor.id;if(!t)throw new Mr("Missing currentFloor object from GeoJsonApi");let n=this.mapData?.getById("floor",t);if(!n)throw new Mr("Missing currentFloor");return n}getState(t){typeof t=="object"&&Fi.is(t)&&R.warn("Cannot get state of a Path directly. Use getState() on individual segments within Path.segments[] instead.");let n=Zw(t,this),o=this.core.getState(n);if(o){if(["interior-walls","exterior-walls"].includes(t)&&o.type==="geometry-group")return mO(o);if(["interior-doors","exterior-doors"].includes(t)&&o.type==="geometry-group")return DA(o);if(o.type==="geometry")return XA(o);if(o.type==="label"&&o.options.appearance&&o.options.rank!==void 0&&o.options.interactive!==void 0)return KA(o);if(o.type==="marker"&&o.options?.rank!==void 0&&o.options.interactive!==void 0)return eO(o,this.Markers.getById(o.id.toString())?.marker);if(o.type==="model")return bO(o);if(o.type==="image")return hO(o);if(o.type==="text3d")return pO(o);if(o.type==="geometry-group"&&t&&typeof t!="string"&&ws.is(t))return iO(o);if(o.type==="path")return nO(o);if(o.type==="group-container"&&typeof t!="string"&&jn.is(t))return ZA(o,this.currentMap.floorsById.get(t.id),this.core);if(o.type==="group-container"&&o.children.length>0&&typeof t!="string"&&Rr.is(t)){let i=this.core.getState(o.children[0].id);return FA(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,n,o){if(o!=null){let c=this.core.projectScreenXYToCoordinate(t,n,!0);return c?new ge(c.coordinate[1],c.coordinate[0],o.id):void 0}let i=this.core.projectScreenXYToCoordinate(t,n);if(i==null||i.coordinate==null)return;let{coordinate:s,groupContainers:u}=i,l=u?.find(c=>{let d=c.userData.entityId.toString();return d.includes("f_")||d.includes("m_")})?.userData.entityId.toString();return new ge(s[1],s[0],l)}getScreenCoordinateFromCoordinate(t){let n=0;if(t.floorId!=null){let o=this.mapData?.getById("floor",t.floorId);o!=null&&(n=this.getState(o)?.altitude??0)}return this.core.projectCoordinateToScreenXY([t.longitude,t.latitude,n])}isInView(t){return this.core.isInView(typeof t=="string"?t:t.id)}getInView(t,n){let o=this.core.queryGeometry2DInView({screenOffsets:n?.screenOffsets,fullyContains:n?.fullyContains});if(o.length===0)return[];let i=[];switch(t){case Ts.__type:i=o.map(s=>this.Labels.getById(s)).filter(s=>s!=null).map(s=>s.label);break;case Ca.__type:i=o.map(s=>this.Markers.getById(s)).filter(s=>s!=null).map(s=>s.marker)}return i}async __EXPERIMENTAL__auto(){let t=this.getMapDataInternal();if(!t)throw new Error("Map data not found");return await UO(t,this)}tween(t){let n=new Ii(t);return this.core.getExternalTweenGroup().add(n),this.core.render(),n}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.Shapes.removeAll(),this.Paths.removeAll(),this.Models.removeAll(),this.Markers.removeAll(),this.Image3D.removeAll(),this.Labels.removeAll()}destroy(){this.clear(),this.core.destroy()}getOptimalVisualDistanceBetweenFloors(t,n=!1){let o=this.currentMap;if(!o){R.error("Cannot compute optimal visual distance between floors. Missing current map.");return}if(t.length<2){R.warn("Cannot compute optimal visual distance between floors. Must provide at least 2 floors.");return}let i=o.renderer.getInternalState().geometry3DMap.get(t[0].id),s=o.renderer.getInternalState().geometry3DMap.get(t[1].id);if(!i||!s){R.warn("Cannot compute optimal visual distance between floors. Floors not found in current map.");return}if(Ec(i,"group-container"),Ec(s,"group-container"),n){let l=new dr;l.setFromObject(i);let c=new dr;if(c.setFromObject(s),i.children.forEach(v=>{v instanceof Pe&&v.userData.debugBox&&Ht(v)}),s.children.forEach(v=>{v instanceof Pe&&v.userData.debugBox&&Ht(v)}),!Uu(l)||!Uu(c))return;let d=new qo(l.max.x-l.min.x,l.max.y-l.min.y,l.max.z-l.min.z),f=new gr({color:255,transparent:!0,opacity:.5}),h=new Pe(d,f);h.position.set((l.min.x+l.max.x)/2,(l.min.y+l.max.y)/2,(l.min.z+l.max.z)/2),h.userData.debugBox=!0;let b=new qo(c.max.x-c.min.x,c.max.y-c.min.y,c.max.z-c.min.z),I=new gr({color:"cyan",transparent:!0,opacity:.5}),E=new Pe(b,I);E.position.set((c.min.x+c.max.x)/2,(c.min.y+c.max.y)/2,(c.min.z+c.max.z)/2),E.userData.debugBox=!0,i.add(h),s.add(E)}let u=o.renderer.computeMinZOffsetBetweenContainers(i,s);if(u!==-1)return u}};uh=new WeakMap,lh=new WeakMap;function fZ(e){if(e===""){Y2(""),J2("");return}J2(`${e}/${yb}`),Y2(`${e}/${gb}`)}p();var X4=class{constructor(r){m(this,"state");m(this,"update");this.update=r.Debug.update.bind(r.Debug),this.state=r.Debug.state}};p();import Fa from"zod";var GO=Fa.strictObject({environment:Fa.union([Fa.literal("basic"),Fa.literal(!1)]).optional(),text3d:Fa.object({hoverColor:Fa.string().optional()}).optional(),geometry:Fa.object({hoverColor:Fa.string().optional()}).optional(),backgroundColor:Fa.string().optional(),backgroundAlpha:Fa.number().optional()});p();var OI=rb(l8(),1);var hZ=(e,r)=>{let t={},n=(o,i,s)=>{for(let u in i){let l=o[u],c=i[u];typeof c=="object"&&!Array.isArray(c)&&c!==null&&typeof l=="object"&&!Array.isArray(l)&&l!==null?(s[u]={},n(l,c,s[u])):s[u]=l}};return n(e,r,t),t},zO=(e,r)=>{let t=hZ(e,r),n=(0,OI.default)({},t,r),o=(0,OI.default)({},t),i=(s,u,l,c=o)=>{for(let d in u){let f=s[d],h=u[d];if(typeof h=="number"&&typeof f=="number")c[d]=f+(h-f)*l;else if(typeof h=="string"&&typeof f=="string"){if(cm(f)&&cm(h)){let b=ab(f),I=ab(h);b&&I?c[d]=g6([b[0]+(I[0]-b[0])*l,b[1]+(I[1]-b[1])*l,b[2]+(I[2]-b[2])*l]):R.warn(`Color "${d}" could not be animated!`)}}else typeof h=="object"&&h!==null&&typeof f=="object"&&f!==null?i(f,h,l,c[d]):R.warn(`Value "${d}" could not be animated!`)}};return s=>(s=Math.min(Math.max(s,0),1),s===0?e:s===1?n:(i(t,r,s),o))};var pc,re,Yo,ch=class{constructor(r){C(this,pc);C(this,re);C(this,Yo);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,"Style");m(this,"Shapes");m(this,"Outdoor");m(this,"update",()=>{a(this,re).core.render()});m(this,"__LEGACY_GET_DIRECTIONS_SYNC",(r,t,n)=>a(this,re).getMapData()?.__LEGACY_GET_DIRECTIONS_SYNC(r,t,n)??void 0);m(this,"getDirections",(r,t,n)=>a(this,re).getMapData()?.getDirections(r,t,n)??Promise.resolve(void 0));m(this,"__LEGACY_GET_DIRECTIONS_MULTI_DESTINATION_SYNC",(r,t,n)=>a(this,re).getMapData()?.__LEGACY_GET_DIRECTIONS_MULTI_DESTINATION_SYNC(r,t,n)??void 0);m(this,"getDirectionsMultiDestination",(r,t,n)=>a(this,re).getMapData()?.getDirectionsMultiDestination(r,t,n)??Promise.resolve(void 0));m(this,"on",(r,t)=>{a(this,pc).on(r,t)});m(this,"off",(r,t)=>{a(this,pc).off(r,t)});m(this,"Debug");T(this,pc,new Oe),T(this,Yo,r);let t=new sh(r,this,a(this,pc));T(this,re,t),this.Camera=a(this,re).Camera,this.Markers=a(this,re).Markers,this.Models=a(this,re).Models,this.Labels=a(this,re).Labels,this.Text3D=a(this,re).Text3D,this.Exporter=a(this,re).Exporter,this.Paths=a(this,re).Paths,this.Navigation=a(this,re).Navigation,this.Shapes=a(this,re).Shapes,this.Style=a(this,re).Style,this.Outdoor=a(this,re).Outdoor,this.Image3D=a(this,re).Image3D,a(this,Yo).container.dataset.version=y.env.npm_package_version,this.Debug=new X4(a(this,re).core)}updateState(r,t){return a(this,re).updateState(r,t)}animateState(r,t,n){let o=a(this,re).getState(r);if(o==null)return R.warn(`Cannot animate state of ${r}.`),new Promise(c=>c({result:"completed"}));let i=zO(o,t),s=a(this,re).tween({percent:0}).to({percent:1},n?.duration??1e3).onUpdate(({percent:l})=>{a(this,re).updateState(r,i(l))});n?.easing&&n.easing in xa&&s.easing(xa[n.easing]);let u=new Promise(l=>{s.onComplete(()=>{a(this,re).removeTween(s),l({result:"completed"})}).onStop(()=>{a(this,re).removeTween(s),l({result:"cancelled"})}),s.start()});return u.cancel=()=>{s.stop(),a(this,re).updateState(r,i(0))},u}updateGlobalState(r){try{GO.parse(r)}catch(t){R.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 n=r.backgroundColor??a(this,re).core.backgroundColor,o=r.backgroundAlpha??a(this,re).core.backgroundAlpha;a(this,re).core.setBackgroundColor(n,o)}r.environment!=null&&a(this,re).core.setEnvironment(r.environment),a(this,re).core.setState(t)}}get options(){return Rw(a(this,re).currentMap.options)}getGlobalState(){let r=a(this,re).core.getState();return{backgroundColor:a(this,re).core.backgroundColor,backgroundAlpha:a(this,re).core.backgroundAlpha,environment:a(this,re).core.getEnvironment(),geometry:{hoverColor:r.hoverColor},text3d:{hoverColor:r.text3dHoverColor}}}getMapData(){if(a(this,re).mapData==null)throw new Mr("MapData not found.");return a(this,re).mapData}getDimensions(){return{width:a(this,Yo).canvasWidth,height:a(this,Yo).canvasHeight}}addMap(r,t){return a(this,re).addMap(r,t)}setFloor(r,t){return a(this,re).setFloor(r,t?.context)}setFloorStack(r,t){return a(this,re).setFloorStack(r,t?.context)}preloadFloors(r){a(this,re).preloadFloors(r)}tween(r){return a(this,re).tween(r)}removeTween(r){a(this,re).removeTween(r)}get tweenGroup(){return a(this,re).tweenGroup()}get currentFloorStack(){return a(this,re).currentFloorStack}get currentFloor(){return a(this,re).currentFloor}updateWatermark(r){a(this,re).updateWatermark(r)}getState(r){return a(this,re).getState(r)}setHoverColor(r){a(this,re).setHoverColor(r)}getHoverColor(){return a(this,re).getHoverColor()}convertAltitudeToMercatorZoomLevel(r){return a(this,re).core.getSystems().cameraSystem.convertAltitudeToZoomLevel(r)}convertMercatorZoomLevelToAltitude(r){return a(this,re).core.getSystems().cameraSystem.convertZoomLevelToAltitude(r)}isInView(r){return a(this,re).isInView(r)}getInView(r,t){return a(this,re).getInView(r,t)}getMetersPerPixel(){return a(this,re).core.getMetersPerPixel()}getDistance(r,t){return a(this,re).getMapData()?.getDistance(r,t)}createCoordinate(r,t,n){return typeof r=="object"?new ge(r):new ge(r,t,n?.id)}createCoordinateFromScreenCoordinate(r,t,n){return a(this,re).createCoordinateFromScreenCoordinate(r,t,n)}getScreenCoordinateFromCoordinate(r){return a(this,re).getScreenCoordinateFromCoordinate(r)}__EXPERIMENTAL__auto(){return a(this,re).__EXPERIMENTAL__auto()}get __core(){if(y.env.INTERNAL==="true")return a(this,re).core;throw new Error("__core is not available.")}get container(){return a(this,Yo).container}publishAllState(){a(this,re).publishAllState()}clear(){a(this,re).clear()}destroy(){a(this,re).destroy()}async enableDebug(r={}){let{Inspector:t}=await import("./inspector-MQK7ARFM.js");await new t(this,a(this,re)).enable(r)}async takeScreenshot(r){let t={withOutdoorContext:r?.withOutdoorContext??!1},n=a(this,Yo).rendererDomElement;if(t.withOutdoorContext){let o=a(this,Yo).map;if(!o)return await a(this,Yo).renderSync(),n.toDataURL("image/png");o.loaded()||await new Promise(l=>{o.once("idle",l)});let i=o.getCanvas(),s=document.createElement("canvas"),u=s.getContext("2d");if(s.width=n.width,s.height=n.height,!u)throw new Error("Failed to get 2D context for composite canvas");return u.drawImage(i,0,0,s.width,s.height),u.drawImage(n,0,0,s.width,s.height),s.toDataURL("image/png")}return await a(this,Yo).renderSync(),n.toDataURL("image/png")}get manualFloorVisibility(){return a(this,re).manualFloorVisibility}set manualFloorVisibility(r){a(this,re).manualFloorVisibility=r}getOptimalVisualDistanceBetweenFloors(r){return a(this,re).getOptimalVisualDistanceBetweenFloors(r)}get __INTERNAL__hidePathsNotOnCurrentFloor(){return a(this,re).hidePathsNotOnCurrentFloor}set __INTERNAL__hidePathsNotOnCurrentFloor(r){a(this,re).hidePathsNotOnCurrentFloor=!!r}};pc=new WeakMap,re=new WeakMap,Yo=new WeakMap;p();var gZ=1e3*60*60*2,Lu,Yd,Lt,Ma,Li,Ko,Ri,Kd,qd,ph,Gt,VO,HO,Jd,J4,BI,PI,kI,Qd=class{constructor(r,t){C(this,Gt);C(this,Lu,new Oe);C(this,Yd);C(this,Lt);C(this,Ma);C(this,Li);C(this,Ko);C(this,Ri);C(this,Kd);C(this,qd);C(this,ph,()=>{"key"in a(this,Lt)&&"secret"in a(this,Lt)&&z(this,Gt,Jd).call(this),z(this,Gt,J4).call(this)});m(this,"on",(r,t)=>a(this,Lu).on(r,t));m(this,"off",(r,t)=>a(this,Lu).off(r,t));T(this,Yd,r),T(this,Lt,t)}setMapIds(r){T(this,Yd,r)}setEnterprise(r){a(this,Lt).enterprise=r}async readySync(){if((!("key"in a(this,Lt))||!("secret"in a(this,Lt)))&&!("accessToken"in a(this,Lt))){R.error("No API keys or access token provided! Cannot preload tokens.");return}let r=[z(this,Gt,Jd).call(this),null];a(this,Lt).enterprise||(r[1]=this.getSasTokensAsync());let[t,n]=await Promise.all(r);z(this,Gt,kI).call(this),z(this,Gt,BI).call(this,t),n!=null&&z(this,Gt,PI).call(this,n),lm()&&globalThis.addEventListener?.("focus",a(this,ph))}async refreshing(){let r=[];return a(this,Ma)!=null&&r.push(a(this,Ma)),a(this,Li)!=null&&r.push(a(this,Li)),Promise.all(r)}getAccessTokenAsync(){return z(this,Gt,Jd).call(this)}getSasTokensAsync(){return z(this,Gt,J4).call(this)}getAccessToken(){return a(this,Ko)==null?(R.error("Tokens must be loaded before reading synchronously! Try awaiting readySync() first."),{token:""}):a(this,Ko)}getSasToken(r){return this.isEnterpriseMode()?(R.error("SAS tokens are not available in the enterprise mode!"),{token:""}):a(this,Ri)==null?(R.error("Tokens must be loaded before reading synchronously! Try awaiting readySync() first."),{token:""}):r in a(this,Ri).tokens?a(this,Ri).tokens[r]:(R.error(`SAS token for map ${r} not found!`),{token:""})}isEnterpriseMode(){return a(this,Lt).enterprise??!1}destroy(){z(this,Gt,kI).call(this),a(this,Lu).destroy(),lm()&&globalThis.removeEventListener("focus",a(this,ph))}};Lu=new WeakMap,Yd=new WeakMap,Lt=new WeakMap,Ma=new WeakMap,Li=new WeakMap,Ko=new WeakMap,Ri=new WeakMap,Kd=new WeakMap,qd=new WeakMap,ph=new WeakMap,Gt=new WeakSet,VO=function(r){let t=r.token!==a(this,Ko)?.token;T(this,Ko,r),t&&a(this,Lu).publish("access-token-refreshed",{accessToken:r})},HO=function(r){let t=JSON.stringify(r.tokens)!==JSON.stringify(a(this,Ri)?.tokens);T(this,Ri,r),t&&a(this,Lu).publish("sas-tokens-refreshed",{sasTokens:r.tokens})},Jd=async function(r=!1){if("accessToken"in a(this,Lt)&&typeof a(this,Lt).accessToken=="string"){let t={token:a(this,Lt).accessToken,expires:Date.now()+72e5};return T(this,Ko,t),t}if(!("key"in a(this,Lt))||!("secret"in a(this,Lt))||typeof a(this,Lt).key!="string"||typeof a(this,Lt).secret!="string")throw new Error("No API keys or access token provided!");return a(this,Ma)!=null?a(this,Ma):a(this,Ko)!=null&&a(this,Ko).expires!=null&&a(this,Ko).expires>Date.now()&&!r?a(this,Ko):(T(this,Ma,pf({...a(this,Lt),key:a(this,Lt).key,secret:a(this,Lt).secret},a(this,Lt).enterprise??!1).then(t=>{let n={token:t.accessToken,expires:t.expiresTimestamp*1e3};return z(this,Gt,VO).call(this,n),n}).catch(t=>{throw t}).finally(()=>{T(this,Ma,void 0)})),a(this,Ma))},J4=async function(r=!1){return this.isEnterpriseMode()?{tokens:{},expires:1/0}:a(this,Li)!=null?a(this,Li):a(this,Ri)!=null&&a(this,Ri).expires>Date.now()&&!r?a(this,Ri):(T(this,Li,new Promise((t,n)=>{z(this,Gt,Jd).call(this).then(o=>{let i={},s=a(this,Yd).map(u=>Z3({...a(this,Lt),mapId:u},o.token).then(l=>{i[u]={token:l.token,expires:l.expires}}).catch(l=>{R.error(`Error getting SAS token for map ${u}:`,l)}));Promise.all(s).then(()=>{let u={tokens:i,expires:Math.min(...Object.values(i).map(l=>l.expires??1/0))};z(this,Gt,HO).call(this,u),t(u)})}).catch(o=>{n(o)})})),a(this,Li).catch(t=>{throw t}).finally(()=>{T(this,Li,void 0)}),a(this,Li))},BI=function(r){if(!("key"in a(this,Lt))||!("secret"in a(this,Lt)))return;let t=r.expires!=null?r.expires-Date.now():gZ;isFinite(t)&&T(this,Kd,setTimeout(()=>{z(this,Gt,Jd).call(this,!0).then(n=>{z(this,Gt,BI).call(this,n)})},t-XT))},PI=function(r){let t=r.expires-Date.now();isFinite(t)&&T(this,qd,setTimeout(()=>{z(this,Gt,J4).call(this,!0).then(n=>{z(this,Gt,PI).call(this,n)})},t-KT))},kI=function(){a(this,Kd)!=null&&clearTimeout(a(this,Kd)),a(this,qd)!=null&&clearTimeout(a(this,qd))};p();var yZ=async(e,r)=>{let t=("mvfVersion"in(r??{})?r?.mvfVersion:void 0)??("options"in e&&"version"in(e.options??{})?e.options?.version:void 0),n={prefetchTokens:!0,...r||{},mvfVersion:t},o,i=ou();i.updateByUserOption(n);let s={};if("type"in e&&typeof e.type=="string"){if(s.enterprise=e.options?.enterprise,e.type==="binary"&&e.main instanceof Uint8Array){o=await Ay(e.main,n.mvfVersion),s.languagePacks=[];for(let I of e.languagePacks??[])I.localePack instanceof Uint8Array&&s.languagePacks.push({language:I.language,localePack:await Tp(I.localePack)})}else if(e.type==="json")o=e.main,s.languagePacks=e.languagePacks??[];else throw new Error("Invalid backup type");e.type==="binary"&&e.main instanceof Uint8Array&&(s.binaryBundle=e.main)}else o=e,s.enterprise=o.enterprise!=null;i.setEnterprise(s.enterprise??!1);let u=My(o),l=u.length>0?u:[n.mapId];n.baseAuthUri=i.getBaseAuthUri();let c=new Qd(l,{...n,enterprise:s.enterprise}),d;if("accessToken"in n&&n.accessToken)d=n.accessToken;else if("key"in n&&"secret"in n){let I;try{I=await c.getAccessTokenAsync()}catch(E){R.error("Failed getting token during hydrateMapData",E)}d=I?.token||""}if(s.outdoorViewToken=d,s.env=i,s.getMapDataOptions=n,n.prefetchTokens)try{await c.readySync()}catch(I){R.error("Failed to ready token manager!",I)}_f()&&(s.enterprise&&R.warn("forceEnterpriseLocations is enabled, but the map is already an enterprise map!"),n.mvfVersion!=="3.0.0"&&R.warn("mvfVersion must be '3.0.0' when forceEnterpriseLocations is enabled!"));let f=new Nl(o,s);d&&f.Analytics.init({accessToken:d,mapId:n.mapId,key:"key"in n?n.key:void 0,secret:"secret"in n?n.secret:void 0,...n.analytics,baseUri:i.getAnalyticsBaseUri(),context:n.analytics?.context});let h=new Cm(f),b=f.findPreferredLanguage({languageCode:n.language,fallbackToNavigatorLanguage:!1});if(b)try{await h.changeLanguage(b.code)}catch{}return typeof r?.onMVFParsed=="function"&&r.onMVFParsed(o),h};p();var ZO=(e,{id:r}={})=>{let t=Array.isArray(e)?e:[e];if(!t.every(i=>typeof i=="string"))return;let n=t.join(""),o=null;if(r){let i=document.getElementById(r);i instanceof HTMLStyleElement&&(o=i)}o==null&&(o=document.createElement("style")),r&&r!==""&&(o.id=r),o.textContent=n,document.head.appendChild(o)};var WO=`:root {
843
843
  --pin-shadow-hover-scale: 0.9;
844
844
  --pin-shadow-width: 12px;
845
845
  --pin-shadow-height: 5px;
@@ -2045,4 +2045,4 @@ a.maplibregl-ctrl-logo.maplibregl-compact {
2045
2045
  `;p();function SZ(e){if(!(!e.languages||!lm()||!globalThis.navigator?.languages?.length))for(let r=0;r<globalThis.navigator.languages.length;r++){let t=e.languages.find(n=>n.code.toLowerCase()===globalThis.navigator.languages[r].toLowerCase());if(t)return{code:t.code,name:t.name}}}function l2(e,r){let t=r?.languageCode??"",n=r?.fallbackToNavigatorLanguage??!0,o=e?.languages?.find(s=>s.code.toLowerCase()===t.toLowerCase()),i;if(o)i=o;else if(n??!0)try{let s=SZ(e);s&&(i=s)}catch(s){R.error("fallbackToNavigatorLanguage is set, however, there was an error getting the navigator language",s)}return i??e.defaultLanguage}var DZ=[WO,XO,JO,YO,KO,qO],QO;function aRe(e){QO=e}var sRe=async(e,r)=>{let t,n=ou();r&&n.updateByUserOption(r);try{r&&(t=(await pf({...r,baseAuthUri:n.getBaseAuthUri()})).accessToken)}catch(s){R.warn("Getting access token failed. Outdoor map disabled.",s)}let o=new Nl(e,{outdoorViewToken:t,languagePacks:r?.languagePacks,env:n});return new Cm(o)},e8=!1;function uRe(e){e8=e}var t8=!1;function lRe(e){t8=e}function _f(){return t8}var TZ=async e=>{let r=e8,t,n=ou();n.updateByUserOption(e);let o={prefetchTokens:!0,...e,fallbackToNavigatorLanguage:e.fallbackToNavigatorLanguage??!0},i=new Qd([o.mapId],o);if("accessToken"in o&&o.accessToken){t=o.accessToken;let{aud:v,sub:x}=Oh(t);(_w.some(D=>v.includes(D))||x&&x.startsWith("client"))&&(r=!0,n.setEnterprise(r),i.setEnterprise(r))}else if("key"in o&&"secret"in o){if(o.key.startsWith("mipk_"))throw new Error(`Partner API keys detected!
2046
2046
 
2047
2047
  Partner API keys should not be passed directly to the SDK. See https://developer.mappedin.com/docs/rest-apis/partner for more details.`);o.key.startsWith("mik_")||(r=!0,n.setEnterprise(r),i.setEnterprise(r)),o.baseAuthUri=n.getBaseAuthUri();let v;try{v=await i.getAccessTokenAsync(),t=v?.token}catch(x){throw R.warn("Get access token failed",x.message),new Error("Get access token failed: "+x.message)}}else throw new Error("Missing key or secret.");o.layoutId!=null&&(r?o.layoutId!=="draft"&&R.warn('Invalid layoutId! Use "draft" to load draft data or leave unspecified to load live data.'):R.warn("layoutId is currently unsupported!")),o.baseUri=n.getBaseUri();let s=performance.now(),u,l;if(r){let v={...o,venue:o.mapId,clientId:o.key,clientSecret:o.secret,version:"1.0.0",perspective:o.viewId,useDraftData:o.layoutId==="draft"},x=await rx(v);u=x.compressed,l=x.localePacks}else u=await nx(o,t);let c=performance.now(),d=await Ay(u,o.mvfVersion),f=performance.now();typeof e.onMVFParsed=="function"&&e.onMVFParsed(d);let h=My(d);if(h.length>0?i.setMapIds(h):i.setMapIds([o.mapId]),o.prefetchTokens)try{await i.readySync()}catch(v){R.error("Failed to ready token manager!",v)}_f()&&(r&&R.warn("forceEnterpriseLocations is enabled, but the map is already an enterprise map!"),o.mvfVersion!=="3.0.0"&&R.warn("mvfVersion must be '3.0.0' when forceEnterpriseLocations is enabled!"));let b=new Nl(d,{env:n,outdoorViewToken:t,tokenManager:i,enterprise:r,localePacksUrls:l,binaryBundle:u,getMapDataOptions:o}),I=new Cm(b,{search:e.search});b.Analytics.init({accessToken:t,mapId:o.mapId,key:"key"in o?o.key:void 0,secret:"secret"in o?o.secret:void 0,...o.analytics,baseUri:n.getAnalyticsBaseUri(),context:o.analytics?.context}),b.Analytics.sendGetMapDataEvent({parseDuration:f-c,downloadDuration:c-s,viewId:o.viewId});let E=b.findPreferredLanguage({languageCode:o.language,fallbackToNavigatorLanguage:o.fallbackToNavigatorLanguage});if(E)try{await I.changeLanguage(E.code)}catch{}return I},cRe=TZ,wZ=async()=>{if($l===""||E4==="")return!1;let e=[fetch($l,{mode:"same-origin"}),fetch(E4,{mode:"same-origin"})],[r,t]=[{ok:!1},{ok:!1}];try{[r,t]=await Promise.all(e)}catch{}return{collision:r.ok,maplibre:t.ok}},FZ=async(e,r,t)=>{let n=performance.now(),o=_x(t,r);o&&kx(o),(o.injectStyles??!0)&&ZO(DZ,{id:"mappedin__styles"});let i=Lw(r.outdoorViewToken??""),s=Sm(r);o.outdoorView?.style&&s.envControl.updateTileServerBaseUrl(o.outdoorView?.style);let u=!1,l=!1,c=await wZ();c&&(c.collision||(u=!0),c.maplibre||(l=!0));let d=await nA(e,{center:[r.mapCenter.longitude,r.mapCenter.latitude],bearing:o.bearing,pitch:o.pitch,zoomLevel:o.zoomLevel,backgroundAlpha:o.style?.backgroundAlpha,backgroundColor:o.style?.backgroundColor,outdoorView:!l&&o.outdoorView?.token?{headers:{"x-mappedin-tiles-key":o.outdoorView?.token},style:r.getEnv().tileServerUri,enabled:!!o.outdoorView?.enabled,lowDpi:o.outdoorView?.lowDpi}:void 0,watermark:{...o.watermark,visible:o.watermark?.visible??(!s.enterpriseMode&&!i.remove_watermark),onClick:QO||void 0},attribution:o.attribution,antialias:typeof o.antialiasing=="boolean"?o.antialiasing:!!o.antialiasing?.enabled,accessToken:r.outdoorViewToken,occlusionEnabled:!0,transformImageRequest:s.enterpriseMode?void 0:s.transformImageRequest,naturalBearing:r.naturalBearing,imagePlacementOptions:o.imagePlacementOptions,onWebGLContextCreationError:o.onWebGLContextCreationError,onWebGLContextLost:o.onWebGLContextLost,onWebGLContextRestored:o.onWebGLContextRestored,onWebGLRendererError:o.onWebGLRendererError,useStandaloneCamera:o.useStandaloneCamera??!1,useWorkers:!(o.disableWorkers??!1),useCollisionWorker:!u}),f=new ch(d);return await f.addMap(r,o),s.Analytics.sendMapViewLoadedEvent({firstRenderDuration:performance.now()-n,dimension:f.getDimensions(),collisionWorkerDisabled:u,outdoorsWorkerDisabled:l}),f},pRe=()=>y.env.npm_package_version,dRe=FZ;export{ge as a,_o as b,pl as c,ml as d,Lo as e,yn as f,Er as g,jn as h,ez as i,lo as j,Un as k,uo as l,ds as m,Ny as n,Rr as o,da as p,$y as q,Wx as r,ox as s,ix as t,Ay as u,Uw as v,Xx as w,Gw as x,Uy as y,Gy as z,hu as A,Ml as B,jy as C,VF as D,xa as E,bH as F,aI as G,kH as H,mI as I,fI as J,fZ as K,ch as L,yZ as M,l2 as N,aRe as O,sRe as P,uRe as Q,lRe as R,_f as S,TZ as T,cRe as U,wZ as V,FZ as W,pRe as X,dRe as Y};
2048
- //# sourceMappingURL=chunk-KYQ66GHT.js.map
2048
+ //# sourceMappingURL=chunk-5EHRFS32.js.map