@mappedin/mappedin-js 6.0.0-rc.1 → 6.0.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/esm/{GLTFExporter-LCU7NXUM.js → GLTFExporter-Z6JPGY7L.js} +2 -2
- package/lib/esm/{GLTFLoader-M52U7R6R.js → GLTFLoader-QCSKNB7G.js} +2 -2
- package/lib/esm/{browser-WC4BWEDX.js → browser-I5Q2RPA3.js} +2 -2
- package/lib/esm/{chunk-4EZCNQDU.js → chunk-6KGIA4EU.js} +2 -2
- package/lib/esm/{chunk-QVO3EAE3.js → chunk-7SIXH4EE.js} +2 -2
- package/lib/esm/chunk-AJPWEERG.js +2 -0
- package/lib/esm/{chunk-SYPB4R2Y.js.map → chunk-AJPWEERG.js.map} +1 -1
- package/lib/esm/{chunk-MTBSFIDI.js → chunk-L4AKE3TV.js} +2 -2
- package/lib/esm/{chunk-OPUPAKD3.js → chunk-VI2AJVL2.js} +7 -7
- package/lib/esm/{chunk-DGI3RI5M.js → chunk-W5WDIXXO.js} +2 -2
- package/lib/esm/index.js +1 -1
- package/lib/esm/{inspector-2WXCEJZC.js → inspector-YD6373IB.js} +2 -2
- package/lib/esm/{internal-MR2VGL5Y.js → internal-JKAX4KK2.js} +2 -2
- package/lib/esm/{outdoor-context-v5-QR4KQTZR.js → outdoor-context-v5-TZEP6AEK.js} +2 -2
- package/lib/esm/{text3d-ROTRSMZX.js → text3d-OX5R3UZU.js} +2 -2
- package/package.json +2 -2
- package/lib/esm/chunk-SYPB4R2Y.js +0 -2
- /package/lib/esm/{GLTFExporter-LCU7NXUM.js.map → GLTFExporter-Z6JPGY7L.js.map} +0 -0
- /package/lib/esm/{GLTFLoader-M52U7R6R.js.map → GLTFLoader-QCSKNB7G.js.map} +0 -0
- /package/lib/esm/{browser-WC4BWEDX.js.map → browser-I5Q2RPA3.js.map} +0 -0
- /package/lib/esm/{chunk-4EZCNQDU.js.map → chunk-6KGIA4EU.js.map} +0 -0
- /package/lib/esm/{chunk-QVO3EAE3.js.map → chunk-7SIXH4EE.js.map} +0 -0
- /package/lib/esm/{chunk-MTBSFIDI.js.map → chunk-L4AKE3TV.js.map} +0 -0
- /package/lib/esm/{chunk-OPUPAKD3.js.map → chunk-VI2AJVL2.js.map} +0 -0
- /package/lib/esm/{chunk-DGI3RI5M.js.map → chunk-W5WDIXXO.js.map} +0 -0
- /package/lib/esm/{inspector-2WXCEJZC.js.map → inspector-YD6373IB.js.map} +0 -0
- /package/lib/esm/{internal-MR2VGL5Y.js.map → internal-JKAX4KK2.js.map} +0 -0
- /package/lib/esm/{outdoor-context-v5-QR4KQTZR.js.map → outdoor-context-v5-TZEP6AEK.js.map} +0 -0
- /package/lib/esm/{text3d-ROTRSMZX.js.map → text3d-OX5R3UZU.js.map} +0 -0
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import{$ as xc,A as u5,Aa as A5,B as d5,Ba as L5,C as yc,Ca as a2,D as f5,Da as R5,E as m5,Ea as B5,F as Qv,Fa as bu,G as qi,Ga as N5,H as db,Ha as G5,I as Ys,Ia as xb,J as bc,Ja as l2,K as h5,Ka as Cm,L as g5,La as xu,M as y5,Ma as vb,N as b5,Na as vu,O as vm,Oa as Iu,P as Rn,Q as x5,R as e2,S as Ki,T as v5,U as hu,V as I5,W as Qi,X as fb,Y as or,Z as ro,_ as S5,aa as ai,ba as Ke,c as A,ca as kt,d as Br,da as mb,e as GT,ea as Im,f as Xv,fa as t2,g as Yi,ga as hb,h as i5,ha as r2,i as cb,ia as n2,j as s5,ja as o2,k as Ji,ka as M5,l as pb,la as gu,m as a5,ma as P5,n as ub,na as yu,o as gc,oa as Sm,p as bm,pa as w5,q as qv,qa as gb,r as mu,ra as O5,s as dt,sa as _5,t as l5,ta as s2,u as Fe,ua as yb,v as Zs,va as bb,w as xm,wa as E5,x as Kv,xa as D5,y as c5,ya as F5,z as p5,za as k5}from"./chunk-4EZCNQDU.js";import{X as i2,ea as T5,w as C5}from"./chunk-QVO3EAE3.js";import{a as vo}from"./chunk-DGI3RI5M.js";import{$ as Re,A as UT,Aa as sb,B as rb,Ba as Jv,C as nb,Ca as zi,D as VT,Da as Xi,E as HT,Ea as si,Fa as ab,G as WT,Ga as QT,H as Xe,Ha as e5,I as De,Ja as xo,M as $T,N as zT,O as XT,P as hc,Q as ue,R as vr,S as ZT,T as to,Ta as fu,U as Xs,V as oi,W as Nt,Xa as lb,Y as Tr,Ya as t5,Z as Sn,_ as ob,aa as ii,ab as r5,b as Qy,c as fc,ca as sl,cb as Zi,d as ym,da as YT,e as ni,ea as Zv,eb as n5,f as jT,g as $i,ga as al,gb as o5,la as JT,oa as ll,p as eb,pa as qT,qa as ib,r as tb,ra as Yv,ta as du,ya as KT,z as mc,za as cl}from"./chunk-MTBSFIDI.js";import{a as u,b as y}from"./chunk-SYPB4R2Y.js";import{b as ri,c as zs,d as il,e as f,f as a,g as T,h as w,i as z}from"./chunk-ROCNZJLL.js";var VO=ri((SS,CS)=>{u();(function(e,t){typeof SS=="object"&&typeof CS<"u"?CS.exports=t():typeof define=="function"&&define.amd?define(t):(e=e||self,e.TinyQueue=t())})(SS,function(){"use strict";var e=function(n,o){if(n===void 0&&(n=[]),o===void 0&&(o=t),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,l=i[n];n>0;){var c=n-1>>1,p=i[c];if(s(l,p)>=0)break;i[n]=p,n=c}i[n]=l},e.prototype._down=function(n){for(var o=this,i=o.data,s=o.compare,l=this.length>>1,c=i[n];n<l;){var p=(n<<1)+1,d=i[p],m=p+1;if(m<this.length&&s(i[m],d)<0&&(p=m,d=i[m]),s(d,c)>=0)break;i[n]=d,n=p}i[n]=c};function t(r,n){return r<n?-1:r>n?1:0}return e})});var WO=ri((s5e,TS)=>{"use strict";u();var r0=VO();r0.default&&(r0=r0.default);TS.exports=HO;TS.exports.default=HO;function HO(e,t,r){t=t||1;for(var n,o,i,s,l=0;l<e[0].length;l++){var c=e[0][l];(!l||c[0]<n)&&(n=c[0]),(!l||c[1]<o)&&(o=c[1]),(!l||c[0]>i)&&(i=c[0]),(!l||c[1]>s)&&(s=c[1])}var p=i-n,d=s-o,m=Math.min(p,d),g=m/2;if(m===0){var x=[n,o];return x.distance=0,x}for(var v=new r0(void 0,jH),C=n;C<i;C+=m)for(var I=o;I<s;I+=m)v.push(new Sl(C+g,I+g,g,e));var S=VH(e),P=new Sl(n+p/2,o+d/2,0,e);P.d>S.d&&(S=P);for(var O=v.length;v.length;){var M=v.pop();M.d>S.d&&(S=M,r&&console.log("found best %d after %d probes",Math.round(1e4*M.d)/1e4,O)),!(M.max-S.d<=t)&&(g=M.h/2,v.push(new Sl(M.x-g,M.y-g,g,e)),v.push(new Sl(M.x+g,M.y-g,g,e)),v.push(new Sl(M.x-g,M.y+g,g,e)),v.push(new Sl(M.x+g,M.y+g,g,e)),O+=4)}r&&(console.log("num probes: "+O),console.log("best distance: "+S.d));var E=[S.x,S.y];return E.distance=S.d,E}function jH(e,t){return t.max-e.max}function Sl(e,t,r,n){this.x=e,this.y=t,this.h=r,this.d=UH(e,t,n),this.max=this.d+this.h*Math.SQRT2}function UH(e,t,r){for(var n=!1,o=1/0,i=0;i<r.length;i++)for(var s=r[i],l=0,c=s.length,p=c-1;l<c;p=l++){var d=s[l],m=s[p];d[1]>t!=m[1]>t&&e<(m[0]-d[0])*(t-d[1])/(m[1]-d[1])+d[0]&&(n=!n),o=Math.min(o,HH(e,t,d,m))}return o===0?0:(n?1:-1)*Math.sqrt(o)}function VH(e){for(var t=0,r=0,n=0,o=e[0],i=0,s=o.length,l=s-1;i<s;l=i++){var c=o[i],p=o[l],d=c[0]*p[1]-p[0]*c[1];r+=(c[0]+p[0])*d,n+=(c[1]+p[1])*d,t+=d*3}return t===0?new Sl(o[0][0],o[0][1],0,e):new Sl(r/t,n/t,0,e)}function HH(e,t,r,n){var o=r[0],i=r[1],s=n[0]-o,l=n[1]-i;if(s!==0||l!==0){var c=((e-o)*s+(t-i)*l)/(s*s+l*l);c>1?(o=n[0],i=n[1]):c>0&&(o+=s*c,i+=l*c)}return s=e-o,l=t-i,s*s+l*l}});var d6=ri((LS,RS)=>{u();(function(e,t){typeof LS=="object"&&typeof RS<"u"?RS.exports=t():typeof define=="function"&&define.amd?define(t):(e=e||self).RBush=t()})(LS,function(){"use strict";function e(I,S,P,O,M){(function E(B,j,L,N,X){for(;N>L;){if(N-L>600){var Z=N-L+1,re=j-L+1,Q=Math.log(Z),xe=.5*Math.exp(2*Q/3),Ce=.5*Math.sqrt(Q*xe*(Z-xe)/Z)*(re-Z/2<0?-1:1),ye=Math.max(L,Math.floor(j-re*xe/Z+Ce)),Ee=Math.min(N,Math.floor(j+(Z-re)*xe/Z+Ce));E(B,j,ye,Ee,X)}var we=B[j],pe=L,Ae=N;for(t(B,L,j),X(B[N],we)>0&&t(B,L,N);pe<Ae;){for(t(B,pe,Ae),pe++,Ae--;X(B[pe],we)<0;)pe++;for(;X(B[Ae],we)>0;)Ae--}X(B[L],we)===0?t(B,L,Ae):t(B,++Ae,N),Ae<=j&&(L=Ae+1),j<=Ae&&(N=Ae-1)}})(I,S,P||0,O||I.length-1,M||r)}function t(I,S,P){var O=I[S];I[S]=I[P],I[P]=O}function r(I,S){return I<S?-1:I>S?1:0}var n=function(I){I===void 0&&(I=9),this._maxEntries=Math.max(4,I),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function o(I,S,P){if(!P)return S.indexOf(I);for(var O=0;O<S.length;O++)if(P(I,S[O]))return O;return-1}function i(I,S){s(I,0,I.children.length,S,I)}function s(I,S,P,O,M){M||(M=v(null)),M.minX=1/0,M.minY=1/0,M.maxX=-1/0,M.maxY=-1/0;for(var E=S;E<P;E++){var B=I.children[E];l(M,I.leaf?O(B):B)}return M}function l(I,S){return I.minX=Math.min(I.minX,S.minX),I.minY=Math.min(I.minY,S.minY),I.maxX=Math.max(I.maxX,S.maxX),I.maxY=Math.max(I.maxY,S.maxY),I}function c(I,S){return I.minX-S.minX}function p(I,S){return I.minY-S.minY}function d(I){return(I.maxX-I.minX)*(I.maxY-I.minY)}function m(I){return I.maxX-I.minX+(I.maxY-I.minY)}function g(I,S){return I.minX<=S.minX&&I.minY<=S.minY&&S.maxX<=I.maxX&&S.maxY<=I.maxY}function x(I,S){return S.minX<=I.maxX&&S.minY<=I.maxY&&S.maxX>=I.minX&&S.maxY>=I.minY}function v(I){return{children:I,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function C(I,S,P,O,M){for(var E=[S,P];E.length;)if(!((P=E.pop())-(S=E.pop())<=O)){var B=S+Math.ceil((P-S)/O/2)*O;e(I,B,S,P,M),E.push(S,B,B,P)}}return n.prototype.all=function(){return this._all(this.data,[])},n.prototype.search=function(I){var S=this.data,P=[];if(!x(I,S))return P;for(var O=this.toBBox,M=[];S;){for(var E=0;E<S.children.length;E++){var B=S.children[E],j=S.leaf?O(B):B;x(I,j)&&(S.leaf?P.push(B):g(I,j)?this._all(B,P):M.push(B))}S=M.pop()}return P},n.prototype.collides=function(I){var S=this.data;if(!x(I,S))return!1;for(var P=[];S;){for(var O=0;O<S.children.length;O++){var M=S.children[O],E=S.leaf?this.toBBox(M):M;if(x(I,E)){if(S.leaf||g(I,E))return!0;P.push(M)}}S=P.pop()}return!1},n.prototype.load=function(I){if(!I||!I.length)return this;if(I.length<this._minEntries){for(var S=0;S<I.length;S++)this.insert(I[S]);return this}var P=this._build(I.slice(),0,I.length-1,0);if(this.data.children.length)if(this.data.height===P.height)this._splitRoot(this.data,P);else{if(this.data.height<P.height){var O=this.data;this.data=P,P=O}this._insert(P,this.data.height-P.height-1,!0)}else this.data=P;return this},n.prototype.insert=function(I){return I&&this._insert(I,this.data.height-1),this},n.prototype.clear=function(){return this.data=v([]),this},n.prototype.remove=function(I,S){if(!I)return this;for(var P,O,M,E=this.data,B=this.toBBox(I),j=[],L=[];E||j.length;){if(E||(E=j.pop(),O=j[j.length-1],P=L.pop(),M=!0),E.leaf){var N=o(I,E.children,S);if(N!==-1)return E.children.splice(N,1),j.push(E),this._condense(j),this}M||E.leaf||!g(E,B)?O?(P++,E=O.children[P],M=!1):E=null:(j.push(E),L.push(P),P=0,O=E,E=E.children[0])}return this},n.prototype.toBBox=function(I){return I},n.prototype.compareMinX=function(I,S){return I.minX-S.minX},n.prototype.compareMinY=function(I,S){return I.minY-S.minY},n.prototype.toJSON=function(){return this.data},n.prototype.fromJSON=function(I){return this.data=I,this},n.prototype._all=function(I,S){for(var P=[];I;)I.leaf?S.push.apply(S,I.children):P.push.apply(P,I.children),I=P.pop();return S},n.prototype._build=function(I,S,P,O){var M,E=P-S+1,B=this._maxEntries;if(E<=B)return i(M=v(I.slice(S,P+1)),this.toBBox),M;O||(O=Math.ceil(Math.log(E)/Math.log(B)),B=Math.ceil(E/Math.pow(B,O-1))),(M=v([])).leaf=!1,M.height=O;var j=Math.ceil(E/B),L=j*Math.ceil(Math.sqrt(B));C(I,S,P,L,this.compareMinX);for(var N=S;N<=P;N+=L){var X=Math.min(N+L-1,P);C(I,N,X,j,this.compareMinY);for(var Z=N;Z<=X;Z+=j){var re=Math.min(Z+j-1,X);M.children.push(this._build(I,Z,re,O-1))}}return i(M,this.toBBox),M},n.prototype._chooseSubtree=function(I,S,P,O){for(;O.push(S),!S.leaf&&O.length-1!==P;){for(var M=1/0,E=1/0,B=void 0,j=0;j<S.children.length;j++){var L=S.children[j],N=d(L),X=(Z=I,re=L,(Math.max(re.maxX,Z.maxX)-Math.min(re.minX,Z.minX))*(Math.max(re.maxY,Z.maxY)-Math.min(re.minY,Z.minY))-N);X<E?(E=X,M=N<M?N:M,B=L):X===E&&N<M&&(M=N,B=L)}S=B||S.children[0]}var Z,re;return S},n.prototype._insert=function(I,S,P){var O=P?I:this.toBBox(I),M=[],E=this._chooseSubtree(O,this.data,S,M);for(E.children.push(I),l(E,O);S>=0&&M[S].children.length>this._maxEntries;)this._split(M,S),S--;this._adjustParentBBoxes(O,M,S)},n.prototype._split=function(I,S){var P=I[S],O=P.children.length,M=this._minEntries;this._chooseSplitAxis(P,M,O);var E=this._chooseSplitIndex(P,M,O),B=v(P.children.splice(E,P.children.length-E));B.height=P.height,B.leaf=P.leaf,i(P,this.toBBox),i(B,this.toBBox),S?I[S-1].children.push(B):this._splitRoot(P,B)},n.prototype._splitRoot=function(I,S){this.data=v([I,S]),this.data.height=I.height+1,this.data.leaf=!1,i(this.data,this.toBBox)},n.prototype._chooseSplitIndex=function(I,S,P){for(var O,M,E,B,j,L,N,X=1/0,Z=1/0,re=S;re<=P-S;re++){var Q=s(I,0,re,this.toBBox),xe=s(I,re,P,this.toBBox),Ce=(M=Q,E=xe,B=void 0,j=void 0,L=void 0,N=void 0,B=Math.max(M.minX,E.minX),j=Math.max(M.minY,E.minY),L=Math.min(M.maxX,E.maxX),N=Math.min(M.maxY,E.maxY),Math.max(0,L-B)*Math.max(0,N-j)),ye=d(Q)+d(xe);Ce<X?(X=Ce,O=re,Z=ye<Z?ye:Z):Ce===X&&ye<Z&&(Z=ye,O=re)}return O||P-S},n.prototype._chooseSplitAxis=function(I,S,P){var O=I.leaf?this.compareMinX:c,M=I.leaf?this.compareMinY:p;this._allDistMargin(I,S,P,O)<this._allDistMargin(I,S,P,M)&&I.children.sort(O)},n.prototype._allDistMargin=function(I,S,P,O){I.children.sort(O);for(var M=this.toBBox,E=s(I,0,S,M),B=s(I,P-S,P,M),j=m(E)+m(B),L=S;L<P-S;L++){var N=I.children[L];l(E,I.leaf?M(N):N),j+=m(E)}for(var X=P-S-1;X>=S;X--){var Z=I.children[X];l(B,I.leaf?M(Z):Z),j+=m(B)}return j},n.prototype._adjustParentBBoxes=function(I,S,P){for(var O=P;O>=0;O--)l(S[O],I)},n.prototype._condense=function(I){for(var S=I.length-1,P=void 0;S>=0;S--)I[S].children.length===0?S>0?(P=I[S-1].children).splice(P.indexOf(I[S]),1):this.clear():i(I[S],this.toBBox)},n})});var US=ri(Ie=>{"use strict";u();Object.defineProperty(Ie,"__esModule",{value:!0});Ie.earthRadius=63710088e-1;Ie.factors={centimeters:Ie.earthRadius*100,centimetres:Ie.earthRadius*100,degrees:Ie.earthRadius/111325,feet:Ie.earthRadius*3.28084,inches:Ie.earthRadius*39.37,kilometers:Ie.earthRadius/1e3,kilometres:Ie.earthRadius/1e3,meters:Ie.earthRadius,metres:Ie.earthRadius,miles:Ie.earthRadius/1609.344,millimeters:Ie.earthRadius*1e3,millimetres:Ie.earthRadius*1e3,nauticalmiles:Ie.earthRadius/1852,radians:1,yards:Ie.earthRadius*1.0936};Ie.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/Ie.earthRadius,yards:1.0936133};Ie.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 Ml(e,t,r){r===void 0&&(r={});var n={type:"Feature"};return(r.id===0||r.id)&&(n.id=r.id),r.bbox&&(n.bbox=r.bbox),n.properties=t||{},n.geometry=e,n}Ie.feature=Ml;function DW(e,t,r){switch(r===void 0&&(r={}),e){case"Point":return BS(t).geometry;case"LineString":return GS(t).geometry;case"Polygon":return NS(t).geometry;case"MultiPoint":return m6(t).geometry;case"MultiLineString":return f6(t).geometry;case"MultiPolygon":return h6(t).geometry;default:throw new Error(e+" is invalid")}}Ie.geometry=DW;function BS(e,t,r){if(r===void 0&&(r={}),!e)throw new Error("coordinates is required");if(!Array.isArray(e))throw new Error("coordinates must be an Array");if(e.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!c0(e[0])||!c0(e[1]))throw new Error("coordinates must contain numbers");var n={type:"Point",coordinates:e};return Ml(n,t,r)}Ie.point=BS;function FW(e,t,r){return r===void 0&&(r={}),p0(e.map(function(n){return BS(n,t)}),r)}Ie.points=FW;function NS(e,t,r){r===void 0&&(r={});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 l={type:"Polygon",coordinates:e};return Ml(l,t,r)}Ie.polygon=NS;function kW(e,t,r){return r===void 0&&(r={}),p0(e.map(function(n){return NS(n,t)}),r)}Ie.polygons=kW;function GS(e,t,r){if(r===void 0&&(r={}),e.length<2)throw new Error("coordinates must be an array of two or more positions");var n={type:"LineString",coordinates:e};return Ml(n,t,r)}Ie.lineString=GS;function AW(e,t,r){return r===void 0&&(r={}),p0(e.map(function(n){return GS(n,t)}),r)}Ie.lineStrings=AW;function p0(e,t){t===void 0&&(t={});var r={type:"FeatureCollection"};return t.id&&(r.id=t.id),t.bbox&&(r.bbox=t.bbox),r.features=e,r}Ie.featureCollection=p0;function f6(e,t,r){r===void 0&&(r={});var n={type:"MultiLineString",coordinates:e};return Ml(n,t,r)}Ie.multiLineString=f6;function m6(e,t,r){r===void 0&&(r={});var n={type:"MultiPoint",coordinates:e};return Ml(n,t,r)}Ie.multiPoint=m6;function h6(e,t,r){r===void 0&&(r={});var n={type:"MultiPolygon",coordinates:e};return Ml(n,t,r)}Ie.multiPolygon=h6;function LW(e,t,r){r===void 0&&(r={});var n={type:"GeometryCollection",geometries:e};return Ml(n,t,r)}Ie.geometryCollection=LW;function RW(e,t){if(t===void 0&&(t=0),t&&!(t>=0))throw new Error("precision must be a positive number");var r=Math.pow(10,t||0);return Math.round(e*r)/r}Ie.round=RW;function g6(e,t){t===void 0&&(t="kilometers");var r=Ie.factors[t];if(!r)throw new Error(t+" units is invalid");return e*r}Ie.radiansToLength=g6;function jS(e,t){t===void 0&&(t="kilometers");var r=Ie.factors[t];if(!r)throw new Error(t+" units is invalid");return e/r}Ie.lengthToRadians=jS;function BW(e,t){return y6(jS(e,t))}Ie.lengthToDegrees=BW;function NW(e){var t=e%360;return t<0&&(t+=360),t}Ie.bearingToAzimuth=NW;function y6(e){var t=e%(2*Math.PI);return t*180/Math.PI}Ie.radiansToDegrees=y6;function GW(e){var t=e%360;return t*Math.PI/180}Ie.degreesToRadians=GW;function jW(e,t,r){if(t===void 0&&(t="kilometers"),r===void 0&&(r="kilometers"),!(e>=0))throw new Error("length must be a positive number");return g6(jS(e,t),r)}Ie.convertLength=jW;function UW(e,t,r){if(t===void 0&&(t="meters"),r===void 0&&(r="kilometers"),!(e>=0))throw new Error("area must be a positive number");var n=Ie.areaFactors[t];if(!n)throw new Error("invalid original units");var o=Ie.areaFactors[r];if(!o)throw new Error("invalid final units");return e/n*o}Ie.convertArea=UW;function c0(e){return!isNaN(e)&&e!==null&&!Array.isArray(e)}Ie.isNumber=c0;function VW(e){return!!e&&e.constructor===Object}Ie.isObject=VW;function HW(e){if(!e)throw new Error("bbox is required");if(!Array.isArray(e))throw new Error("bbox must be an Array");if(e.length!==4&&e.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");e.forEach(function(t){if(!c0(t))throw new Error("bbox must only contain numbers")})}Ie.validateBBox=HW;function WW(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")}Ie.validateId=WW});var HS=ri(wr=>{"use strict";u();Object.defineProperty(wr,"__esModule",{value:!0});var bn=US();function bh(e,t,r){if(e!==null)for(var n,o,i,s,l,c,p,d=0,m=0,g,x=e.type,v=x==="FeatureCollection",C=x==="Feature",I=v?e.features.length:1,S=0;S<I;S++){p=v?e.features[S].geometry:C?e.geometry:e,g=p?p.type==="GeometryCollection":!1,l=g?p.geometries.length:1;for(var P=0;P<l;P++){var O=0,M=0;if(s=g?p.geometries[P]:p,s!==null){c=s.coordinates;var E=s.type;switch(d=r&&(E==="Polygon"||E==="MultiPolygon")?1:0,E){case null:break;case"Point":if(t(c,m,S,O,M)===!1)return!1;m++,O++;break;case"LineString":case"MultiPoint":for(n=0;n<c.length;n++){if(t(c[n],m,S,O,M)===!1)return!1;m++,E==="MultiPoint"&&O++}E==="LineString"&&O++;break;case"Polygon":case"MultiLineString":for(n=0;n<c.length;n++){for(o=0;o<c[n].length-d;o++){if(t(c[n][o],m,S,O,M)===!1)return!1;m++}E==="MultiLineString"&&O++,E==="Polygon"&&M++}E==="Polygon"&&O++;break;case"MultiPolygon":for(n=0;n<c.length;n++){for(M=0,o=0;o<c[n].length;o++){for(i=0;i<c[n][o].length-d;i++){if(t(c[n][o][i],m,S,O,M)===!1)return!1;m++}M++}O++}break;case"GeometryCollection":for(n=0;n<s.geometries.length;n++)if(bh(s.geometries[n],t,r)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function $W(e,t,r,n){var o=r;return bh(e,function(i,s,l,c,p){s===0&&r===void 0?o=i:o=t(o,i,s,l,c,p)},n),o}function b6(e,t){var r;switch(e.type){case"FeatureCollection":for(r=0;r<e.features.length&&t(e.features[r].properties,r)!==!1;r++);break;case"Feature":t(e.properties,0);break}}function zW(e,t,r){var n=r;return b6(e,function(o,i){i===0&&r===void 0?n=o:n=t(n,o,i)}),n}function x6(e,t){if(e.type==="Feature")t(e,0);else if(e.type==="FeatureCollection")for(var r=0;r<e.features.length&&t(e.features[r],r)!==!1;r++);}function XW(e,t,r){var n=r;return x6(e,function(o,i){i===0&&r===void 0?n=o:n=t(n,o,i)}),n}function ZW(e){var t=[];return bh(e,function(r){t.push(r)}),t}function VS(e,t){var r,n,o,i,s,l,c,p,d,m,g=0,x=e.type==="FeatureCollection",v=e.type==="Feature",C=x?e.features.length:1;for(r=0;r<C;r++){for(l=x?e.features[r].geometry:v?e.geometry:e,p=x?e.features[r].properties:v?e.properties:{},d=x?e.features[r].bbox:v?e.bbox:void 0,m=x?e.features[r].id:v?e.id:void 0,c=l?l.type==="GeometryCollection":!1,s=c?l.geometries.length:1,o=0;o<s;o++){if(i=c?l.geometries[o]:l,i===null){if(t(null,g,p,d,m)===!1)return!1;continue}switch(i.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(t(i,g,p,d,m)===!1)return!1;break}case"GeometryCollection":{for(n=0;n<i.geometries.length;n++)if(t(i.geometries[n],g,p,d,m)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}g++}}function YW(e,t,r){var n=r;return VS(e,function(o,i,s,l,c){i===0&&r===void 0?n=o:n=t(n,o,i,s,l,c)}),n}function u0(e,t){VS(e,function(r,n,o,i,s){var l=r===null?null:r.type;switch(l){case null:case"Point":case"LineString":case"Polygon":return t(bn.feature(r,o,{bbox:i,id:s}),n,0)===!1?!1:void 0}var c;switch(l){case"MultiPoint":c="Point";break;case"MultiLineString":c="LineString";break;case"MultiPolygon":c="Polygon";break}for(var p=0;p<r.coordinates.length;p++){var d=r.coordinates[p],m={type:c,coordinates:d};if(t(bn.feature(m,o),n,p)===!1)return!1}})}function JW(e,t,r){var n=r;return u0(e,function(o,i,s){i===0&&s===0&&r===void 0?n=o:n=t(n,o,i,s)}),n}function v6(e,t){u0(e,function(r,n,o){var i=0;if(r.geometry){var s=r.geometry.type;if(!(s==="Point"||s==="MultiPoint")){var l,c=0,p=0,d=0;if(bh(r,function(m,g,x,v,C){if(l===void 0||n>c||v>p||C>d){l=m,c=n,p=v,d=C,i=0;return}var I=bn.lineString([l,m],r.properties);if(t(I,n,o,C,i)===!1)return!1;i++,l=m})===!1)return!1}}})}function qW(e,t,r){var n=r,o=!1;return v6(e,function(i,s,l,c,p){o===!1&&r===void 0?n=i:n=t(n,i,s,l,c,p),o=!0}),n}function I6(e,t){if(!e)throw new Error("geojson is required");u0(e,function(r,n,o){if(r.geometry!==null){var i=r.geometry.type,s=r.geometry.coordinates;switch(i){case"LineString":if(t(r,n,o,0,0)===!1)return!1;break;case"Polygon":for(var l=0;l<s.length;l++)if(t(bn.lineString(s[l],r.properties),n,o,l)===!1)return!1;break}}})}function KW(e,t,r){var n=r;return I6(e,function(o,i,s,l){i===0&&r===void 0?n=o:n=t(n,o,i,s,l)}),n}function QW(e,t){if(t=t||{},!bn.isObject(t))throw new Error("options is invalid");var r=t.featureIndex||0,n=t.multiFeatureIndex||0,o=t.geometryIndex||0,i=t.segmentIndex||0,s=t.properties,l;switch(e.type){case"FeatureCollection":r<0&&(r=e.features.length+r),s=s||e.features[r].properties,l=e.features[r].geometry;break;case"Feature":s=s||e.properties,l=e.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":l=e;break;default:throw new Error("geojson is invalid")}if(l===null)return null;var c=l.coordinates;switch(l.type){case"Point":case"MultiPoint":return null;case"LineString":return i<0&&(i=c.length+i-1),bn.lineString([c[i],c[i+1]],s,t);case"Polygon":return o<0&&(o=c.length+o),i<0&&(i=c[o].length+i-1),bn.lineString([c[o][i],c[o][i+1]],s,t);case"MultiLineString":return n<0&&(n=c.length+n),i<0&&(i=c[n].length+i-1),bn.lineString([c[n][i],c[n][i+1]],s,t);case"MultiPolygon":return n<0&&(n=c.length+n),o<0&&(o=c[n].length+o),i<0&&(i=c[n][o].length-i-1),bn.lineString([c[n][o][i],c[n][o][i+1]],s,t)}throw new Error("geojson is invalid")}function e$(e,t){if(t=t||{},!bn.isObject(t))throw new Error("options is invalid");var r=t.featureIndex||0,n=t.multiFeatureIndex||0,o=t.geometryIndex||0,i=t.coordIndex||0,s=t.properties,l;switch(e.type){case"FeatureCollection":r<0&&(r=e.features.length+r),s=s||e.features[r].properties,l=e.features[r].geometry;break;case"Feature":s=s||e.properties,l=e.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":l=e;break;default:throw new Error("geojson is invalid")}if(l===null)return null;var c=l.coordinates;switch(l.type){case"Point":return bn.point(c,s,t);case"MultiPoint":return n<0&&(n=c.length+n),bn.point(c[n],s,t);case"LineString":return i<0&&(i=c.length+i),bn.point(c[i],s,t);case"Polygon":return o<0&&(o=c.length+o),i<0&&(i=c[o].length+i),bn.point(c[o][i],s,t);case"MultiLineString":return n<0&&(n=c.length+n),i<0&&(i=c[n].length+i),bn.point(c[n][i],s,t);case"MultiPolygon":return n<0&&(n=c.length+n),o<0&&(o=c[n].length+o),i<0&&(i=c[n][o].length-i),bn.point(c[n][o][i],s,t)}throw new Error("geojson is invalid")}wr.coordAll=ZW;wr.coordEach=bh;wr.coordReduce=$W;wr.featureEach=x6;wr.featureReduce=XW;wr.findPoint=e$;wr.findSegment=QW;wr.flattenEach=u0;wr.flattenReduce=JW;wr.geomEach=VS;wr.geomReduce=YW;wr.lineEach=I6;wr.lineReduce=KW;wr.propEach=b6;wr.propReduce=zW;wr.segmentEach=v6;wr.segmentReduce=qW});var S6=ri($S=>{"use strict";u();Object.defineProperty($S,"__esModule",{value:!0});var t$=HS();function WS(e){var t=[1/0,1/0,-1/0,-1/0];return t$.coordEach(e,function(r){t[0]>r[0]&&(t[0]=r[0]),t[1]>r[1]&&(t[1]=r[1]),t[2]<r[0]&&(t[2]=r[0]),t[3]<r[1]&&(t[3]=r[1])}),t}WS.default=WS;$S.default=WS});var w6=ri((APe,zS)=>{u();var hs=d6(),T6=US(),M6=HS(),bd=S6().default,r$=M6.featureEach,FPe=M6.coordEach,kPe=T6.polygon,C6=T6.featureCollection;function P6(e){var t=new hs(e);return t.insert=function(r){if(r.type!=="Feature")throw new Error("invalid feature");return r.bbox=r.bbox?r.bbox:bd(r),hs.prototype.insert.call(this,r)},t.load=function(r){var n=[];return Array.isArray(r)?r.forEach(function(o){if(o.type!=="Feature")throw new Error("invalid features");o.bbox=o.bbox?o.bbox:bd(o),n.push(o)}):r$(r,function(o){if(o.type!=="Feature")throw new Error("invalid features");o.bbox=o.bbox?o.bbox:bd(o),n.push(o)}),hs.prototype.load.call(this,n)},t.remove=function(r,n){if(r.type!=="Feature")throw new Error("invalid feature");return r.bbox=r.bbox?r.bbox:bd(r),hs.prototype.remove.call(this,r,n)},t.clear=function(){return hs.prototype.clear.call(this)},t.search=function(r){var n=hs.prototype.search.call(this,this.toBBox(r));return C6(n)},t.collides=function(r){return hs.prototype.collides.call(this,this.toBBox(r))},t.all=function(){var r=hs.prototype.all.call(this);return C6(r)},t.toJSON=function(){return hs.prototype.toJSON.call(this)},t.fromJSON=function(r){return hs.prototype.fromJSON.call(this,r)},t.toBBox=function(r){var n;if(r.bbox)n=r.bbox;else if(Array.isArray(r)&&r.length===4)n=r;else if(Array.isArray(r)&&r.length===6)n=[r[0],r[1],r[3],r[4]];else if(r.type==="Feature")n=bd(r);else if(r.type==="FeatureCollection")n=bd(r);else throw new Error("invalid geojson");return{minX:n[0],minY:n[1],maxX:n[2],maxY:n[3]}},t}zS.exports=P6;zS.exports.default=P6});var K3=ri((zh,If)=>{u();var oX=200,f_="__lodash_hash_undefined__",iX=800,sX=16,m_=9007199254740991,h_="[object Arguments]",aX="[object Array]",lX="[object AsyncFunction]",cX="[object Boolean]",pX="[object Date]",uX="[object Error]",g_="[object Function]",dX="[object GeneratorFunction]",fX="[object Map]",mX="[object Number]",hX="[object Null]",y_="[object Object]",gX="[object Proxy]",yX="[object RegExp]",bX="[object Set]",xX="[object String]",vX="[object Undefined]",IX="[object WeakMap]",SX="[object ArrayBuffer]",CX="[object DataView]",TX="[object Float32Array]",MX="[object Float64Array]",PX="[object Int8Array]",wX="[object Int16Array]",OX="[object Int32Array]",_X="[object Uint8Array]",EX="[object Uint8ClampedArray]",DX="[object Uint16Array]",FX="[object Uint32Array]",kX=/[\\^$.*+?()[\]{}|]/g,AX=/^\[object .+?Constructor\]$/,LX=/^(?:0|[1-9]\d*)$/,Xt={};Xt[TX]=Xt[MX]=Xt[PX]=Xt[wX]=Xt[OX]=Xt[_X]=Xt[EX]=Xt[DX]=Xt[FX]=!0;Xt[h_]=Xt[aX]=Xt[SX]=Xt[cX]=Xt[CX]=Xt[pX]=Xt[uX]=Xt[g_]=Xt[fX]=Xt[mX]=Xt[y_]=Xt[yX]=Xt[bX]=Xt[xX]=Xt[IX]=!1;var b_=typeof global=="object"&&global&&global.Object===Object&&global,RX=typeof self=="object"&&self&&self.Object===Object&&self,Yh=b_||RX||Function("return this")(),x_=typeof zh=="object"&&zh&&!zh.nodeType&&zh,Xh=x_&&typeof If=="object"&&If&&!If.nodeType&&If,v_=Xh&&Xh.exports===x_,V3=v_&&b_.process,o_=function(){try{var e=Xh&&Xh.require&&Xh.require("util").types;return e||V3&&V3.binding&&V3.binding("util")}catch{}}(),i_=o_&&o_.isTypedArray;function BX(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}function NX(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}function GX(e){return function(t){return e(t)}}function jX(e,t){return e?.[t]}function UX(e,t){return function(r){return e(t(r))}}var VX=Array.prototype,HX=Function.prototype,W0=Object.prototype,H3=Yh["__core-js_shared__"],$0=HX.toString,Aa=W0.hasOwnProperty,s_=function(){var e=/[^.]+$/.exec(H3&&H3.keys&&H3.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),I_=W0.toString,WX=$0.call(Object),$X=RegExp("^"+$0.call(Aa).replace(kX,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),V0=v_?Yh.Buffer:void 0,a_=Yh.Symbol,l_=Yh.Uint8Array,c_=V0?V0.allocUnsafe:void 0,S_=UX(Object.getPrototypeOf,Object),p_=Object.create,zX=W0.propertyIsEnumerable,XX=VX.splice,Op=a_?a_.toStringTag:void 0,H0=function(){try{var e=Y3(Object,"defineProperty");return e({},"",{}),e}catch{}}(),ZX=V0?V0.isBuffer:void 0,u_=Math.max,YX=Date.now,C_=Y3(Yh,"Map"),Zh=Y3(Object,"create"),JX=function(){function e(){}return function(t){if(!Ep(t))return{};if(p_)return p_(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}}();function _p(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function qX(){this.__data__=Zh?Zh(null):{},this.size=0}function KX(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}function QX(e){var t=this.__data__;if(Zh){var r=t[e];return r===f_?void 0:r}return Aa.call(t,e)?t[e]:void 0}function eZ(e){var t=this.__data__;return Zh?t[e]!==void 0:Aa.call(t,e)}function tZ(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=Zh&&t===void 0?f_:t,this}_p.prototype.clear=qX;_p.prototype.delete=KX;_p.prototype.get=QX;_p.prototype.has=eZ;_p.prototype.set=tZ;function La(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function rZ(){this.__data__=[],this.size=0}function nZ(e){var t=this.__data__,r=z0(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():XX.call(t,r,1),--this.size,!0}function oZ(e){var t=this.__data__,r=z0(t,e);return r<0?void 0:t[r][1]}function iZ(e){return z0(this.__data__,e)>-1}function sZ(e,t){var r=this.__data__,n=z0(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}La.prototype.clear=rZ;La.prototype.delete=nZ;La.prototype.get=oZ;La.prototype.has=iZ;La.prototype.set=sZ;function Sf(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function aZ(){this.size=0,this.__data__={hash:new _p,map:new(C_||La),string:new _p}}function lZ(e){var t=Z0(this,e).delete(e);return this.size-=t?1:0,t}function cZ(e){return Z0(this,e).get(e)}function pZ(e){return Z0(this,e).has(e)}function uZ(e,t){var r=Z0(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}Sf.prototype.clear=aZ;Sf.prototype.delete=lZ;Sf.prototype.get=cZ;Sf.prototype.has=pZ;Sf.prototype.set=uZ;function Cf(e){var t=this.__data__=new La(e);this.size=t.size}function dZ(){this.__data__=new La,this.size=0}function fZ(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}function mZ(e){return this.__data__.get(e)}function hZ(e){return this.__data__.has(e)}function gZ(e,t){var r=this.__data__;if(r instanceof La){var n=r.__data__;if(!C_||n.length<oX-1)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new Sf(n)}return r.set(e,t),this.size=r.size,this}Cf.prototype.clear=dZ;Cf.prototype.delete=fZ;Cf.prototype.get=mZ;Cf.prototype.has=hZ;Cf.prototype.set=gZ;function yZ(e,t){var r=X3(e),n=!r&&z3(e),o=!r&&!n&&w_(e),i=!r&&!n&&!o&&__(e),s=r||n||o||i,l=s?NX(e.length,String):[],c=l.length;for(var p in e)(t||Aa.call(e,p))&&!(s&&(p=="length"||o&&(p=="offset"||p=="parent")||i&&(p=="buffer"||p=="byteLength"||p=="byteOffset")||M_(p,c)))&&l.push(p);return l}function W3(e,t,r){(r!==void 0&&!Y0(e[t],r)||r===void 0&&!(t in e))&&Z3(e,t,r)}function bZ(e,t,r){var n=e[t];(!(Aa.call(e,t)&&Y0(n,r))||r===void 0&&!(t in e))&&Z3(e,t,r)}function z0(e,t){for(var r=e.length;r--;)if(Y0(e[r][0],t))return r;return-1}function Z3(e,t,r){t=="__proto__"&&H0?H0(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}var xZ=FZ();function X0(e){return e==null?e===void 0?vX:hX:Op&&Op in Object(e)?kZ(e):GZ(e)}function d_(e){return Jh(e)&&X0(e)==h_}function vZ(e){if(!Ep(e)||BZ(e))return!1;var t=q3(e)?$X:AX;return t.test(HZ(e))}function IZ(e){return Jh(e)&&O_(e.length)&&!!Xt[X0(e)]}function SZ(e){if(!Ep(e))return NZ(e);var t=P_(e),r=[];for(var n in e)n=="constructor"&&(t||!Aa.call(e,n))||r.push(n);return r}function T_(e,t,r,n,o){e!==t&&xZ(t,function(i,s){if(o||(o=new Cf),Ep(i))CZ(e,t,s,r,T_,n,o);else{var l=n?n($3(e,s),i,s+"",e,t,o):void 0;l===void 0&&(l=i),W3(e,s,l)}},E_)}function CZ(e,t,r,n,o,i,s){var l=$3(e,r),c=$3(t,r),p=s.get(c);if(p){W3(e,r,p);return}var d=i?i(l,c,r+"",e,t,s):void 0,m=d===void 0;if(m){var g=X3(c),x=!g&&w_(c),v=!g&&!x&&__(c);d=c,g||x||v?X3(l)?d=l:WZ(l)?d=_Z(l):x?(m=!1,d=PZ(c,!0)):v?(m=!1,d=OZ(c,!0)):d=[]:$Z(c)||z3(c)?(d=l,z3(l)?d=zZ(l):(!Ep(l)||q3(l))&&(d=AZ(c))):m=!1}m&&(s.set(c,d),o(d,c,n,i,s),s.delete(c)),W3(e,r,d)}function TZ(e,t){return UZ(jZ(e,t,D_),e+"")}var MZ=H0?function(e,t){return H0(e,"toString",{configurable:!0,enumerable:!1,value:ZZ(t),writable:!0})}:D_;function PZ(e,t){if(t)return e.slice();var r=e.length,n=c_?c_(r):new e.constructor(r);return e.copy(n),n}function wZ(e){var t=new e.constructor(e.byteLength);return new l_(t).set(new l_(e)),t}function OZ(e,t){var r=t?wZ(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}function _Z(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}function EZ(e,t,r,n){var o=!r;r||(r={});for(var i=-1,s=t.length;++i<s;){var l=t[i],c=n?n(r[l],e[l],l,r,e):void 0;c===void 0&&(c=e[l]),o?Z3(r,l,c):bZ(r,l,c)}return r}function DZ(e){return TZ(function(t,r){var n=-1,o=r.length,i=o>1?r[o-1]:void 0,s=o>2?r[2]:void 0;for(i=e.length>3&&typeof i=="function"?(o--,i):void 0,s&&LZ(r[0],r[1],s)&&(i=o<3?void 0:i,o=1),t=Object(t);++n<o;){var l=r[n];l&&e(t,l,n,i)}return t})}function FZ(e){return function(t,r,n){for(var o=-1,i=Object(t),s=n(t),l=s.length;l--;){var c=s[e?l:++o];if(r(i[c],c,i)===!1)break}return t}}function Z0(e,t){var r=e.__data__;return RZ(t)?r[typeof t=="string"?"string":"hash"]:r.map}function Y3(e,t){var r=jX(e,t);return vZ(r)?r:void 0}function kZ(e){var t=Aa.call(e,Op),r=e[Op];try{e[Op]=void 0;var n=!0}catch{}var o=I_.call(e);return n&&(t?e[Op]=r:delete e[Op]),o}function AZ(e){return typeof e.constructor=="function"&&!P_(e)?JX(S_(e)):{}}function M_(e,t){var r=typeof e;return t=t??m_,!!t&&(r=="number"||r!="symbol"&&LX.test(e))&&e>-1&&e%1==0&&e<t}function LZ(e,t,r){if(!Ep(r))return!1;var n=typeof t;return(n=="number"?J3(r)&&M_(t,r.length):n=="string"&&t in r)?Y0(r[t],e):!1}function RZ(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function BZ(e){return!!s_&&s_ in e}function P_(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||W0;return e===r}function NZ(e){var t=[];if(e!=null)for(var r in Object(e))t.push(r);return t}function GZ(e){return I_.call(e)}function jZ(e,t,r){return t=u_(t===void 0?e.length-1:t,0),function(){for(var n=arguments,o=-1,i=u_(n.length-t,0),s=Array(i);++o<i;)s[o]=n[t+o];o=-1;for(var l=Array(t+1);++o<t;)l[o]=n[o];return l[t]=r(s),BX(e,this,l)}}function $3(e,t){if(!(t==="constructor"&&typeof e[t]=="function")&&t!="__proto__")return e[t]}var UZ=VZ(MZ);function VZ(e){var t=0,r=0;return function(){var n=YX(),o=sX-(n-r);if(r=n,o>0){if(++t>=iX)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function HZ(e){if(e!=null){try{return $0.call(e)}catch{}try{return e+""}catch{}}return""}function Y0(e,t){return e===t||e!==e&&t!==t}var z3=d_(function(){return arguments}())?d_:function(e){return Jh(e)&&Aa.call(e,"callee")&&!zX.call(e,"callee")},X3=Array.isArray;function J3(e){return e!=null&&O_(e.length)&&!q3(e)}function WZ(e){return Jh(e)&&J3(e)}var w_=ZX||YZ;function q3(e){if(!Ep(e))return!1;var t=X0(e);return t==g_||t==dX||t==lX||t==gX}function O_(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=m_}function Ep(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}function Jh(e){return e!=null&&typeof e=="object"}function $Z(e){if(!Jh(e)||X0(e)!=y_)return!1;var t=S_(e);if(t===null)return!0;var r=Aa.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&$0.call(r)==WX}var __=i_?GX(i_):IZ;function zZ(e){return EZ(e,E_(e))}function E_(e){return J3(e)?yZ(e,!0):SZ(e)}var XZ=DZ(function(e,t,r){T_(e,t,r)});function ZZ(e){return function(){return e}}function D_(e){return e}function YZ(){return!1}If.exports=XZ});var uC=ri((Kh,Pf)=>{u();var QZ=200,W_="__lodash_hash_undefined__",eY=800,tY=16,$_=9007199254740991,z_="[object Arguments]",rY="[object Array]",nY="[object AsyncFunction]",oY="[object Boolean]",iY="[object Date]",sY="[object Error]",X_="[object Function]",aY="[object GeneratorFunction]",lY="[object Map]",cY="[object Number]",pY="[object Null]",Z_="[object Object]",uY="[object Proxy]",dY="[object RegExp]",fY="[object Set]",mY="[object String]",hY="[object Undefined]",gY="[object WeakMap]",yY="[object ArrayBuffer]",bY="[object DataView]",xY="[object Float32Array]",vY="[object Float64Array]",IY="[object Int8Array]",SY="[object Int16Array]",CY="[object Int32Array]",TY="[object Uint8Array]",MY="[object Uint8ClampedArray]",PY="[object Uint16Array]",wY="[object Uint32Array]",OY=/[\\^$.*+?()[\]{}|]/g,_Y=/^\[object .+?Constructor\]$/,EY=/^(?:0|[1-9]\d*)$/,Zt={};Zt[xY]=Zt[vY]=Zt[IY]=Zt[SY]=Zt[CY]=Zt[TY]=Zt[MY]=Zt[PY]=Zt[wY]=!0;Zt[z_]=Zt[rY]=Zt[yY]=Zt[oY]=Zt[bY]=Zt[iY]=Zt[sY]=Zt[X_]=Zt[lY]=Zt[cY]=Zt[Z_]=Zt[dY]=Zt[fY]=Zt[mY]=Zt[gY]=!1;var Y_=typeof global=="object"&&global&&global.Object===Object&&global,DY=typeof self=="object"&&self&&self.Object===Object&&self,tg=Y_||DY||Function("return this")(),J_=typeof Kh=="object"&&Kh&&!Kh.nodeType&&Kh,Qh=J_&&typeof Pf=="object"&&Pf&&!Pf.nodeType&&Pf,q_=Qh&&Qh.exports===J_,eC=q_&&Y_.process,L_=function(){try{var e=Qh&&Qh.require&&Qh.require("util").types;return e||eC&&eC.binding&&eC.binding("util")}catch{}}(),R_=L_&&L_.isTypedArray;function K_(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}function FY(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}function kY(e){return function(t){return e(t)}}function AY(e,t){return e?.[t]}function LY(e,t){return function(r){return e(t(r))}}var RY=Array.prototype,BY=Function.prototype,K0=Object.prototype,tC=tg["__core-js_shared__"],Q0=BY.toString,Ba=K0.hasOwnProperty,B_=function(){var e=/[^.]+$/.exec(tC&&tC.keys&&tC.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),Q_=K0.toString,NY=Q0.call(Object),GY=RegExp("^"+Q0.call(Ba).replace(OY,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),J0=q_?tg.Buffer:void 0,N_=tg.Symbol,G_=tg.Uint8Array,j_=J0?J0.allocUnsafe:void 0,eE=LY(Object.getPrototypeOf,Object),U_=Object.create,jY=K0.propertyIsEnumerable,UY=RY.splice,Dp=N_?N_.toStringTag:void 0,q0=function(){try{var e=lC(Object,"defineProperty");return e({},"",{}),e}catch{}}(),VY=J0?J0.isBuffer:void 0,V_=Math.max,HY=Date.now,tE=lC(tg,"Map"),eg=lC(Object,"create"),WY=function(){function e(){}return function(t){if(!Ra(t))return{};if(U_)return U_(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}}();function Fp(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function $Y(){this.__data__=eg?eg(null):{},this.size=0}function zY(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}function XY(e){var t=this.__data__;if(eg){var r=t[e];return r===W_?void 0:r}return Ba.call(t,e)?t[e]:void 0}function ZY(e){var t=this.__data__;return eg?t[e]!==void 0:Ba.call(t,e)}function YY(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=eg&&t===void 0?W_:t,this}Fp.prototype.clear=$Y;Fp.prototype.delete=zY;Fp.prototype.get=XY;Fp.prototype.has=ZY;Fp.prototype.set=YY;function Na(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function JY(){this.__data__=[],this.size=0}function qY(e){var t=this.__data__,r=ex(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():UY.call(t,r,1),--this.size,!0}function KY(e){var t=this.__data__,r=ex(t,e);return r<0?void 0:t[r][1]}function QY(e){return ex(this.__data__,e)>-1}function eJ(e,t){var r=this.__data__,n=ex(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}Na.prototype.clear=JY;Na.prototype.delete=qY;Na.prototype.get=KY;Na.prototype.has=QY;Na.prototype.set=eJ;function wf(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function tJ(){this.size=0,this.__data__={hash:new Fp,map:new(tE||Na),string:new Fp}}function rJ(e){var t=rx(this,e).delete(e);return this.size-=t?1:0,t}function nJ(e){return rx(this,e).get(e)}function oJ(e){return rx(this,e).has(e)}function iJ(e,t){var r=rx(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}wf.prototype.clear=tJ;wf.prototype.delete=rJ;wf.prototype.get=nJ;wf.prototype.has=oJ;wf.prototype.set=iJ;function Of(e){var t=this.__data__=new Na(e);this.size=t.size}function sJ(){this.__data__=new Na,this.size=0}function aJ(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}function lJ(e){return this.__data__.get(e)}function cJ(e){return this.__data__.has(e)}function pJ(e,t){var r=this.__data__;if(r instanceof Na){var n=r.__data__;if(!tE||n.length<QZ-1)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new wf(n)}return r.set(e,t),this.size=r.size,this}Of.prototype.clear=sJ;Of.prototype.delete=aJ;Of.prototype.get=lJ;Of.prototype.has=cJ;Of.prototype.set=pJ;function uJ(e,t){var r=iC(e),n=!r&&oC(e),o=!r&&!n&&sE(e),i=!r&&!n&&!o&&lE(e),s=r||n||o||i,l=s?FY(e.length,String):[],c=l.length;for(var p in e)(t||Ba.call(e,p))&&!(s&&(p=="length"||o&&(p=="offset"||p=="parent")||i&&(p=="buffer"||p=="byteLength"||p=="byteOffset")||oE(p,c)))&&l.push(p);return l}function rC(e,t,r){(r!==void 0&&!nx(e[t],r)||r===void 0&&!(t in e))&&sC(e,t,r)}function dJ(e,t,r){var n=e[t];(!(Ba.call(e,t)&&nx(n,r))||r===void 0&&!(t in e))&&sC(e,t,r)}function ex(e,t){for(var r=e.length;r--;)if(nx(e[r][0],t))return r;return-1}function sC(e,t,r){t=="__proto__"&&q0?q0(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}var fJ=MJ();function tx(e){return e==null?e===void 0?hY:pY:Dp&&Dp in Object(e)?PJ(e):FJ(e)}function H_(e){return rg(e)&&tx(e)==z_}function mJ(e){if(!Ra(e)||EJ(e))return!1;var t=pC(e)?GY:_Y;return t.test(RJ(e))}function hJ(e){return rg(e)&&aE(e.length)&&!!Zt[tx(e)]}function gJ(e){if(!Ra(e))return DJ(e);var t=iE(e),r=[];for(var n in e)n=="constructor"&&(t||!Ba.call(e,n))||r.push(n);return r}function aC(e,t,r,n,o){e!==t&&fJ(t,function(i,s){if(o||(o=new Of),Ra(i))yJ(e,t,s,r,aC,n,o);else{var l=n?n(nC(e,s),i,s+"",e,t,o):void 0;l===void 0&&(l=i),rC(e,s,l)}},cE)}function yJ(e,t,r,n,o,i,s){var l=nC(e,r),c=nC(t,r),p=s.get(c);if(p){rC(e,r,p);return}var d=i?i(l,c,r+"",e,t,s):void 0,m=d===void 0;if(m){var g=iC(c),x=!g&&sE(c),v=!g&&!x&&lE(c);d=c,g||x||v?iC(l)?d=l:BJ(l)?d=SJ(l):x?(m=!1,d=xJ(c,!0)):v?(m=!1,d=IJ(c,!0)):d=[]:NJ(c)||oC(c)?(d=l,oC(l)?d=GJ(l):(!Ra(l)||pC(l))&&(d=wJ(c))):m=!1}m&&(s.set(c,d),o(d,c,n,i,s),s.delete(c)),rC(e,r,d)}function rE(e,t){return AJ(kJ(e,t,pE),e+"")}var bJ=q0?function(e,t){return q0(e,"toString",{configurable:!0,enumerable:!1,value:VJ(t),writable:!0})}:pE;function xJ(e,t){if(t)return e.slice();var r=e.length,n=j_?j_(r):new e.constructor(r);return e.copy(n),n}function vJ(e){var t=new e.constructor(e.byteLength);return new G_(t).set(new G_(e)),t}function IJ(e,t){var r=t?vJ(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}function SJ(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}function CJ(e,t,r,n){var o=!r;r||(r={});for(var i=-1,s=t.length;++i<s;){var l=t[i],c=n?n(r[l],e[l],l,r,e):void 0;c===void 0&&(c=e[l]),o?sC(r,l,c):dJ(r,l,c)}return r}function TJ(e){return rE(function(t,r){var n=-1,o=r.length,i=o>1?r[o-1]:void 0,s=o>2?r[2]:void 0;for(i=e.length>3&&typeof i=="function"?(o--,i):void 0,s&&OJ(r[0],r[1],s)&&(i=o<3?void 0:i,o=1),t=Object(t);++n<o;){var l=r[n];l&&e(t,l,n,i)}return t})}function MJ(e){return function(t,r,n){for(var o=-1,i=Object(t),s=n(t),l=s.length;l--;){var c=s[e?l:++o];if(r(i[c],c,i)===!1)break}return t}}function nE(e,t,r,n,o,i){return Ra(e)&&Ra(t)&&(i.set(t,e),aC(e,t,void 0,nE,i),i.delete(t)),e}function rx(e,t){var r=e.__data__;return _J(t)?r[typeof t=="string"?"string":"hash"]:r.map}function lC(e,t){var r=AY(e,t);return mJ(r)?r:void 0}function PJ(e){var t=Ba.call(e,Dp),r=e[Dp];try{e[Dp]=void 0;var n=!0}catch{}var o=Q_.call(e);return n&&(t?e[Dp]=r:delete e[Dp]),o}function wJ(e){return typeof e.constructor=="function"&&!iE(e)?WY(eE(e)):{}}function oE(e,t){var r=typeof e;return t=t??$_,!!t&&(r=="number"||r!="symbol"&&EY.test(e))&&e>-1&&e%1==0&&e<t}function OJ(e,t,r){if(!Ra(r))return!1;var n=typeof t;return(n=="number"?cC(r)&&oE(t,r.length):n=="string"&&t in r)?nx(r[t],e):!1}function _J(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function EJ(e){return!!B_&&B_ in e}function iE(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||K0;return e===r}function DJ(e){var t=[];if(e!=null)for(var r in Object(e))t.push(r);return t}function FJ(e){return Q_.call(e)}function kJ(e,t,r){return t=V_(t===void 0?e.length-1:t,0),function(){for(var n=arguments,o=-1,i=V_(n.length-t,0),s=Array(i);++o<i;)s[o]=n[t+o];o=-1;for(var l=Array(t+1);++o<t;)l[o]=n[o];return l[t]=r(s),K_(e,this,l)}}function nC(e,t){if(!(t==="constructor"&&typeof e[t]=="function")&&t!="__proto__")return e[t]}var AJ=LJ(bJ);function LJ(e){var t=0,r=0;return function(){var n=HY(),o=tY-(n-r);if(r=n,o>0){if(++t>=eY)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function RJ(e){if(e!=null){try{return Q0.call(e)}catch{}try{return e+""}catch{}}return""}function nx(e,t){return e===t||e!==e&&t!==t}var oC=H_(function(){return arguments}())?H_:function(e){return rg(e)&&Ba.call(e,"callee")&&!jY.call(e,"callee")},iC=Array.isArray;function cC(e){return e!=null&&aE(e.length)&&!pC(e)}function BJ(e){return rg(e)&&cC(e)}var sE=VY||HJ;function pC(e){if(!Ra(e))return!1;var t=tx(e);return t==X_||t==aY||t==nY||t==uY}function aE(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=$_}function Ra(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}function rg(e){return e!=null&&typeof e=="object"}function NJ(e){if(!rg(e)||tx(e)!=Z_)return!1;var t=eE(e);if(t===null)return!0;var r=Ba.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&Q0.call(r)==NY}var lE=R_?kY(R_):hJ;function GJ(e){return CJ(e,cE(e))}var jJ=rE(function(e){return e.push(void 0,nE),K_(UJ,void 0,e)});function cE(e){return cC(e)?uJ(e,!0):gJ(e)}var UJ=TJ(function(e,t,r,n){aC(e,t,r,n)});function VJ(e){return function(){return e}}function pE(e){return e}function HJ(){return!1}Pf.exports=jJ});var d8=ri((gke,dg)=>{"use strict";u();var Aq=!1,Lp=!1,i8=!0,s8=!1,h={},a8=!1;typeof dg<"u"&&dg.exports?(dg.exports=h,a8=!0):typeof document<"u"?window.ClipperLib=h:self.ClipperLib=h;var Sx;a8?(Fr="chrome",Sx="Netscape"):(Fr=navigator.userAgent.toString().toLowerCase(),Sx=navigator.appName);var Fr,ze={};Fr.indexOf("chrome")!=-1&&Fr.indexOf("chromium")==-1?ze.chrome=1:ze.chrome=0;Fr.indexOf("chromium")!=-1?ze.chromium=1:ze.chromium=0;Fr.indexOf("safari")!=-1&&Fr.indexOf("chrome")==-1&&Fr.indexOf("chromium")==-1?ze.safari=1:ze.safari=0;Fr.indexOf("firefox")!=-1?ze.firefox=1:ze.firefox=0;Fr.indexOf("firefox/17")!=-1?ze.firefox17=1:ze.firefox17=0;Fr.indexOf("firefox/15")!=-1?ze.firefox15=1:ze.firefox15=0;Fr.indexOf("firefox/3")!=-1?ze.firefox3=1:ze.firefox3=0;Fr.indexOf("opera")!=-1?ze.opera=1:ze.opera=0;Fr.indexOf("msie 10")!=-1?ze.msie10=1:ze.msie10=0;Fr.indexOf("msie 9")!=-1?ze.msie9=1:ze.msie9=0;Fr.indexOf("msie 8")!=-1?ze.msie8=1:ze.msie8=0;Fr.indexOf("msie 7")!=-1?ze.msie7=1:ze.msie7=0;Fr.indexOf("msie ")!=-1?ze.msie=1:ze.msie=0;h.biginteger_used=null;var Xl,Lq=0xdeadbeefcafe,n8=(Lq&16777215)==15715070;function Y(e,t,r){h.biginteger_used=1,e!=null&&(typeof e=="number"&&typeof t>"u"?this.fromInt(e):typeof e=="number"?this.fromNumber(e,t,r):t==null&&typeof e!="string"?this.fromString(e,256):this.fromString(e,t))}function nt(){return new Y(null)}function Rq(e,t,r,n,o,i){for(;--i>=0;){var s=t*this[e++]+r[n]+o;o=Math.floor(s/67108864),r[n++]=s&67108863}return o}function Bq(e,t,r,n,o,i){for(var s=t&32767,l=t>>15;--i>=0;){var c=this[e]&32767,p=this[e++]>>15,d=l*c+p*s;c=s*c+((d&32767)<<15)+r[n]+(o&1073741823),o=(c>>>30)+(d>>>15)+l*p+(o>>>30),r[n++]=c&1073741823}return o}function Nq(e,t,r,n,o,i){for(var s=t&16383,l=t>>14;--i>=0;){var c=this[e]&16383,p=this[e++]>>14,d=l*c+p*s;c=s*c+((d&16383)<<14)+r[n]+o,o=(c>>28)+(d>>14)+l*p,r[n++]=c&268435455}return o}n8&&Sx=="Microsoft Internet Explorer"?(Y.prototype.am=Bq,Xl=30):n8&&Sx!="Netscape"?(Y.prototype.am=Rq,Xl=26):(Y.prototype.am=Nq,Xl=28);Y.prototype.DB=Xl;Y.prototype.DM=(1<<Xl)-1;Y.prototype.DV=1<<Xl;var MC=52;Y.prototype.FV=Math.pow(2,MC);Y.prototype.F1=MC-Xl;Y.prototype.F2=2*Xl-MC;var Gq="0123456789abcdefghijklmnopqrstuvwxyz",Tx=new Array,Af,Zo;Af=48;for(Zo=0;Zo<=9;++Zo)Tx[Af++]=Zo;Af=97;for(Zo=10;Zo<36;++Zo)Tx[Af++]=Zo;Af=65;for(Zo=10;Zo<36;++Zo)Tx[Af++]=Zo;function o8(e){return Gq.charAt(e)}function l8(e,t){var r=Tx[e.charCodeAt(t)];return r??-1}function jq(e){for(var t=this.t-1;t>=0;--t)e[t]=this[t];e.t=this.t,e.s=this.s}function Uq(e){this.t=1,this.s=e<0?-1:0,e>0?this[0]=e:e<-1?this[0]=e+this.DV:this.t=0}function zl(e){var t=nt();return t.fromInt(e),t}function Vq(e,t){var r;if(t==16)r=4;else if(t==8)r=3;else if(t==256)r=8;else if(t==2)r=1;else if(t==32)r=5;else if(t==4)r=2;else{this.fromRadix(e,t);return}this.t=0,this.s=0;for(var n=e.length,o=!1,i=0;--n>=0;){var s=r==8?e[n]&255:l8(e,n);if(s<0){e.charAt(n)=="-"&&(o=!0);continue}o=!1,i==0?this[this.t++]=s:i+r>this.DB?(this[this.t-1]|=(s&(1<<this.DB-i)-1)<<i,this[this.t++]=s>>this.DB-i):this[this.t-1]|=s<<i,i+=r,i>=this.DB&&(i-=this.DB)}r==8&&(e[0]&128)!=0&&(this.s=-1,i>0&&(this[this.t-1]|=(1<<this.DB-i)-1<<i)),this.clamp(),o&&Y.ZERO.subTo(this,this)}function Hq(){for(var e=this.s&this.DM;this.t>0&&this[this.t-1]==e;)--this.t}function Wq(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(e==16)t=4;else if(e==8)t=3;else if(e==2)t=1;else if(e==32)t=5;else if(e==4)t=2;else return this.toRadix(e);var r=(1<<t)-1,n,o=!1,i="",s=this.t,l=this.DB-s*this.DB%t;if(s-- >0)for(l<this.DB&&(n=this[s]>>l)>0&&(o=!0,i=o8(n));s>=0;)l<t?(n=(this[s]&(1<<l)-1)<<t-l,n|=this[--s]>>(l+=this.DB-t)):(n=this[s]>>(l-=t)&r,l<=0&&(l+=this.DB,--s)),n>0&&(o=!0),o&&(i+=o8(n));return o?i:"0"}function $q(){var e=nt();return Y.ZERO.subTo(this,e),e}function zq(){return this.s<0?this.negate():this}function Xq(e){var t=this.s-e.s;if(t!=0)return t;var r=this.t;if(t=r-e.t,t!=0)return this.s<0?-t:t;for(;--r>=0;)if((t=this[r]-e[r])!=0)return t;return 0}function Mx(e){var t=1,r;return(r=e>>>16)!=0&&(e=r,t+=16),(r=e>>8)!=0&&(e=r,t+=8),(r=e>>4)!=0&&(e=r,t+=4),(r=e>>2)!=0&&(e=r,t+=2),(r=e>>1)!=0&&(e=r,t+=1),t}function Zq(){return this.t<=0?0:this.DB*(this.t-1)+Mx(this[this.t-1]^this.s&this.DM)}function Yq(e,t){var r;for(r=this.t-1;r>=0;--r)t[r+e]=this[r];for(r=e-1;r>=0;--r)t[r]=0;t.t=this.t+e,t.s=this.s}function Jq(e,t){for(var r=e;r<this.t;++r)t[r-e]=this[r];t.t=Math.max(this.t-e,0),t.s=this.s}function qq(e,t){var r=e%this.DB,n=this.DB-r,o=(1<<n)-1,i=Math.floor(e/this.DB),s=this.s<<r&this.DM,l;for(l=this.t-1;l>=0;--l)t[l+i+1]=this[l]>>n|s,s=(this[l]&o)<<r;for(l=i-1;l>=0;--l)t[l]=0;t[i]=s,t.t=this.t+i+1,t.s=this.s,t.clamp()}function Kq(e,t){t.s=this.s;var r=Math.floor(e/this.DB);if(r>=this.t){t.t=0;return}var n=e%this.DB,o=this.DB-n,i=(1<<n)-1;t[0]=this[r]>>n;for(var s=r+1;s<this.t;++s)t[s-r-1]|=(this[s]&i)<<o,t[s-r]=this[s]>>n;n>0&&(t[this.t-r-1]|=(this.s&i)<<o),t.t=this.t-r,t.clamp()}function Qq(e,t){for(var r=0,n=0,o=Math.min(e.t,this.t);r<o;)n+=this[r]-e[r],t[r++]=n&this.DM,n>>=this.DB;if(e.t<this.t){for(n-=e.s;r<this.t;)n+=this[r],t[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<e.t;)n-=e[r],t[r++]=n&this.DM,n>>=this.DB;n-=e.s}t.s=n<0?-1:0,n<-1?t[r++]=this.DV+n:n>0&&(t[r++]=n),t.t=r,t.clamp()}function eK(e,t){var r=this.abs(),n=e.abs(),o=r.t;for(t.t=o+n.t;--o>=0;)t[o]=0;for(o=0;o<n.t;++o)t[o+r.t]=r.am(0,n[o],t,o,0,r.t);t.s=0,t.clamp(),this.s!=e.s&&Y.ZERO.subTo(t,t)}function tK(e){for(var t=this.abs(),r=e.t=2*t.t;--r>=0;)e[r]=0;for(r=0;r<t.t-1;++r){var n=t.am(r,t[r],e,2*r,0,1);(e[r+t.t]+=t.am(r+1,2*t[r],e,2*r+1,n,t.t-r-1))>=t.DV&&(e[r+t.t]-=t.DV,e[r+t.t+1]=1)}e.t>0&&(e[e.t-1]+=t.am(r,t[r],e,2*r,0,1)),e.s=0,e.clamp()}function rK(e,t,r){var n=e.abs();if(!(n.t<=0)){var o=this.abs();if(o.t<n.t){t?.fromInt(0),r!=null&&this.copyTo(r);return}r==null&&(r=nt());var i=nt(),s=this.s,l=e.s,c=this.DB-Mx(n[n.t-1]);c>0?(n.lShiftTo(c,i),o.lShiftTo(c,r)):(n.copyTo(i),o.copyTo(r));var p=i.t,d=i[p-1];if(d!=0){var m=d*(1<<this.F1)+(p>1?i[p-2]>>this.F2:0),g=this.FV/m,x=(1<<this.F1)/m,v=1<<this.F2,C=r.t,I=C-p,S=t??nt();for(i.dlShiftTo(I,S),r.compareTo(S)>=0&&(r[r.t++]=1,r.subTo(S,r)),Y.ONE.dlShiftTo(p,S),S.subTo(i,i);i.t<p;)i[i.t++]=0;for(;--I>=0;){var P=r[--C]==d?this.DM:Math.floor(r[C]*g+(r[C-1]+v)*x);if((r[C]+=i.am(0,P,r,I,0,p))<P)for(i.dlShiftTo(I,S),r.subTo(S,r);r[C]<--P;)r.subTo(S,r)}t!=null&&(r.drShiftTo(p,t),s!=l&&Y.ZERO.subTo(t,t)),r.t=p,r.clamp(),c>0&&r.rShiftTo(c,r),s<0&&Y.ZERO.subTo(r,r)}}}function nK(e){var t=nt();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(Y.ZERO)>0&&e.subTo(t,t),t}function Rp(e){this.m=e}function oK(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e}function iK(e){return e}function sK(e){e.divRemTo(this.m,null,e)}function aK(e,t,r){e.multiplyTo(t,r),this.reduce(r)}function lK(e,t){e.squareTo(t),this.reduce(t)}Rp.prototype.convert=oK;Rp.prototype.revert=iK;Rp.prototype.reduce=sK;Rp.prototype.mulTo=aK;Rp.prototype.sqrTo=lK;function cK(){if(this.t<1)return 0;var e=this[0];if((e&1)==0)return 0;var t=e&3;return t=t*(2-(e&15)*t)&15,t=t*(2-(e&255)*t)&255,t=t*(2-((e&65535)*t&65535))&65535,t=t*(2-e*t%this.DV)%this.DV,t>0?this.DV-t:-t}function Bp(e){this.m=e,this.mp=e.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<<e.DB-15)-1,this.mt2=2*e.t}function pK(e){var t=nt();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(Y.ZERO)>0&&this.m.subTo(t,t),t}function uK(e){var t=nt();return e.copyTo(t),this.reduce(t),t}function dK(e){for(;e.t<=this.mt2;)e[e.t++]=0;for(var t=0;t<this.m.t;++t){var r=e[t]&32767,n=r*this.mpl+((r*this.mph+(e[t]>>15)*this.mpl&this.um)<<15)&e.DM;for(r=t+this.m.t,e[r]+=this.m.am(0,n,e,t,0,this.m.t);e[r]>=e.DV;)e[r]-=e.DV,e[++r]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)}function fK(e,t){e.squareTo(t),this.reduce(t)}function mK(e,t,r){e.multiplyTo(t,r),this.reduce(r)}Bp.prototype.convert=pK;Bp.prototype.revert=uK;Bp.prototype.reduce=dK;Bp.prototype.mulTo=mK;Bp.prototype.sqrTo=fK;function hK(){return(this.t>0?this[0]&1:this.s)==0}function gK(e,t){if(e>4294967295||e<1)return Y.ONE;var r=nt(),n=nt(),o=t.convert(this),i=Mx(e)-1;for(o.copyTo(r);--i>=0;)if(t.sqrTo(r,n),(e&1<<i)>0)t.mulTo(n,o,r);else{var s=r;r=n,n=s}return t.revert(r)}function yK(e,t){var r;return e<256||t.isEven()?r=new Rp(t):r=new Bp(t),this.exp(e,r)}Y.prototype.copyTo=jq;Y.prototype.fromInt=Uq;Y.prototype.fromString=Vq;Y.prototype.clamp=Hq;Y.prototype.dlShiftTo=Yq;Y.prototype.drShiftTo=Jq;Y.prototype.lShiftTo=qq;Y.prototype.rShiftTo=Kq;Y.prototype.subTo=Qq;Y.prototype.multiplyTo=eK;Y.prototype.squareTo=tK;Y.prototype.divRemTo=rK;Y.prototype.invDigit=cK;Y.prototype.isEven=hK;Y.prototype.exp=gK;Y.prototype.toString=Wq;Y.prototype.negate=$q;Y.prototype.abs=zq;Y.prototype.compareTo=Xq;Y.prototype.bitLength=Zq;Y.prototype.mod=nK;Y.prototype.modPowInt=yK;Y.ZERO=zl(0);Y.ONE=zl(1);function bK(){var e=nt();return this.copyTo(e),e}function xK(){if(this.s<0){if(this.t==1)return this[0]-this.DV;if(this.t==0)return-1}else{if(this.t==1)return this[0];if(this.t==0)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]}function vK(){return this.t==0?this.s:this[0]<<24>>24}function IK(){return this.t==0?this.s:this[0]<<16>>16}function SK(e){return Math.floor(Math.LN2*this.DB/Math.log(e))}function CK(){return this.s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1}function TK(e){if(e==null&&(e=10),this.signum()==0||e<2||e>36)return"0";var t=this.chunkSize(e),r=Math.pow(e,t),n=zl(r),o=nt(),i=nt(),s="";for(this.divRemTo(n,o,i);o.signum()>0;)s=(r+i.intValue()).toString(e).substr(1)+s,o.divRemTo(n,o,i);return i.intValue().toString(e)+s}function MK(e,t){this.fromInt(0),t==null&&(t=10);for(var r=this.chunkSize(t),n=Math.pow(t,r),o=!1,i=0,s=0,l=0;l<e.length;++l){var c=l8(e,l);if(c<0){e.charAt(l)=="-"&&this.signum()==0&&(o=!0);continue}s=t*s+c,++i>=r&&(this.dMultiply(n),this.dAddOffset(s,0),i=0,s=0)}i>0&&(this.dMultiply(Math.pow(t,i)),this.dAddOffset(s,0)),o&&Y.ZERO.subTo(this,this)}function PK(e,t,r){if(typeof t=="number")if(e<2)this.fromInt(1);else for(this.fromNumber(e,r),this.testBit(e-1)||this.bitwiseTo(Y.ONE.shiftLeft(e-1),PC,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(Y.ONE.shiftLeft(e-1),this);else{var n=new Array,o=e&7;n.length=(e>>3)+1,t.nextBytes(n),o>0?n[0]&=(1<<o)-1:n[0]=0,this.fromString(n,256)}}function wK(){var e=this.t,t=new Array;t[0]=this.s;var r=this.DB-e*this.DB%8,n,o=0;if(e-- >0)for(r<this.DB&&(n=this[e]>>r)!=(this.s&this.DM)>>r&&(t[o++]=n|this.s<<this.DB-r);e>=0;)r<8?(n=(this[e]&(1<<r)-1)<<8-r,n|=this[--e]>>(r+=this.DB-8)):(n=this[e]>>(r-=8)&255,r<=0&&(r+=this.DB,--e)),(n&128)!=0&&(n|=-256),o==0&&(this.s&128)!=(n&128)&&++o,(o>0||n!=this.s)&&(t[o++]=n);return t}function OK(e){return this.compareTo(e)==0}function _K(e){return this.compareTo(e)<0?this:e}function EK(e){return this.compareTo(e)>0?this:e}function DK(e,t,r){var n,o,i=Math.min(e.t,this.t);for(n=0;n<i;++n)r[n]=t(this[n],e[n]);if(e.t<this.t){for(o=e.s&this.DM,n=i;n<this.t;++n)r[n]=t(this[n],o);r.t=this.t}else{for(o=this.s&this.DM,n=i;n<e.t;++n)r[n]=t(o,e[n]);r.t=e.t}r.s=t(this.s,e.s),r.clamp()}function FK(e,t){return e&t}function kK(e){var t=nt();return this.bitwiseTo(e,FK,t),t}function PC(e,t){return e|t}function AK(e){var t=nt();return this.bitwiseTo(e,PC,t),t}function c8(e,t){return e^t}function LK(e){var t=nt();return this.bitwiseTo(e,c8,t),t}function p8(e,t){return e&~t}function RK(e){var t=nt();return this.bitwiseTo(e,p8,t),t}function BK(){for(var e=nt(),t=0;t<this.t;++t)e[t]=this.DM&~this[t];return e.t=this.t,e.s=~this.s,e}function NK(e){var t=nt();return e<0?this.rShiftTo(-e,t):this.lShiftTo(e,t),t}function GK(e){var t=nt();return e<0?this.lShiftTo(-e,t):this.rShiftTo(e,t),t}function jK(e){if(e==0)return-1;var t=0;return(e&65535)==0&&(e>>=16,t+=16),(e&255)==0&&(e>>=8,t+=8),(e&15)==0&&(e>>=4,t+=4),(e&3)==0&&(e>>=2,t+=2),(e&1)==0&&++t,t}function UK(){for(var e=0;e<this.t;++e)if(this[e]!=0)return e*this.DB+jK(this[e]);return this.s<0?this.t*this.DB:-1}function VK(e){for(var t=0;e!=0;)e&=e-1,++t;return t}function HK(){for(var e=0,t=this.s&this.DM,r=0;r<this.t;++r)e+=VK(this[r]^t);return e}function WK(e){var t=Math.floor(e/this.DB);return t>=this.t?this.s!=0:(this[t]&1<<e%this.DB)!=0}function $K(e,t){var r=Y.ONE.shiftLeft(e);return this.bitwiseTo(r,t,r),r}function zK(e){return this.changeBit(e,PC)}function XK(e){return this.changeBit(e,p8)}function ZK(e){return this.changeBit(e,c8)}function YK(e,t){for(var r=0,n=0,o=Math.min(e.t,this.t);r<o;)n+=this[r]+e[r],t[r++]=n&this.DM,n>>=this.DB;if(e.t<this.t){for(n+=e.s;r<this.t;)n+=this[r],t[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<e.t;)n+=e[r],t[r++]=n&this.DM,n>>=this.DB;n+=e.s}t.s=n<0?-1:0,n>0?t[r++]=n:n<-1&&(t[r++]=this.DV+n),t.t=r,t.clamp()}function JK(e){var t=nt();return this.addTo(e,t),t}function qK(e){var t=nt();return this.subTo(e,t),t}function KK(e){var t=nt();return this.multiplyTo(e,t),t}function QK(){var e=nt();return this.squareTo(e),e}function eQ(e){var t=nt();return this.divRemTo(e,t,null),t}function tQ(e){var t=nt();return this.divRemTo(e,null,t),t}function rQ(e){var t=nt(),r=nt();return this.divRemTo(e,t,r),new Array(t,r)}function nQ(e){this[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()}function oQ(e,t){if(e!=0){for(;this.t<=t;)this[this.t++]=0;for(this[t]+=e;this[t]>=this.DV;)this[t]-=this.DV,++t>=this.t&&(this[this.t++]=0),++this[t]}}function fg(){}function u8(e){return e}function iQ(e,t,r){e.multiplyTo(t,r)}function sQ(e,t){e.squareTo(t)}fg.prototype.convert=u8;fg.prototype.revert=u8;fg.prototype.mulTo=iQ;fg.prototype.sqrTo=sQ;function aQ(e){return this.exp(e,new fg)}function lQ(e,t,r){var n=Math.min(this.t+e.t,t);for(r.s=0,r.t=n;n>0;)r[--n]=0;var o;for(o=r.t-this.t;n<o;++n)r[n+this.t]=this.am(0,e[n],r,n,0,this.t);for(o=Math.min(e.t,t);n<o;++n)this.am(0,e[n],r,n,0,t-n);r.clamp()}function cQ(e,t,r){--t;var n=r.t=this.t+e.t-t;for(r.s=0;--n>=0;)r[n]=0;for(n=Math.max(t-this.t,0);n<e.t;++n)r[this.t+n-t]=this.am(t-n,e[n],r,0,0,this.t+n-t);r.clamp(),r.drShiftTo(1,r)}function Lf(e){this.r2=nt(),this.q3=nt(),Y.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e),this.m=e}function pQ(e){if(e.s<0||e.t>2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=nt();return e.copyTo(t),this.reduce(t),t}function uQ(e){return e}function dQ(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)}function fQ(e,t){e.squareTo(t),this.reduce(t)}function mQ(e,t,r){e.multiplyTo(t,r),this.reduce(r)}Lf.prototype.convert=pQ;Lf.prototype.revert=uQ;Lf.prototype.reduce=dQ;Lf.prototype.mulTo=mQ;Lf.prototype.sqrTo=fQ;function hQ(e,t){var r=e.bitLength(),n,o=zl(1),i;if(r<=0)return o;r<18?n=1:r<48?n=3:r<144?n=4:r<768?n=5:n=6,r<8?i=new Rp(t):t.isEven()?i=new Lf(t):i=new Bp(t);var s=new Array,l=3,c=n-1,p=(1<<n)-1;if(s[1]=i.convert(this),n>1){var d=nt();for(i.sqrTo(s[1],d);l<=p;)s[l]=nt(),i.mulTo(d,s[l-2],s[l]),l+=2}var m=e.t-1,g,x=!0,v=nt(),C;for(r=Mx(e[m])-1;m>=0;){for(r>=c?g=e[m]>>r-c&p:(g=(e[m]&(1<<r+1)-1)<<c-r,m>0&&(g|=e[m-1]>>this.DB+r-c)),l=n;(g&1)==0;)g>>=1,--l;if((r-=l)<0&&(r+=this.DB,--m),x)s[g].copyTo(o),x=!1;else{for(;l>1;)i.sqrTo(o,v),i.sqrTo(v,o),l-=2;l>0?i.sqrTo(o,v):(C=o,o=v,v=C),i.mulTo(v,s[g],o)}for(;m>=0&&(e[m]&1<<r)==0;)i.sqrTo(o,v),C=o,o=v,v=C,--r<0&&(r=this.DB-1,--m)}return i.revert(o)}function gQ(e){var t=this.s<0?this.negate():this.clone(),r=e.s<0?e.negate():e.clone();if(t.compareTo(r)<0){var n=t;t=r,r=n}var o=t.getLowestSetBit(),i=r.getLowestSetBit();if(i<0)return t;for(o<i&&(i=o),i>0&&(t.rShiftTo(i,t),r.rShiftTo(i,r));t.signum()>0;)(o=t.getLowestSetBit())>0&&t.rShiftTo(o,t),(o=r.getLowestSetBit())>0&&r.rShiftTo(o,r),t.compareTo(r)>=0?(t.subTo(r,t),t.rShiftTo(1,t)):(r.subTo(t,r),r.rShiftTo(1,r));return i>0&&r.lShiftTo(i,r),r}function yQ(e){if(e<=0)return 0;var t=this.DV%e,r=this.s<0?e-1:0;if(this.t>0)if(t==0)r=this[0]%e;else for(var n=this.t-1;n>=0;--n)r=(t*r+this[n])%e;return r}function bQ(e){var t=e.isEven();if(this.isEven()&&t||e.signum()==0)return Y.ZERO;for(var r=e.clone(),n=this.clone(),o=zl(1),i=zl(0),s=zl(0),l=zl(1);r.signum()!=0;){for(;r.isEven();)r.rShiftTo(1,r),t?((!o.isEven()||!i.isEven())&&(o.addTo(this,o),i.subTo(e,i)),o.rShiftTo(1,o)):i.isEven()||i.subTo(e,i),i.rShiftTo(1,i);for(;n.isEven();)n.rShiftTo(1,n),t?((!s.isEven()||!l.isEven())&&(s.addTo(this,s),l.subTo(e,l)),s.rShiftTo(1,s)):l.isEven()||l.subTo(e,l),l.rShiftTo(1,l);r.compareTo(n)>=0?(r.subTo(n,r),t&&o.subTo(s,o),i.subTo(l,i)):(n.subTo(r,n),t&&s.subTo(o,s),l.subTo(i,l))}if(n.compareTo(Y.ONE)!=0)return Y.ZERO;if(l.compareTo(e)>=0)return l.subtract(e);if(l.signum()<0)l.addTo(e,l);else return l;return l.signum()<0?l.add(e):l}var En=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],xQ=(1<<26)/En[En.length-1];function vQ(e){var t,r=this.abs();if(r.t==1&&r[0]<=En[En.length-1]){for(t=0;t<En.length;++t)if(r[0]==En[t])return!0;return!1}if(r.isEven())return!1;for(t=1;t<En.length;){for(var n=En[t],o=t+1;o<En.length&&n<xQ;)n*=En[o++];for(n=r.modInt(n);t<o;)if(n%En[t++]==0)return!1}return r.millerRabin(e)}function IQ(e){var t=this.subtract(Y.ONE),r=t.getLowestSetBit();if(r<=0)return!1;var n=t.shiftRight(r);e=e+1>>1,e>En.length&&(e=En.length);for(var o=nt(),i=0;i<e;++i){o.fromInt(En[Math.floor(Math.random()*En.length)]);var s=o.modPow(n,this);if(s.compareTo(Y.ONE)!=0&&s.compareTo(t)!=0){for(var l=1;l++<r&&s.compareTo(t)!=0;)if(s=s.modPowInt(2,this),s.compareTo(Y.ONE)==0)return!1;if(s.compareTo(t)!=0)return!1}}return!0}Y.prototype.chunkSize=SK;Y.prototype.toRadix=TK;Y.prototype.fromRadix=MK;Y.prototype.fromNumber=PK;Y.prototype.bitwiseTo=DK;Y.prototype.changeBit=$K;Y.prototype.addTo=YK;Y.prototype.dMultiply=nQ;Y.prototype.dAddOffset=oQ;Y.prototype.multiplyLowerTo=lQ;Y.prototype.multiplyUpperTo=cQ;Y.prototype.modInt=yQ;Y.prototype.millerRabin=IQ;Y.prototype.clone=bK;Y.prototype.intValue=xK;Y.prototype.byteValue=vK;Y.prototype.shortValue=IK;Y.prototype.signum=CK;Y.prototype.toByteArray=wK;Y.prototype.equals=OK;Y.prototype.min=_K;Y.prototype.max=EK;Y.prototype.and=kK;Y.prototype.or=AK;Y.prototype.xor=LK;Y.prototype.andNot=RK;Y.prototype.not=BK;Y.prototype.shiftLeft=NK;Y.prototype.shiftRight=GK;Y.prototype.getLowestSetBit=UK;Y.prototype.bitCount=HK;Y.prototype.testBit=WK;Y.prototype.setBit=zK;Y.prototype.clearBit=XK;Y.prototype.flipBit=ZK;Y.prototype.add=JK;Y.prototype.subtract=qK;Y.prototype.multiply=KK;Y.prototype.divide=eQ;Y.prototype.remainder=tQ;Y.prototype.divideAndRemainder=rQ;Y.prototype.modPow=hQ;Y.prototype.modInverse=bQ;Y.prototype.pow=aQ;Y.prototype.gcd=gQ;Y.prototype.isProbablePrime=vQ;Y.prototype.square=QK;var Ue=Y;Ue.prototype.IsNegative=function(){return this.compareTo(Ue.ZERO)==-1};Ue.op_Equality=function(e,t){return e.compareTo(t)==0};Ue.op_Inequality=function(e,t){return e.compareTo(t)!=0};Ue.op_GreaterThan=function(e,t){return e.compareTo(t)>0};Ue.op_LessThan=function(e,t){return e.compareTo(t)<0};Ue.op_Addition=function(e,t){return new Ue(e).add(new Ue(t))};Ue.op_Subtraction=function(e,t){return new Ue(e).subtract(new Ue(t))};Ue.Int128Mul=function(e,t){return new Ue(e).multiply(new Ue(t))};Ue.op_Division=function(e,t){return e.divide(t)};Ue.prototype.ToDouble=function(){return parseFloat(this.toString())};typeof Cx>"u"&&(Cx=function(e,t){var r;if(typeof Object.getOwnPropertyNames>"u"){for(r in t.prototype)(typeof e.prototype[r]>"u"||e.prototype[r]==Object.prototype[r])&&(e.prototype[r]=t.prototype[r]);for(r in t)typeof e[r]>"u"&&(e[r]=t[r]);e.$baseCtor=t}else{for(var n=Object.getOwnPropertyNames(t.prototype),o=0;o<n.length;o++)typeof Object.getOwnPropertyDescriptor(e.prototype,n[o])>"u"&&Object.defineProperty(e.prototype,n[o],Object.getOwnPropertyDescriptor(t.prototype,n[o]));for(r in t)typeof e[r]>"u"&&(e[r]=t[r]);e.$baseCtor=t}});var Cx;h.Path=function(){return[]};h.Paths=function(){return[]};h.DoublePoint=function(){var e=arguments;this.X=0,this.Y=0,e.length==1?(this.X=e[0].X,this.Y=e[0].Y):e.length==2&&(this.X=e[0],this.Y=e[1])};h.DoublePoint0=function(){this.X=0,this.Y=0};h.DoublePoint1=function(e){this.X=e.X,this.Y=e.Y};h.DoublePoint2=function(e,t){this.X=e,this.Y=t};h.PolyNode=function(){this.m_Parent=null,this.m_polygon=new h.Path,this.m_Index=0,this.m_jointype=0,this.m_endtype=0,this.m_Childs=[],this.IsOpen=!1};h.PolyNode.prototype.IsHoleNode=function(){for(var e=!0,t=this.m_Parent;t!==null;)e=!e,t=t.m_Parent;return e};h.PolyNode.prototype.ChildCount=function(){return this.m_Childs.length};h.PolyNode.prototype.Contour=function(){return this.m_polygon};h.PolyNode.prototype.AddChild=function(e){var t=this.m_Childs.length;this.m_Childs.push(e),e.m_Parent=this,e.m_Index=t};h.PolyNode.prototype.GetNext=function(){return this.m_Childs.length>0?this.m_Childs[0]:this.GetNextSiblingUp()};h.PolyNode.prototype.GetNextSiblingUp=function(){return this.m_Parent===null?null:this.m_Index==this.m_Parent.m_Childs.length-1?this.m_Parent.GetNextSiblingUp():this.m_Parent.m_Childs[this.m_Index+1]};h.PolyNode.prototype.Childs=function(){return this.m_Childs};h.PolyNode.prototype.Parent=function(){return this.m_Parent};h.PolyNode.prototype.IsHole=function(){return this.IsHoleNode()};h.PolyTree=function(){this.m_AllPolys=[],h.PolyNode.call(this)};h.PolyTree.prototype.Clear=function(){for(var e=0,t=this.m_AllPolys.length;e<t;e++)this.m_AllPolys[e]=null;this.m_AllPolys.length=0,this.m_Childs.length=0};h.PolyTree.prototype.GetFirst=function(){return this.m_Childs.length>0?this.m_Childs[0]:null};h.PolyTree.prototype.Total=function(){return this.m_AllPolys.length};Cx(h.PolyTree,h.PolyNode);h.Math_Abs_Int64=h.Math_Abs_Int32=h.Math_Abs_Double=function(e){return Math.abs(e)};h.Math_Max_Int32_Int32=function(e,t){return Math.max(e,t)};ze.msie||ze.opera||ze.safari?h.Cast_Int32=function(e){return e|0}:h.Cast_Int32=function(e){return~~e};ze.chrome?h.Cast_Int64=function(e){return e<-2147483648||e>2147483647?e<0?Math.ceil(e):Math.floor(e):~~e}:ze.firefox&&typeof Number.toInteger=="function"?h.Cast_Int64=function(e){return Number.toInteger(e)}:ze.msie7||ze.msie8?h.Cast_Int64=function(e){return parseInt(e,10)}:ze.msie?h.Cast_Int64=function(e){return e<-2147483648||e>2147483647?e<0?Math.ceil(e):Math.floor(e):e|0}:h.Cast_Int64=function(e){return e<0?Math.ceil(e):Math.floor(e)};h.Clear=function(e){e.length=0};h.PI=3.141592653589793;h.PI2=2*3.141592653589793;h.IntPoint=function(){var e=arguments,t=e.length;if(this.X=0,this.Y=0,Lp)if(this.Z=0,t==3)this.X=e[0],this.Y=e[1],this.Z=e[2];else if(t==2)this.X=e[0],this.Y=e[1],this.Z=0;else if(t==1)if(e[0]instanceof h.DoublePoint){var r=e[0];this.X=h.Clipper.Round(r.X),this.Y=h.Clipper.Round(r.Y),this.Z=0}else{var n=e[0];typeof n.Z>"u"&&(n.Z=0),this.X=n.X,this.Y=n.Y,this.Z=n.Z}else this.X=0,this.Y=0,this.Z=0;else if(t==2)this.X=e[0],this.Y=e[1];else if(t==1)if(e[0]instanceof h.DoublePoint){var r=e[0];this.X=h.Clipper.Round(r.X),this.Y=h.Clipper.Round(r.Y)}else{var n=e[0];this.X=n.X,this.Y=n.Y}else this.X=0,this.Y=0};h.IntPoint.op_Equality=function(e,t){return e.X==t.X&&e.Y==t.Y};h.IntPoint.op_Inequality=function(e,t){return e.X!=t.X||e.Y!=t.Y};Lp?(h.IntPoint0=function(){this.X=0,this.Y=0,this.Z=0},h.IntPoint1=function(e){this.X=e.X,this.Y=e.Y,this.Z=e.Z},h.IntPoint1dp=function(e){this.X=h.Clipper.Round(e.X),this.Y=h.Clipper.Round(e.Y),this.Z=0},h.IntPoint2=function(e,t){this.X=e,this.Y=t,this.Z=0},h.IntPoint3=function(e,t,r){this.X=e,this.Y=t,this.Z=r}):(h.IntPoint0=function(){this.X=0,this.Y=0},h.IntPoint1=function(e){this.X=e.X,this.Y=e.Y},h.IntPoint1dp=function(e){this.X=h.Clipper.Round(e.X),this.Y=h.Clipper.Round(e.Y)},h.IntPoint2=function(e,t){this.X=e,this.Y=t});h.IntRect=function(){var e=arguments,t=e.length;t==4?(this.left=e[0],this.top=e[1],this.right=e[2],this.bottom=e[3]):t==1?(this.left=ir.left,this.top=ir.top,this.right=ir.right,this.bottom=ir.bottom):(this.left=0,this.top=0,this.right=0,this.bottom=0)};h.IntRect0=function(){this.left=0,this.top=0,this.right=0,this.bottom=0};h.IntRect1=function(e){this.left=e.left,this.top=e.top,this.right=e.right,this.bottom=e.bottom};h.IntRect4=function(e,t,r,n){this.left=e,this.top=t,this.right=r,this.bottom=n};h.ClipType={ctIntersection:0,ctUnion:1,ctDifference:2,ctXor:3};h.PolyType={ptSubject:0,ptClip:1};h.PolyFillType={pftEvenOdd:0,pftNonZero:1,pftPositive:2,pftNegative:3};h.JoinType={jtSquare:0,jtRound:1,jtMiter:2};h.EndType={etOpenSquare:0,etOpenRound:1,etOpenButt:2,etClosedLine:3,etClosedPolygon:4};s8&&(h.EndType_={etSquare:0,etRound:1,etButt:2,etClosed:3});h.EdgeSide={esLeft:0,esRight:1};h.Direction={dRightToLeft:0,dLeftToRight:1};h.TEdge=function(){this.Bot=new h.IntPoint,this.Curr=new h.IntPoint,this.Top=new h.IntPoint,this.Delta=new h.IntPoint,this.Dx=0,this.PolyTyp=h.PolyType.ptSubject,this.Side=h.EdgeSide.esLeft,this.WindDelta=0,this.WindCnt=0,this.WindCnt2=0,this.OutIdx=0,this.Next=null,this.Prev=null,this.NextInLML=null,this.NextInAEL=null,this.PrevInAEL=null,this.NextInSEL=null,this.PrevInSEL=null};h.IntersectNode=function(){this.Edge1=null,this.Edge2=null,this.Pt=new h.IntPoint};h.MyIntersectNodeSort=function(){};h.MyIntersectNodeSort.Compare=function(e,t){return t.Pt.Y-e.Pt.Y};h.LocalMinima=function(){this.Y=0,this.LeftBound=null,this.RightBound=null,this.Next=null};h.Scanbeam=function(){this.Y=0,this.Next=null};h.OutRec=function(){this.Idx=0,this.IsHole=!1,this.IsOpen=!1,this.FirstLeft=null,this.Pts=null,this.BottomPt=null,this.PolyNode=null};h.OutPt=function(){this.Idx=0,this.Pt=new h.IntPoint,this.Next=null,this.Prev=null};h.Join=function(){this.OutPt1=null,this.OutPt2=null,this.OffPt=new h.IntPoint};h.ClipperBase=function(){this.m_MinimaList=null,this.m_CurrentLM=null,this.m_edges=new Array,this.m_UseFullRange=!1,this.m_HasOpenPaths=!1,this.PreserveCollinear=!1,this.m_MinimaList=null,this.m_CurrentLM=null,this.m_UseFullRange=!1,this.m_HasOpenPaths=!1};h.ClipperBase.horizontal=-9007199254740992;h.ClipperBase.Skip=-2;h.ClipperBase.Unassigned=-1;h.ClipperBase.tolerance=1e-20;Aq?(h.ClipperBase.loRange=46340,h.ClipperBase.hiRange=46340):(h.ClipperBase.loRange=47453132,h.ClipperBase.hiRange=0xfffffffffffff);h.ClipperBase.near_zero=function(e){return e>-h.ClipperBase.tolerance&&e<h.ClipperBase.tolerance};h.ClipperBase.IsHorizontal=function(e){return e.Delta.Y===0};h.ClipperBase.prototype.PointIsVertex=function(e,t){var r=t;do{if(h.IntPoint.op_Equality(r.Pt,e))return!0;r=r.Next}while(r!=t);return!1};h.ClipperBase.prototype.PointOnLineSegment=function(e,t,r,n){return n?e.X==t.X&&e.Y==t.Y||e.X==r.X&&e.Y==r.Y||e.X>t.X==e.X<r.X&&e.Y>t.Y==e.Y<r.Y&&Ue.op_Equality(Ue.Int128Mul(e.X-t.X,r.Y-t.Y),Ue.Int128Mul(r.X-t.X,e.Y-t.Y)):e.X==t.X&&e.Y==t.Y||e.X==r.X&&e.Y==r.Y||e.X>t.X==e.X<r.X&&e.Y>t.Y==e.Y<r.Y&&(e.X-t.X)*(r.Y-t.Y)==(r.X-t.X)*(e.Y-t.Y)};h.ClipperBase.prototype.PointOnPolygon=function(e,t,r){for(var n=t;;){if(this.PointOnLineSegment(e,n.Pt,n.Next.Pt,r))return!0;if(n=n.Next,n==t)break}return!1};h.ClipperBase.prototype.SlopesEqual=h.ClipperBase.SlopesEqual=function(){var e=arguments,t=e.length,r,n,o,i,s,l,c;return t==3?(r=e[0],n=e[1],c=e[2],c?Ue.op_Equality(Ue.Int128Mul(r.Delta.Y,n.Delta.X),Ue.Int128Mul(r.Delta.X,n.Delta.Y)):h.Cast_Int64(r.Delta.Y*n.Delta.X)==h.Cast_Int64(r.Delta.X*n.Delta.Y)):t==4?(o=e[0],i=e[1],s=e[2],c=e[3],c?Ue.op_Equality(Ue.Int128Mul(o.Y-i.Y,i.X-s.X),Ue.Int128Mul(o.X-i.X,i.Y-s.Y)):h.Cast_Int64((o.Y-i.Y)*(i.X-s.X))-h.Cast_Int64((o.X-i.X)*(i.Y-s.Y))===0):(o=e[0],i=e[1],s=e[2],l=e[3],c=e[4],c?Ue.op_Equality(Ue.Int128Mul(o.Y-i.Y,s.X-l.X),Ue.Int128Mul(o.X-i.X,s.Y-l.Y)):h.Cast_Int64((o.Y-i.Y)*(s.X-l.X))-h.Cast_Int64((o.X-i.X)*(s.Y-l.Y))===0)};h.ClipperBase.SlopesEqual3=function(e,t,r){return r?Ue.op_Equality(Ue.Int128Mul(e.Delta.Y,t.Delta.X),Ue.Int128Mul(e.Delta.X,t.Delta.Y)):h.Cast_Int64(e.Delta.Y*t.Delta.X)==h.Cast_Int64(e.Delta.X*t.Delta.Y)};h.ClipperBase.SlopesEqual4=function(e,t,r,n){return n?Ue.op_Equality(Ue.Int128Mul(e.Y-t.Y,t.X-r.X),Ue.Int128Mul(e.X-t.X,t.Y-r.Y)):h.Cast_Int64((e.Y-t.Y)*(t.X-r.X))-h.Cast_Int64((e.X-t.X)*(t.Y-r.Y))===0};h.ClipperBase.SlopesEqual5=function(e,t,r,n,o){return o?Ue.op_Equality(Ue.Int128Mul(e.Y-t.Y,r.X-n.X),Ue.Int128Mul(e.X-t.X,r.Y-n.Y)):h.Cast_Int64((e.Y-t.Y)*(r.X-n.X))-h.Cast_Int64((e.X-t.X)*(r.Y-n.Y))===0};h.ClipperBase.prototype.Clear=function(){this.DisposeLocalMinimaList();for(var e=0,t=this.m_edges.length;e<t;++e){for(var r=0,n=this.m_edges[e].length;r<n;++r)this.m_edges[e][r]=null;h.Clear(this.m_edges[e])}h.Clear(this.m_edges),this.m_UseFullRange=!1,this.m_HasOpenPaths=!1};h.ClipperBase.prototype.DisposeLocalMinimaList=function(){for(;this.m_MinimaList!==null;){var e=this.m_MinimaList.Next;this.m_MinimaList=null,this.m_MinimaList=e}this.m_CurrentLM=null};h.ClipperBase.prototype.RangeTest=function(e,t){t.Value?(e.X>h.ClipperBase.hiRange||e.Y>h.ClipperBase.hiRange||-e.X>h.ClipperBase.hiRange||-e.Y>h.ClipperBase.hiRange)&&h.Error("Coordinate outside allowed range in RangeTest()."):(e.X>h.ClipperBase.loRange||e.Y>h.ClipperBase.loRange||-e.X>h.ClipperBase.loRange||-e.Y>h.ClipperBase.loRange)&&(t.Value=!0,this.RangeTest(e,t))};h.ClipperBase.prototype.InitEdge=function(e,t,r,n){e.Next=t,e.Prev=r,e.Curr.X=n.X,e.Curr.Y=n.Y,e.OutIdx=-1};h.ClipperBase.prototype.InitEdge2=function(e,t){e.Curr.Y>=e.Next.Curr.Y?(e.Bot.X=e.Curr.X,e.Bot.Y=e.Curr.Y,e.Top.X=e.Next.Curr.X,e.Top.Y=e.Next.Curr.Y):(e.Top.X=e.Curr.X,e.Top.Y=e.Curr.Y,e.Bot.X=e.Next.Curr.X,e.Bot.Y=e.Next.Curr.Y),this.SetDx(e),e.PolyTyp=t};h.ClipperBase.prototype.FindNextLocMin=function(e){for(var t;;){for(;h.IntPoint.op_Inequality(e.Bot,e.Prev.Bot)||h.IntPoint.op_Equality(e.Curr,e.Top);)e=e.Next;if(e.Dx!=h.ClipperBase.horizontal&&e.Prev.Dx!=h.ClipperBase.horizontal)break;for(;e.Prev.Dx==h.ClipperBase.horizontal;)e=e.Prev;for(t=e;e.Dx==h.ClipperBase.horizontal;)e=e.Next;if(e.Top.Y!=e.Prev.Bot.Y){t.Prev.Bot.X<e.Bot.X&&(e=t);break}}return e};h.ClipperBase.prototype.ProcessBound=function(e,t){var r=e,n=e,o,i;if(e.Dx==h.ClipperBase.horizontal&&(t?i=e.Prev.Bot.X:i=e.Next.Bot.X,e.Bot.X!=i&&this.ReverseHorizontal(e)),n.OutIdx!=h.ClipperBase.Skip)if(t){for(;n.Top.Y==n.Next.Bot.Y&&n.Next.OutIdx!=h.ClipperBase.Skip;)n=n.Next;if(n.Dx==h.ClipperBase.horizontal&&n.Next.OutIdx!=h.ClipperBase.Skip){for(o=n;o.Prev.Dx==h.ClipperBase.horizontal;)o=o.Prev;o.Prev.Top.X==n.Next.Top.X?t||(n=o.Prev):o.Prev.Top.X>n.Next.Top.X&&(n=o.Prev)}for(;e!=n;)e.NextInLML=e.Next,e.Dx==h.ClipperBase.horizontal&&e!=r&&e.Bot.X!=e.Prev.Top.X&&this.ReverseHorizontal(e),e=e.Next;e.Dx==h.ClipperBase.horizontal&&e!=r&&e.Bot.X!=e.Prev.Top.X&&this.ReverseHorizontal(e),n=n.Next}else{for(;n.Top.Y==n.Prev.Bot.Y&&n.Prev.OutIdx!=h.ClipperBase.Skip;)n=n.Prev;if(n.Dx==h.ClipperBase.horizontal&&n.Prev.OutIdx!=h.ClipperBase.Skip){for(o=n;o.Next.Dx==h.ClipperBase.horizontal;)o=o.Next;o.Next.Top.X==n.Prev.Top.X?t||(n=o.Next):o.Next.Top.X>n.Prev.Top.X&&(n=o.Next)}for(;e!=n;)e.NextInLML=e.Prev,e.Dx==h.ClipperBase.horizontal&&e!=r&&e.Bot.X!=e.Next.Top.X&&this.ReverseHorizontal(e),e=e.Prev;e.Dx==h.ClipperBase.horizontal&&e!=r&&e.Bot.X!=e.Next.Top.X&&this.ReverseHorizontal(e),n=n.Prev}if(n.OutIdx==h.ClipperBase.Skip){if(e=n,t){for(;e.Top.Y==e.Next.Bot.Y;)e=e.Next;for(;e!=n&&e.Dx==h.ClipperBase.horizontal;)e=e.Prev}else{for(;e.Top.Y==e.Prev.Bot.Y;)e=e.Prev;for(;e!=n&&e.Dx==h.ClipperBase.horizontal;)e=e.Next}if(e==n)t?n=e.Next:n=e.Prev;else{t?e=n.Next:e=n.Prev;var s=new h.LocalMinima;s.Next=null,s.Y=e.Bot.Y,s.LeftBound=null,s.RightBound=e,s.RightBound.WindDelta=0,n=this.ProcessBound(s.RightBound,t),this.InsertLocalMinima(s)}}return n};h.ClipperBase.prototype.AddPath=function(e,t,r){i8?!r&&t==h.PolyType.ptClip&&h.Error("AddPath: Open paths must be subject."):r||h.Error("AddPath: Open paths have been disabled.");var n=e.length-1;if(r)for(;n>0&&h.IntPoint.op_Equality(e[n],e[0]);)--n;for(;n>0&&h.IntPoint.op_Equality(e[n],e[n-1]);)--n;if(r&&n<2||!r&&n<1)return!1;for(var o=new Array,i=0;i<=n;i++)o.push(new h.TEdge);var s=!0;o[1].Curr.X=e[1].X,o[1].Curr.Y=e[1].Y;var l={Value:this.m_UseFullRange};this.RangeTest(e[0],l),this.m_UseFullRange=l.Value,l.Value=this.m_UseFullRange,this.RangeTest(e[n],l),this.m_UseFullRange=l.Value,this.InitEdge(o[0],o[1],o[n],e[0]),this.InitEdge(o[n],o[0],o[n-1],e[n]);for(var i=n-1;i>=1;--i)l.Value=this.m_UseFullRange,this.RangeTest(e[i],l),this.m_UseFullRange=l.Value,this.InitEdge(o[i],o[i+1],o[i-1],e[i]);for(var c=o[0],p=c,d=c;;){if(h.IntPoint.op_Equality(p.Curr,p.Next.Curr)){if(p==p.Next)break;p==c&&(c=p.Next),p=this.RemoveEdge(p),d=p;continue}if(p.Prev==p.Next)break;if(r&&h.ClipperBase.SlopesEqual(p.Prev.Curr,p.Curr,p.Next.Curr,this.m_UseFullRange)&&(!this.PreserveCollinear||!this.Pt2IsBetweenPt1AndPt3(p.Prev.Curr,p.Curr,p.Next.Curr))){p==c&&(c=p.Next),p=this.RemoveEdge(p),p=p.Prev,d=p;continue}if(p=p.Next,p==d)break}if(!r&&p==p.Next||r&&p.Prev==p.Next)return!1;r||(this.m_HasOpenPaths=!0,c.Prev.OutIdx=h.ClipperBase.Skip);var m=c;p=c;do this.InitEdge2(p,t),p=p.Next,s&&p.Curr.Y!=c.Curr.Y&&(s=!1);while(p!=c);if(s){if(r)return!1;p.Prev.OutIdx=h.ClipperBase.Skip,p.Prev.Bot.X<p.Prev.Top.X&&this.ReverseHorizontal(p.Prev);var g=new h.LocalMinima;for(g.Next=null,g.Y=p.Bot.Y,g.LeftBound=null,g.RightBound=p,g.RightBound.Side=h.EdgeSide.esRight,g.RightBound.WindDelta=0;p.Next.OutIdx!=h.ClipperBase.Skip;)p.NextInLML=p.Next,p.Bot.X!=p.Prev.Top.X&&this.ReverseHorizontal(p),p=p.Next;return this.InsertLocalMinima(g),this.m_edges.push(o),!0}this.m_edges.push(o);for(var x,v=null;p=this.FindNextLocMin(p),p!=v;){v==null&&(v=p);var g=new h.LocalMinima;g.Next=null,g.Y=p.Bot.Y,p.Dx<p.Prev.Dx?(g.LeftBound=p.Prev,g.RightBound=p,x=!1):(g.LeftBound=p,g.RightBound=p.Prev,x=!0),g.LeftBound.Side=h.EdgeSide.esLeft,g.RightBound.Side=h.EdgeSide.esRight,r?g.LeftBound.Next==g.RightBound?g.LeftBound.WindDelta=-1:g.LeftBound.WindDelta=1:g.LeftBound.WindDelta=0,g.RightBound.WindDelta=-g.LeftBound.WindDelta,p=this.ProcessBound(g.LeftBound,x);var C=this.ProcessBound(g.RightBound,!x);g.LeftBound.OutIdx==h.ClipperBase.Skip?g.LeftBound=null:g.RightBound.OutIdx==h.ClipperBase.Skip&&(g.RightBound=null),this.InsertLocalMinima(g),x||(p=C)}return!0};h.ClipperBase.prototype.AddPaths=function(e,t,r){for(var n=!1,o=0,i=e.length;o<i;++o)this.AddPath(e[o],t,r)&&(n=!0);return n};h.ClipperBase.prototype.Pt2IsBetweenPt1AndPt3=function(e,t,r){return h.IntPoint.op_Equality(e,r)||h.IntPoint.op_Equality(e,t)||h.IntPoint.op_Equality(r,t)?!1:e.X!=r.X?t.X>e.X==t.X<r.X:t.Y>e.Y==t.Y<r.Y};h.ClipperBase.prototype.RemoveEdge=function(e){e.Prev.Next=e.Next,e.Next.Prev=e.Prev;var t=e.Next;return e.Prev=null,t};h.ClipperBase.prototype.SetDx=function(e){e.Delta.X=e.Top.X-e.Bot.X,e.Delta.Y=e.Top.Y-e.Bot.Y,e.Delta.Y===0?e.Dx=h.ClipperBase.horizontal:e.Dx=e.Delta.X/e.Delta.Y};h.ClipperBase.prototype.InsertLocalMinima=function(e){if(this.m_MinimaList===null)this.m_MinimaList=e;else if(e.Y>=this.m_MinimaList.Y)e.Next=this.m_MinimaList,this.m_MinimaList=e;else{for(var t=this.m_MinimaList;t.Next!==null&&e.Y<t.Next.Y;)t=t.Next;e.Next=t.Next,t.Next=e}};h.ClipperBase.prototype.PopLocalMinima=function(){this.m_CurrentLM!==null&&(this.m_CurrentLM=this.m_CurrentLM.Next)};h.ClipperBase.prototype.ReverseHorizontal=function(e){var t=e.Top.X;e.Top.X=e.Bot.X,e.Bot.X=t,Lp&&(t=e.Top.Z,e.Top.Z=e.Bot.Z,e.Bot.Z=t)};h.ClipperBase.prototype.Reset=function(){if(this.m_CurrentLM=this.m_MinimaList,this.m_CurrentLM!=null)for(var e=this.m_MinimaList;e!=null;){var t=e.LeftBound;t!=null&&(t.Curr.X=t.Bot.X,t.Curr.Y=t.Bot.Y,t.Side=h.EdgeSide.esLeft,t.OutIdx=h.ClipperBase.Unassigned),t=e.RightBound,t!=null&&(t.Curr.X=t.Bot.X,t.Curr.Y=t.Bot.Y,t.Side=h.EdgeSide.esRight,t.OutIdx=h.ClipperBase.Unassigned),e=e.Next}};h.Clipper=function(e){typeof e>"u"&&(e=0),this.m_PolyOuts=null,this.m_ClipType=h.ClipType.ctIntersection,this.m_Scanbeam=null,this.m_ActiveEdges=null,this.m_SortedEdges=null,this.m_IntersectList=null,this.m_IntersectNodeComparer=null,this.m_ExecuteLocked=!1,this.m_ClipFillType=h.PolyFillType.pftEvenOdd,this.m_SubjFillType=h.PolyFillType.pftEvenOdd,this.m_Joins=null,this.m_GhostJoins=null,this.m_UsingPolyTree=!1,this.ReverseSolution=!1,this.StrictlySimple=!1,h.ClipperBase.call(this),this.m_Scanbeam=null,this.m_ActiveEdges=null,this.m_SortedEdges=null,this.m_IntersectList=new Array,this.m_IntersectNodeComparer=h.MyIntersectNodeSort.Compare,this.m_ExecuteLocked=!1,this.m_UsingPolyTree=!1,this.m_PolyOuts=new Array,this.m_Joins=new Array,this.m_GhostJoins=new Array,this.ReverseSolution=(1&e)!==0,this.StrictlySimple=(2&e)!==0,this.PreserveCollinear=(4&e)!==0,Lp&&(this.ZFillFunction=null)};h.Clipper.ioReverseSolution=1;h.Clipper.ioStrictlySimple=2;h.Clipper.ioPreserveCollinear=4;h.Clipper.prototype.Clear=function(){this.m_edges.length!==0&&(this.DisposeAllPolyPts(),h.ClipperBase.prototype.Clear.call(this))};h.Clipper.prototype.DisposeScanbeamList=function(){for(;this.m_Scanbeam!==null;){var e=this.m_Scanbeam.Next;this.m_Scanbeam=null,this.m_Scanbeam=e}};h.Clipper.prototype.Reset=function(){h.ClipperBase.prototype.Reset.call(this),this.m_Scanbeam=null,this.m_ActiveEdges=null,this.m_SortedEdges=null;for(var e=this.m_MinimaList;e!==null;)this.InsertScanbeam(e.Y),e=e.Next};h.Clipper.prototype.InsertScanbeam=function(e){if(this.m_Scanbeam===null)this.m_Scanbeam=new h.Scanbeam,this.m_Scanbeam.Next=null,this.m_Scanbeam.Y=e;else if(e>this.m_Scanbeam.Y){var t=new h.Scanbeam;t.Y=e,t.Next=this.m_Scanbeam,this.m_Scanbeam=t}else{for(var r=this.m_Scanbeam;r.Next!==null&&e<=r.Next.Y;)r=r.Next;if(e==r.Y)return;var t=new h.Scanbeam;t.Y=e,t.Next=r.Next,r.Next=t}};h.Clipper.prototype.Execute=function(){var e=arguments,t=e.length,r=e[1]instanceof h.PolyTree;if(t==4&&!r){var n=e[0],o=e[1],i=e[2],s=e[3];if(this.m_ExecuteLocked)return!1;this.m_HasOpenPaths&&h.Error("Error: PolyTree struct is need for open path clipping."),this.m_ExecuteLocked=!0,h.Clear(o),this.m_SubjFillType=i,this.m_ClipFillType=s,this.m_ClipType=n,this.m_UsingPolyTree=!1;try{var l=this.ExecuteInternal();l&&this.BuildResult(o)}finally{this.DisposeAllPolyPts(),this.m_ExecuteLocked=!1}return l}else if(t==4&&r){var n=e[0],c=e[1],i=e[2],s=e[3];if(this.m_ExecuteLocked)return!1;this.m_ExecuteLocked=!0,this.m_SubjFillType=i,this.m_ClipFillType=s,this.m_ClipType=n,this.m_UsingPolyTree=!0;try{var l=this.ExecuteInternal();l&&this.BuildResult2(c)}finally{this.DisposeAllPolyPts(),this.m_ExecuteLocked=!1}return l}else if(t==2&&!r){var n=e[0],o=e[1];return this.Execute(n,o,h.PolyFillType.pftEvenOdd,h.PolyFillType.pftEvenOdd)}else if(t==2&&r){var n=e[0],c=e[1];return this.Execute(n,c,h.PolyFillType.pftEvenOdd,h.PolyFillType.pftEvenOdd)}};h.Clipper.prototype.FixHoleLinkage=function(e){if(!(e.FirstLeft===null||e.IsHole!=e.FirstLeft.IsHole&&e.FirstLeft.Pts!==null)){for(var t=e.FirstLeft;t!==null&&(t.IsHole==e.IsHole||t.Pts===null);)t=t.FirstLeft;e.FirstLeft=t}};h.Clipper.prototype.ExecuteInternal=function(){try{if(this.Reset(),this.m_CurrentLM===null)return!1;var e=this.PopScanbeam();do{if(this.InsertLocalMinimaIntoAEL(e),h.Clear(this.m_GhostJoins),this.ProcessHorizontals(!1),this.m_Scanbeam===null)break;var t=this.PopScanbeam();if(!this.ProcessIntersections(e,t))return!1;this.ProcessEdgesAtTopOfScanbeam(t),e=t}while(this.m_Scanbeam!==null||this.m_CurrentLM!==null);for(var r=0,n=this.m_PolyOuts.length;r<n;r++){var o=this.m_PolyOuts[r];o.Pts===null||o.IsOpen||(o.IsHole^this.ReverseSolution)==this.Area(o)>0&&this.ReversePolyPtLinks(o.Pts)}this.JoinCommonEdges();for(var r=0,n=this.m_PolyOuts.length;r<n;r++){var o=this.m_PolyOuts[r];o.Pts!==null&&!o.IsOpen&&this.FixupOutPolygon(o)}return this.StrictlySimple&&this.DoSimplePolygons(),!0}finally{h.Clear(this.m_Joins),h.Clear(this.m_GhostJoins)}};h.Clipper.prototype.PopScanbeam=function(){var e=this.m_Scanbeam.Y,t=this.m_Scanbeam;return this.m_Scanbeam=this.m_Scanbeam.Next,t=null,e};h.Clipper.prototype.DisposeAllPolyPts=function(){for(var e=0,t=this.m_PolyOuts.length;e<t;++e)this.DisposeOutRec(e);h.Clear(this.m_PolyOuts)};h.Clipper.prototype.DisposeOutRec=function(e){var t=this.m_PolyOuts[e];t.Pts!==null&&this.DisposeOutPts(t.Pts),t=null,this.m_PolyOuts[e]=null};h.Clipper.prototype.DisposeOutPts=function(e){if(e!==null){var t=null;for(e.Prev.Next=null;e!==null;)t=e,e=e.Next,t=null}};h.Clipper.prototype.AddJoin=function(e,t,r){var n=new h.Join;n.OutPt1=e,n.OutPt2=t,n.OffPt.X=r.X,n.OffPt.Y=r.Y,this.m_Joins.push(n)};h.Clipper.prototype.AddGhostJoin=function(e,t){var r=new h.Join;r.OutPt1=e,r.OffPt.X=t.X,r.OffPt.Y=t.Y,this.m_GhostJoins.push(r)};Lp&&(h.Clipper.prototype.SetZ=function(e,t){e.Z=0,this.ZFillFunction!==null&&(t.OutIdx<0?this.ZFillFunction(t.Bot,t.Top,e):this.ZFillFunction(t.Top,t.Bot,e))});h.Clipper.prototype.InsertLocalMinimaIntoAEL=function(e){for(;this.m_CurrentLM!==null&&this.m_CurrentLM.Y==e;){var t=this.m_CurrentLM.LeftBound,r=this.m_CurrentLM.RightBound;this.PopLocalMinima();var n=null;if(t===null?(this.InsertEdgeIntoAEL(r,null),this.SetWindingCount(r),this.IsContributing(r)&&(n=this.AddOutPt(r,r.Bot))):r==null?(this.InsertEdgeIntoAEL(t,null),this.SetWindingCount(t),this.IsContributing(t)&&(n=this.AddOutPt(t,t.Bot)),this.InsertScanbeam(t.Top.Y)):(this.InsertEdgeIntoAEL(t,null),this.InsertEdgeIntoAEL(r,t),this.SetWindingCount(t),r.WindCnt=t.WindCnt,r.WindCnt2=t.WindCnt2,this.IsContributing(t)&&(n=this.AddLocalMinPoly(t,r,t.Bot)),this.InsertScanbeam(t.Top.Y)),r!=null&&(h.ClipperBase.IsHorizontal(r)?this.AddEdgeToSEL(r):this.InsertScanbeam(r.Top.Y)),!(t==null||r==null)){if(n!==null&&h.ClipperBase.IsHorizontal(r)&&this.m_GhostJoins.length>0&&r.WindDelta!==0)for(var o=0,i=this.m_GhostJoins.length;o<i;o++){var s=this.m_GhostJoins[o];this.HorzSegmentsOverlap(s.OutPt1.Pt,s.OffPt,r.Bot,r.Top)&&this.AddJoin(s.OutPt1,n,s.OffPt)}if(t.OutIdx>=0&&t.PrevInAEL!==null&&t.PrevInAEL.Curr.X==t.Bot.X&&t.PrevInAEL.OutIdx>=0&&h.ClipperBase.SlopesEqual(t.PrevInAEL,t,this.m_UseFullRange)&&t.WindDelta!==0&&t.PrevInAEL.WindDelta!==0){var l=this.AddOutPt(t.PrevInAEL,t.Bot);this.AddJoin(n,l,t.Top)}if(t.NextInAEL!=r){if(r.OutIdx>=0&&r.PrevInAEL.OutIdx>=0&&h.ClipperBase.SlopesEqual(r.PrevInAEL,r,this.m_UseFullRange)&&r.WindDelta!==0&&r.PrevInAEL.WindDelta!==0){var l=this.AddOutPt(r.PrevInAEL,r.Bot);this.AddJoin(n,l,r.Top)}var c=t.NextInAEL;if(c!==null)for(;c!=r;)this.IntersectEdges(r,c,t.Curr,!1),c=c.NextInAEL}}}};h.Clipper.prototype.InsertEdgeIntoAEL=function(e,t){if(this.m_ActiveEdges===null)e.PrevInAEL=null,e.NextInAEL=null,this.m_ActiveEdges=e;else if(t===null&&this.E2InsertsBeforeE1(this.m_ActiveEdges,e))e.PrevInAEL=null,e.NextInAEL=this.m_ActiveEdges,this.m_ActiveEdges.PrevInAEL=e,this.m_ActiveEdges=e;else{for(t===null&&(t=this.m_ActiveEdges);t.NextInAEL!==null&&!this.E2InsertsBeforeE1(t.NextInAEL,e);)t=t.NextInAEL;e.NextInAEL=t.NextInAEL,t.NextInAEL!==null&&(t.NextInAEL.PrevInAEL=e),e.PrevInAEL=t,t.NextInAEL=e}};h.Clipper.prototype.E2InsertsBeforeE1=function(e,t){return t.Curr.X==e.Curr.X?t.Top.Y>e.Top.Y?t.Top.X<h.Clipper.TopX(e,t.Top.Y):e.Top.X>h.Clipper.TopX(t,e.Top.Y):t.Curr.X<e.Curr.X};h.Clipper.prototype.IsEvenOddFillType=function(e){return e.PolyTyp==h.PolyType.ptSubject?this.m_SubjFillType==h.PolyFillType.pftEvenOdd:this.m_ClipFillType==h.PolyFillType.pftEvenOdd};h.Clipper.prototype.IsEvenOddAltFillType=function(e){return e.PolyTyp==h.PolyType.ptSubject?this.m_ClipFillType==h.PolyFillType.pftEvenOdd:this.m_SubjFillType==h.PolyFillType.pftEvenOdd};h.Clipper.prototype.IsContributing=function(e){var t,r;switch(e.PolyTyp==h.PolyType.ptSubject?(t=this.m_SubjFillType,r=this.m_ClipFillType):(t=this.m_ClipFillType,r=this.m_SubjFillType),t){case h.PolyFillType.pftEvenOdd:if(e.WindDelta===0&&e.WindCnt!=1)return!1;break;case h.PolyFillType.pftNonZero:if(Math.abs(e.WindCnt)!=1)return!1;break;case h.PolyFillType.pftPositive:if(e.WindCnt!=1)return!1;break;default:if(e.WindCnt!=-1)return!1;break}switch(this.m_ClipType){case h.ClipType.ctIntersection:switch(r){case h.PolyFillType.pftEvenOdd:case h.PolyFillType.pftNonZero:return e.WindCnt2!==0;case h.PolyFillType.pftPositive:return e.WindCnt2>0;default:return e.WindCnt2<0}case h.ClipType.ctUnion:switch(r){case h.PolyFillType.pftEvenOdd:case h.PolyFillType.pftNonZero:return e.WindCnt2===0;case h.PolyFillType.pftPositive:return e.WindCnt2<=0;default:return e.WindCnt2>=0}case h.ClipType.ctDifference:if(e.PolyTyp==h.PolyType.ptSubject)switch(r){case h.PolyFillType.pftEvenOdd:case h.PolyFillType.pftNonZero:return e.WindCnt2===0;case h.PolyFillType.pftPositive:return e.WindCnt2<=0;default:return e.WindCnt2>=0}else switch(r){case h.PolyFillType.pftEvenOdd:case h.PolyFillType.pftNonZero:return e.WindCnt2!==0;case h.PolyFillType.pftPositive:return e.WindCnt2>0;default:return e.WindCnt2<0}case h.ClipType.ctXor:if(e.WindDelta===0)switch(r){case h.PolyFillType.pftEvenOdd:case h.PolyFillType.pftNonZero:return e.WindCnt2===0;case h.PolyFillType.pftPositive:return e.WindCnt2<=0;default:return e.WindCnt2>=0}else return!0}return!0};h.Clipper.prototype.SetWindingCount=function(e){for(var t=e.PrevInAEL;t!==null&&(t.PolyTyp!=e.PolyTyp||t.WindDelta===0);)t=t.PrevInAEL;if(t===null)e.WindCnt=e.WindDelta===0?1:e.WindDelta,e.WindCnt2=0,t=this.m_ActiveEdges;else if(e.WindDelta===0&&this.m_ClipType!=h.ClipType.ctUnion)e.WindCnt=1,e.WindCnt2=t.WindCnt2,t=t.NextInAEL;else if(this.IsEvenOddFillType(e)){if(e.WindDelta===0){for(var r=!0,n=t.PrevInAEL;n!==null;)n.PolyTyp==t.PolyTyp&&n.WindDelta!==0&&(r=!r),n=n.PrevInAEL;e.WindCnt=r?0:1}else e.WindCnt=e.WindDelta;e.WindCnt2=t.WindCnt2,t=t.NextInAEL}else t.WindCnt*t.WindDelta<0?Math.abs(t.WindCnt)>1?t.WindDelta*e.WindDelta<0?e.WindCnt=t.WindCnt:e.WindCnt=t.WindCnt+e.WindDelta:e.WindCnt=e.WindDelta===0?1:e.WindDelta:e.WindDelta===0?e.WindCnt=t.WindCnt<0?t.WindCnt-1:t.WindCnt+1:t.WindDelta*e.WindDelta<0?e.WindCnt=t.WindCnt:e.WindCnt=t.WindCnt+e.WindDelta,e.WindCnt2=t.WindCnt2,t=t.NextInAEL;if(this.IsEvenOddAltFillType(e))for(;t!=e;)t.WindDelta!==0&&(e.WindCnt2=e.WindCnt2===0?1:0),t=t.NextInAEL;else for(;t!=e;)e.WindCnt2+=t.WindDelta,t=t.NextInAEL};h.Clipper.prototype.AddEdgeToSEL=function(e){this.m_SortedEdges===null?(this.m_SortedEdges=e,e.PrevInSEL=null,e.NextInSEL=null):(e.NextInSEL=this.m_SortedEdges,e.PrevInSEL=null,this.m_SortedEdges.PrevInSEL=e,this.m_SortedEdges=e)};h.Clipper.prototype.CopyAELToSEL=function(){var e=this.m_ActiveEdges;for(this.m_SortedEdges=e;e!==null;)e.PrevInSEL=e.PrevInAEL,e.NextInSEL=e.NextInAEL,e=e.NextInAEL};h.Clipper.prototype.SwapPositionsInAEL=function(e,t){if(!(e.NextInAEL==e.PrevInAEL||t.NextInAEL==t.PrevInAEL)){if(e.NextInAEL==t){var r=t.NextInAEL;r!==null&&(r.PrevInAEL=e);var n=e.PrevInAEL;n!==null&&(n.NextInAEL=t),t.PrevInAEL=n,t.NextInAEL=e,e.PrevInAEL=t,e.NextInAEL=r}else if(t.NextInAEL==e){var r=e.NextInAEL;r!==null&&(r.PrevInAEL=t);var n=t.PrevInAEL;n!==null&&(n.NextInAEL=e),e.PrevInAEL=n,e.NextInAEL=t,t.PrevInAEL=e,t.NextInAEL=r}else{var r=e.NextInAEL,n=e.PrevInAEL;e.NextInAEL=t.NextInAEL,e.NextInAEL!==null&&(e.NextInAEL.PrevInAEL=e),e.PrevInAEL=t.PrevInAEL,e.PrevInAEL!==null&&(e.PrevInAEL.NextInAEL=e),t.NextInAEL=r,t.NextInAEL!==null&&(t.NextInAEL.PrevInAEL=t),t.PrevInAEL=n,t.PrevInAEL!==null&&(t.PrevInAEL.NextInAEL=t)}e.PrevInAEL===null?this.m_ActiveEdges=e:t.PrevInAEL===null&&(this.m_ActiveEdges=t)}};h.Clipper.prototype.SwapPositionsInSEL=function(e,t){if(!(e.NextInSEL===null&&e.PrevInSEL===null)&&!(t.NextInSEL===null&&t.PrevInSEL===null)){if(e.NextInSEL==t){var r=t.NextInSEL;r!==null&&(r.PrevInSEL=e);var n=e.PrevInSEL;n!==null&&(n.NextInSEL=t),t.PrevInSEL=n,t.NextInSEL=e,e.PrevInSEL=t,e.NextInSEL=r}else if(t.NextInSEL==e){var r=e.NextInSEL;r!==null&&(r.PrevInSEL=t);var n=t.PrevInSEL;n!==null&&(n.NextInSEL=e),e.PrevInSEL=n,e.NextInSEL=t,t.PrevInSEL=e,t.NextInSEL=r}else{var r=e.NextInSEL,n=e.PrevInSEL;e.NextInSEL=t.NextInSEL,e.NextInSEL!==null&&(e.NextInSEL.PrevInSEL=e),e.PrevInSEL=t.PrevInSEL,e.PrevInSEL!==null&&(e.PrevInSEL.NextInSEL=e),t.NextInSEL=r,t.NextInSEL!==null&&(t.NextInSEL.PrevInSEL=t),t.PrevInSEL=n,t.PrevInSEL!==null&&(t.PrevInSEL.NextInSEL=t)}e.PrevInSEL===null?this.m_SortedEdges=e:t.PrevInSEL===null&&(this.m_SortedEdges=t)}};h.Clipper.prototype.AddLocalMaxPoly=function(e,t,r){this.AddOutPt(e,r),t.WindDelta==0&&this.AddOutPt(t,r),e.OutIdx==t.OutIdx?(e.OutIdx=-1,t.OutIdx=-1):e.OutIdx<t.OutIdx?this.AppendPolygon(e,t):this.AppendPolygon(t,e)};h.Clipper.prototype.AddLocalMinPoly=function(e,t,r){var n,o,i;if(h.ClipperBase.IsHorizontal(t)||e.Dx>t.Dx?(n=this.AddOutPt(e,r),t.OutIdx=e.OutIdx,e.Side=h.EdgeSide.esLeft,t.Side=h.EdgeSide.esRight,o=e,o.PrevInAEL==t?i=t.PrevInAEL:i=o.PrevInAEL):(n=this.AddOutPt(t,r),e.OutIdx=t.OutIdx,e.Side=h.EdgeSide.esRight,t.Side=h.EdgeSide.esLeft,o=t,o.PrevInAEL==e?i=e.PrevInAEL:i=o.PrevInAEL),i!==null&&i.OutIdx>=0&&h.Clipper.TopX(i,r.Y)==h.Clipper.TopX(o,r.Y)&&h.ClipperBase.SlopesEqual(o,i,this.m_UseFullRange)&&o.WindDelta!==0&&i.WindDelta!==0){var s=this.AddOutPt(i,r);this.AddJoin(n,s,o.Top)}return n};h.Clipper.prototype.CreateOutRec=function(){var e=new h.OutRec;return e.Idx=-1,e.IsHole=!1,e.IsOpen=!1,e.FirstLeft=null,e.Pts=null,e.BottomPt=null,e.PolyNode=null,this.m_PolyOuts.push(e),e.Idx=this.m_PolyOuts.length-1,e};h.Clipper.prototype.AddOutPt=function(e,t){var r=e.Side==h.EdgeSide.esLeft;if(e.OutIdx<0){var n=this.CreateOutRec();n.IsOpen=e.WindDelta===0;var o=new h.OutPt;return n.Pts=o,o.Idx=n.Idx,o.Pt.X=t.X,o.Pt.Y=t.Y,o.Next=o,o.Prev=o,n.IsOpen||this.SetHoleState(e,n),Lp&&(h.IntPoint.op_Equality(t,e.Bot)?(o.Pt.X=e.Bot.X,o.Pt.Y=e.Bot.Y,o.Pt.Z=e.Bot.Z):h.IntPoint.op_Equality(t,e.Top)?(o.Pt.X=e.Top.X,o.Pt.Y=e.Top.Y,o.Pt.Z=e.Top.Z):this.SetZ(o.Pt,e)),e.OutIdx=n.Idx,o}else{var n=this.m_PolyOuts[e.OutIdx],i=n.Pts;if(r&&h.IntPoint.op_Equality(t,i.Pt))return i;if(!r&&h.IntPoint.op_Equality(t,i.Prev.Pt))return i.Prev;var o=new h.OutPt;return o.Idx=n.Idx,o.Pt.X=t.X,o.Pt.Y=t.Y,o.Next=i,o.Prev=i.Prev,o.Prev.Next=o,i.Prev=o,r&&(n.Pts=o),Lp&&(h.IntPoint.op_Equality(t,e.Bot)?(o.Pt.X=e.Bot.X,o.Pt.Y=e.Bot.Y,o.Pt.Z=e.Bot.Z):h.IntPoint.op_Equality(t,e.Top)?(o.Pt.X=e.Top.X,o.Pt.Y=e.Top.Y,o.Pt.Z=e.Top.Z):this.SetZ(o.Pt,e)),o}};h.Clipper.prototype.SwapPoints=function(e,t){var r=new h.IntPoint(e.Value);e.Value.X=t.Value.X,e.Value.Y=t.Value.Y,t.Value.X=r.X,t.Value.Y=r.Y};h.Clipper.prototype.HorzSegmentsOverlap=function(e,t,r,n){return e.X>r.X==e.X<n.X||t.X>r.X==t.X<n.X||r.X>e.X==r.X<t.X||n.X>e.X==n.X<t.X||e.X==r.X&&t.X==n.X?!0:e.X==n.X&&t.X==r.X};h.Clipper.prototype.InsertPolyPtBetween=function(e,t,r){var n=new h.OutPt;return n.Pt.X=r.X,n.Pt.Y=r.Y,t==e.Next?(e.Next=n,t.Prev=n,n.Next=t,n.Prev=e):(t.Next=n,e.Prev=n,n.Next=e,n.Prev=t),n};h.Clipper.prototype.SetHoleState=function(e,t){for(var r=!1,n=e.PrevInAEL;n!==null;)n.OutIdx>=0&&n.WindDelta!=0&&(r=!r,t.FirstLeft===null&&(t.FirstLeft=this.m_PolyOuts[n.OutIdx])),n=n.PrevInAEL;r&&(t.IsHole=!0)};h.Clipper.prototype.GetDx=function(e,t){return e.Y==t.Y?h.ClipperBase.horizontal:(t.X-e.X)/(t.Y-e.Y)};h.Clipper.prototype.FirstIsBottomPt=function(e,t){for(var r=e.Prev;h.IntPoint.op_Equality(r.Pt,e.Pt)&&r!=e;)r=r.Prev;var n=Math.abs(this.GetDx(e.Pt,r.Pt));for(r=e.Next;h.IntPoint.op_Equality(r.Pt,e.Pt)&&r!=e;)r=r.Next;var o=Math.abs(this.GetDx(e.Pt,r.Pt));for(r=t.Prev;h.IntPoint.op_Equality(r.Pt,t.Pt)&&r!=t;)r=r.Prev;var i=Math.abs(this.GetDx(t.Pt,r.Pt));for(r=t.Next;h.IntPoint.op_Equality(r.Pt,t.Pt)&&r!=t;)r=r.Next;var s=Math.abs(this.GetDx(t.Pt,r.Pt));return n>=i&&n>=s||o>=i&&o>=s};h.Clipper.prototype.GetBottomPt=function(e){for(var t=null,r=e.Next;r!=e;)r.Pt.Y>e.Pt.Y?(e=r,t=null):r.Pt.Y==e.Pt.Y&&r.Pt.X<=e.Pt.X&&(r.Pt.X<e.Pt.X?(t=null,e=r):r.Next!=e&&r.Prev!=e&&(t=r)),r=r.Next;if(t!==null)for(;t!=r;)for(this.FirstIsBottomPt(r,t)||(e=t),t=t.Next;h.IntPoint.op_Inequality(t.Pt,e.Pt);)t=t.Next;return e};h.Clipper.prototype.GetLowermostRec=function(e,t){e.BottomPt===null&&(e.BottomPt=this.GetBottomPt(e.Pts)),t.BottomPt===null&&(t.BottomPt=this.GetBottomPt(t.Pts));var r=e.BottomPt,n=t.BottomPt;return r.Pt.Y>n.Pt.Y?e:r.Pt.Y<n.Pt.Y?t:r.Pt.X<n.Pt.X?e:r.Pt.X>n.Pt.X||r.Next==r?t:n.Next==n||this.FirstIsBottomPt(r,n)?e:t};h.Clipper.prototype.Param1RightOfParam2=function(e,t){do if(e=e.FirstLeft,e==t)return!0;while(e!==null);return!1};h.Clipper.prototype.GetOutRec=function(e){for(var t=this.m_PolyOuts[e];t!=this.m_PolyOuts[t.Idx];)t=this.m_PolyOuts[t.Idx];return t};h.Clipper.prototype.AppendPolygon=function(e,t){var r=this.m_PolyOuts[e.OutIdx],n=this.m_PolyOuts[t.OutIdx],o;this.Param1RightOfParam2(r,n)?o=n:this.Param1RightOfParam2(n,r)?o=r:o=this.GetLowermostRec(r,n);var i=r.Pts,s=i.Prev,l=n.Pts,c=l.Prev,p;e.Side==h.EdgeSide.esLeft?(t.Side==h.EdgeSide.esLeft?(this.ReversePolyPtLinks(l),l.Next=i,i.Prev=l,s.Next=c,c.Prev=s,r.Pts=c):(c.Next=i,i.Prev=c,l.Prev=s,s.Next=l,r.Pts=l),p=h.EdgeSide.esLeft):(t.Side==h.EdgeSide.esRight?(this.ReversePolyPtLinks(l),s.Next=c,c.Prev=s,l.Next=i,i.Prev=l):(s.Next=l,l.Prev=s,i.Prev=c,c.Next=i),p=h.EdgeSide.esRight),r.BottomPt=null,o==n&&(n.FirstLeft!=r&&(r.FirstLeft=n.FirstLeft),r.IsHole=n.IsHole),n.Pts=null,n.BottomPt=null,n.FirstLeft=r;var d=e.OutIdx,m=t.OutIdx;e.OutIdx=-1,t.OutIdx=-1;for(var g=this.m_ActiveEdges;g!==null;){if(g.OutIdx==m){g.OutIdx=d,g.Side=p;break}g=g.NextInAEL}n.Idx=r.Idx};h.Clipper.prototype.ReversePolyPtLinks=function(e){if(e!==null){var t,r;t=e;do r=t.Next,t.Next=t.Prev,t.Prev=r,t=r;while(t!=e)}};h.Clipper.SwapSides=function(e,t){var r=e.Side;e.Side=t.Side,t.Side=r};h.Clipper.SwapPolyIndexes=function(e,t){var r=e.OutIdx;e.OutIdx=t.OutIdx,t.OutIdx=r};h.Clipper.prototype.IntersectEdges=function(e,t,r,n){var o=!n&&e.NextInLML===null&&e.Top.X==r.X&&e.Top.Y==r.Y,i=!n&&t.NextInLML===null&&t.Top.X==r.X&&t.Top.Y==r.Y,s=e.OutIdx>=0,l=t.OutIdx>=0;if(i8&&(e.WindDelta===0||t.WindDelta===0)){e.WindDelta===0&&t.WindDelta===0?(o||i)&&s&&l&&this.AddLocalMaxPoly(e,t,r):e.PolyTyp==t.PolyTyp&&e.WindDelta!=t.WindDelta&&this.m_ClipType==h.ClipType.ctUnion?e.WindDelta===0?l&&(this.AddOutPt(e,r),s&&(e.OutIdx=-1)):s&&(this.AddOutPt(t,r),l&&(t.OutIdx=-1)):e.PolyTyp!=t.PolyTyp&&(e.WindDelta===0&&Math.abs(t.WindCnt)==1&&(this.m_ClipType!=h.ClipType.ctUnion||t.WindCnt2===0)?(this.AddOutPt(e,r),s&&(e.OutIdx=-1)):t.WindDelta===0&&Math.abs(e.WindCnt)==1&&(this.m_ClipType!=h.ClipType.ctUnion||e.WindCnt2===0)&&(this.AddOutPt(t,r),l&&(t.OutIdx=-1))),o&&(e.OutIdx<0?this.DeleteFromAEL(e):h.Error("Error intersecting polylines")),i&&(t.OutIdx<0?this.DeleteFromAEL(t):h.Error("Error intersecting polylines"));return}if(e.PolyTyp==t.PolyTyp)if(this.IsEvenOddFillType(e)){var c=e.WindCnt;e.WindCnt=t.WindCnt,t.WindCnt=c}else e.WindCnt+t.WindDelta===0?e.WindCnt=-e.WindCnt:e.WindCnt+=t.WindDelta,t.WindCnt-e.WindDelta===0?t.WindCnt=-t.WindCnt:t.WindCnt-=e.WindDelta;else this.IsEvenOddFillType(t)?e.WindCnt2=e.WindCnt2===0?1:0:e.WindCnt2+=t.WindDelta,this.IsEvenOddFillType(e)?t.WindCnt2=t.WindCnt2===0?1:0:t.WindCnt2-=e.WindDelta;var p,d,m,g;e.PolyTyp==h.PolyType.ptSubject?(p=this.m_SubjFillType,m=this.m_ClipFillType):(p=this.m_ClipFillType,m=this.m_SubjFillType),t.PolyTyp==h.PolyType.ptSubject?(d=this.m_SubjFillType,g=this.m_ClipFillType):(d=this.m_ClipFillType,g=this.m_SubjFillType);var x,v;switch(p){case h.PolyFillType.pftPositive:x=e.WindCnt;break;case h.PolyFillType.pftNegative:x=-e.WindCnt;break;default:x=Math.abs(e.WindCnt);break}switch(d){case h.PolyFillType.pftPositive:v=t.WindCnt;break;case h.PolyFillType.pftNegative:v=-t.WindCnt;break;default:v=Math.abs(t.WindCnt);break}if(s&&l)o||i||x!==0&&x!=1||v!==0&&v!=1||e.PolyTyp!=t.PolyTyp&&this.m_ClipType!=h.ClipType.ctXor?this.AddLocalMaxPoly(e,t,r):(this.AddOutPt(e,r),this.AddOutPt(t,r),h.Clipper.SwapSides(e,t),h.Clipper.SwapPolyIndexes(e,t));else if(s)(v===0||v==1)&&(this.AddOutPt(e,r),h.Clipper.SwapSides(e,t),h.Clipper.SwapPolyIndexes(e,t));else if(l)(x===0||x==1)&&(this.AddOutPt(t,r),h.Clipper.SwapSides(e,t),h.Clipper.SwapPolyIndexes(e,t));else if((x===0||x==1)&&(v===0||v==1)&&!o&&!i){var C,I;switch(m){case h.PolyFillType.pftPositive:C=e.WindCnt2;break;case h.PolyFillType.pftNegative:C=-e.WindCnt2;break;default:C=Math.abs(e.WindCnt2);break}switch(g){case h.PolyFillType.pftPositive:I=t.WindCnt2;break;case h.PolyFillType.pftNegative:I=-t.WindCnt2;break;default:I=Math.abs(t.WindCnt2);break}if(e.PolyTyp!=t.PolyTyp)this.AddLocalMinPoly(e,t,r);else if(x==1&&v==1)switch(this.m_ClipType){case h.ClipType.ctIntersection:C>0&&I>0&&this.AddLocalMinPoly(e,t,r);break;case h.ClipType.ctUnion:C<=0&&I<=0&&this.AddLocalMinPoly(e,t,r);break;case h.ClipType.ctDifference:(e.PolyTyp==h.PolyType.ptClip&&C>0&&I>0||e.PolyTyp==h.PolyType.ptSubject&&C<=0&&I<=0)&&this.AddLocalMinPoly(e,t,r);break;case h.ClipType.ctXor:this.AddLocalMinPoly(e,t,r);break}else h.Clipper.SwapSides(e,t)}o!=i&&(o&&e.OutIdx>=0||i&&t.OutIdx>=0)&&(h.Clipper.SwapSides(e,t),h.Clipper.SwapPolyIndexes(e,t)),o&&this.DeleteFromAEL(e),i&&this.DeleteFromAEL(t)};h.Clipper.prototype.DeleteFromAEL=function(e){var t=e.PrevInAEL,r=e.NextInAEL;t===null&&r===null&&e!=this.m_ActiveEdges||(t!==null?t.NextInAEL=r:this.m_ActiveEdges=r,r!==null&&(r.PrevInAEL=t),e.NextInAEL=null,e.PrevInAEL=null)};h.Clipper.prototype.DeleteFromSEL=function(e){var t=e.PrevInSEL,r=e.NextInSEL;t===null&&r===null&&e!=this.m_SortedEdges||(t!==null?t.NextInSEL=r:this.m_SortedEdges=r,r!==null&&(r.PrevInSEL=t),e.NextInSEL=null,e.PrevInSEL=null)};h.Clipper.prototype.UpdateEdgeIntoAEL=function(e){e.NextInLML===null&&h.Error("UpdateEdgeIntoAEL: invalid call");var t=e.PrevInAEL,r=e.NextInAEL;return e.NextInLML.OutIdx=e.OutIdx,t!==null?t.NextInAEL=e.NextInLML:this.m_ActiveEdges=e.NextInLML,r!==null&&(r.PrevInAEL=e.NextInLML),e.NextInLML.Side=e.Side,e.NextInLML.WindDelta=e.WindDelta,e.NextInLML.WindCnt=e.WindCnt,e.NextInLML.WindCnt2=e.WindCnt2,e=e.NextInLML,e.Curr.X=e.Bot.X,e.Curr.Y=e.Bot.Y,e.PrevInAEL=t,e.NextInAEL=r,h.ClipperBase.IsHorizontal(e)||this.InsertScanbeam(e.Top.Y),e};h.Clipper.prototype.ProcessHorizontals=function(e){for(var t=this.m_SortedEdges;t!==null;)this.DeleteFromSEL(t),this.ProcessHorizontal(t,e),t=this.m_SortedEdges};h.Clipper.prototype.GetHorzDirection=function(e,t){e.Bot.X<e.Top.X?(t.Left=e.Bot.X,t.Right=e.Top.X,t.Dir=h.Direction.dLeftToRight):(t.Left=e.Top.X,t.Right=e.Bot.X,t.Dir=h.Direction.dRightToLeft)};h.Clipper.prototype.PrepareHorzJoins=function(e,t){var r=this.m_PolyOuts[e.OutIdx].Pts;e.Side!=h.EdgeSide.esLeft&&(r=r.Prev),t&&(h.IntPoint.op_Equality(r.Pt,e.Top)?this.AddGhostJoin(r,e.Bot):this.AddGhostJoin(r,e.Top))};h.Clipper.prototype.ProcessHorizontal=function(e,t){var r={Dir:null,Left:null,Right:null};this.GetHorzDirection(e,r);for(var n=r.Dir,o=r.Left,i=r.Right,s=e,l=null;s.NextInLML!==null&&h.ClipperBase.IsHorizontal(s.NextInLML);)s=s.NextInLML;for(s.NextInLML===null&&(l=this.GetMaximaPair(s));;){for(var c=e==s,p=this.GetNextInAEL(e,n);p!==null&&!(p.Curr.X==e.Top.X&&e.NextInLML!==null&&p.Dx<e.NextInLML.Dx);){var d=this.GetNextInAEL(p,n);if(n==h.Direction.dLeftToRight&&p.Curr.X<=i||n==h.Direction.dRightToLeft&&p.Curr.X>=o){if(e.OutIdx>=0&&e.WindDelta!=0&&this.PrepareHorzJoins(e,t),p==l&&c){n==h.Direction.dLeftToRight?this.IntersectEdges(e,p,p.Top,!1):this.IntersectEdges(p,e,p.Top,!1),l.OutIdx>=0&&h.Error("ProcessHorizontal error");return}else if(n==h.Direction.dLeftToRight){var m=new h.IntPoint(p.Curr.X,e.Curr.Y);this.IntersectEdges(e,p,m,!0)}else{var m=new h.IntPoint(p.Curr.X,e.Curr.Y);this.IntersectEdges(p,e,m,!0)}this.SwapPositionsInAEL(e,p)}else if(n==h.Direction.dLeftToRight&&p.Curr.X>=i||n==h.Direction.dRightToLeft&&p.Curr.X<=o)break;p=d}if(e.OutIdx>=0&&e.WindDelta!==0&&this.PrepareHorzJoins(e,t),e.NextInLML!==null&&h.ClipperBase.IsHorizontal(e.NextInLML)){e=this.UpdateEdgeIntoAEL(e),e.OutIdx>=0&&this.AddOutPt(e,e.Bot);var r={Dir:n,Left:o,Right:i};this.GetHorzDirection(e,r),n=r.Dir,o=r.Left,i=r.Right}else break}if(e.NextInLML!==null)if(e.OutIdx>=0){var g=this.AddOutPt(e,e.Top);if(e=this.UpdateEdgeIntoAEL(e),e.WindDelta===0)return;var x=e.PrevInAEL,d=e.NextInAEL;if(x!==null&&x.Curr.X==e.Bot.X&&x.Curr.Y==e.Bot.Y&&x.WindDelta!==0&&x.OutIdx>=0&&x.Curr.Y>x.Top.Y&&h.ClipperBase.SlopesEqual(e,x,this.m_UseFullRange)){var v=this.AddOutPt(x,e.Bot);this.AddJoin(g,v,e.Top)}else if(d!==null&&d.Curr.X==e.Bot.X&&d.Curr.Y==e.Bot.Y&&d.WindDelta!==0&&d.OutIdx>=0&&d.Curr.Y>d.Top.Y&&h.ClipperBase.SlopesEqual(e,d,this.m_UseFullRange)){var v=this.AddOutPt(d,e.Bot);this.AddJoin(g,v,e.Top)}}else e=this.UpdateEdgeIntoAEL(e);else l!==null?l.OutIdx>=0?(n==h.Direction.dLeftToRight?this.IntersectEdges(e,l,e.Top,!1):this.IntersectEdges(l,e,e.Top,!1),l.OutIdx>=0&&h.Error("ProcessHorizontal error")):(this.DeleteFromAEL(e),this.DeleteFromAEL(l)):(e.OutIdx>=0&&this.AddOutPt(e,e.Top),this.DeleteFromAEL(e))};h.Clipper.prototype.GetNextInAEL=function(e,t){return t==h.Direction.dLeftToRight?e.NextInAEL:e.PrevInAEL};h.Clipper.prototype.IsMinima=function(e){return e!==null&&e.Prev.NextInLML!=e&&e.Next.NextInLML!=e};h.Clipper.prototype.IsMaxima=function(e,t){return e!==null&&e.Top.Y==t&&e.NextInLML===null};h.Clipper.prototype.IsIntermediate=function(e,t){return e.Top.Y==t&&e.NextInLML!==null};h.Clipper.prototype.GetMaximaPair=function(e){var t=null;return h.IntPoint.op_Equality(e.Next.Top,e.Top)&&e.Next.NextInLML===null?t=e.Next:h.IntPoint.op_Equality(e.Prev.Top,e.Top)&&e.Prev.NextInLML===null&&(t=e.Prev),t!==null&&(t.OutIdx==-2||t.NextInAEL==t.PrevInAEL&&!h.ClipperBase.IsHorizontal(t))?null:t};h.Clipper.prototype.ProcessIntersections=function(e,t){if(this.m_ActiveEdges==null)return!0;try{if(this.BuildIntersectList(e,t),this.m_IntersectList.length==0)return!0;if(this.m_IntersectList.length==1||this.FixupIntersectionOrder())this.ProcessIntersectList();else return!1}catch{this.m_SortedEdges=null,this.m_IntersectList.length=0,h.Error("ProcessIntersections error")}return this.m_SortedEdges=null,!0};h.Clipper.prototype.BuildIntersectList=function(e,t){if(this.m_ActiveEdges!==null){var r=this.m_ActiveEdges;for(this.m_SortedEdges=r;r!==null;)r.PrevInSEL=r.PrevInAEL,r.NextInSEL=r.NextInAEL,r.Curr.X=h.Clipper.TopX(r,t),r=r.NextInAEL;for(var n=!0;n&&this.m_SortedEdges!==null;){for(n=!1,r=this.m_SortedEdges;r.NextInSEL!==null;){var o=r.NextInSEL,i=new h.IntPoint;if(r.Curr.X>o.Curr.X){!this.IntersectPoint(r,o,i)&&r.Curr.X>o.Curr.X+1&&h.Error("Intersection error"),i.Y>e&&(i.Y=e,Math.abs(r.Dx)>Math.abs(o.Dx)?i.X=h.Clipper.TopX(o,e):i.X=h.Clipper.TopX(r,e));var s=new h.IntersectNode;s.Edge1=r,s.Edge2=o,s.Pt.X=i.X,s.Pt.Y=i.Y,this.m_IntersectList.push(s),this.SwapPositionsInSEL(r,o),n=!0}else r=o}if(r.PrevInSEL!==null)r.PrevInSEL.NextInSEL=null;else break}this.m_SortedEdges=null}};h.Clipper.prototype.EdgesAdjacent=function(e){return e.Edge1.NextInSEL==e.Edge2||e.Edge1.PrevInSEL==e.Edge2};h.Clipper.IntersectNodeSort=function(e,t){return t.Pt.Y-e.Pt.Y};h.Clipper.prototype.FixupIntersectionOrder=function(){this.m_IntersectList.sort(this.m_IntersectNodeComparer),this.CopyAELToSEL();for(var e=this.m_IntersectList.length,t=0;t<e;t++){if(!this.EdgesAdjacent(this.m_IntersectList[t])){for(var r=t+1;r<e&&!this.EdgesAdjacent(this.m_IntersectList[r]);)r++;if(r==e)return!1;var n=this.m_IntersectList[t];this.m_IntersectList[t]=this.m_IntersectList[r],this.m_IntersectList[r]=n}this.SwapPositionsInSEL(this.m_IntersectList[t].Edge1,this.m_IntersectList[t].Edge2)}return!0};h.Clipper.prototype.ProcessIntersectList=function(){for(var e=0,t=this.m_IntersectList.length;e<t;e++){var r=this.m_IntersectList[e];this.IntersectEdges(r.Edge1,r.Edge2,r.Pt,!0),this.SwapPositionsInAEL(r.Edge1,r.Edge2)}this.m_IntersectList.length=0};var SQ=function(e){return e<0?Math.ceil(e-.5):Math.round(e)},CQ=function(e){return e<0?Math.ceil(e-.5):Math.floor(e+.5)},TQ=function(e){return e<0?-Math.round(Math.abs(e)):Math.round(e)},MQ=function(e){return e<0?(e-=.5,e<-2147483648?Math.ceil(e):e|0):(e+=.5,e>2147483647?Math.floor(e):e|0)};ze.msie?h.Clipper.Round=SQ:ze.chromium?h.Clipper.Round=TQ:ze.safari?h.Clipper.Round=MQ:h.Clipper.Round=CQ;h.Clipper.TopX=function(e,t){return t==e.Top.Y?e.Top.X:e.Bot.X+h.Clipper.Round(e.Dx*(t-e.Bot.Y))};h.Clipper.prototype.IntersectPoint=function(e,t,r){r.X=0,r.Y=0;var n,o;if(h.ClipperBase.SlopesEqual(e,t,this.m_UseFullRange)||e.Dx==t.Dx)return t.Bot.Y>e.Bot.Y?(r.X=t.Bot.X,r.Y=t.Bot.Y):(r.X=e.Bot.X,r.Y=e.Bot.Y),!1;if(e.Delta.X===0)r.X=e.Bot.X,h.ClipperBase.IsHorizontal(t)?r.Y=t.Bot.Y:(o=t.Bot.Y-t.Bot.X/t.Dx,r.Y=h.Clipper.Round(r.X/t.Dx+o));else if(t.Delta.X===0)r.X=t.Bot.X,h.ClipperBase.IsHorizontal(e)?r.Y=e.Bot.Y:(n=e.Bot.Y-e.Bot.X/e.Dx,r.Y=h.Clipper.Round(r.X/e.Dx+n));else{n=e.Bot.X-e.Bot.Y*e.Dx,o=t.Bot.X-t.Bot.Y*t.Dx;var i=(o-n)/(e.Dx-t.Dx);r.Y=h.Clipper.Round(i),Math.abs(e.Dx)<Math.abs(t.Dx)?r.X=h.Clipper.Round(e.Dx*i+n):r.X=h.Clipper.Round(t.Dx*i+o)}if(r.Y<e.Top.Y||r.Y<t.Top.Y){if(e.Top.Y>t.Top.Y)return r.Y=e.Top.Y,r.X=h.Clipper.TopX(t,e.Top.Y),r.X<e.Top.X;r.Y=t.Top.Y,Math.abs(e.Dx)<Math.abs(t.Dx)?r.X=h.Clipper.TopX(e,r.Y):r.X=h.Clipper.TopX(t,r.Y)}return!0};h.Clipper.prototype.ProcessEdgesAtTopOfScanbeam=function(e){for(var t=this.m_ActiveEdges;t!==null;){var r=this.IsMaxima(t,e);if(r){var n=this.GetMaximaPair(t);r=n===null||!h.ClipperBase.IsHorizontal(n)}if(r){var o=t.PrevInAEL;this.DoMaxima(t),o===null?t=this.m_ActiveEdges:t=o.NextInAEL}else{if(this.IsIntermediate(t,e)&&h.ClipperBase.IsHorizontal(t.NextInLML)?(t=this.UpdateEdgeIntoAEL(t),t.OutIdx>=0&&this.AddOutPt(t,t.Bot),this.AddEdgeToSEL(t)):(t.Curr.X=h.Clipper.TopX(t,e),t.Curr.Y=e),this.StrictlySimple){var o=t.PrevInAEL;if(t.OutIdx>=0&&t.WindDelta!==0&&o!==null&&o.OutIdx>=0&&o.Curr.X==t.Curr.X&&o.WindDelta!==0){var i=this.AddOutPt(o,t.Curr),s=this.AddOutPt(t,t.Curr);this.AddJoin(i,s,t.Curr)}}t=t.NextInAEL}}for(this.ProcessHorizontals(!0),t=this.m_ActiveEdges;t!==null;){if(this.IsIntermediate(t,e)){var i=null;t.OutIdx>=0&&(i=this.AddOutPt(t,t.Top)),t=this.UpdateEdgeIntoAEL(t);var o=t.PrevInAEL,l=t.NextInAEL;if(o!==null&&o.Curr.X==t.Bot.X&&o.Curr.Y==t.Bot.Y&&i!==null&&o.OutIdx>=0&&o.Curr.Y>o.Top.Y&&h.ClipperBase.SlopesEqual(t,o,this.m_UseFullRange)&&t.WindDelta!==0&&o.WindDelta!==0){var s=this.AddOutPt(o,t.Bot);this.AddJoin(i,s,t.Top)}else if(l!==null&&l.Curr.X==t.Bot.X&&l.Curr.Y==t.Bot.Y&&i!==null&&l.OutIdx>=0&&l.Curr.Y>l.Top.Y&&h.ClipperBase.SlopesEqual(t,l,this.m_UseFullRange)&&t.WindDelta!==0&&l.WindDelta!==0){var s=this.AddOutPt(l,t.Bot);this.AddJoin(i,s,t.Top)}}t=t.NextInAEL}};h.Clipper.prototype.DoMaxima=function(e){var t=this.GetMaximaPair(e);if(t===null){e.OutIdx>=0&&this.AddOutPt(e,e.Top),this.DeleteFromAEL(e);return}for(var r=e.NextInAEL,n=!0;r!==null&&r!=t;)this.IntersectEdges(e,r,e.Top,!0),this.SwapPositionsInAEL(e,r),r=e.NextInAEL;e.OutIdx==-1&&t.OutIdx==-1?(this.DeleteFromAEL(e),this.DeleteFromAEL(t)):e.OutIdx>=0&&t.OutIdx>=0?this.IntersectEdges(e,t,e.Top,!1):n&&e.WindDelta===0?(e.OutIdx>=0&&(this.AddOutPt(e,e.Top),e.OutIdx=-1),this.DeleteFromAEL(e),t.OutIdx>=0&&(this.AddOutPt(t,e.Top),t.OutIdx=-1),this.DeleteFromAEL(t)):h.Error("DoMaxima error")};h.Clipper.ReversePaths=function(e){for(var t=0,r=e.length;t<r;t++)e[t].reverse()};h.Clipper.Orientation=function(e){return h.Clipper.Area(e)>=0};h.Clipper.prototype.PointCount=function(e){if(e===null)return 0;var t=0,r=e;do t++,r=r.Next;while(r!=e);return t};h.Clipper.prototype.BuildResult=function(e){h.Clear(e);for(var t=0,r=this.m_PolyOuts.length;t<r;t++){var n=this.m_PolyOuts[t];if(n.Pts!==null){var o=n.Pts.Prev,i=this.PointCount(o);if(!(i<2)){for(var s=new Array(i),l=0;l<i;l++)s[l]=o.Pt,o=o.Prev;e.push(s)}}}};h.Clipper.prototype.BuildResult2=function(e){e.Clear();for(var t=0,r=this.m_PolyOuts.length;t<r;t++){var n=this.m_PolyOuts[t],o=this.PointCount(n.Pts);if(!(n.IsOpen&&o<2||!n.IsOpen&&o<3)){this.FixHoleLinkage(n);var i=new h.PolyNode;e.m_AllPolys.push(i),n.PolyNode=i,i.m_polygon.length=o;for(var s=n.Pts.Prev,l=0;l<o;l++)i.m_polygon[l]=s.Pt,s=s.Prev}}for(var t=0,r=this.m_PolyOuts.length;t<r;t++){var n=this.m_PolyOuts[t];n.PolyNode!==null&&(n.IsOpen?(n.PolyNode.IsOpen=!0,e.AddChild(n.PolyNode)):n.FirstLeft!==null&&n.FirstLeft.PolyNode!=null?n.FirstLeft.PolyNode.AddChild(n.PolyNode):e.AddChild(n.PolyNode))}};h.Clipper.prototype.FixupOutPolygon=function(e){var t=null;e.BottomPt=null;for(var r=e.Pts;;){if(r.Prev==r||r.Prev==r.Next){this.DisposeOutPts(r),e.Pts=null;return}if(h.IntPoint.op_Equality(r.Pt,r.Next.Pt)||h.IntPoint.op_Equality(r.Pt,r.Prev.Pt)||h.ClipperBase.SlopesEqual(r.Prev.Pt,r.Pt,r.Next.Pt,this.m_UseFullRange)&&(!this.PreserveCollinear||!this.Pt2IsBetweenPt1AndPt3(r.Prev.Pt,r.Pt,r.Next.Pt))){t=null;var n=r;r.Prev.Next=r.Next,r.Next.Prev=r.Prev,r=r.Prev,n=null}else{if(r==t)break;t===null&&(t=r),r=r.Next}}e.Pts=r};h.Clipper.prototype.DupOutPt=function(e,t){var r=new h.OutPt;return r.Pt.X=e.Pt.X,r.Pt.Y=e.Pt.Y,r.Idx=e.Idx,t?(r.Next=e.Next,r.Prev=e,e.Next.Prev=r,e.Next=r):(r.Prev=e.Prev,r.Next=e,e.Prev.Next=r,e.Prev=r),r};h.Clipper.prototype.GetOverlap=function(e,t,r,n,o){return e<t?r<n?(o.Left=Math.max(e,r),o.Right=Math.min(t,n)):(o.Left=Math.max(e,n),o.Right=Math.min(t,r)):r<n?(o.Left=Math.max(t,r),o.Right=Math.min(e,n)):(o.Left=Math.max(t,n),o.Right=Math.min(e,r)),o.Left<o.Right};h.Clipper.prototype.JoinHorz=function(e,t,r,n,o,i){var s=e.Pt.X>t.Pt.X?h.Direction.dRightToLeft:h.Direction.dLeftToRight,l=r.Pt.X>n.Pt.X?h.Direction.dRightToLeft:h.Direction.dLeftToRight;if(s==l)return!1;if(s==h.Direction.dLeftToRight){for(;e.Next.Pt.X<=o.X&&e.Next.Pt.X>=e.Pt.X&&e.Next.Pt.Y==o.Y;)e=e.Next;i&&e.Pt.X!=o.X&&(e=e.Next),t=this.DupOutPt(e,!i),h.IntPoint.op_Inequality(t.Pt,o)&&(e=t,e.Pt.X=o.X,e.Pt.Y=o.Y,t=this.DupOutPt(e,!i))}else{for(;e.Next.Pt.X>=o.X&&e.Next.Pt.X<=e.Pt.X&&e.Next.Pt.Y==o.Y;)e=e.Next;!i&&e.Pt.X!=o.X&&(e=e.Next),t=this.DupOutPt(e,i),h.IntPoint.op_Inequality(t.Pt,o)&&(e=t,e.Pt.X=o.X,e.Pt.Y=o.Y,t=this.DupOutPt(e,i))}if(l==h.Direction.dLeftToRight){for(;r.Next.Pt.X<=o.X&&r.Next.Pt.X>=r.Pt.X&&r.Next.Pt.Y==o.Y;)r=r.Next;i&&r.Pt.X!=o.X&&(r=r.Next),n=this.DupOutPt(r,!i),h.IntPoint.op_Inequality(n.Pt,o)&&(r=n,r.Pt.X=o.X,r.Pt.Y=o.Y,n=this.DupOutPt(r,!i))}else{for(;r.Next.Pt.X>=o.X&&r.Next.Pt.X<=r.Pt.X&&r.Next.Pt.Y==o.Y;)r=r.Next;!i&&r.Pt.X!=o.X&&(r=r.Next),n=this.DupOutPt(r,i),h.IntPoint.op_Inequality(n.Pt,o)&&(r=n,r.Pt.X=o.X,r.Pt.Y=o.Y,n=this.DupOutPt(r,i))}return s==h.Direction.dLeftToRight==i?(e.Prev=r,r.Next=e,t.Next=n,n.Prev=t):(e.Next=r,r.Prev=e,t.Prev=n,n.Next=t),!0};h.Clipper.prototype.JoinPoints=function(e,t,r){var n=e.OutPt1,o=new h.OutPt,i=e.OutPt2,s=new h.OutPt,l=e.OutPt1.Pt.Y==e.OffPt.Y;if(l&&h.IntPoint.op_Equality(e.OffPt,e.OutPt1.Pt)&&h.IntPoint.op_Equality(e.OffPt,e.OutPt2.Pt)){for(o=e.OutPt1.Next;o!=n&&h.IntPoint.op_Equality(o.Pt,e.OffPt);)o=o.Next;var c=o.Pt.Y>e.OffPt.Y;for(s=e.OutPt2.Next;s!=i&&h.IntPoint.op_Equality(s.Pt,e.OffPt);)s=s.Next;var p=s.Pt.Y>e.OffPt.Y;return c==p?!1:c?(o=this.DupOutPt(n,!1),s=this.DupOutPt(i,!0),n.Prev=i,i.Next=n,o.Next=s,s.Prev=o,e.OutPt1=n,e.OutPt2=o,!0):(o=this.DupOutPt(n,!0),s=this.DupOutPt(i,!1),n.Next=i,i.Prev=n,o.Prev=s,s.Next=o,e.OutPt1=n,e.OutPt2=o,!0)}else if(l){for(o=n;n.Prev.Pt.Y==n.Pt.Y&&n.Prev!=o&&n.Prev!=i;)n=n.Prev;for(;o.Next.Pt.Y==o.Pt.Y&&o.Next!=n&&o.Next!=i;)o=o.Next;if(o.Next==n||o.Next==i)return!1;for(s=i;i.Prev.Pt.Y==i.Pt.Y&&i.Prev!=s&&i.Prev!=o;)i=i.Prev;for(;s.Next.Pt.Y==s.Pt.Y&&s.Next!=i&&s.Next!=n;)s=s.Next;if(s.Next==i||s.Next==n)return!1;var d={Left:null,Right:null};if(!this.GetOverlap(n.Pt.X,o.Pt.X,i.Pt.X,s.Pt.X,d))return!1;var m=d.Left,g=d.Right,x=new h.IntPoint,v;return n.Pt.X>=m&&n.Pt.X<=g?(x.X=n.Pt.X,x.Y=n.Pt.Y,v=n.Pt.X>o.Pt.X):i.Pt.X>=m&&i.Pt.X<=g?(x.X=i.Pt.X,x.Y=i.Pt.Y,v=i.Pt.X>s.Pt.X):o.Pt.X>=m&&o.Pt.X<=g?(x.X=o.Pt.X,x.Y=o.Pt.Y,v=o.Pt.X>n.Pt.X):(x.X=s.Pt.X,x.Y=s.Pt.Y,v=s.Pt.X>i.Pt.X),e.OutPt1=n,e.OutPt2=i,this.JoinHorz(n,o,i,s,x,v)}else{for(o=n.Next;h.IntPoint.op_Equality(o.Pt,n.Pt)&&o!=n;)o=o.Next;var C=o.Pt.Y>n.Pt.Y||!h.ClipperBase.SlopesEqual(n.Pt,o.Pt,e.OffPt,this.m_UseFullRange);if(C){for(o=n.Prev;h.IntPoint.op_Equality(o.Pt,n.Pt)&&o!=n;)o=o.Prev;if(o.Pt.Y>n.Pt.Y||!h.ClipperBase.SlopesEqual(n.Pt,o.Pt,e.OffPt,this.m_UseFullRange))return!1}for(s=i.Next;h.IntPoint.op_Equality(s.Pt,i.Pt)&&s!=i;)s=s.Next;var I=s.Pt.Y>i.Pt.Y||!h.ClipperBase.SlopesEqual(i.Pt,s.Pt,e.OffPt,this.m_UseFullRange);if(I){for(s=i.Prev;h.IntPoint.op_Equality(s.Pt,i.Pt)&&s!=i;)s=s.Prev;if(s.Pt.Y>i.Pt.Y||!h.ClipperBase.SlopesEqual(i.Pt,s.Pt,e.OffPt,this.m_UseFullRange))return!1}return o==n||s==i||o==s||t==r&&C==I?!1:C?(o=this.DupOutPt(n,!1),s=this.DupOutPt(i,!0),n.Prev=i,i.Next=n,o.Next=s,s.Prev=o,e.OutPt1=n,e.OutPt2=o,!0):(o=this.DupOutPt(n,!0),s=this.DupOutPt(i,!1),n.Next=i,i.Prev=n,o.Prev=s,s.Next=o,e.OutPt1=n,e.OutPt2=o,!0)}};h.Clipper.GetBounds=function(e){for(var t=0,r=e.length;t<r&&e[t].length==0;)t++;if(t==r)return new h.IntRect(0,0,0,0);var n=new h.IntRect;for(n.left=e[t][0].X,n.right=n.left,n.top=e[t][0].Y,n.bottom=n.top;t<r;t++)for(var o=0,i=e[t].length;o<i;o++)e[t][o].X<n.left?n.left=e[t][o].X:e[t][o].X>n.right&&(n.right=e[t][o].X),e[t][o].Y<n.top?n.top=e[t][o].Y:e[t][o].Y>n.bottom&&(n.bottom=e[t][o].Y);return n};h.Clipper.prototype.GetBounds2=function(e){var t=e,r=new h.IntRect;for(r.left=e.Pt.X,r.right=e.Pt.X,r.top=e.Pt.Y,r.bottom=e.Pt.Y,e=e.Next;e!=t;)e.Pt.X<r.left&&(r.left=e.Pt.X),e.Pt.X>r.right&&(r.right=e.Pt.X),e.Pt.Y<r.top&&(r.top=e.Pt.Y),e.Pt.Y>r.bottom&&(r.bottom=e.Pt.Y),e=e.Next;return r};h.Clipper.PointInPolygon=function(e,t){var r=0,n=t.length;if(n<3)return 0;for(var o=t[0],i=1;i<=n;++i){var s=i==n?t[0]:t[i];if(s.Y==e.Y&&(s.X==e.X||o.Y==e.Y&&s.X>e.X==o.X<e.X))return-1;if(o.Y<e.Y!=s.Y<e.Y){if(o.X>=e.X)if(s.X>e.X)r=1-r;else{var l=(o.X-e.X)*(s.Y-e.Y)-(s.X-e.X)*(o.Y-e.Y);if(l==0)return-1;l>0==s.Y>o.Y&&(r=1-r)}else if(s.X>e.X){var l=(o.X-e.X)*(s.Y-e.Y)-(s.X-e.X)*(o.Y-e.Y);if(l==0)return-1;l>0==s.Y>o.Y&&(r=1-r)}}o=s}return r};h.Clipper.prototype.PointInPolygon=function(e,t){for(var r=0,n=t;;){var o=t.Pt.X,i=t.Pt.Y,s=t.Next.Pt.X,l=t.Next.Pt.Y;if(l==e.Y&&(s==e.X||i==e.Y&&s>e.X==o<e.X))return-1;if(i<e.Y!=l<e.Y){if(o>=e.X)if(s>e.X)r=1-r;else{var c=(o-e.X)*(l-e.Y)-(s-e.X)*(i-e.Y);if(c==0)return-1;c>0==l>i&&(r=1-r)}else if(s>e.X){var c=(o-e.X)*(l-e.Y)-(s-e.X)*(i-e.Y);if(c==0)return-1;c>0==l>i&&(r=1-r)}}if(t=t.Next,n==t)break}return r};h.Clipper.prototype.Poly2ContainsPoly1=function(e,t){var r=e;do{var n=this.PointInPolygon(r.Pt,t);if(n>=0)return n!=0;r=r.Next}while(r!=e);return!0};h.Clipper.prototype.FixupFirstLefts1=function(e,t){for(var r=0,n=this.m_PolyOuts.length;r<n;r++){var o=this.m_PolyOuts[r];o.Pts!==null&&o.FirstLeft==e&&this.Poly2ContainsPoly1(o.Pts,t.Pts)&&(o.FirstLeft=t)}};h.Clipper.prototype.FixupFirstLefts2=function(e,t){for(var r=0,n=this.m_PolyOuts,o=n.length,i=n[r];r<o;r++,i=n[r])i.FirstLeft==e&&(i.FirstLeft=t)};h.Clipper.ParseFirstLeft=function(e){for(;e!=null&&e.Pts==null;)e=e.FirstLeft;return e};h.Clipper.prototype.JoinCommonEdges=function(){for(var e=0,t=this.m_Joins.length;e<t;e++){var r=this.m_Joins[e],n=this.GetOutRec(r.OutPt1.Idx),o=this.GetOutRec(r.OutPt2.Idx);if(!(n.Pts==null||o.Pts==null)){var i;if(n==o?i=n:this.Param1RightOfParam2(n,o)?i=o:this.Param1RightOfParam2(o,n)?i=n:i=this.GetLowermostRec(n,o),!!this.JoinPoints(r,n,o))if(n==o){if(n.Pts=r.OutPt1,n.BottomPt=null,o=this.CreateOutRec(),o.Pts=r.OutPt2,this.UpdateOutPtIdxs(o),this.m_UsingPolyTree)for(var s=0,l=this.m_PolyOuts.length;s<l-1;s++){var c=this.m_PolyOuts[s];c.Pts==null||h.Clipper.ParseFirstLeft(c.FirstLeft)!=n||c.IsHole==n.IsHole||this.Poly2ContainsPoly1(c.Pts,r.OutPt2)&&(c.FirstLeft=o)}this.Poly2ContainsPoly1(o.Pts,n.Pts)?(o.IsHole=!n.IsHole,o.FirstLeft=n,this.m_UsingPolyTree&&this.FixupFirstLefts2(o,n),(o.IsHole^this.ReverseSolution)==this.Area(o)>0&&this.ReversePolyPtLinks(o.Pts)):this.Poly2ContainsPoly1(n.Pts,o.Pts)?(o.IsHole=n.IsHole,n.IsHole=!o.IsHole,o.FirstLeft=n.FirstLeft,n.FirstLeft=o,this.m_UsingPolyTree&&this.FixupFirstLefts2(n,o),(n.IsHole^this.ReverseSolution)==this.Area(n)>0&&this.ReversePolyPtLinks(n.Pts)):(o.IsHole=n.IsHole,o.FirstLeft=n.FirstLeft,this.m_UsingPolyTree&&this.FixupFirstLefts1(n,o))}else o.Pts=null,o.BottomPt=null,o.Idx=n.Idx,n.IsHole=i.IsHole,i==o&&(n.FirstLeft=o.FirstLeft),o.FirstLeft=n,this.m_UsingPolyTree&&this.FixupFirstLefts2(o,n)}}};h.Clipper.prototype.UpdateOutPtIdxs=function(e){var t=e.Pts;do t.Idx=e.Idx,t=t.Prev;while(t!=e.Pts)};h.Clipper.prototype.DoSimplePolygons=function(){for(var e=0;e<this.m_PolyOuts.length;){var t=this.m_PolyOuts[e++],r=t.Pts;if(r!==null)do{for(var n=r.Next;n!=t.Pts;){if(h.IntPoint.op_Equality(r.Pt,n.Pt)&&n.Next!=r&&n.Prev!=r){var o=r.Prev,i=n.Prev;r.Prev=i,i.Next=r,n.Prev=o,o.Next=n,t.Pts=r;var s=this.CreateOutRec();s.Pts=n,this.UpdateOutPtIdxs(s),this.Poly2ContainsPoly1(s.Pts,t.Pts)?(s.IsHole=!t.IsHole,s.FirstLeft=t):this.Poly2ContainsPoly1(t.Pts,s.Pts)?(s.IsHole=t.IsHole,t.IsHole=!s.IsHole,s.FirstLeft=t.FirstLeft,t.FirstLeft=s):(s.IsHole=t.IsHole,s.FirstLeft=t.FirstLeft),n=r}n=n.Next}r=r.Next}while(r!=t.Pts)}};h.Clipper.Area=function(e){var t=e.length;if(t<3)return 0;for(var r=0,n=0,o=t-1;n<t;++n)r+=(e[o].X+e[n].X)*(e[o].Y-e[n].Y),o=n;return-r*.5};h.Clipper.prototype.Area=function(e){var t=e.Pts;if(t==null)return 0;var r=0;do r=r+(t.Prev.Pt.X+t.Pt.X)*(t.Prev.Pt.Y-t.Pt.Y),t=t.Next;while(t!=e.Pts);return r*.5};s8&&(h.Clipper.OffsetPaths=function(e,t,r,n,o){var i=new h.Paths,s=new h.ClipperOffset(o,o);return s.AddPaths(e,r,n),s.Execute(i,t),i});h.Clipper.SimplifyPolygon=function(e,t){var r=new Array,n=new h.Clipper(0);return n.StrictlySimple=!0,n.AddPath(e,h.PolyType.ptSubject,!0),n.Execute(h.ClipType.ctUnion,r,t,t),r};h.Clipper.SimplifyPolygons=function(e,t){typeof t>"u"&&(t=h.PolyFillType.pftEvenOdd);var r=new Array,n=new h.Clipper(0);return n.StrictlySimple=!0,n.AddPaths(e,h.PolyType.ptSubject,!0),n.Execute(h.ClipType.ctUnion,r,t,t),r};h.Clipper.DistanceSqrd=function(e,t){var r=e.X-t.X,n=e.Y-t.Y;return r*r+n*n};h.Clipper.DistanceFromLineSqrd=function(e,t,r){var n=t.Y-r.Y,o=r.X-t.X,i=n*t.X+o*t.Y;return i=n*e.X+o*e.Y-i,i*i/(n*n+o*o)};h.Clipper.SlopesNearCollinear=function(e,t,r,n){return h.Clipper.DistanceFromLineSqrd(t,e,r)<n};h.Clipper.PointsAreClose=function(e,t,r){var n=e.X-t.X,o=e.Y-t.Y;return n*n+o*o<=r};h.Clipper.ExcludeOp=function(e){var t=e.Prev;return t.Next=e.Next,e.Next.Prev=t,t.Idx=0,t};h.Clipper.CleanPolygon=function(e,t){typeof t>"u"&&(t=1.415);var r=e.length;if(r==0)return new Array;for(var n=new Array(r),o=0;o<r;++o)n[o]=new h.OutPt;for(var o=0;o<r;++o)n[o].Pt=e[o],n[o].Next=n[(o+1)%r],n[o].Next.Prev=n[o],n[o].Idx=0;for(var i=t*t,s=n[0];s.Idx==0&&s.Next!=s.Prev;)h.Clipper.PointsAreClose(s.Pt,s.Prev.Pt,i)?(s=h.Clipper.ExcludeOp(s),r--):h.Clipper.PointsAreClose(s.Prev.Pt,s.Next.Pt,i)?(h.Clipper.ExcludeOp(s.Next),s=h.Clipper.ExcludeOp(s),r-=2):h.Clipper.SlopesNearCollinear(s.Prev.Pt,s.Pt,s.Next.Pt,i)?(s=h.Clipper.ExcludeOp(s),r--):(s.Idx=1,s=s.Next);r<3&&(r=0);for(var l=new Array(r),o=0;o<r;++o)l[o]=new h.IntPoint(s.Pt),s=s.Next;return n=null,l};h.Clipper.CleanPolygons=function(e,t){for(var r=new Array(e.length),n=0,o=e.length;n<o;n++)r[n]=h.Clipper.CleanPolygon(e[n],t);return r};h.Clipper.Minkowski=function(e,t,r,n){var o=n?1:0,i=e.length,s=t.length,l=new Array;if(r)for(var c=0;c<s;c++){for(var p=new Array(i),d=0,m=e.length,g=e[d];d<m;d++,g=e[d])p[d]=new h.IntPoint(t[c].X+g.X,t[c].Y+g.Y);l.push(p)}else for(var c=0;c<s;c++){for(var p=new Array(i),d=0,m=e.length,g=e[d];d<m;d++,g=e[d])p[d]=new h.IntPoint(t[c].X-g.X,t[c].Y-g.Y);l.push(p)}for(var x=new Array,c=0;c<s-1+o;c++)for(var d=0;d<i;d++){var v=new Array;v.push(l[c%s][d%i]),v.push(l[(c+1)%s][d%i]),v.push(l[(c+1)%s][(d+1)%i]),v.push(l[c%s][(d+1)%i]),h.Clipper.Orientation(v)||v.reverse(),x.push(v)}var C=new h.Clipper(0);return C.AddPaths(x,h.PolyType.ptSubject,!0),C.Execute(h.ClipType.ctUnion,l,h.PolyFillType.pftNonZero,h.PolyFillType.pftNonZero),l};h.Clipper.MinkowskiSum=function(){var e=arguments,t=e.length;if(t==3){var r=e[0],n=e[1],o=e[2];return h.Clipper.Minkowski(r,n,!0,o)}else if(t==4){for(var r=e[0],i=e[1],s=e[2],o=e[3],l=new h.Clipper,c,p=0,d=i.length;p<d;++p){var c=h.Clipper.Minkowski(r,i[p],!0,o);l.AddPaths(c,h.PolyType.ptSubject,!0)}o&&l.AddPaths(i,h.PolyType.ptClip,!0);var m=new h.Paths;return l.Execute(h.ClipType.ctUnion,m,s,s),m}};h.Clipper.MinkowskiDiff=function(e,t,r){return h.Clipper.Minkowski(e,t,!1,r)};h.Clipper.PolyTreeToPaths=function(e){var t=new Array;return h.Clipper.AddPolyNodeToPaths(e,h.Clipper.NodeType.ntAny,t),t};h.Clipper.AddPolyNodeToPaths=function(e,t,r){var n=!0;switch(t){case h.Clipper.NodeType.ntOpen:return;case h.Clipper.NodeType.ntClosed:n=!e.IsOpen;break;default:break}e.m_polygon.length>0&&n&&r.push(e.m_polygon);for(var o=0,i=e.Childs(),s=i.length,l=i[o];o<s;o++,l=i[o])h.Clipper.AddPolyNodeToPaths(l,t,r)};h.Clipper.OpenPathsFromPolyTree=function(e){for(var t=new h.Paths,r=0,n=e.ChildCount();r<n;r++)e.Childs()[r].IsOpen&&t.push(e.Childs()[r].m_polygon);return t};h.Clipper.ClosedPathsFromPolyTree=function(e){var t=new h.Paths;return h.Clipper.AddPolyNodeToPaths(e,h.Clipper.NodeType.ntClosed,t),t};Cx(h.Clipper,h.ClipperBase);h.Clipper.NodeType={ntAny:0,ntOpen:1,ntClosed:2};h.ClipperOffset=function(e,t){typeof e>"u"&&(e=2),typeof t>"u"&&(t=h.ClipperOffset.def_arc_tolerance),this.m_destPolys=new h.Paths,this.m_srcPoly=new h.Path,this.m_destPoly=new h.Path,this.m_normals=new Array,this.m_delta=0,this.m_sinA=0,this.m_sin=0,this.m_cos=0,this.m_miterLim=0,this.m_StepsPerRad=0,this.m_lowest=new h.IntPoint,this.m_polyNodes=new h.PolyNode,this.MiterLimit=e,this.ArcTolerance=t,this.m_lowest.X=-1};h.ClipperOffset.two_pi=6.28318530717959;h.ClipperOffset.def_arc_tolerance=.25;h.ClipperOffset.prototype.Clear=function(){h.Clear(this.m_polyNodes.Childs()),this.m_lowest.X=-1};h.ClipperOffset.Round=h.Clipper.Round;h.ClipperOffset.prototype.AddPath=function(e,t,r){var n=e.length-1;if(!(n<0)){var o=new h.PolyNode;if(o.m_jointype=t,o.m_endtype=r,r==h.EndType.etClosedLine||r==h.EndType.etClosedPolygon)for(;n>0&&h.IntPoint.op_Equality(e[0],e[n]);)n--;o.m_polygon.push(e[0]);for(var i=0,s=0,l=1;l<=n;l++)h.IntPoint.op_Inequality(o.m_polygon[i],e[l])&&(i++,o.m_polygon.push(e[l]),(e[l].Y>o.m_polygon[s].Y||e[l].Y==o.m_polygon[s].Y&&e[l].X<o.m_polygon[s].X)&&(s=i));if(!(r==h.EndType.etClosedPolygon&&i<2||r!=h.EndType.etClosedPolygon&&i<0)&&(this.m_polyNodes.AddChild(o),r==h.EndType.etClosedPolygon))if(this.m_lowest.X<0)this.m_lowest=new h.IntPoint(0,s);else{var c=this.m_polyNodes.Childs()[this.m_lowest.X].m_polygon[this.m_lowest.Y];(o.m_polygon[s].Y>c.Y||o.m_polygon[s].Y==c.Y&&o.m_polygon[s].X<c.X)&&(this.m_lowest=new h.IntPoint(this.m_polyNodes.ChildCount()-1,s))}}};h.ClipperOffset.prototype.AddPaths=function(e,t,r){for(var n=0,o=e.length;n<o;n++)this.AddPath(e[n],t,r)};h.ClipperOffset.prototype.FixOrientations=function(){if(this.m_lowest.X>=0&&!h.Clipper.Orientation(this.m_polyNodes.Childs()[this.m_lowest.X].m_polygon))for(var e=0;e<this.m_polyNodes.ChildCount();e++){var t=this.m_polyNodes.Childs()[e];(t.m_endtype==h.EndType.etClosedPolygon||t.m_endtype==h.EndType.etClosedLine&&h.Clipper.Orientation(t.m_polygon))&&t.m_polygon.reverse()}else for(var e=0;e<this.m_polyNodes.ChildCount();e++){var t=this.m_polyNodes.Childs()[e];t.m_endtype==h.EndType.etClosedLine&&!h.Clipper.Orientation(t.m_polygon)&&t.m_polygon.reverse()}};h.ClipperOffset.GetUnitNormal=function(e,t){var r=t.X-e.X,n=t.Y-e.Y;if(r==0&&n==0)return new h.DoublePoint(0,0);var o=1/Math.sqrt(r*r+n*n);return r*=o,n*=o,new h.DoublePoint(n,-r)};h.ClipperOffset.prototype.DoOffset=function(e){if(this.m_destPolys=new Array,this.m_delta=e,h.ClipperBase.near_zero(e)){for(var t=0;t<this.m_polyNodes.ChildCount();t++){var r=this.m_polyNodes.Childs()[t];r.m_endtype==h.EndType.etClosedPolygon&&this.m_destPolys.push(r.m_polygon)}return}this.MiterLimit>2?this.m_miterLim=2/(this.MiterLimit*this.MiterLimit):this.m_miterLim=.5;var n;this.ArcTolerance<=0?n=h.ClipperOffset.def_arc_tolerance:this.ArcTolerance>Math.abs(e)*h.ClipperOffset.def_arc_tolerance?n=Math.abs(e)*h.ClipperOffset.def_arc_tolerance:n=this.ArcTolerance;var o=3.14159265358979/Math.acos(1-n/Math.abs(e));this.m_sin=Math.sin(h.ClipperOffset.two_pi/o),this.m_cos=Math.cos(h.ClipperOffset.two_pi/o),this.m_StepsPerRad=o/h.ClipperOffset.two_pi,e<0&&(this.m_sin=-this.m_sin);for(var t=0;t<this.m_polyNodes.ChildCount();t++){var r=this.m_polyNodes.Childs()[t];this.m_srcPoly=r.m_polygon;var i=this.m_srcPoly.length;if(!(i==0||e<=0&&(i<3||r.m_endtype!=h.EndType.etClosedPolygon))){if(this.m_destPoly=new Array,i==1){if(r.m_jointype==h.JoinType.jtRound)for(var s=1,l=0,c=1;c<=o;c++){this.m_destPoly.push(new h.IntPoint(h.ClipperOffset.Round(this.m_srcPoly[0].X+s*e),h.ClipperOffset.Round(this.m_srcPoly[0].Y+l*e)));var p=s;s=s*this.m_cos-this.m_sin*l,l=p*this.m_sin+l*this.m_cos}else for(var s=-1,l=-1,c=0;c<4;++c)this.m_destPoly.push(new h.IntPoint(h.ClipperOffset.Round(this.m_srcPoly[0].X+s*e),h.ClipperOffset.Round(this.m_srcPoly[0].Y+l*e))),s<0?s=1:l<0?l=1:s=-1;this.m_destPolys.push(this.m_destPoly);continue}this.m_normals.length=0;for(var c=0;c<i-1;c++)this.m_normals.push(h.ClipperOffset.GetUnitNormal(this.m_srcPoly[c],this.m_srcPoly[c+1]));if(r.m_endtype==h.EndType.etClosedLine||r.m_endtype==h.EndType.etClosedPolygon?this.m_normals.push(h.ClipperOffset.GetUnitNormal(this.m_srcPoly[i-1],this.m_srcPoly[0])):this.m_normals.push(new h.DoublePoint(this.m_normals[i-2])),r.m_endtype==h.EndType.etClosedPolygon){for(var d=i-1,c=0;c<i;c++)d=this.OffsetPoint(c,d,r.m_jointype);this.m_destPolys.push(this.m_destPoly)}else if(r.m_endtype==h.EndType.etClosedLine){for(var d=i-1,c=0;c<i;c++)d=this.OffsetPoint(c,d,r.m_jointype);this.m_destPolys.push(this.m_destPoly),this.m_destPoly=new Array;for(var m=this.m_normals[i-1],c=i-1;c>0;c--)this.m_normals[c]=new h.DoublePoint(-this.m_normals[c-1].X,-this.m_normals[c-1].Y);this.m_normals[0]=new h.DoublePoint(-m.X,-m.Y),d=0;for(var c=i-1;c>=0;c--)d=this.OffsetPoint(c,d,r.m_jointype);this.m_destPolys.push(this.m_destPoly)}else{for(var d=0,c=1;c<i-1;++c)d=this.OffsetPoint(c,d,r.m_jointype);var g;if(r.m_endtype==h.EndType.etOpenButt){var c=i-1;g=new h.IntPoint(h.ClipperOffset.Round(this.m_srcPoly[c].X+this.m_normals[c].X*e),h.ClipperOffset.Round(this.m_srcPoly[c].Y+this.m_normals[c].Y*e)),this.m_destPoly.push(g),g=new h.IntPoint(h.ClipperOffset.Round(this.m_srcPoly[c].X-this.m_normals[c].X*e),h.ClipperOffset.Round(this.m_srcPoly[c].Y-this.m_normals[c].Y*e)),this.m_destPoly.push(g)}else{var c=i-1;d=i-2,this.m_sinA=0,this.m_normals[c]=new h.DoublePoint(-this.m_normals[c].X,-this.m_normals[c].Y),r.m_endtype==h.EndType.etOpenSquare?this.DoSquare(c,d):this.DoRound(c,d)}for(var c=i-1;c>0;c--)this.m_normals[c]=new h.DoublePoint(-this.m_normals[c-1].X,-this.m_normals[c-1].Y);this.m_normals[0]=new h.DoublePoint(-this.m_normals[1].X,-this.m_normals[1].Y),d=i-1;for(var c=d-1;c>0;--c)d=this.OffsetPoint(c,d,r.m_jointype);r.m_endtype==h.EndType.etOpenButt?(g=new h.IntPoint(h.ClipperOffset.Round(this.m_srcPoly[0].X-this.m_normals[0].X*e),h.ClipperOffset.Round(this.m_srcPoly[0].Y-this.m_normals[0].Y*e)),this.m_destPoly.push(g),g=new h.IntPoint(h.ClipperOffset.Round(this.m_srcPoly[0].X+this.m_normals[0].X*e),h.ClipperOffset.Round(this.m_srcPoly[0].Y+this.m_normals[0].Y*e)),this.m_destPoly.push(g)):(d=1,this.m_sinA=0,r.m_endtype==h.EndType.etOpenSquare?this.DoSquare(0,1):this.DoRound(0,1)),this.m_destPolys.push(this.m_destPoly)}}}};h.ClipperOffset.prototype.Execute=function(){var e=arguments,t=e[0]instanceof h.PolyTree;if(t){var r=e[0],n=e[1];r.Clear(),this.FixOrientations(),this.DoOffset(n);var o=new h.Clipper(0);if(o.AddPaths(this.m_destPolys,h.PolyType.ptSubject,!0),n>0)o.Execute(h.ClipType.ctUnion,r,h.PolyFillType.pftPositive,h.PolyFillType.pftPositive);else{var i=h.Clipper.GetBounds(this.m_destPolys),s=new h.Path;if(s.push(new h.IntPoint(i.left-10,i.bottom+10)),s.push(new h.IntPoint(i.right+10,i.bottom+10)),s.push(new h.IntPoint(i.right+10,i.top-10)),s.push(new h.IntPoint(i.left-10,i.top-10)),o.AddPath(s,h.PolyType.ptSubject,!0),o.ReverseSolution=!0,o.Execute(h.ClipType.ctUnion,r,h.PolyFillType.pftNegative,h.PolyFillType.pftNegative),r.ChildCount()==1&&r.Childs()[0].ChildCount()>0){var l=r.Childs()[0];r.Childs()[0]=l.Childs()[0];for(var c=1;c<l.ChildCount();c++)r.AddChild(l.Childs()[c])}else r.Clear()}}else{var r=e[0],n=e[1];h.Clear(r),this.FixOrientations(),this.DoOffset(n);var o=new h.Clipper(0);if(o.AddPaths(this.m_destPolys,h.PolyType.ptSubject,!0),n>0)o.Execute(h.ClipType.ctUnion,r,h.PolyFillType.pftPositive,h.PolyFillType.pftPositive);else{var i=h.Clipper.GetBounds(this.m_destPolys),s=new h.Path;s.push(new h.IntPoint(i.left-10,i.bottom+10)),s.push(new h.IntPoint(i.right+10,i.bottom+10)),s.push(new h.IntPoint(i.right+10,i.top-10)),s.push(new h.IntPoint(i.left-10,i.top-10)),o.AddPath(s,h.PolyType.ptSubject,!0),o.ReverseSolution=!0,o.Execute(h.ClipType.ctUnion,r,h.PolyFillType.pftNegative,h.PolyFillType.pftNegative),r.length>0&&r.splice(0,1)}}};h.ClipperOffset.prototype.OffsetPoint=function(e,t,r){if(this.m_sinA=this.m_normals[t].X*this.m_normals[e].Y-this.m_normals[e].X*this.m_normals[t].Y,this.m_sinA<5e-5&&this.m_sinA>-5e-5)return t;if(this.m_sinA>1?this.m_sinA=1:this.m_sinA<-1&&(this.m_sinA=-1),this.m_sinA*this.m_delta<0)this.m_destPoly.push(new h.IntPoint(h.ClipperOffset.Round(this.m_srcPoly[e].X+this.m_normals[t].X*this.m_delta),h.ClipperOffset.Round(this.m_srcPoly[e].Y+this.m_normals[t].Y*this.m_delta))),this.m_destPoly.push(new h.IntPoint(this.m_srcPoly[e])),this.m_destPoly.push(new h.IntPoint(h.ClipperOffset.Round(this.m_srcPoly[e].X+this.m_normals[e].X*this.m_delta),h.ClipperOffset.Round(this.m_srcPoly[e].Y+this.m_normals[e].Y*this.m_delta)));else switch(r){case h.JoinType.jtMiter:{var n=1+(this.m_normals[e].X*this.m_normals[t].X+this.m_normals[e].Y*this.m_normals[t].Y);n>=this.m_miterLim?this.DoMiter(e,t,n):this.DoSquare(e,t);break}case h.JoinType.jtSquare:this.DoSquare(e,t);break;case h.JoinType.jtRound:this.DoRound(e,t);break}return t=e,t};h.ClipperOffset.prototype.DoSquare=function(e,t){var r=Math.tan(Math.atan2(this.m_sinA,this.m_normals[t].X*this.m_normals[e].X+this.m_normals[t].Y*this.m_normals[e].Y)/4);this.m_destPoly.push(new h.IntPoint(h.ClipperOffset.Round(this.m_srcPoly[e].X+this.m_delta*(this.m_normals[t].X-this.m_normals[t].Y*r)),h.ClipperOffset.Round(this.m_srcPoly[e].Y+this.m_delta*(this.m_normals[t].Y+this.m_normals[t].X*r)))),this.m_destPoly.push(new h.IntPoint(h.ClipperOffset.Round(this.m_srcPoly[e].X+this.m_delta*(this.m_normals[e].X+this.m_normals[e].Y*r)),h.ClipperOffset.Round(this.m_srcPoly[e].Y+this.m_delta*(this.m_normals[e].Y-this.m_normals[e].X*r))))};h.ClipperOffset.prototype.DoMiter=function(e,t,r){var n=this.m_delta/r;this.m_destPoly.push(new h.IntPoint(h.ClipperOffset.Round(this.m_srcPoly[e].X+(this.m_normals[t].X+this.m_normals[e].X)*n),h.ClipperOffset.Round(this.m_srcPoly[e].Y+(this.m_normals[t].Y+this.m_normals[e].Y)*n)))};h.ClipperOffset.prototype.DoRound=function(e,t){for(var r=Math.atan2(this.m_sinA,this.m_normals[t].X*this.m_normals[e].X+this.m_normals[t].Y*this.m_normals[e].Y),n=h.Cast_Int32(h.ClipperOffset.Round(this.m_StepsPerRad*Math.abs(r))),o=this.m_normals[t].X,i=this.m_normals[t].Y,s,l=0;l<n;++l)this.m_destPoly.push(new h.IntPoint(h.ClipperOffset.Round(this.m_srcPoly[e].X+o*this.m_delta),h.ClipperOffset.Round(this.m_srcPoly[e].Y+i*this.m_delta))),s=o,o=o*this.m_cos-this.m_sin*i,i=s*this.m_sin+i*this.m_cos;this.m_destPoly.push(new h.IntPoint(h.ClipperOffset.Round(this.m_srcPoly[e].X+this.m_normals[e].X*this.m_delta),h.ClipperOffset.Round(this.m_srcPoly[e].Y+this.m_normals[e].Y*this.m_delta)))};h.Error=function(e){try{throw new Error(e)}catch(t){alert(t.message)}};h.JS={};h.JS.AreaOfPolygon=function(e,t){return t||(t=1),h.Clipper.Area(e)/(t*t)};h.JS.AreaOfPolygons=function(e,t){t||(t=1);for(var r=0,n=0;n<e.length;n++)r+=h.Clipper.Area(e[n]);return r/(t*t)};h.JS.BoundsOfPath=function(e,t){return h.JS.BoundsOfPaths([e],t)};h.JS.BoundsOfPaths=function(e,t){t||(t=1);var r=h.Clipper.GetBounds(e);return r.left/=t,r.bottom/=t,r.right/=t,r.top/=t,r};h.JS.Clean=function(n,t){if(!(n instanceof Array))return[];var r=n[0]instanceof Array,n=h.JS.Clone(n);if(typeof t!="number"||t===null)return h.Error("Delta is not a number in Clean()."),n;if(n.length===0||n.length==1&&n[0].length===0||t<0)return n;r||(n=[n]);for(var o=n.length,i,s,l,c,p,d,m,g=[],x=0;x<o;x++)if(s=n[x],i=s.length,i!==0){if(i<3){l=s,g.push(l);continue}for(l=s,c=t*t,p=s[0],d=1,m=1;m<i;m++)(s[m].X-p.X)*(s[m].X-p.X)+(s[m].Y-p.Y)*(s[m].Y-p.Y)<=c||(l[d]=s[m],p=s[m],d++);p=s[d-1],(s[0].X-p.X)*(s[0].X-p.X)+(s[0].Y-p.Y)*(s[0].Y-p.Y)<=c&&d--,d<i&&l.splice(d,i-d),l.length&&g.push(l)}return!r&&g.length?g=g[0]:!r&&g.length===0?g=[]:r&&g.length===0&&(g=[[]]),g};h.JS.Clone=function(e){if(!(e instanceof Array))return[];if(e.length===0)return[];if(e.length==1&&e[0].length===0)return[[]];var t=e[0]instanceof Array;t||(e=[e]);var r=e.length,n,o,i,s,l=new Array(r);for(o=0;o<r;o++){for(n=e[o].length,s=new Array(n),i=0;i<n;i++)s[i]={X:e[o][i].X,Y:e[o][i].Y};l[o]=s}return t||(l=l[0]),l};h.JS.Lighten=function(e,t){if(!(e instanceof Array))return[];if(typeof t!="number"||t===null)return h.Error("Tolerance is not a number in Lighten()."),h.JS.Clone(e);if(e.length===0||e.length==1&&e[0].length===0||t<0)return h.JS.Clone(e);e[0]instanceof Array||(e=[e]);var r,n,o,i,s,l,c,p,d,m,g,x,v,C,I,S,P,O=e.length,M=t*t,E=[];for(r=0;r<O;r++)if(o=e[r],l=o.length,l!=0){for(i=0;i<1e6;i++){for(s=[],l=o.length,o[l-1].X!=o[0].X||o[l-1].Y!=o[0].Y?(x=1,o.push({X:o[0].X,Y:o[0].Y}),l=o.length):x=0,g=[],n=0;n<l-2;n++)c=o[n],d=o[n+1],p=o[n+2],S=c.X,P=c.Y,v=p.X-S,C=p.Y-P,(v!==0||C!==0)&&(I=((d.X-S)*v+(d.Y-P)*C)/(v*v+C*C),I>1?(S=p.X,P=p.Y):I>0&&(S+=v*I,P+=C*I)),v=d.X-S,C=d.Y-P,m=v*v+C*C,m<=M&&(g[n+1]=1,n++);for(s.push({X:o[0].X,Y:o[0].Y}),n=1;n<l-1;n++)g[n]||s.push({X:o[n].X,Y:o[n].Y});if(s.push({X:o[l-1].X,Y:o[l-1].Y}),x&&o.pop(),g.length)o=s;else break}l=s.length,s[l-1].X==s[0].X&&s[l-1].Y==s[0].Y&&s.pop(),s.length>2&&E.push(s)}return!e[0]instanceof Array&&(E=E[0]),typeof E>"u"&&(E=[[]]),E};h.JS.PerimeterOfPath=function(e,t,r){if(typeof e>"u")return 0;var n=Math.sqrt,o=0,i,s,l=0,c=0,p=0,d=0,m=e.length;if(m<2)return 0;for(t&&(e[m]=e[0],m++);--m;)i=e[m],l=i.X,c=i.Y,s=e[m-1],p=s.X,d=s.Y,o+=n((l-p)*(l-p)+(c-d)*(c-d));return t&&e.pop(),o/r};h.JS.PerimeterOfPaths=function(e,t,r){r||(r=1);for(var n=0,o=0;o<e.length;o++)n+=h.JS.PerimeterOfPath(e[o],t,r);return n};h.JS.ScaleDownPath=function(e,t){var r,n;for(t||(t=1),r=e.length;r--;)n=e[r],n.X=n.X/t,n.Y=n.Y/t};h.JS.ScaleDownPaths=function(e,t){var r,n,o,i=Math.round;for(t||(t=1),r=e.length;r--;)for(n=e[r].length;n--;)o=e[r][n],o.X=o.X/t,o.Y=o.Y/t};h.JS.ScaleUpPath=function(e,t){var r,n,o=Math.round;for(t||(t=1),r=e.length;r--;)n=e[r],n.X=o(n.X*t),n.Y=o(n.Y*t)};h.JS.ScaleUpPaths=function(e,t){var r,n,o,i=Math.round;for(t||(t=1),r=e.length;r--;)for(n=e[r].length;n--;)o=e[r][n],o.X=i(o.X*t),o.Y=i(o.Y*t)};h.ExPolygons=function(){return[]};h.ExPolygon=function(){this.outer=null,this.holes=null};h.JS.AddOuterPolyNodeToExPolygons=function(e,t){var r=new h.ExPolygon;r.outer=e.Contour();var n=e.Childs(),o=n.length;r.holes=new Array(o);var i,s,l,c,p,d;for(l=0;l<o;l++)for(i=n[l],r.holes[l]=i.Contour(),c=0,p=i.Childs(),d=p.length;c<d;c++)s=p[c],h.JS.AddOuterPolyNodeToExPolygons(s,t);t.push(r)};h.JS.ExPolygonsToPaths=function(e){var t,r,n,o,i=new h.Paths;for(t=0,n=e.length;t<n;t++)for(i.push(e[t].outer),r=0,o=e[t].holes.length;r<o;r++)i.push(e[t].holes[r]);return i};h.JS.PolyTreeToExPolygons=function(e){var t=new h.ExPolygons,r,n,o,i;for(n=0,o=e.Childs(),i=o.length;n<i;n++)r=o[n],h.JS.AddOuterPolyNodeToExPolygons(r,t);return t};dg.exports=h});var AD=ri((KHe,_v)=>{u();(function(){"use strict";function e(s,l){var c=s.x-l.x,p=s.y-l.y;return c*c+p*p}function t(s,l,c){var p=l.x,d=l.y,m=c.x-p,g=c.y-d;if(m!==0||g!==0){var x=((s.x-p)*m+(s.y-d)*g)/(m*m+g*g);x>1?(p=c.x,d=c.y):x>0&&(p+=m*x,d+=g*x)}return m=s.x-p,g=s.y-d,m*m+g*g}function r(s,l){for(var c=s[0],p=[c],d,m=1,g=s.length;m<g;m++)d=s[m],e(d,c)>l&&(p.push(d),c=d);return c!==d&&p.push(d),p}function n(s,l,c,p,d){for(var m=p,g,x=l+1;x<c;x++){var v=t(s[x],s[l],s[c]);v>m&&(g=x,m=v)}m>p&&(g-l>1&&n(s,l,g,p,d),d.push(s[g]),c-g>1&&n(s,g,c,p,d))}function o(s,l){var c=s.length-1,p=[s[0]];return n(s,0,c,l,p),p.push(s[c]),p}function i(s,l,c){if(s.length<=2)return s;var p=l!==void 0?l*l:1;return s=c?s:r(s,p),s=o(s,p),s}typeof define=="function"&&define.amd?define(function(){return i}):typeof _v<"u"?(_v.exports=i,_v.exports.default=i):typeof self<"u"?self.simplify=i:window.simplify=i})()});u();u();u();u();u();u();var Tm=e=>e!=null;var $F=function(){let t=globalThis.fetch;return{fetch(...r){if(!Tm(t))throw new Error("fetch is not available in your environment. Pass your own function into `setFetchFn` (node-fetch, etc)");return t?.(...r)},setFetch(r){t=r}}}(),j5=$F.fetch;var $5=["websdk","web","webv2","kiosk-v2","mobile","iossdk","androidsdk","reactnativesdk","gen7","bespoke","reactsdk"],U5=$5[0],z5="https://api-gateway.mappedin.com/track-analytics/a/",X5="deny-watchposition",Z5="load-mapview",Y5="load-mapdata",J5="change-language",q5="query-directions";var es,Io,Js,p2,Ib,Su=class{constructor(){T(this,Js);T(this,es,Object.freeze({}));T(this,Io);f(this,"oneTimeEventsSent",new Set);f(this,"sendGetDirectionsEvent",qv((t,r,n)=>{let o={start:t,end:r,type:"location_to_location"};return n!==void 0&&(o.accessible=n),this.sendAnalyticEvent(q5,o)},2500));w(this,Io,z(this,Js,Ib).call(this,a(this,es)))}init(t){this.reset(),this.updateStateWithOptions(t)}reset(){w(this,es,{}),w(this,Io,z(this,Js,Ib).call(this,{})),this.oneTimeEventsSent.clear()}updateStateWithOptions(t){return w(this,es,Object.freeze(Object.assign({},a(this,es),t))),w(this,Io,z(this,Js,Ib).call(this,t)),z(this,Js,p2).call(this,a(this,Io)),a(this,Io)}updateState(t){let r={...t};r.mapId&&(r.analyticsBaseUrl=c2({...a(this,Io),mapId:r.mapId})),r.context&&(r.context=W5(r.context)),r.baseUri&&(r.analyticsBaseUrl=c2({baseUri:r.baseUri,mapId:a(this,Io).mapId})),Object.assign(a(this,Io),r),this.handleStateUpdate(t),z(this,Js,p2).call(this,r)}handleStateUpdate(t){t.userPosition?.floorLevel?this.sendBlueDotEvents("found-floor"):t.userPosition&&this.sendBlueDotEvents("found-position")}get authReady(){let{key:t,secret:r,accessToken:n}=this.getState();return!!(t&&r)||!!n}getState(){return a(this,Io)}getContext(){return this.getState().context||a(this,es).context||U5}getSessionId(){return this.getState().sessionId||a(this,es).sessionId||H5()}getDeviceId(){return this.getState().deviceId||a(this,es).deviceId||V5()}sendAnalyticEvent(t,r={}){let n=this.getState(),o=zF(n.analyticsBaseUrl,t),i={"mi-context":this.getContext(),"mi-session":this.getSessionId(),"mi-device":this.getDeviceId()};if(n.logEvents&&A.log("Analytics.track",o,i),!n.sendEvents)return Promise.resolve();if(!this.authReady)return A.warn("Auth needs to be ready to send analytics.");let s={...r,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)),j5(o,{method:"POST",mode:"cors",headers:i,body:JSON.stringify(s)})}capture(t,r){if(ZF.includes(t))return A.warn(`${t} event is sent internally.`),Promise.resolve();let n=XF.includes(t)?t.slice(1):t;return this.sendAnalyticEvent(n,r)}sendGetMapDataEvent(t){return this.sendAnalyticEvent(Y5,t)}sendChangeLanguageEvent(t){return this.sendAnalyticEvent(J5,t)}sendWatchPositionDenied(){return this.sendAnalyticEvent(X5)}sendMapViewLoadedEvent({firstRenderDuration:t,dimension:r,collisionWorkerDisabled:n,outdoorsWorkerDisabled:o}){return this.sendAnalyticEvent(Z5,{type:"3d",firstRenderDuration:t,width:r.width,height:r.height,devicePixelRatio:globalThis.devicePixelRatio||1,collisionWorkerDisabled:n,outdoorsWorkerDisabled:o})}sendBlueDotEvents(t){if(!((t==="found-floor"||t==="found-position")&&this.oneTimeEventsSent.has(t)))return this.oneTimeEventsSent.add(t),this.sendAnalyticEvent(t)}};es=new WeakMap,Io=new WeakMap,Js=new WeakSet,p2=function(t){t.sessionId&&Zs.getInstance().saveSessionData("id",t.sessionId),t.deviceId&&Zs.getInstance().saveLocalData("deviceId",t.deviceId)},Ib=function(t){let r=t.baseUri??z5;return{baseUri:r,analyticsBaseUrl:c2({...t,baseUri:r}),version:y?.env?.npm_package_version||"v6",deviceId:t.deviceId||V5(),accessToken:t.accessToken,mapId:t.mapId,sessionId:t.sessionId||H5(),platformString:t.platformString||"",context:W5(t.context)||U5,geolocationMode:!1,sendEvents:t.sendEvents??!0,logEvents:t.logEvents??!1,noAuth:t.noAuth||!1,key:t.key,secret:t.secret}};function c2({mapId:e,baseUri:t=z5}){return`${t}${e}/`}function V5(){return Zs.getInstance().loadLocalData("deviceId")}function H5(){return Zs.getInstance().loadSessionData("id")}function zF(e,t){return e+t}function W5(e){return $5.find(t=>t===e)}var XF=["$select-location","$select-category","$query-suggest","$query-search"],ZF=[Z5,Y5,q5,X5,J5],qte=new Su,So,Mm=class{constructor(t){T(this,So);f(this,"capture");f(this,"updateState");w(this,So,t),this.capture=a(this,So).capture.bind(a(this,So)),this.updateState=a(this,So).updateState.bind(a(this,So))}getState(){let{sessionId:t,deviceId:r,...n}=a(this,So).getState();return n}getContext(){return a(this,So).getContext()}getSessionId(){return a(this,So).getSessionId()}getDeviceId(){return a(this,So).getDeviceId()}};So=new WeakMap;u();u();var wm,Om,_m,Pm=class{constructor(t,r,{enabled:n=!1}={}){T(this,wm);f(this,"searchInstance");T(this,Om);T(this,_m);f(this,"enabled",!1);w(this,wm,t),w(this,Om,r),w(this,_m,()=>{this.searchInstance?.then(o=>o.populate())}),n&&this.enable()}async query(t,r={}){if(this.enabled||await this.enable(),!this.searchInstance)return A.error("Search should be enabled by now"),{places:[],enterpriseLocations:[],enterpriseCategories:[]};try{return await(await this.searchInstance).search(t,r)}catch(n){return A.error("Search.query failed due to",n),{places:[],enterpriseLocations:[],enterpriseCategories:[]}}}async suggest(t,r={}){if(this.enabled||await this.enable(),!this.searchInstance)return A.error("Search should be enabled by now"),[];try{return await(await this.searchInstance).suggest(t,r)}catch(n){return A.error("Search.suggest failed due to",n),[]}}async enable(){this.enabled||(this.enabled=!0,this.searchInstance||(this.searchInstance=import("./internal-MR2VGL5Y.js").then(({InternalSearch:t})=>new t(a(this,wm)))),a(this,Om).on("language-change",a(this,_m)),await this.searchInstance)}};wm=new WeakMap,Om=new WeakMap,_m=new WeakMap;var K5=new WeakMap,vc,Ht,u2=class{constructor(t,{search:r}={}){T(this,vc);T(this,Ht);f(this,"Analytics");f(this,"Search");f(this,"Query");f(this,"internal");f(this,"on",(t,r)=>{a(this,vc).on(t,r)});f(this,"off",(t,r)=>{a(this,vc).off(t,r)});f(this,"__LEGACY_GET_DIRECTIONS_SYNC",(t,r,n)=>a(this,Ht).__LEGACY_GET_DIRECTIONS_SYNC(t,r,n));f(this,"getDirections",(t,r,n)=>a(this,Ht).getDirections(t,r,n));f(this,"__LEGACY_GET_DIRECTIONS_MULTI_DESTINATION_SYNC",(t,r,n)=>a(this,Ht).__LEGACY_GET_DIRECTIONS_MULTI_DESTINATION_SYNC(t,r,n));f(this,"getDirectionsMultiDestination",(t,r,n)=>a(this,Ht).getDirectionsMultiDestination(t,r,n));w(this,vc,new Fe),w(this,Ht,t),K5.set(this,t),this.Analytics=new Mm(t.Analytics),this.Query=t.Query,this.internal=t,this.Search=new Pm(this,t,{enabled:r?.enabled}),a(this,Ht).on("language-change",n=>{a(this,vc).publish("language-change",n)})}getEnv(){return a(this,Ht).getEnv()}getAccessToken(){return a(this,Ht).tokenManager?.getAccessToken().token}get mapName(){return a(this,Ht).mapName}get mapId(){return a(this,Ht).getMapDataOptions?.mapId}get mapCenter(){return a(this,Ht).mapCenter}get organizationId(){return a(this,Ht).organizationId}get outdoorViewToken(){return a(this,Ht).outdoorViewToken}getByType(t){return a(this,Ht).getByType(t)}getById(t,r){return a(this,Ht).getById(t,r)}getByExternalId(t,r){return a(this,Ht).getByExternalId(t,r)}getGeoJSON(t){return t.geoJSON}async changeLanguage(t){return a(this,Ht).changeLanguage(t)}get currentLanguage(){return a(this,Ht).currentLanguage}get naturalBearing(){return a(this,Ht).naturalBearing??0}getDistance(t,r){return a(this,Ht).getDistance(t,r)}toBinaryBundle({downloadLanguagePacks:t=!0}={}){return a(this,Ht).toBinaryBundle({downloadLanguagePacks:t})}toJSONBundle({downloadLanguagePacks:t=!0}={}){return a(this,Ht).toJSONBundle({downloadLanguagePacks:t})}};vc=new WeakMap,Ht=new WeakMap;var Em=u2;function Dm(e){let t=K5.get(e);if(!t)throw new Error("MapDataInternal not found");return t}u();u();u();u();u();u();u();u();u();u();u();u();u();u();u();u();u();u();u();u();u();u();u();u();u();u();u();u();var ot={};zs(ot,{HasPropertyKey:()=>YF,IsArray:()=>un,IsAsyncIterator:()=>d2,IsBigInt:()=>Fm,IsBoolean:()=>pl,IsDate:()=>Ic,IsFunction:()=>f2,IsIterator:()=>m2,IsNull:()=>h2,IsNumber:()=>li,IsObject:()=>wt,IsRegExp:()=>km,IsString:()=>Gt,IsSymbol:()=>g2,IsUint8Array:()=>qs,IsUndefined:()=>sr});u();function YF(e,t){return t in e}function d2(e){return wt(e)&&!un(e)&&!qs(e)&&Symbol.asyncIterator in e}function un(e){return Array.isArray(e)}function Fm(e){return typeof e=="bigint"}function pl(e){return typeof e=="boolean"}function Ic(e){return e instanceof globalThis.Date}function f2(e){return typeof e=="function"}function m2(e){return wt(e)&&!un(e)&&!qs(e)&&Symbol.iterator in e}function h2(e){return e===null}function li(e){return typeof e=="number"}function wt(e){return typeof e=="object"&&e!==null}function km(e){return e instanceof globalThis.RegExp}function Gt(e){return typeof e=="string"}function g2(e){return typeof e=="symbol"}function qs(e){return e instanceof globalThis.Uint8Array}function sr(e){return e===void 0}function JF(e){return e.map(t=>Sb(t))}function qF(e){return new Date(e.getTime())}function KF(e){return new Uint8Array(e)}function QF(e){return new RegExp(e.source,e.flags)}function ek(e){let t={};for(let r of Object.getOwnPropertyNames(e))t[r]=Sb(e[r]);for(let r of Object.getOwnPropertySymbols(e))t[r]=Sb(e[r]);return t}function Sb(e){return un(e)?JF(e):Ic(e)?qF(e):qs(e)?KF(e):km(e)?QF(e):wt(e)?ek(e):e}function Wt(e){return Sb(e)}function Q5(e){return e.map(t=>Am(t))}function Am(e,t){return t===void 0?Wt(e):Wt({...t,...e})}u();u();u();function Cb(e){return Be(e)&&Symbol.asyncIterator in e}function Tb(e){return Be(e)&&Symbol.iterator in e}function y2(e){return Be(e)&&(Object.getPrototypeOf(e)===Object.prototype||Object.getPrototypeOf(e)===null)}function Mb(e){return e instanceof Promise}function Cn(e){return e instanceof Date&&Number.isFinite(e.getTime())}function eM(e){return e instanceof globalThis.Map}function tM(e){return e instanceof globalThis.Set}function Co(e){return ArrayBuffer.isView(e)}function Cu(e){return e instanceof globalThis.Uint8Array}function Me(e,t){return t in e}function Be(e){return e!==null&&typeof e=="object"}function ke(e){return Array.isArray(e)&&!ArrayBuffer.isView(e)}function ar(e){return e===void 0}function Ks(e){return e===null}function ts(e){return typeof e=="boolean"}function he(e){return typeof e=="number"}function Pb(e){return Number.isInteger(e)}function Jr(e){return typeof e=="bigint"}function Qe(e){return typeof e=="string"}function ul(e){return typeof e=="function"}function Qs(e){return typeof e=="symbol"}function qr(e){return Jr(e)||ts(e)||Ks(e)||he(e)||Qe(e)||Qs(e)||ar(e)}var vt;(function(e){e.InstanceMode="default",e.ExactOptionalPropertyTypes=!1,e.AllowArrayObject=!1,e.AllowNaN=!1,e.AllowNullVoid=!1;function t(s,l){return e.ExactOptionalPropertyTypes?l in s:s[l]!==void 0}e.IsExactOptionalProperty=t;function r(s){let l=Be(s);return e.AllowArrayObject?l:l&&!ke(s)}e.IsObjectLike=r;function n(s){return r(s)&&!(s instanceof Date)&&!(s instanceof Uint8Array)}e.IsRecordLike=n;function o(s){return e.AllowNaN?he(s):Number.isFinite(s)}e.IsNumberLike=o;function i(s){let l=ar(s);return e.AllowNullVoid?l||s===null:l}e.IsVoidLike=i})(vt||(vt={}));u();function tk(e){return globalThis.Object.freeze(e).map(t=>Lm(t))}function rk(e){let t={};for(let r of Object.getOwnPropertyNames(e))t[r]=Lm(e[r]);for(let r of Object.getOwnPropertySymbols(e))t[r]=Lm(e[r]);return globalThis.Object.freeze(t)}function Lm(e){return un(e)?tk(e):Ic(e)?e:qs(e)?e:km(e)?e:wt(e)?rk(e):e}function $(e,t){let r=t!==void 0?{...t,...e}:e;switch(vt.InstanceMode){case"freeze":return Lm(r);case"clone":return Wt(r);default:return r}}u();var ve=class extends Error{constructor(t){super(t)}};u();u();u();var $t=Symbol.for("TypeBox.Transform"),ea=Symbol.for("TypeBox.Readonly"),Tn=Symbol.for("TypeBox.Optional"),To=Symbol.for("TypeBox.Hint"),U=Symbol.for("TypeBox.Kind");function rM(e){return wt(e)&&e[ea]==="Readonly"}function rs(e){return wt(e)&&e[Tn]==="Optional"}function b2(e){return it(e,"Any")}function ta(e){return it(e,"Array")}function Rm(e){return it(e,"AsyncIterator")}function x2(e){return it(e,"BigInt")}function v2(e){return it(e,"Boolean")}function Bm(e){return it(e,"Constructor")}function nk(e){return it(e,"Date")}function Nm(e){return it(e,"Function")}function Sc(e){return it(e,"Integer")}function br(e){return it(e,"Intersect")}function Gm(e){return it(e,"Iterator")}function it(e,t){return wt(e)&&U in e&&e[U]===t}function ra(e){return it(e,"Literal")}function no(e){return it(e,"MappedKey")}function zt(e){return it(e,"MappedResult")}function dl(e){return it(e,"Never")}function ok(e){return it(e,"Not")}function ik(e){return it(e,"Null")}function Cc(e){return it(e,"Number")}function Mr(e){return it(e,"Object")}function Tc(e){return it(e,"Promise")}function I2(e){return it(e,"Record")}function S2(e){return it(e,"Ref")}function C2(e){return it(e,"RegExp")}function jm(e){return it(e,"String")}function sk(e){return it(e,"Symbol")}function oo(e){return it(e,"TemplateLiteral")}function ak(e){return it(e,"This")}function Tu(e){return wt(e)&&$t in e}function ci(e){return it(e,"Tuple")}function lk(e){return it(e,"Undefined")}function ft(e){return it(e,"Union")}function ck(e){return it(e,"Uint8Array")}function pk(e){return it(e,"Unknown")}function uk(e){return it(e,"Unsafe")}function dk(e){return it(e,"Void")}function fl(e){return wt(e)&&U in e&&Gt(e[U])}function pi(e){return b2(e)||ta(e)||v2(e)||x2(e)||Rm(e)||Bm(e)||nk(e)||Nm(e)||Sc(e)||br(e)||Gm(e)||ra(e)||no(e)||zt(e)||dl(e)||ok(e)||ik(e)||Cc(e)||Mr(e)||Tc(e)||I2(e)||S2(e)||C2(e)||jm(e)||sk(e)||oo(e)||ak(e)||ci(e)||lk(e)||ft(e)||ck(e)||pk(e)||uk(e)||dk(e)||fl(e)}var F={};zs(F,{IsAny:()=>sM,IsArray:()=>aM,IsAsyncIterator:()=>lM,IsBigInt:()=>cM,IsBoolean:()=>pM,IsConstructor:()=>uM,IsDate:()=>dM,IsFunction:()=>fM,IsInteger:()=>mM,IsIntersect:()=>hM,IsIterator:()=>gM,IsKind:()=>jM,IsKindOf:()=>tt,IsLiteral:()=>Vm,IsLiteralBoolean:()=>xk,IsLiteralNumber:()=>bM,IsLiteralString:()=>yM,IsLiteralValue:()=>xM,IsMappedKey:()=>vM,IsMappedResult:()=>IM,IsNever:()=>SM,IsNot:()=>CM,IsNull:()=>TM,IsNumber:()=>MM,IsObject:()=>PM,IsOptional:()=>bk,IsPromise:()=>wM,IsProperties:()=>w2,IsReadonly:()=>yk,IsRecord:()=>OM,IsRecursive:()=>vk,IsRef:()=>_M,IsRegExp:()=>EM,IsSchema:()=>et,IsString:()=>DM,IsSymbol:()=>FM,IsTemplateLiteral:()=>kM,IsThis:()=>AM,IsTransform:()=>jt,IsTuple:()=>LM,IsUint8Array:()=>RM,IsUndefined:()=>Mu,IsUnion:()=>O2,IsUnionLiteral:()=>Ik,IsUnknown:()=>BM,IsUnsafe:()=>NM,IsVoid:()=>GM,TypeGuardUnknownTypeError:()=>T2});u();var T2=class extends ve{},mk=["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 nM(e){try{return new RegExp(e),!0}catch{return!1}}function M2(e){if(!Gt(e))return!1;for(let t=0;t<e.length;t++){let r=e.charCodeAt(t);if(r>=7&&r<=13||r===27||r===127)return!1}return!0}function oM(e){return P2(e)||et(e)}function Um(e){return sr(e)||Fm(e)}function At(e){return sr(e)||li(e)}function P2(e){return sr(e)||pl(e)}function It(e){return sr(e)||Gt(e)}function hk(e){return sr(e)||Gt(e)&&M2(e)&&nM(e)}function gk(e){return sr(e)||Gt(e)&&M2(e)}function iM(e){return sr(e)||et(e)}function yk(e){return wt(e)&&e[ea]==="Readonly"}function bk(e){return wt(e)&&e[Tn]==="Optional"}function sM(e){return tt(e,"Any")&&It(e.$id)}function aM(e){return tt(e,"Array")&&e.type==="array"&&It(e.$id)&&et(e.items)&&At(e.minItems)&&At(e.maxItems)&&P2(e.uniqueItems)&&iM(e.contains)&&At(e.minContains)&&At(e.maxContains)}function lM(e){return tt(e,"AsyncIterator")&&e.type==="AsyncIterator"&&It(e.$id)&&et(e.items)}function cM(e){return tt(e,"BigInt")&&e.type==="bigint"&&It(e.$id)&&Um(e.exclusiveMaximum)&&Um(e.exclusiveMinimum)&&Um(e.maximum)&&Um(e.minimum)&&Um(e.multipleOf)}function pM(e){return tt(e,"Boolean")&&e.type==="boolean"&&It(e.$id)}function uM(e){return tt(e,"Constructor")&&e.type==="Constructor"&&It(e.$id)&&un(e.parameters)&&e.parameters.every(t=>et(t))&&et(e.returns)}function dM(e){return tt(e,"Date")&&e.type==="Date"&&It(e.$id)&&At(e.exclusiveMaximumTimestamp)&&At(e.exclusiveMinimumTimestamp)&&At(e.maximumTimestamp)&&At(e.minimumTimestamp)&&At(e.multipleOfTimestamp)}function fM(e){return tt(e,"Function")&&e.type==="Function"&&It(e.$id)&&un(e.parameters)&&e.parameters.every(t=>et(t))&&et(e.returns)}function mM(e){return tt(e,"Integer")&&e.type==="integer"&&It(e.$id)&&At(e.exclusiveMaximum)&&At(e.exclusiveMinimum)&&At(e.maximum)&&At(e.minimum)&&At(e.multipleOf)}function w2(e){return wt(e)&&Object.entries(e).every(([t,r])=>M2(t)&&et(r))}function hM(e){return tt(e,"Intersect")&&!(Gt(e.type)&&e.type!=="object")&&un(e.allOf)&&e.allOf.every(t=>et(t)&&!jt(t))&&It(e.type)&&(P2(e.unevaluatedProperties)||iM(e.unevaluatedProperties))&&It(e.$id)}function gM(e){return tt(e,"Iterator")&&e.type==="Iterator"&&It(e.$id)&&et(e.items)}function tt(e,t){return wt(e)&&U in e&&e[U]===t}function yM(e){return Vm(e)&&Gt(e.const)}function bM(e){return Vm(e)&&li(e.const)}function xk(e){return Vm(e)&&pl(e.const)}function Vm(e){return tt(e,"Literal")&&It(e.$id)&&xM(e.const)}function xM(e){return pl(e)||li(e)||Gt(e)}function vM(e){return tt(e,"MappedKey")&&un(e.keys)&&e.keys.every(t=>li(t)||Gt(t))}function IM(e){return tt(e,"MappedResult")&&w2(e.properties)}function SM(e){return tt(e,"Never")&&wt(e.not)&&Object.getOwnPropertyNames(e.not).length===0}function CM(e){return tt(e,"Not")&&et(e.not)}function TM(e){return tt(e,"Null")&&e.type==="null"&&It(e.$id)}function MM(e){return tt(e,"Number")&&e.type==="number"&&It(e.$id)&&At(e.exclusiveMaximum)&&At(e.exclusiveMinimum)&&At(e.maximum)&&At(e.minimum)&&At(e.multipleOf)}function PM(e){return tt(e,"Object")&&e.type==="object"&&It(e.$id)&&w2(e.properties)&&oM(e.additionalProperties)&&At(e.minProperties)&&At(e.maxProperties)}function wM(e){return tt(e,"Promise")&&e.type==="Promise"&&It(e.$id)&&et(e.item)}function OM(e){return tt(e,"Record")&&e.type==="object"&&It(e.$id)&&oM(e.additionalProperties)&&wt(e.patternProperties)&&(t=>{let r=Object.getOwnPropertyNames(t.patternProperties);return r.length===1&&nM(r[0])&&wt(t.patternProperties)&&et(t.patternProperties[r[0]])})(e)}function vk(e){return wt(e)&&To in e&&e[To]==="Recursive"}function _M(e){return tt(e,"Ref")&&It(e.$id)&&Gt(e.$ref)}function EM(e){return tt(e,"RegExp")&&It(e.$id)&&Gt(e.source)&&Gt(e.flags)&&At(e.maxLength)&&At(e.minLength)}function DM(e){return tt(e,"String")&&e.type==="string"&&It(e.$id)&&At(e.minLength)&&At(e.maxLength)&&hk(e.pattern)&&gk(e.format)}function FM(e){return tt(e,"Symbol")&&e.type==="symbol"&&It(e.$id)}function kM(e){return tt(e,"TemplateLiteral")&&e.type==="string"&&Gt(e.pattern)&&e.pattern[0]==="^"&&e.pattern[e.pattern.length-1]==="$"}function AM(e){return tt(e,"This")&&It(e.$id)&&Gt(e.$ref)}function jt(e){return wt(e)&&$t in e}function LM(e){return tt(e,"Tuple")&&e.type==="array"&&It(e.$id)&&li(e.minItems)&&li(e.maxItems)&&e.minItems===e.maxItems&&(sr(e.items)&&sr(e.additionalItems)&&e.minItems===0||un(e.items)&&e.items.every(t=>et(t)))}function Mu(e){return tt(e,"Undefined")&&e.type==="undefined"&&It(e.$id)}function Ik(e){return O2(e)&&e.anyOf.every(t=>yM(t)||bM(t))}function O2(e){return tt(e,"Union")&&It(e.$id)&&wt(e)&&un(e.anyOf)&&e.anyOf.every(t=>et(t))}function RM(e){return tt(e,"Uint8Array")&&e.type==="Uint8Array"&&It(e.$id)&&At(e.minByteLength)&&At(e.maxByteLength)}function BM(e){return tt(e,"Unknown")&&It(e.$id)}function NM(e){return tt(e,"Unsafe")}function GM(e){return tt(e,"Void")&&e.type==="void"&&It(e.$id)}function jM(e){return wt(e)&&U in e&&Gt(e[U])&&!mk.includes(e[U])}function et(e){return wt(e)&&(sM(e)||aM(e)||pM(e)||cM(e)||lM(e)||uM(e)||dM(e)||fM(e)||mM(e)||hM(e)||gM(e)||Vm(e)||vM(e)||IM(e)||SM(e)||CM(e)||TM(e)||MM(e)||PM(e)||wM(e)||OM(e)||_M(e)||EM(e)||DM(e)||FM(e)||kM(e)||AM(e)||LM(e)||Mu(e)||O2(e)||RM(e)||BM(e)||NM(e)||GM(e)||jM(e))}u();var _2="(true|false)",Hm="(0|[1-9][0-9]*)",E2="(.*)",Sk="(?!.*)",Ene=`^${_2}$`,na=`^${Hm}$`,oa=`^${E2}$`,UM=`^${Sk}$`;u();var Bn={};zs(Bn,{Clear:()=>Tk,Delete:()=>Mk,Entries:()=>Ck,Get:()=>Ok,Has:()=>Pk,Set:()=>wk});u();var Pu=new Map;function Ck(){return new Map(Pu)}function Tk(){return Pu.clear()}function Mk(e){return Pu.delete(e)}function Pk(e){return Pu.has(e)}function wk(e,t){Pu.set(e,t)}function Ok(e){return Pu.get(e)}var Nr={};zs(Nr,{Clear:()=>Ek,Delete:()=>Dk,Entries:()=>_k,Get:()=>Ak,Has:()=>Fk,Set:()=>kk});u();var wu=new Map;function _k(){return new Map(wu)}function Ek(){return wu.clear()}function Dk(e){return wu.delete(e)}function Fk(e){return wu.has(e)}function kk(e,t){wu.set(e,t)}function Ak(e){return wu.get(e)}u();function VM(e,t){return e.includes(t)}function HM(e){return[...new Set(e)]}function Lk(e,t){return e.filter(r=>t.includes(r))}function Rk(e,t){return e.reduce((r,n)=>Lk(r,n),t)}function WM(e){return e.length===1?e[0]:e.length>1?Rk(e.slice(1),e[0]):[]}function $M(e){let t=[];for(let r of e)t.push(...r);return t}u();function ml(e){return $({[U]:"Any"},e)}u();function wb(e,t){return $({[U]:"Array",type:"array",items:e},t)}u();function Ob(e,t){return $({[U]:"AsyncIterator",type:"AsyncIterator",items:e},t)}u();u();u();function Bk(e,t){let{[t]:r,...n}=e;return n}function fr(e,t){return t.reduce((r,n)=>Bk(r,n),e)}u();function St(e){return $({[U]:"Never",not:{}},e)}u();u();function st(e){return $({[U]:"MappedResult",properties:e})}u();u();function _b(e,t,r){return $({[U]:"Constructor",type:"Constructor",parameters:e,returns:t},r)}u();function hl(e,t,r){return $({[U]:"Function",type:"Function",parameters:e,returns:t},r)}u();u();u();u();function Wm(e,t){return $({[U]:"Union",anyOf:e},t)}function Nk(e){return e.some(t=>rs(t))}function zM(e){return e.map(t=>rs(t)?Gk(t):t)}function Gk(e){return fr(e,[Tn])}function jk(e,t){return Nk(e)?Nn(Wm(zM(e),t)):Wm(zM(e),t)}function ns(e,t){return e.length===0?St(t):e.length===1?$(e[0],t):jk(e,t)}u();function Ct(e,t){return e.length===0?St(t):e.length===1?$(e[0],t):Wm(e,t)}u();u();u();var Eb=class extends ve{};function Uk(e){return e.replace(/\\\$/g,"$").replace(/\\\*/g,"*").replace(/\\\^/g,"^").replace(/\\\|/g,"|").replace(/\\\(/g,"(").replace(/\\\)/g,")")}function D2(e,t,r){return e[t]===r&&e.charCodeAt(t-1)!==92}function ia(e,t){return D2(e,t,"(")}function $m(e,t){return D2(e,t,")")}function XM(e,t){return D2(e,t,"|")}function Vk(e){if(!(ia(e,0)&&$m(e,e.length-1)))return!1;let t=0;for(let r=0;r<e.length;r++)if(ia(e,r)&&(t+=1),$m(e,r)&&(t-=1),t===0&&r!==e.length-1)return!1;return!0}function Hk(e){return e.slice(1,e.length-1)}function Wk(e){let t=0;for(let r=0;r<e.length;r++)if(ia(e,r)&&(t+=1),$m(e,r)&&(t-=1),XM(e,r)&&t===0)return!0;return!1}function $k(e){for(let t=0;t<e.length;t++)if(ia(e,t))return!0;return!1}function zk(e){let[t,r]=[0,0],n=[];for(let i=0;i<e.length;i++)if(ia(e,i)&&(t+=1),$m(e,i)&&(t-=1),XM(e,i)&&t===0){let s=e.slice(r,i);s.length>0&&n.push(Ou(s)),r=i+1}let o=e.slice(r);return o.length>0&&n.push(Ou(o)),n.length===0?{type:"const",const:""}:n.length===1?n[0]:{type:"or",expr:n}}function Xk(e){function t(o,i){if(!ia(o,i))throw new Eb("TemplateLiteralParser: Index must point to open parens");let s=0;for(let l=i;l<o.length;l++)if(ia(o,l)&&(s+=1),$m(o,l)&&(s-=1),s===0)return[i,l];throw new Eb("TemplateLiteralParser: Unclosed group parens in expression")}function r(o,i){for(let s=i;s<o.length;s++)if(ia(o,s))return[i,s];return[i,o.length]}let n=[];for(let o=0;o<e.length;o++)if(ia(e,o)){let[i,s]=t(e,o),l=e.slice(i,s+1);n.push(Ou(l)),o=s}else{let[i,s]=r(e,o),l=e.slice(i,s);l.length>0&&n.push(Ou(l)),o=s-1}return n.length===0?{type:"const",const:""}:n.length===1?n[0]:{type:"and",expr:n}}function Ou(e){return Vk(e)?Ou(Hk(e)):Wk(e)?zk(e):$k(e)?Xk(e):{type:"const",const:Uk(e)}}function _u(e){return Ou(e.slice(1,e.length-1))}var F2=class extends ve{};function Zk(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 Yk(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 Jk(e){return e.type==="const"&&e.const===".*"}function Mc(e){return Zk(e)||Jk(e)?!1:Yk(e)?!0:e.type==="and"?e.expr.every(t=>Mc(t)):e.type==="or"?e.expr.every(t=>Mc(t)):e.type==="const"?!0:(()=>{throw new F2("Unknown expression type")})()}function Db(e){let t=_u(e.pattern);return Mc(t)}u();var k2=class extends ve{};function*ZM(e){if(e.length===1)return yield*e[0];for(let t of e[0])for(let r of ZM(e.slice(1)))yield`${t}${r}`}function*qk(e){return yield*ZM(e.expr.map(t=>[...zm(t)]))}function*Kk(e){for(let t of e.expr)yield*zm(t)}function*Qk(e){return yield e.const}function*zm(e){return e.type==="and"?yield*qk(e):e.type==="or"?yield*Kk(e):e.type==="const"?yield*Qk(e):(()=>{throw new k2("Unknown expression")})()}function Eu(e){let t=_u(e.pattern);return Mc(t)?[...zm(t)]:[]}u();u();function ht(e,t){return $({[U]:"Literal",const:e,type:typeof e},t)}u();function Fb(e){return $({[U]:"Boolean",type:"boolean"},e)}u();function Du(e){return $({[U]:"BigInt",type:"bigint"},e)}u();function os(e){return $({[U]:"Number",type:"number"},e)}u();function Mo(e){return $({[U]:"String",type:"string"},e)}function*eA(e){let t=e.trim().replace(/"|'/g,"");return t==="boolean"?yield Fb():t==="number"?yield os():t==="bigint"?yield Du():t==="string"?yield Mo():yield(()=>{let r=t.split("|").map(n=>ht(n.trim()));return r.length===0?St():r.length===1?r[0]:ns(r)})()}function*tA(e){if(e[1]!=="{"){let t=ht("$"),r=A2(e.slice(1));return yield*[t,...r]}for(let t=2;t<e.length;t++)if(e[t]==="}"){let r=eA(e.slice(2,t)),n=A2(e.slice(t+1));return yield*[...r,...n]}yield ht(e)}function*A2(e){for(let t=0;t<e.length;t++)if(e[t]==="$"){let r=ht(e.slice(0,t)),n=tA(e.slice(t));return yield*[r,...n]}yield ht(e)}function YM(e){return[...A2(e)]}u();var L2=class extends ve{};function rA(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function JM(e,t){return oo(e)?e.pattern.slice(1,e.pattern.length-1):ft(e)?`(${e.anyOf.map(r=>JM(r,t)).join("|")})`:Cc(e)?`${t}${Hm}`:Sc(e)?`${t}${Hm}`:x2(e)?`${t}${Hm}`:jm(e)?`${t}${E2}`:ra(e)?`${t}${rA(e.const.toString())}`:v2(e)?`${t}${_2}`:(()=>{throw new L2(`Unexpected Kind '${e[U]}'`)})()}function R2(e){return`^${e.map(t=>JM(t,"")).join("")}$`}u();function Pc(e){let r=Eu(e).map(n=>ht(n));return ns(r)}u();function kb(e,t){let r=Gt(e)?R2(YM(e)):R2(e);return $({[U]:"TemplateLiteral",type:"string",pattern:r},t)}function nA(e){return Eu(e).map(r=>r.toString())}function oA(e){let t=[];for(let r of e)t.push(...Gn(r));return t}function iA(e){return[e.toString()]}function Gn(e){return[...new Set(oo(e)?nA(e):ft(e)?oA(e.anyOf):ra(e)?iA(e.const):Cc(e)?["[number]"]:Sc(e)?["[number]"]:[])]}u();function sA(e,t,r){let n={};for(let o of Object.getOwnPropertyNames(t))n[o]=Fu(e,Gn(t[o]),r);return n}function aA(e,t,r){return sA(e,t.properties,r)}function qM(e,t,r){let n=aA(e,t,r);return st(n)}function QM(e,t){return e.map(r=>eP(r,t))}function lA(e){return e.filter(t=>!dl(t))}function cA(e,t){return Ab(lA(QM(e,t)))}function pA(e){return e.some(t=>dl(t))?[]:e}function uA(e,t){return ns(pA(QM(e,t)))}function dA(e,t){return t in e?e[t]:t==="[number]"?ns(e):St()}function fA(e,t){return t==="[number]"?e:St()}function mA(e,t){return t in e?e[t]:St()}function eP(e,t){return br(e)?cA(e.allOf,t):ft(e)?uA(e.anyOf,t):ci(e)?dA(e.items??[],t):ta(e)?fA(e.items,t):Mr(e)?mA(e.properties,t):St()}function Xm(e,t){return t.map(r=>eP(e,r))}function KM(e,t){return ns(Xm(e,t))}function Fu(e,t,r){return zt(t)?qM(e,t,r):no(t)?tP(e,t,r):$(pi(t)?KM(e,Gn(t)):KM(e,t),r)}function hA(e,t,r){return{[t]:Fu(e,[t],Wt(r))}}function gA(e,t,r){return t.reduce((n,o)=>({...n,...hA(e,o,r)}),{})}function yA(e,t,r){return gA(e,t.keys,r)}function tP(e,t,r){let n=yA(e,t,r);return st(n)}u();function Lb(e,t){return $({[U]:"Iterator",type:"Iterator",items:e},t)}u();function bA(e){let t=[];for(let r in e)rs(e[r])||t.push(r);return t}function xA(e,t){let r=bA(e),n=r.length>0?{[U]:"Object",type:"object",properties:e,required:r}:{[U]:"Object",type:"object",properties:e};return $(n,t)}var Ot=xA;u();function Rb(e,t){return $({[U]:"Promise",type:"Promise",item:e},t)}u();u();function vA(e){return $(fr(e,[ea]))}function IA(e){return $({...e,[ea]:"Readonly"})}function SA(e,t){return t===!1?vA(e):IA(e)}function Po(e,t){let r=t??!0;return zt(e)?rP(e,r):SA(e,r)}function CA(e,t){let r={};for(let n of globalThis.Object.getOwnPropertyNames(e))r[n]=Po(e[n],t);return r}function TA(e,t){return CA(e.properties,t)}function rP(e,t){let r=TA(e,t);return st(r)}u();function is(e,t){return $(e.length>0?{[U]:"Tuple",type:"array",items:e,additionalItems:!1,minItems:e.length,maxItems:e.length}:{[U]:"Tuple",type:"array",minItems:e.length,maxItems:e.length},t)}function nP(e,t){return e in t?wo(e,t[e]):st(t)}function MA(e){return{[e]:ht(e)}}function PA(e){let t={};for(let r of e)t[r]=ht(r);return t}function wA(e,t){return VM(t,e)?MA(e):PA(t)}function OA(e,t){let r=wA(e,t);return nP(e,r)}function Zm(e,t){return t.map(r=>wo(e,r))}function _A(e,t){let r={};for(let n of globalThis.Object.getOwnPropertyNames(t))r[n]=wo(e,t[n]);return r}function wo(e,t){let r={...t};return rs(t)?Nn(wo(e,fr(t,[Tn]))):rM(t)?Po(wo(e,fr(t,[ea]))):zt(t)?nP(e,t.properties):no(t)?OA(e,t.keys):Bm(t)?_b(Zm(e,t.parameters),wo(e,t.returns),r):Nm(t)?hl(Zm(e,t.parameters),wo(e,t.returns),r):Rm(t)?Ob(wo(e,t.items),r):Gm(t)?Lb(wo(e,t.items),r):br(t)?jn(Zm(e,t.allOf),r):ft(t)?Ct(Zm(e,t.anyOf),r):ci(t)?is(Zm(e,t.items??[]),r):Mr(t)?Ot(_A(e,t.properties),r):ta(t)?wb(wo(e,t.items),r):Tc(t)?Rb(wo(e,t.item),r):t}function EA(e,t){let r={};for(let n of e)r[n]=wo(n,t);return r}function oP(e,t,r){let n=pi(e)?Gn(e):e,o=t({[U]:"MappedKey",keys:n}),i=EA(n,o);return Ot(i,r)}u();function DA(e){return $(fr(e,[Tn]))}function FA(e){return $({...e,[Tn]:"Optional"})}function kA(e,t){return t===!1?DA(e):FA(e)}function Nn(e,t){let r=t??!0;return zt(e)?iP(e,r):kA(e,r)}function AA(e,t){let r={};for(let n of globalThis.Object.getOwnPropertyNames(e))r[n]=Nn(e[n],t);return r}function LA(e,t){return AA(e.properties,t)}function iP(e,t){let r=LA(e,t);return st(r)}u();function Ym(e,t={}){let r=e.every(o=>Mr(o)),n=pi(t.unevaluatedProperties)?{unevaluatedProperties:t.unevaluatedProperties}:{};return $(t.unevaluatedProperties===!1||pi(t.unevaluatedProperties)||r?{...n,[U]:"Intersect",type:"object",allOf:e}:{...n,[U]:"Intersect",allOf:e},t)}function RA(e){return e.every(t=>rs(t))}function BA(e){return fr(e,[Tn])}function sP(e){return e.map(t=>rs(t)?BA(t):t)}function NA(e,t){return RA(e)?Nn(Ym(sP(e),t)):Ym(sP(e),t)}function Ab(e,t={}){if(e.length===0)return St(t);if(e.length===1)return $(e[0],t);if(e.some(r=>Tu(r)))throw new Error("Cannot intersect transform types");return NA(e,t)}u();function jn(e,t){if(e.length===0)return St(t);if(e.length===1)return $(e[0],t);if(e.some(r=>Tu(r)))throw new Error("Cannot intersect transform types");return Ym(e,t)}function aP(e){return e.map(t=>B2(t))}function GA(e){return jn(aP(e))}function jA(e){return Ct(aP(e))}function UA(e){return B2(e)}function B2(e){return br(e)?GA(e.allOf):ft(e)?jA(e.anyOf):Tc(e)?UA(e.item):e}function lP(e,t){return $(B2(e),t)}u();u();u();u();function cP(e){let t=[];for(let r of e)t.push(Gr(r));return t}function VA(e){let t=cP(e);return $M(t)}function HA(e){let t=cP(e);return WM(t)}function WA(e){return e.map((t,r)=>r.toString())}function $A(e){return["[number]"]}function zA(e){return globalThis.Object.getOwnPropertyNames(e)}function XA(e){return N2?globalThis.Object.getOwnPropertyNames(e).map(r=>r[0]==="^"&&r[r.length-1]==="$"?r.slice(1,r.length-1):r):[]}function Gr(e){return br(e)?VA(e.allOf):ft(e)?HA(e.anyOf):ci(e)?WA(e.items??[]):ta(e)?$A(e.items):Mr(e)?zA(e.properties):I2(e)?XA(e.patternProperties):[]}var N2=!1;function sa(e){N2=!0;let t=Gr(e);return N2=!1,`^(${t.map(n=>`(${n})`).join("|")})$`}function ZA(e){return e.map(t=>t==="[number]"?os():ht(t))}function Bb(e,t){if(zt(e))return pP(e,t);{let r=Gr(e),n=ZA(r),o=ns(n);return $(o,t)}}function YA(e,t){let r={};for(let n of globalThis.Object.getOwnPropertyNames(e))r[n]=Bb(e[n],Wt(t));return r}function JA(e,t){return YA(e.properties,t)}function pP(e,t){let r=JA(e,t);return st(r)}u();function gl(e){let t=Gr(e),r=Xm(e,t);return t.map((n,o)=>[t[o],r[o]])}function qA(e){let t=[];for(let r of e)t.push(...Gr(r));return HM(t)}function KA(e){return e.filter(t=>!dl(t))}function QA(e,t){let r=[];for(let n of e)r.push(...Xm(n,[t]));return KA(r)}function eL(e,t){let r={};for(let n of t)r[n]=Ab(QA(e,n));return r}function uP(e,t){let r=qA(e),n=eL(e,r);return Ot(n,t)}u();u();function Nb(e){return $({[U]:"Date",type:"Date"},e)}u();function Gb(e){return $({[U]:"Null",type:"null"},e)}u();function jb(e){return $({[U]:"Symbol",type:"symbol"},e)}u();function Ub(e){return $({[U]:"Undefined",type:"undefined"},e)}u();function Vb(e){return $({[U]:"Uint8Array",type:"Uint8Array"},e)}u();function aa(e){return $({[U]:"Unknown"},e)}function tL(e){return e.map(t=>G2(t,!1))}function rL(e){let t={};for(let r of globalThis.Object.getOwnPropertyNames(e))t[r]=Po(G2(e[r],!1));return t}function Hb(e,t){return t===!0?e:Po(e)}function G2(e,t){return d2(e)?Hb(ml(),t):m2(e)?Hb(ml(),t):un(e)?Po(is(tL(e))):qs(e)?Vb():Ic(e)?Nb():wt(e)?Hb(Ot(rL(e)),t):f2(e)?Hb(hl([],aa()),t):sr(e)?Ub():h2(e)?Gb():g2(e)?jb():Fm(e)?Du():li(e)?ht(e):pl(e)?ht(e):Gt(e)?ht(e):Ot({})}function dP(e,t){return $(G2(e,!0),t)}u();function fP(e,t){return is(e.parameters,t)}u();function Jm(e,t){return e.map(r=>ui(r,t))}function nL(e,t){let r={};for(let n of globalThis.Object.getOwnPropertyNames(e))r[n]=ui(e[n],t);return r}function oL(e,t){return e.parameters=Jm(e.parameters,t),e.returns=ui(e.returns,t),e}function iL(e,t){return e.parameters=Jm(e.parameters,t),e.returns=ui(e.returns,t),e}function sL(e,t){return e.allOf=Jm(e.allOf,t),e}function aL(e,t){return e.anyOf=Jm(e.anyOf,t),e}function lL(e,t){return sr(e.items)||(e.items=Jm(e.items,t)),e}function cL(e,t){return e.items=ui(e.items,t),e}function pL(e,t){return e.properties=nL(e.properties,t),e}function uL(e,t){return e.item=ui(e.item,t),e}function dL(e,t){return e.items=ui(e.items,t),e}function fL(e,t){return e.items=ui(e.items,t),e}function mL(e,t){let r=t.find(o=>o.$id===e.$ref);if(r===void 0)throw Error(`Unable to dereference schema with $id ${e.$ref}`);let n=fr(r,["$id"]);return ui(n,t)}function hL(e,t){return Bm(e)?oL(e,t):Nm(e)?iL(e,t):br(e)?sL(e,t):ft(e)?aL(e,t):ci(e)?lL(e,t):ta(e)?cL(e,t):Mr(e)?pL(e,t):Tc(e)?uL(e,t):Rm(e)?dL(e,t):Gm(e)?fL(e,t):S2(e)?mL(e,t):e}function ui(e,t){return hL(Am(e),Q5(t))}u();function mP(e,t){if(sr(e))throw new Error("Enum undefined or empty");let r=globalThis.Object.getOwnPropertyNames(e).filter(i=>isNaN(i)).map(i=>e[i]),o=[...new Set(r)].map(i=>ht(i));return Ct(o,{...t,[To]:"Enum"})}u();u();u();var U2=class extends ve{},H;(function(e){e[e.Union=0]="Union",e[e.True=1]="True",e[e.False=2]="False"})(H||(H={}));function Oo(e){return e===H.False?e:H.True}function ku(e){throw new U2(e)}function Ir(e){return F.IsNever(e)||F.IsIntersect(e)||F.IsUnion(e)||F.IsUnknown(e)||F.IsAny(e)}function Sr(e,t){return F.IsNever(t)?IP(e,t):F.IsIntersect(t)?Wb(e,t):F.IsUnion(t)?$2(e,t):F.IsUnknown(t)?MP(e,t):F.IsAny(t)?W2(e,t):ku("StructuralRight")}function W2(e,t){return H.True}function gL(e,t){return F.IsIntersect(t)?Wb(e,t):F.IsUnion(t)&&t.anyOf.some(r=>F.IsAny(r)||F.IsUnknown(r))?H.True:F.IsUnion(t)?H.Union:F.IsUnknown(t)||F.IsAny(t)?H.True:H.Union}function yL(e,t){return F.IsUnknown(e)?H.False:F.IsAny(e)?H.Union:F.IsNever(e)?H.True:H.False}function bL(e,t){return F.IsObject(t)&&$b(t)?H.True:Ir(t)?Sr(e,t):F.IsArray(t)?Oo(Tt(e.items,t.items)):H.False}function xL(e,t){return Ir(t)?Sr(e,t):F.IsAsyncIterator(t)?Oo(Tt(e.items,t.items)):H.False}function vL(e,t){return Ir(t)?Sr(e,t):F.IsObject(t)?dn(e,t):F.IsRecord(t)?_o(e,t):F.IsBigInt(t)?H.True:H.False}function xP(e,t){return F.IsLiteralBoolean(e)||F.IsBoolean(e)?H.True:H.False}function IL(e,t){return Ir(t)?Sr(e,t):F.IsObject(t)?dn(e,t):F.IsRecord(t)?_o(e,t):F.IsBoolean(t)?H.True:H.False}function SL(e,t){return Ir(t)?Sr(e,t):F.IsObject(t)?dn(e,t):F.IsConstructor(t)?e.parameters.length>t.parameters.length?H.False:e.parameters.every((r,n)=>Oo(Tt(t.parameters[n],r))===H.True)?Oo(Tt(e.returns,t.returns)):H.False:H.False}function CL(e,t){return Ir(t)?Sr(e,t):F.IsObject(t)?dn(e,t):F.IsRecord(t)?_o(e,t):F.IsDate(t)?H.True:H.False}function TL(e,t){return Ir(t)?Sr(e,t):F.IsObject(t)?dn(e,t):F.IsFunction(t)?e.parameters.length>t.parameters.length?H.False:e.parameters.every((r,n)=>Oo(Tt(t.parameters[n],r))===H.True)?Oo(Tt(e.returns,t.returns)):H.False:H.False}function vP(e,t){return F.IsLiteral(e)&&ot.IsNumber(e.const)||F.IsNumber(e)||F.IsInteger(e)?H.True:H.False}function ML(e,t){return F.IsInteger(t)||F.IsNumber(t)?H.True:Ir(t)?Sr(e,t):F.IsObject(t)?dn(e,t):F.IsRecord(t)?_o(e,t):H.False}function Wb(e,t){return t.allOf.every(r=>Tt(e,r)===H.True)?H.True:H.False}function PL(e,t){return e.allOf.some(r=>Tt(r,t)===H.True)?H.True:H.False}function wL(e,t){return Ir(t)?Sr(e,t):F.IsIterator(t)?Oo(Tt(e.items,t.items)):H.False}function OL(e,t){return F.IsLiteral(t)&&t.const===e.const?H.True:Ir(t)?Sr(e,t):F.IsObject(t)?dn(e,t):F.IsRecord(t)?_o(e,t):F.IsString(t)?TP(e,t):F.IsNumber(t)?SP(e,t):F.IsInteger(t)?vP(e,t):F.IsBoolean(t)?xP(e,t):H.False}function IP(e,t){return H.False}function _L(e,t){return H.True}function hP(e){let[t,r]=[e,0];for(;F.IsNot(t);)t=t.not,r+=1;return r%2===0?t:aa()}function EL(e,t){return F.IsNot(e)?Tt(hP(e),t):F.IsNot(t)?Tt(e,hP(t)):ku("Invalid fallthrough for Not")}function DL(e,t){return Ir(t)?Sr(e,t):F.IsObject(t)?dn(e,t):F.IsRecord(t)?_o(e,t):F.IsNull(t)?H.True:H.False}function SP(e,t){return F.IsLiteralNumber(e)||F.IsNumber(e)||F.IsInteger(e)?H.True:H.False}function FL(e,t){return Ir(t)?Sr(e,t):F.IsObject(t)?dn(e,t):F.IsRecord(t)?_o(e,t):F.IsInteger(t)||F.IsNumber(t)?H.True:H.False}function Un(e,t){return Object.getOwnPropertyNames(e.properties).length===t}function gP(e){return $b(e)}function yP(e){return Un(e,0)||Un(e,1)&&"description"in e.properties&&F.IsUnion(e.properties.description)&&e.properties.description.anyOf.length===2&&(F.IsString(e.properties.description.anyOf[0])&&F.IsUndefined(e.properties.description.anyOf[1])||F.IsString(e.properties.description.anyOf[1])&&F.IsUndefined(e.properties.description.anyOf[0]))}function j2(e){return Un(e,0)}function bP(e){return Un(e,0)}function kL(e){return Un(e,0)}function AL(e){return Un(e,0)}function LL(e){return $b(e)}function RL(e){let t=os();return Un(e,0)||Un(e,1)&&"length"in e.properties&&Oo(Tt(e.properties.length,t))===H.True}function BL(e){return Un(e,0)}function $b(e){let t=os();return Un(e,0)||Un(e,1)&&"length"in e.properties&&Oo(Tt(e.properties.length,t))===H.True}function NL(e){let t=hl([ml()],ml());return Un(e,0)||Un(e,1)&&"then"in e.properties&&Oo(Tt(e.properties.then,t))===H.True}function CP(e,t){return Tt(e,t)===H.False||F.IsOptional(e)&&!F.IsOptional(t)?H.False:H.True}function dn(e,t){return F.IsUnknown(e)?H.False:F.IsAny(e)?H.Union:F.IsNever(e)||F.IsLiteralString(e)&&gP(t)||F.IsLiteralNumber(e)&&j2(t)||F.IsLiteralBoolean(e)&&bP(t)||F.IsSymbol(e)&&yP(t)||F.IsBigInt(e)&&kL(t)||F.IsString(e)&&gP(t)||F.IsSymbol(e)&&yP(t)||F.IsNumber(e)&&j2(t)||F.IsInteger(e)&&j2(t)||F.IsBoolean(e)&&bP(t)||F.IsUint8Array(e)&&LL(t)||F.IsDate(e)&&AL(t)||F.IsConstructor(e)&&BL(t)||F.IsFunction(e)&&RL(t)?H.True:F.IsRecord(e)&&F.IsString(V2(e))?t[To]==="Record"?H.True:H.False:F.IsRecord(e)&&F.IsNumber(V2(e))?Un(t,0)?H.True:H.False:H.False}function GL(e,t){return Ir(t)?Sr(e,t):F.IsRecord(t)?_o(e,t):F.IsObject(t)?(()=>{for(let r of Object.getOwnPropertyNames(t.properties)){if(!(r in e.properties)&&!F.IsOptional(t.properties[r]))return H.False;if(F.IsOptional(t.properties[r]))return H.True;if(CP(e.properties[r],t.properties[r])===H.False)return H.False}return H.True})():H.False}function jL(e,t){return Ir(t)?Sr(e,t):F.IsObject(t)&&NL(t)?H.True:F.IsPromise(t)?Oo(Tt(e.item,t.item)):H.False}function V2(e){return na in e.patternProperties?os():oa in e.patternProperties?Mo():ku("Unknown record key pattern")}function H2(e){return na in e.patternProperties?e.patternProperties[na]:oa in e.patternProperties?e.patternProperties[oa]:ku("Unable to get record value schema")}function _o(e,t){let[r,n]=[V2(t),H2(t)];return F.IsLiteralString(e)&&F.IsNumber(r)&&Oo(Tt(e,n))===H.True?H.True:F.IsUint8Array(e)&&F.IsNumber(r)||F.IsString(e)&&F.IsNumber(r)||F.IsArray(e)&&F.IsNumber(r)?Tt(e,n):F.IsObject(e)?(()=>{for(let o of Object.getOwnPropertyNames(e.properties))if(CP(n,e.properties[o])===H.False)return H.False;return H.True})():H.False}function UL(e,t){return Ir(t)?Sr(e,t):F.IsObject(t)?dn(e,t):F.IsRecord(t)?Tt(H2(e),H2(t)):H.False}function VL(e,t){let r=F.IsRegExp(e)?Mo():e,n=F.IsRegExp(t)?Mo():t;return Tt(r,n)}function TP(e,t){return F.IsLiteral(e)&&ot.IsString(e.const)||F.IsString(e)?H.True:H.False}function HL(e,t){return Ir(t)?Sr(e,t):F.IsObject(t)?dn(e,t):F.IsRecord(t)?_o(e,t):F.IsString(t)?H.True:H.False}function WL(e,t){return Ir(t)?Sr(e,t):F.IsObject(t)?dn(e,t):F.IsRecord(t)?_o(e,t):F.IsSymbol(t)?H.True:H.False}function $L(e,t){return F.IsTemplateLiteral(e)?Tt(Pc(e),t):F.IsTemplateLiteral(t)?Tt(e,Pc(t)):ku("Invalid fallthrough for TemplateLiteral")}function zL(e,t){return F.IsArray(t)&&e.items!==void 0&&e.items.every(r=>Tt(r,t.items)===H.True)}function XL(e,t){return F.IsNever(e)?H.True:F.IsUnknown(e)?H.False:F.IsAny(e)?H.Union:H.False}function ZL(e,t){return Ir(t)?Sr(e,t):F.IsObject(t)&&$b(t)||F.IsArray(t)&&zL(e,t)?H.True:F.IsTuple(t)?ot.IsUndefined(e.items)&&!ot.IsUndefined(t.items)||!ot.IsUndefined(e.items)&&ot.IsUndefined(t.items)?H.False:ot.IsUndefined(e.items)&&!ot.IsUndefined(t.items)||e.items.every((r,n)=>Tt(r,t.items[n])===H.True)?H.True:H.False:H.False}function YL(e,t){return Ir(t)?Sr(e,t):F.IsObject(t)?dn(e,t):F.IsRecord(t)?_o(e,t):F.IsUint8Array(t)?H.True:H.False}function JL(e,t){return Ir(t)?Sr(e,t):F.IsObject(t)?dn(e,t):F.IsRecord(t)?_o(e,t):F.IsVoid(t)?QL(e,t):F.IsUndefined(t)?H.True:H.False}function $2(e,t){return t.anyOf.some(r=>Tt(e,r)===H.True)?H.True:H.False}function qL(e,t){return e.anyOf.every(r=>Tt(r,t)===H.True)?H.True:H.False}function MP(e,t){return H.True}function KL(e,t){return F.IsNever(t)?IP(e,t):F.IsIntersect(t)?Wb(e,t):F.IsUnion(t)?$2(e,t):F.IsAny(t)?W2(e,t):F.IsString(t)?TP(e,t):F.IsNumber(t)?SP(e,t):F.IsInteger(t)?vP(e,t):F.IsBoolean(t)?xP(e,t):F.IsArray(t)?yL(e,t):F.IsTuple(t)?XL(e,t):F.IsObject(t)?dn(e,t):F.IsUnknown(t)?H.True:H.False}function QL(e,t){return F.IsUndefined(e)||F.IsUndefined(e)?H.True:H.False}function eR(e,t){return F.IsIntersect(t)?Wb(e,t):F.IsUnion(t)?$2(e,t):F.IsUnknown(t)?MP(e,t):F.IsAny(t)?W2(e,t):F.IsObject(t)?dn(e,t):F.IsVoid(t)?H.True:H.False}function Tt(e,t){return F.IsTemplateLiteral(e)||F.IsTemplateLiteral(t)?$L(e,t):F.IsRegExp(e)||F.IsRegExp(t)?VL(e,t):F.IsNot(e)||F.IsNot(t)?EL(e,t):F.IsAny(e)?gL(e,t):F.IsArray(e)?bL(e,t):F.IsBigInt(e)?vL(e,t):F.IsBoolean(e)?IL(e,t):F.IsAsyncIterator(e)?xL(e,t):F.IsConstructor(e)?SL(e,t):F.IsDate(e)?CL(e,t):F.IsFunction(e)?TL(e,t):F.IsInteger(e)?ML(e,t):F.IsIntersect(e)?PL(e,t):F.IsIterator(e)?wL(e,t):F.IsLiteral(e)?OL(e,t):F.IsNever(e)?_L(e,t):F.IsNull(e)?DL(e,t):F.IsNumber(e)?FL(e,t):F.IsObject(e)?GL(e,t):F.IsRecord(e)?UL(e,t):F.IsString(e)?HL(e,t):F.IsSymbol(e)?WL(e,t):F.IsTuple(e)?ZL(e,t):F.IsPromise(e)?jL(e,t):F.IsUint8Array(e)?YL(e,t):F.IsUndefined(e)?JL(e,t):F.IsUnion(e)?qL(e,t):F.IsUnknown(e)?KL(e,t):F.IsVoid(e)?eR(e,t):ku(`Unknown left type operand '${e[U]}'`)}function yl(e,t){return Tt(e,t)}u();u();u();function tR(e,t,r,n,o){let i={};for(let s of globalThis.Object.getOwnPropertyNames(e))i[s]=Au(e[s],t,r,n,Wt(o));return i}function rR(e,t,r,n,o){return tR(e.properties,t,r,n,o)}function PP(e,t,r,n,o){let i=rR(e,t,r,n,o);return st(i)}function nR(e,t,r,n){let o=yl(e,t);return o===H.Union?Ct([r,n]):o===H.True?r:n}function Au(e,t,r,n,o){return zt(e)?PP(e,t,r,n,o):no(e)?$(wP(e,t,r,n,o)):$(nR(e,t,r,n),o)}function oR(e,t,r,n,o){return{[e]:Au(ht(e),t,r,n,Wt(o))}}function iR(e,t,r,n,o){return e.reduce((i,s)=>({...i,...oR(s,t,r,n,o)}),{})}function sR(e,t,r,n,o){return iR(e.keys,t,r,n,o)}function wP(e,t,r,n,o){let i=sR(e,t,r,n,o);return st(i)}u();function aR(e){return e.allOf.every(t=>la(t))}function lR(e){return e.anyOf.some(t=>la(t))}function cR(e){return!la(e.not)}function la(e){return e[U]==="Intersect"?aR(e):e[U]==="Union"?lR(e):e[U]==="Not"?cR(e):e[U]==="Undefined"}u();function OP(e,t){return Lu(Pc(e),t)}function pR(e,t){let r=e.filter(n=>yl(n,t)===H.False);return r.length===1?r[0]:Ct(r)}function Lu(e,t,r={}){return oo(e)?$(OP(e,t),r):zt(e)?$(_P(e,t),r):$(ft(e)?pR(e.anyOf,t):yl(e,t)!==H.False?St():e,r)}function uR(e,t){let r={};for(let n of globalThis.Object.getOwnPropertyNames(e))r[n]=Lu(e[n],t);return r}function dR(e,t){return uR(e.properties,t)}function _P(e,t){let r=dR(e,t);return st(r)}u();u();u();function EP(e,t){return Ru(Pc(e),t)}function fR(e,t){let r=e.filter(n=>yl(n,t)!==H.False);return r.length===1?r[0]:Ct(r)}function Ru(e,t,r){return oo(e)?$(EP(e,t),r):zt(e)?$(DP(e,t),r):$(ft(e)?fR(e.anyOf,t):yl(e,t)!==H.False?e:St(),r)}function mR(e,t){let r={};for(let n of globalThis.Object.getOwnPropertyNames(e))r[n]=Ru(e[n],t);return r}function hR(e,t){return mR(e.properties,t)}function DP(e,t){let r=hR(e,t);return st(r)}u();function FP(e,t){return $(e.returns,t)}u();function kP(e){return $({[U]:"Integer",type:"integer"},e)}u();u();u();function gR(e,t,r){return{[e]:di(ht(e),t,Wt(r))}}function yR(e,t,r){return e.reduce((o,i)=>({...o,...gR(i,t,r)}),{})}function bR(e,t,r){return yR(e.keys,t,r)}function AP(e,t,r){let n=bR(e,t,r);return st(n)}function xR(e){let[t,r]=[e.slice(0,1),e.slice(1)];return[t.toLowerCase(),r].join("")}function vR(e){let[t,r]=[e.slice(0,1),e.slice(1)];return[t.toUpperCase(),r].join("")}function IR(e){return e.toUpperCase()}function SR(e){return e.toLowerCase()}function CR(e,t,r){let n=_u(e.pattern);if(!Mc(n))return{...e,pattern:LP(e.pattern,t)};let s=[...zm(n)].map(p=>ht(p)),l=RP(s,t),c=Ct(l);return kb([c],r)}function LP(e,t){return typeof e=="string"?t==="Uncapitalize"?xR(e):t==="Capitalize"?vR(e):t==="Uppercase"?IR(e):t==="Lowercase"?SR(e):e:e.toString()}function RP(e,t){return e.map(r=>di(r,t))}function di(e,t,r={}){return no(e)?AP(e,t,r):oo(e)?CR(e,t,r):ft(e)?Ct(RP(e.anyOf,t),r):ra(e)?ht(LP(e.const,t),r):$(e,r)}function BP(e,t={}){return di(e,"Capitalize",t)}u();function NP(e,t={}){return di(e,"Lowercase",t)}u();function GP(e,t={}){return di(e,"Uncapitalize",t)}u();function jP(e,t={}){return di(e,"Uppercase",t)}u();function UP(e,t){return $({[U]:"Not",not:e},t)}u();u();u();function TR(e,t,r){let n={};for(let o of globalThis.Object.getOwnPropertyNames(e))n[o]=Bu(e[o],t,Wt(r));return n}function MR(e,t,r){return TR(e.properties,t,r)}function VP(e,t,r){let n=MR(e,t,r);return st(n)}function PR(e,t){return e.map(r=>z2(r,t))}function wR(e,t){return e.map(r=>z2(r,t))}function OR(e,t){let{[t]:r,...n}=e;return n}function _R(e,t){return t.reduce((r,n)=>OR(r,n),e)}function ER(e,t){let r=fr(e,[$t,"$id","required","properties"]),n=_R(e.properties,t);return Ot(n,r)}function z2(e,t){return br(e)?jn(PR(e.allOf,t)):ft(e)?Ct(wR(e.anyOf,t)):Mr(e)?ER(e,t):Ot({})}function Bu(e,t,r){if(no(t))return HP(e,t,r);if(zt(e))return VP(e,t,r);let n=pi(t)?Gn(t):t;return $({...z2(e,n),...r})}function DR(e,t,r){return{[t]:Bu(e,[t],Wt(r))}}function FR(e,t,r){return t.reduce((n,o)=>({...n,...DR(e,o,r)}),{})}function kR(e,t,r){return FR(e,t.keys,r)}function HP(e,t,r){let n=kR(e,t,r);return st(n)}u();function WP(e,t){return is(e.parameters,t)}u();u();function $P(e){return e.map(t=>zP(t))}function AR(e){let t={};for(let r of globalThis.Object.getOwnPropertyNames(e))t[r]=Nn(e[r]);return t}function LR(e){let t=fr(e,[$t,"$id","required","properties"]),r=AR(e.properties);return Ot(r,t)}function zP(e){return br(e)?jn($P(e.allOf)):ft(e)?Ct($P(e.anyOf)):Mr(e)?LR(e):Ot({})}function zb(e,t){return zt(e)?XP(e,t):$({...zP(e),...t})}function RR(e,t){let r={};for(let n of globalThis.Object.getOwnPropertyNames(e))r[n]=zb(e[n],Wt(t));return r}function BR(e,t){return RR(e.properties,t)}function XP(e,t){let r=BR(e,t);return st(r)}u();u();u();function NR(e,t,r){let n={};for(let o of globalThis.Object.getOwnPropertyNames(e))n[o]=Nu(e[o],t,Wt(r));return n}function GR(e,t,r){return NR(e.properties,t,r)}function ZP(e,t,r){let n=GR(e,t,r);return st(n)}function jR(e,t){return e.map(r=>X2(r,t))}function UR(e,t){return e.map(r=>X2(r,t))}function VR(e,t){let r={};for(let n of t)n in e&&(r[n]=e[n]);return r}function HR(e,t){let r=fr(e,[$t,"$id","required","properties"]),n=VR(e.properties,t);return Ot(n,r)}function X2(e,t){return br(e)?jn(jR(e.allOf,t)):ft(e)?Ct(UR(e.anyOf,t)):Mr(e)?HR(e,t):Ot({})}function Nu(e,t,r){if(no(t))return YP(e,t,r);if(zt(e))return ZP(e,t,r);let n=pi(t)?Gn(t):t;return $({...X2(e,n),...r})}function WR(e,t,r){return{[t]:Nu(e,[t],Wt(r))}}function $R(e,t,r){return t.reduce((n,o)=>({...n,...WR(e,o,r)}),{})}function zR(e,t,r){return $R(e,t.keys,r)}function YP(e,t,r){let n=zR(e,t,r);return st(n)}u();function JP(e){return Po(Nn(e))}u();function wc(e,t,r){return $({[U]:"Record",type:"object",patternProperties:{[e]:t}},r)}function Z2(e,t,r){let n={};for(let o of e)n[o]=t;return Ot(n,{...r,[To]:"Record"})}function XR(e,t,r){return Db(e)?Z2(Gn(e),t,r):wc(e.pattern,t,r)}function ZR(e,t,r){return Z2(Gn(Ct(e)),t,r)}function YR(e,t,r){return Z2([e.toString()],t,r)}function JR(e,t,r){return wc(e.source,t,r)}function qR(e,t,r){let n=sr(e.pattern)?oa:e.pattern;return wc(n,t,r)}function KR(e,t,r){return wc(oa,t,r)}function QR(e,t,r){return wc(UM,t,r)}function eB(e,t,r){return wc(na,t,r)}function tB(e,t,r){return wc(na,t,r)}function qP(e,t,r={}){return ft(e)?ZR(e.anyOf,t,r):oo(e)?XR(e,t,r):ra(e)?YR(e.const,t,r):Sc(e)?eB(e,t,r):Cc(e)?tB(e,t,r):C2(e)?JR(e,t,r):jm(e)?qR(e,t,r):b2(e)?KR(e,t,r):dl(e)?QR(e,t,r):St(r)}u();var rB=0;function KP(e,t={}){sr(t.$id)&&(t.$id=`T${rB++}`);let r=Am(e({[U]:"This",$ref:`${t.$id}`}));return r.$id=t.$id,$({[To]:"Recursive",...r},t)}u();function QP(e,t){if(Gt(e))return $({[U]:"Ref",$ref:e},t);if(sr(e.$id))throw new Error("Reference target type must specify an $id");return $({[U]:"Ref",$ref:e.$id},t)}u();function e4(e,t){let r=Gt(e)?new globalThis.RegExp(e):e;return $({[U]:"RegExp",type:"RegExp",source:r.source,flags:r.flags},t)}u();u();function t4(e){return e.map(t=>r4(t))}function nB(e){let t={};for(let r of globalThis.Object.getOwnPropertyNames(e))t[r]=fr(e[r],[Tn]);return t}function oB(e){let t=fr(e,[$t,"$id","required","properties"]),r=nB(e.properties);return Ot(r,t)}function r4(e){return br(e)?jn(t4(e.allOf)):ft(e)?Ct(t4(e.anyOf)):Mr(e)?oB(e):Ot({})}function Xb(e,t){return zt(e)?n4(e,t):$({...r4(e),...t})}function iB(e,t){let r={};for(let n of globalThis.Object.getOwnPropertyNames(e))r[n]=Xb(e[n],t);return r}function sB(e,t){return iB(e.properties,t)}function n4(e,t){let r=sB(e,t);return st(r)}u();function aB(e){return br(e)?e.allOf:ft(e)?e.anyOf:ci(e)?e.items??[]:[]}function o4(e){return aB(e)}u();function i4(e,t){return $(e.returns,t)}u();function s4(e){return JSON.parse(JSON.stringify(e))}u();var Y2=class{constructor(t){this.schema=t}Decode(t){return new J2(this.schema,t)}},J2=class{constructor(t,r){this.schema=t,this.decode=r}EncodeTransform(t,r){let i={Encode:s=>r[$t].Encode(t(s)),Decode:s=>this.decode(r[$t].Decode(s))};return{...r,[$t]:i}}EncodeSchema(t,r){let n={Decode:this.decode,Encode:t};return{...r,[$t]:n}}Encode(t){return Tu(this.schema)?this.EncodeTransform(t,this.schema):this.EncodeSchema(t,this.schema)}};function a4(e){return new Y2(e)}u();function Zb(e={}){return $({[U]:e[U]??"Unsafe"},e)}u();function l4(e){return $({[U]:"Void",type:"void"},e)}u();var q2={};zs(q2,{Any:()=>ml,Array:()=>wb,AsyncIterator:()=>Ob,Awaited:()=>lP,BigInt:()=>Du,Boolean:()=>Fb,Capitalize:()=>BP,Composite:()=>uP,Const:()=>dP,Constructor:()=>_b,ConstructorParameters:()=>fP,Date:()=>Nb,Deref:()=>ui,Enum:()=>mP,Exclude:()=>Lu,Extends:()=>Au,Extract:()=>Ru,Function:()=>hl,Index:()=>Fu,InstanceType:()=>FP,Integer:()=>kP,Intersect:()=>jn,Iterator:()=>Lb,KeyOf:()=>Bb,Literal:()=>ht,Lowercase:()=>NP,Mapped:()=>oP,Never:()=>St,Not:()=>UP,Null:()=>Gb,Number:()=>os,Object:()=>Ot,Omit:()=>Bu,Optional:()=>Nn,Parameters:()=>WP,Partial:()=>zb,Pick:()=>Nu,Promise:()=>Rb,Readonly:()=>Po,ReadonlyOptional:()=>JP,Record:()=>qP,Recursive:()=>KP,Ref:()=>QP,RegExp:()=>e4,Required:()=>Xb,Rest:()=>o4,ReturnType:()=>i4,Strict:()=>s4,String:()=>Mo,Symbol:()=>jb,TemplateLiteral:()=>kb,Transform:()=>a4,Tuple:()=>is,Uint8Array:()=>Vb,Uncapitalize:()=>GP,Undefined:()=>Ub,Union:()=>Ct,Unknown:()=>aa,Unsafe:()=>Zb,Uppercase:()=>jP,Void:()=>l4});u();var b=q2;u();var qm=b.Object({externalId:b.String({description:"An identifier that can be used to link this entity to data outside of the MVF."}),name:b.String({description:"The name of the entity."}),shortName:b.String({description:"A short name for the entity."}),description:b.String({description:"A description of the entity."}),icon:b.String({format:"uri",description:"A URL to an icon for the entity."})},{$id:"BaseDetails",description:"Additional information about a given entity."}),K2=b.Partial(qm,{$id:"Details",description:"Additional information about a given entity."}),io=b.Object({details:b.Optional(b.Ref(K2))},{$id:"WithDetails"}),Oc=e=>{let t=[...e].sort(),r=b.Pick(qm,e),n=b.Omit(qm,e);return b.Object({details:b.Intersect([r,b.Partial(n)])},{$id:`WithRequiredDetails_${t.join("_")}`})},Q2=[qm,K2];u();var Gu=b.Number({$id:"Longitude",minimum:-180,maximum:180,description:"A WGS 84-compatible longitude coordinate value."}),ju=b.Number({$id:"Latitude",minimum:-90,maximum:90,description:"A WGS 84-compatible latitude coordinate value."}),_c=b.Tuple([b.Ref(Gu),b.Ref(ju)],{$id:"Position",minItems:2,maxItems:2,description:"A valid WGS 84 position consisting of a longitude value, followed by a latitude value."}),fn=b.Object({type:b.Literal("Point"),coordinates:b.Ref(_c)},{$id:"Point",description:"An RFC-7946 compatible GeoJSON Point geometry."}),Yb=b.Object({type:b.Literal("MultiPoint"),coordinates:b.Array(b.Ref(_c))},{$id:"MultiPoint",description:"An RFC-7946 compatible GeoJSON MultiPoint geometry."}),Jb=b.Object({type:b.Literal("LineString"),coordinates:b.Array(b.Ref(_c),{minItems:2,description:"At least two positions are required."})},{$id:"LineString",description:"An RFC-7946 compatible GeoJSON LineString geometry."}),qb=b.Object({type:b.Literal("MultiLineString"),coordinates:b.Array(b.Array(b.Ref(_c),{minItems:2}))},{$id:"MultiLineString",description:"An RFC-7946 compatible GeoJSON MultiLineString geometry."}),c4=b.Array(b.Ref(_c),{$id:"LinearRing",minItems:4,description:"A linear ring is a building block of a polygon or multi-polygon."}),eI=b.Array(b.Ref(c4),{$id:"LinearRings",minItems:1,description:"A collection of linear rings, at least one of which is the exterior ring of a polygon."}),Uu=b.Object({type:b.Literal("Polygon"),coordinates:b.Ref(eI)},{$id:"Polygon",description:"An RFC-7946 compatible GeoJSON Polygon geometry."}),Vu=b.Object({type:b.Literal("MultiPolygon"),coordinates:b.Array(b.Ref(eI))},{$id:"MultiPolygon",description:"An RFC-7946 compatible GeoJSON MultiPolygon geometry."}),Kr=(e,t,r)=>b.Object({type:b.Literal("Feature"),geometry:e,properties:t},r),Mn=(e,t,r)=>b.Object({type:b.Literal("FeatureCollection"),features:b.Array(e,r)},t),tI=[Gu,ju,_c,fn,Yb,Jb,qb,c4,eI,Uu,Vu];u();var mr=(e,t)=>b.Unsafe(b.String({$id:t,pattern:`^${e}_[A-Za-z0-9-]+$`})),mn=mr("g","GeometryId"),Ze=mr("f","FloorId"),rI=[mn,Ze];u();u();u();var Kb=class{constructor(t){f(this,"_value");this._value=t}[Symbol.iterator](){return this}next(){if(this._value==null)return{done:!0,value:void 0};let t=this._value;return this._value=null,{done:!1,value:t}}},Qb=class{constructor(t){f(this,"_tag","Some");f(this,"_value");this._value=t}get value(){return this._value}isSome(){return!0}isSomeAnd(t){return t(this.value)}isNone(){return!1}equals(t){return t.isSome()&&t.value===this.value}expect(t){return this.value}unwrap(){return this.value}unwrapOr(t){return this.value}unwrapOrElse(t){return this.value}inspect(t){return t(this.value),this}inspectNone(t){return this}map(t){return p4(t(this.value))}mapAsync(t){return t(this.value).then(r=>p4(r))}mapOr(t,r){return this.map(t).unwrapOr(r)}mapOrAsync(t,r){return this.mapAsync(t).then(n=>n.unwrapOr(r))}mapOrElse(t,r){return this.map(t).unwrapOrElse(r)}mapOrElseAsync(t,r){return this.mapAsync(t).then(n=>n.unwrapOrElse(r))}and(t){return t}andThen(t){return t(this.value)}andThenAsync(t){return t(this.value)}filter(t){return t(this.value)?this:bl()}or(t){return this}orElse(t){return this}xor(t){return t.isSome()?bl():this}toString(){return`Some(${this.value})`}okOr(t){return ie(this.value)}okOrElse(t){return ie(this.value)}iter(){return new Kb(this.value)}[Symbol.iterator](){return this.iter()}zip(t){return t.isSome()?Hu([this.value,t.value]):bl()}zipWith(t,r){return t.isSome()?Hu(r(this.value,t.value)):bl()}get[Symbol.toStringTag](){return"Some"}},e1=class{constructor(){f(this,"_tag","None")}get value(){return null}isSome(){return!1}isSomeAnd(t){return!1}isNone(){return!0}equals(t){return t.isNone()}expect(t){throw new Error(t)}unwrap(){throw new Error("Tried to unwrap a None value!")}unwrapOr(t){return t}unwrapOrElse(t){return t()}inspect(t){return this}inspectNone(t){return t(),this}map(t){return this}mapAsync(t){return Promise.resolve(this)}mapOr(t,r){return r}mapOrAsync(t,r){return Promise.resolve(r)}mapOrElse(t,r){return r()}mapOrElseAsync(t,r){return r()}and(t){return this}andThen(t){return this}andThenAsync(t){return Promise.resolve(this)}filter(t){return this}or(t){return t}orElse(t){return t()}xor(t){return t}toString(){return"None"}okOr(t){return ae(t)}okOrElse(t){return ae(t())}iter(){return new Kb(null)}[Symbol.iterator](){return this.iter()}zip(t){return this}zipWith(t,r){return this}get[Symbol.toStringTag](){return"None"}},Hu=e=>new Qb(e),bl=()=>new e1,p4=e=>e instanceof Qb||e instanceof e1?e:e==null?bl():Hu(e);var t1=class{constructor(t){f(this,"_value");this._value=t}[Symbol.iterator](){return this}next(){if(this._value==null)return{done:!0,value:void 0};let t=this._value;return this._value=null,{done:!1,value:t}}},nI=class{constructor(t){f(this,"_tag","Ok");f(this,"_value");this._value=t}get value(){return this._value}get error(){return null}isOk(){return!0}isOkAnd(t){return t(this.value)}isErr(){return!1}isErrAnd(t){return!1}ok(){return Hu(this.value)}err(){return bl()}expect(t){return this.value}expectErr(t){throw new Error(t)}unwrap(){return this.value}unwrapOr(t){return this.value}unwrapOrElse(t){return this.value}inspect(t){return t(this.value),this}inspectErr(){return this}map(t){return ie(t(this.value))}async mapAsync(t){return t(this.value).then(ie)}mapOr(t,r){return t(this.value)}async mapOrAsync(t,r){return t(this.value)}mapOrElse(t,r){return t(this.value)}async mapOrElseAsync(t,r){return t(this.value)}mapErr(t){return this}iter(){return new t1(this.value)}[Symbol.iterator](){return this.iter()}and(t){return t}andThen(t){return t(this.value)}or(t){return this}orElse(t){return this}async andThenAsync(t){return t(this.value)}toString(){return`Ok(${this.value})`}get[Symbol.toStringTag](){return"Ok"}},oI=class e{constructor(t){f(this,"_tag","Err");f(this,"_error");this._error=t}get value(){return null}get error(){return this._error}isOk(){return!1}isOkAnd(t){return!1}isErr(){return!0}isErrAnd(t){return t(this.error)}ok(){return bl()}err(){return Hu(this.error)}expect(t){throw new Error(t)}expectErr(t){return this.error}unwrap(){throw this.error}unwrapOr(t){return t}unwrapOrElse(t){return t()}inspect(){return this}inspectErr(t){return t(this.error),this}map(t){return this}iter(){return new t1(null)}[Symbol.iterator](){return this.iter()}async mapAsync(t){return this}mapOr(t,r){return r}async mapOrAsync(t,r){return r}mapOrElse(t,r){return r()}async mapOrElseAsync(t,r){return r()}mapErr(t){return new e(t(this.error))}and(t){return this}andThen(t){return this}async andThenAsync(t){return this}or(t){return t}orElse(t){return t(this.error)}toString(){return`Err(${this.error})`}get[Symbol.toStringTag](){return"Err"}},ie=e=>new nI(e),ae=e=>new oI(e);u();var Vn;(function(e){e.GeometryMissingError="GeometryMissingError",e.FloorMissingError="FloorMissingError",e.UnknownFloorError="UnknownFloorError",e.UnknownGeometryError="UnknownGeometryError",e.DuplicateIdError="DuplicateIdError"})(Vn||(Vn={}));u();u();u();u();var iI=class extends ve{constructor(t){super(`Duplicate type kind '${t}' detected`)}},Km=class extends ve{constructor(t){super(`Duplicate string format '${t}' detected`)}},r1;(function(e){function t(n,o){if(Nr.Has(n))throw new iI(n);return Nr.Set(n,o),(i={})=>Zb({...i,[U]:n})}e.Type=t;function r(n,o){if(Bn.Has(n))throw new Km(n);return Bn.Set(n,o),n}e.Format=r})(r1||(r1={}));u();function lB(e){switch(e.errorType){case V.ArrayContains:return"Expected array to contain at least one matching value";case V.ArrayMaxContains:return`Expected array to contain no more than ${e.schema.maxContains} matching values`;case V.ArrayMinContains:return`Expected array to contain at least ${e.schema.minContains} matching values`;case V.ArrayMaxItems:return`Expected array length to be less or equal to ${e.schema.maxItems}`;case V.ArrayMinItems:return`Expected array length to be greater or equal to ${e.schema.minItems}`;case V.ArrayUniqueItems:return"Expected array elements to be unique";case V.Array:return"Expected array";case V.AsyncIterator:return"Expected AsyncIterator";case V.BigIntExclusiveMaximum:return`Expected bigint to be less than ${e.schema.exclusiveMaximum}`;case V.BigIntExclusiveMinimum:return`Expected bigint to be greater than ${e.schema.exclusiveMinimum}`;case V.BigIntMaximum:return`Expected bigint to be less or equal to ${e.schema.maximum}`;case V.BigIntMinimum:return`Expected bigint to be greater or equal to ${e.schema.minimum}`;case V.BigIntMultipleOf:return`Expected bigint to be a multiple of ${e.schema.multipleOf}`;case V.BigInt:return"Expected bigint";case V.Boolean:return"Expected boolean";case V.DateExclusiveMinimumTimestamp:return`Expected Date timestamp to be greater than ${e.schema.exclusiveMinimumTimestamp}`;case V.DateExclusiveMaximumTimestamp:return`Expected Date timestamp to be less than ${e.schema.exclusiveMaximumTimestamp}`;case V.DateMinimumTimestamp:return`Expected Date timestamp to be greater or equal to ${e.schema.minimumTimestamp}`;case V.DateMaximumTimestamp:return`Expected Date timestamp to be less or equal to ${e.schema.maximumTimestamp}`;case V.DateMultipleOfTimestamp:return`Expected Date timestamp to be a multiple of ${e.schema.multipleOfTimestamp}`;case V.Date:return"Expected Date";case V.Function:return"Expected function";case V.IntegerExclusiveMaximum:return`Expected integer to be less than ${e.schema.exclusiveMaximum}`;case V.IntegerExclusiveMinimum:return`Expected integer to be greater than ${e.schema.exclusiveMinimum}`;case V.IntegerMaximum:return`Expected integer to be less or equal to ${e.schema.maximum}`;case V.IntegerMinimum:return`Expected integer to be greater or equal to ${e.schema.minimum}`;case V.IntegerMultipleOf:return`Expected integer to be a multiple of ${e.schema.multipleOf}`;case V.Integer:return"Expected integer";case V.IntersectUnevaluatedProperties:return"Unexpected property";case V.Intersect:return"Expected all values to match";case V.Iterator:return"Expected Iterator";case V.Literal:return`Expected ${typeof e.schema.const=="string"?`'${e.schema.const}'`:e.schema.const}`;case V.Never:return"Never";case V.Not:return"Value should not match";case V.Null:return"Expected null";case V.NumberExclusiveMaximum:return`Expected number to be less than ${e.schema.exclusiveMaximum}`;case V.NumberExclusiveMinimum:return`Expected number to be greater than ${e.schema.exclusiveMinimum}`;case V.NumberMaximum:return`Expected number to be less or equal to ${e.schema.maximum}`;case V.NumberMinimum:return`Expected number to be greater or equal to ${e.schema.minimum}`;case V.NumberMultipleOf:return`Expected number to be a multiple of ${e.schema.multipleOf}`;case V.Number:return"Expected number";case V.Object:return"Expected object";case V.ObjectAdditionalProperties:return"Unexpected property";case V.ObjectMaxProperties:return`Expected object to have no more than ${e.schema.maxProperties} properties`;case V.ObjectMinProperties:return`Expected object to have at least ${e.schema.minProperties} properties`;case V.ObjectRequiredProperty:return"Expected required property";case V.Promise:return"Expected Promise";case V.RegExp:return"Expected string to match regular expression";case V.StringFormatUnknown:return`Unknown format '${e.schema.format}'`;case V.StringFormat:return`Expected string to match '${e.schema.format}' format`;case V.StringMaxLength:return`Expected string length less or equal to ${e.schema.maxLength}`;case V.StringMinLength:return`Expected string length greater or equal to ${e.schema.minLength}`;case V.StringPattern:return`Expected string to match '${e.schema.pattern}'`;case V.String:return"Expected string";case V.Symbol:return"Expected symbol";case V.TupleLength:return`Expected tuple to have ${e.schema.maxItems||0} elements`;case V.Tuple:return"Expected tuple";case V.Uint8ArrayMaxByteLength:return`Expected byte length less or equal to ${e.schema.maxByteLength}`;case V.Uint8ArrayMinByteLength:return`Expected byte length greater or equal to ${e.schema.minByteLength}`;case V.Uint8Array:return"Expected Uint8Array";case V.Undefined:return"Expected undefined";case V.Union:return"Expected union value";case V.Void:return"Expected void";case V.Kind:return`Expected kind '${e.schema[U]}'`;default:return"Unknown error type"}}var cB=lB;function u4(){return cB}u();var sI=class extends ve{constructor(t){super(`Unable to dereference schema with $id '${t.$ref}'`),this.schema=t}};function pB(e,t){let r=t.find(n=>n.$id===e.$ref);if(r===void 0)throw new sI(e);return at(r,t)}function Eo(e,t){return!Qe(e.$id)||t.some(r=>r.$id===e.$id)||t.push(e),t}function at(e,t){return e[U]==="This"||e[U]==="Ref"?pB(e,t):e}u();var aI=class extends ve{constructor(t){super("Unable to hash value"),this.value=t}},so;(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"})(so||(so={}));var Wu=BigInt("14695981039346656037"),[uB,dB]=[BigInt("1099511628211"),BigInt("18446744073709551616")],fB=Array.from({length:256}).map((e,t)=>BigInt(t)),d4=new Float64Array(1),f4=new DataView(d4.buffer),m4=new Uint8Array(d4.buffer);function*mB(e){let t=e===0?1:Math.ceil(Math.floor(Math.log2(e)+1)/8);for(let r=0;r<t;r++)yield e>>8*(t-1-r)&255}function hB(e){hn(so.Array);for(let t of e)$u(t)}function gB(e){hn(so.Boolean),hn(e?1:0)}function yB(e){hn(so.BigInt),f4.setBigInt64(0,e);for(let t of m4)hn(t)}function bB(e){hn(so.Date),$u(e.getTime())}function xB(e){hn(so.Null)}function vB(e){hn(so.Number),f4.setFloat64(0,e);for(let t of m4)hn(t)}function IB(e){hn(so.Object);for(let t of globalThis.Object.getOwnPropertyNames(e).sort())$u(t),$u(e[t])}function SB(e){hn(so.String);for(let t=0;t<e.length;t++)for(let r of mB(e.charCodeAt(t)))hn(r)}function CB(e){hn(so.Symbol),$u(e.description)}function TB(e){hn(so.Uint8Array);for(let t=0;t<e.length;t++)hn(e[t])}function MB(e){return hn(so.Undefined)}function $u(e){if(ke(e))return hB(e);if(ts(e))return gB(e);if(Jr(e))return yB(e);if(Cn(e))return bB(e);if(Ks(e))return xB(e);if(he(e))return vB(e);if(Be(e))return IB(e);if(Qe(e))return SB(e);if(Qs(e))return CB(e);if(Cu(e))return TB(e);if(ar(e))return MB(e);throw new aI(e)}function hn(e){Wu=Wu^fB[e],Wu=Wu*uB%dB}function xl(e){return Wu=BigInt("14695981039346656037"),$u(e),Wu}u();var lI=class extends ve{constructor(t){super("Unknown type"),this.schema=t}};function PB(e){return e[U]==="Any"||e[U]==="Unknown"}function He(e){return e!==void 0}function wB(e,t,r){return!0}function OB(e,t,r){if(!ke(r)||He(e.minItems)&&!(r.length>=e.minItems)||He(e.maxItems)&&!(r.length<=e.maxItems)||!r.every(i=>Qr(e.items,t,i))||e.uniqueItems===!0&&!function(){let i=new Set;for(let s of r){let l=xl(s);if(i.has(l))return!1;i.add(l)}return!0}())return!1;if(!(He(e.contains)||he(e.minContains)||he(e.maxContains)))return!0;let n=He(e.contains)?e.contains:St(),o=r.reduce((i,s)=>Qr(n,t,s)?i+1:i,0);return!(o===0||he(e.minContains)&&o<e.minContains||he(e.maxContains)&&o>e.maxContains)}function _B(e,t,r){return Cb(r)}function EB(e,t,r){return!(!Jr(r)||He(e.exclusiveMaximum)&&!(r<e.exclusiveMaximum)||He(e.exclusiveMinimum)&&!(r>e.exclusiveMinimum)||He(e.maximum)&&!(r<=e.maximum)||He(e.minimum)&&!(r>=e.minimum)||He(e.multipleOf)&&r%e.multipleOf!==BigInt(0))}function DB(e,t,r){return ts(r)}function FB(e,t,r){return Qr(e.returns,t,r.prototype)}function kB(e,t,r){return!(!Cn(r)||He(e.exclusiveMaximumTimestamp)&&!(r.getTime()<e.exclusiveMaximumTimestamp)||He(e.exclusiveMinimumTimestamp)&&!(r.getTime()>e.exclusiveMinimumTimestamp)||He(e.maximumTimestamp)&&!(r.getTime()<=e.maximumTimestamp)||He(e.minimumTimestamp)&&!(r.getTime()>=e.minimumTimestamp)||He(e.multipleOfTimestamp)&&r.getTime()%e.multipleOfTimestamp!==0)}function AB(e,t,r){return ul(r)}function LB(e,t,r){return!(!Pb(r)||He(e.exclusiveMaximum)&&!(r<e.exclusiveMaximum)||He(e.exclusiveMinimum)&&!(r>e.exclusiveMinimum)||He(e.maximum)&&!(r<=e.maximum)||He(e.minimum)&&!(r>=e.minimum)||He(e.multipleOf)&&r%e.multipleOf!==0)}function RB(e,t,r){let n=e.allOf.every(o=>Qr(o,t,r));if(e.unevaluatedProperties===!1){let o=new RegExp(sa(e)),i=Object.getOwnPropertyNames(r).every(s=>o.test(s));return n&&i}else if(et(e.unevaluatedProperties)){let o=new RegExp(sa(e)),i=Object.getOwnPropertyNames(r).every(s=>o.test(s)||Qr(e.unevaluatedProperties,t,r[s]));return n&&i}else return n}function BB(e,t,r){return Tb(r)}function NB(e,t,r){return r===e.const}function GB(e,t,r){return!1}function jB(e,t,r){return!Qr(e.not,t,r)}function UB(e,t,r){return Ks(r)}function VB(e,t,r){return!(!vt.IsNumberLike(r)||He(e.exclusiveMaximum)&&!(r<e.exclusiveMaximum)||He(e.exclusiveMinimum)&&!(r>e.exclusiveMinimum)||He(e.minimum)&&!(r>=e.minimum)||He(e.maximum)&&!(r<=e.maximum)||He(e.multipleOf)&&r%e.multipleOf!==0)}function HB(e,t,r){if(!vt.IsObjectLike(r)||He(e.minProperties)&&!(Object.getOwnPropertyNames(r).length>=e.minProperties)||He(e.maxProperties)&&!(Object.getOwnPropertyNames(r).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(!Qr(i,t,r[o])||(la(i)||PB(i))&&!(o in r))return!1}else if(vt.IsExactOptionalProperty(r,o)&&!Qr(i,t,r[o]))return!1}if(e.additionalProperties===!1){let o=Object.getOwnPropertyNames(r);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(r).every(i=>n.includes(i)||Qr(e.additionalProperties,t,r[i])):!0}function WB(e,t,r){return Mb(r)}function $B(e,t,r){if(!vt.IsRecordLike(r)||He(e.minProperties)&&!(Object.getOwnPropertyNames(r).length>=e.minProperties)||He(e.maxProperties)&&!(Object.getOwnPropertyNames(r).length<=e.maxProperties))return!1;let[n,o]=Object.entries(e.patternProperties)[0],i=new RegExp(n),s=Object.entries(r).every(([p,d])=>i.test(p)?Qr(o,t,d):!0),l=typeof e.additionalProperties=="object"?Object.entries(r).every(([p,d])=>i.test(p)?!0:Qr(e.additionalProperties,t,d)):!0,c=e.additionalProperties===!1?Object.getOwnPropertyNames(r).every(p=>i.test(p)):!0;return s&&l&&c}function zB(e,t,r){return Qr(at(e,t),t,r)}function XB(e,t,r){let n=new RegExp(e.source,e.flags);return He(e.minLength)&&!(r.length>=e.minLength)||He(e.maxLength)&&!(r.length<=e.maxLength)?!1:n.test(r)}function ZB(e,t,r){return!Qe(r)||He(e.minLength)&&!(r.length>=e.minLength)||He(e.maxLength)&&!(r.length<=e.maxLength)||He(e.pattern)&&!new RegExp(e.pattern).test(r)?!1:He(e.format)?Bn.Has(e.format)?Bn.Get(e.format)(r):!1:!0}function YB(e,t,r){return Qs(r)}function JB(e,t,r){return Qe(r)&&new RegExp(e.pattern).test(r)}function qB(e,t,r){return Qr(at(e,t),t,r)}function KB(e,t,r){if(!ke(r)||e.items===void 0&&r.length!==0||r.length!==e.maxItems)return!1;if(!e.items)return!0;for(let n=0;n<e.items.length;n++)if(!Qr(e.items[n],t,r[n]))return!1;return!0}function QB(e,t,r){return ar(r)}function eN(e,t,r){return e.anyOf.some(n=>Qr(n,t,r))}function tN(e,t,r){return!(!Cu(r)||He(e.maxByteLength)&&!(r.length<=e.maxByteLength)||He(e.minByteLength)&&!(r.length>=e.minByteLength))}function rN(e,t,r){return!0}function nN(e,t,r){return vt.IsVoidLike(r)}function oN(e,t,r){return Nr.Has(e[U])?Nr.Get(e[U])(e,r):!1}function Qr(e,t,r){let n=He(e.$id)?[...t,e]:t,o=e;switch(o[U]){case"Any":return wB(o,n,r);case"Array":return OB(o,n,r);case"AsyncIterator":return _B(o,n,r);case"BigInt":return EB(o,n,r);case"Boolean":return DB(o,n,r);case"Constructor":return FB(o,n,r);case"Date":return kB(o,n,r);case"Function":return AB(o,n,r);case"Integer":return LB(o,n,r);case"Intersect":return RB(o,n,r);case"Iterator":return BB(o,n,r);case"Literal":return NB(o,n,r);case"Never":return GB(o,n,r);case"Not":return jB(o,n,r);case"Null":return UB(o,n,r);case"Number":return VB(o,n,r);case"Object":return HB(o,n,r);case"Promise":return WB(o,n,r);case"Record":return $B(o,n,r);case"Ref":return zB(o,n,r);case"RegExp":return XB(o,n,r);case"String":return ZB(o,n,r);case"Symbol":return YB(o,n,r);case"TemplateLiteral":return JB(o,n,r);case"This":return qB(o,n,r);case"Tuple":return KB(o,n,r);case"Undefined":return QB(o,n,r);case"Union":return eN(o,n,r);case"Uint8Array":return tN(o,n,r);case"Unknown":return rN(o,n,r);case"Void":return nN(o,n,r);default:if(!Nr.Has(o[U]))throw new lI(o);return oN(o,n,r)}}function je(...e){return e.length===3?Qr(e[0],e[1],e[2]):Qr(e[0],[],e[1])}var V;(function(e){e[e.ArrayContains=0]="ArrayContains",e[e.ArrayMaxContains=1]="ArrayMaxContains",e[e.ArrayMaxItems=2]="ArrayMaxItems",e[e.ArrayMinContains=3]="ArrayMinContains",e[e.ArrayMinItems=4]="ArrayMinItems",e[e.ArrayUniqueItems=5]="ArrayUniqueItems",e[e.Array=6]="Array",e[e.AsyncIterator=7]="AsyncIterator",e[e.BigIntExclusiveMaximum=8]="BigIntExclusiveMaximum",e[e.BigIntExclusiveMinimum=9]="BigIntExclusiveMinimum",e[e.BigIntMaximum=10]="BigIntMaximum",e[e.BigIntMinimum=11]="BigIntMinimum",e[e.BigIntMultipleOf=12]="BigIntMultipleOf",e[e.BigInt=13]="BigInt",e[e.Boolean=14]="Boolean",e[e.DateExclusiveMaximumTimestamp=15]="DateExclusiveMaximumTimestamp",e[e.DateExclusiveMinimumTimestamp=16]="DateExclusiveMinimumTimestamp",e[e.DateMaximumTimestamp=17]="DateMaximumTimestamp",e[e.DateMinimumTimestamp=18]="DateMinimumTimestamp",e[e.DateMultipleOfTimestamp=19]="DateMultipleOfTimestamp",e[e.Date=20]="Date",e[e.Function=21]="Function",e[e.IntegerExclusiveMaximum=22]="IntegerExclusiveMaximum",e[e.IntegerExclusiveMinimum=23]="IntegerExclusiveMinimum",e[e.IntegerMaximum=24]="IntegerMaximum",e[e.IntegerMinimum=25]="IntegerMinimum",e[e.IntegerMultipleOf=26]="IntegerMultipleOf",e[e.Integer=27]="Integer",e[e.IntersectUnevaluatedProperties=28]="IntersectUnevaluatedProperties",e[e.Intersect=29]="Intersect",e[e.Iterator=30]="Iterator",e[e.Kind=31]="Kind",e[e.Literal=32]="Literal",e[e.Never=33]="Never",e[e.Not=34]="Not",e[e.Null=35]="Null",e[e.NumberExclusiveMaximum=36]="NumberExclusiveMaximum",e[e.NumberExclusiveMinimum=37]="NumberExclusiveMinimum",e[e.NumberMaximum=38]="NumberMaximum",e[e.NumberMinimum=39]="NumberMinimum",e[e.NumberMultipleOf=40]="NumberMultipleOf",e[e.Number=41]="Number",e[e.ObjectAdditionalProperties=42]="ObjectAdditionalProperties",e[e.ObjectMaxProperties=43]="ObjectMaxProperties",e[e.ObjectMinProperties=44]="ObjectMinProperties",e[e.ObjectRequiredProperty=45]="ObjectRequiredProperty",e[e.Object=46]="Object",e[e.Promise=47]="Promise",e[e.RegExp=48]="RegExp",e[e.StringFormatUnknown=49]="StringFormatUnknown",e[e.StringFormat=50]="StringFormat",e[e.StringMaxLength=51]="StringMaxLength",e[e.StringMinLength=52]="StringMinLength",e[e.StringPattern=53]="StringPattern",e[e.String=54]="String",e[e.Symbol=55]="Symbol",e[e.TupleLength=56]="TupleLength",e[e.Tuple=57]="Tuple",e[e.Uint8ArrayMaxByteLength=58]="Uint8ArrayMaxByteLength",e[e.Uint8ArrayMinByteLength=59]="Uint8ArrayMinByteLength",e[e.Uint8Array=60]="Uint8Array",e[e.Undefined=61]="Undefined",e[e.Union=62]="Union",e[e.Void=63]="Void"})(V||(V={}));var cI=class extends ve{constructor(t){super("Unknown type"),this.schema=t}};function ca(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function We(e){return e!==void 0}var Do=class{constructor(t){this.iterator=t}[Symbol.iterator](){return this.iterator}First(){let t=this.iterator.next();return t.done?void 0:t.value}};function oe(e,t,r,n,o=[]){return{type:e,schema:t,path:r,value:n,message:u4()({errorType:e,path:r,schema:t,value:n,errors:o}),errors:o}}function*iN(e,t,r,n){}function*sN(e,t,r,n){if(!ke(n))return yield oe(V.Array,e,r,n);We(e.minItems)&&!(n.length>=e.minItems)&&(yield oe(V.ArrayMinItems,e,r,n)),We(e.maxItems)&&!(n.length<=e.maxItems)&&(yield oe(V.ArrayMaxItems,e,r,n));for(let s=0;s<n.length;s++)yield*en(e.items,t,`${r}/${s}`,n[s]);if(e.uniqueItems===!0&&!function(){let s=new Set;for(let l of n){let c=xl(l);if(s.has(c))return!1;s.add(c)}return!0}()&&(yield oe(V.ArrayUniqueItems,e,r,n)),!(We(e.contains)||We(e.minContains)||We(e.maxContains)))return;let o=We(e.contains)?e.contains:St(),i=n.reduce((s,l,c)=>en(o,t,`${r}${c}`,l).next().done===!0?s+1:s,0);i===0&&(yield oe(V.ArrayContains,e,r,n)),he(e.minContains)&&i<e.minContains&&(yield oe(V.ArrayMinContains,e,r,n)),he(e.maxContains)&&i>e.maxContains&&(yield oe(V.ArrayMaxContains,e,r,n))}function*aN(e,t,r,n){Cb(n)||(yield oe(V.AsyncIterator,e,r,n))}function*lN(e,t,r,n){if(!Jr(n))return yield oe(V.BigInt,e,r,n);We(e.exclusiveMaximum)&&!(n<e.exclusiveMaximum)&&(yield oe(V.BigIntExclusiveMaximum,e,r,n)),We(e.exclusiveMinimum)&&!(n>e.exclusiveMinimum)&&(yield oe(V.BigIntExclusiveMinimum,e,r,n)),We(e.maximum)&&!(n<=e.maximum)&&(yield oe(V.BigIntMaximum,e,r,n)),We(e.minimum)&&!(n>=e.minimum)&&(yield oe(V.BigIntMinimum,e,r,n)),We(e.multipleOf)&&n%e.multipleOf!==BigInt(0)&&(yield oe(V.BigIntMultipleOf,e,r,n))}function*cN(e,t,r,n){ts(n)||(yield oe(V.Boolean,e,r,n))}function*pN(e,t,r,n){yield*en(e.returns,t,r,n.prototype)}function*uN(e,t,r,n){if(!Cn(n))return yield oe(V.Date,e,r,n);We(e.exclusiveMaximumTimestamp)&&!(n.getTime()<e.exclusiveMaximumTimestamp)&&(yield oe(V.DateExclusiveMaximumTimestamp,e,r,n)),We(e.exclusiveMinimumTimestamp)&&!(n.getTime()>e.exclusiveMinimumTimestamp)&&(yield oe(V.DateExclusiveMinimumTimestamp,e,r,n)),We(e.maximumTimestamp)&&!(n.getTime()<=e.maximumTimestamp)&&(yield oe(V.DateMaximumTimestamp,e,r,n)),We(e.minimumTimestamp)&&!(n.getTime()>=e.minimumTimestamp)&&(yield oe(V.DateMinimumTimestamp,e,r,n)),We(e.multipleOfTimestamp)&&n.getTime()%e.multipleOfTimestamp!==0&&(yield oe(V.DateMultipleOfTimestamp,e,r,n))}function*dN(e,t,r,n){ul(n)||(yield oe(V.Function,e,r,n))}function*fN(e,t,r,n){if(!Pb(n))return yield oe(V.Integer,e,r,n);We(e.exclusiveMaximum)&&!(n<e.exclusiveMaximum)&&(yield oe(V.IntegerExclusiveMaximum,e,r,n)),We(e.exclusiveMinimum)&&!(n>e.exclusiveMinimum)&&(yield oe(V.IntegerExclusiveMinimum,e,r,n)),We(e.maximum)&&!(n<=e.maximum)&&(yield oe(V.IntegerMaximum,e,r,n)),We(e.minimum)&&!(n>=e.minimum)&&(yield oe(V.IntegerMinimum,e,r,n)),We(e.multipleOf)&&n%e.multipleOf!==0&&(yield oe(V.IntegerMultipleOf,e,r,n))}function*mN(e,t,r,n){let o=!1;for(let i of e.allOf)for(let s of en(i,t,r,n))o=!0,yield s;if(o)return yield oe(V.Intersect,e,r,n);if(e.unevaluatedProperties===!1){let i=new RegExp(sa(e));for(let s of Object.getOwnPropertyNames(n))i.test(s)||(yield oe(V.IntersectUnevaluatedProperties,e,`${r}/${s}`,n))}if(typeof e.unevaluatedProperties=="object"){let i=new RegExp(sa(e));for(let s of Object.getOwnPropertyNames(n))if(!i.test(s)){let l=en(e.unevaluatedProperties,t,`${r}/${s}`,n[s]).next();l.done||(yield l.value)}}}function*hN(e,t,r,n){Tb(n)||(yield oe(V.Iterator,e,r,n))}function*gN(e,t,r,n){n!==e.const&&(yield oe(V.Literal,e,r,n))}function*yN(e,t,r,n){yield oe(V.Never,e,r,n)}function*bN(e,t,r,n){en(e.not,t,r,n).next().done===!0&&(yield oe(V.Not,e,r,n))}function*xN(e,t,r,n){Ks(n)||(yield oe(V.Null,e,r,n))}function*vN(e,t,r,n){if(!vt.IsNumberLike(n))return yield oe(V.Number,e,r,n);We(e.exclusiveMaximum)&&!(n<e.exclusiveMaximum)&&(yield oe(V.NumberExclusiveMaximum,e,r,n)),We(e.exclusiveMinimum)&&!(n>e.exclusiveMinimum)&&(yield oe(V.NumberExclusiveMinimum,e,r,n)),We(e.maximum)&&!(n<=e.maximum)&&(yield oe(V.NumberMaximum,e,r,n)),We(e.minimum)&&!(n>=e.minimum)&&(yield oe(V.NumberMinimum,e,r,n)),We(e.multipleOf)&&n%e.multipleOf!==0&&(yield oe(V.NumberMultipleOf,e,r,n))}function*IN(e,t,r,n){if(!vt.IsObjectLike(n))return yield oe(V.Object,e,r,n);We(e.minProperties)&&!(Object.getOwnPropertyNames(n).length>=e.minProperties)&&(yield oe(V.ObjectMinProperties,e,r,n)),We(e.maxProperties)&&!(Object.getOwnPropertyNames(n).length<=e.maxProperties)&&(yield oe(V.ObjectMaxProperties,e,r,n));let o=Array.isArray(e.required)?e.required:[],i=Object.getOwnPropertyNames(e.properties),s=Object.getOwnPropertyNames(n);for(let l of o)s.includes(l)||(yield oe(V.ObjectRequiredProperty,e.properties[l],`${r}/${ca(l)}`,void 0));if(e.additionalProperties===!1)for(let l of s)i.includes(l)||(yield oe(V.ObjectAdditionalProperties,e,`${r}/${ca(l)}`,n[l]));if(typeof e.additionalProperties=="object")for(let l of s)i.includes(l)||(yield*en(e.additionalProperties,t,`${r}/${ca(l)}`,n[l]));for(let l of i){let c=e.properties[l];e.required&&e.required.includes(l)?(yield*en(c,t,`${r}/${ca(l)}`,n[l]),la(e)&&!(l in n)&&(yield oe(V.ObjectRequiredProperty,c,`${r}/${ca(l)}`,void 0))):vt.IsExactOptionalProperty(n,l)&&(yield*en(c,t,`${r}/${ca(l)}`,n[l]))}}function*SN(e,t,r,n){Mb(n)||(yield oe(V.Promise,e,r,n))}function*CN(e,t,r,n){if(!vt.IsRecordLike(n))return yield oe(V.Object,e,r,n);We(e.minProperties)&&!(Object.getOwnPropertyNames(n).length>=e.minProperties)&&(yield oe(V.ObjectMinProperties,e,r,n)),We(e.maxProperties)&&!(Object.getOwnPropertyNames(n).length<=e.maxProperties)&&(yield oe(V.ObjectMaxProperties,e,r,n));let[o,i]=Object.entries(e.patternProperties)[0],s=new RegExp(o);for(let[l,c]of Object.entries(n))s.test(l)&&(yield*en(i,t,`${r}/${ca(l)}`,c));if(typeof e.additionalProperties=="object")for(let[l,c]of Object.entries(n))s.test(l)||(yield*en(e.additionalProperties,t,`${r}/${ca(l)}`,c));if(e.additionalProperties===!1){for(let[l,c]of Object.entries(n))if(!s.test(l))return yield oe(V.ObjectAdditionalProperties,e,`${r}/${ca(l)}`,c)}}function*TN(e,t,r,n){yield*en(at(e,t),t,r,n)}function*MN(e,t,r,n){if(!Qe(n))return yield oe(V.String,e,r,n);if(We(e.minLength)&&!(n.length>=e.minLength)&&(yield oe(V.StringMinLength,e,r,n)),We(e.maxLength)&&!(n.length<=e.maxLength)&&(yield oe(V.StringMaxLength,e,r,n)),!new RegExp(e.source,e.flags).test(n))return yield oe(V.RegExp,e,r,n)}function*PN(e,t,r,n){if(!Qe(n))return yield oe(V.String,e,r,n);We(e.minLength)&&!(n.length>=e.minLength)&&(yield oe(V.StringMinLength,e,r,n)),We(e.maxLength)&&!(n.length<=e.maxLength)&&(yield oe(V.StringMaxLength,e,r,n)),Qe(e.pattern)&&(new RegExp(e.pattern).test(n)||(yield oe(V.StringPattern,e,r,n))),Qe(e.format)&&(Bn.Has(e.format)?Bn.Get(e.format)(n)||(yield oe(V.StringFormat,e,r,n)):yield oe(V.StringFormatUnknown,e,r,n))}function*wN(e,t,r,n){Qs(n)||(yield oe(V.Symbol,e,r,n))}function*ON(e,t,r,n){if(!Qe(n))return yield oe(V.String,e,r,n);new RegExp(e.pattern).test(n)||(yield oe(V.StringPattern,e,r,n))}function*_N(e,t,r,n){yield*en(at(e,t),t,r,n)}function*EN(e,t,r,n){if(!ke(n))return yield oe(V.Tuple,e,r,n);if(e.items===void 0&&n.length!==0)return yield oe(V.TupleLength,e,r,n);if(n.length!==e.maxItems)return yield oe(V.TupleLength,e,r,n);if(e.items)for(let o=0;o<e.items.length;o++)yield*en(e.items[o],t,`${r}/${o}`,n[o])}function*DN(e,t,r,n){ar(n)||(yield oe(V.Undefined,e,r,n))}function*FN(e,t,r,n){if(je(e,t,n))return;let o=e.anyOf.map(i=>new Do(en(i,t,r,n)));yield oe(V.Union,e,r,n,o)}function*kN(e,t,r,n){if(!Cu(n))return yield oe(V.Uint8Array,e,r,n);We(e.maxByteLength)&&!(n.length<=e.maxByteLength)&&(yield oe(V.Uint8ArrayMaxByteLength,e,r,n)),We(e.minByteLength)&&!(n.length>=e.minByteLength)&&(yield oe(V.Uint8ArrayMinByteLength,e,r,n))}function*AN(e,t,r,n){}function*LN(e,t,r,n){vt.IsVoidLike(n)||(yield oe(V.Void,e,r,n))}function*RN(e,t,r,n){Nr.Get(e[U])(e,n)||(yield oe(V.Kind,e,r,n))}function*en(e,t,r,n){let o=We(e.$id)?[...t,e]:t,i=e;switch(i[U]){case"Any":return yield*iN(i,o,r,n);case"Array":return yield*sN(i,o,r,n);case"AsyncIterator":return yield*aN(i,o,r,n);case"BigInt":return yield*lN(i,o,r,n);case"Boolean":return yield*cN(i,o,r,n);case"Constructor":return yield*pN(i,o,r,n);case"Date":return yield*uN(i,o,r,n);case"Function":return yield*dN(i,o,r,n);case"Integer":return yield*fN(i,o,r,n);case"Intersect":return yield*mN(i,o,r,n);case"Iterator":return yield*hN(i,o,r,n);case"Literal":return yield*gN(i,o,r,n);case"Never":return yield*yN(i,o,r,n);case"Not":return yield*bN(i,o,r,n);case"Null":return yield*xN(i,o,r,n);case"Number":return yield*vN(i,o,r,n);case"Object":return yield*IN(i,o,r,n);case"Promise":return yield*SN(i,o,r,n);case"Record":return yield*CN(i,o,r,n);case"Ref":return yield*TN(i,o,r,n);case"RegExp":return yield*MN(i,o,r,n);case"String":return yield*PN(i,o,r,n);case"Symbol":return yield*wN(i,o,r,n);case"TemplateLiteral":return yield*ON(i,o,r,n);case"This":return yield*_N(i,o,r,n);case"Tuple":return yield*EN(i,o,r,n);case"Undefined":return yield*DN(i,o,r,n);case"Union":return yield*FN(i,o,r,n);case"Uint8Array":return yield*kN(i,o,r,n);case"Unknown":return yield*AN(i,o,r,n);case"Void":return yield*LN(i,o,r,n);default:if(!Nr.Has(i[U]))throw new cI(e);return yield*RN(i,o,r,n)}}function ss(...e){let t=e.length===3?en(e[0],e[1],"",e[2]):en(e[0],[],"",e[1]);return new Do(t)}u();u();var BN=function(e,t,r,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 t=="function"?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(e,r):o?o.value=r:t.set(e,r),r},g4=function(e,t,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(e):n?n.value:t.get(e)},pI,n1,y4,uI=class extends ve{constructor(t){let r=t.First();super(r===void 0?"Invalid Value":r.message),pI.add(this),n1.set(this,void 0),BN(this,n1,t,"f"),this.error=r}Errors(){return new Do(g4(this,pI,"m",y4).call(this))}};n1=new WeakMap,pI=new WeakSet,y4=function*(){this.error&&(yield this.error),yield*g4(this,n1,"f")};function h4(e,t,r){if(!je(e,t,r))throw new uI(ss(e,t,r))}function o1(...e){return e.length===3?h4(e[0],e[1],e[2]):h4(e[0],[],e[1])}u();u();u();function NN(e){let t={};for(let r of Object.getOwnPropertyNames(e))t[r]=lt(e[r]);for(let r of Object.getOwnPropertySymbols(e))t[r]=lt(e[r]);return t}function GN(e){return e.map(t=>lt(t))}function jN(e){return e.slice()}function UN(e){return new Map(lt([...e.entries()]))}function VN(e){return new Set(lt([...e.entries()]))}function HN(e){return new Date(e.toISOString())}function lt(e){if(ke(e))return GN(e);if(Cn(e))return HN(e);if(Co(e))return jN(e);if(eM(e))return UN(e);if(tM(e))return VN(e);if(Be(e))return NN(e);if(qr(e))return e;throw new Error("ValueClone: Unable to clone value")}var ao=class extends ve{constructor(t,r){super(r),this.schema=t}};function ct(e){return ul(e)?e():lt(e)}function WN(e,t){return Me(e,"default")?ct(e.default):{}}function $N(e,t){if(e.uniqueItems===!0&&!Me(e,"default"))throw new ao(e,"Array with the uniqueItems constraint requires a default value");if("contains"in e&&!Me(e,"default"))throw new ao(e,"Array with the contains constraint requires a default value");return"default"in e?ct(e.default):e.minItems!==void 0?Array.from({length:e.minItems}).map(r=>lo(e.items,t)):[]}function zN(e,t){return Me(e,"default")?ct(e.default):async function*(){}()}function XN(e,t){return Me(e,"default")?ct(e.default):BigInt(0)}function ZN(e,t){return Me(e,"default")?ct(e.default):!1}function YN(e,t){if(Me(e,"default"))return ct(e.default);{let r=lo(e.returns,t);return typeof r=="object"&&!Array.isArray(r)?class{constructor(){for(let[n,o]of Object.entries(r)){let i=this;i[n]=o}}}:class{}}}function JN(e,t){return Me(e,"default")?ct(e.default):e.minimumTimestamp!==void 0?new Date(e.minimumTimestamp):new Date}function qN(e,t){return Me(e,"default")?ct(e.default):()=>lo(e.returns,t)}function KN(e,t){return Me(e,"default")?ct(e.default):e.minimum!==void 0?e.minimum:0}function QN(e,t){if(Me(e,"default"))return ct(e.default);{let r=e.allOf.reduce((n,o)=>{let i=lo(o,t);return typeof i=="object"?{...n,...i}:i},{});if(!je(e,t,r))throw new ao(e,"Intersect produced invalid value. Consider using a default value.");return r}}function eG(e,t){return Me(e,"default")?ct(e.default):function*(){}()}function tG(e,t){return Me(e,"default")?ct(e.default):e.const}function rG(e,t){if(Me(e,"default"))return ct(e.default);throw new ao(e,"Never types cannot be created. Consider using a default value.")}function nG(e,t){if(Me(e,"default"))return ct(e.default);throw new ao(e,"Not types must have a default value")}function oG(e,t){return Me(e,"default")?ct(e.default):null}function iG(e,t){return Me(e,"default")?ct(e.default):e.minimum!==void 0?e.minimum:0}function sG(e,t){if(Me(e,"default"))return ct(e.default);{let r=new Set(e.required),n={};for(let[o,i]of Object.entries(e.properties))r.has(o)&&(n[o]=lo(i,t));return n}}function aG(e,t){return Me(e,"default")?ct(e.default):Promise.resolve(lo(e.item,t))}function lG(e,t){let[r,n]=Object.entries(e.patternProperties)[0];if(Me(e,"default"))return ct(e.default);if(r===oa||r===na)return{};{let o=r.slice(1,r.length-1).split("|"),i={};for(let s of o)i[s]=lo(n,t);return i}}function cG(e,t){return Me(e,"default")?ct(e.default):lo(at(e,t),t)}function pG(e,t){if(Me(e,"default"))return ct(e.default);throw new ao(e,"RegExp types cannot be created. Consider using a default value.")}function uG(e,t){if(e.pattern!==void 0){if(Me(e,"default"))return ct(e.default);throw new ao(e,"String types with patterns must specify a default value")}else if(e.format!==void 0){if(Me(e,"default"))return ct(e.default);throw new ao(e,"String types with formats must specify a default value")}else return Me(e,"default")?ct(e.default):e.minLength!==void 0?Array.from({length:e.minLength}).map(()=>" ").join(""):""}function dG(e,t){return Me(e,"default")?ct(e.default):"value"in e?Symbol.for(e.value):Symbol()}function fG(e,t){if(Me(e,"default"))return ct(e.default);if(!Db(e))throw new ao(e,"Can only create template literals that produce a finite variants. Consider using a default value.");return Eu(e)[0]}function mG(e,t){if(b4++>SG)throw new ao(e,"Cannot create recursive type as it appears possibly infinite. Consider using a default.");return Me(e,"default")?ct(e.default):lo(at(e,t),t)}function hG(e,t){return Me(e,"default")?ct(e.default):e.items===void 0?[]:Array.from({length:e.minItems}).map((r,n)=>lo(e.items[n],t))}function gG(e,t){if(Me(e,"default"))return ct(e.default)}function yG(e,t){if(Me(e,"default"))return ct(e.default);if(e.anyOf.length===0)throw new Error("ValueCreate.Union: Cannot create Union with zero variants");return lo(e.anyOf[0],t)}function bG(e,t){return Me(e,"default")?ct(e.default):e.minByteLength!==void 0?new Uint8Array(e.minByteLength):new Uint8Array(0)}function xG(e,t){return Me(e,"default")?ct(e.default):{}}function vG(e,t){if(Me(e,"default"))return ct(e.default)}function IG(e,t){if(Me(e,"default"))return ct(e.default);throw new Error("User defined types must specify a default value")}function lo(e,t){let r=Eo(e,t),n=e;switch(n[U]){case"Any":return WN(n,r);case"Array":return $N(n,r);case"AsyncIterator":return zN(n,r);case"BigInt":return XN(n,r);case"Boolean":return ZN(n,r);case"Constructor":return YN(n,r);case"Date":return JN(n,r);case"Function":return qN(n,r);case"Integer":return KN(n,r);case"Intersect":return QN(n,r);case"Iterator":return eG(n,r);case"Literal":return tG(n,r);case"Never":return rG(n,r);case"Not":return nG(n,r);case"Null":return oG(n,r);case"Number":return iG(n,r);case"Object":return sG(n,r);case"Promise":return aG(n,r);case"Record":return lG(n,r);case"Ref":return cG(n,r);case"RegExp":return pG(n,r);case"String":return uG(n,r);case"Symbol":return dG(n,r);case"TemplateLiteral":return fG(n,r);case"This":return mG(n,r);case"Tuple":return hG(n,r);case"Undefined":return gG(n,r);case"Union":return yG(n,r);case"Uint8Array":return bG(n,r);case"Unknown":return xG(n,r);case"Void":return vG(n,r);default:if(!Nr.Has(n[U]))throw new ao(n,"Unknown type");return IG(n,r)}}var SG=512,b4=0;function Fo(...e){return b4=0,e.length===2?lo(e[0],e[1]):lo(e[0],[])}var i1=class extends ve{constructor(t,r){super(r),this.schema=t}};function CG(e,t,r){if(e[U]==="Object"&&typeof r=="object"&&!Ks(r)){let n=e,o=Object.getOwnPropertyNames(r),i=Object.entries(n.properties),[s,l]=[1/i.length,i.length];return i.reduce((c,[p,d])=>{let m=d[U]==="Literal"&&d.const===r[p]?l:0,g=je(d,t,r[p])?s:0,x=o.includes(p)?s:0;return c+(m+g+x)},0)}else return je(e,t,r)?1:0}function TG(e,t,r){let n=e.anyOf.map(s=>at(s,t)),[o,i]=[n[0],0];for(let s of n){let l=CG(s,t,r);l>i&&(o=s,i=l)}return o}function MG(e,t,r){if("default"in e)return typeof r=="function"?e.default:lt(e.default);{let n=TG(e,t,r);return dI(n,t,r)}}function PG(e,t,r){return je(e,t,r)?lt(r):Fo(e,t)}function wG(e,t,r){return je(e,t,r)?r:Fo(e,t)}function OG(e,t,r){if(je(e,t,r))return lt(r);let n=ke(r)?lt(r):Fo(e,t),o=he(e.minItems)&&n.length<e.minItems?[...n,...Array.from({length:e.minItems-n.length},()=>null)]:n,s=(he(e.maxItems)&&o.length>e.maxItems?o.slice(0,e.maxItems):o).map(c=>as(e.items,t,c));if(e.uniqueItems!==!0)return s;let l=[...new Set(s)];if(!je(e,t,l))throw new i1(e,"Array cast produced invalid data due to uniqueItems constraint");return l}function _G(e,t,r){if(je(e,t,r))return Fo(e,t);let n=new Set(e.returns.required||[]),o=function(){};for(let[i,s]of Object.entries(e.returns.properties))!n.has(i)&&r.prototype[i]===void 0||(o.prototype[i]=as(s,t,r.prototype[i]));return o}function EG(e,t,r){let n=Fo(e,t),o=Be(n)&&Be(r)?{...n,...r}:r;return je(e,t,o)?o:Fo(e,t)}function DG(e,t,r){throw new i1(e,"Never types cannot be cast")}function FG(e,t,r){if(je(e,t,r))return r;if(r===null||typeof r!="object")return Fo(e,t);let n=new Set(e.required||[]),o={};for(let[i,s]of Object.entries(e.properties))!n.has(i)&&r[i]===void 0||(o[i]=as(s,t,r[i]));if(typeof e.additionalProperties=="object"){let i=Object.getOwnPropertyNames(e.properties);for(let s of Object.getOwnPropertyNames(r))i.includes(s)||(o[s]=as(e.additionalProperties,t,r[s]))}return o}function kG(e,t,r){if(je(e,t,r))return lt(r);if(r===null||typeof r!="object"||Array.isArray(r)||r instanceof Date)return Fo(e,t);let n=Object.getOwnPropertyNames(e.patternProperties)[0],o=e.patternProperties[n],i={};for(let[s,l]of Object.entries(r))i[s]=as(o,t,l);return i}function AG(e,t,r){return as(at(e,t),t,r)}function LG(e,t,r){return as(at(e,t),t,r)}function RG(e,t,r){return je(e,t,r)?lt(r):ke(r)?e.items===void 0?[]:e.items.map((n,o)=>as(n,t,r[o])):Fo(e,t)}function BG(e,t,r){return je(e,t,r)?lt(r):MG(e,t,r)}function as(e,t,r){let n=Qe(e.$id)?[...t,e]:t,o=e;switch(e[U]){case"Array":return OG(o,n,r);case"Constructor":return _G(o,n,r);case"Intersect":return EG(o,n,r);case"Never":return DG(o,n,r);case"Object":return FG(o,n,r);case"Record":return kG(o,n,r);case"Ref":return AG(o,n,r);case"This":return LG(o,n,r);case"Tuple":return RG(o,n,r);case"Union":return BG(o,n,r);case"Date":case"Symbol":case"Uint8Array":return PG(e,t,r);default:return wG(o,n,r)}}function dI(...e){return e.length===3?as(e[0],e[1],e[2]):as(e[0],[],e[1])}u();function NG(e){return fl(e)&&e[U]!=="Unsafe"}function GG(e,t,r){return ke(r)?r.map(n=>co(e.items,t,n)):r}function jG(e,t,r){let n=e.unevaluatedProperties,i=e.allOf.map(l=>co(l,t,lt(r))).reduce((l,c)=>Be(c)?{...l,...c}:c,{});if(!Be(r)||!Be(i)||!fl(n))return i;let s=Gr(e);for(let l of Object.getOwnPropertyNames(r))s.includes(l)||je(n,t,r[l])&&(i[l]=co(n,t,r[l]));return i}function UG(e,t,r){if(!Be(r)||ke(r))return r;let n=e.additionalProperties;for(let o of Object.getOwnPropertyNames(r)){if(Me(e.properties,o)){r[o]=co(e.properties[o],t,r[o]);continue}if(fl(n)&&je(n,t,r[o])){r[o]=co(n,t,r[o]);continue}delete r[o]}return r}function VG(e,t,r){if(!Be(r))return r;let n=e.additionalProperties,o=Object.getOwnPropertyNames(r),[i,s]=Object.entries(e.patternProperties)[0],l=new RegExp(i);for(let c of o){if(l.test(c)){r[c]=co(s,t,r[c]);continue}if(fl(n)&&je(n,t,r[c])){r[c]=co(n,t,r[c]);continue}delete r[c]}return r}function HG(e,t,r){return co(at(e,t),t,r)}function WG(e,t,r){return co(at(e,t),t,r)}function $G(e,t,r){if(!ke(r))return r;if(ar(e.items))return[];let n=Math.min(r.length,e.items.length);for(let o=0;o<n;o++)r[o]=co(e.items[o],t,r[o]);return r.length>n?r.slice(0,n):r}function zG(e,t,r){for(let n of e.anyOf)if(NG(n)&&je(n,t,r))return co(n,t,r);return r}function co(e,t,r){let n=Qe(e.$id)?[...t,e]:t,o=e;switch(o[U]){case"Array":return GG(o,n,r);case"Intersect":return jG(o,n,r);case"Object":return UG(o,n,r);case"Record":return VG(o,n,r);case"Ref":return HG(o,n,r);case"This":return WG(o,n,r);case"Tuple":return $G(o,n,r);case"Union":return zG(o,n,r);default:return r}}function s1(...e){return e.length===3?co(e[0],e[1],e[2]):co(e[0],[],e[1])}u();function a1(e){return Qe(e)&&!isNaN(e)&&!isNaN(parseFloat(e))}function XG(e){return Jr(e)||ts(e)||he(e)}function Qm(e){return e===!0||he(e)&&e===1||Jr(e)&&e===BigInt("1")||Qe(e)&&(e.toLowerCase()==="true"||e==="1")}function eh(e){return e===!1||he(e)&&(e===0||Object.is(e,-0))||Jr(e)&&e===BigInt("0")||Qe(e)&&(e.toLowerCase()==="false"||e==="0"||e==="-0")}function ZG(e){return Qe(e)&&/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i.test(e)}function YG(e){return Qe(e)&&/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)?$/i.test(e)}function JG(e){return Qe(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 qG(e){return Qe(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 KG(e){return Qe(e)&&/^\d\d\d\d-[0-1]\d-[0-3]\d$/i.test(e)}function QG(e,t){let r=v4(e);return r===t?r:e}function ej(e,t){let r=I4(e);return r===t?r:e}function tj(e,t){let r=x4(e);return r===t?r:e}function rj(e,t){return Qe(e.const)?QG(t,e.const):he(e.const)?ej(t,e.const):ts(e.const)?tj(t,e.const):t}function x4(e){return Qm(e)?!0:eh(e)?!1:e}function nj(e){let t=r=>r.split(".")[0];return a1(e)?BigInt(t(e)):he(e)?BigInt(Math.trunc(e)):eh(e)?BigInt(0):Qm(e)?BigInt(1):e}function v4(e){return XG(e)?e.toString():Qs(e)&&e.description!==void 0?e.description.toString():e}function I4(e){return a1(e)?parseFloat(e):Qm(e)?1:eh(e)?0:e}function oj(e){return a1(e)?parseInt(e):he(e)?e|0:Qm(e)?1:eh(e)?0:e}function ij(e){return Qe(e)&&e.toLowerCase()==="null"?null:e}function sj(e){return Qe(e)&&e==="undefined"?void 0:e}function aj(e){return Cn(e)?e:he(e)?new Date(e):Qm(e)?new Date(1):eh(e)?new Date(0):a1(e)?new Date(parseInt(e)):YG(e)?new Date(`1970-01-01T${e}.000Z`):ZG(e)?new Date(`1970-01-01T${e}`):qG(e)?new Date(`${e}.000Z`):JG(e)?new Date(e):KG(e)?new Date(`${e}T00:00:00.000Z`):e}function lj(e,t,r){return(ke(r)?r:[r]).map(o=>ls(e.items,t,o))}function cj(e,t,r){return nj(r)}function pj(e,t,r){return x4(r)}function uj(e,t,r){return aj(r)}function dj(e,t,r){return oj(r)}function fj(e,t,r){return e.allOf.reduce((n,o)=>ls(o,t,n),r)}function mj(e,t,r){return rj(e,r)}function hj(e,t,r){return ij(r)}function gj(e,t,r){return I4(r)}function yj(e,t,r){if(!Be(r))return r;for(let n of Object.getOwnPropertyNames(e.properties))Me(r,n)&&(r[n]=ls(e.properties[n],t,r[n]));return r}function bj(e,t,r){if(!Be(r))return r;let o=Object.getOwnPropertyNames(e.patternProperties)[0],i=e.patternProperties[o];for(let[s,l]of Object.entries(r))r[s]=ls(i,t,l);return r}function xj(e,t,r){return ls(at(e,t),t,r)}function vj(e,t,r){return v4(r)}function Ij(e,t,r){return Qe(r)||he(r)?Symbol(r):r}function Sj(e,t,r){return ls(at(e,t),t,r)}function Cj(e,t,r){return ke(r)&&!ar(e.items)?r.map((o,i)=>i<e.items.length?ls(e.items[i],t,o):o):r}function Tj(e,t,r){return sj(r)}function Mj(e,t,r){for(let n of e.anyOf){let o=ls(n,t,lt(r));if(je(n,t,o))return o}return r}function ls(e,t,r){let n=Eo(e,t),o=e;switch(e[U]){case"Array":return lj(o,n,r);case"BigInt":return cj(o,n,r);case"Boolean":return pj(o,n,r);case"Date":return uj(o,n,r);case"Integer":return dj(o,n,r);case"Intersect":return fj(o,n,r);case"Literal":return mj(o,n,r);case"Null":return hj(o,n,r);case"Number":return gj(o,n,r);case"Object":return yj(o,n,r);case"Record":return bj(o,n,r);case"Ref":return xj(o,n,r);case"String":return vj(o,n,r);case"Symbol":return Ij(o,n,r);case"This":return Sj(o,n,r);case"Tuple":return Cj(o,n,r);case"Undefined":return Tj(o,n,r);case"Union":return Mj(o,n,r);default:return r}}function l1(...e){return e.length===3?ls(e[0],e[1],e[2]):ls(e[0],[],e[1])}u();u();var zu=class extends ve{constructor(t,r,n){super("Unable to decode value as it does not match the expected schema"),this.schema=t,this.value=r,this.error=n}},Ec=class extends ve{constructor(t,r,n,o){super(o instanceof Error?o.message:"Unknown error"),this.schema=t,this.path=r,this.value=n,this.error=o}};function lr(e,t,r){try{return jt(e)?e[$t].Decode(r):r}catch(n){throw new Ec(e,t,r,n)}}function Pj(e,t,r,n){return ke(n)?lr(e,r,n.map((o,i)=>cs(e.items,t,`${r}/${i}`,o))):lr(e,r,n)}function wj(e,t,r,n){if(!Be(n)||qr(n))return lr(e,r,n);let o=gl(e),i=o.map(d=>d[0]),s={...n};for(let[d,m]of o)d in s&&(s[d]=cs(m,t,`${r}/${d}`,s[d]));if(!jt(e.unevaluatedProperties))return lr(e,r,s);let l=Object.getOwnPropertyNames(s),c=e.unevaluatedProperties,p={...s};for(let d of l)i.includes(d)||(p[d]=lr(c,`${r}/${d}`,p[d]));return lr(e,r,p)}function Oj(e,t,r,n){return lr(e,r,cs(e.not,t,r,n))}function _j(e,t,r,n){if(!Be(n))return lr(e,r,n);let o=Gr(e),i={...n};for(let p of o)Me(i,p)&&(ar(i[p])&&(!Mu(e.properties[p])||vt.IsExactOptionalProperty(i,p))||(i[p]=cs(e.properties[p],t,`${r}/${p}`,i[p])));if(!et(e.additionalProperties))return lr(e,r,i);let s=Object.getOwnPropertyNames(i),l=e.additionalProperties,c={...i};for(let p of s)o.includes(p)||(c[p]=lr(l,`${r}/${p}`,c[p]));return lr(e,r,c)}function Ej(e,t,r,n){if(!Be(n))return lr(e,r,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]=cs(e.patternProperties[o],t,`${r}/${d}`,s[d]));if(!et(e.additionalProperties))return lr(e,r,s);let l=Object.getOwnPropertyNames(s),c=e.additionalProperties,p={...s};for(let d of l)i.test(d)||(p[d]=lr(c,`${r}/${d}`,p[d]));return lr(e,r,p)}function Dj(e,t,r,n){let o=at(e,t);return lr(e,r,cs(o,t,r,n))}function Fj(e,t,r,n){let o=at(e,t);return lr(e,r,cs(o,t,r,n))}function kj(e,t,r,n){return ke(n)&&ke(e.items)?lr(e,r,e.items.map((o,i)=>cs(o,t,`${r}/${i}`,n[i]))):lr(e,r,n)}function Aj(e,t,r,n){for(let o of e.anyOf){if(!je(o,t,n))continue;let i=cs(o,t,r,n);return lr(e,r,i)}return lr(e,r,n)}function cs(e,t,r,n){let o=Eo(e,t),i=e;switch(e[U]){case"Array":return Pj(i,o,r,n);case"Intersect":return wj(i,o,r,n);case"Not":return Oj(i,o,r,n);case"Object":return _j(i,o,r,n);case"Record":return Ej(i,o,r,n);case"Ref":return Dj(i,o,r,n);case"Symbol":return lr(i,r,n);case"This":return Fj(i,o,r,n);case"Tuple":return kj(i,o,r,n);case"Union":return Aj(i,o,r,n);default:return lr(i,r,n)}}function Xu(e,t,r){return cs(e,t,"",r)}u();var Zu=class extends ve{constructor(t,r,n){super("The encoded value does not match the expected schema"),this.schema=t,this.value=r,this.error=n}},Dc=class extends ve{constructor(t,r,n,o){super(`${o instanceof Error?o.message:"Unknown error"}`),this.schema=t,this.path=r,this.value=n,this.error=o}};function gn(e,t,r){try{return jt(e)?e[$t].Encode(r):r}catch(n){throw new Dc(e,t,r,n)}}function Lj(e,t,r,n){let o=gn(e,r,n);return ke(o)?o.map((i,s)=>ps(e.items,t,`${r}/${s}`,i)):o}function Rj(e,t,r,n){let o=gn(e,r,n);if(!Be(n)||qr(n))return o;let i=gl(e),s=i.map(m=>m[0]),l={...o};for(let[m,g]of i)m in l&&(l[m]=ps(g,t,`${r}/${m}`,l[m]));if(!jt(e.unevaluatedProperties))return l;let c=Object.getOwnPropertyNames(l),p=e.unevaluatedProperties,d={...l};for(let m of c)s.includes(m)||(d[m]=gn(p,`${r}/${m}`,d[m]));return d}function Bj(e,t,r,n){return gn(e.not,r,gn(e,r,n))}function Nj(e,t,r,n){let o=gn(e,r,n);if(!Be(o))return o;let i=Gr(e),s={...o};for(let d of i)Me(s,d)&&(ar(s[d])&&(!Mu(e.properties[d])||vt.IsExactOptionalProperty(s,d))||(s[d]=ps(e.properties[d],t,`${r}/${d}`,s[d])));if(!et(e.additionalProperties))return s;let l=Object.getOwnPropertyNames(s),c=e.additionalProperties,p={...s};for(let d of l)i.includes(d)||(p[d]=gn(c,`${r}/${d}`,p[d]));return p}function Gj(e,t,r,n){let o=gn(e,r,n);if(!Be(n))return o;let i=Object.getOwnPropertyNames(e.patternProperties)[0],s=new RegExp(i),l={...o};for(let m of Object.getOwnPropertyNames(n))s.test(m)&&(l[m]=ps(e.patternProperties[i],t,`${r}/${m}`,l[m]));if(!et(e.additionalProperties))return l;let c=Object.getOwnPropertyNames(l),p=e.additionalProperties,d={...l};for(let m of c)s.test(m)||(d[m]=gn(p,`${r}/${m}`,d[m]));return d}function jj(e,t,r,n){let o=at(e,t),i=ps(o,t,r,n);return gn(e,r,i)}function Uj(e,t,r,n){let o=at(e,t),i=ps(o,t,r,n);return gn(e,r,i)}function Vj(e,t,r,n){let o=gn(e,r,n);return ke(e.items)?e.items.map((i,s)=>ps(i,t,`${r}/${s}`,o[s])):[]}function Hj(e,t,r,n){for(let o of e.anyOf){if(!je(o,t,n))continue;let i=ps(o,t,r,n);return gn(e,r,i)}for(let o of e.anyOf){let i=ps(o,t,r,n);if(je(e,t,i))return gn(e,r,i)}return gn(e,r,n)}function ps(e,t,r,n){let o=Eo(e,t),i=e;switch(e[U]){case"Array":return Lj(i,o,r,n);case"Intersect":return Rj(i,o,r,n);case"Not":return Bj(i,o,r,n);case"Object":return Nj(i,o,r,n);case"Record":return Gj(i,o,r,n);case"Ref":return jj(i,o,r,n);case"This":return Uj(i,o,r,n);case"Tuple":return Vj(i,o,r,n);case"Union":return Hj(i,o,r,n);default:return gn(i,r,n)}}function c1(e,t,r){return ps(e,t,"",r)}u();function Wj(e,t){return jt(e)||jr(e.items,t)}function $j(e,t){return jt(e)||jr(e.items,t)}function zj(e,t){return jt(e)||jr(e.returns,t)||e.parameters.some(r=>jr(r,t))}function Xj(e,t){return jt(e)||jr(e.returns,t)||e.parameters.some(r=>jr(r,t))}function Zj(e,t){return jt(e)||jt(e.unevaluatedProperties)||e.allOf.some(r=>jr(r,t))}function Yj(e,t){return jt(e)||jr(e.items,t)}function Jj(e,t){return jt(e)||jr(e.not,t)}function qj(e,t){return jt(e)||Object.values(e.properties).some(r=>jr(r,t))||et(e.additionalProperties)&&jr(e.additionalProperties,t)}function Kj(e,t){return jt(e)||jr(e.item,t)}function Qj(e,t){let r=Object.getOwnPropertyNames(e.patternProperties)[0],n=e.patternProperties[r];return jt(e)||jr(n,t)||et(e.additionalProperties)&&jt(e.additionalProperties)}function eU(e,t){return jt(e)?!0:jr(at(e,t),t)}function tU(e,t){return jt(e)?!0:jr(at(e,t),t)}function rU(e,t){return jt(e)||!ar(e.items)&&e.items.some(r=>jr(r,t))}function nU(e,t){return jt(e)||e.anyOf.some(r=>jr(r,t))}function jr(e,t){let r=Eo(e,t),n=e;if(e.$id&&fI.has(e.$id))return!1;switch(e.$id&&fI.add(e.$id),e[U]){case"Array":return Wj(n,r);case"AsyncIterator":return $j(n,r);case"Constructor":return zj(n,r);case"Function":return Xj(n,r);case"Intersect":return Zj(n,r);case"Iterator":return Yj(n,r);case"Not":return Jj(n,r);case"Object":return qj(n,r);case"Promise":return Kj(n,r);case"Record":return Qj(n,r);case"Ref":return eU(n,r);case"This":return tU(n,r);case"Tuple":return rU(n,r);case"Union":return nU(n,r);default:return jt(e)}}var fI=new Set;function us(e,t){return fI.clear(),jr(e,t)}function S4(...e){let[t,r,n]=e.length===3?[e[0],e[1],e[2]]:[e[0],[],e[1]];if(!je(t,r,n))throw new zu(t,n,ss(t,r,n).First());return us(t,r)?Xu(t,r,n):n}u();function pa(e,t){let r=Me(e,"default")?e.default:void 0,n=ul(r)?r():lt(r);return ar(t)?n:Be(t)&&Be(n)?Object.assign(n,t):t}function mI(e){return fl(e)&&"default"in e}function oU(e,t,r){let n=pa(e,r);if(!ke(n))return n;for(let o=0;o<n.length;o++)n[o]=po(e.items,t,n[o]);return n}function iU(e,t,r){return Cn(r)?r:pa(e,r)}function sU(e,t,r){let n=pa(e,r);return e.allOf.reduce((o,i)=>{let s=po(i,t,n);return Be(s)?{...o,...s}:s},{})}function aU(e,t,r){let n=pa(e,r);if(!Be(n))return n;let o=Object.getOwnPropertyNames(e.properties);for(let i of o){let s=po(e.properties[i],t,n[i]);ar(s)||(n[i]=po(e.properties[i],t,n[i]))}if(!mI(e.additionalProperties))return n;for(let i of Object.getOwnPropertyNames(n))o.includes(i)||(n[i]=po(e.additionalProperties,t,n[i]));return n}function lU(e,t,r){let n=pa(e,r);if(!Be(n))return n;let o=e.additionalProperties,[i,s]=Object.entries(e.patternProperties)[0],l=new RegExp(i);for(let c of Object.getOwnPropertyNames(n))l.test(c)&&mI(s)&&(n[c]=po(s,t,n[c]));if(!mI(o))return n;for(let c of Object.getOwnPropertyNames(n))l.test(c)||(n[c]=po(o,t,n[c]));return n}function cU(e,t,r){return po(at(e,t),t,pa(e,r))}function pU(e,t,r){return po(at(e,t),t,r)}function uU(e,t,r){let n=pa(e,r);if(!ke(n)||ar(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]=po(o[s],t,n[s]));return n}function dU(e,t,r){let n=pa(e,r);for(let o of e.anyOf){let i=po(o,t,lt(n));if(je(o,t,i))return i}return n}function po(e,t,r){let n=Eo(e,t),o=e;switch(o[U]){case"Array":return oU(o,n,r);case"Date":return iU(o,n,r);case"Intersect":return sU(o,n,r);case"Object":return aU(o,n,r);case"Record":return lU(o,n,r);case"Ref":return cU(o,n,r);case"This":return pU(o,n,r);case"Tuple":return uU(o,n,r);case"Union":return dU(o,n,r);default:return pa(o,r)}}function p1(...e){return e.length===3?po(e[0],e[1],e[2]):po(e[0],[],e[1])}u();u();var fi={};zs(fi,{Delete:()=>mU,Format:()=>th,Get:()=>gU,Has:()=>hU,Set:()=>fU,ValuePointerRootDeleteError:()=>d1,ValuePointerRootSetError:()=>u1});u();var u1=class extends ve{constructor(t,r,n){super("Cannot set root value"),this.value=t,this.path=r,this.update=n}},d1=class extends ve{constructor(t,r){super("Cannot delete root value"),this.value=t,this.path=r}};function C4(e){return e.indexOf("~")===-1?e:e.replace(/~1/g,"/").replace(/~0/g,"~")}function*th(e){if(e==="")return;let[t,r]=[0,0];for(let n=0;n<e.length;n++)e.charAt(n)==="/"?(n===0||(r=n,yield C4(e.slice(t,r))),t=n+1):r=n;yield C4(e.slice(t))}function fU(e,t,r){if(t==="")throw new u1(e,t,r);let[n,o,i]=[null,e,""];for(let s of th(t))o[s]===void 0&&(o[s]={}),n=o,o=o[s],i=s;n[i]=r}function mU(e,t){if(t==="")throw new d1(e,t);let[r,n,o]=[null,e,""];for(let i of th(t)){if(n[i]===void 0||n[i]===null)return;r=n,n=n[i],o=i}if(Array.isArray(r)){let i=parseInt(o);r.splice(i,1)}else delete r[o]}function hU(e,t){if(t==="")return!0;let[r,n,o]=[null,e,""];for(let i of th(t)){if(n[i]===void 0)return!1;r=n,n=n[i],o=i}return Object.getOwnPropertyNames(r).includes(o)}function gU(e,t){if(t==="")return e;let r=e;for(let n of th(t)){if(r[n]===void 0)return;r=r[n]}return r}u();function yU(e,t){if(!Be(t))return!1;let r=[...Object.keys(e),...Object.getOwnPropertySymbols(e)],n=[...Object.keys(t),...Object.getOwnPropertySymbols(t)];return r.length!==n.length?!1:r.every(o=>Fc(e[o],t[o]))}function bU(e,t){return Cn(t)&&e.getTime()===t.getTime()}function xU(e,t){return!ke(t)||e.length!==t.length?!1:e.every((r,n)=>Fc(r,t[n]))}function vU(e,t){return!Co(t)||e.length!==t.length||Object.getPrototypeOf(e).constructor.name!==Object.getPrototypeOf(t).constructor.name?!1:e.every((r,n)=>Fc(r,t[n]))}function IU(e,t){return e===t}function Fc(e,t){if(Cn(e))return bU(e,t);if(Co(e))return vU(e,t);if(ke(e))return xU(e,t);if(Be(e))return yU(e,t);if(qr(e))return IU(e,t);throw new Error("ValueEquals: Unable to compare value")}var SU=Ot({type:ht("insert"),path:Mo(),value:aa()}),CU=Ot({type:ht("update"),path:Mo(),value:aa()}),TU=Ot({type:ht("delete"),path:Mo()}),M4=Ct([SU,CU,TU]),f1=class extends ve{constructor(t,r){super(r),this.value=t}};function m1(e,t){return{type:"update",path:e,value:t}}function P4(e,t){return{type:"insert",path:e,value:t}}function w4(e){return{type:"delete",path:e}}function T4(e){if(globalThis.Object.getOwnPropertySymbols(e).length>0)throw new f1(e,"Cannot diff objects with symbols")}function*MU(e,t,r){if(T4(t),T4(r),!y2(r))return yield m1(e,r);let n=globalThis.Object.getOwnPropertyNames(t),o=globalThis.Object.getOwnPropertyNames(r);for(let i of o)Me(t,i)||(yield P4(`${e}/${i}`,r[i]));for(let i of n)Me(r,i)&&(Fc(t,r)||(yield*h1(`${e}/${i}`,t[i],r[i])));for(let i of n)Me(r,i)||(yield w4(`${e}/${i}`))}function*PU(e,t,r){if(!ke(r))return yield m1(e,r);for(let n=0;n<Math.min(t.length,r.length);n++)yield*h1(`${e}/${n}`,t[n],r[n]);for(let n=0;n<r.length;n++)n<t.length||(yield P4(`${e}/${n}`,r[n]));for(let n=t.length-1;n>=0;n--)n<r.length||(yield w4(`${e}/${n}`))}function*wU(e,t,r){if(!Co(r)||t.length!==r.length||globalThis.Object.getPrototypeOf(t).constructor.name!==globalThis.Object.getPrototypeOf(r).constructor.name)return yield m1(e,r);for(let n=0;n<Math.min(t.length,r.length);n++)yield*h1(`${e}/${n}`,t[n],r[n])}function*OU(e,t,r){t!==r&&(yield m1(e,r))}function*h1(e,t,r){if(y2(t))return yield*MU(e,t,r);if(ke(t))return yield*PU(e,t,r);if(Co(t))return yield*wU(e,t,r);if(qr(t))return yield*OU(e,t,r);throw new f1(t,"Unable to diff value")}function O4(e,t){return[...h1("",e,t)]}function _U(e){return e.length>0&&e[0].path===""&&e[0].type==="update"}function EU(e){return e.length===0}function _4(e,t){if(_U(t))return lt(t[0].value);if(EU(t))return lt(e);let r=lt(e);for(let n of t)switch(n.type){case"insert":{fi.Set(r,n.path,n.value);break}case"update":{fi.Set(r,n.path,n.value);break}case"delete":{fi.Delete(r,n.path);break}}return r}u();function E4(...e){let[t,r,n]=e.length===3?[e[0],e[1],e[2]]:[e[0],[],e[1]],o=us(t,r)?c1(t,r,n):n;if(!je(t,r,o))throw new Zu(t,o,ss(t,r,o).First());return o}u();var g1=class extends ve{constructor(t){super(t)}};function DU(e,t,r,n){if(!Be(r))fi.Set(e,t,lt(n));else{let o=Object.getOwnPropertyNames(r),i=Object.getOwnPropertyNames(n);for(let s of o)i.includes(s)||delete r[s];for(let s of i)o.includes(s)||(r[s]=null);for(let s of i)hI(e,`${t}/${s}`,r[s],n[s])}}function FU(e,t,r,n){if(!ke(r))fi.Set(e,t,lt(n));else{for(let o=0;o<n.length;o++)hI(e,`${t}/${o}`,r[o],n[o]);r.splice(n.length)}}function kU(e,t,r,n){if(Co(r)&&r.length===n.length)for(let o=0;o<r.length;o++)r[o]=n[o];else fi.Set(e,t,lt(n))}function AU(e,t,r,n){r!==n&&fi.Set(e,t,n)}function hI(e,t,r,n){if(ke(n))return FU(e,t,r,n);if(Co(n))return kU(e,t,r,n);if(Be(n))return DU(e,t,r,n);if(qr(n))return AU(e,t,r,n)}function D4(e){return Co(e)||qr(e)}function LU(e,t){return Be(e)&&ke(t)||ke(e)&&Be(t)}function F4(e,t){if(D4(e)||D4(t))throw new g1("Only object and array types can be mutated at the root level");if(LU(e,t))throw new g1("Cannot assign due type mismatch of assignable values");hI(e,"",e,t)}u();var RU=[(e,t,r)=>lt(r),(e,t,r)=>p1(e,t,r),(e,t,r)=>s1(e,t,r),(e,t,r)=>l1(e,t,r),(e,t,r)=>(o1(e,t,r),r),(e,t,r)=>us(e,t)?Xu(e,t,r):r];function k4(e,t,r){return RU.reduce((n,o)=>o(e,t,n),r)}function A4(...e){return e.length===3?k4(e[0],e[1],e[2]):k4(e[0],[],e[1])}u();var mi={};zs(mi,{Assert:()=>o1,Cast:()=>dI,Check:()=>je,Clean:()=>s1,Clone:()=>lt,Convert:()=>l1,Create:()=>Fo,Decode:()=>S4,Default:()=>p1,Diff:()=>O4,Edit:()=>M4,Encode:()=>E4,Equal:()=>Fc,Errors:()=>ss,Hash:()=>xl,Mutate:()=>F4,Parse:()=>A4,Patch:()=>_4,ValueErrorIterator:()=>Do});u();u();var L4={},BU=function(e,t,r,n,o){var i=new Worker(L4[t]||(L4[t]=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 l=s.data,c=l.$e$;if(c){var p=new Error(c[0]);p.code=c[1],p.stack=c[2],o(p,null)}else o(null,l)},i.postMessage(r,n),i},_t=Uint8Array,Pn=Uint16Array,ih=Int32Array,Qu=new _t([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]),ed=new _t([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]),rh=new _t([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),N4=function(e,t){for(var r=new Pn(31),n=0;n<31;++n)r[n]=t+=1<<e[n-1];for(var o=new ih(r[30]),n=1;n<30;++n)for(var i=r[n];i<r[n+1];++i)o[i]=i-r[n]<<5|n;return{b:r,r:o}},G4=N4(Qu,2),II=G4.b,I1=G4.r;II[28]=258,I1[258]=28;var j4=N4(ed,0),U4=j4.b,yI=j4.r,nh=new Pn(32768);for(gt=0;gt<32768;++gt)ua=(gt&43690)>>1|(gt&21845)<<1,ua=(ua&52428)>>2|(ua&13107)<<2,ua=(ua&61680)>>4|(ua&3855)<<4,nh[gt]=((ua&65280)>>8|(ua&255)<<8)>>1;var ua,gt,Ao=function(e,t,r){for(var n=e.length,o=0,i=new Pn(t);o<n;++o)e[o]&&++i[e[o]-1];var s=new Pn(t);for(o=1;o<t;++o)s[o]=s[o-1]+i[o-1]<<1;var l;if(r){l=new Pn(1<<t);var c=15-t;for(o=0;o<n;++o)if(e[o])for(var p=o<<4|e[o],d=t-e[o],m=s[e[o]-1]++<<d,g=m|(1<<d)-1;m<=g;++m)l[nh[m]>>c]=p}else for(l=new Pn(n),o=0;o<n;++o)e[o]&&(l[o]=nh[s[e[o]-1]++]>>15-e[o]);return l},da=new _t(288);for(gt=0;gt<144;++gt)da[gt]=8;var gt;for(gt=144;gt<256;++gt)da[gt]=9;var gt;for(gt=256;gt<280;++gt)da[gt]=7;var gt;for(gt=280;gt<288;++gt)da[gt]=8;var gt,qu=new _t(32);for(gt=0;gt<32;++gt)qu[gt]=5;var gt,V4=Ao(da,9,0),H4=Ao(da,9,1),W4=Ao(qu,5,0),$4=Ao(qu,5,1),b1=function(e){for(var t=e[0],r=1;r<e.length;++r)e[r]>t&&(t=e[r]);return t},ko=function(e,t,r){var n=t/8|0;return(e[n]|e[n+1]<<8)>>(t&7)&r},x1=function(e,t){var r=t/8|0;return(e[r]|e[r+1]<<8|e[r+2]<<16)>>(t&7)},sh=function(e){return(e+7)/8|0},vl=function(e,t,r){return(t==null||t<0)&&(t=0),(r==null||r>e.length)&&(r=e.length),new _t(e.subarray(t,r))},M1={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},z4=["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"],cr=function(e,t,r){var n=new Error(t||z4[e]);if(n.code=e,Error.captureStackTrace&&Error.captureStackTrace(n,cr),!r)throw n;return n},X4=function(e,t,r,n){var o=e.length,i=n?n.length:0;if(!o||t.f&&!t.l)return r||new _t(0);var s=!r,l=s||t.i!=2,c=t.i;s&&(r=new _t(o*3));var p=function(D){var ne=r.length;if(D>ne){var K=new _t(Math.max(ne*2,D));K.set(r),r=K}},d=t.f||0,m=t.p||0,g=t.b||0,x=t.l,v=t.d,C=t.m,I=t.n,S=o*8;do{if(!x){d=ko(e,m,1);var P=ko(e,m+1,3);if(m+=3,P)if(P==1)x=H4,v=$4,C=9,I=5;else if(P==2){var B=ko(e,m,31)+257,j=ko(e,m+10,15)+4,L=B+ko(e,m+5,31)+1;m+=14;for(var N=new _t(L),X=new _t(19),Z=0;Z<j;++Z)X[rh[Z]]=ko(e,m+Z*3,7);m+=j*3;for(var re=b1(X),Q=(1<<re)-1,xe=Ao(X,re,1),Z=0;Z<L;){var Ce=xe[ko(e,m,Q)];m+=Ce&15;var O=Ce>>4;if(O<16)N[Z++]=O;else{var ye=0,Ee=0;for(O==16?(Ee=3+ko(e,m,3),m+=2,ye=N[Z-1]):O==17?(Ee=3+ko(e,m,7),m+=3):O==18&&(Ee=11+ko(e,m,127),m+=7);Ee--;)N[Z++]=ye}}var we=N.subarray(0,B),pe=N.subarray(B);C=b1(we),I=b1(pe),x=Ao(we,C,1),v=Ao(pe,I,1)}else cr(1);else{var O=sh(m)+4,M=e[O-4]|e[O-3]<<8,E=O+M;if(E>o){c&&cr(0);break}l&&p(g+M),r.set(e.subarray(O,E),g),t.b=g+=M,t.p=m=E*8,t.f=d;continue}if(m>S){c&&cr(0);break}}l&&p(g+131072);for(var Ae=(1<<C)-1,mt=(1<<I)-1,Je=m;;Je=m){var ye=x[x1(e,m)&Ae],ut=ye>>4;if(m+=ye&15,m>S){c&&cr(0);break}if(ye||cr(2),ut<256)r[g++]=ut;else if(ut==256){Je=m,x=null;break}else{var qe=ut-254;if(ut>264){var Z=ut-257,Te=Qu[Z];qe=ko(e,m,(1<<Te)-1)+II[Z],m+=Te}var xt=v[x1(e,m)&mt],Pt=xt>>4;xt||cr(3),m+=xt&15;var pe=U4[Pt];if(Pt>3){var Te=ed[Pt];pe+=x1(e,m)&(1<<Te)-1,m+=Te}if(m>S){c&&cr(0);break}l&&p(g+131072);var nr=g+qe;if(g<pe){var k=i-pe,W=Math.min(pe,nr);for(k+g<0&&cr(3);g<W;++g)r[g]=n[k+g]}for(;g<nr;++g)r[g]=r[g-pe]}}t.l=x,t.p=Je,t.b=g,t.f=d,x&&(d=1,t.m=C,t.d=v,t.n=I)}while(!d);return g!=r.length&&s?vl(r,0,g):r.subarray(0,g)},ds=function(e,t,r){r<<=t&7;var n=t/8|0;e[n]|=r,e[n+1]|=r>>8},Yu=function(e,t,r){r<<=t&7;var n=t/8|0;e[n]|=r,e[n+1]|=r>>8,e[n+2]|=r>>16},v1=function(e,t){for(var r=[],n=0;n<e.length;++n)e[n]&&r.push({s:n,f:e[n]});var o=r.length,i=r.slice();if(!o)return{t:CI,l:0};if(o==1){var s=new _t(r[0].s+1);return s[r[0].s]=1,{t:s,l:1}}r.sort(function(E,B){return E.f-B.f}),r.push({s:-1,f:25001});var l=r[0],c=r[1],p=0,d=1,m=2;for(r[0]={s:-1,f:l.f+c.f,l,r:c};d!=o-1;)l=r[r[p].f<r[m].f?p++:m++],c=r[p!=d&&r[p].f<r[m].f?p++:m++],r[d++]={s:-1,f:l.f+c.f,l,r:c};for(var g=i[0].s,n=1;n<o;++n)i[n].s>g&&(g=i[n].s);var x=new Pn(g+1),v=S1(r[d-1],x,0);if(v>t){var n=0,C=0,I=v-t,S=1<<I;for(i.sort(function(B,j){return x[j.s]-x[B.s]||B.f-j.f});n<o;++n){var P=i[n].s;if(x[P]>t)C+=S-(1<<v-x[P]),x[P]=t;else break}for(C>>=I;C>0;){var O=i[n].s;x[O]<t?C-=1<<t-x[O]++-1:++n}for(;n>=0&&C;--n){var M=i[n].s;x[M]==t&&(--x[M],++C)}v=t}return{t:new _t(x),l:v}},S1=function(e,t,r){return e.s==-1?Math.max(S1(e.l,t,r+1),S1(e.r,t,r+1)):t[e.s]=r},bI=function(e){for(var t=e.length;t&&!e[--t];);for(var r=new Pn(++t),n=0,o=e[0],i=1,s=function(c){r[n++]=c},l=1;l<=t;++l)if(e[l]==o&&l!=t)++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[l]}return{c:r.subarray(0,n),n:t}},Ju=function(e,t){for(var r=0,n=0;n<t.length;++n)r+=e[n]*t[n];return r},SI=function(e,t,r){var n=r.length,o=sh(t+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]=r[i];return(o+4+n)*8},xI=function(e,t,r,n,o,i,s,l,c,p,d){ds(t,d++,r),++o[256];for(var m=v1(o,15),g=m.t,x=m.l,v=v1(i,15),C=v.t,I=v.l,S=bI(g),P=S.c,O=S.n,M=bI(C),E=M.c,B=M.n,j=new Pn(19),L=0;L<P.length;++L)++j[P[L]&31];for(var L=0;L<E.length;++L)++j[E[L]&31];for(var N=v1(j,7),X=N.t,Z=N.l,re=19;re>4&&!X[rh[re-1]];--re);var Q=p+5<<3,xe=Ju(o,da)+Ju(i,qu)+s,Ce=Ju(o,g)+Ju(i,C)+s+14+3*re+Ju(j,X)+2*j[16]+3*j[17]+7*j[18];if(c>=0&&Q<=xe&&Q<=Ce)return SI(t,d,e.subarray(c,c+p));var ye,Ee,we,pe;if(ds(t,d,1+(Ce<xe)),d+=2,Ce<xe){ye=Ao(g,x,0),Ee=g,we=Ao(C,I,0),pe=C;var Ae=Ao(X,Z,0);ds(t,d,O-257),ds(t,d+5,B-1),ds(t,d+10,re-4),d+=14;for(var L=0;L<re;++L)ds(t,d+3*L,X[rh[L]]);d+=3*re;for(var mt=[P,E],Je=0;Je<2;++Je)for(var ut=mt[Je],L=0;L<ut.length;++L){var qe=ut[L]&31;ds(t,d,Ae[qe]),d+=X[qe],qe>15&&(ds(t,d,ut[L]>>5&127),d+=ut[L]>>12)}}else ye=V4,Ee=da,we=W4,pe=qu;for(var L=0;L<l;++L){var Te=n[L];if(Te>255){var qe=Te>>18&31;Yu(t,d,ye[qe+257]),d+=Ee[qe+257],qe>7&&(ds(t,d,Te>>23&31),d+=Qu[qe]);var xt=Te&31;Yu(t,d,we[xt]),d+=pe[xt],xt>3&&(Yu(t,d,Te>>5&8191),d+=ed[xt])}else Yu(t,d,ye[Te]),d+=Ee[Te]}return Yu(t,d,ye[256]),d+Ee[256]},Z4=new ih([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),CI=new _t(0),Y4=function(e,t,r,n,o,i){var s=i.z||e.length,l=new _t(n+s+5*(1+Math.ceil(s/7e3))+o),c=l.subarray(n,l.length-o),p=i.l,d=(i.r||0)&7;if(t){d&&(c[0]=i.r>>3);for(var m=Z4[t-1],g=m>>13,x=m&8191,v=(1<<r)-1,C=i.p||new Pn(32768),I=i.h||new Pn(v+1),S=Math.ceil(r/3),P=2*S,O=function(ee){return(e[ee]^e[ee+1]<<S^e[ee+2]<<P)&v},M=new ih(25e3),E=new Pn(288),B=new Pn(32),j=0,L=0,N=i.i||0,X=0,Z=i.w||0,re=0;N+2<s;++N){var Q=O(N),xe=N&32767,Ce=I[Q];if(C[xe]=Ce,I[Q]=xe,Z<=N){var ye=s-N;if((j>7e3||X>24576)&&(ye>423||!p)){d=xI(e,c,0,M,E,B,L,X,re,N-re,d),X=j=L=0,re=N;for(var Ee=0;Ee<286;++Ee)E[Ee]=0;for(var Ee=0;Ee<30;++Ee)B[Ee]=0}var we=2,pe=0,Ae=x,mt=xe-Ce&32767;if(ye>2&&Q==O(N-mt))for(var Je=Math.min(g,ye)-1,ut=Math.min(32767,N),qe=Math.min(258,ye);mt<=ut&&--Ae&&xe!=Ce;){if(e[N+we]==e[N+we-mt]){for(var Te=0;Te<qe&&e[N+Te]==e[N+Te-mt];++Te);if(Te>we){if(we=Te,pe=mt,Te>Je)break;for(var xt=Math.min(mt,Te-2),Pt=0,Ee=0;Ee<xt;++Ee){var nr=N-mt+Ee&32767,k=C[nr],W=nr-k&32767;W>Pt&&(Pt=W,Ce=nr)}}}xe=Ce,Ce=C[xe],mt+=xe-Ce&32767}if(pe){M[X++]=268435456|I1[we]<<18|yI[pe];var D=I1[we]&31,ne=yI[pe]&31;L+=Qu[D]+ed[ne],++E[257+D],++B[ne],Z=N+we,++j}else M[X++]=e[N],++E[e[N]]}}for(N=Math.max(N,Z);N<s;++N)M[X++]=e[N],++E[e[N]];d=xI(e,c,p,M,E,B,L,X,re,N-re,d),p||(i.r=d&7|c[d/8|0]<<3,d-=7,i.h=I,i.p=C,i.i=N,i.w=Z)}else{for(var N=i.w||0;N<s+p;N+=65535){var K=N+65535;K>=s&&(c[d/8|0]=p,K=s),d=SI(c,d+1,e.subarray(N,K))}i.i=s}return vl(l,0,n+sh(d)+o)},NU=function(){for(var e=new Int32Array(256),t=0;t<256;++t){for(var r=t,n=9;--n;)r=(r&1&&-306674912)^r>>>1;e[t]=r}return e}(),J4=function(){var e=-1;return{p:function(t){for(var r=e,n=0;n<t.length;++n)r=NU[r&255^t[n]]^r>>>8;e=r},d:function(){return~e}}};var q4=function(e,t,r,n,o){if(!o&&(o={l:1},t.dictionary)){var i=t.dictionary.subarray(-32768),s=new _t(i.length+e.length);s.set(i),s.set(e,i.length),e=s,o.w=i.length}return Y4(e,t.level==null?6:t.level,t.mem==null?o.l?Math.ceil(Math.max(8,Math.min(13,Math.log(e.length)))*1.5):20:12+t.mem,r,n,o)},P1=function(e,t){var r={};for(var n in e)r[n]=e[n];for(var n in t)r[n]=t[n];return r},R4=function(e,t,r){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 l=n[s],c=i[s];if(typeof l=="function"){t+=";"+c+"=";var p=l.toString();if(l.prototype)if(p.indexOf("[native code]")!=-1){var d=p.indexOf(" ",8)+1;t+=p.slice(d,p.indexOf("(",d))}else{t+=p;for(var m in l.prototype)t+=";"+c+".prototype."+m+"="+l.prototype[m].toString()}else t+=p}else r[c]=l}return t},y1=[],GU=function(e){var t=[];for(var r in e)e[r].buffer&&t.push((e[r]=new e[r].constructor(e[r])).buffer);return t},jU=function(e,t,r,n){if(!y1[r]){for(var o="",i={},s=e.length-1,l=0;l<s;++l)o=R4(e[l],o,i);y1[r]={c:R4(e[s],o,i),e:i}}var c=P1({},y1[r].e);return BU(y1[r].c+";onmessage=function(e){for(var k in e.data)self[k]=e.data[k];onmessage="+t.toString()+"}",r,c,GU(c),n)},UU=function(){return[_t,Pn,ih,Qu,ed,rh,II,U4,H4,$4,nh,z4,Ao,b1,ko,x1,sh,vl,cr,X4,_1,w1,K4]},VU=function(){return[_t,Pn,ih,Qu,ed,rh,I1,yI,V4,da,W4,qu,nh,Z4,CI,Ao,ds,Yu,v1,S1,bI,Ju,SI,xI,sh,vl,Y4,q4,O1,w1]};var w1=function(e){return postMessage(e,[e.buffer])},K4=function(e){return e&&{out:e.size&&new _t(e.size),dictionary:e.dictionary}},Q4=function(e,t,r,n,o,i){var s=jU(r,n,o,function(l,c){s.terminate(),i(l,c)});return s.postMessage([e,t],t.consume?[e.buffer]:[]),function(){s.terminate()}};var hi=function(e,t){return e[t]|e[t+1]<<8},rn=function(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0},gI=function(e,t){return rn(e,t)+rn(e,t+4)*4294967296},tn=function(e,t,r){for(;r;++t)e[t]=r,r>>>=8};function HU(e,t,r){return r||(r=t,t={}),typeof r!="function"&&cr(7),Q4(e,t,[VU],function(n){return w1(O1(n.data[0],n.data[1]))},0,r)}function O1(e,t){return q4(e,t||{},0,0)}function WU(e,t,r){return r||(r=t,t={}),typeof r!="function"&&cr(7),Q4(e,t,[UU],function(n){return w1(_1(n.data[0],K4(n.data[1])))},1,r)}function _1(e,t){return X4(e,{i:2},t&&t.out,t&&t.dictionary)}var TI=function(e,t,r,n){for(var o in e){var i=e[o],s=t+o,l=n;Array.isArray(i)&&(l=P1(n,i[1]),i=i[0]),i instanceof _t?r[s]=[i,l]:(r[s+="/"]=[new _t(0),l],TI(i,s,r,n))}},B4=typeof TextEncoder<"u"&&new TextEncoder,vI=typeof TextDecoder<"u"&&new TextDecoder,$U=0;try{vI.decode(CI,{stream:!0}),$U=1}catch{}var zU=function(e){for(var t="",r=0;;){var n=e[r++],o=(n>127)+(n>223)+(n>239);if(r+o>e.length)return{s:t,r:vl(e,r-1)};o?o==3?(n=((n&15)<<18|(e[r++]&63)<<12|(e[r++]&63)<<6|e[r++]&63)-65536,t+=String.fromCharCode(55296|n>>10,56320|n&1023)):o&1?t+=String.fromCharCode((n&31)<<6|e[r++]&63):t+=String.fromCharCode((n&15)<<12|(e[r++]&63)<<6|e[r++]&63):t+=String.fromCharCode(n)}};function Ku(e,t){if(t){for(var r=new _t(e.length),n=0;n<e.length;++n)r[n]=e.charCodeAt(n);return r}if(B4)return B4.encode(e);for(var o=e.length,i=new _t(e.length+(e.length>>1)),s=0,l=function(d){i[s++]=d},n=0;n<o;++n){if(s+5>i.length){var c=new _t(s+8+(o-n<<1));c.set(i),i=c}var p=e.charCodeAt(n);p<128||t?l(p):p<2048?(l(192|p>>6),l(128|p&63)):p>55295&&p<57344?(p=65536+(p&1047552)|e.charCodeAt(++n)&1023,l(240|p>>18),l(128|p>>12&63),l(128|p>>6&63),l(128|p&63)):(l(224|p>>12),l(128|p>>6&63),l(128|p&63))}return vl(i,0,s)}function MI(e,t){if(t){for(var r="",n=0;n<e.length;n+=16384)r+=String.fromCharCode.apply(null,e.subarray(n,n+16384));return r}else{if(vI)return vI.decode(e);var o=zU(e),i=o.s,r=o.r;return r.length&&cr(8),i}}var ew=function(e,t){return t+30+hi(e,t+26)+hi(e,t+28)},tw=function(e,t,r){var n=hi(e,t+28),o=MI(e.subarray(t+46,t+46+n),!(hi(e,t+8)&2048)),i=t+46+n,s=rn(e,t+20),l=r&&s==4294967295?XU(e,i):[s,rn(e,t+24),rn(e,t+42)],c=l[0],p=l[1],d=l[2];return[hi(e,t+10),c,p,o,i+hi(e,t+30)+hi(e,t+32),d]},XU=function(e,t){for(;hi(e,t)!=1;t+=4+hi(e,t+2));return[gI(e,t+12),gI(e,t+4),gI(e,t+20)]},oh=function(e){var t=0;if(e)for(var r in e){var n=e[r].length;n>65535&&cr(9),t+=n+4}return t},C1=function(e,t,r,n,o,i,s,l){var c=n.length,p=r.extra,d=l&&l.length,m=oh(p);tn(e,t,s!=null?33639248:67324752),t+=4,s!=null&&(e[t++]=20,e[t++]=r.os),e[t]=20,t+=2,e[t++]=r.flag<<1|(i<0&&8),e[t++]=o&&8,e[t++]=r.compression&255,e[t++]=r.compression>>8;var g=new Date(r.mtime==null?Date.now():r.mtime),x=g.getFullYear()-1980;if((x<0||x>119)&&cr(10),tn(e,t,x<<25|g.getMonth()+1<<21|g.getDate()<<16|g.getHours()<<11|g.getMinutes()<<5|g.getSeconds()>>1),t+=4,i!=-1&&(tn(e,t,r.crc),tn(e,t+4,i<0?-i-2:i),tn(e,t+8,r.size)),tn(e,t+12,c),tn(e,t+14,m),t+=16,s!=null&&(tn(e,t,d),tn(e,t+6,r.attrs),tn(e,t+10,s),t+=14),e.set(n,t),t+=c,m)for(var v in p){var C=p[v],I=C.length;tn(e,t,+v),tn(e,t+2,I),e.set(C,t+4),t+=4+I}return d&&(e.set(l,t),t+=d),t},rw=function(e,t,r,n,o){tn(e,t,101010256),tn(e,t+8,r),tn(e,t+10,r),tn(e,t+12,n),tn(e,t+16,o)};function nw(e,t,r){r||(r=t,t={}),typeof r!="function"&&cr(7);var n={};TI(e,"",n,t);var o=Object.keys(n),i=o.length,s=0,l=0,c=i,p=new Array(i),d=[],m=function(){for(var I=0;I<d.length;++I)d[I]()},g=function(I,S){T1(function(){r(I,S)})};T1(function(){g=r});var x=function(){var I=new _t(l+22),S=s,P=l-s;l=0;for(var O=0;O<c;++O){var M=p[O];try{var E=M.c.length;C1(I,l,M,M.f,M.u,E);var B=30+M.f.length+oh(M.extra),j=l+B;I.set(M.c,j),C1(I,s,M,M.f,M.u,E,l,M.m),s+=16+B+(M.m?M.m.length:0),l=j+E}catch(L){return g(L,null)}}rw(I,s,p.length,P,S),g(null,I)};i||x();for(var v=function(I){var S=o[I],P=n[S],O=P[0],M=P[1],E=J4(),B=O.length;E.p(O);var j=Ku(S),L=j.length,N=M.comment,X=N&&Ku(N),Z=X&&X.length,re=oh(M.extra),Q=M.level==0?0:8,xe=function(Ce,ye){if(Ce)m(),g(Ce,null);else{var Ee=ye.length;p[I]=P1(M,{size:B,crc:E.d(),c:ye,f:j,m:X,u:L!=S.length||X&&N.length!=Z,compression:Q}),s+=30+L+re+Ee,l+=76+2*(L+re)+(Z||0)+Ee,--i||x()}};if(L>65535&&xe(cr(11,0,1),null),!Q)xe(null,O);else if(B<16e4)try{xe(null,O1(O,M))}catch(Ce){xe(Ce,null)}else d.push(HU(O,M,xe))},C=0;C<c;++C)v(C);return m}function ow(e,t){t||(t={});var r={},n=[];TI(e,"",r,t);var o=0,i=0;for(var s in r){var l=r[s],c=l[0],p=l[1],d=p.level==0?0:8,m=Ku(s),g=m.length,x=p.comment,v=x&&Ku(x),C=v&&v.length,I=oh(p.extra);g>65535&&cr(11);var S=d?O1(c,p):c,P=S.length,O=J4();O.p(c),n.push(P1(p,{size:c.length,crc:O.d(),c:S,f:m,m:v,u:g!=s.length||v&&x.length!=C,o,compression:d})),o+=30+g+I+P,i+=76+2*(g+I)+(C||0)+P}for(var M=new _t(i+22),E=o,B=i-o,j=0;j<n.length;++j){var m=n[j];C1(M,m.o,m,m.f,m.u,m.c.length);var L=30+m.f.length+oh(m.extra);M.set(m.c,m.o+L),C1(M,o,m,m.f,m.u,m.c.length,m.o,m.m),o+=16+L+(m.m?m.m.length:0)}return rw(M,o,n.length,B,E),M}var T1=typeof queueMicrotask=="function"?queueMicrotask:typeof setTimeout=="function"?setTimeout:function(e){e()};function iw(e,t,r){r||(r=t,t={}),typeof r!="function"&&cr(7);var n=[],o=function(){for(var I=0;I<n.length;++I)n[I]()},i={},s=function(I,S){T1(function(){r(I,S)})};T1(function(){s=r});for(var l=e.length-22;rn(e,l)!=101010256;--l)if(!l||e.length-l>65558)return s(cr(13,0,1),null),o;var c=hi(e,l+8);if(c){var p=c,d=rn(e,l+16),m=d==4294967295||p==65535;if(m){var g=rn(e,l-12);m=rn(e,g)==101075792,m&&(p=c=rn(e,g+32),d=rn(e,g+48))}for(var x=t&&t.filter,v=function(I){var S=tw(e,d,m),P=S[0],O=S[1],M=S[2],E=S[3],B=S[4],j=S[5],L=ew(e,j);d=B;var N=function(Z,re){Z?(o(),s(Z,null)):(re&&(i[E]=re),--c||s(null,i))};if(!x||x({name:E,size:O,originalSize:M,compression:P}))if(!P)N(null,vl(e,L,L+O));else if(P==8){var X=e.subarray(L,L+O);if(M<524288||O>.8*M)try{N(null,_1(X,{out:new _t(M)}))}catch(Z){N(Z,null)}else n.push(WU(X,{size:M},N))}else N(cr(14,"unknown compression type "+P,1),null);else N(null,null)},C=0;C<p;++C)v(C)}else s(null,{});return o}function sw(e,t){for(var r={},n=e.length-22;rn(e,n)!=101010256;--n)(!n||e.length-n>65558)&&cr(13);var o=hi(e,n+8);if(!o)return{};var i=rn(e,n+16),s=i==4294967295||o==65535;if(s){var l=rn(e,n-12);s=rn(e,l)==101075792,s&&(o=rn(e,l+32),i=rn(e,l+48))}for(var c=t&&t.filter,p=0;p<o;++p){var d=tw(e,i,s),m=d[0],g=d[1],x=d[2],v=d[3],C=d[4],I=d[5],S=ew(e,I);i=C,(!c||c({name:v,size:g,originalSize:x,compression:m}))&&(m?m==8?r[v]=_1(e.subarray(S,S+g),{out:new _t(x)}):cr(14,"unknown compression type "+m):r[v]=vl(e,S,S+g))}return r}u();var ZU=e=>{if(e!=null)return e.trim()===""?void 0:e},YU=e=>e!=null,E1=(e,t,r=0)=>{if(F.IsNull(e))return"null";if(F.IsUndefined(e))return"undefined";if(F.IsString(e))return"<string>";if(F.IsNumber(e))return"<number>";if(F.IsBoolean(e))return"<boolean>";if(F.IsLiteral(e))return typeof e.const=="string"?`'${e.const}'`:`${e.const}`;if(F.IsRef(e)){let n=t.find(o=>o.$id===e.$ref);return n==null?e.$ref:E1(n,t,r)}if(F.IsArray(e))return`${E1(e.items,t,r+1)}[]`;if(F.IsUnion(e)&&(!(e.anyOf.length>5)||e.$id==null)){let o=`${e.anyOf.map(i=>E1(i,t,r+1)).filter(YU).join(" | ")}`;return r>0?`(${o})`:o}return e.$id??""},JU=(e,t,r)=>{let n=t.message;return F.IsUnion(t.schema)&&(n=`Expected one of: ${E1(t.schema,r)}`),`${`#/definitions/${e}${ZU(t.path)??""}`}: ${n}`},D1=(e,t,r)=>{let n=t.First();if(n!=null)return JU(e,n,r)};var td;(function(e){e.Archive="Archive",e.Validate="Validate",e.Encode="Encode",e.Unknown="Unknown"})(td||(td={}));var rd=class extends Error{constructor(r,n){super(n);f(this,"name");f(this,"kind");this.name="CompressError",this.kind=r}},qU=e=>new rd(td.Archive,e.message),KU=e=>{let t=Object.values(M1);return e instanceof Error&&"code"in e&&typeof e.code=="number"&&t.includes(e.code)},QU=(e,t,r)=>new rd(td.Validate,D1(e,t,r)??"Unknown validate error"),eV=e=>new rd(td.Encode,e.message),tV=e=>new rd(td.Unknown,e instanceof Error?e.message:String(e)),ah=(e,t,r)=>t instanceof Dc?eV(t):t instanceof Do?QU(e,t,r):KU(t)?qU(t):tV(t);u();var nd;(function(e){e.Unarchive="Unarchive",e.Validate="Validate",e.Decode="Decode",e.Unknown="Unknown"})(nd||(nd={}));var od=class extends Error{constructor(r,n){super(n);f(this,"name");f(this,"kind");this.name="DecompressError",this.kind=r}},rV=e=>new od(nd.Unarchive,e.message),nV=e=>{let t=Object.values(M1);return e instanceof Error&&"code"in e&&typeof e.code=="number"&&t.includes(e.code)},oV=(e,t,r)=>new od(nd.Validate,D1(e,t,r)??"Unknown validate error"),iV=e=>new od(nd.Decode,e.message),sV=e=>new od(nd.Unknown,e instanceof Error?e.message:String(e)),lh=(e,t,r)=>t instanceof Ec?iV(t):t instanceof Do?oV(e,t,r):nV(t)?rV(t):sV(t);var aw=function*(e,t=""){if(e!=null){if(Array.isArray(e)){for(let r=0;r<e.length;r++)yield[t+`[${r}]`,e[r]];return}if("features"in e){for(let r=0;r<e.features.length;r++)yield[t===""?`features[${r}]`:`${t}.features[${r}]`,e.features[r]];return}for(let[r,n]of Object.entries(e)){let o=t===""?r:`${t}.${r}`;yield*aw(n,o)}}},aV=(e,t)=>e===""?t:t.startsWith("[")?`${e}${t}`:`${e}.${t}`,hr=(e,t,r)=>{let n=new Set;for(let[o,i]of aw(e)){let s=t(i);if(n.has(s))return ae({kind:Vn.DuplicateIdError,properties:{id:s,path:aV(r,o)}});n.add(s)}return ie(!0)};var lw=e=>e.floors==null?ae({kind:Vn.FloorMissingError,properties:null}):hr(e.floors.features,t=>t.properties.id,"floors");var cw=b.Intersect([b.Object({id:b.Ref(Ze),elevation:b.Integer({description:"An ordinal representing the elevation of this map relative to other maps in the stack."}),subtitle:b.Optional(b.String({description:"The subtitle of the floor."}))}),io],{$id:"FloorProperties"}),pw=Kr(b.Union([b.Ref(Uu),b.Ref(Vu),b.Null()]),b.Ref(cw),{$id:"FloorFeature"}),uw=Mn(b.Ref(pw),{$id:"FloorCollection"}),lV=b.Object({floors:b.Ref(uw)}),dw={name:"core:floors",intoBundle:function*(e){e.floors!=null&&(yield{path:"floors.geojson",contents:e.floors})},fromBundle:(e,t,r)=>{if(e==="floors.geojson")return{floors:r(t)}},integrityCheck:lw,schema:lV,references:[cw,pw,uw]};u();u();var gr=e=>b.Unsafe(e);u();var rt=e=>Object.keys(e);u();u();var cV=e=>new Map(e.floors?.features.map(t=>[t.properties.id,t])??[]),gi=e=>{let t=cV(e);return n=>{let o=t.get(n);return o==null?ae({kind:Vn.UnknownFloorError,properties:{floorId:n}}):ie(o)}};var fw=e=>{if(e.floors==null)return ae({kind:Vn.FloorMissingError,properties:null});if(e.geometry==null)return ae({kind:Vn.GeometryMissingError,properties:null});let t=hr(e.geometry,n=>n.properties.id,"geometry");if(t.isErr())return t;let r=gi(e);for(let n of rt(e.geometry)){let o=r(n);if(o.isErr())return o}return ie(!0)};var mw=b.Intersect([b.Object({id:b.Ref(mn)}),io],{$id:"GeometryProperties"}),hw=Kr(b.Union([b.Ref(fn),b.Ref(Yb),b.Ref(Jb),b.Ref(qb),b.Ref(Uu),b.Ref(Vu)]),b.Ref(mw),{$id:"GeometryFeature"}),gw=Mn(b.Ref(hw),{$id:"GeometryCollection"}),pV=b.Object({geometry:gr(b.Record(Ze,b.Ref(gw),{additionalProperties:!1}))},{$id:"GeometrySchema"}),uV=/^geometry\/(.*)\.geojson$/,yw={name:"core:geometry",schema:pV,intoBundle:function*(e){if(e.geometry!=null)for(let t of rt(e.geometry))yield{path:`geometry/${t}.geojson`,contents:e.geometry[t]}},fromBundle:(e,t,r)=>{let n=e.match(uV)?.[1];if(n)return{geometry:{[n]:r(t)}}},references:[mw,hw,gw],integrityCheck:fw};u();var PI=b.Object({type:b.Literal("file"),name:b.String({description:"The name of the file."})},{$id:"ManifestFile"}),bw=b.Recursive(e=>b.Object({type:b.Literal("folder"),name:b.String({description:"The name of the folder."}),children:b.Array(b.Union([e,b.Ref(PI)]),{minItems:1,description:"The children of the folder."})}),{$id:"ManifestFolder"}),xw=b.Object({name:b.String({description:"The name of the map."}),version:b.Literal("3.0.0",{description:"The version of the manifest."}),orgId:b.Optional(b.String({description:"The identifier of the organization that the map this MVF is for belongs to."})),mapId:b.Optional(b.String({description:"The identifier of the map that this MVF is for."})),contents:b.Array(b.Union([b.Ref(bw),b.Ref(PI)]),{minItems:1,description:"The contents of the MVF bundle."}),time:b.String({format:"date-time",description:"An ISO 8601 date-time string, including timezone offset."}),tzid:b.Optional(b.Unsafe(b.String({description:"A valid IANA timezone identifier.",pattern:"^[A-Za-z0-9_-]+/[A-Za-z0-9_-]+$"}))),naturalBearing:b.Optional(b.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:b.Optional(b.Ref(Ze,{description:"The default floor ID of the map."})),language:b.Optional(b.String({description:"The language code of the map."}))},{$id:"ManifestProperties"}),vw=Mn(Kr(fn,b.Ref(xw)),{$id:"ManifestCollection"},{minItems:1,maxItems:1}),dV=b.Object({manifest:b.Ref(vw)}),Iw={name:"core:manifest",intoBundle:function*(e){e.manifest!=null&&(yield{path:"manifest.geojson",contents:e.manifest})},fromBundle:(e,t,r)=>{if(e==="manifest.geojson")return{manifest:r(t)}},schema:dV,references:[PI,bw,xw,vw]};u();u();u();u();var wI=class extends ve{constructor(r){super(`Unable to dereference schema with $id '${r.$ref}'`);f(this,"schema");this.schema=r}};function fV(e,t){let r=t.find(n=>n.$id===e.$ref);if(r===void 0)throw new wI(e);return kc(r,t)}function F1(e,t){return!ot.IsString(e.$id)||t.some(r=>r.$id===e.$id)||t.push(e),t}function kc(e,t){return e[U]==="This"||e[U]==="Ref"?fV(e,t):e}u();function mV(e,t,r){let n=e.get(t);if(n!==void 0)return n;let o=us(t,r);return e.set(t,o),o}function k1(){let e=new WeakMap;return{HasTransform:(t,r)=>mV(e,t,r)}}function pr(e,t,r){try{return F.IsTransform(e)?e[$t].Decode(r):r}catch(n){throw new Ec(e,t,r,n)}}function hV(e,t,r,n,o){return ot.IsArray(n)?pr(e,r,n.map((i,s)=>fs(e.items,t,`${r}/${s}`,i,o))):pr(e,r,n)}function gV(e,t,r,n,o){if(!ot.IsObject(n)||qr(n))return pr(e,r,n);let i=gl(e),s=i.map(m=>m[0]),l={...n};for(let[m,g]of i)m in l&&(l[m]=fs(g,t,`${r}/${m}`,l[m],o));if(!F.IsTransform(e.unevaluatedProperties))return pr(e,r,l);let c=Object.getOwnPropertyNames(l),p=e.unevaluatedProperties,d={...l};for(let m of c)s.includes(m)||(d[m]=pr(p,`${r}/${m}`,d[m]));return pr(e,r,d)}function yV(e,t,r,n,o){return pr(e,r,fs(e.not,t,r,n,o))}function bV(e,t,r,n,o){if(!ot.IsObject(n))return pr(e,r,n);let i=Gr(e),s={...n};for(let d of i)ot.HasPropertyKey(s,d)&&(ot.IsUndefined(s[d])&&(!F.IsUndefined(e.properties[d])||vt.IsExactOptionalProperty(s,d))||(s[d]=fs(e.properties[d],t,`${r}/${d}`,s[d],o)));if(!F.IsSchema(e.additionalProperties))return pr(e,r,s);let l=Object.getOwnPropertyNames(s),c=e.additionalProperties,p={...s};for(let d of l)i.includes(d)||(p[d]=pr(c,`${r}/${d}`,p[d]));return pr(e,r,p)}function xV(e,t,r,n,o){if(!ot.IsObject(n))return pr(e,r,n);let i=Object.getOwnPropertyNames(e.patternProperties)[0],s=new RegExp(i),l={...n};for(let m of Object.getOwnPropertyNames(n))s.test(m)&&(l[m]=fs(e.patternProperties[i],t,`${r}/${m}`,l[m],o));if(!F.IsSchema(e.additionalProperties))return pr(e,r,l);let c=Object.getOwnPropertyNames(l),p=e.additionalProperties,d={...l};for(let m of c)s.test(m)||(d[m]=pr(p,`${r}/${m}`,d[m]));return pr(e,r,d)}function vV(e,t,r,n,o){let i=kc(e,t);return pr(e,r,fs(i,t,r,n,o))}function IV(e,t,r,n,o){let i=kc(e,t);return pr(e,r,fs(i,t,r,n,o))}function SV(e,t,r,n,o){return ot.IsArray(n)&&ot.IsArray(e.items)?pr(e,r,e.items.map((i,s)=>fs(i,t,`${r}/${s}`,n[s],o))):pr(e,r,n)}function CV(e,t,r,n,o){for(let i of e.anyOf){if(!mi.Check(i,t,n))continue;let s=fs(i,t,r,n,o);return pr(e,r,s)}return pr(e,r,n)}function fs(e,t,r,n,o){if(!o.HasTransform(e,t))return n;let i=F1(e,t),s=e;switch(e[U]){case"Array":return hV(s,i,r,n,o);case"Intersect":return gV(s,i,r,n,o);case"Not":return yV(s,i,r,n,o);case"Object":return bV(s,i,r,n,o);case"Record":return xV(s,i,r,n,o);case"Ref":return vV(s,i,r,n,o);case"Symbol":return pr(s,r,n);case"This":return IV(s,i,r,n,o);case"Tuple":return SV(s,i,r,n,o);case"Union":return CV(s,i,r,n,o);default:return pr(s,r,n)}}function Sw(e,t,r){let n=k1();return fs(e,t,"",r,n)}u();function yn(e,t,r){try{return F.IsTransform(e)?e[$t].Encode(r):r}catch(n){throw new Dc(e,t,r,n)}}function TV(e,t,r,n,o){let i=yn(e,r,n);return ot.IsArray(i)?i.map((s,l)=>ms(e.items,t,`${r}/${l}`,s,o)):i}function MV(e,t,r,n,o){let i=yn(e,r,n);if(!ot.IsObject(n)||qr(n))return i;let s=gl(e),l=s.map(g=>g[0]),c={...i};for(let[g,x]of s)g in c&&(c[g]=ms(x,t,`${r}/${g}`,c[g],o));if(!F.IsTransform(e.unevaluatedProperties))return c;let p=Object.getOwnPropertyNames(c),d=e.unevaluatedProperties,m={...c};for(let g of p)l.includes(g)||(m[g]=yn(d,`${r}/${g}`,m[g]));return m}function PV(e,t,r,n){return yn(e.not,r,yn(e,r,n))}function wV(e,t,r,n,o){let i=yn(e,r,n);if(!ot.IsObject(i))return i;let s=Gr(e),l={...i};for(let m of s)ot.HasPropertyKey(l,m)&&(ot.IsUndefined(l[m])&&(!F.IsUndefined(e.properties[m])||vt.IsExactOptionalProperty(l,m))||(l[m]=ms(e.properties[m],t,`${r}/${m}`,l[m],o)));if(!F.IsSchema(e.additionalProperties))return l;let c=Object.getOwnPropertyNames(l),p=e.additionalProperties,d={...l};for(let m of c)s.includes(m)||(d[m]=yn(p,`${r}/${m}`,d[m]));return d}function OV(e,t,r,n,o){let i=yn(e,r,n);if(!ot.IsObject(n))return i;let s=Object.getOwnPropertyNames(e.patternProperties)[0],l=new RegExp(s),c={...i};for(let g of Object.getOwnPropertyNames(n))l.test(g)&&(c[g]=ms(e.patternProperties[s],t,`${r}/${g}`,c[g],o));if(!F.IsSchema(e.additionalProperties))return c;let p=Object.getOwnPropertyNames(c),d=e.additionalProperties,m={...c};for(let g of p)l.test(g)||(m[g]=yn(d,`${r}/${g}`,m[g]));return m}function _V(e,t,r,n,o){let i=kc(e,t),s=ms(i,t,r,n,o);return yn(e,r,s)}function EV(e,t,r,n,o){let i=kc(e,t),s=ms(i,t,r,n,o);return yn(e,r,s)}function DV(e,t,r,n,o){let i=yn(e,r,n);return ot.IsArray(e.items)?e.items.map((s,l)=>ms(s,t,`${r}/${l}`,i[l],o)):[]}function FV(e,t,r,n,o){for(let i of e.anyOf){if(!mi.Check(i,t,n))continue;let s=ms(i,t,r,n,o);return yn(e,r,s)}for(let i of e.anyOf){let s=ms(i,t,r,n,o);if(mi.Check(e,t,s))return yn(e,r,s)}return yn(e,r,n)}function ms(e,t,r,n,o){if(!o.HasTransform(e,t))return n;let i=F1(e,t),s=e;switch(e[U]){case"Array":return TV(s,i,r,n,o);case"Intersect":return MV(s,i,r,n,o);case"Not":return PV(s,i,r,n);case"Object":return wV(s,i,r,n,o);case"Record":return OV(s,i,r,n,o);case"Ref":return _V(s,i,r,n,o);case"This":return EV(s,i,r,n,o);case"Tuple":return DV(s,i,r,n,o);case"Union":return FV(s,i,r,n,o);default:return yn(s,r,n)}}function Cw(e,t,r){let n=k1();return ms(e,t,"",r,n)}u();var OI=class{constructor(t,r,n,o){this.schema=t,this.references=r,this.checkFunc=n,this.code=o,this.hasTransform=us(t,r)}Code(){return this.code}Errors(t){return ss(this.schema,this.references,t)}Check(t){return this.checkFunc(t)}Decode(t){if(!this.checkFunc(t))throw new zu(this.schema,t,this.Errors(t).First());return this.hasTransform?Xu(this.schema,this.references,t):t}Encode(t){let r=this.hasTransform?c1(this.schema,this.references,t):t;if(!this.checkFunc(r))throw new Zu(this.schema,t,this.Errors(t).First());return r}},fa;(function(e){function t(i){return i===36}e.DollarSign=t;function r(i){return i===95}e.IsUnderscore=r;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})(fa||(fa={}));var A1;(function(e){function t(i){return i.length===0?!1:fa.IsNumeric(i.charCodeAt(0))}function r(i){if(t(i))return!1;for(let s=0;s<i.length;s++){let l=i.charCodeAt(s);if(!(fa.IsAlpha(l)||fa.IsNumeric(l)||fa.DollarSign(l)||fa.IsUnderscore(l)))return!1}return!0}function n(i){return i.replace(/'/g,"\\'")}function o(i,s){return r(s)?`${i}.${s}`:`${i}['${n(s)}']`}e.Encode=o})(A1||(A1={}));var _I;(function(e){function t(r){let n=[];for(let o=0;o<r.length;o++){let i=r.charCodeAt(o);fa.IsNumeric(i)||fa.IsAlpha(i)?n.push(r.charAt(o)):n.push(`_${i}_`)}return n.join("").replace(/__/g,"_")}e.Encode=t})(_I||(_I={}));var EI;(function(e){function t(r){return r.replace(/'/g,"\\'")}e.Escape=t})(EI||(EI={}));var DI=class extends ve{constructor(t){super("Unknown type"),this.schema=t}},L1=class extends ve{constructor(t){super("Preflight validation check failed to guard for the given schema"),this.schema=t}},Ac;(function(e){function t(s,l,c){return vt.ExactOptionalPropertyTypes?`('${l}' in ${s} ? ${c} : true)`:`(${A1.Encode(s,l)} !== undefined ? ${c} : true)`}e.IsExactOptionalProperty=t;function r(s){return vt.AllowArrayObject?`(typeof ${s} === 'object' && ${s} !== null)`:`(typeof ${s} === 'object' && ${s} !== null && !Array.isArray(${s}))`}e.IsObjectLike=r;function n(s){return vt.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 vt.AllowNaN?`typeof ${s} === 'number'`:`Number.isFinite(${s})`}e.IsNumberLike=o;function i(s){return vt.AllowNullVoid?`(${s} === undefined || ${s} === null)`:`${s} === undefined`}e.IsVoidLike=i})(Ac||(Ac={}));var R1;(function(e){function t(k){return k[U]==="Any"||k[U]==="Unknown"}function*r(k,W,D){yield"true"}function*n(k,W,D){yield`Array.isArray(${D})`;let[ne,K]=[qe("value","any"),qe("acc","number")];he(k.maxItems)&&(yield`${D}.length <= ${k.maxItems}`),he(k.minItems)&&(yield`${D}.length >= ${k.minItems}`);let ee=Ae(k.items,W,"value");if(yield`${D}.every((${ne}) => ${ee})`,et(k.contains)||he(k.minContains)||he(k.maxContains)){let Le=et(k.contains)?k.contains:St(),Ft=Ae(Le,W,"value"),In=he(k.minContains)?[`(count >= ${k.minContains})`]:[],Yr=he(k.maxContains)?[`(count <= ${k.maxContains})`]:[],pn=`const count = value.reduce((${K}, ${ne}) => ${Ft} ? acc + 1 : acc, 0)`,dc=["(count > 0)",...In,...Yr].join(" && ");yield`((${ne}) => { ${pn}; return ${dc}})(${D})`}k.uniqueItems===!0&&(yield`((${ne}) => { 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 } )(${D})`)}function*o(k,W,D){yield`(typeof value === 'object' && Symbol.asyncIterator in ${D})`}function*i(k,W,D){yield`(typeof ${D} === 'bigint')`,Jr(k.exclusiveMaximum)&&(yield`${D} < BigInt(${k.exclusiveMaximum})`),Jr(k.exclusiveMinimum)&&(yield`${D} > BigInt(${k.exclusiveMinimum})`),Jr(k.maximum)&&(yield`${D} <= BigInt(${k.maximum})`),Jr(k.minimum)&&(yield`${D} >= BigInt(${k.minimum})`),Jr(k.multipleOf)&&(yield`(${D} % BigInt(${k.multipleOf})) === 0`)}function*s(k,W,D){yield`(typeof ${D} === 'boolean')`}function*l(k,W,D){yield*we(k.returns,W,`${D}.prototype`)}function*c(k,W,D){yield`(${D} instanceof Date) && Number.isFinite(${D}.getTime())`,he(k.exclusiveMaximumTimestamp)&&(yield`${D}.getTime() < ${k.exclusiveMaximumTimestamp}`),he(k.exclusiveMinimumTimestamp)&&(yield`${D}.getTime() > ${k.exclusiveMinimumTimestamp}`),he(k.maximumTimestamp)&&(yield`${D}.getTime() <= ${k.maximumTimestamp}`),he(k.minimumTimestamp)&&(yield`${D}.getTime() >= ${k.minimumTimestamp}`),he(k.multipleOfTimestamp)&&(yield`(${D}.getTime() % ${k.multipleOfTimestamp}) === 0`)}function*p(k,W,D){yield`(typeof ${D} === 'function')`}function*d(k,W,D){yield`Number.isInteger(${D})`,he(k.exclusiveMaximum)&&(yield`${D} < ${k.exclusiveMaximum}`),he(k.exclusiveMinimum)&&(yield`${D} > ${k.exclusiveMinimum}`),he(k.maximum)&&(yield`${D} <= ${k.maximum}`),he(k.minimum)&&(yield`${D} >= ${k.minimum}`),he(k.multipleOf)&&(yield`(${D} % ${k.multipleOf}) === 0`)}function*m(k,W,D){let ne=k.allOf.map(K=>Ae(K,W,D)).join(" && ");if(k.unevaluatedProperties===!1){let K=Je(`${new RegExp(sa(k))};`),ee=`Object.getOwnPropertyNames(${D}).every(key => ${K}.test(key))`;yield`(${ne} && ${ee})`}else if(et(k.unevaluatedProperties)){let K=Je(`${new RegExp(sa(k))};`),ee=`Object.getOwnPropertyNames(${D}).every(key => ${K}.test(key) || ${Ae(k.unevaluatedProperties,W,`${D}[key]`)})`;yield`(${ne} && ${ee})`}else yield`(${ne})`}function*g(k,W,D){yield`(typeof value === 'object' && Symbol.iterator in ${D})`}function*x(k,W,D){typeof k.const=="number"||typeof k.const=="boolean"?yield`(${D} === ${k.const})`:yield`(${D} === '${EI.Escape(k.const)}')`}function*v(k,W,D){yield"false"}function*C(k,W,D){yield`(!${Ae(k.not,W,D)})`}function*I(k,W,D){yield`(${D} === null)`}function*S(k,W,D){yield Ac.IsNumberLike(D),he(k.exclusiveMaximum)&&(yield`${D} < ${k.exclusiveMaximum}`),he(k.exclusiveMinimum)&&(yield`${D} > ${k.exclusiveMinimum}`),he(k.maximum)&&(yield`${D} <= ${k.maximum}`),he(k.minimum)&&(yield`${D} >= ${k.minimum}`),he(k.multipleOf)&&(yield`(${D} % ${k.multipleOf}) === 0`)}function*P(k,W,D){yield Ac.IsObjectLike(D),he(k.minProperties)&&(yield`Object.getOwnPropertyNames(${D}).length >= ${k.minProperties}`),he(k.maxProperties)&&(yield`Object.getOwnPropertyNames(${D}).length <= ${k.maxProperties}`);let ne=Object.getOwnPropertyNames(k.properties);for(let K of ne){let ee=A1.Encode(D,K),Le=k.properties[K];if(k.required&&k.required.includes(K))yield*we(Le,W,ee),(la(Le)||t(Le))&&(yield`('${K}' in ${D})`);else{let Ft=Ae(Le,W,ee);yield Ac.IsExactOptionalProperty(D,K,Ft)}}if(k.additionalProperties===!1)if(k.required&&k.required.length===ne.length)yield`Object.getOwnPropertyNames(${D}).length === ${ne.length}`;else{let K=`[${ne.map(ee=>`'${ee}'`).join(", ")}]`;yield`Object.getOwnPropertyNames(${D}).every(key => ${K}.includes(key))`}if(typeof k.additionalProperties=="object"){let K=Ae(k.additionalProperties,W,`${D}[key]`),ee=`[${ne.map(Le=>`'${Le}'`).join(", ")}]`;yield`(Object.getOwnPropertyNames(${D}).every(key => ${ee}.includes(key) || ${K}))`}}function*O(k,W,D){yield`(typeof value === 'object' && typeof ${D}.then === 'function')`}function*M(k,W,D){yield Ac.IsRecordLike(D),he(k.minProperties)&&(yield`Object.getOwnPropertyNames(${D}).length >= ${k.minProperties}`),he(k.maxProperties)&&(yield`Object.getOwnPropertyNames(${D}).length <= ${k.maxProperties}`);let[ne,K]=Object.entries(k.patternProperties)[0],ee=Je(`${new RegExp(ne)}`),Le=Ae(K,W,"value"),Ft=et(k.additionalProperties)?Ae(k.additionalProperties,W,D):k.additionalProperties===!1?"false":"true",In=`(${ee}.test(key) ? ${Le} : ${Ft})`;yield`(Object.entries(${D}).every(([key, value]) => ${In}))`}function*E(k,W,D){let ne=at(k,W);if(pe.functions.has(k.$ref))return yield`${mt(k.$ref)}(${D})`;yield*we(ne,W,D)}function*B(k,W,D){let ne=Je(`${new RegExp(k.source,k.flags)};`);yield`(typeof ${D} === 'string')`,he(k.maxLength)&&(yield`${D}.length <= ${k.maxLength}`),he(k.minLength)&&(yield`${D}.length >= ${k.minLength}`),yield`${ne}.test(${D})`}function*j(k,W,D){yield`(typeof ${D} === 'string')`,he(k.maxLength)&&(yield`${D}.length <= ${k.maxLength}`),he(k.minLength)&&(yield`${D}.length >= ${k.minLength}`),k.pattern!==void 0&&(yield`${Je(`${new RegExp(k.pattern)};`)}.test(${D})`),k.format!==void 0&&(yield`format('${k.format}', ${D})`)}function*L(k,W,D){yield`(typeof ${D} === 'symbol')`}function*N(k,W,D){yield`(typeof ${D} === 'string')`,yield`${Je(`${new RegExp(k.pattern)};`)}.test(${D})`}function*X(k,W,D){yield`${mt(k.$ref)}(${D})`}function*Z(k,W,D){if(yield`Array.isArray(${D})`,k.items===void 0)return yield`${D}.length === 0`;yield`(${D}.length === ${k.maxItems})`;for(let ne=0;ne<k.items.length;ne++)yield`${Ae(k.items[ne],W,`${D}[${ne}]`)}`}function*re(k,W,D){yield`${D} === undefined`}function*Q(k,W,D){yield`(${k.anyOf.map(K=>Ae(K,W,D)).join(" || ")})`}function*xe(k,W,D){yield`${D} instanceof Uint8Array`,he(k.maxByteLength)&&(yield`(${D}.length <= ${k.maxByteLength})`),he(k.minByteLength)&&(yield`(${D}.length >= ${k.minByteLength})`)}function*Ce(k,W,D){yield"true"}function*ye(k,W,D){yield Ac.IsVoidLike(D)}function*Ee(k,W,D){let ne=pe.instances.size;pe.instances.set(ne,k),yield`kind('${k[U]}', ${ne}, ${D})`}function*we(k,W,D,ne=!0){let K=Qe(k.$id)?[...W,k]:W,ee=k;if(ne&&Qe(k.$id)){let Le=mt(k.$id);if(pe.functions.has(Le))return yield`${Le}(${D})`;{let Ft=ut(Le,k,W,"value",!1);return pe.functions.set(Le,Ft),yield`${Le}(${D})`}}switch(ee[U]){case"Any":return yield*r(ee,K,D);case"Array":return yield*n(ee,K,D);case"AsyncIterator":return yield*o(ee,K,D);case"BigInt":return yield*i(ee,K,D);case"Boolean":return yield*s(ee,K,D);case"Constructor":return yield*l(ee,K,D);case"Date":return yield*c(ee,K,D);case"Function":return yield*p(ee,K,D);case"Integer":return yield*d(ee,K,D);case"Intersect":return yield*m(ee,K,D);case"Iterator":return yield*g(ee,K,D);case"Literal":return yield*x(ee,K,D);case"Never":return yield*v(ee,K,D);case"Not":return yield*C(ee,K,D);case"Null":return yield*I(ee,K,D);case"Number":return yield*S(ee,K,D);case"Object":return yield*P(ee,K,D);case"Promise":return yield*O(ee,K,D);case"Record":return yield*M(ee,K,D);case"Ref":return yield*E(ee,K,D);case"RegExp":return yield*B(ee,K,D);case"String":return yield*j(ee,K,D);case"Symbol":return yield*L(ee,K,D);case"TemplateLiteral":return yield*N(ee,K,D);case"This":return yield*X(ee,K,D);case"Tuple":return yield*Z(ee,K,D);case"Undefined":return yield*re(ee,K,D);case"Union":return yield*Q(ee,K,D);case"Uint8Array":return yield*xe(ee,K,D);case"Unknown":return yield*Ce(ee,K,D);case"Void":return yield*ye(ee,K,D);default:if(!Nr.Has(ee[U]))throw new DI(k);return yield*Ee(ee,K,D)}}let pe={language:"javascript",functions:new Map,variables:new Map,instances:new Map};function Ae(k,W,D,ne=!0){return`(${[...we(k,W,D,ne)].join(" && ")})`}function mt(k){return`check_${_I.Encode(k)}`}function Je(k){let W=`local_${pe.variables.size}`;return pe.variables.set(W,`const ${W} = ${k}`),W}function ut(k,W,D,ne,K=!0){let[ee,Le]=[`
|
|
1
|
+
import{$ as xc,A as u5,Aa as A5,B as d5,Ba as L5,C as yc,Ca as a2,D as f5,Da as R5,E as m5,Ea as B5,F as Qv,Fa as bu,G as qi,Ga as N5,H as db,Ha as G5,I as Ys,Ia as xb,J as bc,Ja as l2,K as h5,Ka as Cm,L as g5,La as xu,M as y5,Ma as vb,N as b5,Na as vu,O as vm,Oa as Iu,P as Rn,Q as x5,R as e2,S as Ki,T as v5,U as hu,V as I5,W as Qi,X as fb,Y as or,Z as ro,_ as S5,aa as ai,ba as Ke,c as A,ca as kt,d as Br,da as mb,e as GT,ea as Im,f as Xv,fa as t2,g as Yi,ga as hb,h as i5,ha as r2,i as cb,ia as n2,j as s5,ja as o2,k as Ji,ka as M5,l as pb,la as gu,m as a5,ma as P5,n as ub,na as yu,o as gc,oa as Sm,p as bm,pa as w5,q as qv,qa as gb,r as mu,ra as O5,s as dt,sa as _5,t as l5,ta as s2,u as Fe,ua as yb,v as Zs,va as bb,w as xm,wa as E5,x as Kv,xa as D5,y as c5,ya as F5,z as p5,za as k5}from"./chunk-6KGIA4EU.js";import{X as i2,ea as T5,w as C5}from"./chunk-7SIXH4EE.js";import{a as vo}from"./chunk-W5WDIXXO.js";import{$ as Re,A as UT,Aa as sb,B as rb,Ba as Jv,C as nb,Ca as zi,D as VT,Da as Xi,E as HT,Ea as si,Fa as ab,G as WT,Ga as QT,H as Xe,Ha as e5,I as De,Ja as xo,M as $T,N as zT,O as XT,P as hc,Q as ue,R as vr,S as ZT,T as to,Ta as fu,U as Xs,V as oi,W as Nt,Xa as lb,Y as Tr,Ya as t5,Z as Sn,_ as ob,aa as ii,ab as r5,b as Qy,c as fc,ca as sl,cb as Zi,d as ym,da as YT,e as ni,ea as Zv,eb as n5,f as jT,g as $i,ga as al,gb as o5,la as JT,oa as ll,p as eb,pa as qT,qa as ib,r as tb,ra as Yv,ta as du,ya as KT,z as mc,za as cl}from"./chunk-L4AKE3TV.js";import{a as u,b as y}from"./chunk-AJPWEERG.js";import{b as ri,c as zs,d as il,e as f,f as a,g as T,h as w,i as z}from"./chunk-ROCNZJLL.js";var VO=ri((SS,CS)=>{u();(function(e,t){typeof SS=="object"&&typeof CS<"u"?CS.exports=t():typeof define=="function"&&define.amd?define(t):(e=e||self,e.TinyQueue=t())})(SS,function(){"use strict";var e=function(n,o){if(n===void 0&&(n=[]),o===void 0&&(o=t),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,l=i[n];n>0;){var c=n-1>>1,p=i[c];if(s(l,p)>=0)break;i[n]=p,n=c}i[n]=l},e.prototype._down=function(n){for(var o=this,i=o.data,s=o.compare,l=this.length>>1,c=i[n];n<l;){var p=(n<<1)+1,d=i[p],m=p+1;if(m<this.length&&s(i[m],d)<0&&(p=m,d=i[m]),s(d,c)>=0)break;i[n]=d,n=p}i[n]=c};function t(r,n){return r<n?-1:r>n?1:0}return e})});var WO=ri((s5e,TS)=>{"use strict";u();var r0=VO();r0.default&&(r0=r0.default);TS.exports=HO;TS.exports.default=HO;function HO(e,t,r){t=t||1;for(var n,o,i,s,l=0;l<e[0].length;l++){var c=e[0][l];(!l||c[0]<n)&&(n=c[0]),(!l||c[1]<o)&&(o=c[1]),(!l||c[0]>i)&&(i=c[0]),(!l||c[1]>s)&&(s=c[1])}var p=i-n,d=s-o,m=Math.min(p,d),g=m/2;if(m===0){var x=[n,o];return x.distance=0,x}for(var v=new r0(void 0,jH),C=n;C<i;C+=m)for(var I=o;I<s;I+=m)v.push(new Sl(C+g,I+g,g,e));var S=VH(e),P=new Sl(n+p/2,o+d/2,0,e);P.d>S.d&&(S=P);for(var O=v.length;v.length;){var M=v.pop();M.d>S.d&&(S=M,r&&console.log("found best %d after %d probes",Math.round(1e4*M.d)/1e4,O)),!(M.max-S.d<=t)&&(g=M.h/2,v.push(new Sl(M.x-g,M.y-g,g,e)),v.push(new Sl(M.x+g,M.y-g,g,e)),v.push(new Sl(M.x-g,M.y+g,g,e)),v.push(new Sl(M.x+g,M.y+g,g,e)),O+=4)}r&&(console.log("num probes: "+O),console.log("best distance: "+S.d));var E=[S.x,S.y];return E.distance=S.d,E}function jH(e,t){return t.max-e.max}function Sl(e,t,r,n){this.x=e,this.y=t,this.h=r,this.d=UH(e,t,n),this.max=this.d+this.h*Math.SQRT2}function UH(e,t,r){for(var n=!1,o=1/0,i=0;i<r.length;i++)for(var s=r[i],l=0,c=s.length,p=c-1;l<c;p=l++){var d=s[l],m=s[p];d[1]>t!=m[1]>t&&e<(m[0]-d[0])*(t-d[1])/(m[1]-d[1])+d[0]&&(n=!n),o=Math.min(o,HH(e,t,d,m))}return o===0?0:(n?1:-1)*Math.sqrt(o)}function VH(e){for(var t=0,r=0,n=0,o=e[0],i=0,s=o.length,l=s-1;i<s;l=i++){var c=o[i],p=o[l],d=c[0]*p[1]-p[0]*c[1];r+=(c[0]+p[0])*d,n+=(c[1]+p[1])*d,t+=d*3}return t===0?new Sl(o[0][0],o[0][1],0,e):new Sl(r/t,n/t,0,e)}function HH(e,t,r,n){var o=r[0],i=r[1],s=n[0]-o,l=n[1]-i;if(s!==0||l!==0){var c=((e-o)*s+(t-i)*l)/(s*s+l*l);c>1?(o=n[0],i=n[1]):c>0&&(o+=s*c,i+=l*c)}return s=e-o,l=t-i,s*s+l*l}});var d6=ri((LS,RS)=>{u();(function(e,t){typeof LS=="object"&&typeof RS<"u"?RS.exports=t():typeof define=="function"&&define.amd?define(t):(e=e||self).RBush=t()})(LS,function(){"use strict";function e(I,S,P,O,M){(function E(B,j,L,N,X){for(;N>L;){if(N-L>600){var Z=N-L+1,re=j-L+1,Q=Math.log(Z),xe=.5*Math.exp(2*Q/3),Ce=.5*Math.sqrt(Q*xe*(Z-xe)/Z)*(re-Z/2<0?-1:1),ye=Math.max(L,Math.floor(j-re*xe/Z+Ce)),Ee=Math.min(N,Math.floor(j+(Z-re)*xe/Z+Ce));E(B,j,ye,Ee,X)}var we=B[j],pe=L,Ae=N;for(t(B,L,j),X(B[N],we)>0&&t(B,L,N);pe<Ae;){for(t(B,pe,Ae),pe++,Ae--;X(B[pe],we)<0;)pe++;for(;X(B[Ae],we)>0;)Ae--}X(B[L],we)===0?t(B,L,Ae):t(B,++Ae,N),Ae<=j&&(L=Ae+1),j<=Ae&&(N=Ae-1)}})(I,S,P||0,O||I.length-1,M||r)}function t(I,S,P){var O=I[S];I[S]=I[P],I[P]=O}function r(I,S){return I<S?-1:I>S?1:0}var n=function(I){I===void 0&&(I=9),this._maxEntries=Math.max(4,I),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function o(I,S,P){if(!P)return S.indexOf(I);for(var O=0;O<S.length;O++)if(P(I,S[O]))return O;return-1}function i(I,S){s(I,0,I.children.length,S,I)}function s(I,S,P,O,M){M||(M=v(null)),M.minX=1/0,M.minY=1/0,M.maxX=-1/0,M.maxY=-1/0;for(var E=S;E<P;E++){var B=I.children[E];l(M,I.leaf?O(B):B)}return M}function l(I,S){return I.minX=Math.min(I.minX,S.minX),I.minY=Math.min(I.minY,S.minY),I.maxX=Math.max(I.maxX,S.maxX),I.maxY=Math.max(I.maxY,S.maxY),I}function c(I,S){return I.minX-S.minX}function p(I,S){return I.minY-S.minY}function d(I){return(I.maxX-I.minX)*(I.maxY-I.minY)}function m(I){return I.maxX-I.minX+(I.maxY-I.minY)}function g(I,S){return I.minX<=S.minX&&I.minY<=S.minY&&S.maxX<=I.maxX&&S.maxY<=I.maxY}function x(I,S){return S.minX<=I.maxX&&S.minY<=I.maxY&&S.maxX>=I.minX&&S.maxY>=I.minY}function v(I){return{children:I,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function C(I,S,P,O,M){for(var E=[S,P];E.length;)if(!((P=E.pop())-(S=E.pop())<=O)){var B=S+Math.ceil((P-S)/O/2)*O;e(I,B,S,P,M),E.push(S,B,B,P)}}return n.prototype.all=function(){return this._all(this.data,[])},n.prototype.search=function(I){var S=this.data,P=[];if(!x(I,S))return P;for(var O=this.toBBox,M=[];S;){for(var E=0;E<S.children.length;E++){var B=S.children[E],j=S.leaf?O(B):B;x(I,j)&&(S.leaf?P.push(B):g(I,j)?this._all(B,P):M.push(B))}S=M.pop()}return P},n.prototype.collides=function(I){var S=this.data;if(!x(I,S))return!1;for(var P=[];S;){for(var O=0;O<S.children.length;O++){var M=S.children[O],E=S.leaf?this.toBBox(M):M;if(x(I,E)){if(S.leaf||g(I,E))return!0;P.push(M)}}S=P.pop()}return!1},n.prototype.load=function(I){if(!I||!I.length)return this;if(I.length<this._minEntries){for(var S=0;S<I.length;S++)this.insert(I[S]);return this}var P=this._build(I.slice(),0,I.length-1,0);if(this.data.children.length)if(this.data.height===P.height)this._splitRoot(this.data,P);else{if(this.data.height<P.height){var O=this.data;this.data=P,P=O}this._insert(P,this.data.height-P.height-1,!0)}else this.data=P;return this},n.prototype.insert=function(I){return I&&this._insert(I,this.data.height-1),this},n.prototype.clear=function(){return this.data=v([]),this},n.prototype.remove=function(I,S){if(!I)return this;for(var P,O,M,E=this.data,B=this.toBBox(I),j=[],L=[];E||j.length;){if(E||(E=j.pop(),O=j[j.length-1],P=L.pop(),M=!0),E.leaf){var N=o(I,E.children,S);if(N!==-1)return E.children.splice(N,1),j.push(E),this._condense(j),this}M||E.leaf||!g(E,B)?O?(P++,E=O.children[P],M=!1):E=null:(j.push(E),L.push(P),P=0,O=E,E=E.children[0])}return this},n.prototype.toBBox=function(I){return I},n.prototype.compareMinX=function(I,S){return I.minX-S.minX},n.prototype.compareMinY=function(I,S){return I.minY-S.minY},n.prototype.toJSON=function(){return this.data},n.prototype.fromJSON=function(I){return this.data=I,this},n.prototype._all=function(I,S){for(var P=[];I;)I.leaf?S.push.apply(S,I.children):P.push.apply(P,I.children),I=P.pop();return S},n.prototype._build=function(I,S,P,O){var M,E=P-S+1,B=this._maxEntries;if(E<=B)return i(M=v(I.slice(S,P+1)),this.toBBox),M;O||(O=Math.ceil(Math.log(E)/Math.log(B)),B=Math.ceil(E/Math.pow(B,O-1))),(M=v([])).leaf=!1,M.height=O;var j=Math.ceil(E/B),L=j*Math.ceil(Math.sqrt(B));C(I,S,P,L,this.compareMinX);for(var N=S;N<=P;N+=L){var X=Math.min(N+L-1,P);C(I,N,X,j,this.compareMinY);for(var Z=N;Z<=X;Z+=j){var re=Math.min(Z+j-1,X);M.children.push(this._build(I,Z,re,O-1))}}return i(M,this.toBBox),M},n.prototype._chooseSubtree=function(I,S,P,O){for(;O.push(S),!S.leaf&&O.length-1!==P;){for(var M=1/0,E=1/0,B=void 0,j=0;j<S.children.length;j++){var L=S.children[j],N=d(L),X=(Z=I,re=L,(Math.max(re.maxX,Z.maxX)-Math.min(re.minX,Z.minX))*(Math.max(re.maxY,Z.maxY)-Math.min(re.minY,Z.minY))-N);X<E?(E=X,M=N<M?N:M,B=L):X===E&&N<M&&(M=N,B=L)}S=B||S.children[0]}var Z,re;return S},n.prototype._insert=function(I,S,P){var O=P?I:this.toBBox(I),M=[],E=this._chooseSubtree(O,this.data,S,M);for(E.children.push(I),l(E,O);S>=0&&M[S].children.length>this._maxEntries;)this._split(M,S),S--;this._adjustParentBBoxes(O,M,S)},n.prototype._split=function(I,S){var P=I[S],O=P.children.length,M=this._minEntries;this._chooseSplitAxis(P,M,O);var E=this._chooseSplitIndex(P,M,O),B=v(P.children.splice(E,P.children.length-E));B.height=P.height,B.leaf=P.leaf,i(P,this.toBBox),i(B,this.toBBox),S?I[S-1].children.push(B):this._splitRoot(P,B)},n.prototype._splitRoot=function(I,S){this.data=v([I,S]),this.data.height=I.height+1,this.data.leaf=!1,i(this.data,this.toBBox)},n.prototype._chooseSplitIndex=function(I,S,P){for(var O,M,E,B,j,L,N,X=1/0,Z=1/0,re=S;re<=P-S;re++){var Q=s(I,0,re,this.toBBox),xe=s(I,re,P,this.toBBox),Ce=(M=Q,E=xe,B=void 0,j=void 0,L=void 0,N=void 0,B=Math.max(M.minX,E.minX),j=Math.max(M.minY,E.minY),L=Math.min(M.maxX,E.maxX),N=Math.min(M.maxY,E.maxY),Math.max(0,L-B)*Math.max(0,N-j)),ye=d(Q)+d(xe);Ce<X?(X=Ce,O=re,Z=ye<Z?ye:Z):Ce===X&&ye<Z&&(Z=ye,O=re)}return O||P-S},n.prototype._chooseSplitAxis=function(I,S,P){var O=I.leaf?this.compareMinX:c,M=I.leaf?this.compareMinY:p;this._allDistMargin(I,S,P,O)<this._allDistMargin(I,S,P,M)&&I.children.sort(O)},n.prototype._allDistMargin=function(I,S,P,O){I.children.sort(O);for(var M=this.toBBox,E=s(I,0,S,M),B=s(I,P-S,P,M),j=m(E)+m(B),L=S;L<P-S;L++){var N=I.children[L];l(E,I.leaf?M(N):N),j+=m(E)}for(var X=P-S-1;X>=S;X--){var Z=I.children[X];l(B,I.leaf?M(Z):Z),j+=m(B)}return j},n.prototype._adjustParentBBoxes=function(I,S,P){for(var O=P;O>=0;O--)l(S[O],I)},n.prototype._condense=function(I){for(var S=I.length-1,P=void 0;S>=0;S--)I[S].children.length===0?S>0?(P=I[S-1].children).splice(P.indexOf(I[S]),1):this.clear():i(I[S],this.toBBox)},n})});var US=ri(Ie=>{"use strict";u();Object.defineProperty(Ie,"__esModule",{value:!0});Ie.earthRadius=63710088e-1;Ie.factors={centimeters:Ie.earthRadius*100,centimetres:Ie.earthRadius*100,degrees:Ie.earthRadius/111325,feet:Ie.earthRadius*3.28084,inches:Ie.earthRadius*39.37,kilometers:Ie.earthRadius/1e3,kilometres:Ie.earthRadius/1e3,meters:Ie.earthRadius,metres:Ie.earthRadius,miles:Ie.earthRadius/1609.344,millimeters:Ie.earthRadius*1e3,millimetres:Ie.earthRadius*1e3,nauticalmiles:Ie.earthRadius/1852,radians:1,yards:Ie.earthRadius*1.0936};Ie.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/Ie.earthRadius,yards:1.0936133};Ie.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 Ml(e,t,r){r===void 0&&(r={});var n={type:"Feature"};return(r.id===0||r.id)&&(n.id=r.id),r.bbox&&(n.bbox=r.bbox),n.properties=t||{},n.geometry=e,n}Ie.feature=Ml;function DW(e,t,r){switch(r===void 0&&(r={}),e){case"Point":return BS(t).geometry;case"LineString":return GS(t).geometry;case"Polygon":return NS(t).geometry;case"MultiPoint":return m6(t).geometry;case"MultiLineString":return f6(t).geometry;case"MultiPolygon":return h6(t).geometry;default:throw new Error(e+" is invalid")}}Ie.geometry=DW;function BS(e,t,r){if(r===void 0&&(r={}),!e)throw new Error("coordinates is required");if(!Array.isArray(e))throw new Error("coordinates must be an Array");if(e.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!c0(e[0])||!c0(e[1]))throw new Error("coordinates must contain numbers");var n={type:"Point",coordinates:e};return Ml(n,t,r)}Ie.point=BS;function FW(e,t,r){return r===void 0&&(r={}),p0(e.map(function(n){return BS(n,t)}),r)}Ie.points=FW;function NS(e,t,r){r===void 0&&(r={});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 l={type:"Polygon",coordinates:e};return Ml(l,t,r)}Ie.polygon=NS;function kW(e,t,r){return r===void 0&&(r={}),p0(e.map(function(n){return NS(n,t)}),r)}Ie.polygons=kW;function GS(e,t,r){if(r===void 0&&(r={}),e.length<2)throw new Error("coordinates must be an array of two or more positions");var n={type:"LineString",coordinates:e};return Ml(n,t,r)}Ie.lineString=GS;function AW(e,t,r){return r===void 0&&(r={}),p0(e.map(function(n){return GS(n,t)}),r)}Ie.lineStrings=AW;function p0(e,t){t===void 0&&(t={});var r={type:"FeatureCollection"};return t.id&&(r.id=t.id),t.bbox&&(r.bbox=t.bbox),r.features=e,r}Ie.featureCollection=p0;function f6(e,t,r){r===void 0&&(r={});var n={type:"MultiLineString",coordinates:e};return Ml(n,t,r)}Ie.multiLineString=f6;function m6(e,t,r){r===void 0&&(r={});var n={type:"MultiPoint",coordinates:e};return Ml(n,t,r)}Ie.multiPoint=m6;function h6(e,t,r){r===void 0&&(r={});var n={type:"MultiPolygon",coordinates:e};return Ml(n,t,r)}Ie.multiPolygon=h6;function LW(e,t,r){r===void 0&&(r={});var n={type:"GeometryCollection",geometries:e};return Ml(n,t,r)}Ie.geometryCollection=LW;function RW(e,t){if(t===void 0&&(t=0),t&&!(t>=0))throw new Error("precision must be a positive number");var r=Math.pow(10,t||0);return Math.round(e*r)/r}Ie.round=RW;function g6(e,t){t===void 0&&(t="kilometers");var r=Ie.factors[t];if(!r)throw new Error(t+" units is invalid");return e*r}Ie.radiansToLength=g6;function jS(e,t){t===void 0&&(t="kilometers");var r=Ie.factors[t];if(!r)throw new Error(t+" units is invalid");return e/r}Ie.lengthToRadians=jS;function BW(e,t){return y6(jS(e,t))}Ie.lengthToDegrees=BW;function NW(e){var t=e%360;return t<0&&(t+=360),t}Ie.bearingToAzimuth=NW;function y6(e){var t=e%(2*Math.PI);return t*180/Math.PI}Ie.radiansToDegrees=y6;function GW(e){var t=e%360;return t*Math.PI/180}Ie.degreesToRadians=GW;function jW(e,t,r){if(t===void 0&&(t="kilometers"),r===void 0&&(r="kilometers"),!(e>=0))throw new Error("length must be a positive number");return g6(jS(e,t),r)}Ie.convertLength=jW;function UW(e,t,r){if(t===void 0&&(t="meters"),r===void 0&&(r="kilometers"),!(e>=0))throw new Error("area must be a positive number");var n=Ie.areaFactors[t];if(!n)throw new Error("invalid original units");var o=Ie.areaFactors[r];if(!o)throw new Error("invalid final units");return e/n*o}Ie.convertArea=UW;function c0(e){return!isNaN(e)&&e!==null&&!Array.isArray(e)}Ie.isNumber=c0;function VW(e){return!!e&&e.constructor===Object}Ie.isObject=VW;function HW(e){if(!e)throw new Error("bbox is required");if(!Array.isArray(e))throw new Error("bbox must be an Array");if(e.length!==4&&e.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");e.forEach(function(t){if(!c0(t))throw new Error("bbox must only contain numbers")})}Ie.validateBBox=HW;function WW(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")}Ie.validateId=WW});var HS=ri(wr=>{"use strict";u();Object.defineProperty(wr,"__esModule",{value:!0});var bn=US();function bh(e,t,r){if(e!==null)for(var n,o,i,s,l,c,p,d=0,m=0,g,x=e.type,v=x==="FeatureCollection",C=x==="Feature",I=v?e.features.length:1,S=0;S<I;S++){p=v?e.features[S].geometry:C?e.geometry:e,g=p?p.type==="GeometryCollection":!1,l=g?p.geometries.length:1;for(var P=0;P<l;P++){var O=0,M=0;if(s=g?p.geometries[P]:p,s!==null){c=s.coordinates;var E=s.type;switch(d=r&&(E==="Polygon"||E==="MultiPolygon")?1:0,E){case null:break;case"Point":if(t(c,m,S,O,M)===!1)return!1;m++,O++;break;case"LineString":case"MultiPoint":for(n=0;n<c.length;n++){if(t(c[n],m,S,O,M)===!1)return!1;m++,E==="MultiPoint"&&O++}E==="LineString"&&O++;break;case"Polygon":case"MultiLineString":for(n=0;n<c.length;n++){for(o=0;o<c[n].length-d;o++){if(t(c[n][o],m,S,O,M)===!1)return!1;m++}E==="MultiLineString"&&O++,E==="Polygon"&&M++}E==="Polygon"&&O++;break;case"MultiPolygon":for(n=0;n<c.length;n++){for(M=0,o=0;o<c[n].length;o++){for(i=0;i<c[n][o].length-d;i++){if(t(c[n][o][i],m,S,O,M)===!1)return!1;m++}M++}O++}break;case"GeometryCollection":for(n=0;n<s.geometries.length;n++)if(bh(s.geometries[n],t,r)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function $W(e,t,r,n){var o=r;return bh(e,function(i,s,l,c,p){s===0&&r===void 0?o=i:o=t(o,i,s,l,c,p)},n),o}function b6(e,t){var r;switch(e.type){case"FeatureCollection":for(r=0;r<e.features.length&&t(e.features[r].properties,r)!==!1;r++);break;case"Feature":t(e.properties,0);break}}function zW(e,t,r){var n=r;return b6(e,function(o,i){i===0&&r===void 0?n=o:n=t(n,o,i)}),n}function x6(e,t){if(e.type==="Feature")t(e,0);else if(e.type==="FeatureCollection")for(var r=0;r<e.features.length&&t(e.features[r],r)!==!1;r++);}function XW(e,t,r){var n=r;return x6(e,function(o,i){i===0&&r===void 0?n=o:n=t(n,o,i)}),n}function ZW(e){var t=[];return bh(e,function(r){t.push(r)}),t}function VS(e,t){var r,n,o,i,s,l,c,p,d,m,g=0,x=e.type==="FeatureCollection",v=e.type==="Feature",C=x?e.features.length:1;for(r=0;r<C;r++){for(l=x?e.features[r].geometry:v?e.geometry:e,p=x?e.features[r].properties:v?e.properties:{},d=x?e.features[r].bbox:v?e.bbox:void 0,m=x?e.features[r].id:v?e.id:void 0,c=l?l.type==="GeometryCollection":!1,s=c?l.geometries.length:1,o=0;o<s;o++){if(i=c?l.geometries[o]:l,i===null){if(t(null,g,p,d,m)===!1)return!1;continue}switch(i.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(t(i,g,p,d,m)===!1)return!1;break}case"GeometryCollection":{for(n=0;n<i.geometries.length;n++)if(t(i.geometries[n],g,p,d,m)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}g++}}function YW(e,t,r){var n=r;return VS(e,function(o,i,s,l,c){i===0&&r===void 0?n=o:n=t(n,o,i,s,l,c)}),n}function u0(e,t){VS(e,function(r,n,o,i,s){var l=r===null?null:r.type;switch(l){case null:case"Point":case"LineString":case"Polygon":return t(bn.feature(r,o,{bbox:i,id:s}),n,0)===!1?!1:void 0}var c;switch(l){case"MultiPoint":c="Point";break;case"MultiLineString":c="LineString";break;case"MultiPolygon":c="Polygon";break}for(var p=0;p<r.coordinates.length;p++){var d=r.coordinates[p],m={type:c,coordinates:d};if(t(bn.feature(m,o),n,p)===!1)return!1}})}function JW(e,t,r){var n=r;return u0(e,function(o,i,s){i===0&&s===0&&r===void 0?n=o:n=t(n,o,i,s)}),n}function v6(e,t){u0(e,function(r,n,o){var i=0;if(r.geometry){var s=r.geometry.type;if(!(s==="Point"||s==="MultiPoint")){var l,c=0,p=0,d=0;if(bh(r,function(m,g,x,v,C){if(l===void 0||n>c||v>p||C>d){l=m,c=n,p=v,d=C,i=0;return}var I=bn.lineString([l,m],r.properties);if(t(I,n,o,C,i)===!1)return!1;i++,l=m})===!1)return!1}}})}function qW(e,t,r){var n=r,o=!1;return v6(e,function(i,s,l,c,p){o===!1&&r===void 0?n=i:n=t(n,i,s,l,c,p),o=!0}),n}function I6(e,t){if(!e)throw new Error("geojson is required");u0(e,function(r,n,o){if(r.geometry!==null){var i=r.geometry.type,s=r.geometry.coordinates;switch(i){case"LineString":if(t(r,n,o,0,0)===!1)return!1;break;case"Polygon":for(var l=0;l<s.length;l++)if(t(bn.lineString(s[l],r.properties),n,o,l)===!1)return!1;break}}})}function KW(e,t,r){var n=r;return I6(e,function(o,i,s,l){i===0&&r===void 0?n=o:n=t(n,o,i,s,l)}),n}function QW(e,t){if(t=t||{},!bn.isObject(t))throw new Error("options is invalid");var r=t.featureIndex||0,n=t.multiFeatureIndex||0,o=t.geometryIndex||0,i=t.segmentIndex||0,s=t.properties,l;switch(e.type){case"FeatureCollection":r<0&&(r=e.features.length+r),s=s||e.features[r].properties,l=e.features[r].geometry;break;case"Feature":s=s||e.properties,l=e.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":l=e;break;default:throw new Error("geojson is invalid")}if(l===null)return null;var c=l.coordinates;switch(l.type){case"Point":case"MultiPoint":return null;case"LineString":return i<0&&(i=c.length+i-1),bn.lineString([c[i],c[i+1]],s,t);case"Polygon":return o<0&&(o=c.length+o),i<0&&(i=c[o].length+i-1),bn.lineString([c[o][i],c[o][i+1]],s,t);case"MultiLineString":return n<0&&(n=c.length+n),i<0&&(i=c[n].length+i-1),bn.lineString([c[n][i],c[n][i+1]],s,t);case"MultiPolygon":return n<0&&(n=c.length+n),o<0&&(o=c[n].length+o),i<0&&(i=c[n][o].length-i-1),bn.lineString([c[n][o][i],c[n][o][i+1]],s,t)}throw new Error("geojson is invalid")}function e$(e,t){if(t=t||{},!bn.isObject(t))throw new Error("options is invalid");var r=t.featureIndex||0,n=t.multiFeatureIndex||0,o=t.geometryIndex||0,i=t.coordIndex||0,s=t.properties,l;switch(e.type){case"FeatureCollection":r<0&&(r=e.features.length+r),s=s||e.features[r].properties,l=e.features[r].geometry;break;case"Feature":s=s||e.properties,l=e.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":l=e;break;default:throw new Error("geojson is invalid")}if(l===null)return null;var c=l.coordinates;switch(l.type){case"Point":return bn.point(c,s,t);case"MultiPoint":return n<0&&(n=c.length+n),bn.point(c[n],s,t);case"LineString":return i<0&&(i=c.length+i),bn.point(c[i],s,t);case"Polygon":return o<0&&(o=c.length+o),i<0&&(i=c[o].length+i),bn.point(c[o][i],s,t);case"MultiLineString":return n<0&&(n=c.length+n),i<0&&(i=c[n].length+i),bn.point(c[n][i],s,t);case"MultiPolygon":return n<0&&(n=c.length+n),o<0&&(o=c[n].length+o),i<0&&(i=c[n][o].length-i),bn.point(c[n][o][i],s,t)}throw new Error("geojson is invalid")}wr.coordAll=ZW;wr.coordEach=bh;wr.coordReduce=$W;wr.featureEach=x6;wr.featureReduce=XW;wr.findPoint=e$;wr.findSegment=QW;wr.flattenEach=u0;wr.flattenReduce=JW;wr.geomEach=VS;wr.geomReduce=YW;wr.lineEach=I6;wr.lineReduce=KW;wr.propEach=b6;wr.propReduce=zW;wr.segmentEach=v6;wr.segmentReduce=qW});var S6=ri($S=>{"use strict";u();Object.defineProperty($S,"__esModule",{value:!0});var t$=HS();function WS(e){var t=[1/0,1/0,-1/0,-1/0];return t$.coordEach(e,function(r){t[0]>r[0]&&(t[0]=r[0]),t[1]>r[1]&&(t[1]=r[1]),t[2]<r[0]&&(t[2]=r[0]),t[3]<r[1]&&(t[3]=r[1])}),t}WS.default=WS;$S.default=WS});var w6=ri((APe,zS)=>{u();var hs=d6(),T6=US(),M6=HS(),bd=S6().default,r$=M6.featureEach,FPe=M6.coordEach,kPe=T6.polygon,C6=T6.featureCollection;function P6(e){var t=new hs(e);return t.insert=function(r){if(r.type!=="Feature")throw new Error("invalid feature");return r.bbox=r.bbox?r.bbox:bd(r),hs.prototype.insert.call(this,r)},t.load=function(r){var n=[];return Array.isArray(r)?r.forEach(function(o){if(o.type!=="Feature")throw new Error("invalid features");o.bbox=o.bbox?o.bbox:bd(o),n.push(o)}):r$(r,function(o){if(o.type!=="Feature")throw new Error("invalid features");o.bbox=o.bbox?o.bbox:bd(o),n.push(o)}),hs.prototype.load.call(this,n)},t.remove=function(r,n){if(r.type!=="Feature")throw new Error("invalid feature");return r.bbox=r.bbox?r.bbox:bd(r),hs.prototype.remove.call(this,r,n)},t.clear=function(){return hs.prototype.clear.call(this)},t.search=function(r){var n=hs.prototype.search.call(this,this.toBBox(r));return C6(n)},t.collides=function(r){return hs.prototype.collides.call(this,this.toBBox(r))},t.all=function(){var r=hs.prototype.all.call(this);return C6(r)},t.toJSON=function(){return hs.prototype.toJSON.call(this)},t.fromJSON=function(r){return hs.prototype.fromJSON.call(this,r)},t.toBBox=function(r){var n;if(r.bbox)n=r.bbox;else if(Array.isArray(r)&&r.length===4)n=r;else if(Array.isArray(r)&&r.length===6)n=[r[0],r[1],r[3],r[4]];else if(r.type==="Feature")n=bd(r);else if(r.type==="FeatureCollection")n=bd(r);else throw new Error("invalid geojson");return{minX:n[0],minY:n[1],maxX:n[2],maxY:n[3]}},t}zS.exports=P6;zS.exports.default=P6});var K3=ri((zh,If)=>{u();var oX=200,f_="__lodash_hash_undefined__",iX=800,sX=16,m_=9007199254740991,h_="[object Arguments]",aX="[object Array]",lX="[object AsyncFunction]",cX="[object Boolean]",pX="[object Date]",uX="[object Error]",g_="[object Function]",dX="[object GeneratorFunction]",fX="[object Map]",mX="[object Number]",hX="[object Null]",y_="[object Object]",gX="[object Proxy]",yX="[object RegExp]",bX="[object Set]",xX="[object String]",vX="[object Undefined]",IX="[object WeakMap]",SX="[object ArrayBuffer]",CX="[object DataView]",TX="[object Float32Array]",MX="[object Float64Array]",PX="[object Int8Array]",wX="[object Int16Array]",OX="[object Int32Array]",_X="[object Uint8Array]",EX="[object Uint8ClampedArray]",DX="[object Uint16Array]",FX="[object Uint32Array]",kX=/[\\^$.*+?()[\]{}|]/g,AX=/^\[object .+?Constructor\]$/,LX=/^(?:0|[1-9]\d*)$/,Xt={};Xt[TX]=Xt[MX]=Xt[PX]=Xt[wX]=Xt[OX]=Xt[_X]=Xt[EX]=Xt[DX]=Xt[FX]=!0;Xt[h_]=Xt[aX]=Xt[SX]=Xt[cX]=Xt[CX]=Xt[pX]=Xt[uX]=Xt[g_]=Xt[fX]=Xt[mX]=Xt[y_]=Xt[yX]=Xt[bX]=Xt[xX]=Xt[IX]=!1;var b_=typeof global=="object"&&global&&global.Object===Object&&global,RX=typeof self=="object"&&self&&self.Object===Object&&self,Yh=b_||RX||Function("return this")(),x_=typeof zh=="object"&&zh&&!zh.nodeType&&zh,Xh=x_&&typeof If=="object"&&If&&!If.nodeType&&If,v_=Xh&&Xh.exports===x_,V3=v_&&b_.process,o_=function(){try{var e=Xh&&Xh.require&&Xh.require("util").types;return e||V3&&V3.binding&&V3.binding("util")}catch{}}(),i_=o_&&o_.isTypedArray;function BX(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}function NX(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}function GX(e){return function(t){return e(t)}}function jX(e,t){return e?.[t]}function UX(e,t){return function(r){return e(t(r))}}var VX=Array.prototype,HX=Function.prototype,W0=Object.prototype,H3=Yh["__core-js_shared__"],$0=HX.toString,Aa=W0.hasOwnProperty,s_=function(){var e=/[^.]+$/.exec(H3&&H3.keys&&H3.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),I_=W0.toString,WX=$0.call(Object),$X=RegExp("^"+$0.call(Aa).replace(kX,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),V0=v_?Yh.Buffer:void 0,a_=Yh.Symbol,l_=Yh.Uint8Array,c_=V0?V0.allocUnsafe:void 0,S_=UX(Object.getPrototypeOf,Object),p_=Object.create,zX=W0.propertyIsEnumerable,XX=VX.splice,Op=a_?a_.toStringTag:void 0,H0=function(){try{var e=Y3(Object,"defineProperty");return e({},"",{}),e}catch{}}(),ZX=V0?V0.isBuffer:void 0,u_=Math.max,YX=Date.now,C_=Y3(Yh,"Map"),Zh=Y3(Object,"create"),JX=function(){function e(){}return function(t){if(!Ep(t))return{};if(p_)return p_(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}}();function _p(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function qX(){this.__data__=Zh?Zh(null):{},this.size=0}function KX(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}function QX(e){var t=this.__data__;if(Zh){var r=t[e];return r===f_?void 0:r}return Aa.call(t,e)?t[e]:void 0}function eZ(e){var t=this.__data__;return Zh?t[e]!==void 0:Aa.call(t,e)}function tZ(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=Zh&&t===void 0?f_:t,this}_p.prototype.clear=qX;_p.prototype.delete=KX;_p.prototype.get=QX;_p.prototype.has=eZ;_p.prototype.set=tZ;function La(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function rZ(){this.__data__=[],this.size=0}function nZ(e){var t=this.__data__,r=z0(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():XX.call(t,r,1),--this.size,!0}function oZ(e){var t=this.__data__,r=z0(t,e);return r<0?void 0:t[r][1]}function iZ(e){return z0(this.__data__,e)>-1}function sZ(e,t){var r=this.__data__,n=z0(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}La.prototype.clear=rZ;La.prototype.delete=nZ;La.prototype.get=oZ;La.prototype.has=iZ;La.prototype.set=sZ;function Sf(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function aZ(){this.size=0,this.__data__={hash:new _p,map:new(C_||La),string:new _p}}function lZ(e){var t=Z0(this,e).delete(e);return this.size-=t?1:0,t}function cZ(e){return Z0(this,e).get(e)}function pZ(e){return Z0(this,e).has(e)}function uZ(e,t){var r=Z0(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}Sf.prototype.clear=aZ;Sf.prototype.delete=lZ;Sf.prototype.get=cZ;Sf.prototype.has=pZ;Sf.prototype.set=uZ;function Cf(e){var t=this.__data__=new La(e);this.size=t.size}function dZ(){this.__data__=new La,this.size=0}function fZ(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}function mZ(e){return this.__data__.get(e)}function hZ(e){return this.__data__.has(e)}function gZ(e,t){var r=this.__data__;if(r instanceof La){var n=r.__data__;if(!C_||n.length<oX-1)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new Sf(n)}return r.set(e,t),this.size=r.size,this}Cf.prototype.clear=dZ;Cf.prototype.delete=fZ;Cf.prototype.get=mZ;Cf.prototype.has=hZ;Cf.prototype.set=gZ;function yZ(e,t){var r=X3(e),n=!r&&z3(e),o=!r&&!n&&w_(e),i=!r&&!n&&!o&&__(e),s=r||n||o||i,l=s?NX(e.length,String):[],c=l.length;for(var p in e)(t||Aa.call(e,p))&&!(s&&(p=="length"||o&&(p=="offset"||p=="parent")||i&&(p=="buffer"||p=="byteLength"||p=="byteOffset")||M_(p,c)))&&l.push(p);return l}function W3(e,t,r){(r!==void 0&&!Y0(e[t],r)||r===void 0&&!(t in e))&&Z3(e,t,r)}function bZ(e,t,r){var n=e[t];(!(Aa.call(e,t)&&Y0(n,r))||r===void 0&&!(t in e))&&Z3(e,t,r)}function z0(e,t){for(var r=e.length;r--;)if(Y0(e[r][0],t))return r;return-1}function Z3(e,t,r){t=="__proto__"&&H0?H0(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}var xZ=FZ();function X0(e){return e==null?e===void 0?vX:hX:Op&&Op in Object(e)?kZ(e):GZ(e)}function d_(e){return Jh(e)&&X0(e)==h_}function vZ(e){if(!Ep(e)||BZ(e))return!1;var t=q3(e)?$X:AX;return t.test(HZ(e))}function IZ(e){return Jh(e)&&O_(e.length)&&!!Xt[X0(e)]}function SZ(e){if(!Ep(e))return NZ(e);var t=P_(e),r=[];for(var n in e)n=="constructor"&&(t||!Aa.call(e,n))||r.push(n);return r}function T_(e,t,r,n,o){e!==t&&xZ(t,function(i,s){if(o||(o=new Cf),Ep(i))CZ(e,t,s,r,T_,n,o);else{var l=n?n($3(e,s),i,s+"",e,t,o):void 0;l===void 0&&(l=i),W3(e,s,l)}},E_)}function CZ(e,t,r,n,o,i,s){var l=$3(e,r),c=$3(t,r),p=s.get(c);if(p){W3(e,r,p);return}var d=i?i(l,c,r+"",e,t,s):void 0,m=d===void 0;if(m){var g=X3(c),x=!g&&w_(c),v=!g&&!x&&__(c);d=c,g||x||v?X3(l)?d=l:WZ(l)?d=_Z(l):x?(m=!1,d=PZ(c,!0)):v?(m=!1,d=OZ(c,!0)):d=[]:$Z(c)||z3(c)?(d=l,z3(l)?d=zZ(l):(!Ep(l)||q3(l))&&(d=AZ(c))):m=!1}m&&(s.set(c,d),o(d,c,n,i,s),s.delete(c)),W3(e,r,d)}function TZ(e,t){return UZ(jZ(e,t,D_),e+"")}var MZ=H0?function(e,t){return H0(e,"toString",{configurable:!0,enumerable:!1,value:ZZ(t),writable:!0})}:D_;function PZ(e,t){if(t)return e.slice();var r=e.length,n=c_?c_(r):new e.constructor(r);return e.copy(n),n}function wZ(e){var t=new e.constructor(e.byteLength);return new l_(t).set(new l_(e)),t}function OZ(e,t){var r=t?wZ(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}function _Z(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}function EZ(e,t,r,n){var o=!r;r||(r={});for(var i=-1,s=t.length;++i<s;){var l=t[i],c=n?n(r[l],e[l],l,r,e):void 0;c===void 0&&(c=e[l]),o?Z3(r,l,c):bZ(r,l,c)}return r}function DZ(e){return TZ(function(t,r){var n=-1,o=r.length,i=o>1?r[o-1]:void 0,s=o>2?r[2]:void 0;for(i=e.length>3&&typeof i=="function"?(o--,i):void 0,s&&LZ(r[0],r[1],s)&&(i=o<3?void 0:i,o=1),t=Object(t);++n<o;){var l=r[n];l&&e(t,l,n,i)}return t})}function FZ(e){return function(t,r,n){for(var o=-1,i=Object(t),s=n(t),l=s.length;l--;){var c=s[e?l:++o];if(r(i[c],c,i)===!1)break}return t}}function Z0(e,t){var r=e.__data__;return RZ(t)?r[typeof t=="string"?"string":"hash"]:r.map}function Y3(e,t){var r=jX(e,t);return vZ(r)?r:void 0}function kZ(e){var t=Aa.call(e,Op),r=e[Op];try{e[Op]=void 0;var n=!0}catch{}var o=I_.call(e);return n&&(t?e[Op]=r:delete e[Op]),o}function AZ(e){return typeof e.constructor=="function"&&!P_(e)?JX(S_(e)):{}}function M_(e,t){var r=typeof e;return t=t??m_,!!t&&(r=="number"||r!="symbol"&&LX.test(e))&&e>-1&&e%1==0&&e<t}function LZ(e,t,r){if(!Ep(r))return!1;var n=typeof t;return(n=="number"?J3(r)&&M_(t,r.length):n=="string"&&t in r)?Y0(r[t],e):!1}function RZ(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function BZ(e){return!!s_&&s_ in e}function P_(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||W0;return e===r}function NZ(e){var t=[];if(e!=null)for(var r in Object(e))t.push(r);return t}function GZ(e){return I_.call(e)}function jZ(e,t,r){return t=u_(t===void 0?e.length-1:t,0),function(){for(var n=arguments,o=-1,i=u_(n.length-t,0),s=Array(i);++o<i;)s[o]=n[t+o];o=-1;for(var l=Array(t+1);++o<t;)l[o]=n[o];return l[t]=r(s),BX(e,this,l)}}function $3(e,t){if(!(t==="constructor"&&typeof e[t]=="function")&&t!="__proto__")return e[t]}var UZ=VZ(MZ);function VZ(e){var t=0,r=0;return function(){var n=YX(),o=sX-(n-r);if(r=n,o>0){if(++t>=iX)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function HZ(e){if(e!=null){try{return $0.call(e)}catch{}try{return e+""}catch{}}return""}function Y0(e,t){return e===t||e!==e&&t!==t}var z3=d_(function(){return arguments}())?d_:function(e){return Jh(e)&&Aa.call(e,"callee")&&!zX.call(e,"callee")},X3=Array.isArray;function J3(e){return e!=null&&O_(e.length)&&!q3(e)}function WZ(e){return Jh(e)&&J3(e)}var w_=ZX||YZ;function q3(e){if(!Ep(e))return!1;var t=X0(e);return t==g_||t==dX||t==lX||t==gX}function O_(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=m_}function Ep(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}function Jh(e){return e!=null&&typeof e=="object"}function $Z(e){if(!Jh(e)||X0(e)!=y_)return!1;var t=S_(e);if(t===null)return!0;var r=Aa.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&$0.call(r)==WX}var __=i_?GX(i_):IZ;function zZ(e){return EZ(e,E_(e))}function E_(e){return J3(e)?yZ(e,!0):SZ(e)}var XZ=DZ(function(e,t,r){T_(e,t,r)});function ZZ(e){return function(){return e}}function D_(e){return e}function YZ(){return!1}If.exports=XZ});var uC=ri((Kh,Pf)=>{u();var QZ=200,W_="__lodash_hash_undefined__",eY=800,tY=16,$_=9007199254740991,z_="[object Arguments]",rY="[object Array]",nY="[object AsyncFunction]",oY="[object Boolean]",iY="[object Date]",sY="[object Error]",X_="[object Function]",aY="[object GeneratorFunction]",lY="[object Map]",cY="[object Number]",pY="[object Null]",Z_="[object Object]",uY="[object Proxy]",dY="[object RegExp]",fY="[object Set]",mY="[object String]",hY="[object Undefined]",gY="[object WeakMap]",yY="[object ArrayBuffer]",bY="[object DataView]",xY="[object Float32Array]",vY="[object Float64Array]",IY="[object Int8Array]",SY="[object Int16Array]",CY="[object Int32Array]",TY="[object Uint8Array]",MY="[object Uint8ClampedArray]",PY="[object Uint16Array]",wY="[object Uint32Array]",OY=/[\\^$.*+?()[\]{}|]/g,_Y=/^\[object .+?Constructor\]$/,EY=/^(?:0|[1-9]\d*)$/,Zt={};Zt[xY]=Zt[vY]=Zt[IY]=Zt[SY]=Zt[CY]=Zt[TY]=Zt[MY]=Zt[PY]=Zt[wY]=!0;Zt[z_]=Zt[rY]=Zt[yY]=Zt[oY]=Zt[bY]=Zt[iY]=Zt[sY]=Zt[X_]=Zt[lY]=Zt[cY]=Zt[Z_]=Zt[dY]=Zt[fY]=Zt[mY]=Zt[gY]=!1;var Y_=typeof global=="object"&&global&&global.Object===Object&&global,DY=typeof self=="object"&&self&&self.Object===Object&&self,tg=Y_||DY||Function("return this")(),J_=typeof Kh=="object"&&Kh&&!Kh.nodeType&&Kh,Qh=J_&&typeof Pf=="object"&&Pf&&!Pf.nodeType&&Pf,q_=Qh&&Qh.exports===J_,eC=q_&&Y_.process,L_=function(){try{var e=Qh&&Qh.require&&Qh.require("util").types;return e||eC&&eC.binding&&eC.binding("util")}catch{}}(),R_=L_&&L_.isTypedArray;function K_(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}function FY(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}function kY(e){return function(t){return e(t)}}function AY(e,t){return e?.[t]}function LY(e,t){return function(r){return e(t(r))}}var RY=Array.prototype,BY=Function.prototype,K0=Object.prototype,tC=tg["__core-js_shared__"],Q0=BY.toString,Ba=K0.hasOwnProperty,B_=function(){var e=/[^.]+$/.exec(tC&&tC.keys&&tC.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),Q_=K0.toString,NY=Q0.call(Object),GY=RegExp("^"+Q0.call(Ba).replace(OY,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),J0=q_?tg.Buffer:void 0,N_=tg.Symbol,G_=tg.Uint8Array,j_=J0?J0.allocUnsafe:void 0,eE=LY(Object.getPrototypeOf,Object),U_=Object.create,jY=K0.propertyIsEnumerable,UY=RY.splice,Dp=N_?N_.toStringTag:void 0,q0=function(){try{var e=lC(Object,"defineProperty");return e({},"",{}),e}catch{}}(),VY=J0?J0.isBuffer:void 0,V_=Math.max,HY=Date.now,tE=lC(tg,"Map"),eg=lC(Object,"create"),WY=function(){function e(){}return function(t){if(!Ra(t))return{};if(U_)return U_(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}}();function Fp(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function $Y(){this.__data__=eg?eg(null):{},this.size=0}function zY(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}function XY(e){var t=this.__data__;if(eg){var r=t[e];return r===W_?void 0:r}return Ba.call(t,e)?t[e]:void 0}function ZY(e){var t=this.__data__;return eg?t[e]!==void 0:Ba.call(t,e)}function YY(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=eg&&t===void 0?W_:t,this}Fp.prototype.clear=$Y;Fp.prototype.delete=zY;Fp.prototype.get=XY;Fp.prototype.has=ZY;Fp.prototype.set=YY;function Na(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function JY(){this.__data__=[],this.size=0}function qY(e){var t=this.__data__,r=ex(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():UY.call(t,r,1),--this.size,!0}function KY(e){var t=this.__data__,r=ex(t,e);return r<0?void 0:t[r][1]}function QY(e){return ex(this.__data__,e)>-1}function eJ(e,t){var r=this.__data__,n=ex(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}Na.prototype.clear=JY;Na.prototype.delete=qY;Na.prototype.get=KY;Na.prototype.has=QY;Na.prototype.set=eJ;function wf(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function tJ(){this.size=0,this.__data__={hash:new Fp,map:new(tE||Na),string:new Fp}}function rJ(e){var t=rx(this,e).delete(e);return this.size-=t?1:0,t}function nJ(e){return rx(this,e).get(e)}function oJ(e){return rx(this,e).has(e)}function iJ(e,t){var r=rx(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}wf.prototype.clear=tJ;wf.prototype.delete=rJ;wf.prototype.get=nJ;wf.prototype.has=oJ;wf.prototype.set=iJ;function Of(e){var t=this.__data__=new Na(e);this.size=t.size}function sJ(){this.__data__=new Na,this.size=0}function aJ(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}function lJ(e){return this.__data__.get(e)}function cJ(e){return this.__data__.has(e)}function pJ(e,t){var r=this.__data__;if(r instanceof Na){var n=r.__data__;if(!tE||n.length<QZ-1)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new wf(n)}return r.set(e,t),this.size=r.size,this}Of.prototype.clear=sJ;Of.prototype.delete=aJ;Of.prototype.get=lJ;Of.prototype.has=cJ;Of.prototype.set=pJ;function uJ(e,t){var r=iC(e),n=!r&&oC(e),o=!r&&!n&&sE(e),i=!r&&!n&&!o&&lE(e),s=r||n||o||i,l=s?FY(e.length,String):[],c=l.length;for(var p in e)(t||Ba.call(e,p))&&!(s&&(p=="length"||o&&(p=="offset"||p=="parent")||i&&(p=="buffer"||p=="byteLength"||p=="byteOffset")||oE(p,c)))&&l.push(p);return l}function rC(e,t,r){(r!==void 0&&!nx(e[t],r)||r===void 0&&!(t in e))&&sC(e,t,r)}function dJ(e,t,r){var n=e[t];(!(Ba.call(e,t)&&nx(n,r))||r===void 0&&!(t in e))&&sC(e,t,r)}function ex(e,t){for(var r=e.length;r--;)if(nx(e[r][0],t))return r;return-1}function sC(e,t,r){t=="__proto__"&&q0?q0(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}var fJ=MJ();function tx(e){return e==null?e===void 0?hY:pY:Dp&&Dp in Object(e)?PJ(e):FJ(e)}function H_(e){return rg(e)&&tx(e)==z_}function mJ(e){if(!Ra(e)||EJ(e))return!1;var t=pC(e)?GY:_Y;return t.test(RJ(e))}function hJ(e){return rg(e)&&aE(e.length)&&!!Zt[tx(e)]}function gJ(e){if(!Ra(e))return DJ(e);var t=iE(e),r=[];for(var n in e)n=="constructor"&&(t||!Ba.call(e,n))||r.push(n);return r}function aC(e,t,r,n,o){e!==t&&fJ(t,function(i,s){if(o||(o=new Of),Ra(i))yJ(e,t,s,r,aC,n,o);else{var l=n?n(nC(e,s),i,s+"",e,t,o):void 0;l===void 0&&(l=i),rC(e,s,l)}},cE)}function yJ(e,t,r,n,o,i,s){var l=nC(e,r),c=nC(t,r),p=s.get(c);if(p){rC(e,r,p);return}var d=i?i(l,c,r+"",e,t,s):void 0,m=d===void 0;if(m){var g=iC(c),x=!g&&sE(c),v=!g&&!x&&lE(c);d=c,g||x||v?iC(l)?d=l:BJ(l)?d=SJ(l):x?(m=!1,d=xJ(c,!0)):v?(m=!1,d=IJ(c,!0)):d=[]:NJ(c)||oC(c)?(d=l,oC(l)?d=GJ(l):(!Ra(l)||pC(l))&&(d=wJ(c))):m=!1}m&&(s.set(c,d),o(d,c,n,i,s),s.delete(c)),rC(e,r,d)}function rE(e,t){return AJ(kJ(e,t,pE),e+"")}var bJ=q0?function(e,t){return q0(e,"toString",{configurable:!0,enumerable:!1,value:VJ(t),writable:!0})}:pE;function xJ(e,t){if(t)return e.slice();var r=e.length,n=j_?j_(r):new e.constructor(r);return e.copy(n),n}function vJ(e){var t=new e.constructor(e.byteLength);return new G_(t).set(new G_(e)),t}function IJ(e,t){var r=t?vJ(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}function SJ(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}function CJ(e,t,r,n){var o=!r;r||(r={});for(var i=-1,s=t.length;++i<s;){var l=t[i],c=n?n(r[l],e[l],l,r,e):void 0;c===void 0&&(c=e[l]),o?sC(r,l,c):dJ(r,l,c)}return r}function TJ(e){return rE(function(t,r){var n=-1,o=r.length,i=o>1?r[o-1]:void 0,s=o>2?r[2]:void 0;for(i=e.length>3&&typeof i=="function"?(o--,i):void 0,s&&OJ(r[0],r[1],s)&&(i=o<3?void 0:i,o=1),t=Object(t);++n<o;){var l=r[n];l&&e(t,l,n,i)}return t})}function MJ(e){return function(t,r,n){for(var o=-1,i=Object(t),s=n(t),l=s.length;l--;){var c=s[e?l:++o];if(r(i[c],c,i)===!1)break}return t}}function nE(e,t,r,n,o,i){return Ra(e)&&Ra(t)&&(i.set(t,e),aC(e,t,void 0,nE,i),i.delete(t)),e}function rx(e,t){var r=e.__data__;return _J(t)?r[typeof t=="string"?"string":"hash"]:r.map}function lC(e,t){var r=AY(e,t);return mJ(r)?r:void 0}function PJ(e){var t=Ba.call(e,Dp),r=e[Dp];try{e[Dp]=void 0;var n=!0}catch{}var o=Q_.call(e);return n&&(t?e[Dp]=r:delete e[Dp]),o}function wJ(e){return typeof e.constructor=="function"&&!iE(e)?WY(eE(e)):{}}function oE(e,t){var r=typeof e;return t=t??$_,!!t&&(r=="number"||r!="symbol"&&EY.test(e))&&e>-1&&e%1==0&&e<t}function OJ(e,t,r){if(!Ra(r))return!1;var n=typeof t;return(n=="number"?cC(r)&&oE(t,r.length):n=="string"&&t in r)?nx(r[t],e):!1}function _J(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function EJ(e){return!!B_&&B_ in e}function iE(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||K0;return e===r}function DJ(e){var t=[];if(e!=null)for(var r in Object(e))t.push(r);return t}function FJ(e){return Q_.call(e)}function kJ(e,t,r){return t=V_(t===void 0?e.length-1:t,0),function(){for(var n=arguments,o=-1,i=V_(n.length-t,0),s=Array(i);++o<i;)s[o]=n[t+o];o=-1;for(var l=Array(t+1);++o<t;)l[o]=n[o];return l[t]=r(s),K_(e,this,l)}}function nC(e,t){if(!(t==="constructor"&&typeof e[t]=="function")&&t!="__proto__")return e[t]}var AJ=LJ(bJ);function LJ(e){var t=0,r=0;return function(){var n=HY(),o=tY-(n-r);if(r=n,o>0){if(++t>=eY)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function RJ(e){if(e!=null){try{return Q0.call(e)}catch{}try{return e+""}catch{}}return""}function nx(e,t){return e===t||e!==e&&t!==t}var oC=H_(function(){return arguments}())?H_:function(e){return rg(e)&&Ba.call(e,"callee")&&!jY.call(e,"callee")},iC=Array.isArray;function cC(e){return e!=null&&aE(e.length)&&!pC(e)}function BJ(e){return rg(e)&&cC(e)}var sE=VY||HJ;function pC(e){if(!Ra(e))return!1;var t=tx(e);return t==X_||t==aY||t==nY||t==uY}function aE(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=$_}function Ra(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}function rg(e){return e!=null&&typeof e=="object"}function NJ(e){if(!rg(e)||tx(e)!=Z_)return!1;var t=eE(e);if(t===null)return!0;var r=Ba.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&Q0.call(r)==NY}var lE=R_?kY(R_):hJ;function GJ(e){return CJ(e,cE(e))}var jJ=rE(function(e){return e.push(void 0,nE),K_(UJ,void 0,e)});function cE(e){return cC(e)?uJ(e,!0):gJ(e)}var UJ=TJ(function(e,t,r,n){aC(e,t,r,n)});function VJ(e){return function(){return e}}function pE(e){return e}function HJ(){return!1}Pf.exports=jJ});var d8=ri((gke,dg)=>{"use strict";u();var Aq=!1,Lp=!1,i8=!0,s8=!1,h={},a8=!1;typeof dg<"u"&&dg.exports?(dg.exports=h,a8=!0):typeof document<"u"?window.ClipperLib=h:self.ClipperLib=h;var Sx;a8?(Fr="chrome",Sx="Netscape"):(Fr=navigator.userAgent.toString().toLowerCase(),Sx=navigator.appName);var Fr,ze={};Fr.indexOf("chrome")!=-1&&Fr.indexOf("chromium")==-1?ze.chrome=1:ze.chrome=0;Fr.indexOf("chromium")!=-1?ze.chromium=1:ze.chromium=0;Fr.indexOf("safari")!=-1&&Fr.indexOf("chrome")==-1&&Fr.indexOf("chromium")==-1?ze.safari=1:ze.safari=0;Fr.indexOf("firefox")!=-1?ze.firefox=1:ze.firefox=0;Fr.indexOf("firefox/17")!=-1?ze.firefox17=1:ze.firefox17=0;Fr.indexOf("firefox/15")!=-1?ze.firefox15=1:ze.firefox15=0;Fr.indexOf("firefox/3")!=-1?ze.firefox3=1:ze.firefox3=0;Fr.indexOf("opera")!=-1?ze.opera=1:ze.opera=0;Fr.indexOf("msie 10")!=-1?ze.msie10=1:ze.msie10=0;Fr.indexOf("msie 9")!=-1?ze.msie9=1:ze.msie9=0;Fr.indexOf("msie 8")!=-1?ze.msie8=1:ze.msie8=0;Fr.indexOf("msie 7")!=-1?ze.msie7=1:ze.msie7=0;Fr.indexOf("msie ")!=-1?ze.msie=1:ze.msie=0;h.biginteger_used=null;var Xl,Lq=0xdeadbeefcafe,n8=(Lq&16777215)==15715070;function Y(e,t,r){h.biginteger_used=1,e!=null&&(typeof e=="number"&&typeof t>"u"?this.fromInt(e):typeof e=="number"?this.fromNumber(e,t,r):t==null&&typeof e!="string"?this.fromString(e,256):this.fromString(e,t))}function nt(){return new Y(null)}function Rq(e,t,r,n,o,i){for(;--i>=0;){var s=t*this[e++]+r[n]+o;o=Math.floor(s/67108864),r[n++]=s&67108863}return o}function Bq(e,t,r,n,o,i){for(var s=t&32767,l=t>>15;--i>=0;){var c=this[e]&32767,p=this[e++]>>15,d=l*c+p*s;c=s*c+((d&32767)<<15)+r[n]+(o&1073741823),o=(c>>>30)+(d>>>15)+l*p+(o>>>30),r[n++]=c&1073741823}return o}function Nq(e,t,r,n,o,i){for(var s=t&16383,l=t>>14;--i>=0;){var c=this[e]&16383,p=this[e++]>>14,d=l*c+p*s;c=s*c+((d&16383)<<14)+r[n]+o,o=(c>>28)+(d>>14)+l*p,r[n++]=c&268435455}return o}n8&&Sx=="Microsoft Internet Explorer"?(Y.prototype.am=Bq,Xl=30):n8&&Sx!="Netscape"?(Y.prototype.am=Rq,Xl=26):(Y.prototype.am=Nq,Xl=28);Y.prototype.DB=Xl;Y.prototype.DM=(1<<Xl)-1;Y.prototype.DV=1<<Xl;var MC=52;Y.prototype.FV=Math.pow(2,MC);Y.prototype.F1=MC-Xl;Y.prototype.F2=2*Xl-MC;var Gq="0123456789abcdefghijklmnopqrstuvwxyz",Tx=new Array,Af,Zo;Af=48;for(Zo=0;Zo<=9;++Zo)Tx[Af++]=Zo;Af=97;for(Zo=10;Zo<36;++Zo)Tx[Af++]=Zo;Af=65;for(Zo=10;Zo<36;++Zo)Tx[Af++]=Zo;function o8(e){return Gq.charAt(e)}function l8(e,t){var r=Tx[e.charCodeAt(t)];return r??-1}function jq(e){for(var t=this.t-1;t>=0;--t)e[t]=this[t];e.t=this.t,e.s=this.s}function Uq(e){this.t=1,this.s=e<0?-1:0,e>0?this[0]=e:e<-1?this[0]=e+this.DV:this.t=0}function zl(e){var t=nt();return t.fromInt(e),t}function Vq(e,t){var r;if(t==16)r=4;else if(t==8)r=3;else if(t==256)r=8;else if(t==2)r=1;else if(t==32)r=5;else if(t==4)r=2;else{this.fromRadix(e,t);return}this.t=0,this.s=0;for(var n=e.length,o=!1,i=0;--n>=0;){var s=r==8?e[n]&255:l8(e,n);if(s<0){e.charAt(n)=="-"&&(o=!0);continue}o=!1,i==0?this[this.t++]=s:i+r>this.DB?(this[this.t-1]|=(s&(1<<this.DB-i)-1)<<i,this[this.t++]=s>>this.DB-i):this[this.t-1]|=s<<i,i+=r,i>=this.DB&&(i-=this.DB)}r==8&&(e[0]&128)!=0&&(this.s=-1,i>0&&(this[this.t-1]|=(1<<this.DB-i)-1<<i)),this.clamp(),o&&Y.ZERO.subTo(this,this)}function Hq(){for(var e=this.s&this.DM;this.t>0&&this[this.t-1]==e;)--this.t}function Wq(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(e==16)t=4;else if(e==8)t=3;else if(e==2)t=1;else if(e==32)t=5;else if(e==4)t=2;else return this.toRadix(e);var r=(1<<t)-1,n,o=!1,i="",s=this.t,l=this.DB-s*this.DB%t;if(s-- >0)for(l<this.DB&&(n=this[s]>>l)>0&&(o=!0,i=o8(n));s>=0;)l<t?(n=(this[s]&(1<<l)-1)<<t-l,n|=this[--s]>>(l+=this.DB-t)):(n=this[s]>>(l-=t)&r,l<=0&&(l+=this.DB,--s)),n>0&&(o=!0),o&&(i+=o8(n));return o?i:"0"}function $q(){var e=nt();return Y.ZERO.subTo(this,e),e}function zq(){return this.s<0?this.negate():this}function Xq(e){var t=this.s-e.s;if(t!=0)return t;var r=this.t;if(t=r-e.t,t!=0)return this.s<0?-t:t;for(;--r>=0;)if((t=this[r]-e[r])!=0)return t;return 0}function Mx(e){var t=1,r;return(r=e>>>16)!=0&&(e=r,t+=16),(r=e>>8)!=0&&(e=r,t+=8),(r=e>>4)!=0&&(e=r,t+=4),(r=e>>2)!=0&&(e=r,t+=2),(r=e>>1)!=0&&(e=r,t+=1),t}function Zq(){return this.t<=0?0:this.DB*(this.t-1)+Mx(this[this.t-1]^this.s&this.DM)}function Yq(e,t){var r;for(r=this.t-1;r>=0;--r)t[r+e]=this[r];for(r=e-1;r>=0;--r)t[r]=0;t.t=this.t+e,t.s=this.s}function Jq(e,t){for(var r=e;r<this.t;++r)t[r-e]=this[r];t.t=Math.max(this.t-e,0),t.s=this.s}function qq(e,t){var r=e%this.DB,n=this.DB-r,o=(1<<n)-1,i=Math.floor(e/this.DB),s=this.s<<r&this.DM,l;for(l=this.t-1;l>=0;--l)t[l+i+1]=this[l]>>n|s,s=(this[l]&o)<<r;for(l=i-1;l>=0;--l)t[l]=0;t[i]=s,t.t=this.t+i+1,t.s=this.s,t.clamp()}function Kq(e,t){t.s=this.s;var r=Math.floor(e/this.DB);if(r>=this.t){t.t=0;return}var n=e%this.DB,o=this.DB-n,i=(1<<n)-1;t[0]=this[r]>>n;for(var s=r+1;s<this.t;++s)t[s-r-1]|=(this[s]&i)<<o,t[s-r]=this[s]>>n;n>0&&(t[this.t-r-1]|=(this.s&i)<<o),t.t=this.t-r,t.clamp()}function Qq(e,t){for(var r=0,n=0,o=Math.min(e.t,this.t);r<o;)n+=this[r]-e[r],t[r++]=n&this.DM,n>>=this.DB;if(e.t<this.t){for(n-=e.s;r<this.t;)n+=this[r],t[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<e.t;)n-=e[r],t[r++]=n&this.DM,n>>=this.DB;n-=e.s}t.s=n<0?-1:0,n<-1?t[r++]=this.DV+n:n>0&&(t[r++]=n),t.t=r,t.clamp()}function eK(e,t){var r=this.abs(),n=e.abs(),o=r.t;for(t.t=o+n.t;--o>=0;)t[o]=0;for(o=0;o<n.t;++o)t[o+r.t]=r.am(0,n[o],t,o,0,r.t);t.s=0,t.clamp(),this.s!=e.s&&Y.ZERO.subTo(t,t)}function tK(e){for(var t=this.abs(),r=e.t=2*t.t;--r>=0;)e[r]=0;for(r=0;r<t.t-1;++r){var n=t.am(r,t[r],e,2*r,0,1);(e[r+t.t]+=t.am(r+1,2*t[r],e,2*r+1,n,t.t-r-1))>=t.DV&&(e[r+t.t]-=t.DV,e[r+t.t+1]=1)}e.t>0&&(e[e.t-1]+=t.am(r,t[r],e,2*r,0,1)),e.s=0,e.clamp()}function rK(e,t,r){var n=e.abs();if(!(n.t<=0)){var o=this.abs();if(o.t<n.t){t?.fromInt(0),r!=null&&this.copyTo(r);return}r==null&&(r=nt());var i=nt(),s=this.s,l=e.s,c=this.DB-Mx(n[n.t-1]);c>0?(n.lShiftTo(c,i),o.lShiftTo(c,r)):(n.copyTo(i),o.copyTo(r));var p=i.t,d=i[p-1];if(d!=0){var m=d*(1<<this.F1)+(p>1?i[p-2]>>this.F2:0),g=this.FV/m,x=(1<<this.F1)/m,v=1<<this.F2,C=r.t,I=C-p,S=t??nt();for(i.dlShiftTo(I,S),r.compareTo(S)>=0&&(r[r.t++]=1,r.subTo(S,r)),Y.ONE.dlShiftTo(p,S),S.subTo(i,i);i.t<p;)i[i.t++]=0;for(;--I>=0;){var P=r[--C]==d?this.DM:Math.floor(r[C]*g+(r[C-1]+v)*x);if((r[C]+=i.am(0,P,r,I,0,p))<P)for(i.dlShiftTo(I,S),r.subTo(S,r);r[C]<--P;)r.subTo(S,r)}t!=null&&(r.drShiftTo(p,t),s!=l&&Y.ZERO.subTo(t,t)),r.t=p,r.clamp(),c>0&&r.rShiftTo(c,r),s<0&&Y.ZERO.subTo(r,r)}}}function nK(e){var t=nt();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(Y.ZERO)>0&&e.subTo(t,t),t}function Rp(e){this.m=e}function oK(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e}function iK(e){return e}function sK(e){e.divRemTo(this.m,null,e)}function aK(e,t,r){e.multiplyTo(t,r),this.reduce(r)}function lK(e,t){e.squareTo(t),this.reduce(t)}Rp.prototype.convert=oK;Rp.prototype.revert=iK;Rp.prototype.reduce=sK;Rp.prototype.mulTo=aK;Rp.prototype.sqrTo=lK;function cK(){if(this.t<1)return 0;var e=this[0];if((e&1)==0)return 0;var t=e&3;return t=t*(2-(e&15)*t)&15,t=t*(2-(e&255)*t)&255,t=t*(2-((e&65535)*t&65535))&65535,t=t*(2-e*t%this.DV)%this.DV,t>0?this.DV-t:-t}function Bp(e){this.m=e,this.mp=e.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<<e.DB-15)-1,this.mt2=2*e.t}function pK(e){var t=nt();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(Y.ZERO)>0&&this.m.subTo(t,t),t}function uK(e){var t=nt();return e.copyTo(t),this.reduce(t),t}function dK(e){for(;e.t<=this.mt2;)e[e.t++]=0;for(var t=0;t<this.m.t;++t){var r=e[t]&32767,n=r*this.mpl+((r*this.mph+(e[t]>>15)*this.mpl&this.um)<<15)&e.DM;for(r=t+this.m.t,e[r]+=this.m.am(0,n,e,t,0,this.m.t);e[r]>=e.DV;)e[r]-=e.DV,e[++r]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)}function fK(e,t){e.squareTo(t),this.reduce(t)}function mK(e,t,r){e.multiplyTo(t,r),this.reduce(r)}Bp.prototype.convert=pK;Bp.prototype.revert=uK;Bp.prototype.reduce=dK;Bp.prototype.mulTo=mK;Bp.prototype.sqrTo=fK;function hK(){return(this.t>0?this[0]&1:this.s)==0}function gK(e,t){if(e>4294967295||e<1)return Y.ONE;var r=nt(),n=nt(),o=t.convert(this),i=Mx(e)-1;for(o.copyTo(r);--i>=0;)if(t.sqrTo(r,n),(e&1<<i)>0)t.mulTo(n,o,r);else{var s=r;r=n,n=s}return t.revert(r)}function yK(e,t){var r;return e<256||t.isEven()?r=new Rp(t):r=new Bp(t),this.exp(e,r)}Y.prototype.copyTo=jq;Y.prototype.fromInt=Uq;Y.prototype.fromString=Vq;Y.prototype.clamp=Hq;Y.prototype.dlShiftTo=Yq;Y.prototype.drShiftTo=Jq;Y.prototype.lShiftTo=qq;Y.prototype.rShiftTo=Kq;Y.prototype.subTo=Qq;Y.prototype.multiplyTo=eK;Y.prototype.squareTo=tK;Y.prototype.divRemTo=rK;Y.prototype.invDigit=cK;Y.prototype.isEven=hK;Y.prototype.exp=gK;Y.prototype.toString=Wq;Y.prototype.negate=$q;Y.prototype.abs=zq;Y.prototype.compareTo=Xq;Y.prototype.bitLength=Zq;Y.prototype.mod=nK;Y.prototype.modPowInt=yK;Y.ZERO=zl(0);Y.ONE=zl(1);function bK(){var e=nt();return this.copyTo(e),e}function xK(){if(this.s<0){if(this.t==1)return this[0]-this.DV;if(this.t==0)return-1}else{if(this.t==1)return this[0];if(this.t==0)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]}function vK(){return this.t==0?this.s:this[0]<<24>>24}function IK(){return this.t==0?this.s:this[0]<<16>>16}function SK(e){return Math.floor(Math.LN2*this.DB/Math.log(e))}function CK(){return this.s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1}function TK(e){if(e==null&&(e=10),this.signum()==0||e<2||e>36)return"0";var t=this.chunkSize(e),r=Math.pow(e,t),n=zl(r),o=nt(),i=nt(),s="";for(this.divRemTo(n,o,i);o.signum()>0;)s=(r+i.intValue()).toString(e).substr(1)+s,o.divRemTo(n,o,i);return i.intValue().toString(e)+s}function MK(e,t){this.fromInt(0),t==null&&(t=10);for(var r=this.chunkSize(t),n=Math.pow(t,r),o=!1,i=0,s=0,l=0;l<e.length;++l){var c=l8(e,l);if(c<0){e.charAt(l)=="-"&&this.signum()==0&&(o=!0);continue}s=t*s+c,++i>=r&&(this.dMultiply(n),this.dAddOffset(s,0),i=0,s=0)}i>0&&(this.dMultiply(Math.pow(t,i)),this.dAddOffset(s,0)),o&&Y.ZERO.subTo(this,this)}function PK(e,t,r){if(typeof t=="number")if(e<2)this.fromInt(1);else for(this.fromNumber(e,r),this.testBit(e-1)||this.bitwiseTo(Y.ONE.shiftLeft(e-1),PC,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(Y.ONE.shiftLeft(e-1),this);else{var n=new Array,o=e&7;n.length=(e>>3)+1,t.nextBytes(n),o>0?n[0]&=(1<<o)-1:n[0]=0,this.fromString(n,256)}}function wK(){var e=this.t,t=new Array;t[0]=this.s;var r=this.DB-e*this.DB%8,n,o=0;if(e-- >0)for(r<this.DB&&(n=this[e]>>r)!=(this.s&this.DM)>>r&&(t[o++]=n|this.s<<this.DB-r);e>=0;)r<8?(n=(this[e]&(1<<r)-1)<<8-r,n|=this[--e]>>(r+=this.DB-8)):(n=this[e]>>(r-=8)&255,r<=0&&(r+=this.DB,--e)),(n&128)!=0&&(n|=-256),o==0&&(this.s&128)!=(n&128)&&++o,(o>0||n!=this.s)&&(t[o++]=n);return t}function OK(e){return this.compareTo(e)==0}function _K(e){return this.compareTo(e)<0?this:e}function EK(e){return this.compareTo(e)>0?this:e}function DK(e,t,r){var n,o,i=Math.min(e.t,this.t);for(n=0;n<i;++n)r[n]=t(this[n],e[n]);if(e.t<this.t){for(o=e.s&this.DM,n=i;n<this.t;++n)r[n]=t(this[n],o);r.t=this.t}else{for(o=this.s&this.DM,n=i;n<e.t;++n)r[n]=t(o,e[n]);r.t=e.t}r.s=t(this.s,e.s),r.clamp()}function FK(e,t){return e&t}function kK(e){var t=nt();return this.bitwiseTo(e,FK,t),t}function PC(e,t){return e|t}function AK(e){var t=nt();return this.bitwiseTo(e,PC,t),t}function c8(e,t){return e^t}function LK(e){var t=nt();return this.bitwiseTo(e,c8,t),t}function p8(e,t){return e&~t}function RK(e){var t=nt();return this.bitwiseTo(e,p8,t),t}function BK(){for(var e=nt(),t=0;t<this.t;++t)e[t]=this.DM&~this[t];return e.t=this.t,e.s=~this.s,e}function NK(e){var t=nt();return e<0?this.rShiftTo(-e,t):this.lShiftTo(e,t),t}function GK(e){var t=nt();return e<0?this.lShiftTo(-e,t):this.rShiftTo(e,t),t}function jK(e){if(e==0)return-1;var t=0;return(e&65535)==0&&(e>>=16,t+=16),(e&255)==0&&(e>>=8,t+=8),(e&15)==0&&(e>>=4,t+=4),(e&3)==0&&(e>>=2,t+=2),(e&1)==0&&++t,t}function UK(){for(var e=0;e<this.t;++e)if(this[e]!=0)return e*this.DB+jK(this[e]);return this.s<0?this.t*this.DB:-1}function VK(e){for(var t=0;e!=0;)e&=e-1,++t;return t}function HK(){for(var e=0,t=this.s&this.DM,r=0;r<this.t;++r)e+=VK(this[r]^t);return e}function WK(e){var t=Math.floor(e/this.DB);return t>=this.t?this.s!=0:(this[t]&1<<e%this.DB)!=0}function $K(e,t){var r=Y.ONE.shiftLeft(e);return this.bitwiseTo(r,t,r),r}function zK(e){return this.changeBit(e,PC)}function XK(e){return this.changeBit(e,p8)}function ZK(e){return this.changeBit(e,c8)}function YK(e,t){for(var r=0,n=0,o=Math.min(e.t,this.t);r<o;)n+=this[r]+e[r],t[r++]=n&this.DM,n>>=this.DB;if(e.t<this.t){for(n+=e.s;r<this.t;)n+=this[r],t[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<e.t;)n+=e[r],t[r++]=n&this.DM,n>>=this.DB;n+=e.s}t.s=n<0?-1:0,n>0?t[r++]=n:n<-1&&(t[r++]=this.DV+n),t.t=r,t.clamp()}function JK(e){var t=nt();return this.addTo(e,t),t}function qK(e){var t=nt();return this.subTo(e,t),t}function KK(e){var t=nt();return this.multiplyTo(e,t),t}function QK(){var e=nt();return this.squareTo(e),e}function eQ(e){var t=nt();return this.divRemTo(e,t,null),t}function tQ(e){var t=nt();return this.divRemTo(e,null,t),t}function rQ(e){var t=nt(),r=nt();return this.divRemTo(e,t,r),new Array(t,r)}function nQ(e){this[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()}function oQ(e,t){if(e!=0){for(;this.t<=t;)this[this.t++]=0;for(this[t]+=e;this[t]>=this.DV;)this[t]-=this.DV,++t>=this.t&&(this[this.t++]=0),++this[t]}}function fg(){}function u8(e){return e}function iQ(e,t,r){e.multiplyTo(t,r)}function sQ(e,t){e.squareTo(t)}fg.prototype.convert=u8;fg.prototype.revert=u8;fg.prototype.mulTo=iQ;fg.prototype.sqrTo=sQ;function aQ(e){return this.exp(e,new fg)}function lQ(e,t,r){var n=Math.min(this.t+e.t,t);for(r.s=0,r.t=n;n>0;)r[--n]=0;var o;for(o=r.t-this.t;n<o;++n)r[n+this.t]=this.am(0,e[n],r,n,0,this.t);for(o=Math.min(e.t,t);n<o;++n)this.am(0,e[n],r,n,0,t-n);r.clamp()}function cQ(e,t,r){--t;var n=r.t=this.t+e.t-t;for(r.s=0;--n>=0;)r[n]=0;for(n=Math.max(t-this.t,0);n<e.t;++n)r[this.t+n-t]=this.am(t-n,e[n],r,0,0,this.t+n-t);r.clamp(),r.drShiftTo(1,r)}function Lf(e){this.r2=nt(),this.q3=nt(),Y.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e),this.m=e}function pQ(e){if(e.s<0||e.t>2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=nt();return e.copyTo(t),this.reduce(t),t}function uQ(e){return e}function dQ(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)}function fQ(e,t){e.squareTo(t),this.reduce(t)}function mQ(e,t,r){e.multiplyTo(t,r),this.reduce(r)}Lf.prototype.convert=pQ;Lf.prototype.revert=uQ;Lf.prototype.reduce=dQ;Lf.prototype.mulTo=mQ;Lf.prototype.sqrTo=fQ;function hQ(e,t){var r=e.bitLength(),n,o=zl(1),i;if(r<=0)return o;r<18?n=1:r<48?n=3:r<144?n=4:r<768?n=5:n=6,r<8?i=new Rp(t):t.isEven()?i=new Lf(t):i=new Bp(t);var s=new Array,l=3,c=n-1,p=(1<<n)-1;if(s[1]=i.convert(this),n>1){var d=nt();for(i.sqrTo(s[1],d);l<=p;)s[l]=nt(),i.mulTo(d,s[l-2],s[l]),l+=2}var m=e.t-1,g,x=!0,v=nt(),C;for(r=Mx(e[m])-1;m>=0;){for(r>=c?g=e[m]>>r-c&p:(g=(e[m]&(1<<r+1)-1)<<c-r,m>0&&(g|=e[m-1]>>this.DB+r-c)),l=n;(g&1)==0;)g>>=1,--l;if((r-=l)<0&&(r+=this.DB,--m),x)s[g].copyTo(o),x=!1;else{for(;l>1;)i.sqrTo(o,v),i.sqrTo(v,o),l-=2;l>0?i.sqrTo(o,v):(C=o,o=v,v=C),i.mulTo(v,s[g],o)}for(;m>=0&&(e[m]&1<<r)==0;)i.sqrTo(o,v),C=o,o=v,v=C,--r<0&&(r=this.DB-1,--m)}return i.revert(o)}function gQ(e){var t=this.s<0?this.negate():this.clone(),r=e.s<0?e.negate():e.clone();if(t.compareTo(r)<0){var n=t;t=r,r=n}var o=t.getLowestSetBit(),i=r.getLowestSetBit();if(i<0)return t;for(o<i&&(i=o),i>0&&(t.rShiftTo(i,t),r.rShiftTo(i,r));t.signum()>0;)(o=t.getLowestSetBit())>0&&t.rShiftTo(o,t),(o=r.getLowestSetBit())>0&&r.rShiftTo(o,r),t.compareTo(r)>=0?(t.subTo(r,t),t.rShiftTo(1,t)):(r.subTo(t,r),r.rShiftTo(1,r));return i>0&&r.lShiftTo(i,r),r}function yQ(e){if(e<=0)return 0;var t=this.DV%e,r=this.s<0?e-1:0;if(this.t>0)if(t==0)r=this[0]%e;else for(var n=this.t-1;n>=0;--n)r=(t*r+this[n])%e;return r}function bQ(e){var t=e.isEven();if(this.isEven()&&t||e.signum()==0)return Y.ZERO;for(var r=e.clone(),n=this.clone(),o=zl(1),i=zl(0),s=zl(0),l=zl(1);r.signum()!=0;){for(;r.isEven();)r.rShiftTo(1,r),t?((!o.isEven()||!i.isEven())&&(o.addTo(this,o),i.subTo(e,i)),o.rShiftTo(1,o)):i.isEven()||i.subTo(e,i),i.rShiftTo(1,i);for(;n.isEven();)n.rShiftTo(1,n),t?((!s.isEven()||!l.isEven())&&(s.addTo(this,s),l.subTo(e,l)),s.rShiftTo(1,s)):l.isEven()||l.subTo(e,l),l.rShiftTo(1,l);r.compareTo(n)>=0?(r.subTo(n,r),t&&o.subTo(s,o),i.subTo(l,i)):(n.subTo(r,n),t&&s.subTo(o,s),l.subTo(i,l))}if(n.compareTo(Y.ONE)!=0)return Y.ZERO;if(l.compareTo(e)>=0)return l.subtract(e);if(l.signum()<0)l.addTo(e,l);else return l;return l.signum()<0?l.add(e):l}var En=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],xQ=(1<<26)/En[En.length-1];function vQ(e){var t,r=this.abs();if(r.t==1&&r[0]<=En[En.length-1]){for(t=0;t<En.length;++t)if(r[0]==En[t])return!0;return!1}if(r.isEven())return!1;for(t=1;t<En.length;){for(var n=En[t],o=t+1;o<En.length&&n<xQ;)n*=En[o++];for(n=r.modInt(n);t<o;)if(n%En[t++]==0)return!1}return r.millerRabin(e)}function IQ(e){var t=this.subtract(Y.ONE),r=t.getLowestSetBit();if(r<=0)return!1;var n=t.shiftRight(r);e=e+1>>1,e>En.length&&(e=En.length);for(var o=nt(),i=0;i<e;++i){o.fromInt(En[Math.floor(Math.random()*En.length)]);var s=o.modPow(n,this);if(s.compareTo(Y.ONE)!=0&&s.compareTo(t)!=0){for(var l=1;l++<r&&s.compareTo(t)!=0;)if(s=s.modPowInt(2,this),s.compareTo(Y.ONE)==0)return!1;if(s.compareTo(t)!=0)return!1}}return!0}Y.prototype.chunkSize=SK;Y.prototype.toRadix=TK;Y.prototype.fromRadix=MK;Y.prototype.fromNumber=PK;Y.prototype.bitwiseTo=DK;Y.prototype.changeBit=$K;Y.prototype.addTo=YK;Y.prototype.dMultiply=nQ;Y.prototype.dAddOffset=oQ;Y.prototype.multiplyLowerTo=lQ;Y.prototype.multiplyUpperTo=cQ;Y.prototype.modInt=yQ;Y.prototype.millerRabin=IQ;Y.prototype.clone=bK;Y.prototype.intValue=xK;Y.prototype.byteValue=vK;Y.prototype.shortValue=IK;Y.prototype.signum=CK;Y.prototype.toByteArray=wK;Y.prototype.equals=OK;Y.prototype.min=_K;Y.prototype.max=EK;Y.prototype.and=kK;Y.prototype.or=AK;Y.prototype.xor=LK;Y.prototype.andNot=RK;Y.prototype.not=BK;Y.prototype.shiftLeft=NK;Y.prototype.shiftRight=GK;Y.prototype.getLowestSetBit=UK;Y.prototype.bitCount=HK;Y.prototype.testBit=WK;Y.prototype.setBit=zK;Y.prototype.clearBit=XK;Y.prototype.flipBit=ZK;Y.prototype.add=JK;Y.prototype.subtract=qK;Y.prototype.multiply=KK;Y.prototype.divide=eQ;Y.prototype.remainder=tQ;Y.prototype.divideAndRemainder=rQ;Y.prototype.modPow=hQ;Y.prototype.modInverse=bQ;Y.prototype.pow=aQ;Y.prototype.gcd=gQ;Y.prototype.isProbablePrime=vQ;Y.prototype.square=QK;var Ue=Y;Ue.prototype.IsNegative=function(){return this.compareTo(Ue.ZERO)==-1};Ue.op_Equality=function(e,t){return e.compareTo(t)==0};Ue.op_Inequality=function(e,t){return e.compareTo(t)!=0};Ue.op_GreaterThan=function(e,t){return e.compareTo(t)>0};Ue.op_LessThan=function(e,t){return e.compareTo(t)<0};Ue.op_Addition=function(e,t){return new Ue(e).add(new Ue(t))};Ue.op_Subtraction=function(e,t){return new Ue(e).subtract(new Ue(t))};Ue.Int128Mul=function(e,t){return new Ue(e).multiply(new Ue(t))};Ue.op_Division=function(e,t){return e.divide(t)};Ue.prototype.ToDouble=function(){return parseFloat(this.toString())};typeof Cx>"u"&&(Cx=function(e,t){var r;if(typeof Object.getOwnPropertyNames>"u"){for(r in t.prototype)(typeof e.prototype[r]>"u"||e.prototype[r]==Object.prototype[r])&&(e.prototype[r]=t.prototype[r]);for(r in t)typeof e[r]>"u"&&(e[r]=t[r]);e.$baseCtor=t}else{for(var n=Object.getOwnPropertyNames(t.prototype),o=0;o<n.length;o++)typeof Object.getOwnPropertyDescriptor(e.prototype,n[o])>"u"&&Object.defineProperty(e.prototype,n[o],Object.getOwnPropertyDescriptor(t.prototype,n[o]));for(r in t)typeof e[r]>"u"&&(e[r]=t[r]);e.$baseCtor=t}});var Cx;h.Path=function(){return[]};h.Paths=function(){return[]};h.DoublePoint=function(){var e=arguments;this.X=0,this.Y=0,e.length==1?(this.X=e[0].X,this.Y=e[0].Y):e.length==2&&(this.X=e[0],this.Y=e[1])};h.DoublePoint0=function(){this.X=0,this.Y=0};h.DoublePoint1=function(e){this.X=e.X,this.Y=e.Y};h.DoublePoint2=function(e,t){this.X=e,this.Y=t};h.PolyNode=function(){this.m_Parent=null,this.m_polygon=new h.Path,this.m_Index=0,this.m_jointype=0,this.m_endtype=0,this.m_Childs=[],this.IsOpen=!1};h.PolyNode.prototype.IsHoleNode=function(){for(var e=!0,t=this.m_Parent;t!==null;)e=!e,t=t.m_Parent;return e};h.PolyNode.prototype.ChildCount=function(){return this.m_Childs.length};h.PolyNode.prototype.Contour=function(){return this.m_polygon};h.PolyNode.prototype.AddChild=function(e){var t=this.m_Childs.length;this.m_Childs.push(e),e.m_Parent=this,e.m_Index=t};h.PolyNode.prototype.GetNext=function(){return this.m_Childs.length>0?this.m_Childs[0]:this.GetNextSiblingUp()};h.PolyNode.prototype.GetNextSiblingUp=function(){return this.m_Parent===null?null:this.m_Index==this.m_Parent.m_Childs.length-1?this.m_Parent.GetNextSiblingUp():this.m_Parent.m_Childs[this.m_Index+1]};h.PolyNode.prototype.Childs=function(){return this.m_Childs};h.PolyNode.prototype.Parent=function(){return this.m_Parent};h.PolyNode.prototype.IsHole=function(){return this.IsHoleNode()};h.PolyTree=function(){this.m_AllPolys=[],h.PolyNode.call(this)};h.PolyTree.prototype.Clear=function(){for(var e=0,t=this.m_AllPolys.length;e<t;e++)this.m_AllPolys[e]=null;this.m_AllPolys.length=0,this.m_Childs.length=0};h.PolyTree.prototype.GetFirst=function(){return this.m_Childs.length>0?this.m_Childs[0]:null};h.PolyTree.prototype.Total=function(){return this.m_AllPolys.length};Cx(h.PolyTree,h.PolyNode);h.Math_Abs_Int64=h.Math_Abs_Int32=h.Math_Abs_Double=function(e){return Math.abs(e)};h.Math_Max_Int32_Int32=function(e,t){return Math.max(e,t)};ze.msie||ze.opera||ze.safari?h.Cast_Int32=function(e){return e|0}:h.Cast_Int32=function(e){return~~e};ze.chrome?h.Cast_Int64=function(e){return e<-2147483648||e>2147483647?e<0?Math.ceil(e):Math.floor(e):~~e}:ze.firefox&&typeof Number.toInteger=="function"?h.Cast_Int64=function(e){return Number.toInteger(e)}:ze.msie7||ze.msie8?h.Cast_Int64=function(e){return parseInt(e,10)}:ze.msie?h.Cast_Int64=function(e){return e<-2147483648||e>2147483647?e<0?Math.ceil(e):Math.floor(e):e|0}:h.Cast_Int64=function(e){return e<0?Math.ceil(e):Math.floor(e)};h.Clear=function(e){e.length=0};h.PI=3.141592653589793;h.PI2=2*3.141592653589793;h.IntPoint=function(){var e=arguments,t=e.length;if(this.X=0,this.Y=0,Lp)if(this.Z=0,t==3)this.X=e[0],this.Y=e[1],this.Z=e[2];else if(t==2)this.X=e[0],this.Y=e[1],this.Z=0;else if(t==1)if(e[0]instanceof h.DoublePoint){var r=e[0];this.X=h.Clipper.Round(r.X),this.Y=h.Clipper.Round(r.Y),this.Z=0}else{var n=e[0];typeof n.Z>"u"&&(n.Z=0),this.X=n.X,this.Y=n.Y,this.Z=n.Z}else this.X=0,this.Y=0,this.Z=0;else if(t==2)this.X=e[0],this.Y=e[1];else if(t==1)if(e[0]instanceof h.DoublePoint){var r=e[0];this.X=h.Clipper.Round(r.X),this.Y=h.Clipper.Round(r.Y)}else{var n=e[0];this.X=n.X,this.Y=n.Y}else this.X=0,this.Y=0};h.IntPoint.op_Equality=function(e,t){return e.X==t.X&&e.Y==t.Y};h.IntPoint.op_Inequality=function(e,t){return e.X!=t.X||e.Y!=t.Y};Lp?(h.IntPoint0=function(){this.X=0,this.Y=0,this.Z=0},h.IntPoint1=function(e){this.X=e.X,this.Y=e.Y,this.Z=e.Z},h.IntPoint1dp=function(e){this.X=h.Clipper.Round(e.X),this.Y=h.Clipper.Round(e.Y),this.Z=0},h.IntPoint2=function(e,t){this.X=e,this.Y=t,this.Z=0},h.IntPoint3=function(e,t,r){this.X=e,this.Y=t,this.Z=r}):(h.IntPoint0=function(){this.X=0,this.Y=0},h.IntPoint1=function(e){this.X=e.X,this.Y=e.Y},h.IntPoint1dp=function(e){this.X=h.Clipper.Round(e.X),this.Y=h.Clipper.Round(e.Y)},h.IntPoint2=function(e,t){this.X=e,this.Y=t});h.IntRect=function(){var e=arguments,t=e.length;t==4?(this.left=e[0],this.top=e[1],this.right=e[2],this.bottom=e[3]):t==1?(this.left=ir.left,this.top=ir.top,this.right=ir.right,this.bottom=ir.bottom):(this.left=0,this.top=0,this.right=0,this.bottom=0)};h.IntRect0=function(){this.left=0,this.top=0,this.right=0,this.bottom=0};h.IntRect1=function(e){this.left=e.left,this.top=e.top,this.right=e.right,this.bottom=e.bottom};h.IntRect4=function(e,t,r,n){this.left=e,this.top=t,this.right=r,this.bottom=n};h.ClipType={ctIntersection:0,ctUnion:1,ctDifference:2,ctXor:3};h.PolyType={ptSubject:0,ptClip:1};h.PolyFillType={pftEvenOdd:0,pftNonZero:1,pftPositive:2,pftNegative:3};h.JoinType={jtSquare:0,jtRound:1,jtMiter:2};h.EndType={etOpenSquare:0,etOpenRound:1,etOpenButt:2,etClosedLine:3,etClosedPolygon:4};s8&&(h.EndType_={etSquare:0,etRound:1,etButt:2,etClosed:3});h.EdgeSide={esLeft:0,esRight:1};h.Direction={dRightToLeft:0,dLeftToRight:1};h.TEdge=function(){this.Bot=new h.IntPoint,this.Curr=new h.IntPoint,this.Top=new h.IntPoint,this.Delta=new h.IntPoint,this.Dx=0,this.PolyTyp=h.PolyType.ptSubject,this.Side=h.EdgeSide.esLeft,this.WindDelta=0,this.WindCnt=0,this.WindCnt2=0,this.OutIdx=0,this.Next=null,this.Prev=null,this.NextInLML=null,this.NextInAEL=null,this.PrevInAEL=null,this.NextInSEL=null,this.PrevInSEL=null};h.IntersectNode=function(){this.Edge1=null,this.Edge2=null,this.Pt=new h.IntPoint};h.MyIntersectNodeSort=function(){};h.MyIntersectNodeSort.Compare=function(e,t){return t.Pt.Y-e.Pt.Y};h.LocalMinima=function(){this.Y=0,this.LeftBound=null,this.RightBound=null,this.Next=null};h.Scanbeam=function(){this.Y=0,this.Next=null};h.OutRec=function(){this.Idx=0,this.IsHole=!1,this.IsOpen=!1,this.FirstLeft=null,this.Pts=null,this.BottomPt=null,this.PolyNode=null};h.OutPt=function(){this.Idx=0,this.Pt=new h.IntPoint,this.Next=null,this.Prev=null};h.Join=function(){this.OutPt1=null,this.OutPt2=null,this.OffPt=new h.IntPoint};h.ClipperBase=function(){this.m_MinimaList=null,this.m_CurrentLM=null,this.m_edges=new Array,this.m_UseFullRange=!1,this.m_HasOpenPaths=!1,this.PreserveCollinear=!1,this.m_MinimaList=null,this.m_CurrentLM=null,this.m_UseFullRange=!1,this.m_HasOpenPaths=!1};h.ClipperBase.horizontal=-9007199254740992;h.ClipperBase.Skip=-2;h.ClipperBase.Unassigned=-1;h.ClipperBase.tolerance=1e-20;Aq?(h.ClipperBase.loRange=46340,h.ClipperBase.hiRange=46340):(h.ClipperBase.loRange=47453132,h.ClipperBase.hiRange=0xfffffffffffff);h.ClipperBase.near_zero=function(e){return e>-h.ClipperBase.tolerance&&e<h.ClipperBase.tolerance};h.ClipperBase.IsHorizontal=function(e){return e.Delta.Y===0};h.ClipperBase.prototype.PointIsVertex=function(e,t){var r=t;do{if(h.IntPoint.op_Equality(r.Pt,e))return!0;r=r.Next}while(r!=t);return!1};h.ClipperBase.prototype.PointOnLineSegment=function(e,t,r,n){return n?e.X==t.X&&e.Y==t.Y||e.X==r.X&&e.Y==r.Y||e.X>t.X==e.X<r.X&&e.Y>t.Y==e.Y<r.Y&&Ue.op_Equality(Ue.Int128Mul(e.X-t.X,r.Y-t.Y),Ue.Int128Mul(r.X-t.X,e.Y-t.Y)):e.X==t.X&&e.Y==t.Y||e.X==r.X&&e.Y==r.Y||e.X>t.X==e.X<r.X&&e.Y>t.Y==e.Y<r.Y&&(e.X-t.X)*(r.Y-t.Y)==(r.X-t.X)*(e.Y-t.Y)};h.ClipperBase.prototype.PointOnPolygon=function(e,t,r){for(var n=t;;){if(this.PointOnLineSegment(e,n.Pt,n.Next.Pt,r))return!0;if(n=n.Next,n==t)break}return!1};h.ClipperBase.prototype.SlopesEqual=h.ClipperBase.SlopesEqual=function(){var e=arguments,t=e.length,r,n,o,i,s,l,c;return t==3?(r=e[0],n=e[1],c=e[2],c?Ue.op_Equality(Ue.Int128Mul(r.Delta.Y,n.Delta.X),Ue.Int128Mul(r.Delta.X,n.Delta.Y)):h.Cast_Int64(r.Delta.Y*n.Delta.X)==h.Cast_Int64(r.Delta.X*n.Delta.Y)):t==4?(o=e[0],i=e[1],s=e[2],c=e[3],c?Ue.op_Equality(Ue.Int128Mul(o.Y-i.Y,i.X-s.X),Ue.Int128Mul(o.X-i.X,i.Y-s.Y)):h.Cast_Int64((o.Y-i.Y)*(i.X-s.X))-h.Cast_Int64((o.X-i.X)*(i.Y-s.Y))===0):(o=e[0],i=e[1],s=e[2],l=e[3],c=e[4],c?Ue.op_Equality(Ue.Int128Mul(o.Y-i.Y,s.X-l.X),Ue.Int128Mul(o.X-i.X,s.Y-l.Y)):h.Cast_Int64((o.Y-i.Y)*(s.X-l.X))-h.Cast_Int64((o.X-i.X)*(s.Y-l.Y))===0)};h.ClipperBase.SlopesEqual3=function(e,t,r){return r?Ue.op_Equality(Ue.Int128Mul(e.Delta.Y,t.Delta.X),Ue.Int128Mul(e.Delta.X,t.Delta.Y)):h.Cast_Int64(e.Delta.Y*t.Delta.X)==h.Cast_Int64(e.Delta.X*t.Delta.Y)};h.ClipperBase.SlopesEqual4=function(e,t,r,n){return n?Ue.op_Equality(Ue.Int128Mul(e.Y-t.Y,t.X-r.X),Ue.Int128Mul(e.X-t.X,t.Y-r.Y)):h.Cast_Int64((e.Y-t.Y)*(t.X-r.X))-h.Cast_Int64((e.X-t.X)*(t.Y-r.Y))===0};h.ClipperBase.SlopesEqual5=function(e,t,r,n,o){return o?Ue.op_Equality(Ue.Int128Mul(e.Y-t.Y,r.X-n.X),Ue.Int128Mul(e.X-t.X,r.Y-n.Y)):h.Cast_Int64((e.Y-t.Y)*(r.X-n.X))-h.Cast_Int64((e.X-t.X)*(r.Y-n.Y))===0};h.ClipperBase.prototype.Clear=function(){this.DisposeLocalMinimaList();for(var e=0,t=this.m_edges.length;e<t;++e){for(var r=0,n=this.m_edges[e].length;r<n;++r)this.m_edges[e][r]=null;h.Clear(this.m_edges[e])}h.Clear(this.m_edges),this.m_UseFullRange=!1,this.m_HasOpenPaths=!1};h.ClipperBase.prototype.DisposeLocalMinimaList=function(){for(;this.m_MinimaList!==null;){var e=this.m_MinimaList.Next;this.m_MinimaList=null,this.m_MinimaList=e}this.m_CurrentLM=null};h.ClipperBase.prototype.RangeTest=function(e,t){t.Value?(e.X>h.ClipperBase.hiRange||e.Y>h.ClipperBase.hiRange||-e.X>h.ClipperBase.hiRange||-e.Y>h.ClipperBase.hiRange)&&h.Error("Coordinate outside allowed range in RangeTest()."):(e.X>h.ClipperBase.loRange||e.Y>h.ClipperBase.loRange||-e.X>h.ClipperBase.loRange||-e.Y>h.ClipperBase.loRange)&&(t.Value=!0,this.RangeTest(e,t))};h.ClipperBase.prototype.InitEdge=function(e,t,r,n){e.Next=t,e.Prev=r,e.Curr.X=n.X,e.Curr.Y=n.Y,e.OutIdx=-1};h.ClipperBase.prototype.InitEdge2=function(e,t){e.Curr.Y>=e.Next.Curr.Y?(e.Bot.X=e.Curr.X,e.Bot.Y=e.Curr.Y,e.Top.X=e.Next.Curr.X,e.Top.Y=e.Next.Curr.Y):(e.Top.X=e.Curr.X,e.Top.Y=e.Curr.Y,e.Bot.X=e.Next.Curr.X,e.Bot.Y=e.Next.Curr.Y),this.SetDx(e),e.PolyTyp=t};h.ClipperBase.prototype.FindNextLocMin=function(e){for(var t;;){for(;h.IntPoint.op_Inequality(e.Bot,e.Prev.Bot)||h.IntPoint.op_Equality(e.Curr,e.Top);)e=e.Next;if(e.Dx!=h.ClipperBase.horizontal&&e.Prev.Dx!=h.ClipperBase.horizontal)break;for(;e.Prev.Dx==h.ClipperBase.horizontal;)e=e.Prev;for(t=e;e.Dx==h.ClipperBase.horizontal;)e=e.Next;if(e.Top.Y!=e.Prev.Bot.Y){t.Prev.Bot.X<e.Bot.X&&(e=t);break}}return e};h.ClipperBase.prototype.ProcessBound=function(e,t){var r=e,n=e,o,i;if(e.Dx==h.ClipperBase.horizontal&&(t?i=e.Prev.Bot.X:i=e.Next.Bot.X,e.Bot.X!=i&&this.ReverseHorizontal(e)),n.OutIdx!=h.ClipperBase.Skip)if(t){for(;n.Top.Y==n.Next.Bot.Y&&n.Next.OutIdx!=h.ClipperBase.Skip;)n=n.Next;if(n.Dx==h.ClipperBase.horizontal&&n.Next.OutIdx!=h.ClipperBase.Skip){for(o=n;o.Prev.Dx==h.ClipperBase.horizontal;)o=o.Prev;o.Prev.Top.X==n.Next.Top.X?t||(n=o.Prev):o.Prev.Top.X>n.Next.Top.X&&(n=o.Prev)}for(;e!=n;)e.NextInLML=e.Next,e.Dx==h.ClipperBase.horizontal&&e!=r&&e.Bot.X!=e.Prev.Top.X&&this.ReverseHorizontal(e),e=e.Next;e.Dx==h.ClipperBase.horizontal&&e!=r&&e.Bot.X!=e.Prev.Top.X&&this.ReverseHorizontal(e),n=n.Next}else{for(;n.Top.Y==n.Prev.Bot.Y&&n.Prev.OutIdx!=h.ClipperBase.Skip;)n=n.Prev;if(n.Dx==h.ClipperBase.horizontal&&n.Prev.OutIdx!=h.ClipperBase.Skip){for(o=n;o.Next.Dx==h.ClipperBase.horizontal;)o=o.Next;o.Next.Top.X==n.Prev.Top.X?t||(n=o.Next):o.Next.Top.X>n.Prev.Top.X&&(n=o.Next)}for(;e!=n;)e.NextInLML=e.Prev,e.Dx==h.ClipperBase.horizontal&&e!=r&&e.Bot.X!=e.Next.Top.X&&this.ReverseHorizontal(e),e=e.Prev;e.Dx==h.ClipperBase.horizontal&&e!=r&&e.Bot.X!=e.Next.Top.X&&this.ReverseHorizontal(e),n=n.Prev}if(n.OutIdx==h.ClipperBase.Skip){if(e=n,t){for(;e.Top.Y==e.Next.Bot.Y;)e=e.Next;for(;e!=n&&e.Dx==h.ClipperBase.horizontal;)e=e.Prev}else{for(;e.Top.Y==e.Prev.Bot.Y;)e=e.Prev;for(;e!=n&&e.Dx==h.ClipperBase.horizontal;)e=e.Next}if(e==n)t?n=e.Next:n=e.Prev;else{t?e=n.Next:e=n.Prev;var s=new h.LocalMinima;s.Next=null,s.Y=e.Bot.Y,s.LeftBound=null,s.RightBound=e,s.RightBound.WindDelta=0,n=this.ProcessBound(s.RightBound,t),this.InsertLocalMinima(s)}}return n};h.ClipperBase.prototype.AddPath=function(e,t,r){i8?!r&&t==h.PolyType.ptClip&&h.Error("AddPath: Open paths must be subject."):r||h.Error("AddPath: Open paths have been disabled.");var n=e.length-1;if(r)for(;n>0&&h.IntPoint.op_Equality(e[n],e[0]);)--n;for(;n>0&&h.IntPoint.op_Equality(e[n],e[n-1]);)--n;if(r&&n<2||!r&&n<1)return!1;for(var o=new Array,i=0;i<=n;i++)o.push(new h.TEdge);var s=!0;o[1].Curr.X=e[1].X,o[1].Curr.Y=e[1].Y;var l={Value:this.m_UseFullRange};this.RangeTest(e[0],l),this.m_UseFullRange=l.Value,l.Value=this.m_UseFullRange,this.RangeTest(e[n],l),this.m_UseFullRange=l.Value,this.InitEdge(o[0],o[1],o[n],e[0]),this.InitEdge(o[n],o[0],o[n-1],e[n]);for(var i=n-1;i>=1;--i)l.Value=this.m_UseFullRange,this.RangeTest(e[i],l),this.m_UseFullRange=l.Value,this.InitEdge(o[i],o[i+1],o[i-1],e[i]);for(var c=o[0],p=c,d=c;;){if(h.IntPoint.op_Equality(p.Curr,p.Next.Curr)){if(p==p.Next)break;p==c&&(c=p.Next),p=this.RemoveEdge(p),d=p;continue}if(p.Prev==p.Next)break;if(r&&h.ClipperBase.SlopesEqual(p.Prev.Curr,p.Curr,p.Next.Curr,this.m_UseFullRange)&&(!this.PreserveCollinear||!this.Pt2IsBetweenPt1AndPt3(p.Prev.Curr,p.Curr,p.Next.Curr))){p==c&&(c=p.Next),p=this.RemoveEdge(p),p=p.Prev,d=p;continue}if(p=p.Next,p==d)break}if(!r&&p==p.Next||r&&p.Prev==p.Next)return!1;r||(this.m_HasOpenPaths=!0,c.Prev.OutIdx=h.ClipperBase.Skip);var m=c;p=c;do this.InitEdge2(p,t),p=p.Next,s&&p.Curr.Y!=c.Curr.Y&&(s=!1);while(p!=c);if(s){if(r)return!1;p.Prev.OutIdx=h.ClipperBase.Skip,p.Prev.Bot.X<p.Prev.Top.X&&this.ReverseHorizontal(p.Prev);var g=new h.LocalMinima;for(g.Next=null,g.Y=p.Bot.Y,g.LeftBound=null,g.RightBound=p,g.RightBound.Side=h.EdgeSide.esRight,g.RightBound.WindDelta=0;p.Next.OutIdx!=h.ClipperBase.Skip;)p.NextInLML=p.Next,p.Bot.X!=p.Prev.Top.X&&this.ReverseHorizontal(p),p=p.Next;return this.InsertLocalMinima(g),this.m_edges.push(o),!0}this.m_edges.push(o);for(var x,v=null;p=this.FindNextLocMin(p),p!=v;){v==null&&(v=p);var g=new h.LocalMinima;g.Next=null,g.Y=p.Bot.Y,p.Dx<p.Prev.Dx?(g.LeftBound=p.Prev,g.RightBound=p,x=!1):(g.LeftBound=p,g.RightBound=p.Prev,x=!0),g.LeftBound.Side=h.EdgeSide.esLeft,g.RightBound.Side=h.EdgeSide.esRight,r?g.LeftBound.Next==g.RightBound?g.LeftBound.WindDelta=-1:g.LeftBound.WindDelta=1:g.LeftBound.WindDelta=0,g.RightBound.WindDelta=-g.LeftBound.WindDelta,p=this.ProcessBound(g.LeftBound,x);var C=this.ProcessBound(g.RightBound,!x);g.LeftBound.OutIdx==h.ClipperBase.Skip?g.LeftBound=null:g.RightBound.OutIdx==h.ClipperBase.Skip&&(g.RightBound=null),this.InsertLocalMinima(g),x||(p=C)}return!0};h.ClipperBase.prototype.AddPaths=function(e,t,r){for(var n=!1,o=0,i=e.length;o<i;++o)this.AddPath(e[o],t,r)&&(n=!0);return n};h.ClipperBase.prototype.Pt2IsBetweenPt1AndPt3=function(e,t,r){return h.IntPoint.op_Equality(e,r)||h.IntPoint.op_Equality(e,t)||h.IntPoint.op_Equality(r,t)?!1:e.X!=r.X?t.X>e.X==t.X<r.X:t.Y>e.Y==t.Y<r.Y};h.ClipperBase.prototype.RemoveEdge=function(e){e.Prev.Next=e.Next,e.Next.Prev=e.Prev;var t=e.Next;return e.Prev=null,t};h.ClipperBase.prototype.SetDx=function(e){e.Delta.X=e.Top.X-e.Bot.X,e.Delta.Y=e.Top.Y-e.Bot.Y,e.Delta.Y===0?e.Dx=h.ClipperBase.horizontal:e.Dx=e.Delta.X/e.Delta.Y};h.ClipperBase.prototype.InsertLocalMinima=function(e){if(this.m_MinimaList===null)this.m_MinimaList=e;else if(e.Y>=this.m_MinimaList.Y)e.Next=this.m_MinimaList,this.m_MinimaList=e;else{for(var t=this.m_MinimaList;t.Next!==null&&e.Y<t.Next.Y;)t=t.Next;e.Next=t.Next,t.Next=e}};h.ClipperBase.prototype.PopLocalMinima=function(){this.m_CurrentLM!==null&&(this.m_CurrentLM=this.m_CurrentLM.Next)};h.ClipperBase.prototype.ReverseHorizontal=function(e){var t=e.Top.X;e.Top.X=e.Bot.X,e.Bot.X=t,Lp&&(t=e.Top.Z,e.Top.Z=e.Bot.Z,e.Bot.Z=t)};h.ClipperBase.prototype.Reset=function(){if(this.m_CurrentLM=this.m_MinimaList,this.m_CurrentLM!=null)for(var e=this.m_MinimaList;e!=null;){var t=e.LeftBound;t!=null&&(t.Curr.X=t.Bot.X,t.Curr.Y=t.Bot.Y,t.Side=h.EdgeSide.esLeft,t.OutIdx=h.ClipperBase.Unassigned),t=e.RightBound,t!=null&&(t.Curr.X=t.Bot.X,t.Curr.Y=t.Bot.Y,t.Side=h.EdgeSide.esRight,t.OutIdx=h.ClipperBase.Unassigned),e=e.Next}};h.Clipper=function(e){typeof e>"u"&&(e=0),this.m_PolyOuts=null,this.m_ClipType=h.ClipType.ctIntersection,this.m_Scanbeam=null,this.m_ActiveEdges=null,this.m_SortedEdges=null,this.m_IntersectList=null,this.m_IntersectNodeComparer=null,this.m_ExecuteLocked=!1,this.m_ClipFillType=h.PolyFillType.pftEvenOdd,this.m_SubjFillType=h.PolyFillType.pftEvenOdd,this.m_Joins=null,this.m_GhostJoins=null,this.m_UsingPolyTree=!1,this.ReverseSolution=!1,this.StrictlySimple=!1,h.ClipperBase.call(this),this.m_Scanbeam=null,this.m_ActiveEdges=null,this.m_SortedEdges=null,this.m_IntersectList=new Array,this.m_IntersectNodeComparer=h.MyIntersectNodeSort.Compare,this.m_ExecuteLocked=!1,this.m_UsingPolyTree=!1,this.m_PolyOuts=new Array,this.m_Joins=new Array,this.m_GhostJoins=new Array,this.ReverseSolution=(1&e)!==0,this.StrictlySimple=(2&e)!==0,this.PreserveCollinear=(4&e)!==0,Lp&&(this.ZFillFunction=null)};h.Clipper.ioReverseSolution=1;h.Clipper.ioStrictlySimple=2;h.Clipper.ioPreserveCollinear=4;h.Clipper.prototype.Clear=function(){this.m_edges.length!==0&&(this.DisposeAllPolyPts(),h.ClipperBase.prototype.Clear.call(this))};h.Clipper.prototype.DisposeScanbeamList=function(){for(;this.m_Scanbeam!==null;){var e=this.m_Scanbeam.Next;this.m_Scanbeam=null,this.m_Scanbeam=e}};h.Clipper.prototype.Reset=function(){h.ClipperBase.prototype.Reset.call(this),this.m_Scanbeam=null,this.m_ActiveEdges=null,this.m_SortedEdges=null;for(var e=this.m_MinimaList;e!==null;)this.InsertScanbeam(e.Y),e=e.Next};h.Clipper.prototype.InsertScanbeam=function(e){if(this.m_Scanbeam===null)this.m_Scanbeam=new h.Scanbeam,this.m_Scanbeam.Next=null,this.m_Scanbeam.Y=e;else if(e>this.m_Scanbeam.Y){var t=new h.Scanbeam;t.Y=e,t.Next=this.m_Scanbeam,this.m_Scanbeam=t}else{for(var r=this.m_Scanbeam;r.Next!==null&&e<=r.Next.Y;)r=r.Next;if(e==r.Y)return;var t=new h.Scanbeam;t.Y=e,t.Next=r.Next,r.Next=t}};h.Clipper.prototype.Execute=function(){var e=arguments,t=e.length,r=e[1]instanceof h.PolyTree;if(t==4&&!r){var n=e[0],o=e[1],i=e[2],s=e[3];if(this.m_ExecuteLocked)return!1;this.m_HasOpenPaths&&h.Error("Error: PolyTree struct is need for open path clipping."),this.m_ExecuteLocked=!0,h.Clear(o),this.m_SubjFillType=i,this.m_ClipFillType=s,this.m_ClipType=n,this.m_UsingPolyTree=!1;try{var l=this.ExecuteInternal();l&&this.BuildResult(o)}finally{this.DisposeAllPolyPts(),this.m_ExecuteLocked=!1}return l}else if(t==4&&r){var n=e[0],c=e[1],i=e[2],s=e[3];if(this.m_ExecuteLocked)return!1;this.m_ExecuteLocked=!0,this.m_SubjFillType=i,this.m_ClipFillType=s,this.m_ClipType=n,this.m_UsingPolyTree=!0;try{var l=this.ExecuteInternal();l&&this.BuildResult2(c)}finally{this.DisposeAllPolyPts(),this.m_ExecuteLocked=!1}return l}else if(t==2&&!r){var n=e[0],o=e[1];return this.Execute(n,o,h.PolyFillType.pftEvenOdd,h.PolyFillType.pftEvenOdd)}else if(t==2&&r){var n=e[0],c=e[1];return this.Execute(n,c,h.PolyFillType.pftEvenOdd,h.PolyFillType.pftEvenOdd)}};h.Clipper.prototype.FixHoleLinkage=function(e){if(!(e.FirstLeft===null||e.IsHole!=e.FirstLeft.IsHole&&e.FirstLeft.Pts!==null)){for(var t=e.FirstLeft;t!==null&&(t.IsHole==e.IsHole||t.Pts===null);)t=t.FirstLeft;e.FirstLeft=t}};h.Clipper.prototype.ExecuteInternal=function(){try{if(this.Reset(),this.m_CurrentLM===null)return!1;var e=this.PopScanbeam();do{if(this.InsertLocalMinimaIntoAEL(e),h.Clear(this.m_GhostJoins),this.ProcessHorizontals(!1),this.m_Scanbeam===null)break;var t=this.PopScanbeam();if(!this.ProcessIntersections(e,t))return!1;this.ProcessEdgesAtTopOfScanbeam(t),e=t}while(this.m_Scanbeam!==null||this.m_CurrentLM!==null);for(var r=0,n=this.m_PolyOuts.length;r<n;r++){var o=this.m_PolyOuts[r];o.Pts===null||o.IsOpen||(o.IsHole^this.ReverseSolution)==this.Area(o)>0&&this.ReversePolyPtLinks(o.Pts)}this.JoinCommonEdges();for(var r=0,n=this.m_PolyOuts.length;r<n;r++){var o=this.m_PolyOuts[r];o.Pts!==null&&!o.IsOpen&&this.FixupOutPolygon(o)}return this.StrictlySimple&&this.DoSimplePolygons(),!0}finally{h.Clear(this.m_Joins),h.Clear(this.m_GhostJoins)}};h.Clipper.prototype.PopScanbeam=function(){var e=this.m_Scanbeam.Y,t=this.m_Scanbeam;return this.m_Scanbeam=this.m_Scanbeam.Next,t=null,e};h.Clipper.prototype.DisposeAllPolyPts=function(){for(var e=0,t=this.m_PolyOuts.length;e<t;++e)this.DisposeOutRec(e);h.Clear(this.m_PolyOuts)};h.Clipper.prototype.DisposeOutRec=function(e){var t=this.m_PolyOuts[e];t.Pts!==null&&this.DisposeOutPts(t.Pts),t=null,this.m_PolyOuts[e]=null};h.Clipper.prototype.DisposeOutPts=function(e){if(e!==null){var t=null;for(e.Prev.Next=null;e!==null;)t=e,e=e.Next,t=null}};h.Clipper.prototype.AddJoin=function(e,t,r){var n=new h.Join;n.OutPt1=e,n.OutPt2=t,n.OffPt.X=r.X,n.OffPt.Y=r.Y,this.m_Joins.push(n)};h.Clipper.prototype.AddGhostJoin=function(e,t){var r=new h.Join;r.OutPt1=e,r.OffPt.X=t.X,r.OffPt.Y=t.Y,this.m_GhostJoins.push(r)};Lp&&(h.Clipper.prototype.SetZ=function(e,t){e.Z=0,this.ZFillFunction!==null&&(t.OutIdx<0?this.ZFillFunction(t.Bot,t.Top,e):this.ZFillFunction(t.Top,t.Bot,e))});h.Clipper.prototype.InsertLocalMinimaIntoAEL=function(e){for(;this.m_CurrentLM!==null&&this.m_CurrentLM.Y==e;){var t=this.m_CurrentLM.LeftBound,r=this.m_CurrentLM.RightBound;this.PopLocalMinima();var n=null;if(t===null?(this.InsertEdgeIntoAEL(r,null),this.SetWindingCount(r),this.IsContributing(r)&&(n=this.AddOutPt(r,r.Bot))):r==null?(this.InsertEdgeIntoAEL(t,null),this.SetWindingCount(t),this.IsContributing(t)&&(n=this.AddOutPt(t,t.Bot)),this.InsertScanbeam(t.Top.Y)):(this.InsertEdgeIntoAEL(t,null),this.InsertEdgeIntoAEL(r,t),this.SetWindingCount(t),r.WindCnt=t.WindCnt,r.WindCnt2=t.WindCnt2,this.IsContributing(t)&&(n=this.AddLocalMinPoly(t,r,t.Bot)),this.InsertScanbeam(t.Top.Y)),r!=null&&(h.ClipperBase.IsHorizontal(r)?this.AddEdgeToSEL(r):this.InsertScanbeam(r.Top.Y)),!(t==null||r==null)){if(n!==null&&h.ClipperBase.IsHorizontal(r)&&this.m_GhostJoins.length>0&&r.WindDelta!==0)for(var o=0,i=this.m_GhostJoins.length;o<i;o++){var s=this.m_GhostJoins[o];this.HorzSegmentsOverlap(s.OutPt1.Pt,s.OffPt,r.Bot,r.Top)&&this.AddJoin(s.OutPt1,n,s.OffPt)}if(t.OutIdx>=0&&t.PrevInAEL!==null&&t.PrevInAEL.Curr.X==t.Bot.X&&t.PrevInAEL.OutIdx>=0&&h.ClipperBase.SlopesEqual(t.PrevInAEL,t,this.m_UseFullRange)&&t.WindDelta!==0&&t.PrevInAEL.WindDelta!==0){var l=this.AddOutPt(t.PrevInAEL,t.Bot);this.AddJoin(n,l,t.Top)}if(t.NextInAEL!=r){if(r.OutIdx>=0&&r.PrevInAEL.OutIdx>=0&&h.ClipperBase.SlopesEqual(r.PrevInAEL,r,this.m_UseFullRange)&&r.WindDelta!==0&&r.PrevInAEL.WindDelta!==0){var l=this.AddOutPt(r.PrevInAEL,r.Bot);this.AddJoin(n,l,r.Top)}var c=t.NextInAEL;if(c!==null)for(;c!=r;)this.IntersectEdges(r,c,t.Curr,!1),c=c.NextInAEL}}}};h.Clipper.prototype.InsertEdgeIntoAEL=function(e,t){if(this.m_ActiveEdges===null)e.PrevInAEL=null,e.NextInAEL=null,this.m_ActiveEdges=e;else if(t===null&&this.E2InsertsBeforeE1(this.m_ActiveEdges,e))e.PrevInAEL=null,e.NextInAEL=this.m_ActiveEdges,this.m_ActiveEdges.PrevInAEL=e,this.m_ActiveEdges=e;else{for(t===null&&(t=this.m_ActiveEdges);t.NextInAEL!==null&&!this.E2InsertsBeforeE1(t.NextInAEL,e);)t=t.NextInAEL;e.NextInAEL=t.NextInAEL,t.NextInAEL!==null&&(t.NextInAEL.PrevInAEL=e),e.PrevInAEL=t,t.NextInAEL=e}};h.Clipper.prototype.E2InsertsBeforeE1=function(e,t){return t.Curr.X==e.Curr.X?t.Top.Y>e.Top.Y?t.Top.X<h.Clipper.TopX(e,t.Top.Y):e.Top.X>h.Clipper.TopX(t,e.Top.Y):t.Curr.X<e.Curr.X};h.Clipper.prototype.IsEvenOddFillType=function(e){return e.PolyTyp==h.PolyType.ptSubject?this.m_SubjFillType==h.PolyFillType.pftEvenOdd:this.m_ClipFillType==h.PolyFillType.pftEvenOdd};h.Clipper.prototype.IsEvenOddAltFillType=function(e){return e.PolyTyp==h.PolyType.ptSubject?this.m_ClipFillType==h.PolyFillType.pftEvenOdd:this.m_SubjFillType==h.PolyFillType.pftEvenOdd};h.Clipper.prototype.IsContributing=function(e){var t,r;switch(e.PolyTyp==h.PolyType.ptSubject?(t=this.m_SubjFillType,r=this.m_ClipFillType):(t=this.m_ClipFillType,r=this.m_SubjFillType),t){case h.PolyFillType.pftEvenOdd:if(e.WindDelta===0&&e.WindCnt!=1)return!1;break;case h.PolyFillType.pftNonZero:if(Math.abs(e.WindCnt)!=1)return!1;break;case h.PolyFillType.pftPositive:if(e.WindCnt!=1)return!1;break;default:if(e.WindCnt!=-1)return!1;break}switch(this.m_ClipType){case h.ClipType.ctIntersection:switch(r){case h.PolyFillType.pftEvenOdd:case h.PolyFillType.pftNonZero:return e.WindCnt2!==0;case h.PolyFillType.pftPositive:return e.WindCnt2>0;default:return e.WindCnt2<0}case h.ClipType.ctUnion:switch(r){case h.PolyFillType.pftEvenOdd:case h.PolyFillType.pftNonZero:return e.WindCnt2===0;case h.PolyFillType.pftPositive:return e.WindCnt2<=0;default:return e.WindCnt2>=0}case h.ClipType.ctDifference:if(e.PolyTyp==h.PolyType.ptSubject)switch(r){case h.PolyFillType.pftEvenOdd:case h.PolyFillType.pftNonZero:return e.WindCnt2===0;case h.PolyFillType.pftPositive:return e.WindCnt2<=0;default:return e.WindCnt2>=0}else switch(r){case h.PolyFillType.pftEvenOdd:case h.PolyFillType.pftNonZero:return e.WindCnt2!==0;case h.PolyFillType.pftPositive:return e.WindCnt2>0;default:return e.WindCnt2<0}case h.ClipType.ctXor:if(e.WindDelta===0)switch(r){case h.PolyFillType.pftEvenOdd:case h.PolyFillType.pftNonZero:return e.WindCnt2===0;case h.PolyFillType.pftPositive:return e.WindCnt2<=0;default:return e.WindCnt2>=0}else return!0}return!0};h.Clipper.prototype.SetWindingCount=function(e){for(var t=e.PrevInAEL;t!==null&&(t.PolyTyp!=e.PolyTyp||t.WindDelta===0);)t=t.PrevInAEL;if(t===null)e.WindCnt=e.WindDelta===0?1:e.WindDelta,e.WindCnt2=0,t=this.m_ActiveEdges;else if(e.WindDelta===0&&this.m_ClipType!=h.ClipType.ctUnion)e.WindCnt=1,e.WindCnt2=t.WindCnt2,t=t.NextInAEL;else if(this.IsEvenOddFillType(e)){if(e.WindDelta===0){for(var r=!0,n=t.PrevInAEL;n!==null;)n.PolyTyp==t.PolyTyp&&n.WindDelta!==0&&(r=!r),n=n.PrevInAEL;e.WindCnt=r?0:1}else e.WindCnt=e.WindDelta;e.WindCnt2=t.WindCnt2,t=t.NextInAEL}else t.WindCnt*t.WindDelta<0?Math.abs(t.WindCnt)>1?t.WindDelta*e.WindDelta<0?e.WindCnt=t.WindCnt:e.WindCnt=t.WindCnt+e.WindDelta:e.WindCnt=e.WindDelta===0?1:e.WindDelta:e.WindDelta===0?e.WindCnt=t.WindCnt<0?t.WindCnt-1:t.WindCnt+1:t.WindDelta*e.WindDelta<0?e.WindCnt=t.WindCnt:e.WindCnt=t.WindCnt+e.WindDelta,e.WindCnt2=t.WindCnt2,t=t.NextInAEL;if(this.IsEvenOddAltFillType(e))for(;t!=e;)t.WindDelta!==0&&(e.WindCnt2=e.WindCnt2===0?1:0),t=t.NextInAEL;else for(;t!=e;)e.WindCnt2+=t.WindDelta,t=t.NextInAEL};h.Clipper.prototype.AddEdgeToSEL=function(e){this.m_SortedEdges===null?(this.m_SortedEdges=e,e.PrevInSEL=null,e.NextInSEL=null):(e.NextInSEL=this.m_SortedEdges,e.PrevInSEL=null,this.m_SortedEdges.PrevInSEL=e,this.m_SortedEdges=e)};h.Clipper.prototype.CopyAELToSEL=function(){var e=this.m_ActiveEdges;for(this.m_SortedEdges=e;e!==null;)e.PrevInSEL=e.PrevInAEL,e.NextInSEL=e.NextInAEL,e=e.NextInAEL};h.Clipper.prototype.SwapPositionsInAEL=function(e,t){if(!(e.NextInAEL==e.PrevInAEL||t.NextInAEL==t.PrevInAEL)){if(e.NextInAEL==t){var r=t.NextInAEL;r!==null&&(r.PrevInAEL=e);var n=e.PrevInAEL;n!==null&&(n.NextInAEL=t),t.PrevInAEL=n,t.NextInAEL=e,e.PrevInAEL=t,e.NextInAEL=r}else if(t.NextInAEL==e){var r=e.NextInAEL;r!==null&&(r.PrevInAEL=t);var n=t.PrevInAEL;n!==null&&(n.NextInAEL=e),e.PrevInAEL=n,e.NextInAEL=t,t.PrevInAEL=e,t.NextInAEL=r}else{var r=e.NextInAEL,n=e.PrevInAEL;e.NextInAEL=t.NextInAEL,e.NextInAEL!==null&&(e.NextInAEL.PrevInAEL=e),e.PrevInAEL=t.PrevInAEL,e.PrevInAEL!==null&&(e.PrevInAEL.NextInAEL=e),t.NextInAEL=r,t.NextInAEL!==null&&(t.NextInAEL.PrevInAEL=t),t.PrevInAEL=n,t.PrevInAEL!==null&&(t.PrevInAEL.NextInAEL=t)}e.PrevInAEL===null?this.m_ActiveEdges=e:t.PrevInAEL===null&&(this.m_ActiveEdges=t)}};h.Clipper.prototype.SwapPositionsInSEL=function(e,t){if(!(e.NextInSEL===null&&e.PrevInSEL===null)&&!(t.NextInSEL===null&&t.PrevInSEL===null)){if(e.NextInSEL==t){var r=t.NextInSEL;r!==null&&(r.PrevInSEL=e);var n=e.PrevInSEL;n!==null&&(n.NextInSEL=t),t.PrevInSEL=n,t.NextInSEL=e,e.PrevInSEL=t,e.NextInSEL=r}else if(t.NextInSEL==e){var r=e.NextInSEL;r!==null&&(r.PrevInSEL=t);var n=t.PrevInSEL;n!==null&&(n.NextInSEL=e),e.PrevInSEL=n,e.NextInSEL=t,t.PrevInSEL=e,t.NextInSEL=r}else{var r=e.NextInSEL,n=e.PrevInSEL;e.NextInSEL=t.NextInSEL,e.NextInSEL!==null&&(e.NextInSEL.PrevInSEL=e),e.PrevInSEL=t.PrevInSEL,e.PrevInSEL!==null&&(e.PrevInSEL.NextInSEL=e),t.NextInSEL=r,t.NextInSEL!==null&&(t.NextInSEL.PrevInSEL=t),t.PrevInSEL=n,t.PrevInSEL!==null&&(t.PrevInSEL.NextInSEL=t)}e.PrevInSEL===null?this.m_SortedEdges=e:t.PrevInSEL===null&&(this.m_SortedEdges=t)}};h.Clipper.prototype.AddLocalMaxPoly=function(e,t,r){this.AddOutPt(e,r),t.WindDelta==0&&this.AddOutPt(t,r),e.OutIdx==t.OutIdx?(e.OutIdx=-1,t.OutIdx=-1):e.OutIdx<t.OutIdx?this.AppendPolygon(e,t):this.AppendPolygon(t,e)};h.Clipper.prototype.AddLocalMinPoly=function(e,t,r){var n,o,i;if(h.ClipperBase.IsHorizontal(t)||e.Dx>t.Dx?(n=this.AddOutPt(e,r),t.OutIdx=e.OutIdx,e.Side=h.EdgeSide.esLeft,t.Side=h.EdgeSide.esRight,o=e,o.PrevInAEL==t?i=t.PrevInAEL:i=o.PrevInAEL):(n=this.AddOutPt(t,r),e.OutIdx=t.OutIdx,e.Side=h.EdgeSide.esRight,t.Side=h.EdgeSide.esLeft,o=t,o.PrevInAEL==e?i=e.PrevInAEL:i=o.PrevInAEL),i!==null&&i.OutIdx>=0&&h.Clipper.TopX(i,r.Y)==h.Clipper.TopX(o,r.Y)&&h.ClipperBase.SlopesEqual(o,i,this.m_UseFullRange)&&o.WindDelta!==0&&i.WindDelta!==0){var s=this.AddOutPt(i,r);this.AddJoin(n,s,o.Top)}return n};h.Clipper.prototype.CreateOutRec=function(){var e=new h.OutRec;return e.Idx=-1,e.IsHole=!1,e.IsOpen=!1,e.FirstLeft=null,e.Pts=null,e.BottomPt=null,e.PolyNode=null,this.m_PolyOuts.push(e),e.Idx=this.m_PolyOuts.length-1,e};h.Clipper.prototype.AddOutPt=function(e,t){var r=e.Side==h.EdgeSide.esLeft;if(e.OutIdx<0){var n=this.CreateOutRec();n.IsOpen=e.WindDelta===0;var o=new h.OutPt;return n.Pts=o,o.Idx=n.Idx,o.Pt.X=t.X,o.Pt.Y=t.Y,o.Next=o,o.Prev=o,n.IsOpen||this.SetHoleState(e,n),Lp&&(h.IntPoint.op_Equality(t,e.Bot)?(o.Pt.X=e.Bot.X,o.Pt.Y=e.Bot.Y,o.Pt.Z=e.Bot.Z):h.IntPoint.op_Equality(t,e.Top)?(o.Pt.X=e.Top.X,o.Pt.Y=e.Top.Y,o.Pt.Z=e.Top.Z):this.SetZ(o.Pt,e)),e.OutIdx=n.Idx,o}else{var n=this.m_PolyOuts[e.OutIdx],i=n.Pts;if(r&&h.IntPoint.op_Equality(t,i.Pt))return i;if(!r&&h.IntPoint.op_Equality(t,i.Prev.Pt))return i.Prev;var o=new h.OutPt;return o.Idx=n.Idx,o.Pt.X=t.X,o.Pt.Y=t.Y,o.Next=i,o.Prev=i.Prev,o.Prev.Next=o,i.Prev=o,r&&(n.Pts=o),Lp&&(h.IntPoint.op_Equality(t,e.Bot)?(o.Pt.X=e.Bot.X,o.Pt.Y=e.Bot.Y,o.Pt.Z=e.Bot.Z):h.IntPoint.op_Equality(t,e.Top)?(o.Pt.X=e.Top.X,o.Pt.Y=e.Top.Y,o.Pt.Z=e.Top.Z):this.SetZ(o.Pt,e)),o}};h.Clipper.prototype.SwapPoints=function(e,t){var r=new h.IntPoint(e.Value);e.Value.X=t.Value.X,e.Value.Y=t.Value.Y,t.Value.X=r.X,t.Value.Y=r.Y};h.Clipper.prototype.HorzSegmentsOverlap=function(e,t,r,n){return e.X>r.X==e.X<n.X||t.X>r.X==t.X<n.X||r.X>e.X==r.X<t.X||n.X>e.X==n.X<t.X||e.X==r.X&&t.X==n.X?!0:e.X==n.X&&t.X==r.X};h.Clipper.prototype.InsertPolyPtBetween=function(e,t,r){var n=new h.OutPt;return n.Pt.X=r.X,n.Pt.Y=r.Y,t==e.Next?(e.Next=n,t.Prev=n,n.Next=t,n.Prev=e):(t.Next=n,e.Prev=n,n.Next=e,n.Prev=t),n};h.Clipper.prototype.SetHoleState=function(e,t){for(var r=!1,n=e.PrevInAEL;n!==null;)n.OutIdx>=0&&n.WindDelta!=0&&(r=!r,t.FirstLeft===null&&(t.FirstLeft=this.m_PolyOuts[n.OutIdx])),n=n.PrevInAEL;r&&(t.IsHole=!0)};h.Clipper.prototype.GetDx=function(e,t){return e.Y==t.Y?h.ClipperBase.horizontal:(t.X-e.X)/(t.Y-e.Y)};h.Clipper.prototype.FirstIsBottomPt=function(e,t){for(var r=e.Prev;h.IntPoint.op_Equality(r.Pt,e.Pt)&&r!=e;)r=r.Prev;var n=Math.abs(this.GetDx(e.Pt,r.Pt));for(r=e.Next;h.IntPoint.op_Equality(r.Pt,e.Pt)&&r!=e;)r=r.Next;var o=Math.abs(this.GetDx(e.Pt,r.Pt));for(r=t.Prev;h.IntPoint.op_Equality(r.Pt,t.Pt)&&r!=t;)r=r.Prev;var i=Math.abs(this.GetDx(t.Pt,r.Pt));for(r=t.Next;h.IntPoint.op_Equality(r.Pt,t.Pt)&&r!=t;)r=r.Next;var s=Math.abs(this.GetDx(t.Pt,r.Pt));return n>=i&&n>=s||o>=i&&o>=s};h.Clipper.prototype.GetBottomPt=function(e){for(var t=null,r=e.Next;r!=e;)r.Pt.Y>e.Pt.Y?(e=r,t=null):r.Pt.Y==e.Pt.Y&&r.Pt.X<=e.Pt.X&&(r.Pt.X<e.Pt.X?(t=null,e=r):r.Next!=e&&r.Prev!=e&&(t=r)),r=r.Next;if(t!==null)for(;t!=r;)for(this.FirstIsBottomPt(r,t)||(e=t),t=t.Next;h.IntPoint.op_Inequality(t.Pt,e.Pt);)t=t.Next;return e};h.Clipper.prototype.GetLowermostRec=function(e,t){e.BottomPt===null&&(e.BottomPt=this.GetBottomPt(e.Pts)),t.BottomPt===null&&(t.BottomPt=this.GetBottomPt(t.Pts));var r=e.BottomPt,n=t.BottomPt;return r.Pt.Y>n.Pt.Y?e:r.Pt.Y<n.Pt.Y?t:r.Pt.X<n.Pt.X?e:r.Pt.X>n.Pt.X||r.Next==r?t:n.Next==n||this.FirstIsBottomPt(r,n)?e:t};h.Clipper.prototype.Param1RightOfParam2=function(e,t){do if(e=e.FirstLeft,e==t)return!0;while(e!==null);return!1};h.Clipper.prototype.GetOutRec=function(e){for(var t=this.m_PolyOuts[e];t!=this.m_PolyOuts[t.Idx];)t=this.m_PolyOuts[t.Idx];return t};h.Clipper.prototype.AppendPolygon=function(e,t){var r=this.m_PolyOuts[e.OutIdx],n=this.m_PolyOuts[t.OutIdx],o;this.Param1RightOfParam2(r,n)?o=n:this.Param1RightOfParam2(n,r)?o=r:o=this.GetLowermostRec(r,n);var i=r.Pts,s=i.Prev,l=n.Pts,c=l.Prev,p;e.Side==h.EdgeSide.esLeft?(t.Side==h.EdgeSide.esLeft?(this.ReversePolyPtLinks(l),l.Next=i,i.Prev=l,s.Next=c,c.Prev=s,r.Pts=c):(c.Next=i,i.Prev=c,l.Prev=s,s.Next=l,r.Pts=l),p=h.EdgeSide.esLeft):(t.Side==h.EdgeSide.esRight?(this.ReversePolyPtLinks(l),s.Next=c,c.Prev=s,l.Next=i,i.Prev=l):(s.Next=l,l.Prev=s,i.Prev=c,c.Next=i),p=h.EdgeSide.esRight),r.BottomPt=null,o==n&&(n.FirstLeft!=r&&(r.FirstLeft=n.FirstLeft),r.IsHole=n.IsHole),n.Pts=null,n.BottomPt=null,n.FirstLeft=r;var d=e.OutIdx,m=t.OutIdx;e.OutIdx=-1,t.OutIdx=-1;for(var g=this.m_ActiveEdges;g!==null;){if(g.OutIdx==m){g.OutIdx=d,g.Side=p;break}g=g.NextInAEL}n.Idx=r.Idx};h.Clipper.prototype.ReversePolyPtLinks=function(e){if(e!==null){var t,r;t=e;do r=t.Next,t.Next=t.Prev,t.Prev=r,t=r;while(t!=e)}};h.Clipper.SwapSides=function(e,t){var r=e.Side;e.Side=t.Side,t.Side=r};h.Clipper.SwapPolyIndexes=function(e,t){var r=e.OutIdx;e.OutIdx=t.OutIdx,t.OutIdx=r};h.Clipper.prototype.IntersectEdges=function(e,t,r,n){var o=!n&&e.NextInLML===null&&e.Top.X==r.X&&e.Top.Y==r.Y,i=!n&&t.NextInLML===null&&t.Top.X==r.X&&t.Top.Y==r.Y,s=e.OutIdx>=0,l=t.OutIdx>=0;if(i8&&(e.WindDelta===0||t.WindDelta===0)){e.WindDelta===0&&t.WindDelta===0?(o||i)&&s&&l&&this.AddLocalMaxPoly(e,t,r):e.PolyTyp==t.PolyTyp&&e.WindDelta!=t.WindDelta&&this.m_ClipType==h.ClipType.ctUnion?e.WindDelta===0?l&&(this.AddOutPt(e,r),s&&(e.OutIdx=-1)):s&&(this.AddOutPt(t,r),l&&(t.OutIdx=-1)):e.PolyTyp!=t.PolyTyp&&(e.WindDelta===0&&Math.abs(t.WindCnt)==1&&(this.m_ClipType!=h.ClipType.ctUnion||t.WindCnt2===0)?(this.AddOutPt(e,r),s&&(e.OutIdx=-1)):t.WindDelta===0&&Math.abs(e.WindCnt)==1&&(this.m_ClipType!=h.ClipType.ctUnion||e.WindCnt2===0)&&(this.AddOutPt(t,r),l&&(t.OutIdx=-1))),o&&(e.OutIdx<0?this.DeleteFromAEL(e):h.Error("Error intersecting polylines")),i&&(t.OutIdx<0?this.DeleteFromAEL(t):h.Error("Error intersecting polylines"));return}if(e.PolyTyp==t.PolyTyp)if(this.IsEvenOddFillType(e)){var c=e.WindCnt;e.WindCnt=t.WindCnt,t.WindCnt=c}else e.WindCnt+t.WindDelta===0?e.WindCnt=-e.WindCnt:e.WindCnt+=t.WindDelta,t.WindCnt-e.WindDelta===0?t.WindCnt=-t.WindCnt:t.WindCnt-=e.WindDelta;else this.IsEvenOddFillType(t)?e.WindCnt2=e.WindCnt2===0?1:0:e.WindCnt2+=t.WindDelta,this.IsEvenOddFillType(e)?t.WindCnt2=t.WindCnt2===0?1:0:t.WindCnt2-=e.WindDelta;var p,d,m,g;e.PolyTyp==h.PolyType.ptSubject?(p=this.m_SubjFillType,m=this.m_ClipFillType):(p=this.m_ClipFillType,m=this.m_SubjFillType),t.PolyTyp==h.PolyType.ptSubject?(d=this.m_SubjFillType,g=this.m_ClipFillType):(d=this.m_ClipFillType,g=this.m_SubjFillType);var x,v;switch(p){case h.PolyFillType.pftPositive:x=e.WindCnt;break;case h.PolyFillType.pftNegative:x=-e.WindCnt;break;default:x=Math.abs(e.WindCnt);break}switch(d){case h.PolyFillType.pftPositive:v=t.WindCnt;break;case h.PolyFillType.pftNegative:v=-t.WindCnt;break;default:v=Math.abs(t.WindCnt);break}if(s&&l)o||i||x!==0&&x!=1||v!==0&&v!=1||e.PolyTyp!=t.PolyTyp&&this.m_ClipType!=h.ClipType.ctXor?this.AddLocalMaxPoly(e,t,r):(this.AddOutPt(e,r),this.AddOutPt(t,r),h.Clipper.SwapSides(e,t),h.Clipper.SwapPolyIndexes(e,t));else if(s)(v===0||v==1)&&(this.AddOutPt(e,r),h.Clipper.SwapSides(e,t),h.Clipper.SwapPolyIndexes(e,t));else if(l)(x===0||x==1)&&(this.AddOutPt(t,r),h.Clipper.SwapSides(e,t),h.Clipper.SwapPolyIndexes(e,t));else if((x===0||x==1)&&(v===0||v==1)&&!o&&!i){var C,I;switch(m){case h.PolyFillType.pftPositive:C=e.WindCnt2;break;case h.PolyFillType.pftNegative:C=-e.WindCnt2;break;default:C=Math.abs(e.WindCnt2);break}switch(g){case h.PolyFillType.pftPositive:I=t.WindCnt2;break;case h.PolyFillType.pftNegative:I=-t.WindCnt2;break;default:I=Math.abs(t.WindCnt2);break}if(e.PolyTyp!=t.PolyTyp)this.AddLocalMinPoly(e,t,r);else if(x==1&&v==1)switch(this.m_ClipType){case h.ClipType.ctIntersection:C>0&&I>0&&this.AddLocalMinPoly(e,t,r);break;case h.ClipType.ctUnion:C<=0&&I<=0&&this.AddLocalMinPoly(e,t,r);break;case h.ClipType.ctDifference:(e.PolyTyp==h.PolyType.ptClip&&C>0&&I>0||e.PolyTyp==h.PolyType.ptSubject&&C<=0&&I<=0)&&this.AddLocalMinPoly(e,t,r);break;case h.ClipType.ctXor:this.AddLocalMinPoly(e,t,r);break}else h.Clipper.SwapSides(e,t)}o!=i&&(o&&e.OutIdx>=0||i&&t.OutIdx>=0)&&(h.Clipper.SwapSides(e,t),h.Clipper.SwapPolyIndexes(e,t)),o&&this.DeleteFromAEL(e),i&&this.DeleteFromAEL(t)};h.Clipper.prototype.DeleteFromAEL=function(e){var t=e.PrevInAEL,r=e.NextInAEL;t===null&&r===null&&e!=this.m_ActiveEdges||(t!==null?t.NextInAEL=r:this.m_ActiveEdges=r,r!==null&&(r.PrevInAEL=t),e.NextInAEL=null,e.PrevInAEL=null)};h.Clipper.prototype.DeleteFromSEL=function(e){var t=e.PrevInSEL,r=e.NextInSEL;t===null&&r===null&&e!=this.m_SortedEdges||(t!==null?t.NextInSEL=r:this.m_SortedEdges=r,r!==null&&(r.PrevInSEL=t),e.NextInSEL=null,e.PrevInSEL=null)};h.Clipper.prototype.UpdateEdgeIntoAEL=function(e){e.NextInLML===null&&h.Error("UpdateEdgeIntoAEL: invalid call");var t=e.PrevInAEL,r=e.NextInAEL;return e.NextInLML.OutIdx=e.OutIdx,t!==null?t.NextInAEL=e.NextInLML:this.m_ActiveEdges=e.NextInLML,r!==null&&(r.PrevInAEL=e.NextInLML),e.NextInLML.Side=e.Side,e.NextInLML.WindDelta=e.WindDelta,e.NextInLML.WindCnt=e.WindCnt,e.NextInLML.WindCnt2=e.WindCnt2,e=e.NextInLML,e.Curr.X=e.Bot.X,e.Curr.Y=e.Bot.Y,e.PrevInAEL=t,e.NextInAEL=r,h.ClipperBase.IsHorizontal(e)||this.InsertScanbeam(e.Top.Y),e};h.Clipper.prototype.ProcessHorizontals=function(e){for(var t=this.m_SortedEdges;t!==null;)this.DeleteFromSEL(t),this.ProcessHorizontal(t,e),t=this.m_SortedEdges};h.Clipper.prototype.GetHorzDirection=function(e,t){e.Bot.X<e.Top.X?(t.Left=e.Bot.X,t.Right=e.Top.X,t.Dir=h.Direction.dLeftToRight):(t.Left=e.Top.X,t.Right=e.Bot.X,t.Dir=h.Direction.dRightToLeft)};h.Clipper.prototype.PrepareHorzJoins=function(e,t){var r=this.m_PolyOuts[e.OutIdx].Pts;e.Side!=h.EdgeSide.esLeft&&(r=r.Prev),t&&(h.IntPoint.op_Equality(r.Pt,e.Top)?this.AddGhostJoin(r,e.Bot):this.AddGhostJoin(r,e.Top))};h.Clipper.prototype.ProcessHorizontal=function(e,t){var r={Dir:null,Left:null,Right:null};this.GetHorzDirection(e,r);for(var n=r.Dir,o=r.Left,i=r.Right,s=e,l=null;s.NextInLML!==null&&h.ClipperBase.IsHorizontal(s.NextInLML);)s=s.NextInLML;for(s.NextInLML===null&&(l=this.GetMaximaPair(s));;){for(var c=e==s,p=this.GetNextInAEL(e,n);p!==null&&!(p.Curr.X==e.Top.X&&e.NextInLML!==null&&p.Dx<e.NextInLML.Dx);){var d=this.GetNextInAEL(p,n);if(n==h.Direction.dLeftToRight&&p.Curr.X<=i||n==h.Direction.dRightToLeft&&p.Curr.X>=o){if(e.OutIdx>=0&&e.WindDelta!=0&&this.PrepareHorzJoins(e,t),p==l&&c){n==h.Direction.dLeftToRight?this.IntersectEdges(e,p,p.Top,!1):this.IntersectEdges(p,e,p.Top,!1),l.OutIdx>=0&&h.Error("ProcessHorizontal error");return}else if(n==h.Direction.dLeftToRight){var m=new h.IntPoint(p.Curr.X,e.Curr.Y);this.IntersectEdges(e,p,m,!0)}else{var m=new h.IntPoint(p.Curr.X,e.Curr.Y);this.IntersectEdges(p,e,m,!0)}this.SwapPositionsInAEL(e,p)}else if(n==h.Direction.dLeftToRight&&p.Curr.X>=i||n==h.Direction.dRightToLeft&&p.Curr.X<=o)break;p=d}if(e.OutIdx>=0&&e.WindDelta!==0&&this.PrepareHorzJoins(e,t),e.NextInLML!==null&&h.ClipperBase.IsHorizontal(e.NextInLML)){e=this.UpdateEdgeIntoAEL(e),e.OutIdx>=0&&this.AddOutPt(e,e.Bot);var r={Dir:n,Left:o,Right:i};this.GetHorzDirection(e,r),n=r.Dir,o=r.Left,i=r.Right}else break}if(e.NextInLML!==null)if(e.OutIdx>=0){var g=this.AddOutPt(e,e.Top);if(e=this.UpdateEdgeIntoAEL(e),e.WindDelta===0)return;var x=e.PrevInAEL,d=e.NextInAEL;if(x!==null&&x.Curr.X==e.Bot.X&&x.Curr.Y==e.Bot.Y&&x.WindDelta!==0&&x.OutIdx>=0&&x.Curr.Y>x.Top.Y&&h.ClipperBase.SlopesEqual(e,x,this.m_UseFullRange)){var v=this.AddOutPt(x,e.Bot);this.AddJoin(g,v,e.Top)}else if(d!==null&&d.Curr.X==e.Bot.X&&d.Curr.Y==e.Bot.Y&&d.WindDelta!==0&&d.OutIdx>=0&&d.Curr.Y>d.Top.Y&&h.ClipperBase.SlopesEqual(e,d,this.m_UseFullRange)){var v=this.AddOutPt(d,e.Bot);this.AddJoin(g,v,e.Top)}}else e=this.UpdateEdgeIntoAEL(e);else l!==null?l.OutIdx>=0?(n==h.Direction.dLeftToRight?this.IntersectEdges(e,l,e.Top,!1):this.IntersectEdges(l,e,e.Top,!1),l.OutIdx>=0&&h.Error("ProcessHorizontal error")):(this.DeleteFromAEL(e),this.DeleteFromAEL(l)):(e.OutIdx>=0&&this.AddOutPt(e,e.Top),this.DeleteFromAEL(e))};h.Clipper.prototype.GetNextInAEL=function(e,t){return t==h.Direction.dLeftToRight?e.NextInAEL:e.PrevInAEL};h.Clipper.prototype.IsMinima=function(e){return e!==null&&e.Prev.NextInLML!=e&&e.Next.NextInLML!=e};h.Clipper.prototype.IsMaxima=function(e,t){return e!==null&&e.Top.Y==t&&e.NextInLML===null};h.Clipper.prototype.IsIntermediate=function(e,t){return e.Top.Y==t&&e.NextInLML!==null};h.Clipper.prototype.GetMaximaPair=function(e){var t=null;return h.IntPoint.op_Equality(e.Next.Top,e.Top)&&e.Next.NextInLML===null?t=e.Next:h.IntPoint.op_Equality(e.Prev.Top,e.Top)&&e.Prev.NextInLML===null&&(t=e.Prev),t!==null&&(t.OutIdx==-2||t.NextInAEL==t.PrevInAEL&&!h.ClipperBase.IsHorizontal(t))?null:t};h.Clipper.prototype.ProcessIntersections=function(e,t){if(this.m_ActiveEdges==null)return!0;try{if(this.BuildIntersectList(e,t),this.m_IntersectList.length==0)return!0;if(this.m_IntersectList.length==1||this.FixupIntersectionOrder())this.ProcessIntersectList();else return!1}catch{this.m_SortedEdges=null,this.m_IntersectList.length=0,h.Error("ProcessIntersections error")}return this.m_SortedEdges=null,!0};h.Clipper.prototype.BuildIntersectList=function(e,t){if(this.m_ActiveEdges!==null){var r=this.m_ActiveEdges;for(this.m_SortedEdges=r;r!==null;)r.PrevInSEL=r.PrevInAEL,r.NextInSEL=r.NextInAEL,r.Curr.X=h.Clipper.TopX(r,t),r=r.NextInAEL;for(var n=!0;n&&this.m_SortedEdges!==null;){for(n=!1,r=this.m_SortedEdges;r.NextInSEL!==null;){var o=r.NextInSEL,i=new h.IntPoint;if(r.Curr.X>o.Curr.X){!this.IntersectPoint(r,o,i)&&r.Curr.X>o.Curr.X+1&&h.Error("Intersection error"),i.Y>e&&(i.Y=e,Math.abs(r.Dx)>Math.abs(o.Dx)?i.X=h.Clipper.TopX(o,e):i.X=h.Clipper.TopX(r,e));var s=new h.IntersectNode;s.Edge1=r,s.Edge2=o,s.Pt.X=i.X,s.Pt.Y=i.Y,this.m_IntersectList.push(s),this.SwapPositionsInSEL(r,o),n=!0}else r=o}if(r.PrevInSEL!==null)r.PrevInSEL.NextInSEL=null;else break}this.m_SortedEdges=null}};h.Clipper.prototype.EdgesAdjacent=function(e){return e.Edge1.NextInSEL==e.Edge2||e.Edge1.PrevInSEL==e.Edge2};h.Clipper.IntersectNodeSort=function(e,t){return t.Pt.Y-e.Pt.Y};h.Clipper.prototype.FixupIntersectionOrder=function(){this.m_IntersectList.sort(this.m_IntersectNodeComparer),this.CopyAELToSEL();for(var e=this.m_IntersectList.length,t=0;t<e;t++){if(!this.EdgesAdjacent(this.m_IntersectList[t])){for(var r=t+1;r<e&&!this.EdgesAdjacent(this.m_IntersectList[r]);)r++;if(r==e)return!1;var n=this.m_IntersectList[t];this.m_IntersectList[t]=this.m_IntersectList[r],this.m_IntersectList[r]=n}this.SwapPositionsInSEL(this.m_IntersectList[t].Edge1,this.m_IntersectList[t].Edge2)}return!0};h.Clipper.prototype.ProcessIntersectList=function(){for(var e=0,t=this.m_IntersectList.length;e<t;e++){var r=this.m_IntersectList[e];this.IntersectEdges(r.Edge1,r.Edge2,r.Pt,!0),this.SwapPositionsInAEL(r.Edge1,r.Edge2)}this.m_IntersectList.length=0};var SQ=function(e){return e<0?Math.ceil(e-.5):Math.round(e)},CQ=function(e){return e<0?Math.ceil(e-.5):Math.floor(e+.5)},TQ=function(e){return e<0?-Math.round(Math.abs(e)):Math.round(e)},MQ=function(e){return e<0?(e-=.5,e<-2147483648?Math.ceil(e):e|0):(e+=.5,e>2147483647?Math.floor(e):e|0)};ze.msie?h.Clipper.Round=SQ:ze.chromium?h.Clipper.Round=TQ:ze.safari?h.Clipper.Round=MQ:h.Clipper.Round=CQ;h.Clipper.TopX=function(e,t){return t==e.Top.Y?e.Top.X:e.Bot.X+h.Clipper.Round(e.Dx*(t-e.Bot.Y))};h.Clipper.prototype.IntersectPoint=function(e,t,r){r.X=0,r.Y=0;var n,o;if(h.ClipperBase.SlopesEqual(e,t,this.m_UseFullRange)||e.Dx==t.Dx)return t.Bot.Y>e.Bot.Y?(r.X=t.Bot.X,r.Y=t.Bot.Y):(r.X=e.Bot.X,r.Y=e.Bot.Y),!1;if(e.Delta.X===0)r.X=e.Bot.X,h.ClipperBase.IsHorizontal(t)?r.Y=t.Bot.Y:(o=t.Bot.Y-t.Bot.X/t.Dx,r.Y=h.Clipper.Round(r.X/t.Dx+o));else if(t.Delta.X===0)r.X=t.Bot.X,h.ClipperBase.IsHorizontal(e)?r.Y=e.Bot.Y:(n=e.Bot.Y-e.Bot.X/e.Dx,r.Y=h.Clipper.Round(r.X/e.Dx+n));else{n=e.Bot.X-e.Bot.Y*e.Dx,o=t.Bot.X-t.Bot.Y*t.Dx;var i=(o-n)/(e.Dx-t.Dx);r.Y=h.Clipper.Round(i),Math.abs(e.Dx)<Math.abs(t.Dx)?r.X=h.Clipper.Round(e.Dx*i+n):r.X=h.Clipper.Round(t.Dx*i+o)}if(r.Y<e.Top.Y||r.Y<t.Top.Y){if(e.Top.Y>t.Top.Y)return r.Y=e.Top.Y,r.X=h.Clipper.TopX(t,e.Top.Y),r.X<e.Top.X;r.Y=t.Top.Y,Math.abs(e.Dx)<Math.abs(t.Dx)?r.X=h.Clipper.TopX(e,r.Y):r.X=h.Clipper.TopX(t,r.Y)}return!0};h.Clipper.prototype.ProcessEdgesAtTopOfScanbeam=function(e){for(var t=this.m_ActiveEdges;t!==null;){var r=this.IsMaxima(t,e);if(r){var n=this.GetMaximaPair(t);r=n===null||!h.ClipperBase.IsHorizontal(n)}if(r){var o=t.PrevInAEL;this.DoMaxima(t),o===null?t=this.m_ActiveEdges:t=o.NextInAEL}else{if(this.IsIntermediate(t,e)&&h.ClipperBase.IsHorizontal(t.NextInLML)?(t=this.UpdateEdgeIntoAEL(t),t.OutIdx>=0&&this.AddOutPt(t,t.Bot),this.AddEdgeToSEL(t)):(t.Curr.X=h.Clipper.TopX(t,e),t.Curr.Y=e),this.StrictlySimple){var o=t.PrevInAEL;if(t.OutIdx>=0&&t.WindDelta!==0&&o!==null&&o.OutIdx>=0&&o.Curr.X==t.Curr.X&&o.WindDelta!==0){var i=this.AddOutPt(o,t.Curr),s=this.AddOutPt(t,t.Curr);this.AddJoin(i,s,t.Curr)}}t=t.NextInAEL}}for(this.ProcessHorizontals(!0),t=this.m_ActiveEdges;t!==null;){if(this.IsIntermediate(t,e)){var i=null;t.OutIdx>=0&&(i=this.AddOutPt(t,t.Top)),t=this.UpdateEdgeIntoAEL(t);var o=t.PrevInAEL,l=t.NextInAEL;if(o!==null&&o.Curr.X==t.Bot.X&&o.Curr.Y==t.Bot.Y&&i!==null&&o.OutIdx>=0&&o.Curr.Y>o.Top.Y&&h.ClipperBase.SlopesEqual(t,o,this.m_UseFullRange)&&t.WindDelta!==0&&o.WindDelta!==0){var s=this.AddOutPt(o,t.Bot);this.AddJoin(i,s,t.Top)}else if(l!==null&&l.Curr.X==t.Bot.X&&l.Curr.Y==t.Bot.Y&&i!==null&&l.OutIdx>=0&&l.Curr.Y>l.Top.Y&&h.ClipperBase.SlopesEqual(t,l,this.m_UseFullRange)&&t.WindDelta!==0&&l.WindDelta!==0){var s=this.AddOutPt(l,t.Bot);this.AddJoin(i,s,t.Top)}}t=t.NextInAEL}};h.Clipper.prototype.DoMaxima=function(e){var t=this.GetMaximaPair(e);if(t===null){e.OutIdx>=0&&this.AddOutPt(e,e.Top),this.DeleteFromAEL(e);return}for(var r=e.NextInAEL,n=!0;r!==null&&r!=t;)this.IntersectEdges(e,r,e.Top,!0),this.SwapPositionsInAEL(e,r),r=e.NextInAEL;e.OutIdx==-1&&t.OutIdx==-1?(this.DeleteFromAEL(e),this.DeleteFromAEL(t)):e.OutIdx>=0&&t.OutIdx>=0?this.IntersectEdges(e,t,e.Top,!1):n&&e.WindDelta===0?(e.OutIdx>=0&&(this.AddOutPt(e,e.Top),e.OutIdx=-1),this.DeleteFromAEL(e),t.OutIdx>=0&&(this.AddOutPt(t,e.Top),t.OutIdx=-1),this.DeleteFromAEL(t)):h.Error("DoMaxima error")};h.Clipper.ReversePaths=function(e){for(var t=0,r=e.length;t<r;t++)e[t].reverse()};h.Clipper.Orientation=function(e){return h.Clipper.Area(e)>=0};h.Clipper.prototype.PointCount=function(e){if(e===null)return 0;var t=0,r=e;do t++,r=r.Next;while(r!=e);return t};h.Clipper.prototype.BuildResult=function(e){h.Clear(e);for(var t=0,r=this.m_PolyOuts.length;t<r;t++){var n=this.m_PolyOuts[t];if(n.Pts!==null){var o=n.Pts.Prev,i=this.PointCount(o);if(!(i<2)){for(var s=new Array(i),l=0;l<i;l++)s[l]=o.Pt,o=o.Prev;e.push(s)}}}};h.Clipper.prototype.BuildResult2=function(e){e.Clear();for(var t=0,r=this.m_PolyOuts.length;t<r;t++){var n=this.m_PolyOuts[t],o=this.PointCount(n.Pts);if(!(n.IsOpen&&o<2||!n.IsOpen&&o<3)){this.FixHoleLinkage(n);var i=new h.PolyNode;e.m_AllPolys.push(i),n.PolyNode=i,i.m_polygon.length=o;for(var s=n.Pts.Prev,l=0;l<o;l++)i.m_polygon[l]=s.Pt,s=s.Prev}}for(var t=0,r=this.m_PolyOuts.length;t<r;t++){var n=this.m_PolyOuts[t];n.PolyNode!==null&&(n.IsOpen?(n.PolyNode.IsOpen=!0,e.AddChild(n.PolyNode)):n.FirstLeft!==null&&n.FirstLeft.PolyNode!=null?n.FirstLeft.PolyNode.AddChild(n.PolyNode):e.AddChild(n.PolyNode))}};h.Clipper.prototype.FixupOutPolygon=function(e){var t=null;e.BottomPt=null;for(var r=e.Pts;;){if(r.Prev==r||r.Prev==r.Next){this.DisposeOutPts(r),e.Pts=null;return}if(h.IntPoint.op_Equality(r.Pt,r.Next.Pt)||h.IntPoint.op_Equality(r.Pt,r.Prev.Pt)||h.ClipperBase.SlopesEqual(r.Prev.Pt,r.Pt,r.Next.Pt,this.m_UseFullRange)&&(!this.PreserveCollinear||!this.Pt2IsBetweenPt1AndPt3(r.Prev.Pt,r.Pt,r.Next.Pt))){t=null;var n=r;r.Prev.Next=r.Next,r.Next.Prev=r.Prev,r=r.Prev,n=null}else{if(r==t)break;t===null&&(t=r),r=r.Next}}e.Pts=r};h.Clipper.prototype.DupOutPt=function(e,t){var r=new h.OutPt;return r.Pt.X=e.Pt.X,r.Pt.Y=e.Pt.Y,r.Idx=e.Idx,t?(r.Next=e.Next,r.Prev=e,e.Next.Prev=r,e.Next=r):(r.Prev=e.Prev,r.Next=e,e.Prev.Next=r,e.Prev=r),r};h.Clipper.prototype.GetOverlap=function(e,t,r,n,o){return e<t?r<n?(o.Left=Math.max(e,r),o.Right=Math.min(t,n)):(o.Left=Math.max(e,n),o.Right=Math.min(t,r)):r<n?(o.Left=Math.max(t,r),o.Right=Math.min(e,n)):(o.Left=Math.max(t,n),o.Right=Math.min(e,r)),o.Left<o.Right};h.Clipper.prototype.JoinHorz=function(e,t,r,n,o,i){var s=e.Pt.X>t.Pt.X?h.Direction.dRightToLeft:h.Direction.dLeftToRight,l=r.Pt.X>n.Pt.X?h.Direction.dRightToLeft:h.Direction.dLeftToRight;if(s==l)return!1;if(s==h.Direction.dLeftToRight){for(;e.Next.Pt.X<=o.X&&e.Next.Pt.X>=e.Pt.X&&e.Next.Pt.Y==o.Y;)e=e.Next;i&&e.Pt.X!=o.X&&(e=e.Next),t=this.DupOutPt(e,!i),h.IntPoint.op_Inequality(t.Pt,o)&&(e=t,e.Pt.X=o.X,e.Pt.Y=o.Y,t=this.DupOutPt(e,!i))}else{for(;e.Next.Pt.X>=o.X&&e.Next.Pt.X<=e.Pt.X&&e.Next.Pt.Y==o.Y;)e=e.Next;!i&&e.Pt.X!=o.X&&(e=e.Next),t=this.DupOutPt(e,i),h.IntPoint.op_Inequality(t.Pt,o)&&(e=t,e.Pt.X=o.X,e.Pt.Y=o.Y,t=this.DupOutPt(e,i))}if(l==h.Direction.dLeftToRight){for(;r.Next.Pt.X<=o.X&&r.Next.Pt.X>=r.Pt.X&&r.Next.Pt.Y==o.Y;)r=r.Next;i&&r.Pt.X!=o.X&&(r=r.Next),n=this.DupOutPt(r,!i),h.IntPoint.op_Inequality(n.Pt,o)&&(r=n,r.Pt.X=o.X,r.Pt.Y=o.Y,n=this.DupOutPt(r,!i))}else{for(;r.Next.Pt.X>=o.X&&r.Next.Pt.X<=r.Pt.X&&r.Next.Pt.Y==o.Y;)r=r.Next;!i&&r.Pt.X!=o.X&&(r=r.Next),n=this.DupOutPt(r,i),h.IntPoint.op_Inequality(n.Pt,o)&&(r=n,r.Pt.X=o.X,r.Pt.Y=o.Y,n=this.DupOutPt(r,i))}return s==h.Direction.dLeftToRight==i?(e.Prev=r,r.Next=e,t.Next=n,n.Prev=t):(e.Next=r,r.Prev=e,t.Prev=n,n.Next=t),!0};h.Clipper.prototype.JoinPoints=function(e,t,r){var n=e.OutPt1,o=new h.OutPt,i=e.OutPt2,s=new h.OutPt,l=e.OutPt1.Pt.Y==e.OffPt.Y;if(l&&h.IntPoint.op_Equality(e.OffPt,e.OutPt1.Pt)&&h.IntPoint.op_Equality(e.OffPt,e.OutPt2.Pt)){for(o=e.OutPt1.Next;o!=n&&h.IntPoint.op_Equality(o.Pt,e.OffPt);)o=o.Next;var c=o.Pt.Y>e.OffPt.Y;for(s=e.OutPt2.Next;s!=i&&h.IntPoint.op_Equality(s.Pt,e.OffPt);)s=s.Next;var p=s.Pt.Y>e.OffPt.Y;return c==p?!1:c?(o=this.DupOutPt(n,!1),s=this.DupOutPt(i,!0),n.Prev=i,i.Next=n,o.Next=s,s.Prev=o,e.OutPt1=n,e.OutPt2=o,!0):(o=this.DupOutPt(n,!0),s=this.DupOutPt(i,!1),n.Next=i,i.Prev=n,o.Prev=s,s.Next=o,e.OutPt1=n,e.OutPt2=o,!0)}else if(l){for(o=n;n.Prev.Pt.Y==n.Pt.Y&&n.Prev!=o&&n.Prev!=i;)n=n.Prev;for(;o.Next.Pt.Y==o.Pt.Y&&o.Next!=n&&o.Next!=i;)o=o.Next;if(o.Next==n||o.Next==i)return!1;for(s=i;i.Prev.Pt.Y==i.Pt.Y&&i.Prev!=s&&i.Prev!=o;)i=i.Prev;for(;s.Next.Pt.Y==s.Pt.Y&&s.Next!=i&&s.Next!=n;)s=s.Next;if(s.Next==i||s.Next==n)return!1;var d={Left:null,Right:null};if(!this.GetOverlap(n.Pt.X,o.Pt.X,i.Pt.X,s.Pt.X,d))return!1;var m=d.Left,g=d.Right,x=new h.IntPoint,v;return n.Pt.X>=m&&n.Pt.X<=g?(x.X=n.Pt.X,x.Y=n.Pt.Y,v=n.Pt.X>o.Pt.X):i.Pt.X>=m&&i.Pt.X<=g?(x.X=i.Pt.X,x.Y=i.Pt.Y,v=i.Pt.X>s.Pt.X):o.Pt.X>=m&&o.Pt.X<=g?(x.X=o.Pt.X,x.Y=o.Pt.Y,v=o.Pt.X>n.Pt.X):(x.X=s.Pt.X,x.Y=s.Pt.Y,v=s.Pt.X>i.Pt.X),e.OutPt1=n,e.OutPt2=i,this.JoinHorz(n,o,i,s,x,v)}else{for(o=n.Next;h.IntPoint.op_Equality(o.Pt,n.Pt)&&o!=n;)o=o.Next;var C=o.Pt.Y>n.Pt.Y||!h.ClipperBase.SlopesEqual(n.Pt,o.Pt,e.OffPt,this.m_UseFullRange);if(C){for(o=n.Prev;h.IntPoint.op_Equality(o.Pt,n.Pt)&&o!=n;)o=o.Prev;if(o.Pt.Y>n.Pt.Y||!h.ClipperBase.SlopesEqual(n.Pt,o.Pt,e.OffPt,this.m_UseFullRange))return!1}for(s=i.Next;h.IntPoint.op_Equality(s.Pt,i.Pt)&&s!=i;)s=s.Next;var I=s.Pt.Y>i.Pt.Y||!h.ClipperBase.SlopesEqual(i.Pt,s.Pt,e.OffPt,this.m_UseFullRange);if(I){for(s=i.Prev;h.IntPoint.op_Equality(s.Pt,i.Pt)&&s!=i;)s=s.Prev;if(s.Pt.Y>i.Pt.Y||!h.ClipperBase.SlopesEqual(i.Pt,s.Pt,e.OffPt,this.m_UseFullRange))return!1}return o==n||s==i||o==s||t==r&&C==I?!1:C?(o=this.DupOutPt(n,!1),s=this.DupOutPt(i,!0),n.Prev=i,i.Next=n,o.Next=s,s.Prev=o,e.OutPt1=n,e.OutPt2=o,!0):(o=this.DupOutPt(n,!0),s=this.DupOutPt(i,!1),n.Next=i,i.Prev=n,o.Prev=s,s.Next=o,e.OutPt1=n,e.OutPt2=o,!0)}};h.Clipper.GetBounds=function(e){for(var t=0,r=e.length;t<r&&e[t].length==0;)t++;if(t==r)return new h.IntRect(0,0,0,0);var n=new h.IntRect;for(n.left=e[t][0].X,n.right=n.left,n.top=e[t][0].Y,n.bottom=n.top;t<r;t++)for(var o=0,i=e[t].length;o<i;o++)e[t][o].X<n.left?n.left=e[t][o].X:e[t][o].X>n.right&&(n.right=e[t][o].X),e[t][o].Y<n.top?n.top=e[t][o].Y:e[t][o].Y>n.bottom&&(n.bottom=e[t][o].Y);return n};h.Clipper.prototype.GetBounds2=function(e){var t=e,r=new h.IntRect;for(r.left=e.Pt.X,r.right=e.Pt.X,r.top=e.Pt.Y,r.bottom=e.Pt.Y,e=e.Next;e!=t;)e.Pt.X<r.left&&(r.left=e.Pt.X),e.Pt.X>r.right&&(r.right=e.Pt.X),e.Pt.Y<r.top&&(r.top=e.Pt.Y),e.Pt.Y>r.bottom&&(r.bottom=e.Pt.Y),e=e.Next;return r};h.Clipper.PointInPolygon=function(e,t){var r=0,n=t.length;if(n<3)return 0;for(var o=t[0],i=1;i<=n;++i){var s=i==n?t[0]:t[i];if(s.Y==e.Y&&(s.X==e.X||o.Y==e.Y&&s.X>e.X==o.X<e.X))return-1;if(o.Y<e.Y!=s.Y<e.Y){if(o.X>=e.X)if(s.X>e.X)r=1-r;else{var l=(o.X-e.X)*(s.Y-e.Y)-(s.X-e.X)*(o.Y-e.Y);if(l==0)return-1;l>0==s.Y>o.Y&&(r=1-r)}else if(s.X>e.X){var l=(o.X-e.X)*(s.Y-e.Y)-(s.X-e.X)*(o.Y-e.Y);if(l==0)return-1;l>0==s.Y>o.Y&&(r=1-r)}}o=s}return r};h.Clipper.prototype.PointInPolygon=function(e,t){for(var r=0,n=t;;){var o=t.Pt.X,i=t.Pt.Y,s=t.Next.Pt.X,l=t.Next.Pt.Y;if(l==e.Y&&(s==e.X||i==e.Y&&s>e.X==o<e.X))return-1;if(i<e.Y!=l<e.Y){if(o>=e.X)if(s>e.X)r=1-r;else{var c=(o-e.X)*(l-e.Y)-(s-e.X)*(i-e.Y);if(c==0)return-1;c>0==l>i&&(r=1-r)}else if(s>e.X){var c=(o-e.X)*(l-e.Y)-(s-e.X)*(i-e.Y);if(c==0)return-1;c>0==l>i&&(r=1-r)}}if(t=t.Next,n==t)break}return r};h.Clipper.prototype.Poly2ContainsPoly1=function(e,t){var r=e;do{var n=this.PointInPolygon(r.Pt,t);if(n>=0)return n!=0;r=r.Next}while(r!=e);return!0};h.Clipper.prototype.FixupFirstLefts1=function(e,t){for(var r=0,n=this.m_PolyOuts.length;r<n;r++){var o=this.m_PolyOuts[r];o.Pts!==null&&o.FirstLeft==e&&this.Poly2ContainsPoly1(o.Pts,t.Pts)&&(o.FirstLeft=t)}};h.Clipper.prototype.FixupFirstLefts2=function(e,t){for(var r=0,n=this.m_PolyOuts,o=n.length,i=n[r];r<o;r++,i=n[r])i.FirstLeft==e&&(i.FirstLeft=t)};h.Clipper.ParseFirstLeft=function(e){for(;e!=null&&e.Pts==null;)e=e.FirstLeft;return e};h.Clipper.prototype.JoinCommonEdges=function(){for(var e=0,t=this.m_Joins.length;e<t;e++){var r=this.m_Joins[e],n=this.GetOutRec(r.OutPt1.Idx),o=this.GetOutRec(r.OutPt2.Idx);if(!(n.Pts==null||o.Pts==null)){var i;if(n==o?i=n:this.Param1RightOfParam2(n,o)?i=o:this.Param1RightOfParam2(o,n)?i=n:i=this.GetLowermostRec(n,o),!!this.JoinPoints(r,n,o))if(n==o){if(n.Pts=r.OutPt1,n.BottomPt=null,o=this.CreateOutRec(),o.Pts=r.OutPt2,this.UpdateOutPtIdxs(o),this.m_UsingPolyTree)for(var s=0,l=this.m_PolyOuts.length;s<l-1;s++){var c=this.m_PolyOuts[s];c.Pts==null||h.Clipper.ParseFirstLeft(c.FirstLeft)!=n||c.IsHole==n.IsHole||this.Poly2ContainsPoly1(c.Pts,r.OutPt2)&&(c.FirstLeft=o)}this.Poly2ContainsPoly1(o.Pts,n.Pts)?(o.IsHole=!n.IsHole,o.FirstLeft=n,this.m_UsingPolyTree&&this.FixupFirstLefts2(o,n),(o.IsHole^this.ReverseSolution)==this.Area(o)>0&&this.ReversePolyPtLinks(o.Pts)):this.Poly2ContainsPoly1(n.Pts,o.Pts)?(o.IsHole=n.IsHole,n.IsHole=!o.IsHole,o.FirstLeft=n.FirstLeft,n.FirstLeft=o,this.m_UsingPolyTree&&this.FixupFirstLefts2(n,o),(n.IsHole^this.ReverseSolution)==this.Area(n)>0&&this.ReversePolyPtLinks(n.Pts)):(o.IsHole=n.IsHole,o.FirstLeft=n.FirstLeft,this.m_UsingPolyTree&&this.FixupFirstLefts1(n,o))}else o.Pts=null,o.BottomPt=null,o.Idx=n.Idx,n.IsHole=i.IsHole,i==o&&(n.FirstLeft=o.FirstLeft),o.FirstLeft=n,this.m_UsingPolyTree&&this.FixupFirstLefts2(o,n)}}};h.Clipper.prototype.UpdateOutPtIdxs=function(e){var t=e.Pts;do t.Idx=e.Idx,t=t.Prev;while(t!=e.Pts)};h.Clipper.prototype.DoSimplePolygons=function(){for(var e=0;e<this.m_PolyOuts.length;){var t=this.m_PolyOuts[e++],r=t.Pts;if(r!==null)do{for(var n=r.Next;n!=t.Pts;){if(h.IntPoint.op_Equality(r.Pt,n.Pt)&&n.Next!=r&&n.Prev!=r){var o=r.Prev,i=n.Prev;r.Prev=i,i.Next=r,n.Prev=o,o.Next=n,t.Pts=r;var s=this.CreateOutRec();s.Pts=n,this.UpdateOutPtIdxs(s),this.Poly2ContainsPoly1(s.Pts,t.Pts)?(s.IsHole=!t.IsHole,s.FirstLeft=t):this.Poly2ContainsPoly1(t.Pts,s.Pts)?(s.IsHole=t.IsHole,t.IsHole=!s.IsHole,s.FirstLeft=t.FirstLeft,t.FirstLeft=s):(s.IsHole=t.IsHole,s.FirstLeft=t.FirstLeft),n=r}n=n.Next}r=r.Next}while(r!=t.Pts)}};h.Clipper.Area=function(e){var t=e.length;if(t<3)return 0;for(var r=0,n=0,o=t-1;n<t;++n)r+=(e[o].X+e[n].X)*(e[o].Y-e[n].Y),o=n;return-r*.5};h.Clipper.prototype.Area=function(e){var t=e.Pts;if(t==null)return 0;var r=0;do r=r+(t.Prev.Pt.X+t.Pt.X)*(t.Prev.Pt.Y-t.Pt.Y),t=t.Next;while(t!=e.Pts);return r*.5};s8&&(h.Clipper.OffsetPaths=function(e,t,r,n,o){var i=new h.Paths,s=new h.ClipperOffset(o,o);return s.AddPaths(e,r,n),s.Execute(i,t),i});h.Clipper.SimplifyPolygon=function(e,t){var r=new Array,n=new h.Clipper(0);return n.StrictlySimple=!0,n.AddPath(e,h.PolyType.ptSubject,!0),n.Execute(h.ClipType.ctUnion,r,t,t),r};h.Clipper.SimplifyPolygons=function(e,t){typeof t>"u"&&(t=h.PolyFillType.pftEvenOdd);var r=new Array,n=new h.Clipper(0);return n.StrictlySimple=!0,n.AddPaths(e,h.PolyType.ptSubject,!0),n.Execute(h.ClipType.ctUnion,r,t,t),r};h.Clipper.DistanceSqrd=function(e,t){var r=e.X-t.X,n=e.Y-t.Y;return r*r+n*n};h.Clipper.DistanceFromLineSqrd=function(e,t,r){var n=t.Y-r.Y,o=r.X-t.X,i=n*t.X+o*t.Y;return i=n*e.X+o*e.Y-i,i*i/(n*n+o*o)};h.Clipper.SlopesNearCollinear=function(e,t,r,n){return h.Clipper.DistanceFromLineSqrd(t,e,r)<n};h.Clipper.PointsAreClose=function(e,t,r){var n=e.X-t.X,o=e.Y-t.Y;return n*n+o*o<=r};h.Clipper.ExcludeOp=function(e){var t=e.Prev;return t.Next=e.Next,e.Next.Prev=t,t.Idx=0,t};h.Clipper.CleanPolygon=function(e,t){typeof t>"u"&&(t=1.415);var r=e.length;if(r==0)return new Array;for(var n=new Array(r),o=0;o<r;++o)n[o]=new h.OutPt;for(var o=0;o<r;++o)n[o].Pt=e[o],n[o].Next=n[(o+1)%r],n[o].Next.Prev=n[o],n[o].Idx=0;for(var i=t*t,s=n[0];s.Idx==0&&s.Next!=s.Prev;)h.Clipper.PointsAreClose(s.Pt,s.Prev.Pt,i)?(s=h.Clipper.ExcludeOp(s),r--):h.Clipper.PointsAreClose(s.Prev.Pt,s.Next.Pt,i)?(h.Clipper.ExcludeOp(s.Next),s=h.Clipper.ExcludeOp(s),r-=2):h.Clipper.SlopesNearCollinear(s.Prev.Pt,s.Pt,s.Next.Pt,i)?(s=h.Clipper.ExcludeOp(s),r--):(s.Idx=1,s=s.Next);r<3&&(r=0);for(var l=new Array(r),o=0;o<r;++o)l[o]=new h.IntPoint(s.Pt),s=s.Next;return n=null,l};h.Clipper.CleanPolygons=function(e,t){for(var r=new Array(e.length),n=0,o=e.length;n<o;n++)r[n]=h.Clipper.CleanPolygon(e[n],t);return r};h.Clipper.Minkowski=function(e,t,r,n){var o=n?1:0,i=e.length,s=t.length,l=new Array;if(r)for(var c=0;c<s;c++){for(var p=new Array(i),d=0,m=e.length,g=e[d];d<m;d++,g=e[d])p[d]=new h.IntPoint(t[c].X+g.X,t[c].Y+g.Y);l.push(p)}else for(var c=0;c<s;c++){for(var p=new Array(i),d=0,m=e.length,g=e[d];d<m;d++,g=e[d])p[d]=new h.IntPoint(t[c].X-g.X,t[c].Y-g.Y);l.push(p)}for(var x=new Array,c=0;c<s-1+o;c++)for(var d=0;d<i;d++){var v=new Array;v.push(l[c%s][d%i]),v.push(l[(c+1)%s][d%i]),v.push(l[(c+1)%s][(d+1)%i]),v.push(l[c%s][(d+1)%i]),h.Clipper.Orientation(v)||v.reverse(),x.push(v)}var C=new h.Clipper(0);return C.AddPaths(x,h.PolyType.ptSubject,!0),C.Execute(h.ClipType.ctUnion,l,h.PolyFillType.pftNonZero,h.PolyFillType.pftNonZero),l};h.Clipper.MinkowskiSum=function(){var e=arguments,t=e.length;if(t==3){var r=e[0],n=e[1],o=e[2];return h.Clipper.Minkowski(r,n,!0,o)}else if(t==4){for(var r=e[0],i=e[1],s=e[2],o=e[3],l=new h.Clipper,c,p=0,d=i.length;p<d;++p){var c=h.Clipper.Minkowski(r,i[p],!0,o);l.AddPaths(c,h.PolyType.ptSubject,!0)}o&&l.AddPaths(i,h.PolyType.ptClip,!0);var m=new h.Paths;return l.Execute(h.ClipType.ctUnion,m,s,s),m}};h.Clipper.MinkowskiDiff=function(e,t,r){return h.Clipper.Minkowski(e,t,!1,r)};h.Clipper.PolyTreeToPaths=function(e){var t=new Array;return h.Clipper.AddPolyNodeToPaths(e,h.Clipper.NodeType.ntAny,t),t};h.Clipper.AddPolyNodeToPaths=function(e,t,r){var n=!0;switch(t){case h.Clipper.NodeType.ntOpen:return;case h.Clipper.NodeType.ntClosed:n=!e.IsOpen;break;default:break}e.m_polygon.length>0&&n&&r.push(e.m_polygon);for(var o=0,i=e.Childs(),s=i.length,l=i[o];o<s;o++,l=i[o])h.Clipper.AddPolyNodeToPaths(l,t,r)};h.Clipper.OpenPathsFromPolyTree=function(e){for(var t=new h.Paths,r=0,n=e.ChildCount();r<n;r++)e.Childs()[r].IsOpen&&t.push(e.Childs()[r].m_polygon);return t};h.Clipper.ClosedPathsFromPolyTree=function(e){var t=new h.Paths;return h.Clipper.AddPolyNodeToPaths(e,h.Clipper.NodeType.ntClosed,t),t};Cx(h.Clipper,h.ClipperBase);h.Clipper.NodeType={ntAny:0,ntOpen:1,ntClosed:2};h.ClipperOffset=function(e,t){typeof e>"u"&&(e=2),typeof t>"u"&&(t=h.ClipperOffset.def_arc_tolerance),this.m_destPolys=new h.Paths,this.m_srcPoly=new h.Path,this.m_destPoly=new h.Path,this.m_normals=new Array,this.m_delta=0,this.m_sinA=0,this.m_sin=0,this.m_cos=0,this.m_miterLim=0,this.m_StepsPerRad=0,this.m_lowest=new h.IntPoint,this.m_polyNodes=new h.PolyNode,this.MiterLimit=e,this.ArcTolerance=t,this.m_lowest.X=-1};h.ClipperOffset.two_pi=6.28318530717959;h.ClipperOffset.def_arc_tolerance=.25;h.ClipperOffset.prototype.Clear=function(){h.Clear(this.m_polyNodes.Childs()),this.m_lowest.X=-1};h.ClipperOffset.Round=h.Clipper.Round;h.ClipperOffset.prototype.AddPath=function(e,t,r){var n=e.length-1;if(!(n<0)){var o=new h.PolyNode;if(o.m_jointype=t,o.m_endtype=r,r==h.EndType.etClosedLine||r==h.EndType.etClosedPolygon)for(;n>0&&h.IntPoint.op_Equality(e[0],e[n]);)n--;o.m_polygon.push(e[0]);for(var i=0,s=0,l=1;l<=n;l++)h.IntPoint.op_Inequality(o.m_polygon[i],e[l])&&(i++,o.m_polygon.push(e[l]),(e[l].Y>o.m_polygon[s].Y||e[l].Y==o.m_polygon[s].Y&&e[l].X<o.m_polygon[s].X)&&(s=i));if(!(r==h.EndType.etClosedPolygon&&i<2||r!=h.EndType.etClosedPolygon&&i<0)&&(this.m_polyNodes.AddChild(o),r==h.EndType.etClosedPolygon))if(this.m_lowest.X<0)this.m_lowest=new h.IntPoint(0,s);else{var c=this.m_polyNodes.Childs()[this.m_lowest.X].m_polygon[this.m_lowest.Y];(o.m_polygon[s].Y>c.Y||o.m_polygon[s].Y==c.Y&&o.m_polygon[s].X<c.X)&&(this.m_lowest=new h.IntPoint(this.m_polyNodes.ChildCount()-1,s))}}};h.ClipperOffset.prototype.AddPaths=function(e,t,r){for(var n=0,o=e.length;n<o;n++)this.AddPath(e[n],t,r)};h.ClipperOffset.prototype.FixOrientations=function(){if(this.m_lowest.X>=0&&!h.Clipper.Orientation(this.m_polyNodes.Childs()[this.m_lowest.X].m_polygon))for(var e=0;e<this.m_polyNodes.ChildCount();e++){var t=this.m_polyNodes.Childs()[e];(t.m_endtype==h.EndType.etClosedPolygon||t.m_endtype==h.EndType.etClosedLine&&h.Clipper.Orientation(t.m_polygon))&&t.m_polygon.reverse()}else for(var e=0;e<this.m_polyNodes.ChildCount();e++){var t=this.m_polyNodes.Childs()[e];t.m_endtype==h.EndType.etClosedLine&&!h.Clipper.Orientation(t.m_polygon)&&t.m_polygon.reverse()}};h.ClipperOffset.GetUnitNormal=function(e,t){var r=t.X-e.X,n=t.Y-e.Y;if(r==0&&n==0)return new h.DoublePoint(0,0);var o=1/Math.sqrt(r*r+n*n);return r*=o,n*=o,new h.DoublePoint(n,-r)};h.ClipperOffset.prototype.DoOffset=function(e){if(this.m_destPolys=new Array,this.m_delta=e,h.ClipperBase.near_zero(e)){for(var t=0;t<this.m_polyNodes.ChildCount();t++){var r=this.m_polyNodes.Childs()[t];r.m_endtype==h.EndType.etClosedPolygon&&this.m_destPolys.push(r.m_polygon)}return}this.MiterLimit>2?this.m_miterLim=2/(this.MiterLimit*this.MiterLimit):this.m_miterLim=.5;var n;this.ArcTolerance<=0?n=h.ClipperOffset.def_arc_tolerance:this.ArcTolerance>Math.abs(e)*h.ClipperOffset.def_arc_tolerance?n=Math.abs(e)*h.ClipperOffset.def_arc_tolerance:n=this.ArcTolerance;var o=3.14159265358979/Math.acos(1-n/Math.abs(e));this.m_sin=Math.sin(h.ClipperOffset.two_pi/o),this.m_cos=Math.cos(h.ClipperOffset.two_pi/o),this.m_StepsPerRad=o/h.ClipperOffset.two_pi,e<0&&(this.m_sin=-this.m_sin);for(var t=0;t<this.m_polyNodes.ChildCount();t++){var r=this.m_polyNodes.Childs()[t];this.m_srcPoly=r.m_polygon;var i=this.m_srcPoly.length;if(!(i==0||e<=0&&(i<3||r.m_endtype!=h.EndType.etClosedPolygon))){if(this.m_destPoly=new Array,i==1){if(r.m_jointype==h.JoinType.jtRound)for(var s=1,l=0,c=1;c<=o;c++){this.m_destPoly.push(new h.IntPoint(h.ClipperOffset.Round(this.m_srcPoly[0].X+s*e),h.ClipperOffset.Round(this.m_srcPoly[0].Y+l*e)));var p=s;s=s*this.m_cos-this.m_sin*l,l=p*this.m_sin+l*this.m_cos}else for(var s=-1,l=-1,c=0;c<4;++c)this.m_destPoly.push(new h.IntPoint(h.ClipperOffset.Round(this.m_srcPoly[0].X+s*e),h.ClipperOffset.Round(this.m_srcPoly[0].Y+l*e))),s<0?s=1:l<0?l=1:s=-1;this.m_destPolys.push(this.m_destPoly);continue}this.m_normals.length=0;for(var c=0;c<i-1;c++)this.m_normals.push(h.ClipperOffset.GetUnitNormal(this.m_srcPoly[c],this.m_srcPoly[c+1]));if(r.m_endtype==h.EndType.etClosedLine||r.m_endtype==h.EndType.etClosedPolygon?this.m_normals.push(h.ClipperOffset.GetUnitNormal(this.m_srcPoly[i-1],this.m_srcPoly[0])):this.m_normals.push(new h.DoublePoint(this.m_normals[i-2])),r.m_endtype==h.EndType.etClosedPolygon){for(var d=i-1,c=0;c<i;c++)d=this.OffsetPoint(c,d,r.m_jointype);this.m_destPolys.push(this.m_destPoly)}else if(r.m_endtype==h.EndType.etClosedLine){for(var d=i-1,c=0;c<i;c++)d=this.OffsetPoint(c,d,r.m_jointype);this.m_destPolys.push(this.m_destPoly),this.m_destPoly=new Array;for(var m=this.m_normals[i-1],c=i-1;c>0;c--)this.m_normals[c]=new h.DoublePoint(-this.m_normals[c-1].X,-this.m_normals[c-1].Y);this.m_normals[0]=new h.DoublePoint(-m.X,-m.Y),d=0;for(var c=i-1;c>=0;c--)d=this.OffsetPoint(c,d,r.m_jointype);this.m_destPolys.push(this.m_destPoly)}else{for(var d=0,c=1;c<i-1;++c)d=this.OffsetPoint(c,d,r.m_jointype);var g;if(r.m_endtype==h.EndType.etOpenButt){var c=i-1;g=new h.IntPoint(h.ClipperOffset.Round(this.m_srcPoly[c].X+this.m_normals[c].X*e),h.ClipperOffset.Round(this.m_srcPoly[c].Y+this.m_normals[c].Y*e)),this.m_destPoly.push(g),g=new h.IntPoint(h.ClipperOffset.Round(this.m_srcPoly[c].X-this.m_normals[c].X*e),h.ClipperOffset.Round(this.m_srcPoly[c].Y-this.m_normals[c].Y*e)),this.m_destPoly.push(g)}else{var c=i-1;d=i-2,this.m_sinA=0,this.m_normals[c]=new h.DoublePoint(-this.m_normals[c].X,-this.m_normals[c].Y),r.m_endtype==h.EndType.etOpenSquare?this.DoSquare(c,d):this.DoRound(c,d)}for(var c=i-1;c>0;c--)this.m_normals[c]=new h.DoublePoint(-this.m_normals[c-1].X,-this.m_normals[c-1].Y);this.m_normals[0]=new h.DoublePoint(-this.m_normals[1].X,-this.m_normals[1].Y),d=i-1;for(var c=d-1;c>0;--c)d=this.OffsetPoint(c,d,r.m_jointype);r.m_endtype==h.EndType.etOpenButt?(g=new h.IntPoint(h.ClipperOffset.Round(this.m_srcPoly[0].X-this.m_normals[0].X*e),h.ClipperOffset.Round(this.m_srcPoly[0].Y-this.m_normals[0].Y*e)),this.m_destPoly.push(g),g=new h.IntPoint(h.ClipperOffset.Round(this.m_srcPoly[0].X+this.m_normals[0].X*e),h.ClipperOffset.Round(this.m_srcPoly[0].Y+this.m_normals[0].Y*e)),this.m_destPoly.push(g)):(d=1,this.m_sinA=0,r.m_endtype==h.EndType.etOpenSquare?this.DoSquare(0,1):this.DoRound(0,1)),this.m_destPolys.push(this.m_destPoly)}}}};h.ClipperOffset.prototype.Execute=function(){var e=arguments,t=e[0]instanceof h.PolyTree;if(t){var r=e[0],n=e[1];r.Clear(),this.FixOrientations(),this.DoOffset(n);var o=new h.Clipper(0);if(o.AddPaths(this.m_destPolys,h.PolyType.ptSubject,!0),n>0)o.Execute(h.ClipType.ctUnion,r,h.PolyFillType.pftPositive,h.PolyFillType.pftPositive);else{var i=h.Clipper.GetBounds(this.m_destPolys),s=new h.Path;if(s.push(new h.IntPoint(i.left-10,i.bottom+10)),s.push(new h.IntPoint(i.right+10,i.bottom+10)),s.push(new h.IntPoint(i.right+10,i.top-10)),s.push(new h.IntPoint(i.left-10,i.top-10)),o.AddPath(s,h.PolyType.ptSubject,!0),o.ReverseSolution=!0,o.Execute(h.ClipType.ctUnion,r,h.PolyFillType.pftNegative,h.PolyFillType.pftNegative),r.ChildCount()==1&&r.Childs()[0].ChildCount()>0){var l=r.Childs()[0];r.Childs()[0]=l.Childs()[0];for(var c=1;c<l.ChildCount();c++)r.AddChild(l.Childs()[c])}else r.Clear()}}else{var r=e[0],n=e[1];h.Clear(r),this.FixOrientations(),this.DoOffset(n);var o=new h.Clipper(0);if(o.AddPaths(this.m_destPolys,h.PolyType.ptSubject,!0),n>0)o.Execute(h.ClipType.ctUnion,r,h.PolyFillType.pftPositive,h.PolyFillType.pftPositive);else{var i=h.Clipper.GetBounds(this.m_destPolys),s=new h.Path;s.push(new h.IntPoint(i.left-10,i.bottom+10)),s.push(new h.IntPoint(i.right+10,i.bottom+10)),s.push(new h.IntPoint(i.right+10,i.top-10)),s.push(new h.IntPoint(i.left-10,i.top-10)),o.AddPath(s,h.PolyType.ptSubject,!0),o.ReverseSolution=!0,o.Execute(h.ClipType.ctUnion,r,h.PolyFillType.pftNegative,h.PolyFillType.pftNegative),r.length>0&&r.splice(0,1)}}};h.ClipperOffset.prototype.OffsetPoint=function(e,t,r){if(this.m_sinA=this.m_normals[t].X*this.m_normals[e].Y-this.m_normals[e].X*this.m_normals[t].Y,this.m_sinA<5e-5&&this.m_sinA>-5e-5)return t;if(this.m_sinA>1?this.m_sinA=1:this.m_sinA<-1&&(this.m_sinA=-1),this.m_sinA*this.m_delta<0)this.m_destPoly.push(new h.IntPoint(h.ClipperOffset.Round(this.m_srcPoly[e].X+this.m_normals[t].X*this.m_delta),h.ClipperOffset.Round(this.m_srcPoly[e].Y+this.m_normals[t].Y*this.m_delta))),this.m_destPoly.push(new h.IntPoint(this.m_srcPoly[e])),this.m_destPoly.push(new h.IntPoint(h.ClipperOffset.Round(this.m_srcPoly[e].X+this.m_normals[e].X*this.m_delta),h.ClipperOffset.Round(this.m_srcPoly[e].Y+this.m_normals[e].Y*this.m_delta)));else switch(r){case h.JoinType.jtMiter:{var n=1+(this.m_normals[e].X*this.m_normals[t].X+this.m_normals[e].Y*this.m_normals[t].Y);n>=this.m_miterLim?this.DoMiter(e,t,n):this.DoSquare(e,t);break}case h.JoinType.jtSquare:this.DoSquare(e,t);break;case h.JoinType.jtRound:this.DoRound(e,t);break}return t=e,t};h.ClipperOffset.prototype.DoSquare=function(e,t){var r=Math.tan(Math.atan2(this.m_sinA,this.m_normals[t].X*this.m_normals[e].X+this.m_normals[t].Y*this.m_normals[e].Y)/4);this.m_destPoly.push(new h.IntPoint(h.ClipperOffset.Round(this.m_srcPoly[e].X+this.m_delta*(this.m_normals[t].X-this.m_normals[t].Y*r)),h.ClipperOffset.Round(this.m_srcPoly[e].Y+this.m_delta*(this.m_normals[t].Y+this.m_normals[t].X*r)))),this.m_destPoly.push(new h.IntPoint(h.ClipperOffset.Round(this.m_srcPoly[e].X+this.m_delta*(this.m_normals[e].X+this.m_normals[e].Y*r)),h.ClipperOffset.Round(this.m_srcPoly[e].Y+this.m_delta*(this.m_normals[e].Y-this.m_normals[e].X*r))))};h.ClipperOffset.prototype.DoMiter=function(e,t,r){var n=this.m_delta/r;this.m_destPoly.push(new h.IntPoint(h.ClipperOffset.Round(this.m_srcPoly[e].X+(this.m_normals[t].X+this.m_normals[e].X)*n),h.ClipperOffset.Round(this.m_srcPoly[e].Y+(this.m_normals[t].Y+this.m_normals[e].Y)*n)))};h.ClipperOffset.prototype.DoRound=function(e,t){for(var r=Math.atan2(this.m_sinA,this.m_normals[t].X*this.m_normals[e].X+this.m_normals[t].Y*this.m_normals[e].Y),n=h.Cast_Int32(h.ClipperOffset.Round(this.m_StepsPerRad*Math.abs(r))),o=this.m_normals[t].X,i=this.m_normals[t].Y,s,l=0;l<n;++l)this.m_destPoly.push(new h.IntPoint(h.ClipperOffset.Round(this.m_srcPoly[e].X+o*this.m_delta),h.ClipperOffset.Round(this.m_srcPoly[e].Y+i*this.m_delta))),s=o,o=o*this.m_cos-this.m_sin*i,i=s*this.m_sin+i*this.m_cos;this.m_destPoly.push(new h.IntPoint(h.ClipperOffset.Round(this.m_srcPoly[e].X+this.m_normals[e].X*this.m_delta),h.ClipperOffset.Round(this.m_srcPoly[e].Y+this.m_normals[e].Y*this.m_delta)))};h.Error=function(e){try{throw new Error(e)}catch(t){alert(t.message)}};h.JS={};h.JS.AreaOfPolygon=function(e,t){return t||(t=1),h.Clipper.Area(e)/(t*t)};h.JS.AreaOfPolygons=function(e,t){t||(t=1);for(var r=0,n=0;n<e.length;n++)r+=h.Clipper.Area(e[n]);return r/(t*t)};h.JS.BoundsOfPath=function(e,t){return h.JS.BoundsOfPaths([e],t)};h.JS.BoundsOfPaths=function(e,t){t||(t=1);var r=h.Clipper.GetBounds(e);return r.left/=t,r.bottom/=t,r.right/=t,r.top/=t,r};h.JS.Clean=function(n,t){if(!(n instanceof Array))return[];var r=n[0]instanceof Array,n=h.JS.Clone(n);if(typeof t!="number"||t===null)return h.Error("Delta is not a number in Clean()."),n;if(n.length===0||n.length==1&&n[0].length===0||t<0)return n;r||(n=[n]);for(var o=n.length,i,s,l,c,p,d,m,g=[],x=0;x<o;x++)if(s=n[x],i=s.length,i!==0){if(i<3){l=s,g.push(l);continue}for(l=s,c=t*t,p=s[0],d=1,m=1;m<i;m++)(s[m].X-p.X)*(s[m].X-p.X)+(s[m].Y-p.Y)*(s[m].Y-p.Y)<=c||(l[d]=s[m],p=s[m],d++);p=s[d-1],(s[0].X-p.X)*(s[0].X-p.X)+(s[0].Y-p.Y)*(s[0].Y-p.Y)<=c&&d--,d<i&&l.splice(d,i-d),l.length&&g.push(l)}return!r&&g.length?g=g[0]:!r&&g.length===0?g=[]:r&&g.length===0&&(g=[[]]),g};h.JS.Clone=function(e){if(!(e instanceof Array))return[];if(e.length===0)return[];if(e.length==1&&e[0].length===0)return[[]];var t=e[0]instanceof Array;t||(e=[e]);var r=e.length,n,o,i,s,l=new Array(r);for(o=0;o<r;o++){for(n=e[o].length,s=new Array(n),i=0;i<n;i++)s[i]={X:e[o][i].X,Y:e[o][i].Y};l[o]=s}return t||(l=l[0]),l};h.JS.Lighten=function(e,t){if(!(e instanceof Array))return[];if(typeof t!="number"||t===null)return h.Error("Tolerance is not a number in Lighten()."),h.JS.Clone(e);if(e.length===0||e.length==1&&e[0].length===0||t<0)return h.JS.Clone(e);e[0]instanceof Array||(e=[e]);var r,n,o,i,s,l,c,p,d,m,g,x,v,C,I,S,P,O=e.length,M=t*t,E=[];for(r=0;r<O;r++)if(o=e[r],l=o.length,l!=0){for(i=0;i<1e6;i++){for(s=[],l=o.length,o[l-1].X!=o[0].X||o[l-1].Y!=o[0].Y?(x=1,o.push({X:o[0].X,Y:o[0].Y}),l=o.length):x=0,g=[],n=0;n<l-2;n++)c=o[n],d=o[n+1],p=o[n+2],S=c.X,P=c.Y,v=p.X-S,C=p.Y-P,(v!==0||C!==0)&&(I=((d.X-S)*v+(d.Y-P)*C)/(v*v+C*C),I>1?(S=p.X,P=p.Y):I>0&&(S+=v*I,P+=C*I)),v=d.X-S,C=d.Y-P,m=v*v+C*C,m<=M&&(g[n+1]=1,n++);for(s.push({X:o[0].X,Y:o[0].Y}),n=1;n<l-1;n++)g[n]||s.push({X:o[n].X,Y:o[n].Y});if(s.push({X:o[l-1].X,Y:o[l-1].Y}),x&&o.pop(),g.length)o=s;else break}l=s.length,s[l-1].X==s[0].X&&s[l-1].Y==s[0].Y&&s.pop(),s.length>2&&E.push(s)}return!e[0]instanceof Array&&(E=E[0]),typeof E>"u"&&(E=[[]]),E};h.JS.PerimeterOfPath=function(e,t,r){if(typeof e>"u")return 0;var n=Math.sqrt,o=0,i,s,l=0,c=0,p=0,d=0,m=e.length;if(m<2)return 0;for(t&&(e[m]=e[0],m++);--m;)i=e[m],l=i.X,c=i.Y,s=e[m-1],p=s.X,d=s.Y,o+=n((l-p)*(l-p)+(c-d)*(c-d));return t&&e.pop(),o/r};h.JS.PerimeterOfPaths=function(e,t,r){r||(r=1);for(var n=0,o=0;o<e.length;o++)n+=h.JS.PerimeterOfPath(e[o],t,r);return n};h.JS.ScaleDownPath=function(e,t){var r,n;for(t||(t=1),r=e.length;r--;)n=e[r],n.X=n.X/t,n.Y=n.Y/t};h.JS.ScaleDownPaths=function(e,t){var r,n,o,i=Math.round;for(t||(t=1),r=e.length;r--;)for(n=e[r].length;n--;)o=e[r][n],o.X=o.X/t,o.Y=o.Y/t};h.JS.ScaleUpPath=function(e,t){var r,n,o=Math.round;for(t||(t=1),r=e.length;r--;)n=e[r],n.X=o(n.X*t),n.Y=o(n.Y*t)};h.JS.ScaleUpPaths=function(e,t){var r,n,o,i=Math.round;for(t||(t=1),r=e.length;r--;)for(n=e[r].length;n--;)o=e[r][n],o.X=i(o.X*t),o.Y=i(o.Y*t)};h.ExPolygons=function(){return[]};h.ExPolygon=function(){this.outer=null,this.holes=null};h.JS.AddOuterPolyNodeToExPolygons=function(e,t){var r=new h.ExPolygon;r.outer=e.Contour();var n=e.Childs(),o=n.length;r.holes=new Array(o);var i,s,l,c,p,d;for(l=0;l<o;l++)for(i=n[l],r.holes[l]=i.Contour(),c=0,p=i.Childs(),d=p.length;c<d;c++)s=p[c],h.JS.AddOuterPolyNodeToExPolygons(s,t);t.push(r)};h.JS.ExPolygonsToPaths=function(e){var t,r,n,o,i=new h.Paths;for(t=0,n=e.length;t<n;t++)for(i.push(e[t].outer),r=0,o=e[t].holes.length;r<o;r++)i.push(e[t].holes[r]);return i};h.JS.PolyTreeToExPolygons=function(e){var t=new h.ExPolygons,r,n,o,i;for(n=0,o=e.Childs(),i=o.length;n<i;n++)r=o[n],h.JS.AddOuterPolyNodeToExPolygons(r,t);return t};dg.exports=h});var AD=ri((KHe,_v)=>{u();(function(){"use strict";function e(s,l){var c=s.x-l.x,p=s.y-l.y;return c*c+p*p}function t(s,l,c){var p=l.x,d=l.y,m=c.x-p,g=c.y-d;if(m!==0||g!==0){var x=((s.x-p)*m+(s.y-d)*g)/(m*m+g*g);x>1?(p=c.x,d=c.y):x>0&&(p+=m*x,d+=g*x)}return m=s.x-p,g=s.y-d,m*m+g*g}function r(s,l){for(var c=s[0],p=[c],d,m=1,g=s.length;m<g;m++)d=s[m],e(d,c)>l&&(p.push(d),c=d);return c!==d&&p.push(d),p}function n(s,l,c,p,d){for(var m=p,g,x=l+1;x<c;x++){var v=t(s[x],s[l],s[c]);v>m&&(g=x,m=v)}m>p&&(g-l>1&&n(s,l,g,p,d),d.push(s[g]),c-g>1&&n(s,g,c,p,d))}function o(s,l){var c=s.length-1,p=[s[0]];return n(s,0,c,l,p),p.push(s[c]),p}function i(s,l,c){if(s.length<=2)return s;var p=l!==void 0?l*l:1;return s=c?s:r(s,p),s=o(s,p),s}typeof define=="function"&&define.amd?define(function(){return i}):typeof _v<"u"?(_v.exports=i,_v.exports.default=i):typeof self<"u"?self.simplify=i:window.simplify=i})()});u();u();u();u();u();u();var Tm=e=>e!=null;var $F=function(){let t=globalThis.fetch;return{fetch(...r){if(!Tm(t))throw new Error("fetch is not available in your environment. Pass your own function into `setFetchFn` (node-fetch, etc)");return t?.(...r)},setFetch(r){t=r}}}(),j5=$F.fetch;var $5=["websdk","web","webv2","kiosk-v2","mobile","iossdk","androidsdk","reactnativesdk","gen7","bespoke","reactsdk"],U5=$5[0],z5="https://api-gateway.mappedin.com/track-analytics/a/",X5="deny-watchposition",Z5="load-mapview",Y5="load-mapdata",J5="change-language",q5="query-directions";var es,Io,Js,p2,Ib,Su=class{constructor(){T(this,Js);T(this,es,Object.freeze({}));T(this,Io);f(this,"oneTimeEventsSent",new Set);f(this,"sendGetDirectionsEvent",qv((t,r,n)=>{let o={start:t,end:r,type:"location_to_location"};return n!==void 0&&(o.accessible=n),this.sendAnalyticEvent(q5,o)},2500));w(this,Io,z(this,Js,Ib).call(this,a(this,es)))}init(t){this.reset(),this.updateStateWithOptions(t)}reset(){w(this,es,{}),w(this,Io,z(this,Js,Ib).call(this,{})),this.oneTimeEventsSent.clear()}updateStateWithOptions(t){return w(this,es,Object.freeze(Object.assign({},a(this,es),t))),w(this,Io,z(this,Js,Ib).call(this,t)),z(this,Js,p2).call(this,a(this,Io)),a(this,Io)}updateState(t){let r={...t};r.mapId&&(r.analyticsBaseUrl=c2({...a(this,Io),mapId:r.mapId})),r.context&&(r.context=W5(r.context)),r.baseUri&&(r.analyticsBaseUrl=c2({baseUri:r.baseUri,mapId:a(this,Io).mapId})),Object.assign(a(this,Io),r),this.handleStateUpdate(t),z(this,Js,p2).call(this,r)}handleStateUpdate(t){t.userPosition?.floorLevel?this.sendBlueDotEvents("found-floor"):t.userPosition&&this.sendBlueDotEvents("found-position")}get authReady(){let{key:t,secret:r,accessToken:n}=this.getState();return!!(t&&r)||!!n}getState(){return a(this,Io)}getContext(){return this.getState().context||a(this,es).context||U5}getSessionId(){return this.getState().sessionId||a(this,es).sessionId||H5()}getDeviceId(){return this.getState().deviceId||a(this,es).deviceId||V5()}sendAnalyticEvent(t,r={}){let n=this.getState(),o=zF(n.analyticsBaseUrl,t),i={"mi-context":this.getContext(),"mi-session":this.getSessionId(),"mi-device":this.getDeviceId()};if(n.logEvents&&A.log("Analytics.track",o,i),!n.sendEvents)return Promise.resolve();if(!this.authReady)return A.warn("Auth needs to be ready to send analytics.");let s={...r,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)),j5(o,{method:"POST",mode:"cors",headers:i,body:JSON.stringify(s)})}capture(t,r){if(ZF.includes(t))return A.warn(`${t} event is sent internally.`),Promise.resolve();let n=XF.includes(t)?t.slice(1):t;return this.sendAnalyticEvent(n,r)}sendGetMapDataEvent(t){return this.sendAnalyticEvent(Y5,t)}sendChangeLanguageEvent(t){return this.sendAnalyticEvent(J5,t)}sendWatchPositionDenied(){return this.sendAnalyticEvent(X5)}sendMapViewLoadedEvent({firstRenderDuration:t,dimension:r,collisionWorkerDisabled:n,outdoorsWorkerDisabled:o}){return this.sendAnalyticEvent(Z5,{type:"3d",firstRenderDuration:t,width:r.width,height:r.height,devicePixelRatio:globalThis.devicePixelRatio||1,collisionWorkerDisabled:n,outdoorsWorkerDisabled:o})}sendBlueDotEvents(t){if(!((t==="found-floor"||t==="found-position")&&this.oneTimeEventsSent.has(t)))return this.oneTimeEventsSent.add(t),this.sendAnalyticEvent(t)}};es=new WeakMap,Io=new WeakMap,Js=new WeakSet,p2=function(t){t.sessionId&&Zs.getInstance().saveSessionData("id",t.sessionId),t.deviceId&&Zs.getInstance().saveLocalData("deviceId",t.deviceId)},Ib=function(t){let r=t.baseUri??z5;return{baseUri:r,analyticsBaseUrl:c2({...t,baseUri:r}),version:y?.env?.npm_package_version||"v6",deviceId:t.deviceId||V5(),accessToken:t.accessToken,mapId:t.mapId,sessionId:t.sessionId||H5(),platformString:t.platformString||"",context:W5(t.context)||U5,geolocationMode:!1,sendEvents:t.sendEvents??!0,logEvents:t.logEvents??!1,noAuth:t.noAuth||!1,key:t.key,secret:t.secret}};function c2({mapId:e,baseUri:t=z5}){return`${t}${e}/`}function V5(){return Zs.getInstance().loadLocalData("deviceId")}function H5(){return Zs.getInstance().loadSessionData("id")}function zF(e,t){return e+t}function W5(e){return $5.find(t=>t===e)}var XF=["$select-location","$select-category","$query-suggest","$query-search"],ZF=[Z5,Y5,q5,X5,J5],qte=new Su,So,Mm=class{constructor(t){T(this,So);f(this,"capture");f(this,"updateState");w(this,So,t),this.capture=a(this,So).capture.bind(a(this,So)),this.updateState=a(this,So).updateState.bind(a(this,So))}getState(){let{sessionId:t,deviceId:r,...n}=a(this,So).getState();return n}getContext(){return a(this,So).getContext()}getSessionId(){return a(this,So).getSessionId()}getDeviceId(){return a(this,So).getDeviceId()}};So=new WeakMap;u();u();var wm,Om,_m,Pm=class{constructor(t,r,{enabled:n=!1}={}){T(this,wm);f(this,"searchInstance");T(this,Om);T(this,_m);f(this,"enabled",!1);w(this,wm,t),w(this,Om,r),w(this,_m,()=>{this.searchInstance?.then(o=>o.populate())}),n&&this.enable()}async query(t,r={}){if(this.enabled||await this.enable(),!this.searchInstance)return A.error("Search should be enabled by now"),{places:[],enterpriseLocations:[],enterpriseCategories:[]};try{return await(await this.searchInstance).search(t,r)}catch(n){return A.error("Search.query failed due to",n),{places:[],enterpriseLocations:[],enterpriseCategories:[]}}}async suggest(t,r={}){if(this.enabled||await this.enable(),!this.searchInstance)return A.error("Search should be enabled by now"),[];try{return await(await this.searchInstance).suggest(t,r)}catch(n){return A.error("Search.suggest failed due to",n),[]}}async enable(){this.enabled||(this.enabled=!0,this.searchInstance||(this.searchInstance=import("./internal-JKAX4KK2.js").then(({InternalSearch:t})=>new t(a(this,wm)))),a(this,Om).on("language-change",a(this,_m)),await this.searchInstance)}};wm=new WeakMap,Om=new WeakMap,_m=new WeakMap;var K5=new WeakMap,vc,Ht,u2=class{constructor(t,{search:r}={}){T(this,vc);T(this,Ht);f(this,"Analytics");f(this,"Search");f(this,"Query");f(this,"internal");f(this,"on",(t,r)=>{a(this,vc).on(t,r)});f(this,"off",(t,r)=>{a(this,vc).off(t,r)});f(this,"__LEGACY_GET_DIRECTIONS_SYNC",(t,r,n)=>a(this,Ht).__LEGACY_GET_DIRECTIONS_SYNC(t,r,n));f(this,"getDirections",(t,r,n)=>a(this,Ht).getDirections(t,r,n));f(this,"__LEGACY_GET_DIRECTIONS_MULTI_DESTINATION_SYNC",(t,r,n)=>a(this,Ht).__LEGACY_GET_DIRECTIONS_MULTI_DESTINATION_SYNC(t,r,n));f(this,"getDirectionsMultiDestination",(t,r,n)=>a(this,Ht).getDirectionsMultiDestination(t,r,n));w(this,vc,new Fe),w(this,Ht,t),K5.set(this,t),this.Analytics=new Mm(t.Analytics),this.Query=t.Query,this.internal=t,this.Search=new Pm(this,t,{enabled:r?.enabled}),a(this,Ht).on("language-change",n=>{a(this,vc).publish("language-change",n)})}getEnv(){return a(this,Ht).getEnv()}getAccessToken(){return a(this,Ht).tokenManager?.getAccessToken().token}get mapName(){return a(this,Ht).mapName}get mapId(){return a(this,Ht).getMapDataOptions?.mapId}get mapCenter(){return a(this,Ht).mapCenter}get organizationId(){return a(this,Ht).organizationId}get outdoorViewToken(){return a(this,Ht).outdoorViewToken}getByType(t){return a(this,Ht).getByType(t)}getById(t,r){return a(this,Ht).getById(t,r)}getByExternalId(t,r){return a(this,Ht).getByExternalId(t,r)}getGeoJSON(t){return t.geoJSON}async changeLanguage(t){return a(this,Ht).changeLanguage(t)}get currentLanguage(){return a(this,Ht).currentLanguage}get naturalBearing(){return a(this,Ht).naturalBearing??0}getDistance(t,r){return a(this,Ht).getDistance(t,r)}toBinaryBundle({downloadLanguagePacks:t=!0}={}){return a(this,Ht).toBinaryBundle({downloadLanguagePacks:t})}toJSONBundle({downloadLanguagePacks:t=!0}={}){return a(this,Ht).toJSONBundle({downloadLanguagePacks:t})}};vc=new WeakMap,Ht=new WeakMap;var Em=u2;function Dm(e){let t=K5.get(e);if(!t)throw new Error("MapDataInternal not found");return t}u();u();u();u();u();u();u();u();u();u();u();u();u();u();u();u();u();u();u();u();u();u();u();u();u();u();u();u();var ot={};zs(ot,{HasPropertyKey:()=>YF,IsArray:()=>un,IsAsyncIterator:()=>d2,IsBigInt:()=>Fm,IsBoolean:()=>pl,IsDate:()=>Ic,IsFunction:()=>f2,IsIterator:()=>m2,IsNull:()=>h2,IsNumber:()=>li,IsObject:()=>wt,IsRegExp:()=>km,IsString:()=>Gt,IsSymbol:()=>g2,IsUint8Array:()=>qs,IsUndefined:()=>sr});u();function YF(e,t){return t in e}function d2(e){return wt(e)&&!un(e)&&!qs(e)&&Symbol.asyncIterator in e}function un(e){return Array.isArray(e)}function Fm(e){return typeof e=="bigint"}function pl(e){return typeof e=="boolean"}function Ic(e){return e instanceof globalThis.Date}function f2(e){return typeof e=="function"}function m2(e){return wt(e)&&!un(e)&&!qs(e)&&Symbol.iterator in e}function h2(e){return e===null}function li(e){return typeof e=="number"}function wt(e){return typeof e=="object"&&e!==null}function km(e){return e instanceof globalThis.RegExp}function Gt(e){return typeof e=="string"}function g2(e){return typeof e=="symbol"}function qs(e){return e instanceof globalThis.Uint8Array}function sr(e){return e===void 0}function JF(e){return e.map(t=>Sb(t))}function qF(e){return new Date(e.getTime())}function KF(e){return new Uint8Array(e)}function QF(e){return new RegExp(e.source,e.flags)}function ek(e){let t={};for(let r of Object.getOwnPropertyNames(e))t[r]=Sb(e[r]);for(let r of Object.getOwnPropertySymbols(e))t[r]=Sb(e[r]);return t}function Sb(e){return un(e)?JF(e):Ic(e)?qF(e):qs(e)?KF(e):km(e)?QF(e):wt(e)?ek(e):e}function Wt(e){return Sb(e)}function Q5(e){return e.map(t=>Am(t))}function Am(e,t){return t===void 0?Wt(e):Wt({...t,...e})}u();u();u();function Cb(e){return Be(e)&&Symbol.asyncIterator in e}function Tb(e){return Be(e)&&Symbol.iterator in e}function y2(e){return Be(e)&&(Object.getPrototypeOf(e)===Object.prototype||Object.getPrototypeOf(e)===null)}function Mb(e){return e instanceof Promise}function Cn(e){return e instanceof Date&&Number.isFinite(e.getTime())}function eM(e){return e instanceof globalThis.Map}function tM(e){return e instanceof globalThis.Set}function Co(e){return ArrayBuffer.isView(e)}function Cu(e){return e instanceof globalThis.Uint8Array}function Me(e,t){return t in e}function Be(e){return e!==null&&typeof e=="object"}function ke(e){return Array.isArray(e)&&!ArrayBuffer.isView(e)}function ar(e){return e===void 0}function Ks(e){return e===null}function ts(e){return typeof e=="boolean"}function he(e){return typeof e=="number"}function Pb(e){return Number.isInteger(e)}function Jr(e){return typeof e=="bigint"}function Qe(e){return typeof e=="string"}function ul(e){return typeof e=="function"}function Qs(e){return typeof e=="symbol"}function qr(e){return Jr(e)||ts(e)||Ks(e)||he(e)||Qe(e)||Qs(e)||ar(e)}var vt;(function(e){e.InstanceMode="default",e.ExactOptionalPropertyTypes=!1,e.AllowArrayObject=!1,e.AllowNaN=!1,e.AllowNullVoid=!1;function t(s,l){return e.ExactOptionalPropertyTypes?l in s:s[l]!==void 0}e.IsExactOptionalProperty=t;function r(s){let l=Be(s);return e.AllowArrayObject?l:l&&!ke(s)}e.IsObjectLike=r;function n(s){return r(s)&&!(s instanceof Date)&&!(s instanceof Uint8Array)}e.IsRecordLike=n;function o(s){return e.AllowNaN?he(s):Number.isFinite(s)}e.IsNumberLike=o;function i(s){let l=ar(s);return e.AllowNullVoid?l||s===null:l}e.IsVoidLike=i})(vt||(vt={}));u();function tk(e){return globalThis.Object.freeze(e).map(t=>Lm(t))}function rk(e){let t={};for(let r of Object.getOwnPropertyNames(e))t[r]=Lm(e[r]);for(let r of Object.getOwnPropertySymbols(e))t[r]=Lm(e[r]);return globalThis.Object.freeze(t)}function Lm(e){return un(e)?tk(e):Ic(e)?e:qs(e)?e:km(e)?e:wt(e)?rk(e):e}function $(e,t){let r=t!==void 0?{...t,...e}:e;switch(vt.InstanceMode){case"freeze":return Lm(r);case"clone":return Wt(r);default:return r}}u();var ve=class extends Error{constructor(t){super(t)}};u();u();u();var $t=Symbol.for("TypeBox.Transform"),ea=Symbol.for("TypeBox.Readonly"),Tn=Symbol.for("TypeBox.Optional"),To=Symbol.for("TypeBox.Hint"),U=Symbol.for("TypeBox.Kind");function rM(e){return wt(e)&&e[ea]==="Readonly"}function rs(e){return wt(e)&&e[Tn]==="Optional"}function b2(e){return it(e,"Any")}function ta(e){return it(e,"Array")}function Rm(e){return it(e,"AsyncIterator")}function x2(e){return it(e,"BigInt")}function v2(e){return it(e,"Boolean")}function Bm(e){return it(e,"Constructor")}function nk(e){return it(e,"Date")}function Nm(e){return it(e,"Function")}function Sc(e){return it(e,"Integer")}function br(e){return it(e,"Intersect")}function Gm(e){return it(e,"Iterator")}function it(e,t){return wt(e)&&U in e&&e[U]===t}function ra(e){return it(e,"Literal")}function no(e){return it(e,"MappedKey")}function zt(e){return it(e,"MappedResult")}function dl(e){return it(e,"Never")}function ok(e){return it(e,"Not")}function ik(e){return it(e,"Null")}function Cc(e){return it(e,"Number")}function Mr(e){return it(e,"Object")}function Tc(e){return it(e,"Promise")}function I2(e){return it(e,"Record")}function S2(e){return it(e,"Ref")}function C2(e){return it(e,"RegExp")}function jm(e){return it(e,"String")}function sk(e){return it(e,"Symbol")}function oo(e){return it(e,"TemplateLiteral")}function ak(e){return it(e,"This")}function Tu(e){return wt(e)&&$t in e}function ci(e){return it(e,"Tuple")}function lk(e){return it(e,"Undefined")}function ft(e){return it(e,"Union")}function ck(e){return it(e,"Uint8Array")}function pk(e){return it(e,"Unknown")}function uk(e){return it(e,"Unsafe")}function dk(e){return it(e,"Void")}function fl(e){return wt(e)&&U in e&&Gt(e[U])}function pi(e){return b2(e)||ta(e)||v2(e)||x2(e)||Rm(e)||Bm(e)||nk(e)||Nm(e)||Sc(e)||br(e)||Gm(e)||ra(e)||no(e)||zt(e)||dl(e)||ok(e)||ik(e)||Cc(e)||Mr(e)||Tc(e)||I2(e)||S2(e)||C2(e)||jm(e)||sk(e)||oo(e)||ak(e)||ci(e)||lk(e)||ft(e)||ck(e)||pk(e)||uk(e)||dk(e)||fl(e)}var F={};zs(F,{IsAny:()=>sM,IsArray:()=>aM,IsAsyncIterator:()=>lM,IsBigInt:()=>cM,IsBoolean:()=>pM,IsConstructor:()=>uM,IsDate:()=>dM,IsFunction:()=>fM,IsInteger:()=>mM,IsIntersect:()=>hM,IsIterator:()=>gM,IsKind:()=>jM,IsKindOf:()=>tt,IsLiteral:()=>Vm,IsLiteralBoolean:()=>xk,IsLiteralNumber:()=>bM,IsLiteralString:()=>yM,IsLiteralValue:()=>xM,IsMappedKey:()=>vM,IsMappedResult:()=>IM,IsNever:()=>SM,IsNot:()=>CM,IsNull:()=>TM,IsNumber:()=>MM,IsObject:()=>PM,IsOptional:()=>bk,IsPromise:()=>wM,IsProperties:()=>w2,IsReadonly:()=>yk,IsRecord:()=>OM,IsRecursive:()=>vk,IsRef:()=>_M,IsRegExp:()=>EM,IsSchema:()=>et,IsString:()=>DM,IsSymbol:()=>FM,IsTemplateLiteral:()=>kM,IsThis:()=>AM,IsTransform:()=>jt,IsTuple:()=>LM,IsUint8Array:()=>RM,IsUndefined:()=>Mu,IsUnion:()=>O2,IsUnionLiteral:()=>Ik,IsUnknown:()=>BM,IsUnsafe:()=>NM,IsVoid:()=>GM,TypeGuardUnknownTypeError:()=>T2});u();var T2=class extends ve{},mk=["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 nM(e){try{return new RegExp(e),!0}catch{return!1}}function M2(e){if(!Gt(e))return!1;for(let t=0;t<e.length;t++){let r=e.charCodeAt(t);if(r>=7&&r<=13||r===27||r===127)return!1}return!0}function oM(e){return P2(e)||et(e)}function Um(e){return sr(e)||Fm(e)}function At(e){return sr(e)||li(e)}function P2(e){return sr(e)||pl(e)}function It(e){return sr(e)||Gt(e)}function hk(e){return sr(e)||Gt(e)&&M2(e)&&nM(e)}function gk(e){return sr(e)||Gt(e)&&M2(e)}function iM(e){return sr(e)||et(e)}function yk(e){return wt(e)&&e[ea]==="Readonly"}function bk(e){return wt(e)&&e[Tn]==="Optional"}function sM(e){return tt(e,"Any")&&It(e.$id)}function aM(e){return tt(e,"Array")&&e.type==="array"&&It(e.$id)&&et(e.items)&&At(e.minItems)&&At(e.maxItems)&&P2(e.uniqueItems)&&iM(e.contains)&&At(e.minContains)&&At(e.maxContains)}function lM(e){return tt(e,"AsyncIterator")&&e.type==="AsyncIterator"&&It(e.$id)&&et(e.items)}function cM(e){return tt(e,"BigInt")&&e.type==="bigint"&&It(e.$id)&&Um(e.exclusiveMaximum)&&Um(e.exclusiveMinimum)&&Um(e.maximum)&&Um(e.minimum)&&Um(e.multipleOf)}function pM(e){return tt(e,"Boolean")&&e.type==="boolean"&&It(e.$id)}function uM(e){return tt(e,"Constructor")&&e.type==="Constructor"&&It(e.$id)&&un(e.parameters)&&e.parameters.every(t=>et(t))&&et(e.returns)}function dM(e){return tt(e,"Date")&&e.type==="Date"&&It(e.$id)&&At(e.exclusiveMaximumTimestamp)&&At(e.exclusiveMinimumTimestamp)&&At(e.maximumTimestamp)&&At(e.minimumTimestamp)&&At(e.multipleOfTimestamp)}function fM(e){return tt(e,"Function")&&e.type==="Function"&&It(e.$id)&&un(e.parameters)&&e.parameters.every(t=>et(t))&&et(e.returns)}function mM(e){return tt(e,"Integer")&&e.type==="integer"&&It(e.$id)&&At(e.exclusiveMaximum)&&At(e.exclusiveMinimum)&&At(e.maximum)&&At(e.minimum)&&At(e.multipleOf)}function w2(e){return wt(e)&&Object.entries(e).every(([t,r])=>M2(t)&&et(r))}function hM(e){return tt(e,"Intersect")&&!(Gt(e.type)&&e.type!=="object")&&un(e.allOf)&&e.allOf.every(t=>et(t)&&!jt(t))&&It(e.type)&&(P2(e.unevaluatedProperties)||iM(e.unevaluatedProperties))&&It(e.$id)}function gM(e){return tt(e,"Iterator")&&e.type==="Iterator"&&It(e.$id)&&et(e.items)}function tt(e,t){return wt(e)&&U in e&&e[U]===t}function yM(e){return Vm(e)&&Gt(e.const)}function bM(e){return Vm(e)&&li(e.const)}function xk(e){return Vm(e)&&pl(e.const)}function Vm(e){return tt(e,"Literal")&&It(e.$id)&&xM(e.const)}function xM(e){return pl(e)||li(e)||Gt(e)}function vM(e){return tt(e,"MappedKey")&&un(e.keys)&&e.keys.every(t=>li(t)||Gt(t))}function IM(e){return tt(e,"MappedResult")&&w2(e.properties)}function SM(e){return tt(e,"Never")&&wt(e.not)&&Object.getOwnPropertyNames(e.not).length===0}function CM(e){return tt(e,"Not")&&et(e.not)}function TM(e){return tt(e,"Null")&&e.type==="null"&&It(e.$id)}function MM(e){return tt(e,"Number")&&e.type==="number"&&It(e.$id)&&At(e.exclusiveMaximum)&&At(e.exclusiveMinimum)&&At(e.maximum)&&At(e.minimum)&&At(e.multipleOf)}function PM(e){return tt(e,"Object")&&e.type==="object"&&It(e.$id)&&w2(e.properties)&&oM(e.additionalProperties)&&At(e.minProperties)&&At(e.maxProperties)}function wM(e){return tt(e,"Promise")&&e.type==="Promise"&&It(e.$id)&&et(e.item)}function OM(e){return tt(e,"Record")&&e.type==="object"&&It(e.$id)&&oM(e.additionalProperties)&&wt(e.patternProperties)&&(t=>{let r=Object.getOwnPropertyNames(t.patternProperties);return r.length===1&&nM(r[0])&&wt(t.patternProperties)&&et(t.patternProperties[r[0]])})(e)}function vk(e){return wt(e)&&To in e&&e[To]==="Recursive"}function _M(e){return tt(e,"Ref")&&It(e.$id)&&Gt(e.$ref)}function EM(e){return tt(e,"RegExp")&&It(e.$id)&&Gt(e.source)&&Gt(e.flags)&&At(e.maxLength)&&At(e.minLength)}function DM(e){return tt(e,"String")&&e.type==="string"&&It(e.$id)&&At(e.minLength)&&At(e.maxLength)&&hk(e.pattern)&&gk(e.format)}function FM(e){return tt(e,"Symbol")&&e.type==="symbol"&&It(e.$id)}function kM(e){return tt(e,"TemplateLiteral")&&e.type==="string"&&Gt(e.pattern)&&e.pattern[0]==="^"&&e.pattern[e.pattern.length-1]==="$"}function AM(e){return tt(e,"This")&&It(e.$id)&&Gt(e.$ref)}function jt(e){return wt(e)&&$t in e}function LM(e){return tt(e,"Tuple")&&e.type==="array"&&It(e.$id)&&li(e.minItems)&&li(e.maxItems)&&e.minItems===e.maxItems&&(sr(e.items)&&sr(e.additionalItems)&&e.minItems===0||un(e.items)&&e.items.every(t=>et(t)))}function Mu(e){return tt(e,"Undefined")&&e.type==="undefined"&&It(e.$id)}function Ik(e){return O2(e)&&e.anyOf.every(t=>yM(t)||bM(t))}function O2(e){return tt(e,"Union")&&It(e.$id)&&wt(e)&&un(e.anyOf)&&e.anyOf.every(t=>et(t))}function RM(e){return tt(e,"Uint8Array")&&e.type==="Uint8Array"&&It(e.$id)&&At(e.minByteLength)&&At(e.maxByteLength)}function BM(e){return tt(e,"Unknown")&&It(e.$id)}function NM(e){return tt(e,"Unsafe")}function GM(e){return tt(e,"Void")&&e.type==="void"&&It(e.$id)}function jM(e){return wt(e)&&U in e&&Gt(e[U])&&!mk.includes(e[U])}function et(e){return wt(e)&&(sM(e)||aM(e)||pM(e)||cM(e)||lM(e)||uM(e)||dM(e)||fM(e)||mM(e)||hM(e)||gM(e)||Vm(e)||vM(e)||IM(e)||SM(e)||CM(e)||TM(e)||MM(e)||PM(e)||wM(e)||OM(e)||_M(e)||EM(e)||DM(e)||FM(e)||kM(e)||AM(e)||LM(e)||Mu(e)||O2(e)||RM(e)||BM(e)||NM(e)||GM(e)||jM(e))}u();var _2="(true|false)",Hm="(0|[1-9][0-9]*)",E2="(.*)",Sk="(?!.*)",Ene=`^${_2}$`,na=`^${Hm}$`,oa=`^${E2}$`,UM=`^${Sk}$`;u();var Bn={};zs(Bn,{Clear:()=>Tk,Delete:()=>Mk,Entries:()=>Ck,Get:()=>Ok,Has:()=>Pk,Set:()=>wk});u();var Pu=new Map;function Ck(){return new Map(Pu)}function Tk(){return Pu.clear()}function Mk(e){return Pu.delete(e)}function Pk(e){return Pu.has(e)}function wk(e,t){Pu.set(e,t)}function Ok(e){return Pu.get(e)}var Nr={};zs(Nr,{Clear:()=>Ek,Delete:()=>Dk,Entries:()=>_k,Get:()=>Ak,Has:()=>Fk,Set:()=>kk});u();var wu=new Map;function _k(){return new Map(wu)}function Ek(){return wu.clear()}function Dk(e){return wu.delete(e)}function Fk(e){return wu.has(e)}function kk(e,t){wu.set(e,t)}function Ak(e){return wu.get(e)}u();function VM(e,t){return e.includes(t)}function HM(e){return[...new Set(e)]}function Lk(e,t){return e.filter(r=>t.includes(r))}function Rk(e,t){return e.reduce((r,n)=>Lk(r,n),t)}function WM(e){return e.length===1?e[0]:e.length>1?Rk(e.slice(1),e[0]):[]}function $M(e){let t=[];for(let r of e)t.push(...r);return t}u();function ml(e){return $({[U]:"Any"},e)}u();function wb(e,t){return $({[U]:"Array",type:"array",items:e},t)}u();function Ob(e,t){return $({[U]:"AsyncIterator",type:"AsyncIterator",items:e},t)}u();u();u();function Bk(e,t){let{[t]:r,...n}=e;return n}function fr(e,t){return t.reduce((r,n)=>Bk(r,n),e)}u();function St(e){return $({[U]:"Never",not:{}},e)}u();u();function st(e){return $({[U]:"MappedResult",properties:e})}u();u();function _b(e,t,r){return $({[U]:"Constructor",type:"Constructor",parameters:e,returns:t},r)}u();function hl(e,t,r){return $({[U]:"Function",type:"Function",parameters:e,returns:t},r)}u();u();u();u();function Wm(e,t){return $({[U]:"Union",anyOf:e},t)}function Nk(e){return e.some(t=>rs(t))}function zM(e){return e.map(t=>rs(t)?Gk(t):t)}function Gk(e){return fr(e,[Tn])}function jk(e,t){return Nk(e)?Nn(Wm(zM(e),t)):Wm(zM(e),t)}function ns(e,t){return e.length===0?St(t):e.length===1?$(e[0],t):jk(e,t)}u();function Ct(e,t){return e.length===0?St(t):e.length===1?$(e[0],t):Wm(e,t)}u();u();u();var Eb=class extends ve{};function Uk(e){return e.replace(/\\\$/g,"$").replace(/\\\*/g,"*").replace(/\\\^/g,"^").replace(/\\\|/g,"|").replace(/\\\(/g,"(").replace(/\\\)/g,")")}function D2(e,t,r){return e[t]===r&&e.charCodeAt(t-1)!==92}function ia(e,t){return D2(e,t,"(")}function $m(e,t){return D2(e,t,")")}function XM(e,t){return D2(e,t,"|")}function Vk(e){if(!(ia(e,0)&&$m(e,e.length-1)))return!1;let t=0;for(let r=0;r<e.length;r++)if(ia(e,r)&&(t+=1),$m(e,r)&&(t-=1),t===0&&r!==e.length-1)return!1;return!0}function Hk(e){return e.slice(1,e.length-1)}function Wk(e){let t=0;for(let r=0;r<e.length;r++)if(ia(e,r)&&(t+=1),$m(e,r)&&(t-=1),XM(e,r)&&t===0)return!0;return!1}function $k(e){for(let t=0;t<e.length;t++)if(ia(e,t))return!0;return!1}function zk(e){let[t,r]=[0,0],n=[];for(let i=0;i<e.length;i++)if(ia(e,i)&&(t+=1),$m(e,i)&&(t-=1),XM(e,i)&&t===0){let s=e.slice(r,i);s.length>0&&n.push(Ou(s)),r=i+1}let o=e.slice(r);return o.length>0&&n.push(Ou(o)),n.length===0?{type:"const",const:""}:n.length===1?n[0]:{type:"or",expr:n}}function Xk(e){function t(o,i){if(!ia(o,i))throw new Eb("TemplateLiteralParser: Index must point to open parens");let s=0;for(let l=i;l<o.length;l++)if(ia(o,l)&&(s+=1),$m(o,l)&&(s-=1),s===0)return[i,l];throw new Eb("TemplateLiteralParser: Unclosed group parens in expression")}function r(o,i){for(let s=i;s<o.length;s++)if(ia(o,s))return[i,s];return[i,o.length]}let n=[];for(let o=0;o<e.length;o++)if(ia(e,o)){let[i,s]=t(e,o),l=e.slice(i,s+1);n.push(Ou(l)),o=s}else{let[i,s]=r(e,o),l=e.slice(i,s);l.length>0&&n.push(Ou(l)),o=s-1}return n.length===0?{type:"const",const:""}:n.length===1?n[0]:{type:"and",expr:n}}function Ou(e){return Vk(e)?Ou(Hk(e)):Wk(e)?zk(e):$k(e)?Xk(e):{type:"const",const:Uk(e)}}function _u(e){return Ou(e.slice(1,e.length-1))}var F2=class extends ve{};function Zk(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 Yk(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 Jk(e){return e.type==="const"&&e.const===".*"}function Mc(e){return Zk(e)||Jk(e)?!1:Yk(e)?!0:e.type==="and"?e.expr.every(t=>Mc(t)):e.type==="or"?e.expr.every(t=>Mc(t)):e.type==="const"?!0:(()=>{throw new F2("Unknown expression type")})()}function Db(e){let t=_u(e.pattern);return Mc(t)}u();var k2=class extends ve{};function*ZM(e){if(e.length===1)return yield*e[0];for(let t of e[0])for(let r of ZM(e.slice(1)))yield`${t}${r}`}function*qk(e){return yield*ZM(e.expr.map(t=>[...zm(t)]))}function*Kk(e){for(let t of e.expr)yield*zm(t)}function*Qk(e){return yield e.const}function*zm(e){return e.type==="and"?yield*qk(e):e.type==="or"?yield*Kk(e):e.type==="const"?yield*Qk(e):(()=>{throw new k2("Unknown expression")})()}function Eu(e){let t=_u(e.pattern);return Mc(t)?[...zm(t)]:[]}u();u();function ht(e,t){return $({[U]:"Literal",const:e,type:typeof e},t)}u();function Fb(e){return $({[U]:"Boolean",type:"boolean"},e)}u();function Du(e){return $({[U]:"BigInt",type:"bigint"},e)}u();function os(e){return $({[U]:"Number",type:"number"},e)}u();function Mo(e){return $({[U]:"String",type:"string"},e)}function*eA(e){let t=e.trim().replace(/"|'/g,"");return t==="boolean"?yield Fb():t==="number"?yield os():t==="bigint"?yield Du():t==="string"?yield Mo():yield(()=>{let r=t.split("|").map(n=>ht(n.trim()));return r.length===0?St():r.length===1?r[0]:ns(r)})()}function*tA(e){if(e[1]!=="{"){let t=ht("$"),r=A2(e.slice(1));return yield*[t,...r]}for(let t=2;t<e.length;t++)if(e[t]==="}"){let r=eA(e.slice(2,t)),n=A2(e.slice(t+1));return yield*[...r,...n]}yield ht(e)}function*A2(e){for(let t=0;t<e.length;t++)if(e[t]==="$"){let r=ht(e.slice(0,t)),n=tA(e.slice(t));return yield*[r,...n]}yield ht(e)}function YM(e){return[...A2(e)]}u();var L2=class extends ve{};function rA(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function JM(e,t){return oo(e)?e.pattern.slice(1,e.pattern.length-1):ft(e)?`(${e.anyOf.map(r=>JM(r,t)).join("|")})`:Cc(e)?`${t}${Hm}`:Sc(e)?`${t}${Hm}`:x2(e)?`${t}${Hm}`:jm(e)?`${t}${E2}`:ra(e)?`${t}${rA(e.const.toString())}`:v2(e)?`${t}${_2}`:(()=>{throw new L2(`Unexpected Kind '${e[U]}'`)})()}function R2(e){return`^${e.map(t=>JM(t,"")).join("")}$`}u();function Pc(e){let r=Eu(e).map(n=>ht(n));return ns(r)}u();function kb(e,t){let r=Gt(e)?R2(YM(e)):R2(e);return $({[U]:"TemplateLiteral",type:"string",pattern:r},t)}function nA(e){return Eu(e).map(r=>r.toString())}function oA(e){let t=[];for(let r of e)t.push(...Gn(r));return t}function iA(e){return[e.toString()]}function Gn(e){return[...new Set(oo(e)?nA(e):ft(e)?oA(e.anyOf):ra(e)?iA(e.const):Cc(e)?["[number]"]:Sc(e)?["[number]"]:[])]}u();function sA(e,t,r){let n={};for(let o of Object.getOwnPropertyNames(t))n[o]=Fu(e,Gn(t[o]),r);return n}function aA(e,t,r){return sA(e,t.properties,r)}function qM(e,t,r){let n=aA(e,t,r);return st(n)}function QM(e,t){return e.map(r=>eP(r,t))}function lA(e){return e.filter(t=>!dl(t))}function cA(e,t){return Ab(lA(QM(e,t)))}function pA(e){return e.some(t=>dl(t))?[]:e}function uA(e,t){return ns(pA(QM(e,t)))}function dA(e,t){return t in e?e[t]:t==="[number]"?ns(e):St()}function fA(e,t){return t==="[number]"?e:St()}function mA(e,t){return t in e?e[t]:St()}function eP(e,t){return br(e)?cA(e.allOf,t):ft(e)?uA(e.anyOf,t):ci(e)?dA(e.items??[],t):ta(e)?fA(e.items,t):Mr(e)?mA(e.properties,t):St()}function Xm(e,t){return t.map(r=>eP(e,r))}function KM(e,t){return ns(Xm(e,t))}function Fu(e,t,r){return zt(t)?qM(e,t,r):no(t)?tP(e,t,r):$(pi(t)?KM(e,Gn(t)):KM(e,t),r)}function hA(e,t,r){return{[t]:Fu(e,[t],Wt(r))}}function gA(e,t,r){return t.reduce((n,o)=>({...n,...hA(e,o,r)}),{})}function yA(e,t,r){return gA(e,t.keys,r)}function tP(e,t,r){let n=yA(e,t,r);return st(n)}u();function Lb(e,t){return $({[U]:"Iterator",type:"Iterator",items:e},t)}u();function bA(e){let t=[];for(let r in e)rs(e[r])||t.push(r);return t}function xA(e,t){let r=bA(e),n=r.length>0?{[U]:"Object",type:"object",properties:e,required:r}:{[U]:"Object",type:"object",properties:e};return $(n,t)}var Ot=xA;u();function Rb(e,t){return $({[U]:"Promise",type:"Promise",item:e},t)}u();u();function vA(e){return $(fr(e,[ea]))}function IA(e){return $({...e,[ea]:"Readonly"})}function SA(e,t){return t===!1?vA(e):IA(e)}function Po(e,t){let r=t??!0;return zt(e)?rP(e,r):SA(e,r)}function CA(e,t){let r={};for(let n of globalThis.Object.getOwnPropertyNames(e))r[n]=Po(e[n],t);return r}function TA(e,t){return CA(e.properties,t)}function rP(e,t){let r=TA(e,t);return st(r)}u();function is(e,t){return $(e.length>0?{[U]:"Tuple",type:"array",items:e,additionalItems:!1,minItems:e.length,maxItems:e.length}:{[U]:"Tuple",type:"array",minItems:e.length,maxItems:e.length},t)}function nP(e,t){return e in t?wo(e,t[e]):st(t)}function MA(e){return{[e]:ht(e)}}function PA(e){let t={};for(let r of e)t[r]=ht(r);return t}function wA(e,t){return VM(t,e)?MA(e):PA(t)}function OA(e,t){let r=wA(e,t);return nP(e,r)}function Zm(e,t){return t.map(r=>wo(e,r))}function _A(e,t){let r={};for(let n of globalThis.Object.getOwnPropertyNames(t))r[n]=wo(e,t[n]);return r}function wo(e,t){let r={...t};return rs(t)?Nn(wo(e,fr(t,[Tn]))):rM(t)?Po(wo(e,fr(t,[ea]))):zt(t)?nP(e,t.properties):no(t)?OA(e,t.keys):Bm(t)?_b(Zm(e,t.parameters),wo(e,t.returns),r):Nm(t)?hl(Zm(e,t.parameters),wo(e,t.returns),r):Rm(t)?Ob(wo(e,t.items),r):Gm(t)?Lb(wo(e,t.items),r):br(t)?jn(Zm(e,t.allOf),r):ft(t)?Ct(Zm(e,t.anyOf),r):ci(t)?is(Zm(e,t.items??[]),r):Mr(t)?Ot(_A(e,t.properties),r):ta(t)?wb(wo(e,t.items),r):Tc(t)?Rb(wo(e,t.item),r):t}function EA(e,t){let r={};for(let n of e)r[n]=wo(n,t);return r}function oP(e,t,r){let n=pi(e)?Gn(e):e,o=t({[U]:"MappedKey",keys:n}),i=EA(n,o);return Ot(i,r)}u();function DA(e){return $(fr(e,[Tn]))}function FA(e){return $({...e,[Tn]:"Optional"})}function kA(e,t){return t===!1?DA(e):FA(e)}function Nn(e,t){let r=t??!0;return zt(e)?iP(e,r):kA(e,r)}function AA(e,t){let r={};for(let n of globalThis.Object.getOwnPropertyNames(e))r[n]=Nn(e[n],t);return r}function LA(e,t){return AA(e.properties,t)}function iP(e,t){let r=LA(e,t);return st(r)}u();function Ym(e,t={}){let r=e.every(o=>Mr(o)),n=pi(t.unevaluatedProperties)?{unevaluatedProperties:t.unevaluatedProperties}:{};return $(t.unevaluatedProperties===!1||pi(t.unevaluatedProperties)||r?{...n,[U]:"Intersect",type:"object",allOf:e}:{...n,[U]:"Intersect",allOf:e},t)}function RA(e){return e.every(t=>rs(t))}function BA(e){return fr(e,[Tn])}function sP(e){return e.map(t=>rs(t)?BA(t):t)}function NA(e,t){return RA(e)?Nn(Ym(sP(e),t)):Ym(sP(e),t)}function Ab(e,t={}){if(e.length===0)return St(t);if(e.length===1)return $(e[0],t);if(e.some(r=>Tu(r)))throw new Error("Cannot intersect transform types");return NA(e,t)}u();function jn(e,t){if(e.length===0)return St(t);if(e.length===1)return $(e[0],t);if(e.some(r=>Tu(r)))throw new Error("Cannot intersect transform types");return Ym(e,t)}function aP(e){return e.map(t=>B2(t))}function GA(e){return jn(aP(e))}function jA(e){return Ct(aP(e))}function UA(e){return B2(e)}function B2(e){return br(e)?GA(e.allOf):ft(e)?jA(e.anyOf):Tc(e)?UA(e.item):e}function lP(e,t){return $(B2(e),t)}u();u();u();u();function cP(e){let t=[];for(let r of e)t.push(Gr(r));return t}function VA(e){let t=cP(e);return $M(t)}function HA(e){let t=cP(e);return WM(t)}function WA(e){return e.map((t,r)=>r.toString())}function $A(e){return["[number]"]}function zA(e){return globalThis.Object.getOwnPropertyNames(e)}function XA(e){return N2?globalThis.Object.getOwnPropertyNames(e).map(r=>r[0]==="^"&&r[r.length-1]==="$"?r.slice(1,r.length-1):r):[]}function Gr(e){return br(e)?VA(e.allOf):ft(e)?HA(e.anyOf):ci(e)?WA(e.items??[]):ta(e)?$A(e.items):Mr(e)?zA(e.properties):I2(e)?XA(e.patternProperties):[]}var N2=!1;function sa(e){N2=!0;let t=Gr(e);return N2=!1,`^(${t.map(n=>`(${n})`).join("|")})$`}function ZA(e){return e.map(t=>t==="[number]"?os():ht(t))}function Bb(e,t){if(zt(e))return pP(e,t);{let r=Gr(e),n=ZA(r),o=ns(n);return $(o,t)}}function YA(e,t){let r={};for(let n of globalThis.Object.getOwnPropertyNames(e))r[n]=Bb(e[n],Wt(t));return r}function JA(e,t){return YA(e.properties,t)}function pP(e,t){let r=JA(e,t);return st(r)}u();function gl(e){let t=Gr(e),r=Xm(e,t);return t.map((n,o)=>[t[o],r[o]])}function qA(e){let t=[];for(let r of e)t.push(...Gr(r));return HM(t)}function KA(e){return e.filter(t=>!dl(t))}function QA(e,t){let r=[];for(let n of e)r.push(...Xm(n,[t]));return KA(r)}function eL(e,t){let r={};for(let n of t)r[n]=Ab(QA(e,n));return r}function uP(e,t){let r=qA(e),n=eL(e,r);return Ot(n,t)}u();u();function Nb(e){return $({[U]:"Date",type:"Date"},e)}u();function Gb(e){return $({[U]:"Null",type:"null"},e)}u();function jb(e){return $({[U]:"Symbol",type:"symbol"},e)}u();function Ub(e){return $({[U]:"Undefined",type:"undefined"},e)}u();function Vb(e){return $({[U]:"Uint8Array",type:"Uint8Array"},e)}u();function aa(e){return $({[U]:"Unknown"},e)}function tL(e){return e.map(t=>G2(t,!1))}function rL(e){let t={};for(let r of globalThis.Object.getOwnPropertyNames(e))t[r]=Po(G2(e[r],!1));return t}function Hb(e,t){return t===!0?e:Po(e)}function G2(e,t){return d2(e)?Hb(ml(),t):m2(e)?Hb(ml(),t):un(e)?Po(is(tL(e))):qs(e)?Vb():Ic(e)?Nb():wt(e)?Hb(Ot(rL(e)),t):f2(e)?Hb(hl([],aa()),t):sr(e)?Ub():h2(e)?Gb():g2(e)?jb():Fm(e)?Du():li(e)?ht(e):pl(e)?ht(e):Gt(e)?ht(e):Ot({})}function dP(e,t){return $(G2(e,!0),t)}u();function fP(e,t){return is(e.parameters,t)}u();function Jm(e,t){return e.map(r=>ui(r,t))}function nL(e,t){let r={};for(let n of globalThis.Object.getOwnPropertyNames(e))r[n]=ui(e[n],t);return r}function oL(e,t){return e.parameters=Jm(e.parameters,t),e.returns=ui(e.returns,t),e}function iL(e,t){return e.parameters=Jm(e.parameters,t),e.returns=ui(e.returns,t),e}function sL(e,t){return e.allOf=Jm(e.allOf,t),e}function aL(e,t){return e.anyOf=Jm(e.anyOf,t),e}function lL(e,t){return sr(e.items)||(e.items=Jm(e.items,t)),e}function cL(e,t){return e.items=ui(e.items,t),e}function pL(e,t){return e.properties=nL(e.properties,t),e}function uL(e,t){return e.item=ui(e.item,t),e}function dL(e,t){return e.items=ui(e.items,t),e}function fL(e,t){return e.items=ui(e.items,t),e}function mL(e,t){let r=t.find(o=>o.$id===e.$ref);if(r===void 0)throw Error(`Unable to dereference schema with $id ${e.$ref}`);let n=fr(r,["$id"]);return ui(n,t)}function hL(e,t){return Bm(e)?oL(e,t):Nm(e)?iL(e,t):br(e)?sL(e,t):ft(e)?aL(e,t):ci(e)?lL(e,t):ta(e)?cL(e,t):Mr(e)?pL(e,t):Tc(e)?uL(e,t):Rm(e)?dL(e,t):Gm(e)?fL(e,t):S2(e)?mL(e,t):e}function ui(e,t){return hL(Am(e),Q5(t))}u();function mP(e,t){if(sr(e))throw new Error("Enum undefined or empty");let r=globalThis.Object.getOwnPropertyNames(e).filter(i=>isNaN(i)).map(i=>e[i]),o=[...new Set(r)].map(i=>ht(i));return Ct(o,{...t,[To]:"Enum"})}u();u();u();var U2=class extends ve{},H;(function(e){e[e.Union=0]="Union",e[e.True=1]="True",e[e.False=2]="False"})(H||(H={}));function Oo(e){return e===H.False?e:H.True}function ku(e){throw new U2(e)}function Ir(e){return F.IsNever(e)||F.IsIntersect(e)||F.IsUnion(e)||F.IsUnknown(e)||F.IsAny(e)}function Sr(e,t){return F.IsNever(t)?IP(e,t):F.IsIntersect(t)?Wb(e,t):F.IsUnion(t)?$2(e,t):F.IsUnknown(t)?MP(e,t):F.IsAny(t)?W2(e,t):ku("StructuralRight")}function W2(e,t){return H.True}function gL(e,t){return F.IsIntersect(t)?Wb(e,t):F.IsUnion(t)&&t.anyOf.some(r=>F.IsAny(r)||F.IsUnknown(r))?H.True:F.IsUnion(t)?H.Union:F.IsUnknown(t)||F.IsAny(t)?H.True:H.Union}function yL(e,t){return F.IsUnknown(e)?H.False:F.IsAny(e)?H.Union:F.IsNever(e)?H.True:H.False}function bL(e,t){return F.IsObject(t)&&$b(t)?H.True:Ir(t)?Sr(e,t):F.IsArray(t)?Oo(Tt(e.items,t.items)):H.False}function xL(e,t){return Ir(t)?Sr(e,t):F.IsAsyncIterator(t)?Oo(Tt(e.items,t.items)):H.False}function vL(e,t){return Ir(t)?Sr(e,t):F.IsObject(t)?dn(e,t):F.IsRecord(t)?_o(e,t):F.IsBigInt(t)?H.True:H.False}function xP(e,t){return F.IsLiteralBoolean(e)||F.IsBoolean(e)?H.True:H.False}function IL(e,t){return Ir(t)?Sr(e,t):F.IsObject(t)?dn(e,t):F.IsRecord(t)?_o(e,t):F.IsBoolean(t)?H.True:H.False}function SL(e,t){return Ir(t)?Sr(e,t):F.IsObject(t)?dn(e,t):F.IsConstructor(t)?e.parameters.length>t.parameters.length?H.False:e.parameters.every((r,n)=>Oo(Tt(t.parameters[n],r))===H.True)?Oo(Tt(e.returns,t.returns)):H.False:H.False}function CL(e,t){return Ir(t)?Sr(e,t):F.IsObject(t)?dn(e,t):F.IsRecord(t)?_o(e,t):F.IsDate(t)?H.True:H.False}function TL(e,t){return Ir(t)?Sr(e,t):F.IsObject(t)?dn(e,t):F.IsFunction(t)?e.parameters.length>t.parameters.length?H.False:e.parameters.every((r,n)=>Oo(Tt(t.parameters[n],r))===H.True)?Oo(Tt(e.returns,t.returns)):H.False:H.False}function vP(e,t){return F.IsLiteral(e)&&ot.IsNumber(e.const)||F.IsNumber(e)||F.IsInteger(e)?H.True:H.False}function ML(e,t){return F.IsInteger(t)||F.IsNumber(t)?H.True:Ir(t)?Sr(e,t):F.IsObject(t)?dn(e,t):F.IsRecord(t)?_o(e,t):H.False}function Wb(e,t){return t.allOf.every(r=>Tt(e,r)===H.True)?H.True:H.False}function PL(e,t){return e.allOf.some(r=>Tt(r,t)===H.True)?H.True:H.False}function wL(e,t){return Ir(t)?Sr(e,t):F.IsIterator(t)?Oo(Tt(e.items,t.items)):H.False}function OL(e,t){return F.IsLiteral(t)&&t.const===e.const?H.True:Ir(t)?Sr(e,t):F.IsObject(t)?dn(e,t):F.IsRecord(t)?_o(e,t):F.IsString(t)?TP(e,t):F.IsNumber(t)?SP(e,t):F.IsInteger(t)?vP(e,t):F.IsBoolean(t)?xP(e,t):H.False}function IP(e,t){return H.False}function _L(e,t){return H.True}function hP(e){let[t,r]=[e,0];for(;F.IsNot(t);)t=t.not,r+=1;return r%2===0?t:aa()}function EL(e,t){return F.IsNot(e)?Tt(hP(e),t):F.IsNot(t)?Tt(e,hP(t)):ku("Invalid fallthrough for Not")}function DL(e,t){return Ir(t)?Sr(e,t):F.IsObject(t)?dn(e,t):F.IsRecord(t)?_o(e,t):F.IsNull(t)?H.True:H.False}function SP(e,t){return F.IsLiteralNumber(e)||F.IsNumber(e)||F.IsInteger(e)?H.True:H.False}function FL(e,t){return Ir(t)?Sr(e,t):F.IsObject(t)?dn(e,t):F.IsRecord(t)?_o(e,t):F.IsInteger(t)||F.IsNumber(t)?H.True:H.False}function Un(e,t){return Object.getOwnPropertyNames(e.properties).length===t}function gP(e){return $b(e)}function yP(e){return Un(e,0)||Un(e,1)&&"description"in e.properties&&F.IsUnion(e.properties.description)&&e.properties.description.anyOf.length===2&&(F.IsString(e.properties.description.anyOf[0])&&F.IsUndefined(e.properties.description.anyOf[1])||F.IsString(e.properties.description.anyOf[1])&&F.IsUndefined(e.properties.description.anyOf[0]))}function j2(e){return Un(e,0)}function bP(e){return Un(e,0)}function kL(e){return Un(e,0)}function AL(e){return Un(e,0)}function LL(e){return $b(e)}function RL(e){let t=os();return Un(e,0)||Un(e,1)&&"length"in e.properties&&Oo(Tt(e.properties.length,t))===H.True}function BL(e){return Un(e,0)}function $b(e){let t=os();return Un(e,0)||Un(e,1)&&"length"in e.properties&&Oo(Tt(e.properties.length,t))===H.True}function NL(e){let t=hl([ml()],ml());return Un(e,0)||Un(e,1)&&"then"in e.properties&&Oo(Tt(e.properties.then,t))===H.True}function CP(e,t){return Tt(e,t)===H.False||F.IsOptional(e)&&!F.IsOptional(t)?H.False:H.True}function dn(e,t){return F.IsUnknown(e)?H.False:F.IsAny(e)?H.Union:F.IsNever(e)||F.IsLiteralString(e)&&gP(t)||F.IsLiteralNumber(e)&&j2(t)||F.IsLiteralBoolean(e)&&bP(t)||F.IsSymbol(e)&&yP(t)||F.IsBigInt(e)&&kL(t)||F.IsString(e)&&gP(t)||F.IsSymbol(e)&&yP(t)||F.IsNumber(e)&&j2(t)||F.IsInteger(e)&&j2(t)||F.IsBoolean(e)&&bP(t)||F.IsUint8Array(e)&&LL(t)||F.IsDate(e)&&AL(t)||F.IsConstructor(e)&&BL(t)||F.IsFunction(e)&&RL(t)?H.True:F.IsRecord(e)&&F.IsString(V2(e))?t[To]==="Record"?H.True:H.False:F.IsRecord(e)&&F.IsNumber(V2(e))?Un(t,0)?H.True:H.False:H.False}function GL(e,t){return Ir(t)?Sr(e,t):F.IsRecord(t)?_o(e,t):F.IsObject(t)?(()=>{for(let r of Object.getOwnPropertyNames(t.properties)){if(!(r in e.properties)&&!F.IsOptional(t.properties[r]))return H.False;if(F.IsOptional(t.properties[r]))return H.True;if(CP(e.properties[r],t.properties[r])===H.False)return H.False}return H.True})():H.False}function jL(e,t){return Ir(t)?Sr(e,t):F.IsObject(t)&&NL(t)?H.True:F.IsPromise(t)?Oo(Tt(e.item,t.item)):H.False}function V2(e){return na in e.patternProperties?os():oa in e.patternProperties?Mo():ku("Unknown record key pattern")}function H2(e){return na in e.patternProperties?e.patternProperties[na]:oa in e.patternProperties?e.patternProperties[oa]:ku("Unable to get record value schema")}function _o(e,t){let[r,n]=[V2(t),H2(t)];return F.IsLiteralString(e)&&F.IsNumber(r)&&Oo(Tt(e,n))===H.True?H.True:F.IsUint8Array(e)&&F.IsNumber(r)||F.IsString(e)&&F.IsNumber(r)||F.IsArray(e)&&F.IsNumber(r)?Tt(e,n):F.IsObject(e)?(()=>{for(let o of Object.getOwnPropertyNames(e.properties))if(CP(n,e.properties[o])===H.False)return H.False;return H.True})():H.False}function UL(e,t){return Ir(t)?Sr(e,t):F.IsObject(t)?dn(e,t):F.IsRecord(t)?Tt(H2(e),H2(t)):H.False}function VL(e,t){let r=F.IsRegExp(e)?Mo():e,n=F.IsRegExp(t)?Mo():t;return Tt(r,n)}function TP(e,t){return F.IsLiteral(e)&&ot.IsString(e.const)||F.IsString(e)?H.True:H.False}function HL(e,t){return Ir(t)?Sr(e,t):F.IsObject(t)?dn(e,t):F.IsRecord(t)?_o(e,t):F.IsString(t)?H.True:H.False}function WL(e,t){return Ir(t)?Sr(e,t):F.IsObject(t)?dn(e,t):F.IsRecord(t)?_o(e,t):F.IsSymbol(t)?H.True:H.False}function $L(e,t){return F.IsTemplateLiteral(e)?Tt(Pc(e),t):F.IsTemplateLiteral(t)?Tt(e,Pc(t)):ku("Invalid fallthrough for TemplateLiteral")}function zL(e,t){return F.IsArray(t)&&e.items!==void 0&&e.items.every(r=>Tt(r,t.items)===H.True)}function XL(e,t){return F.IsNever(e)?H.True:F.IsUnknown(e)?H.False:F.IsAny(e)?H.Union:H.False}function ZL(e,t){return Ir(t)?Sr(e,t):F.IsObject(t)&&$b(t)||F.IsArray(t)&&zL(e,t)?H.True:F.IsTuple(t)?ot.IsUndefined(e.items)&&!ot.IsUndefined(t.items)||!ot.IsUndefined(e.items)&&ot.IsUndefined(t.items)?H.False:ot.IsUndefined(e.items)&&!ot.IsUndefined(t.items)||e.items.every((r,n)=>Tt(r,t.items[n])===H.True)?H.True:H.False:H.False}function YL(e,t){return Ir(t)?Sr(e,t):F.IsObject(t)?dn(e,t):F.IsRecord(t)?_o(e,t):F.IsUint8Array(t)?H.True:H.False}function JL(e,t){return Ir(t)?Sr(e,t):F.IsObject(t)?dn(e,t):F.IsRecord(t)?_o(e,t):F.IsVoid(t)?QL(e,t):F.IsUndefined(t)?H.True:H.False}function $2(e,t){return t.anyOf.some(r=>Tt(e,r)===H.True)?H.True:H.False}function qL(e,t){return e.anyOf.every(r=>Tt(r,t)===H.True)?H.True:H.False}function MP(e,t){return H.True}function KL(e,t){return F.IsNever(t)?IP(e,t):F.IsIntersect(t)?Wb(e,t):F.IsUnion(t)?$2(e,t):F.IsAny(t)?W2(e,t):F.IsString(t)?TP(e,t):F.IsNumber(t)?SP(e,t):F.IsInteger(t)?vP(e,t):F.IsBoolean(t)?xP(e,t):F.IsArray(t)?yL(e,t):F.IsTuple(t)?XL(e,t):F.IsObject(t)?dn(e,t):F.IsUnknown(t)?H.True:H.False}function QL(e,t){return F.IsUndefined(e)||F.IsUndefined(e)?H.True:H.False}function eR(e,t){return F.IsIntersect(t)?Wb(e,t):F.IsUnion(t)?$2(e,t):F.IsUnknown(t)?MP(e,t):F.IsAny(t)?W2(e,t):F.IsObject(t)?dn(e,t):F.IsVoid(t)?H.True:H.False}function Tt(e,t){return F.IsTemplateLiteral(e)||F.IsTemplateLiteral(t)?$L(e,t):F.IsRegExp(e)||F.IsRegExp(t)?VL(e,t):F.IsNot(e)||F.IsNot(t)?EL(e,t):F.IsAny(e)?gL(e,t):F.IsArray(e)?bL(e,t):F.IsBigInt(e)?vL(e,t):F.IsBoolean(e)?IL(e,t):F.IsAsyncIterator(e)?xL(e,t):F.IsConstructor(e)?SL(e,t):F.IsDate(e)?CL(e,t):F.IsFunction(e)?TL(e,t):F.IsInteger(e)?ML(e,t):F.IsIntersect(e)?PL(e,t):F.IsIterator(e)?wL(e,t):F.IsLiteral(e)?OL(e,t):F.IsNever(e)?_L(e,t):F.IsNull(e)?DL(e,t):F.IsNumber(e)?FL(e,t):F.IsObject(e)?GL(e,t):F.IsRecord(e)?UL(e,t):F.IsString(e)?HL(e,t):F.IsSymbol(e)?WL(e,t):F.IsTuple(e)?ZL(e,t):F.IsPromise(e)?jL(e,t):F.IsUint8Array(e)?YL(e,t):F.IsUndefined(e)?JL(e,t):F.IsUnion(e)?qL(e,t):F.IsUnknown(e)?KL(e,t):F.IsVoid(e)?eR(e,t):ku(`Unknown left type operand '${e[U]}'`)}function yl(e,t){return Tt(e,t)}u();u();u();function tR(e,t,r,n,o){let i={};for(let s of globalThis.Object.getOwnPropertyNames(e))i[s]=Au(e[s],t,r,n,Wt(o));return i}function rR(e,t,r,n,o){return tR(e.properties,t,r,n,o)}function PP(e,t,r,n,o){let i=rR(e,t,r,n,o);return st(i)}function nR(e,t,r,n){let o=yl(e,t);return o===H.Union?Ct([r,n]):o===H.True?r:n}function Au(e,t,r,n,o){return zt(e)?PP(e,t,r,n,o):no(e)?$(wP(e,t,r,n,o)):$(nR(e,t,r,n),o)}function oR(e,t,r,n,o){return{[e]:Au(ht(e),t,r,n,Wt(o))}}function iR(e,t,r,n,o){return e.reduce((i,s)=>({...i,...oR(s,t,r,n,o)}),{})}function sR(e,t,r,n,o){return iR(e.keys,t,r,n,o)}function wP(e,t,r,n,o){let i=sR(e,t,r,n,o);return st(i)}u();function aR(e){return e.allOf.every(t=>la(t))}function lR(e){return e.anyOf.some(t=>la(t))}function cR(e){return!la(e.not)}function la(e){return e[U]==="Intersect"?aR(e):e[U]==="Union"?lR(e):e[U]==="Not"?cR(e):e[U]==="Undefined"}u();function OP(e,t){return Lu(Pc(e),t)}function pR(e,t){let r=e.filter(n=>yl(n,t)===H.False);return r.length===1?r[0]:Ct(r)}function Lu(e,t,r={}){return oo(e)?$(OP(e,t),r):zt(e)?$(_P(e,t),r):$(ft(e)?pR(e.anyOf,t):yl(e,t)!==H.False?St():e,r)}function uR(e,t){let r={};for(let n of globalThis.Object.getOwnPropertyNames(e))r[n]=Lu(e[n],t);return r}function dR(e,t){return uR(e.properties,t)}function _P(e,t){let r=dR(e,t);return st(r)}u();u();u();function EP(e,t){return Ru(Pc(e),t)}function fR(e,t){let r=e.filter(n=>yl(n,t)!==H.False);return r.length===1?r[0]:Ct(r)}function Ru(e,t,r){return oo(e)?$(EP(e,t),r):zt(e)?$(DP(e,t),r):$(ft(e)?fR(e.anyOf,t):yl(e,t)!==H.False?e:St(),r)}function mR(e,t){let r={};for(let n of globalThis.Object.getOwnPropertyNames(e))r[n]=Ru(e[n],t);return r}function hR(e,t){return mR(e.properties,t)}function DP(e,t){let r=hR(e,t);return st(r)}u();function FP(e,t){return $(e.returns,t)}u();function kP(e){return $({[U]:"Integer",type:"integer"},e)}u();u();u();function gR(e,t,r){return{[e]:di(ht(e),t,Wt(r))}}function yR(e,t,r){return e.reduce((o,i)=>({...o,...gR(i,t,r)}),{})}function bR(e,t,r){return yR(e.keys,t,r)}function AP(e,t,r){let n=bR(e,t,r);return st(n)}function xR(e){let[t,r]=[e.slice(0,1),e.slice(1)];return[t.toLowerCase(),r].join("")}function vR(e){let[t,r]=[e.slice(0,1),e.slice(1)];return[t.toUpperCase(),r].join("")}function IR(e){return e.toUpperCase()}function SR(e){return e.toLowerCase()}function CR(e,t,r){let n=_u(e.pattern);if(!Mc(n))return{...e,pattern:LP(e.pattern,t)};let s=[...zm(n)].map(p=>ht(p)),l=RP(s,t),c=Ct(l);return kb([c],r)}function LP(e,t){return typeof e=="string"?t==="Uncapitalize"?xR(e):t==="Capitalize"?vR(e):t==="Uppercase"?IR(e):t==="Lowercase"?SR(e):e:e.toString()}function RP(e,t){return e.map(r=>di(r,t))}function di(e,t,r={}){return no(e)?AP(e,t,r):oo(e)?CR(e,t,r):ft(e)?Ct(RP(e.anyOf,t),r):ra(e)?ht(LP(e.const,t),r):$(e,r)}function BP(e,t={}){return di(e,"Capitalize",t)}u();function NP(e,t={}){return di(e,"Lowercase",t)}u();function GP(e,t={}){return di(e,"Uncapitalize",t)}u();function jP(e,t={}){return di(e,"Uppercase",t)}u();function UP(e,t){return $({[U]:"Not",not:e},t)}u();u();u();function TR(e,t,r){let n={};for(let o of globalThis.Object.getOwnPropertyNames(e))n[o]=Bu(e[o],t,Wt(r));return n}function MR(e,t,r){return TR(e.properties,t,r)}function VP(e,t,r){let n=MR(e,t,r);return st(n)}function PR(e,t){return e.map(r=>z2(r,t))}function wR(e,t){return e.map(r=>z2(r,t))}function OR(e,t){let{[t]:r,...n}=e;return n}function _R(e,t){return t.reduce((r,n)=>OR(r,n),e)}function ER(e,t){let r=fr(e,[$t,"$id","required","properties"]),n=_R(e.properties,t);return Ot(n,r)}function z2(e,t){return br(e)?jn(PR(e.allOf,t)):ft(e)?Ct(wR(e.anyOf,t)):Mr(e)?ER(e,t):Ot({})}function Bu(e,t,r){if(no(t))return HP(e,t,r);if(zt(e))return VP(e,t,r);let n=pi(t)?Gn(t):t;return $({...z2(e,n),...r})}function DR(e,t,r){return{[t]:Bu(e,[t],Wt(r))}}function FR(e,t,r){return t.reduce((n,o)=>({...n,...DR(e,o,r)}),{})}function kR(e,t,r){return FR(e,t.keys,r)}function HP(e,t,r){let n=kR(e,t,r);return st(n)}u();function WP(e,t){return is(e.parameters,t)}u();u();function $P(e){return e.map(t=>zP(t))}function AR(e){let t={};for(let r of globalThis.Object.getOwnPropertyNames(e))t[r]=Nn(e[r]);return t}function LR(e){let t=fr(e,[$t,"$id","required","properties"]),r=AR(e.properties);return Ot(r,t)}function zP(e){return br(e)?jn($P(e.allOf)):ft(e)?Ct($P(e.anyOf)):Mr(e)?LR(e):Ot({})}function zb(e,t){return zt(e)?XP(e,t):$({...zP(e),...t})}function RR(e,t){let r={};for(let n of globalThis.Object.getOwnPropertyNames(e))r[n]=zb(e[n],Wt(t));return r}function BR(e,t){return RR(e.properties,t)}function XP(e,t){let r=BR(e,t);return st(r)}u();u();u();function NR(e,t,r){let n={};for(let o of globalThis.Object.getOwnPropertyNames(e))n[o]=Nu(e[o],t,Wt(r));return n}function GR(e,t,r){return NR(e.properties,t,r)}function ZP(e,t,r){let n=GR(e,t,r);return st(n)}function jR(e,t){return e.map(r=>X2(r,t))}function UR(e,t){return e.map(r=>X2(r,t))}function VR(e,t){let r={};for(let n of t)n in e&&(r[n]=e[n]);return r}function HR(e,t){let r=fr(e,[$t,"$id","required","properties"]),n=VR(e.properties,t);return Ot(n,r)}function X2(e,t){return br(e)?jn(jR(e.allOf,t)):ft(e)?Ct(UR(e.anyOf,t)):Mr(e)?HR(e,t):Ot({})}function Nu(e,t,r){if(no(t))return YP(e,t,r);if(zt(e))return ZP(e,t,r);let n=pi(t)?Gn(t):t;return $({...X2(e,n),...r})}function WR(e,t,r){return{[t]:Nu(e,[t],Wt(r))}}function $R(e,t,r){return t.reduce((n,o)=>({...n,...WR(e,o,r)}),{})}function zR(e,t,r){return $R(e,t.keys,r)}function YP(e,t,r){let n=zR(e,t,r);return st(n)}u();function JP(e){return Po(Nn(e))}u();function wc(e,t,r){return $({[U]:"Record",type:"object",patternProperties:{[e]:t}},r)}function Z2(e,t,r){let n={};for(let o of e)n[o]=t;return Ot(n,{...r,[To]:"Record"})}function XR(e,t,r){return Db(e)?Z2(Gn(e),t,r):wc(e.pattern,t,r)}function ZR(e,t,r){return Z2(Gn(Ct(e)),t,r)}function YR(e,t,r){return Z2([e.toString()],t,r)}function JR(e,t,r){return wc(e.source,t,r)}function qR(e,t,r){let n=sr(e.pattern)?oa:e.pattern;return wc(n,t,r)}function KR(e,t,r){return wc(oa,t,r)}function QR(e,t,r){return wc(UM,t,r)}function eB(e,t,r){return wc(na,t,r)}function tB(e,t,r){return wc(na,t,r)}function qP(e,t,r={}){return ft(e)?ZR(e.anyOf,t,r):oo(e)?XR(e,t,r):ra(e)?YR(e.const,t,r):Sc(e)?eB(e,t,r):Cc(e)?tB(e,t,r):C2(e)?JR(e,t,r):jm(e)?qR(e,t,r):b2(e)?KR(e,t,r):dl(e)?QR(e,t,r):St(r)}u();var rB=0;function KP(e,t={}){sr(t.$id)&&(t.$id=`T${rB++}`);let r=Am(e({[U]:"This",$ref:`${t.$id}`}));return r.$id=t.$id,$({[To]:"Recursive",...r},t)}u();function QP(e,t){if(Gt(e))return $({[U]:"Ref",$ref:e},t);if(sr(e.$id))throw new Error("Reference target type must specify an $id");return $({[U]:"Ref",$ref:e.$id},t)}u();function e4(e,t){let r=Gt(e)?new globalThis.RegExp(e):e;return $({[U]:"RegExp",type:"RegExp",source:r.source,flags:r.flags},t)}u();u();function t4(e){return e.map(t=>r4(t))}function nB(e){let t={};for(let r of globalThis.Object.getOwnPropertyNames(e))t[r]=fr(e[r],[Tn]);return t}function oB(e){let t=fr(e,[$t,"$id","required","properties"]),r=nB(e.properties);return Ot(r,t)}function r4(e){return br(e)?jn(t4(e.allOf)):ft(e)?Ct(t4(e.anyOf)):Mr(e)?oB(e):Ot({})}function Xb(e,t){return zt(e)?n4(e,t):$({...r4(e),...t})}function iB(e,t){let r={};for(let n of globalThis.Object.getOwnPropertyNames(e))r[n]=Xb(e[n],t);return r}function sB(e,t){return iB(e.properties,t)}function n4(e,t){let r=sB(e,t);return st(r)}u();function aB(e){return br(e)?e.allOf:ft(e)?e.anyOf:ci(e)?e.items??[]:[]}function o4(e){return aB(e)}u();function i4(e,t){return $(e.returns,t)}u();function s4(e){return JSON.parse(JSON.stringify(e))}u();var Y2=class{constructor(t){this.schema=t}Decode(t){return new J2(this.schema,t)}},J2=class{constructor(t,r){this.schema=t,this.decode=r}EncodeTransform(t,r){let i={Encode:s=>r[$t].Encode(t(s)),Decode:s=>this.decode(r[$t].Decode(s))};return{...r,[$t]:i}}EncodeSchema(t,r){let n={Decode:this.decode,Encode:t};return{...r,[$t]:n}}Encode(t){return Tu(this.schema)?this.EncodeTransform(t,this.schema):this.EncodeSchema(t,this.schema)}};function a4(e){return new Y2(e)}u();function Zb(e={}){return $({[U]:e[U]??"Unsafe"},e)}u();function l4(e){return $({[U]:"Void",type:"void"},e)}u();var q2={};zs(q2,{Any:()=>ml,Array:()=>wb,AsyncIterator:()=>Ob,Awaited:()=>lP,BigInt:()=>Du,Boolean:()=>Fb,Capitalize:()=>BP,Composite:()=>uP,Const:()=>dP,Constructor:()=>_b,ConstructorParameters:()=>fP,Date:()=>Nb,Deref:()=>ui,Enum:()=>mP,Exclude:()=>Lu,Extends:()=>Au,Extract:()=>Ru,Function:()=>hl,Index:()=>Fu,InstanceType:()=>FP,Integer:()=>kP,Intersect:()=>jn,Iterator:()=>Lb,KeyOf:()=>Bb,Literal:()=>ht,Lowercase:()=>NP,Mapped:()=>oP,Never:()=>St,Not:()=>UP,Null:()=>Gb,Number:()=>os,Object:()=>Ot,Omit:()=>Bu,Optional:()=>Nn,Parameters:()=>WP,Partial:()=>zb,Pick:()=>Nu,Promise:()=>Rb,Readonly:()=>Po,ReadonlyOptional:()=>JP,Record:()=>qP,Recursive:()=>KP,Ref:()=>QP,RegExp:()=>e4,Required:()=>Xb,Rest:()=>o4,ReturnType:()=>i4,Strict:()=>s4,String:()=>Mo,Symbol:()=>jb,TemplateLiteral:()=>kb,Transform:()=>a4,Tuple:()=>is,Uint8Array:()=>Vb,Uncapitalize:()=>GP,Undefined:()=>Ub,Union:()=>Ct,Unknown:()=>aa,Unsafe:()=>Zb,Uppercase:()=>jP,Void:()=>l4});u();var b=q2;u();var qm=b.Object({externalId:b.String({description:"An identifier that can be used to link this entity to data outside of the MVF."}),name:b.String({description:"The name of the entity."}),shortName:b.String({description:"A short name for the entity."}),description:b.String({description:"A description of the entity."}),icon:b.String({format:"uri",description:"A URL to an icon for the entity."})},{$id:"BaseDetails",description:"Additional information about a given entity."}),K2=b.Partial(qm,{$id:"Details",description:"Additional information about a given entity."}),io=b.Object({details:b.Optional(b.Ref(K2))},{$id:"WithDetails"}),Oc=e=>{let t=[...e].sort(),r=b.Pick(qm,e),n=b.Omit(qm,e);return b.Object({details:b.Intersect([r,b.Partial(n)])},{$id:`WithRequiredDetails_${t.join("_")}`})},Q2=[qm,K2];u();var Gu=b.Number({$id:"Longitude",minimum:-180,maximum:180,description:"A WGS 84-compatible longitude coordinate value."}),ju=b.Number({$id:"Latitude",minimum:-90,maximum:90,description:"A WGS 84-compatible latitude coordinate value."}),_c=b.Tuple([b.Ref(Gu),b.Ref(ju)],{$id:"Position",minItems:2,maxItems:2,description:"A valid WGS 84 position consisting of a longitude value, followed by a latitude value."}),fn=b.Object({type:b.Literal("Point"),coordinates:b.Ref(_c)},{$id:"Point",description:"An RFC-7946 compatible GeoJSON Point geometry."}),Yb=b.Object({type:b.Literal("MultiPoint"),coordinates:b.Array(b.Ref(_c))},{$id:"MultiPoint",description:"An RFC-7946 compatible GeoJSON MultiPoint geometry."}),Jb=b.Object({type:b.Literal("LineString"),coordinates:b.Array(b.Ref(_c),{minItems:2,description:"At least two positions are required."})},{$id:"LineString",description:"An RFC-7946 compatible GeoJSON LineString geometry."}),qb=b.Object({type:b.Literal("MultiLineString"),coordinates:b.Array(b.Array(b.Ref(_c),{minItems:2}))},{$id:"MultiLineString",description:"An RFC-7946 compatible GeoJSON MultiLineString geometry."}),c4=b.Array(b.Ref(_c),{$id:"LinearRing",minItems:4,description:"A linear ring is a building block of a polygon or multi-polygon."}),eI=b.Array(b.Ref(c4),{$id:"LinearRings",minItems:1,description:"A collection of linear rings, at least one of which is the exterior ring of a polygon."}),Uu=b.Object({type:b.Literal("Polygon"),coordinates:b.Ref(eI)},{$id:"Polygon",description:"An RFC-7946 compatible GeoJSON Polygon geometry."}),Vu=b.Object({type:b.Literal("MultiPolygon"),coordinates:b.Array(b.Ref(eI))},{$id:"MultiPolygon",description:"An RFC-7946 compatible GeoJSON MultiPolygon geometry."}),Kr=(e,t,r)=>b.Object({type:b.Literal("Feature"),geometry:e,properties:t},r),Mn=(e,t,r)=>b.Object({type:b.Literal("FeatureCollection"),features:b.Array(e,r)},t),tI=[Gu,ju,_c,fn,Yb,Jb,qb,c4,eI,Uu,Vu];u();var mr=(e,t)=>b.Unsafe(b.String({$id:t,pattern:`^${e}_[A-Za-z0-9-]+$`})),mn=mr("g","GeometryId"),Ze=mr("f","FloorId"),rI=[mn,Ze];u();u();u();var Kb=class{constructor(t){f(this,"_value");this._value=t}[Symbol.iterator](){return this}next(){if(this._value==null)return{done:!0,value:void 0};let t=this._value;return this._value=null,{done:!1,value:t}}},Qb=class{constructor(t){f(this,"_tag","Some");f(this,"_value");this._value=t}get value(){return this._value}isSome(){return!0}isSomeAnd(t){return t(this.value)}isNone(){return!1}equals(t){return t.isSome()&&t.value===this.value}expect(t){return this.value}unwrap(){return this.value}unwrapOr(t){return this.value}unwrapOrElse(t){return this.value}inspect(t){return t(this.value),this}inspectNone(t){return this}map(t){return p4(t(this.value))}mapAsync(t){return t(this.value).then(r=>p4(r))}mapOr(t,r){return this.map(t).unwrapOr(r)}mapOrAsync(t,r){return this.mapAsync(t).then(n=>n.unwrapOr(r))}mapOrElse(t,r){return this.map(t).unwrapOrElse(r)}mapOrElseAsync(t,r){return this.mapAsync(t).then(n=>n.unwrapOrElse(r))}and(t){return t}andThen(t){return t(this.value)}andThenAsync(t){return t(this.value)}filter(t){return t(this.value)?this:bl()}or(t){return this}orElse(t){return this}xor(t){return t.isSome()?bl():this}toString(){return`Some(${this.value})`}okOr(t){return ie(this.value)}okOrElse(t){return ie(this.value)}iter(){return new Kb(this.value)}[Symbol.iterator](){return this.iter()}zip(t){return t.isSome()?Hu([this.value,t.value]):bl()}zipWith(t,r){return t.isSome()?Hu(r(this.value,t.value)):bl()}get[Symbol.toStringTag](){return"Some"}},e1=class{constructor(){f(this,"_tag","None")}get value(){return null}isSome(){return!1}isSomeAnd(t){return!1}isNone(){return!0}equals(t){return t.isNone()}expect(t){throw new Error(t)}unwrap(){throw new Error("Tried to unwrap a None value!")}unwrapOr(t){return t}unwrapOrElse(t){return t()}inspect(t){return this}inspectNone(t){return t(),this}map(t){return this}mapAsync(t){return Promise.resolve(this)}mapOr(t,r){return r}mapOrAsync(t,r){return Promise.resolve(r)}mapOrElse(t,r){return r()}mapOrElseAsync(t,r){return r()}and(t){return this}andThen(t){return this}andThenAsync(t){return Promise.resolve(this)}filter(t){return this}or(t){return t}orElse(t){return t()}xor(t){return t}toString(){return"None"}okOr(t){return ae(t)}okOrElse(t){return ae(t())}iter(){return new Kb(null)}[Symbol.iterator](){return this.iter()}zip(t){return this}zipWith(t,r){return this}get[Symbol.toStringTag](){return"None"}},Hu=e=>new Qb(e),bl=()=>new e1,p4=e=>e instanceof Qb||e instanceof e1?e:e==null?bl():Hu(e);var t1=class{constructor(t){f(this,"_value");this._value=t}[Symbol.iterator](){return this}next(){if(this._value==null)return{done:!0,value:void 0};let t=this._value;return this._value=null,{done:!1,value:t}}},nI=class{constructor(t){f(this,"_tag","Ok");f(this,"_value");this._value=t}get value(){return this._value}get error(){return null}isOk(){return!0}isOkAnd(t){return t(this.value)}isErr(){return!1}isErrAnd(t){return!1}ok(){return Hu(this.value)}err(){return bl()}expect(t){return this.value}expectErr(t){throw new Error(t)}unwrap(){return this.value}unwrapOr(t){return this.value}unwrapOrElse(t){return this.value}inspect(t){return t(this.value),this}inspectErr(){return this}map(t){return ie(t(this.value))}async mapAsync(t){return t(this.value).then(ie)}mapOr(t,r){return t(this.value)}async mapOrAsync(t,r){return t(this.value)}mapOrElse(t,r){return t(this.value)}async mapOrElseAsync(t,r){return t(this.value)}mapErr(t){return this}iter(){return new t1(this.value)}[Symbol.iterator](){return this.iter()}and(t){return t}andThen(t){return t(this.value)}or(t){return this}orElse(t){return this}async andThenAsync(t){return t(this.value)}toString(){return`Ok(${this.value})`}get[Symbol.toStringTag](){return"Ok"}},oI=class e{constructor(t){f(this,"_tag","Err");f(this,"_error");this._error=t}get value(){return null}get error(){return this._error}isOk(){return!1}isOkAnd(t){return!1}isErr(){return!0}isErrAnd(t){return t(this.error)}ok(){return bl()}err(){return Hu(this.error)}expect(t){throw new Error(t)}expectErr(t){return this.error}unwrap(){throw this.error}unwrapOr(t){return t}unwrapOrElse(t){return t()}inspect(){return this}inspectErr(t){return t(this.error),this}map(t){return this}iter(){return new t1(null)}[Symbol.iterator](){return this.iter()}async mapAsync(t){return this}mapOr(t,r){return r}async mapOrAsync(t,r){return r}mapOrElse(t,r){return r()}async mapOrElseAsync(t,r){return r()}mapErr(t){return new e(t(this.error))}and(t){return this}andThen(t){return this}async andThenAsync(t){return this}or(t){return t}orElse(t){return t(this.error)}toString(){return`Err(${this.error})`}get[Symbol.toStringTag](){return"Err"}},ie=e=>new nI(e),ae=e=>new oI(e);u();var Vn;(function(e){e.GeometryMissingError="GeometryMissingError",e.FloorMissingError="FloorMissingError",e.UnknownFloorError="UnknownFloorError",e.UnknownGeometryError="UnknownGeometryError",e.DuplicateIdError="DuplicateIdError"})(Vn||(Vn={}));u();u();u();u();var iI=class extends ve{constructor(t){super(`Duplicate type kind '${t}' detected`)}},Km=class extends ve{constructor(t){super(`Duplicate string format '${t}' detected`)}},r1;(function(e){function t(n,o){if(Nr.Has(n))throw new iI(n);return Nr.Set(n,o),(i={})=>Zb({...i,[U]:n})}e.Type=t;function r(n,o){if(Bn.Has(n))throw new Km(n);return Bn.Set(n,o),n}e.Format=r})(r1||(r1={}));u();function lB(e){switch(e.errorType){case V.ArrayContains:return"Expected array to contain at least one matching value";case V.ArrayMaxContains:return`Expected array to contain no more than ${e.schema.maxContains} matching values`;case V.ArrayMinContains:return`Expected array to contain at least ${e.schema.minContains} matching values`;case V.ArrayMaxItems:return`Expected array length to be less or equal to ${e.schema.maxItems}`;case V.ArrayMinItems:return`Expected array length to be greater or equal to ${e.schema.minItems}`;case V.ArrayUniqueItems:return"Expected array elements to be unique";case V.Array:return"Expected array";case V.AsyncIterator:return"Expected AsyncIterator";case V.BigIntExclusiveMaximum:return`Expected bigint to be less than ${e.schema.exclusiveMaximum}`;case V.BigIntExclusiveMinimum:return`Expected bigint to be greater than ${e.schema.exclusiveMinimum}`;case V.BigIntMaximum:return`Expected bigint to be less or equal to ${e.schema.maximum}`;case V.BigIntMinimum:return`Expected bigint to be greater or equal to ${e.schema.minimum}`;case V.BigIntMultipleOf:return`Expected bigint to be a multiple of ${e.schema.multipleOf}`;case V.BigInt:return"Expected bigint";case V.Boolean:return"Expected boolean";case V.DateExclusiveMinimumTimestamp:return`Expected Date timestamp to be greater than ${e.schema.exclusiveMinimumTimestamp}`;case V.DateExclusiveMaximumTimestamp:return`Expected Date timestamp to be less than ${e.schema.exclusiveMaximumTimestamp}`;case V.DateMinimumTimestamp:return`Expected Date timestamp to be greater or equal to ${e.schema.minimumTimestamp}`;case V.DateMaximumTimestamp:return`Expected Date timestamp to be less or equal to ${e.schema.maximumTimestamp}`;case V.DateMultipleOfTimestamp:return`Expected Date timestamp to be a multiple of ${e.schema.multipleOfTimestamp}`;case V.Date:return"Expected Date";case V.Function:return"Expected function";case V.IntegerExclusiveMaximum:return`Expected integer to be less than ${e.schema.exclusiveMaximum}`;case V.IntegerExclusiveMinimum:return`Expected integer to be greater than ${e.schema.exclusiveMinimum}`;case V.IntegerMaximum:return`Expected integer to be less or equal to ${e.schema.maximum}`;case V.IntegerMinimum:return`Expected integer to be greater or equal to ${e.schema.minimum}`;case V.IntegerMultipleOf:return`Expected integer to be a multiple of ${e.schema.multipleOf}`;case V.Integer:return"Expected integer";case V.IntersectUnevaluatedProperties:return"Unexpected property";case V.Intersect:return"Expected all values to match";case V.Iterator:return"Expected Iterator";case V.Literal:return`Expected ${typeof e.schema.const=="string"?`'${e.schema.const}'`:e.schema.const}`;case V.Never:return"Never";case V.Not:return"Value should not match";case V.Null:return"Expected null";case V.NumberExclusiveMaximum:return`Expected number to be less than ${e.schema.exclusiveMaximum}`;case V.NumberExclusiveMinimum:return`Expected number to be greater than ${e.schema.exclusiveMinimum}`;case V.NumberMaximum:return`Expected number to be less or equal to ${e.schema.maximum}`;case V.NumberMinimum:return`Expected number to be greater or equal to ${e.schema.minimum}`;case V.NumberMultipleOf:return`Expected number to be a multiple of ${e.schema.multipleOf}`;case V.Number:return"Expected number";case V.Object:return"Expected object";case V.ObjectAdditionalProperties:return"Unexpected property";case V.ObjectMaxProperties:return`Expected object to have no more than ${e.schema.maxProperties} properties`;case V.ObjectMinProperties:return`Expected object to have at least ${e.schema.minProperties} properties`;case V.ObjectRequiredProperty:return"Expected required property";case V.Promise:return"Expected Promise";case V.RegExp:return"Expected string to match regular expression";case V.StringFormatUnknown:return`Unknown format '${e.schema.format}'`;case V.StringFormat:return`Expected string to match '${e.schema.format}' format`;case V.StringMaxLength:return`Expected string length less or equal to ${e.schema.maxLength}`;case V.StringMinLength:return`Expected string length greater or equal to ${e.schema.minLength}`;case V.StringPattern:return`Expected string to match '${e.schema.pattern}'`;case V.String:return"Expected string";case V.Symbol:return"Expected symbol";case V.TupleLength:return`Expected tuple to have ${e.schema.maxItems||0} elements`;case V.Tuple:return"Expected tuple";case V.Uint8ArrayMaxByteLength:return`Expected byte length less or equal to ${e.schema.maxByteLength}`;case V.Uint8ArrayMinByteLength:return`Expected byte length greater or equal to ${e.schema.minByteLength}`;case V.Uint8Array:return"Expected Uint8Array";case V.Undefined:return"Expected undefined";case V.Union:return"Expected union value";case V.Void:return"Expected void";case V.Kind:return`Expected kind '${e.schema[U]}'`;default:return"Unknown error type"}}var cB=lB;function u4(){return cB}u();var sI=class extends ve{constructor(t){super(`Unable to dereference schema with $id '${t.$ref}'`),this.schema=t}};function pB(e,t){let r=t.find(n=>n.$id===e.$ref);if(r===void 0)throw new sI(e);return at(r,t)}function Eo(e,t){return!Qe(e.$id)||t.some(r=>r.$id===e.$id)||t.push(e),t}function at(e,t){return e[U]==="This"||e[U]==="Ref"?pB(e,t):e}u();var aI=class extends ve{constructor(t){super("Unable to hash value"),this.value=t}},so;(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"})(so||(so={}));var Wu=BigInt("14695981039346656037"),[uB,dB]=[BigInt("1099511628211"),BigInt("18446744073709551616")],fB=Array.from({length:256}).map((e,t)=>BigInt(t)),d4=new Float64Array(1),f4=new DataView(d4.buffer),m4=new Uint8Array(d4.buffer);function*mB(e){let t=e===0?1:Math.ceil(Math.floor(Math.log2(e)+1)/8);for(let r=0;r<t;r++)yield e>>8*(t-1-r)&255}function hB(e){hn(so.Array);for(let t of e)$u(t)}function gB(e){hn(so.Boolean),hn(e?1:0)}function yB(e){hn(so.BigInt),f4.setBigInt64(0,e);for(let t of m4)hn(t)}function bB(e){hn(so.Date),$u(e.getTime())}function xB(e){hn(so.Null)}function vB(e){hn(so.Number),f4.setFloat64(0,e);for(let t of m4)hn(t)}function IB(e){hn(so.Object);for(let t of globalThis.Object.getOwnPropertyNames(e).sort())$u(t),$u(e[t])}function SB(e){hn(so.String);for(let t=0;t<e.length;t++)for(let r of mB(e.charCodeAt(t)))hn(r)}function CB(e){hn(so.Symbol),$u(e.description)}function TB(e){hn(so.Uint8Array);for(let t=0;t<e.length;t++)hn(e[t])}function MB(e){return hn(so.Undefined)}function $u(e){if(ke(e))return hB(e);if(ts(e))return gB(e);if(Jr(e))return yB(e);if(Cn(e))return bB(e);if(Ks(e))return xB(e);if(he(e))return vB(e);if(Be(e))return IB(e);if(Qe(e))return SB(e);if(Qs(e))return CB(e);if(Cu(e))return TB(e);if(ar(e))return MB(e);throw new aI(e)}function hn(e){Wu=Wu^fB[e],Wu=Wu*uB%dB}function xl(e){return Wu=BigInt("14695981039346656037"),$u(e),Wu}u();var lI=class extends ve{constructor(t){super("Unknown type"),this.schema=t}};function PB(e){return e[U]==="Any"||e[U]==="Unknown"}function He(e){return e!==void 0}function wB(e,t,r){return!0}function OB(e,t,r){if(!ke(r)||He(e.minItems)&&!(r.length>=e.minItems)||He(e.maxItems)&&!(r.length<=e.maxItems)||!r.every(i=>Qr(e.items,t,i))||e.uniqueItems===!0&&!function(){let i=new Set;for(let s of r){let l=xl(s);if(i.has(l))return!1;i.add(l)}return!0}())return!1;if(!(He(e.contains)||he(e.minContains)||he(e.maxContains)))return!0;let n=He(e.contains)?e.contains:St(),o=r.reduce((i,s)=>Qr(n,t,s)?i+1:i,0);return!(o===0||he(e.minContains)&&o<e.minContains||he(e.maxContains)&&o>e.maxContains)}function _B(e,t,r){return Cb(r)}function EB(e,t,r){return!(!Jr(r)||He(e.exclusiveMaximum)&&!(r<e.exclusiveMaximum)||He(e.exclusiveMinimum)&&!(r>e.exclusiveMinimum)||He(e.maximum)&&!(r<=e.maximum)||He(e.minimum)&&!(r>=e.minimum)||He(e.multipleOf)&&r%e.multipleOf!==BigInt(0))}function DB(e,t,r){return ts(r)}function FB(e,t,r){return Qr(e.returns,t,r.prototype)}function kB(e,t,r){return!(!Cn(r)||He(e.exclusiveMaximumTimestamp)&&!(r.getTime()<e.exclusiveMaximumTimestamp)||He(e.exclusiveMinimumTimestamp)&&!(r.getTime()>e.exclusiveMinimumTimestamp)||He(e.maximumTimestamp)&&!(r.getTime()<=e.maximumTimestamp)||He(e.minimumTimestamp)&&!(r.getTime()>=e.minimumTimestamp)||He(e.multipleOfTimestamp)&&r.getTime()%e.multipleOfTimestamp!==0)}function AB(e,t,r){return ul(r)}function LB(e,t,r){return!(!Pb(r)||He(e.exclusiveMaximum)&&!(r<e.exclusiveMaximum)||He(e.exclusiveMinimum)&&!(r>e.exclusiveMinimum)||He(e.maximum)&&!(r<=e.maximum)||He(e.minimum)&&!(r>=e.minimum)||He(e.multipleOf)&&r%e.multipleOf!==0)}function RB(e,t,r){let n=e.allOf.every(o=>Qr(o,t,r));if(e.unevaluatedProperties===!1){let o=new RegExp(sa(e)),i=Object.getOwnPropertyNames(r).every(s=>o.test(s));return n&&i}else if(et(e.unevaluatedProperties)){let o=new RegExp(sa(e)),i=Object.getOwnPropertyNames(r).every(s=>o.test(s)||Qr(e.unevaluatedProperties,t,r[s]));return n&&i}else return n}function BB(e,t,r){return Tb(r)}function NB(e,t,r){return r===e.const}function GB(e,t,r){return!1}function jB(e,t,r){return!Qr(e.not,t,r)}function UB(e,t,r){return Ks(r)}function VB(e,t,r){return!(!vt.IsNumberLike(r)||He(e.exclusiveMaximum)&&!(r<e.exclusiveMaximum)||He(e.exclusiveMinimum)&&!(r>e.exclusiveMinimum)||He(e.minimum)&&!(r>=e.minimum)||He(e.maximum)&&!(r<=e.maximum)||He(e.multipleOf)&&r%e.multipleOf!==0)}function HB(e,t,r){if(!vt.IsObjectLike(r)||He(e.minProperties)&&!(Object.getOwnPropertyNames(r).length>=e.minProperties)||He(e.maxProperties)&&!(Object.getOwnPropertyNames(r).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(!Qr(i,t,r[o])||(la(i)||PB(i))&&!(o in r))return!1}else if(vt.IsExactOptionalProperty(r,o)&&!Qr(i,t,r[o]))return!1}if(e.additionalProperties===!1){let o=Object.getOwnPropertyNames(r);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(r).every(i=>n.includes(i)||Qr(e.additionalProperties,t,r[i])):!0}function WB(e,t,r){return Mb(r)}function $B(e,t,r){if(!vt.IsRecordLike(r)||He(e.minProperties)&&!(Object.getOwnPropertyNames(r).length>=e.minProperties)||He(e.maxProperties)&&!(Object.getOwnPropertyNames(r).length<=e.maxProperties))return!1;let[n,o]=Object.entries(e.patternProperties)[0],i=new RegExp(n),s=Object.entries(r).every(([p,d])=>i.test(p)?Qr(o,t,d):!0),l=typeof e.additionalProperties=="object"?Object.entries(r).every(([p,d])=>i.test(p)?!0:Qr(e.additionalProperties,t,d)):!0,c=e.additionalProperties===!1?Object.getOwnPropertyNames(r).every(p=>i.test(p)):!0;return s&&l&&c}function zB(e,t,r){return Qr(at(e,t),t,r)}function XB(e,t,r){let n=new RegExp(e.source,e.flags);return He(e.minLength)&&!(r.length>=e.minLength)||He(e.maxLength)&&!(r.length<=e.maxLength)?!1:n.test(r)}function ZB(e,t,r){return!Qe(r)||He(e.minLength)&&!(r.length>=e.minLength)||He(e.maxLength)&&!(r.length<=e.maxLength)||He(e.pattern)&&!new RegExp(e.pattern).test(r)?!1:He(e.format)?Bn.Has(e.format)?Bn.Get(e.format)(r):!1:!0}function YB(e,t,r){return Qs(r)}function JB(e,t,r){return Qe(r)&&new RegExp(e.pattern).test(r)}function qB(e,t,r){return Qr(at(e,t),t,r)}function KB(e,t,r){if(!ke(r)||e.items===void 0&&r.length!==0||r.length!==e.maxItems)return!1;if(!e.items)return!0;for(let n=0;n<e.items.length;n++)if(!Qr(e.items[n],t,r[n]))return!1;return!0}function QB(e,t,r){return ar(r)}function eN(e,t,r){return e.anyOf.some(n=>Qr(n,t,r))}function tN(e,t,r){return!(!Cu(r)||He(e.maxByteLength)&&!(r.length<=e.maxByteLength)||He(e.minByteLength)&&!(r.length>=e.minByteLength))}function rN(e,t,r){return!0}function nN(e,t,r){return vt.IsVoidLike(r)}function oN(e,t,r){return Nr.Has(e[U])?Nr.Get(e[U])(e,r):!1}function Qr(e,t,r){let n=He(e.$id)?[...t,e]:t,o=e;switch(o[U]){case"Any":return wB(o,n,r);case"Array":return OB(o,n,r);case"AsyncIterator":return _B(o,n,r);case"BigInt":return EB(o,n,r);case"Boolean":return DB(o,n,r);case"Constructor":return FB(o,n,r);case"Date":return kB(o,n,r);case"Function":return AB(o,n,r);case"Integer":return LB(o,n,r);case"Intersect":return RB(o,n,r);case"Iterator":return BB(o,n,r);case"Literal":return NB(o,n,r);case"Never":return GB(o,n,r);case"Not":return jB(o,n,r);case"Null":return UB(o,n,r);case"Number":return VB(o,n,r);case"Object":return HB(o,n,r);case"Promise":return WB(o,n,r);case"Record":return $B(o,n,r);case"Ref":return zB(o,n,r);case"RegExp":return XB(o,n,r);case"String":return ZB(o,n,r);case"Symbol":return YB(o,n,r);case"TemplateLiteral":return JB(o,n,r);case"This":return qB(o,n,r);case"Tuple":return KB(o,n,r);case"Undefined":return QB(o,n,r);case"Union":return eN(o,n,r);case"Uint8Array":return tN(o,n,r);case"Unknown":return rN(o,n,r);case"Void":return nN(o,n,r);default:if(!Nr.Has(o[U]))throw new lI(o);return oN(o,n,r)}}function je(...e){return e.length===3?Qr(e[0],e[1],e[2]):Qr(e[0],[],e[1])}var V;(function(e){e[e.ArrayContains=0]="ArrayContains",e[e.ArrayMaxContains=1]="ArrayMaxContains",e[e.ArrayMaxItems=2]="ArrayMaxItems",e[e.ArrayMinContains=3]="ArrayMinContains",e[e.ArrayMinItems=4]="ArrayMinItems",e[e.ArrayUniqueItems=5]="ArrayUniqueItems",e[e.Array=6]="Array",e[e.AsyncIterator=7]="AsyncIterator",e[e.BigIntExclusiveMaximum=8]="BigIntExclusiveMaximum",e[e.BigIntExclusiveMinimum=9]="BigIntExclusiveMinimum",e[e.BigIntMaximum=10]="BigIntMaximum",e[e.BigIntMinimum=11]="BigIntMinimum",e[e.BigIntMultipleOf=12]="BigIntMultipleOf",e[e.BigInt=13]="BigInt",e[e.Boolean=14]="Boolean",e[e.DateExclusiveMaximumTimestamp=15]="DateExclusiveMaximumTimestamp",e[e.DateExclusiveMinimumTimestamp=16]="DateExclusiveMinimumTimestamp",e[e.DateMaximumTimestamp=17]="DateMaximumTimestamp",e[e.DateMinimumTimestamp=18]="DateMinimumTimestamp",e[e.DateMultipleOfTimestamp=19]="DateMultipleOfTimestamp",e[e.Date=20]="Date",e[e.Function=21]="Function",e[e.IntegerExclusiveMaximum=22]="IntegerExclusiveMaximum",e[e.IntegerExclusiveMinimum=23]="IntegerExclusiveMinimum",e[e.IntegerMaximum=24]="IntegerMaximum",e[e.IntegerMinimum=25]="IntegerMinimum",e[e.IntegerMultipleOf=26]="IntegerMultipleOf",e[e.Integer=27]="Integer",e[e.IntersectUnevaluatedProperties=28]="IntersectUnevaluatedProperties",e[e.Intersect=29]="Intersect",e[e.Iterator=30]="Iterator",e[e.Kind=31]="Kind",e[e.Literal=32]="Literal",e[e.Never=33]="Never",e[e.Not=34]="Not",e[e.Null=35]="Null",e[e.NumberExclusiveMaximum=36]="NumberExclusiveMaximum",e[e.NumberExclusiveMinimum=37]="NumberExclusiveMinimum",e[e.NumberMaximum=38]="NumberMaximum",e[e.NumberMinimum=39]="NumberMinimum",e[e.NumberMultipleOf=40]="NumberMultipleOf",e[e.Number=41]="Number",e[e.ObjectAdditionalProperties=42]="ObjectAdditionalProperties",e[e.ObjectMaxProperties=43]="ObjectMaxProperties",e[e.ObjectMinProperties=44]="ObjectMinProperties",e[e.ObjectRequiredProperty=45]="ObjectRequiredProperty",e[e.Object=46]="Object",e[e.Promise=47]="Promise",e[e.RegExp=48]="RegExp",e[e.StringFormatUnknown=49]="StringFormatUnknown",e[e.StringFormat=50]="StringFormat",e[e.StringMaxLength=51]="StringMaxLength",e[e.StringMinLength=52]="StringMinLength",e[e.StringPattern=53]="StringPattern",e[e.String=54]="String",e[e.Symbol=55]="Symbol",e[e.TupleLength=56]="TupleLength",e[e.Tuple=57]="Tuple",e[e.Uint8ArrayMaxByteLength=58]="Uint8ArrayMaxByteLength",e[e.Uint8ArrayMinByteLength=59]="Uint8ArrayMinByteLength",e[e.Uint8Array=60]="Uint8Array",e[e.Undefined=61]="Undefined",e[e.Union=62]="Union",e[e.Void=63]="Void"})(V||(V={}));var cI=class extends ve{constructor(t){super("Unknown type"),this.schema=t}};function ca(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function We(e){return e!==void 0}var Do=class{constructor(t){this.iterator=t}[Symbol.iterator](){return this.iterator}First(){let t=this.iterator.next();return t.done?void 0:t.value}};function oe(e,t,r,n,o=[]){return{type:e,schema:t,path:r,value:n,message:u4()({errorType:e,path:r,schema:t,value:n,errors:o}),errors:o}}function*iN(e,t,r,n){}function*sN(e,t,r,n){if(!ke(n))return yield oe(V.Array,e,r,n);We(e.minItems)&&!(n.length>=e.minItems)&&(yield oe(V.ArrayMinItems,e,r,n)),We(e.maxItems)&&!(n.length<=e.maxItems)&&(yield oe(V.ArrayMaxItems,e,r,n));for(let s=0;s<n.length;s++)yield*en(e.items,t,`${r}/${s}`,n[s]);if(e.uniqueItems===!0&&!function(){let s=new Set;for(let l of n){let c=xl(l);if(s.has(c))return!1;s.add(c)}return!0}()&&(yield oe(V.ArrayUniqueItems,e,r,n)),!(We(e.contains)||We(e.minContains)||We(e.maxContains)))return;let o=We(e.contains)?e.contains:St(),i=n.reduce((s,l,c)=>en(o,t,`${r}${c}`,l).next().done===!0?s+1:s,0);i===0&&(yield oe(V.ArrayContains,e,r,n)),he(e.minContains)&&i<e.minContains&&(yield oe(V.ArrayMinContains,e,r,n)),he(e.maxContains)&&i>e.maxContains&&(yield oe(V.ArrayMaxContains,e,r,n))}function*aN(e,t,r,n){Cb(n)||(yield oe(V.AsyncIterator,e,r,n))}function*lN(e,t,r,n){if(!Jr(n))return yield oe(V.BigInt,e,r,n);We(e.exclusiveMaximum)&&!(n<e.exclusiveMaximum)&&(yield oe(V.BigIntExclusiveMaximum,e,r,n)),We(e.exclusiveMinimum)&&!(n>e.exclusiveMinimum)&&(yield oe(V.BigIntExclusiveMinimum,e,r,n)),We(e.maximum)&&!(n<=e.maximum)&&(yield oe(V.BigIntMaximum,e,r,n)),We(e.minimum)&&!(n>=e.minimum)&&(yield oe(V.BigIntMinimum,e,r,n)),We(e.multipleOf)&&n%e.multipleOf!==BigInt(0)&&(yield oe(V.BigIntMultipleOf,e,r,n))}function*cN(e,t,r,n){ts(n)||(yield oe(V.Boolean,e,r,n))}function*pN(e,t,r,n){yield*en(e.returns,t,r,n.prototype)}function*uN(e,t,r,n){if(!Cn(n))return yield oe(V.Date,e,r,n);We(e.exclusiveMaximumTimestamp)&&!(n.getTime()<e.exclusiveMaximumTimestamp)&&(yield oe(V.DateExclusiveMaximumTimestamp,e,r,n)),We(e.exclusiveMinimumTimestamp)&&!(n.getTime()>e.exclusiveMinimumTimestamp)&&(yield oe(V.DateExclusiveMinimumTimestamp,e,r,n)),We(e.maximumTimestamp)&&!(n.getTime()<=e.maximumTimestamp)&&(yield oe(V.DateMaximumTimestamp,e,r,n)),We(e.minimumTimestamp)&&!(n.getTime()>=e.minimumTimestamp)&&(yield oe(V.DateMinimumTimestamp,e,r,n)),We(e.multipleOfTimestamp)&&n.getTime()%e.multipleOfTimestamp!==0&&(yield oe(V.DateMultipleOfTimestamp,e,r,n))}function*dN(e,t,r,n){ul(n)||(yield oe(V.Function,e,r,n))}function*fN(e,t,r,n){if(!Pb(n))return yield oe(V.Integer,e,r,n);We(e.exclusiveMaximum)&&!(n<e.exclusiveMaximum)&&(yield oe(V.IntegerExclusiveMaximum,e,r,n)),We(e.exclusiveMinimum)&&!(n>e.exclusiveMinimum)&&(yield oe(V.IntegerExclusiveMinimum,e,r,n)),We(e.maximum)&&!(n<=e.maximum)&&(yield oe(V.IntegerMaximum,e,r,n)),We(e.minimum)&&!(n>=e.minimum)&&(yield oe(V.IntegerMinimum,e,r,n)),We(e.multipleOf)&&n%e.multipleOf!==0&&(yield oe(V.IntegerMultipleOf,e,r,n))}function*mN(e,t,r,n){let o=!1;for(let i of e.allOf)for(let s of en(i,t,r,n))o=!0,yield s;if(o)return yield oe(V.Intersect,e,r,n);if(e.unevaluatedProperties===!1){let i=new RegExp(sa(e));for(let s of Object.getOwnPropertyNames(n))i.test(s)||(yield oe(V.IntersectUnevaluatedProperties,e,`${r}/${s}`,n))}if(typeof e.unevaluatedProperties=="object"){let i=new RegExp(sa(e));for(let s of Object.getOwnPropertyNames(n))if(!i.test(s)){let l=en(e.unevaluatedProperties,t,`${r}/${s}`,n[s]).next();l.done||(yield l.value)}}}function*hN(e,t,r,n){Tb(n)||(yield oe(V.Iterator,e,r,n))}function*gN(e,t,r,n){n!==e.const&&(yield oe(V.Literal,e,r,n))}function*yN(e,t,r,n){yield oe(V.Never,e,r,n)}function*bN(e,t,r,n){en(e.not,t,r,n).next().done===!0&&(yield oe(V.Not,e,r,n))}function*xN(e,t,r,n){Ks(n)||(yield oe(V.Null,e,r,n))}function*vN(e,t,r,n){if(!vt.IsNumberLike(n))return yield oe(V.Number,e,r,n);We(e.exclusiveMaximum)&&!(n<e.exclusiveMaximum)&&(yield oe(V.NumberExclusiveMaximum,e,r,n)),We(e.exclusiveMinimum)&&!(n>e.exclusiveMinimum)&&(yield oe(V.NumberExclusiveMinimum,e,r,n)),We(e.maximum)&&!(n<=e.maximum)&&(yield oe(V.NumberMaximum,e,r,n)),We(e.minimum)&&!(n>=e.minimum)&&(yield oe(V.NumberMinimum,e,r,n)),We(e.multipleOf)&&n%e.multipleOf!==0&&(yield oe(V.NumberMultipleOf,e,r,n))}function*IN(e,t,r,n){if(!vt.IsObjectLike(n))return yield oe(V.Object,e,r,n);We(e.minProperties)&&!(Object.getOwnPropertyNames(n).length>=e.minProperties)&&(yield oe(V.ObjectMinProperties,e,r,n)),We(e.maxProperties)&&!(Object.getOwnPropertyNames(n).length<=e.maxProperties)&&(yield oe(V.ObjectMaxProperties,e,r,n));let o=Array.isArray(e.required)?e.required:[],i=Object.getOwnPropertyNames(e.properties),s=Object.getOwnPropertyNames(n);for(let l of o)s.includes(l)||(yield oe(V.ObjectRequiredProperty,e.properties[l],`${r}/${ca(l)}`,void 0));if(e.additionalProperties===!1)for(let l of s)i.includes(l)||(yield oe(V.ObjectAdditionalProperties,e,`${r}/${ca(l)}`,n[l]));if(typeof e.additionalProperties=="object")for(let l of s)i.includes(l)||(yield*en(e.additionalProperties,t,`${r}/${ca(l)}`,n[l]));for(let l of i){let c=e.properties[l];e.required&&e.required.includes(l)?(yield*en(c,t,`${r}/${ca(l)}`,n[l]),la(e)&&!(l in n)&&(yield oe(V.ObjectRequiredProperty,c,`${r}/${ca(l)}`,void 0))):vt.IsExactOptionalProperty(n,l)&&(yield*en(c,t,`${r}/${ca(l)}`,n[l]))}}function*SN(e,t,r,n){Mb(n)||(yield oe(V.Promise,e,r,n))}function*CN(e,t,r,n){if(!vt.IsRecordLike(n))return yield oe(V.Object,e,r,n);We(e.minProperties)&&!(Object.getOwnPropertyNames(n).length>=e.minProperties)&&(yield oe(V.ObjectMinProperties,e,r,n)),We(e.maxProperties)&&!(Object.getOwnPropertyNames(n).length<=e.maxProperties)&&(yield oe(V.ObjectMaxProperties,e,r,n));let[o,i]=Object.entries(e.patternProperties)[0],s=new RegExp(o);for(let[l,c]of Object.entries(n))s.test(l)&&(yield*en(i,t,`${r}/${ca(l)}`,c));if(typeof e.additionalProperties=="object")for(let[l,c]of Object.entries(n))s.test(l)||(yield*en(e.additionalProperties,t,`${r}/${ca(l)}`,c));if(e.additionalProperties===!1){for(let[l,c]of Object.entries(n))if(!s.test(l))return yield oe(V.ObjectAdditionalProperties,e,`${r}/${ca(l)}`,c)}}function*TN(e,t,r,n){yield*en(at(e,t),t,r,n)}function*MN(e,t,r,n){if(!Qe(n))return yield oe(V.String,e,r,n);if(We(e.minLength)&&!(n.length>=e.minLength)&&(yield oe(V.StringMinLength,e,r,n)),We(e.maxLength)&&!(n.length<=e.maxLength)&&(yield oe(V.StringMaxLength,e,r,n)),!new RegExp(e.source,e.flags).test(n))return yield oe(V.RegExp,e,r,n)}function*PN(e,t,r,n){if(!Qe(n))return yield oe(V.String,e,r,n);We(e.minLength)&&!(n.length>=e.minLength)&&(yield oe(V.StringMinLength,e,r,n)),We(e.maxLength)&&!(n.length<=e.maxLength)&&(yield oe(V.StringMaxLength,e,r,n)),Qe(e.pattern)&&(new RegExp(e.pattern).test(n)||(yield oe(V.StringPattern,e,r,n))),Qe(e.format)&&(Bn.Has(e.format)?Bn.Get(e.format)(n)||(yield oe(V.StringFormat,e,r,n)):yield oe(V.StringFormatUnknown,e,r,n))}function*wN(e,t,r,n){Qs(n)||(yield oe(V.Symbol,e,r,n))}function*ON(e,t,r,n){if(!Qe(n))return yield oe(V.String,e,r,n);new RegExp(e.pattern).test(n)||(yield oe(V.StringPattern,e,r,n))}function*_N(e,t,r,n){yield*en(at(e,t),t,r,n)}function*EN(e,t,r,n){if(!ke(n))return yield oe(V.Tuple,e,r,n);if(e.items===void 0&&n.length!==0)return yield oe(V.TupleLength,e,r,n);if(n.length!==e.maxItems)return yield oe(V.TupleLength,e,r,n);if(e.items)for(let o=0;o<e.items.length;o++)yield*en(e.items[o],t,`${r}/${o}`,n[o])}function*DN(e,t,r,n){ar(n)||(yield oe(V.Undefined,e,r,n))}function*FN(e,t,r,n){if(je(e,t,n))return;let o=e.anyOf.map(i=>new Do(en(i,t,r,n)));yield oe(V.Union,e,r,n,o)}function*kN(e,t,r,n){if(!Cu(n))return yield oe(V.Uint8Array,e,r,n);We(e.maxByteLength)&&!(n.length<=e.maxByteLength)&&(yield oe(V.Uint8ArrayMaxByteLength,e,r,n)),We(e.minByteLength)&&!(n.length>=e.minByteLength)&&(yield oe(V.Uint8ArrayMinByteLength,e,r,n))}function*AN(e,t,r,n){}function*LN(e,t,r,n){vt.IsVoidLike(n)||(yield oe(V.Void,e,r,n))}function*RN(e,t,r,n){Nr.Get(e[U])(e,n)||(yield oe(V.Kind,e,r,n))}function*en(e,t,r,n){let o=We(e.$id)?[...t,e]:t,i=e;switch(i[U]){case"Any":return yield*iN(i,o,r,n);case"Array":return yield*sN(i,o,r,n);case"AsyncIterator":return yield*aN(i,o,r,n);case"BigInt":return yield*lN(i,o,r,n);case"Boolean":return yield*cN(i,o,r,n);case"Constructor":return yield*pN(i,o,r,n);case"Date":return yield*uN(i,o,r,n);case"Function":return yield*dN(i,o,r,n);case"Integer":return yield*fN(i,o,r,n);case"Intersect":return yield*mN(i,o,r,n);case"Iterator":return yield*hN(i,o,r,n);case"Literal":return yield*gN(i,o,r,n);case"Never":return yield*yN(i,o,r,n);case"Not":return yield*bN(i,o,r,n);case"Null":return yield*xN(i,o,r,n);case"Number":return yield*vN(i,o,r,n);case"Object":return yield*IN(i,o,r,n);case"Promise":return yield*SN(i,o,r,n);case"Record":return yield*CN(i,o,r,n);case"Ref":return yield*TN(i,o,r,n);case"RegExp":return yield*MN(i,o,r,n);case"String":return yield*PN(i,o,r,n);case"Symbol":return yield*wN(i,o,r,n);case"TemplateLiteral":return yield*ON(i,o,r,n);case"This":return yield*_N(i,o,r,n);case"Tuple":return yield*EN(i,o,r,n);case"Undefined":return yield*DN(i,o,r,n);case"Union":return yield*FN(i,o,r,n);case"Uint8Array":return yield*kN(i,o,r,n);case"Unknown":return yield*AN(i,o,r,n);case"Void":return yield*LN(i,o,r,n);default:if(!Nr.Has(i[U]))throw new cI(e);return yield*RN(i,o,r,n)}}function ss(...e){let t=e.length===3?en(e[0],e[1],"",e[2]):en(e[0],[],"",e[1]);return new Do(t)}u();u();var BN=function(e,t,r,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 t=="function"?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(e,r):o?o.value=r:t.set(e,r),r},g4=function(e,t,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(e):n?n.value:t.get(e)},pI,n1,y4,uI=class extends ve{constructor(t){let r=t.First();super(r===void 0?"Invalid Value":r.message),pI.add(this),n1.set(this,void 0),BN(this,n1,t,"f"),this.error=r}Errors(){return new Do(g4(this,pI,"m",y4).call(this))}};n1=new WeakMap,pI=new WeakSet,y4=function*(){this.error&&(yield this.error),yield*g4(this,n1,"f")};function h4(e,t,r){if(!je(e,t,r))throw new uI(ss(e,t,r))}function o1(...e){return e.length===3?h4(e[0],e[1],e[2]):h4(e[0],[],e[1])}u();u();u();function NN(e){let t={};for(let r of Object.getOwnPropertyNames(e))t[r]=lt(e[r]);for(let r of Object.getOwnPropertySymbols(e))t[r]=lt(e[r]);return t}function GN(e){return e.map(t=>lt(t))}function jN(e){return e.slice()}function UN(e){return new Map(lt([...e.entries()]))}function VN(e){return new Set(lt([...e.entries()]))}function HN(e){return new Date(e.toISOString())}function lt(e){if(ke(e))return GN(e);if(Cn(e))return HN(e);if(Co(e))return jN(e);if(eM(e))return UN(e);if(tM(e))return VN(e);if(Be(e))return NN(e);if(qr(e))return e;throw new Error("ValueClone: Unable to clone value")}var ao=class extends ve{constructor(t,r){super(r),this.schema=t}};function ct(e){return ul(e)?e():lt(e)}function WN(e,t){return Me(e,"default")?ct(e.default):{}}function $N(e,t){if(e.uniqueItems===!0&&!Me(e,"default"))throw new ao(e,"Array with the uniqueItems constraint requires a default value");if("contains"in e&&!Me(e,"default"))throw new ao(e,"Array with the contains constraint requires a default value");return"default"in e?ct(e.default):e.minItems!==void 0?Array.from({length:e.minItems}).map(r=>lo(e.items,t)):[]}function zN(e,t){return Me(e,"default")?ct(e.default):async function*(){}()}function XN(e,t){return Me(e,"default")?ct(e.default):BigInt(0)}function ZN(e,t){return Me(e,"default")?ct(e.default):!1}function YN(e,t){if(Me(e,"default"))return ct(e.default);{let r=lo(e.returns,t);return typeof r=="object"&&!Array.isArray(r)?class{constructor(){for(let[n,o]of Object.entries(r)){let i=this;i[n]=o}}}:class{}}}function JN(e,t){return Me(e,"default")?ct(e.default):e.minimumTimestamp!==void 0?new Date(e.minimumTimestamp):new Date}function qN(e,t){return Me(e,"default")?ct(e.default):()=>lo(e.returns,t)}function KN(e,t){return Me(e,"default")?ct(e.default):e.minimum!==void 0?e.minimum:0}function QN(e,t){if(Me(e,"default"))return ct(e.default);{let r=e.allOf.reduce((n,o)=>{let i=lo(o,t);return typeof i=="object"?{...n,...i}:i},{});if(!je(e,t,r))throw new ao(e,"Intersect produced invalid value. Consider using a default value.");return r}}function eG(e,t){return Me(e,"default")?ct(e.default):function*(){}()}function tG(e,t){return Me(e,"default")?ct(e.default):e.const}function rG(e,t){if(Me(e,"default"))return ct(e.default);throw new ao(e,"Never types cannot be created. Consider using a default value.")}function nG(e,t){if(Me(e,"default"))return ct(e.default);throw new ao(e,"Not types must have a default value")}function oG(e,t){return Me(e,"default")?ct(e.default):null}function iG(e,t){return Me(e,"default")?ct(e.default):e.minimum!==void 0?e.minimum:0}function sG(e,t){if(Me(e,"default"))return ct(e.default);{let r=new Set(e.required),n={};for(let[o,i]of Object.entries(e.properties))r.has(o)&&(n[o]=lo(i,t));return n}}function aG(e,t){return Me(e,"default")?ct(e.default):Promise.resolve(lo(e.item,t))}function lG(e,t){let[r,n]=Object.entries(e.patternProperties)[0];if(Me(e,"default"))return ct(e.default);if(r===oa||r===na)return{};{let o=r.slice(1,r.length-1).split("|"),i={};for(let s of o)i[s]=lo(n,t);return i}}function cG(e,t){return Me(e,"default")?ct(e.default):lo(at(e,t),t)}function pG(e,t){if(Me(e,"default"))return ct(e.default);throw new ao(e,"RegExp types cannot be created. Consider using a default value.")}function uG(e,t){if(e.pattern!==void 0){if(Me(e,"default"))return ct(e.default);throw new ao(e,"String types with patterns must specify a default value")}else if(e.format!==void 0){if(Me(e,"default"))return ct(e.default);throw new ao(e,"String types with formats must specify a default value")}else return Me(e,"default")?ct(e.default):e.minLength!==void 0?Array.from({length:e.minLength}).map(()=>" ").join(""):""}function dG(e,t){return Me(e,"default")?ct(e.default):"value"in e?Symbol.for(e.value):Symbol()}function fG(e,t){if(Me(e,"default"))return ct(e.default);if(!Db(e))throw new ao(e,"Can only create template literals that produce a finite variants. Consider using a default value.");return Eu(e)[0]}function mG(e,t){if(b4++>SG)throw new ao(e,"Cannot create recursive type as it appears possibly infinite. Consider using a default.");return Me(e,"default")?ct(e.default):lo(at(e,t),t)}function hG(e,t){return Me(e,"default")?ct(e.default):e.items===void 0?[]:Array.from({length:e.minItems}).map((r,n)=>lo(e.items[n],t))}function gG(e,t){if(Me(e,"default"))return ct(e.default)}function yG(e,t){if(Me(e,"default"))return ct(e.default);if(e.anyOf.length===0)throw new Error("ValueCreate.Union: Cannot create Union with zero variants");return lo(e.anyOf[0],t)}function bG(e,t){return Me(e,"default")?ct(e.default):e.minByteLength!==void 0?new Uint8Array(e.minByteLength):new Uint8Array(0)}function xG(e,t){return Me(e,"default")?ct(e.default):{}}function vG(e,t){if(Me(e,"default"))return ct(e.default)}function IG(e,t){if(Me(e,"default"))return ct(e.default);throw new Error("User defined types must specify a default value")}function lo(e,t){let r=Eo(e,t),n=e;switch(n[U]){case"Any":return WN(n,r);case"Array":return $N(n,r);case"AsyncIterator":return zN(n,r);case"BigInt":return XN(n,r);case"Boolean":return ZN(n,r);case"Constructor":return YN(n,r);case"Date":return JN(n,r);case"Function":return qN(n,r);case"Integer":return KN(n,r);case"Intersect":return QN(n,r);case"Iterator":return eG(n,r);case"Literal":return tG(n,r);case"Never":return rG(n,r);case"Not":return nG(n,r);case"Null":return oG(n,r);case"Number":return iG(n,r);case"Object":return sG(n,r);case"Promise":return aG(n,r);case"Record":return lG(n,r);case"Ref":return cG(n,r);case"RegExp":return pG(n,r);case"String":return uG(n,r);case"Symbol":return dG(n,r);case"TemplateLiteral":return fG(n,r);case"This":return mG(n,r);case"Tuple":return hG(n,r);case"Undefined":return gG(n,r);case"Union":return yG(n,r);case"Uint8Array":return bG(n,r);case"Unknown":return xG(n,r);case"Void":return vG(n,r);default:if(!Nr.Has(n[U]))throw new ao(n,"Unknown type");return IG(n,r)}}var SG=512,b4=0;function Fo(...e){return b4=0,e.length===2?lo(e[0],e[1]):lo(e[0],[])}var i1=class extends ve{constructor(t,r){super(r),this.schema=t}};function CG(e,t,r){if(e[U]==="Object"&&typeof r=="object"&&!Ks(r)){let n=e,o=Object.getOwnPropertyNames(r),i=Object.entries(n.properties),[s,l]=[1/i.length,i.length];return i.reduce((c,[p,d])=>{let m=d[U]==="Literal"&&d.const===r[p]?l:0,g=je(d,t,r[p])?s:0,x=o.includes(p)?s:0;return c+(m+g+x)},0)}else return je(e,t,r)?1:0}function TG(e,t,r){let n=e.anyOf.map(s=>at(s,t)),[o,i]=[n[0],0];for(let s of n){let l=CG(s,t,r);l>i&&(o=s,i=l)}return o}function MG(e,t,r){if("default"in e)return typeof r=="function"?e.default:lt(e.default);{let n=TG(e,t,r);return dI(n,t,r)}}function PG(e,t,r){return je(e,t,r)?lt(r):Fo(e,t)}function wG(e,t,r){return je(e,t,r)?r:Fo(e,t)}function OG(e,t,r){if(je(e,t,r))return lt(r);let n=ke(r)?lt(r):Fo(e,t),o=he(e.minItems)&&n.length<e.minItems?[...n,...Array.from({length:e.minItems-n.length},()=>null)]:n,s=(he(e.maxItems)&&o.length>e.maxItems?o.slice(0,e.maxItems):o).map(c=>as(e.items,t,c));if(e.uniqueItems!==!0)return s;let l=[...new Set(s)];if(!je(e,t,l))throw new i1(e,"Array cast produced invalid data due to uniqueItems constraint");return l}function _G(e,t,r){if(je(e,t,r))return Fo(e,t);let n=new Set(e.returns.required||[]),o=function(){};for(let[i,s]of Object.entries(e.returns.properties))!n.has(i)&&r.prototype[i]===void 0||(o.prototype[i]=as(s,t,r.prototype[i]));return o}function EG(e,t,r){let n=Fo(e,t),o=Be(n)&&Be(r)?{...n,...r}:r;return je(e,t,o)?o:Fo(e,t)}function DG(e,t,r){throw new i1(e,"Never types cannot be cast")}function FG(e,t,r){if(je(e,t,r))return r;if(r===null||typeof r!="object")return Fo(e,t);let n=new Set(e.required||[]),o={};for(let[i,s]of Object.entries(e.properties))!n.has(i)&&r[i]===void 0||(o[i]=as(s,t,r[i]));if(typeof e.additionalProperties=="object"){let i=Object.getOwnPropertyNames(e.properties);for(let s of Object.getOwnPropertyNames(r))i.includes(s)||(o[s]=as(e.additionalProperties,t,r[s]))}return o}function kG(e,t,r){if(je(e,t,r))return lt(r);if(r===null||typeof r!="object"||Array.isArray(r)||r instanceof Date)return Fo(e,t);let n=Object.getOwnPropertyNames(e.patternProperties)[0],o=e.patternProperties[n],i={};for(let[s,l]of Object.entries(r))i[s]=as(o,t,l);return i}function AG(e,t,r){return as(at(e,t),t,r)}function LG(e,t,r){return as(at(e,t),t,r)}function RG(e,t,r){return je(e,t,r)?lt(r):ke(r)?e.items===void 0?[]:e.items.map((n,o)=>as(n,t,r[o])):Fo(e,t)}function BG(e,t,r){return je(e,t,r)?lt(r):MG(e,t,r)}function as(e,t,r){let n=Qe(e.$id)?[...t,e]:t,o=e;switch(e[U]){case"Array":return OG(o,n,r);case"Constructor":return _G(o,n,r);case"Intersect":return EG(o,n,r);case"Never":return DG(o,n,r);case"Object":return FG(o,n,r);case"Record":return kG(o,n,r);case"Ref":return AG(o,n,r);case"This":return LG(o,n,r);case"Tuple":return RG(o,n,r);case"Union":return BG(o,n,r);case"Date":case"Symbol":case"Uint8Array":return PG(e,t,r);default:return wG(o,n,r)}}function dI(...e){return e.length===3?as(e[0],e[1],e[2]):as(e[0],[],e[1])}u();function NG(e){return fl(e)&&e[U]!=="Unsafe"}function GG(e,t,r){return ke(r)?r.map(n=>co(e.items,t,n)):r}function jG(e,t,r){let n=e.unevaluatedProperties,i=e.allOf.map(l=>co(l,t,lt(r))).reduce((l,c)=>Be(c)?{...l,...c}:c,{});if(!Be(r)||!Be(i)||!fl(n))return i;let s=Gr(e);for(let l of Object.getOwnPropertyNames(r))s.includes(l)||je(n,t,r[l])&&(i[l]=co(n,t,r[l]));return i}function UG(e,t,r){if(!Be(r)||ke(r))return r;let n=e.additionalProperties;for(let o of Object.getOwnPropertyNames(r)){if(Me(e.properties,o)){r[o]=co(e.properties[o],t,r[o]);continue}if(fl(n)&&je(n,t,r[o])){r[o]=co(n,t,r[o]);continue}delete r[o]}return r}function VG(e,t,r){if(!Be(r))return r;let n=e.additionalProperties,o=Object.getOwnPropertyNames(r),[i,s]=Object.entries(e.patternProperties)[0],l=new RegExp(i);for(let c of o){if(l.test(c)){r[c]=co(s,t,r[c]);continue}if(fl(n)&&je(n,t,r[c])){r[c]=co(n,t,r[c]);continue}delete r[c]}return r}function HG(e,t,r){return co(at(e,t),t,r)}function WG(e,t,r){return co(at(e,t),t,r)}function $G(e,t,r){if(!ke(r))return r;if(ar(e.items))return[];let n=Math.min(r.length,e.items.length);for(let o=0;o<n;o++)r[o]=co(e.items[o],t,r[o]);return r.length>n?r.slice(0,n):r}function zG(e,t,r){for(let n of e.anyOf)if(NG(n)&&je(n,t,r))return co(n,t,r);return r}function co(e,t,r){let n=Qe(e.$id)?[...t,e]:t,o=e;switch(o[U]){case"Array":return GG(o,n,r);case"Intersect":return jG(o,n,r);case"Object":return UG(o,n,r);case"Record":return VG(o,n,r);case"Ref":return HG(o,n,r);case"This":return WG(o,n,r);case"Tuple":return $G(o,n,r);case"Union":return zG(o,n,r);default:return r}}function s1(...e){return e.length===3?co(e[0],e[1],e[2]):co(e[0],[],e[1])}u();function a1(e){return Qe(e)&&!isNaN(e)&&!isNaN(parseFloat(e))}function XG(e){return Jr(e)||ts(e)||he(e)}function Qm(e){return e===!0||he(e)&&e===1||Jr(e)&&e===BigInt("1")||Qe(e)&&(e.toLowerCase()==="true"||e==="1")}function eh(e){return e===!1||he(e)&&(e===0||Object.is(e,-0))||Jr(e)&&e===BigInt("0")||Qe(e)&&(e.toLowerCase()==="false"||e==="0"||e==="-0")}function ZG(e){return Qe(e)&&/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i.test(e)}function YG(e){return Qe(e)&&/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)?$/i.test(e)}function JG(e){return Qe(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 qG(e){return Qe(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 KG(e){return Qe(e)&&/^\d\d\d\d-[0-1]\d-[0-3]\d$/i.test(e)}function QG(e,t){let r=v4(e);return r===t?r:e}function ej(e,t){let r=I4(e);return r===t?r:e}function tj(e,t){let r=x4(e);return r===t?r:e}function rj(e,t){return Qe(e.const)?QG(t,e.const):he(e.const)?ej(t,e.const):ts(e.const)?tj(t,e.const):t}function x4(e){return Qm(e)?!0:eh(e)?!1:e}function nj(e){let t=r=>r.split(".")[0];return a1(e)?BigInt(t(e)):he(e)?BigInt(Math.trunc(e)):eh(e)?BigInt(0):Qm(e)?BigInt(1):e}function v4(e){return XG(e)?e.toString():Qs(e)&&e.description!==void 0?e.description.toString():e}function I4(e){return a1(e)?parseFloat(e):Qm(e)?1:eh(e)?0:e}function oj(e){return a1(e)?parseInt(e):he(e)?e|0:Qm(e)?1:eh(e)?0:e}function ij(e){return Qe(e)&&e.toLowerCase()==="null"?null:e}function sj(e){return Qe(e)&&e==="undefined"?void 0:e}function aj(e){return Cn(e)?e:he(e)?new Date(e):Qm(e)?new Date(1):eh(e)?new Date(0):a1(e)?new Date(parseInt(e)):YG(e)?new Date(`1970-01-01T${e}.000Z`):ZG(e)?new Date(`1970-01-01T${e}`):qG(e)?new Date(`${e}.000Z`):JG(e)?new Date(e):KG(e)?new Date(`${e}T00:00:00.000Z`):e}function lj(e,t,r){return(ke(r)?r:[r]).map(o=>ls(e.items,t,o))}function cj(e,t,r){return nj(r)}function pj(e,t,r){return x4(r)}function uj(e,t,r){return aj(r)}function dj(e,t,r){return oj(r)}function fj(e,t,r){return e.allOf.reduce((n,o)=>ls(o,t,n),r)}function mj(e,t,r){return rj(e,r)}function hj(e,t,r){return ij(r)}function gj(e,t,r){return I4(r)}function yj(e,t,r){if(!Be(r))return r;for(let n of Object.getOwnPropertyNames(e.properties))Me(r,n)&&(r[n]=ls(e.properties[n],t,r[n]));return r}function bj(e,t,r){if(!Be(r))return r;let o=Object.getOwnPropertyNames(e.patternProperties)[0],i=e.patternProperties[o];for(let[s,l]of Object.entries(r))r[s]=ls(i,t,l);return r}function xj(e,t,r){return ls(at(e,t),t,r)}function vj(e,t,r){return v4(r)}function Ij(e,t,r){return Qe(r)||he(r)?Symbol(r):r}function Sj(e,t,r){return ls(at(e,t),t,r)}function Cj(e,t,r){return ke(r)&&!ar(e.items)?r.map((o,i)=>i<e.items.length?ls(e.items[i],t,o):o):r}function Tj(e,t,r){return sj(r)}function Mj(e,t,r){for(let n of e.anyOf){let o=ls(n,t,lt(r));if(je(n,t,o))return o}return r}function ls(e,t,r){let n=Eo(e,t),o=e;switch(e[U]){case"Array":return lj(o,n,r);case"BigInt":return cj(o,n,r);case"Boolean":return pj(o,n,r);case"Date":return uj(o,n,r);case"Integer":return dj(o,n,r);case"Intersect":return fj(o,n,r);case"Literal":return mj(o,n,r);case"Null":return hj(o,n,r);case"Number":return gj(o,n,r);case"Object":return yj(o,n,r);case"Record":return bj(o,n,r);case"Ref":return xj(o,n,r);case"String":return vj(o,n,r);case"Symbol":return Ij(o,n,r);case"This":return Sj(o,n,r);case"Tuple":return Cj(o,n,r);case"Undefined":return Tj(o,n,r);case"Union":return Mj(o,n,r);default:return r}}function l1(...e){return e.length===3?ls(e[0],e[1],e[2]):ls(e[0],[],e[1])}u();u();var zu=class extends ve{constructor(t,r,n){super("Unable to decode value as it does not match the expected schema"),this.schema=t,this.value=r,this.error=n}},Ec=class extends ve{constructor(t,r,n,o){super(o instanceof Error?o.message:"Unknown error"),this.schema=t,this.path=r,this.value=n,this.error=o}};function lr(e,t,r){try{return jt(e)?e[$t].Decode(r):r}catch(n){throw new Ec(e,t,r,n)}}function Pj(e,t,r,n){return ke(n)?lr(e,r,n.map((o,i)=>cs(e.items,t,`${r}/${i}`,o))):lr(e,r,n)}function wj(e,t,r,n){if(!Be(n)||qr(n))return lr(e,r,n);let o=gl(e),i=o.map(d=>d[0]),s={...n};for(let[d,m]of o)d in s&&(s[d]=cs(m,t,`${r}/${d}`,s[d]));if(!jt(e.unevaluatedProperties))return lr(e,r,s);let l=Object.getOwnPropertyNames(s),c=e.unevaluatedProperties,p={...s};for(let d of l)i.includes(d)||(p[d]=lr(c,`${r}/${d}`,p[d]));return lr(e,r,p)}function Oj(e,t,r,n){return lr(e,r,cs(e.not,t,r,n))}function _j(e,t,r,n){if(!Be(n))return lr(e,r,n);let o=Gr(e),i={...n};for(let p of o)Me(i,p)&&(ar(i[p])&&(!Mu(e.properties[p])||vt.IsExactOptionalProperty(i,p))||(i[p]=cs(e.properties[p],t,`${r}/${p}`,i[p])));if(!et(e.additionalProperties))return lr(e,r,i);let s=Object.getOwnPropertyNames(i),l=e.additionalProperties,c={...i};for(let p of s)o.includes(p)||(c[p]=lr(l,`${r}/${p}`,c[p]));return lr(e,r,c)}function Ej(e,t,r,n){if(!Be(n))return lr(e,r,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]=cs(e.patternProperties[o],t,`${r}/${d}`,s[d]));if(!et(e.additionalProperties))return lr(e,r,s);let l=Object.getOwnPropertyNames(s),c=e.additionalProperties,p={...s};for(let d of l)i.test(d)||(p[d]=lr(c,`${r}/${d}`,p[d]));return lr(e,r,p)}function Dj(e,t,r,n){let o=at(e,t);return lr(e,r,cs(o,t,r,n))}function Fj(e,t,r,n){let o=at(e,t);return lr(e,r,cs(o,t,r,n))}function kj(e,t,r,n){return ke(n)&&ke(e.items)?lr(e,r,e.items.map((o,i)=>cs(o,t,`${r}/${i}`,n[i]))):lr(e,r,n)}function Aj(e,t,r,n){for(let o of e.anyOf){if(!je(o,t,n))continue;let i=cs(o,t,r,n);return lr(e,r,i)}return lr(e,r,n)}function cs(e,t,r,n){let o=Eo(e,t),i=e;switch(e[U]){case"Array":return Pj(i,o,r,n);case"Intersect":return wj(i,o,r,n);case"Not":return Oj(i,o,r,n);case"Object":return _j(i,o,r,n);case"Record":return Ej(i,o,r,n);case"Ref":return Dj(i,o,r,n);case"Symbol":return lr(i,r,n);case"This":return Fj(i,o,r,n);case"Tuple":return kj(i,o,r,n);case"Union":return Aj(i,o,r,n);default:return lr(i,r,n)}}function Xu(e,t,r){return cs(e,t,"",r)}u();var Zu=class extends ve{constructor(t,r,n){super("The encoded value does not match the expected schema"),this.schema=t,this.value=r,this.error=n}},Dc=class extends ve{constructor(t,r,n,o){super(`${o instanceof Error?o.message:"Unknown error"}`),this.schema=t,this.path=r,this.value=n,this.error=o}};function gn(e,t,r){try{return jt(e)?e[$t].Encode(r):r}catch(n){throw new Dc(e,t,r,n)}}function Lj(e,t,r,n){let o=gn(e,r,n);return ke(o)?o.map((i,s)=>ps(e.items,t,`${r}/${s}`,i)):o}function Rj(e,t,r,n){let o=gn(e,r,n);if(!Be(n)||qr(n))return o;let i=gl(e),s=i.map(m=>m[0]),l={...o};for(let[m,g]of i)m in l&&(l[m]=ps(g,t,`${r}/${m}`,l[m]));if(!jt(e.unevaluatedProperties))return l;let c=Object.getOwnPropertyNames(l),p=e.unevaluatedProperties,d={...l};for(let m of c)s.includes(m)||(d[m]=gn(p,`${r}/${m}`,d[m]));return d}function Bj(e,t,r,n){return gn(e.not,r,gn(e,r,n))}function Nj(e,t,r,n){let o=gn(e,r,n);if(!Be(o))return o;let i=Gr(e),s={...o};for(let d of i)Me(s,d)&&(ar(s[d])&&(!Mu(e.properties[d])||vt.IsExactOptionalProperty(s,d))||(s[d]=ps(e.properties[d],t,`${r}/${d}`,s[d])));if(!et(e.additionalProperties))return s;let l=Object.getOwnPropertyNames(s),c=e.additionalProperties,p={...s};for(let d of l)i.includes(d)||(p[d]=gn(c,`${r}/${d}`,p[d]));return p}function Gj(e,t,r,n){let o=gn(e,r,n);if(!Be(n))return o;let i=Object.getOwnPropertyNames(e.patternProperties)[0],s=new RegExp(i),l={...o};for(let m of Object.getOwnPropertyNames(n))s.test(m)&&(l[m]=ps(e.patternProperties[i],t,`${r}/${m}`,l[m]));if(!et(e.additionalProperties))return l;let c=Object.getOwnPropertyNames(l),p=e.additionalProperties,d={...l};for(let m of c)s.test(m)||(d[m]=gn(p,`${r}/${m}`,d[m]));return d}function jj(e,t,r,n){let o=at(e,t),i=ps(o,t,r,n);return gn(e,r,i)}function Uj(e,t,r,n){let o=at(e,t),i=ps(o,t,r,n);return gn(e,r,i)}function Vj(e,t,r,n){let o=gn(e,r,n);return ke(e.items)?e.items.map((i,s)=>ps(i,t,`${r}/${s}`,o[s])):[]}function Hj(e,t,r,n){for(let o of e.anyOf){if(!je(o,t,n))continue;let i=ps(o,t,r,n);return gn(e,r,i)}for(let o of e.anyOf){let i=ps(o,t,r,n);if(je(e,t,i))return gn(e,r,i)}return gn(e,r,n)}function ps(e,t,r,n){let o=Eo(e,t),i=e;switch(e[U]){case"Array":return Lj(i,o,r,n);case"Intersect":return Rj(i,o,r,n);case"Not":return Bj(i,o,r,n);case"Object":return Nj(i,o,r,n);case"Record":return Gj(i,o,r,n);case"Ref":return jj(i,o,r,n);case"This":return Uj(i,o,r,n);case"Tuple":return Vj(i,o,r,n);case"Union":return Hj(i,o,r,n);default:return gn(i,r,n)}}function c1(e,t,r){return ps(e,t,"",r)}u();function Wj(e,t){return jt(e)||jr(e.items,t)}function $j(e,t){return jt(e)||jr(e.items,t)}function zj(e,t){return jt(e)||jr(e.returns,t)||e.parameters.some(r=>jr(r,t))}function Xj(e,t){return jt(e)||jr(e.returns,t)||e.parameters.some(r=>jr(r,t))}function Zj(e,t){return jt(e)||jt(e.unevaluatedProperties)||e.allOf.some(r=>jr(r,t))}function Yj(e,t){return jt(e)||jr(e.items,t)}function Jj(e,t){return jt(e)||jr(e.not,t)}function qj(e,t){return jt(e)||Object.values(e.properties).some(r=>jr(r,t))||et(e.additionalProperties)&&jr(e.additionalProperties,t)}function Kj(e,t){return jt(e)||jr(e.item,t)}function Qj(e,t){let r=Object.getOwnPropertyNames(e.patternProperties)[0],n=e.patternProperties[r];return jt(e)||jr(n,t)||et(e.additionalProperties)&&jt(e.additionalProperties)}function eU(e,t){return jt(e)?!0:jr(at(e,t),t)}function tU(e,t){return jt(e)?!0:jr(at(e,t),t)}function rU(e,t){return jt(e)||!ar(e.items)&&e.items.some(r=>jr(r,t))}function nU(e,t){return jt(e)||e.anyOf.some(r=>jr(r,t))}function jr(e,t){let r=Eo(e,t),n=e;if(e.$id&&fI.has(e.$id))return!1;switch(e.$id&&fI.add(e.$id),e[U]){case"Array":return Wj(n,r);case"AsyncIterator":return $j(n,r);case"Constructor":return zj(n,r);case"Function":return Xj(n,r);case"Intersect":return Zj(n,r);case"Iterator":return Yj(n,r);case"Not":return Jj(n,r);case"Object":return qj(n,r);case"Promise":return Kj(n,r);case"Record":return Qj(n,r);case"Ref":return eU(n,r);case"This":return tU(n,r);case"Tuple":return rU(n,r);case"Union":return nU(n,r);default:return jt(e)}}var fI=new Set;function us(e,t){return fI.clear(),jr(e,t)}function S4(...e){let[t,r,n]=e.length===3?[e[0],e[1],e[2]]:[e[0],[],e[1]];if(!je(t,r,n))throw new zu(t,n,ss(t,r,n).First());return us(t,r)?Xu(t,r,n):n}u();function pa(e,t){let r=Me(e,"default")?e.default:void 0,n=ul(r)?r():lt(r);return ar(t)?n:Be(t)&&Be(n)?Object.assign(n,t):t}function mI(e){return fl(e)&&"default"in e}function oU(e,t,r){let n=pa(e,r);if(!ke(n))return n;for(let o=0;o<n.length;o++)n[o]=po(e.items,t,n[o]);return n}function iU(e,t,r){return Cn(r)?r:pa(e,r)}function sU(e,t,r){let n=pa(e,r);return e.allOf.reduce((o,i)=>{let s=po(i,t,n);return Be(s)?{...o,...s}:s},{})}function aU(e,t,r){let n=pa(e,r);if(!Be(n))return n;let o=Object.getOwnPropertyNames(e.properties);for(let i of o){let s=po(e.properties[i],t,n[i]);ar(s)||(n[i]=po(e.properties[i],t,n[i]))}if(!mI(e.additionalProperties))return n;for(let i of Object.getOwnPropertyNames(n))o.includes(i)||(n[i]=po(e.additionalProperties,t,n[i]));return n}function lU(e,t,r){let n=pa(e,r);if(!Be(n))return n;let o=e.additionalProperties,[i,s]=Object.entries(e.patternProperties)[0],l=new RegExp(i);for(let c of Object.getOwnPropertyNames(n))l.test(c)&&mI(s)&&(n[c]=po(s,t,n[c]));if(!mI(o))return n;for(let c of Object.getOwnPropertyNames(n))l.test(c)||(n[c]=po(o,t,n[c]));return n}function cU(e,t,r){return po(at(e,t),t,pa(e,r))}function pU(e,t,r){return po(at(e,t),t,r)}function uU(e,t,r){let n=pa(e,r);if(!ke(n)||ar(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]=po(o[s],t,n[s]));return n}function dU(e,t,r){let n=pa(e,r);for(let o of e.anyOf){let i=po(o,t,lt(n));if(je(o,t,i))return i}return n}function po(e,t,r){let n=Eo(e,t),o=e;switch(o[U]){case"Array":return oU(o,n,r);case"Date":return iU(o,n,r);case"Intersect":return sU(o,n,r);case"Object":return aU(o,n,r);case"Record":return lU(o,n,r);case"Ref":return cU(o,n,r);case"This":return pU(o,n,r);case"Tuple":return uU(o,n,r);case"Union":return dU(o,n,r);default:return pa(o,r)}}function p1(...e){return e.length===3?po(e[0],e[1],e[2]):po(e[0],[],e[1])}u();u();var fi={};zs(fi,{Delete:()=>mU,Format:()=>th,Get:()=>gU,Has:()=>hU,Set:()=>fU,ValuePointerRootDeleteError:()=>d1,ValuePointerRootSetError:()=>u1});u();var u1=class extends ve{constructor(t,r,n){super("Cannot set root value"),this.value=t,this.path=r,this.update=n}},d1=class extends ve{constructor(t,r){super("Cannot delete root value"),this.value=t,this.path=r}};function C4(e){return e.indexOf("~")===-1?e:e.replace(/~1/g,"/").replace(/~0/g,"~")}function*th(e){if(e==="")return;let[t,r]=[0,0];for(let n=0;n<e.length;n++)e.charAt(n)==="/"?(n===0||(r=n,yield C4(e.slice(t,r))),t=n+1):r=n;yield C4(e.slice(t))}function fU(e,t,r){if(t==="")throw new u1(e,t,r);let[n,o,i]=[null,e,""];for(let s of th(t))o[s]===void 0&&(o[s]={}),n=o,o=o[s],i=s;n[i]=r}function mU(e,t){if(t==="")throw new d1(e,t);let[r,n,o]=[null,e,""];for(let i of th(t)){if(n[i]===void 0||n[i]===null)return;r=n,n=n[i],o=i}if(Array.isArray(r)){let i=parseInt(o);r.splice(i,1)}else delete r[o]}function hU(e,t){if(t==="")return!0;let[r,n,o]=[null,e,""];for(let i of th(t)){if(n[i]===void 0)return!1;r=n,n=n[i],o=i}return Object.getOwnPropertyNames(r).includes(o)}function gU(e,t){if(t==="")return e;let r=e;for(let n of th(t)){if(r[n]===void 0)return;r=r[n]}return r}u();function yU(e,t){if(!Be(t))return!1;let r=[...Object.keys(e),...Object.getOwnPropertySymbols(e)],n=[...Object.keys(t),...Object.getOwnPropertySymbols(t)];return r.length!==n.length?!1:r.every(o=>Fc(e[o],t[o]))}function bU(e,t){return Cn(t)&&e.getTime()===t.getTime()}function xU(e,t){return!ke(t)||e.length!==t.length?!1:e.every((r,n)=>Fc(r,t[n]))}function vU(e,t){return!Co(t)||e.length!==t.length||Object.getPrototypeOf(e).constructor.name!==Object.getPrototypeOf(t).constructor.name?!1:e.every((r,n)=>Fc(r,t[n]))}function IU(e,t){return e===t}function Fc(e,t){if(Cn(e))return bU(e,t);if(Co(e))return vU(e,t);if(ke(e))return xU(e,t);if(Be(e))return yU(e,t);if(qr(e))return IU(e,t);throw new Error("ValueEquals: Unable to compare value")}var SU=Ot({type:ht("insert"),path:Mo(),value:aa()}),CU=Ot({type:ht("update"),path:Mo(),value:aa()}),TU=Ot({type:ht("delete"),path:Mo()}),M4=Ct([SU,CU,TU]),f1=class extends ve{constructor(t,r){super(r),this.value=t}};function m1(e,t){return{type:"update",path:e,value:t}}function P4(e,t){return{type:"insert",path:e,value:t}}function w4(e){return{type:"delete",path:e}}function T4(e){if(globalThis.Object.getOwnPropertySymbols(e).length>0)throw new f1(e,"Cannot diff objects with symbols")}function*MU(e,t,r){if(T4(t),T4(r),!y2(r))return yield m1(e,r);let n=globalThis.Object.getOwnPropertyNames(t),o=globalThis.Object.getOwnPropertyNames(r);for(let i of o)Me(t,i)||(yield P4(`${e}/${i}`,r[i]));for(let i of n)Me(r,i)&&(Fc(t,r)||(yield*h1(`${e}/${i}`,t[i],r[i])));for(let i of n)Me(r,i)||(yield w4(`${e}/${i}`))}function*PU(e,t,r){if(!ke(r))return yield m1(e,r);for(let n=0;n<Math.min(t.length,r.length);n++)yield*h1(`${e}/${n}`,t[n],r[n]);for(let n=0;n<r.length;n++)n<t.length||(yield P4(`${e}/${n}`,r[n]));for(let n=t.length-1;n>=0;n--)n<r.length||(yield w4(`${e}/${n}`))}function*wU(e,t,r){if(!Co(r)||t.length!==r.length||globalThis.Object.getPrototypeOf(t).constructor.name!==globalThis.Object.getPrototypeOf(r).constructor.name)return yield m1(e,r);for(let n=0;n<Math.min(t.length,r.length);n++)yield*h1(`${e}/${n}`,t[n],r[n])}function*OU(e,t,r){t!==r&&(yield m1(e,r))}function*h1(e,t,r){if(y2(t))return yield*MU(e,t,r);if(ke(t))return yield*PU(e,t,r);if(Co(t))return yield*wU(e,t,r);if(qr(t))return yield*OU(e,t,r);throw new f1(t,"Unable to diff value")}function O4(e,t){return[...h1("",e,t)]}function _U(e){return e.length>0&&e[0].path===""&&e[0].type==="update"}function EU(e){return e.length===0}function _4(e,t){if(_U(t))return lt(t[0].value);if(EU(t))return lt(e);let r=lt(e);for(let n of t)switch(n.type){case"insert":{fi.Set(r,n.path,n.value);break}case"update":{fi.Set(r,n.path,n.value);break}case"delete":{fi.Delete(r,n.path);break}}return r}u();function E4(...e){let[t,r,n]=e.length===3?[e[0],e[1],e[2]]:[e[0],[],e[1]],o=us(t,r)?c1(t,r,n):n;if(!je(t,r,o))throw new Zu(t,o,ss(t,r,o).First());return o}u();var g1=class extends ve{constructor(t){super(t)}};function DU(e,t,r,n){if(!Be(r))fi.Set(e,t,lt(n));else{let o=Object.getOwnPropertyNames(r),i=Object.getOwnPropertyNames(n);for(let s of o)i.includes(s)||delete r[s];for(let s of i)o.includes(s)||(r[s]=null);for(let s of i)hI(e,`${t}/${s}`,r[s],n[s])}}function FU(e,t,r,n){if(!ke(r))fi.Set(e,t,lt(n));else{for(let o=0;o<n.length;o++)hI(e,`${t}/${o}`,r[o],n[o]);r.splice(n.length)}}function kU(e,t,r,n){if(Co(r)&&r.length===n.length)for(let o=0;o<r.length;o++)r[o]=n[o];else fi.Set(e,t,lt(n))}function AU(e,t,r,n){r!==n&&fi.Set(e,t,n)}function hI(e,t,r,n){if(ke(n))return FU(e,t,r,n);if(Co(n))return kU(e,t,r,n);if(Be(n))return DU(e,t,r,n);if(qr(n))return AU(e,t,r,n)}function D4(e){return Co(e)||qr(e)}function LU(e,t){return Be(e)&&ke(t)||ke(e)&&Be(t)}function F4(e,t){if(D4(e)||D4(t))throw new g1("Only object and array types can be mutated at the root level");if(LU(e,t))throw new g1("Cannot assign due type mismatch of assignable values");hI(e,"",e,t)}u();var RU=[(e,t,r)=>lt(r),(e,t,r)=>p1(e,t,r),(e,t,r)=>s1(e,t,r),(e,t,r)=>l1(e,t,r),(e,t,r)=>(o1(e,t,r),r),(e,t,r)=>us(e,t)?Xu(e,t,r):r];function k4(e,t,r){return RU.reduce((n,o)=>o(e,t,n),r)}function A4(...e){return e.length===3?k4(e[0],e[1],e[2]):k4(e[0],[],e[1])}u();var mi={};zs(mi,{Assert:()=>o1,Cast:()=>dI,Check:()=>je,Clean:()=>s1,Clone:()=>lt,Convert:()=>l1,Create:()=>Fo,Decode:()=>S4,Default:()=>p1,Diff:()=>O4,Edit:()=>M4,Encode:()=>E4,Equal:()=>Fc,Errors:()=>ss,Hash:()=>xl,Mutate:()=>F4,Parse:()=>A4,Patch:()=>_4,ValueErrorIterator:()=>Do});u();u();var L4={},BU=function(e,t,r,n,o){var i=new Worker(L4[t]||(L4[t]=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 l=s.data,c=l.$e$;if(c){var p=new Error(c[0]);p.code=c[1],p.stack=c[2],o(p,null)}else o(null,l)},i.postMessage(r,n),i},_t=Uint8Array,Pn=Uint16Array,ih=Int32Array,Qu=new _t([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]),ed=new _t([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]),rh=new _t([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),N4=function(e,t){for(var r=new Pn(31),n=0;n<31;++n)r[n]=t+=1<<e[n-1];for(var o=new ih(r[30]),n=1;n<30;++n)for(var i=r[n];i<r[n+1];++i)o[i]=i-r[n]<<5|n;return{b:r,r:o}},G4=N4(Qu,2),II=G4.b,I1=G4.r;II[28]=258,I1[258]=28;var j4=N4(ed,0),U4=j4.b,yI=j4.r,nh=new Pn(32768);for(gt=0;gt<32768;++gt)ua=(gt&43690)>>1|(gt&21845)<<1,ua=(ua&52428)>>2|(ua&13107)<<2,ua=(ua&61680)>>4|(ua&3855)<<4,nh[gt]=((ua&65280)>>8|(ua&255)<<8)>>1;var ua,gt,Ao=function(e,t,r){for(var n=e.length,o=0,i=new Pn(t);o<n;++o)e[o]&&++i[e[o]-1];var s=new Pn(t);for(o=1;o<t;++o)s[o]=s[o-1]+i[o-1]<<1;var l;if(r){l=new Pn(1<<t);var c=15-t;for(o=0;o<n;++o)if(e[o])for(var p=o<<4|e[o],d=t-e[o],m=s[e[o]-1]++<<d,g=m|(1<<d)-1;m<=g;++m)l[nh[m]>>c]=p}else for(l=new Pn(n),o=0;o<n;++o)e[o]&&(l[o]=nh[s[e[o]-1]++]>>15-e[o]);return l},da=new _t(288);for(gt=0;gt<144;++gt)da[gt]=8;var gt;for(gt=144;gt<256;++gt)da[gt]=9;var gt;for(gt=256;gt<280;++gt)da[gt]=7;var gt;for(gt=280;gt<288;++gt)da[gt]=8;var gt,qu=new _t(32);for(gt=0;gt<32;++gt)qu[gt]=5;var gt,V4=Ao(da,9,0),H4=Ao(da,9,1),W4=Ao(qu,5,0),$4=Ao(qu,5,1),b1=function(e){for(var t=e[0],r=1;r<e.length;++r)e[r]>t&&(t=e[r]);return t},ko=function(e,t,r){var n=t/8|0;return(e[n]|e[n+1]<<8)>>(t&7)&r},x1=function(e,t){var r=t/8|0;return(e[r]|e[r+1]<<8|e[r+2]<<16)>>(t&7)},sh=function(e){return(e+7)/8|0},vl=function(e,t,r){return(t==null||t<0)&&(t=0),(r==null||r>e.length)&&(r=e.length),new _t(e.subarray(t,r))},M1={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},z4=["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"],cr=function(e,t,r){var n=new Error(t||z4[e]);if(n.code=e,Error.captureStackTrace&&Error.captureStackTrace(n,cr),!r)throw n;return n},X4=function(e,t,r,n){var o=e.length,i=n?n.length:0;if(!o||t.f&&!t.l)return r||new _t(0);var s=!r,l=s||t.i!=2,c=t.i;s&&(r=new _t(o*3));var p=function(D){var ne=r.length;if(D>ne){var K=new _t(Math.max(ne*2,D));K.set(r),r=K}},d=t.f||0,m=t.p||0,g=t.b||0,x=t.l,v=t.d,C=t.m,I=t.n,S=o*8;do{if(!x){d=ko(e,m,1);var P=ko(e,m+1,3);if(m+=3,P)if(P==1)x=H4,v=$4,C=9,I=5;else if(P==2){var B=ko(e,m,31)+257,j=ko(e,m+10,15)+4,L=B+ko(e,m+5,31)+1;m+=14;for(var N=new _t(L),X=new _t(19),Z=0;Z<j;++Z)X[rh[Z]]=ko(e,m+Z*3,7);m+=j*3;for(var re=b1(X),Q=(1<<re)-1,xe=Ao(X,re,1),Z=0;Z<L;){var Ce=xe[ko(e,m,Q)];m+=Ce&15;var O=Ce>>4;if(O<16)N[Z++]=O;else{var ye=0,Ee=0;for(O==16?(Ee=3+ko(e,m,3),m+=2,ye=N[Z-1]):O==17?(Ee=3+ko(e,m,7),m+=3):O==18&&(Ee=11+ko(e,m,127),m+=7);Ee--;)N[Z++]=ye}}var we=N.subarray(0,B),pe=N.subarray(B);C=b1(we),I=b1(pe),x=Ao(we,C,1),v=Ao(pe,I,1)}else cr(1);else{var O=sh(m)+4,M=e[O-4]|e[O-3]<<8,E=O+M;if(E>o){c&&cr(0);break}l&&p(g+M),r.set(e.subarray(O,E),g),t.b=g+=M,t.p=m=E*8,t.f=d;continue}if(m>S){c&&cr(0);break}}l&&p(g+131072);for(var Ae=(1<<C)-1,mt=(1<<I)-1,Je=m;;Je=m){var ye=x[x1(e,m)&Ae],ut=ye>>4;if(m+=ye&15,m>S){c&&cr(0);break}if(ye||cr(2),ut<256)r[g++]=ut;else if(ut==256){Je=m,x=null;break}else{var qe=ut-254;if(ut>264){var Z=ut-257,Te=Qu[Z];qe=ko(e,m,(1<<Te)-1)+II[Z],m+=Te}var xt=v[x1(e,m)&mt],Pt=xt>>4;xt||cr(3),m+=xt&15;var pe=U4[Pt];if(Pt>3){var Te=ed[Pt];pe+=x1(e,m)&(1<<Te)-1,m+=Te}if(m>S){c&&cr(0);break}l&&p(g+131072);var nr=g+qe;if(g<pe){var k=i-pe,W=Math.min(pe,nr);for(k+g<0&&cr(3);g<W;++g)r[g]=n[k+g]}for(;g<nr;++g)r[g]=r[g-pe]}}t.l=x,t.p=Je,t.b=g,t.f=d,x&&(d=1,t.m=C,t.d=v,t.n=I)}while(!d);return g!=r.length&&s?vl(r,0,g):r.subarray(0,g)},ds=function(e,t,r){r<<=t&7;var n=t/8|0;e[n]|=r,e[n+1]|=r>>8},Yu=function(e,t,r){r<<=t&7;var n=t/8|0;e[n]|=r,e[n+1]|=r>>8,e[n+2]|=r>>16},v1=function(e,t){for(var r=[],n=0;n<e.length;++n)e[n]&&r.push({s:n,f:e[n]});var o=r.length,i=r.slice();if(!o)return{t:CI,l:0};if(o==1){var s=new _t(r[0].s+1);return s[r[0].s]=1,{t:s,l:1}}r.sort(function(E,B){return E.f-B.f}),r.push({s:-1,f:25001});var l=r[0],c=r[1],p=0,d=1,m=2;for(r[0]={s:-1,f:l.f+c.f,l,r:c};d!=o-1;)l=r[r[p].f<r[m].f?p++:m++],c=r[p!=d&&r[p].f<r[m].f?p++:m++],r[d++]={s:-1,f:l.f+c.f,l,r:c};for(var g=i[0].s,n=1;n<o;++n)i[n].s>g&&(g=i[n].s);var x=new Pn(g+1),v=S1(r[d-1],x,0);if(v>t){var n=0,C=0,I=v-t,S=1<<I;for(i.sort(function(B,j){return x[j.s]-x[B.s]||B.f-j.f});n<o;++n){var P=i[n].s;if(x[P]>t)C+=S-(1<<v-x[P]),x[P]=t;else break}for(C>>=I;C>0;){var O=i[n].s;x[O]<t?C-=1<<t-x[O]++-1:++n}for(;n>=0&&C;--n){var M=i[n].s;x[M]==t&&(--x[M],++C)}v=t}return{t:new _t(x),l:v}},S1=function(e,t,r){return e.s==-1?Math.max(S1(e.l,t,r+1),S1(e.r,t,r+1)):t[e.s]=r},bI=function(e){for(var t=e.length;t&&!e[--t];);for(var r=new Pn(++t),n=0,o=e[0],i=1,s=function(c){r[n++]=c},l=1;l<=t;++l)if(e[l]==o&&l!=t)++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[l]}return{c:r.subarray(0,n),n:t}},Ju=function(e,t){for(var r=0,n=0;n<t.length;++n)r+=e[n]*t[n];return r},SI=function(e,t,r){var n=r.length,o=sh(t+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]=r[i];return(o+4+n)*8},xI=function(e,t,r,n,o,i,s,l,c,p,d){ds(t,d++,r),++o[256];for(var m=v1(o,15),g=m.t,x=m.l,v=v1(i,15),C=v.t,I=v.l,S=bI(g),P=S.c,O=S.n,M=bI(C),E=M.c,B=M.n,j=new Pn(19),L=0;L<P.length;++L)++j[P[L]&31];for(var L=0;L<E.length;++L)++j[E[L]&31];for(var N=v1(j,7),X=N.t,Z=N.l,re=19;re>4&&!X[rh[re-1]];--re);var Q=p+5<<3,xe=Ju(o,da)+Ju(i,qu)+s,Ce=Ju(o,g)+Ju(i,C)+s+14+3*re+Ju(j,X)+2*j[16]+3*j[17]+7*j[18];if(c>=0&&Q<=xe&&Q<=Ce)return SI(t,d,e.subarray(c,c+p));var ye,Ee,we,pe;if(ds(t,d,1+(Ce<xe)),d+=2,Ce<xe){ye=Ao(g,x,0),Ee=g,we=Ao(C,I,0),pe=C;var Ae=Ao(X,Z,0);ds(t,d,O-257),ds(t,d+5,B-1),ds(t,d+10,re-4),d+=14;for(var L=0;L<re;++L)ds(t,d+3*L,X[rh[L]]);d+=3*re;for(var mt=[P,E],Je=0;Je<2;++Je)for(var ut=mt[Je],L=0;L<ut.length;++L){var qe=ut[L]&31;ds(t,d,Ae[qe]),d+=X[qe],qe>15&&(ds(t,d,ut[L]>>5&127),d+=ut[L]>>12)}}else ye=V4,Ee=da,we=W4,pe=qu;for(var L=0;L<l;++L){var Te=n[L];if(Te>255){var qe=Te>>18&31;Yu(t,d,ye[qe+257]),d+=Ee[qe+257],qe>7&&(ds(t,d,Te>>23&31),d+=Qu[qe]);var xt=Te&31;Yu(t,d,we[xt]),d+=pe[xt],xt>3&&(Yu(t,d,Te>>5&8191),d+=ed[xt])}else Yu(t,d,ye[Te]),d+=Ee[Te]}return Yu(t,d,ye[256]),d+Ee[256]},Z4=new ih([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),CI=new _t(0),Y4=function(e,t,r,n,o,i){var s=i.z||e.length,l=new _t(n+s+5*(1+Math.ceil(s/7e3))+o),c=l.subarray(n,l.length-o),p=i.l,d=(i.r||0)&7;if(t){d&&(c[0]=i.r>>3);for(var m=Z4[t-1],g=m>>13,x=m&8191,v=(1<<r)-1,C=i.p||new Pn(32768),I=i.h||new Pn(v+1),S=Math.ceil(r/3),P=2*S,O=function(ee){return(e[ee]^e[ee+1]<<S^e[ee+2]<<P)&v},M=new ih(25e3),E=new Pn(288),B=new Pn(32),j=0,L=0,N=i.i||0,X=0,Z=i.w||0,re=0;N+2<s;++N){var Q=O(N),xe=N&32767,Ce=I[Q];if(C[xe]=Ce,I[Q]=xe,Z<=N){var ye=s-N;if((j>7e3||X>24576)&&(ye>423||!p)){d=xI(e,c,0,M,E,B,L,X,re,N-re,d),X=j=L=0,re=N;for(var Ee=0;Ee<286;++Ee)E[Ee]=0;for(var Ee=0;Ee<30;++Ee)B[Ee]=0}var we=2,pe=0,Ae=x,mt=xe-Ce&32767;if(ye>2&&Q==O(N-mt))for(var Je=Math.min(g,ye)-1,ut=Math.min(32767,N),qe=Math.min(258,ye);mt<=ut&&--Ae&&xe!=Ce;){if(e[N+we]==e[N+we-mt]){for(var Te=0;Te<qe&&e[N+Te]==e[N+Te-mt];++Te);if(Te>we){if(we=Te,pe=mt,Te>Je)break;for(var xt=Math.min(mt,Te-2),Pt=0,Ee=0;Ee<xt;++Ee){var nr=N-mt+Ee&32767,k=C[nr],W=nr-k&32767;W>Pt&&(Pt=W,Ce=nr)}}}xe=Ce,Ce=C[xe],mt+=xe-Ce&32767}if(pe){M[X++]=268435456|I1[we]<<18|yI[pe];var D=I1[we]&31,ne=yI[pe]&31;L+=Qu[D]+ed[ne],++E[257+D],++B[ne],Z=N+we,++j}else M[X++]=e[N],++E[e[N]]}}for(N=Math.max(N,Z);N<s;++N)M[X++]=e[N],++E[e[N]];d=xI(e,c,p,M,E,B,L,X,re,N-re,d),p||(i.r=d&7|c[d/8|0]<<3,d-=7,i.h=I,i.p=C,i.i=N,i.w=Z)}else{for(var N=i.w||0;N<s+p;N+=65535){var K=N+65535;K>=s&&(c[d/8|0]=p,K=s),d=SI(c,d+1,e.subarray(N,K))}i.i=s}return vl(l,0,n+sh(d)+o)},NU=function(){for(var e=new Int32Array(256),t=0;t<256;++t){for(var r=t,n=9;--n;)r=(r&1&&-306674912)^r>>>1;e[t]=r}return e}(),J4=function(){var e=-1;return{p:function(t){for(var r=e,n=0;n<t.length;++n)r=NU[r&255^t[n]]^r>>>8;e=r},d:function(){return~e}}};var q4=function(e,t,r,n,o){if(!o&&(o={l:1},t.dictionary)){var i=t.dictionary.subarray(-32768),s=new _t(i.length+e.length);s.set(i),s.set(e,i.length),e=s,o.w=i.length}return Y4(e,t.level==null?6:t.level,t.mem==null?o.l?Math.ceil(Math.max(8,Math.min(13,Math.log(e.length)))*1.5):20:12+t.mem,r,n,o)},P1=function(e,t){var r={};for(var n in e)r[n]=e[n];for(var n in t)r[n]=t[n];return r},R4=function(e,t,r){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 l=n[s],c=i[s];if(typeof l=="function"){t+=";"+c+"=";var p=l.toString();if(l.prototype)if(p.indexOf("[native code]")!=-1){var d=p.indexOf(" ",8)+1;t+=p.slice(d,p.indexOf("(",d))}else{t+=p;for(var m in l.prototype)t+=";"+c+".prototype."+m+"="+l.prototype[m].toString()}else t+=p}else r[c]=l}return t},y1=[],GU=function(e){var t=[];for(var r in e)e[r].buffer&&t.push((e[r]=new e[r].constructor(e[r])).buffer);return t},jU=function(e,t,r,n){if(!y1[r]){for(var o="",i={},s=e.length-1,l=0;l<s;++l)o=R4(e[l],o,i);y1[r]={c:R4(e[s],o,i),e:i}}var c=P1({},y1[r].e);return BU(y1[r].c+";onmessage=function(e){for(var k in e.data)self[k]=e.data[k];onmessage="+t.toString()+"}",r,c,GU(c),n)},UU=function(){return[_t,Pn,ih,Qu,ed,rh,II,U4,H4,$4,nh,z4,Ao,b1,ko,x1,sh,vl,cr,X4,_1,w1,K4]},VU=function(){return[_t,Pn,ih,Qu,ed,rh,I1,yI,V4,da,W4,qu,nh,Z4,CI,Ao,ds,Yu,v1,S1,bI,Ju,SI,xI,sh,vl,Y4,q4,O1,w1]};var w1=function(e){return postMessage(e,[e.buffer])},K4=function(e){return e&&{out:e.size&&new _t(e.size),dictionary:e.dictionary}},Q4=function(e,t,r,n,o,i){var s=jU(r,n,o,function(l,c){s.terminate(),i(l,c)});return s.postMessage([e,t],t.consume?[e.buffer]:[]),function(){s.terminate()}};var hi=function(e,t){return e[t]|e[t+1]<<8},rn=function(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0},gI=function(e,t){return rn(e,t)+rn(e,t+4)*4294967296},tn=function(e,t,r){for(;r;++t)e[t]=r,r>>>=8};function HU(e,t,r){return r||(r=t,t={}),typeof r!="function"&&cr(7),Q4(e,t,[VU],function(n){return w1(O1(n.data[0],n.data[1]))},0,r)}function O1(e,t){return q4(e,t||{},0,0)}function WU(e,t,r){return r||(r=t,t={}),typeof r!="function"&&cr(7),Q4(e,t,[UU],function(n){return w1(_1(n.data[0],K4(n.data[1])))},1,r)}function _1(e,t){return X4(e,{i:2},t&&t.out,t&&t.dictionary)}var TI=function(e,t,r,n){for(var o in e){var i=e[o],s=t+o,l=n;Array.isArray(i)&&(l=P1(n,i[1]),i=i[0]),i instanceof _t?r[s]=[i,l]:(r[s+="/"]=[new _t(0),l],TI(i,s,r,n))}},B4=typeof TextEncoder<"u"&&new TextEncoder,vI=typeof TextDecoder<"u"&&new TextDecoder,$U=0;try{vI.decode(CI,{stream:!0}),$U=1}catch{}var zU=function(e){for(var t="",r=0;;){var n=e[r++],o=(n>127)+(n>223)+(n>239);if(r+o>e.length)return{s:t,r:vl(e,r-1)};o?o==3?(n=((n&15)<<18|(e[r++]&63)<<12|(e[r++]&63)<<6|e[r++]&63)-65536,t+=String.fromCharCode(55296|n>>10,56320|n&1023)):o&1?t+=String.fromCharCode((n&31)<<6|e[r++]&63):t+=String.fromCharCode((n&15)<<12|(e[r++]&63)<<6|e[r++]&63):t+=String.fromCharCode(n)}};function Ku(e,t){if(t){for(var r=new _t(e.length),n=0;n<e.length;++n)r[n]=e.charCodeAt(n);return r}if(B4)return B4.encode(e);for(var o=e.length,i=new _t(e.length+(e.length>>1)),s=0,l=function(d){i[s++]=d},n=0;n<o;++n){if(s+5>i.length){var c=new _t(s+8+(o-n<<1));c.set(i),i=c}var p=e.charCodeAt(n);p<128||t?l(p):p<2048?(l(192|p>>6),l(128|p&63)):p>55295&&p<57344?(p=65536+(p&1047552)|e.charCodeAt(++n)&1023,l(240|p>>18),l(128|p>>12&63),l(128|p>>6&63),l(128|p&63)):(l(224|p>>12),l(128|p>>6&63),l(128|p&63))}return vl(i,0,s)}function MI(e,t){if(t){for(var r="",n=0;n<e.length;n+=16384)r+=String.fromCharCode.apply(null,e.subarray(n,n+16384));return r}else{if(vI)return vI.decode(e);var o=zU(e),i=o.s,r=o.r;return r.length&&cr(8),i}}var ew=function(e,t){return t+30+hi(e,t+26)+hi(e,t+28)},tw=function(e,t,r){var n=hi(e,t+28),o=MI(e.subarray(t+46,t+46+n),!(hi(e,t+8)&2048)),i=t+46+n,s=rn(e,t+20),l=r&&s==4294967295?XU(e,i):[s,rn(e,t+24),rn(e,t+42)],c=l[0],p=l[1],d=l[2];return[hi(e,t+10),c,p,o,i+hi(e,t+30)+hi(e,t+32),d]},XU=function(e,t){for(;hi(e,t)!=1;t+=4+hi(e,t+2));return[gI(e,t+12),gI(e,t+4),gI(e,t+20)]},oh=function(e){var t=0;if(e)for(var r in e){var n=e[r].length;n>65535&&cr(9),t+=n+4}return t},C1=function(e,t,r,n,o,i,s,l){var c=n.length,p=r.extra,d=l&&l.length,m=oh(p);tn(e,t,s!=null?33639248:67324752),t+=4,s!=null&&(e[t++]=20,e[t++]=r.os),e[t]=20,t+=2,e[t++]=r.flag<<1|(i<0&&8),e[t++]=o&&8,e[t++]=r.compression&255,e[t++]=r.compression>>8;var g=new Date(r.mtime==null?Date.now():r.mtime),x=g.getFullYear()-1980;if((x<0||x>119)&&cr(10),tn(e,t,x<<25|g.getMonth()+1<<21|g.getDate()<<16|g.getHours()<<11|g.getMinutes()<<5|g.getSeconds()>>1),t+=4,i!=-1&&(tn(e,t,r.crc),tn(e,t+4,i<0?-i-2:i),tn(e,t+8,r.size)),tn(e,t+12,c),tn(e,t+14,m),t+=16,s!=null&&(tn(e,t,d),tn(e,t+6,r.attrs),tn(e,t+10,s),t+=14),e.set(n,t),t+=c,m)for(var v in p){var C=p[v],I=C.length;tn(e,t,+v),tn(e,t+2,I),e.set(C,t+4),t+=4+I}return d&&(e.set(l,t),t+=d),t},rw=function(e,t,r,n,o){tn(e,t,101010256),tn(e,t+8,r),tn(e,t+10,r),tn(e,t+12,n),tn(e,t+16,o)};function nw(e,t,r){r||(r=t,t={}),typeof r!="function"&&cr(7);var n={};TI(e,"",n,t);var o=Object.keys(n),i=o.length,s=0,l=0,c=i,p=new Array(i),d=[],m=function(){for(var I=0;I<d.length;++I)d[I]()},g=function(I,S){T1(function(){r(I,S)})};T1(function(){g=r});var x=function(){var I=new _t(l+22),S=s,P=l-s;l=0;for(var O=0;O<c;++O){var M=p[O];try{var E=M.c.length;C1(I,l,M,M.f,M.u,E);var B=30+M.f.length+oh(M.extra),j=l+B;I.set(M.c,j),C1(I,s,M,M.f,M.u,E,l,M.m),s+=16+B+(M.m?M.m.length:0),l=j+E}catch(L){return g(L,null)}}rw(I,s,p.length,P,S),g(null,I)};i||x();for(var v=function(I){var S=o[I],P=n[S],O=P[0],M=P[1],E=J4(),B=O.length;E.p(O);var j=Ku(S),L=j.length,N=M.comment,X=N&&Ku(N),Z=X&&X.length,re=oh(M.extra),Q=M.level==0?0:8,xe=function(Ce,ye){if(Ce)m(),g(Ce,null);else{var Ee=ye.length;p[I]=P1(M,{size:B,crc:E.d(),c:ye,f:j,m:X,u:L!=S.length||X&&N.length!=Z,compression:Q}),s+=30+L+re+Ee,l+=76+2*(L+re)+(Z||0)+Ee,--i||x()}};if(L>65535&&xe(cr(11,0,1),null),!Q)xe(null,O);else if(B<16e4)try{xe(null,O1(O,M))}catch(Ce){xe(Ce,null)}else d.push(HU(O,M,xe))},C=0;C<c;++C)v(C);return m}function ow(e,t){t||(t={});var r={},n=[];TI(e,"",r,t);var o=0,i=0;for(var s in r){var l=r[s],c=l[0],p=l[1],d=p.level==0?0:8,m=Ku(s),g=m.length,x=p.comment,v=x&&Ku(x),C=v&&v.length,I=oh(p.extra);g>65535&&cr(11);var S=d?O1(c,p):c,P=S.length,O=J4();O.p(c),n.push(P1(p,{size:c.length,crc:O.d(),c:S,f:m,m:v,u:g!=s.length||v&&x.length!=C,o,compression:d})),o+=30+g+I+P,i+=76+2*(g+I)+(C||0)+P}for(var M=new _t(i+22),E=o,B=i-o,j=0;j<n.length;++j){var m=n[j];C1(M,m.o,m,m.f,m.u,m.c.length);var L=30+m.f.length+oh(m.extra);M.set(m.c,m.o+L),C1(M,o,m,m.f,m.u,m.c.length,m.o,m.m),o+=16+L+(m.m?m.m.length:0)}return rw(M,o,n.length,B,E),M}var T1=typeof queueMicrotask=="function"?queueMicrotask:typeof setTimeout=="function"?setTimeout:function(e){e()};function iw(e,t,r){r||(r=t,t={}),typeof r!="function"&&cr(7);var n=[],o=function(){for(var I=0;I<n.length;++I)n[I]()},i={},s=function(I,S){T1(function(){r(I,S)})};T1(function(){s=r});for(var l=e.length-22;rn(e,l)!=101010256;--l)if(!l||e.length-l>65558)return s(cr(13,0,1),null),o;var c=hi(e,l+8);if(c){var p=c,d=rn(e,l+16),m=d==4294967295||p==65535;if(m){var g=rn(e,l-12);m=rn(e,g)==101075792,m&&(p=c=rn(e,g+32),d=rn(e,g+48))}for(var x=t&&t.filter,v=function(I){var S=tw(e,d,m),P=S[0],O=S[1],M=S[2],E=S[3],B=S[4],j=S[5],L=ew(e,j);d=B;var N=function(Z,re){Z?(o(),s(Z,null)):(re&&(i[E]=re),--c||s(null,i))};if(!x||x({name:E,size:O,originalSize:M,compression:P}))if(!P)N(null,vl(e,L,L+O));else if(P==8){var X=e.subarray(L,L+O);if(M<524288||O>.8*M)try{N(null,_1(X,{out:new _t(M)}))}catch(Z){N(Z,null)}else n.push(WU(X,{size:M},N))}else N(cr(14,"unknown compression type "+P,1),null);else N(null,null)},C=0;C<p;++C)v(C)}else s(null,{});return o}function sw(e,t){for(var r={},n=e.length-22;rn(e,n)!=101010256;--n)(!n||e.length-n>65558)&&cr(13);var o=hi(e,n+8);if(!o)return{};var i=rn(e,n+16),s=i==4294967295||o==65535;if(s){var l=rn(e,n-12);s=rn(e,l)==101075792,s&&(o=rn(e,l+32),i=rn(e,l+48))}for(var c=t&&t.filter,p=0;p<o;++p){var d=tw(e,i,s),m=d[0],g=d[1],x=d[2],v=d[3],C=d[4],I=d[5],S=ew(e,I);i=C,(!c||c({name:v,size:g,originalSize:x,compression:m}))&&(m?m==8?r[v]=_1(e.subarray(S,S+g),{out:new _t(x)}):cr(14,"unknown compression type "+m):r[v]=vl(e,S,S+g))}return r}u();var ZU=e=>{if(e!=null)return e.trim()===""?void 0:e},YU=e=>e!=null,E1=(e,t,r=0)=>{if(F.IsNull(e))return"null";if(F.IsUndefined(e))return"undefined";if(F.IsString(e))return"<string>";if(F.IsNumber(e))return"<number>";if(F.IsBoolean(e))return"<boolean>";if(F.IsLiteral(e))return typeof e.const=="string"?`'${e.const}'`:`${e.const}`;if(F.IsRef(e)){let n=t.find(o=>o.$id===e.$ref);return n==null?e.$ref:E1(n,t,r)}if(F.IsArray(e))return`${E1(e.items,t,r+1)}[]`;if(F.IsUnion(e)&&(!(e.anyOf.length>5)||e.$id==null)){let o=`${e.anyOf.map(i=>E1(i,t,r+1)).filter(YU).join(" | ")}`;return r>0?`(${o})`:o}return e.$id??""},JU=(e,t,r)=>{let n=t.message;return F.IsUnion(t.schema)&&(n=`Expected one of: ${E1(t.schema,r)}`),`${`#/definitions/${e}${ZU(t.path)??""}`}: ${n}`},D1=(e,t,r)=>{let n=t.First();if(n!=null)return JU(e,n,r)};var td;(function(e){e.Archive="Archive",e.Validate="Validate",e.Encode="Encode",e.Unknown="Unknown"})(td||(td={}));var rd=class extends Error{constructor(r,n){super(n);f(this,"name");f(this,"kind");this.name="CompressError",this.kind=r}},qU=e=>new rd(td.Archive,e.message),KU=e=>{let t=Object.values(M1);return e instanceof Error&&"code"in e&&typeof e.code=="number"&&t.includes(e.code)},QU=(e,t,r)=>new rd(td.Validate,D1(e,t,r)??"Unknown validate error"),eV=e=>new rd(td.Encode,e.message),tV=e=>new rd(td.Unknown,e instanceof Error?e.message:String(e)),ah=(e,t,r)=>t instanceof Dc?eV(t):t instanceof Do?QU(e,t,r):KU(t)?qU(t):tV(t);u();var nd;(function(e){e.Unarchive="Unarchive",e.Validate="Validate",e.Decode="Decode",e.Unknown="Unknown"})(nd||(nd={}));var od=class extends Error{constructor(r,n){super(n);f(this,"name");f(this,"kind");this.name="DecompressError",this.kind=r}},rV=e=>new od(nd.Unarchive,e.message),nV=e=>{let t=Object.values(M1);return e instanceof Error&&"code"in e&&typeof e.code=="number"&&t.includes(e.code)},oV=(e,t,r)=>new od(nd.Validate,D1(e,t,r)??"Unknown validate error"),iV=e=>new od(nd.Decode,e.message),sV=e=>new od(nd.Unknown,e instanceof Error?e.message:String(e)),lh=(e,t,r)=>t instanceof Ec?iV(t):t instanceof Do?oV(e,t,r):nV(t)?rV(t):sV(t);var aw=function*(e,t=""){if(e!=null){if(Array.isArray(e)){for(let r=0;r<e.length;r++)yield[t+`[${r}]`,e[r]];return}if("features"in e){for(let r=0;r<e.features.length;r++)yield[t===""?`features[${r}]`:`${t}.features[${r}]`,e.features[r]];return}for(let[r,n]of Object.entries(e)){let o=t===""?r:`${t}.${r}`;yield*aw(n,o)}}},aV=(e,t)=>e===""?t:t.startsWith("[")?`${e}${t}`:`${e}.${t}`,hr=(e,t,r)=>{let n=new Set;for(let[o,i]of aw(e)){let s=t(i);if(n.has(s))return ae({kind:Vn.DuplicateIdError,properties:{id:s,path:aV(r,o)}});n.add(s)}return ie(!0)};var lw=e=>e.floors==null?ae({kind:Vn.FloorMissingError,properties:null}):hr(e.floors.features,t=>t.properties.id,"floors");var cw=b.Intersect([b.Object({id:b.Ref(Ze),elevation:b.Integer({description:"An ordinal representing the elevation of this map relative to other maps in the stack."}),subtitle:b.Optional(b.String({description:"The subtitle of the floor."}))}),io],{$id:"FloorProperties"}),pw=Kr(b.Union([b.Ref(Uu),b.Ref(Vu),b.Null()]),b.Ref(cw),{$id:"FloorFeature"}),uw=Mn(b.Ref(pw),{$id:"FloorCollection"}),lV=b.Object({floors:b.Ref(uw)}),dw={name:"core:floors",intoBundle:function*(e){e.floors!=null&&(yield{path:"floors.geojson",contents:e.floors})},fromBundle:(e,t,r)=>{if(e==="floors.geojson")return{floors:r(t)}},integrityCheck:lw,schema:lV,references:[cw,pw,uw]};u();u();var gr=e=>b.Unsafe(e);u();var rt=e=>Object.keys(e);u();u();var cV=e=>new Map(e.floors?.features.map(t=>[t.properties.id,t])??[]),gi=e=>{let t=cV(e);return n=>{let o=t.get(n);return o==null?ae({kind:Vn.UnknownFloorError,properties:{floorId:n}}):ie(o)}};var fw=e=>{if(e.floors==null)return ae({kind:Vn.FloorMissingError,properties:null});if(e.geometry==null)return ae({kind:Vn.GeometryMissingError,properties:null});let t=hr(e.geometry,n=>n.properties.id,"geometry");if(t.isErr())return t;let r=gi(e);for(let n of rt(e.geometry)){let o=r(n);if(o.isErr())return o}return ie(!0)};var mw=b.Intersect([b.Object({id:b.Ref(mn)}),io],{$id:"GeometryProperties"}),hw=Kr(b.Union([b.Ref(fn),b.Ref(Yb),b.Ref(Jb),b.Ref(qb),b.Ref(Uu),b.Ref(Vu)]),b.Ref(mw),{$id:"GeometryFeature"}),gw=Mn(b.Ref(hw),{$id:"GeometryCollection"}),pV=b.Object({geometry:gr(b.Record(Ze,b.Ref(gw),{additionalProperties:!1}))},{$id:"GeometrySchema"}),uV=/^geometry\/(.*)\.geojson$/,yw={name:"core:geometry",schema:pV,intoBundle:function*(e){if(e.geometry!=null)for(let t of rt(e.geometry))yield{path:`geometry/${t}.geojson`,contents:e.geometry[t]}},fromBundle:(e,t,r)=>{let n=e.match(uV)?.[1];if(n)return{geometry:{[n]:r(t)}}},references:[mw,hw,gw],integrityCheck:fw};u();var PI=b.Object({type:b.Literal("file"),name:b.String({description:"The name of the file."})},{$id:"ManifestFile"}),bw=b.Recursive(e=>b.Object({type:b.Literal("folder"),name:b.String({description:"The name of the folder."}),children:b.Array(b.Union([e,b.Ref(PI)]),{minItems:1,description:"The children of the folder."})}),{$id:"ManifestFolder"}),xw=b.Object({name:b.String({description:"The name of the map."}),version:b.Literal("3.0.0",{description:"The version of the manifest."}),orgId:b.Optional(b.String({description:"The identifier of the organization that the map this MVF is for belongs to."})),mapId:b.Optional(b.String({description:"The identifier of the map that this MVF is for."})),contents:b.Array(b.Union([b.Ref(bw),b.Ref(PI)]),{minItems:1,description:"The contents of the MVF bundle."}),time:b.String({format:"date-time",description:"An ISO 8601 date-time string, including timezone offset."}),tzid:b.Optional(b.Unsafe(b.String({description:"A valid IANA timezone identifier.",pattern:"^[A-Za-z0-9_-]+/[A-Za-z0-9_-]+$"}))),naturalBearing:b.Optional(b.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:b.Optional(b.Ref(Ze,{description:"The default floor ID of the map."})),language:b.Optional(b.String({description:"The language code of the map."}))},{$id:"ManifestProperties"}),vw=Mn(Kr(fn,b.Ref(xw)),{$id:"ManifestCollection"},{minItems:1,maxItems:1}),dV=b.Object({manifest:b.Ref(vw)}),Iw={name:"core:manifest",intoBundle:function*(e){e.manifest!=null&&(yield{path:"manifest.geojson",contents:e.manifest})},fromBundle:(e,t,r)=>{if(e==="manifest.geojson")return{manifest:r(t)}},schema:dV,references:[PI,bw,xw,vw]};u();u();u();u();var wI=class extends ve{constructor(r){super(`Unable to dereference schema with $id '${r.$ref}'`);f(this,"schema");this.schema=r}};function fV(e,t){let r=t.find(n=>n.$id===e.$ref);if(r===void 0)throw new wI(e);return kc(r,t)}function F1(e,t){return!ot.IsString(e.$id)||t.some(r=>r.$id===e.$id)||t.push(e),t}function kc(e,t){return e[U]==="This"||e[U]==="Ref"?fV(e,t):e}u();function mV(e,t,r){let n=e.get(t);if(n!==void 0)return n;let o=us(t,r);return e.set(t,o),o}function k1(){let e=new WeakMap;return{HasTransform:(t,r)=>mV(e,t,r)}}function pr(e,t,r){try{return F.IsTransform(e)?e[$t].Decode(r):r}catch(n){throw new Ec(e,t,r,n)}}function hV(e,t,r,n,o){return ot.IsArray(n)?pr(e,r,n.map((i,s)=>fs(e.items,t,`${r}/${s}`,i,o))):pr(e,r,n)}function gV(e,t,r,n,o){if(!ot.IsObject(n)||qr(n))return pr(e,r,n);let i=gl(e),s=i.map(m=>m[0]),l={...n};for(let[m,g]of i)m in l&&(l[m]=fs(g,t,`${r}/${m}`,l[m],o));if(!F.IsTransform(e.unevaluatedProperties))return pr(e,r,l);let c=Object.getOwnPropertyNames(l),p=e.unevaluatedProperties,d={...l};for(let m of c)s.includes(m)||(d[m]=pr(p,`${r}/${m}`,d[m]));return pr(e,r,d)}function yV(e,t,r,n,o){return pr(e,r,fs(e.not,t,r,n,o))}function bV(e,t,r,n,o){if(!ot.IsObject(n))return pr(e,r,n);let i=Gr(e),s={...n};for(let d of i)ot.HasPropertyKey(s,d)&&(ot.IsUndefined(s[d])&&(!F.IsUndefined(e.properties[d])||vt.IsExactOptionalProperty(s,d))||(s[d]=fs(e.properties[d],t,`${r}/${d}`,s[d],o)));if(!F.IsSchema(e.additionalProperties))return pr(e,r,s);let l=Object.getOwnPropertyNames(s),c=e.additionalProperties,p={...s};for(let d of l)i.includes(d)||(p[d]=pr(c,`${r}/${d}`,p[d]));return pr(e,r,p)}function xV(e,t,r,n,o){if(!ot.IsObject(n))return pr(e,r,n);let i=Object.getOwnPropertyNames(e.patternProperties)[0],s=new RegExp(i),l={...n};for(let m of Object.getOwnPropertyNames(n))s.test(m)&&(l[m]=fs(e.patternProperties[i],t,`${r}/${m}`,l[m],o));if(!F.IsSchema(e.additionalProperties))return pr(e,r,l);let c=Object.getOwnPropertyNames(l),p=e.additionalProperties,d={...l};for(let m of c)s.test(m)||(d[m]=pr(p,`${r}/${m}`,d[m]));return pr(e,r,d)}function vV(e,t,r,n,o){let i=kc(e,t);return pr(e,r,fs(i,t,r,n,o))}function IV(e,t,r,n,o){let i=kc(e,t);return pr(e,r,fs(i,t,r,n,o))}function SV(e,t,r,n,o){return ot.IsArray(n)&&ot.IsArray(e.items)?pr(e,r,e.items.map((i,s)=>fs(i,t,`${r}/${s}`,n[s],o))):pr(e,r,n)}function CV(e,t,r,n,o){for(let i of e.anyOf){if(!mi.Check(i,t,n))continue;let s=fs(i,t,r,n,o);return pr(e,r,s)}return pr(e,r,n)}function fs(e,t,r,n,o){if(!o.HasTransform(e,t))return n;let i=F1(e,t),s=e;switch(e[U]){case"Array":return hV(s,i,r,n,o);case"Intersect":return gV(s,i,r,n,o);case"Not":return yV(s,i,r,n,o);case"Object":return bV(s,i,r,n,o);case"Record":return xV(s,i,r,n,o);case"Ref":return vV(s,i,r,n,o);case"Symbol":return pr(s,r,n);case"This":return IV(s,i,r,n,o);case"Tuple":return SV(s,i,r,n,o);case"Union":return CV(s,i,r,n,o);default:return pr(s,r,n)}}function Sw(e,t,r){let n=k1();return fs(e,t,"",r,n)}u();function yn(e,t,r){try{return F.IsTransform(e)?e[$t].Encode(r):r}catch(n){throw new Dc(e,t,r,n)}}function TV(e,t,r,n,o){let i=yn(e,r,n);return ot.IsArray(i)?i.map((s,l)=>ms(e.items,t,`${r}/${l}`,s,o)):i}function MV(e,t,r,n,o){let i=yn(e,r,n);if(!ot.IsObject(n)||qr(n))return i;let s=gl(e),l=s.map(g=>g[0]),c={...i};for(let[g,x]of s)g in c&&(c[g]=ms(x,t,`${r}/${g}`,c[g],o));if(!F.IsTransform(e.unevaluatedProperties))return c;let p=Object.getOwnPropertyNames(c),d=e.unevaluatedProperties,m={...c};for(let g of p)l.includes(g)||(m[g]=yn(d,`${r}/${g}`,m[g]));return m}function PV(e,t,r,n){return yn(e.not,r,yn(e,r,n))}function wV(e,t,r,n,o){let i=yn(e,r,n);if(!ot.IsObject(i))return i;let s=Gr(e),l={...i};for(let m of s)ot.HasPropertyKey(l,m)&&(ot.IsUndefined(l[m])&&(!F.IsUndefined(e.properties[m])||vt.IsExactOptionalProperty(l,m))||(l[m]=ms(e.properties[m],t,`${r}/${m}`,l[m],o)));if(!F.IsSchema(e.additionalProperties))return l;let c=Object.getOwnPropertyNames(l),p=e.additionalProperties,d={...l};for(let m of c)s.includes(m)||(d[m]=yn(p,`${r}/${m}`,d[m]));return d}function OV(e,t,r,n,o){let i=yn(e,r,n);if(!ot.IsObject(n))return i;let s=Object.getOwnPropertyNames(e.patternProperties)[0],l=new RegExp(s),c={...i};for(let g of Object.getOwnPropertyNames(n))l.test(g)&&(c[g]=ms(e.patternProperties[s],t,`${r}/${g}`,c[g],o));if(!F.IsSchema(e.additionalProperties))return c;let p=Object.getOwnPropertyNames(c),d=e.additionalProperties,m={...c};for(let g of p)l.test(g)||(m[g]=yn(d,`${r}/${g}`,m[g]));return m}function _V(e,t,r,n,o){let i=kc(e,t),s=ms(i,t,r,n,o);return yn(e,r,s)}function EV(e,t,r,n,o){let i=kc(e,t),s=ms(i,t,r,n,o);return yn(e,r,s)}function DV(e,t,r,n,o){let i=yn(e,r,n);return ot.IsArray(e.items)?e.items.map((s,l)=>ms(s,t,`${r}/${l}`,i[l],o)):[]}function FV(e,t,r,n,o){for(let i of e.anyOf){if(!mi.Check(i,t,n))continue;let s=ms(i,t,r,n,o);return yn(e,r,s)}for(let i of e.anyOf){let s=ms(i,t,r,n,o);if(mi.Check(e,t,s))return yn(e,r,s)}return yn(e,r,n)}function ms(e,t,r,n,o){if(!o.HasTransform(e,t))return n;let i=F1(e,t),s=e;switch(e[U]){case"Array":return TV(s,i,r,n,o);case"Intersect":return MV(s,i,r,n,o);case"Not":return PV(s,i,r,n);case"Object":return wV(s,i,r,n,o);case"Record":return OV(s,i,r,n,o);case"Ref":return _V(s,i,r,n,o);case"This":return EV(s,i,r,n,o);case"Tuple":return DV(s,i,r,n,o);case"Union":return FV(s,i,r,n,o);default:return yn(s,r,n)}}function Cw(e,t,r){let n=k1();return ms(e,t,"",r,n)}u();var OI=class{constructor(t,r,n,o){this.schema=t,this.references=r,this.checkFunc=n,this.code=o,this.hasTransform=us(t,r)}Code(){return this.code}Errors(t){return ss(this.schema,this.references,t)}Check(t){return this.checkFunc(t)}Decode(t){if(!this.checkFunc(t))throw new zu(this.schema,t,this.Errors(t).First());return this.hasTransform?Xu(this.schema,this.references,t):t}Encode(t){let r=this.hasTransform?c1(this.schema,this.references,t):t;if(!this.checkFunc(r))throw new Zu(this.schema,t,this.Errors(t).First());return r}},fa;(function(e){function t(i){return i===36}e.DollarSign=t;function r(i){return i===95}e.IsUnderscore=r;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})(fa||(fa={}));var A1;(function(e){function t(i){return i.length===0?!1:fa.IsNumeric(i.charCodeAt(0))}function r(i){if(t(i))return!1;for(let s=0;s<i.length;s++){let l=i.charCodeAt(s);if(!(fa.IsAlpha(l)||fa.IsNumeric(l)||fa.DollarSign(l)||fa.IsUnderscore(l)))return!1}return!0}function n(i){return i.replace(/'/g,"\\'")}function o(i,s){return r(s)?`${i}.${s}`:`${i}['${n(s)}']`}e.Encode=o})(A1||(A1={}));var _I;(function(e){function t(r){let n=[];for(let o=0;o<r.length;o++){let i=r.charCodeAt(o);fa.IsNumeric(i)||fa.IsAlpha(i)?n.push(r.charAt(o)):n.push(`_${i}_`)}return n.join("").replace(/__/g,"_")}e.Encode=t})(_I||(_I={}));var EI;(function(e){function t(r){return r.replace(/'/g,"\\'")}e.Escape=t})(EI||(EI={}));var DI=class extends ve{constructor(t){super("Unknown type"),this.schema=t}},L1=class extends ve{constructor(t){super("Preflight validation check failed to guard for the given schema"),this.schema=t}},Ac;(function(e){function t(s,l,c){return vt.ExactOptionalPropertyTypes?`('${l}' in ${s} ? ${c} : true)`:`(${A1.Encode(s,l)} !== undefined ? ${c} : true)`}e.IsExactOptionalProperty=t;function r(s){return vt.AllowArrayObject?`(typeof ${s} === 'object' && ${s} !== null)`:`(typeof ${s} === 'object' && ${s} !== null && !Array.isArray(${s}))`}e.IsObjectLike=r;function n(s){return vt.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 vt.AllowNaN?`typeof ${s} === 'number'`:`Number.isFinite(${s})`}e.IsNumberLike=o;function i(s){return vt.AllowNullVoid?`(${s} === undefined || ${s} === null)`:`${s} === undefined`}e.IsVoidLike=i})(Ac||(Ac={}));var R1;(function(e){function t(k){return k[U]==="Any"||k[U]==="Unknown"}function*r(k,W,D){yield"true"}function*n(k,W,D){yield`Array.isArray(${D})`;let[ne,K]=[qe("value","any"),qe("acc","number")];he(k.maxItems)&&(yield`${D}.length <= ${k.maxItems}`),he(k.minItems)&&(yield`${D}.length >= ${k.minItems}`);let ee=Ae(k.items,W,"value");if(yield`${D}.every((${ne}) => ${ee})`,et(k.contains)||he(k.minContains)||he(k.maxContains)){let Le=et(k.contains)?k.contains:St(),Ft=Ae(Le,W,"value"),In=he(k.minContains)?[`(count >= ${k.minContains})`]:[],Yr=he(k.maxContains)?[`(count <= ${k.maxContains})`]:[],pn=`const count = value.reduce((${K}, ${ne}) => ${Ft} ? acc + 1 : acc, 0)`,dc=["(count > 0)",...In,...Yr].join(" && ");yield`((${ne}) => { ${pn}; return ${dc}})(${D})`}k.uniqueItems===!0&&(yield`((${ne}) => { 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 } )(${D})`)}function*o(k,W,D){yield`(typeof value === 'object' && Symbol.asyncIterator in ${D})`}function*i(k,W,D){yield`(typeof ${D} === 'bigint')`,Jr(k.exclusiveMaximum)&&(yield`${D} < BigInt(${k.exclusiveMaximum})`),Jr(k.exclusiveMinimum)&&(yield`${D} > BigInt(${k.exclusiveMinimum})`),Jr(k.maximum)&&(yield`${D} <= BigInt(${k.maximum})`),Jr(k.minimum)&&(yield`${D} >= BigInt(${k.minimum})`),Jr(k.multipleOf)&&(yield`(${D} % BigInt(${k.multipleOf})) === 0`)}function*s(k,W,D){yield`(typeof ${D} === 'boolean')`}function*l(k,W,D){yield*we(k.returns,W,`${D}.prototype`)}function*c(k,W,D){yield`(${D} instanceof Date) && Number.isFinite(${D}.getTime())`,he(k.exclusiveMaximumTimestamp)&&(yield`${D}.getTime() < ${k.exclusiveMaximumTimestamp}`),he(k.exclusiveMinimumTimestamp)&&(yield`${D}.getTime() > ${k.exclusiveMinimumTimestamp}`),he(k.maximumTimestamp)&&(yield`${D}.getTime() <= ${k.maximumTimestamp}`),he(k.minimumTimestamp)&&(yield`${D}.getTime() >= ${k.minimumTimestamp}`),he(k.multipleOfTimestamp)&&(yield`(${D}.getTime() % ${k.multipleOfTimestamp}) === 0`)}function*p(k,W,D){yield`(typeof ${D} === 'function')`}function*d(k,W,D){yield`Number.isInteger(${D})`,he(k.exclusiveMaximum)&&(yield`${D} < ${k.exclusiveMaximum}`),he(k.exclusiveMinimum)&&(yield`${D} > ${k.exclusiveMinimum}`),he(k.maximum)&&(yield`${D} <= ${k.maximum}`),he(k.minimum)&&(yield`${D} >= ${k.minimum}`),he(k.multipleOf)&&(yield`(${D} % ${k.multipleOf}) === 0`)}function*m(k,W,D){let ne=k.allOf.map(K=>Ae(K,W,D)).join(" && ");if(k.unevaluatedProperties===!1){let K=Je(`${new RegExp(sa(k))};`),ee=`Object.getOwnPropertyNames(${D}).every(key => ${K}.test(key))`;yield`(${ne} && ${ee})`}else if(et(k.unevaluatedProperties)){let K=Je(`${new RegExp(sa(k))};`),ee=`Object.getOwnPropertyNames(${D}).every(key => ${K}.test(key) || ${Ae(k.unevaluatedProperties,W,`${D}[key]`)})`;yield`(${ne} && ${ee})`}else yield`(${ne})`}function*g(k,W,D){yield`(typeof value === 'object' && Symbol.iterator in ${D})`}function*x(k,W,D){typeof k.const=="number"||typeof k.const=="boolean"?yield`(${D} === ${k.const})`:yield`(${D} === '${EI.Escape(k.const)}')`}function*v(k,W,D){yield"false"}function*C(k,W,D){yield`(!${Ae(k.not,W,D)})`}function*I(k,W,D){yield`(${D} === null)`}function*S(k,W,D){yield Ac.IsNumberLike(D),he(k.exclusiveMaximum)&&(yield`${D} < ${k.exclusiveMaximum}`),he(k.exclusiveMinimum)&&(yield`${D} > ${k.exclusiveMinimum}`),he(k.maximum)&&(yield`${D} <= ${k.maximum}`),he(k.minimum)&&(yield`${D} >= ${k.minimum}`),he(k.multipleOf)&&(yield`(${D} % ${k.multipleOf}) === 0`)}function*P(k,W,D){yield Ac.IsObjectLike(D),he(k.minProperties)&&(yield`Object.getOwnPropertyNames(${D}).length >= ${k.minProperties}`),he(k.maxProperties)&&(yield`Object.getOwnPropertyNames(${D}).length <= ${k.maxProperties}`);let ne=Object.getOwnPropertyNames(k.properties);for(let K of ne){let ee=A1.Encode(D,K),Le=k.properties[K];if(k.required&&k.required.includes(K))yield*we(Le,W,ee),(la(Le)||t(Le))&&(yield`('${K}' in ${D})`);else{let Ft=Ae(Le,W,ee);yield Ac.IsExactOptionalProperty(D,K,Ft)}}if(k.additionalProperties===!1)if(k.required&&k.required.length===ne.length)yield`Object.getOwnPropertyNames(${D}).length === ${ne.length}`;else{let K=`[${ne.map(ee=>`'${ee}'`).join(", ")}]`;yield`Object.getOwnPropertyNames(${D}).every(key => ${K}.includes(key))`}if(typeof k.additionalProperties=="object"){let K=Ae(k.additionalProperties,W,`${D}[key]`),ee=`[${ne.map(Le=>`'${Le}'`).join(", ")}]`;yield`(Object.getOwnPropertyNames(${D}).every(key => ${ee}.includes(key) || ${K}))`}}function*O(k,W,D){yield`(typeof value === 'object' && typeof ${D}.then === 'function')`}function*M(k,W,D){yield Ac.IsRecordLike(D),he(k.minProperties)&&(yield`Object.getOwnPropertyNames(${D}).length >= ${k.minProperties}`),he(k.maxProperties)&&(yield`Object.getOwnPropertyNames(${D}).length <= ${k.maxProperties}`);let[ne,K]=Object.entries(k.patternProperties)[0],ee=Je(`${new RegExp(ne)}`),Le=Ae(K,W,"value"),Ft=et(k.additionalProperties)?Ae(k.additionalProperties,W,D):k.additionalProperties===!1?"false":"true",In=`(${ee}.test(key) ? ${Le} : ${Ft})`;yield`(Object.entries(${D}).every(([key, value]) => ${In}))`}function*E(k,W,D){let ne=at(k,W);if(pe.functions.has(k.$ref))return yield`${mt(k.$ref)}(${D})`;yield*we(ne,W,D)}function*B(k,W,D){let ne=Je(`${new RegExp(k.source,k.flags)};`);yield`(typeof ${D} === 'string')`,he(k.maxLength)&&(yield`${D}.length <= ${k.maxLength}`),he(k.minLength)&&(yield`${D}.length >= ${k.minLength}`),yield`${ne}.test(${D})`}function*j(k,W,D){yield`(typeof ${D} === 'string')`,he(k.maxLength)&&(yield`${D}.length <= ${k.maxLength}`),he(k.minLength)&&(yield`${D}.length >= ${k.minLength}`),k.pattern!==void 0&&(yield`${Je(`${new RegExp(k.pattern)};`)}.test(${D})`),k.format!==void 0&&(yield`format('${k.format}', ${D})`)}function*L(k,W,D){yield`(typeof ${D} === 'symbol')`}function*N(k,W,D){yield`(typeof ${D} === 'string')`,yield`${Je(`${new RegExp(k.pattern)};`)}.test(${D})`}function*X(k,W,D){yield`${mt(k.$ref)}(${D})`}function*Z(k,W,D){if(yield`Array.isArray(${D})`,k.items===void 0)return yield`${D}.length === 0`;yield`(${D}.length === ${k.maxItems})`;for(let ne=0;ne<k.items.length;ne++)yield`${Ae(k.items[ne],W,`${D}[${ne}]`)}`}function*re(k,W,D){yield`${D} === undefined`}function*Q(k,W,D){yield`(${k.anyOf.map(K=>Ae(K,W,D)).join(" || ")})`}function*xe(k,W,D){yield`${D} instanceof Uint8Array`,he(k.maxByteLength)&&(yield`(${D}.length <= ${k.maxByteLength})`),he(k.minByteLength)&&(yield`(${D}.length >= ${k.minByteLength})`)}function*Ce(k,W,D){yield"true"}function*ye(k,W,D){yield Ac.IsVoidLike(D)}function*Ee(k,W,D){let ne=pe.instances.size;pe.instances.set(ne,k),yield`kind('${k[U]}', ${ne}, ${D})`}function*we(k,W,D,ne=!0){let K=Qe(k.$id)?[...W,k]:W,ee=k;if(ne&&Qe(k.$id)){let Le=mt(k.$id);if(pe.functions.has(Le))return yield`${Le}(${D})`;{let Ft=ut(Le,k,W,"value",!1);return pe.functions.set(Le,Ft),yield`${Le}(${D})`}}switch(ee[U]){case"Any":return yield*r(ee,K,D);case"Array":return yield*n(ee,K,D);case"AsyncIterator":return yield*o(ee,K,D);case"BigInt":return yield*i(ee,K,D);case"Boolean":return yield*s(ee,K,D);case"Constructor":return yield*l(ee,K,D);case"Date":return yield*c(ee,K,D);case"Function":return yield*p(ee,K,D);case"Integer":return yield*d(ee,K,D);case"Intersect":return yield*m(ee,K,D);case"Iterator":return yield*g(ee,K,D);case"Literal":return yield*x(ee,K,D);case"Never":return yield*v(ee,K,D);case"Not":return yield*C(ee,K,D);case"Null":return yield*I(ee,K,D);case"Number":return yield*S(ee,K,D);case"Object":return yield*P(ee,K,D);case"Promise":return yield*O(ee,K,D);case"Record":return yield*M(ee,K,D);case"Ref":return yield*E(ee,K,D);case"RegExp":return yield*B(ee,K,D);case"String":return yield*j(ee,K,D);case"Symbol":return yield*L(ee,K,D);case"TemplateLiteral":return yield*N(ee,K,D);case"This":return yield*X(ee,K,D);case"Tuple":return yield*Z(ee,K,D);case"Undefined":return yield*re(ee,K,D);case"Union":return yield*Q(ee,K,D);case"Uint8Array":return yield*xe(ee,K,D);case"Unknown":return yield*Ce(ee,K,D);case"Void":return yield*ye(ee,K,D);default:if(!Nr.Has(ee[U]))throw new DI(k);return yield*Ee(ee,K,D)}}let pe={language:"javascript",functions:new Map,variables:new Map,instances:new Map};function Ae(k,W,D,ne=!0){return`(${[...we(k,W,D,ne)].join(" && ")})`}function mt(k){return`check_${_I.Encode(k)}`}function Je(k){let W=`local_${pe.variables.size}`;return pe.variables.set(W,`const ${W} = ${k}`),W}function ut(k,W,D,ne,K=!0){let[ee,Le]=[`
|
|
2
2
|
`,pn=>"".padStart(pn," ")],Ft=qe("value","any"),In=Te("boolean"),Yr=[...we(W,D,ne,K)].map(pn=>`${Le(4)}${pn}`).join(` &&${ee}`);return`function ${k}(${Ft})${In} {${ee}${Le(2)}return (${ee}${Yr}${ee}${Le(2)})
|
|
3
3
|
}`}function qe(k,W){let D=pe.language==="typescript"?`: ${W}`:"";return`${k}${D}`}function Te(k){return pe.language==="typescript"?`: ${k}`:""}function xt(k,W,D){let ne=ut("check",k,W,"value"),K=qe("value","any"),ee=Te("boolean"),Le=[...pe.functions.values()],Ft=[...pe.variables.values()],In=Qe(k.$id)?`return function check(${K})${ee} {
|
|
4
4
|
return ${mt(k.$id)}(value)
|
|
5
5
|
}`:`return ${ne}`;return[...Ft,...Le,In].join(`
|
|
6
|
-
`)}function Pt(...k){let W={language:"javascript"},[D,ne,K]=k.length===2&&ke(k[1])?[k[0],k[1],W]:k.length===2&&!ke(k[1])?[k[0],[],k[1]]:k.length===3?[k[0],k[1],k[2]]:k.length===1?[k[0],[],W]:[null,[],W];if(pe.language=K.language,pe.variables.clear(),pe.functions.clear(),pe.instances.clear(),!et(D))throw new L1(D);for(let ee of ne)if(!et(ee))throw new L1(ee);return xt(D,ne,K)}e.Code=Pt;function nr(k,W=[]){let D=Pt(k,W,{language:"javascript"}),ne=globalThis.Function("kind","format","hash",D),K=new Map(pe.instances);function ee(Yr,pn,dc){if(!Nr.Has(Yr)||!K.has(pn))return!1;let $v=Nr.Get(Yr),zv=K.get(pn);return $v(zv,dc)}function Le(Yr,pn){return Bn.Has(Yr)?Bn.Get(Yr)(pn):!1}function Ft(Yr){return xl(Yr)}let In=ne(ee,Le,Ft);return new OI(k,W,In,D)}e.Compile=nr})(R1||(R1={}));u();u();u();var kV=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,AV=[0,31,28,31,30,31,30,31,31,30,31,30,31],LV=e=>e%4===0&&(e%100!==0||e%400===0),B1=e=>{let t=kV.exec(e);if(!t)return!1;let r=+t[1],n=+t[2],o=+t[3];return n>=1&&n<=12&&o>=1&&o<=(n===2&&LV(r)?29:AV[n])};u();var RV=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i,N1=e=>{let t=RV.exec(e);if(!t)return!1;let r=+t[1],n=+t[2],o=+t[3],i=t[4],s=t[5]==="-"?-1:1,l=+(t[6]||0),c=+(t[7]||0);if(l>23||c>59||!i)return!1;if(r<=23&&n<=59&&o<60)return!0;let p=n-c*s,d=r-l*s-(p<0?1:0);return(d===23||d===-1)&&(p===59||p===-1)&&o<61};var BV=/t|\s/i,Tw=e=>{let t=e.split(BV);return t.length===2&&B1(t[0])&&N1(t[1])};u();var NV=/\/|:/,GV=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,Mw=e=>NV.test(e)&&GV.test(e);var jV=[["date",B1],["time",N1],["date-time",Tw],["uri",Mw]],Pw=()=>{for(let[e,t]of jV)try{r1.Format(e,t)}catch(r){if(r instanceof Km)continue;throw r}};u();var FI=b.Record(b.String(),b.Unknown(),{$id:"Extra"}),yi=b.Object({extra:b.Optional(b.Ref(FI))}),kI=[FI];u();u();u();u();u();u();var pt=e=>Object.entries(e);var UV=e=>{let t=new Map;for(let[r,n]of pt(e.geometry??{}))t.set(r,new Map(n?.features.map(o=>[o.properties.id,o])));return t},Pr=e=>{let t=UV(e);return(n,o)=>{let i=t.get(n);if(i==null)return ae({kind:Vn.UnknownFloorError,properties:{floorId:n}});let s=i.get(o);return s==null?ae({kind:Vn.UnknownGeometryError,properties:{floorId:n,geometryId:o}}):ie(s)}};u();var Lo=b.Object({geometryId:b.Ref(mn)},{$id:"WithGeometryId"}),id=b.Object({geometryIds:b.Array(b.Ref(mn))},{$id:"WithGeometryIds"}),AI=[Lo,id];u();u();u();var ww=e=>e instanceof Error?e:new Error(String(e));var sd=e=>(...t)=>{try{return ie(e(...t))}catch(r){return ae(ww(r))}};var Ow=sd((e,t)=>{let r={};for(let n of t)for(let o of n.intoBundle(e))r[o.path]=Ku(JSON.stringify(o.contents));return r}),LI=async(e,t,r)=>Ow(e,t).andThenAsync(n=>new Promise(o=>{nw(n,{...r,consume:!0},(i,s)=>{o(i?ae(i):ie(s))})})),VV=sd(ow),RI=(e,t,r)=>Ow(e,t).andThen(n=>VV(n,r));u();u();function G1(e,t,r=[]){let n={...e};for(let[o,i]of Object.entries(t))if(i!==void 0)if(o in n){let s=o;if(Array.isArray(i)&&i.length>0){let l=HV(i[0],r);if(l){let c=n[s];if(!Array.isArray(c))throw new Error(`Expected array at ${o}, got ${typeof c}`);let p=new Map(i.map(g=>[_w(g,l),g])),m=c.map(g=>{let x=p.get(_w(g,l));return x?G1(g,x,r):g});n[s]=m}else n[s]=i}else{let l=n[s];typeof l=="object"&&l!==null&&typeof i=="object"&&i!==null?Object.keys(i).length===0?n[s]=i:n[s]=G1(l,i,r):n[o]=i}}else n[o]=i;return n}function HV(e,t){function r(n){if(typeof n!="object"||n===null)return null;for(let o of t)if(o in n&&typeof n[o]<"u")return[o];if(Array.isArray(n))return null;for(let[o,i]of Object.entries(n)){let s=r(i);if(s)return[o,...s]}return null}return r(e)}function _w(e,t){return t.reduce((r,n)=>{if(r&&typeof r=="object")return r[n]},e)}var WV=e=>e,$V=e=>JSON.parse(MI(e)),Ew=(e,t)=>t.some(r=>r.fromBundle(e.name,new Uint8Array,WV)!==void 0),Dw=sd((e,t)=>{let r={};for(let n of Object.keys(e)){let o=e[n];for(let i of t){let s=i.fromBundle(n,o,$V);if(s){r=G1(r,s,[]);break}}}return r}),BI=async(e,t)=>new Promise(r=>iw(e,{filter:n=>Ew(n,t)},(n,o)=>{r(n?ae(n):ie(o))})).then(r=>r.andThen(n=>Dw(n,t))),zV=sd(sw),NI=(e,t)=>zV(e,{filter:r=>Ew(r,t)}).andThen(r=>Dw(r,t));u();var XV=e=>typeof e=="object"&&e!=null&&"$ref"in e&&typeof e.$ref=="string",ZV=e=>{if(e.length<2)return!1;let t=e.filter(XV);if(t.length!==e.length)return!1;let r=t[0].$ref;return t.slice(1).every(n=>n.$ref===r)},j1=e=>typeof e=="object"&&e!=null&&"allOf"in e&&Array.isArray(e.allOf)&&ZV(e.allOf)?e.allOf[0]:typeof e=="object"&&e!=null&&!Array.isArray(e)?Object.fromEntries(Object.entries(e).map(([t,r])=>[t,j1(r)])):Array.isArray(e)?e.map(j1):e;u();var U1=e=>typeof e=="object"&&e!=null&&"$ref"in e?{...e,$ref:`#/definitions/${e.$ref}`}:typeof e=="object"&&e!=null&&!Array.isArray(e)?Object.fromEntries(Object.entries(e).map(([t,r])=>[t,U1(r)])):Array.isArray(e)?e.map(U1):e;var ad;(function(e){e.InvalidTypeboxSchema="InvalidTypeboxSchema",e.MissingReferenceId="MissingReferenceId",e.DuplicateReferenceId="DuplicateReferenceId",e.TypeboxError="TypeboxError",e.UnknownError="UnknownError"})(ad||(ad={}));var YV=e=>({next(){for(let r of e){let n=r.next();if(!n.done)return n}return{done:!0,value:void 0}},[Symbol.iterator](){return this}}),JV=(...e)=>{let t=new Map;for(let r of YV(e)){if(!r.$id)continue;let n=t.get(r.$id);if(n!=null&&n!==r)return ae({kind:ad.DuplicateReferenceId,message:"Failed to register a reference for a schema with an $id that has already been used",schema:r});t.set(r.$id,r)}return ie(t)},Ur,ld,uo,nn,GI=class GI{constructor(t,r,n,o){T(this,Ur);T(this,ld);T(this,uo,[]);T(this,nn);w(this,Ur,t),w(this,ld,r),w(this,uo,n),w(this,nn,o),this.is=this.is.bind(this),this.parse=this.parse.bind(this),this.verify=this.verify.bind(this),this.jsonSchema=this.jsonSchema.bind(this),this.compress=this.compress.bind(this),this.decompress=this.decompress.bind(this)}static create(t,r="CoreMVF",n=!1){let o=b.Composite(t.extensions.map(s=>s.schema),{$id:r});if(!F.IsSchema(o))return ae({kind:ad.InvalidTypeboxSchema,message:"Attempting to merge schemas produced an invalid schema",schema:o});let i=JV(tI.values(),rI.values(),Q2.values(),kI.values(),jI.values(),AI.values(),t.extensions.flatMap(s=>s.references??[]).values());if(!i.isOk())return i;try{Pw();let s=n?null:R1.Compile(o,[...i.value.values()]);return ie(new GI(o,s,t.extensions,i.value))}catch(s){return s instanceof ve?ae({kind:ad.TypeboxError,message:s.message,original:s}):ae({kind:ad.UnknownError,message:"An unknown error occurred while compiling the schema",original:s})}}is(t){return a(this,ld)?.Check(t)??mi.Check(a(this,Ur),[...a(this,nn).values()],t)}parse(t){return this.is(t)?ie(t):ae(a(this,ld)?.Errors(t)??mi.Errors(a(this,Ur),[...a(this,nn).values()],t))}decode(t){try{return ie(Sw(a(this,Ur),[...a(this,nn).values()],t))}catch(r){return ae(r)}}encode(t){try{return ie(Cw(a(this,Ur),[...a(this,nn).values()],t))}catch(r){return ae(r)}}verify(t){for(let r of a(this,uo))if(r.integrityCheck){let n=r.integrityCheck(t);if(n.isErr())return ae(n.error)}return ie(!0)}jsonSchema(){let t=JSON.parse(JSON.stringify([a(this,Ur),...a(this,nn).values()])),r=j1(U1({$id:`#/definitions/${a(this,Ur).$id??"CoreMVF"}`,$schema:"http://json-schema.org/draft-07/schema#",references:t}));return JSON.stringify(r,null,2)}async compress(t){return this.encode(t).andThen(r=>this.parse(r)).andThenAsync(r=>LI(r,a(this,uo))).then(r=>r.mapErr(n=>ah(a(this,Ur).$id??"CoreMVF",n,[...a(this,nn).values()])))}async compressUnsafe(t){return this.encode(t).andThenAsync(r=>LI(r,a(this,uo))).then(r=>r.mapErr(n=>ah(a(this,Ur).$id??"CoreMVF",n,[...a(this,nn).values()])))}compressSync(t){return this.encode(t).andThen(r=>this.parse(r)).andThen(r=>RI(r,a(this,uo))).mapErr(r=>ah(a(this,Ur).$id??"CoreMVF",r,[...a(this,nn).values()]))}compressUnsafeSync(t){return this.encode(t).andThen(r=>RI(r,a(this,uo))).mapErr(r=>ah(a(this,Ur).$id??"CoreMVF",r,[...a(this,nn).values()]))}async decompress(t){return BI(t,a(this,uo)).then(r=>r.andThen(n=>this.parse(n)).andThen(n=>this.decode(n)).mapErr(n=>lh(a(this,Ur).$id??"CoreMVF",n,[...a(this,nn).values()])))}async decompressUnsafe(t){return BI(t,a(this,uo)).then(r=>r.andThen(n=>this.decode(n)).mapErr(n=>lh(a(this,Ur).$id??"CoreMVF",n,[...a(this,nn).values()])))}decompressSync(t){return NI(t,a(this,uo)).andThen(r=>this.parse(r)).andThen(r=>this.decode(r)).mapErr(r=>lh(a(this,Ur).$id??"CoreMVF",r,[...a(this,nn).values()]))}decompressUnsafeSync(t){return NI(t,a(this,uo)).andThen(r=>this.decode(r)).mapErr(r=>lh(a(this,Ur).$id??"CoreMVF",r,[...a(this,nn).values()]))}};Ur=new WeakMap,ld=new WeakMap,uo=new WeakMap,nn=new WeakMap;var V1=GI;var cd,H1=class{constructor(){T(this,cd,[]);this.extend=this.extend.bind(this)}extend(t){return a(this,cd).push(t),this}extendOptional(t){let r={...t,schema:b.Partial(t.schema)};return a(this,cd).push(r),this}build(t){return V1.create(this,void 0,t?.cspSafe)}get extensions(){return a(this,cd)}};cd=new WeakMap;u();u();u();u();var pd=b.Object({geometryId:b.Ref(mn),floorId:b.Ref(Ze)},{$id:"GeometryAnchor"}),qV=b.Object({geometryAnchor:b.Ref(pd)}),ch=(e,t)=>b.Object({geometryAnchors:b.Array(b.Ref(pd),e)},t),jI=[pd];u();u();u();var Fw=(e,t)=>b.Unsafe(b.Transform(b.String(t)).Decode(r=>e.includes(r)?r:"unknown").Encode(r=>r)),Hn=(e,t)=>{let r=Fw(e,t),n=[...e,"unknown"],o=Object.freeze(Object.fromEntries([...e,"unknown"].map(i=>[i,i])));return{schema:r,values:n,record:o}};var kw=()=>new H1().extend(dw).extend(yw).extend(Iw);u();u();u();u();u();u();var ph;(function(e){e.AnnotationNonPointGeometryError="AnnotationNonPointGeometryError",e.AnnotationUnknownSymbolError="AnnotationUnknownSymbolError"})(ph||(ph={}));var Aw=e=>{if(e.annotations==null)return ie(!0);let t=hr(e.annotations,o=>o.id,"annotations");if(t.isErr())return t;let r=Pr(e),n=new Set(rt(e.annotationSymbols??{}));for(let o of rt(e.annotations)){let i=e.annotations[o];if(i!=null)for(let s of i){if(!n.has(s.symbolKey))return ae({kind:ph.AnnotationUnknownSymbolError,properties:{annotationId:s.id,symbolKey:s.symbolKey}});let l=r(o,s.geometryId);if(l.isErr())return l;if(l.value.geometry.type!=="Point")return ae({kind:ph.AnnotationNonPointGeometryError,properties:{annotationId:s.id,floorId:o,geometryId:s.geometryId}})}}return ie(!0)};var Lw=mr("a","AnnotationId"),UI=b.Intersect([Lo,b.Object({id:b.Ref(Lw,{description:"The unique identifier for the annotation."}),externalId:b.Optional(b.String({description:"The external identifier for the annotation."})),symbolKey:b.String({description:"The symbol identifier for the annotation."})})],{$id:"AnnotationProperties"}),Rw=b.Object({url:b.String({format:"uri",description:"The URL for the symbol."}),name:b.String({description:"The name of the symbol."})},{$id:"AnnotationSymbol"}),KV=b.Object({annotations:gr(b.Record(Ze,b.Array(b.Ref(UI)),{additionalProperties:!1})),annotationSymbols:gr(b.Record(b.Index(UI,["symbolKey"]),b.Ref(Rw)))},{$id:"AnnotationsSchema"}),QV=/^annotations\/(.*)\.json$/,Bw={name:"ext:mvf-annotations",schema:KV,intoBundle:function*(e){if(e.annotations!=null)for(let t of rt(e.annotations))yield{path:`annotations/${t}.json`,contents:e.annotations[t]};e.annotationSymbols!=null&&(yield{path:"annotation-symbols.json",contents:e.annotationSymbols})},fromBundle:(e,t,r)=>{if(e==="annotation-symbols.json")return{annotationSymbols:r(t)};let n=e.match(QV)?.[1];if(n)return{annotations:{[n]:r(t)}}},references:[Lw,UI,Rw],integrityCheck:Aw};u();u();u();var ma=mr("lcat","LocationCategoryId"),VI=b.Intersect([b.Object({id:b.Ref(ma),parent:b.Optional(b.Ref(ma))}),Oc(["name"]),yi],{$id:"LocationCategory"}),Nw=[ma,VI];u();u();var Lc;(function(e){e.UnknownCategoryError="UnknownCategoryError",e.UnknownParentCategoryError="UnknownParentCategoryError",e.UnknownParentLocationError="UnknownParentLocationError"})(Lc||(Lc={}));var Gw=e=>{if(e.locationCategories==null&&e.locations==null)return ie(!0);if(e.locationCategories!=null){let o=hr(e.locationCategories,i=>i.id,"locationCategories");if(o.isErr())return o}if(e.locations!=null){let o=hr(e.locations,i=>i.id,"locations");if(o.isErr())return o}if(e.locationInstances!=null){let o=hr(e.locationInstances,i=>i.id,"locationInstances");if(o.isErr())return o}let t=new Set(e.locationCategories?.map(o=>o.id)??[]);for(let o of e.locationCategories??[])if(o.parent!=null&&!t.has(o.parent))return ae({kind:Lc.UnknownParentCategoryError,properties:{categoryId:o.id,parentCategoryId:o.parent}});let r=Pr(e);for(let o of e.locations??[]){for(let i of o.categories)if(!t.has(i))return ae({kind:Lc.UnknownCategoryError,properties:{locationId:o.id,categoryId:i}});for(let i of o.geometryAnchors){let s=r(i.floorId,i.geometryId);if(s.isErr())return s}}let n=new Set(e.locations?.map(o=>o.id)??[]);for(let o of e.locationInstances??[]){if(!n.has(o.parentId))return ae({kind:Lc.UnknownParentLocationError,properties:{locationInstanceId:o.id,parentLocationId:o.parentId}});for(let i of o.categories??[])if(!t.has(i))return ae({kind:Lc.UnknownCategoryError,properties:{locationId:o.id,categoryId:i}});for(let i of o.geometryAnchors??[]){let s=r(i.floorId,i.geometryId);if(s.isErr())return s}}return ie(!0)};u();var ha=mr("loc","LocationId"),W1=mr("loci","LocationInstanceId"),jw=b.Object({name:b.String(),url:b.String({format:"uri"})},{$id:"LocationSocial"}),Uw=b.Object({url:b.String({format:"uri"})},{$id:"LocationImage"}),HI=b.Object({label:b.String(),url:b.String({format:"uri"})},{$id:"LocationLink"}),WI=b.String({pattern:"^[0-2][0-9]:[0-6][0-9](:[0-6][0-9])?$",$id:"OpeningHoursTime"}),Vw=b.Union([b.Literal("Sunday"),b.Literal("Monday"),b.Literal("Tuesday"),b.Literal("Wednesday"),b.Literal("Thursday"),b.Literal("Friday"),b.Literal("Saturday")],{$id:"OpeningHoursDay"}),eH="PublicHolidays",$I=b.Union([Vw,b.Literal(eH)],{$id:"OpeningHoursDayOrPublicHoliday"}),$1=b.Object({"@type":b.Optional(b.Literal("OpeningHoursSpecification",{description:"The type of opening hours"})),opens:b.Optional(b.Ref(WI,{description:"The time the opening hours start"})),closes:b.Optional(b.Ref(WI,{description:"The time the opening hours end"})),dayOfWeek:b.Optional(b.Union([b.Ref($I),b.Array(b.Ref($I))],{description:"The days of the week the opening hours apply to"})),validFrom:b.Optional(b.String({format:"date",description:"The date the opening hours start, in ISO 8601 format"})),validTo:b.Optional(b.String({format:"date",description:"The date the opening hours end, in ISO 8601 format"}))},{$id:"OpeningHoursSpecification"}),z1=b.Intersect([b.Object({id:b.Ref(ha),categories:b.Array(b.Ref(ma)),logo:b.Optional(b.String({format:"uri"})),phone:b.Optional(b.String()),social:b.Array(b.Ref(jw)),images:b.Array(b.Ref(Uw)),links:b.Array(b.Ref(HI)),website:b.Optional(b.Ref(HI)),openingHours:b.Optional(b.Array(b.Ref($1)))}),Oc(["name"]),ch(),yi],{$id:"Location"}),zI=b.Intersect([b.Object({id:b.Ref(W1),parentId:b.Ref(ha)}),b.Partial(b.Omit(z1,["id","parentId","details"])),io],{$id:"LocationInstance",description:"A location instance is a particular instance of an location that has some properties different from the parent."}),X1=[ha,W1,jw,Uw,HI,WI,Vw,$I,$1,z1,zI];var tH=b.Object({locations:b.Array(b.Ref(z1)),locationCategories:b.Array(b.Ref(VI)),locationInstances:b.Optional(b.Array(b.Ref(zI)))},{$id:"LocationsExtensionSchema"}),Hw="locations.json",Ww="location-categories.json",$w="location-instances.json",zw={name:"ext:locations",schema:tH,intoBundle:function*(e){e.locations!=null&&(yield{path:Hw,contents:e.locations}),e.locationCategories!=null&&(yield{path:Ww,contents:e.locationCategories}),e.locationInstances!=null&&(yield{path:$w,contents:e.locationInstances})},fromBundle:(e,t,r)=>{if(e===Hw)return{locations:r(t)};if(e===Ww)return{locationCategories:r(t)};if(e===$w)return{locationInstances:r(t)}},references:[...Nw,...X1],integrityCheck:Gw};u();u();var bi;(function(e){e.EnterpriseLocationWithUnknownLocationError="EnterpriseLocationWithUnknownLocationError",e.EnterpriseCategoryWithUnknownLocationCategoryError="EnterpriseCategoryWithUnknownLocationCategoryError",e.InstanceWithUnknownLocationInstanceError="InstanceWithUnknownLocationInstanceError",e.InstanceWithUnknownEnterpriseLocationError="InstanceWithUnknownEnterpriseLocationError",e.EnterpriseLocationWithUnknownSibling="EnterpriseLocationWithUnknownSibling",e.EnterpriseLocationInstanceWithUnknownSibling="EnterpriseLocationInstanceWithUnknownSibling",e.EnterpriseVenueWithUnknownTopLocationError="EnterpriseVenueWithUnknownTopLocationError",e.EnterpriseLocationWithInvalidPrimaryCategory="EnterpriseLocationWithInvalidPrimaryCategory"})(bi||(bi={}));var Xw=e=>{if(e.cms==null)return ie(!0);let t=e.cms,r=hr(e.cms.categories,g=>g.id,"cms.categories");if(r.isErr())return r;let n=new Set(e.locationCategories?.map(g=>g.id)??[]);for(let g of t.categories??[])if(!n.has(g.categoryId))return ae({kind:bi.EnterpriseCategoryWithUnknownLocationCategoryError,properties:{enterpriseCategoryId:g.id,locationCategoryId:g.categoryId}});let o=hr(e.cms.locations,g=>g.id,"cms.locations");if(o.isErr())return o;let i=new Map(e.locations?.map(g=>[g.id,g])??[]);for(let g of t.locations??[]){if(!i.has(g.locationId))return ae({kind:bi.EnterpriseLocationWithUnknownLocationError,properties:{enterpriseLocationId:g.id,locationId:g.locationId}});for(let x of g.siblingGroups??[])for(let v of x.siblings??[])if(!i.has(v))return ae({kind:bi.EnterpriseLocationWithUnknownSibling,properties:{enterpriseLocationId:g.id,siblingLocationId:v,label:x.label}});if(g.primaryCategory!=null){let x=i.get(g.locationId);if(x!=null&&!x.categories.includes(g.primaryCategory))return ae({kind:bi.EnterpriseLocationWithInvalidPrimaryCategory,properties:{enterpriseLocationId:g.id,locationId:g.locationId,primaryCategory:g.primaryCategory}})}}if(t.venue?.topLocations!=null){for(let g of t.venue.topLocations)if(!i.has(g))return ae({kind:bi.EnterpriseVenueWithUnknownTopLocationError,properties:{locationId:g}})}let s=new Set(e.cms.locations?.map(g=>g.id)??[]),l=hr(e.cms.locationInstances,g=>g.id,"cms.locationInstances");if(l.isErr())return l;let c=new Set(e.locationInstances?.map(g=>g.id)??[]);for(let g of t.locationInstances??[]){if(!s.has(g.parentId))return ae({kind:bi.InstanceWithUnknownEnterpriseLocationError,properties:{enterpriseLocationInstanceId:g.id,enterpriseLocationId:g.parentId}});if(!c.has(g.locationInstanceId))return ae({kind:bi.InstanceWithUnknownLocationInstanceError,properties:{enterpriseLocationInstanceId:g.id,locationInstanceId:g.locationInstanceId}});for(let x of g.siblingGroups??[])for(let v of x.siblings??[])if(!i.has(v))return ae({kind:bi.EnterpriseLocationInstanceWithUnknownSibling,properties:{enterpriseLocationInstanceId:g.id,siblingLocationId:v,label:x.label}})}let p=gi(e),d=Pr(e),m=hr(e.cms.floorText,g=>g.properties.id,"cms.floorText");if(m.isErr())return m;for(let[g,x]of pt(t.floorText??{})){let v=p(g);if(v.isErr())return v;for(let C of x.features){if(!("geometryId"in C.properties))continue;let I=d(g,C.properties.geometryId);if(I.isErr())return I}}for(let[g,x]of pt(t.textures??{})){let v=p(g);if(v.isErr())return v;for(let C of x){let I=d(g,C.geometryId);if(I.isErr())return I}}for(let[g,x]of pt(t.layers??{})){let v=p(g);if(v.isErr())return v;for(let C of rt(x??{})){let I=d(g,C);if(I.isErr())return I}}for(let[g,x]of pt(t.textAreas??{})){let v=p(g);if(v.isErr())return v;for(let C of x.features)if("geometryId"in C.properties){let I=d(g,C.properties.geometryId);if(I.isErr())return I}}return ie(!0)};u();u();var uh=mr("el","EnterpriseLocationId"),XI=mr("ec","EnterpriseCategoryId"),ZI=mr("eli","EnterpriseLocationInstanceId"),YI=mr("ev","EnterpriseVenueId"),JI=mr("eft","EnterpriseFloorTextId"),Zw=[uh,XI,ZI,YI,JI];var Yw=b.Object({id:b.Ref(XI),categoryId:b.Ref(ma),color:b.Optional(b.String()),sortOrder:b.Number(),iconFromDefaultList:b.Optional(b.Union([b.String(),b.Null()])),picture:b.Optional(b.String({format:"uri",description:"The category's picture"}))},{$id:"EnterpriseCategory"}),qI=b.Object({categories:b.Optional(b.Array(b.Ref(Yw)))},{$id:"EnterpriseCategoriesSchema"}),Jw=[Yw,qI];u();var qw=Hn(["left","center","right"]),rH=qw.schema,AIe=qw.values,KI=b.Object({id:b.Ref(JI),text:b.String(),visible:b.Boolean({default:!0}),fontSize:b.Number({default:12,exclusiveMinimum:0}),fontFamily:b.String({default:"Droid Sans"}),color:b.String({default:"black"}),rotation:b.Number({minimum:0,maximum:360}),align:rH},{$id:"FloorTextCommonProperties"}),QI=b.Intersect([b.Ref(KI),Lo],{$id:"AnchoredFloorTextProperties"}),eS=b.Intersect([b.Ref(KI),b.Object({verticalOffset:b.Number()})],{$id:"FloatingFloorTextProperties"}),Kw=b.Union([b.Ref(QI),b.Ref(eS)],{$id:"FloorTextProperties"}),Qw=Kr(fn,b.Ref(Kw),{$id:"FloorTextFeature"}),nH=Kr(fn,b.Ref(QI),{$id:"AnchoredFloorTextFeature"}),oH=Kr(fn,b.Ref(eS),{$id:"FloatingFloorTextFeature"}),e7=Mn(b.Ref(Qw),{$id:"EnterpriseFloorTextFeatureCollection"}),t7=b.Record(Ze,b.Ref(e7),{$id:"EnterpriseFloorTextCollectionsByFloor",additionalProperties:!1}),tS=b.Object({floorText:b.Optional(b.Ref(t7))},{$id:"EnterpriseFloorTextSchema"}),r7=[KI,QI,eS,Kw,Qw,nH,oH,e7,t7,tS];u();var n7=gr(b.Record(mn,b.String({minLength:1}),{additionalProperties:!1,$id:"EnterpriseLayers"})),o7=gr(b.Record(Ze,b.Ref(n7),{additionalProperties:!1,$id:"EnterpriseLayersByFloor"})),rS=b.Object({layers:b.Optional(b.Ref(o7))},{$id:"EnterpriseLayersSchema"}),i7=[n7,o7,rS];u();u();u();var nS=Hn(["closed-temporarily","new","pop-up","coming-soon","relocated"]),iH=nS.schema,$Ie=nS.values,zIe=nS.record,oS=b.Object({type:iH,start:b.Optional(b.String({format:"date",description:"The start date of the state"})),end:b.Optional(b.String({format:"date",description:"The end date of the state"}))},{$id:"LocationState",description:"The state of a location. Start and end dates are optional."}),iS=b.Object({label:b.String(),siblings:b.Array(b.Ref(ha))},{$id:"SiblingGroup"}),Z1=b.Object({name:b.String(),code:b.String()},{$id:"Language"}),s7=[oS,iS,Z1];var Y1=b.Object({id:b.Ref(uh),locationId:b.Ref(ha),cmsId:b.String(),type:b.String(),sortOrder:b.Number(),tags:b.Optional(b.Array(b.String())),picture:b.Optional(b.String({format:"uri",description:"The picture of the location"})),states:b.Optional(b.Array(b.Ref(oS),{description:"The location's state. No more than one state should be active at a time, and all but at most one should have dates set"})),siblingGroups:b.Optional(b.Array(b.Ref(iS))),gallery:b.Optional(b.Array(b.Object({caption:b.Optional(b.String()),image:b.String({format:"uri"}),embeddedUrl:b.Optional(b.String({format:"uri",description:"The URL to link from the image"}))},{description:"The location's image gallery"}),{description:"The location's image gallery"})),showFloatingLabelWhenImagePresent:b.Optional(b.Boolean({description:"Whether to show the flat label when an image is present"})),amenity:b.Optional(b.String({description:"The location's amenity type. Only set if the location is an amenity"})),showLogo:b.Optional(b.Boolean({description:"Whether to show the logo of the location"})),primaryCategory:b.Optional(b.Ref(ma))},{$id:"EnterpriseLocation"}),sS=b.Object({locations:b.Optional(b.Array(b.Ref(Y1)))},{$id:"EnterpriseLocationsSchema"}),a7=[Y1,sS];var l7=b.Intersect([b.Object({id:b.Ref(ZI),parentId:b.Ref(uh),locationInstanceId:b.Ref(W1)}),b.Partial(b.Omit(Y1,["id","parentId","locationId"]))],{$id:"EnterpriseLocationInstance",description:"A locationInstance is a particular instance of an Enterprise Location that has some properties different from the parent."}),aS=b.Object({locationInstances:b.Optional(b.Array(b.Ref(l7)))},{$id:"EnterpriseLocationInstancesSchema"}),c7=[l7,aS];u();var lS=Hn(["near","center"],{$id:"EnterpriseTextAreaAlignment"}),p7=lS.schema,uSe=lS.values,dSe=lS.record,cS=b.Object({maxWidth:b.Number({exclusiveMinimum:0,description:"The maximum width of the label, in meters."}),maxHeight:b.Number({exclusiveMinimum:0,description:"The maximum height of the label, in meters."}),align:b.Ref(p7),rotation:b.Number({minimum:0,maximum:360,description:"Rotation in degrees, about the center of the image. North is 0, east is 90."})},{$id:"EnterpriseBaseTextAreaProperties"}),u7=b.Intersect([b.Ref(cS),Lo],{$id:"EnterpriseAnchoredTextAreaProperties"}),d7=b.Intersect([b.Ref(cS),b.Object({verticalOffset:b.Number({minimum:0,description:"How high to position the image, in meters, relative to the ground plane."})})],{$id:"EnterpriseFloatingTextAreaProperties"}),f7=b.Union([u7,d7],{$id:"EnterpriseTextAreaProperties"}),m7=Kr(b.Ref(fn),f7,{$id:"EnterpriseTextAreaFeature"}),h7=Mn(b.Ref(m7),{$id:"EnterpriseTextAreaCollection"}),g7=b.Record(Ze,b.Ref(h7),{$id:"EnterpriseTextAreasByFloor",additionalProperties:!1}),y7=b.Object({textAreas:b.Optional(b.Ref(g7))},{$id:"EnterpriseTextAreasSchema"}),b7=[p7,cS,u7,d7,f7,m7,h7,g7];u();var pS=b.Object({u:b.Number(),v:b.Number()},{$id:"EnterpriseTextureUV"}),uS=Hn(["top","side"],{$id:"EnterpriseTextureFace"}),x7=uS.schema,ySe=uS.values,bSe=uS.record,dS=Hn(["inside","outside","both"],{$id:"EnterpriseTextureSurface"}),v7=dS.schema,xSe=dS.values,vSe=dS.record,I7=b.Tuple([Gu,ju,Gu,ju],{$id:"EnterpriseTextureBounds"}),S7=b.Intersect([b.Object({repeat:b.Ref(pS),offset:b.Ref(pS),rotation:b.Number({minimum:0,maximum:360}),path:b.String({format:"uri"}),face:b.Ref(x7),surface:b.Ref(v7),bounds:b.Ref(I7)},{$id:"EnterpriseTextureProperties"}),Lo],{$id:"EnterpriseTexture"}),C7=b.Array(b.Ref(S7),{$id:"EnterpriseTextures"}),T7=b.Record(Ze,b.Ref(C7),{$id:"EnterpriseTexturesByFloor",additionalProperties:!1}),fS=b.Object({textures:b.Optional(b.Ref(T7))},{$id:"EnterpriseTexturesSchema"}),M7=[S7,C7,fS,pS,x7,v7,I7,T7];u();var P7=b.Intersect([b.Object({id:b.Ref(YI),slug:b.String(),defaultLanguage:b.Ref(Z1),languages:b.Array(b.Ref(Z1)),countrycode:b.Optional(b.String()),logo:b.Optional(b.String({format:"uri"})),mappedinWebUrl:b.Optional(b.String({format:"uri"})),topLocations:b.Optional(b.Array(b.Ref(ha))),operationHours:b.Optional(b.Array(b.Ref($1))),coverImage:b.Optional(b.String({format:"uri"}))}),Oc(["name"]),yi],{$id:"EnterpriseVenue"}),mS=b.Object({venue:b.Optional(b.Ref(P7))},{$id:"EnterpriseVenueSchema"}),w7=[P7,mS];var _7=b.Intersect([mS,sS,aS,qI,fS,tS,rS,y7],{$id:"CMSProperties"}),O7=b.Object({cms:b.Optional(b.Ref(_7))},{$id:"CMSExtensionSchema"}),sH=/^cms\/(?:([^/]+)\/)?([^/]+)\.(?:json|geojson)$/,E7={name:"ext:cms",schema:O7,intoBundle:function*(e){if(e.cms==null)return;let t=e.cms;for(let r of rt(t))switch(r){case"floorText":for(let n of rt(t.floorText??{}))yield{path:`cms/floorText/${n}.geojson`,contents:(t.floorText??{})[n]};continue;case"textures":for(let n of rt(t.textures??{}))yield{path:`cms/textures/${n}.json`,contents:(t.textures??{})[n]};continue;case"textAreas":for(let n of rt(t.textAreas??{}))yield{path:`cms/textAreas/${n}.geojson`,contents:(t.textAreas??{})[n]};continue;default:yield{path:`cms/${r}.json`,contents:t[r]};continue}},fromBundle:(e,t,r)=>{let n=e.match(sH);if(!n)return;let[,o,i]=n,s=r(t);switch(o){case"floorText":case"textures":case"textAreas":return{cms:{[o]:{[i]:s}}};default:return{cms:{[i]:s}}}},references:[_7,O7,...w7,...a7,...c7,...Jw,...M7,...i7,...r7,...b7,...Zw,...s7,...X1],integrityCheck:Xw};u();u();u();u();var xi;(function(e){e.NavigationFlagMissingDeclaration="NavigationFlagMissingDeclaration",e.NavigationFlagDuplicateBit="NavigationFlagDuplicateBit",e.NavigationFlagIncorrectFlagsLength="NavigationFlagIncorrectFlagsLength",e.NavigationFlagValueTooBig="NavigationFlagValueTooBig"})(xi||(xi={}));var D7=e=>{let{navigationFlags:t}=e;if(!t||Object.keys(t).length===0)return ie(!0);let r=Object.entries(t).map(([i,s])=>({key:i,...s})).sort((i,s)=>i.index!==s.index?i.index-s.index:i.bit-s.bit),n=0,o=-1;for(let i of r){if(i.bit===o)return ae({kind:xi.NavigationFlagDuplicateBit,properties:{index:i.index,bit:i.bit,path:`navigationFlags.${i.key}`}});if(i.index!=n){if(o!=31)return ae({kind:xi.NavigationFlagMissingDeclaration,properties:{index:n,bit:o+1,path:"navigationFlags"}});if(i.index!=n+1||i.bit!=0)return ae({kind:xi.NavigationFlagMissingDeclaration,properties:{index:n+1,bit:0,path:"navigationFlags"}});n=i.index,o=0}else{if(i.bit!==o+1)return ae({kind:xi.NavigationFlagMissingDeclaration,properties:{index:i.index,bit:o+1,path:"navigationFlags"}});o=i.bit}}return ie(!0)};u();function Il(e,t){return t&&(e.flags[t.index]&1<<t.bit)!==0}u();var F7=2**32-1,dh=e=>{let t=Object.keys(e.navigationFlags??{}).length;if(t===0)return{index:-1,flag:0};let r=Math.floor(t/32),n=t%32;return{index:r,flag:2**n-1}},ud=(e,t,r)=>{if(t.index==-1&&e.length===0)return ie(!0);let n=t.flag>0||t.index===-1?t.index+1:t.index;if(e.length!==n)return ae({kind:xi.NavigationFlagIncorrectFlagsLength,properties:{expected:n,actual:e.length,path:r}});for(let o=0;o<e.length;o++){let i=e[o];if(o<t.index){if(i>F7)return ae({kind:xi.NavigationFlagValueTooBig,properties:{index:o,flagValue:i,expectedMaxFlagValue:F7,path:r}});continue}else if(i>t.flag)return ae({kind:xi.NavigationFlagValueTooBig,properties:{index:o,flagValue:i,expectedMaxFlagValue:t.flag,path:r}})}return ie(!0)};var aH=b.Object({index:b.Integer({description:"The index of the flag in a flags array.",minimum:0}),bit:b.Integer({description:"The bit position of the flag in a flag's bitfield.",minimum:0,maximum:31})},{$id:"NavigationFlagDeclarationCore"}),k7=b.Intersect([aH,io],{$id:"NavigationFlagDeclaration",description:'A NavigationFlagDeclaration describes the relationship between a "key" that a developer might use to wayfind using that flag, and the index and bit position in an object\'s `flags` array.'}),hS={accessible:"accessible",outdoors:"outdoors"},A7=b.Record(b.String(),k7,{$id:"NavigationFlagDeclarations",description:"Any well known and custom flags present in the MVF"}),lH=b.Object({navigationFlags:b.Ref(A7)},{$id:"NavigationFlagsSchema"}),J1=b.Array(b.Integer({minimum:0,maximum:Math.pow(2,32)-1}),{$id:"Flags"}),gS=b.Object({flags:b.Ref(J1)},{$id:"WithFlags"}),Rc=b.Intersect([pd,gS],{$id:"FlaggedGeometryAnchor"}),cH=b.Object({geometryAnchor:Rc},{$id:"WithFlaggedGeometryAnchor"}),pH=b.Object({geometryAnchors:b.Array(Rc)},{$id:"WithFlaggedGeometryAnchors"}),L7={name:"ext:mvf-navigation-flags",schema:lH,intoBundle:function*(e){e.navigationFlags!=null&&(yield{path:"navigationFlags.json",contents:e.navigationFlags})},fromBundle:(e,t,r)=>e!=="navigationFlags.json"?void 0:{navigationFlags:r(t)},references:[k7,A7,J1,Rc,cH,pH],integrityCheck:D7};u();var R7=e=>{if(e.connections==null)return ie(!0);let t=hr(e.connections,o=>o.id,"connections");if(t.isErr())return t;let r=Pr(e),n=dh(e);for(let[o,i]of e.connections.entries()){for(let[s,l]of i.entrances.entries()){let c=r(l.floorId,l.geometryId);if(c.isErr())return c;let p=ud(l.flags,n,`connections[${o}].entrances[${s}]`);if(p.isErr())return p}for(let[s,l]of i.exits.entries()){let c=r(l.floorId,l.geometryId);if(c.isErr())return c;let p=ud(l.flags,n,`connections[${o}].exits[${s}]`);if(p.isErr())return p}}return ie(!0)};var N7=mr("c","ConnectionId"),{schema:uH,values:S3e,record:dH}=Hn(["elevator","escalator","travelator","stairs","door","ramp"],{$id:"ConnectionType"}),G7=uH;var yS=dH,j7=b.Intersect([b.Object({id:b.Ref(N7,{description:"The unique identifier for the connection."}),entrances:b.Array(b.Ref(Rc)),exits:b.Array(b.Ref(Rc)),entryCost:b.Number({description:"The cost to enter the connection.",minimum:0}),floorCostMultiplier:b.Number({description:"The cost multiplier for each floor transitioned.",minimum:1}),type:b.Ref(G7,{description:"The type of connection."})}),io,yi],{$id:"ConnectionsProperties"}),U7=b.Array(b.Ref(j7),{$id:"ConnectionsCollection"}),fH=b.Object({connections:b.Ref(U7)},{$id:"ConnectionsExtensionSchema"}),B7="connections.json",V7={name:"ext:connections",schema:fH,intoBundle:function*(e){e.connections!=null&&(yield{path:B7,contents:e.connections})},fromBundle:(e,t,r)=>{if(e===B7)return{connections:r(t)}},references:[j7,U7,G7,N7,Rc,J1],integrityCheck:R7};u();u();var H7=e=>{if(e.defaultStyle==null)return ie(!0);let t=Pr(e);for(let r of Object.values(e.defaultStyle))if(r!=null)for(let n of r.geometryAnchors){let o=t(n.floorId,n.geometryId);if(o.isErr())return o}return ie(!0)};var W7=b.Intersect([ch(),yi,b.Object({altitude:b.Number({description:"How far off the bottom of the floor the objects with this style should be drawn, in meters."}),color:b.String({pattern:"^#[0-9a-fA-F]{6}$",description:"Color should be represented with a hash (#), followed by 6 hexadecimal digits. ex: #RRGGBB"}),height:b.Number({minimum:0,description:"The height of the objects belonging to this layer, in meters."}),opacity:b.Number({minimum:0,maximum:1,description:"The opacity of the objects belonging to this layer, from 0 to 1."}),buffer:b.Number({description:"The buffer amount to apply to the geometry, in meters. This can be used to inflate line string geometry for walls, but might also be applicable as a way to grow or shrink polygon geometry for aesthetic purposes. Can be negative."}),hidden:b.Optional(b.Boolean({description:"Whether or not the objects with this style should be hidden."}))})],{$id:"DefaultStyle"}),$7=b.Record(b.String(),b.Ref(W7),{$id:"DefaultStyleCollection",additionalProperties:!1}),mH=b.Object({defaultStyle:b.Ref($7)},{$id:"DefaultStyleSchema"}),z7={name:"ext:mvf-default-style",schema:mH,intoBundle:function*(e){e.defaultStyle!=null&&(yield{path:"default-style.json",contents:e.defaultStyle})},fromBundle:(e,t,r)=>{if(e==="default-style.json")return{defaultStyle:r(t)}},references:[W7,$7],integrityCheck:H7};u();u();u();u();var q1;(function(e){e.InvalidDefaultFloorError="InvalidDefaultFloorError"})(q1||(q1={}));var X7=e=>{if(e.floorStacks==null)return ie(!0);let t=hr(e.floorStacks,n=>n.id,"floorStacks");if(t.isErr())return t;let r=gi(e);for(let n of e.floorStacks){for(let o of n.floors){let i=r(o);if(i.isErr())return i}if(n.defaultFloor!=null&&!n.floors.includes(n.defaultFloor))return ae({kind:q1.InvalidDefaultFloorError,properties:{floorStackId:n.id,floorId:n.defaultFloor}})}return ie(!0)};var fh=mr("fs","FloorStackId"),Y7=b.Intersect([b.Object({id:b.Ref(fh,{description:"The unique identifier for the floor stack."}),floors:b.Array(b.Ref(Ze),{uniqueItems:!0,minItems:1,description:"The floors that are part of this floor stack."}),defaultFloor:b.Optional(b.Ref(Ze,{description:"The default floor for the floor stack."}))}),io],{$id:"FloorStacksProperties"}),J7=b.Array(b.Ref(Y7),{$id:"FloorStackCollection"}),hH=b.Object({floorStacks:b.Ref(J7)},{$id:"FloorStackExtensionSchema"}),Z7="floor-stacks.json",q7={name:"ext:floor-stacks",schema:hH,intoBundle:function*(e){e.floorStacks!=null&&(yield{path:Z7,contents:e.floorStacks})},fromBundle:(e,t,r)=>{if(e===Z7)return{floorStacks:r(t)}},references:[fh,Y7,J7],integrityCheck:X7};u();u();var mh;(function(e){e.MissingFloorStackError="MissingFloorStackError",e.UnknownFloorStackError="UnknownFloorStackError"})(mh||(mh={}));var K7=e=>{if(e.facade==null)return ie(!0);if(e.floorStacks==null)return ae({kind:mh.MissingFloorStackError,properties:null});let t=new Set(e.floorStacks.map(o=>o.id)),r=Pr(e),n=gi(e);for(let[o,i]of pt(e.facade)){if(i==null)continue;let s=n(o);if(s.isErr())return s;for(let l of i){let{floorStackId:c,geometryIds:p}=l;if(!t.has(c))return ae({kind:mh.UnknownFloorStackError,properties:{floorStackId:c}});for(let d of p){let m=r(o,d);if(m.isErr())return m}}}return ie(!0)};var Q7=b.Intersect([b.Object({floorStackId:b.Ref(fh)}),id],{$id:"Facade"}),gH=b.Object({facade:gr(b.Record(Ze,b.Array(b.Ref(Q7)),{additionalProperties:!1}))},{$id:"FacadeExtensionSchema"}),yH=/^facade\/(.*)\.json$/,eO={name:"ext:facade",schema:gH,intoBundle:function*(e){if(e.facade!=null)for(let t of rt(e.facade))yield{path:`facade/${t}.json`,contents:e.facade[t]}},fromBundle:(e,t,r)=>{let n=e.match(yH)?.[1];if(n)return{facade:{[n]:r(t)}}},references:[fh,Q7],integrityCheck:K7};u();u();var tO=e=>{if(e.floorImages==null)return ie(!0);let t=Pr(e);for(let[r,n]of pt(e.floorImages))if(n!=null)for(let o of n.features){if(!("geometryId"in o.properties))continue;let i=o.properties.geometryId,s=t(r,i);if(s.isErr())return s}return ie(!0)};var bS=b.Object({path:b.String({format:"uri",description:"The path to the image. This will be a remote URL."}),width:b.Number({minimum:0,description:"The width of the image when represented on the map, in meters."}),height:b.Number({minimum:0,description:"The height of the image when represented on the map, in meters."}),rotation:b.Number({minimum:0,maximum:360,description:"Rotation in degrees, about the center of the image. North is 0, east is 90."})},{$id:"BaseFloorImageProperties"}),rO=b.Intersect([b.Ref(bS),Lo],{$id:"AnchoredFloorImageProperties"}),nO=b.Intersect([b.Ref(bS),b.Object({verticalOffset:b.Number({minimum:0,description:"How high to position the image, in meters, relative to the ground plane."})})],{$id:"FloatingFloorImageProperties"}),oO=b.Union([rO,nO],{$id:"FloorImageProperties"}),iO=Kr(b.Ref(fn),oO,{$id:"FloorImageFeature"}),sO=Mn(b.Ref(iO),{$id:"FloorImageCollection"}),bH=b.Object({floorImages:gr(b.Record(Ze,b.Ref(sO),{additionalProperties:!1}))},{$id:"FloorImagesExtensionSchema"}),xH=/^floorImages\/(.*)\.geojson$/,aO={name:"ext:floor-images",schema:bH,intoBundle:function*(e){if(e.floorImages!=null)for(let t of rt(e.floorImages))yield{path:`floorImages/${t}.geojson`,contents:e.floorImages[t]}},fromBundle:(e,t,r)=>{let n=e.match(xH)?.[1];if(n)return{floorImages:{[n]:r(t)}}},references:[bS,rO,nO,oO,iO,sO],integrityCheck:tO};u();u();var lO=e=>{if(e.kinds==null)return ie(!0);let t=Pr(e);for(let[r,n]of pt(e.kinds))if(n!=null)for(let o of rt(n)){let i=t(r,o);if(i.isErr())return i}return ie(!0)};var{values:ACe,schema:vH,record:LCe}=Hn(["room","hallway","wall","object","poi","area","window"],{$id:"Kind"}),cO=vH;var pO=gr(b.Record(mn,b.Ref(cO),{additionalProperties:!1,$id:"GeometryKinds"})),IH=b.Object({kinds:gr(b.Record(Ze,b.Ref(pO),{additionalProperties:!1}))},{$id:"KindsExtensionSchema"}),SH=/^kinds\/(.*)\.json$/,uO={name:"ext:kinds",schema:IH,intoBundle:function*(e){if(e.kinds!=null)for(let t of rt(e.kinds))yield{path:`kinds/${t}.json`,contents:e.kinds[t]}},fromBundle:(e,t,r)=>{let n=e.match(SH)?.[1];if(n)return{kinds:{[n]:r(t)}}},references:[cO,pO],integrityCheck:lO};u();u();u();var K1;(function(e){e.UnknownNeighbor="UnknownNeighbor"})(K1||(K1={}));var dO=e=>{if(e.nodes==null)return ie(!0);let t=hr(e.nodes,o=>o.properties.id,"nodes");if(t.isErr())return t;let r=Pr(e),n=dh(e);for(let[o,i]of pt(e.nodes)){if(i==null)continue;let s=new Set(i.features.map(l=>l.properties.id));for(let[l,c]of i.features.entries()){for(let p of c.properties.geometryIds){let d=r(o,p);if(d.isErr())return d}for(let[p,d]of c.properties.neighbors.entries()){if(!s.has(d.id))return ae({kind:K1.UnknownNeighbor,properties:{floorId:o,nodeId:c.properties.id,neighborId:d.id}});let m=ud(d.flags,n,`nodes["${o}"].features[${l}].properties.neighbors[${p}]`);if(m.isErr())return m}}}return ie(!0)};var xS=mr("n","NodeId"),fO=b.Intersect([b.Object({id:b.Ref(xS,{description:"The unique identifier for the node."}),extraCost:b.Number({minimum:0,description:"The extra cost to traverse to the node, above the straight-line distance."})}),gS],{$id:"NodeNeighbor"}),mO=b.Intersect([b.Object({id:b.Ref(xS,{description:"The unique identifier for the node."}),neighbors:b.Array(b.Ref(fO),{description:"The neighbors of the node."})}),id],{$id:"NodeProperties"}),hO=Kr(b.Ref(fn),mO,{$id:"NodeFeature"}),gO=Mn(b.Ref(hO),{$id:"NodeCollection"}),CH=b.Object({nodes:gr(b.Record(Ze,b.Ref(gO),{additionalProperties:!1}))},{$id:"NodesExtensionSchema"}),TH=/^nodes\/(.*)\.json$/,yO={name:"ext:nodes",schema:CH,intoBundle:function*(e){if(e.nodes!=null)for(let t of rt(e.nodes))yield{path:`nodes/${t}.json`,contents:e.nodes[t]}},fromBundle:(e,t,r)=>{let n=e.match(TH)?.[1];if(n)return{nodes:{[n]:r(t)}}},references:[xS,fO,mO,hO,gO],integrityCheck:dO};u();u();u();var Q1;(function(e){e.FloorInFloorStackError="FloorInFloorStackError"})(Q1||(Q1={}));var bO=e=>{if(e.outdoors==null)return ie(!0);let t=gi(e);for(let r of e.outdoors.floors){let n=t(r);if(n.isErr())return n;if(e.floorStacks!=null){for(let o of e.floorStacks)if(o.floors.includes(r))return ae({kind:Q1.FloorInFloorStackError,properties:{floorId:r,floorStackId:o.id}})}}return ie(!0)};var vO=b.Object({floors:b.Array(b.Ref(Ze),{uniqueItems:!0,description:"A list of floor IDs that should be considered to contain outdoor features."})},{$id:"Outdoors"}),MH=b.Object({outdoors:b.Ref(vO)},{$id:"OutdoorsExtensionSchema"}),xO="outdoors.json",IO={name:"ext:outdoors",schema:MH,intoBundle:function*(e){e.outdoors!=null&&(yield{path:xO,contents:e.outdoors})},fromBundle:(e,t,r)=>{if(e===xO)return{outdoors:r(t)}},references:[vO],integrityCheck:bO};u();u();u();var e0;(function(e){e.TilesetDuplicateKeyError="TilesetDuplicateKeyError"})(e0||(e0={}));var SO=e=>{if(e.tileset==null)return ie(!0);let t=new Set;if(t.add(e.tileset.default.key),e.tileset.others)for(let r of e.tileset.others){if(t.has(r.key))return ae({kind:e0.TilesetDuplicateKeyError,properties:{key:r.key}});t.add(r.key)}return ie(!0)};var vS=b.Object({key:b.String({minLength:1,description:"Unique identifier for the tileset style."}),name:b.String({minLength:1,description:"Display name of the tileset style."}),url:b.String({format:"uri",description:"URL of the tileset style."})},{$id:"TilesetStyle",description:"A tileset style definition."}),CO=b.Object({default:b.Ref(vS,{description:"The default tileset style, which should be used."}),others:b.Optional(b.Array(b.Ref(vS,{description:"Additional tileset styles that can be used."})))},{$id:"TilesetCollection"}),PH=b.Object({tileset:b.Ref(CO)},{$id:"TilesetExtensionSchema"}),TO={name:"ext:mvf-tileset",schema:PH,intoBundle:function*(e){e.tileset!=null&&(yield{path:"tileset.json",contents:e.tileset})},fromBundle:(e,t,r)=>{if(e==="tileset.json")return{tileset:r(t)}},references:[vS,CO],integrityCheck:SO};u();var MO=b.Object({},{$id:"WalkableProperties"}),PO=b.Object({},{$id:"NonWalkableProperties"}),wO=gr(b.Record(mn,b.Ref(MO),{$id:"WalkableGeometries",additionalProperties:!1})),OO=gr(b.Record(mn,b.Ref(PO),{$id:"NonWalkableGeometries",additionalProperties:!1})),wH=b.Object({walkable:gr(b.Record(Ze,b.Ref(wO),{additionalProperties:!1})),nonwalkable:gr(b.Record(Ze,b.Ref(OO),{additionalProperties:!1}))},{$id:"TraversabilitySchema"}),OH=/^walkable\/(.*)\.json$/,_H=/^nonwalkable\/(.*)\.json$/,_O={name:"ext:mvf-traversability",schema:wH,intoBundle:function*(e){if(e.walkable!=null)for(let t of rt(e.walkable))yield{path:`walkable/${t}.json`,contents:e.walkable[t]};if(e.nonwalkable!=null)for(let t of rt(e.nonwalkable))yield{path:`nonwalkable/${t}.json`,contents:e.nonwalkable[t]}},fromBundle:(e,t,r)=>{let n=e.match(OH)?.[1];if(n!=null)return{walkable:{[n]:r(t)}};let o=e.match(_H)?.[1];if(o!=null)return{nonwalkable:{[o]:r(t)}}},references:[MO,PO,wO,OO]};u();u();function EO(e){return e.replace(/^g_/,"s_")}function EH(e){return e.replace(/^g_/,"o_")}function DH(e){return e.replace(/^g_/,"w_")}function DO(e){return e.replace(/^loci_/,"eli_")}function gh(e){return e.replace(/^loc_/,"el_")}function t0(e){return e.replace(/^lcat_/,"ec_")}function FH(e){return e.replace(/^g_/,"ar_")}function kH(e,t,r){switch(e.geometry.type){case"MultiPoint":case"MultiLineString":case"MultiPolygon":{let n=[],o=0,i=e.geometry.type.replace("Multi","");for(let s of e.geometry.coordinates)n.push({...e,geometry:{type:i,coordinates:s},properties:{...e.properties,id:`${t}-${o++}`,kind:r}});return n}default:return[{...e,properties:{...e.properties,id:t,kind:r}}]}}function hh(e,t,r,n){let o=new Map;for(let{feature:i,floorId:s}of e){let l=i.properties.id,c=n.get(l);if(t.has(l)){let p=kH(i,r(l),c),d=p.map(g=>g.properties.id),m=d.map(g=>({geometryId:g,floorId:s}));o.set(l,{ids:d,features:p,anchors:m})}}return o}function FO(e){let t={space:new Map,obstruction:new Map,area:new Map,window:new Map};if(!e.geometry)return t;let r=new Map(Object.values(e.kinds??{}).filter(c=>c!==void 0).flatMap(pt)),n=pt(e.geometry).flatMap(([c,p])=>(p?.features??[]).map(d=>({feature:d,floorId:c}))).flat(),o=new Set(Object.values(e.walkable??{}).filter(c=>c!==void 0).flatMap(rt)),i=new Set(Object.values(e.nonwalkable??{}).filter(c=>c!==void 0).flatMap(rt)),s=new Set(Array.from(r.entries()).filter(([c,p])=>p==="area").map(([c])=>c)),l=new Set(Array.from(r.entries()).filter(([c,p])=>p==="window").map(([c])=>c));return o.size>0&&(t.space=hh(n,o,EO,r)),i.size>0&&(t.obstruction=hh(n,i,EH,r)),s.size>0&&(t.area=hh(n,s,FH,r)),l.size>0&&(t.window=hh(n,l,DH,r)),o.size===0&&i.size===0&&s.size===0&&(t.space=hh(n,new Set(n.map(c=>c.feature.properties.id)),EO,r)),t}function kO(e){let{nodesByGeometryId:t,incomingEdgesByNodeId:r}=AH(e),n=FO(e),o=LH(e),i=e.navigationFlags??{};return{geometryMaps:n,nodesByGeometryId:t,geometryFeatureById:o,navigationFlags:i,incomingEdgesByNodeId:r}}function AH(e){let t=new Map,r=new Map;for(let n of Object.values(e.nodes??{}))for(let o of n?.features??[]){if(o.properties.geometryIds.length>0)for(let i of o.properties.geometryIds){let s=t.get(i)??[];s.push(o.properties.id),t.set(i,s)}if(o.properties.neighbors.length>0)for(let i of o.properties.neighbors){let s=r.get(i.id);s!=null?s.push(i):r.set(i.id,[i])}}return{nodesByGeometryId:t,incomingEdgesByNodeId:r}}function LH(e){let t=new Map;for(let r of Object.values(e.geometry??{}))for(let n of r?.features??[])t.set(n.properties.id,n);return t}u();function AO(e,t){if(!e.annotations||!e.annotationSymbols||!e.geometry)return{};let r={};for(let[n,o]of pt(e.annotations)){if(!o||o.length===0||!e.geometry[n]||e.geometry[n].features.length===0)continue;let i=new Map(e.geometry[n].features.map(l=>[l.properties.id,l])),s={type:"FeatureCollection",features:[]};for(let l of o){let c=i.get(l.geometryId);if(!c||c.geometry.type!=="Point")continue;let p={id:l.id,externalId:l.externalId,symbolId:l.symbolKey};s.features.push({type:"Feature",geometry:c.geometry,properties:p})}r[n]=s}return{annotation:r}}u();function LO(e,{nodesByGeometryId:t}){let r={"connection.json":[],entrance:{}},n=e.navigationFlags?.[hS.accessible],o=e.navigationFlags?.[hS.outdoors],i=new Map(Object.values(e.geometry??{}).flatMap(s=>s?.features??[]).map(s=>[s.properties.id,s]));for(let s of e.connections??[]){if(IS(s,i)){let d=RH(s,i,t,o);for(let[m,g]of d)r.entrance[m]||(r.entrance[m]={type:"FeatureCollection",features:[]}),r.entrance[m].features.push(g);continue}let l=n!=null&&s.entrances.some(d=>Il(d,n))&&s.exits.some(d=>Il(d,n)),c=Array.from(new Set([...s.entrances.map(d=>t.get(d.geometryId)),...s.exits.map(d=>t.get(d.geometryId))].flat().filter(d=>d!=null))),p={id:s.id,externalId:s.details?.externalId??"",type:s.type,accessible:l,nodes:c};s.details?.name&&(p.details={name:s.details.name}),s.extra&&(p.extra=s.extra),r["connection.json"].push(p)}return r}function IS(e,t){return e.type==yS.door&&e.entrances.every(r=>t.get(r.geometryId)?.geometry.type==="LineString")}function RH(e,t,r,n){if(e.type!==yS.door)return[];let o=[];for(let i of e.entrances){let s=t.get(i.geometryId);if(s?.geometry.type==="LineString"){let l={type:"Feature",geometry:s.geometry,properties:{id:e.id,externalId:e.details?.externalId??"",isExterior:BH(e,n)}},c=e.details;c&&(l.properties.details={name:c.name,description:c.description},c.icon&&(l.properties.details.images=[{url:c.icon,altText:`${c.name} icon`}]));let p=r.get(i.geometryId);p&&p.length>0&&(l.properties.node=p[0]),o.push([i.floorId,l])}}return o}function BH(e,t){return e.entrances.some(r=>Il(r,t))||e.exits.some(r=>Il(r,t))}u();function BO(e,{geometryMaps:t,nodesByGeometryId:r}){let n={categories:[],locations:[],locationInstances:[],layers:[],venue:{slug:"",name:"",externalId:"",defaultLanguage:{name:"English",code:"en"},languages:[]}},o=e.manifest?.features[0];o&&(n.venue.defaultFloor=o.properties.defaultFloor,n.venue.tzid=o.properties.tzid,n.venue.name=o.properties.name,n.venue.defaultLanguage={name:o.properties.language??"English",code:o.properties.language??"en"});let i=e.cms?.venue;i&&(n.venue={...n.venue,slug:i.slug,name:i.details?.name??n.venue.name??o.properties.name,externalId:i.details?.externalId??"",defaultLanguage:i.defaultLanguage,languages:i.languages??[],countrycode:i.countrycode,coverImage:i.coverImage,logo:i.logo,icon:i.details?.icon,extra:i.extra,mappedinWebUrl:i.mappedinWebUrl,operationHours:i.operationHours,topLocations:i.topLocations});let s=new Map,l=e.locations??[],c=e.cms?.locations??[],p=e.cms?.categories??[],d=new Map((p??[]).map(O=>[O.categoryId,O]));if(l.length>0){let O=new Map(c.map(M=>[M.locationId,M]));for(let M of l){let E=O.get(M.id)??{};if(M){let B=M.details,j={id:E?.cmsId!==void 0?`el_${E?.cmsId}`:gh(M.id),name:B.name,externalId:B.externalId??"",type:E.type??"location",sortOrder:E.sortOrder??0,amenity:E.amenity,description:B.description,extra:M.extra,links:M.links,operationHours:M.openingHours,gallery:E.gallery,logo:M.logo,shortName:B.shortName,picture:E.picture,showFloatingLabelWhenImagePresent:E.showFloatingLabelWhenImagePresent,showLogo:E.showLogo,siblingGroups:E.siblingGroups,states:E.states,tags:E.tags,spaces:[],nodes:[],polygons:[]};if(M.phone&&(j.phone={number:M.phone}),E.primaryCategory){let N=d.get(E.primaryCategory);N&&(j.primaryCategory=N.id)}let L=RO(M.social);M.website&&(L.website=M.website.url),j.social=L;for(let N of M.geometryAnchors){let X=t.space.get(N.geometryId);if(X){let re=new Set(X.features.filter(Q=>Q.geometry.type==="Polygon").map(Q=>Q.properties.id));for(let Q of X.anchors)j.spaces.push({floor:Q.floorId,id:Q.geometryId}),re.has(Q.geometryId)&&j.polygons.push({map:Q.floorId,id:Q.geometryId})}let Z=r.get(N.geometryId);for(let re of Z??[])j.nodes.push({map:N.floorId,id:re})}n.locations.push(j);for(let N of M.categories)s.set(N,[...s.get(N)??[],M.id])}}}let m=e.cms?.locationInstances??[],g=e.locationInstances;if(g){let O=new Map(m.map(E=>[E.locationInstanceId,E])),M=[];for(let E of g){let B=O.get(E.id)??{};if(E){let j={id:DO(E.id),parent:B.parentId??gh(E.parentId),name:E.details?.name,externalId:E.details?.externalId,type:B.type,sortOrder:B.sortOrder,amenity:B.amenity,description:E.details?.description,extra:E.extra,links:E.links,operationHours:E.openingHours,gallery:B.gallery,picture:B.picture,showFloatingLabelWhenImagePresent:B.showFloatingLabelWhenImagePresent,showLogo:B.showLogo,siblingGroups:B.siblingGroups,states:B.states,tags:B.tags,logo:E.logo,shortName:E.details?.shortName};E.phone&&(j.phone={number:E.phone});let L=RO(E.social??[]);if(E.website&&(L.website=E.website.url),Object.keys(L).length>0&&(j.social=L),E.geometryAnchors?.length){let N=E.geometryAnchors.flatMap(X=>t.space.get(X.geometryId)?.anchors??[]);N.length>0&&(j.spaces=N.map(X=>({floor:X.floorId,id:X.geometryId})))}if(E.geometryAnchors){j.spaces=[],j.polygons=[],j.nodes=[];for(let N of E.geometryAnchors){let X=t.space.get(N.geometryId);if(X){let re=new Set(X.features.filter(Q=>Q.geometry.type==="Polygon").map(Q=>Q.properties.id));for(let Q of X.anchors)j.spaces.push({floor:Q.floorId,id:Q.geometryId}),re.has(Q.geometryId)&&j.polygons.push({map:Q.floorId,id:Q.geometryId})}let Z=r.get(N.geometryId);for(let re of Z??[])j.nodes.push({map:N.floorId,id:re})}}M.push(j)}}M.length>0&&(n.locationInstances=M)}let x=e.locationCategories;if(x){let O=[],M=new Map(x.map(L=>[L.id,L])),E=new Map((p??[]).map(L=>[L.categoryId,L])),B=new Map;for(let L of x){let N=M.get(L.parent);if(N){let X=B.get(N.id)??[];X.push(L.id),B.set(N.id,X)}}for(let L of x){let N=E.get(L.id);if(L){let X=(B.get(L.id)??[]).map(t0),Z={id:t0(L.id),name:L.details.name,externalId:L.details.externalId??"",sortOrder:N?.sortOrder??0,children:X,locations:(s.get(L.id)??[]).map(gh),icon:L.details.icon,picture:N?.picture,color:N?.color,extra:L.extra,iconFromDefaultList:N?.iconFromDefaultList};O.push(Z)}}n.categories=O;let j={};for(let L of l)j[gh(L.id)]=L.categories.map(t0).filter(N=>N!==void 0);n.categoryPriorities=j}let v={};for(let[O,M]of Object.entries(e.defaultStyle??{}))if(M.buffer){let E=M.geometryAnchors.flatMap(B=>t.space.get(B.geometryId)?.anchors??[]);v[O]={edgeOffset:M.buffer,geometryAnchors:E}}Object.keys(v).length>0&&(n.enterpriseStyles=v);let C=new Map;for(let O of Object.values(e.cms?.layers??{}))if(O)for(let[M,E]of pt(O)){if(typeof E!="string")continue;let B=C.get(E)??{name:E,id:`ely_${E}`,spaces:[]};B.spaces.push(...t.space.get(M)?.anchors.map(j=>({floorId:j.floorId,spaceId:j.geometryId}))??[]),C.set(E,B)}C.size>0&&(n.layers=Array.from(C.values()));let I=[];for(let O of Object.values(e.cms?.textures??{}))for(let M of O){let E=t.space.get(M.geometryId)?.anchors;!E||E.length<1||M.face==="unknown"||M.surface==="unknown"||I.push({repeat:M.repeat,offset:M.offset,rotation:M.rotation,path:M.path,face:M.face,surface:M.surface,bounds:M.bounds,geometryAnchors:E})}I.length>0&&(n.textures=I);let S={};for(let[O,M]of Object.entries(e.cms?.floorText??{})){let E={type:"FeatureCollection",features:[]};for(let B of M.features){if(B.properties.align==="unknown")continue;let j={align:B.properties.align,color:B.properties.color,fontFamily:B.properties.fontFamily,fontSize:B.properties.fontSize,rotation:B.properties.rotation,text:B.properties.text,visible:B.properties.visible};"geometryId"in B.properties?j.geometryId=B.properties.geometryId:j.verticalOffset=B.properties.verticalOffset,E.features.push({type:"Feature",geometry:B.geometry,properties:j})}E.features.length>0&&(S[O]=E)}Object.keys(S).length>0&&(n.floorText=S);let P={enterprise:n};if(e.cms?.textAreas){let O={};for(let[M,E]of pt(e.cms.textAreas)){let B={type:"FeatureCollection",features:[]};for(let j of E.features){if(j.properties.align==="unknown")continue;let L={align:j.properties.align,maxWidth:j.properties.maxWidth,maxHeight:j.properties.maxHeight,rotation:j.properties.rotation};"geometryId"in j.properties?L.anchorId=j.properties.geometryId:L.verticalOffset=j.properties.verticalOffset;let N={type:"Feature",geometry:j.geometry,properties:L};B.features.push(N)}O[M]=B}P.textAreas=O}return P}var NH=["facebook","instagram","twitter"];function RO(e){let t={};for(let{name:r,url:n}of e){let o=r.toLowerCase();NH.includes(o)&&(t[o]=n)}return t}u();var GH=e=>`fc_${e.slice(3)}`;function NO(e,{geometryMaps:t}){if(!e.facade)return{};let r={},n={};for(let[o,i]of pt(e.facade))if(i)for(let s of Object.values(i)){let{floorStackId:l,geometryIds:c}=s,p=GH(l);n[l]??(n[l]={id:p,spaces:[]}),n[l].spaces.push(...c.map(d=>({floorId:o,spaceId:t.space.get(d)?.ids[0]??""})))}return Object.keys(n).length>0&&(r.facade=n),r}u();function GO(e,t={}){let r={type:"FeatureCollection",features:[]},n=[];for(let o of e.floors.features)n.push({id:o.properties.id.replace(/^f_/,"m_"),externalId:o.properties.details?.externalId??"",elevation:o.properties.elevation,name:o.properties.details?.name??"",shortName:o.properties.details?.shortName??"",subtitle:o.properties.subtitle}),r.features.push({type:"Feature",geometry:o.geometry,properties:{id:o.properties.id,externalId:o.properties.details?.externalId??"",elevation:o.properties.elevation,name:o.properties.details?.name??"",shortName:o.properties.details?.shortName??"",subtitle:o.properties.subtitle}});return{"floor.geojson":r,"map.geojson":n}}u();function jO(e,{geometryMaps:t}){let r={},n={};for(let[o,i]of pt(e.floorImages??{})){let s={features:[],type:"FeatureCollection"};for(let l of i?.features??[])if("verticalOffset"in l.properties)s.features.push(l);else{let{geometryId:c,...p}=l.properties,d=t.space.get(c)?.ids[0]??t.obstruction.get(c)?.ids[0];if(!d)continue;let m={geometry:l.geometry,properties:{...p,anchorId:d},type:l.type};s.features.push(m)}n[o]=s}return Object.keys(n).length>0&&(r.floorImages=n),r}u();function UO(e,t={}){let r=[];for(let o of e?.floorStacks??[]){let i={id:o.id,floors:o.floors,maps:o.floors,externalId:o.details?.externalId??"",name:o.details?.name??"",shortName:o.details?.shortName??"",type:"Building"};o.defaultFloor&&(i.defaultFloor=o.defaultFloor),r.push(i)}if(e.outdoors){let o={id:"outdoors",floors:e.outdoors.floors,maps:e.outdoors.floors,type:"Outdoor",name:"Outdoors",externalId:"outdoors"};r.push(o)}return{"floorstack.json":r,"mapstack.geojson":r}}u();u();var $O=il(WO(),1),WH=e=>{let t=e.geometry.coordinates[0],r=0;for(let n=0;n<t.length-1;n++)r+=t[n][0]*t[n+1][1]-t[n+1][0]*t[n][1];return Math.abs(r/2)},$H=(e,t)=>{let[r,n]=e,o=t.geometry.coordinates[0],i=!1;for(let s=0,l=o.length-1;s<o.length;l=s++){let[c,p]=o[s],[d,m]=o[l];p>n!=m>n&&r<(d-c)*(n-p)/(m-p)+c&&(i=!i)}return i},zH=e=>{let t=e.geometry.coordinates[0],r=0,n=0;for(let o=0;o<t.length-1;o++)r+=t[o][0],n+=t[o][1];return{geometry:{coordinates:[r/(t.length-1),n/(t.length-1)]}}},XH=e=>{let t=WH(e),r=Number.isFinite(t)?Math.max(t,1):1;return Math.sqrt(r)*1e-6},n0=e=>{try{let r=zH(e).geometry.coordinates;if(!$H(r,e)){let o=(0,$O.default)(e.geometry.coordinates,XH(e));return ie([o[0],o[1]])}return ie(r)}catch{return ae(new Error("Unable to calculate center of polygon"))}};function MS(e){return e?.geometry?.type==="Polygon"}function zO(e,{geometryMaps:t,nodesByGeometryId:r}){let n=KH(e.defaultStyle),o={},i={},s={},l={};for(let p of rt(e.geometry)){let d=e.geometry[p];if(!d)continue;let m=[],g=[],x=[],v=[];for(let C of d.features){let I=C.properties.id,S=n.has(I),P=r.get(I)??[];for(let O of t.space.get(I)?.features??[])m.push(ZH(O,P));for(let O of t.obstruction.get(I)?.features??[])g.push(YH(O,S));for(let O of t.area.get(I)?.features??[])x.push(JH(O,P));for(let O of t.window.get(I)?.features??[])v.push(qH(O))}m.length>0&&(o[p]={type:"FeatureCollection",features:m.filter(C=>C!==null)}),g.length>0&&(i[p]={type:"FeatureCollection",features:g.filter(C=>C!==null)}),x.length>0&&(s[p]={type:"FeatureCollection",features:x.filter(C=>C!==null)}),v.length>0&&(l[p]={type:"FeatureCollection",features:v.filter(C=>C!==null)})}let c={space:o,obstruction:i};return Object.keys(s).length>0&&(c.area=s),Object.keys(l).length>0&&(c.window=l),c}function ZH(e,t){switch(e.geometry.type){case"MultiPoint":case"MultiLineString":case"MultiPolygon":return null}let r={type:"Feature",geometry:e.geometry,properties:{destinationNodes:t,id:e.properties.id,externalId:e.properties.details?.externalId??"",kind:e.properties.kind}};return e.properties.details&&(r.properties.details={name:e.properties.details.name,description:e.properties.details.description,images:e.properties.details.icon?[{url:e.properties.details.icon,altText:e.properties.details.name?`${e.properties.details.name} icon`:"icon"}]:void 0}),MS(r)&&(r.properties.center=n0(r).unwrapOr(void 0)),r}function YH(e,t){switch(e.geometry.type){case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"Point":return null}let r=e.properties,n={type:"Feature",geometry:e.geometry,properties:{id:r.id,externalId:r.details?.externalId??"",entrances:[],kind:r.kind,footprintComponent:t}};return MS(n)&&(n.properties.center=n0(n).unwrapOr(void 0)),r.details&&(n.properties.details={name:r.details.name,description:r.details.description,images:r.details.icon?[{url:r.details.icon,altText:r.details.name?`${r.details.name} icon`:"icon"}]:void 0}),n}function JH(e,t){if(e.geometry.type!=="Polygon")return null;let r=e.properties,n={type:"Feature",geometry:e.geometry,properties:{id:r.id,externalId:r.details?.externalId??"",destinationNodes:t}};return MS(n)&&(n.properties.center=n0(n).unwrapOr(void 0)),r.details&&(n.properties.details={name:r.details.name,description:r.details.description,images:r.details.icon?[{url:r.details.icon,altText:r.details.name?`${r.details.name} icon`:"icon"}]:void 0}),n}function qH(e){return e.geometry.type!=="LineString"?null:{type:"Feature",geometry:e.geometry,properties:{id:e.properties.id}}}function KH(e){let t=[...e?.ExteriorWalls?.geometryAnchors??[],...e?.Walls?.geometryAnchors??[]];return new Set(t.map(n=>n.geometryId))}u();function XO(e,{geometryMaps:t,geometryFeatureById:r}){if(!e.locationCategories&&!e.locations)return{};let n={};if(e.locationCategories?.length){let o=[];for(let i of e.locationCategories){let s={id:i.id,name:i.details.name,icon:i.details.icon??""};i.parent&&(s.parent=i.parent),o.push(s)}n["category.json"]=o}if(e.locations?.length){let o=QH(e,{geometryFeatureById:r}),i=[];for(let s of e.locations){let l={id:s.id,name:s.details.name,categories:s.categories,spaces:[],obstructions:[],areas:[],annotations:[],connections:[],entrances:[],links:s.links,openingHoursSpecification:s.openingHours??[],pictures:s.images,social:s.social,description:s.details.description,externalId:s.details.externalId,icon:s.details.icon,logo:s.logo,phone:s.phone,website:s.website};i.push(l);for(let{geometryId:c,floorId:p}of s.geometryAnchors)l.spaces.push(...t.space.get(c)?.ids.map(d=>({id:d,floor:p}))??[]),l.obstructions.push(...t.obstruction.get(c)?.ids.map(d=>({id:d,floor:p}))??[]),l.areas.push(...t.area.get(c)?.ids.map(d=>({id:d,floor:p}))??[]),l.entrances.push(...o.entrancesByGeometryId.get(c)??[]),l.connections.push(...o.connectionsByGeometryId.get(c)??[]),l.annotations.push(...o.annotationsByGeometryId.get(c)??[])}n["location.json"]=i}return n}function QH(e,{geometryFeatureById:t}){let r={annotationsByGeometryId:new Map,connectionsByGeometryId:new Map,entrancesByGeometryId:new Map};if(e.annotations)for(let[n,o]of pt(e.annotations))for(let i of o??[]){let s=i.geometryId,l=i.id,c=r.annotationsByGeometryId.get(s)??[];c.push({floor:n,id:l}),r.annotationsByGeometryId.set(s,c)}if(e.connections)for(let n of e.connections){let o=IS(n,t),i=Array.from(new Map([...n.entrances,...n.exits].map(s=>[`${s.geometryId}_${s.floorId}`,s])).values());for(let s of i){let l=s.geometryId;if(o){let c=r.entrancesByGeometryId.get(l)??[];c.push({floor:s.floorId,id:n.id}),r.entrancesByGeometryId.set(l,c)}else{let c=r.connectionsByGeometryId.get(l)??[];c.push(n.id),r.connectionsByGeometryId.set(l,c)}}}return r}u();function ZO(e,t){let r={features:[],type:"FeatureCollection"},n={"manifest.geojson":r},o=e.manifest;if(o.features.length>0){let i=o.features[0],s=i.properties,l={type:"Feature",geometry:i.geometry,properties:{folder_struct:[],version:"2.0.0",time:s.time,name:s.name,naturalBearing:s.naturalBearing,tzid:s.tzid,map:s.mapId,org_id:s.orgId,language:s.language}};r.features.push(l)}return n}u();function YO(e,{geometryMaps:t,navigationFlags:r,incomingEdgesByNodeId:n}){let o={"node.geojson":{type:"FeatureCollection",features:[]}},i=o["node.geojson"].features,s=new Map;for(let p of e.floors?.features??[])s.set(p.properties.id,p.properties.elevation);let l=new Map;for(let p of Object.values(e.nodes??{}))for(let d of p?.features??[])for(let m of d.properties.geometryIds)l.set(m,[...l.get(m)??[],d.properties.id]);let c=new Map;for(let p of e.connections??[]){let d=p.exits.map(m=>({...m,nodes:l.get(m.geometryId)??[]}));for(let m of p.entrances){let g=l.get(m.geometryId)??[];for(let x of g)for(let v of d){let C=Math.abs((s.get(m.floorId)??0)-(s.get(v.floorId)??0))*p.floorCostMultiplier,I=c.get(x)??[];I.push(...v.nodes.map(S=>({id:S,weight:C+p.entryCost}))),c.set(x,I)}}}for(let[p,d]of pt(e.nodes??{}))for(let m of d?.features??[]){let g=t.space.get(m.properties.geometryIds[0])?.features[0],x=g?.geometry.type==="Point"&&g?.properties.details?.externalId?g.properties.details.externalId:"",v=n.get(m.properties.id)??[],C=Object.keys(r??{}),I=[];for(let P of v)for(let O of C)Il(P,r[O])&&I.push(r[O]);let S={type:"Feature",geometry:m.geometry,properties:{id:m.properties.id,floor:p,space:m.properties.geometryIds.map(P=>t.space.get(P)?.ids).flat().filter(P=>P!==void 0),neighbors:[...m.properties.neighbors.map(P=>({id:P.id,weight:P.extraCost})),...c.get(m.properties.id)??[]],map:p,externalId:x,flags:I.length>0?eW(I):void 0}};i.push(S)}return o}function eW(e){if(e==null||e.length===0)return;let t=new Array(Math.max(...e.map(r=>r.index))+1).fill(0);for(let r of e)t[r.index]|=1<<r.bit;return t}u();function tW(e,t){let r={};for(let n of e){let o=t.get(n);o&&(r[o]??(r[o]=[]),r[o].push(n))}return r}function JO(e,{geometryMaps:t}){if(!e.defaultStyle)return{};let r={},n={};r["styles.json"]=n;let o=[...Array.from(t.space.values()).map(s=>s.features),...Array.from(t.obstruction.values()).map(s=>s.features)],i=new Map(o.flatMap(s=>s.map(l=>[l.properties.id,l.geometry.type])));for(let[s,l]of pt(e.defaultStyle)){let c=tW(l.geometryAnchors.flatMap(p=>[...t.space.get(p.geometryId)?.ids??[],...t.obstruction.get(p.geometryId)?.ids??[]]),i);if(c.Point&&c.Point.length>0){let p={points:Array.from(c.Point.values()),showImage:l.extra?.showImage!==void 0?l.extra?.showImage===!0:l.opacity!==0};n[`${s}.Point`]=p}if(c.LineString&&c.LineString.length>0){let p={lineStrings:Array.from(c.LineString.values()),altitude:l.altitude,color:l.color,height:l.height,opacity:l.opacity,width:l.buffer};n[`${s}.LineString`]=p}if(c.Polygon&&c.Polygon.length>0){let p={polygons:Array.from(c.Polygon.values()),altitude:l.altitude,color:l.color,height:l.height,opacity:l.opacity};l.extra?.showImage!==void 0&&(p.showImage=l.extra.showImage===!0),n[`${s}.Polygon`]=p}}return r}var rW=kw().extendOptional(L7).extendOptional(yO).extendOptional(V7).extendOptional(uO).extendOptional(_O).extendOptional(z7).extendOptional(q7).extendOptional(IO).extendOptional(TO).extendOptional(aO).extendOptional(eO).extendOptional(Bw).extendOptional(zw).extendOptional(E7).build({cspSafe:!0}).expect("Invalid parser, this should never happen. Likely a bug in the MVFv2 library, or one of the extensions.");function qO(e){let t=kO(e),r=GO(e,t),n=zO(e,t),o=YO(e,t),i=LO(e,t),s=JO(e,t),l=UO(e,t),c=jO(e,t),p=NO(e,t),d=AO(e,t),m=XO(e,t),g=BO(e,t),x=ZO(e,t);return{...r,...n,...o,...i,...s,...l,"tileset.json":e.tileset,...c,...p,...d,...m,...g,...x}}function PS(e){let t=rW.decompressUnsafeSync(e);return t.isOk()?ie(qO(t.value)):ae(t.error)}u();function dd(e){return e.endsWith("/")?e:`${e}/`}u();var fd="https://app.mappedin.com/",KO="https://auth.mappedin.com/";u();u();var nW=e=>{let t=Date.now();return e-t},o0=(e,t)=>nW(e)<=t*60*1e3;var e6=60,t6=e6*60*1e3,QO="accessTokens";async function yh(e,t=!1){let r=`${e.key}`,n=Zs.getInstance(),o=n?.loadSessionData(QO)||{},i=Math.floor(Date.now()/1e3);if(o[r]&&!o0(o[r].expiresTimestamp*1e3,e6))return o[r];let s=t?await oW(e,i):await iW(e,i),l={...o,[r]:s};return n?.saveSessionData(QO,l),s}async function oW(e,t){let r=`${e.baseAuthUri??KO}oauth2/token`,n=await vi()(r,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({grant_type:"client_credentials",client_id:e.key,client_secret:e.secret})});if(!n.ok)throw new Error(`${n.status} ${n.statusText}: ${await n.text()}`);let o=await n.json();return{accessToken:o.access_token,expiresTimestamp:t+o.expires_in}}async function iW(e,t){let r=`${e.baseAuthUri?dd(e.baseAuthUri):fd}api/v1/api-key/token`,n=await vi()(r,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:e.key,secret:e.secret})});if(!n.ok)throw new Error(`${n.status} ${n.statusText}: ${await n.text()}`);let o=await n.json();return{accessToken:o.access_token,expiresTimestamp:t+o.expires_in}}u();var n6=60,o6=n6*60*1e3,r6="miSasTokens";async function wS(e,t){let r=`${t}__${e.mapId}`,n=Zs.getInstance(),o=n?.loadSessionData(r6)||{};if(o[r]&&!o0(o[r].expires,n6))return o[r];let i=await sW(e,t),s={...o,[r]:{token:i.token,expires:new Date(i.expires).getTime()}};return n?.saveSessionData(r6,s),i}async function sW(e,t){let r=`${e.baseUri?dd(e.baseUri):fd}api/v1/venue/${e.mapId}/sas-token`,n=await vi()(r,{method:"GET",headers:{Authorization:`Bearer ${t}`}});if(!n.ok)throw new Error(`${n.status} ${n.statusText}: ${await n.text()}`);let o=await n.json();return{token:o.token,expires:new Date(o.expires).getTime()}}var i6=globalThis.fetch,aW=y?.env?.npm_package_version;function vi(){if(i6==null)throw new Error("fetch is not available in your environment. Pass your own function into `setFetchFn` (node-fetch, etc)");return i6}var OS={supplementaryUrl:"https://api-gateway.mappedin.com/analytics/",headers:{},accessToken:"",clientId:"",noAuth:!1,includeHidden:!0,clientSecret:"",apiGateway:"",authorization:"",perspective:"Website",language:"",venue:""};function a6(e){let t={...OS,...e};return t.headers={...t.headers,"mappedin-sdk-version":aW},t.things=[],"platformString"in e&&(t.headers={...t.headers,"mappedin-platform-version":e.platformString}),t.noAuth||(t.accessToken?t.authorization=`Bearer ${t.accessToken}`:t.clientId&&t.clientSecret&&(t.authorization=`Basic ${globalThis.btoa(`${t.clientId}:${t.clientSecret}`)}`)),t.language=t.language?.toLowerCase(),t}function lW(e,t,r=!1){let n={language:e.language,clientId:e.clientId,clientSecret:e.clientSecret};r&&delete n.language;let{headers:o}=e;o["Content-Type"]=o["Content-Type"]||"text/json",e.accessToken?o.Authorization=`Bearer ${e.accessToken}`:e.noAuth||e.clientId&&e.clientSecret&&(o["x-mappedin-key"]=btoa(e.clientId),o["x-mappedin-secret"]=btoa(e.clientSecret));let i={method:"GET",headers:o};return e.secure&&(t+="&withcdntoken"),{req:i,url:t}}async function cW(e,t,r=!1){let n=lW(e,t,r),o=await vi()(n.url,n.req);if(!o.ok)throw new Error(`${o.status} ${o.statusText}`);return o.json()}var pW=e=>{let t=e!=null&&typeof e=="object"&&"perspectives"in e&&e.perspectives!=null&&typeof e.perspectives=="object"?e.perspectives:null;if(t==null||Object.keys(t).length===0)return A.warn("No perspectives available in response!"),null;let r={};for(let[n,o]of Object.entries(t)){let i="url"in o&&typeof o.url=="string"?o.url:null,s="locale_packs"in o&&typeof o.locale_packs=="object"?o.locale_packs:null;if(i==null||s==null){A.warn(`Perspective ${n} is missing url or locale_packs!`);continue}r[n]={url:i,locale_packs:s}}return r};async function uW(e,t="exports/mvf/1/bundle"){let r=a6({baseUri:"https://api-gateway.mappedin.com/",...OS,...e}),n=`${r.baseUri+t}?venue=${r.venue}&version=${r.version??"2.0.0"}`;r.headers["Content-Type"]="application/zip";let o=await cW(r,n),i=o.url,s=o.locale_packs,l=r.perspective??OS.perspective,c=pW(o);if(l!=null&&l!==""&&c!=null){let p=c[l];p==null?A.warn(`Perspective ${l} not found in response! Loading default perspective instead.`):(A.log(`Loading perspective "${l}"`),i=p.url,s=p.locale_packs)}return{url:i,localePacks:s,updated_at:o.updated_at}}var md=function(){let e;return()=>(e||(e=new TextDecoder),e)}();async function _S(e,{signal:t}){let r=await(await vi()(e,{signal:t})).arrayBuffer();return new Uint8Array(r)}async function hd(e){let r=(await import("./browser-WC4BWEDX.js")).unzipSync(e),n={};if(r["enterprise/"]!=null){n.enterprise={};let o=r["enterprise/locations.json"];o&&(n.enterprise.locations=JSON.parse(md().decode(o)));let i=r["enterprise/locationInstances.json"];i&&(n.enterprise.locationInstances=JSON.parse(md().decode(i)));let s=r["enterprise/categories.json"];s&&(n.enterprise.categories=JSON.parse(md().decode(s)))}return r["floorstack.json"]&&(n["floorstack.json"]=JSON.parse(md().decode(r["floorstack.json"]))),r["floor.geojson"]&&(n["floor.geojson"]=JSON.parse(md().decode(r["floor.geojson"]))),r["manifest.json"]&&(n["manifest.geojson"]=JSON.parse(md().decode(r["manifest.json"]))),n}async function l6(e,{signal:t}){try{let r=await(await vi()(e,{signal:t})).arrayBuffer();if(t.aborted)return;let n=new Uint8Array(r);return await hd(n)}catch(r){let n=new Error("downloadLanguagePack failed");throw n.cause=r,n}}function dW(e){let{mvfVersion:t,useDraftData:r}=e;if(t==="3.0.0")return r?"exports/mvf3-draft/1/bundle":"exports/mvf3/1/bundle";if(t==null||t==="2.0.0")return r?"exports/mvf2-draft/1/bundle":"exports/mvf2/1/bundle";if(t==="2.0.0-c")return r?"exports/mvf2c-draft/1/bundle":"exports/mvf2c/1/bundle";throw new Error(`Unsupported MVF version: ${t}`)}async function ES(e){return new Promise(async(t,r)=>{try{let n=dW(e),{url:o,localePacks:i}=await uW(e,n),s=await vi()(o).then(c=>c.arrayBuffer()),l=new Uint8Array(s);t({compressed:l,localePacks:i})}catch(n){r(n)}})}async function DS(e,t){return new Promise(async(r,n)=>{try{let{url:o}=await fW(e,t),i=await vi()(o).then(l=>l.arrayBuffer()),s=new Uint8Array(i);r(s)}catch(o){n(o)}})}async function fW(e,t){let r=new URL(`${e.baseUri?dd(e.baseUri):fd}api/v1/venue/${e.mapId}/mvf`);e.viewId&&r.searchParams.set("configId",e.viewId),e.mvfVersion&&r.searchParams.set("version",e.mvfVersion);let n=await vi()(r.toString(),{headers:{Authorization:`Bearer ${t}`}});if(!n.ok)throw new Error(`${n.status} ${n.statusText}`);return n.json()}function FS(e){let t=new TextDecoder,r=t.decode.bind(t);try{let n={"connection.json":JSON.parse(r(e["connection.json"])),"manifest.geojson":JSON.parse(r(e["manifest.geojson"])),"map.geojson":e["map.geojson"]?JSON.parse(r(e["map.geojson"])):void 0,"mapstack.geojson":e["mapstack.geojson"]?JSON.parse(r(e["mapstack.geojson"])):void 0,"node.geojson":JSON.parse(r(e["node.geojson"])),obstruction:{},space:{},entrance:{},facade:{},"tileset.json":e["tileset.json"]?JSON.parse(r(e["tileset.json"])):void 0,"navigationFlags.json":e["navigationFlags.json"]?JSON.parse(r(e["navigationFlags.json"])):void 0};if(e.enterprise!=null&&(n.enterprise={},e.enterprise?.["locations.json"]&&(n.enterprise.locations=JSON.parse(r(e.enterprise?.["locations.json"]))),e.enterprise?.["categories.json"]&&(n.enterprise.categories=JSON.parse(r(e.enterprise?.["categories.json"]))),e.enterprise?.["venue.json"]&&(n.enterprise.venue=JSON.parse(r(e.enterprise?.["venue.json"]))),e.enterprise?.["layers.json"]&&(n.enterprise.layers=JSON.parse(r(e.enterprise?.["layers.json"]))),e.enterprise?.["locationInstances.json"]&&(n.enterprise.locationInstances=JSON.parse(r(e.enterprise?.["locationInstances.json"]))),e.enterprise?.["enterpriseStyles.json"]&&(n.enterprise.enterpriseStyles=JSON.parse(r(e.enterprise?.["enterpriseStyles.json"]))),e.enterprise?.["textures.json"]&&(n.enterprise.textures=JSON.parse(r(e.enterprise?.["textures.json"]))),e.enterprise?.["floorText.json"]&&(n.enterprise.floorText=JSON.parse(r(e.enterprise?.["floorText.json"]))),e.enterprise?.["categoryPriorities.json"]&&(n.enterprise.categoryPriorities=JSON.parse(r(e.enterprise?.["categoryPriorities.json"])))),e["floorstack.json"]!=null?n["floorstack.json"]=JSON.parse(r(e["floorstack.json"])):e["mapstack.json"]!=null&&(n["mapstack.json"]=JSON.parse(r(e["mapstack.json"]))),n["floorstack.json"]==null&&n["mapstack.json"]==null&&n["mapstack.geojson"]==null)throw new Error("MVF is missing floorstack.json or mapstack.json/mapstack.geojson");if(e["floor.geojson"]&&(n["floor.geojson"]=JSON.parse(r(e["floor.geojson"]))),n["floor.geojson"]==null&&n["map.geojson"]==null)throw new Error("MVF is missing floor.geojson or map.geojson");if("styles.json"in e&&(n["styles.json"]=JSON.parse(r(e["styles.json"]))),"shapes.json"in e&&(n["shapes.json"]=JSON.parse(r(e["shapes.json"]))),"location.json"in e&&(n["location.json"]=JSON.parse(r(e["location.json"]))),"category.json"in e&&(n["category.json"]=JSON.parse(r(e["category.json"]))),e.annotation!=null){n.annotation={};let i=Object.keys(e.annotation);for(let s of i){let l=s.replace(/\.json|\.geojson/g,"");n.annotation[l]=JSON.parse(r(e.annotation[s]))}}let o=Object.keys(e.space);for(let i of o){let s=i.replace(/\.json|\.geojson/g,"");n.space[s]=JSON.parse(r(e.space[i]))}if(e.obstruction!=null){let i=Object.keys(e.obstruction);for(let s of i){let l=s.replace(/\.json|\.geojson/g,"");n.obstruction[l]=JSON.parse(r(e.obstruction[s]))}}else n.obstruction={};if(e.entrance!=null){let i=Object.keys(e.entrance);for(let s of i){let l=s.replace(/\.json|\.geojson/g,"");n.entrance[l]=JSON.parse(r(e.entrance[s]))}}else n.entrance={};if("floorImages"in e&&e.floorImages!=null){n.floorImages={};for(let i of Object.keys(e.floorImages)){let s=i.replace(/\.json|\.geojson/g,"");n.floorImages[s]=JSON.parse(r(e.floorImages[i]))}}if("textAreas"in e&&e.textAreas!=null){n.textAreas={};for(let i of Object.keys(e.textAreas)){let s=i.replace(/\.json|\.geojson/g,"");n.textAreas[s]=JSON.parse(r(e.textAreas[i]))}}if("facade"in e&&e.facade!=null){n.facade={};for(let i of Object.keys(e.facade)){let s=i.replace(/\.json|\.geojson/g,"");n.facade[s]=JSON.parse(r(e.facade[i]))}}if("area"in e&&e.area!=null){n.area={};for(let i of Object.keys(e.area)){let s=i.replace(/\.json|\.geojson/g,"");n.area[s]=JSON.parse(r(e.area[i]))}}return n}catch(n){throw A.error(n),new Error("MVF parsing failed! Probably encountered a bad file.")}}function mW(e){if(e==null||typeof e!="object")return!1;let t=["connection.json","manifest.geojson","floor.geojson"in e?"floor.geojson":"map.geojson","node.geojson","floorstack.json"in e?"floorstack.json":"mapstack.json"in e?"mapstack.json":"mapstack.geojson"];"styles.json"in e&&t.push("styles.json"),"shapes.json"in e&&t.push("shapes.json");for(let r of t)if(e[r]==null||e[r][Symbol.toStringTag]!=="Uint8Array")return!1;return!0}async function kS(e){return new Promise(async(t,r)=>{try{if(e==null||typeof e!="object")throw new Error("Error parsing data! Unzipping failed.");if(e[Symbol.toStringTag]!=="Uint8Array")throw new Error("Unexpected file type! Unzipping failed.");let o=(await import("./browser-WC4BWEDX.js")).unzipSync(e);if(!mW(o))throw new Error("MVF is missing some expect static files. Unzipping failed.");let i={},s=Object.keys(o);for(let l of s){if(o[l].length===0)continue;let c=l.split("/");if(c.length<0)throw new Error("Encounted a file with no name! Unzipping failed.");if(c.length>2)throw new Error("Encountered unexpected nesting in MVF! Unzipping failed.");if(c.length===1){i[c[0]]=o[l];continue}if(c[0]==="image"){A.warn("MVF unzipping encountered an image. Ignoring as this case has not been implemented.");continue}else i[c[0]]==null&&(i[c[0]]={}),i[c[0]][c[1]]=o[l]}t(i)}catch(n){r(n)}})}function Cl(){let e="us",t={};function r(){return xW(IW(e),t)}return{updateByUserOption(n){n.environment&&(e=n.environment),n.baseUri&&(t.baseUri=n.baseUri),n.baseAuthUri&&(t.baseAuthUri=n.baseAuthUri),n.analytics?.baseUri&&(t.analyticsBaseUri=n.analytics?.baseUri)},updateTileServerBaseUrl(n){t.tileServerUri=n},updateEnvironment(n){e=n},setEnterprise(n){(e==="us"||e==="us-enterprise")&&(e=n?"us-enterprise":"us")},getBaseUri(){return r().baseUri},getBaseAuthUri(){return r().baseAuthUri},getAnalyticsBaseUri(){return r().analyticsBaseUri},getTileServerUri(){return r().tileServerUri},reset(){e="us",t={}},__getState:r}}var c6=Object.freeze({baseUri:"https://app.mappedin.com/",baseAuthUri:"https://app.mappedin.com/",analyticsBaseUri:"https://api-gateway.mappedin.com/track-analytics/a/",tileServerUri:"https://tiles-cdn.mappedin.com/styles/mappedin/style.json"}),hW=Object.freeze({...c6,baseUri:"https://api-gateway.mappedin.com/",baseAuthUri:"https://auth.mappedin.com/"}),gW=Object.freeze({baseUri:"https://api-gateway.eu.mappedin.com/",baseAuthUri:"https://auth.eu.mappedin.com/",analyticsBaseUri:"https://api-gateway.eu.mappedin.com/track-analytics/a/",tileServerUri:"https://tiles-cdn.eu.mappedin.com/styles/mappedin/style.json"}),yW=Object.freeze({baseUri:"https://api-gateway-staging.mappedin.net/",baseAuthUri:"https://auth-staging.mappedin.net/",analyticsBaseUri:"https://api-gateway-staging.mappedin.net/track-analytics/a/",tileServerUri:"https://tiles-cdn.mappedin.com/styles/mappedin/style.json"}),bW=Object.freeze({baseUri:"https://app-staging.mappedin.net/",baseAuthUri:"https://app-staging.mappedin.net/",analyticsBaseUri:"https://api-gateway-staging.mappedin.net/track-analytics/a/",tileServerUri:"https://tiles-cdn.mappedin.com/styles/mappedin/style.json"});function xW(e,t){return{...e,...t}}var vW={eu:gW,us:c6,"us-enterprise":hW,"us-staging-enterprise":yW,"us-staging-self-serve":bW};function IW(e){return vW[e]}var i0=e=>{let t=Object.values(e["floorstack.json"]??e["mapstack.json"]??{});return t.length===1?[]:t.filter(r=>r.type!=="Outdoor").map(r=>r.id.replace("fs_","").replace("ms_",""))},s6=async e=>{let t=performance.now(),r=PS(e);return A.log(`Parsed MVFv3 in ${performance.now()-t}ms`),r.inspectErr(o=>{throw A.error(o),new Error("MVFv3 parsing failed!")}),r.unwrap()};async function s0(e,t="2.0.0"){switch(t){case"2.0.0":case"2.0.0-c":try{let r=await kS(e);return FS(r)}catch{return s6(e)}case"3.0.0":return s6(e);default:throw new Error(`Unsupported MVF version: ${t}`)}}u();u();u();function Ro(e){if(!e)throw new Error("coord is required");if(!Array.isArray(e)){if(e.type==="Feature"&&e.geometry!==null&&e.geometry.type==="Point")return e.geometry.coordinates;if(e.type==="Point")return e.coordinates}if(Array.isArray(e)&&e.length>=2&&!Array.isArray(e[0])&&!Array.isArray(e[1]))return e;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function fo(e){if(Array.isArray(e))return e;if(e.type==="Feature"){if(e.geometry!==null)return e.geometry.coordinates}else if(e.coordinates)return e.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function gd(e){return e.type==="Feature"?e.geometry:e}function p6(e,t){return e.type==="FeatureCollection"?"FeatureCollection":e.type==="GeometryCollection"?"GeometryCollection":e.type==="Feature"&&e.geometry!==null?e.geometry.type:e.type}function SW(e,t,r){r===void 0&&(r={});for(var n=Ro(e),o=fo(t),i=0;i<o.length-1;i++){var s=!1;if(r.ignoreEndVertices&&(i===0&&(s="start"),i===o.length-2&&(s="end"),i===0&&i+1===o.length-1&&(s="both")),CW(o[i],o[i+1],n,s,typeof r.epsilon>"u"?null:r.epsilon))return!0}return!1}function CW(e,t,r,n,o){var i=r[0],s=r[1],l=e[0],c=e[1],p=t[0],d=t[1],m=r[0]-l,g=r[1]-c,x=p-l,v=d-c,C=m*v-g*x;if(o!==null){if(Math.abs(C)>o)return!1}else if(C!==0)return!1;if(n){if(n==="start")return Math.abs(x)>=Math.abs(v)?x>0?l<i&&i<=p:p<=i&&i<l:v>0?c<s&&s<=d:d<=s&&s<c;if(n==="end")return Math.abs(x)>=Math.abs(v)?x>0?l<=i&&i<p:p<i&&i<=l:v>0?c<=s&&s<d:d<s&&s<=c;if(n==="both")return Math.abs(x)>=Math.abs(v)?x>0?l<i&&i<p:p<i&&i<l:v>0?c<s&&s<d:d<s&&s<c}else return Math.abs(x)>=Math.abs(v)?x>0?l<=i&&i<=p:p<=i&&i<=l:v>0?c<=s&&s<=d:d<=s&&s<=c;return!1}var u6=SW;u();function TW(e,t){t===void 0&&(t={});var r=hu(e),n=(r[0]+r[2])/2,o=(r[1]+r[3])/2;return qi([n,o],t.properties,t)}var yd=TW;u();u();function MW(e,t,r){r===void 0&&(r={});var n=Ro(e),o=Ro(t),i=Rn(o[1]-n[1]),s=Rn(o[0]-n[0]),l=Rn(n[1]),c=Rn(o[1]),p=Math.pow(Math.sin(i/2),2)+Math.pow(Math.sin(s/2),2)*Math.cos(l)*Math.cos(c);return y5(2*Math.atan2(Math.sqrt(p),Math.sqrt(1-p)),r.units)}var Tl=MW;function a0(e,t){return t===void 0&&(t={}),v5(e,function(r,n){var o=n.geometry.coordinates;return r+Tl(o[0],o[1],t)},0)}u();u();u();function l0(e,t,r){if(r===void 0&&(r={}),r.final===!0)return PW(e,t);var n=Ro(e),o=Ro(t),i=Rn(n[0]),s=Rn(o[0]),l=Rn(n[1]),c=Rn(o[1]),p=Math.sin(s-i)*Math.cos(c),d=Math.cos(l)*Math.sin(c)-Math.sin(l)*Math.cos(c)*Math.cos(s-i);return vm(Math.atan2(p,d))}function PW(e,t){var r=l0(t,e);return r=(r+180)%360,r}u();function Bc(e,t,r,n){n===void 0&&(n={});var o=Ro(e),i=Rn(o[0]),s=Rn(o[1]),l=Rn(r),c=b5(t,n.units),p=Math.asin(Math.sin(s)*Math.cos(c)+Math.cos(s)*Math.sin(c)*Math.cos(l)),d=i+Math.atan2(Math.sin(l)*Math.sin(c)*Math.cos(s),Math.cos(c)-Math.sin(s)*Math.sin(p)),m=vm(d),g=vm(p);return qi([m,g],n.properties)}u();u();function wW(e){if(!e)throw new Error("geojson is required");var t=[];return Ki(e,function(r){OW(r,t)}),bc(t)}function OW(e,t){var r=[],n=e.geometry;if(n!==null){switch(n.type){case"Polygon":r=fo(n);break;case"LineString":r=[fo(n)]}r.forEach(function(o){var i=_W(o,e.properties);i.forEach(function(s){s.id=t.length,t.push(s)})})}}function _W(e,t){var r=[];return e.reduce(function(n,o){var i=Ys([n,o],t);return i.bbox=EW(n,o),r.push(i),o}),r}function EW(e,t){var r=e[0],n=e[1],o=t[0],i=t[1],s=r<o?r:o,l=n<i?n:i,c=r>o?r:o,p=n>i?n:i;return[s,l,c,p]}var AS=wW;var _6=il(w6(),1);function n$(e,t){var r={},n=[];if(e.type==="LineString"&&(e=Qv(e)),t.type==="LineString"&&(t=Qv(t)),e.type==="Feature"&&t.type==="Feature"&&e.geometry!==null&&t.geometry!==null&&e.geometry.type==="LineString"&&t.geometry.type==="LineString"&&e.geometry.coordinates.length===2&&t.geometry.coordinates.length===2){var o=O6(e,t);return o&&n.push(o),bc(n)}var i=(0,_6.default)();return i.load(AS(t)),e2(AS(e),function(s){e2(i.search(s),function(l){var c=O6(s,l);if(c){var p=fo(c).join(",");r[p]||(r[p]=!0,n.push(c))}})}),bc(n)}function O6(e,t){var r=fo(e),n=fo(t);if(r.length!==2)throw new Error("<intersects> line1 must only contain 2 coordinates");if(n.length!==2)throw new Error("<intersects> line2 must only contain 2 coordinates");var o=r[0][0],i=r[0][1],s=r[1][0],l=r[1][1],c=n[0][0],p=n[0][1],d=n[1][0],m=n[1][1],g=(m-p)*(s-o)-(d-c)*(l-i),x=(d-c)*(i-p)-(m-p)*(o-c),v=(s-o)*(i-p)-(l-i)*(o-c);if(g===0)return null;var C=x/g,I=v/g;if(C>=0&&C<=1&&I>=0&&I<=1){var S=o+C*(s-o),P=i+C*(l-i);return qi([S,P])}return null}var xd=n$;function o$(e,t,r){r===void 0&&(r={});var n=qi([1/0,1/0],{dist:1/0}),o=0;return Ki(e,function(i){for(var s=fo(i),l=0;l<s.length-1;l++){var c=qi(s[l]);c.properties.dist=Tl(t,c,r);var p=qi(s[l+1]);p.properties.dist=Tl(t,p,r);var d=Tl(c,p,r),m=Math.max(c.properties.dist,p.properties.dist),g=l0(c,p),x=Bc(t,m,g+90,r),v=Bc(t,m,g-90,r),C=xd(Ys([x.geometry.coordinates,v.geometry.coordinates]),Ys([c.geometry.coordinates,p.geometry.coordinates])),I=null;C.features.length>0&&(I=C.features[0],I.properties.dist=Tl(t,I,r),I.properties.location=o+Tl(c,I,r)),c.properties.dist<n.properties.dist&&(n=c,n.properties.index=l,n.properties.location=o),p.properties.dist<n.properties.dist&&(n=p,n.properties.index=l+1,n.properties.location=o+d),I&&I.properties.dist<n.properties.dist&&(n=I,n.properties.index=l),o+=d}}),n}var xh=o$;function i$(e,t,r){var n=fo(r);if(p6(r)!=="LineString")throw new Error("line must be a LineString");var o=xh(r,e),i=xh(r,t),s;o.properties.index<=i.properties.index?s=[o,i]:s=[i,o];for(var l=[s[0].geometry.coordinates],c=s[0].properties.index+1;c<s[1].properties.index+1;c++)l.push(n[c]);return l.push(s[1].geometry.coordinates),Ys(l,r.properties)}var XS=i$;var s$=1e-7;function ZS(e){return{type:"Point",coordinates:e}}function a$(e,t){let{coordinates:r}=t.geometry,{coordinates:n}=e.geometry,o=r.map(i=>xh(e,ZS(i)));return n.reduce((i,s)=>{let l=XS(ZS(s),o[0],e),c=XS(ZS(s),o[1],e),p=a0(l)<a0(c)?l:c;return p.properties={...e.properties,entrances:[]},i.concat([p])},[])}function YS(e,t){return t.reduce((r,n)=>{let o={epsilon:s$},i=r.obstructions.findIndex(l=>u6(yd(n),l,o)),s=r.obstructions[i];if(s){let[l,c]=a$(s,n);r.entrances.push(n),r.obstructions.splice(i,1,l,c)}return r},{obstructions:[e],entrances:[]})}u();u();u();var Or=class{constructor(t){f(this,"id");this.id=t}};u();u();var vd=class vd{constructor(t,r,n){f(this,"__type",vd.__type);f(this,"id",dt());f(this,"latitude");f(this,"longitude");f(this,"floorId");f(this,"verticalOffset");if(typeof t=="object")this.latitude=t.latitude,this.longitude=t.longitude,this.floorId=t.floorId,this.verticalOffset=t.verticalOffset??0;else{if(r==null)throw new Error("Coordinate longitude is required.");this.latitude=t,this.longitude=r,this.floorId=n,this.verticalOffset=0}}static is(t){return t.__type===vd.__type}get anchorTarget(){return this}get focusTarget(){return this}isEqual(t){return this.latitude===t.latitude&&this.longitude===t.longitude&&this.floorId===t.floorId}toJSON(){return{__type:vd.__type,latitude:this.latitude,longitude:this.longitude,floorId:this.floorId,verticalOffset:this.verticalOffset}}destroy(){}};f(vd,"__type","coordinate");var JS=vd,ge=JS;function qS(e){let t=e.enterprise?.locations?.reduce((o,i)=>(o[i.id]=i,o),{})||{};for(let o of e.enterprise?.locationInstances||[])t[o.id]=o;let r={};for(let o of e["floorstack.json"]||[])r[o.id]=o;let n={};for(let o of e["floor.geojson"]?.features||[])o.properties&&o.properties.id&&(n[o.properties.id]=o.properties);return{type:"downloaded",data:e,optimized:{"enterprise-location":t,"enterprise-category":e.enterprise?.categories?.reduce((o,i)=>(o[i.id]=i,o),{})||{},"floor-stack":r,floor:n}}}function E6(e){return/^https?:\/\/cdn\.mappedin\.com/.test(e)}function D6(e){return!!e.split("?")[1]?.includes("sv=")}function Vr(e,t){let r=e?.properties?.id||"unknown";if(e.geometry==null)return A.error(`Cannot get the center coordinate for "${r}" because it has no geometry.`),new ge({latitude:0,longitude:0,floorId:t});try{if(e.geometry.type==="LineString"){let[[n,o],[i,s]]=e.geometry.coordinates,l=(n+i)/2,c=(o+s)/2;return new ge({latitude:c,longitude:l,floorId:t})}else if(e.geometry.type==="Point"){let[n,o]=e.geometry.coordinates;return new ge({latitude:o,longitude:n,floorId:t})}else if(e.geometry.type==="Polygon"){let n=e;if(n.properties.center!=null){let[o,i]=n.properties.center;return new ge({latitude:i,longitude:o,floorId:t})}}}catch{}try{let[n,o]=yd(e).geometry.coordinates;return new ge({latitude:o,longitude:n,floorId:t})}catch(n){return A.error(`Failed to get center coordinate for "${r}" ${n instanceof Error?n.stack:""}`),new ge({latitude:0,longitude:0,floorId:t})}}function F6(e,t){return t&&(e.flags[t.index]&1<<t.bit)!==0}var Ii,Hr,Nc,ga,Id=class Id extends Or{constructor(r,n){super(n.mvfData.properties.id);f(this,"__type",Id.__type);T(this,Ii);T(this,Hr,{});T(this,Nc);T(this,ga);w(this,Ii,r),w(this,Nc,n.floorId),w(this,ga,n.mvfData)}static is(r){return r.__type===Id.__type}get locations(){return a(this,Hr).locations?a(this,Hr).locations:(a(this,Hr).locations=(a(this,Ii).locationIdsByNodeId[this.id]||[]).map(r=>a(this,Ii).getById("enterprise-location",r)).filter(Boolean),a(this,Hr).locations)}get space(){return a(this,Ii).getById("space",a(this,Ii).spaceIdsByNodeId[this.id]?.[0])}get floor(){let r=a(this,Ii).getById("floor",a(this,Nc));if(r==null)throw new Error(`Floor ${a(this,Nc)} not found!`);return r}get coordinate(){return a(this,Hr).coordinate==null&&(a(this,Hr).coordinate=Vr(a(this,ga),a(this,Nc))),a(this,Hr).coordinate}get externalId(){return a(this,ga).properties.externalId??""}get neighbors(){if(a(this,Hr).neighbors==null){let r=a(this,ga).properties.neighbors.map(n=>{let o=a(this,Ii).getById("node",n.id);if(o==null)throw new Error(`Node ${n.id} not found!`);return o});a(this,Hr).neighbors=r}return a(this,Hr).neighbors}get navigationFlags(){if(a(this,Hr).navigationFlags==null){let r=[],n=a(this,ga).properties.flags;if(n!=null&&n.length>0)for(let[o,i]of Object.entries(a(this,Ii).navigationFlags))n.length>i.index&&n[i.index]!=null&&F6({flags:n},i)&&r.push(o);a(this,Hr).navigationFlags=Object.freeze(r)}return a(this,Hr).navigationFlags}get geoJSON(){return{...a(this,ga),properties:null}}get focusTarget(){return this.coordinate}get anchorTarget(){return this.coordinate}toJSON(){return{__type:Id.__type,id:this.id,floor:this.floor.id,coordinate:this.coordinate.toJSON(),neighbors:this.neighbors.map(r=>r.id)}}destroy(){for(let r of Object.keys(a(this,Hr)))delete a(this,Hr)[r]}};Ii=new WeakMap,Hr=new WeakMap,Nc=new WeakMap,ga=new WeakMap,f(Id,"__type","node");var KS=Id,Bo=KS;u();u();u();u();var vh,ya,Sd=class Sd extends Or{constructor(r){super(String(dt()));f(this,"__type",Sd.__type);T(this,vh,{});T(this,ya);w(this,ya,r.mvfData)}static is(r){return r.__type===Sd.__type}get url(){return a(this,ya).url}get name(){if("displayName"in a(this,ya))return a(this,ya).displayName;if("label"in a(this,ya))return a(this,ya).label}toJSON(){return{__type:Sd.__type,id:this.id,url:this.url,name:this.name}}destroy(){for(let r of globalThis.Object.keys(a(this,vh)))delete a(this,vh)[r]}};vh=new WeakMap,ya=new WeakMap,f(Sd,"__type","hyperlink");var QS=Sd,Gc=QS;u();u();function Ih(e){return typeof e=="string"?e:e.id}function t3(e){return Array.isArray(e)&&Number.isFinite(e[0])&&Number.isFinite(e[1])}var e3=8,gs=e=>typeof e=="number"?e.toFixed(e3):t3(e)?e[1].toFixed(e3)+"-"+e[0].toFixed(e3):e.map(t=>gs(t)).join("-"),l$=e=>{let t=/^https:\/\/cdn\.mappedin\.com\/[^/]+\/[^/]+\.[a-zA-Z0-9]+$/,r=/^https:\/\/cdn-staging\.mappedin\.net\/[^/]+\/[^/]+\.[a-zA-Z0-9]+$/;return t.test(e)||r.test(e)},d0=e=>{if(!l$(e))return null;let t="";e.startsWith("https://")?(t="https://",e=e.slice(8)):e.startsWith("http://")&&(t="http://",e=e.slice(7));let[r,n,o]=e.split("/");return{origin:t+r,mapId:n,fileName:o}};var Sh,Pl,jc,Cd=class Cd extends Or{constructor(r){super(String(dt()));f(this,"__type",Cd.__type);T(this,Sh,{});T(this,Pl);T(this,jc);w(this,Pl,r.mvfData),w(this,jc,r.mapData)}static is(r){return r.__type===Cd.__type}get url(){let r=a(this,Pl).url;if(a(this,jc).tokenManager==null)return r;let n=d0(a(this,Pl).url);if(n==null)return r;let o=n.mapId;try{if(a(this,jc).tokenManager.isEnterpriseMode())return r;let i=a(this,jc).tokenManager.getSasToken(o).token;if(i==null||i==="")throw new Error("SAS token empty!");return`${r}?${i}`}catch(i){return A.error("Error getting SAS token for image",{error:i,url:r}),r}}get name(){return a(this,Pl).altText}get altText(){return a(this,Pl).altText}toJSON(){return{__type:Cd.__type,id:this.id,url:this.url,name:this.name}}destroy(){for(let r of globalThis.Object.keys(a(this,Sh)))delete a(this,Sh)[r]}};Sh=new WeakMap,Pl=new WeakMap,jc=new WeakMap,f(Cd,"__type","image");var r3=Cd,Uc=r3;u();var Vc,Si=class{constructor(t,r){f(this,"id");T(this,Vc);this.id=t}get geoJSONBoundingBox(){return a(this,Vc)?a(this,Vc):"bbox"in this.geoJSON.geometry&&this.geoJSON.geometry.bbox?this.geoJSON.geometry.bbox:(w(this,Vc,hu(this.geoJSON)),a(this,Vc))}get geoJSON(){return{properties:null,type:"Feature",geometry:{type:"Polygon",coordinates:[[]]}}}};Vc=new WeakMap;var Td,ba,xa,on=class extends Si{constructor(r,n){super(n.properties.id,r);T(this,Td);T(this,ba);T(this,xa,{});w(this,Td,r),w(this,ba,n)}get externalId(){return a(this,ba).properties.externalId??""}get name(){let r=a(this,ba).properties.details?.name??"";return r===""&&(r=this.locationProfiles.find(n=>n.name&&n.name.length>0)?.name??""),r}get description(){let r=a(this,ba).properties.details?.description??"";return r===""&&(r=this.locationProfiles.find(n=>n.description&&n.description.length>0)?.description??""),r}get images(){if(a(this,xa).images!=null)return a(this,xa).images;let r=a(this,ba).properties.details?.images?.map(n=>new Uc({mvfData:n,mapData:a(this,Td)}))??[];return(r==null||r.length===0)&&(r=this.locationProfiles.find(n=>n.images.length>0)?.images??[]),a(this,xa).images=r,r}get links(){if(a(this,xa).links!=null)return a(this,xa).links;let r=a(this,ba).properties.details?.links?.map(n=>new Gc({mvfData:n}))??[];return(r==null||r.length===0)&&(r=this.locationProfiles.find(n=>n.links.length>0)?.links??[]),a(this,xa).links=r,r}get locationProfiles(){return a(this,Td).locationProfilesByAttachedFeatureId[this.id]??[]}};Td=new WeakMap,ba=new WeakMap,xa=new WeakMap;var Ch,Hc,Pd,wd,Md=class Md extends on{constructor(r,n){super(r,n.mvfData);f(this,"__type",Md.__type);T(this,Ch);T(this,Hc);T(this,Pd,{});T(this,wd);w(this,Ch,r),w(this,Hc,n.floorId),w(this,wd,n.mvfData)}static is(r){return r.__type===Md.__type}get center(){return a(this,Pd).center==null&&(a(this,Pd).center=Vr(a(this,wd),a(this,Hc))),a(this,Pd).center}get floor(){let r=a(this,Ch).getById("floor",a(this,Hc));if(r==null)throw new Error(`Floor ${a(this,Hc)} not found!`);return r}get geoJSON(){return{...a(this,wd),properties:null}}get focusTarget(){return this}get anchorTarget(){return this.center}toJSON(){return{__type:Md.__type,id:this.id,name:this.name,floor:this.floor.id}}destroy(){}};Ch=new WeakMap,Hc=new WeakMap,Pd=new WeakMap,wd=new WeakMap,f(Md,"__type","area");var n3=Md,va=n3;u();var Wc,Ia,$c,zc,Od=class Od extends on{constructor(r,n){super(r,n.mvfData);f(this,"__type",Od.__type);T(this,Wc);T(this,Ia);T(this,$c);T(this,zc);w(this,Ia,{}),w(this,zc,n.mvfData),w(this,Wc,r),w(this,$c,n.floorId)}static is(r){return r.__type===Od.__type}get floor(){let r=a(this,Wc).getById("floor",a(this,$c));if(r==null)throw new Error(`Floor ${a(this,$c)} not found!`);return r}get center(){return a(this,Ia).center==null&&(a(this,Ia).center=Vr(a(this,zc),a(this,$c))),a(this,Ia).center}get isExterior(){if(a(this,zc).properties.isExterior)return!0;let r=a(this,Wc).obstructionIdByEntranceId[this.id];return a(this,Wc).getMVFFeatureById("obstruction",r)?.properties.footprintComponent??!1}get geoJSON(){return{...a(this,zc),properties:null}}get focusTarget(){return this.center}get anchorTarget(){return this.center}toJSON(){return{__type:Od.__type,id:this.id,name:this.name,floor:this.floor.id,center:this.center.toJSON()}}destroy(){for(let r of Object.keys(a(this,Ia)))delete a(this,Ia)[r]}};Wc=new WeakMap,Ia=new WeakMap,$c=new WeakMap,zc=new WeakMap,f(Od,"__type","door");var o3=Od,Ci=o3;u();var wl,Xc,mo,Sa,_d=class _d extends on{constructor(r,n){super(r,n.mvfData);f(this,"__type",_d.__type);T(this,wl);T(this,Xc);T(this,mo,{});T(this,Sa);w(this,wl,r),w(this,Xc,n.floorId),w(this,Sa,n.mvfData)}static is(r){return r.__type===_d.__type}get type(){return p$(a(this,Sa).properties.kind)}get locations(){if(a(this,mo).locations)return a(this,mo).locations;a(this,mo).locations=[];let r=a(this,wl).mvfLocationsBySpaceId[a(this,Sa).properties.id];if(r?.length>0)for(let n of r){let o=a(this,wl).getById("enterprise-location",n.id);o&&a(this,mo).locations.push(o)}return a(this,mo).locations}get floor(){let r=a(this,wl).getById("floor",a(this,Xc));if(r==null)throw new Error(`Floor ${a(this,Xc)} not found!`);return r}get doors(){return a(this,Sa).properties.destinationNodes.reduce((r,n)=>{let o=a(this,wl).doorsByNodeId[n];return o&&r.push(o),r},[])}get center(){return a(this,mo).center==null&&(a(this,mo).center=Vr(a(this,Sa),a(this,Xc))),a(this,mo).center}get geoJSON(){return{...a(this,Sa),properties:null}}get focusTarget(){return this.geoJSON.geometry.type==="Polygon"?this:this.center}get anchorTarget(){return this.center}toJSON(){return{__type:_d.__type,id:this.id,name:this.name,type:this.type,floor:this.floor.id,center:this.center.toJSON()}}destroy(){for(let r of Object.keys(a(this,mo)))delete a(this,mo)[r]}};wl=new WeakMap,Xc=new WeakMap,mo=new WeakMap,Sa=new WeakMap,f(_d,"__type","space");var i3=_d,c$=["room","hallway","exterior","void","gate"];function p$(e){if(e==null||e==="default")return"room";let t=e.toLowerCase();return c$.includes(t)?t:"room"}var _r=i3;u();var No,Mt,ho,Dd,f0,Ed=class Ed extends Si{constructor(r,n){super(n.mvfData.properties.id,r);T(this,Dd);f(this,"__type",Ed.__type);T(this,No);T(this,Mt,{});T(this,ho);w(this,No,r),w(this,ho,n.mvfData)}static is(r){return r.__type===Ed.__type}get focusTarget(){return this}get name(){return"name"in a(this,ho).properties?z(this,Dd,f0).call(this,"name")??"":a(this,ho).properties.externalId??""}get shortName(){return"shortName"in a(this,ho).properties?z(this,Dd,f0).call(this,"shortName")??"":a(this,ho).properties.externalId??""}get subtitle(){return z(this,Dd,f0).call(this,"subtitle")??""}get externalId(){return a(this,ho).properties.externalId??""}get elevation(){return a(this,ho).properties.elevation}get spaces(){if(a(this,Mt).spaces==null){let r=a(this,No).spaces.filter(n=>n.floor.id===this.id);a(this,Mt).spaces=r}return a(this,Mt).spaces}get geoJSON(){return{type:"Feature",properties:null,geometry:a(this,ho).geometry??{type:"Polygon",coordinates:[]}}}get objects(){if(a(this,Mt).objects==null){let r=a(this,No).objects.filter(n=>n.floor.id===this.id);a(this,Mt).objects=r}return a(this,Mt).objects}get connections(){if(a(this,Mt).connections==null){let r=a(this,No).connections.filter(n=>n.floors.includes(this));a(this,Mt).connections=r}return a(this,Mt).connections}get doors(){if(a(this,Mt).doors==null){let r=a(this,No).doors.filter(n=>n.floor.id===this.id);a(this,Mt).doors=r}return a(this,Mt).doors}get annotations(){if(a(this,Mt).annotations==null){let r=a(this,No).annotations.filter(n=>n.floor.id===this.id);a(this,Mt).annotations=r}return a(this,Mt).annotations}get pois(){if(a(this,Mt).pois==null){let r=a(this,No).pointsOfInterest.filter(n=>n.floor.id===this.id);a(this,Mt).pois=r}return a(this,Mt).pois}get floorStack(){if(a(this,Mt).floorStack==null){let r=a(this,No).floorStacks.find(n=>n.floors.includes(this));a(this,Mt).floorStack=r}return a(this,Mt).floorStack}get center(){return a(this,Mt).center==null&&(a(this,Mt).center=Vr(a(this,ho),this.id)),a(this,Mt).center}toJSON(){return{__type:Ed.__type,id:this.id,name:this.name,shortName:this.shortName,subtitle:this.subtitle,elevation:this.elevation,spaces:this.spaces.map(r=>r.id),objects:this.objects.map(r=>r.id),connections:this.connections.map(r=>r.id),doors:this.doors.map(r=>r.id),annotations:this.annotations.map(r=>r.id),pois:this.pois.map(r=>r.id)}}destroy(){for(let r of globalThis.Object.keys(a(this,Mt)))delete a(this,Mt)[r]}};No=new WeakMap,Mt=new WeakMap,ho=new WeakMap,Dd=new WeakSet,f0=function(r){let n=a(this,ho).properties[r];return a(this,No).getPropTranslation(this.__type,r,this.id,n)},f(Ed,"__type","floor");var s3=Ed,Wn=s3;u();u();u();function Fd(e){let t;if(_r.is(e)||Ci.is(e)||$n.is(e)||va.is(e)||Go.is(e))t=e.center;else if(Ca.is(e)||Ta.is(e))t=e.coordinate;else if(ge.is(e))t=e;else if(Bo.is(e))t=e.coordinate;else if(ys.is(e))t=e.coordinates[0];else return;return t}u();u();var Th={debug:!1,pitch:45,bearing:0,antialiasing:{enabled:!0},shadingAndOutlines:!0,outdoorView:{layersHiddenByGeometry:["building","building-top"]},imagePlacementOptions:{mode:"default"},flipImagesToFaceCamera:!0,multiFloorView:{enabled:!0,floorGap:10}},bs="ExteriorWalls",Ol="Walls",k6=0,kd="InteriorDoors",Ad="ExteriorDoors",yr="GeometryLayer",xs="LabelsLayer",Ti="MarkersLayer",Ld="FootprintLayer",_l="OcclusionLayer",Rd="ImagesLayer",Zc="FacadesLayer",vs="PathsLayer";var A6=["https://mappedin.auth0.com","https://mappedin-staging.auth0.com","https://staging.mappedin.com","https://mappedin-staging.auth0.com/userinfo","https://mappedin.com","https://mappedin.auth0.com/userinfo"],u$={orange:"#F26336",teal:"#057685",lightTeal:"#5DC7D0"};var d$=new Set(["outdoorView","bearing","pitch","zoomLevel","screenOffsets","debug","initialFloor","shadingAndOutlines","wallTopColor","style","multiFloorView","occlusion","imagePlacementOptions","flipImagesToFaceCamera","injectStyles","useStandaloneCamera","preloadFloors"]),f$=new Set(["style","enabled","layersHiddenByGeometry","lowDpi"]);function a3(e){e.outdoorView?.enabled&&!e.outdoorView?.token&&A.error("Enable outdoor view requires a token. Provide token in `options.outdoorView.token`")}function l3(e,t){let r=e?.outdoorView?.token||t.outdoorViewToken,n={...Th,...e,outdoorView:{enabled:e?.outdoorView?.enabled===void 0?!!r:e?.outdoorView?.enabled,layersHiddenByGeometry:Th.outdoorView?.layersHiddenByGeometry,...e?.outdoorView},bearing:e?.bearing??t.naturalBearing??0,imagePlacementOptions:{...Th.imagePlacementOptions,...e?.imagePlacementOptions},multiFloorView:{...Th.multiFloorView,...e?.multiFloorView}};return r&&n.outdoorView&&(n.outdoorView.token=r),n}function L6(e){let t={remove_watermark:!1};if(e)try{let r=cb(e);Object.assign(t,r.capabilities)}catch(r){A.error("Error decoding capabilities from token",r)}return t}function R6(e){let t=Object.fromEntries(Object.entries(e).filter(([r])=>d$.has(r)));return t.outdoorView&&(t.outdoorView=Object.fromEntries(Object.entries(t.outdoorView).filter(([r])=>f$.has(r)))),t}var El,jo,Ma,Bd=class Bd extends on{constructor(r,n){let o=Object.values(n.mvfDataByFloorId)[0];super(r,o);f(this,"__type",Bd.__type);T(this,El);T(this,jo);T(this,Ma);w(this,jo,{}),w(this,El,r),w(this,Ma,n.mvfDataByFloorId)}static is(r){return r.__type===Bd.__type}get accessible(){return Object.values(a(this,Ma))[0].properties.accessible??!1}get type(){return Object.values(a(this,Ma))[0].properties.kind?.split(".")[1]??"unknown"}get extra(){return Object.values(a(this,Ma))[0].properties.extra}get coordinates(){return a(this,jo).coordinates==null&&(a(this,jo).coordinates=Object.entries(a(this,Ma)).map(([r,n])=>Vr(n,r))),a(this,jo).coordinates}get nodes(){return Object.values(a(this,Ma))[0].properties.nodes.map(r=>a(this,El).getById("node",r))}get floors(){return this.coordinates.map(r=>r.floorId?a(this,El).getById("floor",r.floorId):void 0).filter(Tm)}get locationProfiles(){if(a(this,jo).locationProfiles!=null)return a(this,jo).locationProfiles;let r=super.locationProfiles;if(r==null||r.length===0){let n=[this.coordinates[0]?.longitude??0,this.coordinates[0]?.latitude??0],o=gs(n),i=a(this,El).mvfConnectionIdsByLatLon[o]??[];for(let s of i){let l=a(this,El).locationProfilesByAttachedFeatureId[s];if(l!=null){r=l;break}}}return a(this,jo).locationProfiles=r??[],r}get focusTarget(){return this.coordinates}toJSON(){return{__type:Bd.__type,id:this.id,name:this.name,type:this.type,externalId:this.externalId,coordinates:this.coordinates.map(r=>r.toJSON()),floors:this.floors.map(r=>r.id),extra:this.extra}}destroy(){for(let r of Object.keys(a(this,jo)))delete a(this,jo)[r]}};El=new WeakMap,jo=new WeakMap,Ma=new WeakMap,f(Bd,"__type","connection");var c3=Bd,Dl=c3;u();var Mh,Yc,Fl,Jc,Nd=class Nd extends on{constructor(r,n){super(r,n.mvfData);f(this,"__type",Nd.__type);T(this,Mh);T(this,Yc);T(this,Fl,{});T(this,Jc);w(this,Mh,r),w(this,Yc,n.floorId),w(this,Jc,n.mvfData)}static is(r){return r.__type===Nd.__type}get type(){let r=a(this,Jc).properties.kind;return r==null&&(r="object"),r==="Desks"&&(r="desk"),r.toLowerCase()}get floor(){let r=a(this,Mh).getById("floor",a(this,Yc));if(r==null)throw new Error(`Floor ${a(this,Yc)} not found!`);return r}get center(){return a(this,Fl).center==null&&(a(this,Fl).center=Vr(a(this,Jc),a(this,Yc))),a(this,Fl).center}get geoJSON(){return{...a(this,Jc),properties:null}}get anchorTarget(){return this.center}get focusTarget(){return this.geoJSON.geometry.type==="Polygon"?this:this.center}toJSON(){return{__type:Nd.__type,id:this.id,name:this.name,type:this.type,floor:this.floor.id,center:this.center.toJSON()}}destroy(){for(let r of globalThis.Object.keys(a(this,Fl)))a(this,Fl)[r]=null}};Mh=new WeakMap,Yc=new WeakMap,Fl=new WeakMap,Jc=new WeakMap,f(Nd,"__type","object");var p3=Nd,$n=p3;u();var Ph,qc,kl,jd,Gd=class Gd extends on{constructor(r,n){super(r,n.mvfData);f(this,"__type",Gd.__type);T(this,Ph);T(this,qc);T(this,kl,{});T(this,jd);w(this,Ph,r),w(this,jd,n.mvfData),w(this,qc,n.floorId)}static is(r){return r.__type===Gd.__type}get floor(){let r=a(this,Ph).getById("floor",a(this,qc));if(r==null)throw new Error(`Floor ${a(this,qc)} not found!`);return r}get coordinate(){return a(this,kl).coordinate==null&&(a(this,kl).coordinate=Vr(a(this,jd),a(this,qc))),a(this,kl).coordinate}get geoJSON(){return{...a(this,jd),properties:null}}get focusTarget(){return this.coordinate}get anchorTarget(){return this.coordinate}toJSON(){return{__type:Gd.__type,id:this.id,name:this.name,floor:this.floor.id,coordinate:this.coordinate.toJSON()}}destroy(){for(let r in a(this,kl))a(this,kl)[r]=null}};Ph=new WeakMap,qc=new WeakMap,kl=new WeakMap,jd=new WeakMap,f(Gd,"__type","point-of-interest");var u3=Gd,Ca=u3;u();var wh,Kc,Al,Qc,Oh,f3,Ud=class Ud extends on{constructor(r,n){super(r,n.mvfData);T(this,Oh);f(this,"__type",Ud.__type);T(this,wh);T(this,Kc);T(this,Al,{});T(this,Qc);w(this,wh,r),w(this,Kc,n.floorId),w(this,Qc,n.mvfData)}static is(r){return r.__type===Ud.__type}get group(){return z(this,Oh,f3).call(this).group}get type(){return z(this,Oh,f3).call(this).type}get coordinate(){return a(this,Al).coordinate==null&&(a(this,Al).coordinate=Vr(a(this,Qc),a(this,Kc))),a(this,Al).coordinate}get floor(){let r=a(this,wh).getById("floor",a(this,Kc));if(r==null)throw new Error(`Floor ${a(this,Kc)} not found!`);return r}get geoJSON(){return{...a(this,Qc),properties:null}}get focusTarget(){return this.coordinate}get anchorTarget(){return this.coordinate}toJSON(){return{__type:Ud.__type,id:this.id,group:this.group,type:this.type,coordinate:this.coordinate.toJSON()}}destroy(){for(let r of Object.keys(a(this,Al)))delete a(this,Al)[r]}};wh=new WeakMap,Kc=new WeakMap,Al=new WeakMap,Qc=new WeakMap,Oh=new WeakSet,f3=function(){let[r,n]=a(this,Qc).properties.symbolId.split("--");return{group:r,type:n}},f(Ud,"__type","annotation");var d3=Ud,Ta=d3;u();var Ll,Uo,Mi,Hd,_h,h3,Vd=class Vd extends Si{constructor(r,n){super(n.mvfData.id,r);T(this,_h);f(this,"__type",Vd.__type);T(this,Ll);T(this,Uo,{});T(this,Mi);T(this,Hd);w(this,Ll,r),w(this,Mi,n.mvfData),w(this,Hd,n.facadeId)}static is(r){return r.__type===Vd.__type}get type(){return a(this,Mi).type}get name(){return z(this,_h,h3).call(this,"name")??""}get shortName(){return z(this,_h,h3).call(this,"shortName")??""}get externalId(){return a(this,Mi).externalId??""}get floors(){if(a(this,Uo).floors==null){let r=(a(this,Mi).floors??a(this,Mi).maps??[]).reduce((n,o)=>{let i=a(this,Ll).floorsById[o];return i&&n.push(i),n},[]);r.length===0&&A.error(`Floor stack ${this.id} has no floors`),a(this,Uo).floors=r.sort((n,o)=>n.elevation-o.elevation)}return a(this,Uo).floors}get defaultFloor(){if(a(this,Uo).defaultFloor!=null)return a(this,Uo).defaultFloor;let r=a(this,Mi).defaultFloor?a(this,Ll).getById("floor",a(this,Mi).defaultFloor):void 0;return a(this,Uo).defaultFloor=r||this.floors.reduce((n,o)=>Math.abs(o.elevation)<Math.abs(n.elevation)?o:n),a(this,Uo).defaultFloor}get facade(){return a(this,Hd)?a(this,Ll).facadesById[a(this,Hd)]:void 0}toJSON(){return{__type:Vd.__type,id:this.id,name:this.name,shortName:this.shortName,type:this.type,floors:this.floors.map(r=>r.id)}}destroy(){for(let r of globalThis.Object.keys(a(this,Uo)))delete a(this,Uo)[r]}};Ll=new WeakMap,Uo=new WeakMap,Mi=new WeakMap,Hd=new WeakMap,_h=new WeakSet,h3=function(r){return a(this,Ll).getPropTranslation(this.__type,r,this.id,a(this,Mi)[r])},f(Vd,"__type","floor-stack");var m3=Vd,m0=m3;u();var $d,ep,zd,Is,Wd=class Wd extends Si{constructor(r,n){super(n.mvfData.id,r);f(this,"__type",Wd.__type);T(this,$d);T(this,ep);T(this,zd);T(this,Is,{});w(this,$d,n.mvfData),w(this,ep,r),w(this,zd,n.floorStackId)}static is(r){return r.__type===Wd.__type}get floorStack(){return a(this,ep).getById("floor-stack",a(this,zd))}get spaces(){if(!a(this,Is).spaces){a(this,Is).spaces=[];for(let r of a(this,$d).spaces){let n=a(this,ep).getById("space",r.spaceId);n&&a(this,Is).spaces.push(n)}}return a(this,Is).spaces}get center(){if(!a(this,Is).center){let r={type:"FeatureCollection",features:[]};for(let o of this.spaces){let i=a(this,ep).mvfSpacesById[o.id];i&&r.features.push(i)}if(r.features.length===0)throw new Br("No geometry found for facade!");let n=yd(r);a(this,Is).center=new ge({latitude:n.geometry.coordinates[1],longitude:n.geometry.coordinates[0],floorId:a(this,$d).spaces[0].floorId})}return a(this,Is).center}get focusTarget(){return this.spaces}get anchorTarget(){return this.center}toJSON(){return{id:this.id,__type:Wd.__type,floorStackId:a(this,zd),floorStack:this.floorStack,spaces:this.spaces}}};$d=new WeakMap,ep=new WeakMap,zd=new WeakMap,Is=new WeakMap,f(Wd,"__type","facade");var g3=Wd,Go=g3;u();var m$=new Set(["wall","area"]),h$=new Set(["void","desk-entrance"]),g$=(e,t)=>{let r={},n={},o={},i={},s={},l={};for(let c of e["location.json"]||[]){let p=new tp(t,{mvfData:c});if(r[c.id]=p,c.externalId&&(i[c.externalId]==null&&(i[c.externalId]=[]),i[c.externalId].push(p)),c.categories)for(let m of c.categories)s[m]==null&&(s[m]=[]),s[m].push(p);let d=[...c.obstructions?.map(m=>m.id)??[],...c.spaces?.map(m=>m.id)??[],...c.annotations?.map(m=>m.id)??[],...c.connections??[],...c.entrances?.map(m=>m.id)??[],...c.areas?.map(m=>m.id)??[]];for(let m of d)m&&(l[m]==null&&(l[m]=[]),l[m].push(p))}for(let c of e["category.json"]||[]){let p=new g0(t,{mvfData:c});n[c.id]=p,c.parent&&(o[c.parent]==null&&(o[c.parent]=[]),o[c.parent].push(p))}return{locationCategoriesByParentId:o,locationProfilesById:r,locationCategoriesById:n,locationProfilesByExternalId:i,locationProfilesByCategoryId:s,locationProfilesByAttachedFeatureId:l}},y$=(e,t,r)=>{let n={},o={},i={},s={},l={},c={},p={},d={},m={},g={},x={},v=globalThis.Object.keys(e.space);for(let C of v){let I=e.space[C];if(I!=null){for(let S of I.features)if(x[S.properties.id]=C,c[S.properties.id]=S,S.properties.kind==="desk-entrance"&&(l[S.properties.externalId]==null&&(l[S.properties.externalId]=[]),l[S.properties.externalId].push(...S.properties.destinationNodes)),!("kind"in S.properties&&S.properties.kind==null||h$.has(S.properties.kind??""))){if(S.properties.kind?.includes("connection")){let P=gs(S.geometry.coordinates);m[P]==null&&(m[P]=[]),m[P].push(S.properties.id);continue}if(S.properties.kind==="poi"||S.geometry.type==="Point"&&S.properties.kind==null){let P=new Ca(r,{floorId:C,mvfData:S});i[S.properties.id]=P,d[C]||(d[C]=[]),d[C].push(S),S.properties.externalId&&(s[S.properties.externalId]==null&&(s[S.properties.externalId]=[]),s[S.properties.externalId].push(P))}else if(S.geometry.type==="Point")A.warn("Encountered a point space with an unknown kind!",S.properties.kind);else{let P=new _r(r,{floorId:C,mvfData:S});n[S.properties.id]=P,S.properties.externalId&&(o[S.properties.externalId]==null&&(o[S.properties.externalId]=[]),o[S.properties.externalId].push(P)),p[C]||(p[C]=[]),p[C].push(S)}}}}for(let C in m){let I=m[C],S={};for(let O of I){let M=x[O],E=c[O],B=t?.["n_"+E.properties.id.split("s_")[1]];S[M]={...E,properties:{...E.properties,accessible:B?.accessible===!0}}}let P=new Dl(r,{mvfDataByFloorId:S});g[P.id]=P}return{spacesById:n,spacesByExternalId:o,poisById:i,poisByExternalId:s,connectionsById:g,objectEntranceNodeIdsByObstructionId:l,mvfSpacesById:c,connectionIdsByLatLon:m,mvfSpacesByFloorId:p,mvfPoisByFloorId:d}},b$=(e,t)=>{let r={},n={},o={},i={};for(let s of e["node.geojson"].features){o[s.properties.id]=s;let l=new Bo(t,{mvfData:s,floorId:s.properties.floor??s.properties.map});r[s.properties.id]=l,s.properties.externalId&&(n[s.properties.externalId]==null&&(n[s.properties.externalId]=[]),n[s.properties.externalId].push(l));let c=s.properties.floor??s.properties.map;i[c]||(i[c]=[]),i[c].push(s)}return{nodesById:r,nodesByExternalId:n,mvfNodesById:o,mvfNodesByFloorId:i}},x$=(e,t)=>{let r={},n={},o={},i={},s=globalThis.Object.keys(e.obstruction);for(let l of s){let c=e.obstruction[l];if(c!=null)for(let p of c.features){o[p.properties.id]=p;for(let m of p.properties.entrances)i[m]=p.properties.id;if(m$.has(p.properties.kind?.toLowerCase()??""))continue;let d=new $n(t,{floorId:l,mvfData:p});r[p.properties.id]=d,p.properties.externalId&&(n[p.properties.externalId]==null&&(n[p.properties.externalId]=[]),n[p.properties.externalId].push(d))}}return{objectsById:r,objectsByExternalId:n,mvfObstructionById:o,obstructionIdByEntranceId:i}},v$=(e,t)=>{let r={},n={},o={};if("floor.geojson"in e&&e["floor.geojson"]!=null)for(let i of e["floor.geojson"].features){o[i.properties.id]=i.properties;let s=new Wn(t,{mvfData:i});r[i.properties.id]=s,i.properties.externalId&&(n[i.properties.externalId]==null&&(n[i.properties.externalId]=[]),n[i.properties.externalId].push(s))}else for(let i of e["map.geojson"]){o[i.id]=i;let s=new Wn(t,{mvfData:{properties:i}});r[i.id]=s}return{floorsById:r,floorsByExternalId:n,mvfFloorsById:o}},I$=(e,t)=>{let r={},n={},o={},i={},s={},l=e["floorstack.json"]||e["mapstack.json"]||e["mapstack.geojson"];if(l!=null)for(let c of l){let p=e.facade?.[c.id],d=new m0(t,{mvfData:c,facadeId:p?.id});if(r[c.id]=d,c.externalId&&(n[c.externalId]==null&&(n[c.externalId]=[]),n[c.externalId].push(d)),o[c.id]=c,p){let m=new Go(t,{mvfData:p,floorStackId:c.id});i[p.id]=m;for(let g of p.spaces)s[g.spaceId]=m}}return{floorStacksById:r,floorStacksByExternalId:n,mvfFloorStacksById:o,facadesById:i,facadesBySpaceId:s}},S$=(e,t)=>{let r={},n={},o=e["connection.json"].reduce((i,s)=>{s.nodes.forEach(c=>i[c]=s),r[s.id]=s;let l=t?.[s.nodes[0]];if(l!=null){let c=gs(l.geometry.coordinates);n[c]==null&&(n[c]=[]),n[c].push(s.id)}return i},{});return{mvfConnectionsById:r,mvfConnectionsByNodeId:o,mvfConnectionIdsByLatLon:n}},C$=(e,t)=>{let r={},n={},o={},i={},s={},l=globalThis.Object.keys(e.entrance);for(let c of l){let p=e.entrance[c];if(p!=null)for(let d of p.features){i[d.properties.id]=d;let m=new Ci(t,{floorId:c,mvfData:d});d.properties.node&&(o[d.properties.node]=m),r[d.properties.id]=m,d.properties.externalId&&(n[d.properties.externalId]==null&&(n[d.properties.externalId]=[]),n[d.properties.externalId].push(m)),s[c]||(s[c]=[]),s[c].push(d)}}return{doorsById:r,doorsByExternalId:n,doorsByNodeId:o,mvfEntrancesById:i,mvfEntrancesByFloorId:s}},T$=(e,t,r)=>{if(e.textAreas!=null)for(let n in e.textAreas){let o=e.textAreas[n]?.features;if(o!=null){for(let i of o)if("anchorId"in i.properties){let s=i?.properties,l=t[s.anchorId]||r[s.anchorId];if(l!=null&&s!=null){let c=l.properties;c.textArea=s,c.textArea&&(c.textArea.position=i.geometry.coordinates)}}}}},M$=(e,t,r)=>{if(e.floorImages!=null)for(let n in e.floorImages){let o=e.floorImages[n]?.features;if(o!=null){for(let i of o)if("anchorId"in i.properties){let s=i?.properties,l=t[s.anchorId]||r[s.anchorId];if(l!=null&&s!=null){let c=l.properties;c.image=s,c.image&&(c.image.position=i.geometry.coordinates)}}}}},P$=(e,t)=>{if(e.enterprise?.enterpriseStyles==null)return;let r=e.enterprise?.enterpriseStyles;for(let n in r){let o=r[n];o.geometryAnchors.forEach(i=>{let s=t[i.geometryId];if(s!=null){let l=s.properties;l.style={styleId:n,edgeOffset:o.edgeOffset}}})}},w$=(e,t,r)=>{if(!(e.enterprise==null||e.enterprise.textures==null))for(let n of e.enterprise.textures)for(let o of n.geometryAnchors){let i=t[o.geometryId]||r[o.geometryId];if(i!=null){let s=i.properties;s.textures==null&&(s.textures=[]),s.textures.push(n)}}},O$=(e,t)=>{let r={},n={},o={};if(e.annotation==null)return{annotationsById:r,mvfAnnotationsById:n,mvfAnnotationsByFloorId:o};let i=globalThis.Object.keys(e.annotation);for(let s of i){let l=e.annotation[s];if(l!=null)for(let c of l.features){n[c.properties.id]=c;let p=new Ta(t,{floorId:s,mvfData:c});r[c.properties.id]=p,o[s]||(o[s]=[]),o[s].push(c)}}return{annotationsById:r,mvfAnnotationsById:n,mvfAnnotationsByFloorId:o}},_$=(e,t)=>{let r={},n={},o={};if(e.area==null)return{areasById:r,areasByExternalId:n,mvfAreasById:o};let i=globalThis.Object.keys(e.area);for(let s of i){let l=e.area[s];if(l!=null)for(let c of l.features){o[c.properties.id]=c;let p=new va(t,{floorId:s,mvfData:c});r[c.properties.id]=p,c.properties.externalId&&(n[c.properties.externalId]==null&&(n[c.properties.externalId]=[]),n[c.properties.externalId].push(p))}}return{areasById:r,areasByExternalId:n,mvfAreasById:o}},B6=(e,t)=>{let r={},n={},o={},i={},s=(e.enterprise?.locations??[]).reduce((P,O)=>(P[O.id]=O,P),{}),l={},c={},p={},d={},m={},g={},x=e.enterprise?.venue||{},v={},C={},I={};for(let P of e.enterprise?.categories??[]){let O=new h0(t,{mvfData:P});l[P.id]=O,P.externalId&&(c[P.externalId]==null&&(c[P.externalId]=[]),c[P.externalId].push(O)),p[P.id]=P,P.locations.forEach(M=>{m[M]==null&&(m[M]=[]),m[M].push(P.id)})}let S={};for(let P of e.enterprise?.locationInstances??[]){let O=s[P.parent],M=Object.keys(O),E={};for(let j of M)E[j]=void 0;let B={...E,polygons:[],nodes:[],...P};S[B.parent]==null&&(S[B.parent]=[]),S[B.parent].push(new ys(t,{mvfData:B,categoryIds:e.enterprise?.categoryPriorities?.[B.id]||m[B.id],parentId:P.parent})),v[B.id]=P}for(let P in e.space){let O=e.space[P];if(O!=null)for(let M of O.features){for(let E of M.properties.destinationNodes)C[E]==null&&(C[E]=[]),C[E].push(M.properties.id);I[M.properties.id]=M.properties.destinationNodes}}for(let P of e.enterprise?.locations??[]){let O=new ys(t,{mvfData:P,categoryIds:e.enterprise?.categoryPriorities?.[P.id]||m[P.id],locationInstances:S[P.id]});o[P.id]=O,P.externalId&&(i[P.externalId]==null&&(i[P.externalId]=[]),i[P.externalId].push(O)),P.nodes.forEach(M=>{g[M.id]==null&&(g[M.id]=[]),g[M.id].push(P.id)});for(let M of P.polygons)d[M.id]==null&&(d[M.id]=[]),d[M.id].push(P)}if(t.enterpriseMode===!0){for(let P in t.mvfConnectionsById){let O={},M=t.mvfConnectionsById[P];for(let E of t.mvfConnectionsById[P].nodes){let B=t.nodesById[E];B!=null&&(O[B.floor.id]={type:"Feature",geometry:{type:"Point",coordinates:[B.coordinate.longitude,B.coordinate.latitude]},properties:{id:P,externalId:M.externalId,kind:"enterprise."+M.type,destinationNodes:[],flags:"",type:M.type,nodes:M.nodes,accessible:M.accessible,extra:M.extra,details:M.details}})}Object.keys(O).length>0&&(r[P]=new Dl(t,{mvfDataByFloorId:O}),M.externalId&&(n[M.externalId]==null&&(n[M.externalId]=[]),n[M.externalId].push(r[P])))}t.connectionsById=r}return{spaceIdsByNodeId:C,connectionsByExternalId:n,locationIdsByNodeId:g,mvfLocationsBySpaceId:d,mvfLocationsById:s,mvfCategoriesById:p,locationsById:o,locationsByExternalId:i,locationInstancesById:v,categoriesById:l,categoriesByExternalId:c,destinationNodesIdsBySpaceId:I,venue:x}},N6=(e,t)=>{let{nodesById:r,nodesByExternalId:n,mvfNodesById:o,mvfNodesByFloorId:i}=b$(e,t),{mvfConnectionsById:s,mvfConnectionsByNodeId:l,mvfConnectionIdsByLatLon:c}=S$(e,o),{spacesById:p,spacesByExternalId:d,poisById:m,poisByExternalId:g,mvfSpacesById:x,objectEntranceNodeIdsByObstructionId:v,connectionsById:C,connectionIdsByLatLon:I,mvfSpacesByFloorId:S,mvfPoisByFloorId:P}=y$(e,l,t),{objectsById:O,objectsByExternalId:M,mvfObstructionById:E,obstructionIdByEntranceId:B}=x$(e,t),{floorsById:j,floorsByExternalId:L,mvfFloorsById:N}=v$(e,t),{floorStacksById:X,floorStacksByExternalId:Z,mvfFloorStacksById:re,facadesById:Q,facadesBySpaceId:xe}=I$(e,t),{doorsById:Ce,doorsByExternalId:ye,doorsByNodeId:Ee,mvfEntrancesById:we,mvfEntrancesByFloorId:pe}=C$(e,t),{annotationsById:Ae,mvfAnnotationsById:mt,mvfAnnotationsByFloorId:Je}=O$(e,t),{areasById:ut,areasByExternalId:qe,mvfAreasById:Te}=_$(e,t);M$(e,x,E),T$(e,x,E),P$(e,x),w$(e,x,E);let{locationCategoriesByParentId:xt,locationProfilesById:Pt,locationCategoriesById:nr,locationProfilesByExternalId:k,locationProfilesByCategoryId:W,locationProfilesByAttachedFeatureId:D}=g$(e,t);return{spacesById:p,spacesByExternalId:d,nodesById:r,nodesByExternalId:n,objectsById:O,objectsByExternalId:M,floorsById:j,floorsByExternalId:L,floorStacksById:X,floorStacksByExternalId:Z,facadesById:Q,facadesBySpaceId:xe,connectionsById:C,doorsById:Ce,doorsByExternalId:ye,doorsByNodeId:Ee,poisById:m,poisByExternalId:g,annotationsById:Ae,areasById:ut,areasByExternalId:qe,objectEntranceNodeIdsByObstructionId:v,obstructionIdByEntranceId:B,connectionIdsByLatLon:I,locationProfilesById:Pt,locationCategoriesById:nr,locationProfilesByExternalId:k,locationProfilesByCategoryId:W,locationCategoriesByParentId:xt,mvfSpacesById:x,mvfNodesById:o,mvfObstructionById:E,mvfFloorsById:N,mvfFloorStacksById:re,mvfConnectionsById:s,mvfConnectionsByNodeId:l,mvfEntrancesById:we,mvfAnnotationsById:mt,mvfNodesByFloorId:i,mvfSpacesByFloorId:S,mvfPoisByFloorId:P,mvfAreasById:Te,mvfEntrancesByFloorId:pe,mvfAnnotationsByFloorId:Je,locationProfilesByAttachedFeatureId:D,mvfConnectionIdsByLatLon:c}};u();var E$=new Set(["polygons"]),Pi,qt,zn,Eh,Xd=class Xd extends Or{constructor(r,n){super(n.mvfData.externalId);f(this,"__type",Xd.__type);f(this,"description");f(this,"name","");f(this,"amenity");f(this,"externalId","");f(this,"extra");f(this,"gallery");f(this,"instances");f(this,"logo");f(this,"operationHours");f(this,"phone");f(this,"picture");f(this,"shortName");f(this,"showFloatingLabelWhenImagePresent");f(this,"showLogo");f(this,"siblingGroups");f(this,"social");f(this,"sortOrder",-1);f(this,"states");f(this,"tags");f(this,"type","");f(this,"hidden",!1);T(this,Pi);T(this,qt,{});T(this,zn);T(this,Eh);w(this,Pi,r),w(this,zn,n.mvfData),w(this,Eh,n.categoryIds||[]),this.instances=n.locationInstances||[];for(let o in n.mvfData)!E$.has(o)&&!Object.getOwnPropertyDescriptor(Object.getPrototypeOf(this),o)&&Object.defineProperty(this,o,{enumerable:!0,get(){if(n.parentId){let i=a(this,Pi).locationsById[n.parentId];return a(this,zn)[o]!=null?a(this,Pi).getPropTranslation(this.__type,o,a(this,zn).id,a(this,zn)[o]):a(this,Pi).getPropTranslation(this.__type,o,a(this,zn).id,i[o])}return a(this,Pi).getPropTranslation(this.__type,o,a(this,zn).id,a(this,zn)[o])}})}static is(r){return r.__type===Xd.__type}get focusTarget(){return this.spaces}get categories(){return a(this,qt).categories?a(this,qt).categories:(a(this,qt).categories=(a(this,Eh).map(r=>a(this,Pi).getById("enterprise-category",r))||[]).filter(Boolean),a(this,qt).categories)}get coordinates(){if(a(this,qt).coordinates)return a(this,qt).coordinates;a(this,qt).coordinates=[];for(let r=0;r<this.nodes.length;r++)a(this,qt).coordinates.push(this.nodes[r].coordinate);return a(this,qt).coordinates}get nodes(){if(a(this,qt).nodes)return a(this,qt).nodes;a(this,qt).nodes=[];for(let r=0;r<a(this,zn).nodes.length;r++){let n=a(this,Pi).getById("node",a(this,zn).nodes[r].id);n&&a(this,qt).nodes.push(n)}return a(this,qt).nodes}get spaces(){if(a(this,qt).spaces)return a(this,qt).spaces;a(this,qt).spaces=[];for(let r=0;r<a(this,zn).polygons.length;r++){let n=a(this,Pi).getById("space",a(this,zn).polygons[r].id);n&&a(this,qt).spaces.push(n)}return a(this,qt).spaces}toJSON(){return{__type:Xd.__type,id:this.id,name:this.name}}destroy(){for(let r of Object.keys(a(this,qt)))delete a(this,qt)[r]}};Pi=new WeakMap,qt=new WeakMap,zn=new WeakMap,Eh=new WeakMap,f(Xd,"__type","enterprise-location");var y3=Xd,ys=y3;u();var D$=new Set,rp,wn,Ss,Zd=class Zd extends Or{constructor(r,n){super(n.mvfData.externalId);f(this,"__type",Zd.__type);f(this,"name","");f(this,"color");f(this,"externalId","");f(this,"extra");f(this,"icon");f(this,"iconFromDefaultList");f(this,"sortOrder",-1);f(this,"picture");T(this,rp);T(this,wn,{});T(this,Ss);w(this,rp,r),w(this,Ss,n.mvfData);for(let o in n.mvfData)!D$.has(o)&&!Object.getOwnPropertyDescriptor(Object.getPrototypeOf(this),o)&&Object.defineProperty(this,o,{get(){return a(this,rp).getPropTranslation(this.__type,o,a(this,Ss).id,a(this,Ss)[o])}})}static is(r){return r.__type===Zd.__type}get children(){if(a(this,wn).children)return a(this,wn).children;a(this,wn).children=[];for(let r=0;r<a(this,Ss).children.length;r++){let n=a(this,rp).getById("enterprise-category",a(this,Ss).children[r]);n&&a(this,wn).children.push(n)}return a(this,wn).children}get locations(){if(a(this,wn).locations)return a(this,wn).locations;a(this,wn).locations=[];for(let r=0;r<a(this,Ss).locations.length;r++){let n=a(this,rp).getById("enterprise-location",a(this,Ss).locations[r]);n&&a(this,wn).locations.push(n)}return a(this,wn).locations}toJSON(){return{__type:Zd.__type,id:this.id,name:this.name}}destroy(){for(let r of Object.keys(a(this,wn)))delete a(this,wn)[r]}};rp=new WeakMap,wn=new WeakMap,Ss=new WeakMap,f(Zd,"__type","enterprise-category");var b3=Zd,h0=b3;u();var F$=new Set,Dh,Jd,Yd=class Yd extends Or{constructor(r,n){super(n.mvfData.externalId);f(this,"__type",Yd.__type);f(this,"countrycode");f(this,"coverImage");f(this,"externalId","");f(this,"defaultLanguage",{code:"en",name:"English"});f(this,"defaultFloor");f(this,"extra");f(this,"icon");f(this,"languages",[]);f(this,"links",[]);f(this,"logo");f(this,"mappedinWebUrl");f(this,"operationHours");f(this,"slug","");f(this,"topLocations");f(this,"tzid");T(this,Dh,{});T(this,Jd);w(this,Jd,n.mvfData);for(let o in n.mvfData)!F$.has(o)&&!Object.getOwnPropertyDescriptor(Object.getPrototypeOf(this),o)&&(this[o]=n.mvfData[o])}static is(r){return r.__type===Yd.__type}get name(){return a(this,Jd).name??""}get defaultMap(){return a(this,Jd).defaultMap??this.defaultFloor??""}toJSON(){return{__type:Yd.__type,id:this.id,name:this.name}}destroy(){for(let r of Object.keys(a(this,Dh)))delete a(this,Dh)[r]}};Dh=new WeakMap,Jd=new WeakMap,f(Yd,"__type","enterprise-venue");var x3=Yd,v3=x3;u();u();u();u();u();var G6=(i=>(i.Departure="Departure",i.TakeConnection="TakeConnection",i.ExitConnection="ExitConnection",i.Turn="Turn",i.Arrival="Arrival",i))(G6||{}),I3=(s=>(s.Straight="Straight",s.Right="Right",s.SlightRight="SlightRight",s.Left="Left",s.SlightLeft="SlightLeft",s.Back="Back",s))(I3||{}),j6=(p=>(p.stairs="stairs",p.elevator="elevator",p.escalator="escalator",p.door="door",p.ramp="ramp",p.slide="slide",p.portal="portal",p.security="security",p.shuttle="shuttle",p))(j6||{}),y0=(r=>(r.Exterior="exterior-walls",r.Interior="interior-walls",r))(y0||{}),b0=(r=>(r.Interior="interior-doors",r.Exterior="exterior-doors",r))(b0||{});function Vo(e){return e.verticalOffset===0?[e.longitude,e.latitude]:[e.longitude,e.latitude,e.verticalOffset]}function k$(e){return new Map(e.map(t=>{let{properties:r}=t,{id:n}=r;return[n,t]}))}var S3=(e,t)=>{let r=k$(t),n={entrances:{type:"FeatureCollection",features:[]},walls:{type:"Feature",properties:{id:e[0].properties.id},geometry:{type:"MultiLineString",coordinates:[]}}};for(let o of e){let i=[o.geometry.coordinates],s=(o.properties.entrances||[]).reduce((l,c)=>(r.has(c)&&l.push(r.get(c)),l),[]);if(s.length){let{entrances:l,obstructions:c}=YS(o,s);i=c.map(p=>p.geometry.coordinates),n.entrances.features.push(...l)}n.walls.geometry.coordinates.push(...i)}return n};function U6(e,t){return((t-e+Math.PI)%(Math.PI*2)+Math.PI*2)%(Math.PI*2)-Math.PI}function V6(e,t){let r="Left";return e<=-Math.PI/4?r="Right":e<=-t?r="SlightRight":e<=t?r="Straight":e<=Math.PI/4?r="SlightLeft":r="Left",r}function H6(e){let t={};for(let r in e){let n=e[r];if(n!=null){if(n.id=r,"polygons"in n)for(let o of n.polygons)t[o]=n;else if("lineStrings"in n)for(let o of n.lineStrings)t[o]=n;else if("points"in n)for(let o of n.points)t[o]=n}}return t}function x0(e,t){return e.reduce((r,n)=>{let o=t[n.properties.id];if(o==null)return r;if("textures"in n.properties&&Array.isArray(n.properties.textures)&&n.properties.textures.length>0){let i={...o,id:o.id+"-textures"};r.set(i,[n])}else r.has(o)||r.set(o,[]),r.get(o).push(n);return r},new Map)}function qd(e,t={}){let r={...e,flipImageToFaceCamera:t?.flipImagesToFaceCamera??!0},n=t?.style?.shading??t?.shadingAndOutlines;if(n===!0?r.shading={start:.1,end:.15,intensity:.4}:typeof n=="object"&&(r.shading={start:n.start,end:n.end,intensity:n.intensity}),r.outline=t?.style?.outlines??t?.shadingAndOutlines,"lineStrings"in e){let o=t?.style?.wallTopColor??t?.wallTopColor;o!=null&&(r.topColor=o)}return r}var W6=(e,t)=>{let n=(t.currentMap?.currentFloor).layers.get(yr);switch(e){case"interior-walls":return n?.layers.get(Ol);case"exterior-walls":return n?.layers.get(bs);case"interior-doors":return n?.layers.get(kd);case"exterior-doors":return n?.layers.get(Ad);default:return typeof e=="string"?e:e.id}};function C3(e){return new Promise(t=>{e.onComplete(t),e.onStop(t)})}function v0(e){return e.bbox?e.bbox:hu(e)}function $6(e,t){return[Math.min(e[0],t[0]),Math.min(e[1],t[1]),Math.max(e[2],t[2]),Math.max(e[3],t[3])]}function T3(e,t,r){return e.floorId&&t.has(e.floorId)?t.get(e.floorId):r}function Kd(e){if(_r.is(e)||$n.is(e))return e.id}function z6(e,t,r){let n=e.coordinates.length===2&&e.coordinates[0].floorId!==e.coordinates[1].floorId,o=!0;if(n&&e.coordinates[0].floorId!=null&&e.coordinates[1].floorId!=null){let i=t?.getById("floor",e.coordinates[0].floorId),s=t?.getById("floor",e.coordinates[1].floorId);if(i&&s){let l=r.getState(i),c=r.getState(s);l!=null&&c!=null&&(o=l.visible&&c.visible&&l.altitude!==c.altitude)}}else{let i=e.coordinates[0].floorId!=null?t?.getById("floor",e.coordinates[0].floorId):void 0;o=i?r.getState(i)?.visible??!0:!0}return o}function X6(e,t){let r=e.properties.path.split("/"),n=r[r.length-1].split(".")[0],o=atob(n);return"img_"+l5(o).toString()+"-"+t}var Z6=Math.PI*.1,On,Xn,go,Pa,np,ef,Ho,Y6,Qd,J6,Rl=class{constructor(t,r,n,o,i){T(this,Ho);f(this,"id");T(this,On,{});T(this,Xn);T(this,go);f(this,"departure");f(this,"destination");T(this,Pa);T(this,np);T(this,ef);this.id=i?.id??dt(),w(this,Xn,r),w(this,go,t.features),this.departure=n,this.destination=o}get path(){return a(this,go).map(t=>a(this,Xn).getById("node",t.properties.id)).filter(Boolean)}get coordinates(){return a(this,On).coordinates?a(this,On).coordinates:(a(this,On).coordinates=a(this,go).map(t=>new ge(t.geometry.coordinates[1],t.geometry.coordinates[0],t.properties.groupBy)),a(this,On).coordinates)}get distance(){return a(this,On).distance?a(this,On).distance:(a(this,On).distance=a(this,go).reduce((t,r)=>t+(r.properties.distance||0),0),a(this,On).distance)}get instructions(){if(a(this,go).length<2)return[];if(a(this,On).instructions)return a(this,On).instructions;let t=[],r=0;for(let n=0;n<a(this,go).length;n++){let o=a(this,go)[n],i=a(this,go)[n-1],s=a(this,go)[n+1],l=new ge(o.geometry.coordinates[1],o.geometry.coordinates[0],o.properties.groupBy),c=z(this,Ho,Y6).call(this,{prevDirection:i,direction:o,nextDirection:s});r+=i?.properties.distance||0;for(let p of c)p&&(t.push({action:p,distance:r,coordinate:l,node:a(this,Xn).getById("node",o.properties.id)}),r=0)}return a(this,On).instructions=t,a(this,On).instructions}toJSON(){return{id:this.id,directions:a(this,go),__type:"directions",from:this.departure,to:this.destination}}};On=new WeakMap,Xn=new WeakMap,go=new WeakMap,Pa=new WeakMap,np=new WeakMap,ef=new WeakMap,Ho=new WeakSet,Y6=function(t){let{prevDirection:r,direction:n,nextDirection:o}=t,i=r&&a(this,Xn).getById("floor",r.properties.groupBy),s=a(this,Xn).getById("floor",n.properties.groupBy),l=o&&a(this,Xn).getById("floor",o.properties.groupBy),c=[];r||c.push({type:"Departure"});let p=a(this,Xn).getMVFFeatureByNodeId("connection",n.properties.id),d=p?a(this,Xn).getById("connection",p.id):void 0,m=p&&p.nodes.length>1,g=a(this,Xn).enterpriseMode&&(!n.properties.destination||!p?.nodes.includes(n.properties.destination)||!p?.nodes.includes(n.properties.id));if(p&&!(!m||g))if(!a(this,Pa)||a(this,Pa)==="exit")c.push(z(this,Ho,Qd).call(this,"TakeConnection",s,l,d,p)),w(this,Pa,"take"),w(this,np,d),w(this,ef,p);else{let v=a(this,Xn).getMVFFeatureByNodeId("connection",r?.properties.id??""),C=a(this,Xn).getById("connection",v?.id??"");c.push(z(this,Ho,Qd).call(this,"ExitConnection",s,i,C,v)),w(this,Pa,"exit"),w(this,np,d),w(this,ef,p)}else a(this,Pa)==="take"?(c.push(z(this,Ho,Qd).call(this,"ExitConnection",s,i,a(this,np),a(this,ef))),w(this,Pa,"exit"),w(this,np,d)):l&&s?.id!==l.id?c.push(z(this,Ho,Qd).call(this,"TakeConnection",s,l,d)):i&&i.id!==s?.id?c.push(z(this,Ho,Qd).call(this,"ExitConnection",s,i,d)):c.push(z(this,Ho,J6).call(this,r,n));return o||c.push({type:"Arrival"}),c},Qd=function(t,r,n,o,i){let s="none",l=r?r.elevation:0;if(l!=null&&n?.elevation!=null){let p=l-n.elevation;p>0?s="down":p<0&&(s="up")}let c=o?.type??i?.type??"stairs";return{type:t,fromFloor:r,toFloor:n,direction:s,connection:o,connectionType:c}},J6=function(t,r){let n=r.properties.edges;if(!n||n.filter(s=>s.destination.properties.id!==t?.properties.id&&s.destination.properties.id!==r.properties.destination).length===0)return null;let i=t?-U6(t.properties.angle,r.properties.angle):0;return Math.abs(i)>=Z6?{type:"Turn",bearing:V6(i,Z6),referencePosition:"At"}:null};u();u();u();u();u();u();u();var op=class{constructor({origin:t,destination:r,distance:n=0,angle:o=0,pathWeight:i=0,multiplicativeDistanceWeightScaling:s=!0}){f(this,"origin");f(this,"destination");f(this,"distance");f(this,"angle");f(this,"weight");if(this.origin=t,this.destination=r,this.distance=n,this.angle=o,this.weight=i||0,s?t.properties.floor===r.properties.floor&&(this.weight=(this.weight>=0?this.distance*this.weight:0)+this.distance):t.properties.map===r.properties.map&&(this.weight=this.weight>=0?this.distance+this.weight:0),isNaN(this.angle))throw new Error("Invalid angle: Expected a numeric value, but received NaN.")}};u();u();u();function wa(e,t,r){if(r===void 0&&(r={}),!e)throw new Error("point is required");if(!t)throw new Error("polygon is required");var n=Ro(e),o=gd(t),i=o.type,s=t.bbox,l=o.coordinates;if(s&&A$(n,s)===!1)return!1;i==="Polygon"&&(l=[l]);for(var c=!1,p=0;p<l.length&&!c;p++)if(q6(n,l[p][0],r.ignoreBoundary)){for(var d=!1,m=1;m<l[p].length&&!d;)q6(n,l[p][m],!r.ignoreBoundary)&&(d=!0),m++;d||(c=!0)}return c}function q6(e,t,r){var n=!1;t[0][0]===t[t.length-1][0]&&t[0][1]===t[t.length-1][1]&&(t=t.slice(0,t.length-1));for(var o=0,i=t.length-1;o<t.length;i=o++){var s=t[o][0],l=t[o][1],c=t[i][0],p=t[i][1],d=e[1]*(s-c)+l*(c-e[0])+p*(e[0]-s)===0&&(s-e[0])*(c-e[0])<=0&&(l-e[1])*(p-e[1])<=0;if(d)return!r;var m=l>e[1]!=p>e[1]&&e[0]<(c-s)*(e[1]-l)/(p-l)+s;m&&(n=!n)}return n}function A$(e,t){return t[0]<=e[0]&&t[1]<=e[1]&&t[2]>=e[0]&&t[3]>=e[1]}u();u();function Oa([e,t],[r,n]){let o=t-n,i=e-r;return(Math.atan2(i,o)+Math.PI*3)%(Math.PI*2)}u();var L$=63710088e-1;function wi(e,t){let[r,n]=e.map(d=>d*Math.PI/180),[o,i]=t.map(d=>d*Math.PI/180),s=i-n,l=o-r,c=Math.sin(s/2)*Math.sin(s/2)+Math.cos(n)*Math.cos(i)*Math.sin(l/2)*Math.sin(l/2),p=2*Math.atan2(Math.sqrt(c),Math.sqrt(1-c));return L$*p}u();u();function I0(e,t,r,n){let[o,i]=e,[s,l]=t,[c,p]=r,[d,m]=n;if(i===l&&o===s||p===m&&c===d)return null;let g=(d-c)*(l-i)-(m-p)*(s-o);if(g===0)return null;let x=((m-p)*(o-c)-(d-c)*(i-p))/g,v=((l-i)*(o-c)-(s-o)*(i-p))/g;if(x<0||x>1||v<0||v>1)return null;let C=i+x*(l-i);return[o+x*(s-o),C]}u();function M3(e,t,r,n){let o=Bc(e,r/1e3,n),i=Bc(t,r/1e3,n);return[o.geometry.coordinates,i.geometry.coordinates]}u();function P3(e){let t=e*(180/Math.PI);return t=t%360,t>180?t-=360:t<-180&&(t+=360),Object.is(t,-0)?0:t}var K6=111e3;function S0(e,t,r=[],n=0){let o=!0,i=e.geometry.coordinates,s=t.geometry.coordinates,l=P3(Oa(i,s)-Math.PI/2),c=P3(Oa(i,s)+Math.PI/2),p=n/K6,d=n/(K6*Math.cos(i[1]*Math.PI/180)),m=Math.min(i[1],s[1])-p,g=Math.max(i[1],s[1])+p,x=Math.min(i[0],s[0])-d,v=Math.max(i[0],s[0])+d;for(let C of r)if(!(Math.max(C[0][1],C[1][1])<m||Math.min(C[0][1],C[1][1])>g||Math.max(C[0][0],C[1][0])<x||Math.min(C[0][0],C[1][0])>v)){if(n>0){let I=M3(i,s,n,l),S=M3(i,s,n,c);if(I0(I[0],I[1],C[0],C[1])||I0(S[0],S[1],C[0],C[1]))return o=!1,!1}else if(I0(i,s,C[0],C[1]))return o=!1,!1}return o}var O3=.4,ip,sn,w3,Q6,e9,t9,r9,n9,o9,T0,C0=class{constructor({nodes:t,groupBy:r,multiplicativeDistanceWeightScaling:n}){T(this,sn);f(this,"edges",{});f(this,"nodesById");f(this,"nodesByGroup",new Map);T(this,ip);f(this,"hasLineOfSight",(t,r,n=[],o=O3)=>S0({type:"Feature",properties:{id:"origin",neighbors:[]},geometry:{type:"Point",coordinates:t}},{type:"Feature",properties:{id:"destination",neighbors:[]},geometry:{type:"Point",coordinates:r}},n,o)===!0);T(this,T0,(t,r)=>{let n=0;for(let o of r)(!o[a(this,ip)]||o[a(this,ip)]===t.properties[a(this,ip)])&&wa(t.geometry.coordinates,o.geometry.geometry)&&(n+=Math.max(0,o.cost));return n});w(this,ip,r);let{features:o}=t;this.nodesById=z(this,sn,Q6).call(this,o),z(this,sn,e9).call(this),z(this,sn,t9).call(this,o,r,{multiplicativeDistanceWeightScaling:n})}getShortestEuclideanDistance(t,r){return r.reduce((n,o)=>{let i=wi(t.geometry.coordinates,o.geometry.coordinates);return Math.min(n,i)},Number.MAX_VALUE)}dijkstraFindWithinTravelDistance(t,r,n,o,i){let s=this.nodesById[t];if(!s)return[];let l=[],c={},p={},d=new Set,m=[];for(l.push({node:s,distance:0}),c[s.properties.id]=null,p[s.properties.id]=0;l.length>0;){l.sort((C,I)=>C.distance-I.distance);let g=l.shift();if(!g)break;let x=g.node,v=g.distance;if(!d.has(x.properties.id)){d.add(x.properties.id),x.properties.id!=null&&n.includes(x.properties.id?.toString())&&(i?this.hasLineOfSight(s.geometry.coordinates,x.geometry.coordinates,o)&&m.push({feature:x,distance:v}):m.push({feature:x,distance:v}));for(let C of this.edges[x.properties.id]){let I=C.destination,S=v+C.distance,P=p[x.properties.id]+C.weight;S>r||d.has(I.properties.id)||p[I.properties.id]!==void 0&&P>=p[I.properties.id]||(p[I.properties.id]=P,c[I.properties.id]=C,l.push({node:I,distance:S}))}}}return m.sort((g,x)=>g.distance-x.distance)}aStar({originIds:t,destinationNodeIds:r,disabledConnectionNodeIds:n,zones:o,overrideEdgeWeights:i}){let s=z(this,sn,w3).call(this,t),l=z(this,sn,w3).call(this,r);if(s.length===0||l.length===0)return[];let{frontier:c,cameFrom:p,costSoFar:d}=z(this,sn,r9).call(this,s,l);for(;c.length>0;){let m=c.shift();if(!m)break;if(z(this,sn,n9).call(this,m.origin,l))return z(this,sn,o9).call(this,p,m.origin.properties.id);for(let g of this.edges[m.origin.properties.id]){let x=i?.get(g)??g.weight;if(n?.has(g.origin.properties.id)&&g.destination.properties.map!==g.origin.properties.map)continue;let v=d[m.origin.properties.id]+x+a(this,T0).call(this,g.destination,o);if(v!==1/0&&(d[g.destination.properties.id]==null||v<d[g.destination.properties.id])){let C=v+this.getShortestEuclideanDistance(g.destination,l);d[g.destination.properties.id]=v,p[g.destination.properties.id]=g,c.push({origin:g.destination,priority:C})}}c.sort((g,x)=>g.priority-x.priority)}return[]}};ip=new WeakMap,sn=new WeakSet,w3=function(t){return t.map(r=>this.nodesById[r]).filter(Boolean)},Q6=function(t){return t.reduce((r,n)=>(r[n.properties.id]=n,r),{})},e9=function(){for(let t in this.nodesById)this.nodesById.hasOwnProperty(t)&&(this.nodesById[t].properties.neighbors=this.nodesById[t].properties.neighbors.filter(({id:r})=>!!this.nodesById[r]))},t9=function(t,r,n){t.forEach(o=>{let i=r==="default"?r:o.properties[r];this.nodesByGroup.has(i)||this.nodesByGroup.set(i,[]),this.nodesByGroup.get(i).push(o),this.edges[o.properties.id]=o.properties.neighbors.map(({id:s,weight:l})=>{let c=this.nodesById[s],p=wi(o.geometry.coordinates,c.geometry.coordinates),d=Oa(o.geometry.coordinates,c.geometry.coordinates);return new op({origin:o,destination:c,pathWeight:l,distance:p,angle:d,multiplicativeDistanceWeightScaling:n?.multiplicativeDistanceWeightScaling})})})},r9=function(t,r){let n=[],o={},i={};return t.forEach(s=>{let l=this.getShortestEuclideanDistance(s,r);n.push({origin:s,priority:l}),o[s.properties.id]=null,i[s.properties.id]=0}),n.sort((s,l)=>s.priority-l.priority),{frontier:n,cameFrom:o,costSoFar:i}},n9=function(t,r){return r.some(n=>n.properties.id===t.properties.id)},o9=function(t,r){let n=[],o=t[r];for(;o;)n.push(o),o=t[o.origin.properties.id];return n.reverse()},T0=new WeakMap;var tf=class{constructor({nodes:t,geojsonCollection:r,groupBy:n="default",multiplicativeDistanceWeightScaling:o}){f(this,"groupBy");f(this,"graph");f(this,"geometryEdgesByMapId",new Map);f(this,"generatePath",t=>{let{destination:r}=t[t.length-1],n={type:"FeatureCollection",features:[]};for(let i=0;i<t.length;i++){let{origin:s,destination:l}=t[i],c={id:s.properties.id,angle:t[i].angle,distance:t[i].distance,destination:l.properties.id,edges:this.graph.edges[s.properties.id]};this.groupBy!=="default"&&(c.groupBy=s.properties[this.groupBy]),n.features.push({type:"Feature",geometry:{type:"Point",coordinates:[s.geometry.coordinates[0],s.geometry.coordinates[1]]},properties:c})}let o={id:r.properties.id,edges:this.graph.edges[r.properties.id]};return this.groupBy!=="default"&&(o.groupBy=r.properties[this.groupBy]),n.features.push({type:"Feature",geometry:{type:"Point",coordinates:[r.geometry.coordinates[0],r.geometry.coordinates[1]]},properties:o}),n});f(this,"findNearestNodesOnGraph",(t,r,n,o,i=!1)=>this.graph.dijkstraFindWithinTravelDistance(t,r,o,this.geometryEdgesByMapId.get(n)??[],i));f(this,"hasLineOfSight",(t,r,n,o)=>this.graph.hasLineOfSight(t,r,this.geometryEdgesByMapId.get(n),o));f(this,"getDistance",(t,r)=>wi(t,r));f(this,"getAngle",(t,r)=>Oa(t,r));this.groupBy=n,this.graph=new C0({nodes:t,groupBy:this.groupBy,multiplicativeDistanceWeightScaling:o}),(r?.features||[]).forEach(s=>{let l=null;if(s.geometry.type==="LineString"?l=s.geometry.coordinates:s.geometry.type==="Polygon"&&(l=s.geometry.coordinates.flat()),l){let c=this.groupBy==="default"?this.groupBy:s.properties[this.groupBy];this.geometryEdgesByMapId.has(c)||this.geometryEdgesByMapId.set(c,[]),l.forEach((p,d)=>{this.geometryEdgesByMapId.get(c).push([p,l[d+1]||l[0]])})}})}getDirections({zones:t,originIds:r,destinationNodeIds:n,disabledConnectionNodeIds:o,simplify:i,multiplicativeDistanceWeightScaling:s,overrideEdgeWeights:l}){let c=i?.enabled??!0,p=t??[],d=this.graph.aStar({originIds:r,destinationNodeIds:n,zones:p,disabledConnectionNodeIds:new Set(o),overrideEdgeWeights:l});return d.length===0?{type:"FeatureCollection",features:[]}:(c&&(d=this.simplifyAllSteps(d,i?.bufferRadius??O3,s)),this.generatePath(d))}simplifyAllSteps(t,r,n){let o=[],i=[t[0]];for(let p=1;p<t.length;p++)if(this.groupBy!=="default"&&t[p].origin.properties[this.groupBy]!==t[p-1].origin.properties[this.groupBy]){let d=t[p-1].origin.properties[this.groupBy],m=this.geometryEdgesByMapId.get(d)??[];o.push(...this.simplifySteps(i,m,r,n)),i=[t[p]]}else i.push(t[p]);let s=t[t.length-1],l=this.groupBy==="default"?this.groupBy:s.origin.properties[this.groupBy],c=this.geometryEdgesByMapId.get(l)??[];return o.push(...this.simplifySteps(i,c,r,n)),o}simplifySteps(t,r,n,o){if(t.length<3)return t;let i=[t[0]],s=1;for(let l=s+2;l<t.length;l++)if(t[s].origin.properties.preventSmoothing||!S0(t[s].origin,t[l].origin,r,n)){let c=l-1;i.push(new op({...t[s],destination:t[c].origin,distance:wi(t[s].origin.geometry.coordinates,t[c].origin.geometry.coordinates),angle:Oa(t[s].origin.geometry.coordinates,t[c].origin.geometry.coordinates)})),s=c}return i.push(new op({...t[s],destination:t[t.length-1].origin,distance:wi(t[s].origin.geometry.coordinates,t[t.length-1].origin.geometry.coordinates),angle:Oa(t[s].origin.geometry.coordinates,t[t.length-1].origin.geometry.coordinates),multiplicativeDistanceWeightScaling:o}),t[t.length-1]),i}};u();var Ut=new WeakMap;function rf(e,t){if(Ut.has(e))return Ut.get(e);if(tp.is(e)){let r=[];for(let n of e.navigationTarget){let o=rf(n,t);r.push(...o)}return Ut.set(e,r),r}else if(Ta.is(e)){let r=t.Query.__LEGACY_NEAREST_SYNC(e,t.getByType("node")),n=r?.[0]?.feature.id?[r[0].feature.id]:[];return Ut.set(e,n),n}else if(ge.is(e)){let r=t.Query.__LEGACY_NEAREST_SYNC(e,t.getByType("node"),{lineOfSight:!0}),n=r?.[0]?.feature.id?[r[0].feature.id]:[];return Ut.set(e,n),n}else if(Ca.is(e)){let r=t.Query.__LEGACY_NEAREST_SYNC(e,t.getByType("node"));return r?.[0]?.feature.id?[r[0].feature.id]:[]}else if(Ci.is(e)){let r=t?.getMVFFeatureById("entrance",e.id),n=r?.properties.node?[r?.properties.node]:[];return Ut.set(e,n),n}else if(va.is(e)){let n=t?.getMVFFeatureById("area",e.id)?.properties.destinationNodes??[];return Ut.set(e,n),n}else if(_r.is(e)){let r=t?.getMVFFeatureById("space",e.id);if(r==null)return[];let n=r.properties.destinationNodes;return Ut.set(e,n),n}else if(Dl.is(e)){let r=[];for(let n of e.coordinates){let o=t.Query.__LEGACY_NEAREST_SYNC(n,t.getByType("node"));o?.[0]?.feature.id&&r.push(o[0].feature.id)}return Ut.set(e,r),r}else if($n.is(e)){let r=t?.objectEntranceNodeIdsByObstructionId[e.id];return Ut.set(e,r??[]),r??[]}else if(Go.is(e)){let r=e.spaces.flatMap(n=>t?.getMVFFeatureById("space",n.id)?.properties.destinationNodes??[]).filter(n=>typeof n=="string");return Ut.set(e,r),r}else if(ys.is(e)){let r=e.nodes.map(n=>n.id);return Ut.set(e,r),r}else if(Bo.is(e)){let r=[e.id];return Ut.set(e,r),r}else return[]}async function Bl(e,t){if(Ut.has(e))return Ut.get(e);if(tp.is(e)){let r=[];for(let n of e.navigationTarget){let o=await Bl(n,t);r.push(...o)}return Ut.set(e,r),r}else if(Ta.is(e)){let r=await t.Query.nearest(e,t.getByType("node")),n=r?.[0]?.feature.id?[r[0].feature.id]:[];return Ut.set(e,n),n}else if(ge.is(e)){let r=await t.Query.nearest(e,t.getByType("node"),{lineOfSight:!0}),n=r?.[0]?.feature.id?[r[0].feature.id]:[];return Ut.set(e,n),n}else if(Ca.is(e)){let r=await t.Query.nearest(e,t.getByType("node")),n=r?.[0]?.feature.id?[r[0].feature.id]:[];return Ut.set(e,n),n}else if(Ci.is(e)){let r=t?.getMVFFeatureById("entrance",e.id),n=r?.properties.node?[r?.properties.node]:[];return Ut.set(e,n),n}else if(va.is(e)){let n=t?.getMVFFeatureById("area",e.id)?.properties.destinationNodes??[];return Ut.set(e,n),n}else if(_r.is(e)){let r=t?.getMVFFeatureById("space",e.id);if(r==null)return[];let n=r.properties.destinationNodes;return Ut.set(e,n),n}else if(Dl.is(e)){let r=[];for(let n of e.coordinates){let o=await t.Query.nearest(n,t.getByType("node"));o?.[0]?.feature.id&&r.push(o[0].feature.id)}return Ut.set(e,r),r}else if($n.is(e)){let r=t?.objectEntranceNodeIdsByObstructionId[e.id];return Ut.set(e,r??[]),r??[]}else{if(Go.is(e))return e.spaces.flatMap(r=>t?.getMVFFeatureById("space",r.id)?.properties.destinationNodes??[]).filter(r=>typeof r=="string");if(ys.is(e)){let r=e.nodes.map(n=>n.id);return Ut.set(e,r),r}else if(Bo.is(e)){let r=[e.id];return Ut.set(e,r),r}else return[]}}function i9(e,t,r){let n=e.features[0]?.properties.id,o=t[0];if(t.length>1){for(let i of t)if((r.get(i)??[]).includes(n)){o=i;break}}return o}function s9(e,t,r){let n=e.features[e.features.length-1]?.properties.id,o=t[0];if(t.length>1){for(let i of t)if((r.get(i)??[]).includes(n)){o=i;break}}return o}var Fh,M0,nf=class{constructor({nodes:t,geojsonCollection:r,connections:n,groupBy:o,multiplicativeDistanceWeightScaling:i}){f(this,"navigator");f(this,"connections");f(this,"getDirections",async(t,r,n,o)=>{let i=[],s=[],l=new Map;for(let c of t){let p=await Bl(c,o);for(let d of p)i.push(d),l.set(c,p)}for(let c of r){let p=await Bl(c,o);for(let d of p)s.push(d),l.set(c,p)}return a(this,Fh).call(this,t,r,i,s,n,o,l)});f(this,"getDirectionsSync",(t,r,n,o)=>{let i=[],s=[],l=new Map;for(let c of t){let p=rf(c,o);for(let d of p)i.push(d),l.set(c,p)}for(let c of r){let p=rf(c,o);for(let d of p)s.push(d),l.set(c,p)}return a(this,Fh).call(this,t,r,i,s,n,o,l)});T(this,Fh,(t,r,n,o,i,s,l)=>{let c=this.getDisabledConnectionNodeIds(i.accessible).filter(C=>!n.includes(C)&&!o.includes(C)),p=new Map,d={...i.connectionIdWeightMap};for(let C of i.excludedConnections)d[C.id]=1/0;for(let C in d){let I=s.getById("connection",C);I&&a(this,M0).call(this,I,d[C],p)}let m=this.navigator.getDirections({zones:i.zones.map(C=>({geometry:C.geometry,cost:C.cost,map:C.floor?.id})),originIds:n,destinationNodeIds:o,disabledConnectionNodeIds:c,simplify:{enabled:i.smoothing.enabled,bufferRadius:i.smoothing.radius},overrideEdgeWeights:p,multiplicativeDistanceWeightScaling:!s.enterpriseMode});this.addCoordinateDirections(m,t,r);let g=i9(m,t,l),x=s9(m,r,l),v=new Rl(m,s,g,x);if(!(v.distance===0&&new Set([...n,...o]).size===n.length+o.length))return v});f(this,"getDisabledConnectionNodeIds",t=>t===!1?[]:this.connections.reduce((r,n)=>n.accessible?r:r.concat(n.nodes),[]));T(this,M0,(t,r,n)=>{if(t.nodes.length<2)return;let o=new Set(t.nodes.map(i=>i.id));for(let i of t.nodes){let s=this.navigator.graph.edges[i.id];if(s)for(let l of s)o.has(l.destination.properties.id)&&n.set(l,r)}});f(this,"addCoordinateDirections",(t,[r],[n])=>{if(t.features.length){if(ge.is(r)){let o=this.createDirectionFeature(r,this.navigator.getAngle([r.longitude,r.latitude],t.features[0].geometry.coordinates),this.navigator.getDistance([r.longitude,r.latitude],t.features[0].geometry.coordinates));t.features.splice(0,0,o)}if(ge.is(n)){let o=this.createDirectionFeature(n,0,0),i=t.features[t.features.length-1];i.properties.distance=this.navigator.getDistance(i.geometry.coordinates,[n.longitude,n.latitude]),i.properties.angle=this.navigator.getAngle(i.geometry.coordinates,[n.longitude,n.latitude]),t.features.push(o)}}});f(this,"createDirectionFeature",(t,r,n)=>({type:"Feature",geometry:{type:"Point",coordinates:[t.longitude,t.latitude]},properties:{groupBy:t.floorId,id:t.id,angle:r,distance:n,edges:[]}}));this.navigator=new tf({nodes:t,geojsonCollection:this.createCollection(r),groupBy:o,multiplicativeDistanceWeightScaling:i}),this.connections=n}createCollection(t){return{type:"FeatureCollection",features:Object.entries(t).reduce((r,[n,o])=>r.concat(o.features.map(i=>(i.properties.map=n,i))),[])}}};Fh=new WeakMap,M0=new WeakMap;u();u();u();u();u();u();function a9(e){let t=+this._x.call(null,e),r=+this._y.call(null,e);return l9(this.cover(t,r),t,r,e)}function l9(e,t,r,n){if(isNaN(t)||isNaN(r))return e;var o,i=e._root,s={data:n},l=e._x0,c=e._y0,p=e._x1,d=e._y1,m,g,x,v,C,I,S,P;if(!i)return e._root=s,e;for(;i.length;)if((C=t>=(m=(l+p)/2))?l=m:p=m,(I=r>=(g=(c+d)/2))?c=g:d=g,o=i,!(i=i[S=I<<1|C]))return o[S]=s,e;if(x=+e._x.call(null,i.data),v=+e._y.call(null,i.data),t===x&&r===v)return s.next=i,o?o[S]=s:e._root=s,e;do o=o?o[S]=new Array(4):e._root=new Array(4),(C=t>=(m=(l+p)/2))?l=m:p=m,(I=r>=(g=(c+d)/2))?c=g:d=g;while((S=I<<1|C)===(P=(v>=g)<<1|x>=m));return o[P]=i,o[S]=s,e}function c9(e){var t,r,n=e.length,o,i,s=new Array(n),l=new Array(n),c=1/0,p=1/0,d=-1/0,m=-1/0;for(r=0;r<n;++r)isNaN(o=+this._x.call(null,t=e[r]))||isNaN(i=+this._y.call(null,t))||(s[r]=o,l[r]=i,o<c&&(c=o),o>d&&(d=o),i<p&&(p=i),i>m&&(m=i));if(c>d||p>m)return this;for(this.cover(c,p).cover(d,m),r=0;r<n;++r)l9(this,s[r],l[r],e[r]);return this}u();function p9(e,t){if(isNaN(e=+e)||isNaN(t=+t))return this;var r=this._x0,n=this._y0,o=this._x1,i=this._y1;if(isNaN(r))o=(r=Math.floor(e))+1,i=(n=Math.floor(t))+1;else{for(var s=o-r||1,l=this._root,c,p;r>e||e>=o||n>t||t>=i;)switch(p=(t<n)<<1|e<r,c=new Array(4),c[p]=l,l=c,s*=2,p){case 0:o=r+s,i=n+s;break;case 1:r=o-s,i=n+s;break;case 2:o=r+s,n=i-s;break;case 3:r=o-s,n=i-s;break}this._root&&this._root.length&&(this._root=l)}return this._x0=r,this._y0=n,this._x1=o,this._y1=i,this}u();function u9(){var e=[];return this.visit(function(t){if(!t.length)do e.push(t.data);while(t=t.next)}),e}u();function d9(e){return arguments.length?this.cover(+e[0][0],+e[0][1]).cover(+e[1][0],+e[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}u();u();function Wr(e,t,r,n,o){this.node=e,this.x0=t,this.y0=r,this.x1=n,this.y1=o}function f9(e,t,r){var n,o=this._x0,i=this._y0,s,l,c,p,d=this._x1,m=this._y1,g=[],x=this._root,v,C;for(x&&g.push(new Wr(x,o,i,d,m)),r==null?r=1/0:(o=e-r,i=t-r,d=e+r,m=t+r,r*=r);v=g.pop();)if(!(!(x=v.node)||(s=v.x0)>d||(l=v.y0)>m||(c=v.x1)<o||(p=v.y1)<i))if(x.length){var I=(s+c)/2,S=(l+p)/2;g.push(new Wr(x[3],I,S,c,p),new Wr(x[2],s,S,I,p),new Wr(x[1],I,l,c,S),new Wr(x[0],s,l,I,S)),(C=(t>=S)<<1|e>=I)&&(v=g[g.length-1],g[g.length-1]=g[g.length-1-C],g[g.length-1-C]=v)}else{var P=e-+this._x.call(null,x.data),O=t-+this._y.call(null,x.data),M=P*P+O*O;if(M<r){var E=Math.sqrt(r=M);o=e-E,i=t-E,d=e+E,m=t+E,n=x.data}}return n}u();function m9(e){if(isNaN(d=+this._x.call(null,e))||isNaN(m=+this._y.call(null,e)))return this;var t,r=this._root,n,o,i,s=this._x0,l=this._y0,c=this._x1,p=this._y1,d,m,g,x,v,C,I,S;if(!r)return this;if(r.length)for(;;){if((v=d>=(g=(s+c)/2))?s=g:c=g,(C=m>=(x=(l+p)/2))?l=x:p=x,t=r,!(r=r[I=C<<1|v]))return this;if(!r.length)break;(t[I+1&3]||t[I+2&3]||t[I+3&3])&&(n=t,S=I)}for(;r.data!==e;)if(o=r,!(r=r.next))return this;return(i=r.next)&&delete r.next,o?(i?o.next=i:delete o.next,this):t?(i?t[I]=i:delete t[I],(r=t[0]||t[1]||t[2]||t[3])&&r===(t[3]||t[2]||t[1]||t[0])&&!r.length&&(n?n[S]=r:this._root=r),this):(this._root=i,this)}function h9(e){for(var t=0,r=e.length;t<r;++t)this.remove(e[t]);return this}u();function g9(){return this._root}u();function y9(){var e=0;return this.visit(function(t){if(!t.length)do++e;while(t=t.next)}),e}u();function b9(e){var t=[],r,n=this._root,o,i,s,l,c;for(n&&t.push(new Wr(n,this._x0,this._y0,this._x1,this._y1));r=t.pop();)if(!e(n=r.node,i=r.x0,s=r.y0,l=r.x1,c=r.y1)&&n.length){var p=(i+l)/2,d=(s+c)/2;(o=n[3])&&t.push(new Wr(o,p,d,l,c)),(o=n[2])&&t.push(new Wr(o,i,d,p,c)),(o=n[1])&&t.push(new Wr(o,p,s,l,d)),(o=n[0])&&t.push(new Wr(o,i,s,p,d))}return this}u();function x9(e){var t=[],r=[],n;for(this._root&&t.push(new Wr(this._root,this._x0,this._y0,this._x1,this._y1));n=t.pop();){var o=n.node;if(o.length){var i,s=n.x0,l=n.y0,c=n.x1,p=n.y1,d=(s+c)/2,m=(l+p)/2;(i=o[0])&&t.push(new Wr(i,s,l,d,m)),(i=o[1])&&t.push(new Wr(i,d,l,c,m)),(i=o[2])&&t.push(new Wr(i,s,m,d,p)),(i=o[3])&&t.push(new Wr(i,d,m,c,p))}r.push(n)}for(;n=r.pop();)e(n.node,n.x0,n.y0,n.x1,n.y1);return this}u();function v9(e){return e[0]}function I9(e){return arguments.length?(this._x=e,this):this._x}u();function S9(e){return e[1]}function C9(e){return arguments.length?(this._y=e,this):this._y}function kh(e,t,r){var n=new _3(t??v9,r??S9,NaN,NaN,NaN,NaN);return e==null?n:n.addAll(e)}function _3(e,t,r,n,o,i){this._x=e,this._y=t,this._x0=r,this._y0=n,this._x1=o,this._y1=i,this._root=void 0}function T9(e){for(var t={data:e.data},r=t;e=e.next;)r=r.next={data:e.data};return t}var _n=kh.prototype=_3.prototype;_n.copy=function(){var e=new _3(this._x,this._y,this._x0,this._y0,this._x1,this._y1),t=this._root,r,n;if(!t)return e;if(!t.length)return e._root=T9(t),e;for(r=[{source:t,target:e._root=new Array(4)}];t=r.pop();)for(var o=0;o<4;++o)(n=t.source[o])&&(n.length?r.push({source:n,target:t.target[o]=new Array(4)}):t.target[o]=T9(n));return e};_n.add=a9;_n.addAll=c9;_n.cover=p9;_n.data=u9;_n.extent=d9;_n.find=f9;_n.remove=m9;_n.removeAll=h9;_n.root=g9;_n.size=y9;_n.visit=b9;_n.visitAfter=x9;_n.x=I9;_n.y=C9;u();function E3(e,t,r,n=0,o=0,i=0,s=0){if(r===void 0){r=e.root();let c=e.extent();if(c&&([[n,o],[i,s]]=c,t(r,n,o,i,s)))return!0;if(!r)return!1}let l=[[n,o,(i+n)/2,(s+o)/2],[(i+n)/2,o,i,(s+o)/2],[n,(s+o)/2,(i+n)/2,s],[(i+n)/2,(s+o)/2,i,s]];for(let c=0;c<4;c++){let p=r[c];if(p){let[d,m,g,x]=l[c];t(p,d,m,g,x)||E3(e,t,p,d,m,g,x)}}return!1}var M9=1e3,R$=.1,Oi,Ah,Zn,sp,P0=class{constructor(t,r){T(this,Oi,{});T(this,Ah,new Map);f(this,"getMaxSearchRadiusForFloorId",(t,r)=>{let n=a(this,Ah).get(a(this,Zn).mapName)?.get(r);if(n)return n;let o=this.getNodeTreeByTypeAndFloorId(t,a(this,Zn).mapName,r);if(typeof o.extent=="function")if(o.extent()){let[[i,s],[l,c]]=o.extent(),p=l-i,d=c-s;n=Math.max(p,d)}else n=M9;else n=M9;return a(this,Ah).set(a(this,Zn).mapName,new Map([[r,n]])),n});T(this,Zn);T(this,sp);w(this,Zn,t),w(this,sp,r)}searchWithIncludedIds(t,r,n,o,i,s,l=!1){let{x:c,y:p}=a(this,sp).call(this,t),d=c-s,m=c+s,g=p-s,x=p+s,v=this.getNodeTreeByTypeAndFloorId(r,n,o),C=[],I=new Set;return E3(v,(S,P,O,M,E)=>{let B=P>=m||O>=x||M<d||E<g;if("data"in S){let j=S.data,L=j.properties.parentId||j.properties.id;if(i.includes(L)&&!I.has(L)){I.add(L);let N=wi(t,j.geometry.coordinates);N<=s&&(l?a(this,Zn).directions.navigator.hasLineOfSight(t,j.geometry.coordinates,o,R$)&&C.push({node:j,distance:N}):C.push({node:j,distance:N}))}}return B}),C.sort((S,P)=>S.distance-P.distance)}getNodeTreeByTypeAndFloorId(t,r,n){if(a(this,Oi)[t]||(a(this,Oi)[t]={}),a(this,Oi)[t][r]?.[n])return a(this,Oi)[t][r][n];a(this,Oi)[t][r]||(a(this,Oi)[t][r]={}),a(this,Oi)[t][r][n]=kh();let o=a(this,Oi)[t][r][n];o.x(s=>a(this,sp).call(this,s.geometry.coordinates).x),o.y(s=>a(this,sp).call(this,s.geometry.coordinates).y);let i=[];switch(t){case"space":i=a(this,Zn).mvfSpacesByFloorId[n].flatMap(l=>l.properties.destinationNodes).map(l=>{let c=a(this,Zn).mvfNodesById[l];return c?{...c,properties:{id:c.properties.id,parentId:c.properties.space[0]}}:null});break;case"node":i=a(this,Zn).mvfNodesByFloorId[n]?.filter(l=>l.properties.neighbors.length>0)||[];break;case"point-of-interest":i=a(this,Zn).mvfPoisByFloorId[n]||[];break;case"door":i=a(this,Zn).mvfEntrancesByFloorId[n]||[];break;case"annotation":i=a(this,Zn).mvfAnnotationsByFloorId[n]||[];break}return i?.length>0&&o.addAll(i),o}};Oi=new WeakMap,Ah=new WeakMap,Zn=new WeakMap,sp=new WeakMap;u();u();var _={};zs(_,{BRAND:()=>lz,DIRTY:()=>ap,EMPTY_PATH:()=>j$,INVALID:()=>Se,NEVER:()=>zz,OK:()=>xn,ParseStatus:()=>an,Schema:()=>Ge,ZodAny:()=>jl,ZodArray:()=>Fa,ZodBigInt:()=>cp,ZodBoolean:()=>pp,ZodBranded:()=>Rh,ZodCatch:()=>Ip,ZodDate:()=>up,ZodDefault:()=>vp,ZodDiscriminatedUnion:()=>_0,ZodEffects:()=>zo,ZodEnum:()=>bp,ZodError:()=>Yn,ZodFirstPartyTypeKind:()=>Pe,ZodFunction:()=>D0,ZodIntersection:()=>hp,ZodIssueCode:()=>J,ZodLazy:()=>gp,ZodLiteral:()=>yp,ZodMap:()=>pf,ZodNaN:()=>df,ZodNativeEnum:()=>xp,ZodNever:()=>_i,ZodNull:()=>fp,ZodNullable:()=>Ms,ZodNumber:()=>lp,ZodObject:()=>Jn,ZodOptional:()=>Wo,ZodParsedType:()=>le,ZodPipeline:()=>Bh,ZodPromise:()=>Ul,ZodReadonly:()=>Sp,ZodRecord:()=>E0,ZodSchema:()=>Ge,ZodSet:()=>uf,ZodString:()=>Gl,ZodSymbol:()=>lf,ZodTransformer:()=>zo,ZodTuple:()=>Ts,ZodType:()=>Ge,ZodUndefined:()=>dp,ZodUnion:()=>mp,ZodUnknown:()=>Da,ZodVoid:()=>cf,addIssueToContext:()=>te,any:()=>yz,array:()=>Iz,bigint:()=>dz,boolean:()=>R9,coerce:()=>$z,custom:()=>k9,date:()=>fz,datetimeRegex:()=>D9,defaultErrorMap:()=>_a,discriminatedUnion:()=>Mz,effect:()=>Bz,enum:()=>Az,function:()=>Dz,getErrorMap:()=>of,getParsedType:()=>Cs,instanceof:()=>pz,intersection:()=>Pz,isAborted:()=>w0,isAsync:()=>sf,isDirty:()=>O0,isValid:()=>Nl,late:()=>cz,lazy:()=>Fz,literal:()=>kz,makeIssue:()=>Lh,map:()=>_z,nan:()=>uz,nativeEnum:()=>Lz,never:()=>xz,null:()=>gz,nullable:()=>Gz,number:()=>L9,object:()=>Sz,objectUtil:()=>D3,oboolean:()=>Wz,onumber:()=>Hz,optional:()=>Nz,ostring:()=>Vz,pipeline:()=>Uz,preprocess:()=>jz,promise:()=>Rz,quotelessJson:()=>B$,record:()=>Oz,set:()=>Ez,setErrorMap:()=>G$,strictObject:()=>Cz,string:()=>A9,symbol:()=>mz,transformer:()=>Bz,tuple:()=>wz,undefined:()=>hz,union:()=>Tz,unknown:()=>bz,util:()=>$e,void:()=>vz});u();u();u();u();u();var $e;(function(e){e.assertEqual=o=>{};function t(o){}e.assertIs=t;function r(o){throw new Error}e.assertNever=r,e.arrayToEnum=o=>{let i={};for(let s of o)i[s]=s;return i},e.getValidEnumValues=o=>{let i=e.objectKeys(o).filter(l=>typeof o[o[l]]!="number"),s={};for(let l of i)s[l]=o[l];return e.objectValues(s)},e.objectValues=o=>e.objectKeys(o).map(function(i){return o[i]}),e.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let i=[];for(let s in o)Object.prototype.hasOwnProperty.call(o,s)&&i.push(s);return i},e.find=(o,i)=>{for(let s of o)if(i(s))return s},e.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function n(o,i=" | "){return o.map(s=>typeof s=="string"?`'${s}'`:s).join(i)}e.joinValues=n,e.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})($e||($e={}));var D3;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(D3||(D3={}));var le=$e.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Cs=e=>{switch(typeof e){case"undefined":return le.undefined;case"string":return le.string;case"number":return Number.isNaN(e)?le.nan:le.number;case"boolean":return le.boolean;case"function":return le.function;case"bigint":return le.bigint;case"symbol":return le.symbol;case"object":return Array.isArray(e)?le.array:e===null?le.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?le.promise:typeof Map<"u"&&e instanceof Map?le.map:typeof Set<"u"&&e instanceof Set?le.set:typeof Date<"u"&&e instanceof Date?le.date:le.object;default:return le.unknown}};var J=$e.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),B$=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),Yn=class e extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=t}format(t){let r=t||function(i){return i.message},n={_errors:[]},o=i=>{for(let s of i.issues)if(s.code==="invalid_union")s.unionErrors.map(o);else if(s.code==="invalid_return_type")o(s.returnTypeError);else if(s.code==="invalid_arguments")o(s.argumentsError);else if(s.path.length===0)n._errors.push(r(s));else{let l=n,c=0;for(;c<s.path.length;){let p=s.path[c];c===s.path.length-1?(l[p]=l[p]||{_errors:[]},l[p]._errors.push(r(s))):l[p]=l[p]||{_errors:[]},l=l[p],c++}}};return o(this),n}static assert(t){if(!(t instanceof e))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,$e.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=r=>r.message){let r={},n=[];for(let o of this.issues)o.path.length>0?(r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(t(o))):n.push(t(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};Yn.create=e=>new Yn(e);var N$=(e,t)=>{let r;switch(e.code){case J.invalid_type:e.received===le.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case J.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,$e.jsonStringifyReplacer)}`;break;case J.unrecognized_keys:r=`Unrecognized key(s) in object: ${$e.joinValues(e.keys,", ")}`;break;case J.invalid_union:r="Invalid input";break;case J.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${$e.joinValues(e.options)}`;break;case J.invalid_enum_value:r=`Invalid enum value. Expected ${$e.joinValues(e.options)}, received '${e.received}'`;break;case J.invalid_arguments:r="Invalid function arguments";break;case J.invalid_return_type:r="Invalid function return type";break;case J.invalid_date:r="Invalid date";break;case J.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:$e.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case J.too_small:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:r="Invalid input";break;case J.too_big:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:r="Invalid input";break;case J.custom:r="Invalid input";break;case J.invalid_intersection_types:r="Intersection results could not be merged";break;case J.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case J.not_finite:r="Number must be finite";break;default:r=t.defaultError,$e.assertNever(e)}return{message:r}},_a=N$;var P9=_a;function G$(e){P9=e}function of(){return P9}u();var Lh=e=>{let{data:t,path:r,errorMaps:n,issueData:o}=e,i=[...r,...o.path||[]],s={...o,path:i};if(o.message!==void 0)return{...o,path:i,message:o.message};let l="",c=n.filter(p=>!!p).slice().reverse();for(let p of c)l=p(s,{data:t,defaultError:l}).message;return{...o,path:i,message:l}},j$=[];function te(e,t){let r=of(),n=Lh({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===_a?void 0:_a].filter(o=>!!o)});e.common.issues.push(n)}var an=class e{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,r){let n=[];for(let o of r){if(o.status==="aborted")return Se;o.status==="dirty"&&t.dirty(),n.push(o.value)}return{status:t.value,value:n}}static async mergeObjectAsync(t,r){let n=[];for(let o of r){let i=await o.key,s=await o.value;n.push({key:i,value:s})}return e.mergeObjectSync(t,n)}static mergeObjectSync(t,r){let n={};for(let o of r){let{key:i,value:s}=o;if(i.status==="aborted"||s.status==="aborted")return Se;i.status==="dirty"&&t.dirty(),s.status==="dirty"&&t.dirty(),i.value!=="__proto__"&&(typeof s.value<"u"||o.alwaysSet)&&(n[i.value]=s.value)}return{status:t.value,value:n}}},Se=Object.freeze({status:"aborted"}),ap=e=>({status:"dirty",value:e}),xn=e=>({status:"valid",value:e}),w0=e=>e.status==="aborted",O0=e=>e.status==="dirty",Nl=e=>e.status==="valid",sf=e=>typeof Promise<"u"&&e instanceof Promise;u();u();u();var fe;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(fe||(fe={}));var $o=class{constructor(t,r,n,o){this._cachedPath=[],this.parent=t,this.data=r,this._path=n,this._key=o}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},w9=(e,t)=>{if(Nl(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new Yn(e.common.issues);return this._error=r,this._error}}};function Ne(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:o}=e;if(t&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:o}:{errorMap:(s,l)=>{let{message:c}=e;return s.code==="invalid_enum_value"?{message:c??l.defaultError}:typeof l.data>"u"?{message:c??n??l.defaultError}:s.code!=="invalid_type"?{message:l.defaultError}:{message:c??r??l.defaultError}},description:o}}var Ge=class{get description(){return this._def.description}_getType(t){return Cs(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:Cs(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new an,ctx:{common:t.parent.common,data:t.data,parsedType:Cs(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(sf(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(t){let r=this._parse(t);return Promise.resolve(r)}parse(t,r){let n=this.safeParse(t,r);if(n.success)return n.data;throw n.error}safeParse(t,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Cs(t)},o=this._parseSync({data:t,path:n.path,parent:n});return w9(n,o)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Cs(t)};if(!this["~standard"].async)try{let n=this._parseSync({data:t,path:[],parent:r});return Nl(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:r}).then(n=>Nl(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(t,r){let n=await this.safeParseAsync(t,r);if(n.success)return n.data;throw n.error}async safeParseAsync(t,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Cs(t)},o=this._parse({data:t,path:n.path,parent:n}),i=await(sf(o)?o:Promise.resolve(o));return w9(n,i)}refine(t,r){let n=o=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(o):r;return this._refinement((o,i)=>{let s=t(o),l=()=>i.addIssue({code:J.custom,...n(o)});return typeof Promise<"u"&&s instanceof Promise?s.then(c=>c?!0:(l(),!1)):s?!0:(l(),!1)})}refinement(t,r){return this._refinement((n,o)=>t(n)?!0:(o.addIssue(typeof r=="function"?r(n,o):r),!1))}_refinement(t){return new zo({schema:this,typeName:Pe.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return Wo.create(this,this._def)}nullable(){return Ms.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Fa.create(this)}promise(){return Ul.create(this,this._def)}or(t){return mp.create([this,t],this._def)}and(t){return hp.create(this,t,this._def)}transform(t){return new zo({...Ne(this._def),schema:this,typeName:Pe.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new vp({...Ne(this._def),innerType:this,defaultValue:r,typeName:Pe.ZodDefault})}brand(){return new Rh({typeName:Pe.ZodBranded,type:this,...Ne(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new Ip({...Ne(this._def),innerType:this,catchValue:r,typeName:Pe.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return Bh.create(this,t)}readonly(){return Sp.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},U$=/^c[^\s-]{8,}$/i,V$=/^[0-9a-z]+$/,H$=/^[0-9A-HJKMNP-TV-Z]{26}$/i,W$=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,$$=/^[a-z0-9_-]{21}$/i,z$=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,X$=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Z$=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Y$="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",F3,J$=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,q$=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,K$=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Q$=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,ez=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,tz=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,_9="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",rz=new RegExp(`^${_9}$`);function E9(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);let r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function nz(e){return new RegExp(`^${E9(e)}$`)}function D9(e){let t=`${_9}T${E9(e)}`,r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function oz(e,t){return!!((t==="v4"||!t)&&J$.test(e)||(t==="v6"||!t)&&K$.test(e))}function iz(e,t){if(!z$.test(e))return!1;try{let[r]=e.split("."),n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),o=JSON.parse(atob(n));return!(typeof o!="object"||o===null||"typ"in o&&o?.typ!=="JWT"||!o.alg||t&&o.alg!==t)}catch{return!1}}function sz(e,t){return!!((t==="v4"||!t)&&q$.test(e)||(t==="v6"||!t)&&Q$.test(e))}var Gl=class e extends Ge{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==le.string){let i=this._getOrReturnCtx(t);return te(i,{code:J.invalid_type,expected:le.string,received:i.parsedType}),Se}let n=new an,o;for(let i of this._def.checks)if(i.kind==="min")t.data.length<i.value&&(o=this._getOrReturnCtx(t,o),te(o,{code:J.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="max")t.data.length>i.value&&(o=this._getOrReturnCtx(t,o),te(o,{code:J.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){let s=t.data.length>i.value,l=t.data.length<i.value;(s||l)&&(o=this._getOrReturnCtx(t,o),s?te(o,{code:J.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):l&&te(o,{code:J.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")Z$.test(t.data)||(o=this._getOrReturnCtx(t,o),te(o,{validation:"email",code:J.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")F3||(F3=new RegExp(Y$,"u")),F3.test(t.data)||(o=this._getOrReturnCtx(t,o),te(o,{validation:"emoji",code:J.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")W$.test(t.data)||(o=this._getOrReturnCtx(t,o),te(o,{validation:"uuid",code:J.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")$$.test(t.data)||(o=this._getOrReturnCtx(t,o),te(o,{validation:"nanoid",code:J.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")U$.test(t.data)||(o=this._getOrReturnCtx(t,o),te(o,{validation:"cuid",code:J.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")V$.test(t.data)||(o=this._getOrReturnCtx(t,o),te(o,{validation:"cuid2",code:J.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")H$.test(t.data)||(o=this._getOrReturnCtx(t,o),te(o,{validation:"ulid",code:J.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(t.data)}catch{o=this._getOrReturnCtx(t,o),te(o,{validation:"url",code:J.invalid_string,message:i.message}),n.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(t.data)||(o=this._getOrReturnCtx(t,o),te(o,{validation:"regex",code:J.invalid_string,message:i.message}),n.dirty())):i.kind==="trim"?t.data=t.data.trim():i.kind==="includes"?t.data.includes(i.value,i.position)||(o=this._getOrReturnCtx(t,o),te(o,{code:J.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),n.dirty()):i.kind==="toLowerCase"?t.data=t.data.toLowerCase():i.kind==="toUpperCase"?t.data=t.data.toUpperCase():i.kind==="startsWith"?t.data.startsWith(i.value)||(o=this._getOrReturnCtx(t,o),te(o,{code:J.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?t.data.endsWith(i.value)||(o=this._getOrReturnCtx(t,o),te(o,{code:J.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?D9(i).test(t.data)||(o=this._getOrReturnCtx(t,o),te(o,{code:J.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?rz.test(t.data)||(o=this._getOrReturnCtx(t,o),te(o,{code:J.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?nz(i).test(t.data)||(o=this._getOrReturnCtx(t,o),te(o,{code:J.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?X$.test(t.data)||(o=this._getOrReturnCtx(t,o),te(o,{validation:"duration",code:J.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?oz(t.data,i.version)||(o=this._getOrReturnCtx(t,o),te(o,{validation:"ip",code:J.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?iz(t.data,i.alg)||(o=this._getOrReturnCtx(t,o),te(o,{validation:"jwt",code:J.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?sz(t.data,i.version)||(o=this._getOrReturnCtx(t,o),te(o,{validation:"cidr",code:J.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?ez.test(t.data)||(o=this._getOrReturnCtx(t,o),te(o,{validation:"base64",code:J.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?tz.test(t.data)||(o=this._getOrReturnCtx(t,o),te(o,{validation:"base64url",code:J.invalid_string,message:i.message}),n.dirty()):$e.assertNever(i);return{status:n.value,value:t.data}}_regex(t,r,n){return this.refinement(o=>t.test(o),{validation:r,code:J.invalid_string,...fe.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...fe.errToObj(t)})}url(t){return this._addCheck({kind:"url",...fe.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...fe.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...fe.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...fe.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...fe.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...fe.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...fe.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...fe.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...fe.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...fe.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...fe.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...fe.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:t?.offset??!1,local:t?.local??!1,...fe.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...fe.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...fe.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...fe.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...fe.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...fe.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...fe.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...fe.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...fe.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...fe.errToObj(r)})}nonempty(t){return this.min(1,fe.errToObj(t))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxLength(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};Gl.create=e=>new Gl({checks:[],typeName:Pe.ZodString,coerce:e?.coerce??!1,...Ne(e)});function az(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,o=r>n?r:n,i=Number.parseInt(e.toFixed(o).replace(".","")),s=Number.parseInt(t.toFixed(o).replace(".",""));return i%s/10**o}var lp=class e extends Ge{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==le.number){let i=this._getOrReturnCtx(t);return te(i,{code:J.invalid_type,expected:le.number,received:i.parsedType}),Se}let n,o=new an;for(let i of this._def.checks)i.kind==="int"?$e.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),te(n,{code:J.invalid_type,expected:"integer",received:"float",message:i.message}),o.dirty()):i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(n=this._getOrReturnCtx(t,n),te(n,{code:J.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(n=this._getOrReturnCtx(t,n),te(n,{code:J.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?az(t.data,i.value)!==0&&(n=this._getOrReturnCtx(t,n),te(n,{code:J.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),te(n,{code:J.not_finite,message:i.message}),o.dirty()):$e.assertNever(i);return{status:o.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,fe.toString(r))}gt(t,r){return this.setLimit("min",t,!1,fe.toString(r))}lte(t,r){return this.setLimit("max",t,!0,fe.toString(r))}lt(t,r){return this.setLimit("max",t,!1,fe.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:fe.toString(o)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:fe.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:fe.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:fe.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:fe.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:fe.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:fe.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:fe.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:fe.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:fe.toString(t)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&$e.isInteger(t.value))}get isFinite(){let t=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(t===null||n.value<t)&&(t=n.value)}return Number.isFinite(r)&&Number.isFinite(t)}};lp.create=e=>new lp({checks:[],typeName:Pe.ZodNumber,coerce:e?.coerce||!1,...Ne(e)});var cp=class e extends Ge{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==le.bigint)return this._getInvalidInput(t);let n,o=new an;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(n=this._getOrReturnCtx(t,n),te(n,{code:J.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(n=this._getOrReturnCtx(t,n),te(n,{code:J.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="multipleOf"?t.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),te(n,{code:J.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):$e.assertNever(i);return{status:o.value,value:t.data}}_getInvalidInput(t){let r=this._getOrReturnCtx(t);return te(r,{code:J.invalid_type,expected:le.bigint,received:r.parsedType}),Se}gte(t,r){return this.setLimit("min",t,!0,fe.toString(r))}gt(t,r){return this.setLimit("min",t,!1,fe.toString(r))}lte(t,r){return this.setLimit("max",t,!0,fe.toString(r))}lt(t,r){return this.setLimit("max",t,!1,fe.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:fe.toString(o)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:fe.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:fe.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:fe.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:fe.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:fe.toString(r)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};cp.create=e=>new cp({checks:[],typeName:Pe.ZodBigInt,coerce:e?.coerce??!1,...Ne(e)});var pp=class extends Ge{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==le.boolean){let n=this._getOrReturnCtx(t);return te(n,{code:J.invalid_type,expected:le.boolean,received:n.parsedType}),Se}return xn(t.data)}};pp.create=e=>new pp({typeName:Pe.ZodBoolean,coerce:e?.coerce||!1,...Ne(e)});var up=class e extends Ge{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==le.date){let i=this._getOrReturnCtx(t);return te(i,{code:J.invalid_type,expected:le.date,received:i.parsedType}),Se}if(Number.isNaN(t.data.getTime())){let i=this._getOrReturnCtx(t);return te(i,{code:J.invalid_date}),Se}let n=new an,o;for(let i of this._def.checks)i.kind==="min"?t.data.getTime()<i.value&&(o=this._getOrReturnCtx(t,o),te(o,{code:J.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),n.dirty()):i.kind==="max"?t.data.getTime()>i.value&&(o=this._getOrReturnCtx(t,o),te(o,{code:J.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):$e.assertNever(i);return{status:n.value,value:new Date(t.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:fe.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:fe.toString(r)})}get minDate(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t!=null?new Date(t):null}};up.create=e=>new up({checks:[],coerce:e?.coerce||!1,typeName:Pe.ZodDate,...Ne(e)});var lf=class extends Ge{_parse(t){if(this._getType(t)!==le.symbol){let n=this._getOrReturnCtx(t);return te(n,{code:J.invalid_type,expected:le.symbol,received:n.parsedType}),Se}return xn(t.data)}};lf.create=e=>new lf({typeName:Pe.ZodSymbol,...Ne(e)});var dp=class extends Ge{_parse(t){if(this._getType(t)!==le.undefined){let n=this._getOrReturnCtx(t);return te(n,{code:J.invalid_type,expected:le.undefined,received:n.parsedType}),Se}return xn(t.data)}};dp.create=e=>new dp({typeName:Pe.ZodUndefined,...Ne(e)});var fp=class extends Ge{_parse(t){if(this._getType(t)!==le.null){let n=this._getOrReturnCtx(t);return te(n,{code:J.invalid_type,expected:le.null,received:n.parsedType}),Se}return xn(t.data)}};fp.create=e=>new fp({typeName:Pe.ZodNull,...Ne(e)});var jl=class extends Ge{constructor(){super(...arguments),this._any=!0}_parse(t){return xn(t.data)}};jl.create=e=>new jl({typeName:Pe.ZodAny,...Ne(e)});var Da=class extends Ge{constructor(){super(...arguments),this._unknown=!0}_parse(t){return xn(t.data)}};Da.create=e=>new Da({typeName:Pe.ZodUnknown,...Ne(e)});var _i=class extends Ge{_parse(t){let r=this._getOrReturnCtx(t);return te(r,{code:J.invalid_type,expected:le.never,received:r.parsedType}),Se}};_i.create=e=>new _i({typeName:Pe.ZodNever,...Ne(e)});var cf=class extends Ge{_parse(t){if(this._getType(t)!==le.undefined){let n=this._getOrReturnCtx(t);return te(n,{code:J.invalid_type,expected:le.void,received:n.parsedType}),Se}return xn(t.data)}};cf.create=e=>new cf({typeName:Pe.ZodVoid,...Ne(e)});var Fa=class e extends Ge{_parse(t){let{ctx:r,status:n}=this._processInputParams(t),o=this._def;if(r.parsedType!==le.array)return te(r,{code:J.invalid_type,expected:le.array,received:r.parsedType}),Se;if(o.exactLength!==null){let s=r.data.length>o.exactLength.value,l=r.data.length<o.exactLength.value;(s||l)&&(te(r,{code:s?J.too_big:J.too_small,minimum:l?o.exactLength.value:void 0,maximum:s?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),n.dirty())}if(o.minLength!==null&&r.data.length<o.minLength.value&&(te(r,{code:J.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),n.dirty()),o.maxLength!==null&&r.data.length>o.maxLength.value&&(te(r,{code:J.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((s,l)=>o.type._parseAsync(new $o(r,s,r.path,l)))).then(s=>an.mergeArray(n,s));let i=[...r.data].map((s,l)=>o.type._parseSync(new $o(r,s,r.path,l)));return an.mergeArray(n,i)}get element(){return this._def.type}min(t,r){return new e({...this._def,minLength:{value:t,message:fe.toString(r)}})}max(t,r){return new e({...this._def,maxLength:{value:t,message:fe.toString(r)}})}length(t,r){return new e({...this._def,exactLength:{value:t,message:fe.toString(r)}})}nonempty(t){return this.min(1,t)}};Fa.create=(e,t)=>new Fa({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Pe.ZodArray,...Ne(t)});function af(e){if(e instanceof Jn){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=Wo.create(af(n))}return new Jn({...e._def,shape:()=>t})}else return e instanceof Fa?new Fa({...e._def,type:af(e.element)}):e instanceof Wo?Wo.create(af(e.unwrap())):e instanceof Ms?Ms.create(af(e.unwrap())):e instanceof Ts?Ts.create(e.items.map(t=>af(t))):e}var Jn=class e extends Ge{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),r=$e.objectKeys(t);return this._cached={shape:t,keys:r},this._cached}_parse(t){if(this._getType(t)!==le.object){let p=this._getOrReturnCtx(t);return te(p,{code:J.invalid_type,expected:le.object,received:p.parsedType}),Se}let{status:n,ctx:o}=this._processInputParams(t),{shape:i,keys:s}=this._getCached(),l=[];if(!(this._def.catchall instanceof _i&&this._def.unknownKeys==="strip"))for(let p in o.data)s.includes(p)||l.push(p);let c=[];for(let p of s){let d=i[p],m=o.data[p];c.push({key:{status:"valid",value:p},value:d._parse(new $o(o,m,o.path,p)),alwaysSet:p in o.data})}if(this._def.catchall instanceof _i){let p=this._def.unknownKeys;if(p==="passthrough")for(let d of l)c.push({key:{status:"valid",value:d},value:{status:"valid",value:o.data[d]}});else if(p==="strict")l.length>0&&(te(o,{code:J.unrecognized_keys,keys:l}),n.dirty());else if(p!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let p=this._def.catchall;for(let d of l){let m=o.data[d];c.push({key:{status:"valid",value:d},value:p._parse(new $o(o,m,o.path,d)),alwaysSet:d in o.data})}}return o.common.async?Promise.resolve().then(async()=>{let p=[];for(let d of c){let m=await d.key,g=await d.value;p.push({key:m,value:g,alwaysSet:d.alwaysSet})}return p}).then(p=>an.mergeObjectSync(n,p)):an.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(t){return fe.errToObj,new e({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(r,n)=>{let o=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:fe.errToObj(t).message??o}:{message:o}}}:{}})}strip(){return new e({...this._def,unknownKeys:"strip"})}passthrough(){return new e({...this._def,unknownKeys:"passthrough"})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:Pe.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let r={};for(let n of $e.objectKeys(t))t[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}omit(t){let r={};for(let n of $e.objectKeys(this.shape))t[n]||(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}deepPartial(){return af(this)}partial(t){let r={};for(let n of $e.objectKeys(this.shape)){let o=this.shape[n];t&&!t[n]?r[n]=o:r[n]=o.optional()}return new e({...this._def,shape:()=>r})}required(t){let r={};for(let n of $e.objectKeys(this.shape))if(t&&!t[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof Wo;)i=i._def.innerType;r[n]=i}return new e({...this._def,shape:()=>r})}keyof(){return F9($e.objectKeys(this.shape))}};Jn.create=(e,t)=>new Jn({shape:()=>e,unknownKeys:"strip",catchall:_i.create(),typeName:Pe.ZodObject,...Ne(t)});Jn.strictCreate=(e,t)=>new Jn({shape:()=>e,unknownKeys:"strict",catchall:_i.create(),typeName:Pe.ZodObject,...Ne(t)});Jn.lazycreate=(e,t)=>new Jn({shape:e,unknownKeys:"strip",catchall:_i.create(),typeName:Pe.ZodObject,...Ne(t)});var mp=class extends Ge{_parse(t){let{ctx:r}=this._processInputParams(t),n=this._def.options;function o(i){for(let l of i)if(l.result.status==="valid")return l.result;for(let l of i)if(l.result.status==="dirty")return r.common.issues.push(...l.ctx.common.issues),l.result;let s=i.map(l=>new Yn(l.ctx.common.issues));return te(r,{code:J.invalid_union,unionErrors:s}),Se}if(r.common.async)return Promise.all(n.map(async i=>{let s={...r,common:{...r.common,issues:[]},parent:null};return{result:await i._parseAsync({data:r.data,path:r.path,parent:s}),ctx:s}})).then(o);{let i,s=[];for(let c of n){let p={...r,common:{...r.common,issues:[]},parent:null},d=c._parseSync({data:r.data,path:r.path,parent:p});if(d.status==="valid")return d;d.status==="dirty"&&!i&&(i={result:d,ctx:p}),p.common.issues.length&&s.push(p.common.issues)}if(i)return r.common.issues.push(...i.ctx.common.issues),i.result;let l=s.map(c=>new Yn(c));return te(r,{code:J.invalid_union,unionErrors:l}),Se}}get options(){return this._def.options}};mp.create=(e,t)=>new mp({options:e,typeName:Pe.ZodUnion,...Ne(t)});var Ea=e=>e instanceof gp?Ea(e.schema):e instanceof zo?Ea(e.innerType()):e instanceof yp?[e.value]:e instanceof bp?e.options:e instanceof xp?$e.objectValues(e.enum):e instanceof vp?Ea(e._def.innerType):e instanceof dp?[void 0]:e instanceof fp?[null]:e instanceof Wo?[void 0,...Ea(e.unwrap())]:e instanceof Ms?[null,...Ea(e.unwrap())]:e instanceof Rh||e instanceof Sp?Ea(e.unwrap()):e instanceof Ip?Ea(e._def.innerType):[],_0=class e extends Ge{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==le.object)return te(r,{code:J.invalid_type,expected:le.object,received:r.parsedType}),Se;let n=this.discriminator,o=r.data[n],i=this.optionsMap.get(o);return i?r.common.async?i._parseAsync({data:r.data,path:r.path,parent:r}):i._parseSync({data:r.data,path:r.path,parent:r}):(te(r,{code:J.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),Se)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,n){let o=new Map;for(let i of r){let s=Ea(i.shape[t]);if(!s.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let l of s){if(o.has(l))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(l)}`);o.set(l,i)}}return new e({typeName:Pe.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:o,...Ne(n)})}};function k3(e,t){let r=Cs(e),n=Cs(t);if(e===t)return{valid:!0,data:e};if(r===le.object&&n===le.object){let o=$e.objectKeys(t),i=$e.objectKeys(e).filter(l=>o.indexOf(l)!==-1),s={...e,...t};for(let l of i){let c=k3(e[l],t[l]);if(!c.valid)return{valid:!1};s[l]=c.data}return{valid:!0,data:s}}else if(r===le.array&&n===le.array){if(e.length!==t.length)return{valid:!1};let o=[];for(let i=0;i<e.length;i++){let s=e[i],l=t[i],c=k3(s,l);if(!c.valid)return{valid:!1};o.push(c.data)}return{valid:!0,data:o}}else return r===le.date&&n===le.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var hp=class extends Ge{_parse(t){let{status:r,ctx:n}=this._processInputParams(t),o=(i,s)=>{if(w0(i)||w0(s))return Se;let l=k3(i.value,s.value);return l.valid?((O0(i)||O0(s))&&r.dirty(),{status:r.value,value:l.data}):(te(n,{code:J.invalid_intersection_types}),Se)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([i,s])=>o(i,s)):o(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};hp.create=(e,t,r)=>new hp({left:e,right:t,typeName:Pe.ZodIntersection,...Ne(r)});var Ts=class e extends Ge{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==le.array)return te(n,{code:J.invalid_type,expected:le.array,received:n.parsedType}),Se;if(n.data.length<this._def.items.length)return te(n,{code:J.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Se;!this._def.rest&&n.data.length>this._def.items.length&&(te(n,{code:J.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let i=[...n.data].map((s,l)=>{let c=this._def.items[l]||this._def.rest;return c?c._parse(new $o(n,s,n.path,l)):null}).filter(s=>!!s);return n.common.async?Promise.all(i).then(s=>an.mergeArray(r,s)):an.mergeArray(r,i)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};Ts.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ts({items:e,typeName:Pe.ZodTuple,rest:null,...Ne(t)})};var E0=class e extends Ge{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==le.object)return te(n,{code:J.invalid_type,expected:le.object,received:n.parsedType}),Se;let o=[],i=this._def.keyType,s=this._def.valueType;for(let l in n.data)o.push({key:i._parse(new $o(n,l,n.path,l)),value:s._parse(new $o(n,n.data[l],n.path,l)),alwaysSet:l in n.data});return n.common.async?an.mergeObjectAsync(r,o):an.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof Ge?new e({keyType:t,valueType:r,typeName:Pe.ZodRecord,...Ne(n)}):new e({keyType:Gl.create(),valueType:t,typeName:Pe.ZodRecord,...Ne(r)})}},pf=class extends Ge{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==le.map)return te(n,{code:J.invalid_type,expected:le.map,received:n.parsedType}),Se;let o=this._def.keyType,i=this._def.valueType,s=[...n.data.entries()].map(([l,c],p)=>({key:o._parse(new $o(n,l,n.path,[p,"key"])),value:i._parse(new $o(n,c,n.path,[p,"value"]))}));if(n.common.async){let l=new Map;return Promise.resolve().then(async()=>{for(let c of s){let p=await c.key,d=await c.value;if(p.status==="aborted"||d.status==="aborted")return Se;(p.status==="dirty"||d.status==="dirty")&&r.dirty(),l.set(p.value,d.value)}return{status:r.value,value:l}})}else{let l=new Map;for(let c of s){let p=c.key,d=c.value;if(p.status==="aborted"||d.status==="aborted")return Se;(p.status==="dirty"||d.status==="dirty")&&r.dirty(),l.set(p.value,d.value)}return{status:r.value,value:l}}}};pf.create=(e,t,r)=>new pf({valueType:t,keyType:e,typeName:Pe.ZodMap,...Ne(r)});var uf=class e extends Ge{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==le.set)return te(n,{code:J.invalid_type,expected:le.set,received:n.parsedType}),Se;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&(te(n,{code:J.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),r.dirty()),o.maxSize!==null&&n.data.size>o.maxSize.value&&(te(n,{code:J.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),r.dirty());let i=this._def.valueType;function s(c){let p=new Set;for(let d of c){if(d.status==="aborted")return Se;d.status==="dirty"&&r.dirty(),p.add(d.value)}return{status:r.value,value:p}}let l=[...n.data.values()].map((c,p)=>i._parse(new $o(n,c,n.path,p)));return n.common.async?Promise.all(l).then(c=>s(c)):s(l)}min(t,r){return new e({...this._def,minSize:{value:t,message:fe.toString(r)}})}max(t,r){return new e({...this._def,maxSize:{value:t,message:fe.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};uf.create=(e,t)=>new uf({valueType:e,minSize:null,maxSize:null,typeName:Pe.ZodSet,...Ne(t)});var D0=class e extends Ge{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==le.function)return te(r,{code:J.invalid_type,expected:le.function,received:r.parsedType}),Se;function n(l,c){return Lh({data:l,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,of(),_a].filter(p=>!!p),issueData:{code:J.invalid_arguments,argumentsError:c}})}function o(l,c){return Lh({data:l,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,of(),_a].filter(p=>!!p),issueData:{code:J.invalid_return_type,returnTypeError:c}})}let i={errorMap:r.common.contextualErrorMap},s=r.data;if(this._def.returns instanceof Ul){let l=this;return xn(async function(...c){let p=new Yn([]),d=await l._def.args.parseAsync(c,i).catch(x=>{throw p.addIssue(n(c,x)),p}),m=await Reflect.apply(s,this,d);return await l._def.returns._def.type.parseAsync(m,i).catch(x=>{throw p.addIssue(o(m,x)),p})})}else{let l=this;return xn(function(...c){let p=l._def.args.safeParse(c,i);if(!p.success)throw new Yn([n(c,p.error)]);let d=Reflect.apply(s,this,p.data),m=l._def.returns.safeParse(d,i);if(!m.success)throw new Yn([o(d,m.error)]);return m.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:Ts.create(t).rest(Da.create())})}returns(t){return new e({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,n){return new e({args:t||Ts.create([]).rest(Da.create()),returns:r||Da.create(),typeName:Pe.ZodFunction,...Ne(n)})}},gp=class extends Ge{get schema(){return this._def.getter()}_parse(t){let{ctx:r}=this._processInputParams(t);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};gp.create=(e,t)=>new gp({getter:e,typeName:Pe.ZodLazy,...Ne(t)});var yp=class extends Ge{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return te(r,{received:r.data,code:J.invalid_literal,expected:this._def.value}),Se}return{status:"valid",value:t.data}}get value(){return this._def.value}};yp.create=(e,t)=>new yp({value:e,typeName:Pe.ZodLiteral,...Ne(t)});function F9(e,t){return new bp({values:e,typeName:Pe.ZodEnum,...Ne(t)})}var bp=class e extends Ge{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),n=this._def.values;return te(r,{expected:$e.joinValues(n),received:r.parsedType,code:J.invalid_type}),Se}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){let r=this._getOrReturnCtx(t),n=this._def.values;return te(r,{received:r.data,code:J.invalid_enum_value,options:n}),Se}return xn(t.data)}get options(){return this._def.values}get enum(){let t={};for(let r of this._def.values)t[r]=r;return t}get Values(){let t={};for(let r of this._def.values)t[r]=r;return t}get Enum(){let t={};for(let r of this._def.values)t[r]=r;return t}extract(t,r=this._def){return e.create(t,{...this._def,...r})}exclude(t,r=this._def){return e.create(this.options.filter(n=>!t.includes(n)),{...this._def,...r})}};bp.create=F9;var xp=class extends Ge{_parse(t){let r=$e.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==le.string&&n.parsedType!==le.number){let o=$e.objectValues(r);return te(n,{expected:$e.joinValues(o),received:n.parsedType,code:J.invalid_type}),Se}if(this._cache||(this._cache=new Set($e.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let o=$e.objectValues(r);return te(n,{received:n.data,code:J.invalid_enum_value,options:o}),Se}return xn(t.data)}get enum(){return this._def.values}};xp.create=(e,t)=>new xp({values:e,typeName:Pe.ZodNativeEnum,...Ne(t)});var Ul=class extends Ge{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==le.promise&&r.common.async===!1)return te(r,{code:J.invalid_type,expected:le.promise,received:r.parsedType}),Se;let n=r.parsedType===le.promise?r.data:Promise.resolve(r.data);return xn(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};Ul.create=(e,t)=>new Ul({type:e,typeName:Pe.ZodPromise,...Ne(t)});var zo=class extends Ge{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Pe.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:r,ctx:n}=this._processInputParams(t),o=this._def.effect||null,i={addIssue:s=>{te(n,s),s.fatal?r.abort():r.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),o.type==="preprocess"){let s=o.transform(n.data,i);if(n.common.async)return Promise.resolve(s).then(async l=>{if(r.value==="aborted")return Se;let c=await this._def.schema._parseAsync({data:l,path:n.path,parent:n});return c.status==="aborted"?Se:c.status==="dirty"?ap(c.value):r.value==="dirty"?ap(c.value):c});{if(r.value==="aborted")return Se;let l=this._def.schema._parseSync({data:s,path:n.path,parent:n});return l.status==="aborted"?Se:l.status==="dirty"?ap(l.value):r.value==="dirty"?ap(l.value):l}}if(o.type==="refinement"){let s=l=>{let c=o.refinement(l,i);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return l};if(n.common.async===!1){let l=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return l.status==="aborted"?Se:(l.status==="dirty"&&r.dirty(),s(l.value),{status:r.value,value:l.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(l=>l.status==="aborted"?Se:(l.status==="dirty"&&r.dirty(),s(l.value).then(()=>({status:r.value,value:l.value}))))}if(o.type==="transform")if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Nl(s))return Se;let l=o.transform(s.value,i);if(l instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:l}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>Nl(s)?Promise.resolve(o.transform(s.value,i)).then(l=>({status:r.value,value:l})):Se);$e.assertNever(o)}};zo.create=(e,t,r)=>new zo({schema:e,typeName:Pe.ZodEffects,effect:t,...Ne(r)});zo.createWithPreprocess=(e,t,r)=>new zo({schema:t,effect:{type:"preprocess",transform:e},typeName:Pe.ZodEffects,...Ne(r)});var Wo=class extends Ge{_parse(t){return this._getType(t)===le.undefined?xn(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Wo.create=(e,t)=>new Wo({innerType:e,typeName:Pe.ZodOptional,...Ne(t)});var Ms=class extends Ge{_parse(t){return this._getType(t)===le.null?xn(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Ms.create=(e,t)=>new Ms({innerType:e,typeName:Pe.ZodNullable,...Ne(t)});var vp=class extends Ge{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return r.parsedType===le.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};vp.create=(e,t)=>new vp({innerType:e,typeName:Pe.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Ne(t)});var Ip=class extends Ge{_parse(t){let{ctx:r}=this._processInputParams(t),n={...r,common:{...r.common,issues:[]}},o=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return sf(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Yn(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Yn(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Ip.create=(e,t)=>new Ip({innerType:e,typeName:Pe.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...Ne(t)});var df=class extends Ge{_parse(t){if(this._getType(t)!==le.nan){let n=this._getOrReturnCtx(t);return te(n,{code:J.invalid_type,expected:le.nan,received:n.parsedType}),Se}return{status:"valid",value:t.data}}};df.create=e=>new df({typeName:Pe.ZodNaN,...Ne(e)});var lz=Symbol("zod_brand"),Rh=class extends Ge{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},Bh=class e extends Ge{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?Se:i.status==="dirty"?(r.dirty(),ap(i.value)):this._def.out._parseAsync({data:i.value,path:n.path,parent:n})})();{let o=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?Se:o.status==="dirty"?(r.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:n.path,parent:n})}}static create(t,r){return new e({in:t,out:r,typeName:Pe.ZodPipeline})}},Sp=class extends Ge{_parse(t){let r=this._def.innerType._parse(t),n=o=>(Nl(o)&&(o.value=Object.freeze(o.value)),o);return sf(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};Sp.create=(e,t)=>new Sp({innerType:e,typeName:Pe.ZodReadonly,...Ne(t)});function O9(e,t){let r=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof r=="string"?{message:r}:r}function k9(e,t={},r){return e?jl.create().superRefine((n,o)=>{let i=e(n);if(i instanceof Promise)return i.then(s=>{if(!s){let l=O9(t,n),c=l.fatal??r??!0;o.addIssue({code:"custom",...l,fatal:c})}});if(!i){let s=O9(t,n),l=s.fatal??r??!0;o.addIssue({code:"custom",...s,fatal:l})}}):jl.create()}var cz={object:Jn.lazycreate},Pe;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(Pe||(Pe={}));var pz=(e,t={message:`Input not instance of ${e.name}`})=>k9(r=>r instanceof e,t),A9=Gl.create,L9=lp.create,uz=df.create,dz=cp.create,R9=pp.create,fz=up.create,mz=lf.create,hz=dp.create,gz=fp.create,yz=jl.create,bz=Da.create,xz=_i.create,vz=cf.create,Iz=Fa.create,Sz=Jn.create,Cz=Jn.strictCreate,Tz=mp.create,Mz=_0.create,Pz=hp.create,wz=Ts.create,Oz=E0.create,_z=pf.create,Ez=uf.create,Dz=D0.create,Fz=gp.create,kz=yp.create,Az=bp.create,Lz=xp.create,Rz=Ul.create,Bz=zo.create,Nz=Wo.create,Gz=Ms.create,jz=zo.createWithPreprocess,Uz=Bh.create,Vz=()=>A9().optional(),Hz=()=>L9().optional(),Wz=()=>R9().optional(),$z={string:e=>Gl.create({...e,coerce:!0}),number:e=>lp.create({...e,coerce:!0}),boolean:e=>pp.create({...e,coerce:!0}),bigint:e=>cp.create({...e,coerce:!0}),date:e=>up.create({...e,coerce:!0})};var zz=Se;var B9=_;var q=B9;var ff=50,N9=111319.9,A3=!1,G9=q.object({limit:q.enum(["same-floor","same-elevation"]).optional(),mode:q.enum(["travel-distance","absolute-distance"]).optional(),lineOfSight:q.boolean().optional().or(q.literal("auto")),maxDistance:q.number().optional()}),j9={lineOfSight:A3,mode:"travel-distance",maxDistance:ff,limit:"same-floor"},Er,Gh,F0,jh,L3,mf,k0,A0,Nh=class{constructor(t){T(this,jh);T(this,Er);T(this,Gh);T(this,F0,([t,r])=>{let[n,o]=[a(this,Er).mapCenter.longitude,a(this,Er).mapCenter.latitude],i=N9,s=N9*Math.cos(r*Math.PI/180),l=(t-n)*s,c=(r-o)*i;return{x:l,y:c}});f(this,"__LEGACY_NEAREST_SYNC",(t,r,n)=>{let o={...j9,...n};try{G9.parse(o)}catch(d){A.error(d);return}let i=Fd(t);if(!i)return;let s=z(this,jh,L3).call(this,i,o),l=[],c={},p=[];for(let d of r){let m=rf(d,a(this,Er));if(m)for(let g of m)c[g]||(c[g]=[]),c[g].push(d),p.push(g)}return n?.mode==="absolute-distance"?l=a(this,mf).call(this,i,s,r,o):l=a(this,A0).call(this,t,s,p,c,o),l.sort((d,m)=>d.distance-m.distance)});T(this,mf,(t,r,n,o)=>{let i=[],s=new Set(n.map(l=>l.__type));for(let l of r)for(let c of s){let p=a(this,Gh).searchWithIncludedIds([t.longitude,t.latitude],c,a(this,Er).mapName,l,n.filter(d=>d.__type===c).map(d=>d.id),o?.maxDistance??ff,o?.lineOfSight==="auto"?A3:o?.lineOfSight);if(p)for(let d of p)i.push({distance:d.distance,feature:a(this,Er).getById(c,d.node.properties.parentId)||a(this,Er).getById(c,d.node.properties.id)})}return i});T(this,k0,async(t,r,n,o,i)=>{let s=[];for(let l of r){let c,p=0;if(!Bo.is(t)){let d=a(this,mf).call(this,t.anchorTarget,[l],a(this,Er).getByType("node").filter(m=>m.floor.id===l),{limit:"same-floor",lineOfSight:i?.lineOfSight??!0,mode:"absolute-distance",maxDistance:i?.maxDistance??ff});d.length>0&&(c=d[0].feature,p=d[0].distance)}if(c){let d=new Set,m=a(this,Er).directions.navigator.findNearestNodesOnGraph(c.id,(i?.maxDistance??ff)-p,l,n,!1);for(let g of m)for(let x of o[g.feature.properties.id])d.has(x.id)||(s.push({distance:g.distance+p,feature:x}),d.add(x.id))}}return s});T(this,A0,(t,r,n,o,i)=>{let s=[];for(let l of r){let c;if(Bo.is(t)||(c=this.__LEGACY_NEAREST_SYNC(t,a(this,Er).getByType("node"),{lineOfSight:i?.lineOfSight??!0,mode:"absolute-distance",maxDistance:i?.maxDistance??ff})?.[0].feature),c){let p=a(this,Er).directions.navigator.findNearestNodesOnGraph(c.id,i?.maxDistance??ff,l,n,i?.lineOfSight==="auto"?A3:i?.lineOfSight);for(let d of p)for(let m of o[d.feature.properties.id])s.push({distance:d.distance,feature:m})}}return s});w(this,Er,t),w(this,Gh,new P0(a(this,Er),a(this,F0)))}async nearest(t,r,n){let o={...j9,...n};try{G9.parse(o)}catch(m){A.error(m);return}let i=Fd(t);if(!i)return;let s=z(this,jh,L3).call(this,i,o),l=[],c={},p=[],d=[];if(n?.mode==="absolute-distance")l=a(this,mf).call(this,i,s,r,o);else{for(let m of r)d.push(Bl(m,a(this,Er)).then(g=>{if(g)for(let x of g)c[x]||(c[x]=[]),c[x].push(m),p.push(x)}));await Promise.all(d),l=await a(this,k0).call(this,t,s,p,c,o)}return l.sort((m,g)=>m.distance-g.distance)}};Er=new WeakMap,Gh=new WeakMap,F0=new WeakMap,jh=new WeakSet,L3=function(t,r){let n=t.floorId?[t.floorId]:[];if(t.floorId==null)for(let o of a(this,Er).getByType("floor-stack")){let i=o.defaultFloor;i&&n.push(i.id)}else if(r?.limit==="same-elevation"){let o=a(this,Er).floorsById[t.floorId];if(o){let i=o?.elevation;i&&(n=a(this,Er).getByType("floor-stack").map(s=>s.floors.find(l=>l.elevation===i)?.id).filter(Boolean))}}return n},mf=new WeakMap,k0=new WeakMap,A0=new WeakMap;u();u();var Uh,L0=class{constructor(t){T(this,Uh);w(this,Uh,t||[])}get raw(){return a(this,Uh)}};Uh=new WeakMap;var ln,ce,Lt,hf=class hf extends Or{constructor(r,n){super(n.mvfData.id);f(this,"__type",hf.__type);f(this,"id","loc_");f(this,"name","");f(this,"externalId");f(this,"description");f(this,"logo");f(this,"phone");f(this,"social",[]);f(this,"images",[]);f(this,"links",[]);f(this,"website");f(this,"icon");T(this,ln);T(this,ce,{});T(this,Lt);w(this,ln,r),w(this,Lt,n.mvfData);for(let o in n.mvfData)o==="links"?this.links=n.mvfData.links.map(i=>new Gc({mvfData:i})):o==="pictures"?this.images=n.mvfData.pictures.map(i=>i.url?new Uc({mvfData:{...i,url:i.url??""},mapData:a(this,ln)}):void 0).filter(i=>i!=null):o==="website"?n.mvfData.website&&(this.website=new Gc({mvfData:n.mvfData.website})):o==="icon"?n.mvfData.icon&&(this.icon=new Uc({mvfData:{url:n.mvfData.icon},mapData:a(this,ln)})):Object.getOwnPropertyDescriptor(Object.getPrototypeOf(this),o)||Object.defineProperty(this,o,{enumerable:!0,get(){return a(this,Lt)[o]}})}static is(r){return r.__type===hf.__type}get spaces(){if(a(this,ce).spaces)return a(this,ce).spaces;if(a(this,Lt).spaces==null)return a(this,ce).spaces=[],a(this,ce).spaces;a(this,ce).spaces=[];for(let r=0;r<a(this,Lt).spaces.length;r++){let n=a(this,ln).getById("space",a(this,Lt).spaces[r].id);n&&a(this,ce).spaces.push(n)}return a(this,ce).spaces}get points(){if(a(this,ce).points)return a(this,ce).points;if(a(this,Lt).spaces==null)return a(this,ce).points=[],a(this,ce).points;a(this,ce).points=[];for(let r=0;r<a(this,Lt).spaces.length;r++){let n=a(this,ln).getById("point-of-interest",a(this,Lt).spaces[r].id);n&&a(this,ce).points.push(n)}return a(this,ce).points}get doors(){if(a(this,ce).doors)return a(this,ce).doors;if(a(this,Lt).entrances==null)return a(this,ce).doors=[],a(this,ce).doors;a(this,ce).doors=[];for(let r=0;r<a(this,Lt).entrances.length;r++){let n=a(this,ln).getById("door",a(this,Lt).entrances[r].id);n&&a(this,ce).doors.push(n)}return a(this,ce).doors}get connections(){if(a(this,ce).connections)return a(this,ce).connections;if(a(this,Lt).connections==null)return a(this,ce).connections=[],a(this,ce).connections;let r=new Set;for(let n=0;n<a(this,Lt).connections.length;n++){let o=a(this,Lt).connections[n],i=a(this,ln).mvfConnectionsById[o],l=(i==null?[]:i.nodes).map(c=>a(this,ln).getById("node",c)).filter(Boolean);for(let c of l){if(c==null)continue;let p=gs([c.coordinate.longitude,c.coordinate.latitude]),m=(a(this,ln).connectionSpaceIdsByLatLon[p]??[]).map(g=>a(this,ln).connectionsById[g]).filter(g=>g!=null);for(let g of m)r.add(g)}}return a(this,ce).connections=Array.from(r),a(this,ce).connections}get annotations(){if(a(this,ce).annotations)return a(this,ce).annotations;if(a(this,Lt).annotations==null)return a(this,ce).annotations=[],a(this,ce).annotations;a(this,ce).annotations=[];for(let r=0;r<a(this,Lt).annotations.length;r++){let n=a(this,ln).getById("annotation",a(this,Lt).annotations[r].id);n&&a(this,ce).annotations.push(n)}return a(this,ce).annotations}get categories(){return a(this,ce).categories?a(this,ce).categories:a(this,Lt).categories==null?(a(this,ce).categories=[],a(this,ce).categories):(a(this,ce).categories=a(this,Lt).categories.map(r=>a(this,ln).getById("location-category",r)).filter(r=>r!=null),a(this,ce).categories)}get mapObjects(){return a(this,ce).mapObjects?a(this,ce).mapObjects:a(this,Lt).obstructions==null?(a(this,ce).mapObjects=[],a(this,ce).mapObjects):(a(this,ce).mapObjects=a(this,Lt).obstructions.map(r=>a(this,ln).getById("object",r.id)).filter(r=>r!=null),a(this,ce).mapObjects)}get areas(){return a(this,ce).areas?a(this,ce).areas:a(this,Lt).areas==null?(a(this,ce).areas=[],a(this,ce).areas):(a(this,ce).areas=a(this,Lt).areas.map(r=>a(this,ln).getById("area",r.id)).filter(r=>r!=null),a(this,ce).areas)}get focusTarget(){if(a(this,ce).focusTarget)return a(this,ce).focusTarget;let r=[];for(let n of this.spaces)r.push(n);for(let n of this.connections)r.push(...n.coordinates);for(let n of this.doors)r.push(n.focusTarget);for(let n of this.mapObjects)r.push(n.focusTarget);for(let n of this.annotations)r.push(n.focusTarget);for(let n of this.points)r.push(n.focusTarget);for(let n of this.areas)r.push(n.focusTarget);return a(this,ce).focusTarget=r,r}get openingHours(){return a(this,ce).openingHours?a(this,ce).openingHours:(a(this,ce).openingHours=new L0(a(this,Lt).openingHoursSpecification??[]),a(this,ce).openingHours)}get navigationTarget(){if(a(this,ce).navigationTarget)return a(this,ce).navigationTarget;let r=[];for(let n of this.spaces)r.push(n);for(let n of this.connections)r.push(...n.coordinates);for(let n of this.doors)r.push(n.focusTarget);for(let n of this.mapObjects)r.push(n.focusTarget);for(let n of this.annotations)r.push(n.focusTarget);for(let n of this.points)r.push(n.focusTarget);return a(this,ce).navigationTarget=r,r}toJSON(){return{__type:hf.__type,id:this.id,name:this.name}}};ln=new WeakMap,ce=new WeakMap,Lt=new WeakMap,f(hf,"__type","location-profile");var R3=hf,tp=R3;u();var Vl,qn,Cp,gf=class gf extends Or{constructor(r,n){super(n.mvfData.id);f(this,"__type",gf.__type);f(this,"id","cat_");f(this,"name","");f(this,"icon","");T(this,Vl);T(this,qn,{});T(this,Cp);w(this,Vl,r),w(this,Cp,n.mvfData);for(let o in n.mvfData)Object.getOwnPropertyDescriptor(Object.getPrototypeOf(this),o)||Object.defineProperty(this,o,{enumerable:!0,get(){return a(this,Cp)[o]}})}static is(r){return r.__type===gf.__type}get parent(){return a(this,qn).parent?a(this,qn).parent:(a(this,qn).parent=a(this,Cp).parent?a(this,Vl).getById("location-category",a(this,Cp).parent):void 0,a(this,qn).parent)}get children(){return a(this,qn).children?a(this,qn).children:(a(this,qn).children=a(this,Vl).locationCategoriesByParentId[this.id]||[],a(this,qn).children)}get locationProfiles(){if(a(this,qn).locationProfiles)return a(this,qn).locationProfiles;let r=[];for(let n of a(this,Vl).locationProfilesByCategoryId[this.id]||[]){let o=a(this,Vl).getById("location-profile",n.id);o&&r.push(o)}return a(this,qn).locationProfiles=r,r}toJSON(){return{__type:gf.__type,id:this.id,name:this.name}}};Vl=new WeakMap,qn=new WeakMap,Cp=new WeakMap,f(gf,"__type","location-category");var B3=gf,g0=B3;var be,R0,V9,yf,Tp=class extends Fe{constructor(r,n){super();T(this,R0);f(this,"Analytics");T(this,be,{});f(this,"Query");f(this,"mvf");f(this,"outdoorViewToken");f(this,"objectEntranceNodeIdsByObstructionId");f(this,"obstructionIdByEntranceId");f(this,"venue");f(this,"tokenManager");f(this,"directions");f(this,"enterpriseMode",!1);f(this,"nodesById");f(this,"spacesById");f(this,"floorsById");f(this,"floorStacksById");f(this,"facadesById");f(this,"facadesBySpaceId");f(this,"connectionsById");f(this,"objectsById");f(this,"doorsById");f(this,"pointsOfInterestById");f(this,"annotationsById");f(this,"areasById");f(this,"locationProfilesById");f(this,"locationCategoriesById");f(this,"locationProfilesByExternalId");f(this,"locationProfilesByCategoryId");f(this,"locationCategoriesByParentId");f(this,"doorsByNodeId");f(this,"mvfAnnotationsById");f(this,"mvfConnectionsById");f(this,"mvfConnectionsByNodeId");f(this,"mvfConnectionIdsByLatLon");f(this,"mvfEntrancesById");f(this,"mvfNodesById");f(this,"mvfObstructionById");f(this,"mvfSpacesById");f(this,"mvfFloorsById");f(this,"mvfFloorStacksById");f(this,"mvfAreasById");f(this,"spacesByExternalId");f(this,"nodesByExternalId");f(this,"objectsByExternalId");f(this,"poisByExternalId");f(this,"floorsByExternalId");f(this,"floorStacksByExternalId");f(this,"doorsByExternalId");f(this,"areasByExternalId");f(this,"connectionSpaceIdsByLatLon",{});f(this,"locationProfilesByAttachedFeatureId",{});f(this,"locationsById",{});f(this,"categoriesById",{});f(this,"mvfLocationsBySpaceId",{});f(this,"locationIdsByNodeId",{});f(this,"spaceIdsByNodeId",{});f(this,"connectionsByExternalId",{});f(this,"locationsByExternalId",{});f(this,"categoriesByExternalId",{});f(this,"destinationNodesIdsBySpaceId",{});f(this,"mvfNodesByFloorId");f(this,"mvfSpacesByFloorId");f(this,"mvfPoisByFloorId");f(this,"mvfEntrancesByFloorId");f(this,"mvfAnnotationsByFloorId");f(this,"localePacksUrls");f(this,"currentLanguage");f(this,"languagePacks",{});f(this,"tilesets",{});f(this,"navigationFlags");f(this,"binaryBundle");f(this,"envControl");f(this,"getMapDataOptions");T(this,yf);f(this,"__LEGACY_GET_DIRECTIONS_MULTI_DESTINATION_SYNC",(r,n,o)=>this.__LEGACY_GET_DIRECTIONS_SYNC(r,n,{...o,multiDestination:!0}));f(this,"__LEGACY_GET_DIRECTIONS_SYNC",(r,n,o)=>{let{accessible:i=!1,multiDestination:s=!1}=o||{},l=U9(this.enterpriseMode,o),c=o?.zones||[],p={accessible:i,zones:c,smoothing:l,excludedConnections:o?.excludedConnections||[],connectionIdWeightMap:o?.connectionIdWeightMap||{}};if(s&&Array.isArray(n)){let d=Array.isArray(r)?r:[r],m=[];for(let g of n){let x=Array.isArray(g)?g:[g],v=this.directions.getDirectionsSync(d,x,p,this);if(!v){A.error("getDirections failed due to missing directions for one of the segments");return}d=x,m.push(v)}return m}else{let d=Array.isArray(r)?r:[r],m=Array.isArray(n)?n:[n];if(Array.isArray(m[0])){A.error("getDirections does not support multi-destination without multisegment option");return}d[0].id&&m[0].id&&this.Analytics.sendGetDirectionsEvent(d[0].id,m[0].id,i);try{return this.directions.getDirectionsSync(d,m,p,this)}catch(g){A.error("Unable to get directions",g);return}}});f(this,"getDirections",async(r,n,o)=>{let{accessible:i=!1}=o||{},s=U9(this.enterpriseMode,o),l=o?.zones||[],c={accessible:i,zones:l,smoothing:s,excludedConnections:o?.excludedConnections||[],connectionIdWeightMap:o?.connectionIdWeightMap||{}},p=Array.isArray(r)?r:[r],d=Array.isArray(n)?n:[n];if(Array.isArray(d[0])){A.error("getDirections does not support multi-destination without multisegment option");return}p[0].id&&d[0].id&&this.Analytics.sendGetDirectionsEvent(p[0].id,d[0].id,i);try{return this.directions.getDirections(p,d,c,this)}catch(m){A.error("Unable to get directions",m);return}});f(this,"getDirectionsMultiDestination",async(r,n,o)=>Promise.resolve(this.__LEGACY_GET_DIRECTIONS_MULTI_DESTINATION_SYNC(r,n,o)));f(this,"transformImageRequest",async r=>{if(this.enterpriseMode||!this.getMapDataOptions)return{url:r};if(!E6(r))return{url:r};if(D6(r))return{url:r};let n=d0(r);if(!n)return{url:r};try{let i=(await this.tokenManager?.getSasTokensAsync())?.[n.mapId];if(i==null)throw new Error("SAS token not found");let[s]=r.split("?");return{url:`${s}?${i.token}`}}catch(o){return A.error("Failed to append SAS token to image request. Requests for private images may fail.",o),{url:r}}});let o=n?.env??Cl();if(this.envControl=o,this.binaryBundle=n?.binaryBundle,this.Analytics=new Su,this.localePacksUrls=n?.localePacksUrls??{},this.mvf=r,this.outdoorViewToken=n?.outdoorViewToken,this.getMapDataOptions=n?.getMapDataOptions,r["tileset.json"]?.default!=null&&(this.tilesets[r["tileset.json"].default.key]=r["tileset.json"].default,o.updateTileServerBaseUrl(r["tileset.json"].default.url),r["tileset.json"].others!=null))for(let s of r["tileset.json"].others)this.tilesets[s.key]=s;this.navigationFlags=r["navigationFlags.json"]??{},this.enterpriseMode=n?.enterprise??!1,this.tokenManager=n?.tokenManager;let i=N6(r,this);if(this.nodesById=i.nodesById,this.spacesById=i.spacesById,this.floorsById=i.floorsById,this.floorStacksById=i.floorStacksById,this.facadesById=i.facadesById,this.facadesBySpaceId=i.facadesBySpaceId,this.connectionsById=i.connectionsById,this.objectsById=i.objectsById,this.doorsById=i.doorsById,this.pointsOfInterestById=i.poisById,this.annotationsById=i.annotationsById,this.areasById=i.areasById,this.locationProfilesById=i.locationProfilesById,this.locationCategoriesById=i.locationCategoriesById,this.locationProfilesByCategoryId=i.locationProfilesByCategoryId,this.locationCategoriesByParentId=i.locationCategoriesByParentId,this.spacesByExternalId=i.spacesByExternalId,this.nodesByExternalId=i.nodesByExternalId,this.objectsByExternalId=i.objectsByExternalId,this.floorsByExternalId=i.floorsByExternalId,this.locationProfilesByExternalId=i.locationProfilesByExternalId,this.floorStacksByExternalId=i.floorStacksByExternalId,this.poisByExternalId=i.poisByExternalId,this.doorsByExternalId=i.doorsByExternalId,this.areasByExternalId=i.areasByExternalId,this.mvfAnnotationsById=i.mvfAnnotationsById,this.mvfConnectionsById=i.mvfConnectionsById,this.mvfConnectionsByNodeId=i.mvfConnectionsByNodeId,this.mvfConnectionIdsByLatLon=i.mvfConnectionIdsByLatLon,this.mvfEntrancesById=i.mvfEntrancesById,this.mvfNodesById=i.mvfNodesById,this.mvfObstructionById=i.mvfObstructionById,this.mvfSpacesById=i.mvfSpacesById,this.mvfFloorsById=i.mvfFloorsById,this.mvfFloorStacksById=i.mvfFloorStacksById,this.mvfNodesByFloorId=i.mvfNodesByFloorId,this.mvfSpacesByFloorId=i.mvfSpacesByFloorId,this.mvfPoisByFloorId=i.mvfPoisByFloorId,this.mvfEntrancesByFloorId=i.mvfEntrancesByFloorId,this.mvfAnnotationsByFloorId=i.mvfAnnotationsByFloorId,this.mvfAreasById=i.mvfAreasById,this.doorsByNodeId=i.doorsByNodeId,this.objectEntranceNodeIdsByObstructionId=i.objectEntranceNodeIdsByObstructionId,this.obstructionIdByEntranceId=i.obstructionIdByEntranceId,this.connectionSpaceIdsByLatLon=i.connectionIdsByLatLon,this.locationProfilesByAttachedFeatureId=i.locationProfilesByAttachedFeatureId,this.enterpriseMode||Vh()){let s=B6(r,this);if(this.locationsById=s.locationsById,this.categoriesById=s.categoriesById,this.mvfLocationsBySpaceId=s.mvfLocationsBySpaceId,this.locationIdsByNodeId=s.locationIdsByNodeId,this.spaceIdsByNodeId=s.spaceIdsByNodeId,this.connectionsByExternalId=s.connectionsByExternalId,this.locationsByExternalId=s.locationsByExternalId,this.categoriesByExternalId=s.categoriesByExternalId,this.destinationNodesIdsBySpaceId=s.destinationNodesIdsBySpaceId,s.venue.name!=null){this.venue=new v3(this,{mvfData:s.venue});let l={};for(let c in s.mvfLocationsById)l[c]=s.mvfLocationsById[c];for(let c in s.locationInstancesById)l[c]=s.locationInstancesById[c];this.languagePacks[this.venue.defaultLanguage.code]={type:"initial",optimized:{"enterprise-location":l,"enterprise-category":s.mvfCategoriesById,"floor-stack":i.mvfFloorStacksById,floor:i.mvfFloorsById}},n?.languagePacks?.forEach(({language:c,localePack:p})=>{this.languagePacks[c.code]=qS(p)}),this.currentLanguage=this.venue.defaultLanguage}}this.directions=new nf({nodes:r["node.geojson"],geojsonCollection:r.enterprise?r.space:r.obstruction,connections:r["connection.json"],groupBy:"map",multiplicativeDistanceWeightScaling:!this.enterpriseMode}),this.Query=new Nh(this)}getEnv(){let r=this;return{get baseUri(){return r.envControl.getBaseUri()},get baseAuthUri(){return r.envControl.getBaseAuthUri()},get analyticsBaseUri(){return r.envControl.getAnalyticsBaseUri()},get tileServerUri(){return r.envControl.getTileServerUri()}}}get mapName(){return this.mvf["manifest.geojson"].features[0].properties.name}get organizationId(){return this.mvf["manifest.geojson"].features[0].properties.org_id??""}get mapCenter(){return new ge(this.mvf["manifest.geojson"].features[0].geometry.coordinates[1],this.mvf["manifest.geojson"].features[0].geometry.coordinates[0])}get naturalBearing(){return this.mvf["manifest.geojson"].features[0].properties.naturalBearing??0}get spaces(){return a(this,be).spaces==null&&(a(this,be).spaces=globalThis.Object.values(this.spacesById)),a(this,be).spaces}get objects(){return a(this,be).objects==null&&(a(this,be).objects=globalThis.Object.values(this.objectsById)),a(this,be).objects}get connections(){return a(this,be).connections==null&&(a(this,be).connections=globalThis.Object.values(this.connectionsById)),a(this,be).connections}get floors(){return a(this,be).floors==null&&(a(this,be).floors=globalThis.Object.values(this.floorsById)),a(this,be).floors}get floorStacks(){return a(this,be).floorStacks==null&&(a(this,be).floorStacks=globalThis.Object.values(this.floorStacksById)),a(this,be).floorStacks}get facades(){return a(this,be).facades==null&&(a(this,be).facades=globalThis.Object.values(this.facadesById)),a(this,be).facades}get doors(){return a(this,be).doors==null&&(a(this,be).doors=globalThis.Object.values(this.doorsById)),a(this,be).doors}get pointsOfInterest(){return a(this,be).pointsOfInterest==null&&(a(this,be).pointsOfInterest=globalThis.Object.values(this.pointsOfInterestById)),a(this,be).pointsOfInterest}get annotations(){return a(this,be).annotations==null&&(a(this,be).annotations=globalThis.Object.values(this.annotationsById)),a(this,be).annotations}get areas(){return a(this,be).areas==null&&(a(this,be).areas=globalThis.Object.values(this.areasById)),a(this,be).areas}get nodes(){return a(this,be).nodes==null&&(a(this,be).nodes=globalThis.Object.values(this.nodesById)),a(this,be).nodes}get locations(){return a(this,be).locations==null&&(a(this,be).locations=globalThis.Object.values(this.locationsById)),globalThis.Object.values(this.locationsById)}get categories(){return a(this,be).categories==null&&(a(this,be).categories=globalThis.Object.values(this.categoriesById)),globalThis.Object.values(this.categoriesById)}get locationProfiles(){return a(this,be).locationProfiles==null&&(a(this,be).locationProfiles=globalThis.Object.values(this.locationProfilesById)),a(this,be).locationProfiles}get locationCategories(){return a(this,be).locationCategories==null&&(a(this,be).locationCategories=globalThis.Object.values(this.locationCategoriesById)),a(this,be).locationCategories}get mvfFloors(){return a(this,be).mvfFloors==null&&(a(this,be).mvfFloors=globalThis.Object.values(this.mvfFloorsById)),a(this,be).mvfFloors}get mvfFloorStacks(){return a(this,be).mvfFloorStacks==null&&(a(this,be).mvfFloorStacks=globalThis.Object.values(this.mvfFloorStacksById)),a(this,be).mvfFloorStacks}getByType(r){switch(r){case"location-profile":return this.locationProfiles;case"location-category":return this.locationCategories;case"area":return this.areas;case"node":return this.nodes;case"space":return this.spaces;case"door":return this.doors;case"floor":return this.floors;case"floor-stack":return this.floorStacks;case"connection":return this.connections;case"object":return this.objects;case"point-of-interest":return this.pointsOfInterest;case"annotation":return this.annotations;case"enterprise-location":return this.locations;case"enterprise-category":return this.categories;case"enterprise-venue":return this.venue;case"facade":return this.facades;default:return[]}}getById(r,n){let o={"location-profile":this.locationProfilesById,"location-category":this.locationCategoriesById,space:this.spacesById,floor:this.floorsById,"floor-stack":this.floorStacksById,facade:this.facadesById,node:this.nodesById,door:this.doorsById,connection:this.connectionsById,"mvf-connection":l=>z(this,R0,V9).call(this,this.mvfConnectionsById[l]),object:this.objectsById,"point-of-interest":this.pointsOfInterestById,annotation:this.annotationsById,area:this.areasById,"enterprise-location":this.locationsById,"enterprise-category":this.categoriesById},i=l=>{let c=o[l];if(c!=null)return typeof c=="function"?c(n):c[n]},s=()=>{for(let l of Object.keys(o)){let c=i(l);if(c!=null)return c}};return r==="unknown"?s():i(r)}getByExternalId(r,n){switch(r){case"location-profile":return this.locationProfilesByExternalId[n]??[];case"location-category":return[];case"space":return this.spacesByExternalId[n]??[];case"floor":return this.floorsByExternalId[n]??[];case"floor-stack":return this.floorStacksByExternalId[n]??[];case"node":return this.nodesByExternalId[n]??[];case"door":return this.doorsByExternalId[n]??[];case"connection":return this.connectionsByExternalId[n]??[];case"object":return this.objectsByExternalId[n]??[];case"point-of-interest":return this.poisByExternalId[n]??[];case"area":return this.areasByExternalId[n]??[];case"enterprise-location":return this.locationsByExternalId[n]??[];case"enterprise-category":return this.categoriesByExternalId[n]??[];default:return[]}}getMapDataById(r){return this.spacesById[r]??this.floorsById[r]??this.floorStacksById[r]??this.facadesById[r]??this.nodesById[r]??this.doorsById[r]??this.connectionsById[r]??this.objectsById[r]??this.pointsOfInterestById[r]??this.annotationsById[r]??this.areasById[r]}getMVFFeatureById(r,n){switch(r){case"space":return this.mvfSpacesById[n];case"node":return this.mvfNodesById[n];case"obstruction":return this.mvfObstructionById[n];case"floor":return this.mvfFloorsById[n];case"floor-stack":return this.mvfFloorStacksById[n];case"connection":return this.mvfConnectionsById[n];case"entrance":return this.mvfEntrancesById[n];case"annotation":return this.mvfAnnotationsById[n];case"area":return this.mvfAreasById[n];default:throw new Error(`Unknown MVF feature type: ${r}`)}}getMVFFeatureByNodeId(r,n){switch(r){case"connection":return this.mvfConnectionsByNodeId[n];default:throw new Error(`Unsupported MVF feature type: ${r}`)}}getMVFFeatureByType(r){switch(r){case"floor-stack":return this.mvfFloorStacks;case"floor":return this.mvfFloors;default:throw new Error(`Unsupported MVF feature type: ${r}`)}}getPropTranslation(r,n,o,i){if(!this.currentLanguage)return i;let{code:s}=this.currentLanguage,l=this.languagePacks[s]?.optimized?.[r];if(l){let c=l[o];if(c!=null&&c[n]!==void 0)return c[n]}return i}findPreferredLanguage(r){if(!this.venue)return;let n=N3(this.venue,r);return r?.languageCode!=null&&r.languageCode.toLowerCase()!==n.code.toLowerCase()&&A.warn(`Language code "${r.languageCode}" could not be found in the venue. Using "${n.code}" instead.`),n}async changeLanguage(r){let n=r.toLowerCase();if(!n){A.error("Language code must be defined.");return}if(!this.currentLanguage||!this.venue){A.error("Changing the language is not supported for this map.");return}let o=this.currentLanguage.code,i=this.venue?.languages.find(({code:l})=>l.toLowerCase()===n.toLowerCase());if(!i){A.warn(`Language code "${n}" could not be found in the venue.`);return}if(o===i.code)return;let s=this.languagePacks[i.code];if(!s){let l=this.localePacksUrls[i.code];if(!l){A.error(`Locale pack URL not found for language code "${i.code}".`);return}a(this,yf)&&a(this,yf).abort();let c=new AbortController;w(this,yf,c);let p;try{p=await l6(l,{signal:c.signal})}catch(d){A.error(`Failed to download language pack for language code "${i.code}".`,d);return}if(!p||c.signal.aborted)return;s=qS(p),this.languagePacks[i.code]=s}this.Analytics.sendChangeLanguageEvent({fromLanguage:this.currentLanguage.code}),this.currentLanguage=i,this.publish("language-change",this.currentLanguage)}getDistance(r,n){let o=Fd(r),i=Fd(n);return wi([o.longitude,o.latitude],[i.longitude,i.latitude])}async toJSONBundle({downloadLanguagePacks:r=!0}={}){let n=[];if(r&&this.enterpriseMode){let o=new AbortController;for(let i of this.venue?.languages||[])try{if(this.localePacksUrls[i.code]){let s=await _S(this.localePacksUrls[i.code],{signal:o.signal}),l=await hd(s);l&&n.push({language:{code:i.code,name:i.name},localePack:l})}}catch(s){A.warn("failed downloading language pack",s)}}return{type:"json",options:{enterprise:this.enterpriseMode},languagePacks:n,main:this.mvf}}async toBinaryBundle({downloadLanguagePacks:r=!0}={}){if(!this.binaryBundle){A.error("binary bundle not found");return}let n=[];if(r&&this.enterpriseMode){let o=new AbortController;for(let i of this.venue?.languages||[])try{if(this.localePacksUrls[i.code]){let s=await _S(this.localePacksUrls[i.code],{signal:o.signal});s&&n.push({language:{code:i.code,name:i.name},localePack:s})}}catch(s){A.warn("failed downloading language pack",s)}}return{type:"binary",options:{enterprise:this.enterpriseMode},languagePacks:n,main:this.binaryBundle}}destroy(){for(let r of globalThis.Object.keys(a(this,be)))a(this,be)[r]=null}};be=new WeakMap,R0=new WeakSet,V9=function(r){let n=r?.nodes?.[0],o=this.getById("node",n);if(o==null)return;let i=gs([o.coordinate.longitude,o.coordinate.latitude]);return this.connectionSpaceIdsByLatLon[i]?.map(l=>this.connectionsById[l]).find(l=>l!=null)},yf=new WeakMap;var U9=(e,t)=>{let r=!e,n=t?.smoothing,i=n!=null?typeof n=="object"?n.enabled??r:n:r,s=typeof n=="object"?n.radius:void 0;return{enabled:i,radius:s??.75}};u();u();u();u();(function(){typeof globalThis!="object"&&(Object.defineProperty(Object.prototype,"__magic__",{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__)})();var H9="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAkGBwgHBgkICAgKCgkLDhcPDg0NDhwUFREXIh4jIyEeICAlKjUtJScyKCAgLj8vMjc5PDw8JC1CRkE6RjU7PDn/2wBDAQoKCg4MDhsPDxs5JiAmOTk5OTk5OTk5OTk5OTk5OTk5OTk5OTk5OTk5OTk5OTk5OTk5OTk5OTk5OTk5OTk5OTn/wgARCAIABAADAREAAhEBAxEB/8QAGwABAAMBAQEBAAAAAAAAAAAAAAECAwQFBgf/xAAWAQEBAQAAAAAAAAAAAAAAAAAAAQL/2gAMAwEAAhADEAAAAP3EAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAIAAAJAFAAAAAAAAAAAAAAAAAAAAAAAAABAgAAEgCgAAAAAAAAAAAAAAAAAAAABERLSM1zM4zXMzjMoUIqCCSSS8XNC9mpoaVomharWTQAAAAAAAAAAAAAAAAEREtIoZrnGZkucUKFStQQSTFixdNDStF0TWrmiWqbJoAAAAAAAAAAAAAIgiWkZy4HNLzHLXKcxzpzmFYmRkUKFSCCSSxcuampsbR0HSdK9R1R1HTZvWll0mlAAAAAAAAAAAIiKLnLjHNLynLXKcycxzmNYmJmUKFSCAWLFy5qamxvHQvSdJ0nVHUdFm1aparWKAjNWSKAAAAARBEtYzlyXnjmOSuM4U4q4jjOM5a5k5zAyMjOqFCCCCSSS5c0jU1NzoOk6pew7TtjuO1e0646jezWr2WSaUAAAAAECIqtZco55eY464zhTirhOI5Dks5jAwMTIzqhUqQASWLFzSNTY3Og6V646zsO2O47V7DrjqNzWy9nlZ1c0LlrLEk0EQQVipRczIyMU5q5F4U8+vOPOrgThOOuU5jAxMjMzKpUggigJiSSxY0XQ1Njc6TqjtO49CX0D0T0Y7l7E6JdzU1NEvViSalBAWIqVKLSMjIxOauM4U86vPPOrz04TjrkOYwMTIzKJQqQQCKmBJJYutzQ1Njc6TrOyO475fRPRPQjuXsToXWPn6kkkEkhCkEAgggqVMjlrzzzDy7PMPPrhOQ5jBMqoVIIIAAIAJAAJJJLFzWN16TsO49CPTPUl9Q9A6o1LFiSSSSQpCwQQCCCpVMjlrzzyzy7PMPPrhOM5kwM6zKlQQAAQASAASCxY0NI3XpOw7j0I9M9SX0z0DqjU+UqpQqVIBFgEyixJYuWLFDkrzE8o8yvOONOasipBAAAAAAAAAAABJJY2OiO1fQPUj1T0pewuVKlCCqQsBIUSSSSWLlyTM5K808pPLrzziTnrEqQQAAAAAAAAAAASSWNjojtX0D1I9VfSOuND4uzMzqhQqVIALEli5c1jUuQc1vnp5pwJzVmQQAAAAAAAAAAAAAASSaHTHevpHoHTFjMyM6zKlSpABJJcsaGkamhU5q88804E5qzIIAAAAAAAAAAAAAAJJNDpjvX0j0Dqix8dVDMolSpAqCYElixc0XU0IMjlTlrIqAAAAAAAAAAAAAAAAAWNTqjqXYGZkZpUoQQRSFIsSXLroaGhBkcqctZFQAAAAAAAAAAAAAAAACxqdUdS7EngWQCAAQASACSSSwKlSCAAAAAAAAAAAAAAAAAACSSxYFSCCAACCQACSSSwKlSCAAAAAAAAAAAAAAAAAACSSxYGIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABIAJAJAJBAAIAIABAAAAAAAAAAAAAAAAAAAABIAJAJAJBAAIAIABAAAAJABAAAAAAAAAJBILEli5Y0LlzQ0Lly5csWLAkgFSChUoUMyhmUMyhQqVKkEEAEAAAAAAAAAkEgsSWLljQuXNDQuXLlyxYsCSAVIKFShQzKGZQzKFCpUqQe+ZmZkUKFCpUEEAAkksWLFzQ0NTU2NzY3Og3NzoNzc2NjU1NS5csSAQVKmZmZGRiYmBgYHOYGBgYGBiZGRkUMypUqQCAASSWLFi5oaGpqbG5sbnQbm50G5ubGxqampcuWJAIIKGZmZGRiYmBgYHOYGBgYGR+jmBzmBzmJiZGZQoQQSSWLmhqbGxudB0nSdJ1HSdR1HSdJ0G5qamhcsWJJJBIIIBUqVKFDIyMDA5jmOU5TlOY5TmOc5znMTEyMyhQggFixc0NTY2NzoOk6TpOo6TqOo6TpOg3NTU0LlixJJIJBAIKkFChQyMjAwOY5jlOU5jnP00yMTnOc5zAwMjMoVIJJLmhqbmx0HQdBubmxqXLkkgAAAAAAAAAAAAAEEFTMzMTEwOc5znMDAyMyhUgkkuaGpsbnQdB0G5ubGpcuSSAAAAAAAAAAAAAAQQVKGZ1gAEEEEFSCACSSxJJJIAAAAAAAAAAAAAAAAAAAAAAABBBBBUggAkkksSSSAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQCCpBUqQVIKggAkFiSSxYksSSSSAAAAAAAAAAAAAAAAAAQCCpBUqQVIKggAkFiSSxYksSWBIAAKFiQAAAAAAAAACCpUoUMzIyMzMzMyhQoVKkEEAgkEkklixYuXNDQ0NTQ1NC5cuWJAAAAAAAAAAIKlShQzMjIzMzMzKFChUqQQQCCQSSSWLFyxoXNDQ1NDU0LljUkkAAAAAAAAAAggggEEAgAAAAAAAAAAAAAEkgkkkkkAAAAAAAAAAgggggEAgAAAAAEgEAAAAAAEkgkkuAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADyyCCCCCCCCAQASCSQWJJJJLEkkkkkgkkEgkAEgAAEAAgEAggEEEEEEEFSCCCCCCAQASCSQWJJJJLEkkkkkgkkEgEgEgAAEAAgEAggEEEEEH5AQQQQVBBAIAAJBIJJJLEkkkkliSSSSSQSSCQSAAAQAQQCCCCCCCCCpBBBBBUEEEAgAAkEgkkksSSSSSWJJJJJJBJIJBIAABABBAIIIIIIIIKg/LCAQCACAAAACQCQSCQSASSASCQCQAAAAAAQCAQAQCAQAQQCACAAAACQCQSCQSASSASCQCQAAAAAAQCAQAQCAQfPgAAAAAAAAAAAAAAkAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAkAAAAAAAAAAAAAAgAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAH/xAApEAAABQUBAQACAwACAwAAAAABAgQFFQMGERQWEhNAUAAgMGCAkKCw/9oACAEBAAECAP8AwTZznOf3mc5/YZE41xVivFyM6i7C8C8C8zMzMzMyDyDyDyDwV4K7ldSuZV5VgVwqZ/SCca4qxXmcjOouwvAvEzMzMzMzMyDyDyDwV4K7ldSuRVwKgrgf88TDWMrO4VHOo61Hao7ndzvB3k7yZ5M8i8i8zMzMzMyDyDyDyV5K8keSPJHmm8U3em70nam603Mi8qotUDfk5GqZUdfUc6jrUdqjvUeDvB3kzyZ5M8i8i8zMzMzMzMg8g8leSvJHkjyR5pvFN4pu9N2pOtNzIvKqLWA39PX+/saplJlh1tRfVcKrlVdKrrVdqrvVdzu53Y7sZ2M6mdRdRdBdJSUk5SUB0B0B1K6kdSOxHam7Unek70nei7UXWi6UXKk40l9NaRWWuB8/75E41zKjraq+q41nOq6VXas7VXeq71Hc7ud2O7GdRdRdZQXSUlJSUlAdCugOpXUjqR2I7U3em70nek70nai60XSk5UnGkvItIrKoCsC0FwLgXAuBbube3ubm7uiuFcZcZaZYdZUWVl1dwruVdzrulZ0qulVzqOR3EzgZeZcZcK0Vm3t7W1tbW1tgrBYC0q0q4q8jgRxpuVJzoulB0oOlBzoOVBworqa0iwi0i0q4FwLQWAr2trZ2trb3RWiuFcZaZadbUW1l1ZwruVd0rulZ0qulVzqOR3E7gZeZeK4VorNzb29ra2tsFe2CwFpVxVxV5HAjjTcqTnRdKDpQdKDnQcqDhRXU1pFhVm/ISUnKSkrLSsrKyspJyUhvitOtrLq69Q4qHGu41nGqvqLjrDKhUDW+nv1nP+Oc+vYVArFUEVEWUl1FfQcU7imckzinX0VxFoLgXyMlJykrLS0tLS0rKSclI74rjraq6uvUuKhxruNdxqr6i46wysVA1vp79Zz/AI5z6A4VArFUEVkWUl1FfQcU7imcUzinX0VxFoLZKTlJWVlpaXl5eWlpWUB0BzBxkDr669SvUr666stqqz1xqes/j5AxahFFJXRWp1yZemX0F5HCQkpOUlZaWlpeXl5aWB2lQdAcwcZE7hWcFLgpXqF1ZbVVnUDU9Z/HyBi1CV6SuitTrky9MvoLyL5AXEXEXIXIXKSkpKSkpIHIHIHIrkVxK4yJnCsvrra6uqpPVE354GJVpKaCtOtoryuEiZxM5C5C5C5SUnJSclJSQOQORXIrkVxBxM4VV9dbXV1VJ6om/PAxKtFTQVp1tFeRwkRWitFYKvb2tra2draBUCsFgLCrSrQWitOsqqT1RN+jAxKtJTTWFWitMtMtFYKzb29ra2tnaBUCsFZVhVpVoLRWnWVFJ6om/RgYlWkpprAW73v36zn++c+gOFQKv1GoJv04GCp9Rq/T36zn++c+gOFT7fUagm/TgYKn1+3/AKEeMefHjx8/n8vl8vn8/Hjx5xj9bjHnx48fP5/L5fL5/Px48ecY/wAvOPxceQIFIKIJgSAiBAVuK2FaitINAM4MwMwMsJCQkJCQkJCwosws4tAtItQtgtot4oRSCm+Hy8ecfi48gQKQUQTAkBECArcVsK1FaQaAZwZgZgZYSEhISEhISFhRZhZxaBaRahbBbRbxQikFN8BpfMWgWozWLaLcKAUWpq62vr/DX19YEoJARAhBvK2laytRGgjORlIyEYiMJLfJbxLdJbhLbJbRLaJbJbZLbAWxzHMcxzHMcxzHMDbBrYNbJraNbRrbPbh7dPbx7fOwHYjsZ2UzMZoM0maxbRbhQCi1NXW19fX19fW1QSAiBCDeVtK1laiNBGYjKRkIxEYSW+S3iW6S3CW2S2iW0S2S2yW2AtgLY5jmOY5jmOY5gbYNbJrZNbRraPbZ7cPbp7ePb52A7EdjOymZjW4e3D26e3j2+ZgMwmYhYxY4SEhISEBjKxlYiMJGAjAS3iW9TtynblO26dtUrap2zTtmnbNO2SW2S3isRWYGkG0EAItTW1/h8Phr6+rp6AtwtQs5mI9vntw9tHtk9s1LZqWzUto9tnts9uHt09vHt8zAZhMxCxixwkJCQkIDGVjKxEYSMBGAlvEt6nblO3Kdt0rap21TtmnbNO2SWyS2yW8ViKzA1A2ggBFqa2v8Ph8NfW1dPRFuFqMzGYjW+e3D20e2T2zUtk9tHto1tCzHYj2+e3T24e3D24a3DW4Nuc5znOc4FuBbhbcLbhLcJblO3CW4S3iMRGcrYVECcKYB+cJBoCjM2maDsZ7fPbp7cPbh7cNbhrcG3Oc5znOcC3C24W3C24S3CW5TtwluEt4jERnK2FRAnCmAfnCQaAoxb/7ePl8NbU09PT1NYKHy8Y/ZePl8NbU09PT1NYKHy8Y/4Z6+g1tjb3d+Rk5SVlZWVlZSTkd8Fu3s/b6es/pvX0Gtsbe7vyMnKSkrKysrKSciC8Fu3s/YKnrP9gqAb8X0NQawqBVCrMrMqMoGuNUTiYf4ICT5/L4/H4fD4fH4hSCmBAAP4AgctUtYqgqoqsqsqoFIVwqAb8X0NQawqBVCrMrMqMoGuNUTiYf4ICT5/L4/H4fD4fH4hSCmBAAP4AgctUtYqgqkqsqsqsFIV/Hn8XHj5/H4a+traurq6mpqampqampqampqampqampqampqamrq62tr/D4/Lx5/Fx4+fx+Gvra2rq6upqampqampqamrq6upqampqampqamrq6utra/w+Py/wCgEzNTc5OTs7PT09PT8/Pz09PT07Ozk3Ng9TMxLy0rKSclJSMhIb+9vbu9u7u7u7u7u729vb2/vyEjJSUnKSstLzEzNTc5OTs7Oz09PT8/Pz09PT07Ozk5NzUzMS8tKyknJSUjISG/v727vbu7u7u7u7u9u729v78hIyUlJykrLS8x0nR9H0fR9H0XRdF0XRdD0PQ9F0XRdF0XRdF0fR9H0nSdJ0vS9L0vTdN03TdP0/T9P0/T9P0/T9P0/T9R0/T9P0/T9P0/TdN03S9L0vS9J0nSdJ0fR9H0XRdF0PRdD0PQ9D0PRdF0XRdF0XR9H0fSdJ0nS9L0vS9N03TdN0/T9P0/T9P0/T9P0/T9P1HT9P0/T9P0/T9N03TdL0vS9L0vSS8tLy0tLS0rKysrKysrKysrKystLS0vLS8vLy8vMTExMTExMzMzMTMzMzM1NTUzMzMzMzMzMzExMTExMS8vLy8vLy8tKy0tKysrKysrKysrKysrLS0tLy0vLy8vLzExMTExMTMzMzEzMzMzNTU1MzMzMzMzMzMxMTExMTEvLy8vnOc5znOc5znOc5znOc5znOc59ZznPr169evXr169evXr169evXr16znOfWc5znOc5znOc5znOc5znOc5znOc59ZznPr169evXr169evXr169evXr16znOfWc5z/9YD//xAArEAEAAgIDAQABBAICAQUAAAAAAVICYgNRYQRBEEBQUzFCIDARYICQoLD/2gAIAQEAAz8A/wDgmhCEI/nYQj+RhjH5ccflxw44YMe0dtmzZs2bNmzZs2bIsjtiwlxy45/Ljn8se0fwuPbjj8uOPy44YQxR2izZs2bNmzZs2bNkWR2xYS45cc/lhP5Y9/wEQwj8sIRD1s2bNmzZs2bNmzZs2bNmzZs2bNmzZs2bNmyLMZYZMZ/KJ/dRDCPywhjCI/LZs2bNmzZs2bNmzZs2bNmzZs2bNmzZs2bNkWYywlhP5RP/ABj9hDGGMIh69bNmzZs2bNmzZsmybJsmybJsmybJsmybJsmybJs2bNmzZs2bNmzZ7+mMsZYyj9hDGGMIj9NmzZs2bNmzZs2bJsmybJsmybJs2TZNk2TZNk2bJs2bNmzZs2bNmzZ6iWMsXr16hiwYMGDBgwYo/T169/T162bNmzZs2TZNk2T2ntPae09pSlKUpSlPae09p7T2mybJsmzZs2bNmz17+nr16hiwYOPtx9uPtx9sO2DBih69evXr1s2bNmzZsmybJsmye09p7T2lKUpSlKU9p7T2ntNk2TZNmzZs2bNmz17+vr1s2bNmzZs2bNmzZs2evXr169bNmye09p7SlKUp/wC6UpSlKe09p7etmzZs9evWzZs2bNmzZs2bNmzZs2bPXr1s9bNmye09p7SlKUp/7pSlKUp7T29bPWz169evWzZs2bNmzZs2bNmzZs2bNmzZs2evU9plM/vJhMJ7T29bNnrZ62bNmzZs2bNmzZs2bNmzZs2bNnr39J7TKZ/eTCYT3+nr162bNnrZs2bJsntNk2TZPabNmzZs2etnr39JlM/wUwmP09etmzZs2bNk2TZNk2TZNk2bNmzZs2bNnv6TKZ/gphMfp69etk9p7T2ntKUpSlKUp7T2nt69e/pMpn+GmH/j9PXr1Pae09pSySlklKU9p7T29evf0mUz/DTCY/T16lP/AHSlKU/xUpSlP/dKUpT/ABUpT/8AQllKWTJl0y6ZdMumXTLpl0y6ZJSn+QlKWTJl0y6ZdMumXTLpl0y6ZJSn/sn9xKWXTLpn0z6Z9M+mXTLplVlVlVlVlVlVlVlVlVlVlRlVlVlRlVlVlVlVlVlVlVl0z6Z9M4/DPpn0z6ZdMkp/byll0y6Z9M+mfTPpn0y6ZVZVZVZVZVZVZVZVZUZVZUZVZVZVZVZVZVZVZVZVZVZdM+mfTOPwz6Z9M+mTJlVlVlVl0yZ9M2fTPpn0z6Z9M+mbPpn0z6Z9M2fTPpl0yqyqyqyqyqyomiaJomiaJomiaJomjRo0aNGjRo0aNGjRNE0TRNE0TRNE0TRNE0ZVZVZVZVZVZVZM+mbPpn0z6Z9M+mfTNn0z6Z9M+mfTPpl0y6ZVZVZVTVlVlRNE0TRlRNE0TRNE0TRo0aNGjRo0aNGjRomiaJomiaJomiaJomqaJqyq0TRNE0TRNE0TVNE1TVNU1TRNE1TVNU0TRNE0TRNGjRo0aNGjRhWHFHTgh88Pmj8Pnj/V89HBRwf1w4f64cNMXFSHFTFxUxcVIcP9cOGkOCkPno+ej55/D55cEuKemHUIo0aNGjRo0TRNE0TRNE0TVNE0TVNE1TVNE1TRNU0TRNE0TRNGjRo0aNGjRhWHFHThh88Pnj8Pnq+ejgo4P64cP9cOKkOKkOKmLipi4aYuH+uHBSHBSHz0fPR88/h88uCXFNWHUIo0aNGjRo4ZcU9MOoRRFGjRo0aNGjRo0aNGjRo0RRhVxR04IcGP4cGP+jij/GEMI/xjCP3+M/5xhxT/AJwhwT/o4Mv9XBk4p6YdQiiKNGjRo0aNGjRo0aNGjRoijGsOKOnBi4Mfw4I/0cUf4whhH+MYR+/xn/OMOKf84Q4J/wBHBP8Ar/zxrDCsOKkOKjhq4auGrhq4auGjipDjpDGsI/k8awwrDipDio4aOGrhq4auGrho4qQ46QxrCP8A0bHcMLQ47w4rw4buCzgs4O3A4HA4XA4HA4HA4O3BZwWcN3Fdx3hhaGNoR/Dx3DC0OO8OK8OG7gs4LODtwOBwOFwOBwOBwODtwWcFnDdxXcd4YWhjaEf88UftoQh4y6ZuRyuVzOZzeudz+uf1z+uf1z+uf1z+uf1zuf1z+uf1z+uf1z+udzR25nM5o7c3rlcrlZsniOkSj9tCEPGXTNyuVy+uZzOb1z+uf1z+uf1z+uf1z+uf1z+udz+uf1z+uf1z+uf1z+ueO3O5nM5vXK5XKzZPEdMUftoYsemHTDpx9OPpxVcVXDVw1cNXDVw0cNHDRw0cNHDRw0cNHDRw0cNHDRw0cNHDRw0cNHDVw1cNXFVxVcVXFVx9OPph0w6Yo/bQxY9MOnH04+nH04quKrhq4auGrhq4aOGjho4aOGjho4aOGkOGkOGkOGjho4aOGjho4aOGjhq4auGriq4quKriq4+nH0w6Ydf+wHgcLhcLicTjYdww7hh3DDuGPcMe4Y9ww7hh3DDuGHcONxuJxOFwuBwOB8753z2fPZ89nz3fNd893zXfPd893z3fP/Y+e757uC75/wCyHz/2Q+f+yHBd893z3fPd893z3fPd893zXfNd893z2fPZ8/b5+3zvncDgcLhcLicTjYdww7hh3DDuGHcMe4Ydww7hh3DDuGHcONxuJxOFwuBwPnfO+d89nz2fPZ893zXfPd813z3fPd893z/2Pnu+e7gu+f8Ash8/9kPn/shwXcF3z3fPd893z3fPd893zXfNd893z2fPZ8/b5+3zvncDdu3bt03bt26bpum6bpum6bt27du3bt26bt26bpum6bpum6bpum6bt03TdN26bpum6bpum7dN03TdN03TdN03TdN03Tdum7dum7dN27dum6bpum6bpum6bpum7du3bt03bpu3bpum6bpum6bpum6bpu3TdN03bpum6bpum6bt03TdN03TdN03TdN03TdN03TduysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysmzKzKzKybMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrJT+2lKUpSlKUpSlKUpSlKUpSlKUpSlKUpSlKUpSn9tKUpSlKUpSlKUpSlKUpSlKUpSlKUpSlKUpT/wDrA//EAB0RAAMBAAMBAQEAAAAAAAAAAAABERIwQFAgkMD/2gAIAQIBAT8A/COlKioqKioqKi+zSoqKioqL59Ro0aKyvpVlZWaNFXiVGkaNFZWV9CsrNGjRpFXepo0V8c69Zo0u1pGilfVnJWaNF+NFXNUaNFfmU0aReamkaNPzNM19VlZWaKysrK/XrKzTNGjRWaKyv+u0/8QAHREBAQACAQUAAAAAAAAAAAAAEQBAUCAQITCQwP/aAAgBAwEBPwD1NkRER07eYiIiNMRERGARERGgIiNAREZRERoCIjiYBERqiIwiI1REcCIiIiIjbkREREREfXZ//9k=";u();u();var W9=!1;function $9(){W9=!0}function z9(){return W9}var B0=class{constructor(t){f(this,"backgroundAlpha",1);f(this,"backgroundColor",new Nt);f(this,"width",0);f(this,"height",0);f(this,"options",{});f(this,"renderer");f(this,"enabledLayers",new Set([0,1]));f(this,"handleWebGLContextCreationError",t=>{this.options.onWebGLContextCreationError?.(t)});f(this,"handleWebGLContextLost",t=>{this.options.onWebGLContextLost?.(t)});f(this,"handleWebGLContextRestored",t=>{this.options.onWebGLContextRestored?.(t)});try{this.options=t,z9()?(this.renderer={setSize:()=>{},state:{reset:()=>{}},properties:{get:()=>{}},getSize:()=>({width:window.innerWidth,height:innerHeight}),getDrawingBufferSize:()=>({width:window.innerWidth,height:innerHeight}),getClearAlpha:()=>1,getClearColor:()=>new Nt,autoUpdate:!0,shadowMap:{autoUpdate:!0},getContext:()=>({getContextAttributes(){return{alpha:!0,antialias:!1,depth:!0,stencil:!1}}}),readRenderTargetPixelsAsync:()=>Promise.resolve([]),setRenderTarget:()=>{},setClearColor:()=>{},clear:()=>{},render:()=>{},clearStencil:()=>{},clearDepth:()=>{},domElement:document.createElement("canvas"),capabilities:{isWebGL2:!0}},this.renderer.domElement.style.width="1920px",Object.defineProperty(this.renderer.domElement,"clientWidth",{value:1920}),this.renderer.domElement.style.height="1080px",Object.defineProperty(this.renderer.domElement,"clientHeight",{value:1080})):this.renderer=new o5({canvas:t.canvas,alpha:t.alpha||!1,stencil:!0,antialias:typeof t.antialias=="boolean"?t.antialias:!0,powerPreference:"high-performance",preserveDrawingBuffer:!0}),this.backgroundColor=new Nt(t.backgroundColor??"#ffffff"),this.backgroundAlpha=t.backgroundAlpha??1}catch(r){A.error(r),t.onWebGLRendererError&&t.onWebGLRendererError(r)}this.domElement()?.addEventListener("webglcontextlost",this.handleWebGLContextLost),this.domElement()?.addEventListener("webglcontextrestored",this.handleWebGLContextRestored),this.domElement()?.addEventListener("webglcontextcreationerror",this.handleWebGLContextCreationError)}destroy(){this.renderer&&this.renderer.dispose?.(),this.domElement()?.removeEventListener("webglcontextlost",this.handleWebGLContextLost),this.domElement()?.removeEventListener("webglcontextrestored",this.handleWebGLContextRestored),this.domElement()?.removeEventListener("webglcontextcreationerror",this.handleWebGLContextCreationError)}render(t,r){if(this.renderer){this.renderer.state.reset(),r.layers.disableAll();for(let n of this.enabledLayers.values())r.layers.enable(n);this.renderer.clearStencil(),this.renderer.autoClear=!1,this.renderer.setRenderTarget(null),this.renderer.render(t,r),this.renderer.clearDepth(),r.layers.disableAll(),r.layers.enable(hb.ALWAYS_ON_TOP),this.renderer.render(t,r),this.renderer.state.reset()}}clear(){this.renderer&&(this.renderer.setClearColor(this.backgroundColor,this.backgroundAlpha),this.renderer.clear())}setBufferSize(t,r){y.env.NODE_ENV==="test"||!this.renderer||(this.width=t,this.height=r,this.renderer.setSize(t,r,!1))}setBackgroundColor(t,r){this.backgroundColor=t,this.backgroundAlpha=r}domElement(){return this.renderer?.domElement}};u();u();var X9='"use strict";(()=>{var Je=Object.defineProperty;var gt=(r,e,t)=>e in r?Je(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var _t=(r,e)=>{for(var t in e)Je(r,t,{get:e[t],enumerable:!0})};var w=(r,e,t)=>gt(r,typeof e!="symbol"?e+"":e,t);function Qe(r,e){return e.x+e.w<r.x+r.w&&e.x>r.x&&e.y>r.y&&e.y+e.h<r.y+r.h}function Ke(r,e){let[t,s]=e;return t>=r.x&&t<=r.x+r.w&&s>=r.y&&s<=r.y+r.h}function Ge(r,e){let t=e.x,s=e.y,n=e.x+e.w,a=e.y+e.h,o=r.x,i=r.y,u=r.x+r.w,l=r.y+r.h;return t<u&&o<n&&s<l&&i<a}function $(r,e){for(let t=0;t<e.length;t++)r.push(e[t])}var b=class{constructor(e,t,s,n,a){w(this,"x");w(this,"y");w(this,"w");w(this,"h");w(this,"userData");this.userData=typeof a>"u"?null:a,this.x=e,this.y=t,this.w=s,this.h=n}contains(e){return e===this?!1:Qe(this,e)}intersects(e){return Ge(this,e)}intersectsPoint(e){return Ke(this,e)}draw(e){e.fillStyle="rgba(123,222,26, 0.8)",e.fillRect(this.x,this.y,this.w,this.h)}};var Re=class r{constructor(e,t){w(this,"topLeft");w(this,"topRight");w(this,"bottomLeft");w(this,"bottomRight");w(this,"divided",!1);w(this,"boundary");w(this,"capacity",16);w(this,"objects",[]);w(this,"parent");this.parent=t,this.boundary=e}getSize(){return this.divided?this.objects.length+this.topLeft.getSize()+this.topRight.getSize()+this.bottomLeft.getSize()+this.bottomRight.getSize():this.objects.length}subdivide(){let{x:e,y:t,w:s,h:n}=this.boundary;this.topLeft=new r(new b(e,t,s/2,n/2),this),this.topRight=new r(new b(e+s/2,t,s/2,n/2),this),this.bottomLeft=new r(new b(e,t+n/2,s/2,n/2),this),this.bottomRight=new r(new b(e+s/2,t+n/2,s/2,n/2),this),this.divided=!0}queryRect(e){let t=[];if(this.boundary.intersects(e))t.push(...this.objects);else return[];return this.divided&&($(t,this.topLeft.queryRect(e)),$(t,this.topRight.queryRect(e)),$(t,this.bottomLeft.queryRect(e)),$(t,this.bottomRight.queryRect(e))),t}queryPoint(e){let t=[];if(this.boundary.intersectsPoint(e))t.push(...this.objects);else return[];return this.divided&&($(t,this.topLeft.queryPoint(e)),$(t,this.topRight.queryPoint(e)),$(t,this.bottomLeft.queryPoint(e)),$(t,this.bottomRight.queryPoint(e))),t}insert(e){return(this.parent?!this.boundary.contains(e):!this.boundary.intersects(e))?!1:this.objects.length<this.capacity?(this.objects.push(e),!0):(this.divided||this.subdivide(),(this.topLeft.insert(e)||this.topRight.insert(e)||this.bottomLeft.insert(e)||this.bottomRight.insert(e))===!1&&this.objects.push(e),!0)}drawObjects(e){this.objects.forEach(t=>t.draw(e)),this.divided&&(this.topLeft.drawObjects(e),this.topRight.drawObjects(e),this.bottomLeft.drawObjects(e),this.bottomRight.drawObjects(e))}draw(e){e.rect(this.boundary.x,this.boundary.y,this.boundary.w,this.boundary.h),this.divided&&(this.topLeft.draw(e),this.topRight.draw(e),this.bottomLeft.draw(e),this.bottomRight.draw(e)),e.strokeStyle="black",e.lineWidth=4,e.stroke()}};var xe={};_t(xe,{BRAND:()=>Ut,DIRTY:()=>J,EMPTY_PATH:()=>kt,INVALID:()=>p,NEVER:()=>Ar,OK:()=>T,ParseStatus:()=>k,Schema:()=>_,ZodAny:()=>U,ZodArray:()=>z,ZodBigInt:()=>K,ZodBoolean:()=>G,ZodBranded:()=>Se,ZodCatch:()=>de,ZodDate:()=>H,ZodDefault:()=>ce,ZodDiscriminatedUnion:()=>Ee,ZodEffects:()=>j,ZodEnum:()=>ie,ZodError:()=>C,ZodFirstPartyTypeKind:()=>m,ZodFunction:()=>Pe,ZodIntersection:()=>se,ZodIssueCode:()=>c,ZodLazy:()=>ne,ZodLiteral:()=>ae,ZodMap:()=>ge,ZodNaN:()=>ve,ZodNativeEnum:()=>oe,ZodNever:()=>E,ZodNull:()=>te,ZodNullable:()=>Z,ZodNumber:()=>Q,ZodObject:()=>S,ZodOptional:()=>I,ZodParsedType:()=>f,ZodPipeline:()=>Ae,ZodPromise:()=>W,ZodReadonly:()=>ue,ZodRecord:()=>Me,ZodSchema:()=>_,ZodSet:()=>_e,ZodString:()=>F,ZodSymbol:()=>me,ZodTransformer:()=>j,ZodTuple:()=>P,ZodType:()=>_,ZodUndefined:()=>ee,ZodUnion:()=>re,ZodUnknown:()=>D,ZodVoid:()=>ye,addIssueToContext:()=>d,any:()=>Ht,array:()=>sr,bigint:()=>Xt,boolean:()=>dt,coerce:()=>Sr,custom:()=>it,date:()=>Jt,datetimeRegex:()=>nt,defaultErrorMap:()=>L,discriminatedUnion:()=>or,effect:()=>vr,enum:()=>yr,function:()=>hr,getErrorMap:()=>fe,getParsedType:()=>M,instanceof:()=>qt,intersection:()=>cr,isAborted:()=>Ne,isAsync:()=>he,isDirty:()=>je,isValid:()=>B,late:()=>Wt,lazy:()=>pr,literal:()=>mr,makeIssue:()=>Ce,map:()=>lr,nan:()=>Yt,nativeEnum:()=>gr,never:()=>tr,null:()=>Gt,nullable:()=>br,number:()=>ct,object:()=>nr,objectUtil:()=>ze,oboolean:()=>Cr,onumber:()=>Rr,optional:()=>xr,ostring:()=>Tr,pipeline:()=>wr,preprocess:()=>kr,promise:()=>_r,quotelessJson:()=>vt,record:()=>ur,set:()=>fr,setErrorMap:()=>bt,strictObject:()=>ar,string:()=>ot,symbol:()=>Qt,transformer:()=>vr,tuple:()=>dr,undefined:()=>Kt,union:()=>ir,unknown:()=>er,util:()=>v,void:()=>rr});var v;(function(r){r.assertEqual=n=>{};function e(n){}r.assertIs=e;function t(n){throw new Error}r.assertNever=t,r.arrayToEnum=n=>{let a={};for(let o of n)a[o]=o;return a},r.getValidEnumValues=n=>{let a=r.objectKeys(n).filter(i=>typeof n[n[i]]!="number"),o={};for(let i of a)o[i]=n[i];return r.objectValues(o)},r.objectValues=n=>r.objectKeys(n).map(function(a){return n[a]}),r.objectKeys=typeof Object.keys=="function"?n=>Object.keys(n):n=>{let a=[];for(let o in n)Object.prototype.hasOwnProperty.call(n,o)&&a.push(o);return a},r.find=(n,a)=>{for(let o of n)if(a(o))return o},r.isInteger=typeof Number.isInteger=="function"?n=>Number.isInteger(n):n=>typeof n=="number"&&Number.isFinite(n)&&Math.floor(n)===n;function s(n,a=" | "){return n.map(o=>typeof o=="string"?`\'${o}\'`:o).join(a)}r.joinValues=s,r.jsonStringifyReplacer=(n,a)=>typeof a=="bigint"?a.toString():a})(v||(v={}));var ze;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(ze||(ze={}));var f=v.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),M=r=>{switch(typeof r){case"undefined":return f.undefined;case"string":return f.string;case"number":return Number.isNaN(r)?f.nan:f.number;case"boolean":return f.boolean;case"function":return f.function;case"bigint":return f.bigint;case"symbol":return f.symbol;case"object":return Array.isArray(r)?f.array:r===null?f.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?f.promise:typeof Map<"u"&&r instanceof Map?f.map:typeof Set<"u"&&r instanceof Set?f.set:typeof Date<"u"&&r instanceof Date?f.date:f.object;default:return f.unknown}};var c=v.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),vt=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:"),C=class r extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){let t=e||function(a){return a.message},s={_errors:[]},n=a=>{for(let o of a.issues)if(o.code==="invalid_union")o.unionErrors.map(n);else if(o.code==="invalid_return_type")n(o.returnTypeError);else if(o.code==="invalid_arguments")n(o.argumentsError);else if(o.path.length===0)s._errors.push(t(o));else{let i=s,u=0;for(;u<o.path.length;){let l=o.path[u];u===o.path.length-1?(i[l]=i[l]||{_errors:[]},i[l]._errors.push(t(o))):i[l]=i[l]||{_errors:[]},i=i[l],u++}}};return n(this),s}static assert(e){if(!(e instanceof r))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,v.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){let t={},s=[];for(let n of this.issues)n.path.length>0?(t[n.path[0]]=t[n.path[0]]||[],t[n.path[0]].push(e(n))):s.push(e(n));return{formErrors:s,fieldErrors:t}}get formErrors(){return this.flatten()}};C.create=r=>new C(r);var xt=(r,e)=>{let t;switch(r.code){case c.invalid_type:r.received===f.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case c.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,v.jsonStringifyReplacer)}`;break;case c.unrecognized_keys:t=`Unrecognized key(s) in object: ${v.joinValues(r.keys,", ")}`;break;case c.invalid_union:t="Invalid input";break;case c.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${v.joinValues(r.options)}`;break;case c.invalid_enum_value:t=`Invalid enum value. Expected ${v.joinValues(r.options)}, received \'${r.received}\'`;break;case c.invalid_arguments:t="Invalid function arguments";break;case c.invalid_return_type:t="Invalid function return type";break;case c.invalid_date:t="Invalid date";break;case c.invalid_string:typeof r.validation=="object"?"includes"in r.validation?(t=`Invalid input: must include "${r.validation.includes}"`,typeof r.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${r.validation.position}`)):"startsWith"in r.validation?t=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?t=`Invalid input: must end with "${r.validation.endsWith}"`:v.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case c.too_small:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(r.minimum))}`:t="Invalid input";break;case c.too_big:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="bigint"?t=`BigInt must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(r.maximum))}`:t="Invalid input";break;case c.custom:t="Invalid input";break;case c.invalid_intersection_types:t="Intersection results could not be merged";break;case c.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case c.not_finite:t="Number must be finite";break;default:t=e.defaultError,v.assertNever(r)}return{message:t}},L=xt;var He=L;function bt(r){He=r}function fe(){return He}var Ce=r=>{let{data:e,path:t,errorMaps:s,issueData:n}=r,a=[...t,...n.path||[]],o={...n,path:a};if(n.message!==void 0)return{...n,path:a,message:n.message};let i="",u=s.filter(l=>!!l).slice().reverse();for(let l of u)i=l(o,{data:e,defaultError:i}).message;return{...n,path:a,message:i}},kt=[];function d(r,e){let t=fe(),s=Ce({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t,t===L?void 0:L].filter(n=>!!n)});r.common.issues.push(s)}var k=class r{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){let s=[];for(let n of t){if(n.status==="aborted")return p;n.status==="dirty"&&e.dirty(),s.push(n.value)}return{status:e.value,value:s}}static async mergeObjectAsync(e,t){let s=[];for(let n of t){let a=await n.key,o=await n.value;s.push({key:a,value:o})}return r.mergeObjectSync(e,s)}static mergeObjectSync(e,t){let s={};for(let n of t){let{key:a,value:o}=n;if(a.status==="aborted"||o.status==="aborted")return p;a.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof o.value<"u"||n.alwaysSet)&&(s[a.value]=o.value)}return{status:e.value,value:s}}},p=Object.freeze({status:"aborted"}),J=r=>({status:"dirty",value:r}),T=r=>({status:"valid",value:r}),Ne=r=>r.status==="aborted",je=r=>r.status==="dirty",B=r=>r.status==="valid",he=r=>typeof Promise<"u"&&r instanceof Promise;var h;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e?.message})(h||(h={}));var N=class{constructor(e,t,s,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=s,this._key=n}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},et=(r,e)=>{if(B(e))return{success:!0,data:e.value};if(!r.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new C(r.common.issues);return this._error=t,this._error}}};function y(r){if(!r)return{};let{errorMap:e,invalid_type_error:t,required_error:s,description:n}=r;if(e&&(t||s))throw new Error(`Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:n}:{errorMap:(o,i)=>{let{message:u}=r;return o.code==="invalid_enum_value"?{message:u??i.defaultError}:typeof i.data>"u"?{message:u??s??i.defaultError}:o.code!=="invalid_type"?{message:i.defaultError}:{message:u??t??i.defaultError}},description:n}}var _=class{get description(){return this._def.description}_getType(e){return M(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:M(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new k,ctx:{common:e.parent.common,data:e.data,parsedType:M(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(he(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let s=this.safeParse(e,t);if(s.success)return s.data;throw s.error}safeParse(e,t){let s={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:M(e)},n=this._parseSync({data:e,path:s.path,parent:s});return et(s,n)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:M(e)};if(!this["~standard"].async)try{let s=this._parseSync({data:e,path:[],parent:t});return B(s)?{value:s.value}:{issues:t.common.issues}}catch(s){s?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(s=>B(s)?{value:s.value}:{issues:t.common.issues})}async parseAsync(e,t){let s=await this.safeParseAsync(e,t);if(s.success)return s.data;throw s.error}async safeParseAsync(e,t){let s={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:M(e)},n=this._parse({data:e,path:s.path,parent:s}),a=await(he(n)?n:Promise.resolve(n));return et(s,a)}refine(e,t){let s=n=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(n):t;return this._refinement((n,a)=>{let o=e(n),i=()=>a.addIssue({code:c.custom,...s(n)});return typeof Promise<"u"&&o instanceof Promise?o.then(u=>u?!0:(i(),!1)):o?!0:(i(),!1)})}refinement(e,t){return this._refinement((s,n)=>e(s)?!0:(n.addIssue(typeof t=="function"?t(s,n):t),!1))}_refinement(e){return new j({schema:this,typeName:m.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return I.create(this,this._def)}nullable(){return Z.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return z.create(this)}promise(){return W.create(this,this._def)}or(e){return re.create([this,e],this._def)}and(e){return se.create(this,e,this._def)}transform(e){return new j({...y(this._def),schema:this,typeName:m.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new ce({...y(this._def),innerType:this,defaultValue:t,typeName:m.ZodDefault})}brand(){return new Se({typeName:m.ZodBranded,type:this,...y(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new de({...y(this._def),innerType:this,catchValue:t,typeName:m.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Ae.create(this,e)}readonly(){return ue.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},wt=/^c[^\\s-]{8,}$/i,Tt=/^[0-9a-z]+$/,Rt=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Ct=/^[0-9a-fA-F]{8}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{12}$/i,St=/^[a-z0-9_-]{21}$/i,At=/^[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]*$/,Ot=/^[-+]?P(?!$)(?:(?:[-+]?\\d+Y)|(?:[-+]?\\d+[.,]\\d+Y$))?(?:(?:[-+]?\\d+M)|(?:[-+]?\\d+[.,]\\d+M$))?(?:(?:[-+]?\\d+W)|(?:[-+]?\\d+[.,]\\d+W$))?(?:(?:[-+]?\\d+D)|(?:[-+]?\\d+[.,]\\d+D$))?(?:T(?=[\\d+-])(?:(?:[-+]?\\d+H)|(?:[-+]?\\d+[.,]\\d+H$))?(?:(?:[-+]?\\d+M)|(?:[-+]?\\d+[.,]\\d+M$))?(?:[-+]?\\d+(?:[.,]\\d+)?S)?)??$/,It=/^(?!\\.)(?!.*\\.\\.)([A-Z0-9_\'+\\-\\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\\-]*\\.)+[A-Z]{2,}$/i,Nt="^(\\\\p{Extended_Pictographic}|\\\\p{Emoji_Component})+$",Be,jt=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Et=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\/(3[0-2]|[12]?[0-9])$/,Mt=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Pt=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Zt=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,$t=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,rt="((\\\\d\\\\d[2468][048]|\\\\d\\\\d[13579][26]|\\\\d\\\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\\\d|30)|(02)-(0[1-9]|1\\\\d|2[0-8])))",Lt=new RegExp(`^${rt}$`);function st(r){let e="[0-5]\\\\d";r.precision?e=`${e}\\\\.\\\\d{${r.precision}}`:r.precision==null&&(e=`${e}(\\\\.\\\\d+)?`);let t=r.precision?"+":"?";return`([01]\\\\d|2[0-3]):[0-5]\\\\d(:${e})${t}`}function Vt(r){return new RegExp(`^${st(r)}$`)}function nt(r){let e=`${rt}T${st(r)}`,t=[];return t.push(r.local?"Z?":"Z"),r.offset&&t.push("([+-]\\\\d{2}:?\\\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function Dt(r,e){return!!((e==="v4"||!e)&&jt.test(r)||(e==="v6"||!e)&&Mt.test(r))}function zt(r,e){if(!At.test(r))return!1;try{let[t]=r.split("."),s=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),n=JSON.parse(atob(s));return!(typeof n!="object"||n===null||"typ"in n&&n?.typ!=="JWT"||!n.alg||e&&n.alg!==e)}catch{return!1}}function Bt(r,e){return!!((e==="v4"||!e)&&Et.test(r)||(e==="v6"||!e)&&Pt.test(r))}var F=class r extends _{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==f.string){let a=this._getOrReturnCtx(e);return d(a,{code:c.invalid_type,expected:f.string,received:a.parsedType}),p}let s=new k,n;for(let a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(n=this._getOrReturnCtx(e,n),d(n,{code:c.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),s.dirty());else if(a.kind==="max")e.data.length>a.value&&(n=this._getOrReturnCtx(e,n),d(n,{code:c.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),s.dirty());else if(a.kind==="length"){let o=e.data.length>a.value,i=e.data.length<a.value;(o||i)&&(n=this._getOrReturnCtx(e,n),o?d(n,{code:c.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):i&&d(n,{code:c.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),s.dirty())}else if(a.kind==="email")It.test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"email",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="emoji")Be||(Be=new RegExp(Nt,"u")),Be.test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"emoji",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="uuid")Ct.test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"uuid",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="nanoid")St.test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"nanoid",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="cuid")wt.test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"cuid",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="cuid2")Tt.test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"cuid2",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="ulid")Rt.test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"ulid",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),d(n,{validation:"url",code:c.invalid_string,message:a.message}),s.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"regex",code:c.invalid_string,message:a.message}),s.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(n=this._getOrReturnCtx(e,n),d(n,{code:c.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),s.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(n=this._getOrReturnCtx(e,n),d(n,{code:c.invalid_string,validation:{startsWith:a.value},message:a.message}),s.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(n=this._getOrReturnCtx(e,n),d(n,{code:c.invalid_string,validation:{endsWith:a.value},message:a.message}),s.dirty()):a.kind==="datetime"?nt(a).test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{code:c.invalid_string,validation:"datetime",message:a.message}),s.dirty()):a.kind==="date"?Lt.test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{code:c.invalid_string,validation:"date",message:a.message}),s.dirty()):a.kind==="time"?Vt(a).test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{code:c.invalid_string,validation:"time",message:a.message}),s.dirty()):a.kind==="duration"?Ot.test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"duration",code:c.invalid_string,message:a.message}),s.dirty()):a.kind==="ip"?Dt(e.data,a.version)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"ip",code:c.invalid_string,message:a.message}),s.dirty()):a.kind==="jwt"?zt(e.data,a.alg)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"jwt",code:c.invalid_string,message:a.message}),s.dirty()):a.kind==="cidr"?Bt(e.data,a.version)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"cidr",code:c.invalid_string,message:a.message}),s.dirty()):a.kind==="base64"?Zt.test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"base64",code:c.invalid_string,message:a.message}),s.dirty()):a.kind==="base64url"?$t.test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"base64url",code:c.invalid_string,message:a.message}),s.dirty()):v.assertNever(a);return{status:s.value,value:e.data}}_regex(e,t,s){return this.refinement(n=>e.test(n),{validation:t,code:c.invalid_string,...h.errToObj(s)})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...h.errToObj(e)})}url(e){return this._addCheck({kind:"url",...h.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...h.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...h.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...h.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...h.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...h.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...h.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...h.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...h.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...h.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...h.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...h.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...h.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...h.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...h.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...h.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...h.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...h.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...h.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...h.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...h.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...h.errToObj(t)})}nonempty(e){return this.min(1,h.errToObj(e))}trim(){return new r({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new r({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new r({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};F.create=r=>new F({checks:[],typeName:m.ZodString,coerce:r?.coerce??!1,...y(r)});function Ft(r,e){let t=(r.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,n=t>s?t:s,a=Number.parseInt(r.toFixed(n).replace(".","")),o=Number.parseInt(e.toFixed(n).replace(".",""));return a%o/10**n}var Q=class r extends _{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==f.number){let a=this._getOrReturnCtx(e);return d(a,{code:c.invalid_type,expected:f.number,received:a.parsedType}),p}let s,n=new k;for(let a of this._def.checks)a.kind==="int"?v.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{code:c.invalid_type,expected:"integer",received:"float",message:a.message}),n.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(s=this._getOrReturnCtx(e,s),d(s,{code:c.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(s=this._getOrReturnCtx(e,s),d(s,{code:c.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):a.kind==="multipleOf"?Ft(e.data,a.value)!==0&&(s=this._getOrReturnCtx(e,s),d(s,{code:c.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{code:c.not_finite,message:a.message}),n.dirty()):v.assertNever(a);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,h.toString(t))}gt(e,t){return this.setLimit("min",e,!1,h.toString(t))}lte(e,t){return this.setLimit("max",e,!0,h.toString(t))}lt(e,t){return this.setLimit("max",e,!1,h.toString(t))}setLimit(e,t,s,n){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:h.toString(n)}]})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:h.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:h.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:h.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:h.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:h.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:h.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:h.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:h.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:h.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&v.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(t===null||s.value>t)&&(t=s.value):s.kind==="max"&&(e===null||s.value<e)&&(e=s.value)}return Number.isFinite(t)&&Number.isFinite(e)}};Q.create=r=>new Q({checks:[],typeName:m.ZodNumber,coerce:r?.coerce||!1,...y(r)});var K=class r extends _{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==f.bigint)return this._getInvalidInput(e);let s,n=new k;for(let a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(s=this._getOrReturnCtx(e,s),d(s,{code:c.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(s=this._getOrReturnCtx(e,s),d(s,{code:c.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(s=this._getOrReturnCtx(e,s),d(s,{code:c.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):v.assertNever(a);return{status:n.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return d(t,{code:c.invalid_type,expected:f.bigint,received:t.parsedType}),p}gte(e,t){return this.setLimit("min",e,!0,h.toString(t))}gt(e,t){return this.setLimit("min",e,!1,h.toString(t))}lte(e,t){return this.setLimit("max",e,!0,h.toString(t))}lt(e,t){return this.setLimit("max",e,!1,h.toString(t))}setLimit(e,t,s,n){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:h.toString(n)}]})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:h.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:h.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:h.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:h.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:h.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};K.create=r=>new K({checks:[],typeName:m.ZodBigInt,coerce:r?.coerce??!1,...y(r)});var G=class extends _{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==f.boolean){let s=this._getOrReturnCtx(e);return d(s,{code:c.invalid_type,expected:f.boolean,received:s.parsedType}),p}return T(e.data)}};G.create=r=>new G({typeName:m.ZodBoolean,coerce:r?.coerce||!1,...y(r)});var H=class r extends _{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==f.date){let a=this._getOrReturnCtx(e);return d(a,{code:c.invalid_type,expected:f.date,received:a.parsedType}),p}if(Number.isNaN(e.data.getTime())){let a=this._getOrReturnCtx(e);return d(a,{code:c.invalid_date}),p}let s=new k,n;for(let a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(n=this._getOrReturnCtx(e,n),d(n,{code:c.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),s.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(n=this._getOrReturnCtx(e,n),d(n,{code:c.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),s.dirty()):v.assertNever(a);return{status:s.value,value:new Date(e.data.getTime())}}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:h.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:h.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}};H.create=r=>new H({checks:[],coerce:r?.coerce||!1,typeName:m.ZodDate,...y(r)});var me=class extends _{_parse(e){if(this._getType(e)!==f.symbol){let s=this._getOrReturnCtx(e);return d(s,{code:c.invalid_type,expected:f.symbol,received:s.parsedType}),p}return T(e.data)}};me.create=r=>new me({typeName:m.ZodSymbol,...y(r)});var ee=class extends _{_parse(e){if(this._getType(e)!==f.undefined){let s=this._getOrReturnCtx(e);return d(s,{code:c.invalid_type,expected:f.undefined,received:s.parsedType}),p}return T(e.data)}};ee.create=r=>new ee({typeName:m.ZodUndefined,...y(r)});var te=class extends _{_parse(e){if(this._getType(e)!==f.null){let s=this._getOrReturnCtx(e);return d(s,{code:c.invalid_type,expected:f.null,received:s.parsedType}),p}return T(e.data)}};te.create=r=>new te({typeName:m.ZodNull,...y(r)});var U=class extends _{constructor(){super(...arguments),this._any=!0}_parse(e){return T(e.data)}};U.create=r=>new U({typeName:m.ZodAny,...y(r)});var D=class extends _{constructor(){super(...arguments),this._unknown=!0}_parse(e){return T(e.data)}};D.create=r=>new D({typeName:m.ZodUnknown,...y(r)});var E=class extends _{_parse(e){let t=this._getOrReturnCtx(e);return d(t,{code:c.invalid_type,expected:f.never,received:t.parsedType}),p}};E.create=r=>new E({typeName:m.ZodNever,...y(r)});var ye=class extends _{_parse(e){if(this._getType(e)!==f.undefined){let s=this._getOrReturnCtx(e);return d(s,{code:c.invalid_type,expected:f.void,received:s.parsedType}),p}return T(e.data)}};ye.create=r=>new ye({typeName:m.ZodVoid,...y(r)});var z=class r extends _{_parse(e){let{ctx:t,status:s}=this._processInputParams(e),n=this._def;if(t.parsedType!==f.array)return d(t,{code:c.invalid_type,expected:f.array,received:t.parsedType}),p;if(n.exactLength!==null){let o=t.data.length>n.exactLength.value,i=t.data.length<n.exactLength.value;(o||i)&&(d(t,{code:o?c.too_big:c.too_small,minimum:i?n.exactLength.value:void 0,maximum:o?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),s.dirty())}if(n.minLength!==null&&t.data.length<n.minLength.value&&(d(t,{code:c.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),s.dirty()),n.maxLength!==null&&t.data.length>n.maxLength.value&&(d(t,{code:c.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),s.dirty()),t.common.async)return Promise.all([...t.data].map((o,i)=>n.type._parseAsync(new N(t,o,t.path,i)))).then(o=>k.mergeArray(s,o));let a=[...t.data].map((o,i)=>n.type._parseSync(new N(t,o,t.path,i)));return k.mergeArray(s,a)}get element(){return this._def.type}min(e,t){return new r({...this._def,minLength:{value:e,message:h.toString(t)}})}max(e,t){return new r({...this._def,maxLength:{value:e,message:h.toString(t)}})}length(e,t){return new r({...this._def,exactLength:{value:e,message:h.toString(t)}})}nonempty(e){return this.min(1,e)}};z.create=(r,e)=>new z({type:r,minLength:null,maxLength:null,exactLength:null,typeName:m.ZodArray,...y(e)});function pe(r){if(r instanceof S){let e={};for(let t in r.shape){let s=r.shape[t];e[t]=I.create(pe(s))}return new S({...r._def,shape:()=>e})}else return r instanceof z?new z({...r._def,type:pe(r.element)}):r instanceof I?I.create(pe(r.unwrap())):r instanceof Z?Z.create(pe(r.unwrap())):r instanceof P?P.create(r.items.map(e=>pe(e))):r}var S=class r extends _{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=v.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==f.object){let l=this._getOrReturnCtx(e);return d(l,{code:c.invalid_type,expected:f.object,received:l.parsedType}),p}let{status:s,ctx:n}=this._processInputParams(e),{shape:a,keys:o}=this._getCached(),i=[];if(!(this._def.catchall instanceof E&&this._def.unknownKeys==="strip"))for(let l in n.data)o.includes(l)||i.push(l);let u=[];for(let l of o){let g=a[l],R=n.data[l];u.push({key:{status:"valid",value:l},value:g._parse(new N(n,R,n.path,l)),alwaysSet:l in n.data})}if(this._def.catchall instanceof E){let l=this._def.unknownKeys;if(l==="passthrough")for(let g of i)u.push({key:{status:"valid",value:g},value:{status:"valid",value:n.data[g]}});else if(l==="strict")i.length>0&&(d(n,{code:c.unrecognized_keys,keys:i}),s.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let l=this._def.catchall;for(let g of i){let R=n.data[g];u.push({key:{status:"valid",value:g},value:l._parse(new N(n,R,n.path,g)),alwaysSet:g in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let l=[];for(let g of u){let R=await g.key,Oe=await g.value;l.push({key:R,value:Oe,alwaysSet:g.alwaysSet})}return l}).then(l=>k.mergeObjectSync(s,l)):k.mergeObjectSync(s,u)}get shape(){return this._def.shape()}strict(e){return h.errToObj,new r({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,s)=>{let n=this._def.errorMap?.(t,s).message??s.defaultError;return t.code==="unrecognized_keys"?{message:h.errToObj(e).message??n}:{message:n}}}:{}})}strip(){return new r({...this._def,unknownKeys:"strip"})}passthrough(){return new r({...this._def,unknownKeys:"passthrough"})}extend(e){return new r({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new r({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:m.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new r({...this._def,catchall:e})}pick(e){let t={};for(let s of v.objectKeys(e))e[s]&&this.shape[s]&&(t[s]=this.shape[s]);return new r({...this._def,shape:()=>t})}omit(e){let t={};for(let s of v.objectKeys(this.shape))e[s]||(t[s]=this.shape[s]);return new r({...this._def,shape:()=>t})}deepPartial(){return pe(this)}partial(e){let t={};for(let s of v.objectKeys(this.shape)){let n=this.shape[s];e&&!e[s]?t[s]=n:t[s]=n.optional()}return new r({...this._def,shape:()=>t})}required(e){let t={};for(let s of v.objectKeys(this.shape))if(e&&!e[s])t[s]=this.shape[s];else{let a=this.shape[s];for(;a instanceof I;)a=a._def.innerType;t[s]=a}return new r({...this._def,shape:()=>t})}keyof(){return at(v.objectKeys(this.shape))}};S.create=(r,e)=>new S({shape:()=>r,unknownKeys:"strip",catchall:E.create(),typeName:m.ZodObject,...y(e)});S.strictCreate=(r,e)=>new S({shape:()=>r,unknownKeys:"strict",catchall:E.create(),typeName:m.ZodObject,...y(e)});S.lazycreate=(r,e)=>new S({shape:r,unknownKeys:"strip",catchall:E.create(),typeName:m.ZodObject,...y(e)});var re=class extends _{_parse(e){let{ctx:t}=this._processInputParams(e),s=this._def.options;function n(a){for(let i of a)if(i.result.status==="valid")return i.result;for(let i of a)if(i.result.status==="dirty")return t.common.issues.push(...i.ctx.common.issues),i.result;let o=a.map(i=>new C(i.ctx.common.issues));return d(t,{code:c.invalid_union,unionErrors:o}),p}if(t.common.async)return Promise.all(s.map(async a=>{let o={...t,common:{...t.common,issues:[]},parent:null};return{result:await a._parseAsync({data:t.data,path:t.path,parent:o}),ctx:o}})).then(n);{let a,o=[];for(let u of s){let l={...t,common:{...t.common,issues:[]},parent:null},g=u._parseSync({data:t.data,path:t.path,parent:l});if(g.status==="valid")return g;g.status==="dirty"&&!a&&(a={result:g,ctx:l}),l.common.issues.length&&o.push(l.common.issues)}if(a)return t.common.issues.push(...a.ctx.common.issues),a.result;let i=o.map(u=>new C(u));return d(t,{code:c.invalid_union,unionErrors:i}),p}}get options(){return this._def.options}};re.create=(r,e)=>new re({options:r,typeName:m.ZodUnion,...y(e)});var V=r=>r instanceof ne?V(r.schema):r instanceof j?V(r.innerType()):r instanceof ae?[r.value]:r instanceof ie?r.options:r instanceof oe?v.objectValues(r.enum):r instanceof ce?V(r._def.innerType):r instanceof ee?[void 0]:r instanceof te?[null]:r instanceof I?[void 0,...V(r.unwrap())]:r instanceof Z?[null,...V(r.unwrap())]:r instanceof Se||r instanceof ue?V(r.unwrap()):r instanceof de?V(r._def.innerType):[],Ee=class r extends _{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==f.object)return d(t,{code:c.invalid_type,expected:f.object,received:t.parsedType}),p;let s=this.discriminator,n=t.data[s],a=this.optionsMap.get(n);return a?t.common.async?a._parseAsync({data:t.data,path:t.path,parent:t}):a._parseSync({data:t.data,path:t.path,parent:t}):(d(t,{code:c.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),p)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,s){let n=new Map;for(let a of t){let o=V(a.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \\`${e}\\` could not be extracted from all schema options`);for(let i of o){if(n.has(i))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);n.set(i,a)}}return new r({typeName:m.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,...y(s)})}};function Fe(r,e){let t=M(r),s=M(e);if(r===e)return{valid:!0,data:r};if(t===f.object&&s===f.object){let n=v.objectKeys(e),a=v.objectKeys(r).filter(i=>n.indexOf(i)!==-1),o={...r,...e};for(let i of a){let u=Fe(r[i],e[i]);if(!u.valid)return{valid:!1};o[i]=u.data}return{valid:!0,data:o}}else if(t===f.array&&s===f.array){if(r.length!==e.length)return{valid:!1};let n=[];for(let a=0;a<r.length;a++){let o=r[a],i=e[a],u=Fe(o,i);if(!u.valid)return{valid:!1};n.push(u.data)}return{valid:!0,data:n}}else return t===f.date&&s===f.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}var se=class extends _{_parse(e){let{status:t,ctx:s}=this._processInputParams(e),n=(a,o)=>{if(Ne(a)||Ne(o))return p;let i=Fe(a.value,o.value);return i.valid?((je(a)||je(o))&&t.dirty(),{status:t.value,value:i.data}):(d(s,{code:c.invalid_intersection_types}),p)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([a,o])=>n(a,o)):n(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}};se.create=(r,e,t)=>new se({left:r,right:e,typeName:m.ZodIntersection,...y(t)});var P=class r extends _{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==f.array)return d(s,{code:c.invalid_type,expected:f.array,received:s.parsedType}),p;if(s.data.length<this._def.items.length)return d(s,{code:c.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),p;!this._def.rest&&s.data.length>this._def.items.length&&(d(s,{code:c.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let a=[...s.data].map((o,i)=>{let u=this._def.items[i]||this._def.rest;return u?u._parse(new N(s,o,s.path,i)):null}).filter(o=>!!o);return s.common.async?Promise.all(a).then(o=>k.mergeArray(t,o)):k.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new r({...this._def,rest:e})}};P.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new P({items:r,typeName:m.ZodTuple,rest:null,...y(e)})};var Me=class r extends _{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==f.object)return d(s,{code:c.invalid_type,expected:f.object,received:s.parsedType}),p;let n=[],a=this._def.keyType,o=this._def.valueType;for(let i in s.data)n.push({key:a._parse(new N(s,i,s.path,i)),value:o._parse(new N(s,s.data[i],s.path,i)),alwaysSet:i in s.data});return s.common.async?k.mergeObjectAsync(t,n):k.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,s){return t instanceof _?new r({keyType:e,valueType:t,typeName:m.ZodRecord,...y(s)}):new r({keyType:F.create(),valueType:e,typeName:m.ZodRecord,...y(t)})}},ge=class extends _{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==f.map)return d(s,{code:c.invalid_type,expected:f.map,received:s.parsedType}),p;let n=this._def.keyType,a=this._def.valueType,o=[...s.data.entries()].map(([i,u],l)=>({key:n._parse(new N(s,i,s.path,[l,"key"])),value:a._parse(new N(s,u,s.path,[l,"value"]))}));if(s.common.async){let i=new Map;return Promise.resolve().then(async()=>{for(let u of o){let l=await u.key,g=await u.value;if(l.status==="aborted"||g.status==="aborted")return p;(l.status==="dirty"||g.status==="dirty")&&t.dirty(),i.set(l.value,g.value)}return{status:t.value,value:i}})}else{let i=new Map;for(let u of o){let l=u.key,g=u.value;if(l.status==="aborted"||g.status==="aborted")return p;(l.status==="dirty"||g.status==="dirty")&&t.dirty(),i.set(l.value,g.value)}return{status:t.value,value:i}}}};ge.create=(r,e,t)=>new ge({valueType:e,keyType:r,typeName:m.ZodMap,...y(t)});var _e=class r extends _{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==f.set)return d(s,{code:c.invalid_type,expected:f.set,received:s.parsedType}),p;let n=this._def;n.minSize!==null&&s.data.size<n.minSize.value&&(d(s,{code:c.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()),n.maxSize!==null&&s.data.size>n.maxSize.value&&(d(s,{code:c.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());let a=this._def.valueType;function o(u){let l=new Set;for(let g of u){if(g.status==="aborted")return p;g.status==="dirty"&&t.dirty(),l.add(g.value)}return{status:t.value,value:l}}let i=[...s.data.values()].map((u,l)=>a._parse(new N(s,u,s.path,l)));return s.common.async?Promise.all(i).then(u=>o(u)):o(i)}min(e,t){return new r({...this._def,minSize:{value:e,message:h.toString(t)}})}max(e,t){return new r({...this._def,maxSize:{value:e,message:h.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};_e.create=(r,e)=>new _e({valueType:r,minSize:null,maxSize:null,typeName:m.ZodSet,...y(e)});var Pe=class r extends _{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==f.function)return d(t,{code:c.invalid_type,expected:f.function,received:t.parsedType}),p;function s(i,u){return Ce({data:i,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,fe(),L].filter(l=>!!l),issueData:{code:c.invalid_arguments,argumentsError:u}})}function n(i,u){return Ce({data:i,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,fe(),L].filter(l=>!!l),issueData:{code:c.invalid_return_type,returnTypeError:u}})}let a={errorMap:t.common.contextualErrorMap},o=t.data;if(this._def.returns instanceof W){let i=this;return T(async function(...u){let l=new C([]),g=await i._def.args.parseAsync(u,a).catch(be=>{throw l.addIssue(s(u,be)),l}),R=await Reflect.apply(o,this,g);return await i._def.returns._def.type.parseAsync(R,a).catch(be=>{throw l.addIssue(n(R,be)),l})})}else{let i=this;return T(function(...u){let l=i._def.args.safeParse(u,a);if(!l.success)throw new C([s(u,l.error)]);let g=Reflect.apply(o,this,l.data),R=i._def.returns.safeParse(g,a);if(!R.success)throw new C([n(g,R.error)]);return R.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new r({...this._def,args:P.create(e).rest(D.create())})}returns(e){return new r({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,s){return new r({args:e||P.create([]).rest(D.create()),returns:t||D.create(),typeName:m.ZodFunction,...y(s)})}},ne=class extends _{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};ne.create=(r,e)=>new ne({getter:r,typeName:m.ZodLazy,...y(e)});var ae=class extends _{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return d(t,{received:t.data,code:c.invalid_literal,expected:this._def.value}),p}return{status:"valid",value:e.data}}get value(){return this._def.value}};ae.create=(r,e)=>new ae({value:r,typeName:m.ZodLiteral,...y(e)});function at(r,e){return new ie({values:r,typeName:m.ZodEnum,...y(e)})}var ie=class r extends _{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),s=this._def.values;return d(t,{expected:v.joinValues(s),received:t.parsedType,code:c.invalid_type}),p}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),s=this._def.values;return d(t,{received:t.data,code:c.invalid_enum_value,options:s}),p}return T(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return r.create(e,{...this._def,...t})}exclude(e,t=this._def){return r.create(this.options.filter(s=>!e.includes(s)),{...this._def,...t})}};ie.create=at;var oe=class extends _{_parse(e){let t=v.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==f.string&&s.parsedType!==f.number){let n=v.objectValues(t);return d(s,{expected:v.joinValues(n),received:s.parsedType,code:c.invalid_type}),p}if(this._cache||(this._cache=new Set(v.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let n=v.objectValues(t);return d(s,{received:s.data,code:c.invalid_enum_value,options:n}),p}return T(e.data)}get enum(){return this._def.values}};oe.create=(r,e)=>new oe({values:r,typeName:m.ZodNativeEnum,...y(e)});var W=class extends _{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==f.promise&&t.common.async===!1)return d(t,{code:c.invalid_type,expected:f.promise,received:t.parsedType}),p;let s=t.parsedType===f.promise?t.data:Promise.resolve(t.data);return T(s.then(n=>this._def.type.parseAsync(n,{path:t.path,errorMap:t.common.contextualErrorMap})))}};W.create=(r,e)=>new W({type:r,typeName:m.ZodPromise,...y(e)});var j=class extends _{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===m.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:s}=this._processInputParams(e),n=this._def.effect||null,a={addIssue:o=>{d(s,o),o.fatal?t.abort():t.dirty()},get path(){return s.path}};if(a.addIssue=a.addIssue.bind(a),n.type==="preprocess"){let o=n.transform(s.data,a);if(s.common.async)return Promise.resolve(o).then(async i=>{if(t.value==="aborted")return p;let u=await this._def.schema._parseAsync({data:i,path:s.path,parent:s});return u.status==="aborted"?p:u.status==="dirty"?J(u.value):t.value==="dirty"?J(u.value):u});{if(t.value==="aborted")return p;let i=this._def.schema._parseSync({data:o,path:s.path,parent:s});return i.status==="aborted"?p:i.status==="dirty"?J(i.value):t.value==="dirty"?J(i.value):i}}if(n.type==="refinement"){let o=i=>{let u=n.refinement(i,a);if(s.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return i};if(s.common.async===!1){let i=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return i.status==="aborted"?p:(i.status==="dirty"&&t.dirty(),o(i.value),{status:t.value,value:i.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(i=>i.status==="aborted"?p:(i.status==="dirty"&&t.dirty(),o(i.value).then(()=>({status:t.value,value:i.value}))))}if(n.type==="transform")if(s.common.async===!1){let o=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!B(o))return p;let i=n.transform(o.value,a);if(i instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:i}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(o=>B(o)?Promise.resolve(n.transform(o.value,a)).then(i=>({status:t.value,value:i})):p);v.assertNever(n)}};j.create=(r,e,t)=>new j({schema:r,typeName:m.ZodEffects,effect:e,...y(t)});j.createWithPreprocess=(r,e,t)=>new j({schema:e,effect:{type:"preprocess",transform:r},typeName:m.ZodEffects,...y(t)});var I=class extends _{_parse(e){return this._getType(e)===f.undefined?T(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};I.create=(r,e)=>new I({innerType:r,typeName:m.ZodOptional,...y(e)});var Z=class extends _{_parse(e){return this._getType(e)===f.null?T(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Z.create=(r,e)=>new Z({innerType:r,typeName:m.ZodNullable,...y(e)});var ce=class extends _{_parse(e){let{ctx:t}=this._processInputParams(e),s=t.data;return t.parsedType===f.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};ce.create=(r,e)=>new ce({innerType:r,typeName:m.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...y(e)});var de=class extends _{_parse(e){let{ctx:t}=this._processInputParams(e),s={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return he(n)?n.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new C(s.common.issues)},input:s.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new C(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}};de.create=(r,e)=>new de({innerType:r,typeName:m.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...y(e)});var ve=class extends _{_parse(e){if(this._getType(e)!==f.nan){let s=this._getOrReturnCtx(e);return d(s,{code:c.invalid_type,expected:f.nan,received:s.parsedType}),p}return{status:"valid",value:e.data}}};ve.create=r=>new ve({typeName:m.ZodNaN,...y(r)});var Ut=Symbol("zod_brand"),Se=class extends _{_parse(e){let{ctx:t}=this._processInputParams(e),s=t.data;return this._def.type._parse({data:s,path:t.path,parent:t})}unwrap(){return this._def.type}},Ae=class r extends _{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.common.async)return(async()=>{let a=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return a.status==="aborted"?p:a.status==="dirty"?(t.dirty(),J(a.value)):this._def.out._parseAsync({data:a.value,path:s.path,parent:s})})();{let n=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return n.status==="aborted"?p:n.status==="dirty"?(t.dirty(),{status:"dirty",value:n.value}):this._def.out._parseSync({data:n.value,path:s.path,parent:s})}}static create(e,t){return new r({in:e,out:t,typeName:m.ZodPipeline})}},ue=class extends _{_parse(e){let t=this._def.innerType._parse(e),s=n=>(B(n)&&(n.value=Object.freeze(n.value)),n);return he(t)?t.then(n=>s(n)):s(t)}unwrap(){return this._def.innerType}};ue.create=(r,e)=>new ue({innerType:r,typeName:m.ZodReadonly,...y(e)});function tt(r,e){let t=typeof r=="function"?r(e):typeof r=="string"?{message:r}:r;return typeof t=="string"?{message:t}:t}function it(r,e={},t){return r?U.create().superRefine((s,n)=>{let a=r(s);if(a instanceof Promise)return a.then(o=>{if(!o){let i=tt(e,s),u=i.fatal??t??!0;n.addIssue({code:"custom",...i,fatal:u})}});if(!a){let o=tt(e,s),i=o.fatal??t??!0;n.addIssue({code:"custom",...o,fatal:i})}}):U.create()}var Wt={object:S.lazycreate},m;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline",r.ZodReadonly="ZodReadonly"})(m||(m={}));var qt=(r,e={message:`Input not instance of ${r.name}`})=>it(t=>t instanceof r,e),ot=F.create,ct=Q.create,Yt=ve.create,Xt=K.create,dt=G.create,Jt=H.create,Qt=me.create,Kt=ee.create,Gt=te.create,Ht=U.create,er=D.create,tr=E.create,rr=ye.create,sr=z.create,nr=S.create,ar=S.strictCreate,ir=re.create,or=Ee.create,cr=se.create,dr=P.create,ur=Me.create,lr=ge.create,fr=_e.create,hr=Pe.create,pr=ne.create,mr=ae.create,yr=ie.create,gr=oe.create,_r=W.create,vr=j.create,xr=I.create,br=Z.create,kr=j.createWithPreprocess,wr=Ae.create,Tr=()=>ot().optional(),Rr=()=>ct().optional(),Cr=()=>dt().optional(),Sr={string:r=>F.create({...r,coerce:!0}),number:r=>Q.create({...r,coerce:!0}),boolean:r=>G.create({...r,coerce:!0}),bigint:r=>K.create({...r,coerce:!0}),date:r=>H.create({...r,coerce:!0})};var Ar=p;var Os=xe.union([xe.enum(["low","medium","high","always-visible"]),xe.number()]);var Ze=5;var q=200,$e=10;function ut(r,e,t,s,n,a,o="-1"){let i=1/0,u=1/0,l=-1/0,g=-1/0,R=new b(-$e,0,5,t),Oe=new b(-$e,0,e,5),be=new b(e-5,0,e+$e,t),ft=new b(0,t-5,e,t+$e),ht=Or(e,t,s,n,a),pt=[R,Oe,be,ft],Ue=new b(-q,-q,e+q*2,t+q*2);for(let x of r){let we,Te;for(let A=0;A<x.bboxes.length;A++){if(x.bboxes[A]==null||(we=x.bboxes[A].boundingBox,Te=x.bboxes[A].index,x.lockedToStrategyIndex!==-1&&Te!==x.lockedToStrategyIndex))continue;let[Ie,O,Y,We]=we,[X,mt,qe,yt]=[x.y-Ie,x.y+O,x.x-Y,x.x+We],Ve=qe,De=X,Ye=yt-qe,Xe=mt-X;i=Math.min(i,Ve)-q,u=Math.min(u,De)-q,l=Math.max(l,Ve+Ye)+q,g=Math.max(g,De+Xe)+q,x.bboxes[A].boundingRect=new b(Ve,De,Ye,Xe)}}let le={msgId:o,colliders:new Array(r.length),debug:[]},Le=new Re(new b(i,u,l-i,g-u)),ke;for(let x=0;x<r.length;x++)if(ke=r[x],le.colliders[x]=[-1,0],ke.enabledAndVisible){let[we,Te,A]=[1/0,-1,void 0];for(let{index:Ie,boundingRect:O}of ke.bboxes){if(O==null)continue;let Y=[];if(Y=Le.queryRect(O).filter(X=>O.intersects(X)),ke.shouldCollideWithScreenEdges&&pt.forEach(X=>{O.intersects(X)&&Y.push(X)}),O.intersects(ht)){le.colliders[x]=[-1,0,O];break}if(Y.length<=we&&(A=O,Te=Ie,we=Y.length),Y.length===0){Le.insert(O),le.colliders[x]=[Ie,Ue.contains(O)?0:1,O];break}}ke.rank===Ze&&A!=null&&(Le.insert(A),le.colliders[x]=[Te,Ue.contains(A)?0:1,A])}else le.colliders[x]=[-1,0];return le}function Or(r,e,t,s,n){switch(n){case"top-right":return new b(r-t,0,t,s);case"bottom-left":return new b(0,e-s,t,s);case"bottom-right":return new b(r-t,e-s,t,s);case"top-left":return new b(0,0,t,s)}}function lt(r){let e=r[0].map(t=>{let s=t[0].map(n=>({index:n[4],boundingBox:[n[0],n[1],n[2],n[3]]}));return{enabledAndVisible:t[1]===1,rank:t[2]===1?Ze:0,x:t[3],y:t[4],shouldCollideWithScreenEdges:t[5]===1,bboxes:s,lockedToStrategyIndex:t[6]}});return{msgId:"-1",totalWidth:r[3],totalHeight:r[2],watermarkWidth:r[4],watermarkHeight:r[5],watermarkPosition:r[6],colliders:e,devicePixelRatio:r[1]}}self.onmessage=r=>{let e=lt(r.data);self.postMessage(ut(e.colliders,e.totalWidth,e.totalHeight,e.watermarkWidth,e.watermarkHeight,e.watermarkPosition,e.msgId))};})();\n';u();u();u();u();u();function Z9(e,t){return t.x+t.w<e.x+e.w&&t.x>e.x&&t.y>e.y&&t.y+t.h<e.y+e.h}u();function Y9(e,t){let[r,n]=t;return r>=e.x&&r<=e.x+e.w&&n>=e.y&&n<=e.y+e.h}u();function J9(e,t){let r=t.x,n=t.y,o=t.x+t.w,i=t.y+t.h,s=e.x,l=e.y,c=e.x+e.w,p=e.y+e.h;return r<c&&s<o&&n<p&&l<i}u();function ka(e,t){for(let r=0;r<t.length;r++)e.push(t[r])}u();var yt=class{constructor(t,r,n,o,i){f(this,"x");f(this,"y");f(this,"w");f(this,"h");f(this,"userData");this.userData=typeof i>"u"?null:i,this.x=t,this.y=r,this.w=n,this.h=o}contains(t){return t===this?!1:Z9(this,t)}intersects(t){return J9(this,t)}intersectsPoint(t){return Y9(this,t)}draw(t){t.fillStyle="rgba(123,222,26, 0.8)",t.fillRect(this.x,this.y,this.w,this.h)}};var Xo=class e{constructor(t,r){f(this,"topLeft");f(this,"topRight");f(this,"bottomLeft");f(this,"bottomRight");f(this,"divided",!1);f(this,"boundary");f(this,"capacity",16);f(this,"objects",[]);f(this,"parent");this.parent=r,this.boundary=t}getSize(){return this.divided?this.objects.length+this.topLeft.getSize()+this.topRight.getSize()+this.bottomLeft.getSize()+this.bottomRight.getSize():this.objects.length}subdivide(){let{x:t,y:r,w:n,h:o}=this.boundary;this.topLeft=new e(new yt(t,r,n/2,o/2),this),this.topRight=new e(new yt(t+n/2,r,n/2,o/2),this),this.bottomLeft=new e(new yt(t,r+o/2,n/2,o/2),this),this.bottomRight=new e(new yt(t+n/2,r+o/2,n/2,o/2),this),this.divided=!0}queryRect(t){let r=[];if(this.boundary.intersects(t))r.push(...this.objects);else return[];return this.divided&&(ka(r,this.topLeft.queryRect(t)),ka(r,this.topRight.queryRect(t)),ka(r,this.bottomLeft.queryRect(t)),ka(r,this.bottomRight.queryRect(t))),r}queryPoint(t){let r=[];if(this.boundary.intersectsPoint(t))r.push(...this.objects);else return[];return this.divided&&(ka(r,this.topLeft.queryPoint(t)),ka(r,this.topRight.queryPoint(t)),ka(r,this.bottomLeft.queryPoint(t)),ka(r,this.bottomRight.queryPoint(t))),r}insert(t){return(this.parent?!this.boundary.contains(t):!this.boundary.intersects(t))?!1:this.objects.length<this.capacity?(this.objects.push(t),!0):(this.divided||this.subdivide(),(this.topLeft.insert(t)||this.topRight.insert(t)||this.bottomLeft.insert(t)||this.bottomRight.insert(t))===!1&&this.objects.push(t),!0)}drawObjects(t){this.objects.forEach(r=>r.draw(t)),this.divided&&(this.topLeft.drawObjects(t),this.topRight.drawObjects(t),this.bottomLeft.drawObjects(t),this.bottomRight.drawObjects(t))}draw(t){t.rect(this.boundary.x,this.boundary.y,this.boundary.w,this.boundary.h),this.divided&&(this.topLeft.draw(t),this.topRight.draw(t),this.bottomLeft.draw(t),this.bottomRight.draw(t)),t.strokeStyle="black",t.lineWidth=4,t.stroke()}};u();u();var bf=_.union([_.enum(["low","medium","high","always-visible"]),_.number()]),q9=["","","low","medium","high","always-visible"],Zz=2,Yz=3;var Mp=5;function K9(e){return Math.min(Mp,Math.max(Zz,e))}function xf(e){if(typeof e=="number")return K9(e);let t=q9.indexOf(e);return t===-1?Yz:t}function Hh(e){let t=K9(e);return q9[t]}function Q9(e,t,r){let n,o,i,s=null,l=0;r||(r={});let c=function(){l=r.leading===!1?0:Date.now(),s=null,i=e.apply(n,o),s||(n=o=null)};return function(){let p=Date.now();!l&&r.leading===!1&&(l=p);let d=t-(p-l);return n=globalThis,o=arguments,d<=0||d>t?(s&&(clearTimeout(s),s=null),l=p,i=e.apply(n,o),s||(n=o=null)):!s&&r.trailing!==!1&&(s=setTimeout(c,d)),i}}function e_(e){let t=e[0].map(r=>{let n=r[0].map(o=>({index:o[4],boundingBox:[o[0],o[1],o[2],o[3]]}));return{enabledAndVisible:r[1]===1,rank:r[2]===1?Mp:0,x:r[3],y:r[4],shouldCollideWithScreenEdges:r[5]===1,bboxes:n,lockedToStrategyIndex:r[6]}});return{msgId:"-1",totalWidth:e[3],totalHeight:e[2],watermarkWidth:e[4],watermarkHeight:e[5],watermarkPosition:e[6],colliders:t,devicePixelRatio:e[1]}}u();u();var Hl=200,N0=10;function t_(e,t,r,n,o,i,s="-1"){let l=1/0,c=1/0,p=-1/0,d=-1/0,m=new yt(-N0,0,5,r),g=new yt(-N0,0,t,5),x=new yt(t-5,0,t+N0,r),v=new yt(0,r-5,t,r+N0),C=Jz(t,r,n,o,i),I=[m,g,x,v],S=new yt(-Hl,-Hl,t+Hl*2,r+Hl*2);for(let E of e){let B,j;for(let L=0;L<E.bboxes.length;L++){if(E.bboxes[L]==null||(B=E.bboxes[L].boundingBox,j=E.bboxes[L].index,E.lockedToStrategyIndex!==-1&&j!==E.lockedToStrategyIndex))continue;let[N,X,Z,re]=B,[Q,xe,Ce,ye]=[E.y-N,E.y+X,E.x-Z,E.x+re],Ee=Ce,we=Q,pe=ye-Ce,Ae=xe-Q;l=Math.min(l,Ee)-Hl,c=Math.min(c,we)-Hl,p=Math.max(p,Ee+pe)+Hl,d=Math.max(d,we+Ae)+Hl,E.bboxes[L].boundingRect=new yt(Ee,we,pe,Ae)}}let P={msgId:s,colliders:new Array(e.length),debug:[]},O=new Xo(new yt(l,c,p-l,d-c)),M;for(let E=0;E<e.length;E++)if(M=e[E],P.colliders[E]=[-1,0],M.enabledAndVisible){let[B,j,L]=[1/0,-1,void 0];for(let{index:N,boundingRect:X}of M.bboxes){if(X==null)continue;let Z=[];if(Z=O.queryRect(X).filter(Q=>X.intersects(Q)),M.shouldCollideWithScreenEdges&&I.forEach(Q=>{X.intersects(Q)&&Z.push(Q)}),X.intersects(C)){P.colliders[E]=[-1,0,X];break}if(Z.length<=B&&(L=X,j=N,B=Z.length),Z.length===0){O.insert(X),P.colliders[E]=[N,S.contains(X)?0:1,X];break}}M.rank===Mp&&L!=null&&(O.insert(L),P.colliders[E]=[j,S.contains(L)?0:1,L])}else P.colliders[E]=[-1,0];return P}function Jz(e,t,r,n,o){switch(o){case"top-right":return new yt(e-r,0,r,n);case"bottom-left":return new yt(0,t-n,r,n);case"bottom-right":return new yt(e-r,t-n,r,n);case"top-left":return new yt(0,0,r,n)}}var Wh=class{constructor(){f(this,"onerror",()=>{});f(this,"onmessage",()=>{});f(this,"postMessage",t=>{let r=e_(t);this.onmessage({data:t_(r.colliders,r.totalWidth,r.totalHeight,r.watermarkWidth,r.watermarkHeight,r.watermarkPosition,r.msgId)})});f(this,"terminate",()=>{})}};var Pp=!1,qz=150,G0=class extends Fe{constructor(r,n,o=!0){super();f(this,"worker");f(this,"debugContext");f(this,"debugCanvas");f(this,"collidersDirty",!0);f(this,"packedMessage",[[],0,0,0,0,0,"bottom-left"]);f(this,"visibleCollidersQTree",new Xo(new yt(0,0,0,0)));f(this,"interactiveCollidersQTree",new Xo(new yt(0,0,0,0)));f(this,"coreState");f(this,"postMessage");f(this,"showCollisionBoxes",()=>{Pp=!0,this.debugCanvas.style.display="block"});f(this,"hideCollisionBoxes",()=>{Pp=!1,this.debugContext.clearRect(0,0,this.debugCanvas.width,this.debugCanvas.height),this.debugCanvas.style.display="none"});f(this,"currentMsgId","");f(this,"working",!1);f(this,"_postMessage",()=>{this.worker.postMessage(this.packedMessage)});f(this,"componentArray",[]);f(this,"update",(r,n,o="bottom-left",i=!1)=>{let s=!1;if(this.collidersDirty){this.packedMessage=[[],0,0,0,0,0,"bottom-left"],this.componentArray=[];let l;for(let c of this.coreState.geometry2DIdsInScene){let p=this.coreState.geometry2DMap.get(c);p&&(l=p.components[0],this.componentArray.push(l))}this.resize(r,n,o),this.collidersDirty=!1,s=!0}else s=this.componentArray.some(l=>l.collisionDirty===!0);s&&this.componentArray.sort((l,c)=>c.rank-l.rank);for(let l=0;l<this.componentArray.length;l++)if(this.packedMessage){let c=this.componentArray[l].toPackedMessage(i&&!s);this.packedMessage[0][l]==null&&(this.packedMessage[0][l]=[]),this.packedMessage[0][l][0]==null&&(this.packedMessage[0][l][0]=[]),this.packedMessage[0][l][0]=c.bboxes,this.packedMessage[0][l][1]=c.enabled&&this.componentArray[l].visible&&!this.componentArray[l].isOccluded?1:0,this.packedMessage[0][l][2]=c.rank===Mp?1:0,this.packedMessage[0][l][3]=c.x,this.packedMessage[0][l][4]=c.y,this.packedMessage[0][l][5]=c.shouldCollideWithScreenEdges?1:0,this.packedMessage[0][l][6]=c.lockedToStrategyIndex}this.working||this.postMessage()});f(this,"resolve",r=>{if(this.working=!1,this.collidersDirty||!r.data)return;let n=r.data.colliders,o=-1,i,s,l;Pp&&(this.visibleCollidersQTree=new Xo(new yt(0,0,this.debugCanvas.width,this.debugCanvas.height))),this.interactiveCollidersQTree=new Xo(new yt(0,0,this.debugCanvas.width,this.debugCanvas.height));for(let c=0;c<this.componentArray.length;c++){let p=this.componentArray[c];n[c]!=null&&(o=n[c][0],i=n[c][2],p.offscreen=n[c][1]===1,o!==-1&&i!=null?(l=new yt(i.x,i.y,i.w,i.h,{entityId:p.id}),Pp&&this.visibleCollidersQTree.insert(l),s=this.coreState.geometry2DMap.get(p.id),s?.components[1]!=null&&this.interactiveCollidersQTree.insert(new yt(i.x,i.y,i.w,i.h,{entityId:p.id})),(p.canShow===!1||p.visibilityNeedsUpdate!==!1)&&"visibilityNeedsUpdate"in p&&(p.visibilityNeedsUpdate="show"),o!==-1&&o!==p.currentStrategyIndex&&(p.activeBoundingBox=l,p.onStrategySelected(o))):((p.canShow===!0||p.visibilityNeedsUpdate!==!1)&&"visibilityNeedsUpdate"in p&&(p.visibilityNeedsUpdate="hide"),o!==-1&&o!==p.currentStrategyIndex&&p.onStrategySelected(o)))}Pp&&this.drawDebug(),this.publish("visibility-changed")});f(this,"drawDebug",()=>{Pp&&this.visibleCollidersQTree&&(this.debugContext.clearRect(0,0,this.debugCanvas.width,this.debugCanvas.height),this.debugContext.beginPath(),this.visibleCollidersQTree.drawObjects(this.debugContext))});f(this,"destroy",()=>{this.worker.terminate()});this.worker=o===!1?new Wh:wp!==""?new Worker(wp):new Worker(URL.createObjectURL(new Blob([X9],{type:"text/javascript"}))),this.worker.onerror=()=>{this.worker=new Wh,this.worker.onmessage=i=>this.resolve(i)},this.coreState=n,this.debugCanvas=r,this.debugContext=r.getContext("2d"),this.worker.onmessage=i=>this.resolve(i),this.postMessage=Q9(this._postMessage,qz,!1),Pp?this.showCollisionBoxes():this.hideCollisionBoxes()}resize(r,n,o){this.packedMessage[6]=o,this.packedMessage[5]=n,this.packedMessage[4]=r,this.packedMessage[3]=this.debugCanvas.width,this.packedMessage[2]=this.debugCanvas.height}};u();u();u();u();var j0=class{constructor(t){f(this,"type");f(this,"event");this.type=0,this.event=t}get timestamp(){return this.event.timeStamp}},U0=class{constructor(){f(this,"taps",[])}add(t){this.lastPointerDown&&t.timestamp-this.lastPointerDown.timestamp<50?this.lastPointerDown.type=1:this.taps.push(t)}get lastPointerDown(){return this.taps.length>=1?this.taps[this.taps.length-1]:void 0}get isSingleTapWithTwoFingers(){return this.isSingleTap&&this.lastPointerDown?.type===1}get isSingleTapWithOneFinger(){return this.isSingleTap&&this.lastPointerDown?.type===0}get isDoubleTapWithOneFinger(){return this.isDoubleTap&&this.taps[0]?.type===0&&this.taps[1]?.type===0}get isSingleTap(){return this.taps.length===1}get isDoubleTap(){return this.taps.length===2}discardOutsideOfWaitWindow(t){this.taps=this.taps.filter(r=>t-r.timestamp<300)}flush(){this.taps=[]}get _taps(){return this.taps}destroy(){this.flush()}};u();function U3(e){let t=new Set;for(let r of e){let n=r.object;for(;n.visible&&n.parent&&n.parent.visible===!0&&!t.has(n.parent);)n=n.parent,n instanceof kt&&n.type==="group-container"&&n.visible&&n.components[0]&&t.add(n)}return Array.from(t)}var vf,$h=class extends Fe{constructor(r,n,o,i,s){super();f(this,"raycaster",new Zi);f(this,"state",{hovered3DEntity:void 0,hovered2DEntity:void 0,hovered3DContainers:void 0,lastHover:void 0,interaction:{mouseDownStart:void 0,distanceFromMouseDown:void 0,isPanning:!1}});f(this,"coreState");f(this,"camera");f(this,"worldPlane");f(this,"_quadtree",new Xo(new yt(0,0,0,0)));f(this,"_container");f(this,"lastPointerEvent");f(this,"cursor","grab");f(this,"touchesCount",0);f(this,"isUserInteracting");f(this,"hasTouched",!1);T(this,vf);f(this,"onPointerMoveRaf",r=>{this.lastPointerEvent=r,a(this,vf)&&cancelAnimationFrame(a(this,vf)),w(this,vf,requestAnimationFrame(()=>{this.onPointerMove(r)}))});f(this,"onPointerMove",r=>{r.preventDefault(),this.updateInteractionStateIfPanning(r),(r.pointerType!=="touch"||r.pointerType===void 0&&this.hasTouched)&&this.handleHover(r),this.handleCursor()});f(this,"tapsControl",new U0);f(this,"onPointerDown",r=>{r.target===this._container&&(this._container.addEventListener("pointerup",this.onPointerUp,!1),this._container.addEventListener("pointercancel",this.onPointerUp,!1),this.state.interaction.mouseDownStart={time:Date.now(),timestamp:r.timeStamp,offsetX:r.offsetX,offsetY:r.offsetY},this.lastPointerEvent=r,this.state.interaction.distanceFromMouseDown=0,this.handleCursor(),r.pointerType==="touch"&&(this.tapsControl.add(new j0(r)),this.touchesCount=Math.max(0,this.touchesCount+1)))});f(this,"clickTimeout");f(this,"onPointerUp",r=>{this.tapsControl.discardOutsideOfWaitWindow(r.timeStamp),this.lastPointerEvent=r,this.touchesCount=Math.max(0,this.touchesCount-1),this.touchesCount===0&&(this._container.removeEventListener("pointerup",this.onPointerUp,!1),this._container.removeEventListener("pointercancel",this.onPointerUp,!1)),this.updateInteractionStateIfPanning(r);let{mouseDownStart:n}=this.state.interaction;!n||this.state.interaction.distanceFromMouseDown==null||(Date.now()<n.time+300&&(this.tapsControl.isSingleTapWithTwoFingers||this.state.interaction.distanceFromMouseDown<=15)&&(r.pointerType==="touch"?this.tapsControl.isSingleTapWithTwoFingers?(this.publish("singletap-with-twofinger",r),this.flush()):this.tapsControl.isSingleTapWithOneFinger&&this.touchesCount===0?(this.clickTimeout&&clearTimeout(this.clickTimeout),this.clickTimeout=window.setTimeout(()=>{this.handleClick(r),this.flush()},300)):this.tapsControl.isDoubleTapWithOneFinger&&(this.publish("doubletap-with-onefinger",r),this.flush()):this.handleClick(r)),this.state.interaction.mouseDownStart=void 0,this.state.interaction.distanceFromMouseDown=void 0,this.state.interaction.isPanning=!1,this.handleCursor())});f(this,"dirty3D",!0);f(this,"cachedHitBoxes",{entities:[]});f(this,"ndcPoint",new De);f(this,"debugPanel");this.isUserInteracting=s,this.raycaster.layers.enableAll(),this.raycaster.layers.disable(1),this.camera=o,this._container=r,this.coreState=n,this.worldPlane=i,this._container.addEventListener("pointerdown",this.onPointerDown,!1),this._container.addEventListener("pointermove",this.onPointerMoveRaf,!1),this._container.classList.add("mappedin-interactive")}updateQuadtree(r){this._quadtree=r}setHovered3DEntityInteractionComponentDirty(){if(this.state.hovered3DEntity){let r=this.state.hovered3DEntity.components[2];r&&(r.dirty=!0)}}getThreeDIntersectsFromXY(r){this.raycaster.setFromCamera(r,this.camera),this.raycaster.layers.enable(0);let n=this.raycaster.intersectObjects(this._hitBoxes.entities,!0).filter(i=>i.object?.name==="worldPlane"||i.object?.visible),o=n.findIndex(i=>i.object?.name==="worldPlane");return o!==-1&&n.push(n.splice(o,1)[0]),n}getGroupContainerIntersectsFromXY(r){let n=this.getThreeDIntersectsFromXY(r),o;return n!=null&&n.length>0&&(o=U3(n)),o}flush(){this.tapsControl.flush(),this.clickTimeout!=null&&(clearTimeout(this.clickTimeout),this.clickTimeout=void 0)}handleHover(r){let n=r||this.lastPointerEvent;if(this.state.interaction.mouseDownStart||!n||this.isUserInteracting())return;let{entity3D:o,entity2D:i,position:s,groupContainers:l}=this.intersect(n);(this.detect3DEntityHover(o)||this.detect2DEntityHover(i)||this.detect3DContainerHover(l))&&(this.state.hovered3DEntity=o,this.state.lastHover=o,this.state.hovered2DEntity=i,this.state.hovered3DContainers=l,this.publish("hover",{entity2D:this.state.hovered2DEntity,entity3D:this.state.hovered3DEntity,position:s,groupContainers:l})),this.handleCursor()}handleCursor(){let r=!!(this.state.hovered3DEntity&&this.state.hovered3DEntity?.components[2]||this.state.hovered2DEntity),n=!!this.state.interaction.mouseDownStart,o=this.state.interaction.isPanning,i=tX(r,o,n);this.cursor!==i&&(this.cursor=i,i==="pointer"?this._container.classList.add("mappedin-interaction-hover"):this._container.classList.remove("mappedin-interaction-hover"))}detect2DEntityHover(r){return this.state.hovered2DEntity!==r}handleClick(r){let n=this.intersect(r);this.publish("click",{entity2D:n.entity2D,entity3D:n.entity3D,position:n.position,groupContainers:n.groupContainers,pointerEvent:{button:r.button}})}get _hitBoxes(){if(this.dirty3D){this.cachedHitBoxes.entities=[];let r;for(let n of this.coreState.geometry3DIdsInScene)r=this.coreState.geometry3DMap.get(n),(r?.type==="geometry"||r?.type==="model"||r?.type==="path"||r?.type==="custom-geometry")&&r.components[0].mesh&&!this.cachedHitBoxes.entities.includes(r.components[0].mesh)&&this.cachedHitBoxes.entities.push(r.components[0].mesh);return this.dirty3D=!1,this.cachedHitBoxes.entities.push(this.worldPlane),this.cachedHitBoxes}return this.cachedHitBoxes}intersect(r){let{offsetX:n,offsetY:o}=r,i=[n,o],s=this._quadtree.queryPoint(i),[l]=s.filter(S=>S.intersectsPoint(i));this.ndcPoint.x=n/this._container.clientWidth*2-1,this.ndcPoint.y=-(o/this._container.clientHeight)*2+1;let c=this.getThreeDIntersectsFromXY(this.ndcPoint),p=c[0]?.point,d=[],m=[],g=c.filter(S=>S.object.name!=="worldPlane");for(let S of g)S.object instanceof Re&&S.object.material.depthTest===!1?d.push(S):m.push(S);let x=d[0]??m[0]??void 0,v,C;if(x!=null){if(v=nX(x.object,this.coreState.geometry3DMap),!v){let S=x?.instanceId??x?.batchId;v=S!=null&&x?.object.userData.entities?this.coreState.geometry3DMap.get(x?.object.userData.entities[S]):this.coreState.geometry3DMap.get(x?.object.userData.entityId)}v?.components[2]&&(C=v)}let I=U3(g);return{entity2D:l?.userData?.entityId==="watermark"?{id:"watermark"}:this.coreState.geometry2DMap.get(l?.userData.entityId),entity3D:C,position:p,groupContainers:I.length>0?I:void 0}}detect3DEntityHover(r){return this.state.lastHover!==r&&(this.state.lastHover&&n_(this.state.lastHover,!1,this.coreState),r&&n_(r,!0,this.coreState)),this.state.hovered3DEntity!==r}detect3DContainerHover(r){return!i5(this.state.hovered3DContainers,r)}updateInteractionStateIfPanning(r){this.state.interaction.mouseDownStart&&(this.state.interaction.distanceFromMouseDown=Math.sqrt(Math.pow(r.offsetX-this.state.interaction.mouseDownStart.offsetX,2)+Math.pow(r.offsetY-this.state.interaction.mouseDownStart.offsetY,2)),!this.state.interaction.isPanning&&this.state.interaction.distanceFromMouseDown>15&&(this.state.interaction.isPanning=!0))}getMouseRayIntersects(){return this.raycaster.intersectObjects([this.worldPlane],!1)}destroy(){this._container.removeEventListener("pointerdown",this.onPointerDown,!1),this._container.removeEventListener("pointermove",this.onPointerMoveRaf,!1),this._container.removeEventListener("pointerup",this.onPointerUp,!1),this._container.removeEventListener("pointercancel",this.onPointerUp,!1)}enableDebug(){let r=document.createElement("div");r.style.position="absolute",r.style.top="0",r.style.right="0",r.style.backgroundColor="white",r.style.padding="10px",document.body.append(r),r.id="interaction-debug-panel",this.debugPanel=r,this.on("doubletap-with-onefinger",()=>{this.queueDebugMessage("doubletap-with-onefinger","#ffadad")}),this.on("singletap-with-twofinger",()=>{this.queueDebugMessage("singletap-with-twofinger","#ffd6a5")}),this.on("click",n=>{this.queueDebugMessage(`CLICK
|
|
6
|
+
`)}function Pt(...k){let W={language:"javascript"},[D,ne,K]=k.length===2&&ke(k[1])?[k[0],k[1],W]:k.length===2&&!ke(k[1])?[k[0],[],k[1]]:k.length===3?[k[0],k[1],k[2]]:k.length===1?[k[0],[],W]:[null,[],W];if(pe.language=K.language,pe.variables.clear(),pe.functions.clear(),pe.instances.clear(),!et(D))throw new L1(D);for(let ee of ne)if(!et(ee))throw new L1(ee);return xt(D,ne,K)}e.Code=Pt;function nr(k,W=[]){let D=Pt(k,W,{language:"javascript"}),ne=globalThis.Function("kind","format","hash",D),K=new Map(pe.instances);function ee(Yr,pn,dc){if(!Nr.Has(Yr)||!K.has(pn))return!1;let $v=Nr.Get(Yr),zv=K.get(pn);return $v(zv,dc)}function Le(Yr,pn){return Bn.Has(Yr)?Bn.Get(Yr)(pn):!1}function Ft(Yr){return xl(Yr)}let In=ne(ee,Le,Ft);return new OI(k,W,In,D)}e.Compile=nr})(R1||(R1={}));u();u();u();var kV=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,AV=[0,31,28,31,30,31,30,31,31,30,31,30,31],LV=e=>e%4===0&&(e%100!==0||e%400===0),B1=e=>{let t=kV.exec(e);if(!t)return!1;let r=+t[1],n=+t[2],o=+t[3];return n>=1&&n<=12&&o>=1&&o<=(n===2&&LV(r)?29:AV[n])};u();var RV=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i,N1=e=>{let t=RV.exec(e);if(!t)return!1;let r=+t[1],n=+t[2],o=+t[3],i=t[4],s=t[5]==="-"?-1:1,l=+(t[6]||0),c=+(t[7]||0);if(l>23||c>59||!i)return!1;if(r<=23&&n<=59&&o<60)return!0;let p=n-c*s,d=r-l*s-(p<0?1:0);return(d===23||d===-1)&&(p===59||p===-1)&&o<61};var BV=/t|\s/i,Tw=e=>{let t=e.split(BV);return t.length===2&&B1(t[0])&&N1(t[1])};u();var NV=/\/|:/,GV=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,Mw=e=>NV.test(e)&&GV.test(e);var jV=[["date",B1],["time",N1],["date-time",Tw],["uri",Mw]],Pw=()=>{for(let[e,t]of jV)try{r1.Format(e,t)}catch(r){if(r instanceof Km)continue;throw r}};u();var FI=b.Record(b.String(),b.Unknown(),{$id:"Extra"}),yi=b.Object({extra:b.Optional(b.Ref(FI))}),kI=[FI];u();u();u();u();u();u();var pt=e=>Object.entries(e);var UV=e=>{let t=new Map;for(let[r,n]of pt(e.geometry??{}))t.set(r,new Map(n?.features.map(o=>[o.properties.id,o])));return t},Pr=e=>{let t=UV(e);return(n,o)=>{let i=t.get(n);if(i==null)return ae({kind:Vn.UnknownFloorError,properties:{floorId:n}});let s=i.get(o);return s==null?ae({kind:Vn.UnknownGeometryError,properties:{floorId:n,geometryId:o}}):ie(s)}};u();var Lo=b.Object({geometryId:b.Ref(mn)},{$id:"WithGeometryId"}),id=b.Object({geometryIds:b.Array(b.Ref(mn))},{$id:"WithGeometryIds"}),AI=[Lo,id];u();u();u();var ww=e=>e instanceof Error?e:new Error(String(e));var sd=e=>(...t)=>{try{return ie(e(...t))}catch(r){return ae(ww(r))}};var Ow=sd((e,t)=>{let r={};for(let n of t)for(let o of n.intoBundle(e))r[o.path]=Ku(JSON.stringify(o.contents));return r}),LI=async(e,t,r)=>Ow(e,t).andThenAsync(n=>new Promise(o=>{nw(n,{...r,consume:!0},(i,s)=>{o(i?ae(i):ie(s))})})),VV=sd(ow),RI=(e,t,r)=>Ow(e,t).andThen(n=>VV(n,r));u();u();function G1(e,t,r=[]){let n={...e};for(let[o,i]of Object.entries(t))if(i!==void 0)if(o in n){let s=o;if(Array.isArray(i)&&i.length>0){let l=HV(i[0],r);if(l){let c=n[s];if(!Array.isArray(c))throw new Error(`Expected array at ${o}, got ${typeof c}`);let p=new Map(i.map(g=>[_w(g,l),g])),m=c.map(g=>{let x=p.get(_w(g,l));return x?G1(g,x,r):g});n[s]=m}else n[s]=i}else{let l=n[s];typeof l=="object"&&l!==null&&typeof i=="object"&&i!==null?Object.keys(i).length===0?n[s]=i:n[s]=G1(l,i,r):n[o]=i}}else n[o]=i;return n}function HV(e,t){function r(n){if(typeof n!="object"||n===null)return null;for(let o of t)if(o in n&&typeof n[o]<"u")return[o];if(Array.isArray(n))return null;for(let[o,i]of Object.entries(n)){let s=r(i);if(s)return[o,...s]}return null}return r(e)}function _w(e,t){return t.reduce((r,n)=>{if(r&&typeof r=="object")return r[n]},e)}var WV=e=>e,$V=e=>JSON.parse(MI(e)),Ew=(e,t)=>t.some(r=>r.fromBundle(e.name,new Uint8Array,WV)!==void 0),Dw=sd((e,t)=>{let r={};for(let n of Object.keys(e)){let o=e[n];for(let i of t){let s=i.fromBundle(n,o,$V);if(s){r=G1(r,s,[]);break}}}return r}),BI=async(e,t)=>new Promise(r=>iw(e,{filter:n=>Ew(n,t)},(n,o)=>{r(n?ae(n):ie(o))})).then(r=>r.andThen(n=>Dw(n,t))),zV=sd(sw),NI=(e,t)=>zV(e,{filter:r=>Ew(r,t)}).andThen(r=>Dw(r,t));u();var XV=e=>typeof e=="object"&&e!=null&&"$ref"in e&&typeof e.$ref=="string",ZV=e=>{if(e.length<2)return!1;let t=e.filter(XV);if(t.length!==e.length)return!1;let r=t[0].$ref;return t.slice(1).every(n=>n.$ref===r)},j1=e=>typeof e=="object"&&e!=null&&"allOf"in e&&Array.isArray(e.allOf)&&ZV(e.allOf)?e.allOf[0]:typeof e=="object"&&e!=null&&!Array.isArray(e)?Object.fromEntries(Object.entries(e).map(([t,r])=>[t,j1(r)])):Array.isArray(e)?e.map(j1):e;u();var U1=e=>typeof e=="object"&&e!=null&&"$ref"in e?{...e,$ref:`#/definitions/${e.$ref}`}:typeof e=="object"&&e!=null&&!Array.isArray(e)?Object.fromEntries(Object.entries(e).map(([t,r])=>[t,U1(r)])):Array.isArray(e)?e.map(U1):e;var ad;(function(e){e.InvalidTypeboxSchema="InvalidTypeboxSchema",e.MissingReferenceId="MissingReferenceId",e.DuplicateReferenceId="DuplicateReferenceId",e.TypeboxError="TypeboxError",e.UnknownError="UnknownError"})(ad||(ad={}));var YV=e=>({next(){for(let r of e){let n=r.next();if(!n.done)return n}return{done:!0,value:void 0}},[Symbol.iterator](){return this}}),JV=(...e)=>{let t=new Map;for(let r of YV(e)){if(!r.$id)continue;let n=t.get(r.$id);if(n!=null&&n!==r)return ae({kind:ad.DuplicateReferenceId,message:"Failed to register a reference for a schema with an $id that has already been used",schema:r});t.set(r.$id,r)}return ie(t)},Ur,ld,uo,nn,GI=class GI{constructor(t,r,n,o){T(this,Ur);T(this,ld);T(this,uo,[]);T(this,nn);w(this,Ur,t),w(this,ld,r),w(this,uo,n),w(this,nn,o),this.is=this.is.bind(this),this.parse=this.parse.bind(this),this.verify=this.verify.bind(this),this.jsonSchema=this.jsonSchema.bind(this),this.compress=this.compress.bind(this),this.decompress=this.decompress.bind(this)}static create(t,r="CoreMVF",n=!1){let o=b.Composite(t.extensions.map(s=>s.schema),{$id:r});if(!F.IsSchema(o))return ae({kind:ad.InvalidTypeboxSchema,message:"Attempting to merge schemas produced an invalid schema",schema:o});let i=JV(tI.values(),rI.values(),Q2.values(),kI.values(),jI.values(),AI.values(),t.extensions.flatMap(s=>s.references??[]).values());if(!i.isOk())return i;try{Pw();let s=n?null:R1.Compile(o,[...i.value.values()]);return ie(new GI(o,s,t.extensions,i.value))}catch(s){return s instanceof ve?ae({kind:ad.TypeboxError,message:s.message,original:s}):ae({kind:ad.UnknownError,message:"An unknown error occurred while compiling the schema",original:s})}}is(t){return a(this,ld)?.Check(t)??mi.Check(a(this,Ur),[...a(this,nn).values()],t)}parse(t){return this.is(t)?ie(t):ae(a(this,ld)?.Errors(t)??mi.Errors(a(this,Ur),[...a(this,nn).values()],t))}decode(t){try{return ie(Sw(a(this,Ur),[...a(this,nn).values()],t))}catch(r){return ae(r)}}encode(t){try{return ie(Cw(a(this,Ur),[...a(this,nn).values()],t))}catch(r){return ae(r)}}verify(t){for(let r of a(this,uo))if(r.integrityCheck){let n=r.integrityCheck(t);if(n.isErr())return ae(n.error)}return ie(!0)}jsonSchema(){let t=JSON.parse(JSON.stringify([a(this,Ur),...a(this,nn).values()])),r=j1(U1({$id:`#/definitions/${a(this,Ur).$id??"CoreMVF"}`,$schema:"http://json-schema.org/draft-07/schema#",references:t}));return JSON.stringify(r,null,2)}async compress(t){return this.encode(t).andThen(r=>this.parse(r)).andThenAsync(r=>LI(r,a(this,uo))).then(r=>r.mapErr(n=>ah(a(this,Ur).$id??"CoreMVF",n,[...a(this,nn).values()])))}async compressUnsafe(t){return this.encode(t).andThenAsync(r=>LI(r,a(this,uo))).then(r=>r.mapErr(n=>ah(a(this,Ur).$id??"CoreMVF",n,[...a(this,nn).values()])))}compressSync(t){return this.encode(t).andThen(r=>this.parse(r)).andThen(r=>RI(r,a(this,uo))).mapErr(r=>ah(a(this,Ur).$id??"CoreMVF",r,[...a(this,nn).values()]))}compressUnsafeSync(t){return this.encode(t).andThen(r=>RI(r,a(this,uo))).mapErr(r=>ah(a(this,Ur).$id??"CoreMVF",r,[...a(this,nn).values()]))}async decompress(t){return BI(t,a(this,uo)).then(r=>r.andThen(n=>this.parse(n)).andThen(n=>this.decode(n)).mapErr(n=>lh(a(this,Ur).$id??"CoreMVF",n,[...a(this,nn).values()])))}async decompressUnsafe(t){return BI(t,a(this,uo)).then(r=>r.andThen(n=>this.decode(n)).mapErr(n=>lh(a(this,Ur).$id??"CoreMVF",n,[...a(this,nn).values()])))}decompressSync(t){return NI(t,a(this,uo)).andThen(r=>this.parse(r)).andThen(r=>this.decode(r)).mapErr(r=>lh(a(this,Ur).$id??"CoreMVF",r,[...a(this,nn).values()]))}decompressUnsafeSync(t){return NI(t,a(this,uo)).andThen(r=>this.decode(r)).mapErr(r=>lh(a(this,Ur).$id??"CoreMVF",r,[...a(this,nn).values()]))}};Ur=new WeakMap,ld=new WeakMap,uo=new WeakMap,nn=new WeakMap;var V1=GI;var cd,H1=class{constructor(){T(this,cd,[]);this.extend=this.extend.bind(this)}extend(t){return a(this,cd).push(t),this}extendOptional(t){let r={...t,schema:b.Partial(t.schema)};return a(this,cd).push(r),this}build(t){return V1.create(this,void 0,t?.cspSafe)}get extensions(){return a(this,cd)}};cd=new WeakMap;u();u();u();u();var pd=b.Object({geometryId:b.Ref(mn),floorId:b.Ref(Ze)},{$id:"GeometryAnchor"}),qV=b.Object({geometryAnchor:b.Ref(pd)}),ch=(e,t)=>b.Object({geometryAnchors:b.Array(b.Ref(pd),e)},t),jI=[pd];u();u();u();var Fw=(e,t)=>b.Unsafe(b.Transform(b.String(t)).Decode(r=>e.includes(r)?r:"unknown").Encode(r=>r)),Hn=(e,t)=>{let r=Fw(e,t),n=[...e,"unknown"],o=Object.freeze(Object.fromEntries([...e,"unknown"].map(i=>[i,i])));return{schema:r,values:n,record:o}};var kw=()=>new H1().extend(dw).extend(yw).extend(Iw);u();u();u();u();u();u();var ph;(function(e){e.AnnotationNonPointGeometryError="AnnotationNonPointGeometryError",e.AnnotationUnknownSymbolError="AnnotationUnknownSymbolError"})(ph||(ph={}));var Aw=e=>{if(e.annotations==null)return ie(!0);let t=hr(e.annotations,o=>o.id,"annotations");if(t.isErr())return t;let r=Pr(e),n=new Set(rt(e.annotationSymbols??{}));for(let o of rt(e.annotations)){let i=e.annotations[o];if(i!=null)for(let s of i){if(!n.has(s.symbolKey))return ae({kind:ph.AnnotationUnknownSymbolError,properties:{annotationId:s.id,symbolKey:s.symbolKey}});let l=r(o,s.geometryId);if(l.isErr())return l;if(l.value.geometry.type!=="Point")return ae({kind:ph.AnnotationNonPointGeometryError,properties:{annotationId:s.id,floorId:o,geometryId:s.geometryId}})}}return ie(!0)};var Lw=mr("a","AnnotationId"),UI=b.Intersect([Lo,b.Object({id:b.Ref(Lw,{description:"The unique identifier for the annotation."}),externalId:b.Optional(b.String({description:"The external identifier for the annotation."})),symbolKey:b.String({description:"The symbol identifier for the annotation."})})],{$id:"AnnotationProperties"}),Rw=b.Object({url:b.String({format:"uri",description:"The URL for the symbol."}),name:b.String({description:"The name of the symbol."})},{$id:"AnnotationSymbol"}),KV=b.Object({annotations:gr(b.Record(Ze,b.Array(b.Ref(UI)),{additionalProperties:!1})),annotationSymbols:gr(b.Record(b.Index(UI,["symbolKey"]),b.Ref(Rw)))},{$id:"AnnotationsSchema"}),QV=/^annotations\/(.*)\.json$/,Bw={name:"ext:mvf-annotations",schema:KV,intoBundle:function*(e){if(e.annotations!=null)for(let t of rt(e.annotations))yield{path:`annotations/${t}.json`,contents:e.annotations[t]};e.annotationSymbols!=null&&(yield{path:"annotation-symbols.json",contents:e.annotationSymbols})},fromBundle:(e,t,r)=>{if(e==="annotation-symbols.json")return{annotationSymbols:r(t)};let n=e.match(QV)?.[1];if(n)return{annotations:{[n]:r(t)}}},references:[Lw,UI,Rw],integrityCheck:Aw};u();u();u();var ma=mr("lcat","LocationCategoryId"),VI=b.Intersect([b.Object({id:b.Ref(ma),parent:b.Optional(b.Ref(ma))}),Oc(["name"]),yi],{$id:"LocationCategory"}),Nw=[ma,VI];u();u();var Lc;(function(e){e.UnknownCategoryError="UnknownCategoryError",e.UnknownParentCategoryError="UnknownParentCategoryError",e.UnknownParentLocationError="UnknownParentLocationError"})(Lc||(Lc={}));var Gw=e=>{if(e.locationCategories==null&&e.locations==null)return ie(!0);if(e.locationCategories!=null){let o=hr(e.locationCategories,i=>i.id,"locationCategories");if(o.isErr())return o}if(e.locations!=null){let o=hr(e.locations,i=>i.id,"locations");if(o.isErr())return o}if(e.locationInstances!=null){let o=hr(e.locationInstances,i=>i.id,"locationInstances");if(o.isErr())return o}let t=new Set(e.locationCategories?.map(o=>o.id)??[]);for(let o of e.locationCategories??[])if(o.parent!=null&&!t.has(o.parent))return ae({kind:Lc.UnknownParentCategoryError,properties:{categoryId:o.id,parentCategoryId:o.parent}});let r=Pr(e);for(let o of e.locations??[]){for(let i of o.categories)if(!t.has(i))return ae({kind:Lc.UnknownCategoryError,properties:{locationId:o.id,categoryId:i}});for(let i of o.geometryAnchors){let s=r(i.floorId,i.geometryId);if(s.isErr())return s}}let n=new Set(e.locations?.map(o=>o.id)??[]);for(let o of e.locationInstances??[]){if(!n.has(o.parentId))return ae({kind:Lc.UnknownParentLocationError,properties:{locationInstanceId:o.id,parentLocationId:o.parentId}});for(let i of o.categories??[])if(!t.has(i))return ae({kind:Lc.UnknownCategoryError,properties:{locationId:o.id,categoryId:i}});for(let i of o.geometryAnchors??[]){let s=r(i.floorId,i.geometryId);if(s.isErr())return s}}return ie(!0)};u();var ha=mr("loc","LocationId"),W1=mr("loci","LocationInstanceId"),jw=b.Object({name:b.String(),url:b.String({format:"uri"})},{$id:"LocationSocial"}),Uw=b.Object({url:b.String({format:"uri"})},{$id:"LocationImage"}),HI=b.Object({label:b.String(),url:b.String({format:"uri"})},{$id:"LocationLink"}),WI=b.String({pattern:"^[0-2][0-9]:[0-6][0-9](:[0-6][0-9])?$",$id:"OpeningHoursTime"}),Vw=b.Union([b.Literal("Sunday"),b.Literal("Monday"),b.Literal("Tuesday"),b.Literal("Wednesday"),b.Literal("Thursday"),b.Literal("Friday"),b.Literal("Saturday")],{$id:"OpeningHoursDay"}),eH="PublicHolidays",$I=b.Union([Vw,b.Literal(eH)],{$id:"OpeningHoursDayOrPublicHoliday"}),$1=b.Object({"@type":b.Optional(b.Literal("OpeningHoursSpecification",{description:"The type of opening hours"})),opens:b.Optional(b.Ref(WI,{description:"The time the opening hours start"})),closes:b.Optional(b.Ref(WI,{description:"The time the opening hours end"})),dayOfWeek:b.Optional(b.Union([b.Ref($I),b.Array(b.Ref($I))],{description:"The days of the week the opening hours apply to"})),validFrom:b.Optional(b.String({format:"date",description:"The date the opening hours start, in ISO 8601 format"})),validTo:b.Optional(b.String({format:"date",description:"The date the opening hours end, in ISO 8601 format"}))},{$id:"OpeningHoursSpecification"}),z1=b.Intersect([b.Object({id:b.Ref(ha),categories:b.Array(b.Ref(ma)),logo:b.Optional(b.String({format:"uri"})),phone:b.Optional(b.String()),social:b.Array(b.Ref(jw)),images:b.Array(b.Ref(Uw)),links:b.Array(b.Ref(HI)),website:b.Optional(b.Ref(HI)),openingHours:b.Optional(b.Array(b.Ref($1)))}),Oc(["name"]),ch(),yi],{$id:"Location"}),zI=b.Intersect([b.Object({id:b.Ref(W1),parentId:b.Ref(ha)}),b.Partial(b.Omit(z1,["id","parentId","details"])),io],{$id:"LocationInstance",description:"A location instance is a particular instance of an location that has some properties different from the parent."}),X1=[ha,W1,jw,Uw,HI,WI,Vw,$I,$1,z1,zI];var tH=b.Object({locations:b.Array(b.Ref(z1)),locationCategories:b.Array(b.Ref(VI)),locationInstances:b.Optional(b.Array(b.Ref(zI)))},{$id:"LocationsExtensionSchema"}),Hw="locations.json",Ww="location-categories.json",$w="location-instances.json",zw={name:"ext:locations",schema:tH,intoBundle:function*(e){e.locations!=null&&(yield{path:Hw,contents:e.locations}),e.locationCategories!=null&&(yield{path:Ww,contents:e.locationCategories}),e.locationInstances!=null&&(yield{path:$w,contents:e.locationInstances})},fromBundle:(e,t,r)=>{if(e===Hw)return{locations:r(t)};if(e===Ww)return{locationCategories:r(t)};if(e===$w)return{locationInstances:r(t)}},references:[...Nw,...X1],integrityCheck:Gw};u();u();var bi;(function(e){e.EnterpriseLocationWithUnknownLocationError="EnterpriseLocationWithUnknownLocationError",e.EnterpriseCategoryWithUnknownLocationCategoryError="EnterpriseCategoryWithUnknownLocationCategoryError",e.InstanceWithUnknownLocationInstanceError="InstanceWithUnknownLocationInstanceError",e.InstanceWithUnknownEnterpriseLocationError="InstanceWithUnknownEnterpriseLocationError",e.EnterpriseLocationWithUnknownSibling="EnterpriseLocationWithUnknownSibling",e.EnterpriseLocationInstanceWithUnknownSibling="EnterpriseLocationInstanceWithUnknownSibling",e.EnterpriseVenueWithUnknownTopLocationError="EnterpriseVenueWithUnknownTopLocationError",e.EnterpriseLocationWithInvalidPrimaryCategory="EnterpriseLocationWithInvalidPrimaryCategory"})(bi||(bi={}));var Xw=e=>{if(e.cms==null)return ie(!0);let t=e.cms,r=hr(e.cms.categories,g=>g.id,"cms.categories");if(r.isErr())return r;let n=new Set(e.locationCategories?.map(g=>g.id)??[]);for(let g of t.categories??[])if(!n.has(g.categoryId))return ae({kind:bi.EnterpriseCategoryWithUnknownLocationCategoryError,properties:{enterpriseCategoryId:g.id,locationCategoryId:g.categoryId}});let o=hr(e.cms.locations,g=>g.id,"cms.locations");if(o.isErr())return o;let i=new Map(e.locations?.map(g=>[g.id,g])??[]);for(let g of t.locations??[]){if(!i.has(g.locationId))return ae({kind:bi.EnterpriseLocationWithUnknownLocationError,properties:{enterpriseLocationId:g.id,locationId:g.locationId}});for(let x of g.siblingGroups??[])for(let v of x.siblings??[])if(!i.has(v))return ae({kind:bi.EnterpriseLocationWithUnknownSibling,properties:{enterpriseLocationId:g.id,siblingLocationId:v,label:x.label}});if(g.primaryCategory!=null){let x=i.get(g.locationId);if(x!=null&&!x.categories.includes(g.primaryCategory))return ae({kind:bi.EnterpriseLocationWithInvalidPrimaryCategory,properties:{enterpriseLocationId:g.id,locationId:g.locationId,primaryCategory:g.primaryCategory}})}}if(t.venue?.topLocations!=null){for(let g of t.venue.topLocations)if(!i.has(g))return ae({kind:bi.EnterpriseVenueWithUnknownTopLocationError,properties:{locationId:g}})}let s=new Set(e.cms.locations?.map(g=>g.id)??[]),l=hr(e.cms.locationInstances,g=>g.id,"cms.locationInstances");if(l.isErr())return l;let c=new Set(e.locationInstances?.map(g=>g.id)??[]);for(let g of t.locationInstances??[]){if(!s.has(g.parentId))return ae({kind:bi.InstanceWithUnknownEnterpriseLocationError,properties:{enterpriseLocationInstanceId:g.id,enterpriseLocationId:g.parentId}});if(!c.has(g.locationInstanceId))return ae({kind:bi.InstanceWithUnknownLocationInstanceError,properties:{enterpriseLocationInstanceId:g.id,locationInstanceId:g.locationInstanceId}});for(let x of g.siblingGroups??[])for(let v of x.siblings??[])if(!i.has(v))return ae({kind:bi.EnterpriseLocationInstanceWithUnknownSibling,properties:{enterpriseLocationInstanceId:g.id,siblingLocationId:v,label:x.label}})}let p=gi(e),d=Pr(e),m=hr(e.cms.floorText,g=>g.properties.id,"cms.floorText");if(m.isErr())return m;for(let[g,x]of pt(t.floorText??{})){let v=p(g);if(v.isErr())return v;for(let C of x.features){if(!("geometryId"in C.properties))continue;let I=d(g,C.properties.geometryId);if(I.isErr())return I}}for(let[g,x]of pt(t.textures??{})){let v=p(g);if(v.isErr())return v;for(let C of x){let I=d(g,C.geometryId);if(I.isErr())return I}}for(let[g,x]of pt(t.layers??{})){let v=p(g);if(v.isErr())return v;for(let C of rt(x??{})){let I=d(g,C);if(I.isErr())return I}}for(let[g,x]of pt(t.textAreas??{})){let v=p(g);if(v.isErr())return v;for(let C of x.features)if("geometryId"in C.properties){let I=d(g,C.properties.geometryId);if(I.isErr())return I}}return ie(!0)};u();u();var uh=mr("el","EnterpriseLocationId"),XI=mr("ec","EnterpriseCategoryId"),ZI=mr("eli","EnterpriseLocationInstanceId"),YI=mr("ev","EnterpriseVenueId"),JI=mr("eft","EnterpriseFloorTextId"),Zw=[uh,XI,ZI,YI,JI];var Yw=b.Object({id:b.Ref(XI),categoryId:b.Ref(ma),color:b.Optional(b.String()),sortOrder:b.Number(),iconFromDefaultList:b.Optional(b.Union([b.String(),b.Null()])),picture:b.Optional(b.String({format:"uri",description:"The category's picture"}))},{$id:"EnterpriseCategory"}),qI=b.Object({categories:b.Optional(b.Array(b.Ref(Yw)))},{$id:"EnterpriseCategoriesSchema"}),Jw=[Yw,qI];u();var qw=Hn(["left","center","right"]),rH=qw.schema,AIe=qw.values,KI=b.Object({id:b.Ref(JI),text:b.String(),visible:b.Boolean({default:!0}),fontSize:b.Number({default:12,exclusiveMinimum:0}),fontFamily:b.String({default:"Droid Sans"}),color:b.String({default:"black"}),rotation:b.Number({minimum:0,maximum:360}),align:rH},{$id:"FloorTextCommonProperties"}),QI=b.Intersect([b.Ref(KI),Lo],{$id:"AnchoredFloorTextProperties"}),eS=b.Intersect([b.Ref(KI),b.Object({verticalOffset:b.Number()})],{$id:"FloatingFloorTextProperties"}),Kw=b.Union([b.Ref(QI),b.Ref(eS)],{$id:"FloorTextProperties"}),Qw=Kr(fn,b.Ref(Kw),{$id:"FloorTextFeature"}),nH=Kr(fn,b.Ref(QI),{$id:"AnchoredFloorTextFeature"}),oH=Kr(fn,b.Ref(eS),{$id:"FloatingFloorTextFeature"}),e7=Mn(b.Ref(Qw),{$id:"EnterpriseFloorTextFeatureCollection"}),t7=b.Record(Ze,b.Ref(e7),{$id:"EnterpriseFloorTextCollectionsByFloor",additionalProperties:!1}),tS=b.Object({floorText:b.Optional(b.Ref(t7))},{$id:"EnterpriseFloorTextSchema"}),r7=[KI,QI,eS,Kw,Qw,nH,oH,e7,t7,tS];u();var n7=gr(b.Record(mn,b.String({minLength:1}),{additionalProperties:!1,$id:"EnterpriseLayers"})),o7=gr(b.Record(Ze,b.Ref(n7),{additionalProperties:!1,$id:"EnterpriseLayersByFloor"})),rS=b.Object({layers:b.Optional(b.Ref(o7))},{$id:"EnterpriseLayersSchema"}),i7=[n7,o7,rS];u();u();u();var nS=Hn(["closed-temporarily","new","pop-up","coming-soon","relocated"]),iH=nS.schema,$Ie=nS.values,zIe=nS.record,oS=b.Object({type:iH,start:b.Optional(b.String({format:"date",description:"The start date of the state"})),end:b.Optional(b.String({format:"date",description:"The end date of the state"}))},{$id:"LocationState",description:"The state of a location. Start and end dates are optional."}),iS=b.Object({label:b.String(),siblings:b.Array(b.Ref(ha))},{$id:"SiblingGroup"}),Z1=b.Object({name:b.String(),code:b.String()},{$id:"Language"}),s7=[oS,iS,Z1];var Y1=b.Object({id:b.Ref(uh),locationId:b.Ref(ha),cmsId:b.String(),type:b.String(),sortOrder:b.Number(),tags:b.Optional(b.Array(b.String())),picture:b.Optional(b.String({format:"uri",description:"The picture of the location"})),states:b.Optional(b.Array(b.Ref(oS),{description:"The location's state. No more than one state should be active at a time, and all but at most one should have dates set"})),siblingGroups:b.Optional(b.Array(b.Ref(iS))),gallery:b.Optional(b.Array(b.Object({caption:b.Optional(b.String()),image:b.String({format:"uri"}),embeddedUrl:b.Optional(b.String({format:"uri",description:"The URL to link from the image"}))},{description:"The location's image gallery"}),{description:"The location's image gallery"})),showFloatingLabelWhenImagePresent:b.Optional(b.Boolean({description:"Whether to show the flat label when an image is present"})),amenity:b.Optional(b.String({description:"The location's amenity type. Only set if the location is an amenity"})),showLogo:b.Optional(b.Boolean({description:"Whether to show the logo of the location"})),primaryCategory:b.Optional(b.Ref(ma))},{$id:"EnterpriseLocation"}),sS=b.Object({locations:b.Optional(b.Array(b.Ref(Y1)))},{$id:"EnterpriseLocationsSchema"}),a7=[Y1,sS];var l7=b.Intersect([b.Object({id:b.Ref(ZI),parentId:b.Ref(uh),locationInstanceId:b.Ref(W1)}),b.Partial(b.Omit(Y1,["id","parentId","locationId"]))],{$id:"EnterpriseLocationInstance",description:"A locationInstance is a particular instance of an Enterprise Location that has some properties different from the parent."}),aS=b.Object({locationInstances:b.Optional(b.Array(b.Ref(l7)))},{$id:"EnterpriseLocationInstancesSchema"}),c7=[l7,aS];u();var lS=Hn(["near","center"],{$id:"EnterpriseTextAreaAlignment"}),p7=lS.schema,uSe=lS.values,dSe=lS.record,cS=b.Object({maxWidth:b.Number({exclusiveMinimum:0,description:"The maximum width of the label, in meters."}),maxHeight:b.Number({exclusiveMinimum:0,description:"The maximum height of the label, in meters."}),align:b.Ref(p7),rotation:b.Number({minimum:0,maximum:360,description:"Rotation in degrees, about the center of the image. North is 0, east is 90."})},{$id:"EnterpriseBaseTextAreaProperties"}),u7=b.Intersect([b.Ref(cS),Lo],{$id:"EnterpriseAnchoredTextAreaProperties"}),d7=b.Intersect([b.Ref(cS),b.Object({verticalOffset:b.Number({minimum:0,description:"How high to position the image, in meters, relative to the ground plane."})})],{$id:"EnterpriseFloatingTextAreaProperties"}),f7=b.Union([u7,d7],{$id:"EnterpriseTextAreaProperties"}),m7=Kr(b.Ref(fn),f7,{$id:"EnterpriseTextAreaFeature"}),h7=Mn(b.Ref(m7),{$id:"EnterpriseTextAreaCollection"}),g7=b.Record(Ze,b.Ref(h7),{$id:"EnterpriseTextAreasByFloor",additionalProperties:!1}),y7=b.Object({textAreas:b.Optional(b.Ref(g7))},{$id:"EnterpriseTextAreasSchema"}),b7=[p7,cS,u7,d7,f7,m7,h7,g7];u();var pS=b.Object({u:b.Number(),v:b.Number()},{$id:"EnterpriseTextureUV"}),uS=Hn(["top","side"],{$id:"EnterpriseTextureFace"}),x7=uS.schema,ySe=uS.values,bSe=uS.record,dS=Hn(["inside","outside","both"],{$id:"EnterpriseTextureSurface"}),v7=dS.schema,xSe=dS.values,vSe=dS.record,I7=b.Tuple([Gu,ju,Gu,ju],{$id:"EnterpriseTextureBounds"}),S7=b.Intersect([b.Object({repeat:b.Ref(pS),offset:b.Ref(pS),rotation:b.Number({minimum:0,maximum:360}),path:b.String({format:"uri"}),face:b.Ref(x7),surface:b.Ref(v7),bounds:b.Ref(I7)},{$id:"EnterpriseTextureProperties"}),Lo],{$id:"EnterpriseTexture"}),C7=b.Array(b.Ref(S7),{$id:"EnterpriseTextures"}),T7=b.Record(Ze,b.Ref(C7),{$id:"EnterpriseTexturesByFloor",additionalProperties:!1}),fS=b.Object({textures:b.Optional(b.Ref(T7))},{$id:"EnterpriseTexturesSchema"}),M7=[S7,C7,fS,pS,x7,v7,I7,T7];u();var P7=b.Intersect([b.Object({id:b.Ref(YI),slug:b.String(),defaultLanguage:b.Ref(Z1),languages:b.Array(b.Ref(Z1)),countrycode:b.Optional(b.String()),logo:b.Optional(b.String({format:"uri"})),mappedinWebUrl:b.Optional(b.String({format:"uri"})),topLocations:b.Optional(b.Array(b.Ref(ha))),operationHours:b.Optional(b.Array(b.Ref($1))),coverImage:b.Optional(b.String({format:"uri"}))}),Oc(["name"]),yi],{$id:"EnterpriseVenue"}),mS=b.Object({venue:b.Optional(b.Ref(P7))},{$id:"EnterpriseVenueSchema"}),w7=[P7,mS];var _7=b.Intersect([mS,sS,aS,qI,fS,tS,rS,y7],{$id:"CMSProperties"}),O7=b.Object({cms:b.Optional(b.Ref(_7))},{$id:"CMSExtensionSchema"}),sH=/^cms\/(?:([^/]+)\/)?([^/]+)\.(?:json|geojson)$/,E7={name:"ext:cms",schema:O7,intoBundle:function*(e){if(e.cms==null)return;let t=e.cms;for(let r of rt(t))switch(r){case"floorText":for(let n of rt(t.floorText??{}))yield{path:`cms/floorText/${n}.geojson`,contents:(t.floorText??{})[n]};continue;case"textures":for(let n of rt(t.textures??{}))yield{path:`cms/textures/${n}.json`,contents:(t.textures??{})[n]};continue;case"textAreas":for(let n of rt(t.textAreas??{}))yield{path:`cms/textAreas/${n}.geojson`,contents:(t.textAreas??{})[n]};continue;default:yield{path:`cms/${r}.json`,contents:t[r]};continue}},fromBundle:(e,t,r)=>{let n=e.match(sH);if(!n)return;let[,o,i]=n,s=r(t);switch(o){case"floorText":case"textures":case"textAreas":return{cms:{[o]:{[i]:s}}};default:return{cms:{[i]:s}}}},references:[_7,O7,...w7,...a7,...c7,...Jw,...M7,...i7,...r7,...b7,...Zw,...s7,...X1],integrityCheck:Xw};u();u();u();u();var xi;(function(e){e.NavigationFlagMissingDeclaration="NavigationFlagMissingDeclaration",e.NavigationFlagDuplicateBit="NavigationFlagDuplicateBit",e.NavigationFlagIncorrectFlagsLength="NavigationFlagIncorrectFlagsLength",e.NavigationFlagValueTooBig="NavigationFlagValueTooBig"})(xi||(xi={}));var D7=e=>{let{navigationFlags:t}=e;if(!t||Object.keys(t).length===0)return ie(!0);let r=Object.entries(t).map(([i,s])=>({key:i,...s})).sort((i,s)=>i.index!==s.index?i.index-s.index:i.bit-s.bit),n=0,o=-1;for(let i of r){if(i.bit===o)return ae({kind:xi.NavigationFlagDuplicateBit,properties:{index:i.index,bit:i.bit,path:`navigationFlags.${i.key}`}});if(i.index!=n){if(o!=31)return ae({kind:xi.NavigationFlagMissingDeclaration,properties:{index:n,bit:o+1,path:"navigationFlags"}});if(i.index!=n+1||i.bit!=0)return ae({kind:xi.NavigationFlagMissingDeclaration,properties:{index:n+1,bit:0,path:"navigationFlags"}});n=i.index,o=0}else{if(i.bit!==o+1)return ae({kind:xi.NavigationFlagMissingDeclaration,properties:{index:i.index,bit:o+1,path:"navigationFlags"}});o=i.bit}}return ie(!0)};u();function Il(e,t){return t&&(e.flags[t.index]&1<<t.bit)!==0}u();var F7=2**32-1,dh=e=>{let t=Object.keys(e.navigationFlags??{}).length;if(t===0)return{index:-1,flag:0};let r=Math.floor(t/32),n=t%32;return{index:r,flag:2**n-1}},ud=(e,t,r)=>{if(t.index==-1&&e.length===0)return ie(!0);let n=t.flag>0||t.index===-1?t.index+1:t.index;if(e.length!==n)return ae({kind:xi.NavigationFlagIncorrectFlagsLength,properties:{expected:n,actual:e.length,path:r}});for(let o=0;o<e.length;o++){let i=e[o];if(o<t.index){if(i>F7)return ae({kind:xi.NavigationFlagValueTooBig,properties:{index:o,flagValue:i,expectedMaxFlagValue:F7,path:r}});continue}else if(i>t.flag)return ae({kind:xi.NavigationFlagValueTooBig,properties:{index:o,flagValue:i,expectedMaxFlagValue:t.flag,path:r}})}return ie(!0)};var aH=b.Object({index:b.Integer({description:"The index of the flag in a flags array.",minimum:0}),bit:b.Integer({description:"The bit position of the flag in a flag's bitfield.",minimum:0,maximum:31})},{$id:"NavigationFlagDeclarationCore"}),k7=b.Intersect([aH,io],{$id:"NavigationFlagDeclaration",description:'A NavigationFlagDeclaration describes the relationship between a "key" that a developer might use to wayfind using that flag, and the index and bit position in an object\'s `flags` array.'}),hS={accessible:"accessible",outdoors:"outdoors"},A7=b.Record(b.String(),k7,{$id:"NavigationFlagDeclarations",description:"Any well known and custom flags present in the MVF"}),lH=b.Object({navigationFlags:b.Ref(A7)},{$id:"NavigationFlagsSchema"}),J1=b.Array(b.Integer({minimum:0,maximum:Math.pow(2,32)-1}),{$id:"Flags"}),gS=b.Object({flags:b.Ref(J1)},{$id:"WithFlags"}),Rc=b.Intersect([pd,gS],{$id:"FlaggedGeometryAnchor"}),cH=b.Object({geometryAnchor:Rc},{$id:"WithFlaggedGeometryAnchor"}),pH=b.Object({geometryAnchors:b.Array(Rc)},{$id:"WithFlaggedGeometryAnchors"}),L7={name:"ext:mvf-navigation-flags",schema:lH,intoBundle:function*(e){e.navigationFlags!=null&&(yield{path:"navigationFlags.json",contents:e.navigationFlags})},fromBundle:(e,t,r)=>e!=="navigationFlags.json"?void 0:{navigationFlags:r(t)},references:[k7,A7,J1,Rc,cH,pH],integrityCheck:D7};u();var R7=e=>{if(e.connections==null)return ie(!0);let t=hr(e.connections,o=>o.id,"connections");if(t.isErr())return t;let r=Pr(e),n=dh(e);for(let[o,i]of e.connections.entries()){for(let[s,l]of i.entrances.entries()){let c=r(l.floorId,l.geometryId);if(c.isErr())return c;let p=ud(l.flags,n,`connections[${o}].entrances[${s}]`);if(p.isErr())return p}for(let[s,l]of i.exits.entries()){let c=r(l.floorId,l.geometryId);if(c.isErr())return c;let p=ud(l.flags,n,`connections[${o}].exits[${s}]`);if(p.isErr())return p}}return ie(!0)};var N7=mr("c","ConnectionId"),{schema:uH,values:S3e,record:dH}=Hn(["elevator","escalator","travelator","stairs","door","ramp"],{$id:"ConnectionType"}),G7=uH;var yS=dH,j7=b.Intersect([b.Object({id:b.Ref(N7,{description:"The unique identifier for the connection."}),entrances:b.Array(b.Ref(Rc)),exits:b.Array(b.Ref(Rc)),entryCost:b.Number({description:"The cost to enter the connection.",minimum:0}),floorCostMultiplier:b.Number({description:"The cost multiplier for each floor transitioned.",minimum:1}),type:b.Ref(G7,{description:"The type of connection."})}),io,yi],{$id:"ConnectionsProperties"}),U7=b.Array(b.Ref(j7),{$id:"ConnectionsCollection"}),fH=b.Object({connections:b.Ref(U7)},{$id:"ConnectionsExtensionSchema"}),B7="connections.json",V7={name:"ext:connections",schema:fH,intoBundle:function*(e){e.connections!=null&&(yield{path:B7,contents:e.connections})},fromBundle:(e,t,r)=>{if(e===B7)return{connections:r(t)}},references:[j7,U7,G7,N7,Rc,J1],integrityCheck:R7};u();u();var H7=e=>{if(e.defaultStyle==null)return ie(!0);let t=Pr(e);for(let r of Object.values(e.defaultStyle))if(r!=null)for(let n of r.geometryAnchors){let o=t(n.floorId,n.geometryId);if(o.isErr())return o}return ie(!0)};var W7=b.Intersect([ch(),yi,b.Object({altitude:b.Number({description:"How far off the bottom of the floor the objects with this style should be drawn, in meters."}),color:b.String({pattern:"^#[0-9a-fA-F]{6}$",description:"Color should be represented with a hash (#), followed by 6 hexadecimal digits. ex: #RRGGBB"}),height:b.Number({minimum:0,description:"The height of the objects belonging to this layer, in meters."}),opacity:b.Number({minimum:0,maximum:1,description:"The opacity of the objects belonging to this layer, from 0 to 1."}),buffer:b.Number({description:"The buffer amount to apply to the geometry, in meters. This can be used to inflate line string geometry for walls, but might also be applicable as a way to grow or shrink polygon geometry for aesthetic purposes. Can be negative."}),hidden:b.Optional(b.Boolean({description:"Whether or not the objects with this style should be hidden."}))})],{$id:"DefaultStyle"}),$7=b.Record(b.String(),b.Ref(W7),{$id:"DefaultStyleCollection",additionalProperties:!1}),mH=b.Object({defaultStyle:b.Ref($7)},{$id:"DefaultStyleSchema"}),z7={name:"ext:mvf-default-style",schema:mH,intoBundle:function*(e){e.defaultStyle!=null&&(yield{path:"default-style.json",contents:e.defaultStyle})},fromBundle:(e,t,r)=>{if(e==="default-style.json")return{defaultStyle:r(t)}},references:[W7,$7],integrityCheck:H7};u();u();u();u();var q1;(function(e){e.InvalidDefaultFloorError="InvalidDefaultFloorError"})(q1||(q1={}));var X7=e=>{if(e.floorStacks==null)return ie(!0);let t=hr(e.floorStacks,n=>n.id,"floorStacks");if(t.isErr())return t;let r=gi(e);for(let n of e.floorStacks){for(let o of n.floors){let i=r(o);if(i.isErr())return i}if(n.defaultFloor!=null&&!n.floors.includes(n.defaultFloor))return ae({kind:q1.InvalidDefaultFloorError,properties:{floorStackId:n.id,floorId:n.defaultFloor}})}return ie(!0)};var fh=mr("fs","FloorStackId"),Y7=b.Intersect([b.Object({id:b.Ref(fh,{description:"The unique identifier for the floor stack."}),floors:b.Array(b.Ref(Ze),{uniqueItems:!0,minItems:1,description:"The floors that are part of this floor stack."}),defaultFloor:b.Optional(b.Ref(Ze,{description:"The default floor for the floor stack."}))}),io],{$id:"FloorStacksProperties"}),J7=b.Array(b.Ref(Y7),{$id:"FloorStackCollection"}),hH=b.Object({floorStacks:b.Ref(J7)},{$id:"FloorStackExtensionSchema"}),Z7="floor-stacks.json",q7={name:"ext:floor-stacks",schema:hH,intoBundle:function*(e){e.floorStacks!=null&&(yield{path:Z7,contents:e.floorStacks})},fromBundle:(e,t,r)=>{if(e===Z7)return{floorStacks:r(t)}},references:[fh,Y7,J7],integrityCheck:X7};u();u();var mh;(function(e){e.MissingFloorStackError="MissingFloorStackError",e.UnknownFloorStackError="UnknownFloorStackError"})(mh||(mh={}));var K7=e=>{if(e.facade==null)return ie(!0);if(e.floorStacks==null)return ae({kind:mh.MissingFloorStackError,properties:null});let t=new Set(e.floorStacks.map(o=>o.id)),r=Pr(e),n=gi(e);for(let[o,i]of pt(e.facade)){if(i==null)continue;let s=n(o);if(s.isErr())return s;for(let l of i){let{floorStackId:c,geometryIds:p}=l;if(!t.has(c))return ae({kind:mh.UnknownFloorStackError,properties:{floorStackId:c}});for(let d of p){let m=r(o,d);if(m.isErr())return m}}}return ie(!0)};var Q7=b.Intersect([b.Object({floorStackId:b.Ref(fh)}),id],{$id:"Facade"}),gH=b.Object({facade:gr(b.Record(Ze,b.Array(b.Ref(Q7)),{additionalProperties:!1}))},{$id:"FacadeExtensionSchema"}),yH=/^facade\/(.*)\.json$/,eO={name:"ext:facade",schema:gH,intoBundle:function*(e){if(e.facade!=null)for(let t of rt(e.facade))yield{path:`facade/${t}.json`,contents:e.facade[t]}},fromBundle:(e,t,r)=>{let n=e.match(yH)?.[1];if(n)return{facade:{[n]:r(t)}}},references:[fh,Q7],integrityCheck:K7};u();u();var tO=e=>{if(e.floorImages==null)return ie(!0);let t=Pr(e);for(let[r,n]of pt(e.floorImages))if(n!=null)for(let o of n.features){if(!("geometryId"in o.properties))continue;let i=o.properties.geometryId,s=t(r,i);if(s.isErr())return s}return ie(!0)};var bS=b.Object({path:b.String({format:"uri",description:"The path to the image. This will be a remote URL."}),width:b.Number({minimum:0,description:"The width of the image when represented on the map, in meters."}),height:b.Number({minimum:0,description:"The height of the image when represented on the map, in meters."}),rotation:b.Number({minimum:0,maximum:360,description:"Rotation in degrees, about the center of the image. North is 0, east is 90."})},{$id:"BaseFloorImageProperties"}),rO=b.Intersect([b.Ref(bS),Lo],{$id:"AnchoredFloorImageProperties"}),nO=b.Intersect([b.Ref(bS),b.Object({verticalOffset:b.Number({minimum:0,description:"How high to position the image, in meters, relative to the ground plane."})})],{$id:"FloatingFloorImageProperties"}),oO=b.Union([rO,nO],{$id:"FloorImageProperties"}),iO=Kr(b.Ref(fn),oO,{$id:"FloorImageFeature"}),sO=Mn(b.Ref(iO),{$id:"FloorImageCollection"}),bH=b.Object({floorImages:gr(b.Record(Ze,b.Ref(sO),{additionalProperties:!1}))},{$id:"FloorImagesExtensionSchema"}),xH=/^floorImages\/(.*)\.geojson$/,aO={name:"ext:floor-images",schema:bH,intoBundle:function*(e){if(e.floorImages!=null)for(let t of rt(e.floorImages))yield{path:`floorImages/${t}.geojson`,contents:e.floorImages[t]}},fromBundle:(e,t,r)=>{let n=e.match(xH)?.[1];if(n)return{floorImages:{[n]:r(t)}}},references:[bS,rO,nO,oO,iO,sO],integrityCheck:tO};u();u();var lO=e=>{if(e.kinds==null)return ie(!0);let t=Pr(e);for(let[r,n]of pt(e.kinds))if(n!=null)for(let o of rt(n)){let i=t(r,o);if(i.isErr())return i}return ie(!0)};var{values:ACe,schema:vH,record:LCe}=Hn(["room","hallway","wall","object","poi","area","window"],{$id:"Kind"}),cO=vH;var pO=gr(b.Record(mn,b.Ref(cO),{additionalProperties:!1,$id:"GeometryKinds"})),IH=b.Object({kinds:gr(b.Record(Ze,b.Ref(pO),{additionalProperties:!1}))},{$id:"KindsExtensionSchema"}),SH=/^kinds\/(.*)\.json$/,uO={name:"ext:kinds",schema:IH,intoBundle:function*(e){if(e.kinds!=null)for(let t of rt(e.kinds))yield{path:`kinds/${t}.json`,contents:e.kinds[t]}},fromBundle:(e,t,r)=>{let n=e.match(SH)?.[1];if(n)return{kinds:{[n]:r(t)}}},references:[cO,pO],integrityCheck:lO};u();u();u();var K1;(function(e){e.UnknownNeighbor="UnknownNeighbor"})(K1||(K1={}));var dO=e=>{if(e.nodes==null)return ie(!0);let t=hr(e.nodes,o=>o.properties.id,"nodes");if(t.isErr())return t;let r=Pr(e),n=dh(e);for(let[o,i]of pt(e.nodes)){if(i==null)continue;let s=new Set(i.features.map(l=>l.properties.id));for(let[l,c]of i.features.entries()){for(let p of c.properties.geometryIds){let d=r(o,p);if(d.isErr())return d}for(let[p,d]of c.properties.neighbors.entries()){if(!s.has(d.id))return ae({kind:K1.UnknownNeighbor,properties:{floorId:o,nodeId:c.properties.id,neighborId:d.id}});let m=ud(d.flags,n,`nodes["${o}"].features[${l}].properties.neighbors[${p}]`);if(m.isErr())return m}}}return ie(!0)};var xS=mr("n","NodeId"),fO=b.Intersect([b.Object({id:b.Ref(xS,{description:"The unique identifier for the node."}),extraCost:b.Number({minimum:0,description:"The extra cost to traverse to the node, above the straight-line distance."})}),gS],{$id:"NodeNeighbor"}),mO=b.Intersect([b.Object({id:b.Ref(xS,{description:"The unique identifier for the node."}),neighbors:b.Array(b.Ref(fO),{description:"The neighbors of the node."})}),id],{$id:"NodeProperties"}),hO=Kr(b.Ref(fn),mO,{$id:"NodeFeature"}),gO=Mn(b.Ref(hO),{$id:"NodeCollection"}),CH=b.Object({nodes:gr(b.Record(Ze,b.Ref(gO),{additionalProperties:!1}))},{$id:"NodesExtensionSchema"}),TH=/^nodes\/(.*)\.json$/,yO={name:"ext:nodes",schema:CH,intoBundle:function*(e){if(e.nodes!=null)for(let t of rt(e.nodes))yield{path:`nodes/${t}.json`,contents:e.nodes[t]}},fromBundle:(e,t,r)=>{let n=e.match(TH)?.[1];if(n)return{nodes:{[n]:r(t)}}},references:[xS,fO,mO,hO,gO],integrityCheck:dO};u();u();u();var Q1;(function(e){e.FloorInFloorStackError="FloorInFloorStackError"})(Q1||(Q1={}));var bO=e=>{if(e.outdoors==null)return ie(!0);let t=gi(e);for(let r of e.outdoors.floors){let n=t(r);if(n.isErr())return n;if(e.floorStacks!=null){for(let o of e.floorStacks)if(o.floors.includes(r))return ae({kind:Q1.FloorInFloorStackError,properties:{floorId:r,floorStackId:o.id}})}}return ie(!0)};var vO=b.Object({floors:b.Array(b.Ref(Ze),{uniqueItems:!0,description:"A list of floor IDs that should be considered to contain outdoor features."})},{$id:"Outdoors"}),MH=b.Object({outdoors:b.Ref(vO)},{$id:"OutdoorsExtensionSchema"}),xO="outdoors.json",IO={name:"ext:outdoors",schema:MH,intoBundle:function*(e){e.outdoors!=null&&(yield{path:xO,contents:e.outdoors})},fromBundle:(e,t,r)=>{if(e===xO)return{outdoors:r(t)}},references:[vO],integrityCheck:bO};u();u();u();var e0;(function(e){e.TilesetDuplicateKeyError="TilesetDuplicateKeyError"})(e0||(e0={}));var SO=e=>{if(e.tileset==null)return ie(!0);let t=new Set;if(t.add(e.tileset.default.key),e.tileset.others)for(let r of e.tileset.others){if(t.has(r.key))return ae({kind:e0.TilesetDuplicateKeyError,properties:{key:r.key}});t.add(r.key)}return ie(!0)};var vS=b.Object({key:b.String({minLength:1,description:"Unique identifier for the tileset style."}),name:b.String({minLength:1,description:"Display name of the tileset style."}),url:b.String({format:"uri",description:"URL of the tileset style."})},{$id:"TilesetStyle",description:"A tileset style definition."}),CO=b.Object({default:b.Ref(vS,{description:"The default tileset style, which should be used."}),others:b.Optional(b.Array(b.Ref(vS,{description:"Additional tileset styles that can be used."})))},{$id:"TilesetCollection"}),PH=b.Object({tileset:b.Ref(CO)},{$id:"TilesetExtensionSchema"}),TO={name:"ext:mvf-tileset",schema:PH,intoBundle:function*(e){e.tileset!=null&&(yield{path:"tileset.json",contents:e.tileset})},fromBundle:(e,t,r)=>{if(e==="tileset.json")return{tileset:r(t)}},references:[vS,CO],integrityCheck:SO};u();var MO=b.Object({},{$id:"WalkableProperties"}),PO=b.Object({},{$id:"NonWalkableProperties"}),wO=gr(b.Record(mn,b.Ref(MO),{$id:"WalkableGeometries",additionalProperties:!1})),OO=gr(b.Record(mn,b.Ref(PO),{$id:"NonWalkableGeometries",additionalProperties:!1})),wH=b.Object({walkable:gr(b.Record(Ze,b.Ref(wO),{additionalProperties:!1})),nonwalkable:gr(b.Record(Ze,b.Ref(OO),{additionalProperties:!1}))},{$id:"TraversabilitySchema"}),OH=/^walkable\/(.*)\.json$/,_H=/^nonwalkable\/(.*)\.json$/,_O={name:"ext:mvf-traversability",schema:wH,intoBundle:function*(e){if(e.walkable!=null)for(let t of rt(e.walkable))yield{path:`walkable/${t}.json`,contents:e.walkable[t]};if(e.nonwalkable!=null)for(let t of rt(e.nonwalkable))yield{path:`nonwalkable/${t}.json`,contents:e.nonwalkable[t]}},fromBundle:(e,t,r)=>{let n=e.match(OH)?.[1];if(n!=null)return{walkable:{[n]:r(t)}};let o=e.match(_H)?.[1];if(o!=null)return{nonwalkable:{[o]:r(t)}}},references:[MO,PO,wO,OO]};u();u();function EO(e){return e.replace(/^g_/,"s_")}function EH(e){return e.replace(/^g_/,"o_")}function DH(e){return e.replace(/^g_/,"w_")}function DO(e){return e.replace(/^loci_/,"eli_")}function gh(e){return e.replace(/^loc_/,"el_")}function t0(e){return e.replace(/^lcat_/,"ec_")}function FH(e){return e.replace(/^g_/,"ar_")}function kH(e,t,r){switch(e.geometry.type){case"MultiPoint":case"MultiLineString":case"MultiPolygon":{let n=[],o=0,i=e.geometry.type.replace("Multi","");for(let s of e.geometry.coordinates)n.push({...e,geometry:{type:i,coordinates:s},properties:{...e.properties,id:`${t}-${o++}`,kind:r}});return n}default:return[{...e,properties:{...e.properties,id:t,kind:r}}]}}function hh(e,t,r,n){let o=new Map;for(let{feature:i,floorId:s}of e){let l=i.properties.id,c=n.get(l);if(t.has(l)){let p=kH(i,r(l),c),d=p.map(g=>g.properties.id),m=d.map(g=>({geometryId:g,floorId:s}));o.set(l,{ids:d,features:p,anchors:m})}}return o}function FO(e){let t={space:new Map,obstruction:new Map,area:new Map,window:new Map};if(!e.geometry)return t;let r=new Map(Object.values(e.kinds??{}).filter(c=>c!==void 0).flatMap(pt)),n=pt(e.geometry).flatMap(([c,p])=>(p?.features??[]).map(d=>({feature:d,floorId:c}))).flat(),o=new Set(Object.values(e.walkable??{}).filter(c=>c!==void 0).flatMap(rt)),i=new Set(Object.values(e.nonwalkable??{}).filter(c=>c!==void 0).flatMap(rt)),s=new Set(Array.from(r.entries()).filter(([c,p])=>p==="area").map(([c])=>c)),l=new Set(Array.from(r.entries()).filter(([c,p])=>p==="window").map(([c])=>c));return o.size>0&&(t.space=hh(n,o,EO,r)),i.size>0&&(t.obstruction=hh(n,i,EH,r)),s.size>0&&(t.area=hh(n,s,FH,r)),l.size>0&&(t.window=hh(n,l,DH,r)),o.size===0&&i.size===0&&s.size===0&&(t.space=hh(n,new Set(n.map(c=>c.feature.properties.id)),EO,r)),t}function kO(e){let{nodesByGeometryId:t,incomingEdgesByNodeId:r}=AH(e),n=FO(e),o=LH(e),i=e.navigationFlags??{};return{geometryMaps:n,nodesByGeometryId:t,geometryFeatureById:o,navigationFlags:i,incomingEdgesByNodeId:r}}function AH(e){let t=new Map,r=new Map;for(let n of Object.values(e.nodes??{}))for(let o of n?.features??[]){if(o.properties.geometryIds.length>0)for(let i of o.properties.geometryIds){let s=t.get(i)??[];s.push(o.properties.id),t.set(i,s)}if(o.properties.neighbors.length>0)for(let i of o.properties.neighbors){let s=r.get(i.id);s!=null?s.push(i):r.set(i.id,[i])}}return{nodesByGeometryId:t,incomingEdgesByNodeId:r}}function LH(e){let t=new Map;for(let r of Object.values(e.geometry??{}))for(let n of r?.features??[])t.set(n.properties.id,n);return t}u();function AO(e,t){if(!e.annotations||!e.annotationSymbols||!e.geometry)return{};let r={};for(let[n,o]of pt(e.annotations)){if(!o||o.length===0||!e.geometry[n]||e.geometry[n].features.length===0)continue;let i=new Map(e.geometry[n].features.map(l=>[l.properties.id,l])),s={type:"FeatureCollection",features:[]};for(let l of o){let c=i.get(l.geometryId);if(!c||c.geometry.type!=="Point")continue;let p={id:l.id,externalId:l.externalId,symbolId:l.symbolKey};s.features.push({type:"Feature",geometry:c.geometry,properties:p})}r[n]=s}return{annotation:r}}u();function LO(e,{nodesByGeometryId:t}){let r={"connection.json":[],entrance:{}},n=e.navigationFlags?.[hS.accessible],o=e.navigationFlags?.[hS.outdoors],i=new Map(Object.values(e.geometry??{}).flatMap(s=>s?.features??[]).map(s=>[s.properties.id,s]));for(let s of e.connections??[]){if(IS(s,i)){let d=RH(s,i,t,o);for(let[m,g]of d)r.entrance[m]||(r.entrance[m]={type:"FeatureCollection",features:[]}),r.entrance[m].features.push(g);continue}let l=n!=null&&s.entrances.some(d=>Il(d,n))&&s.exits.some(d=>Il(d,n)),c=Array.from(new Set([...s.entrances.map(d=>t.get(d.geometryId)),...s.exits.map(d=>t.get(d.geometryId))].flat().filter(d=>d!=null))),p={id:s.id,externalId:s.details?.externalId??"",type:s.type,accessible:l,nodes:c};s.details?.name&&(p.details={name:s.details.name}),s.extra&&(p.extra=s.extra),r["connection.json"].push(p)}return r}function IS(e,t){return e.type==yS.door&&e.entrances.every(r=>t.get(r.geometryId)?.geometry.type==="LineString")}function RH(e,t,r,n){if(e.type!==yS.door)return[];let o=[];for(let i of e.entrances){let s=t.get(i.geometryId);if(s?.geometry.type==="LineString"){let l={type:"Feature",geometry:s.geometry,properties:{id:e.id,externalId:e.details?.externalId??"",isExterior:BH(e,n)}},c=e.details;c&&(l.properties.details={name:c.name,description:c.description},c.icon&&(l.properties.details.images=[{url:c.icon,altText:`${c.name} icon`}]));let p=r.get(i.geometryId);p&&p.length>0&&(l.properties.node=p[0]),o.push([i.floorId,l])}}return o}function BH(e,t){return e.entrances.some(r=>Il(r,t))||e.exits.some(r=>Il(r,t))}u();function BO(e,{geometryMaps:t,nodesByGeometryId:r}){let n={categories:[],locations:[],locationInstances:[],layers:[],venue:{slug:"",name:"",externalId:"",defaultLanguage:{name:"English",code:"en"},languages:[]}},o=e.manifest?.features[0];o&&(n.venue.defaultFloor=o.properties.defaultFloor,n.venue.tzid=o.properties.tzid,n.venue.name=o.properties.name,n.venue.defaultLanguage={name:o.properties.language??"English",code:o.properties.language??"en"});let i=e.cms?.venue;i&&(n.venue={...n.venue,slug:i.slug,name:i.details?.name??n.venue.name??o.properties.name,externalId:i.details?.externalId??"",defaultLanguage:i.defaultLanguage,languages:i.languages??[],countrycode:i.countrycode,coverImage:i.coverImage,logo:i.logo,icon:i.details?.icon,extra:i.extra,mappedinWebUrl:i.mappedinWebUrl,operationHours:i.operationHours,topLocations:i.topLocations});let s=new Map,l=e.locations??[],c=e.cms?.locations??[],p=e.cms?.categories??[],d=new Map((p??[]).map(O=>[O.categoryId,O]));if(l.length>0){let O=new Map(c.map(M=>[M.locationId,M]));for(let M of l){let E=O.get(M.id)??{};if(M){let B=M.details,j={id:E?.cmsId!==void 0?`el_${E?.cmsId}`:gh(M.id),name:B.name,externalId:B.externalId??"",type:E.type??"location",sortOrder:E.sortOrder??0,amenity:E.amenity,description:B.description,extra:M.extra,links:M.links,operationHours:M.openingHours,gallery:E.gallery,logo:M.logo,shortName:B.shortName,picture:E.picture,showFloatingLabelWhenImagePresent:E.showFloatingLabelWhenImagePresent,showLogo:E.showLogo,siblingGroups:E.siblingGroups,states:E.states,tags:E.tags,spaces:[],nodes:[],polygons:[]};if(M.phone&&(j.phone={number:M.phone}),E.primaryCategory){let N=d.get(E.primaryCategory);N&&(j.primaryCategory=N.id)}let L=RO(M.social);M.website&&(L.website=M.website.url),j.social=L;for(let N of M.geometryAnchors){let X=t.space.get(N.geometryId);if(X){let re=new Set(X.features.filter(Q=>Q.geometry.type==="Polygon").map(Q=>Q.properties.id));for(let Q of X.anchors)j.spaces.push({floor:Q.floorId,id:Q.geometryId}),re.has(Q.geometryId)&&j.polygons.push({map:Q.floorId,id:Q.geometryId})}let Z=r.get(N.geometryId);for(let re of Z??[])j.nodes.push({map:N.floorId,id:re})}n.locations.push(j);for(let N of M.categories)s.set(N,[...s.get(N)??[],M.id])}}}let m=e.cms?.locationInstances??[],g=e.locationInstances;if(g){let O=new Map(m.map(E=>[E.locationInstanceId,E])),M=[];for(let E of g){let B=O.get(E.id)??{};if(E){let j={id:DO(E.id),parent:B.parentId??gh(E.parentId),name:E.details?.name,externalId:E.details?.externalId,type:B.type,sortOrder:B.sortOrder,amenity:B.amenity,description:E.details?.description,extra:E.extra,links:E.links,operationHours:E.openingHours,gallery:B.gallery,picture:B.picture,showFloatingLabelWhenImagePresent:B.showFloatingLabelWhenImagePresent,showLogo:B.showLogo,siblingGroups:B.siblingGroups,states:B.states,tags:B.tags,logo:E.logo,shortName:E.details?.shortName};E.phone&&(j.phone={number:E.phone});let L=RO(E.social??[]);if(E.website&&(L.website=E.website.url),Object.keys(L).length>0&&(j.social=L),E.geometryAnchors?.length){let N=E.geometryAnchors.flatMap(X=>t.space.get(X.geometryId)?.anchors??[]);N.length>0&&(j.spaces=N.map(X=>({floor:X.floorId,id:X.geometryId})))}if(E.geometryAnchors){j.spaces=[],j.polygons=[],j.nodes=[];for(let N of E.geometryAnchors){let X=t.space.get(N.geometryId);if(X){let re=new Set(X.features.filter(Q=>Q.geometry.type==="Polygon").map(Q=>Q.properties.id));for(let Q of X.anchors)j.spaces.push({floor:Q.floorId,id:Q.geometryId}),re.has(Q.geometryId)&&j.polygons.push({map:Q.floorId,id:Q.geometryId})}let Z=r.get(N.geometryId);for(let re of Z??[])j.nodes.push({map:N.floorId,id:re})}}M.push(j)}}M.length>0&&(n.locationInstances=M)}let x=e.locationCategories;if(x){let O=[],M=new Map(x.map(L=>[L.id,L])),E=new Map((p??[]).map(L=>[L.categoryId,L])),B=new Map;for(let L of x){let N=M.get(L.parent);if(N){let X=B.get(N.id)??[];X.push(L.id),B.set(N.id,X)}}for(let L of x){let N=E.get(L.id);if(L){let X=(B.get(L.id)??[]).map(t0),Z={id:t0(L.id),name:L.details.name,externalId:L.details.externalId??"",sortOrder:N?.sortOrder??0,children:X,locations:(s.get(L.id)??[]).map(gh),icon:L.details.icon,picture:N?.picture,color:N?.color,extra:L.extra,iconFromDefaultList:N?.iconFromDefaultList};O.push(Z)}}n.categories=O;let j={};for(let L of l)j[gh(L.id)]=L.categories.map(t0).filter(N=>N!==void 0);n.categoryPriorities=j}let v={};for(let[O,M]of Object.entries(e.defaultStyle??{}))if(M.buffer){let E=M.geometryAnchors.flatMap(B=>t.space.get(B.geometryId)?.anchors??[]);v[O]={edgeOffset:M.buffer,geometryAnchors:E}}Object.keys(v).length>0&&(n.enterpriseStyles=v);let C=new Map;for(let O of Object.values(e.cms?.layers??{}))if(O)for(let[M,E]of pt(O)){if(typeof E!="string")continue;let B=C.get(E)??{name:E,id:`ely_${E}`,spaces:[]};B.spaces.push(...t.space.get(M)?.anchors.map(j=>({floorId:j.floorId,spaceId:j.geometryId}))??[]),C.set(E,B)}C.size>0&&(n.layers=Array.from(C.values()));let I=[];for(let O of Object.values(e.cms?.textures??{}))for(let M of O){let E=t.space.get(M.geometryId)?.anchors;!E||E.length<1||M.face==="unknown"||M.surface==="unknown"||I.push({repeat:M.repeat,offset:M.offset,rotation:M.rotation,path:M.path,face:M.face,surface:M.surface,bounds:M.bounds,geometryAnchors:E})}I.length>0&&(n.textures=I);let S={};for(let[O,M]of Object.entries(e.cms?.floorText??{})){let E={type:"FeatureCollection",features:[]};for(let B of M.features){if(B.properties.align==="unknown")continue;let j={align:B.properties.align,color:B.properties.color,fontFamily:B.properties.fontFamily,fontSize:B.properties.fontSize,rotation:B.properties.rotation,text:B.properties.text,visible:B.properties.visible};"geometryId"in B.properties?j.geometryId=B.properties.geometryId:j.verticalOffset=B.properties.verticalOffset,E.features.push({type:"Feature",geometry:B.geometry,properties:j})}E.features.length>0&&(S[O]=E)}Object.keys(S).length>0&&(n.floorText=S);let P={enterprise:n};if(e.cms?.textAreas){let O={};for(let[M,E]of pt(e.cms.textAreas)){let B={type:"FeatureCollection",features:[]};for(let j of E.features){if(j.properties.align==="unknown")continue;let L={align:j.properties.align,maxWidth:j.properties.maxWidth,maxHeight:j.properties.maxHeight,rotation:j.properties.rotation};"geometryId"in j.properties?L.anchorId=j.properties.geometryId:L.verticalOffset=j.properties.verticalOffset;let N={type:"Feature",geometry:j.geometry,properties:L};B.features.push(N)}O[M]=B}P.textAreas=O}return P}var NH=["facebook","instagram","twitter"];function RO(e){let t={};for(let{name:r,url:n}of e){let o=r.toLowerCase();NH.includes(o)&&(t[o]=n)}return t}u();var GH=e=>`fc_${e.slice(3)}`;function NO(e,{geometryMaps:t}){if(!e.facade)return{};let r={},n={};for(let[o,i]of pt(e.facade))if(i)for(let s of Object.values(i)){let{floorStackId:l,geometryIds:c}=s,p=GH(l);n[l]??(n[l]={id:p,spaces:[]}),n[l].spaces.push(...c.map(d=>({floorId:o,spaceId:t.space.get(d)?.ids[0]??""})))}return Object.keys(n).length>0&&(r.facade=n),r}u();function GO(e,t={}){let r={type:"FeatureCollection",features:[]},n=[];for(let o of e.floors.features)n.push({id:o.properties.id.replace(/^f_/,"m_"),externalId:o.properties.details?.externalId??"",elevation:o.properties.elevation,name:o.properties.details?.name??"",shortName:o.properties.details?.shortName??"",subtitle:o.properties.subtitle}),r.features.push({type:"Feature",geometry:o.geometry,properties:{id:o.properties.id,externalId:o.properties.details?.externalId??"",elevation:o.properties.elevation,name:o.properties.details?.name??"",shortName:o.properties.details?.shortName??"",subtitle:o.properties.subtitle}});return{"floor.geojson":r,"map.geojson":n}}u();function jO(e,{geometryMaps:t}){let r={},n={};for(let[o,i]of pt(e.floorImages??{})){let s={features:[],type:"FeatureCollection"};for(let l of i?.features??[])if("verticalOffset"in l.properties)s.features.push(l);else{let{geometryId:c,...p}=l.properties,d=t.space.get(c)?.ids[0]??t.obstruction.get(c)?.ids[0];if(!d)continue;let m={geometry:l.geometry,properties:{...p,anchorId:d},type:l.type};s.features.push(m)}n[o]=s}return Object.keys(n).length>0&&(r.floorImages=n),r}u();function UO(e,t={}){let r=[];for(let o of e?.floorStacks??[]){let i={id:o.id,floors:o.floors,maps:o.floors,externalId:o.details?.externalId??"",name:o.details?.name??"",shortName:o.details?.shortName??"",type:"Building"};o.defaultFloor&&(i.defaultFloor=o.defaultFloor),r.push(i)}if(e.outdoors){let o={id:"outdoors",floors:e.outdoors.floors,maps:e.outdoors.floors,type:"Outdoor",name:"Outdoors",externalId:"outdoors"};r.push(o)}return{"floorstack.json":r,"mapstack.geojson":r}}u();u();var $O=il(WO(),1),WH=e=>{let t=e.geometry.coordinates[0],r=0;for(let n=0;n<t.length-1;n++)r+=t[n][0]*t[n+1][1]-t[n+1][0]*t[n][1];return Math.abs(r/2)},$H=(e,t)=>{let[r,n]=e,o=t.geometry.coordinates[0],i=!1;for(let s=0,l=o.length-1;s<o.length;l=s++){let[c,p]=o[s],[d,m]=o[l];p>n!=m>n&&r<(d-c)*(n-p)/(m-p)+c&&(i=!i)}return i},zH=e=>{let t=e.geometry.coordinates[0],r=0,n=0;for(let o=0;o<t.length-1;o++)r+=t[o][0],n+=t[o][1];return{geometry:{coordinates:[r/(t.length-1),n/(t.length-1)]}}},XH=e=>{let t=WH(e),r=Number.isFinite(t)?Math.max(t,1):1;return Math.sqrt(r)*1e-6},n0=e=>{try{let r=zH(e).geometry.coordinates;if(!$H(r,e)){let o=(0,$O.default)(e.geometry.coordinates,XH(e));return ie([o[0],o[1]])}return ie(r)}catch{return ae(new Error("Unable to calculate center of polygon"))}};function MS(e){return e?.geometry?.type==="Polygon"}function zO(e,{geometryMaps:t,nodesByGeometryId:r}){let n=KH(e.defaultStyle),o={},i={},s={},l={};for(let p of rt(e.geometry)){let d=e.geometry[p];if(!d)continue;let m=[],g=[],x=[],v=[];for(let C of d.features){let I=C.properties.id,S=n.has(I),P=r.get(I)??[];for(let O of t.space.get(I)?.features??[])m.push(ZH(O,P));for(let O of t.obstruction.get(I)?.features??[])g.push(YH(O,S));for(let O of t.area.get(I)?.features??[])x.push(JH(O,P));for(let O of t.window.get(I)?.features??[])v.push(qH(O))}m.length>0&&(o[p]={type:"FeatureCollection",features:m.filter(C=>C!==null)}),g.length>0&&(i[p]={type:"FeatureCollection",features:g.filter(C=>C!==null)}),x.length>0&&(s[p]={type:"FeatureCollection",features:x.filter(C=>C!==null)}),v.length>0&&(l[p]={type:"FeatureCollection",features:v.filter(C=>C!==null)})}let c={space:o,obstruction:i};return Object.keys(s).length>0&&(c.area=s),Object.keys(l).length>0&&(c.window=l),c}function ZH(e,t){switch(e.geometry.type){case"MultiPoint":case"MultiLineString":case"MultiPolygon":return null}let r={type:"Feature",geometry:e.geometry,properties:{destinationNodes:t,id:e.properties.id,externalId:e.properties.details?.externalId??"",kind:e.properties.kind}};return e.properties.details&&(r.properties.details={name:e.properties.details.name,description:e.properties.details.description,images:e.properties.details.icon?[{url:e.properties.details.icon,altText:e.properties.details.name?`${e.properties.details.name} icon`:"icon"}]:void 0}),MS(r)&&(r.properties.center=n0(r).unwrapOr(void 0)),r}function YH(e,t){switch(e.geometry.type){case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"Point":return null}let r=e.properties,n={type:"Feature",geometry:e.geometry,properties:{id:r.id,externalId:r.details?.externalId??"",entrances:[],kind:r.kind,footprintComponent:t}};return MS(n)&&(n.properties.center=n0(n).unwrapOr(void 0)),r.details&&(n.properties.details={name:r.details.name,description:r.details.description,images:r.details.icon?[{url:r.details.icon,altText:r.details.name?`${r.details.name} icon`:"icon"}]:void 0}),n}function JH(e,t){if(e.geometry.type!=="Polygon")return null;let r=e.properties,n={type:"Feature",geometry:e.geometry,properties:{id:r.id,externalId:r.details?.externalId??"",destinationNodes:t}};return MS(n)&&(n.properties.center=n0(n).unwrapOr(void 0)),r.details&&(n.properties.details={name:r.details.name,description:r.details.description,images:r.details.icon?[{url:r.details.icon,altText:r.details.name?`${r.details.name} icon`:"icon"}]:void 0}),n}function qH(e){return e.geometry.type!=="LineString"?null:{type:"Feature",geometry:e.geometry,properties:{id:e.properties.id}}}function KH(e){let t=[...e?.ExteriorWalls?.geometryAnchors??[],...e?.Walls?.geometryAnchors??[]];return new Set(t.map(n=>n.geometryId))}u();function XO(e,{geometryMaps:t,geometryFeatureById:r}){if(!e.locationCategories&&!e.locations)return{};let n={};if(e.locationCategories?.length){let o=[];for(let i of e.locationCategories){let s={id:i.id,name:i.details.name,icon:i.details.icon??""};i.parent&&(s.parent=i.parent),o.push(s)}n["category.json"]=o}if(e.locations?.length){let o=QH(e,{geometryFeatureById:r}),i=[];for(let s of e.locations){let l={id:s.id,name:s.details.name,categories:s.categories,spaces:[],obstructions:[],areas:[],annotations:[],connections:[],entrances:[],links:s.links,openingHoursSpecification:s.openingHours??[],pictures:s.images,social:s.social,description:s.details.description,externalId:s.details.externalId,icon:s.details.icon,logo:s.logo,phone:s.phone,website:s.website};i.push(l);for(let{geometryId:c,floorId:p}of s.geometryAnchors)l.spaces.push(...t.space.get(c)?.ids.map(d=>({id:d,floor:p}))??[]),l.obstructions.push(...t.obstruction.get(c)?.ids.map(d=>({id:d,floor:p}))??[]),l.areas.push(...t.area.get(c)?.ids.map(d=>({id:d,floor:p}))??[]),l.entrances.push(...o.entrancesByGeometryId.get(c)??[]),l.connections.push(...o.connectionsByGeometryId.get(c)??[]),l.annotations.push(...o.annotationsByGeometryId.get(c)??[])}n["location.json"]=i}return n}function QH(e,{geometryFeatureById:t}){let r={annotationsByGeometryId:new Map,connectionsByGeometryId:new Map,entrancesByGeometryId:new Map};if(e.annotations)for(let[n,o]of pt(e.annotations))for(let i of o??[]){let s=i.geometryId,l=i.id,c=r.annotationsByGeometryId.get(s)??[];c.push({floor:n,id:l}),r.annotationsByGeometryId.set(s,c)}if(e.connections)for(let n of e.connections){let o=IS(n,t),i=Array.from(new Map([...n.entrances,...n.exits].map(s=>[`${s.geometryId}_${s.floorId}`,s])).values());for(let s of i){let l=s.geometryId;if(o){let c=r.entrancesByGeometryId.get(l)??[];c.push({floor:s.floorId,id:n.id}),r.entrancesByGeometryId.set(l,c)}else{let c=r.connectionsByGeometryId.get(l)??[];c.push(n.id),r.connectionsByGeometryId.set(l,c)}}}return r}u();function ZO(e,t){let r={features:[],type:"FeatureCollection"},n={"manifest.geojson":r},o=e.manifest;if(o.features.length>0){let i=o.features[0],s=i.properties,l={type:"Feature",geometry:i.geometry,properties:{folder_struct:[],version:"2.0.0",time:s.time,name:s.name,naturalBearing:s.naturalBearing,tzid:s.tzid,map:s.mapId,org_id:s.orgId,language:s.language}};r.features.push(l)}return n}u();function YO(e,{geometryMaps:t,navigationFlags:r,incomingEdgesByNodeId:n}){let o={"node.geojson":{type:"FeatureCollection",features:[]}},i=o["node.geojson"].features,s=new Map;for(let p of e.floors?.features??[])s.set(p.properties.id,p.properties.elevation);let l=new Map;for(let p of Object.values(e.nodes??{}))for(let d of p?.features??[])for(let m of d.properties.geometryIds)l.set(m,[...l.get(m)??[],d.properties.id]);let c=new Map;for(let p of e.connections??[]){let d=p.exits.map(m=>({...m,nodes:l.get(m.geometryId)??[]}));for(let m of p.entrances){let g=l.get(m.geometryId)??[];for(let x of g)for(let v of d){let C=Math.abs((s.get(m.floorId)??0)-(s.get(v.floorId)??0))*p.floorCostMultiplier,I=c.get(x)??[];I.push(...v.nodes.map(S=>({id:S,weight:C+p.entryCost}))),c.set(x,I)}}}for(let[p,d]of pt(e.nodes??{}))for(let m of d?.features??[]){let g=t.space.get(m.properties.geometryIds[0])?.features[0],x=g?.geometry.type==="Point"&&g?.properties.details?.externalId?g.properties.details.externalId:"",v=n.get(m.properties.id)??[],C=Object.keys(r??{}),I=[];for(let P of v)for(let O of C)Il(P,r[O])&&I.push(r[O]);let S={type:"Feature",geometry:m.geometry,properties:{id:m.properties.id,floor:p,space:m.properties.geometryIds.map(P=>t.space.get(P)?.ids).flat().filter(P=>P!==void 0),neighbors:[...m.properties.neighbors.map(P=>({id:P.id,weight:P.extraCost})),...c.get(m.properties.id)??[]],map:p,externalId:x,flags:I.length>0?eW(I):void 0}};i.push(S)}return o}function eW(e){if(e==null||e.length===0)return;let t=new Array(Math.max(...e.map(r=>r.index))+1).fill(0);for(let r of e)t[r.index]|=1<<r.bit;return t}u();function tW(e,t){let r={};for(let n of e){let o=t.get(n);o&&(r[o]??(r[o]=[]),r[o].push(n))}return r}function JO(e,{geometryMaps:t}){if(!e.defaultStyle)return{};let r={},n={};r["styles.json"]=n;let o=[...Array.from(t.space.values()).map(s=>s.features),...Array.from(t.obstruction.values()).map(s=>s.features)],i=new Map(o.flatMap(s=>s.map(l=>[l.properties.id,l.geometry.type])));for(let[s,l]of pt(e.defaultStyle)){let c=tW(l.geometryAnchors.flatMap(p=>[...t.space.get(p.geometryId)?.ids??[],...t.obstruction.get(p.geometryId)?.ids??[]]),i);if(c.Point&&c.Point.length>0){let p={points:Array.from(c.Point.values()),showImage:l.extra?.showImage!==void 0?l.extra?.showImage===!0:l.opacity!==0};n[`${s}.Point`]=p}if(c.LineString&&c.LineString.length>0){let p={lineStrings:Array.from(c.LineString.values()),altitude:l.altitude,color:l.color,height:l.height,opacity:l.opacity,width:l.buffer};n[`${s}.LineString`]=p}if(c.Polygon&&c.Polygon.length>0){let p={polygons:Array.from(c.Polygon.values()),altitude:l.altitude,color:l.color,height:l.height,opacity:l.opacity};l.extra?.showImage!==void 0&&(p.showImage=l.extra.showImage===!0),n[`${s}.Polygon`]=p}}return r}var rW=kw().extendOptional(L7).extendOptional(yO).extendOptional(V7).extendOptional(uO).extendOptional(_O).extendOptional(z7).extendOptional(q7).extendOptional(IO).extendOptional(TO).extendOptional(aO).extendOptional(eO).extendOptional(Bw).extendOptional(zw).extendOptional(E7).build({cspSafe:!0}).expect("Invalid parser, this should never happen. Likely a bug in the MVFv2 library, or one of the extensions.");function qO(e){let t=kO(e),r=GO(e,t),n=zO(e,t),o=YO(e,t),i=LO(e,t),s=JO(e,t),l=UO(e,t),c=jO(e,t),p=NO(e,t),d=AO(e,t),m=XO(e,t),g=BO(e,t),x=ZO(e,t);return{...r,...n,...o,...i,...s,...l,"tileset.json":e.tileset,...c,...p,...d,...m,...g,...x}}function PS(e){let t=rW.decompressUnsafeSync(e);return t.isOk()?ie(qO(t.value)):ae(t.error)}u();function dd(e){return e.endsWith("/")?e:`${e}/`}u();var fd="https://app.mappedin.com/",KO="https://auth.mappedin.com/";u();u();var nW=e=>{let t=Date.now();return e-t},o0=(e,t)=>nW(e)<=t*60*1e3;var e6=60,t6=e6*60*1e3,QO="accessTokens";async function yh(e,t=!1){let r=`${e.key}`,n=Zs.getInstance(),o=n?.loadSessionData(QO)||{},i=Math.floor(Date.now()/1e3);if(o[r]&&!o0(o[r].expiresTimestamp*1e3,e6))return o[r];let s=t?await oW(e,i):await iW(e,i),l={...o,[r]:s};return n?.saveSessionData(QO,l),s}async function oW(e,t){let r=`${e.baseAuthUri??KO}oauth2/token`,n=await vi()(r,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({grant_type:"client_credentials",client_id:e.key,client_secret:e.secret})});if(!n.ok)throw new Error(`${n.status} ${n.statusText}: ${await n.text()}`);let o=await n.json();return{accessToken:o.access_token,expiresTimestamp:t+o.expires_in}}async function iW(e,t){let r=`${e.baseAuthUri?dd(e.baseAuthUri):fd}api/v1/api-key/token`,n=await vi()(r,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:e.key,secret:e.secret})});if(!n.ok)throw new Error(`${n.status} ${n.statusText}: ${await n.text()}`);let o=await n.json();return{accessToken:o.access_token,expiresTimestamp:t+o.expires_in}}u();var n6=60,o6=n6*60*1e3,r6="miSasTokens";async function wS(e,t){let r=`${t}__${e.mapId}`,n=Zs.getInstance(),o=n?.loadSessionData(r6)||{};if(o[r]&&!o0(o[r].expires,n6))return o[r];let i=await sW(e,t),s={...o,[r]:{token:i.token,expires:new Date(i.expires).getTime()}};return n?.saveSessionData(r6,s),i}async function sW(e,t){let r=`${e.baseUri?dd(e.baseUri):fd}api/v1/venue/${e.mapId}/sas-token`,n=await vi()(r,{method:"GET",headers:{Authorization:`Bearer ${t}`}});if(!n.ok)throw new Error(`${n.status} ${n.statusText}: ${await n.text()}`);let o=await n.json();return{token:o.token,expires:new Date(o.expires).getTime()}}var i6=globalThis.fetch,aW=y?.env?.npm_package_version;function vi(){if(i6==null)throw new Error("fetch is not available in your environment. Pass your own function into `setFetchFn` (node-fetch, etc)");return i6}var OS={supplementaryUrl:"https://api-gateway.mappedin.com/analytics/",headers:{},accessToken:"",clientId:"",noAuth:!1,includeHidden:!0,clientSecret:"",apiGateway:"",authorization:"",perspective:"Website",language:"",venue:""};function a6(e){let t={...OS,...e};return t.headers={...t.headers,"mappedin-sdk-version":aW},t.things=[],"platformString"in e&&(t.headers={...t.headers,"mappedin-platform-version":e.platformString}),t.noAuth||(t.accessToken?t.authorization=`Bearer ${t.accessToken}`:t.clientId&&t.clientSecret&&(t.authorization=`Basic ${globalThis.btoa(`${t.clientId}:${t.clientSecret}`)}`)),t.language=t.language?.toLowerCase(),t}function lW(e,t,r=!1){let n={language:e.language,clientId:e.clientId,clientSecret:e.clientSecret};r&&delete n.language;let{headers:o}=e;o["Content-Type"]=o["Content-Type"]||"text/json",e.accessToken?o.Authorization=`Bearer ${e.accessToken}`:e.noAuth||e.clientId&&e.clientSecret&&(o["x-mappedin-key"]=btoa(e.clientId),o["x-mappedin-secret"]=btoa(e.clientSecret));let i={method:"GET",headers:o};return e.secure&&(t+="&withcdntoken"),{req:i,url:t}}async function cW(e,t,r=!1){let n=lW(e,t,r),o=await vi()(n.url,n.req);if(!o.ok)throw new Error(`${o.status} ${o.statusText}`);return o.json()}var pW=e=>{let t=e!=null&&typeof e=="object"&&"perspectives"in e&&e.perspectives!=null&&typeof e.perspectives=="object"?e.perspectives:null;if(t==null||Object.keys(t).length===0)return A.warn("No perspectives available in response!"),null;let r={};for(let[n,o]of Object.entries(t)){let i="url"in o&&typeof o.url=="string"?o.url:null,s="locale_packs"in o&&typeof o.locale_packs=="object"?o.locale_packs:null;if(i==null||s==null){A.warn(`Perspective ${n} is missing url or locale_packs!`);continue}r[n]={url:i,locale_packs:s}}return r};async function uW(e,t="exports/mvf/1/bundle"){let r=a6({baseUri:"https://api-gateway.mappedin.com/",...OS,...e}),n=`${r.baseUri+t}?venue=${r.venue}&version=${r.version??"2.0.0"}`;r.headers["Content-Type"]="application/zip";let o=await cW(r,n),i=o.url,s=o.locale_packs,l=r.perspective??OS.perspective,c=pW(o);if(l!=null&&l!==""&&c!=null){let p=c[l];p==null?A.warn(`Perspective ${l} not found in response! Loading default perspective instead.`):(A.log(`Loading perspective "${l}"`),i=p.url,s=p.locale_packs)}return{url:i,localePacks:s,updated_at:o.updated_at}}var md=function(){let e;return()=>(e||(e=new TextDecoder),e)}();async function _S(e,{signal:t}){let r=await(await vi()(e,{signal:t})).arrayBuffer();return new Uint8Array(r)}async function hd(e){let r=(await import("./browser-I5Q2RPA3.js")).unzipSync(e),n={};if(r["enterprise/"]!=null){n.enterprise={};let o=r["enterprise/locations.json"];o&&(n.enterprise.locations=JSON.parse(md().decode(o)));let i=r["enterprise/locationInstances.json"];i&&(n.enterprise.locationInstances=JSON.parse(md().decode(i)));let s=r["enterprise/categories.json"];s&&(n.enterprise.categories=JSON.parse(md().decode(s)))}return r["floorstack.json"]&&(n["floorstack.json"]=JSON.parse(md().decode(r["floorstack.json"]))),r["floor.geojson"]&&(n["floor.geojson"]=JSON.parse(md().decode(r["floor.geojson"]))),r["manifest.json"]&&(n["manifest.geojson"]=JSON.parse(md().decode(r["manifest.json"]))),n}async function l6(e,{signal:t}){try{let r=await(await vi()(e,{signal:t})).arrayBuffer();if(t.aborted)return;let n=new Uint8Array(r);return await hd(n)}catch(r){let n=new Error("downloadLanguagePack failed");throw n.cause=r,n}}function dW(e){let{mvfVersion:t,useDraftData:r}=e;if(t==="3.0.0")return r?"exports/mvf3-draft/1/bundle":"exports/mvf3/1/bundle";if(t==null||t==="2.0.0")return r?"exports/mvf2-draft/1/bundle":"exports/mvf2/1/bundle";if(t==="2.0.0-c")return r?"exports/mvf2c-draft/1/bundle":"exports/mvf2c/1/bundle";throw new Error(`Unsupported MVF version: ${t}`)}async function ES(e){return new Promise(async(t,r)=>{try{let n=dW(e),{url:o,localePacks:i}=await uW(e,n),s=await vi()(o).then(c=>c.arrayBuffer()),l=new Uint8Array(s);t({compressed:l,localePacks:i})}catch(n){r(n)}})}async function DS(e,t){return new Promise(async(r,n)=>{try{let{url:o}=await fW(e,t),i=await vi()(o).then(l=>l.arrayBuffer()),s=new Uint8Array(i);r(s)}catch(o){n(o)}})}async function fW(e,t){let r=new URL(`${e.baseUri?dd(e.baseUri):fd}api/v1/venue/${e.mapId}/mvf`);e.viewId&&r.searchParams.set("configId",e.viewId),e.mvfVersion&&r.searchParams.set("version",e.mvfVersion);let n=await vi()(r.toString(),{headers:{Authorization:`Bearer ${t}`}});if(!n.ok)throw new Error(`${n.status} ${n.statusText}`);return n.json()}function FS(e){let t=new TextDecoder,r=t.decode.bind(t);try{let n={"connection.json":JSON.parse(r(e["connection.json"])),"manifest.geojson":JSON.parse(r(e["manifest.geojson"])),"map.geojson":e["map.geojson"]?JSON.parse(r(e["map.geojson"])):void 0,"mapstack.geojson":e["mapstack.geojson"]?JSON.parse(r(e["mapstack.geojson"])):void 0,"node.geojson":JSON.parse(r(e["node.geojson"])),obstruction:{},space:{},entrance:{},facade:{},"tileset.json":e["tileset.json"]?JSON.parse(r(e["tileset.json"])):void 0,"navigationFlags.json":e["navigationFlags.json"]?JSON.parse(r(e["navigationFlags.json"])):void 0};if(e.enterprise!=null&&(n.enterprise={},e.enterprise?.["locations.json"]&&(n.enterprise.locations=JSON.parse(r(e.enterprise?.["locations.json"]))),e.enterprise?.["categories.json"]&&(n.enterprise.categories=JSON.parse(r(e.enterprise?.["categories.json"]))),e.enterprise?.["venue.json"]&&(n.enterprise.venue=JSON.parse(r(e.enterprise?.["venue.json"]))),e.enterprise?.["layers.json"]&&(n.enterprise.layers=JSON.parse(r(e.enterprise?.["layers.json"]))),e.enterprise?.["locationInstances.json"]&&(n.enterprise.locationInstances=JSON.parse(r(e.enterprise?.["locationInstances.json"]))),e.enterprise?.["enterpriseStyles.json"]&&(n.enterprise.enterpriseStyles=JSON.parse(r(e.enterprise?.["enterpriseStyles.json"]))),e.enterprise?.["textures.json"]&&(n.enterprise.textures=JSON.parse(r(e.enterprise?.["textures.json"]))),e.enterprise?.["floorText.json"]&&(n.enterprise.floorText=JSON.parse(r(e.enterprise?.["floorText.json"]))),e.enterprise?.["categoryPriorities.json"]&&(n.enterprise.categoryPriorities=JSON.parse(r(e.enterprise?.["categoryPriorities.json"])))),e["floorstack.json"]!=null?n["floorstack.json"]=JSON.parse(r(e["floorstack.json"])):e["mapstack.json"]!=null&&(n["mapstack.json"]=JSON.parse(r(e["mapstack.json"]))),n["floorstack.json"]==null&&n["mapstack.json"]==null&&n["mapstack.geojson"]==null)throw new Error("MVF is missing floorstack.json or mapstack.json/mapstack.geojson");if(e["floor.geojson"]&&(n["floor.geojson"]=JSON.parse(r(e["floor.geojson"]))),n["floor.geojson"]==null&&n["map.geojson"]==null)throw new Error("MVF is missing floor.geojson or map.geojson");if("styles.json"in e&&(n["styles.json"]=JSON.parse(r(e["styles.json"]))),"shapes.json"in e&&(n["shapes.json"]=JSON.parse(r(e["shapes.json"]))),"location.json"in e&&(n["location.json"]=JSON.parse(r(e["location.json"]))),"category.json"in e&&(n["category.json"]=JSON.parse(r(e["category.json"]))),e.annotation!=null){n.annotation={};let i=Object.keys(e.annotation);for(let s of i){let l=s.replace(/\.json|\.geojson/g,"");n.annotation[l]=JSON.parse(r(e.annotation[s]))}}let o=Object.keys(e.space);for(let i of o){let s=i.replace(/\.json|\.geojson/g,"");n.space[s]=JSON.parse(r(e.space[i]))}if(e.obstruction!=null){let i=Object.keys(e.obstruction);for(let s of i){let l=s.replace(/\.json|\.geojson/g,"");n.obstruction[l]=JSON.parse(r(e.obstruction[s]))}}else n.obstruction={};if(e.entrance!=null){let i=Object.keys(e.entrance);for(let s of i){let l=s.replace(/\.json|\.geojson/g,"");n.entrance[l]=JSON.parse(r(e.entrance[s]))}}else n.entrance={};if("floorImages"in e&&e.floorImages!=null){n.floorImages={};for(let i of Object.keys(e.floorImages)){let s=i.replace(/\.json|\.geojson/g,"");n.floorImages[s]=JSON.parse(r(e.floorImages[i]))}}if("textAreas"in e&&e.textAreas!=null){n.textAreas={};for(let i of Object.keys(e.textAreas)){let s=i.replace(/\.json|\.geojson/g,"");n.textAreas[s]=JSON.parse(r(e.textAreas[i]))}}if("facade"in e&&e.facade!=null){n.facade={};for(let i of Object.keys(e.facade)){let s=i.replace(/\.json|\.geojson/g,"");n.facade[s]=JSON.parse(r(e.facade[i]))}}if("area"in e&&e.area!=null){n.area={};for(let i of Object.keys(e.area)){let s=i.replace(/\.json|\.geojson/g,"");n.area[s]=JSON.parse(r(e.area[i]))}}return n}catch(n){throw A.error(n),new Error("MVF parsing failed! Probably encountered a bad file.")}}function mW(e){if(e==null||typeof e!="object")return!1;let t=["connection.json","manifest.geojson","floor.geojson"in e?"floor.geojson":"map.geojson","node.geojson","floorstack.json"in e?"floorstack.json":"mapstack.json"in e?"mapstack.json":"mapstack.geojson"];"styles.json"in e&&t.push("styles.json"),"shapes.json"in e&&t.push("shapes.json");for(let r of t)if(e[r]==null||e[r][Symbol.toStringTag]!=="Uint8Array")return!1;return!0}async function kS(e){return new Promise(async(t,r)=>{try{if(e==null||typeof e!="object")throw new Error("Error parsing data! Unzipping failed.");if(e[Symbol.toStringTag]!=="Uint8Array")throw new Error("Unexpected file type! Unzipping failed.");let o=(await import("./browser-I5Q2RPA3.js")).unzipSync(e);if(!mW(o))throw new Error("MVF is missing some expect static files. Unzipping failed.");let i={},s=Object.keys(o);for(let l of s){if(o[l].length===0)continue;let c=l.split("/");if(c.length<0)throw new Error("Encounted a file with no name! Unzipping failed.");if(c.length>2)throw new Error("Encountered unexpected nesting in MVF! Unzipping failed.");if(c.length===1){i[c[0]]=o[l];continue}if(c[0]==="image"){A.warn("MVF unzipping encountered an image. Ignoring as this case has not been implemented.");continue}else i[c[0]]==null&&(i[c[0]]={}),i[c[0]][c[1]]=o[l]}t(i)}catch(n){r(n)}})}function Cl(){let e="us",t={};function r(){return xW(IW(e),t)}return{updateByUserOption(n){n.environment&&(e=n.environment),n.baseUri&&(t.baseUri=n.baseUri),n.baseAuthUri&&(t.baseAuthUri=n.baseAuthUri),n.analytics?.baseUri&&(t.analyticsBaseUri=n.analytics?.baseUri)},updateTileServerBaseUrl(n){t.tileServerUri=n},updateEnvironment(n){e=n},setEnterprise(n){(e==="us"||e==="us-enterprise")&&(e=n?"us-enterprise":"us")},getBaseUri(){return r().baseUri},getBaseAuthUri(){return r().baseAuthUri},getAnalyticsBaseUri(){return r().analyticsBaseUri},getTileServerUri(){return r().tileServerUri},reset(){e="us",t={}},__getState:r}}var c6=Object.freeze({baseUri:"https://app.mappedin.com/",baseAuthUri:"https://app.mappedin.com/",analyticsBaseUri:"https://api-gateway.mappedin.com/track-analytics/a/",tileServerUri:"https://tiles-cdn.mappedin.com/styles/mappedin/style.json"}),hW=Object.freeze({...c6,baseUri:"https://api-gateway.mappedin.com/",baseAuthUri:"https://auth.mappedin.com/"}),gW=Object.freeze({baseUri:"https://api-gateway.eu.mappedin.com/",baseAuthUri:"https://auth.eu.mappedin.com/",analyticsBaseUri:"https://api-gateway.eu.mappedin.com/track-analytics/a/",tileServerUri:"https://tiles-cdn.eu.mappedin.com/styles/mappedin/style.json"}),yW=Object.freeze({baseUri:"https://api-gateway-staging.mappedin.net/",baseAuthUri:"https://auth-staging.mappedin.net/",analyticsBaseUri:"https://api-gateway-staging.mappedin.net/track-analytics/a/",tileServerUri:"https://tiles-cdn.mappedin.com/styles/mappedin/style.json"}),bW=Object.freeze({baseUri:"https://app-staging.mappedin.net/",baseAuthUri:"https://app-staging.mappedin.net/",analyticsBaseUri:"https://api-gateway-staging.mappedin.net/track-analytics/a/",tileServerUri:"https://tiles-cdn.mappedin.com/styles/mappedin/style.json"});function xW(e,t){return{...e,...t}}var vW={eu:gW,us:c6,"us-enterprise":hW,"us-staging-enterprise":yW,"us-staging-self-serve":bW};function IW(e){return vW[e]}var i0=e=>{let t=Object.values(e["floorstack.json"]??e["mapstack.json"]??{});return t.length===1?[]:t.filter(r=>r.type!=="Outdoor").map(r=>r.id.replace("fs_","").replace("ms_",""))},s6=async e=>{let t=performance.now(),r=PS(e);return A.log(`Parsed MVFv3 in ${performance.now()-t}ms`),r.inspectErr(o=>{throw A.error(o),new Error("MVFv3 parsing failed!")}),r.unwrap()};async function s0(e,t="2.0.0"){switch(t){case"2.0.0":case"2.0.0-c":try{let r=await kS(e);return FS(r)}catch{return s6(e)}case"3.0.0":return s6(e);default:throw new Error(`Unsupported MVF version: ${t}`)}}u();u();u();function Ro(e){if(!e)throw new Error("coord is required");if(!Array.isArray(e)){if(e.type==="Feature"&&e.geometry!==null&&e.geometry.type==="Point")return e.geometry.coordinates;if(e.type==="Point")return e.coordinates}if(Array.isArray(e)&&e.length>=2&&!Array.isArray(e[0])&&!Array.isArray(e[1]))return e;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function fo(e){if(Array.isArray(e))return e;if(e.type==="Feature"){if(e.geometry!==null)return e.geometry.coordinates}else if(e.coordinates)return e.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function gd(e){return e.type==="Feature"?e.geometry:e}function p6(e,t){return e.type==="FeatureCollection"?"FeatureCollection":e.type==="GeometryCollection"?"GeometryCollection":e.type==="Feature"&&e.geometry!==null?e.geometry.type:e.type}function SW(e,t,r){r===void 0&&(r={});for(var n=Ro(e),o=fo(t),i=0;i<o.length-1;i++){var s=!1;if(r.ignoreEndVertices&&(i===0&&(s="start"),i===o.length-2&&(s="end"),i===0&&i+1===o.length-1&&(s="both")),CW(o[i],o[i+1],n,s,typeof r.epsilon>"u"?null:r.epsilon))return!0}return!1}function CW(e,t,r,n,o){var i=r[0],s=r[1],l=e[0],c=e[1],p=t[0],d=t[1],m=r[0]-l,g=r[1]-c,x=p-l,v=d-c,C=m*v-g*x;if(o!==null){if(Math.abs(C)>o)return!1}else if(C!==0)return!1;if(n){if(n==="start")return Math.abs(x)>=Math.abs(v)?x>0?l<i&&i<=p:p<=i&&i<l:v>0?c<s&&s<=d:d<=s&&s<c;if(n==="end")return Math.abs(x)>=Math.abs(v)?x>0?l<=i&&i<p:p<i&&i<=l:v>0?c<=s&&s<d:d<s&&s<=c;if(n==="both")return Math.abs(x)>=Math.abs(v)?x>0?l<i&&i<p:p<i&&i<l:v>0?c<s&&s<d:d<s&&s<c}else return Math.abs(x)>=Math.abs(v)?x>0?l<=i&&i<=p:p<=i&&i<=l:v>0?c<=s&&s<=d:d<=s&&s<=c;return!1}var u6=SW;u();function TW(e,t){t===void 0&&(t={});var r=hu(e),n=(r[0]+r[2])/2,o=(r[1]+r[3])/2;return qi([n,o],t.properties,t)}var yd=TW;u();u();function MW(e,t,r){r===void 0&&(r={});var n=Ro(e),o=Ro(t),i=Rn(o[1]-n[1]),s=Rn(o[0]-n[0]),l=Rn(n[1]),c=Rn(o[1]),p=Math.pow(Math.sin(i/2),2)+Math.pow(Math.sin(s/2),2)*Math.cos(l)*Math.cos(c);return y5(2*Math.atan2(Math.sqrt(p),Math.sqrt(1-p)),r.units)}var Tl=MW;function a0(e,t){return t===void 0&&(t={}),v5(e,function(r,n){var o=n.geometry.coordinates;return r+Tl(o[0],o[1],t)},0)}u();u();u();function l0(e,t,r){if(r===void 0&&(r={}),r.final===!0)return PW(e,t);var n=Ro(e),o=Ro(t),i=Rn(n[0]),s=Rn(o[0]),l=Rn(n[1]),c=Rn(o[1]),p=Math.sin(s-i)*Math.cos(c),d=Math.cos(l)*Math.sin(c)-Math.sin(l)*Math.cos(c)*Math.cos(s-i);return vm(Math.atan2(p,d))}function PW(e,t){var r=l0(t,e);return r=(r+180)%360,r}u();function Bc(e,t,r,n){n===void 0&&(n={});var o=Ro(e),i=Rn(o[0]),s=Rn(o[1]),l=Rn(r),c=b5(t,n.units),p=Math.asin(Math.sin(s)*Math.cos(c)+Math.cos(s)*Math.sin(c)*Math.cos(l)),d=i+Math.atan2(Math.sin(l)*Math.sin(c)*Math.cos(s),Math.cos(c)-Math.sin(s)*Math.sin(p)),m=vm(d),g=vm(p);return qi([m,g],n.properties)}u();u();function wW(e){if(!e)throw new Error("geojson is required");var t=[];return Ki(e,function(r){OW(r,t)}),bc(t)}function OW(e,t){var r=[],n=e.geometry;if(n!==null){switch(n.type){case"Polygon":r=fo(n);break;case"LineString":r=[fo(n)]}r.forEach(function(o){var i=_W(o,e.properties);i.forEach(function(s){s.id=t.length,t.push(s)})})}}function _W(e,t){var r=[];return e.reduce(function(n,o){var i=Ys([n,o],t);return i.bbox=EW(n,o),r.push(i),o}),r}function EW(e,t){var r=e[0],n=e[1],o=t[0],i=t[1],s=r<o?r:o,l=n<i?n:i,c=r>o?r:o,p=n>i?n:i;return[s,l,c,p]}var AS=wW;var _6=il(w6(),1);function n$(e,t){var r={},n=[];if(e.type==="LineString"&&(e=Qv(e)),t.type==="LineString"&&(t=Qv(t)),e.type==="Feature"&&t.type==="Feature"&&e.geometry!==null&&t.geometry!==null&&e.geometry.type==="LineString"&&t.geometry.type==="LineString"&&e.geometry.coordinates.length===2&&t.geometry.coordinates.length===2){var o=O6(e,t);return o&&n.push(o),bc(n)}var i=(0,_6.default)();return i.load(AS(t)),e2(AS(e),function(s){e2(i.search(s),function(l){var c=O6(s,l);if(c){var p=fo(c).join(",");r[p]||(r[p]=!0,n.push(c))}})}),bc(n)}function O6(e,t){var r=fo(e),n=fo(t);if(r.length!==2)throw new Error("<intersects> line1 must only contain 2 coordinates");if(n.length!==2)throw new Error("<intersects> line2 must only contain 2 coordinates");var o=r[0][0],i=r[0][1],s=r[1][0],l=r[1][1],c=n[0][0],p=n[0][1],d=n[1][0],m=n[1][1],g=(m-p)*(s-o)-(d-c)*(l-i),x=(d-c)*(i-p)-(m-p)*(o-c),v=(s-o)*(i-p)-(l-i)*(o-c);if(g===0)return null;var C=x/g,I=v/g;if(C>=0&&C<=1&&I>=0&&I<=1){var S=o+C*(s-o),P=i+C*(l-i);return qi([S,P])}return null}var xd=n$;function o$(e,t,r){r===void 0&&(r={});var n=qi([1/0,1/0],{dist:1/0}),o=0;return Ki(e,function(i){for(var s=fo(i),l=0;l<s.length-1;l++){var c=qi(s[l]);c.properties.dist=Tl(t,c,r);var p=qi(s[l+1]);p.properties.dist=Tl(t,p,r);var d=Tl(c,p,r),m=Math.max(c.properties.dist,p.properties.dist),g=l0(c,p),x=Bc(t,m,g+90,r),v=Bc(t,m,g-90,r),C=xd(Ys([x.geometry.coordinates,v.geometry.coordinates]),Ys([c.geometry.coordinates,p.geometry.coordinates])),I=null;C.features.length>0&&(I=C.features[0],I.properties.dist=Tl(t,I,r),I.properties.location=o+Tl(c,I,r)),c.properties.dist<n.properties.dist&&(n=c,n.properties.index=l,n.properties.location=o),p.properties.dist<n.properties.dist&&(n=p,n.properties.index=l+1,n.properties.location=o+d),I&&I.properties.dist<n.properties.dist&&(n=I,n.properties.index=l),o+=d}}),n}var xh=o$;function i$(e,t,r){var n=fo(r);if(p6(r)!=="LineString")throw new Error("line must be a LineString");var o=xh(r,e),i=xh(r,t),s;o.properties.index<=i.properties.index?s=[o,i]:s=[i,o];for(var l=[s[0].geometry.coordinates],c=s[0].properties.index+1;c<s[1].properties.index+1;c++)l.push(n[c]);return l.push(s[1].geometry.coordinates),Ys(l,r.properties)}var XS=i$;var s$=1e-7;function ZS(e){return{type:"Point",coordinates:e}}function a$(e,t){let{coordinates:r}=t.geometry,{coordinates:n}=e.geometry,o=r.map(i=>xh(e,ZS(i)));return n.reduce((i,s)=>{let l=XS(ZS(s),o[0],e),c=XS(ZS(s),o[1],e),p=a0(l)<a0(c)?l:c;return p.properties={...e.properties,entrances:[]},i.concat([p])},[])}function YS(e,t){return t.reduce((r,n)=>{let o={epsilon:s$},i=r.obstructions.findIndex(l=>u6(yd(n),l,o)),s=r.obstructions[i];if(s){let[l,c]=a$(s,n);r.entrances.push(n),r.obstructions.splice(i,1,l,c)}return r},{obstructions:[e],entrances:[]})}u();u();u();var Or=class{constructor(t){f(this,"id");this.id=t}};u();u();var vd=class vd{constructor(t,r,n){f(this,"__type",vd.__type);f(this,"id",dt());f(this,"latitude");f(this,"longitude");f(this,"floorId");f(this,"verticalOffset");if(typeof t=="object")this.latitude=t.latitude,this.longitude=t.longitude,this.floorId=t.floorId,this.verticalOffset=t.verticalOffset??0;else{if(r==null)throw new Error("Coordinate longitude is required.");this.latitude=t,this.longitude=r,this.floorId=n,this.verticalOffset=0}}static is(t){return t.__type===vd.__type}get anchorTarget(){return this}get focusTarget(){return this}isEqual(t){return this.latitude===t.latitude&&this.longitude===t.longitude&&this.floorId===t.floorId}toJSON(){return{__type:vd.__type,latitude:this.latitude,longitude:this.longitude,floorId:this.floorId,verticalOffset:this.verticalOffset}}destroy(){}};f(vd,"__type","coordinate");var JS=vd,ge=JS;function qS(e){let t=e.enterprise?.locations?.reduce((o,i)=>(o[i.id]=i,o),{})||{};for(let o of e.enterprise?.locationInstances||[])t[o.id]=o;let r={};for(let o of e["floorstack.json"]||[])r[o.id]=o;let n={};for(let o of e["floor.geojson"]?.features||[])o.properties&&o.properties.id&&(n[o.properties.id]=o.properties);return{type:"downloaded",data:e,optimized:{"enterprise-location":t,"enterprise-category":e.enterprise?.categories?.reduce((o,i)=>(o[i.id]=i,o),{})||{},"floor-stack":r,floor:n}}}function E6(e){return/^https?:\/\/cdn\.mappedin\.com/.test(e)}function D6(e){return!!e.split("?")[1]?.includes("sv=")}function Vr(e,t){let r=e?.properties?.id||"unknown";if(e.geometry==null)return A.error(`Cannot get the center coordinate for "${r}" because it has no geometry.`),new ge({latitude:0,longitude:0,floorId:t});try{if(e.geometry.type==="LineString"){let[[n,o],[i,s]]=e.geometry.coordinates,l=(n+i)/2,c=(o+s)/2;return new ge({latitude:c,longitude:l,floorId:t})}else if(e.geometry.type==="Point"){let[n,o]=e.geometry.coordinates;return new ge({latitude:o,longitude:n,floorId:t})}else if(e.geometry.type==="Polygon"){let n=e;if(n.properties.center!=null){let[o,i]=n.properties.center;return new ge({latitude:i,longitude:o,floorId:t})}}}catch{}try{let[n,o]=yd(e).geometry.coordinates;return new ge({latitude:o,longitude:n,floorId:t})}catch(n){return A.error(`Failed to get center coordinate for "${r}" ${n instanceof Error?n.stack:""}`),new ge({latitude:0,longitude:0,floorId:t})}}function F6(e,t){return t&&(e.flags[t.index]&1<<t.bit)!==0}var Ii,Hr,Nc,ga,Id=class Id extends Or{constructor(r,n){super(n.mvfData.properties.id);f(this,"__type",Id.__type);T(this,Ii);T(this,Hr,{});T(this,Nc);T(this,ga);w(this,Ii,r),w(this,Nc,n.floorId),w(this,ga,n.mvfData)}static is(r){return r.__type===Id.__type}get locations(){return a(this,Hr).locations?a(this,Hr).locations:(a(this,Hr).locations=(a(this,Ii).locationIdsByNodeId[this.id]||[]).map(r=>a(this,Ii).getById("enterprise-location",r)).filter(Boolean),a(this,Hr).locations)}get space(){return a(this,Ii).getById("space",a(this,Ii).spaceIdsByNodeId[this.id]?.[0])}get floor(){let r=a(this,Ii).getById("floor",a(this,Nc));if(r==null)throw new Error(`Floor ${a(this,Nc)} not found!`);return r}get coordinate(){return a(this,Hr).coordinate==null&&(a(this,Hr).coordinate=Vr(a(this,ga),a(this,Nc))),a(this,Hr).coordinate}get externalId(){return a(this,ga).properties.externalId??""}get neighbors(){if(a(this,Hr).neighbors==null){let r=a(this,ga).properties.neighbors.map(n=>{let o=a(this,Ii).getById("node",n.id);if(o==null)throw new Error(`Node ${n.id} not found!`);return o});a(this,Hr).neighbors=r}return a(this,Hr).neighbors}get navigationFlags(){if(a(this,Hr).navigationFlags==null){let r=[],n=a(this,ga).properties.flags;if(n!=null&&n.length>0)for(let[o,i]of Object.entries(a(this,Ii).navigationFlags))n.length>i.index&&n[i.index]!=null&&F6({flags:n},i)&&r.push(o);a(this,Hr).navigationFlags=Object.freeze(r)}return a(this,Hr).navigationFlags}get geoJSON(){return{...a(this,ga),properties:null}}get focusTarget(){return this.coordinate}get anchorTarget(){return this.coordinate}toJSON(){return{__type:Id.__type,id:this.id,floor:this.floor.id,coordinate:this.coordinate.toJSON(),neighbors:this.neighbors.map(r=>r.id)}}destroy(){for(let r of Object.keys(a(this,Hr)))delete a(this,Hr)[r]}};Ii=new WeakMap,Hr=new WeakMap,Nc=new WeakMap,ga=new WeakMap,f(Id,"__type","node");var KS=Id,Bo=KS;u();u();u();u();var vh,ya,Sd=class Sd extends Or{constructor(r){super(String(dt()));f(this,"__type",Sd.__type);T(this,vh,{});T(this,ya);w(this,ya,r.mvfData)}static is(r){return r.__type===Sd.__type}get url(){return a(this,ya).url}get name(){if("displayName"in a(this,ya))return a(this,ya).displayName;if("label"in a(this,ya))return a(this,ya).label}toJSON(){return{__type:Sd.__type,id:this.id,url:this.url,name:this.name}}destroy(){for(let r of globalThis.Object.keys(a(this,vh)))delete a(this,vh)[r]}};vh=new WeakMap,ya=new WeakMap,f(Sd,"__type","hyperlink");var QS=Sd,Gc=QS;u();u();function Ih(e){return typeof e=="string"?e:e.id}function t3(e){return Array.isArray(e)&&Number.isFinite(e[0])&&Number.isFinite(e[1])}var e3=8,gs=e=>typeof e=="number"?e.toFixed(e3):t3(e)?e[1].toFixed(e3)+"-"+e[0].toFixed(e3):e.map(t=>gs(t)).join("-"),l$=e=>{let t=/^https:\/\/cdn\.mappedin\.com\/[^/]+\/[^/]+\.[a-zA-Z0-9]+$/,r=/^https:\/\/cdn-staging\.mappedin\.net\/[^/]+\/[^/]+\.[a-zA-Z0-9]+$/;return t.test(e)||r.test(e)},d0=e=>{if(!l$(e))return null;let t="";e.startsWith("https://")?(t="https://",e=e.slice(8)):e.startsWith("http://")&&(t="http://",e=e.slice(7));let[r,n,o]=e.split("/");return{origin:t+r,mapId:n,fileName:o}};var Sh,Pl,jc,Cd=class Cd extends Or{constructor(r){super(String(dt()));f(this,"__type",Cd.__type);T(this,Sh,{});T(this,Pl);T(this,jc);w(this,Pl,r.mvfData),w(this,jc,r.mapData)}static is(r){return r.__type===Cd.__type}get url(){let r=a(this,Pl).url;if(a(this,jc).tokenManager==null)return r;let n=d0(a(this,Pl).url);if(n==null)return r;let o=n.mapId;try{if(a(this,jc).tokenManager.isEnterpriseMode())return r;let i=a(this,jc).tokenManager.getSasToken(o).token;if(i==null||i==="")throw new Error("SAS token empty!");return`${r}?${i}`}catch(i){return A.error("Error getting SAS token for image",{error:i,url:r}),r}}get name(){return a(this,Pl).altText}get altText(){return a(this,Pl).altText}toJSON(){return{__type:Cd.__type,id:this.id,url:this.url,name:this.name}}destroy(){for(let r of globalThis.Object.keys(a(this,Sh)))delete a(this,Sh)[r]}};Sh=new WeakMap,Pl=new WeakMap,jc=new WeakMap,f(Cd,"__type","image");var r3=Cd,Uc=r3;u();var Vc,Si=class{constructor(t,r){f(this,"id");T(this,Vc);this.id=t}get geoJSONBoundingBox(){return a(this,Vc)?a(this,Vc):"bbox"in this.geoJSON.geometry&&this.geoJSON.geometry.bbox?this.geoJSON.geometry.bbox:(w(this,Vc,hu(this.geoJSON)),a(this,Vc))}get geoJSON(){return{properties:null,type:"Feature",geometry:{type:"Polygon",coordinates:[[]]}}}};Vc=new WeakMap;var Td,ba,xa,on=class extends Si{constructor(r,n){super(n.properties.id,r);T(this,Td);T(this,ba);T(this,xa,{});w(this,Td,r),w(this,ba,n)}get externalId(){return a(this,ba).properties.externalId??""}get name(){let r=a(this,ba).properties.details?.name??"";return r===""&&(r=this.locationProfiles.find(n=>n.name&&n.name.length>0)?.name??""),r}get description(){let r=a(this,ba).properties.details?.description??"";return r===""&&(r=this.locationProfiles.find(n=>n.description&&n.description.length>0)?.description??""),r}get images(){if(a(this,xa).images!=null)return a(this,xa).images;let r=a(this,ba).properties.details?.images?.map(n=>new Uc({mvfData:n,mapData:a(this,Td)}))??[];return(r==null||r.length===0)&&(r=this.locationProfiles.find(n=>n.images.length>0)?.images??[]),a(this,xa).images=r,r}get links(){if(a(this,xa).links!=null)return a(this,xa).links;let r=a(this,ba).properties.details?.links?.map(n=>new Gc({mvfData:n}))??[];return(r==null||r.length===0)&&(r=this.locationProfiles.find(n=>n.links.length>0)?.links??[]),a(this,xa).links=r,r}get locationProfiles(){return a(this,Td).locationProfilesByAttachedFeatureId[this.id]??[]}};Td=new WeakMap,ba=new WeakMap,xa=new WeakMap;var Ch,Hc,Pd,wd,Md=class Md extends on{constructor(r,n){super(r,n.mvfData);f(this,"__type",Md.__type);T(this,Ch);T(this,Hc);T(this,Pd,{});T(this,wd);w(this,Ch,r),w(this,Hc,n.floorId),w(this,wd,n.mvfData)}static is(r){return r.__type===Md.__type}get center(){return a(this,Pd).center==null&&(a(this,Pd).center=Vr(a(this,wd),a(this,Hc))),a(this,Pd).center}get floor(){let r=a(this,Ch).getById("floor",a(this,Hc));if(r==null)throw new Error(`Floor ${a(this,Hc)} not found!`);return r}get geoJSON(){return{...a(this,wd),properties:null}}get focusTarget(){return this}get anchorTarget(){return this.center}toJSON(){return{__type:Md.__type,id:this.id,name:this.name,floor:this.floor.id}}destroy(){}};Ch=new WeakMap,Hc=new WeakMap,Pd=new WeakMap,wd=new WeakMap,f(Md,"__type","area");var n3=Md,va=n3;u();var Wc,Ia,$c,zc,Od=class Od extends on{constructor(r,n){super(r,n.mvfData);f(this,"__type",Od.__type);T(this,Wc);T(this,Ia);T(this,$c);T(this,zc);w(this,Ia,{}),w(this,zc,n.mvfData),w(this,Wc,r),w(this,$c,n.floorId)}static is(r){return r.__type===Od.__type}get floor(){let r=a(this,Wc).getById("floor",a(this,$c));if(r==null)throw new Error(`Floor ${a(this,$c)} not found!`);return r}get center(){return a(this,Ia).center==null&&(a(this,Ia).center=Vr(a(this,zc),a(this,$c))),a(this,Ia).center}get isExterior(){if(a(this,zc).properties.isExterior)return!0;let r=a(this,Wc).obstructionIdByEntranceId[this.id];return a(this,Wc).getMVFFeatureById("obstruction",r)?.properties.footprintComponent??!1}get geoJSON(){return{...a(this,zc),properties:null}}get focusTarget(){return this.center}get anchorTarget(){return this.center}toJSON(){return{__type:Od.__type,id:this.id,name:this.name,floor:this.floor.id,center:this.center.toJSON()}}destroy(){for(let r of Object.keys(a(this,Ia)))delete a(this,Ia)[r]}};Wc=new WeakMap,Ia=new WeakMap,$c=new WeakMap,zc=new WeakMap,f(Od,"__type","door");var o3=Od,Ci=o3;u();var wl,Xc,mo,Sa,_d=class _d extends on{constructor(r,n){super(r,n.mvfData);f(this,"__type",_d.__type);T(this,wl);T(this,Xc);T(this,mo,{});T(this,Sa);w(this,wl,r),w(this,Xc,n.floorId),w(this,Sa,n.mvfData)}static is(r){return r.__type===_d.__type}get type(){return p$(a(this,Sa).properties.kind)}get locations(){if(a(this,mo).locations)return a(this,mo).locations;a(this,mo).locations=[];let r=a(this,wl).mvfLocationsBySpaceId[a(this,Sa).properties.id];if(r?.length>0)for(let n of r){let o=a(this,wl).getById("enterprise-location",n.id);o&&a(this,mo).locations.push(o)}return a(this,mo).locations}get floor(){let r=a(this,wl).getById("floor",a(this,Xc));if(r==null)throw new Error(`Floor ${a(this,Xc)} not found!`);return r}get doors(){return a(this,Sa).properties.destinationNodes.reduce((r,n)=>{let o=a(this,wl).doorsByNodeId[n];return o&&r.push(o),r},[])}get center(){return a(this,mo).center==null&&(a(this,mo).center=Vr(a(this,Sa),a(this,Xc))),a(this,mo).center}get geoJSON(){return{...a(this,Sa),properties:null}}get focusTarget(){return this.geoJSON.geometry.type==="Polygon"?this:this.center}get anchorTarget(){return this.center}toJSON(){return{__type:_d.__type,id:this.id,name:this.name,type:this.type,floor:this.floor.id,center:this.center.toJSON()}}destroy(){for(let r of Object.keys(a(this,mo)))delete a(this,mo)[r]}};wl=new WeakMap,Xc=new WeakMap,mo=new WeakMap,Sa=new WeakMap,f(_d,"__type","space");var i3=_d,c$=["room","hallway","exterior","void","gate"];function p$(e){if(e==null||e==="default")return"room";let t=e.toLowerCase();return c$.includes(t)?t:"room"}var _r=i3;u();var No,Mt,ho,Dd,f0,Ed=class Ed extends Si{constructor(r,n){super(n.mvfData.properties.id,r);T(this,Dd);f(this,"__type",Ed.__type);T(this,No);T(this,Mt,{});T(this,ho);w(this,No,r),w(this,ho,n.mvfData)}static is(r){return r.__type===Ed.__type}get focusTarget(){return this}get name(){return"name"in a(this,ho).properties?z(this,Dd,f0).call(this,"name")??"":a(this,ho).properties.externalId??""}get shortName(){return"shortName"in a(this,ho).properties?z(this,Dd,f0).call(this,"shortName")??"":a(this,ho).properties.externalId??""}get subtitle(){return z(this,Dd,f0).call(this,"subtitle")??""}get externalId(){return a(this,ho).properties.externalId??""}get elevation(){return a(this,ho).properties.elevation}get spaces(){if(a(this,Mt).spaces==null){let r=a(this,No).spaces.filter(n=>n.floor.id===this.id);a(this,Mt).spaces=r}return a(this,Mt).spaces}get geoJSON(){return{type:"Feature",properties:null,geometry:a(this,ho).geometry??{type:"Polygon",coordinates:[]}}}get objects(){if(a(this,Mt).objects==null){let r=a(this,No).objects.filter(n=>n.floor.id===this.id);a(this,Mt).objects=r}return a(this,Mt).objects}get connections(){if(a(this,Mt).connections==null){let r=a(this,No).connections.filter(n=>n.floors.includes(this));a(this,Mt).connections=r}return a(this,Mt).connections}get doors(){if(a(this,Mt).doors==null){let r=a(this,No).doors.filter(n=>n.floor.id===this.id);a(this,Mt).doors=r}return a(this,Mt).doors}get annotations(){if(a(this,Mt).annotations==null){let r=a(this,No).annotations.filter(n=>n.floor.id===this.id);a(this,Mt).annotations=r}return a(this,Mt).annotations}get pois(){if(a(this,Mt).pois==null){let r=a(this,No).pointsOfInterest.filter(n=>n.floor.id===this.id);a(this,Mt).pois=r}return a(this,Mt).pois}get floorStack(){if(a(this,Mt).floorStack==null){let r=a(this,No).floorStacks.find(n=>n.floors.includes(this));a(this,Mt).floorStack=r}return a(this,Mt).floorStack}get center(){return a(this,Mt).center==null&&(a(this,Mt).center=Vr(a(this,ho),this.id)),a(this,Mt).center}toJSON(){return{__type:Ed.__type,id:this.id,name:this.name,shortName:this.shortName,subtitle:this.subtitle,elevation:this.elevation,spaces:this.spaces.map(r=>r.id),objects:this.objects.map(r=>r.id),connections:this.connections.map(r=>r.id),doors:this.doors.map(r=>r.id),annotations:this.annotations.map(r=>r.id),pois:this.pois.map(r=>r.id)}}destroy(){for(let r of globalThis.Object.keys(a(this,Mt)))delete a(this,Mt)[r]}};No=new WeakMap,Mt=new WeakMap,ho=new WeakMap,Dd=new WeakSet,f0=function(r){let n=a(this,ho).properties[r];return a(this,No).getPropTranslation(this.__type,r,this.id,n)},f(Ed,"__type","floor");var s3=Ed,Wn=s3;u();u();u();function Fd(e){let t;if(_r.is(e)||Ci.is(e)||$n.is(e)||va.is(e)||Go.is(e))t=e.center;else if(Ca.is(e)||Ta.is(e))t=e.coordinate;else if(ge.is(e))t=e;else if(Bo.is(e))t=e.coordinate;else if(ys.is(e))t=e.coordinates[0];else return;return t}u();u();var Th={debug:!1,pitch:45,bearing:0,antialiasing:{enabled:!0},shadingAndOutlines:!0,outdoorView:{layersHiddenByGeometry:["building","building-top"]},imagePlacementOptions:{mode:"default"},flipImagesToFaceCamera:!0,multiFloorView:{enabled:!0,floorGap:10}},bs="ExteriorWalls",Ol="Walls",k6=0,kd="InteriorDoors",Ad="ExteriorDoors",yr="GeometryLayer",xs="LabelsLayer",Ti="MarkersLayer",Ld="FootprintLayer",_l="OcclusionLayer",Rd="ImagesLayer",Zc="FacadesLayer",vs="PathsLayer";var A6=["https://mappedin.auth0.com","https://mappedin-staging.auth0.com","https://staging.mappedin.com","https://mappedin-staging.auth0.com/userinfo","https://mappedin.com","https://mappedin.auth0.com/userinfo"],u$={orange:"#F26336",teal:"#057685",lightTeal:"#5DC7D0"};var d$=new Set(["outdoorView","bearing","pitch","zoomLevel","screenOffsets","debug","initialFloor","shadingAndOutlines","wallTopColor","style","multiFloorView","occlusion","imagePlacementOptions","flipImagesToFaceCamera","injectStyles","useStandaloneCamera","preloadFloors"]),f$=new Set(["style","enabled","layersHiddenByGeometry","lowDpi"]);function a3(e){e.outdoorView?.enabled&&!e.outdoorView?.token&&A.error("Enable outdoor view requires a token. Provide token in `options.outdoorView.token`")}function l3(e,t){let r=e?.outdoorView?.token||t.outdoorViewToken,n={...Th,...e,outdoorView:{enabled:e?.outdoorView?.enabled===void 0?!!r:e?.outdoorView?.enabled,layersHiddenByGeometry:Th.outdoorView?.layersHiddenByGeometry,...e?.outdoorView},bearing:e?.bearing??t.naturalBearing??0,imagePlacementOptions:{...Th.imagePlacementOptions,...e?.imagePlacementOptions},multiFloorView:{...Th.multiFloorView,...e?.multiFloorView}};return r&&n.outdoorView&&(n.outdoorView.token=r),n}function L6(e){let t={remove_watermark:!1};if(e)try{let r=cb(e);Object.assign(t,r.capabilities)}catch(r){A.error("Error decoding capabilities from token",r)}return t}function R6(e){let t=Object.fromEntries(Object.entries(e).filter(([r])=>d$.has(r)));return t.outdoorView&&(t.outdoorView=Object.fromEntries(Object.entries(t.outdoorView).filter(([r])=>f$.has(r)))),t}var El,jo,Ma,Bd=class Bd extends on{constructor(r,n){let o=Object.values(n.mvfDataByFloorId)[0];super(r,o);f(this,"__type",Bd.__type);T(this,El);T(this,jo);T(this,Ma);w(this,jo,{}),w(this,El,r),w(this,Ma,n.mvfDataByFloorId)}static is(r){return r.__type===Bd.__type}get accessible(){return Object.values(a(this,Ma))[0].properties.accessible??!1}get type(){return Object.values(a(this,Ma))[0].properties.kind?.split(".")[1]??"unknown"}get extra(){return Object.values(a(this,Ma))[0].properties.extra}get coordinates(){return a(this,jo).coordinates==null&&(a(this,jo).coordinates=Object.entries(a(this,Ma)).map(([r,n])=>Vr(n,r))),a(this,jo).coordinates}get nodes(){return Object.values(a(this,Ma))[0].properties.nodes.map(r=>a(this,El).getById("node",r))}get floors(){return this.coordinates.map(r=>r.floorId?a(this,El).getById("floor",r.floorId):void 0).filter(Tm)}get locationProfiles(){if(a(this,jo).locationProfiles!=null)return a(this,jo).locationProfiles;let r=super.locationProfiles;if(r==null||r.length===0){let n=[this.coordinates[0]?.longitude??0,this.coordinates[0]?.latitude??0],o=gs(n),i=a(this,El).mvfConnectionIdsByLatLon[o]??[];for(let s of i){let l=a(this,El).locationProfilesByAttachedFeatureId[s];if(l!=null){r=l;break}}}return a(this,jo).locationProfiles=r??[],r}get focusTarget(){return this.coordinates}toJSON(){return{__type:Bd.__type,id:this.id,name:this.name,type:this.type,externalId:this.externalId,coordinates:this.coordinates.map(r=>r.toJSON()),floors:this.floors.map(r=>r.id),extra:this.extra}}destroy(){for(let r of Object.keys(a(this,jo)))delete a(this,jo)[r]}};El=new WeakMap,jo=new WeakMap,Ma=new WeakMap,f(Bd,"__type","connection");var c3=Bd,Dl=c3;u();var Mh,Yc,Fl,Jc,Nd=class Nd extends on{constructor(r,n){super(r,n.mvfData);f(this,"__type",Nd.__type);T(this,Mh);T(this,Yc);T(this,Fl,{});T(this,Jc);w(this,Mh,r),w(this,Yc,n.floorId),w(this,Jc,n.mvfData)}static is(r){return r.__type===Nd.__type}get type(){let r=a(this,Jc).properties.kind;return r==null&&(r="object"),r==="Desks"&&(r="desk"),r.toLowerCase()}get floor(){let r=a(this,Mh).getById("floor",a(this,Yc));if(r==null)throw new Error(`Floor ${a(this,Yc)} not found!`);return r}get center(){return a(this,Fl).center==null&&(a(this,Fl).center=Vr(a(this,Jc),a(this,Yc))),a(this,Fl).center}get geoJSON(){return{...a(this,Jc),properties:null}}get anchorTarget(){return this.center}get focusTarget(){return this.geoJSON.geometry.type==="Polygon"?this:this.center}toJSON(){return{__type:Nd.__type,id:this.id,name:this.name,type:this.type,floor:this.floor.id,center:this.center.toJSON()}}destroy(){for(let r of globalThis.Object.keys(a(this,Fl)))a(this,Fl)[r]=null}};Mh=new WeakMap,Yc=new WeakMap,Fl=new WeakMap,Jc=new WeakMap,f(Nd,"__type","object");var p3=Nd,$n=p3;u();var Ph,qc,kl,jd,Gd=class Gd extends on{constructor(r,n){super(r,n.mvfData);f(this,"__type",Gd.__type);T(this,Ph);T(this,qc);T(this,kl,{});T(this,jd);w(this,Ph,r),w(this,jd,n.mvfData),w(this,qc,n.floorId)}static is(r){return r.__type===Gd.__type}get floor(){let r=a(this,Ph).getById("floor",a(this,qc));if(r==null)throw new Error(`Floor ${a(this,qc)} not found!`);return r}get coordinate(){return a(this,kl).coordinate==null&&(a(this,kl).coordinate=Vr(a(this,jd),a(this,qc))),a(this,kl).coordinate}get geoJSON(){return{...a(this,jd),properties:null}}get focusTarget(){return this.coordinate}get anchorTarget(){return this.coordinate}toJSON(){return{__type:Gd.__type,id:this.id,name:this.name,floor:this.floor.id,coordinate:this.coordinate.toJSON()}}destroy(){for(let r in a(this,kl))a(this,kl)[r]=null}};Ph=new WeakMap,qc=new WeakMap,kl=new WeakMap,jd=new WeakMap,f(Gd,"__type","point-of-interest");var u3=Gd,Ca=u3;u();var wh,Kc,Al,Qc,Oh,f3,Ud=class Ud extends on{constructor(r,n){super(r,n.mvfData);T(this,Oh);f(this,"__type",Ud.__type);T(this,wh);T(this,Kc);T(this,Al,{});T(this,Qc);w(this,wh,r),w(this,Kc,n.floorId),w(this,Qc,n.mvfData)}static is(r){return r.__type===Ud.__type}get group(){return z(this,Oh,f3).call(this).group}get type(){return z(this,Oh,f3).call(this).type}get coordinate(){return a(this,Al).coordinate==null&&(a(this,Al).coordinate=Vr(a(this,Qc),a(this,Kc))),a(this,Al).coordinate}get floor(){let r=a(this,wh).getById("floor",a(this,Kc));if(r==null)throw new Error(`Floor ${a(this,Kc)} not found!`);return r}get geoJSON(){return{...a(this,Qc),properties:null}}get focusTarget(){return this.coordinate}get anchorTarget(){return this.coordinate}toJSON(){return{__type:Ud.__type,id:this.id,group:this.group,type:this.type,coordinate:this.coordinate.toJSON()}}destroy(){for(let r of Object.keys(a(this,Al)))delete a(this,Al)[r]}};wh=new WeakMap,Kc=new WeakMap,Al=new WeakMap,Qc=new WeakMap,Oh=new WeakSet,f3=function(){let[r,n]=a(this,Qc).properties.symbolId.split("--");return{group:r,type:n}},f(Ud,"__type","annotation");var d3=Ud,Ta=d3;u();var Ll,Uo,Mi,Hd,_h,h3,Vd=class Vd extends Si{constructor(r,n){super(n.mvfData.id,r);T(this,_h);f(this,"__type",Vd.__type);T(this,Ll);T(this,Uo,{});T(this,Mi);T(this,Hd);w(this,Ll,r),w(this,Mi,n.mvfData),w(this,Hd,n.facadeId)}static is(r){return r.__type===Vd.__type}get type(){return a(this,Mi).type}get name(){return z(this,_h,h3).call(this,"name")??""}get shortName(){return z(this,_h,h3).call(this,"shortName")??""}get externalId(){return a(this,Mi).externalId??""}get floors(){if(a(this,Uo).floors==null){let r=(a(this,Mi).floors??a(this,Mi).maps??[]).reduce((n,o)=>{let i=a(this,Ll).floorsById[o];return i&&n.push(i),n},[]);r.length===0&&A.error(`Floor stack ${this.id} has no floors`),a(this,Uo).floors=r.sort((n,o)=>n.elevation-o.elevation)}return a(this,Uo).floors}get defaultFloor(){if(a(this,Uo).defaultFloor!=null)return a(this,Uo).defaultFloor;let r=a(this,Mi).defaultFloor?a(this,Ll).getById("floor",a(this,Mi).defaultFloor):void 0;return a(this,Uo).defaultFloor=r||this.floors.reduce((n,o)=>Math.abs(o.elevation)<Math.abs(n.elevation)?o:n),a(this,Uo).defaultFloor}get facade(){return a(this,Hd)?a(this,Ll).facadesById[a(this,Hd)]:void 0}toJSON(){return{__type:Vd.__type,id:this.id,name:this.name,shortName:this.shortName,type:this.type,floors:this.floors.map(r=>r.id)}}destroy(){for(let r of globalThis.Object.keys(a(this,Uo)))delete a(this,Uo)[r]}};Ll=new WeakMap,Uo=new WeakMap,Mi=new WeakMap,Hd=new WeakMap,_h=new WeakSet,h3=function(r){return a(this,Ll).getPropTranslation(this.__type,r,this.id,a(this,Mi)[r])},f(Vd,"__type","floor-stack");var m3=Vd,m0=m3;u();var $d,ep,zd,Is,Wd=class Wd extends Si{constructor(r,n){super(n.mvfData.id,r);f(this,"__type",Wd.__type);T(this,$d);T(this,ep);T(this,zd);T(this,Is,{});w(this,$d,n.mvfData),w(this,ep,r),w(this,zd,n.floorStackId)}static is(r){return r.__type===Wd.__type}get floorStack(){return a(this,ep).getById("floor-stack",a(this,zd))}get spaces(){if(!a(this,Is).spaces){a(this,Is).spaces=[];for(let r of a(this,$d).spaces){let n=a(this,ep).getById("space",r.spaceId);n&&a(this,Is).spaces.push(n)}}return a(this,Is).spaces}get center(){if(!a(this,Is).center){let r={type:"FeatureCollection",features:[]};for(let o of this.spaces){let i=a(this,ep).mvfSpacesById[o.id];i&&r.features.push(i)}if(r.features.length===0)throw new Br("No geometry found for facade!");let n=yd(r);a(this,Is).center=new ge({latitude:n.geometry.coordinates[1],longitude:n.geometry.coordinates[0],floorId:a(this,$d).spaces[0].floorId})}return a(this,Is).center}get focusTarget(){return this.spaces}get anchorTarget(){return this.center}toJSON(){return{id:this.id,__type:Wd.__type,floorStackId:a(this,zd),floorStack:this.floorStack,spaces:this.spaces}}};$d=new WeakMap,ep=new WeakMap,zd=new WeakMap,Is=new WeakMap,f(Wd,"__type","facade");var g3=Wd,Go=g3;u();var m$=new Set(["wall","area"]),h$=new Set(["void","desk-entrance"]),g$=(e,t)=>{let r={},n={},o={},i={},s={},l={};for(let c of e["location.json"]||[]){let p=new tp(t,{mvfData:c});if(r[c.id]=p,c.externalId&&(i[c.externalId]==null&&(i[c.externalId]=[]),i[c.externalId].push(p)),c.categories)for(let m of c.categories)s[m]==null&&(s[m]=[]),s[m].push(p);let d=[...c.obstructions?.map(m=>m.id)??[],...c.spaces?.map(m=>m.id)??[],...c.annotations?.map(m=>m.id)??[],...c.connections??[],...c.entrances?.map(m=>m.id)??[],...c.areas?.map(m=>m.id)??[]];for(let m of d)m&&(l[m]==null&&(l[m]=[]),l[m].push(p))}for(let c of e["category.json"]||[]){let p=new g0(t,{mvfData:c});n[c.id]=p,c.parent&&(o[c.parent]==null&&(o[c.parent]=[]),o[c.parent].push(p))}return{locationCategoriesByParentId:o,locationProfilesById:r,locationCategoriesById:n,locationProfilesByExternalId:i,locationProfilesByCategoryId:s,locationProfilesByAttachedFeatureId:l}},y$=(e,t,r)=>{let n={},o={},i={},s={},l={},c={},p={},d={},m={},g={},x={},v=globalThis.Object.keys(e.space);for(let C of v){let I=e.space[C];if(I!=null){for(let S of I.features)if(x[S.properties.id]=C,c[S.properties.id]=S,S.properties.kind==="desk-entrance"&&(l[S.properties.externalId]==null&&(l[S.properties.externalId]=[]),l[S.properties.externalId].push(...S.properties.destinationNodes)),!("kind"in S.properties&&S.properties.kind==null||h$.has(S.properties.kind??""))){if(S.properties.kind?.includes("connection")){let P=gs(S.geometry.coordinates);m[P]==null&&(m[P]=[]),m[P].push(S.properties.id);continue}if(S.properties.kind==="poi"||S.geometry.type==="Point"&&S.properties.kind==null){let P=new Ca(r,{floorId:C,mvfData:S});i[S.properties.id]=P,d[C]||(d[C]=[]),d[C].push(S),S.properties.externalId&&(s[S.properties.externalId]==null&&(s[S.properties.externalId]=[]),s[S.properties.externalId].push(P))}else if(S.geometry.type==="Point")A.warn("Encountered a point space with an unknown kind!",S.properties.kind);else{let P=new _r(r,{floorId:C,mvfData:S});n[S.properties.id]=P,S.properties.externalId&&(o[S.properties.externalId]==null&&(o[S.properties.externalId]=[]),o[S.properties.externalId].push(P)),p[C]||(p[C]=[]),p[C].push(S)}}}}for(let C in m){let I=m[C],S={};for(let O of I){let M=x[O],E=c[O],B=t?.["n_"+E.properties.id.split("s_")[1]];S[M]={...E,properties:{...E.properties,accessible:B?.accessible===!0}}}let P=new Dl(r,{mvfDataByFloorId:S});g[P.id]=P}return{spacesById:n,spacesByExternalId:o,poisById:i,poisByExternalId:s,connectionsById:g,objectEntranceNodeIdsByObstructionId:l,mvfSpacesById:c,connectionIdsByLatLon:m,mvfSpacesByFloorId:p,mvfPoisByFloorId:d}},b$=(e,t)=>{let r={},n={},o={},i={};for(let s of e["node.geojson"].features){o[s.properties.id]=s;let l=new Bo(t,{mvfData:s,floorId:s.properties.floor??s.properties.map});r[s.properties.id]=l,s.properties.externalId&&(n[s.properties.externalId]==null&&(n[s.properties.externalId]=[]),n[s.properties.externalId].push(l));let c=s.properties.floor??s.properties.map;i[c]||(i[c]=[]),i[c].push(s)}return{nodesById:r,nodesByExternalId:n,mvfNodesById:o,mvfNodesByFloorId:i}},x$=(e,t)=>{let r={},n={},o={},i={},s=globalThis.Object.keys(e.obstruction);for(let l of s){let c=e.obstruction[l];if(c!=null)for(let p of c.features){o[p.properties.id]=p;for(let m of p.properties.entrances)i[m]=p.properties.id;if(m$.has(p.properties.kind?.toLowerCase()??""))continue;let d=new $n(t,{floorId:l,mvfData:p});r[p.properties.id]=d,p.properties.externalId&&(n[p.properties.externalId]==null&&(n[p.properties.externalId]=[]),n[p.properties.externalId].push(d))}}return{objectsById:r,objectsByExternalId:n,mvfObstructionById:o,obstructionIdByEntranceId:i}},v$=(e,t)=>{let r={},n={},o={};if("floor.geojson"in e&&e["floor.geojson"]!=null)for(let i of e["floor.geojson"].features){o[i.properties.id]=i.properties;let s=new Wn(t,{mvfData:i});r[i.properties.id]=s,i.properties.externalId&&(n[i.properties.externalId]==null&&(n[i.properties.externalId]=[]),n[i.properties.externalId].push(s))}else for(let i of e["map.geojson"]){o[i.id]=i;let s=new Wn(t,{mvfData:{properties:i}});r[i.id]=s}return{floorsById:r,floorsByExternalId:n,mvfFloorsById:o}},I$=(e,t)=>{let r={},n={},o={},i={},s={},l=e["floorstack.json"]||e["mapstack.json"]||e["mapstack.geojson"];if(l!=null)for(let c of l){let p=e.facade?.[c.id],d=new m0(t,{mvfData:c,facadeId:p?.id});if(r[c.id]=d,c.externalId&&(n[c.externalId]==null&&(n[c.externalId]=[]),n[c.externalId].push(d)),o[c.id]=c,p){let m=new Go(t,{mvfData:p,floorStackId:c.id});i[p.id]=m;for(let g of p.spaces)s[g.spaceId]=m}}return{floorStacksById:r,floorStacksByExternalId:n,mvfFloorStacksById:o,facadesById:i,facadesBySpaceId:s}},S$=(e,t)=>{let r={},n={},o=e["connection.json"].reduce((i,s)=>{s.nodes.forEach(c=>i[c]=s),r[s.id]=s;let l=t?.[s.nodes[0]];if(l!=null){let c=gs(l.geometry.coordinates);n[c]==null&&(n[c]=[]),n[c].push(s.id)}return i},{});return{mvfConnectionsById:r,mvfConnectionsByNodeId:o,mvfConnectionIdsByLatLon:n}},C$=(e,t)=>{let r={},n={},o={},i={},s={},l=globalThis.Object.keys(e.entrance);for(let c of l){let p=e.entrance[c];if(p!=null)for(let d of p.features){i[d.properties.id]=d;let m=new Ci(t,{floorId:c,mvfData:d});d.properties.node&&(o[d.properties.node]=m),r[d.properties.id]=m,d.properties.externalId&&(n[d.properties.externalId]==null&&(n[d.properties.externalId]=[]),n[d.properties.externalId].push(m)),s[c]||(s[c]=[]),s[c].push(d)}}return{doorsById:r,doorsByExternalId:n,doorsByNodeId:o,mvfEntrancesById:i,mvfEntrancesByFloorId:s}},T$=(e,t,r)=>{if(e.textAreas!=null)for(let n in e.textAreas){let o=e.textAreas[n]?.features;if(o!=null){for(let i of o)if("anchorId"in i.properties){let s=i?.properties,l=t[s.anchorId]||r[s.anchorId];if(l!=null&&s!=null){let c=l.properties;c.textArea=s,c.textArea&&(c.textArea.position=i.geometry.coordinates)}}}}},M$=(e,t,r)=>{if(e.floorImages!=null)for(let n in e.floorImages){let o=e.floorImages[n]?.features;if(o!=null){for(let i of o)if("anchorId"in i.properties){let s=i?.properties,l=t[s.anchorId]||r[s.anchorId];if(l!=null&&s!=null){let c=l.properties;c.image=s,c.image&&(c.image.position=i.geometry.coordinates)}}}}},P$=(e,t)=>{if(e.enterprise?.enterpriseStyles==null)return;let r=e.enterprise?.enterpriseStyles;for(let n in r){let o=r[n];o.geometryAnchors.forEach(i=>{let s=t[i.geometryId];if(s!=null){let l=s.properties;l.style={styleId:n,edgeOffset:o.edgeOffset}}})}},w$=(e,t,r)=>{if(!(e.enterprise==null||e.enterprise.textures==null))for(let n of e.enterprise.textures)for(let o of n.geometryAnchors){let i=t[o.geometryId]||r[o.geometryId];if(i!=null){let s=i.properties;s.textures==null&&(s.textures=[]),s.textures.push(n)}}},O$=(e,t)=>{let r={},n={},o={};if(e.annotation==null)return{annotationsById:r,mvfAnnotationsById:n,mvfAnnotationsByFloorId:o};let i=globalThis.Object.keys(e.annotation);for(let s of i){let l=e.annotation[s];if(l!=null)for(let c of l.features){n[c.properties.id]=c;let p=new Ta(t,{floorId:s,mvfData:c});r[c.properties.id]=p,o[s]||(o[s]=[]),o[s].push(c)}}return{annotationsById:r,mvfAnnotationsById:n,mvfAnnotationsByFloorId:o}},_$=(e,t)=>{let r={},n={},o={};if(e.area==null)return{areasById:r,areasByExternalId:n,mvfAreasById:o};let i=globalThis.Object.keys(e.area);for(let s of i){let l=e.area[s];if(l!=null)for(let c of l.features){o[c.properties.id]=c;let p=new va(t,{floorId:s,mvfData:c});r[c.properties.id]=p,c.properties.externalId&&(n[c.properties.externalId]==null&&(n[c.properties.externalId]=[]),n[c.properties.externalId].push(p))}}return{areasById:r,areasByExternalId:n,mvfAreasById:o}},B6=(e,t)=>{let r={},n={},o={},i={},s=(e.enterprise?.locations??[]).reduce((P,O)=>(P[O.id]=O,P),{}),l={},c={},p={},d={},m={},g={},x=e.enterprise?.venue||{},v={},C={},I={};for(let P of e.enterprise?.categories??[]){let O=new h0(t,{mvfData:P});l[P.id]=O,P.externalId&&(c[P.externalId]==null&&(c[P.externalId]=[]),c[P.externalId].push(O)),p[P.id]=P,P.locations.forEach(M=>{m[M]==null&&(m[M]=[]),m[M].push(P.id)})}let S={};for(let P of e.enterprise?.locationInstances??[]){let O=s[P.parent],M=Object.keys(O),E={};for(let j of M)E[j]=void 0;let B={...E,polygons:[],nodes:[],...P};S[B.parent]==null&&(S[B.parent]=[]),S[B.parent].push(new ys(t,{mvfData:B,categoryIds:e.enterprise?.categoryPriorities?.[B.id]||m[B.id],parentId:P.parent})),v[B.id]=P}for(let P in e.space){let O=e.space[P];if(O!=null)for(let M of O.features){for(let E of M.properties.destinationNodes)C[E]==null&&(C[E]=[]),C[E].push(M.properties.id);I[M.properties.id]=M.properties.destinationNodes}}for(let P of e.enterprise?.locations??[]){let O=new ys(t,{mvfData:P,categoryIds:e.enterprise?.categoryPriorities?.[P.id]||m[P.id],locationInstances:S[P.id]});o[P.id]=O,P.externalId&&(i[P.externalId]==null&&(i[P.externalId]=[]),i[P.externalId].push(O)),P.nodes.forEach(M=>{g[M.id]==null&&(g[M.id]=[]),g[M.id].push(P.id)});for(let M of P.polygons)d[M.id]==null&&(d[M.id]=[]),d[M.id].push(P)}if(t.enterpriseMode===!0){for(let P in t.mvfConnectionsById){let O={},M=t.mvfConnectionsById[P];for(let E of t.mvfConnectionsById[P].nodes){let B=t.nodesById[E];B!=null&&(O[B.floor.id]={type:"Feature",geometry:{type:"Point",coordinates:[B.coordinate.longitude,B.coordinate.latitude]},properties:{id:P,externalId:M.externalId,kind:"enterprise."+M.type,destinationNodes:[],flags:"",type:M.type,nodes:M.nodes,accessible:M.accessible,extra:M.extra,details:M.details}})}Object.keys(O).length>0&&(r[P]=new Dl(t,{mvfDataByFloorId:O}),M.externalId&&(n[M.externalId]==null&&(n[M.externalId]=[]),n[M.externalId].push(r[P])))}t.connectionsById=r}return{spaceIdsByNodeId:C,connectionsByExternalId:n,locationIdsByNodeId:g,mvfLocationsBySpaceId:d,mvfLocationsById:s,mvfCategoriesById:p,locationsById:o,locationsByExternalId:i,locationInstancesById:v,categoriesById:l,categoriesByExternalId:c,destinationNodesIdsBySpaceId:I,venue:x}},N6=(e,t)=>{let{nodesById:r,nodesByExternalId:n,mvfNodesById:o,mvfNodesByFloorId:i}=b$(e,t),{mvfConnectionsById:s,mvfConnectionsByNodeId:l,mvfConnectionIdsByLatLon:c}=S$(e,o),{spacesById:p,spacesByExternalId:d,poisById:m,poisByExternalId:g,mvfSpacesById:x,objectEntranceNodeIdsByObstructionId:v,connectionsById:C,connectionIdsByLatLon:I,mvfSpacesByFloorId:S,mvfPoisByFloorId:P}=y$(e,l,t),{objectsById:O,objectsByExternalId:M,mvfObstructionById:E,obstructionIdByEntranceId:B}=x$(e,t),{floorsById:j,floorsByExternalId:L,mvfFloorsById:N}=v$(e,t),{floorStacksById:X,floorStacksByExternalId:Z,mvfFloorStacksById:re,facadesById:Q,facadesBySpaceId:xe}=I$(e,t),{doorsById:Ce,doorsByExternalId:ye,doorsByNodeId:Ee,mvfEntrancesById:we,mvfEntrancesByFloorId:pe}=C$(e,t),{annotationsById:Ae,mvfAnnotationsById:mt,mvfAnnotationsByFloorId:Je}=O$(e,t),{areasById:ut,areasByExternalId:qe,mvfAreasById:Te}=_$(e,t);M$(e,x,E),T$(e,x,E),P$(e,x),w$(e,x,E);let{locationCategoriesByParentId:xt,locationProfilesById:Pt,locationCategoriesById:nr,locationProfilesByExternalId:k,locationProfilesByCategoryId:W,locationProfilesByAttachedFeatureId:D}=g$(e,t);return{spacesById:p,spacesByExternalId:d,nodesById:r,nodesByExternalId:n,objectsById:O,objectsByExternalId:M,floorsById:j,floorsByExternalId:L,floorStacksById:X,floorStacksByExternalId:Z,facadesById:Q,facadesBySpaceId:xe,connectionsById:C,doorsById:Ce,doorsByExternalId:ye,doorsByNodeId:Ee,poisById:m,poisByExternalId:g,annotationsById:Ae,areasById:ut,areasByExternalId:qe,objectEntranceNodeIdsByObstructionId:v,obstructionIdByEntranceId:B,connectionIdsByLatLon:I,locationProfilesById:Pt,locationCategoriesById:nr,locationProfilesByExternalId:k,locationProfilesByCategoryId:W,locationCategoriesByParentId:xt,mvfSpacesById:x,mvfNodesById:o,mvfObstructionById:E,mvfFloorsById:N,mvfFloorStacksById:re,mvfConnectionsById:s,mvfConnectionsByNodeId:l,mvfEntrancesById:we,mvfAnnotationsById:mt,mvfNodesByFloorId:i,mvfSpacesByFloorId:S,mvfPoisByFloorId:P,mvfAreasById:Te,mvfEntrancesByFloorId:pe,mvfAnnotationsByFloorId:Je,locationProfilesByAttachedFeatureId:D,mvfConnectionIdsByLatLon:c}};u();var E$=new Set(["polygons"]),Pi,qt,zn,Eh,Xd=class Xd extends Or{constructor(r,n){super(n.mvfData.externalId);f(this,"__type",Xd.__type);f(this,"description");f(this,"name","");f(this,"amenity");f(this,"externalId","");f(this,"extra");f(this,"gallery");f(this,"instances");f(this,"logo");f(this,"operationHours");f(this,"phone");f(this,"picture");f(this,"shortName");f(this,"showFloatingLabelWhenImagePresent");f(this,"showLogo");f(this,"siblingGroups");f(this,"social");f(this,"sortOrder",-1);f(this,"states");f(this,"tags");f(this,"type","");f(this,"hidden",!1);T(this,Pi);T(this,qt,{});T(this,zn);T(this,Eh);w(this,Pi,r),w(this,zn,n.mvfData),w(this,Eh,n.categoryIds||[]),this.instances=n.locationInstances||[];for(let o in n.mvfData)!E$.has(o)&&!Object.getOwnPropertyDescriptor(Object.getPrototypeOf(this),o)&&Object.defineProperty(this,o,{enumerable:!0,get(){if(n.parentId){let i=a(this,Pi).locationsById[n.parentId];return a(this,zn)[o]!=null?a(this,Pi).getPropTranslation(this.__type,o,a(this,zn).id,a(this,zn)[o]):a(this,Pi).getPropTranslation(this.__type,o,a(this,zn).id,i[o])}return a(this,Pi).getPropTranslation(this.__type,o,a(this,zn).id,a(this,zn)[o])}})}static is(r){return r.__type===Xd.__type}get focusTarget(){return this.spaces}get categories(){return a(this,qt).categories?a(this,qt).categories:(a(this,qt).categories=(a(this,Eh).map(r=>a(this,Pi).getById("enterprise-category",r))||[]).filter(Boolean),a(this,qt).categories)}get coordinates(){if(a(this,qt).coordinates)return a(this,qt).coordinates;a(this,qt).coordinates=[];for(let r=0;r<this.nodes.length;r++)a(this,qt).coordinates.push(this.nodes[r].coordinate);return a(this,qt).coordinates}get nodes(){if(a(this,qt).nodes)return a(this,qt).nodes;a(this,qt).nodes=[];for(let r=0;r<a(this,zn).nodes.length;r++){let n=a(this,Pi).getById("node",a(this,zn).nodes[r].id);n&&a(this,qt).nodes.push(n)}return a(this,qt).nodes}get spaces(){if(a(this,qt).spaces)return a(this,qt).spaces;a(this,qt).spaces=[];for(let r=0;r<a(this,zn).polygons.length;r++){let n=a(this,Pi).getById("space",a(this,zn).polygons[r].id);n&&a(this,qt).spaces.push(n)}return a(this,qt).spaces}toJSON(){return{__type:Xd.__type,id:this.id,name:this.name}}destroy(){for(let r of Object.keys(a(this,qt)))delete a(this,qt)[r]}};Pi=new WeakMap,qt=new WeakMap,zn=new WeakMap,Eh=new WeakMap,f(Xd,"__type","enterprise-location");var y3=Xd,ys=y3;u();var D$=new Set,rp,wn,Ss,Zd=class Zd extends Or{constructor(r,n){super(n.mvfData.externalId);f(this,"__type",Zd.__type);f(this,"name","");f(this,"color");f(this,"externalId","");f(this,"extra");f(this,"icon");f(this,"iconFromDefaultList");f(this,"sortOrder",-1);f(this,"picture");T(this,rp);T(this,wn,{});T(this,Ss);w(this,rp,r),w(this,Ss,n.mvfData);for(let o in n.mvfData)!D$.has(o)&&!Object.getOwnPropertyDescriptor(Object.getPrototypeOf(this),o)&&Object.defineProperty(this,o,{get(){return a(this,rp).getPropTranslation(this.__type,o,a(this,Ss).id,a(this,Ss)[o])}})}static is(r){return r.__type===Zd.__type}get children(){if(a(this,wn).children)return a(this,wn).children;a(this,wn).children=[];for(let r=0;r<a(this,Ss).children.length;r++){let n=a(this,rp).getById("enterprise-category",a(this,Ss).children[r]);n&&a(this,wn).children.push(n)}return a(this,wn).children}get locations(){if(a(this,wn).locations)return a(this,wn).locations;a(this,wn).locations=[];for(let r=0;r<a(this,Ss).locations.length;r++){let n=a(this,rp).getById("enterprise-location",a(this,Ss).locations[r]);n&&a(this,wn).locations.push(n)}return a(this,wn).locations}toJSON(){return{__type:Zd.__type,id:this.id,name:this.name}}destroy(){for(let r of Object.keys(a(this,wn)))delete a(this,wn)[r]}};rp=new WeakMap,wn=new WeakMap,Ss=new WeakMap,f(Zd,"__type","enterprise-category");var b3=Zd,h0=b3;u();var F$=new Set,Dh,Jd,Yd=class Yd extends Or{constructor(r,n){super(n.mvfData.externalId);f(this,"__type",Yd.__type);f(this,"countrycode");f(this,"coverImage");f(this,"externalId","");f(this,"defaultLanguage",{code:"en",name:"English"});f(this,"defaultFloor");f(this,"extra");f(this,"icon");f(this,"languages",[]);f(this,"links",[]);f(this,"logo");f(this,"mappedinWebUrl");f(this,"operationHours");f(this,"slug","");f(this,"topLocations");f(this,"tzid");T(this,Dh,{});T(this,Jd);w(this,Jd,n.mvfData);for(let o in n.mvfData)!F$.has(o)&&!Object.getOwnPropertyDescriptor(Object.getPrototypeOf(this),o)&&(this[o]=n.mvfData[o])}static is(r){return r.__type===Yd.__type}get name(){return a(this,Jd).name??""}get defaultMap(){return a(this,Jd).defaultMap??this.defaultFloor??""}toJSON(){return{__type:Yd.__type,id:this.id,name:this.name}}destroy(){for(let r of Object.keys(a(this,Dh)))delete a(this,Dh)[r]}};Dh=new WeakMap,Jd=new WeakMap,f(Yd,"__type","enterprise-venue");var x3=Yd,v3=x3;u();u();u();u();u();var G6=(i=>(i.Departure="Departure",i.TakeConnection="TakeConnection",i.ExitConnection="ExitConnection",i.Turn="Turn",i.Arrival="Arrival",i))(G6||{}),I3=(s=>(s.Straight="Straight",s.Right="Right",s.SlightRight="SlightRight",s.Left="Left",s.SlightLeft="SlightLeft",s.Back="Back",s))(I3||{}),j6=(p=>(p.stairs="stairs",p.elevator="elevator",p.escalator="escalator",p.door="door",p.ramp="ramp",p.slide="slide",p.portal="portal",p.security="security",p.shuttle="shuttle",p))(j6||{}),y0=(r=>(r.Exterior="exterior-walls",r.Interior="interior-walls",r))(y0||{}),b0=(r=>(r.Interior="interior-doors",r.Exterior="exterior-doors",r))(b0||{});function Vo(e){return e.verticalOffset===0?[e.longitude,e.latitude]:[e.longitude,e.latitude,e.verticalOffset]}function k$(e){return new Map(e.map(t=>{let{properties:r}=t,{id:n}=r;return[n,t]}))}var S3=(e,t)=>{let r=k$(t),n={entrances:{type:"FeatureCollection",features:[]},walls:{type:"Feature",properties:{id:e[0].properties.id},geometry:{type:"MultiLineString",coordinates:[]}}};for(let o of e){let i=[o.geometry.coordinates],s=(o.properties.entrances||[]).reduce((l,c)=>(r.has(c)&&l.push(r.get(c)),l),[]);if(s.length){let{entrances:l,obstructions:c}=YS(o,s);i=c.map(p=>p.geometry.coordinates),n.entrances.features.push(...l)}n.walls.geometry.coordinates.push(...i)}return n};function U6(e,t){return((t-e+Math.PI)%(Math.PI*2)+Math.PI*2)%(Math.PI*2)-Math.PI}function V6(e,t){let r="Left";return e<=-Math.PI/4?r="Right":e<=-t?r="SlightRight":e<=t?r="Straight":e<=Math.PI/4?r="SlightLeft":r="Left",r}function H6(e){let t={};for(let r in e){let n=e[r];if(n!=null){if(n.id=r,"polygons"in n)for(let o of n.polygons)t[o]=n;else if("lineStrings"in n)for(let o of n.lineStrings)t[o]=n;else if("points"in n)for(let o of n.points)t[o]=n}}return t}function x0(e,t){return e.reduce((r,n)=>{let o=t[n.properties.id];if(o==null)return r;if("textures"in n.properties&&Array.isArray(n.properties.textures)&&n.properties.textures.length>0){let i={...o,id:o.id+"-textures"};r.set(i,[n])}else r.has(o)||r.set(o,[]),r.get(o).push(n);return r},new Map)}function qd(e,t={}){let r={...e,flipImageToFaceCamera:t?.flipImagesToFaceCamera??!0},n=t?.style?.shading??t?.shadingAndOutlines;if(n===!0?r.shading={start:.1,end:.15,intensity:.4}:typeof n=="object"&&(r.shading={start:n.start,end:n.end,intensity:n.intensity}),r.outline=t?.style?.outlines??t?.shadingAndOutlines,"lineStrings"in e){let o=t?.style?.wallTopColor??t?.wallTopColor;o!=null&&(r.topColor=o)}return r}var W6=(e,t)=>{let n=(t.currentMap?.currentFloor).layers.get(yr);switch(e){case"interior-walls":return n?.layers.get(Ol);case"exterior-walls":return n?.layers.get(bs);case"interior-doors":return n?.layers.get(kd);case"exterior-doors":return n?.layers.get(Ad);default:return typeof e=="string"?e:e.id}};function C3(e){return new Promise(t=>{e.onComplete(t),e.onStop(t)})}function v0(e){return e.bbox?e.bbox:hu(e)}function $6(e,t){return[Math.min(e[0],t[0]),Math.min(e[1],t[1]),Math.max(e[2],t[2]),Math.max(e[3],t[3])]}function T3(e,t,r){return e.floorId&&t.has(e.floorId)?t.get(e.floorId):r}function Kd(e){if(_r.is(e)||$n.is(e))return e.id}function z6(e,t,r){let n=e.coordinates.length===2&&e.coordinates[0].floorId!==e.coordinates[1].floorId,o=!0;if(n&&e.coordinates[0].floorId!=null&&e.coordinates[1].floorId!=null){let i=t?.getById("floor",e.coordinates[0].floorId),s=t?.getById("floor",e.coordinates[1].floorId);if(i&&s){let l=r.getState(i),c=r.getState(s);l!=null&&c!=null&&(o=l.visible&&c.visible&&l.altitude!==c.altitude)}}else{let i=e.coordinates[0].floorId!=null?t?.getById("floor",e.coordinates[0].floorId):void 0;o=i?r.getState(i)?.visible??!0:!0}return o}function X6(e,t){let r=e.properties.path.split("/"),n=r[r.length-1].split(".")[0],o=atob(n);return"img_"+l5(o).toString()+"-"+t}var Z6=Math.PI*.1,On,Xn,go,Pa,np,ef,Ho,Y6,Qd,J6,Rl=class{constructor(t,r,n,o,i){T(this,Ho);f(this,"id");T(this,On,{});T(this,Xn);T(this,go);f(this,"departure");f(this,"destination");T(this,Pa);T(this,np);T(this,ef);this.id=i?.id??dt(),w(this,Xn,r),w(this,go,t.features),this.departure=n,this.destination=o}get path(){return a(this,go).map(t=>a(this,Xn).getById("node",t.properties.id)).filter(Boolean)}get coordinates(){return a(this,On).coordinates?a(this,On).coordinates:(a(this,On).coordinates=a(this,go).map(t=>new ge(t.geometry.coordinates[1],t.geometry.coordinates[0],t.properties.groupBy)),a(this,On).coordinates)}get distance(){return a(this,On).distance?a(this,On).distance:(a(this,On).distance=a(this,go).reduce((t,r)=>t+(r.properties.distance||0),0),a(this,On).distance)}get instructions(){if(a(this,go).length<2)return[];if(a(this,On).instructions)return a(this,On).instructions;let t=[],r=0;for(let n=0;n<a(this,go).length;n++){let o=a(this,go)[n],i=a(this,go)[n-1],s=a(this,go)[n+1],l=new ge(o.geometry.coordinates[1],o.geometry.coordinates[0],o.properties.groupBy),c=z(this,Ho,Y6).call(this,{prevDirection:i,direction:o,nextDirection:s});r+=i?.properties.distance||0;for(let p of c)p&&(t.push({action:p,distance:r,coordinate:l,node:a(this,Xn).getById("node",o.properties.id)}),r=0)}return a(this,On).instructions=t,a(this,On).instructions}toJSON(){return{id:this.id,directions:a(this,go),__type:"directions",from:this.departure,to:this.destination}}};On=new WeakMap,Xn=new WeakMap,go=new WeakMap,Pa=new WeakMap,np=new WeakMap,ef=new WeakMap,Ho=new WeakSet,Y6=function(t){let{prevDirection:r,direction:n,nextDirection:o}=t,i=r&&a(this,Xn).getById("floor",r.properties.groupBy),s=a(this,Xn).getById("floor",n.properties.groupBy),l=o&&a(this,Xn).getById("floor",o.properties.groupBy),c=[];r||c.push({type:"Departure"});let p=a(this,Xn).getMVFFeatureByNodeId("connection",n.properties.id),d=p?a(this,Xn).getById("connection",p.id):void 0,m=p&&p.nodes.length>1,g=a(this,Xn).enterpriseMode&&(!n.properties.destination||!p?.nodes.includes(n.properties.destination)||!p?.nodes.includes(n.properties.id));if(p&&!(!m||g))if(!a(this,Pa)||a(this,Pa)==="exit")c.push(z(this,Ho,Qd).call(this,"TakeConnection",s,l,d,p)),w(this,Pa,"take"),w(this,np,d),w(this,ef,p);else{let v=a(this,Xn).getMVFFeatureByNodeId("connection",r?.properties.id??""),C=a(this,Xn).getById("connection",v?.id??"");c.push(z(this,Ho,Qd).call(this,"ExitConnection",s,i,C,v)),w(this,Pa,"exit"),w(this,np,d),w(this,ef,p)}else a(this,Pa)==="take"?(c.push(z(this,Ho,Qd).call(this,"ExitConnection",s,i,a(this,np),a(this,ef))),w(this,Pa,"exit"),w(this,np,d)):l&&s?.id!==l.id?c.push(z(this,Ho,Qd).call(this,"TakeConnection",s,l,d)):i&&i.id!==s?.id?c.push(z(this,Ho,Qd).call(this,"ExitConnection",s,i,d)):c.push(z(this,Ho,J6).call(this,r,n));return o||c.push({type:"Arrival"}),c},Qd=function(t,r,n,o,i){let s="none",l=r?r.elevation:0;if(l!=null&&n?.elevation!=null){let p=l-n.elevation;p>0?s="down":p<0&&(s="up")}let c=o?.type??i?.type??"stairs";return{type:t,fromFloor:r,toFloor:n,direction:s,connection:o,connectionType:c}},J6=function(t,r){let n=r.properties.edges;if(!n||n.filter(s=>s.destination.properties.id!==t?.properties.id&&s.destination.properties.id!==r.properties.destination).length===0)return null;let i=t?-U6(t.properties.angle,r.properties.angle):0;return Math.abs(i)>=Z6?{type:"Turn",bearing:V6(i,Z6),referencePosition:"At"}:null};u();u();u();u();u();u();u();var op=class{constructor({origin:t,destination:r,distance:n=0,angle:o=0,pathWeight:i=0,multiplicativeDistanceWeightScaling:s=!0}){f(this,"origin");f(this,"destination");f(this,"distance");f(this,"angle");f(this,"weight");if(this.origin=t,this.destination=r,this.distance=n,this.angle=o,this.weight=i||0,s?t.properties.floor===r.properties.floor&&(this.weight=(this.weight>=0?this.distance*this.weight:0)+this.distance):t.properties.map===r.properties.map&&(this.weight=this.weight>=0?this.distance+this.weight:0),isNaN(this.angle))throw new Error("Invalid angle: Expected a numeric value, but received NaN.")}};u();u();u();function wa(e,t,r){if(r===void 0&&(r={}),!e)throw new Error("point is required");if(!t)throw new Error("polygon is required");var n=Ro(e),o=gd(t),i=o.type,s=t.bbox,l=o.coordinates;if(s&&A$(n,s)===!1)return!1;i==="Polygon"&&(l=[l]);for(var c=!1,p=0;p<l.length&&!c;p++)if(q6(n,l[p][0],r.ignoreBoundary)){for(var d=!1,m=1;m<l[p].length&&!d;)q6(n,l[p][m],!r.ignoreBoundary)&&(d=!0),m++;d||(c=!0)}return c}function q6(e,t,r){var n=!1;t[0][0]===t[t.length-1][0]&&t[0][1]===t[t.length-1][1]&&(t=t.slice(0,t.length-1));for(var o=0,i=t.length-1;o<t.length;i=o++){var s=t[o][0],l=t[o][1],c=t[i][0],p=t[i][1],d=e[1]*(s-c)+l*(c-e[0])+p*(e[0]-s)===0&&(s-e[0])*(c-e[0])<=0&&(l-e[1])*(p-e[1])<=0;if(d)return!r;var m=l>e[1]!=p>e[1]&&e[0]<(c-s)*(e[1]-l)/(p-l)+s;m&&(n=!n)}return n}function A$(e,t){return t[0]<=e[0]&&t[1]<=e[1]&&t[2]>=e[0]&&t[3]>=e[1]}u();u();function Oa([e,t],[r,n]){let o=t-n,i=e-r;return(Math.atan2(i,o)+Math.PI*3)%(Math.PI*2)}u();var L$=63710088e-1;function wi(e,t){let[r,n]=e.map(d=>d*Math.PI/180),[o,i]=t.map(d=>d*Math.PI/180),s=i-n,l=o-r,c=Math.sin(s/2)*Math.sin(s/2)+Math.cos(n)*Math.cos(i)*Math.sin(l/2)*Math.sin(l/2),p=2*Math.atan2(Math.sqrt(c),Math.sqrt(1-c));return L$*p}u();u();function I0(e,t,r,n){let[o,i]=e,[s,l]=t,[c,p]=r,[d,m]=n;if(i===l&&o===s||p===m&&c===d)return null;let g=(d-c)*(l-i)-(m-p)*(s-o);if(g===0)return null;let x=((m-p)*(o-c)-(d-c)*(i-p))/g,v=((l-i)*(o-c)-(s-o)*(i-p))/g;if(x<0||x>1||v<0||v>1)return null;let C=i+x*(l-i);return[o+x*(s-o),C]}u();function M3(e,t,r,n){let o=Bc(e,r/1e3,n),i=Bc(t,r/1e3,n);return[o.geometry.coordinates,i.geometry.coordinates]}u();function P3(e){let t=e*(180/Math.PI);return t=t%360,t>180?t-=360:t<-180&&(t+=360),Object.is(t,-0)?0:t}var K6=111e3;function S0(e,t,r=[],n=0){let o=!0,i=e.geometry.coordinates,s=t.geometry.coordinates,l=P3(Oa(i,s)-Math.PI/2),c=P3(Oa(i,s)+Math.PI/2),p=n/K6,d=n/(K6*Math.cos(i[1]*Math.PI/180)),m=Math.min(i[1],s[1])-p,g=Math.max(i[1],s[1])+p,x=Math.min(i[0],s[0])-d,v=Math.max(i[0],s[0])+d;for(let C of r)if(!(Math.max(C[0][1],C[1][1])<m||Math.min(C[0][1],C[1][1])>g||Math.max(C[0][0],C[1][0])<x||Math.min(C[0][0],C[1][0])>v)){if(n>0){let I=M3(i,s,n,l),S=M3(i,s,n,c);if(I0(I[0],I[1],C[0],C[1])||I0(S[0],S[1],C[0],C[1]))return o=!1,!1}else if(I0(i,s,C[0],C[1]))return o=!1,!1}return o}var O3=.4,ip,sn,w3,Q6,e9,t9,r9,n9,o9,T0,C0=class{constructor({nodes:t,groupBy:r,multiplicativeDistanceWeightScaling:n}){T(this,sn);f(this,"edges",{});f(this,"nodesById");f(this,"nodesByGroup",new Map);T(this,ip);f(this,"hasLineOfSight",(t,r,n=[],o=O3)=>S0({type:"Feature",properties:{id:"origin",neighbors:[]},geometry:{type:"Point",coordinates:t}},{type:"Feature",properties:{id:"destination",neighbors:[]},geometry:{type:"Point",coordinates:r}},n,o)===!0);T(this,T0,(t,r)=>{let n=0;for(let o of r)(!o[a(this,ip)]||o[a(this,ip)]===t.properties[a(this,ip)])&&wa(t.geometry.coordinates,o.geometry.geometry)&&(n+=Math.max(0,o.cost));return n});w(this,ip,r);let{features:o}=t;this.nodesById=z(this,sn,Q6).call(this,o),z(this,sn,e9).call(this),z(this,sn,t9).call(this,o,r,{multiplicativeDistanceWeightScaling:n})}getShortestEuclideanDistance(t,r){return r.reduce((n,o)=>{let i=wi(t.geometry.coordinates,o.geometry.coordinates);return Math.min(n,i)},Number.MAX_VALUE)}dijkstraFindWithinTravelDistance(t,r,n,o,i){let s=this.nodesById[t];if(!s)return[];let l=[],c={},p={},d=new Set,m=[];for(l.push({node:s,distance:0}),c[s.properties.id]=null,p[s.properties.id]=0;l.length>0;){l.sort((C,I)=>C.distance-I.distance);let g=l.shift();if(!g)break;let x=g.node,v=g.distance;if(!d.has(x.properties.id)){d.add(x.properties.id),x.properties.id!=null&&n.includes(x.properties.id?.toString())&&(i?this.hasLineOfSight(s.geometry.coordinates,x.geometry.coordinates,o)&&m.push({feature:x,distance:v}):m.push({feature:x,distance:v}));for(let C of this.edges[x.properties.id]){let I=C.destination,S=v+C.distance,P=p[x.properties.id]+C.weight;S>r||d.has(I.properties.id)||p[I.properties.id]!==void 0&&P>=p[I.properties.id]||(p[I.properties.id]=P,c[I.properties.id]=C,l.push({node:I,distance:S}))}}}return m.sort((g,x)=>g.distance-x.distance)}aStar({originIds:t,destinationNodeIds:r,disabledConnectionNodeIds:n,zones:o,overrideEdgeWeights:i}){let s=z(this,sn,w3).call(this,t),l=z(this,sn,w3).call(this,r);if(s.length===0||l.length===0)return[];let{frontier:c,cameFrom:p,costSoFar:d}=z(this,sn,r9).call(this,s,l);for(;c.length>0;){let m=c.shift();if(!m)break;if(z(this,sn,n9).call(this,m.origin,l))return z(this,sn,o9).call(this,p,m.origin.properties.id);for(let g of this.edges[m.origin.properties.id]){let x=i?.get(g)??g.weight;if(n?.has(g.origin.properties.id)&&g.destination.properties.map!==g.origin.properties.map)continue;let v=d[m.origin.properties.id]+x+a(this,T0).call(this,g.destination,o);if(v!==1/0&&(d[g.destination.properties.id]==null||v<d[g.destination.properties.id])){let C=v+this.getShortestEuclideanDistance(g.destination,l);d[g.destination.properties.id]=v,p[g.destination.properties.id]=g,c.push({origin:g.destination,priority:C})}}c.sort((g,x)=>g.priority-x.priority)}return[]}};ip=new WeakMap,sn=new WeakSet,w3=function(t){return t.map(r=>this.nodesById[r]).filter(Boolean)},Q6=function(t){return t.reduce((r,n)=>(r[n.properties.id]=n,r),{})},e9=function(){for(let t in this.nodesById)this.nodesById.hasOwnProperty(t)&&(this.nodesById[t].properties.neighbors=this.nodesById[t].properties.neighbors.filter(({id:r})=>!!this.nodesById[r]))},t9=function(t,r,n){t.forEach(o=>{let i=r==="default"?r:o.properties[r];this.nodesByGroup.has(i)||this.nodesByGroup.set(i,[]),this.nodesByGroup.get(i).push(o),this.edges[o.properties.id]=o.properties.neighbors.map(({id:s,weight:l})=>{let c=this.nodesById[s],p=wi(o.geometry.coordinates,c.geometry.coordinates),d=Oa(o.geometry.coordinates,c.geometry.coordinates);return new op({origin:o,destination:c,pathWeight:l,distance:p,angle:d,multiplicativeDistanceWeightScaling:n?.multiplicativeDistanceWeightScaling})})})},r9=function(t,r){let n=[],o={},i={};return t.forEach(s=>{let l=this.getShortestEuclideanDistance(s,r);n.push({origin:s,priority:l}),o[s.properties.id]=null,i[s.properties.id]=0}),n.sort((s,l)=>s.priority-l.priority),{frontier:n,cameFrom:o,costSoFar:i}},n9=function(t,r){return r.some(n=>n.properties.id===t.properties.id)},o9=function(t,r){let n=[],o=t[r];for(;o;)n.push(o),o=t[o.origin.properties.id];return n.reverse()},T0=new WeakMap;var tf=class{constructor({nodes:t,geojsonCollection:r,groupBy:n="default",multiplicativeDistanceWeightScaling:o}){f(this,"groupBy");f(this,"graph");f(this,"geometryEdgesByMapId",new Map);f(this,"generatePath",t=>{let{destination:r}=t[t.length-1],n={type:"FeatureCollection",features:[]};for(let i=0;i<t.length;i++){let{origin:s,destination:l}=t[i],c={id:s.properties.id,angle:t[i].angle,distance:t[i].distance,destination:l.properties.id,edges:this.graph.edges[s.properties.id]};this.groupBy!=="default"&&(c.groupBy=s.properties[this.groupBy]),n.features.push({type:"Feature",geometry:{type:"Point",coordinates:[s.geometry.coordinates[0],s.geometry.coordinates[1]]},properties:c})}let o={id:r.properties.id,edges:this.graph.edges[r.properties.id]};return this.groupBy!=="default"&&(o.groupBy=r.properties[this.groupBy]),n.features.push({type:"Feature",geometry:{type:"Point",coordinates:[r.geometry.coordinates[0],r.geometry.coordinates[1]]},properties:o}),n});f(this,"findNearestNodesOnGraph",(t,r,n,o,i=!1)=>this.graph.dijkstraFindWithinTravelDistance(t,r,o,this.geometryEdgesByMapId.get(n)??[],i));f(this,"hasLineOfSight",(t,r,n,o)=>this.graph.hasLineOfSight(t,r,this.geometryEdgesByMapId.get(n),o));f(this,"getDistance",(t,r)=>wi(t,r));f(this,"getAngle",(t,r)=>Oa(t,r));this.groupBy=n,this.graph=new C0({nodes:t,groupBy:this.groupBy,multiplicativeDistanceWeightScaling:o}),(r?.features||[]).forEach(s=>{let l=null;if(s.geometry.type==="LineString"?l=s.geometry.coordinates:s.geometry.type==="Polygon"&&(l=s.geometry.coordinates.flat()),l){let c=this.groupBy==="default"?this.groupBy:s.properties[this.groupBy];this.geometryEdgesByMapId.has(c)||this.geometryEdgesByMapId.set(c,[]),l.forEach((p,d)=>{this.geometryEdgesByMapId.get(c).push([p,l[d+1]||l[0]])})}})}getDirections({zones:t,originIds:r,destinationNodeIds:n,disabledConnectionNodeIds:o,simplify:i,multiplicativeDistanceWeightScaling:s,overrideEdgeWeights:l}){let c=i?.enabled??!0,p=t??[],d=this.graph.aStar({originIds:r,destinationNodeIds:n,zones:p,disabledConnectionNodeIds:new Set(o),overrideEdgeWeights:l});return d.length===0?{type:"FeatureCollection",features:[]}:(c&&(d=this.simplifyAllSteps(d,i?.bufferRadius??O3,s)),this.generatePath(d))}simplifyAllSteps(t,r,n){let o=[],i=[t[0]];for(let p=1;p<t.length;p++)if(this.groupBy!=="default"&&t[p].origin.properties[this.groupBy]!==t[p-1].origin.properties[this.groupBy]){let d=t[p-1].origin.properties[this.groupBy],m=this.geometryEdgesByMapId.get(d)??[];o.push(...this.simplifySteps(i,m,r,n)),i=[t[p]]}else i.push(t[p]);let s=t[t.length-1],l=this.groupBy==="default"?this.groupBy:s.origin.properties[this.groupBy],c=this.geometryEdgesByMapId.get(l)??[];return o.push(...this.simplifySteps(i,c,r,n)),o}simplifySteps(t,r,n,o){if(t.length<3)return t;let i=[t[0]],s=1;for(let l=s+2;l<t.length;l++)if(t[s].origin.properties.preventSmoothing||!S0(t[s].origin,t[l].origin,r,n)){let c=l-1;i.push(new op({...t[s],destination:t[c].origin,distance:wi(t[s].origin.geometry.coordinates,t[c].origin.geometry.coordinates),angle:Oa(t[s].origin.geometry.coordinates,t[c].origin.geometry.coordinates)})),s=c}return i.push(new op({...t[s],destination:t[t.length-1].origin,distance:wi(t[s].origin.geometry.coordinates,t[t.length-1].origin.geometry.coordinates),angle:Oa(t[s].origin.geometry.coordinates,t[t.length-1].origin.geometry.coordinates),multiplicativeDistanceWeightScaling:o}),t[t.length-1]),i}};u();var Ut=new WeakMap;function rf(e,t){if(Ut.has(e))return Ut.get(e);if(tp.is(e)){let r=[];for(let n of e.navigationTarget){let o=rf(n,t);r.push(...o)}return Ut.set(e,r),r}else if(Ta.is(e)){let r=t.Query.__LEGACY_NEAREST_SYNC(e,t.getByType("node")),n=r?.[0]?.feature.id?[r[0].feature.id]:[];return Ut.set(e,n),n}else if(ge.is(e)){let r=t.Query.__LEGACY_NEAREST_SYNC(e,t.getByType("node"),{lineOfSight:!0}),n=r?.[0]?.feature.id?[r[0].feature.id]:[];return Ut.set(e,n),n}else if(Ca.is(e)){let r=t.Query.__LEGACY_NEAREST_SYNC(e,t.getByType("node"));return r?.[0]?.feature.id?[r[0].feature.id]:[]}else if(Ci.is(e)){let r=t?.getMVFFeatureById("entrance",e.id),n=r?.properties.node?[r?.properties.node]:[];return Ut.set(e,n),n}else if(va.is(e)){let n=t?.getMVFFeatureById("area",e.id)?.properties.destinationNodes??[];return Ut.set(e,n),n}else if(_r.is(e)){let r=t?.getMVFFeatureById("space",e.id);if(r==null)return[];let n=r.properties.destinationNodes;return Ut.set(e,n),n}else if(Dl.is(e)){let r=[];for(let n of e.coordinates){let o=t.Query.__LEGACY_NEAREST_SYNC(n,t.getByType("node"));o?.[0]?.feature.id&&r.push(o[0].feature.id)}return Ut.set(e,r),r}else if($n.is(e)){let r=t?.objectEntranceNodeIdsByObstructionId[e.id];return Ut.set(e,r??[]),r??[]}else if(Go.is(e)){let r=e.spaces.flatMap(n=>t?.getMVFFeatureById("space",n.id)?.properties.destinationNodes??[]).filter(n=>typeof n=="string");return Ut.set(e,r),r}else if(ys.is(e)){let r=e.nodes.map(n=>n.id);return Ut.set(e,r),r}else if(Bo.is(e)){let r=[e.id];return Ut.set(e,r),r}else return[]}async function Bl(e,t){if(Ut.has(e))return Ut.get(e);if(tp.is(e)){let r=[];for(let n of e.navigationTarget){let o=await Bl(n,t);r.push(...o)}return Ut.set(e,r),r}else if(Ta.is(e)){let r=await t.Query.nearest(e,t.getByType("node")),n=r?.[0]?.feature.id?[r[0].feature.id]:[];return Ut.set(e,n),n}else if(ge.is(e)){let r=await t.Query.nearest(e,t.getByType("node"),{lineOfSight:!0}),n=r?.[0]?.feature.id?[r[0].feature.id]:[];return Ut.set(e,n),n}else if(Ca.is(e)){let r=await t.Query.nearest(e,t.getByType("node")),n=r?.[0]?.feature.id?[r[0].feature.id]:[];return Ut.set(e,n),n}else if(Ci.is(e)){let r=t?.getMVFFeatureById("entrance",e.id),n=r?.properties.node?[r?.properties.node]:[];return Ut.set(e,n),n}else if(va.is(e)){let n=t?.getMVFFeatureById("area",e.id)?.properties.destinationNodes??[];return Ut.set(e,n),n}else if(_r.is(e)){let r=t?.getMVFFeatureById("space",e.id);if(r==null)return[];let n=r.properties.destinationNodes;return Ut.set(e,n),n}else if(Dl.is(e)){let r=[];for(let n of e.coordinates){let o=await t.Query.nearest(n,t.getByType("node"));o?.[0]?.feature.id&&r.push(o[0].feature.id)}return Ut.set(e,r),r}else if($n.is(e)){let r=t?.objectEntranceNodeIdsByObstructionId[e.id];return Ut.set(e,r??[]),r??[]}else{if(Go.is(e))return e.spaces.flatMap(r=>t?.getMVFFeatureById("space",r.id)?.properties.destinationNodes??[]).filter(r=>typeof r=="string");if(ys.is(e)){let r=e.nodes.map(n=>n.id);return Ut.set(e,r),r}else if(Bo.is(e)){let r=[e.id];return Ut.set(e,r),r}else return[]}}function i9(e,t,r){let n=e.features[0]?.properties.id,o=t[0];if(t.length>1){for(let i of t)if((r.get(i)??[]).includes(n)){o=i;break}}return o}function s9(e,t,r){let n=e.features[e.features.length-1]?.properties.id,o=t[0];if(t.length>1){for(let i of t)if((r.get(i)??[]).includes(n)){o=i;break}}return o}var Fh,M0,nf=class{constructor({nodes:t,geojsonCollection:r,connections:n,groupBy:o,multiplicativeDistanceWeightScaling:i}){f(this,"navigator");f(this,"connections");f(this,"getDirections",async(t,r,n,o)=>{let i=[],s=[],l=new Map;for(let c of t){let p=await Bl(c,o);for(let d of p)i.push(d),l.set(c,p)}for(let c of r){let p=await Bl(c,o);for(let d of p)s.push(d),l.set(c,p)}return a(this,Fh).call(this,t,r,i,s,n,o,l)});f(this,"getDirectionsSync",(t,r,n,o)=>{let i=[],s=[],l=new Map;for(let c of t){let p=rf(c,o);for(let d of p)i.push(d),l.set(c,p)}for(let c of r){let p=rf(c,o);for(let d of p)s.push(d),l.set(c,p)}return a(this,Fh).call(this,t,r,i,s,n,o,l)});T(this,Fh,(t,r,n,o,i,s,l)=>{let c=this.getDisabledConnectionNodeIds(i.accessible).filter(C=>!n.includes(C)&&!o.includes(C)),p=new Map,d={...i.connectionIdWeightMap};for(let C of i.excludedConnections)d[C.id]=1/0;for(let C in d){let I=s.getById("connection",C);I&&a(this,M0).call(this,I,d[C],p)}let m=this.navigator.getDirections({zones:i.zones.map(C=>({geometry:C.geometry,cost:C.cost,map:C.floor?.id})),originIds:n,destinationNodeIds:o,disabledConnectionNodeIds:c,simplify:{enabled:i.smoothing.enabled,bufferRadius:i.smoothing.radius},overrideEdgeWeights:p,multiplicativeDistanceWeightScaling:!s.enterpriseMode});this.addCoordinateDirections(m,t,r);let g=i9(m,t,l),x=s9(m,r,l),v=new Rl(m,s,g,x);if(!(v.distance===0&&new Set([...n,...o]).size===n.length+o.length))return v});f(this,"getDisabledConnectionNodeIds",t=>t===!1?[]:this.connections.reduce((r,n)=>n.accessible?r:r.concat(n.nodes),[]));T(this,M0,(t,r,n)=>{if(t.nodes.length<2)return;let o=new Set(t.nodes.map(i=>i.id));for(let i of t.nodes){let s=this.navigator.graph.edges[i.id];if(s)for(let l of s)o.has(l.destination.properties.id)&&n.set(l,r)}});f(this,"addCoordinateDirections",(t,[r],[n])=>{if(t.features.length){if(ge.is(r)){let o=this.createDirectionFeature(r,this.navigator.getAngle([r.longitude,r.latitude],t.features[0].geometry.coordinates),this.navigator.getDistance([r.longitude,r.latitude],t.features[0].geometry.coordinates));t.features.splice(0,0,o)}if(ge.is(n)){let o=this.createDirectionFeature(n,0,0),i=t.features[t.features.length-1];i.properties.distance=this.navigator.getDistance(i.geometry.coordinates,[n.longitude,n.latitude]),i.properties.angle=this.navigator.getAngle(i.geometry.coordinates,[n.longitude,n.latitude]),t.features.push(o)}}});f(this,"createDirectionFeature",(t,r,n)=>({type:"Feature",geometry:{type:"Point",coordinates:[t.longitude,t.latitude]},properties:{groupBy:t.floorId,id:t.id,angle:r,distance:n,edges:[]}}));this.navigator=new tf({nodes:t,geojsonCollection:this.createCollection(r),groupBy:o,multiplicativeDistanceWeightScaling:i}),this.connections=n}createCollection(t){return{type:"FeatureCollection",features:Object.entries(t).reduce((r,[n,o])=>r.concat(o.features.map(i=>(i.properties.map=n,i))),[])}}};Fh=new WeakMap,M0=new WeakMap;u();u();u();u();u();u();function a9(e){let t=+this._x.call(null,e),r=+this._y.call(null,e);return l9(this.cover(t,r),t,r,e)}function l9(e,t,r,n){if(isNaN(t)||isNaN(r))return e;var o,i=e._root,s={data:n},l=e._x0,c=e._y0,p=e._x1,d=e._y1,m,g,x,v,C,I,S,P;if(!i)return e._root=s,e;for(;i.length;)if((C=t>=(m=(l+p)/2))?l=m:p=m,(I=r>=(g=(c+d)/2))?c=g:d=g,o=i,!(i=i[S=I<<1|C]))return o[S]=s,e;if(x=+e._x.call(null,i.data),v=+e._y.call(null,i.data),t===x&&r===v)return s.next=i,o?o[S]=s:e._root=s,e;do o=o?o[S]=new Array(4):e._root=new Array(4),(C=t>=(m=(l+p)/2))?l=m:p=m,(I=r>=(g=(c+d)/2))?c=g:d=g;while((S=I<<1|C)===(P=(v>=g)<<1|x>=m));return o[P]=i,o[S]=s,e}function c9(e){var t,r,n=e.length,o,i,s=new Array(n),l=new Array(n),c=1/0,p=1/0,d=-1/0,m=-1/0;for(r=0;r<n;++r)isNaN(o=+this._x.call(null,t=e[r]))||isNaN(i=+this._y.call(null,t))||(s[r]=o,l[r]=i,o<c&&(c=o),o>d&&(d=o),i<p&&(p=i),i>m&&(m=i));if(c>d||p>m)return this;for(this.cover(c,p).cover(d,m),r=0;r<n;++r)l9(this,s[r],l[r],e[r]);return this}u();function p9(e,t){if(isNaN(e=+e)||isNaN(t=+t))return this;var r=this._x0,n=this._y0,o=this._x1,i=this._y1;if(isNaN(r))o=(r=Math.floor(e))+1,i=(n=Math.floor(t))+1;else{for(var s=o-r||1,l=this._root,c,p;r>e||e>=o||n>t||t>=i;)switch(p=(t<n)<<1|e<r,c=new Array(4),c[p]=l,l=c,s*=2,p){case 0:o=r+s,i=n+s;break;case 1:r=o-s,i=n+s;break;case 2:o=r+s,n=i-s;break;case 3:r=o-s,n=i-s;break}this._root&&this._root.length&&(this._root=l)}return this._x0=r,this._y0=n,this._x1=o,this._y1=i,this}u();function u9(){var e=[];return this.visit(function(t){if(!t.length)do e.push(t.data);while(t=t.next)}),e}u();function d9(e){return arguments.length?this.cover(+e[0][0],+e[0][1]).cover(+e[1][0],+e[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}u();u();function Wr(e,t,r,n,o){this.node=e,this.x0=t,this.y0=r,this.x1=n,this.y1=o}function f9(e,t,r){var n,o=this._x0,i=this._y0,s,l,c,p,d=this._x1,m=this._y1,g=[],x=this._root,v,C;for(x&&g.push(new Wr(x,o,i,d,m)),r==null?r=1/0:(o=e-r,i=t-r,d=e+r,m=t+r,r*=r);v=g.pop();)if(!(!(x=v.node)||(s=v.x0)>d||(l=v.y0)>m||(c=v.x1)<o||(p=v.y1)<i))if(x.length){var I=(s+c)/2,S=(l+p)/2;g.push(new Wr(x[3],I,S,c,p),new Wr(x[2],s,S,I,p),new Wr(x[1],I,l,c,S),new Wr(x[0],s,l,I,S)),(C=(t>=S)<<1|e>=I)&&(v=g[g.length-1],g[g.length-1]=g[g.length-1-C],g[g.length-1-C]=v)}else{var P=e-+this._x.call(null,x.data),O=t-+this._y.call(null,x.data),M=P*P+O*O;if(M<r){var E=Math.sqrt(r=M);o=e-E,i=t-E,d=e+E,m=t+E,n=x.data}}return n}u();function m9(e){if(isNaN(d=+this._x.call(null,e))||isNaN(m=+this._y.call(null,e)))return this;var t,r=this._root,n,o,i,s=this._x0,l=this._y0,c=this._x1,p=this._y1,d,m,g,x,v,C,I,S;if(!r)return this;if(r.length)for(;;){if((v=d>=(g=(s+c)/2))?s=g:c=g,(C=m>=(x=(l+p)/2))?l=x:p=x,t=r,!(r=r[I=C<<1|v]))return this;if(!r.length)break;(t[I+1&3]||t[I+2&3]||t[I+3&3])&&(n=t,S=I)}for(;r.data!==e;)if(o=r,!(r=r.next))return this;return(i=r.next)&&delete r.next,o?(i?o.next=i:delete o.next,this):t?(i?t[I]=i:delete t[I],(r=t[0]||t[1]||t[2]||t[3])&&r===(t[3]||t[2]||t[1]||t[0])&&!r.length&&(n?n[S]=r:this._root=r),this):(this._root=i,this)}function h9(e){for(var t=0,r=e.length;t<r;++t)this.remove(e[t]);return this}u();function g9(){return this._root}u();function y9(){var e=0;return this.visit(function(t){if(!t.length)do++e;while(t=t.next)}),e}u();function b9(e){var t=[],r,n=this._root,o,i,s,l,c;for(n&&t.push(new Wr(n,this._x0,this._y0,this._x1,this._y1));r=t.pop();)if(!e(n=r.node,i=r.x0,s=r.y0,l=r.x1,c=r.y1)&&n.length){var p=(i+l)/2,d=(s+c)/2;(o=n[3])&&t.push(new Wr(o,p,d,l,c)),(o=n[2])&&t.push(new Wr(o,i,d,p,c)),(o=n[1])&&t.push(new Wr(o,p,s,l,d)),(o=n[0])&&t.push(new Wr(o,i,s,p,d))}return this}u();function x9(e){var t=[],r=[],n;for(this._root&&t.push(new Wr(this._root,this._x0,this._y0,this._x1,this._y1));n=t.pop();){var o=n.node;if(o.length){var i,s=n.x0,l=n.y0,c=n.x1,p=n.y1,d=(s+c)/2,m=(l+p)/2;(i=o[0])&&t.push(new Wr(i,s,l,d,m)),(i=o[1])&&t.push(new Wr(i,d,l,c,m)),(i=o[2])&&t.push(new Wr(i,s,m,d,p)),(i=o[3])&&t.push(new Wr(i,d,m,c,p))}r.push(n)}for(;n=r.pop();)e(n.node,n.x0,n.y0,n.x1,n.y1);return this}u();function v9(e){return e[0]}function I9(e){return arguments.length?(this._x=e,this):this._x}u();function S9(e){return e[1]}function C9(e){return arguments.length?(this._y=e,this):this._y}function kh(e,t,r){var n=new _3(t??v9,r??S9,NaN,NaN,NaN,NaN);return e==null?n:n.addAll(e)}function _3(e,t,r,n,o,i){this._x=e,this._y=t,this._x0=r,this._y0=n,this._x1=o,this._y1=i,this._root=void 0}function T9(e){for(var t={data:e.data},r=t;e=e.next;)r=r.next={data:e.data};return t}var _n=kh.prototype=_3.prototype;_n.copy=function(){var e=new _3(this._x,this._y,this._x0,this._y0,this._x1,this._y1),t=this._root,r,n;if(!t)return e;if(!t.length)return e._root=T9(t),e;for(r=[{source:t,target:e._root=new Array(4)}];t=r.pop();)for(var o=0;o<4;++o)(n=t.source[o])&&(n.length?r.push({source:n,target:t.target[o]=new Array(4)}):t.target[o]=T9(n));return e};_n.add=a9;_n.addAll=c9;_n.cover=p9;_n.data=u9;_n.extent=d9;_n.find=f9;_n.remove=m9;_n.removeAll=h9;_n.root=g9;_n.size=y9;_n.visit=b9;_n.visitAfter=x9;_n.x=I9;_n.y=C9;u();function E3(e,t,r,n=0,o=0,i=0,s=0){if(r===void 0){r=e.root();let c=e.extent();if(c&&([[n,o],[i,s]]=c,t(r,n,o,i,s)))return!0;if(!r)return!1}let l=[[n,o,(i+n)/2,(s+o)/2],[(i+n)/2,o,i,(s+o)/2],[n,(s+o)/2,(i+n)/2,s],[(i+n)/2,(s+o)/2,i,s]];for(let c=0;c<4;c++){let p=r[c];if(p){let[d,m,g,x]=l[c];t(p,d,m,g,x)||E3(e,t,p,d,m,g,x)}}return!1}var M9=1e3,R$=.1,Oi,Ah,Zn,sp,P0=class{constructor(t,r){T(this,Oi,{});T(this,Ah,new Map);f(this,"getMaxSearchRadiusForFloorId",(t,r)=>{let n=a(this,Ah).get(a(this,Zn).mapName)?.get(r);if(n)return n;let o=this.getNodeTreeByTypeAndFloorId(t,a(this,Zn).mapName,r);if(typeof o.extent=="function")if(o.extent()){let[[i,s],[l,c]]=o.extent(),p=l-i,d=c-s;n=Math.max(p,d)}else n=M9;else n=M9;return a(this,Ah).set(a(this,Zn).mapName,new Map([[r,n]])),n});T(this,Zn);T(this,sp);w(this,Zn,t),w(this,sp,r)}searchWithIncludedIds(t,r,n,o,i,s,l=!1){let{x:c,y:p}=a(this,sp).call(this,t),d=c-s,m=c+s,g=p-s,x=p+s,v=this.getNodeTreeByTypeAndFloorId(r,n,o),C=[],I=new Set;return E3(v,(S,P,O,M,E)=>{let B=P>=m||O>=x||M<d||E<g;if("data"in S){let j=S.data,L=j.properties.parentId||j.properties.id;if(i.includes(L)&&!I.has(L)){I.add(L);let N=wi(t,j.geometry.coordinates);N<=s&&(l?a(this,Zn).directions.navigator.hasLineOfSight(t,j.geometry.coordinates,o,R$)&&C.push({node:j,distance:N}):C.push({node:j,distance:N}))}}return B}),C.sort((S,P)=>S.distance-P.distance)}getNodeTreeByTypeAndFloorId(t,r,n){if(a(this,Oi)[t]||(a(this,Oi)[t]={}),a(this,Oi)[t][r]?.[n])return a(this,Oi)[t][r][n];a(this,Oi)[t][r]||(a(this,Oi)[t][r]={}),a(this,Oi)[t][r][n]=kh();let o=a(this,Oi)[t][r][n];o.x(s=>a(this,sp).call(this,s.geometry.coordinates).x),o.y(s=>a(this,sp).call(this,s.geometry.coordinates).y);let i=[];switch(t){case"space":i=a(this,Zn).mvfSpacesByFloorId[n].flatMap(l=>l.properties.destinationNodes).map(l=>{let c=a(this,Zn).mvfNodesById[l];return c?{...c,properties:{id:c.properties.id,parentId:c.properties.space[0]}}:null});break;case"node":i=a(this,Zn).mvfNodesByFloorId[n]?.filter(l=>l.properties.neighbors.length>0)||[];break;case"point-of-interest":i=a(this,Zn).mvfPoisByFloorId[n]||[];break;case"door":i=a(this,Zn).mvfEntrancesByFloorId[n]||[];break;case"annotation":i=a(this,Zn).mvfAnnotationsByFloorId[n]||[];break}return i?.length>0&&o.addAll(i),o}};Oi=new WeakMap,Ah=new WeakMap,Zn=new WeakMap,sp=new WeakMap;u();u();var _={};zs(_,{BRAND:()=>lz,DIRTY:()=>ap,EMPTY_PATH:()=>j$,INVALID:()=>Se,NEVER:()=>zz,OK:()=>xn,ParseStatus:()=>an,Schema:()=>Ge,ZodAny:()=>jl,ZodArray:()=>Fa,ZodBigInt:()=>cp,ZodBoolean:()=>pp,ZodBranded:()=>Rh,ZodCatch:()=>Ip,ZodDate:()=>up,ZodDefault:()=>vp,ZodDiscriminatedUnion:()=>_0,ZodEffects:()=>zo,ZodEnum:()=>bp,ZodError:()=>Yn,ZodFirstPartyTypeKind:()=>Pe,ZodFunction:()=>D0,ZodIntersection:()=>hp,ZodIssueCode:()=>J,ZodLazy:()=>gp,ZodLiteral:()=>yp,ZodMap:()=>pf,ZodNaN:()=>df,ZodNativeEnum:()=>xp,ZodNever:()=>_i,ZodNull:()=>fp,ZodNullable:()=>Ms,ZodNumber:()=>lp,ZodObject:()=>Jn,ZodOptional:()=>Wo,ZodParsedType:()=>le,ZodPipeline:()=>Bh,ZodPromise:()=>Ul,ZodReadonly:()=>Sp,ZodRecord:()=>E0,ZodSchema:()=>Ge,ZodSet:()=>uf,ZodString:()=>Gl,ZodSymbol:()=>lf,ZodTransformer:()=>zo,ZodTuple:()=>Ts,ZodType:()=>Ge,ZodUndefined:()=>dp,ZodUnion:()=>mp,ZodUnknown:()=>Da,ZodVoid:()=>cf,addIssueToContext:()=>te,any:()=>yz,array:()=>Iz,bigint:()=>dz,boolean:()=>R9,coerce:()=>$z,custom:()=>k9,date:()=>fz,datetimeRegex:()=>D9,defaultErrorMap:()=>_a,discriminatedUnion:()=>Mz,effect:()=>Bz,enum:()=>Az,function:()=>Dz,getErrorMap:()=>of,getParsedType:()=>Cs,instanceof:()=>pz,intersection:()=>Pz,isAborted:()=>w0,isAsync:()=>sf,isDirty:()=>O0,isValid:()=>Nl,late:()=>cz,lazy:()=>Fz,literal:()=>kz,makeIssue:()=>Lh,map:()=>_z,nan:()=>uz,nativeEnum:()=>Lz,never:()=>xz,null:()=>gz,nullable:()=>Gz,number:()=>L9,object:()=>Sz,objectUtil:()=>D3,oboolean:()=>Wz,onumber:()=>Hz,optional:()=>Nz,ostring:()=>Vz,pipeline:()=>Uz,preprocess:()=>jz,promise:()=>Rz,quotelessJson:()=>B$,record:()=>Oz,set:()=>Ez,setErrorMap:()=>G$,strictObject:()=>Cz,string:()=>A9,symbol:()=>mz,transformer:()=>Bz,tuple:()=>wz,undefined:()=>hz,union:()=>Tz,unknown:()=>bz,util:()=>$e,void:()=>vz});u();u();u();u();u();var $e;(function(e){e.assertEqual=o=>{};function t(o){}e.assertIs=t;function r(o){throw new Error}e.assertNever=r,e.arrayToEnum=o=>{let i={};for(let s of o)i[s]=s;return i},e.getValidEnumValues=o=>{let i=e.objectKeys(o).filter(l=>typeof o[o[l]]!="number"),s={};for(let l of i)s[l]=o[l];return e.objectValues(s)},e.objectValues=o=>e.objectKeys(o).map(function(i){return o[i]}),e.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let i=[];for(let s in o)Object.prototype.hasOwnProperty.call(o,s)&&i.push(s);return i},e.find=(o,i)=>{for(let s of o)if(i(s))return s},e.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function n(o,i=" | "){return o.map(s=>typeof s=="string"?`'${s}'`:s).join(i)}e.joinValues=n,e.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})($e||($e={}));var D3;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(D3||(D3={}));var le=$e.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Cs=e=>{switch(typeof e){case"undefined":return le.undefined;case"string":return le.string;case"number":return Number.isNaN(e)?le.nan:le.number;case"boolean":return le.boolean;case"function":return le.function;case"bigint":return le.bigint;case"symbol":return le.symbol;case"object":return Array.isArray(e)?le.array:e===null?le.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?le.promise:typeof Map<"u"&&e instanceof Map?le.map:typeof Set<"u"&&e instanceof Set?le.set:typeof Date<"u"&&e instanceof Date?le.date:le.object;default:return le.unknown}};var J=$e.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),B$=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),Yn=class e extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=t}format(t){let r=t||function(i){return i.message},n={_errors:[]},o=i=>{for(let s of i.issues)if(s.code==="invalid_union")s.unionErrors.map(o);else if(s.code==="invalid_return_type")o(s.returnTypeError);else if(s.code==="invalid_arguments")o(s.argumentsError);else if(s.path.length===0)n._errors.push(r(s));else{let l=n,c=0;for(;c<s.path.length;){let p=s.path[c];c===s.path.length-1?(l[p]=l[p]||{_errors:[]},l[p]._errors.push(r(s))):l[p]=l[p]||{_errors:[]},l=l[p],c++}}};return o(this),n}static assert(t){if(!(t instanceof e))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,$e.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=r=>r.message){let r={},n=[];for(let o of this.issues)o.path.length>0?(r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(t(o))):n.push(t(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};Yn.create=e=>new Yn(e);var N$=(e,t)=>{let r;switch(e.code){case J.invalid_type:e.received===le.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case J.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,$e.jsonStringifyReplacer)}`;break;case J.unrecognized_keys:r=`Unrecognized key(s) in object: ${$e.joinValues(e.keys,", ")}`;break;case J.invalid_union:r="Invalid input";break;case J.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${$e.joinValues(e.options)}`;break;case J.invalid_enum_value:r=`Invalid enum value. Expected ${$e.joinValues(e.options)}, received '${e.received}'`;break;case J.invalid_arguments:r="Invalid function arguments";break;case J.invalid_return_type:r="Invalid function return type";break;case J.invalid_date:r="Invalid date";break;case J.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:$e.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case J.too_small:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:r="Invalid input";break;case J.too_big:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:r="Invalid input";break;case J.custom:r="Invalid input";break;case J.invalid_intersection_types:r="Intersection results could not be merged";break;case J.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case J.not_finite:r="Number must be finite";break;default:r=t.defaultError,$e.assertNever(e)}return{message:r}},_a=N$;var P9=_a;function G$(e){P9=e}function of(){return P9}u();var Lh=e=>{let{data:t,path:r,errorMaps:n,issueData:o}=e,i=[...r,...o.path||[]],s={...o,path:i};if(o.message!==void 0)return{...o,path:i,message:o.message};let l="",c=n.filter(p=>!!p).slice().reverse();for(let p of c)l=p(s,{data:t,defaultError:l}).message;return{...o,path:i,message:l}},j$=[];function te(e,t){let r=of(),n=Lh({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===_a?void 0:_a].filter(o=>!!o)});e.common.issues.push(n)}var an=class e{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,r){let n=[];for(let o of r){if(o.status==="aborted")return Se;o.status==="dirty"&&t.dirty(),n.push(o.value)}return{status:t.value,value:n}}static async mergeObjectAsync(t,r){let n=[];for(let o of r){let i=await o.key,s=await o.value;n.push({key:i,value:s})}return e.mergeObjectSync(t,n)}static mergeObjectSync(t,r){let n={};for(let o of r){let{key:i,value:s}=o;if(i.status==="aborted"||s.status==="aborted")return Se;i.status==="dirty"&&t.dirty(),s.status==="dirty"&&t.dirty(),i.value!=="__proto__"&&(typeof s.value<"u"||o.alwaysSet)&&(n[i.value]=s.value)}return{status:t.value,value:n}}},Se=Object.freeze({status:"aborted"}),ap=e=>({status:"dirty",value:e}),xn=e=>({status:"valid",value:e}),w0=e=>e.status==="aborted",O0=e=>e.status==="dirty",Nl=e=>e.status==="valid",sf=e=>typeof Promise<"u"&&e instanceof Promise;u();u();u();var fe;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(fe||(fe={}));var $o=class{constructor(t,r,n,o){this._cachedPath=[],this.parent=t,this.data=r,this._path=n,this._key=o}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},w9=(e,t)=>{if(Nl(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new Yn(e.common.issues);return this._error=r,this._error}}};function Ne(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:o}=e;if(t&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:o}:{errorMap:(s,l)=>{let{message:c}=e;return s.code==="invalid_enum_value"?{message:c??l.defaultError}:typeof l.data>"u"?{message:c??n??l.defaultError}:s.code!=="invalid_type"?{message:l.defaultError}:{message:c??r??l.defaultError}},description:o}}var Ge=class{get description(){return this._def.description}_getType(t){return Cs(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:Cs(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new an,ctx:{common:t.parent.common,data:t.data,parsedType:Cs(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(sf(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(t){let r=this._parse(t);return Promise.resolve(r)}parse(t,r){let n=this.safeParse(t,r);if(n.success)return n.data;throw n.error}safeParse(t,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Cs(t)},o=this._parseSync({data:t,path:n.path,parent:n});return w9(n,o)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Cs(t)};if(!this["~standard"].async)try{let n=this._parseSync({data:t,path:[],parent:r});return Nl(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:r}).then(n=>Nl(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(t,r){let n=await this.safeParseAsync(t,r);if(n.success)return n.data;throw n.error}async safeParseAsync(t,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Cs(t)},o=this._parse({data:t,path:n.path,parent:n}),i=await(sf(o)?o:Promise.resolve(o));return w9(n,i)}refine(t,r){let n=o=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(o):r;return this._refinement((o,i)=>{let s=t(o),l=()=>i.addIssue({code:J.custom,...n(o)});return typeof Promise<"u"&&s instanceof Promise?s.then(c=>c?!0:(l(),!1)):s?!0:(l(),!1)})}refinement(t,r){return this._refinement((n,o)=>t(n)?!0:(o.addIssue(typeof r=="function"?r(n,o):r),!1))}_refinement(t){return new zo({schema:this,typeName:Pe.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return Wo.create(this,this._def)}nullable(){return Ms.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Fa.create(this)}promise(){return Ul.create(this,this._def)}or(t){return mp.create([this,t],this._def)}and(t){return hp.create(this,t,this._def)}transform(t){return new zo({...Ne(this._def),schema:this,typeName:Pe.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new vp({...Ne(this._def),innerType:this,defaultValue:r,typeName:Pe.ZodDefault})}brand(){return new Rh({typeName:Pe.ZodBranded,type:this,...Ne(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new Ip({...Ne(this._def),innerType:this,catchValue:r,typeName:Pe.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return Bh.create(this,t)}readonly(){return Sp.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},U$=/^c[^\s-]{8,}$/i,V$=/^[0-9a-z]+$/,H$=/^[0-9A-HJKMNP-TV-Z]{26}$/i,W$=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,$$=/^[a-z0-9_-]{21}$/i,z$=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,X$=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Z$=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Y$="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",F3,J$=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,q$=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,K$=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Q$=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,ez=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,tz=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,_9="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",rz=new RegExp(`^${_9}$`);function E9(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);let r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function nz(e){return new RegExp(`^${E9(e)}$`)}function D9(e){let t=`${_9}T${E9(e)}`,r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function oz(e,t){return!!((t==="v4"||!t)&&J$.test(e)||(t==="v6"||!t)&&K$.test(e))}function iz(e,t){if(!z$.test(e))return!1;try{let[r]=e.split("."),n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),o=JSON.parse(atob(n));return!(typeof o!="object"||o===null||"typ"in o&&o?.typ!=="JWT"||!o.alg||t&&o.alg!==t)}catch{return!1}}function sz(e,t){return!!((t==="v4"||!t)&&q$.test(e)||(t==="v6"||!t)&&Q$.test(e))}var Gl=class e extends Ge{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==le.string){let i=this._getOrReturnCtx(t);return te(i,{code:J.invalid_type,expected:le.string,received:i.parsedType}),Se}let n=new an,o;for(let i of this._def.checks)if(i.kind==="min")t.data.length<i.value&&(o=this._getOrReturnCtx(t,o),te(o,{code:J.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="max")t.data.length>i.value&&(o=this._getOrReturnCtx(t,o),te(o,{code:J.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){let s=t.data.length>i.value,l=t.data.length<i.value;(s||l)&&(o=this._getOrReturnCtx(t,o),s?te(o,{code:J.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):l&&te(o,{code:J.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")Z$.test(t.data)||(o=this._getOrReturnCtx(t,o),te(o,{validation:"email",code:J.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")F3||(F3=new RegExp(Y$,"u")),F3.test(t.data)||(o=this._getOrReturnCtx(t,o),te(o,{validation:"emoji",code:J.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")W$.test(t.data)||(o=this._getOrReturnCtx(t,o),te(o,{validation:"uuid",code:J.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")$$.test(t.data)||(o=this._getOrReturnCtx(t,o),te(o,{validation:"nanoid",code:J.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")U$.test(t.data)||(o=this._getOrReturnCtx(t,o),te(o,{validation:"cuid",code:J.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")V$.test(t.data)||(o=this._getOrReturnCtx(t,o),te(o,{validation:"cuid2",code:J.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")H$.test(t.data)||(o=this._getOrReturnCtx(t,o),te(o,{validation:"ulid",code:J.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(t.data)}catch{o=this._getOrReturnCtx(t,o),te(o,{validation:"url",code:J.invalid_string,message:i.message}),n.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(t.data)||(o=this._getOrReturnCtx(t,o),te(o,{validation:"regex",code:J.invalid_string,message:i.message}),n.dirty())):i.kind==="trim"?t.data=t.data.trim():i.kind==="includes"?t.data.includes(i.value,i.position)||(o=this._getOrReturnCtx(t,o),te(o,{code:J.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),n.dirty()):i.kind==="toLowerCase"?t.data=t.data.toLowerCase():i.kind==="toUpperCase"?t.data=t.data.toUpperCase():i.kind==="startsWith"?t.data.startsWith(i.value)||(o=this._getOrReturnCtx(t,o),te(o,{code:J.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?t.data.endsWith(i.value)||(o=this._getOrReturnCtx(t,o),te(o,{code:J.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?D9(i).test(t.data)||(o=this._getOrReturnCtx(t,o),te(o,{code:J.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?rz.test(t.data)||(o=this._getOrReturnCtx(t,o),te(o,{code:J.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?nz(i).test(t.data)||(o=this._getOrReturnCtx(t,o),te(o,{code:J.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?X$.test(t.data)||(o=this._getOrReturnCtx(t,o),te(o,{validation:"duration",code:J.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?oz(t.data,i.version)||(o=this._getOrReturnCtx(t,o),te(o,{validation:"ip",code:J.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?iz(t.data,i.alg)||(o=this._getOrReturnCtx(t,o),te(o,{validation:"jwt",code:J.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?sz(t.data,i.version)||(o=this._getOrReturnCtx(t,o),te(o,{validation:"cidr",code:J.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?ez.test(t.data)||(o=this._getOrReturnCtx(t,o),te(o,{validation:"base64",code:J.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?tz.test(t.data)||(o=this._getOrReturnCtx(t,o),te(o,{validation:"base64url",code:J.invalid_string,message:i.message}),n.dirty()):$e.assertNever(i);return{status:n.value,value:t.data}}_regex(t,r,n){return this.refinement(o=>t.test(o),{validation:r,code:J.invalid_string,...fe.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...fe.errToObj(t)})}url(t){return this._addCheck({kind:"url",...fe.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...fe.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...fe.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...fe.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...fe.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...fe.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...fe.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...fe.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...fe.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...fe.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...fe.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...fe.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:t?.offset??!1,local:t?.local??!1,...fe.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...fe.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...fe.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...fe.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...fe.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...fe.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...fe.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...fe.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...fe.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...fe.errToObj(r)})}nonempty(t){return this.min(1,fe.errToObj(t))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxLength(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};Gl.create=e=>new Gl({checks:[],typeName:Pe.ZodString,coerce:e?.coerce??!1,...Ne(e)});function az(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,o=r>n?r:n,i=Number.parseInt(e.toFixed(o).replace(".","")),s=Number.parseInt(t.toFixed(o).replace(".",""));return i%s/10**o}var lp=class e extends Ge{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==le.number){let i=this._getOrReturnCtx(t);return te(i,{code:J.invalid_type,expected:le.number,received:i.parsedType}),Se}let n,o=new an;for(let i of this._def.checks)i.kind==="int"?$e.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),te(n,{code:J.invalid_type,expected:"integer",received:"float",message:i.message}),o.dirty()):i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(n=this._getOrReturnCtx(t,n),te(n,{code:J.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(n=this._getOrReturnCtx(t,n),te(n,{code:J.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?az(t.data,i.value)!==0&&(n=this._getOrReturnCtx(t,n),te(n,{code:J.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),te(n,{code:J.not_finite,message:i.message}),o.dirty()):$e.assertNever(i);return{status:o.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,fe.toString(r))}gt(t,r){return this.setLimit("min",t,!1,fe.toString(r))}lte(t,r){return this.setLimit("max",t,!0,fe.toString(r))}lt(t,r){return this.setLimit("max",t,!1,fe.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:fe.toString(o)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:fe.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:fe.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:fe.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:fe.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:fe.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:fe.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:fe.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:fe.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:fe.toString(t)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&$e.isInteger(t.value))}get isFinite(){let t=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(t===null||n.value<t)&&(t=n.value)}return Number.isFinite(r)&&Number.isFinite(t)}};lp.create=e=>new lp({checks:[],typeName:Pe.ZodNumber,coerce:e?.coerce||!1,...Ne(e)});var cp=class e extends Ge{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==le.bigint)return this._getInvalidInput(t);let n,o=new an;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(n=this._getOrReturnCtx(t,n),te(n,{code:J.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(n=this._getOrReturnCtx(t,n),te(n,{code:J.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="multipleOf"?t.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),te(n,{code:J.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):$e.assertNever(i);return{status:o.value,value:t.data}}_getInvalidInput(t){let r=this._getOrReturnCtx(t);return te(r,{code:J.invalid_type,expected:le.bigint,received:r.parsedType}),Se}gte(t,r){return this.setLimit("min",t,!0,fe.toString(r))}gt(t,r){return this.setLimit("min",t,!1,fe.toString(r))}lte(t,r){return this.setLimit("max",t,!0,fe.toString(r))}lt(t,r){return this.setLimit("max",t,!1,fe.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:fe.toString(o)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:fe.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:fe.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:fe.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:fe.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:fe.toString(r)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};cp.create=e=>new cp({checks:[],typeName:Pe.ZodBigInt,coerce:e?.coerce??!1,...Ne(e)});var pp=class extends Ge{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==le.boolean){let n=this._getOrReturnCtx(t);return te(n,{code:J.invalid_type,expected:le.boolean,received:n.parsedType}),Se}return xn(t.data)}};pp.create=e=>new pp({typeName:Pe.ZodBoolean,coerce:e?.coerce||!1,...Ne(e)});var up=class e extends Ge{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==le.date){let i=this._getOrReturnCtx(t);return te(i,{code:J.invalid_type,expected:le.date,received:i.parsedType}),Se}if(Number.isNaN(t.data.getTime())){let i=this._getOrReturnCtx(t);return te(i,{code:J.invalid_date}),Se}let n=new an,o;for(let i of this._def.checks)i.kind==="min"?t.data.getTime()<i.value&&(o=this._getOrReturnCtx(t,o),te(o,{code:J.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),n.dirty()):i.kind==="max"?t.data.getTime()>i.value&&(o=this._getOrReturnCtx(t,o),te(o,{code:J.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):$e.assertNever(i);return{status:n.value,value:new Date(t.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:fe.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:fe.toString(r)})}get minDate(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t!=null?new Date(t):null}};up.create=e=>new up({checks:[],coerce:e?.coerce||!1,typeName:Pe.ZodDate,...Ne(e)});var lf=class extends Ge{_parse(t){if(this._getType(t)!==le.symbol){let n=this._getOrReturnCtx(t);return te(n,{code:J.invalid_type,expected:le.symbol,received:n.parsedType}),Se}return xn(t.data)}};lf.create=e=>new lf({typeName:Pe.ZodSymbol,...Ne(e)});var dp=class extends Ge{_parse(t){if(this._getType(t)!==le.undefined){let n=this._getOrReturnCtx(t);return te(n,{code:J.invalid_type,expected:le.undefined,received:n.parsedType}),Se}return xn(t.data)}};dp.create=e=>new dp({typeName:Pe.ZodUndefined,...Ne(e)});var fp=class extends Ge{_parse(t){if(this._getType(t)!==le.null){let n=this._getOrReturnCtx(t);return te(n,{code:J.invalid_type,expected:le.null,received:n.parsedType}),Se}return xn(t.data)}};fp.create=e=>new fp({typeName:Pe.ZodNull,...Ne(e)});var jl=class extends Ge{constructor(){super(...arguments),this._any=!0}_parse(t){return xn(t.data)}};jl.create=e=>new jl({typeName:Pe.ZodAny,...Ne(e)});var Da=class extends Ge{constructor(){super(...arguments),this._unknown=!0}_parse(t){return xn(t.data)}};Da.create=e=>new Da({typeName:Pe.ZodUnknown,...Ne(e)});var _i=class extends Ge{_parse(t){let r=this._getOrReturnCtx(t);return te(r,{code:J.invalid_type,expected:le.never,received:r.parsedType}),Se}};_i.create=e=>new _i({typeName:Pe.ZodNever,...Ne(e)});var cf=class extends Ge{_parse(t){if(this._getType(t)!==le.undefined){let n=this._getOrReturnCtx(t);return te(n,{code:J.invalid_type,expected:le.void,received:n.parsedType}),Se}return xn(t.data)}};cf.create=e=>new cf({typeName:Pe.ZodVoid,...Ne(e)});var Fa=class e extends Ge{_parse(t){let{ctx:r,status:n}=this._processInputParams(t),o=this._def;if(r.parsedType!==le.array)return te(r,{code:J.invalid_type,expected:le.array,received:r.parsedType}),Se;if(o.exactLength!==null){let s=r.data.length>o.exactLength.value,l=r.data.length<o.exactLength.value;(s||l)&&(te(r,{code:s?J.too_big:J.too_small,minimum:l?o.exactLength.value:void 0,maximum:s?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),n.dirty())}if(o.minLength!==null&&r.data.length<o.minLength.value&&(te(r,{code:J.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),n.dirty()),o.maxLength!==null&&r.data.length>o.maxLength.value&&(te(r,{code:J.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((s,l)=>o.type._parseAsync(new $o(r,s,r.path,l)))).then(s=>an.mergeArray(n,s));let i=[...r.data].map((s,l)=>o.type._parseSync(new $o(r,s,r.path,l)));return an.mergeArray(n,i)}get element(){return this._def.type}min(t,r){return new e({...this._def,minLength:{value:t,message:fe.toString(r)}})}max(t,r){return new e({...this._def,maxLength:{value:t,message:fe.toString(r)}})}length(t,r){return new e({...this._def,exactLength:{value:t,message:fe.toString(r)}})}nonempty(t){return this.min(1,t)}};Fa.create=(e,t)=>new Fa({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Pe.ZodArray,...Ne(t)});function af(e){if(e instanceof Jn){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=Wo.create(af(n))}return new Jn({...e._def,shape:()=>t})}else return e instanceof Fa?new Fa({...e._def,type:af(e.element)}):e instanceof Wo?Wo.create(af(e.unwrap())):e instanceof Ms?Ms.create(af(e.unwrap())):e instanceof Ts?Ts.create(e.items.map(t=>af(t))):e}var Jn=class e extends Ge{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),r=$e.objectKeys(t);return this._cached={shape:t,keys:r},this._cached}_parse(t){if(this._getType(t)!==le.object){let p=this._getOrReturnCtx(t);return te(p,{code:J.invalid_type,expected:le.object,received:p.parsedType}),Se}let{status:n,ctx:o}=this._processInputParams(t),{shape:i,keys:s}=this._getCached(),l=[];if(!(this._def.catchall instanceof _i&&this._def.unknownKeys==="strip"))for(let p in o.data)s.includes(p)||l.push(p);let c=[];for(let p of s){let d=i[p],m=o.data[p];c.push({key:{status:"valid",value:p},value:d._parse(new $o(o,m,o.path,p)),alwaysSet:p in o.data})}if(this._def.catchall instanceof _i){let p=this._def.unknownKeys;if(p==="passthrough")for(let d of l)c.push({key:{status:"valid",value:d},value:{status:"valid",value:o.data[d]}});else if(p==="strict")l.length>0&&(te(o,{code:J.unrecognized_keys,keys:l}),n.dirty());else if(p!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let p=this._def.catchall;for(let d of l){let m=o.data[d];c.push({key:{status:"valid",value:d},value:p._parse(new $o(o,m,o.path,d)),alwaysSet:d in o.data})}}return o.common.async?Promise.resolve().then(async()=>{let p=[];for(let d of c){let m=await d.key,g=await d.value;p.push({key:m,value:g,alwaysSet:d.alwaysSet})}return p}).then(p=>an.mergeObjectSync(n,p)):an.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(t){return fe.errToObj,new e({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(r,n)=>{let o=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:fe.errToObj(t).message??o}:{message:o}}}:{}})}strip(){return new e({...this._def,unknownKeys:"strip"})}passthrough(){return new e({...this._def,unknownKeys:"passthrough"})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:Pe.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let r={};for(let n of $e.objectKeys(t))t[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}omit(t){let r={};for(let n of $e.objectKeys(this.shape))t[n]||(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}deepPartial(){return af(this)}partial(t){let r={};for(let n of $e.objectKeys(this.shape)){let o=this.shape[n];t&&!t[n]?r[n]=o:r[n]=o.optional()}return new e({...this._def,shape:()=>r})}required(t){let r={};for(let n of $e.objectKeys(this.shape))if(t&&!t[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof Wo;)i=i._def.innerType;r[n]=i}return new e({...this._def,shape:()=>r})}keyof(){return F9($e.objectKeys(this.shape))}};Jn.create=(e,t)=>new Jn({shape:()=>e,unknownKeys:"strip",catchall:_i.create(),typeName:Pe.ZodObject,...Ne(t)});Jn.strictCreate=(e,t)=>new Jn({shape:()=>e,unknownKeys:"strict",catchall:_i.create(),typeName:Pe.ZodObject,...Ne(t)});Jn.lazycreate=(e,t)=>new Jn({shape:e,unknownKeys:"strip",catchall:_i.create(),typeName:Pe.ZodObject,...Ne(t)});var mp=class extends Ge{_parse(t){let{ctx:r}=this._processInputParams(t),n=this._def.options;function o(i){for(let l of i)if(l.result.status==="valid")return l.result;for(let l of i)if(l.result.status==="dirty")return r.common.issues.push(...l.ctx.common.issues),l.result;let s=i.map(l=>new Yn(l.ctx.common.issues));return te(r,{code:J.invalid_union,unionErrors:s}),Se}if(r.common.async)return Promise.all(n.map(async i=>{let s={...r,common:{...r.common,issues:[]},parent:null};return{result:await i._parseAsync({data:r.data,path:r.path,parent:s}),ctx:s}})).then(o);{let i,s=[];for(let c of n){let p={...r,common:{...r.common,issues:[]},parent:null},d=c._parseSync({data:r.data,path:r.path,parent:p});if(d.status==="valid")return d;d.status==="dirty"&&!i&&(i={result:d,ctx:p}),p.common.issues.length&&s.push(p.common.issues)}if(i)return r.common.issues.push(...i.ctx.common.issues),i.result;let l=s.map(c=>new Yn(c));return te(r,{code:J.invalid_union,unionErrors:l}),Se}}get options(){return this._def.options}};mp.create=(e,t)=>new mp({options:e,typeName:Pe.ZodUnion,...Ne(t)});var Ea=e=>e instanceof gp?Ea(e.schema):e instanceof zo?Ea(e.innerType()):e instanceof yp?[e.value]:e instanceof bp?e.options:e instanceof xp?$e.objectValues(e.enum):e instanceof vp?Ea(e._def.innerType):e instanceof dp?[void 0]:e instanceof fp?[null]:e instanceof Wo?[void 0,...Ea(e.unwrap())]:e instanceof Ms?[null,...Ea(e.unwrap())]:e instanceof Rh||e instanceof Sp?Ea(e.unwrap()):e instanceof Ip?Ea(e._def.innerType):[],_0=class e extends Ge{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==le.object)return te(r,{code:J.invalid_type,expected:le.object,received:r.parsedType}),Se;let n=this.discriminator,o=r.data[n],i=this.optionsMap.get(o);return i?r.common.async?i._parseAsync({data:r.data,path:r.path,parent:r}):i._parseSync({data:r.data,path:r.path,parent:r}):(te(r,{code:J.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),Se)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,n){let o=new Map;for(let i of r){let s=Ea(i.shape[t]);if(!s.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let l of s){if(o.has(l))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(l)}`);o.set(l,i)}}return new e({typeName:Pe.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:o,...Ne(n)})}};function k3(e,t){let r=Cs(e),n=Cs(t);if(e===t)return{valid:!0,data:e};if(r===le.object&&n===le.object){let o=$e.objectKeys(t),i=$e.objectKeys(e).filter(l=>o.indexOf(l)!==-1),s={...e,...t};for(let l of i){let c=k3(e[l],t[l]);if(!c.valid)return{valid:!1};s[l]=c.data}return{valid:!0,data:s}}else if(r===le.array&&n===le.array){if(e.length!==t.length)return{valid:!1};let o=[];for(let i=0;i<e.length;i++){let s=e[i],l=t[i],c=k3(s,l);if(!c.valid)return{valid:!1};o.push(c.data)}return{valid:!0,data:o}}else return r===le.date&&n===le.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var hp=class extends Ge{_parse(t){let{status:r,ctx:n}=this._processInputParams(t),o=(i,s)=>{if(w0(i)||w0(s))return Se;let l=k3(i.value,s.value);return l.valid?((O0(i)||O0(s))&&r.dirty(),{status:r.value,value:l.data}):(te(n,{code:J.invalid_intersection_types}),Se)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([i,s])=>o(i,s)):o(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};hp.create=(e,t,r)=>new hp({left:e,right:t,typeName:Pe.ZodIntersection,...Ne(r)});var Ts=class e extends Ge{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==le.array)return te(n,{code:J.invalid_type,expected:le.array,received:n.parsedType}),Se;if(n.data.length<this._def.items.length)return te(n,{code:J.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Se;!this._def.rest&&n.data.length>this._def.items.length&&(te(n,{code:J.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let i=[...n.data].map((s,l)=>{let c=this._def.items[l]||this._def.rest;return c?c._parse(new $o(n,s,n.path,l)):null}).filter(s=>!!s);return n.common.async?Promise.all(i).then(s=>an.mergeArray(r,s)):an.mergeArray(r,i)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};Ts.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ts({items:e,typeName:Pe.ZodTuple,rest:null,...Ne(t)})};var E0=class e extends Ge{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==le.object)return te(n,{code:J.invalid_type,expected:le.object,received:n.parsedType}),Se;let o=[],i=this._def.keyType,s=this._def.valueType;for(let l in n.data)o.push({key:i._parse(new $o(n,l,n.path,l)),value:s._parse(new $o(n,n.data[l],n.path,l)),alwaysSet:l in n.data});return n.common.async?an.mergeObjectAsync(r,o):an.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof Ge?new e({keyType:t,valueType:r,typeName:Pe.ZodRecord,...Ne(n)}):new e({keyType:Gl.create(),valueType:t,typeName:Pe.ZodRecord,...Ne(r)})}},pf=class extends Ge{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==le.map)return te(n,{code:J.invalid_type,expected:le.map,received:n.parsedType}),Se;let o=this._def.keyType,i=this._def.valueType,s=[...n.data.entries()].map(([l,c],p)=>({key:o._parse(new $o(n,l,n.path,[p,"key"])),value:i._parse(new $o(n,c,n.path,[p,"value"]))}));if(n.common.async){let l=new Map;return Promise.resolve().then(async()=>{for(let c of s){let p=await c.key,d=await c.value;if(p.status==="aborted"||d.status==="aborted")return Se;(p.status==="dirty"||d.status==="dirty")&&r.dirty(),l.set(p.value,d.value)}return{status:r.value,value:l}})}else{let l=new Map;for(let c of s){let p=c.key,d=c.value;if(p.status==="aborted"||d.status==="aborted")return Se;(p.status==="dirty"||d.status==="dirty")&&r.dirty(),l.set(p.value,d.value)}return{status:r.value,value:l}}}};pf.create=(e,t,r)=>new pf({valueType:t,keyType:e,typeName:Pe.ZodMap,...Ne(r)});var uf=class e extends Ge{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==le.set)return te(n,{code:J.invalid_type,expected:le.set,received:n.parsedType}),Se;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&(te(n,{code:J.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),r.dirty()),o.maxSize!==null&&n.data.size>o.maxSize.value&&(te(n,{code:J.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),r.dirty());let i=this._def.valueType;function s(c){let p=new Set;for(let d of c){if(d.status==="aborted")return Se;d.status==="dirty"&&r.dirty(),p.add(d.value)}return{status:r.value,value:p}}let l=[...n.data.values()].map((c,p)=>i._parse(new $o(n,c,n.path,p)));return n.common.async?Promise.all(l).then(c=>s(c)):s(l)}min(t,r){return new e({...this._def,minSize:{value:t,message:fe.toString(r)}})}max(t,r){return new e({...this._def,maxSize:{value:t,message:fe.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};uf.create=(e,t)=>new uf({valueType:e,minSize:null,maxSize:null,typeName:Pe.ZodSet,...Ne(t)});var D0=class e extends Ge{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==le.function)return te(r,{code:J.invalid_type,expected:le.function,received:r.parsedType}),Se;function n(l,c){return Lh({data:l,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,of(),_a].filter(p=>!!p),issueData:{code:J.invalid_arguments,argumentsError:c}})}function o(l,c){return Lh({data:l,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,of(),_a].filter(p=>!!p),issueData:{code:J.invalid_return_type,returnTypeError:c}})}let i={errorMap:r.common.contextualErrorMap},s=r.data;if(this._def.returns instanceof Ul){let l=this;return xn(async function(...c){let p=new Yn([]),d=await l._def.args.parseAsync(c,i).catch(x=>{throw p.addIssue(n(c,x)),p}),m=await Reflect.apply(s,this,d);return await l._def.returns._def.type.parseAsync(m,i).catch(x=>{throw p.addIssue(o(m,x)),p})})}else{let l=this;return xn(function(...c){let p=l._def.args.safeParse(c,i);if(!p.success)throw new Yn([n(c,p.error)]);let d=Reflect.apply(s,this,p.data),m=l._def.returns.safeParse(d,i);if(!m.success)throw new Yn([o(d,m.error)]);return m.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:Ts.create(t).rest(Da.create())})}returns(t){return new e({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,n){return new e({args:t||Ts.create([]).rest(Da.create()),returns:r||Da.create(),typeName:Pe.ZodFunction,...Ne(n)})}},gp=class extends Ge{get schema(){return this._def.getter()}_parse(t){let{ctx:r}=this._processInputParams(t);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};gp.create=(e,t)=>new gp({getter:e,typeName:Pe.ZodLazy,...Ne(t)});var yp=class extends Ge{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return te(r,{received:r.data,code:J.invalid_literal,expected:this._def.value}),Se}return{status:"valid",value:t.data}}get value(){return this._def.value}};yp.create=(e,t)=>new yp({value:e,typeName:Pe.ZodLiteral,...Ne(t)});function F9(e,t){return new bp({values:e,typeName:Pe.ZodEnum,...Ne(t)})}var bp=class e extends Ge{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),n=this._def.values;return te(r,{expected:$e.joinValues(n),received:r.parsedType,code:J.invalid_type}),Se}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){let r=this._getOrReturnCtx(t),n=this._def.values;return te(r,{received:r.data,code:J.invalid_enum_value,options:n}),Se}return xn(t.data)}get options(){return this._def.values}get enum(){let t={};for(let r of this._def.values)t[r]=r;return t}get Values(){let t={};for(let r of this._def.values)t[r]=r;return t}get Enum(){let t={};for(let r of this._def.values)t[r]=r;return t}extract(t,r=this._def){return e.create(t,{...this._def,...r})}exclude(t,r=this._def){return e.create(this.options.filter(n=>!t.includes(n)),{...this._def,...r})}};bp.create=F9;var xp=class extends Ge{_parse(t){let r=$e.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==le.string&&n.parsedType!==le.number){let o=$e.objectValues(r);return te(n,{expected:$e.joinValues(o),received:n.parsedType,code:J.invalid_type}),Se}if(this._cache||(this._cache=new Set($e.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let o=$e.objectValues(r);return te(n,{received:n.data,code:J.invalid_enum_value,options:o}),Se}return xn(t.data)}get enum(){return this._def.values}};xp.create=(e,t)=>new xp({values:e,typeName:Pe.ZodNativeEnum,...Ne(t)});var Ul=class extends Ge{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==le.promise&&r.common.async===!1)return te(r,{code:J.invalid_type,expected:le.promise,received:r.parsedType}),Se;let n=r.parsedType===le.promise?r.data:Promise.resolve(r.data);return xn(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};Ul.create=(e,t)=>new Ul({type:e,typeName:Pe.ZodPromise,...Ne(t)});var zo=class extends Ge{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Pe.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:r,ctx:n}=this._processInputParams(t),o=this._def.effect||null,i={addIssue:s=>{te(n,s),s.fatal?r.abort():r.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),o.type==="preprocess"){let s=o.transform(n.data,i);if(n.common.async)return Promise.resolve(s).then(async l=>{if(r.value==="aborted")return Se;let c=await this._def.schema._parseAsync({data:l,path:n.path,parent:n});return c.status==="aborted"?Se:c.status==="dirty"?ap(c.value):r.value==="dirty"?ap(c.value):c});{if(r.value==="aborted")return Se;let l=this._def.schema._parseSync({data:s,path:n.path,parent:n});return l.status==="aborted"?Se:l.status==="dirty"?ap(l.value):r.value==="dirty"?ap(l.value):l}}if(o.type==="refinement"){let s=l=>{let c=o.refinement(l,i);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return l};if(n.common.async===!1){let l=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return l.status==="aborted"?Se:(l.status==="dirty"&&r.dirty(),s(l.value),{status:r.value,value:l.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(l=>l.status==="aborted"?Se:(l.status==="dirty"&&r.dirty(),s(l.value).then(()=>({status:r.value,value:l.value}))))}if(o.type==="transform")if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Nl(s))return Se;let l=o.transform(s.value,i);if(l instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:l}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>Nl(s)?Promise.resolve(o.transform(s.value,i)).then(l=>({status:r.value,value:l})):Se);$e.assertNever(o)}};zo.create=(e,t,r)=>new zo({schema:e,typeName:Pe.ZodEffects,effect:t,...Ne(r)});zo.createWithPreprocess=(e,t,r)=>new zo({schema:t,effect:{type:"preprocess",transform:e},typeName:Pe.ZodEffects,...Ne(r)});var Wo=class extends Ge{_parse(t){return this._getType(t)===le.undefined?xn(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Wo.create=(e,t)=>new Wo({innerType:e,typeName:Pe.ZodOptional,...Ne(t)});var Ms=class extends Ge{_parse(t){return this._getType(t)===le.null?xn(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Ms.create=(e,t)=>new Ms({innerType:e,typeName:Pe.ZodNullable,...Ne(t)});var vp=class extends Ge{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return r.parsedType===le.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};vp.create=(e,t)=>new vp({innerType:e,typeName:Pe.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Ne(t)});var Ip=class extends Ge{_parse(t){let{ctx:r}=this._processInputParams(t),n={...r,common:{...r.common,issues:[]}},o=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return sf(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Yn(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Yn(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Ip.create=(e,t)=>new Ip({innerType:e,typeName:Pe.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...Ne(t)});var df=class extends Ge{_parse(t){if(this._getType(t)!==le.nan){let n=this._getOrReturnCtx(t);return te(n,{code:J.invalid_type,expected:le.nan,received:n.parsedType}),Se}return{status:"valid",value:t.data}}};df.create=e=>new df({typeName:Pe.ZodNaN,...Ne(e)});var lz=Symbol("zod_brand"),Rh=class extends Ge{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},Bh=class e extends Ge{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?Se:i.status==="dirty"?(r.dirty(),ap(i.value)):this._def.out._parseAsync({data:i.value,path:n.path,parent:n})})();{let o=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?Se:o.status==="dirty"?(r.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:n.path,parent:n})}}static create(t,r){return new e({in:t,out:r,typeName:Pe.ZodPipeline})}},Sp=class extends Ge{_parse(t){let r=this._def.innerType._parse(t),n=o=>(Nl(o)&&(o.value=Object.freeze(o.value)),o);return sf(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};Sp.create=(e,t)=>new Sp({innerType:e,typeName:Pe.ZodReadonly,...Ne(t)});function O9(e,t){let r=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof r=="string"?{message:r}:r}function k9(e,t={},r){return e?jl.create().superRefine((n,o)=>{let i=e(n);if(i instanceof Promise)return i.then(s=>{if(!s){let l=O9(t,n),c=l.fatal??r??!0;o.addIssue({code:"custom",...l,fatal:c})}});if(!i){let s=O9(t,n),l=s.fatal??r??!0;o.addIssue({code:"custom",...s,fatal:l})}}):jl.create()}var cz={object:Jn.lazycreate},Pe;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(Pe||(Pe={}));var pz=(e,t={message:`Input not instance of ${e.name}`})=>k9(r=>r instanceof e,t),A9=Gl.create,L9=lp.create,uz=df.create,dz=cp.create,R9=pp.create,fz=up.create,mz=lf.create,hz=dp.create,gz=fp.create,yz=jl.create,bz=Da.create,xz=_i.create,vz=cf.create,Iz=Fa.create,Sz=Jn.create,Cz=Jn.strictCreate,Tz=mp.create,Mz=_0.create,Pz=hp.create,wz=Ts.create,Oz=E0.create,_z=pf.create,Ez=uf.create,Dz=D0.create,Fz=gp.create,kz=yp.create,Az=bp.create,Lz=xp.create,Rz=Ul.create,Bz=zo.create,Nz=Wo.create,Gz=Ms.create,jz=zo.createWithPreprocess,Uz=Bh.create,Vz=()=>A9().optional(),Hz=()=>L9().optional(),Wz=()=>R9().optional(),$z={string:e=>Gl.create({...e,coerce:!0}),number:e=>lp.create({...e,coerce:!0}),boolean:e=>pp.create({...e,coerce:!0}),bigint:e=>cp.create({...e,coerce:!0}),date:e=>up.create({...e,coerce:!0})};var zz=Se;var B9=_;var q=B9;var ff=50,N9=111319.9,A3=!1,G9=q.object({limit:q.enum(["same-floor","same-elevation"]).optional(),mode:q.enum(["travel-distance","absolute-distance"]).optional(),lineOfSight:q.boolean().optional().or(q.literal("auto")),maxDistance:q.number().optional()}),j9={lineOfSight:A3,mode:"travel-distance",maxDistance:ff,limit:"same-floor"},Er,Gh,F0,jh,L3,mf,k0,A0,Nh=class{constructor(t){T(this,jh);T(this,Er);T(this,Gh);T(this,F0,([t,r])=>{let[n,o]=[a(this,Er).mapCenter.longitude,a(this,Er).mapCenter.latitude],i=N9,s=N9*Math.cos(r*Math.PI/180),l=(t-n)*s,c=(r-o)*i;return{x:l,y:c}});f(this,"__LEGACY_NEAREST_SYNC",(t,r,n)=>{let o={...j9,...n};try{G9.parse(o)}catch(d){A.error(d);return}let i=Fd(t);if(!i)return;let s=z(this,jh,L3).call(this,i,o),l=[],c={},p=[];for(let d of r){let m=rf(d,a(this,Er));if(m)for(let g of m)c[g]||(c[g]=[]),c[g].push(d),p.push(g)}return n?.mode==="absolute-distance"?l=a(this,mf).call(this,i,s,r,o):l=a(this,A0).call(this,t,s,p,c,o),l.sort((d,m)=>d.distance-m.distance)});T(this,mf,(t,r,n,o)=>{let i=[],s=new Set(n.map(l=>l.__type));for(let l of r)for(let c of s){let p=a(this,Gh).searchWithIncludedIds([t.longitude,t.latitude],c,a(this,Er).mapName,l,n.filter(d=>d.__type===c).map(d=>d.id),o?.maxDistance??ff,o?.lineOfSight==="auto"?A3:o?.lineOfSight);if(p)for(let d of p)i.push({distance:d.distance,feature:a(this,Er).getById(c,d.node.properties.parentId)||a(this,Er).getById(c,d.node.properties.id)})}return i});T(this,k0,async(t,r,n,o,i)=>{let s=[];for(let l of r){let c,p=0;if(!Bo.is(t)){let d=a(this,mf).call(this,t.anchorTarget,[l],a(this,Er).getByType("node").filter(m=>m.floor.id===l),{limit:"same-floor",lineOfSight:i?.lineOfSight??!0,mode:"absolute-distance",maxDistance:i?.maxDistance??ff});d.length>0&&(c=d[0].feature,p=d[0].distance)}if(c){let d=new Set,m=a(this,Er).directions.navigator.findNearestNodesOnGraph(c.id,(i?.maxDistance??ff)-p,l,n,!1);for(let g of m)for(let x of o[g.feature.properties.id])d.has(x.id)||(s.push({distance:g.distance+p,feature:x}),d.add(x.id))}}return s});T(this,A0,(t,r,n,o,i)=>{let s=[];for(let l of r){let c;if(Bo.is(t)||(c=this.__LEGACY_NEAREST_SYNC(t,a(this,Er).getByType("node"),{lineOfSight:i?.lineOfSight??!0,mode:"absolute-distance",maxDistance:i?.maxDistance??ff})?.[0].feature),c){let p=a(this,Er).directions.navigator.findNearestNodesOnGraph(c.id,i?.maxDistance??ff,l,n,i?.lineOfSight==="auto"?A3:i?.lineOfSight);for(let d of p)for(let m of o[d.feature.properties.id])s.push({distance:d.distance,feature:m})}}return s});w(this,Er,t),w(this,Gh,new P0(a(this,Er),a(this,F0)))}async nearest(t,r,n){let o={...j9,...n};try{G9.parse(o)}catch(m){A.error(m);return}let i=Fd(t);if(!i)return;let s=z(this,jh,L3).call(this,i,o),l=[],c={},p=[],d=[];if(n?.mode==="absolute-distance")l=a(this,mf).call(this,i,s,r,o);else{for(let m of r)d.push(Bl(m,a(this,Er)).then(g=>{if(g)for(let x of g)c[x]||(c[x]=[]),c[x].push(m),p.push(x)}));await Promise.all(d),l=await a(this,k0).call(this,t,s,p,c,o)}return l.sort((m,g)=>m.distance-g.distance)}};Er=new WeakMap,Gh=new WeakMap,F0=new WeakMap,jh=new WeakSet,L3=function(t,r){let n=t.floorId?[t.floorId]:[];if(t.floorId==null)for(let o of a(this,Er).getByType("floor-stack")){let i=o.defaultFloor;i&&n.push(i.id)}else if(r?.limit==="same-elevation"){let o=a(this,Er).floorsById[t.floorId];if(o){let i=o?.elevation;i&&(n=a(this,Er).getByType("floor-stack").map(s=>s.floors.find(l=>l.elevation===i)?.id).filter(Boolean))}}return n},mf=new WeakMap,k0=new WeakMap,A0=new WeakMap;u();u();var Uh,L0=class{constructor(t){T(this,Uh);w(this,Uh,t||[])}get raw(){return a(this,Uh)}};Uh=new WeakMap;var ln,ce,Lt,hf=class hf extends Or{constructor(r,n){super(n.mvfData.id);f(this,"__type",hf.__type);f(this,"id","loc_");f(this,"name","");f(this,"externalId");f(this,"description");f(this,"logo");f(this,"phone");f(this,"social",[]);f(this,"images",[]);f(this,"links",[]);f(this,"website");f(this,"icon");T(this,ln);T(this,ce,{});T(this,Lt);w(this,ln,r),w(this,Lt,n.mvfData);for(let o in n.mvfData)o==="links"?this.links=n.mvfData.links.map(i=>new Gc({mvfData:i})):o==="pictures"?this.images=n.mvfData.pictures.map(i=>i.url?new Uc({mvfData:{...i,url:i.url??""},mapData:a(this,ln)}):void 0).filter(i=>i!=null):o==="website"?n.mvfData.website&&(this.website=new Gc({mvfData:n.mvfData.website})):o==="icon"?n.mvfData.icon&&(this.icon=new Uc({mvfData:{url:n.mvfData.icon},mapData:a(this,ln)})):Object.getOwnPropertyDescriptor(Object.getPrototypeOf(this),o)||Object.defineProperty(this,o,{enumerable:!0,get(){return a(this,Lt)[o]}})}static is(r){return r.__type===hf.__type}get spaces(){if(a(this,ce).spaces)return a(this,ce).spaces;if(a(this,Lt).spaces==null)return a(this,ce).spaces=[],a(this,ce).spaces;a(this,ce).spaces=[];for(let r=0;r<a(this,Lt).spaces.length;r++){let n=a(this,ln).getById("space",a(this,Lt).spaces[r].id);n&&a(this,ce).spaces.push(n)}return a(this,ce).spaces}get points(){if(a(this,ce).points)return a(this,ce).points;if(a(this,Lt).spaces==null)return a(this,ce).points=[],a(this,ce).points;a(this,ce).points=[];for(let r=0;r<a(this,Lt).spaces.length;r++){let n=a(this,ln).getById("point-of-interest",a(this,Lt).spaces[r].id);n&&a(this,ce).points.push(n)}return a(this,ce).points}get doors(){if(a(this,ce).doors)return a(this,ce).doors;if(a(this,Lt).entrances==null)return a(this,ce).doors=[],a(this,ce).doors;a(this,ce).doors=[];for(let r=0;r<a(this,Lt).entrances.length;r++){let n=a(this,ln).getById("door",a(this,Lt).entrances[r].id);n&&a(this,ce).doors.push(n)}return a(this,ce).doors}get connections(){if(a(this,ce).connections)return a(this,ce).connections;if(a(this,Lt).connections==null)return a(this,ce).connections=[],a(this,ce).connections;let r=new Set;for(let n=0;n<a(this,Lt).connections.length;n++){let o=a(this,Lt).connections[n],i=a(this,ln).mvfConnectionsById[o],l=(i==null?[]:i.nodes).map(c=>a(this,ln).getById("node",c)).filter(Boolean);for(let c of l){if(c==null)continue;let p=gs([c.coordinate.longitude,c.coordinate.latitude]),m=(a(this,ln).connectionSpaceIdsByLatLon[p]??[]).map(g=>a(this,ln).connectionsById[g]).filter(g=>g!=null);for(let g of m)r.add(g)}}return a(this,ce).connections=Array.from(r),a(this,ce).connections}get annotations(){if(a(this,ce).annotations)return a(this,ce).annotations;if(a(this,Lt).annotations==null)return a(this,ce).annotations=[],a(this,ce).annotations;a(this,ce).annotations=[];for(let r=0;r<a(this,Lt).annotations.length;r++){let n=a(this,ln).getById("annotation",a(this,Lt).annotations[r].id);n&&a(this,ce).annotations.push(n)}return a(this,ce).annotations}get categories(){return a(this,ce).categories?a(this,ce).categories:a(this,Lt).categories==null?(a(this,ce).categories=[],a(this,ce).categories):(a(this,ce).categories=a(this,Lt).categories.map(r=>a(this,ln).getById("location-category",r)).filter(r=>r!=null),a(this,ce).categories)}get mapObjects(){return a(this,ce).mapObjects?a(this,ce).mapObjects:a(this,Lt).obstructions==null?(a(this,ce).mapObjects=[],a(this,ce).mapObjects):(a(this,ce).mapObjects=a(this,Lt).obstructions.map(r=>a(this,ln).getById("object",r.id)).filter(r=>r!=null),a(this,ce).mapObjects)}get areas(){return a(this,ce).areas?a(this,ce).areas:a(this,Lt).areas==null?(a(this,ce).areas=[],a(this,ce).areas):(a(this,ce).areas=a(this,Lt).areas.map(r=>a(this,ln).getById("area",r.id)).filter(r=>r!=null),a(this,ce).areas)}get focusTarget(){if(a(this,ce).focusTarget)return a(this,ce).focusTarget;let r=[];for(let n of this.spaces)r.push(n);for(let n of this.connections)r.push(...n.coordinates);for(let n of this.doors)r.push(n.focusTarget);for(let n of this.mapObjects)r.push(n.focusTarget);for(let n of this.annotations)r.push(n.focusTarget);for(let n of this.points)r.push(n.focusTarget);for(let n of this.areas)r.push(n.focusTarget);return a(this,ce).focusTarget=r,r}get openingHours(){return a(this,ce).openingHours?a(this,ce).openingHours:(a(this,ce).openingHours=new L0(a(this,Lt).openingHoursSpecification??[]),a(this,ce).openingHours)}get navigationTarget(){if(a(this,ce).navigationTarget)return a(this,ce).navigationTarget;let r=[];for(let n of this.spaces)r.push(n);for(let n of this.connections)r.push(...n.coordinates);for(let n of this.doors)r.push(n.focusTarget);for(let n of this.mapObjects)r.push(n.focusTarget);for(let n of this.annotations)r.push(n.focusTarget);for(let n of this.points)r.push(n.focusTarget);return a(this,ce).navigationTarget=r,r}toJSON(){return{__type:hf.__type,id:this.id,name:this.name}}};ln=new WeakMap,ce=new WeakMap,Lt=new WeakMap,f(hf,"__type","location-profile");var R3=hf,tp=R3;u();var Vl,qn,Cp,gf=class gf extends Or{constructor(r,n){super(n.mvfData.id);f(this,"__type",gf.__type);f(this,"id","cat_");f(this,"name","");f(this,"icon","");T(this,Vl);T(this,qn,{});T(this,Cp);w(this,Vl,r),w(this,Cp,n.mvfData);for(let o in n.mvfData)Object.getOwnPropertyDescriptor(Object.getPrototypeOf(this),o)||Object.defineProperty(this,o,{enumerable:!0,get(){return a(this,Cp)[o]}})}static is(r){return r.__type===gf.__type}get parent(){return a(this,qn).parent?a(this,qn).parent:(a(this,qn).parent=a(this,Cp).parent?a(this,Vl).getById("location-category",a(this,Cp).parent):void 0,a(this,qn).parent)}get children(){return a(this,qn).children?a(this,qn).children:(a(this,qn).children=a(this,Vl).locationCategoriesByParentId[this.id]||[],a(this,qn).children)}get locationProfiles(){if(a(this,qn).locationProfiles)return a(this,qn).locationProfiles;let r=[];for(let n of a(this,Vl).locationProfilesByCategoryId[this.id]||[]){let o=a(this,Vl).getById("location-profile",n.id);o&&r.push(o)}return a(this,qn).locationProfiles=r,r}toJSON(){return{__type:gf.__type,id:this.id,name:this.name}}};Vl=new WeakMap,qn=new WeakMap,Cp=new WeakMap,f(gf,"__type","location-category");var B3=gf,g0=B3;var be,R0,V9,yf,Tp=class extends Fe{constructor(r,n){super();T(this,R0);f(this,"Analytics");T(this,be,{});f(this,"Query");f(this,"mvf");f(this,"outdoorViewToken");f(this,"objectEntranceNodeIdsByObstructionId");f(this,"obstructionIdByEntranceId");f(this,"venue");f(this,"tokenManager");f(this,"directions");f(this,"enterpriseMode",!1);f(this,"nodesById");f(this,"spacesById");f(this,"floorsById");f(this,"floorStacksById");f(this,"facadesById");f(this,"facadesBySpaceId");f(this,"connectionsById");f(this,"objectsById");f(this,"doorsById");f(this,"pointsOfInterestById");f(this,"annotationsById");f(this,"areasById");f(this,"locationProfilesById");f(this,"locationCategoriesById");f(this,"locationProfilesByExternalId");f(this,"locationProfilesByCategoryId");f(this,"locationCategoriesByParentId");f(this,"doorsByNodeId");f(this,"mvfAnnotationsById");f(this,"mvfConnectionsById");f(this,"mvfConnectionsByNodeId");f(this,"mvfConnectionIdsByLatLon");f(this,"mvfEntrancesById");f(this,"mvfNodesById");f(this,"mvfObstructionById");f(this,"mvfSpacesById");f(this,"mvfFloorsById");f(this,"mvfFloorStacksById");f(this,"mvfAreasById");f(this,"spacesByExternalId");f(this,"nodesByExternalId");f(this,"objectsByExternalId");f(this,"poisByExternalId");f(this,"floorsByExternalId");f(this,"floorStacksByExternalId");f(this,"doorsByExternalId");f(this,"areasByExternalId");f(this,"connectionSpaceIdsByLatLon",{});f(this,"locationProfilesByAttachedFeatureId",{});f(this,"locationsById",{});f(this,"categoriesById",{});f(this,"mvfLocationsBySpaceId",{});f(this,"locationIdsByNodeId",{});f(this,"spaceIdsByNodeId",{});f(this,"connectionsByExternalId",{});f(this,"locationsByExternalId",{});f(this,"categoriesByExternalId",{});f(this,"destinationNodesIdsBySpaceId",{});f(this,"mvfNodesByFloorId");f(this,"mvfSpacesByFloorId");f(this,"mvfPoisByFloorId");f(this,"mvfEntrancesByFloorId");f(this,"mvfAnnotationsByFloorId");f(this,"localePacksUrls");f(this,"currentLanguage");f(this,"languagePacks",{});f(this,"tilesets",{});f(this,"navigationFlags");f(this,"binaryBundle");f(this,"envControl");f(this,"getMapDataOptions");T(this,yf);f(this,"__LEGACY_GET_DIRECTIONS_MULTI_DESTINATION_SYNC",(r,n,o)=>this.__LEGACY_GET_DIRECTIONS_SYNC(r,n,{...o,multiDestination:!0}));f(this,"__LEGACY_GET_DIRECTIONS_SYNC",(r,n,o)=>{let{accessible:i=!1,multiDestination:s=!1}=o||{},l=U9(this.enterpriseMode,o),c=o?.zones||[],p={accessible:i,zones:c,smoothing:l,excludedConnections:o?.excludedConnections||[],connectionIdWeightMap:o?.connectionIdWeightMap||{}};if(s&&Array.isArray(n)){let d=Array.isArray(r)?r:[r],m=[];for(let g of n){let x=Array.isArray(g)?g:[g],v=this.directions.getDirectionsSync(d,x,p,this);if(!v){A.error("getDirections failed due to missing directions for one of the segments");return}d=x,m.push(v)}return m}else{let d=Array.isArray(r)?r:[r],m=Array.isArray(n)?n:[n];if(Array.isArray(m[0])){A.error("getDirections does not support multi-destination without multisegment option");return}d[0].id&&m[0].id&&this.Analytics.sendGetDirectionsEvent(d[0].id,m[0].id,i);try{return this.directions.getDirectionsSync(d,m,p,this)}catch(g){A.error("Unable to get directions",g);return}}});f(this,"getDirections",async(r,n,o)=>{let{accessible:i=!1}=o||{},s=U9(this.enterpriseMode,o),l=o?.zones||[],c={accessible:i,zones:l,smoothing:s,excludedConnections:o?.excludedConnections||[],connectionIdWeightMap:o?.connectionIdWeightMap||{}},p=Array.isArray(r)?r:[r],d=Array.isArray(n)?n:[n];if(Array.isArray(d[0])){A.error("getDirections does not support multi-destination without multisegment option");return}p[0].id&&d[0].id&&this.Analytics.sendGetDirectionsEvent(p[0].id,d[0].id,i);try{return this.directions.getDirections(p,d,c,this)}catch(m){A.error("Unable to get directions",m);return}});f(this,"getDirectionsMultiDestination",async(r,n,o)=>Promise.resolve(this.__LEGACY_GET_DIRECTIONS_MULTI_DESTINATION_SYNC(r,n,o)));f(this,"transformImageRequest",async r=>{if(this.enterpriseMode||!this.getMapDataOptions)return{url:r};if(!E6(r))return{url:r};if(D6(r))return{url:r};let n=d0(r);if(!n)return{url:r};try{let i=(await this.tokenManager?.getSasTokensAsync())?.[n.mapId];if(i==null)throw new Error("SAS token not found");let[s]=r.split("?");return{url:`${s}?${i.token}`}}catch(o){return A.error("Failed to append SAS token to image request. Requests for private images may fail.",o),{url:r}}});let o=n?.env??Cl();if(this.envControl=o,this.binaryBundle=n?.binaryBundle,this.Analytics=new Su,this.localePacksUrls=n?.localePacksUrls??{},this.mvf=r,this.outdoorViewToken=n?.outdoorViewToken,this.getMapDataOptions=n?.getMapDataOptions,r["tileset.json"]?.default!=null&&(this.tilesets[r["tileset.json"].default.key]=r["tileset.json"].default,o.updateTileServerBaseUrl(r["tileset.json"].default.url),r["tileset.json"].others!=null))for(let s of r["tileset.json"].others)this.tilesets[s.key]=s;this.navigationFlags=r["navigationFlags.json"]??{},this.enterpriseMode=n?.enterprise??!1,this.tokenManager=n?.tokenManager;let i=N6(r,this);if(this.nodesById=i.nodesById,this.spacesById=i.spacesById,this.floorsById=i.floorsById,this.floorStacksById=i.floorStacksById,this.facadesById=i.facadesById,this.facadesBySpaceId=i.facadesBySpaceId,this.connectionsById=i.connectionsById,this.objectsById=i.objectsById,this.doorsById=i.doorsById,this.pointsOfInterestById=i.poisById,this.annotationsById=i.annotationsById,this.areasById=i.areasById,this.locationProfilesById=i.locationProfilesById,this.locationCategoriesById=i.locationCategoriesById,this.locationProfilesByCategoryId=i.locationProfilesByCategoryId,this.locationCategoriesByParentId=i.locationCategoriesByParentId,this.spacesByExternalId=i.spacesByExternalId,this.nodesByExternalId=i.nodesByExternalId,this.objectsByExternalId=i.objectsByExternalId,this.floorsByExternalId=i.floorsByExternalId,this.locationProfilesByExternalId=i.locationProfilesByExternalId,this.floorStacksByExternalId=i.floorStacksByExternalId,this.poisByExternalId=i.poisByExternalId,this.doorsByExternalId=i.doorsByExternalId,this.areasByExternalId=i.areasByExternalId,this.mvfAnnotationsById=i.mvfAnnotationsById,this.mvfConnectionsById=i.mvfConnectionsById,this.mvfConnectionsByNodeId=i.mvfConnectionsByNodeId,this.mvfConnectionIdsByLatLon=i.mvfConnectionIdsByLatLon,this.mvfEntrancesById=i.mvfEntrancesById,this.mvfNodesById=i.mvfNodesById,this.mvfObstructionById=i.mvfObstructionById,this.mvfSpacesById=i.mvfSpacesById,this.mvfFloorsById=i.mvfFloorsById,this.mvfFloorStacksById=i.mvfFloorStacksById,this.mvfNodesByFloorId=i.mvfNodesByFloorId,this.mvfSpacesByFloorId=i.mvfSpacesByFloorId,this.mvfPoisByFloorId=i.mvfPoisByFloorId,this.mvfEntrancesByFloorId=i.mvfEntrancesByFloorId,this.mvfAnnotationsByFloorId=i.mvfAnnotationsByFloorId,this.mvfAreasById=i.mvfAreasById,this.doorsByNodeId=i.doorsByNodeId,this.objectEntranceNodeIdsByObstructionId=i.objectEntranceNodeIdsByObstructionId,this.obstructionIdByEntranceId=i.obstructionIdByEntranceId,this.connectionSpaceIdsByLatLon=i.connectionIdsByLatLon,this.locationProfilesByAttachedFeatureId=i.locationProfilesByAttachedFeatureId,this.enterpriseMode||Vh()){let s=B6(r,this);if(this.locationsById=s.locationsById,this.categoriesById=s.categoriesById,this.mvfLocationsBySpaceId=s.mvfLocationsBySpaceId,this.locationIdsByNodeId=s.locationIdsByNodeId,this.spaceIdsByNodeId=s.spaceIdsByNodeId,this.connectionsByExternalId=s.connectionsByExternalId,this.locationsByExternalId=s.locationsByExternalId,this.categoriesByExternalId=s.categoriesByExternalId,this.destinationNodesIdsBySpaceId=s.destinationNodesIdsBySpaceId,s.venue.name!=null){this.venue=new v3(this,{mvfData:s.venue});let l={};for(let c in s.mvfLocationsById)l[c]=s.mvfLocationsById[c];for(let c in s.locationInstancesById)l[c]=s.locationInstancesById[c];this.languagePacks[this.venue.defaultLanguage.code]={type:"initial",optimized:{"enterprise-location":l,"enterprise-category":s.mvfCategoriesById,"floor-stack":i.mvfFloorStacksById,floor:i.mvfFloorsById}},n?.languagePacks?.forEach(({language:c,localePack:p})=>{this.languagePacks[c.code]=qS(p)}),this.currentLanguage=this.venue.defaultLanguage}}this.directions=new nf({nodes:r["node.geojson"],geojsonCollection:r.enterprise?r.space:r.obstruction,connections:r["connection.json"],groupBy:"map",multiplicativeDistanceWeightScaling:!this.enterpriseMode}),this.Query=new Nh(this)}getEnv(){let r=this;return{get baseUri(){return r.envControl.getBaseUri()},get baseAuthUri(){return r.envControl.getBaseAuthUri()},get analyticsBaseUri(){return r.envControl.getAnalyticsBaseUri()},get tileServerUri(){return r.envControl.getTileServerUri()}}}get mapName(){return this.mvf["manifest.geojson"].features[0].properties.name}get organizationId(){return this.mvf["manifest.geojson"].features[0].properties.org_id??""}get mapCenter(){return new ge(this.mvf["manifest.geojson"].features[0].geometry.coordinates[1],this.mvf["manifest.geojson"].features[0].geometry.coordinates[0])}get naturalBearing(){return this.mvf["manifest.geojson"].features[0].properties.naturalBearing??0}get spaces(){return a(this,be).spaces==null&&(a(this,be).spaces=globalThis.Object.values(this.spacesById)),a(this,be).spaces}get objects(){return a(this,be).objects==null&&(a(this,be).objects=globalThis.Object.values(this.objectsById)),a(this,be).objects}get connections(){return a(this,be).connections==null&&(a(this,be).connections=globalThis.Object.values(this.connectionsById)),a(this,be).connections}get floors(){return a(this,be).floors==null&&(a(this,be).floors=globalThis.Object.values(this.floorsById)),a(this,be).floors}get floorStacks(){return a(this,be).floorStacks==null&&(a(this,be).floorStacks=globalThis.Object.values(this.floorStacksById)),a(this,be).floorStacks}get facades(){return a(this,be).facades==null&&(a(this,be).facades=globalThis.Object.values(this.facadesById)),a(this,be).facades}get doors(){return a(this,be).doors==null&&(a(this,be).doors=globalThis.Object.values(this.doorsById)),a(this,be).doors}get pointsOfInterest(){return a(this,be).pointsOfInterest==null&&(a(this,be).pointsOfInterest=globalThis.Object.values(this.pointsOfInterestById)),a(this,be).pointsOfInterest}get annotations(){return a(this,be).annotations==null&&(a(this,be).annotations=globalThis.Object.values(this.annotationsById)),a(this,be).annotations}get areas(){return a(this,be).areas==null&&(a(this,be).areas=globalThis.Object.values(this.areasById)),a(this,be).areas}get nodes(){return a(this,be).nodes==null&&(a(this,be).nodes=globalThis.Object.values(this.nodesById)),a(this,be).nodes}get locations(){return a(this,be).locations==null&&(a(this,be).locations=globalThis.Object.values(this.locationsById)),globalThis.Object.values(this.locationsById)}get categories(){return a(this,be).categories==null&&(a(this,be).categories=globalThis.Object.values(this.categoriesById)),globalThis.Object.values(this.categoriesById)}get locationProfiles(){return a(this,be).locationProfiles==null&&(a(this,be).locationProfiles=globalThis.Object.values(this.locationProfilesById)),a(this,be).locationProfiles}get locationCategories(){return a(this,be).locationCategories==null&&(a(this,be).locationCategories=globalThis.Object.values(this.locationCategoriesById)),a(this,be).locationCategories}get mvfFloors(){return a(this,be).mvfFloors==null&&(a(this,be).mvfFloors=globalThis.Object.values(this.mvfFloorsById)),a(this,be).mvfFloors}get mvfFloorStacks(){return a(this,be).mvfFloorStacks==null&&(a(this,be).mvfFloorStacks=globalThis.Object.values(this.mvfFloorStacksById)),a(this,be).mvfFloorStacks}getByType(r){switch(r){case"location-profile":return this.locationProfiles;case"location-category":return this.locationCategories;case"area":return this.areas;case"node":return this.nodes;case"space":return this.spaces;case"door":return this.doors;case"floor":return this.floors;case"floor-stack":return this.floorStacks;case"connection":return this.connections;case"object":return this.objects;case"point-of-interest":return this.pointsOfInterest;case"annotation":return this.annotations;case"enterprise-location":return this.locations;case"enterprise-category":return this.categories;case"enterprise-venue":return this.venue;case"facade":return this.facades;default:return[]}}getById(r,n){let o={"location-profile":this.locationProfilesById,"location-category":this.locationCategoriesById,space:this.spacesById,floor:this.floorsById,"floor-stack":this.floorStacksById,facade:this.facadesById,node:this.nodesById,door:this.doorsById,connection:this.connectionsById,"mvf-connection":l=>z(this,R0,V9).call(this,this.mvfConnectionsById[l]),object:this.objectsById,"point-of-interest":this.pointsOfInterestById,annotation:this.annotationsById,area:this.areasById,"enterprise-location":this.locationsById,"enterprise-category":this.categoriesById},i=l=>{let c=o[l];if(c!=null)return typeof c=="function"?c(n):c[n]},s=()=>{for(let l of Object.keys(o)){let c=i(l);if(c!=null)return c}};return r==="unknown"?s():i(r)}getByExternalId(r,n){switch(r){case"location-profile":return this.locationProfilesByExternalId[n]??[];case"location-category":return[];case"space":return this.spacesByExternalId[n]??[];case"floor":return this.floorsByExternalId[n]??[];case"floor-stack":return this.floorStacksByExternalId[n]??[];case"node":return this.nodesByExternalId[n]??[];case"door":return this.doorsByExternalId[n]??[];case"connection":return this.connectionsByExternalId[n]??[];case"object":return this.objectsByExternalId[n]??[];case"point-of-interest":return this.poisByExternalId[n]??[];case"area":return this.areasByExternalId[n]??[];case"enterprise-location":return this.locationsByExternalId[n]??[];case"enterprise-category":return this.categoriesByExternalId[n]??[];default:return[]}}getMapDataById(r){return this.spacesById[r]??this.floorsById[r]??this.floorStacksById[r]??this.facadesById[r]??this.nodesById[r]??this.doorsById[r]??this.connectionsById[r]??this.objectsById[r]??this.pointsOfInterestById[r]??this.annotationsById[r]??this.areasById[r]}getMVFFeatureById(r,n){switch(r){case"space":return this.mvfSpacesById[n];case"node":return this.mvfNodesById[n];case"obstruction":return this.mvfObstructionById[n];case"floor":return this.mvfFloorsById[n];case"floor-stack":return this.mvfFloorStacksById[n];case"connection":return this.mvfConnectionsById[n];case"entrance":return this.mvfEntrancesById[n];case"annotation":return this.mvfAnnotationsById[n];case"area":return this.mvfAreasById[n];default:throw new Error(`Unknown MVF feature type: ${r}`)}}getMVFFeatureByNodeId(r,n){switch(r){case"connection":return this.mvfConnectionsByNodeId[n];default:throw new Error(`Unsupported MVF feature type: ${r}`)}}getMVFFeatureByType(r){switch(r){case"floor-stack":return this.mvfFloorStacks;case"floor":return this.mvfFloors;default:throw new Error(`Unsupported MVF feature type: ${r}`)}}getPropTranslation(r,n,o,i){if(!this.currentLanguage)return i;let{code:s}=this.currentLanguage,l=this.languagePacks[s]?.optimized?.[r];if(l){let c=l[o];if(c!=null&&c[n]!==void 0)return c[n]}return i}findPreferredLanguage(r){if(!this.venue)return;let n=N3(this.venue,r);return r?.languageCode!=null&&r.languageCode.toLowerCase()!==n.code.toLowerCase()&&A.warn(`Language code "${r.languageCode}" could not be found in the venue. Using "${n.code}" instead.`),n}async changeLanguage(r){let n=r.toLowerCase();if(!n){A.error("Language code must be defined.");return}if(!this.currentLanguage||!this.venue){A.error("Changing the language is not supported for this map.");return}let o=this.currentLanguage.code,i=this.venue?.languages.find(({code:l})=>l.toLowerCase()===n.toLowerCase());if(!i){A.warn(`Language code "${n}" could not be found in the venue.`);return}if(o===i.code)return;let s=this.languagePacks[i.code];if(!s){let l=this.localePacksUrls[i.code];if(!l){A.error(`Locale pack URL not found for language code "${i.code}".`);return}a(this,yf)&&a(this,yf).abort();let c=new AbortController;w(this,yf,c);let p;try{p=await l6(l,{signal:c.signal})}catch(d){A.error(`Failed to download language pack for language code "${i.code}".`,d);return}if(!p||c.signal.aborted)return;s=qS(p),this.languagePacks[i.code]=s}this.Analytics.sendChangeLanguageEvent({fromLanguage:this.currentLanguage.code}),this.currentLanguage=i,this.publish("language-change",this.currentLanguage)}getDistance(r,n){let o=Fd(r),i=Fd(n);return wi([o.longitude,o.latitude],[i.longitude,i.latitude])}async toJSONBundle({downloadLanguagePacks:r=!0}={}){let n=[];if(r&&this.enterpriseMode){let o=new AbortController;for(let i of this.venue?.languages||[])try{if(this.localePacksUrls[i.code]){let s=await _S(this.localePacksUrls[i.code],{signal:o.signal}),l=await hd(s);l&&n.push({language:{code:i.code,name:i.name},localePack:l})}}catch(s){A.warn("failed downloading language pack",s)}}return{type:"json",options:{enterprise:this.enterpriseMode},languagePacks:n,main:this.mvf}}async toBinaryBundle({downloadLanguagePacks:r=!0}={}){if(!this.binaryBundle){A.error("binary bundle not found");return}let n=[];if(r&&this.enterpriseMode){let o=new AbortController;for(let i of this.venue?.languages||[])try{if(this.localePacksUrls[i.code]){let s=await _S(this.localePacksUrls[i.code],{signal:o.signal});s&&n.push({language:{code:i.code,name:i.name},localePack:s})}}catch(s){A.warn("failed downloading language pack",s)}}return{type:"binary",options:{enterprise:this.enterpriseMode},languagePacks:n,main:this.binaryBundle}}destroy(){for(let r of globalThis.Object.keys(a(this,be)))a(this,be)[r]=null}};be=new WeakMap,R0=new WeakSet,V9=function(r){let n=r?.nodes?.[0],o=this.getById("node",n);if(o==null)return;let i=gs([o.coordinate.longitude,o.coordinate.latitude]);return this.connectionSpaceIdsByLatLon[i]?.map(l=>this.connectionsById[l]).find(l=>l!=null)},yf=new WeakMap;var U9=(e,t)=>{let r=!e,n=t?.smoothing,i=n!=null?typeof n=="object"?n.enabled??r:n:r,s=typeof n=="object"?n.radius:void 0;return{enabled:i,radius:s??.75}};u();u();u();u();(function(){typeof globalThis!="object"&&(Object.defineProperty(Object.prototype,"__magic__",{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__)})();var H9="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAkGBwgHBgkICAgKCgkLDhcPDg0NDhwUFREXIh4jIyEeICAlKjUtJScyKCAgLj8vMjc5PDw8JC1CRkE6RjU7PDn/2wBDAQoKCg4MDhsPDxs5JiAmOTk5OTk5OTk5OTk5OTk5OTk5OTk5OTk5OTk5OTk5OTk5OTk5OTk5OTk5OTk5OTk5OTn/wgARCAIABAADAREAAhEBAxEB/8QAGwABAAMBAQEBAAAAAAAAAAAAAAECAwQFBgf/xAAWAQEBAQAAAAAAAAAAAAAAAAAAAQL/2gAMAwEAAhADEAAAAP3EAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAIAAAJAFAAAAAAAAAAAAAAAAAAAAAAAAABAgAAEgCgAAAAAAAAAAAAAAAAAAAABERLSM1zM4zXMzjMoUIqCCSSS8XNC9mpoaVomharWTQAAAAAAAAAAAAAAAAEREtIoZrnGZkucUKFStQQSTFixdNDStF0TWrmiWqbJoAAAAAAAAAAAAAIgiWkZy4HNLzHLXKcxzpzmFYmRkUKFSCCSSxcuampsbR0HSdK9R1R1HTZvWll0mlAAAAAAAAAAAIiKLnLjHNLynLXKcycxzmNYmJmUKFSCAWLFy5qamxvHQvSdJ0nVHUdFm1aparWKAjNWSKAAAAARBEtYzlyXnjmOSuM4U4q4jjOM5a5k5zAyMjOqFCCCCSSS5c0jU1NzoOk6pew7TtjuO1e0646jezWr2WSaUAAAAAECIqtZco55eY464zhTirhOI5Dks5jAwMTIzqhUqQASWLFzSNTY3Og6V646zsO2O47V7DrjqNzWy9nlZ1c0LlrLEk0EQQVipRczIyMU5q5F4U8+vOPOrgThOOuU5jAxMjMzKpUggigJiSSxY0XQ1Njc6TqjtO49CX0D0T0Y7l7E6JdzU1NEvViSalBAWIqVKLSMjIxOauM4U86vPPOrz04TjrkOYwMTIzKJQqQQCKmBJJYutzQ1Njc6TrOyO475fRPRPQjuXsToXWPn6kkkEkhCkEAgggqVMjlrzzzDy7PMPPrhOQ5jBMqoVIIIAAIAJAAJJJLFzWN16TsO49CPTPUl9Q9A6o1LFiSSSSQpCwQQCCCpVMjlrzzyzy7PMPPrhOM5kwM6zKlQQAAQASAASCxY0NI3XpOw7j0I9M9SX0z0DqjU+UqpQqVIBFgEyixJYuWLFDkrzE8o8yvOONOasipBAAAAAAAAAAABJJY2OiO1fQPUj1T0pewuVKlCCqQsBIUSSSSWLlyTM5K808pPLrzziTnrEqQQAAAAAAAAAAASSWNjojtX0D1I9VfSOuND4uzMzqhQqVIALEli5c1jUuQc1vnp5pwJzVmQQAAAAAAAAAAAAAASSaHTHevpHoHTFjMyM6zKlSpABJJcsaGkamhU5q88804E5qzIIAAAAAAAAAAAAAAJJNDpjvX0j0Dqix8dVDMolSpAqCYElixc0XU0IMjlTlrIqAAAAAAAAAAAAAAAAAWNTqjqXYGZkZpUoQQRSFIsSXLroaGhBkcqctZFQAAAAAAAAAAAAAAAACxqdUdS7EngWQCAAQASACSSSwKlSCAAAAAAAAAAAAAAAAAACSSxYFSCCAACCQACSSSwKlSCAAAAAAAAAAAAAAAAAACSSxYGIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABIAJAJAJBAAIAIABAAAAAAAAAAAAAAAAAAAABIAJAJAJBAAIAIABAAAAJABAAAAAAAAAJBILEli5Y0LlzQ0Lly5csWLAkgFSChUoUMyhmUMyhQqVKkEEAEAAAAAAAAAkEgsSWLljQuXNDQuXLlyxYsCSAVIKFShQzKGZQzKFCpUqQe+ZmZkUKFCpUEEAAkksWLFzQ0NTU2NzY3Og3NzoNzc2NjU1NS5csSAQVKmZmZGRiYmBgYHOYGBgYGBiZGRkUMypUqQCAASSWLFi5oaGpqbG5sbnQbm50G5ubGxqampcuWJAIIKGZmZGRiYmBgYHOYGBgYGR+jmBzmBzmJiZGZQoQQSSWLmhqbGxudB0nSdJ1HSdR1HSdJ0G5qamhcsWJJJBIIIBUqVKFDIyMDA5jmOU5TlOY5TmOc5znMTEyMyhQggFixc0NTY2NzoOk6TpOo6TqOo6TpOg3NTU0LlixJJIJBAIKkFChQyMjAwOY5jlOU5jnP00yMTnOc5zAwMjMoVIJJLmhqbmx0HQdBubmxqXLkkgAAAAAAAAAAAAAEEFTMzMTEwOc5znMDAyMyhUgkkuaGpsbnQdB0G5ubGpcuSSAAAAAAAAAAAAAAQQVKGZ1gAEEEEFSCACSSxJJJIAAAAAAAAAAAAAAAAAAAAAAABBBBBUggAkkksSSSAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQCCpBUqQVIKggAkFiSSxYksSSSSAAAAAAAAAAAAAAAAAAQCCpBUqQVIKggAkFiSSxYksSWBIAAKFiQAAAAAAAAACCpUoUMzIyMzMzMyhQoVKkEEAgkEkklixYuXNDQ0NTQ1NC5cuWJAAAAAAAAAAIKlShQzMjIzMzMzKFChUqQQQCCQSSSWLFyxoXNDQ1NDU0LljUkkAAAAAAAAAAggggEEAgAAAAAAAAAAAAAEkgkkkkkAAAAAAAAAAgggggEAgAAAAAEgEAAAAAAEkgkkuAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADyyCCCCCCCCAQASCSQWJJJJLEkkkkkgkkEgkAEgAAEAAgEAggEEEEEEEFSCCCCCCAQASCSQWJJJJLEkkkkkgkkEgEgEgAAEAAgEAggEEEEEH5AQQQQVBBAIAAJBIJJJLEkkkkliSSSSSQSSCQSAAAQAQQCCCCCCCCCpBBBBBUEEEAgAAkEgkkksSSSSSWJJJJJJBJIJBIAABABBAIIIIIIIIKg/LCAQCACAAAACQCQSCQSASSASCQCQAAAAAAQCAQAQCAQAQQCACAAAACQCQSCQSASSASCQCQAAAAAAQCAQAQCAQfPgAAAAAAAAAAAAAAkAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAkAAAAAAAAAAAAAAgAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAH/xAApEAAABQUBAQACAwACAwAAAAABAgQFFQMGERQWEhNAUAAgMGCAkKCw/9oACAEBAAECAP8AwTZznOf3mc5/YZE41xVivFyM6i7C8C8C8zMzMzMyDyDyDyDwV4K7ldSuZV5VgVwqZ/SCca4qxXmcjOouwvAvEzMzMzMzMyDyDyDwV4K7ldSuRVwKgrgf88TDWMrO4VHOo61Hao7ndzvB3k7yZ5M8i8i8zMzMzMyDyDyDyV5K8keSPJHmm8U3em70nam603Mi8qotUDfk5GqZUdfUc6jrUdqjvUeDvB3kzyZ5M8i8i8zMzMzMzMg8g8leSvJHkjyR5pvFN4pu9N2pOtNzIvKqLWA39PX+/saplJlh1tRfVcKrlVdKrrVdqrvVdzu53Y7sZ2M6mdRdRdBdJSUk5SUB0B0B1K6kdSOxHam7Unek70nei7UXWi6UXKk40l9NaRWWuB8/75E41zKjraq+q41nOq6VXas7VXeq71Hc7ud2O7GdRdRdZQXSUlJSUlAdCugOpXUjqR2I7U3em70nek70nai60XSk5UnGkvItIrKoCsC0FwLgXAuBbube3ubm7uiuFcZcZaZYdZUWVl1dwruVdzrulZ0qulVzqOR3EzgZeZcZcK0Vm3t7W1tbW1tgrBYC0q0q4q8jgRxpuVJzoulB0oOlBzoOVBworqa0iwi0i0q4FwLQWAr2trZ2trb3RWiuFcZaZadbUW1l1ZwruVd0rulZ0qulVzqOR3E7gZeZeK4VorNzb29ra2tsFe2CwFpVxVxV5HAjjTcqTnRdKDpQdKDnQcqDhRXU1pFhVm/ISUnKSkrLSsrKyspJyUhvitOtrLq69Q4qHGu41nGqvqLjrDKhUDW+nv1nP+Oc+vYVArFUEVEWUl1FfQcU7imckzinX0VxFoLgXyMlJykrLS0tLS0rKSclI74rjraq6uvUuKhxruNdxqr6i46wysVA1vp79Zz/AI5z6A4VArFUEVkWUl1FfQcU7imcUzinX0VxFoLZKTlJWVlpaXl5eWlpWUB0BzBxkDr669SvUr666stqqz1xqes/j5AxahFFJXRWp1yZemX0F5HCQkpOUlZaWlpeXl5aWB2lQdAcwcZE7hWcFLgpXqF1ZbVVnUDU9Z/HyBi1CV6SuitTrky9MvoLyL5AXEXEXIXIXKSkpKSkpIHIHIHIrkVxK4yJnCsvrra6uqpPVE354GJVpKaCtOtoryuEiZxM5C5C5C5SUnJSclJSQOQORXIrkVxBxM4VV9dbXV1VJ6om/PAxKtFTQVp1tFeRwkRWitFYKvb2tra2draBUCsFgLCrSrQWitOsqqT1RN+jAxKtJTTWFWitMtMtFYKzb29ra2tnaBUCsFZVhVpVoLRWnWVFJ6om/RgYlWkpprAW73v36zn++c+gOFQKv1GoJv04GCp9Rq/T36zn++c+gOFT7fUagm/TgYKn1+3/AKEeMefHjx8/n8vl8vn8/Hjx5xj9bjHnx48fP5/L5fL5/Px48ecY/wAvOPxceQIFIKIJgSAiBAVuK2FaitINAM4MwMwMsJCQkJCQkJCwosws4tAtItQtgtot4oRSCm+Hy8ecfi48gQKQUQTAkBECArcVsK1FaQaAZwZgZgZYSEhISEhISFhRZhZxaBaRahbBbRbxQikFN8BpfMWgWozWLaLcKAUWpq62vr/DX19YEoJARAhBvK2laytRGgjORlIyEYiMJLfJbxLdJbhLbJbRLaJbJbZLbAWxzHMcxzHMcxzHMDbBrYNbJraNbRrbPbh7dPbx7fOwHYjsZ2UzMZoM0maxbRbhQCi1NXW19fX19fW1QSAiBCDeVtK1laiNBGYjKRkIxEYSW+S3iW6S3CW2S2iW0S2S2yW2AtgLY5jmOY5jmOY5gbYNbJrZNbRraPbZ7cPbp7ePb52A7EdjOymZjW4e3D26e3j2+ZgMwmYhYxY4SEhISEBjKxlYiMJGAjAS3iW9TtynblO26dtUrap2zTtmnbNO2SW2S3isRWYGkG0EAItTW1/h8Phr6+rp6AtwtQs5mI9vntw9tHtk9s1LZqWzUto9tnts9uHt09vHt8zAZhMxCxixwkJCQkIDGVjKxEYSMBGAlvEt6nblO3Kdt0rap21TtmnbNO2SWyS2yW8ViKzA1A2ggBFqa2v8Ph8NfW1dPRFuFqMzGYjW+e3D20e2T2zUtk9tHto1tCzHYj2+e3T24e3D24a3DW4Nuc5znOc4FuBbhbcLbhLcJblO3CW4S3iMRGcrYVECcKYB+cJBoCjM2maDsZ7fPbp7cPbh7cNbhrcG3Oc5znOcC3C24W3C24S3CW5TtwluEt4jERnK2FRAnCmAfnCQaAoxb/7ePl8NbU09PT1NYKHy8Y/ZePl8NbU09PT1NYKHy8Y/4Z6+g1tjb3d+Rk5SVlZWVlZSTkd8Fu3s/b6es/pvX0Gtsbe7vyMnKSkrKysrKSciC8Fu3s/YKnrP9gqAb8X0NQawqBVCrMrMqMoGuNUTiYf4ICT5/L4/H4fD4fH4hSCmBAAP4AgctUtYqgqoqsqsqoFIVwqAb8X0NQawqBVCrMrMqMoGuNUTiYf4ICT5/L4/H4fD4fH4hSCmBAAP4AgctUtYqgqkqsqsqsFIV/Hn8XHj5/H4a+traurq6mpqampqampqampqampqampqampqamrq62tr/D4/Lx5/Fx4+fx+Gvra2rq6upqampqampqamrq6upqampqampqamrq6utra/w+Py/wCgEzNTc5OTs7PT09PT8/Pz09PT07Ozk3Ng9TMxLy0rKSclJSMhIb+9vbu9u7u7u7u7u729vb2/vyEjJSUnKSstLzEzNTc5OTs7Oz09PT8/Pz09PT07Ozk5NzUzMS8tKyknJSUjISG/v727vbu7u7u7u7u9u729v78hIyUlJykrLS8x0nR9H0fR9H0XRdF0XRdD0PQ9F0XRdF0XRdF0fR9H0nSdJ0vS9L0vTdN03TdP0/T9P0/T9P0/T9P0/T9R0/T9P0/T9P0/TdN03S9L0vS9J0nSdJ0fR9H0XRdF0PRdD0PQ9D0PRdF0XRdF0XR9H0fSdJ0nS9L0vS9N03TdN0/T9P0/T9P0/T9P0/T9P1HT9P0/T9P0/T9N03TdL0vS9L0vSS8tLy0tLS0rKysrKysrKysrKystLS0vLS8vLy8vMTExMTExMzMzMTMzMzM1NTUzMzMzMzMzMzExMTExMS8vLy8vLy8tKy0tKysrKysrKysrKysrLS0tLy0vLy8vLzExMTExMTMzMzEzMzMzNTU1MzMzMzMzMzMxMTExMTEvLy8vnOc5znOc5znOc5znOc5znOc59ZznPr169evXr169evXr169evXr16znOfWc5znOc5znOc5znOc5znOc5znOc59ZznPr169evXr169evXr169evXr16znOfWc5z/9YD//xAArEAEAAgIDAQABBAICAQUAAAAAAVICYgNRYQRBEEBQUzFCIDARYICQoLD/2gAIAQEAAz8A/wDgmhCEI/nYQj+RhjH5ccflxw44YMe0dtmzZs2bNmzZs2bIsjtiwlxy45/Ljn8se0fwuPbjj8uOPy44YQxR2izZs2bNmzZs2bNkWR2xYS45cc/lhP5Y9/wEQwj8sIRD1s2bNmzZs2bNmzZs2bNmzZs2bNmzZs2bNmyLMZYZMZ/KJ/dRDCPywhjCI/LZs2bNmzZs2bNmzZs2bNmzZs2bNmzZs2bNkWYywlhP5RP/ABj9hDGGMIh69bNmzZs2bNmzZsmybJsmybJsmybJsmybJsmybJs2bNmzZs2bNmzZ7+mMsZYyj9hDGGMIj9NmzZs2bNmzZs2bJsmybJsmybJs2TZNk2TZNk2bJs2bNmzZs2bNmzZ6iWMsXr16hiwYMGDBgwYo/T169/T162bNmzZs2TZNk2T2ntPae09pSlKUpSlPae09p7T2mybJsmzZs2bNmz17+nr16hiwYOPtx9uPtx9sO2DBih69evXr1s2bNmzZsmybJsmye09p7T2lKUpSlKU9p7T2ntNk2TZNmzZs2bNmz17+vr1s2bNmzZs2bNmzZs2evXr169bNmye09p7SlKUp/wC6UpSlKe09p7etmzZs9evWzZs2bNmzZs2bNmzZs2bPXr1s9bNmye09p7SlKUp/7pSlKUp7T29bPWz169evWzZs2bNmzZs2bNmzZs2bNmzZs2evU9plM/vJhMJ7T29bNnrZ62bNmzZs2bNmzZs2bNmzZs2bNnr39J7TKZ/eTCYT3+nr162bNnrZs2bJsntNk2TZPabNmzZs2etnr39JlM/wUwmP09etmzZs2bNk2TZNk2TZNk2bNmzZs2bNnv6TKZ/gphMfp69etk9p7T2ntKUpSlKUp7T2nt69e/pMpn+GmH/j9PXr1Pae09pSySlklKU9p7T29evf0mUz/DTCY/T16lP/AHSlKU/xUpSlP/dKUpT/ABUpT/8AQllKWTJl0y6ZdMumXTLpl0y6ZJSn+QlKWTJl0y6ZdMumXTLpl0y6ZJSn/sn9xKWXTLpn0z6Z9M+mXTLplVlVlVlVlVlVlVlVlVlVlRlVlVlRlVlVlVlVlVlVlVl0z6Z9M4/DPpn0z6ZdMkp/byll0y6Z9M+mfTPpn0y6ZVZVZVZVZVZVZVZVZUZVZUZVZVZVZVZVZVZVZVZVZVZdM+mfTOPwz6Z9M+mTJlVlVlVl0yZ9M2fTPpn0z6Z9M+mbPpn0z6Z9M2fTPpl0yqyqyqyqyqyomiaJomiaJomiaJomjRo0aNGjRo0aNGjRNE0TRNE0TRNE0TRNE0ZVZVZVZVZVZVZM+mbPpn0z6Z9M+mfTNn0z6Z9M+mfTPpl0y6ZVZVZVTVlVlRNE0TRlRNE0TRNE0TRo0aNGjRo0aNGjRomiaJomiaJomiaJomqaJqyq0TRNE0TRNE0TVNE1TVNU1TRNE1TVNU0TRNE0TRNGjRo0aNGjRhWHFHTgh88Pmj8Pnj/V89HBRwf1w4f64cNMXFSHFTFxUxcVIcP9cOGkOCkPno+ej55/D55cEuKemHUIo0aNGjRo0TRNE0TRNE0TVNE0TVNE1TVNE1TRNU0TRNE0TRNGjRo0aNGjRhWHFHThh88Pnj8Pnq+ejgo4P64cP9cOKkOKkOKmLipi4aYuH+uHBSHBSHz0fPR88/h88uCXFNWHUIo0aNGjRo4ZcU9MOoRRFGjRo0aNGjRo0aNGjRo0RRhVxR04IcGP4cGP+jij/GEMI/xjCP3+M/5xhxT/AJwhwT/o4Mv9XBk4p6YdQiiKNGjRo0aNGjRo0aNGjRoijGsOKOnBi4Mfw4I/0cUf4whhH+MYR+/xn/OMOKf84Q4J/wBHBP8Ar/zxrDCsOKkOKjhq4auGrhq4auGjipDjpDGsI/k8awwrDipDio4aOGrhq4auGrho4qQ46QxrCP8A0bHcMLQ47w4rw4buCzgs4O3A4HA4XA4HA4HA4O3BZwWcN3Fdx3hhaGNoR/Dx3DC0OO8OK8OG7gs4LODtwOBwOFwOBwOBwODtwWcFnDdxXcd4YWhjaEf88UftoQh4y6ZuRyuVzOZzeudz+uf1z+uf1z+uf1z+uf1zuf1z+uf1z+uf1z+udzR25nM5o7c3rlcrlZsniOkSj9tCEPGXTNyuVy+uZzOb1z+uf1z+uf1z+uf1z+uf1z+udz+uf1z+uf1z+uf1z+ueO3O5nM5vXK5XKzZPEdMUftoYsemHTDpx9OPpxVcVXDVw1cNXDVw0cNHDRw0cNHDRw0cNHDRw0cNHDRw0cNHDRw0cNHDVw1cNXFVxVcVXFVx9OPph0w6Yo/bQxY9MOnH04+nH04quKrhq4auGrhq4aOGjho4aOGjho4aOGkOGkOGkOGjho4aOGjho4aOGjhq4auGriq4quKriq4+nH0w6Ydf+wHgcLhcLicTjYdww7hh3DDuGPcMe4Y9ww7hh3DDuGHcONxuJxOFwuBwOB8753z2fPZ89nz3fNd893zXfPd893z3fP/Y+e757uC75/wCyHz/2Q+f+yHBd893z3fPd893z3fPd893zXfNd893z2fPZ8/b5+3zvncDgcLhcLicTjYdww7hh3DDuGHcMe4Ydww7hh3DDuGHcONxuJxOFwuBwPnfO+d89nz2fPZ893zXfPd813z3fPd893z/2Pnu+e7gu+f8Ash8/9kPn/shwXcF3z3fPd893z3fPd893zXfNd893z2fPZ8/b5+3zvncDdu3bt03bt26bpum6bpum6bt27du3bt26bt26bpum6bpum6bpum6bt03TdN26bpum6bpum7dN03TdN03TdN03TdN03Tdum7dum7dN27dum6bpum6bpum6bpum7du3bt03bpu3bpum6bpum6bpum6bpu3TdN03bpum6bpum6bt03TdN03TdN03TdN03TdN03TduysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysmzKzKzKybMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrJT+2lKUpSlKUpSlKUpSlKUpSlKUpSlKUpSlKUpSn9tKUpSlKUpSlKUpSlKUpSlKUpSlKUpSlKUpT/wDrA//EAB0RAAMBAAMBAQEAAAAAAAAAAAABERIwQFAgkMD/2gAIAQIBAT8A/COlKioqKioqKi+zSoqKioqL59Ro0aKyvpVlZWaNFXiVGkaNFZWV9CsrNGjRpFXepo0V8c69Zo0u1pGilfVnJWaNF+NFXNUaNFfmU0aReamkaNPzNM19VlZWaKysrK/XrKzTNGjRWaKyv+u0/8QAHREBAQACAQUAAAAAAAAAAAAAEQBAUCAQITCQwP/aAAgBAwEBPwD1NkRER07eYiIiNMRERGARERGgIiNAREZRERoCIjiYBERqiIwiI1REcCIiIiIjbkREREREfXZ//9k=";u();u();var W9=!1;function $9(){W9=!0}function z9(){return W9}var B0=class{constructor(t){f(this,"backgroundAlpha",1);f(this,"backgroundColor",new Nt);f(this,"width",0);f(this,"height",0);f(this,"options",{});f(this,"renderer");f(this,"enabledLayers",new Set([0,1]));f(this,"handleWebGLContextCreationError",t=>{this.options.onWebGLContextCreationError?.(t)});f(this,"handleWebGLContextLost",t=>{this.options.onWebGLContextLost?.(t)});f(this,"handleWebGLContextRestored",t=>{this.options.onWebGLContextRestored?.(t)});try{this.options=t,z9()?(this.renderer={setSize:()=>{},state:{reset:()=>{}},properties:{get:()=>{}},getSize:()=>({width:window.innerWidth,height:innerHeight}),getDrawingBufferSize:()=>({width:window.innerWidth,height:innerHeight}),getClearAlpha:()=>1,getClearColor:()=>new Nt,autoUpdate:!0,shadowMap:{autoUpdate:!0},getContext:()=>({getContextAttributes(){return{alpha:!0,antialias:!1,depth:!0,stencil:!1}}}),readRenderTargetPixelsAsync:()=>Promise.resolve([]),setRenderTarget:()=>{},setClearColor:()=>{},clear:()=>{},render:()=>{},clearStencil:()=>{},clearDepth:()=>{},domElement:document.createElement("canvas"),capabilities:{isWebGL2:!0}},this.renderer.domElement.style.width="1920px",Object.defineProperty(this.renderer.domElement,"clientWidth",{value:1920}),this.renderer.domElement.style.height="1080px",Object.defineProperty(this.renderer.domElement,"clientHeight",{value:1080})):this.renderer=new o5({canvas:t.canvas,alpha:t.alpha||!1,stencil:!0,antialias:typeof t.antialias=="boolean"?t.antialias:!0,powerPreference:"high-performance",preserveDrawingBuffer:!0}),this.backgroundColor=new Nt(t.backgroundColor??"#ffffff"),this.backgroundAlpha=t.backgroundAlpha??1}catch(r){A.error(r),t.onWebGLRendererError&&t.onWebGLRendererError(r)}this.domElement()?.addEventListener("webglcontextlost",this.handleWebGLContextLost),this.domElement()?.addEventListener("webglcontextrestored",this.handleWebGLContextRestored),this.domElement()?.addEventListener("webglcontextcreationerror",this.handleWebGLContextCreationError)}destroy(){this.renderer&&this.renderer.dispose?.(),this.domElement()?.removeEventListener("webglcontextlost",this.handleWebGLContextLost),this.domElement()?.removeEventListener("webglcontextrestored",this.handleWebGLContextRestored),this.domElement()?.removeEventListener("webglcontextcreationerror",this.handleWebGLContextCreationError)}render(t,r){if(this.renderer){this.renderer.state.reset(),r.layers.disableAll();for(let n of this.enabledLayers.values())r.layers.enable(n);this.renderer.clearStencil(),this.renderer.autoClear=!1,this.renderer.setRenderTarget(null),this.renderer.render(t,r),this.renderer.clearDepth(),r.layers.disableAll(),r.layers.enable(hb.ALWAYS_ON_TOP),this.renderer.render(t,r),this.renderer.state.reset()}}clear(){this.renderer&&(this.renderer.setClearColor(this.backgroundColor,this.backgroundAlpha),this.renderer.clear())}setBufferSize(t,r){y.env.NODE_ENV==="test"||!this.renderer||(this.width=t,this.height=r,this.renderer.setSize(t,r,!1))}setBackgroundColor(t,r){this.backgroundColor=t,this.backgroundAlpha=r}domElement(){return this.renderer?.domElement}};u();u();var X9='"use strict";(()=>{var Je=Object.defineProperty;var gt=(r,e,t)=>e in r?Je(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var _t=(r,e)=>{for(var t in e)Je(r,t,{get:e[t],enumerable:!0})};var w=(r,e,t)=>gt(r,typeof e!="symbol"?e+"":e,t);function Qe(r,e){return e.x+e.w<r.x+r.w&&e.x>r.x&&e.y>r.y&&e.y+e.h<r.y+r.h}function Ke(r,e){let[t,s]=e;return t>=r.x&&t<=r.x+r.w&&s>=r.y&&s<=r.y+r.h}function Ge(r,e){let t=e.x,s=e.y,n=e.x+e.w,a=e.y+e.h,o=r.x,i=r.y,u=r.x+r.w,l=r.y+r.h;return t<u&&o<n&&s<l&&i<a}function $(r,e){for(let t=0;t<e.length;t++)r.push(e[t])}var b=class{constructor(e,t,s,n,a){w(this,"x");w(this,"y");w(this,"w");w(this,"h");w(this,"userData");this.userData=typeof a>"u"?null:a,this.x=e,this.y=t,this.w=s,this.h=n}contains(e){return e===this?!1:Qe(this,e)}intersects(e){return Ge(this,e)}intersectsPoint(e){return Ke(this,e)}draw(e){e.fillStyle="rgba(123,222,26, 0.8)",e.fillRect(this.x,this.y,this.w,this.h)}};var Re=class r{constructor(e,t){w(this,"topLeft");w(this,"topRight");w(this,"bottomLeft");w(this,"bottomRight");w(this,"divided",!1);w(this,"boundary");w(this,"capacity",16);w(this,"objects",[]);w(this,"parent");this.parent=t,this.boundary=e}getSize(){return this.divided?this.objects.length+this.topLeft.getSize()+this.topRight.getSize()+this.bottomLeft.getSize()+this.bottomRight.getSize():this.objects.length}subdivide(){let{x:e,y:t,w:s,h:n}=this.boundary;this.topLeft=new r(new b(e,t,s/2,n/2),this),this.topRight=new r(new b(e+s/2,t,s/2,n/2),this),this.bottomLeft=new r(new b(e,t+n/2,s/2,n/2),this),this.bottomRight=new r(new b(e+s/2,t+n/2,s/2,n/2),this),this.divided=!0}queryRect(e){let t=[];if(this.boundary.intersects(e))t.push(...this.objects);else return[];return this.divided&&($(t,this.topLeft.queryRect(e)),$(t,this.topRight.queryRect(e)),$(t,this.bottomLeft.queryRect(e)),$(t,this.bottomRight.queryRect(e))),t}queryPoint(e){let t=[];if(this.boundary.intersectsPoint(e))t.push(...this.objects);else return[];return this.divided&&($(t,this.topLeft.queryPoint(e)),$(t,this.topRight.queryPoint(e)),$(t,this.bottomLeft.queryPoint(e)),$(t,this.bottomRight.queryPoint(e))),t}insert(e){return(this.parent?!this.boundary.contains(e):!this.boundary.intersects(e))?!1:this.objects.length<this.capacity?(this.objects.push(e),!0):(this.divided||this.subdivide(),(this.topLeft.insert(e)||this.topRight.insert(e)||this.bottomLeft.insert(e)||this.bottomRight.insert(e))===!1&&this.objects.push(e),!0)}drawObjects(e){this.objects.forEach(t=>t.draw(e)),this.divided&&(this.topLeft.drawObjects(e),this.topRight.drawObjects(e),this.bottomLeft.drawObjects(e),this.bottomRight.drawObjects(e))}draw(e){e.rect(this.boundary.x,this.boundary.y,this.boundary.w,this.boundary.h),this.divided&&(this.topLeft.draw(e),this.topRight.draw(e),this.bottomLeft.draw(e),this.bottomRight.draw(e)),e.strokeStyle="black",e.lineWidth=4,e.stroke()}};var xe={};_t(xe,{BRAND:()=>Ut,DIRTY:()=>J,EMPTY_PATH:()=>kt,INVALID:()=>p,NEVER:()=>Ar,OK:()=>T,ParseStatus:()=>k,Schema:()=>_,ZodAny:()=>U,ZodArray:()=>z,ZodBigInt:()=>K,ZodBoolean:()=>G,ZodBranded:()=>Se,ZodCatch:()=>de,ZodDate:()=>H,ZodDefault:()=>ce,ZodDiscriminatedUnion:()=>Ee,ZodEffects:()=>j,ZodEnum:()=>ie,ZodError:()=>C,ZodFirstPartyTypeKind:()=>m,ZodFunction:()=>Pe,ZodIntersection:()=>se,ZodIssueCode:()=>c,ZodLazy:()=>ne,ZodLiteral:()=>ae,ZodMap:()=>ge,ZodNaN:()=>ve,ZodNativeEnum:()=>oe,ZodNever:()=>E,ZodNull:()=>te,ZodNullable:()=>Z,ZodNumber:()=>Q,ZodObject:()=>S,ZodOptional:()=>I,ZodParsedType:()=>f,ZodPipeline:()=>Ae,ZodPromise:()=>W,ZodReadonly:()=>ue,ZodRecord:()=>Me,ZodSchema:()=>_,ZodSet:()=>_e,ZodString:()=>F,ZodSymbol:()=>me,ZodTransformer:()=>j,ZodTuple:()=>P,ZodType:()=>_,ZodUndefined:()=>ee,ZodUnion:()=>re,ZodUnknown:()=>D,ZodVoid:()=>ye,addIssueToContext:()=>d,any:()=>Ht,array:()=>sr,bigint:()=>Xt,boolean:()=>dt,coerce:()=>Sr,custom:()=>it,date:()=>Jt,datetimeRegex:()=>nt,defaultErrorMap:()=>L,discriminatedUnion:()=>or,effect:()=>vr,enum:()=>yr,function:()=>hr,getErrorMap:()=>fe,getParsedType:()=>M,instanceof:()=>qt,intersection:()=>cr,isAborted:()=>Ne,isAsync:()=>he,isDirty:()=>je,isValid:()=>B,late:()=>Wt,lazy:()=>pr,literal:()=>mr,makeIssue:()=>Ce,map:()=>lr,nan:()=>Yt,nativeEnum:()=>gr,never:()=>tr,null:()=>Gt,nullable:()=>br,number:()=>ct,object:()=>nr,objectUtil:()=>ze,oboolean:()=>Cr,onumber:()=>Rr,optional:()=>xr,ostring:()=>Tr,pipeline:()=>wr,preprocess:()=>kr,promise:()=>_r,quotelessJson:()=>vt,record:()=>ur,set:()=>fr,setErrorMap:()=>bt,strictObject:()=>ar,string:()=>ot,symbol:()=>Qt,transformer:()=>vr,tuple:()=>dr,undefined:()=>Kt,union:()=>ir,unknown:()=>er,util:()=>v,void:()=>rr});var v;(function(r){r.assertEqual=n=>{};function e(n){}r.assertIs=e;function t(n){throw new Error}r.assertNever=t,r.arrayToEnum=n=>{let a={};for(let o of n)a[o]=o;return a},r.getValidEnumValues=n=>{let a=r.objectKeys(n).filter(i=>typeof n[n[i]]!="number"),o={};for(let i of a)o[i]=n[i];return r.objectValues(o)},r.objectValues=n=>r.objectKeys(n).map(function(a){return n[a]}),r.objectKeys=typeof Object.keys=="function"?n=>Object.keys(n):n=>{let a=[];for(let o in n)Object.prototype.hasOwnProperty.call(n,o)&&a.push(o);return a},r.find=(n,a)=>{for(let o of n)if(a(o))return o},r.isInteger=typeof Number.isInteger=="function"?n=>Number.isInteger(n):n=>typeof n=="number"&&Number.isFinite(n)&&Math.floor(n)===n;function s(n,a=" | "){return n.map(o=>typeof o=="string"?`\'${o}\'`:o).join(a)}r.joinValues=s,r.jsonStringifyReplacer=(n,a)=>typeof a=="bigint"?a.toString():a})(v||(v={}));var ze;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(ze||(ze={}));var f=v.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),M=r=>{switch(typeof r){case"undefined":return f.undefined;case"string":return f.string;case"number":return Number.isNaN(r)?f.nan:f.number;case"boolean":return f.boolean;case"function":return f.function;case"bigint":return f.bigint;case"symbol":return f.symbol;case"object":return Array.isArray(r)?f.array:r===null?f.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?f.promise:typeof Map<"u"&&r instanceof Map?f.map:typeof Set<"u"&&r instanceof Set?f.set:typeof Date<"u"&&r instanceof Date?f.date:f.object;default:return f.unknown}};var c=v.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),vt=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:"),C=class r extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){let t=e||function(a){return a.message},s={_errors:[]},n=a=>{for(let o of a.issues)if(o.code==="invalid_union")o.unionErrors.map(n);else if(o.code==="invalid_return_type")n(o.returnTypeError);else if(o.code==="invalid_arguments")n(o.argumentsError);else if(o.path.length===0)s._errors.push(t(o));else{let i=s,u=0;for(;u<o.path.length;){let l=o.path[u];u===o.path.length-1?(i[l]=i[l]||{_errors:[]},i[l]._errors.push(t(o))):i[l]=i[l]||{_errors:[]},i=i[l],u++}}};return n(this),s}static assert(e){if(!(e instanceof r))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,v.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){let t={},s=[];for(let n of this.issues)n.path.length>0?(t[n.path[0]]=t[n.path[0]]||[],t[n.path[0]].push(e(n))):s.push(e(n));return{formErrors:s,fieldErrors:t}}get formErrors(){return this.flatten()}};C.create=r=>new C(r);var xt=(r,e)=>{let t;switch(r.code){case c.invalid_type:r.received===f.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case c.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,v.jsonStringifyReplacer)}`;break;case c.unrecognized_keys:t=`Unrecognized key(s) in object: ${v.joinValues(r.keys,", ")}`;break;case c.invalid_union:t="Invalid input";break;case c.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${v.joinValues(r.options)}`;break;case c.invalid_enum_value:t=`Invalid enum value. Expected ${v.joinValues(r.options)}, received \'${r.received}\'`;break;case c.invalid_arguments:t="Invalid function arguments";break;case c.invalid_return_type:t="Invalid function return type";break;case c.invalid_date:t="Invalid date";break;case c.invalid_string:typeof r.validation=="object"?"includes"in r.validation?(t=`Invalid input: must include "${r.validation.includes}"`,typeof r.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${r.validation.position}`)):"startsWith"in r.validation?t=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?t=`Invalid input: must end with "${r.validation.endsWith}"`:v.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case c.too_small:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(r.minimum))}`:t="Invalid input";break;case c.too_big:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="bigint"?t=`BigInt must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(r.maximum))}`:t="Invalid input";break;case c.custom:t="Invalid input";break;case c.invalid_intersection_types:t="Intersection results could not be merged";break;case c.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case c.not_finite:t="Number must be finite";break;default:t=e.defaultError,v.assertNever(r)}return{message:t}},L=xt;var He=L;function bt(r){He=r}function fe(){return He}var Ce=r=>{let{data:e,path:t,errorMaps:s,issueData:n}=r,a=[...t,...n.path||[]],o={...n,path:a};if(n.message!==void 0)return{...n,path:a,message:n.message};let i="",u=s.filter(l=>!!l).slice().reverse();for(let l of u)i=l(o,{data:e,defaultError:i}).message;return{...n,path:a,message:i}},kt=[];function d(r,e){let t=fe(),s=Ce({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t,t===L?void 0:L].filter(n=>!!n)});r.common.issues.push(s)}var k=class r{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){let s=[];for(let n of t){if(n.status==="aborted")return p;n.status==="dirty"&&e.dirty(),s.push(n.value)}return{status:e.value,value:s}}static async mergeObjectAsync(e,t){let s=[];for(let n of t){let a=await n.key,o=await n.value;s.push({key:a,value:o})}return r.mergeObjectSync(e,s)}static mergeObjectSync(e,t){let s={};for(let n of t){let{key:a,value:o}=n;if(a.status==="aborted"||o.status==="aborted")return p;a.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof o.value<"u"||n.alwaysSet)&&(s[a.value]=o.value)}return{status:e.value,value:s}}},p=Object.freeze({status:"aborted"}),J=r=>({status:"dirty",value:r}),T=r=>({status:"valid",value:r}),Ne=r=>r.status==="aborted",je=r=>r.status==="dirty",B=r=>r.status==="valid",he=r=>typeof Promise<"u"&&r instanceof Promise;var h;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e?.message})(h||(h={}));var N=class{constructor(e,t,s,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=s,this._key=n}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},et=(r,e)=>{if(B(e))return{success:!0,data:e.value};if(!r.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new C(r.common.issues);return this._error=t,this._error}}};function y(r){if(!r)return{};let{errorMap:e,invalid_type_error:t,required_error:s,description:n}=r;if(e&&(t||s))throw new Error(`Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:n}:{errorMap:(o,i)=>{let{message:u}=r;return o.code==="invalid_enum_value"?{message:u??i.defaultError}:typeof i.data>"u"?{message:u??s??i.defaultError}:o.code!=="invalid_type"?{message:i.defaultError}:{message:u??t??i.defaultError}},description:n}}var _=class{get description(){return this._def.description}_getType(e){return M(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:M(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new k,ctx:{common:e.parent.common,data:e.data,parsedType:M(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(he(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let s=this.safeParse(e,t);if(s.success)return s.data;throw s.error}safeParse(e,t){let s={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:M(e)},n=this._parseSync({data:e,path:s.path,parent:s});return et(s,n)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:M(e)};if(!this["~standard"].async)try{let s=this._parseSync({data:e,path:[],parent:t});return B(s)?{value:s.value}:{issues:t.common.issues}}catch(s){s?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(s=>B(s)?{value:s.value}:{issues:t.common.issues})}async parseAsync(e,t){let s=await this.safeParseAsync(e,t);if(s.success)return s.data;throw s.error}async safeParseAsync(e,t){let s={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:M(e)},n=this._parse({data:e,path:s.path,parent:s}),a=await(he(n)?n:Promise.resolve(n));return et(s,a)}refine(e,t){let s=n=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(n):t;return this._refinement((n,a)=>{let o=e(n),i=()=>a.addIssue({code:c.custom,...s(n)});return typeof Promise<"u"&&o instanceof Promise?o.then(u=>u?!0:(i(),!1)):o?!0:(i(),!1)})}refinement(e,t){return this._refinement((s,n)=>e(s)?!0:(n.addIssue(typeof t=="function"?t(s,n):t),!1))}_refinement(e){return new j({schema:this,typeName:m.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return I.create(this,this._def)}nullable(){return Z.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return z.create(this)}promise(){return W.create(this,this._def)}or(e){return re.create([this,e],this._def)}and(e){return se.create(this,e,this._def)}transform(e){return new j({...y(this._def),schema:this,typeName:m.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new ce({...y(this._def),innerType:this,defaultValue:t,typeName:m.ZodDefault})}brand(){return new Se({typeName:m.ZodBranded,type:this,...y(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new de({...y(this._def),innerType:this,catchValue:t,typeName:m.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Ae.create(this,e)}readonly(){return ue.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},wt=/^c[^\\s-]{8,}$/i,Tt=/^[0-9a-z]+$/,Rt=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Ct=/^[0-9a-fA-F]{8}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{12}$/i,St=/^[a-z0-9_-]{21}$/i,At=/^[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]*$/,Ot=/^[-+]?P(?!$)(?:(?:[-+]?\\d+Y)|(?:[-+]?\\d+[.,]\\d+Y$))?(?:(?:[-+]?\\d+M)|(?:[-+]?\\d+[.,]\\d+M$))?(?:(?:[-+]?\\d+W)|(?:[-+]?\\d+[.,]\\d+W$))?(?:(?:[-+]?\\d+D)|(?:[-+]?\\d+[.,]\\d+D$))?(?:T(?=[\\d+-])(?:(?:[-+]?\\d+H)|(?:[-+]?\\d+[.,]\\d+H$))?(?:(?:[-+]?\\d+M)|(?:[-+]?\\d+[.,]\\d+M$))?(?:[-+]?\\d+(?:[.,]\\d+)?S)?)??$/,It=/^(?!\\.)(?!.*\\.\\.)([A-Z0-9_\'+\\-\\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\\-]*\\.)+[A-Z]{2,}$/i,Nt="^(\\\\p{Extended_Pictographic}|\\\\p{Emoji_Component})+$",Be,jt=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Et=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\/(3[0-2]|[12]?[0-9])$/,Mt=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Pt=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Zt=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,$t=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,rt="((\\\\d\\\\d[2468][048]|\\\\d\\\\d[13579][26]|\\\\d\\\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\\\d|30)|(02)-(0[1-9]|1\\\\d|2[0-8])))",Lt=new RegExp(`^${rt}$`);function st(r){let e="[0-5]\\\\d";r.precision?e=`${e}\\\\.\\\\d{${r.precision}}`:r.precision==null&&(e=`${e}(\\\\.\\\\d+)?`);let t=r.precision?"+":"?";return`([01]\\\\d|2[0-3]):[0-5]\\\\d(:${e})${t}`}function Vt(r){return new RegExp(`^${st(r)}$`)}function nt(r){let e=`${rt}T${st(r)}`,t=[];return t.push(r.local?"Z?":"Z"),r.offset&&t.push("([+-]\\\\d{2}:?\\\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function Dt(r,e){return!!((e==="v4"||!e)&&jt.test(r)||(e==="v6"||!e)&&Mt.test(r))}function zt(r,e){if(!At.test(r))return!1;try{let[t]=r.split("."),s=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),n=JSON.parse(atob(s));return!(typeof n!="object"||n===null||"typ"in n&&n?.typ!=="JWT"||!n.alg||e&&n.alg!==e)}catch{return!1}}function Bt(r,e){return!!((e==="v4"||!e)&&Et.test(r)||(e==="v6"||!e)&&Pt.test(r))}var F=class r extends _{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==f.string){let a=this._getOrReturnCtx(e);return d(a,{code:c.invalid_type,expected:f.string,received:a.parsedType}),p}let s=new k,n;for(let a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(n=this._getOrReturnCtx(e,n),d(n,{code:c.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),s.dirty());else if(a.kind==="max")e.data.length>a.value&&(n=this._getOrReturnCtx(e,n),d(n,{code:c.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),s.dirty());else if(a.kind==="length"){let o=e.data.length>a.value,i=e.data.length<a.value;(o||i)&&(n=this._getOrReturnCtx(e,n),o?d(n,{code:c.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):i&&d(n,{code:c.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),s.dirty())}else if(a.kind==="email")It.test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"email",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="emoji")Be||(Be=new RegExp(Nt,"u")),Be.test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"emoji",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="uuid")Ct.test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"uuid",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="nanoid")St.test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"nanoid",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="cuid")wt.test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"cuid",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="cuid2")Tt.test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"cuid2",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="ulid")Rt.test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"ulid",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),d(n,{validation:"url",code:c.invalid_string,message:a.message}),s.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"regex",code:c.invalid_string,message:a.message}),s.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(n=this._getOrReturnCtx(e,n),d(n,{code:c.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),s.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(n=this._getOrReturnCtx(e,n),d(n,{code:c.invalid_string,validation:{startsWith:a.value},message:a.message}),s.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(n=this._getOrReturnCtx(e,n),d(n,{code:c.invalid_string,validation:{endsWith:a.value},message:a.message}),s.dirty()):a.kind==="datetime"?nt(a).test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{code:c.invalid_string,validation:"datetime",message:a.message}),s.dirty()):a.kind==="date"?Lt.test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{code:c.invalid_string,validation:"date",message:a.message}),s.dirty()):a.kind==="time"?Vt(a).test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{code:c.invalid_string,validation:"time",message:a.message}),s.dirty()):a.kind==="duration"?Ot.test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"duration",code:c.invalid_string,message:a.message}),s.dirty()):a.kind==="ip"?Dt(e.data,a.version)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"ip",code:c.invalid_string,message:a.message}),s.dirty()):a.kind==="jwt"?zt(e.data,a.alg)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"jwt",code:c.invalid_string,message:a.message}),s.dirty()):a.kind==="cidr"?Bt(e.data,a.version)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"cidr",code:c.invalid_string,message:a.message}),s.dirty()):a.kind==="base64"?Zt.test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"base64",code:c.invalid_string,message:a.message}),s.dirty()):a.kind==="base64url"?$t.test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"base64url",code:c.invalid_string,message:a.message}),s.dirty()):v.assertNever(a);return{status:s.value,value:e.data}}_regex(e,t,s){return this.refinement(n=>e.test(n),{validation:t,code:c.invalid_string,...h.errToObj(s)})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...h.errToObj(e)})}url(e){return this._addCheck({kind:"url",...h.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...h.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...h.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...h.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...h.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...h.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...h.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...h.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...h.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...h.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...h.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...h.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...h.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...h.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...h.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...h.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...h.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...h.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...h.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...h.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...h.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...h.errToObj(t)})}nonempty(e){return this.min(1,h.errToObj(e))}trim(){return new r({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new r({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new r({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};F.create=r=>new F({checks:[],typeName:m.ZodString,coerce:r?.coerce??!1,...y(r)});function Ft(r,e){let t=(r.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,n=t>s?t:s,a=Number.parseInt(r.toFixed(n).replace(".","")),o=Number.parseInt(e.toFixed(n).replace(".",""));return a%o/10**n}var Q=class r extends _{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==f.number){let a=this._getOrReturnCtx(e);return d(a,{code:c.invalid_type,expected:f.number,received:a.parsedType}),p}let s,n=new k;for(let a of this._def.checks)a.kind==="int"?v.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{code:c.invalid_type,expected:"integer",received:"float",message:a.message}),n.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(s=this._getOrReturnCtx(e,s),d(s,{code:c.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(s=this._getOrReturnCtx(e,s),d(s,{code:c.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):a.kind==="multipleOf"?Ft(e.data,a.value)!==0&&(s=this._getOrReturnCtx(e,s),d(s,{code:c.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{code:c.not_finite,message:a.message}),n.dirty()):v.assertNever(a);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,h.toString(t))}gt(e,t){return this.setLimit("min",e,!1,h.toString(t))}lte(e,t){return this.setLimit("max",e,!0,h.toString(t))}lt(e,t){return this.setLimit("max",e,!1,h.toString(t))}setLimit(e,t,s,n){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:h.toString(n)}]})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:h.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:h.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:h.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:h.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:h.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:h.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:h.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:h.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:h.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&v.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(t===null||s.value>t)&&(t=s.value):s.kind==="max"&&(e===null||s.value<e)&&(e=s.value)}return Number.isFinite(t)&&Number.isFinite(e)}};Q.create=r=>new Q({checks:[],typeName:m.ZodNumber,coerce:r?.coerce||!1,...y(r)});var K=class r extends _{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==f.bigint)return this._getInvalidInput(e);let s,n=new k;for(let a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(s=this._getOrReturnCtx(e,s),d(s,{code:c.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(s=this._getOrReturnCtx(e,s),d(s,{code:c.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(s=this._getOrReturnCtx(e,s),d(s,{code:c.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):v.assertNever(a);return{status:n.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return d(t,{code:c.invalid_type,expected:f.bigint,received:t.parsedType}),p}gte(e,t){return this.setLimit("min",e,!0,h.toString(t))}gt(e,t){return this.setLimit("min",e,!1,h.toString(t))}lte(e,t){return this.setLimit("max",e,!0,h.toString(t))}lt(e,t){return this.setLimit("max",e,!1,h.toString(t))}setLimit(e,t,s,n){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:h.toString(n)}]})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:h.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:h.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:h.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:h.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:h.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};K.create=r=>new K({checks:[],typeName:m.ZodBigInt,coerce:r?.coerce??!1,...y(r)});var G=class extends _{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==f.boolean){let s=this._getOrReturnCtx(e);return d(s,{code:c.invalid_type,expected:f.boolean,received:s.parsedType}),p}return T(e.data)}};G.create=r=>new G({typeName:m.ZodBoolean,coerce:r?.coerce||!1,...y(r)});var H=class r extends _{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==f.date){let a=this._getOrReturnCtx(e);return d(a,{code:c.invalid_type,expected:f.date,received:a.parsedType}),p}if(Number.isNaN(e.data.getTime())){let a=this._getOrReturnCtx(e);return d(a,{code:c.invalid_date}),p}let s=new k,n;for(let a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(n=this._getOrReturnCtx(e,n),d(n,{code:c.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),s.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(n=this._getOrReturnCtx(e,n),d(n,{code:c.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),s.dirty()):v.assertNever(a);return{status:s.value,value:new Date(e.data.getTime())}}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:h.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:h.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}};H.create=r=>new H({checks:[],coerce:r?.coerce||!1,typeName:m.ZodDate,...y(r)});var me=class extends _{_parse(e){if(this._getType(e)!==f.symbol){let s=this._getOrReturnCtx(e);return d(s,{code:c.invalid_type,expected:f.symbol,received:s.parsedType}),p}return T(e.data)}};me.create=r=>new me({typeName:m.ZodSymbol,...y(r)});var ee=class extends _{_parse(e){if(this._getType(e)!==f.undefined){let s=this._getOrReturnCtx(e);return d(s,{code:c.invalid_type,expected:f.undefined,received:s.parsedType}),p}return T(e.data)}};ee.create=r=>new ee({typeName:m.ZodUndefined,...y(r)});var te=class extends _{_parse(e){if(this._getType(e)!==f.null){let s=this._getOrReturnCtx(e);return d(s,{code:c.invalid_type,expected:f.null,received:s.parsedType}),p}return T(e.data)}};te.create=r=>new te({typeName:m.ZodNull,...y(r)});var U=class extends _{constructor(){super(...arguments),this._any=!0}_parse(e){return T(e.data)}};U.create=r=>new U({typeName:m.ZodAny,...y(r)});var D=class extends _{constructor(){super(...arguments),this._unknown=!0}_parse(e){return T(e.data)}};D.create=r=>new D({typeName:m.ZodUnknown,...y(r)});var E=class extends _{_parse(e){let t=this._getOrReturnCtx(e);return d(t,{code:c.invalid_type,expected:f.never,received:t.parsedType}),p}};E.create=r=>new E({typeName:m.ZodNever,...y(r)});var ye=class extends _{_parse(e){if(this._getType(e)!==f.undefined){let s=this._getOrReturnCtx(e);return d(s,{code:c.invalid_type,expected:f.void,received:s.parsedType}),p}return T(e.data)}};ye.create=r=>new ye({typeName:m.ZodVoid,...y(r)});var z=class r extends _{_parse(e){let{ctx:t,status:s}=this._processInputParams(e),n=this._def;if(t.parsedType!==f.array)return d(t,{code:c.invalid_type,expected:f.array,received:t.parsedType}),p;if(n.exactLength!==null){let o=t.data.length>n.exactLength.value,i=t.data.length<n.exactLength.value;(o||i)&&(d(t,{code:o?c.too_big:c.too_small,minimum:i?n.exactLength.value:void 0,maximum:o?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),s.dirty())}if(n.minLength!==null&&t.data.length<n.minLength.value&&(d(t,{code:c.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),s.dirty()),n.maxLength!==null&&t.data.length>n.maxLength.value&&(d(t,{code:c.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),s.dirty()),t.common.async)return Promise.all([...t.data].map((o,i)=>n.type._parseAsync(new N(t,o,t.path,i)))).then(o=>k.mergeArray(s,o));let a=[...t.data].map((o,i)=>n.type._parseSync(new N(t,o,t.path,i)));return k.mergeArray(s,a)}get element(){return this._def.type}min(e,t){return new r({...this._def,minLength:{value:e,message:h.toString(t)}})}max(e,t){return new r({...this._def,maxLength:{value:e,message:h.toString(t)}})}length(e,t){return new r({...this._def,exactLength:{value:e,message:h.toString(t)}})}nonempty(e){return this.min(1,e)}};z.create=(r,e)=>new z({type:r,minLength:null,maxLength:null,exactLength:null,typeName:m.ZodArray,...y(e)});function pe(r){if(r instanceof S){let e={};for(let t in r.shape){let s=r.shape[t];e[t]=I.create(pe(s))}return new S({...r._def,shape:()=>e})}else return r instanceof z?new z({...r._def,type:pe(r.element)}):r instanceof I?I.create(pe(r.unwrap())):r instanceof Z?Z.create(pe(r.unwrap())):r instanceof P?P.create(r.items.map(e=>pe(e))):r}var S=class r extends _{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=v.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==f.object){let l=this._getOrReturnCtx(e);return d(l,{code:c.invalid_type,expected:f.object,received:l.parsedType}),p}let{status:s,ctx:n}=this._processInputParams(e),{shape:a,keys:o}=this._getCached(),i=[];if(!(this._def.catchall instanceof E&&this._def.unknownKeys==="strip"))for(let l in n.data)o.includes(l)||i.push(l);let u=[];for(let l of o){let g=a[l],R=n.data[l];u.push({key:{status:"valid",value:l},value:g._parse(new N(n,R,n.path,l)),alwaysSet:l in n.data})}if(this._def.catchall instanceof E){let l=this._def.unknownKeys;if(l==="passthrough")for(let g of i)u.push({key:{status:"valid",value:g},value:{status:"valid",value:n.data[g]}});else if(l==="strict")i.length>0&&(d(n,{code:c.unrecognized_keys,keys:i}),s.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let l=this._def.catchall;for(let g of i){let R=n.data[g];u.push({key:{status:"valid",value:g},value:l._parse(new N(n,R,n.path,g)),alwaysSet:g in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let l=[];for(let g of u){let R=await g.key,Oe=await g.value;l.push({key:R,value:Oe,alwaysSet:g.alwaysSet})}return l}).then(l=>k.mergeObjectSync(s,l)):k.mergeObjectSync(s,u)}get shape(){return this._def.shape()}strict(e){return h.errToObj,new r({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,s)=>{let n=this._def.errorMap?.(t,s).message??s.defaultError;return t.code==="unrecognized_keys"?{message:h.errToObj(e).message??n}:{message:n}}}:{}})}strip(){return new r({...this._def,unknownKeys:"strip"})}passthrough(){return new r({...this._def,unknownKeys:"passthrough"})}extend(e){return new r({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new r({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:m.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new r({...this._def,catchall:e})}pick(e){let t={};for(let s of v.objectKeys(e))e[s]&&this.shape[s]&&(t[s]=this.shape[s]);return new r({...this._def,shape:()=>t})}omit(e){let t={};for(let s of v.objectKeys(this.shape))e[s]||(t[s]=this.shape[s]);return new r({...this._def,shape:()=>t})}deepPartial(){return pe(this)}partial(e){let t={};for(let s of v.objectKeys(this.shape)){let n=this.shape[s];e&&!e[s]?t[s]=n:t[s]=n.optional()}return new r({...this._def,shape:()=>t})}required(e){let t={};for(let s of v.objectKeys(this.shape))if(e&&!e[s])t[s]=this.shape[s];else{let a=this.shape[s];for(;a instanceof I;)a=a._def.innerType;t[s]=a}return new r({...this._def,shape:()=>t})}keyof(){return at(v.objectKeys(this.shape))}};S.create=(r,e)=>new S({shape:()=>r,unknownKeys:"strip",catchall:E.create(),typeName:m.ZodObject,...y(e)});S.strictCreate=(r,e)=>new S({shape:()=>r,unknownKeys:"strict",catchall:E.create(),typeName:m.ZodObject,...y(e)});S.lazycreate=(r,e)=>new S({shape:r,unknownKeys:"strip",catchall:E.create(),typeName:m.ZodObject,...y(e)});var re=class extends _{_parse(e){let{ctx:t}=this._processInputParams(e),s=this._def.options;function n(a){for(let i of a)if(i.result.status==="valid")return i.result;for(let i of a)if(i.result.status==="dirty")return t.common.issues.push(...i.ctx.common.issues),i.result;let o=a.map(i=>new C(i.ctx.common.issues));return d(t,{code:c.invalid_union,unionErrors:o}),p}if(t.common.async)return Promise.all(s.map(async a=>{let o={...t,common:{...t.common,issues:[]},parent:null};return{result:await a._parseAsync({data:t.data,path:t.path,parent:o}),ctx:o}})).then(n);{let a,o=[];for(let u of s){let l={...t,common:{...t.common,issues:[]},parent:null},g=u._parseSync({data:t.data,path:t.path,parent:l});if(g.status==="valid")return g;g.status==="dirty"&&!a&&(a={result:g,ctx:l}),l.common.issues.length&&o.push(l.common.issues)}if(a)return t.common.issues.push(...a.ctx.common.issues),a.result;let i=o.map(u=>new C(u));return d(t,{code:c.invalid_union,unionErrors:i}),p}}get options(){return this._def.options}};re.create=(r,e)=>new re({options:r,typeName:m.ZodUnion,...y(e)});var V=r=>r instanceof ne?V(r.schema):r instanceof j?V(r.innerType()):r instanceof ae?[r.value]:r instanceof ie?r.options:r instanceof oe?v.objectValues(r.enum):r instanceof ce?V(r._def.innerType):r instanceof ee?[void 0]:r instanceof te?[null]:r instanceof I?[void 0,...V(r.unwrap())]:r instanceof Z?[null,...V(r.unwrap())]:r instanceof Se||r instanceof ue?V(r.unwrap()):r instanceof de?V(r._def.innerType):[],Ee=class r extends _{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==f.object)return d(t,{code:c.invalid_type,expected:f.object,received:t.parsedType}),p;let s=this.discriminator,n=t.data[s],a=this.optionsMap.get(n);return a?t.common.async?a._parseAsync({data:t.data,path:t.path,parent:t}):a._parseSync({data:t.data,path:t.path,parent:t}):(d(t,{code:c.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),p)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,s){let n=new Map;for(let a of t){let o=V(a.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \\`${e}\\` could not be extracted from all schema options`);for(let i of o){if(n.has(i))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);n.set(i,a)}}return new r({typeName:m.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,...y(s)})}};function Fe(r,e){let t=M(r),s=M(e);if(r===e)return{valid:!0,data:r};if(t===f.object&&s===f.object){let n=v.objectKeys(e),a=v.objectKeys(r).filter(i=>n.indexOf(i)!==-1),o={...r,...e};for(let i of a){let u=Fe(r[i],e[i]);if(!u.valid)return{valid:!1};o[i]=u.data}return{valid:!0,data:o}}else if(t===f.array&&s===f.array){if(r.length!==e.length)return{valid:!1};let n=[];for(let a=0;a<r.length;a++){let o=r[a],i=e[a],u=Fe(o,i);if(!u.valid)return{valid:!1};n.push(u.data)}return{valid:!0,data:n}}else return t===f.date&&s===f.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}var se=class extends _{_parse(e){let{status:t,ctx:s}=this._processInputParams(e),n=(a,o)=>{if(Ne(a)||Ne(o))return p;let i=Fe(a.value,o.value);return i.valid?((je(a)||je(o))&&t.dirty(),{status:t.value,value:i.data}):(d(s,{code:c.invalid_intersection_types}),p)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([a,o])=>n(a,o)):n(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}};se.create=(r,e,t)=>new se({left:r,right:e,typeName:m.ZodIntersection,...y(t)});var P=class r extends _{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==f.array)return d(s,{code:c.invalid_type,expected:f.array,received:s.parsedType}),p;if(s.data.length<this._def.items.length)return d(s,{code:c.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),p;!this._def.rest&&s.data.length>this._def.items.length&&(d(s,{code:c.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let a=[...s.data].map((o,i)=>{let u=this._def.items[i]||this._def.rest;return u?u._parse(new N(s,o,s.path,i)):null}).filter(o=>!!o);return s.common.async?Promise.all(a).then(o=>k.mergeArray(t,o)):k.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new r({...this._def,rest:e})}};P.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new P({items:r,typeName:m.ZodTuple,rest:null,...y(e)})};var Me=class r extends _{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==f.object)return d(s,{code:c.invalid_type,expected:f.object,received:s.parsedType}),p;let n=[],a=this._def.keyType,o=this._def.valueType;for(let i in s.data)n.push({key:a._parse(new N(s,i,s.path,i)),value:o._parse(new N(s,s.data[i],s.path,i)),alwaysSet:i in s.data});return s.common.async?k.mergeObjectAsync(t,n):k.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,s){return t instanceof _?new r({keyType:e,valueType:t,typeName:m.ZodRecord,...y(s)}):new r({keyType:F.create(),valueType:e,typeName:m.ZodRecord,...y(t)})}},ge=class extends _{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==f.map)return d(s,{code:c.invalid_type,expected:f.map,received:s.parsedType}),p;let n=this._def.keyType,a=this._def.valueType,o=[...s.data.entries()].map(([i,u],l)=>({key:n._parse(new N(s,i,s.path,[l,"key"])),value:a._parse(new N(s,u,s.path,[l,"value"]))}));if(s.common.async){let i=new Map;return Promise.resolve().then(async()=>{for(let u of o){let l=await u.key,g=await u.value;if(l.status==="aborted"||g.status==="aborted")return p;(l.status==="dirty"||g.status==="dirty")&&t.dirty(),i.set(l.value,g.value)}return{status:t.value,value:i}})}else{let i=new Map;for(let u of o){let l=u.key,g=u.value;if(l.status==="aborted"||g.status==="aborted")return p;(l.status==="dirty"||g.status==="dirty")&&t.dirty(),i.set(l.value,g.value)}return{status:t.value,value:i}}}};ge.create=(r,e,t)=>new ge({valueType:e,keyType:r,typeName:m.ZodMap,...y(t)});var _e=class r extends _{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==f.set)return d(s,{code:c.invalid_type,expected:f.set,received:s.parsedType}),p;let n=this._def;n.minSize!==null&&s.data.size<n.minSize.value&&(d(s,{code:c.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()),n.maxSize!==null&&s.data.size>n.maxSize.value&&(d(s,{code:c.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());let a=this._def.valueType;function o(u){let l=new Set;for(let g of u){if(g.status==="aborted")return p;g.status==="dirty"&&t.dirty(),l.add(g.value)}return{status:t.value,value:l}}let i=[...s.data.values()].map((u,l)=>a._parse(new N(s,u,s.path,l)));return s.common.async?Promise.all(i).then(u=>o(u)):o(i)}min(e,t){return new r({...this._def,minSize:{value:e,message:h.toString(t)}})}max(e,t){return new r({...this._def,maxSize:{value:e,message:h.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};_e.create=(r,e)=>new _e({valueType:r,minSize:null,maxSize:null,typeName:m.ZodSet,...y(e)});var Pe=class r extends _{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==f.function)return d(t,{code:c.invalid_type,expected:f.function,received:t.parsedType}),p;function s(i,u){return Ce({data:i,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,fe(),L].filter(l=>!!l),issueData:{code:c.invalid_arguments,argumentsError:u}})}function n(i,u){return Ce({data:i,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,fe(),L].filter(l=>!!l),issueData:{code:c.invalid_return_type,returnTypeError:u}})}let a={errorMap:t.common.contextualErrorMap},o=t.data;if(this._def.returns instanceof W){let i=this;return T(async function(...u){let l=new C([]),g=await i._def.args.parseAsync(u,a).catch(be=>{throw l.addIssue(s(u,be)),l}),R=await Reflect.apply(o,this,g);return await i._def.returns._def.type.parseAsync(R,a).catch(be=>{throw l.addIssue(n(R,be)),l})})}else{let i=this;return T(function(...u){let l=i._def.args.safeParse(u,a);if(!l.success)throw new C([s(u,l.error)]);let g=Reflect.apply(o,this,l.data),R=i._def.returns.safeParse(g,a);if(!R.success)throw new C([n(g,R.error)]);return R.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new r({...this._def,args:P.create(e).rest(D.create())})}returns(e){return new r({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,s){return new r({args:e||P.create([]).rest(D.create()),returns:t||D.create(),typeName:m.ZodFunction,...y(s)})}},ne=class extends _{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};ne.create=(r,e)=>new ne({getter:r,typeName:m.ZodLazy,...y(e)});var ae=class extends _{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return d(t,{received:t.data,code:c.invalid_literal,expected:this._def.value}),p}return{status:"valid",value:e.data}}get value(){return this._def.value}};ae.create=(r,e)=>new ae({value:r,typeName:m.ZodLiteral,...y(e)});function at(r,e){return new ie({values:r,typeName:m.ZodEnum,...y(e)})}var ie=class r extends _{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),s=this._def.values;return d(t,{expected:v.joinValues(s),received:t.parsedType,code:c.invalid_type}),p}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),s=this._def.values;return d(t,{received:t.data,code:c.invalid_enum_value,options:s}),p}return T(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return r.create(e,{...this._def,...t})}exclude(e,t=this._def){return r.create(this.options.filter(s=>!e.includes(s)),{...this._def,...t})}};ie.create=at;var oe=class extends _{_parse(e){let t=v.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==f.string&&s.parsedType!==f.number){let n=v.objectValues(t);return d(s,{expected:v.joinValues(n),received:s.parsedType,code:c.invalid_type}),p}if(this._cache||(this._cache=new Set(v.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let n=v.objectValues(t);return d(s,{received:s.data,code:c.invalid_enum_value,options:n}),p}return T(e.data)}get enum(){return this._def.values}};oe.create=(r,e)=>new oe({values:r,typeName:m.ZodNativeEnum,...y(e)});var W=class extends _{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==f.promise&&t.common.async===!1)return d(t,{code:c.invalid_type,expected:f.promise,received:t.parsedType}),p;let s=t.parsedType===f.promise?t.data:Promise.resolve(t.data);return T(s.then(n=>this._def.type.parseAsync(n,{path:t.path,errorMap:t.common.contextualErrorMap})))}};W.create=(r,e)=>new W({type:r,typeName:m.ZodPromise,...y(e)});var j=class extends _{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===m.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:s}=this._processInputParams(e),n=this._def.effect||null,a={addIssue:o=>{d(s,o),o.fatal?t.abort():t.dirty()},get path(){return s.path}};if(a.addIssue=a.addIssue.bind(a),n.type==="preprocess"){let o=n.transform(s.data,a);if(s.common.async)return Promise.resolve(o).then(async i=>{if(t.value==="aborted")return p;let u=await this._def.schema._parseAsync({data:i,path:s.path,parent:s});return u.status==="aborted"?p:u.status==="dirty"?J(u.value):t.value==="dirty"?J(u.value):u});{if(t.value==="aborted")return p;let i=this._def.schema._parseSync({data:o,path:s.path,parent:s});return i.status==="aborted"?p:i.status==="dirty"?J(i.value):t.value==="dirty"?J(i.value):i}}if(n.type==="refinement"){let o=i=>{let u=n.refinement(i,a);if(s.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return i};if(s.common.async===!1){let i=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return i.status==="aborted"?p:(i.status==="dirty"&&t.dirty(),o(i.value),{status:t.value,value:i.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(i=>i.status==="aborted"?p:(i.status==="dirty"&&t.dirty(),o(i.value).then(()=>({status:t.value,value:i.value}))))}if(n.type==="transform")if(s.common.async===!1){let o=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!B(o))return p;let i=n.transform(o.value,a);if(i instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:i}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(o=>B(o)?Promise.resolve(n.transform(o.value,a)).then(i=>({status:t.value,value:i})):p);v.assertNever(n)}};j.create=(r,e,t)=>new j({schema:r,typeName:m.ZodEffects,effect:e,...y(t)});j.createWithPreprocess=(r,e,t)=>new j({schema:e,effect:{type:"preprocess",transform:r},typeName:m.ZodEffects,...y(t)});var I=class extends _{_parse(e){return this._getType(e)===f.undefined?T(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};I.create=(r,e)=>new I({innerType:r,typeName:m.ZodOptional,...y(e)});var Z=class extends _{_parse(e){return this._getType(e)===f.null?T(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Z.create=(r,e)=>new Z({innerType:r,typeName:m.ZodNullable,...y(e)});var ce=class extends _{_parse(e){let{ctx:t}=this._processInputParams(e),s=t.data;return t.parsedType===f.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};ce.create=(r,e)=>new ce({innerType:r,typeName:m.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...y(e)});var de=class extends _{_parse(e){let{ctx:t}=this._processInputParams(e),s={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return he(n)?n.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new C(s.common.issues)},input:s.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new C(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}};de.create=(r,e)=>new de({innerType:r,typeName:m.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...y(e)});var ve=class extends _{_parse(e){if(this._getType(e)!==f.nan){let s=this._getOrReturnCtx(e);return d(s,{code:c.invalid_type,expected:f.nan,received:s.parsedType}),p}return{status:"valid",value:e.data}}};ve.create=r=>new ve({typeName:m.ZodNaN,...y(r)});var Ut=Symbol("zod_brand"),Se=class extends _{_parse(e){let{ctx:t}=this._processInputParams(e),s=t.data;return this._def.type._parse({data:s,path:t.path,parent:t})}unwrap(){return this._def.type}},Ae=class r extends _{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.common.async)return(async()=>{let a=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return a.status==="aborted"?p:a.status==="dirty"?(t.dirty(),J(a.value)):this._def.out._parseAsync({data:a.value,path:s.path,parent:s})})();{let n=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return n.status==="aborted"?p:n.status==="dirty"?(t.dirty(),{status:"dirty",value:n.value}):this._def.out._parseSync({data:n.value,path:s.path,parent:s})}}static create(e,t){return new r({in:e,out:t,typeName:m.ZodPipeline})}},ue=class extends _{_parse(e){let t=this._def.innerType._parse(e),s=n=>(B(n)&&(n.value=Object.freeze(n.value)),n);return he(t)?t.then(n=>s(n)):s(t)}unwrap(){return this._def.innerType}};ue.create=(r,e)=>new ue({innerType:r,typeName:m.ZodReadonly,...y(e)});function tt(r,e){let t=typeof r=="function"?r(e):typeof r=="string"?{message:r}:r;return typeof t=="string"?{message:t}:t}function it(r,e={},t){return r?U.create().superRefine((s,n)=>{let a=r(s);if(a instanceof Promise)return a.then(o=>{if(!o){let i=tt(e,s),u=i.fatal??t??!0;n.addIssue({code:"custom",...i,fatal:u})}});if(!a){let o=tt(e,s),i=o.fatal??t??!0;n.addIssue({code:"custom",...o,fatal:i})}}):U.create()}var Wt={object:S.lazycreate},m;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline",r.ZodReadonly="ZodReadonly"})(m||(m={}));var qt=(r,e={message:`Input not instance of ${r.name}`})=>it(t=>t instanceof r,e),ot=F.create,ct=Q.create,Yt=ve.create,Xt=K.create,dt=G.create,Jt=H.create,Qt=me.create,Kt=ee.create,Gt=te.create,Ht=U.create,er=D.create,tr=E.create,rr=ye.create,sr=z.create,nr=S.create,ar=S.strictCreate,ir=re.create,or=Ee.create,cr=se.create,dr=P.create,ur=Me.create,lr=ge.create,fr=_e.create,hr=Pe.create,pr=ne.create,mr=ae.create,yr=ie.create,gr=oe.create,_r=W.create,vr=j.create,xr=I.create,br=Z.create,kr=j.createWithPreprocess,wr=Ae.create,Tr=()=>ot().optional(),Rr=()=>ct().optional(),Cr=()=>dt().optional(),Sr={string:r=>F.create({...r,coerce:!0}),number:r=>Q.create({...r,coerce:!0}),boolean:r=>G.create({...r,coerce:!0}),bigint:r=>K.create({...r,coerce:!0}),date:r=>H.create({...r,coerce:!0})};var Ar=p;var Os=xe.union([xe.enum(["low","medium","high","always-visible"]),xe.number()]);var Ze=5;var q=200,$e=10;function ut(r,e,t,s,n,a,o="-1"){let i=1/0,u=1/0,l=-1/0,g=-1/0,R=new b(-$e,0,5,t),Oe=new b(-$e,0,e,5),be=new b(e-5,0,e+$e,t),ft=new b(0,t-5,e,t+$e),ht=Or(e,t,s,n,a),pt=[R,Oe,be,ft],Ue=new b(-q,-q,e+q*2,t+q*2);for(let x of r){let we,Te;for(let A=0;A<x.bboxes.length;A++){if(x.bboxes[A]==null||(we=x.bboxes[A].boundingBox,Te=x.bboxes[A].index,x.lockedToStrategyIndex!==-1&&Te!==x.lockedToStrategyIndex))continue;let[Ie,O,Y,We]=we,[X,mt,qe,yt]=[x.y-Ie,x.y+O,x.x-Y,x.x+We],Ve=qe,De=X,Ye=yt-qe,Xe=mt-X;i=Math.min(i,Ve)-q,u=Math.min(u,De)-q,l=Math.max(l,Ve+Ye)+q,g=Math.max(g,De+Xe)+q,x.bboxes[A].boundingRect=new b(Ve,De,Ye,Xe)}}let le={msgId:o,colliders:new Array(r.length),debug:[]},Le=new Re(new b(i,u,l-i,g-u)),ke;for(let x=0;x<r.length;x++)if(ke=r[x],le.colliders[x]=[-1,0],ke.enabledAndVisible){let[we,Te,A]=[1/0,-1,void 0];for(let{index:Ie,boundingRect:O}of ke.bboxes){if(O==null)continue;let Y=[];if(Y=Le.queryRect(O).filter(X=>O.intersects(X)),ke.shouldCollideWithScreenEdges&&pt.forEach(X=>{O.intersects(X)&&Y.push(X)}),O.intersects(ht)){le.colliders[x]=[-1,0,O];break}if(Y.length<=we&&(A=O,Te=Ie,we=Y.length),Y.length===0){Le.insert(O),le.colliders[x]=[Ie,Ue.contains(O)?0:1,O];break}}ke.rank===Ze&&A!=null&&(Le.insert(A),le.colliders[x]=[Te,Ue.contains(A)?0:1,A])}else le.colliders[x]=[-1,0];return le}function Or(r,e,t,s,n){switch(n){case"top-right":return new b(r-t,0,t,s);case"bottom-left":return new b(0,e-s,t,s);case"bottom-right":return new b(r-t,e-s,t,s);case"top-left":return new b(0,0,t,s)}}function lt(r){let e=r[0].map(t=>{let s=t[0].map(n=>({index:n[4],boundingBox:[n[0],n[1],n[2],n[3]]}));return{enabledAndVisible:t[1]===1,rank:t[2]===1?Ze:0,x:t[3],y:t[4],shouldCollideWithScreenEdges:t[5]===1,bboxes:s,lockedToStrategyIndex:t[6]}});return{msgId:"-1",totalWidth:r[3],totalHeight:r[2],watermarkWidth:r[4],watermarkHeight:r[5],watermarkPosition:r[6],colliders:e,devicePixelRatio:r[1]}}self.onmessage=r=>{let e=lt(r.data);self.postMessage(ut(e.colliders,e.totalWidth,e.totalHeight,e.watermarkWidth,e.watermarkHeight,e.watermarkPosition,e.msgId))};})();\n';u();u();u();u();u();function Z9(e,t){return t.x+t.w<e.x+e.w&&t.x>e.x&&t.y>e.y&&t.y+t.h<e.y+e.h}u();function Y9(e,t){let[r,n]=t;return r>=e.x&&r<=e.x+e.w&&n>=e.y&&n<=e.y+e.h}u();function J9(e,t){let r=t.x,n=t.y,o=t.x+t.w,i=t.y+t.h,s=e.x,l=e.y,c=e.x+e.w,p=e.y+e.h;return r<c&&s<o&&n<p&&l<i}u();function ka(e,t){for(let r=0;r<t.length;r++)e.push(t[r])}u();var yt=class{constructor(t,r,n,o,i){f(this,"x");f(this,"y");f(this,"w");f(this,"h");f(this,"userData");this.userData=typeof i>"u"?null:i,this.x=t,this.y=r,this.w=n,this.h=o}contains(t){return t===this?!1:Z9(this,t)}intersects(t){return J9(this,t)}intersectsPoint(t){return Y9(this,t)}draw(t){t.fillStyle="rgba(123,222,26, 0.8)",t.fillRect(this.x,this.y,this.w,this.h)}};var Xo=class e{constructor(t,r){f(this,"topLeft");f(this,"topRight");f(this,"bottomLeft");f(this,"bottomRight");f(this,"divided",!1);f(this,"boundary");f(this,"capacity",16);f(this,"objects",[]);f(this,"parent");this.parent=r,this.boundary=t}getSize(){return this.divided?this.objects.length+this.topLeft.getSize()+this.topRight.getSize()+this.bottomLeft.getSize()+this.bottomRight.getSize():this.objects.length}subdivide(){let{x:t,y:r,w:n,h:o}=this.boundary;this.topLeft=new e(new yt(t,r,n/2,o/2),this),this.topRight=new e(new yt(t+n/2,r,n/2,o/2),this),this.bottomLeft=new e(new yt(t,r+o/2,n/2,o/2),this),this.bottomRight=new e(new yt(t+n/2,r+o/2,n/2,o/2),this),this.divided=!0}queryRect(t){let r=[];if(this.boundary.intersects(t))r.push(...this.objects);else return[];return this.divided&&(ka(r,this.topLeft.queryRect(t)),ka(r,this.topRight.queryRect(t)),ka(r,this.bottomLeft.queryRect(t)),ka(r,this.bottomRight.queryRect(t))),r}queryPoint(t){let r=[];if(this.boundary.intersectsPoint(t))r.push(...this.objects);else return[];return this.divided&&(ka(r,this.topLeft.queryPoint(t)),ka(r,this.topRight.queryPoint(t)),ka(r,this.bottomLeft.queryPoint(t)),ka(r,this.bottomRight.queryPoint(t))),r}insert(t){return(this.parent?!this.boundary.contains(t):!this.boundary.intersects(t))?!1:this.objects.length<this.capacity?(this.objects.push(t),!0):(this.divided||this.subdivide(),(this.topLeft.insert(t)||this.topRight.insert(t)||this.bottomLeft.insert(t)||this.bottomRight.insert(t))===!1&&this.objects.push(t),!0)}drawObjects(t){this.objects.forEach(r=>r.draw(t)),this.divided&&(this.topLeft.drawObjects(t),this.topRight.drawObjects(t),this.bottomLeft.drawObjects(t),this.bottomRight.drawObjects(t))}draw(t){t.rect(this.boundary.x,this.boundary.y,this.boundary.w,this.boundary.h),this.divided&&(this.topLeft.draw(t),this.topRight.draw(t),this.bottomLeft.draw(t),this.bottomRight.draw(t)),t.strokeStyle="black",t.lineWidth=4,t.stroke()}};u();u();var bf=_.union([_.enum(["low","medium","high","always-visible"]),_.number()]),q9=["","","low","medium","high","always-visible"],Zz=2,Yz=3;var Mp=5;function K9(e){return Math.min(Mp,Math.max(Zz,e))}function xf(e){if(typeof e=="number")return K9(e);let t=q9.indexOf(e);return t===-1?Yz:t}function Hh(e){let t=K9(e);return q9[t]}function Q9(e,t,r){let n,o,i,s=null,l=0;r||(r={});let c=function(){l=r.leading===!1?0:Date.now(),s=null,i=e.apply(n,o),s||(n=o=null)};return function(){let p=Date.now();!l&&r.leading===!1&&(l=p);let d=t-(p-l);return n=globalThis,o=arguments,d<=0||d>t?(s&&(clearTimeout(s),s=null),l=p,i=e.apply(n,o),s||(n=o=null)):!s&&r.trailing!==!1&&(s=setTimeout(c,d)),i}}function e_(e){let t=e[0].map(r=>{let n=r[0].map(o=>({index:o[4],boundingBox:[o[0],o[1],o[2],o[3]]}));return{enabledAndVisible:r[1]===1,rank:r[2]===1?Mp:0,x:r[3],y:r[4],shouldCollideWithScreenEdges:r[5]===1,bboxes:n,lockedToStrategyIndex:r[6]}});return{msgId:"-1",totalWidth:e[3],totalHeight:e[2],watermarkWidth:e[4],watermarkHeight:e[5],watermarkPosition:e[6],colliders:t,devicePixelRatio:e[1]}}u();u();var Hl=200,N0=10;function t_(e,t,r,n,o,i,s="-1"){let l=1/0,c=1/0,p=-1/0,d=-1/0,m=new yt(-N0,0,5,r),g=new yt(-N0,0,t,5),x=new yt(t-5,0,t+N0,r),v=new yt(0,r-5,t,r+N0),C=Jz(t,r,n,o,i),I=[m,g,x,v],S=new yt(-Hl,-Hl,t+Hl*2,r+Hl*2);for(let E of e){let B,j;for(let L=0;L<E.bboxes.length;L++){if(E.bboxes[L]==null||(B=E.bboxes[L].boundingBox,j=E.bboxes[L].index,E.lockedToStrategyIndex!==-1&&j!==E.lockedToStrategyIndex))continue;let[N,X,Z,re]=B,[Q,xe,Ce,ye]=[E.y-N,E.y+X,E.x-Z,E.x+re],Ee=Ce,we=Q,pe=ye-Ce,Ae=xe-Q;l=Math.min(l,Ee)-Hl,c=Math.min(c,we)-Hl,p=Math.max(p,Ee+pe)+Hl,d=Math.max(d,we+Ae)+Hl,E.bboxes[L].boundingRect=new yt(Ee,we,pe,Ae)}}let P={msgId:s,colliders:new Array(e.length),debug:[]},O=new Xo(new yt(l,c,p-l,d-c)),M;for(let E=0;E<e.length;E++)if(M=e[E],P.colliders[E]=[-1,0],M.enabledAndVisible){let[B,j,L]=[1/0,-1,void 0];for(let{index:N,boundingRect:X}of M.bboxes){if(X==null)continue;let Z=[];if(Z=O.queryRect(X).filter(Q=>X.intersects(Q)),M.shouldCollideWithScreenEdges&&I.forEach(Q=>{X.intersects(Q)&&Z.push(Q)}),X.intersects(C)){P.colliders[E]=[-1,0,X];break}if(Z.length<=B&&(L=X,j=N,B=Z.length),Z.length===0){O.insert(X),P.colliders[E]=[N,S.contains(X)?0:1,X];break}}M.rank===Mp&&L!=null&&(O.insert(L),P.colliders[E]=[j,S.contains(L)?0:1,L])}else P.colliders[E]=[-1,0];return P}function Jz(e,t,r,n,o){switch(o){case"top-right":return new yt(e-r,0,r,n);case"bottom-left":return new yt(0,t-n,r,n);case"bottom-right":return new yt(e-r,t-n,r,n);case"top-left":return new yt(0,0,r,n)}}var Wh=class{constructor(){f(this,"onerror",()=>{});f(this,"onmessage",()=>{});f(this,"postMessage",t=>{let r=e_(t);this.onmessage({data:t_(r.colliders,r.totalWidth,r.totalHeight,r.watermarkWidth,r.watermarkHeight,r.watermarkPosition,r.msgId)})});f(this,"terminate",()=>{})}};var Pp=!1,qz=150,G0=class extends Fe{constructor(r,n,o=!0){super();f(this,"worker");f(this,"debugContext");f(this,"debugCanvas");f(this,"collidersDirty",!0);f(this,"packedMessage",[[],0,0,0,0,0,"bottom-left"]);f(this,"visibleCollidersQTree",new Xo(new yt(0,0,0,0)));f(this,"interactiveCollidersQTree",new Xo(new yt(0,0,0,0)));f(this,"coreState");f(this,"postMessage");f(this,"showCollisionBoxes",()=>{Pp=!0,this.debugCanvas.style.display="block"});f(this,"hideCollisionBoxes",()=>{Pp=!1,this.debugContext.clearRect(0,0,this.debugCanvas.width,this.debugCanvas.height),this.debugCanvas.style.display="none"});f(this,"currentMsgId","");f(this,"working",!1);f(this,"_postMessage",()=>{this.worker.postMessage(this.packedMessage)});f(this,"componentArray",[]);f(this,"update",(r,n,o="bottom-left",i=!1)=>{let s=!1;if(this.collidersDirty){this.packedMessage=[[],0,0,0,0,0,"bottom-left"],this.componentArray=[];let l;for(let c of this.coreState.geometry2DIdsInScene){let p=this.coreState.geometry2DMap.get(c);p&&(l=p.components[0],this.componentArray.push(l))}this.resize(r,n,o),this.collidersDirty=!1,s=!0}else s=this.componentArray.some(l=>l.collisionDirty===!0);s&&this.componentArray.sort((l,c)=>c.rank-l.rank);for(let l=0;l<this.componentArray.length;l++)if(this.packedMessage){let c=this.componentArray[l].toPackedMessage(i&&!s);this.packedMessage[0][l]==null&&(this.packedMessage[0][l]=[]),this.packedMessage[0][l][0]==null&&(this.packedMessage[0][l][0]=[]),this.packedMessage[0][l][0]=c.bboxes,this.packedMessage[0][l][1]=c.enabled&&this.componentArray[l].visible&&!this.componentArray[l].isOccluded?1:0,this.packedMessage[0][l][2]=c.rank===Mp?1:0,this.packedMessage[0][l][3]=c.x,this.packedMessage[0][l][4]=c.y,this.packedMessage[0][l][5]=c.shouldCollideWithScreenEdges?1:0,this.packedMessage[0][l][6]=c.lockedToStrategyIndex}this.working||this.postMessage()});f(this,"resolve",r=>{if(this.working=!1,this.collidersDirty||!r.data)return;let n=r.data.colliders,o=-1,i,s,l;Pp&&(this.visibleCollidersQTree=new Xo(new yt(0,0,this.debugCanvas.width,this.debugCanvas.height))),this.interactiveCollidersQTree=new Xo(new yt(0,0,this.debugCanvas.width,this.debugCanvas.height));for(let c=0;c<this.componentArray.length;c++){let p=this.componentArray[c];n[c]!=null&&(o=n[c][0],i=n[c][2],p.offscreen=n[c][1]===1,o!==-1&&i!=null?(l=new yt(i.x,i.y,i.w,i.h,{entityId:p.id}),Pp&&this.visibleCollidersQTree.insert(l),s=this.coreState.geometry2DMap.get(p.id),s?.components[1]!=null&&this.interactiveCollidersQTree.insert(new yt(i.x,i.y,i.w,i.h,{entityId:p.id})),(p.canShow===!1||p.visibilityNeedsUpdate!==!1)&&"visibilityNeedsUpdate"in p&&(p.visibilityNeedsUpdate="show"),o!==-1&&o!==p.currentStrategyIndex&&(p.activeBoundingBox=l,p.onStrategySelected(o))):((p.canShow===!0||p.visibilityNeedsUpdate!==!1)&&"visibilityNeedsUpdate"in p&&(p.visibilityNeedsUpdate="hide"),o!==-1&&o!==p.currentStrategyIndex&&p.onStrategySelected(o)))}Pp&&this.drawDebug(),this.publish("visibility-changed")});f(this,"drawDebug",()=>{Pp&&this.visibleCollidersQTree&&(this.debugContext.clearRect(0,0,this.debugCanvas.width,this.debugCanvas.height),this.debugContext.beginPath(),this.visibleCollidersQTree.drawObjects(this.debugContext))});f(this,"destroy",()=>{this.worker.terminate()});this.worker=o===!1?new Wh:wp!==""?new Worker(wp):new Worker(URL.createObjectURL(new Blob([X9],{type:"text/javascript"}))),this.worker.onerror=()=>{this.worker=new Wh,this.worker.onmessage=i=>this.resolve(i)},this.coreState=n,this.debugCanvas=r,this.debugContext=r.getContext("2d"),this.worker.onmessage=i=>this.resolve(i),this.postMessage=Q9(this._postMessage,qz,!1),Pp?this.showCollisionBoxes():this.hideCollisionBoxes()}resize(r,n,o){this.packedMessage[6]=o,this.packedMessage[5]=n,this.packedMessage[4]=r,this.packedMessage[3]=this.debugCanvas.width,this.packedMessage[2]=this.debugCanvas.height}};u();u();u();u();var j0=class{constructor(t){f(this,"type");f(this,"event");this.type=0,this.event=t}get timestamp(){return this.event.timeStamp}},U0=class{constructor(){f(this,"taps",[])}add(t){this.lastPointerDown&&t.timestamp-this.lastPointerDown.timestamp<50?this.lastPointerDown.type=1:this.taps.push(t)}get lastPointerDown(){return this.taps.length>=1?this.taps[this.taps.length-1]:void 0}get isSingleTapWithTwoFingers(){return this.isSingleTap&&this.lastPointerDown?.type===1}get isSingleTapWithOneFinger(){return this.isSingleTap&&this.lastPointerDown?.type===0}get isDoubleTapWithOneFinger(){return this.isDoubleTap&&this.taps[0]?.type===0&&this.taps[1]?.type===0}get isSingleTap(){return this.taps.length===1}get isDoubleTap(){return this.taps.length===2}discardOutsideOfWaitWindow(t){this.taps=this.taps.filter(r=>t-r.timestamp<300)}flush(){this.taps=[]}get _taps(){return this.taps}destroy(){this.flush()}};u();function U3(e){let t=new Set;for(let r of e){let n=r.object;for(;n.visible&&n.parent&&n.parent.visible===!0&&!t.has(n.parent);)n=n.parent,n instanceof kt&&n.type==="group-container"&&n.visible&&n.components[0]&&t.add(n)}return Array.from(t)}var vf,$h=class extends Fe{constructor(r,n,o,i,s){super();f(this,"raycaster",new Zi);f(this,"state",{hovered3DEntity:void 0,hovered2DEntity:void 0,hovered3DContainers:void 0,lastHover:void 0,interaction:{mouseDownStart:void 0,distanceFromMouseDown:void 0,isPanning:!1}});f(this,"coreState");f(this,"camera");f(this,"worldPlane");f(this,"_quadtree",new Xo(new yt(0,0,0,0)));f(this,"_container");f(this,"lastPointerEvent");f(this,"cursor","grab");f(this,"touchesCount",0);f(this,"isUserInteracting");f(this,"hasTouched",!1);T(this,vf);f(this,"onPointerMoveRaf",r=>{this.lastPointerEvent=r,a(this,vf)&&cancelAnimationFrame(a(this,vf)),w(this,vf,requestAnimationFrame(()=>{this.onPointerMove(r)}))});f(this,"onPointerMove",r=>{r.preventDefault(),this.updateInteractionStateIfPanning(r),(r.pointerType!=="touch"||r.pointerType===void 0&&this.hasTouched)&&this.handleHover(r),this.handleCursor()});f(this,"tapsControl",new U0);f(this,"onPointerDown",r=>{r.target===this._container&&(this._container.addEventListener("pointerup",this.onPointerUp,!1),this._container.addEventListener("pointercancel",this.onPointerUp,!1),this.state.interaction.mouseDownStart={time:Date.now(),timestamp:r.timeStamp,offsetX:r.offsetX,offsetY:r.offsetY},this.lastPointerEvent=r,this.state.interaction.distanceFromMouseDown=0,this.handleCursor(),r.pointerType==="touch"&&(this.tapsControl.add(new j0(r)),this.touchesCount=Math.max(0,this.touchesCount+1)))});f(this,"clickTimeout");f(this,"onPointerUp",r=>{this.tapsControl.discardOutsideOfWaitWindow(r.timeStamp),this.lastPointerEvent=r,this.touchesCount=Math.max(0,this.touchesCount-1),this.touchesCount===0&&(this._container.removeEventListener("pointerup",this.onPointerUp,!1),this._container.removeEventListener("pointercancel",this.onPointerUp,!1)),this.updateInteractionStateIfPanning(r);let{mouseDownStart:n}=this.state.interaction;!n||this.state.interaction.distanceFromMouseDown==null||(Date.now()<n.time+300&&(this.tapsControl.isSingleTapWithTwoFingers||this.state.interaction.distanceFromMouseDown<=15)&&(r.pointerType==="touch"?this.tapsControl.isSingleTapWithTwoFingers?(this.publish("singletap-with-twofinger",r),this.flush()):this.tapsControl.isSingleTapWithOneFinger&&this.touchesCount===0?(this.clickTimeout&&clearTimeout(this.clickTimeout),this.clickTimeout=window.setTimeout(()=>{this.handleClick(r),this.flush()},300)):this.tapsControl.isDoubleTapWithOneFinger&&(this.publish("doubletap-with-onefinger",r),this.flush()):this.handleClick(r)),this.state.interaction.mouseDownStart=void 0,this.state.interaction.distanceFromMouseDown=void 0,this.state.interaction.isPanning=!1,this.handleCursor())});f(this,"dirty3D",!0);f(this,"cachedHitBoxes",{entities:[]});f(this,"ndcPoint",new De);f(this,"debugPanel");this.isUserInteracting=s,this.raycaster.layers.enableAll(),this.raycaster.layers.disable(1),this.camera=o,this._container=r,this.coreState=n,this.worldPlane=i,this._container.addEventListener("pointerdown",this.onPointerDown,!1),this._container.addEventListener("pointermove",this.onPointerMoveRaf,!1),this._container.classList.add("mappedin-interactive")}updateQuadtree(r){this._quadtree=r}setHovered3DEntityInteractionComponentDirty(){if(this.state.hovered3DEntity){let r=this.state.hovered3DEntity.components[2];r&&(r.dirty=!0)}}getThreeDIntersectsFromXY(r){this.raycaster.setFromCamera(r,this.camera),this.raycaster.layers.enable(0);let n=this.raycaster.intersectObjects(this._hitBoxes.entities,!0).filter(i=>i.object?.name==="worldPlane"||i.object?.visible),o=n.findIndex(i=>i.object?.name==="worldPlane");return o!==-1&&n.push(n.splice(o,1)[0]),n}getGroupContainerIntersectsFromXY(r){let n=this.getThreeDIntersectsFromXY(r),o;return n!=null&&n.length>0&&(o=U3(n)),o}flush(){this.tapsControl.flush(),this.clickTimeout!=null&&(clearTimeout(this.clickTimeout),this.clickTimeout=void 0)}handleHover(r){let n=r||this.lastPointerEvent;if(this.state.interaction.mouseDownStart||!n||this.isUserInteracting())return;let{entity3D:o,entity2D:i,position:s,groupContainers:l}=this.intersect(n);(this.detect3DEntityHover(o)||this.detect2DEntityHover(i)||this.detect3DContainerHover(l))&&(this.state.hovered3DEntity=o,this.state.lastHover=o,this.state.hovered2DEntity=i,this.state.hovered3DContainers=l,this.publish("hover",{entity2D:this.state.hovered2DEntity,entity3D:this.state.hovered3DEntity,position:s,groupContainers:l})),this.handleCursor()}handleCursor(){let r=!!(this.state.hovered3DEntity&&this.state.hovered3DEntity?.components[2]||this.state.hovered2DEntity),n=!!this.state.interaction.mouseDownStart,o=this.state.interaction.isPanning,i=tX(r,o,n);this.cursor!==i&&(this.cursor=i,i==="pointer"?this._container.classList.add("mappedin-interaction-hover"):this._container.classList.remove("mappedin-interaction-hover"))}detect2DEntityHover(r){return this.state.hovered2DEntity!==r}handleClick(r){let n=this.intersect(r);this.publish("click",{entity2D:n.entity2D,entity3D:n.entity3D,position:n.position,groupContainers:n.groupContainers,pointerEvent:{button:r.button}})}get _hitBoxes(){if(this.dirty3D){this.cachedHitBoxes.entities=[];let r;for(let n of this.coreState.geometry3DIdsInScene)r=this.coreState.geometry3DMap.get(n),(r?.type==="geometry"||r?.type==="model"||r?.type==="path"||r?.type==="custom-geometry")&&r.components[0].mesh&&!this.cachedHitBoxes.entities.includes(r.components[0].mesh)&&this.cachedHitBoxes.entities.push(r.components[0].mesh);return this.dirty3D=!1,this.cachedHitBoxes.entities.push(this.worldPlane),this.cachedHitBoxes}return this.cachedHitBoxes}intersect(r){let{offsetX:n,offsetY:o}=r,i=[n,o],s=this._quadtree.queryPoint(i),[l]=s.filter(S=>S.intersectsPoint(i));this.ndcPoint.x=n/this._container.clientWidth*2-1,this.ndcPoint.y=-(o/this._container.clientHeight)*2+1;let c=this.getThreeDIntersectsFromXY(this.ndcPoint),p=c[0]?.point,d=[],m=[],g=c.filter(S=>S.object.name!=="worldPlane");for(let S of g)S.object instanceof Re&&S.object.material.depthTest===!1?d.push(S):m.push(S);let x=d[0]??m[0]??void 0,v,C;if(x!=null){if(v=nX(x.object,this.coreState.geometry3DMap),!v){let S=x?.instanceId??x?.batchId;v=S!=null&&x?.object.userData.entities?this.coreState.geometry3DMap.get(x?.object.userData.entities[S]):this.coreState.geometry3DMap.get(x?.object.userData.entityId)}v?.components[2]&&(C=v)}let I=U3(g);return{entity2D:l?.userData?.entityId==="watermark"?{id:"watermark"}:this.coreState.geometry2DMap.get(l?.userData.entityId),entity3D:C,position:p,groupContainers:I.length>0?I:void 0}}detect3DEntityHover(r){return this.state.lastHover!==r&&(this.state.lastHover&&n_(this.state.lastHover,!1,this.coreState),r&&n_(r,!0,this.coreState)),this.state.hovered3DEntity!==r}detect3DContainerHover(r){return!i5(this.state.hovered3DContainers,r)}updateInteractionStateIfPanning(r){this.state.interaction.mouseDownStart&&(this.state.interaction.distanceFromMouseDown=Math.sqrt(Math.pow(r.offsetX-this.state.interaction.mouseDownStart.offsetX,2)+Math.pow(r.offsetY-this.state.interaction.mouseDownStart.offsetY,2)),!this.state.interaction.isPanning&&this.state.interaction.distanceFromMouseDown>15&&(this.state.interaction.isPanning=!0))}getMouseRayIntersects(){return this.raycaster.intersectObjects([this.worldPlane],!1)}destroy(){this._container.removeEventListener("pointerdown",this.onPointerDown,!1),this._container.removeEventListener("pointermove",this.onPointerMoveRaf,!1),this._container.removeEventListener("pointerup",this.onPointerUp,!1),this._container.removeEventListener("pointercancel",this.onPointerUp,!1)}enableDebug(){let r=document.createElement("div");r.style.position="absolute",r.style.top="0",r.style.right="0",r.style.backgroundColor="white",r.style.padding="10px",document.body.append(r),r.id="interaction-debug-panel",this.debugPanel=r,this.on("doubletap-with-onefinger",()=>{this.queueDebugMessage("doubletap-with-onefinger","#ffadad")}),this.on("singletap-with-twofinger",()=>{this.queueDebugMessage("singletap-with-twofinger","#ffd6a5")}),this.on("click",n=>{this.queueDebugMessage(`CLICK
|
|
7
7
|
3D: ${n.entity3D?.id}
|
|
8
8
|
2D: ${n.entity2D?.id}
|
|
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(r,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=r,this.debugPanel?.prepend(o),setTimeout(()=>{o.style.opacity="0",setTimeout(()=>{o.remove()},500)},2500)}getCursor(){return this.cursor}};vf=new WeakMap;function n_(e,t,r){let n=e.components[2];n&&n.hover!==!0&&(n.hover=t?"user-interaction":!1,n.dirty=!0);let o=e.components[0].textMesh?.userData.entityId;if(!o)return;let i=r.geometry3DMap.get(o);i?.type==="text3d"&&(i.components[1].hoverByPolygon=t,i.components[1].dirty=!0)}function tX(e,t,r){return t?"grabbing":e?"pointer":r?"grabbing":"grab"}function rX(e){let t=e;for(;t?.parent;){if(t instanceof al)return;if(t.userData.isSingleModel)return t;t=t.parent}}function nX(e,t){let r=rX(e);return r?t.get(r.userData.entityId):void 0}u();var k_=il(K3());var qh=4,JZ=8,qZ="0.6",F_="low-priority-pin",Q3=_.object({rank:_.union([_.enum(["low","medium","high","always-visible"]),_.number()]).optional(),interactive:_.union([_.boolean(),_.literal("pointer-events-auto")]).optional(),id:_.string().optional(),placement:_.union([_.enum(["top","bottom","left","right","center","top-left","top-right","bottom-left","bottom-right"]),_.array(_.enum(["top","bottom","left","right","center","top-left","top-right","bottom-left","bottom-right"]))]).optional(),dynamicResize:_.boolean().optional(),zIndex:_.number().optional(),lowPriorityPin:_.object({enabled:_.boolean().optional(),size:_.number().positive().optional(),color:_.string().optional()}).optional()});function A_(e,t,r){_.array(_.number()).min(2).max(3).parse(e),_.string().parse(t),Q3.parse(r)}var KZ=Object.freeze({enabled:!0,size:JZ,color:"#666"}),Tf=class Tf{constructor(t,r={}){f(this,"id");f(this,"type","marker");f(this,"rank",0);f(this,"initialRank",0);f(this,"activePlacement","center");f(this,"pointerEvents","none");f(this,"options",{rank:"low",interactive:!1,id:"",placement:"center",dynamicResize:!1,occluderId:0,zIndex:void 0,verticalOffset:0,lowPriorityPin:{...KZ}});f(this,"projection",new De);f(this,"enabled",!0);f(this,"canShow",!1);f(this,"visible",!0);f(this,"isOccluded",!1);f(this,"offscreen",!1);f(this,"strategyIndex",-1);f(this,"activeBoundingBox",{x:0,y:0,w:0,h:0});f(this,"dimensions",{width:0,height:0});f(this,"markerContainer");f(this,"containerEl");f(this,"contentEl",null);f(this,"contentHtml","");f(this,"style",{top:"0px",left:"0px"});f(this,"dirty",!1);f(this,"attachedDirty",!0);f(this,"collisionDirty",!0);f(this,"visibilityNeedsUpdate","show");f(this,"animation",null);f(this,"currentStrategyIndex",-1);f(this,"onStrategySelected",(t,r=!1)=>{if(this.currentStrategyIndex===t&&!r)return;if(this.currentStrategyIndex=t,t===this.lowPriorityPinStrategyIndex){this.activePlacement="center",this.markerContainer.setAttribute("data-placement",F_);let o=this.options.lowPriorityPin,i=o.size,s=o.color;this.markerContainer.style.setProperty("--mappedin-pin-size",`${i}px`),this.markerContainer.style.setProperty("--pin-color",s),this.markerContainer.style.opacity=qZ,this.style.top=-i/2+"px",this.style.left=-i/2+"px"}else{this.activePlacement=this.strategies[t]?.name??"center",this.markerContainer.setAttribute("data-placement",this.activePlacement),this.markerContainer.style.removeProperty("--mappedin-pin-size"),this.markerContainer.style.removeProperty("--pin-color"),this.markerContainer.style.opacity="1";let{width:o,height:i}=this.dimensions,s=-i/2+"px",l=-o/2+"px";switch(this.style.top=s,this.style.left=l,this.activePlacement){case"top":{this.style.top=-i+"px";break}case"bottom":{this.style.top="0px";break}case"left":{this.style.left=-o+"px";break}case"right":{this.style.left="0px";break}case"top-left":{this.style.top=-i+"px",this.style.left=-o+"px";break}case"top-right":{this.style.top=-i+"px",this.style.left="0px";break}case"bottom-left":{this.style.top="0px",this.style.left=-o+"px";break}case"bottom-right":{this.style.top="0px",this.style.left="0px";break}default:this.style.top=s,this.style.left=l}}this.markerContainer.style.top=this.style.top,this.markerContainer.style.left=this.style.left});f(this,"packedMessage",{x:0,y:0,enabled:!1,rank:0,bboxes:[],lockedToStrategyIndex:-1,shouldCollideWithScreenEdges:!1});if(this.id=r?.id||dt(),this.options=(0,k_.default)(this.options,r),typeof r.rank=="string")this.rank=xf(r.rank);else if(r.rank!=null&&r.rank>0)this.rank=r.rank;else{let n=Math.trunc(y.env.NODE_ENV==="test"?Tf.testId:Tf.testId*10)/10;Tf.testId+=.001,this.rank=n}typeof r.interactive=="string"&&(this.pointerEvents=r.interactive==="pointer-events-auto"?"auto":"none"),this.contentHtml=t,this.initialRank=this.rank,this.markerContainer=document.createElement("div"),this.markerContainer.className="mappedin-marker",this.markerContainer.style.opacity="0",this.markerContainer.innerHTML=`<div class="mappedin-marker-content">${this.contentHtml}</div>`,this.markerContainer.setAttribute("data-marker-id",this.id.toString()),this.containerEl=this.markerContainer.firstElementChild??null,this.contentEl=this.markerContainer.firstElementChild?.firstElementChild??null}updateDimensions(t,r){if(t!=null&&r!=null)this.dimensions={width:t,height:r};else{let{width:n,height:o}=this.markerContainer.getBoundingClientRect();this.dimensions={width:n,height:o}}Object.assign(this.markerContainer,{width:this.dimensions.width+"px",height:this.dimensions.height+"px"}),this.currentStrategyIndex=-1}get strategies(){let{width:t,height:r}=this.dimensions;if(t===0||r===0)return[];let o=(Array.isArray(this.options.placement)?this.options.placement:[this.options.placement]).map(i=>({name:i,getBoundingBox:()=>{let s=r/2,l=r/2,c=t/2,p=t/2;switch(i){case"top":{s=r,l=0;break}case"bottom":{s=0,l=r;break}case"left":{c=t,p=0;break}case"right":{c=0,p=t;break}case"top-left":{s=r,c=t,l=0,p=0;break}case"top-right":{s=r,p=t,l=0,c=0;break}case"bottom-left":{l=r,c=t,s=0,p=0;break}case"bottom-right":{l=r,p=t,s=0,c=0;break}}return[s+qh,l+qh,c+qh,p+qh]}}));if(this.options.lowPriorityPin?.enabled&&this.options.rank!=="always-visible"){let i={name:F_,getBoundingBox:()=>{let s=Math.max(2,qh/2);return[this.options.lowPriorityPin.size/2+s,this.options.lowPriorityPin.size/2+s,this.options.lowPriorityPin.size/2+s,this.options.lowPriorityPin.size/2+s]}};o.push(i)}return o}toPackedMessage(t=!1){this.packedMessage.x=this.projection.x,this.packedMessage.y=this.projection.y,this.packedMessage.enabled=this.enabled,this.packedMessage.rank=this.rank,this.packedMessage.shouldCollideWithScreenEdges=!0;let r=this.currentStrategyIndex!==-1&&this.currentStrategyIndex!==this.lowPriorityPinStrategyIndex;if(this.visible&&t&&r&&this.collisionDirty===!1?this.packedMessage.lockedToStrategyIndex=this.currentStrategyIndex:this.packedMessage.lockedToStrategyIndex=-1,r&&this.currentStrategyIndex!==this.packedMessage.bboxes[0]?.[4]){let n=this.packedMessage.bboxes.findIndex(o=>o[4]===this.currentStrategyIndex);if(n!==-1){let o=this.packedMessage.bboxes.splice(n,1)[0];this.packedMessage.bboxes.unshift(o)}}if(!this.collisionDirty)return this.packedMessage;this.packedMessage.bboxes=[];for(let n=0;n<this.strategies.length;n++){let o=this.strategies[n];n===this.currentStrategyIndex&&r?this.packedMessage.bboxes.unshift([...o.getBoundingBox(),n]):this.packedMessage.bboxes.push([...o.getBoundingBox(),n])}return this.collisionDirty=!1,this.packedMessage}get lowPriorityPinStrategyIndex(){return!this.options.lowPriorityPin?.enabled||this.options.rank==="always-visible"?-1:Array.isArray(this.options.placement)?this.options.placement.length:1}destroy(){}};f(Tf,"testId",0);var ws=Tf;u();u();u();u();u();var Mf=class{constructor(){f(this,"hover",!1);f(this,"dirty",!1)}};u();var wE=il(uC());u();u();u();var WJ=q.enum(p5),$J=e=>{let t=e[0];for(let r=1;r<e.length;r++){let n=e[r];if(n<=t)return!1;t=n}return!0},zJ=e=>{let t=e[0];for(let r=1;r<e.length;r++){let n=e[r];if(n>=t)return!1;t=n}return!0},XJ=e=>$J(e)||zJ(e),uE=q.object({on:q.literal("zoom-level"),input:q.array(q.number()).nonempty().refine(XJ,{message:"input array must be strictly increasing or decreasing"}),output:q.array(q.number()).nonempty(),easing:WJ.default("linear")}).refine(e=>e.input.length===e.output.length,{message:"input and output must have the same length"});u();function ox(e){"@babel/helpers - typeof";return ox=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ox(e)}var ZJ=/^\s+/,YJ=/\s+$/;function de(e,t){if(e=e||"",t=t||{},e instanceof de)return e;if(!(this instanceof de))return new de(e,t);var r=JJ(e);this._originalInput=e,this._r=r.r,this._g=r.g,this._b=r.b,this._a=r.a,this._roundA=Math.round(100*this._a)/100,this._format=t.format||r.format,this._gradientType=t.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=r.ok}de.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(t.r*299+t.g*587+t.b*114)/1e3},getLuminance:function(){var t=this.toRgb(),r,n,o,i,s,l;return r=t.r/255,n=t.g/255,o=t.b/255,r<=.03928?i=r/12.92:i=Math.pow((r+.055)/1.055,2.4),n<=.03928?s=n/12.92:s=Math.pow((n+.055)/1.055,2.4),o<=.03928?l=o/12.92:l=Math.pow((o+.055)/1.055,2.4),.2126*i+.7152*s+.0722*l},setAlpha:function(t){return this._a=bE(t),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var t=fE(this._r,this._g,this._b);return{h:t.h*360,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=fE(this._r,this._g,this._b),r=Math.round(t.h*360),n=Math.round(t.s*100),o=Math.round(t.v*100);return this._a==1?"hsv("+r+", "+n+"%, "+o+"%)":"hsva("+r+", "+n+"%, "+o+"%, "+this._roundA+")"},toHsl:function(){var t=dE(this._r,this._g,this._b);return{h:t.h*360,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=dE(this._r,this._g,this._b),r=Math.round(t.h*360),n=Math.round(t.s*100),o=Math.round(t.l*100);return this._a==1?"hsl("+r+", "+n+"%, "+o+"%)":"hsla("+r+", "+n+"%, "+o+"%, "+this._roundA+")"},toHex:function(t){return mE(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(t){return eq(this._r,this._g,this._b,this._a,t)},toHex8String:function(t){return"#"+this.toHex8(t)},toRgb:function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:Math.round(Kt(this._r,255)*100)+"%",g:Math.round(Kt(this._g,255)*100)+"%",b:Math.round(Kt(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+Math.round(Kt(this._r,255)*100)+"%, "+Math.round(Kt(this._g,255)*100)+"%, "+Math.round(Kt(this._b,255)*100)+"%)":"rgba("+Math.round(Kt(this._r,255)*100)+"%, "+Math.round(Kt(this._g,255)*100)+"%, "+Math.round(Kt(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:dq[mE(this._r,this._g,this._b,!0)]||!1},toFilter:function(t){var r="#"+hE(this._r,this._g,this._b,this._a),n=r,o=this._gradientType?"GradientType = 1, ":"";if(t){var i=de(t);n="#"+hE(i._r,i._g,i._b,i._a)}return"progid:DXImageTransform.Microsoft.gradient("+o+"startColorstr="+r+",endColorstr="+n+")"},toString:function(t){var r=!!t;t=t||this._format;var n=!1,o=this._a<1&&this._a>=0,i=!r&&o&&(t==="hex"||t==="hex6"||t==="hex3"||t==="hex4"||t==="hex8"||t==="name");return i?t==="name"&&this._a===0?this.toName():this.toRgbString():(t==="rgb"&&(n=this.toRgbString()),t==="prgb"&&(n=this.toPercentageRgbString()),(t==="hex"||t==="hex6")&&(n=this.toHexString()),t==="hex3"&&(n=this.toHexString(!0)),t==="hex4"&&(n=this.toHex8String(!0)),t==="hex8"&&(n=this.toHex8String()),t==="name"&&(n=this.toName()),t==="hsl"&&(n=this.toHslString()),t==="hsv"&&(n=this.toHsvString()),n||this.toHexString())},clone:function(){return de(this.toString())},_applyModification:function(t,r){var n=t.apply(null,[this].concat([].slice.call(r)));return this._r=n._r,this._g=n._g,this._b=n._b,this.setAlpha(n._a),this},lighten:function(){return this._applyModification(oq,arguments)},brighten:function(){return this._applyModification(iq,arguments)},darken:function(){return this._applyModification(sq,arguments)},desaturate:function(){return this._applyModification(tq,arguments)},saturate:function(){return this._applyModification(rq,arguments)},greyscale:function(){return this._applyModification(nq,arguments)},spin:function(){return this._applyModification(aq,arguments)},_applyCombination:function(t,r){return t.apply(null,[this].concat([].slice.call(r)))},analogous:function(){return this._applyCombination(pq,arguments)},complement:function(){return this._applyCombination(lq,arguments)},monochromatic:function(){return this._applyCombination(uq,arguments)},splitcomplement:function(){return this._applyCombination(cq,arguments)},triad:function(){return this._applyCombination(gE,[3])},tetrad:function(){return this._applyCombination(gE,[4])}};de.fromRatio=function(e,t){if(ox(e)=="object"){var r={};for(var n in e)e.hasOwnProperty(n)&&(n==="a"?r[n]=e[n]:r[n]=ng(e[n]));e=r}return de(e,t)};function JJ(e){var t={r:0,g:0,b:0},r=1,n=null,o=null,i=null,s=!1,l=!1;return typeof e=="string"&&(e=gq(e)),ox(e)=="object"&&(Ga(e.r)&&Ga(e.g)&&Ga(e.b)?(t=qJ(e.r,e.g,e.b),s=!0,l=String(e.r).substr(-1)==="%"?"prgb":"rgb"):Ga(e.h)&&Ga(e.s)&&Ga(e.v)?(n=ng(e.s),o=ng(e.v),t=QJ(e.h,n,o),s=!0,l="hsv"):Ga(e.h)&&Ga(e.s)&&Ga(e.l)&&(n=ng(e.s),i=ng(e.l),t=KJ(e.h,n,i),s=!0,l="hsl"),e.hasOwnProperty("a")&&(r=e.a)),r=bE(r),{ok:s,format:e.format||l,r:Math.min(255,Math.max(t.r,0)),g:Math.min(255,Math.max(t.g,0)),b:Math.min(255,Math.max(t.b,0)),a:r}}function qJ(e,t,r){return{r:Kt(e,255)*255,g:Kt(t,255)*255,b:Kt(r,255)*255}}function dE(e,t,r){e=Kt(e,255),t=Kt(t,255),r=Kt(r,255);var n=Math.max(e,t,r),o=Math.min(e,t,r),i,s,l=(n+o)/2;if(n==o)i=s=0;else{var c=n-o;switch(s=l>.5?c/(2-n-o):c/(n+o),n){case e:i=(t-r)/c+(t<r?6:0);break;case t:i=(r-e)/c+2;break;case r:i=(e-t)/c+4;break}i/=6}return{h:i,s,l}}function KJ(e,t,r){var n,o,i;e=Kt(e,360),t=Kt(t,100),r=Kt(r,100);function s(p,d,m){return m<0&&(m+=1),m>1&&(m-=1),m<1/6?p+(d-p)*6*m:m<1/2?d:m<2/3?p+(d-p)*(2/3-m)*6:p}if(t===0)n=o=i=r;else{var l=r<.5?r*(1+t):r+t-r*t,c=2*r-l;n=s(c,l,e+1/3),o=s(c,l,e),i=s(c,l,e-1/3)}return{r:n*255,g:o*255,b:i*255}}function fE(e,t,r){e=Kt(e,255),t=Kt(t,255),r=Kt(r,255);var n=Math.max(e,t,r),o=Math.min(e,t,r),i,s,l=n,c=n-o;if(s=n===0?0:c/n,n==o)i=0;else{switch(n){case e:i=(t-r)/c+(t<r?6:0);break;case t:i=(r-e)/c+2;break;case r:i=(e-t)/c+4;break}i/=6}return{h:i,s,v:l}}function QJ(e,t,r){e=Kt(e,360)*6,t=Kt(t,100),r=Kt(r,100);var n=Math.floor(e),o=e-n,i=r*(1-t),s=r*(1-o*t),l=r*(1-(1-o)*t),c=n%6,p=[r,s,i,i,l,r][c],d=[l,r,r,s,i,i][c],m=[i,i,l,r,r,s][c];return{r:p*255,g:d*255,b:m*255}}function mE(e,t,r,n){var o=[Di(Math.round(e).toString(16)),Di(Math.round(t).toString(16)),Di(Math.round(r).toString(16))];return n&&o[0].charAt(0)==o[0].charAt(1)&&o[1].charAt(0)==o[1].charAt(1)&&o[2].charAt(0)==o[2].charAt(1)?o[0].charAt(0)+o[1].charAt(0)+o[2].charAt(0):o.join("")}function eq(e,t,r,n,o){var i=[Di(Math.round(e).toString(16)),Di(Math.round(t).toString(16)),Di(Math.round(r).toString(16)),Di(xE(n))];return o&&i[0].charAt(0)==i[0].charAt(1)&&i[1].charAt(0)==i[1].charAt(1)&&i[2].charAt(0)==i[2].charAt(1)&&i[3].charAt(0)==i[3].charAt(1)?i[0].charAt(0)+i[1].charAt(0)+i[2].charAt(0)+i[3].charAt(0):i.join("")}function hE(e,t,r,n){var o=[Di(xE(n)),Di(Math.round(e).toString(16)),Di(Math.round(t).toString(16)),Di(Math.round(r).toString(16))];return o.join("")}de.equals=function(e,t){return!e||!t?!1:de(e).toRgbString()==de(t).toRgbString()};de.random=function(){return de.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function tq(e,t){t=t===0?0:t||10;var r=de(e).toHsl();return r.s-=t/100,r.s=ix(r.s),de(r)}function rq(e,t){t=t===0?0:t||10;var r=de(e).toHsl();return r.s+=t/100,r.s=ix(r.s),de(r)}function nq(e){return de(e).desaturate(100)}function oq(e,t){t=t===0?0:t||10;var r=de(e).toHsl();return r.l+=t/100,r.l=ix(r.l),de(r)}function iq(e,t){t=t===0?0:t||10;var r=de(e).toRgb();return r.r=Math.max(0,Math.min(255,r.r-Math.round(255*-(t/100)))),r.g=Math.max(0,Math.min(255,r.g-Math.round(255*-(t/100)))),r.b=Math.max(0,Math.min(255,r.b-Math.round(255*-(t/100)))),de(r)}function sq(e,t){t=t===0?0:t||10;var r=de(e).toHsl();return r.l-=t/100,r.l=ix(r.l),de(r)}function aq(e,t){var r=de(e).toHsl(),n=(r.h+t)%360;return r.h=n<0?360+n:n,de(r)}function lq(e){var t=de(e).toHsl();return t.h=(t.h+180)%360,de(t)}function gE(e,t){if(isNaN(t)||t<=0)throw new Error("Argument to polyad must be a positive number");for(var r=de(e).toHsl(),n=[de(e)],o=360/t,i=1;i<t;i++)n.push(de({h:(r.h+i*o)%360,s:r.s,l:r.l}));return n}function cq(e){var t=de(e).toHsl(),r=t.h;return[de(e),de({h:(r+72)%360,s:t.s,l:t.l}),de({h:(r+216)%360,s:t.s,l:t.l})]}function pq(e,t,r){t=t||6,r=r||30;var n=de(e).toHsl(),o=360/r,i=[de(e)];for(n.h=(n.h-(o*t>>1)+720)%360;--t;)n.h=(n.h+o)%360,i.push(de(n));return i}function uq(e,t){t=t||6;for(var r=de(e).toHsv(),n=r.h,o=r.s,i=r.v,s=[],l=1/t;t--;)s.push(de({h:n,s:o,v:i})),i=(i+l)%1;return s}de.mix=function(e,t,r){r=r===0?0:r||50;var n=de(e).toRgb(),o=de(t).toRgb(),i=r/100,s={r:(o.r-n.r)*i+n.r,g:(o.g-n.g)*i+n.g,b:(o.b-n.b)*i+n.b,a:(o.a-n.a)*i+n.a};return de(s)};de.readability=function(e,t){var r=de(e),n=de(t);return(Math.max(r.getLuminance(),n.getLuminance())+.05)/(Math.min(r.getLuminance(),n.getLuminance())+.05)};de.isReadable=function(e,t,r){var n=de.readability(e,t),o,i;switch(i=!1,o=yq(r),o.level+o.size){case"AAsmall":case"AAAlarge":i=n>=4.5;break;case"AAlarge":i=n>=3;break;case"AAAsmall":i=n>=7;break}return i};de.mostReadable=function(e,t,r){var n=null,o=0,i,s,l,c;r=r||{},s=r.includeFallbackColors,l=r.level,c=r.size;for(var p=0;p<t.length;p++)i=de.readability(e,t[p]),i>o&&(o=i,n=de(t[p]));return de.isReadable(e,n,{level:l,size:c})||!s?n:(r.includeFallbackColors=!1,de.mostReadable(e,["#fff","#000"],r))};var dC=de.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},dq=de.hexNames=fq(dC);function fq(e){var t={};for(var r in e)e.hasOwnProperty(r)&&(t[e[r]]=r);return t}function bE(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function Kt(e,t){mq(e)&&(e="100%");var r=hq(e);return e=Math.min(t,Math.max(0,parseFloat(e))),r&&(e=parseInt(e*t,10)/100),Math.abs(e-t)<1e-6?1:e%t/parseFloat(t)}function ix(e){return Math.min(1,Math.max(0,e))}function yo(e){return parseInt(e,16)}function mq(e){return typeof e=="string"&&e.indexOf(".")!=-1&&parseFloat(e)===1}function hq(e){return typeof e=="string"&&e.indexOf("%")!=-1}function Di(e){return e.length==1?"0"+e:""+e}function ng(e){return e<=1&&(e=e*100+"%"),e}function xE(e){return Math.round(parseFloat(e)*255).toString(16)}function yE(e){return yo(e)/255}var Ei=function(){var e="[-\\+]?\\d+%?",t="[-\\+]?\\d*\\.\\d+%?",r="(?:"+t+")|(?:"+e+")",n="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?",o="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?";return{CSS_UNIT:new RegExp(r),rgb:new RegExp("rgb"+n),rgba:new RegExp("rgba"+o),hsl:new RegExp("hsl"+n),hsla:new RegExp("hsla"+o),hsv:new RegExp("hsv"+n),hsva:new RegExp("hsva"+o),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function Ga(e){return!!Ei.CSS_UNIT.exec(e)}function gq(e){e=e.replace(ZJ,"").replace(YJ,"").toLowerCase();var t=!1;if(dC[e])e=dC[e],t=!0;else if(e=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var r;return(r=Ei.rgb.exec(e))?{r:r[1],g:r[2],b:r[3]}:(r=Ei.rgba.exec(e))?{r:r[1],g:r[2],b:r[3],a:r[4]}:(r=Ei.hsl.exec(e))?{h:r[1],s:r[2],l:r[3]}:(r=Ei.hsla.exec(e))?{h:r[1],s:r[2],l:r[3],a:r[4]}:(r=Ei.hsv.exec(e))?{h:r[1],s:r[2],v:r[3]}:(r=Ei.hsva.exec(e))?{h:r[1],s:r[2],v:r[3],a:r[4]}:(r=Ei.hex8.exec(e))?{r:yo(r[1]),g:yo(r[2]),b:yo(r[3]),a:yE(r[4]),format:t?"name":"hex8"}:(r=Ei.hex6.exec(e))?{r:yo(r[1]),g:yo(r[2]),b:yo(r[3]),format:t?"name":"hex"}:(r=Ei.hex4.exec(e))?{r:yo(r[1]+""+r[1]),g:yo(r[2]+""+r[2]),b:yo(r[3]+""+r[3]),a:yE(r[4]+""+r[4]),format:t?"name":"hex8"}:(r=Ei.hex3.exec(e))?{r:yo(r[1]+""+r[1]),g:yo(r[2]+""+r[2]),b:yo(r[3]+""+r[3]),format:t?"name":"hex"}:!1}function yq(e){var t,r;return e=e||{level:"AA",size:"small"},t=(e.level||"AA").toUpperCase(),r=(e.size||"small").toLowerCase(),t!=="AA"&&t!=="AAA"&&(t="AA"),r!=="small"&&r!=="large"&&(r="small"),{level:t,size:r}}var sx=_.object({margin:_.number().min(6).default(6),maxLines:_.number().min(1).default(2),textSize:_.number().min(0).default(11.5),maxWidth:_.number().min(0).default(150),lineHeight:_.number().min(0).default(1.2),color:_.string().default("#333"),outlineColor:_.string().default("white"),textColor:_.string().optional(),textOutlineColor:_.string().optional(),pinColor:_.string().optional(),pinOutlineColor:_.string().optional(),pinColorInactive:_.string().optional(),pinOutlineColorInactive:_.string().optional(),icon:_.string().optional(),iconSize:_.number().min(0).default(20),iconScale:_.union([_.number(),uE]).default(1),iconPadding:_.number().min(0).default(2),iconFit:_.enum(["fill","contain","cover"]).default("cover"),iconOverflow:_.enum(["visible","hidden"]).default("hidden"),iconVisibleAtZoomLevel:_.number().default(-1/0)}),vE=sx.transform(e=>({...e,textColor:e.textColor??e.color,textOutlineColor:e.textOutlineColor??e.outlineColor,pinColor:e.pinColor??e.color,pinOutlineColor:e.pinOutlineColor??e.outlineColor,pinColorInactive:e.pinColorInactive??de(e.pinColor??e.color).setAlpha(.5).toRgbString(),pinOutlineColorInactive:e.pinOutlineColorInactive??de(e.pinOutlineColor??e.outlineColor).setAlpha(.5).toRgbString()})),kDe=sx.strict(),ax=e=>vE.parse(e),bq=_.object({rank:bf.optional(),appearance:vE.optional(),interactive:_.boolean().default(!1)}),fC=e=>{bq.parse(e??{})},IE=(e,t,r)=>{_.array(_.number()).min(2).max(3).parse(e),_.string().parse(t),fC(r)},SE=["color","outlineColor","margin"],xq=[...SE,"maxLines","lineHeight","textSize","maxWidth","textColor","textOutlineColor"],vq=[...SE,"icon","pinColor","pinOutlineColor","pinColorInactive","pinOutlineColorInactive"],CE=(e,t)=>xq.some(r=>t[r]!=null&&e[r]!==t[r]),TE=(e,t)=>vq.some(r=>t[r]!=null&&e[r]!==t[r]);var Cq="LOW_PRIORITY",ME=4,Tq=6,PE=6.5,Mq={heightAbovePolygon:0},_f=class _f{constructor(t,r,n){f(this,"lines",0);f(this,"id");f(this,"rank");f(this,"type","label");f(this,"initialRank");f(this,"contextConfigured",!1);f(this,"fillText");f(this,"newStyle",{});f(this,"opacity",0);f(this,"visibilityNeedsUpdate",!1);f(this,"text");f(this,"style",{top:0,left:0,textLabelVisible:!0,pinVisibility:1,textAlign:"left"});f(this,"projection",new De);f(this,"labelCacheId");f(this,"_cache",{});f(this,"appearance");f(this,"options");f(this,"visible",!0);f(this,"enabled",!0);f(this,"isOccluded",!1);f(this,"offscreen",!1);f(this,"canShow",!1);f(this,"activeBoundingBox",{x:0,y:0,w:0,h:0});f(this,"dimensions",{width:0,height:0});f(this,"currentStrategyIndex",-1);f(this,"totalMarkerSize",0);f(this,"iconScale",1);f(this,"iconPadding");f(this,"dirty",!0);f(this,"textDirty",!0);f(this,"markerDirty",!0);f(this,"attachedDirty",!0);f(this,"collisionDirty",!0);f(this,"lastTextAlign");f(this,"imageHash");f(this,"markerSize",0);f(this,"iconVisible",!1);f(this,"dp");f(this,"animate",!0);f(this,"onStrategySelected",t=>{if(this.currentStrategyIndex===t)return;this.currentStrategyIndex=t;let r=this.strategies[this.currentStrategyIndex];if(r){r.onStrategySelected();let n=this.style;this.style=this.newStyle,this.newStyle=n}});f(this,"packedMessage",{x:0,y:0,enabled:!1,rank:0,bboxes:[],shouldCollideWithScreenEdges:!1,lockedToStrategyIndex:-1});if(this.id=r.id??dt(),this.options=(0,wE.default)({},r,Mq),this.text=t,this.dp=(i=1)=>i*n.pixelRatio,typeof r.rank=="string")this.rank=xf(r.rank),this.initialRank=this.rank;else if(r.rank!=null&&r.rank>0)this.rank=r.rank,this.initialRank=r.rank;else{let i=Math.trunc(y.env.NODE_ENV==="test"?_f.testId:_f.testId*10)/10;_f.testId+=.001,this.rank=i,this.initialRank=i}let o=ax(r.appearance??{});this.appearance=o,this.iconPadding=o.iconPadding}get scaledMarkerSize(){return this.totalMarkerSize*this.iconScale}get scaledIconPadding(){return this.appearance.iconPadding*this.iconScale}setEntity(){}calculateMarkerSize(){let t=this.dp();this.iconVisible&&typeof this.appearance.iconSize<"u"&&this.imageHash?this.markerSize=this.dp(this.appearance.iconSize):this.markerSize=this.dp(PE),this.totalMarkerSize=Math.ceil((this.markerSize+2.5)/t)}get lowPriorityStrategyIndex(){return this.text===""?-1:3}get strategies(){let{width:t,height:r}=this.dimensions,{margin:n}=this.appearance,o=Math.max(Tq,n),i=this.iconVisible?o/2:0,s=this.iconVisible?this.scaledMarkerSize:PE/2,l=[{name:"RIGHT",getBoundingBox:()=>{let c=Math.max(this.scaledMarkerSize,r);return[c/2+o,c/2+o,this.scaledMarkerSize/2+o,this.scaledMarkerSize/2+t+o]},onStrategySelected:()=>{this.newStyle.textAlign="left",this.newStyle.pinVisibility=1,this.newStyle.top=-r/2,this.newStyle.left=this.scaledMarkerSize/2+ME,this.newStyle.textLabelVisible=!0}},{name:"LEFT",getBoundingBox:()=>{let c=Math.max(this.scaledMarkerSize,r);return[c/2+o,c/2+o,this.scaledMarkerSize/2+t+o,this.scaledMarkerSize/2+o]},onStrategySelected:()=>{this.newStyle.textAlign="right",this.newStyle.pinVisibility=1,this.newStyle.top=-r/2,this.newStyle.left=-t-this.scaledMarkerSize/2-ME,this.newStyle.textLabelVisible=!0}},{name:"TOP",getBoundingBox:()=>{let c=this.dp();return[r+this.scaledMarkerSize/2/c+o,this.scaledMarkerSize/2+o,t/2+o,t/2+o]},onStrategySelected:()=>{this.newStyle.pinVisibility=1,this.newStyle.textAlign="center",this.newStyle.textLabelVisible=!0,this.newStyle.top=-r-this.scaledMarkerSize/2,this.newStyle.left=-t/2}},{name:Cq,getBoundingBox:()=>[s+i,s+i,s+i,s+i],onStrategySelected:()=>{this.newStyle.pinVisibility=.5,this.newStyle.textLabelVisible=!1,this.newStyle.top=0,this.newStyle.left=0}}];return this.text===""?[{name:"ICON_ONLY",getBoundingBox:()=>[this.scaledMarkerSize/2+o,this.scaledMarkerSize/2+o,this.scaledMarkerSize/2+o,this.scaledMarkerSize/2+o],onStrategySelected:()=>{this.newStyle.pinVisibility=1,this.newStyle.textLabelVisible=!1,this.newStyle.top=0,this.newStyle.left=0}}]:l}recomputeCurrentStrategy(t=this.iconScale){if(this.iconScale!==t||this.dirty){let r=this.strategies[this.currentStrategyIndex];if(this.iconScale=t,this.collisionDirty=!0,r){r.onStrategySelected(t);let n=this.style;this.style=this.newStyle,this.newStyle=n}this.dirty=!1}}updatePosition(){}disable(){this.visible=!1}toPackedMessage(t=!1){if(this.visible&&t&&this.collisionDirty===!1&&this.currentStrategyIndex!=null&&this.currentStrategyIndex!==-1&&this.currentStrategyIndex!==this.lowPriorityStrategyIndex?this.packedMessage.lockedToStrategyIndex=this.currentStrategyIndex:this.packedMessage.lockedToStrategyIndex=-1,this.packedMessage.x=this.projection.x,this.packedMessage.y=this.projection.y,this.packedMessage.enabled=this.enabled,this.packedMessage.rank=this.rank,this.currentStrategyIndex!==-1&&this.currentStrategyIndex!==this.lowPriorityStrategyIndex&&this.currentStrategyIndex!==this.packedMessage.bboxes[0]?.[4]){let r=this.packedMessage.bboxes.findIndex(n=>n[4]===this.currentStrategyIndex);if(r!==-1){let n=this.packedMessage.bboxes.splice(r,1)[0];this.packedMessage.bboxes.unshift(n)}}if(!this.collisionDirty)return this.packedMessage;this.packedMessage.bboxes=[];for(let r=0;r<this.strategies.length;r++){let n=this.strategies[r];r===this.currentStrategyIndex&&this.currentStrategyIndex!==-1&&this.currentStrategyIndex!==this.lowPriorityStrategyIndex?this.packedMessage.bboxes.unshift([...n.getBoundingBox(),r]):this.packedMessage.bboxes.push([...n.getBoundingBox(),r])}return this.packedMessage.shouldCollideWithScreenEdges=!1,this.collisionDirty=!1,this.packedMessage}destroy(){}};f(_f,"testId",0);var mC=_f,Os=mC;u();u();var lx=class extends Fe{constructor(r,n,o=!0){super();f(this,"rendererState");f(this,"convertTo3DMapPosition");f(this,"textSet",new Set);f(this,"batchedTextMap",new Map);f(this,"useWorker",!0);f(this,"debugTextAreaMesh",new Map);o===!1&&(this.useWorker=!1,cx(!1)),this.rendererState=r,this.convertTo3DMapPosition=n}remove(r){this.textSet.delete(r)}update(r){let n,o,i,s=[];for(let l of this.rendererState.geometry3DIdsInScene)if(n=this.rendererState.geometry3DMap.get(l),n?.type==="text3d"){o=n.components[0],i=n.components[1];let c=o.mesh?.parent;if(!c||!(c instanceof kt)||!(o instanceof Wl))continue;if("textArea"in o.feature.properties&&o.mesh!=null&&o.polygonEntityId!=null&&o.textMesh==null&&o.mesh.parent!=null&&o.feature.properties?.textArea?.position!=null){if(this.textSet.has(o.polygonEntityId))continue;this.textSet.add(o.polygonEntityId),this.batchedTextMap.has(c)||this.batchedTextMap.set(c,Ef().then(({BatchedText:m})=>{let g=new m;return g.type="batchedtext",c.add(g),g}));let d=this.batchedTextMap.get(c);if(!d)throw new Error("batched text required");s.push(OE({entityId:l,textComponent:o,styleComponent:i,convertTo3DMapPosition:this.convertTo3DMapPosition,batchedMeshPromise:d,rendererState:this.rendererState,type:"text-area"}).then(()=>{this.publish("render")}))}else if(o.mesh!=null&&o.textMesh==null&&o.mesh.parent!=null){if(this.textSet.has(l.toString()))continue;this.textSet.add(l.toString()),this.batchedTextMap.has(c)||this.batchedTextMap.set(c,Ef().then(({BatchedText:m})=>{let g=new m;return g.type="batchedtext",c.add(g),g}));let d=this.batchedTextMap.get(c);if(!d)throw new Error("batched text required");s.push(OE({entityId:l,textComponent:o,styleComponent:i,convertTo3DMapPosition:this.convertTo3DMapPosition,batchedMeshPromise:d,rendererState:this.rendererState,type:"point"}).then(()=>{this.publish("render")}))}let p=this.batchedTextMap.get(c);o.textMesh&&p&&o.polygonEntityId!=null&&Promise.all([p,Promise.resolve({meshComponent:o,styleComponent:i})]).then(([d,{meshComponent:m,styleComponent:g}])=>{let{textMesh:x}=m;if(d&&x){let v=bC(d,x);m.visible&&!v?d.add(x):!m.visible&&v&&d.remove(x)}g.flipToFaceCamera&&this.flipIfNeeded(m,r)})}return Promise.all(s)}flipIfNeeded(r,n){let o=r.textMesh;if(!o)return!1;let i=o.rotation.z,s=s2(i+n);s>Math.PI/2&&s<3*Math.PI/2&&(o.rotation.z=s2(i+Math.PI))}showTextAreaMesh(){let r,n;for(let o of this.rendererState.geometry3DIdsInScene)if(r=this.rendererState.geometry3DMap.get(o),r?.type==="text3d"&&(n=r.components[0],"textArea"in n.feature.properties)){let i=n.feature.properties.textArea;if(!i)continue;let s=new si(i.maxWidth,i.maxHeight),l=new Re(s,new Tr({color:"pink"})),{textMesh:c}=n;if(!c)continue;let p=this.convertTo3DMapPosition(i.position,og);l.position.copy(p),l.position.z=c.position.z-.1,l.rotation.z=c.rotation.z,gC.identity(),gC.makeRotationAxis(new ue(0,0,1),c.userData.rotationZ),og.set(i.maxWidth/2,0,0),og.applyMatrix4(gC),l.position.x-=og.x,l.position.y-=og.y,this.rendererState.entityScene.add(l),this.debugTextAreaMesh.set(o,l)}this.publish("render")}hideTextAreaMesh(){this.debugTextAreaMesh.forEach(r=>{this.rendererState.entityScene.remove(r)}),this.debugTextAreaMesh.clear(),this.publish("render")}};function cx(e){Ef().then(({configureTroikaTextBuilder:t})=>{t({useWorker:e})})}var gC=new to,og=new ue,yC;async function _E(e){let{preloadFont:t}=await Ef();return t(e)}function Ef(){return yC||(yC=import("./text3d-ROTRSMZX.js").then(e=>e)),yC}async function OE({entityId:e,textComponent:t,styleComponent:r,convertTo3DMapPosition:n,batchedMeshPromise:o,rendererState:i,type:s="text-area"}){return Promise.all([Ef(),Promise.resolve({entityId:e,meshComponent:t,styleComponent:r})]).then(([{createTroikaTextPoint:l,createTroikaTextArea:c},p])=>s==="text-area"?c(p.entityId,p.meshComponent,p.styleComponent,n):l(p.entityId,p.meshComponent,p.styleComponent,n)).catch(l=>{A.warn("Trouble creating text: ",l)}).then(l=>{if(!l?.text)return;let c=[Promise.resolve(l.text),o,Promise.resolve()];if(t.polygonEntityId){let p=i.geometry3DMap.get(t.polygonEntityId);if(p?.type==="geometry"){let d=p.components[0],m=p.components[1];d.textMesh=l.text,l.text.position.z=m.altitude+m.height+Pq}}else c[2]=Ef().then(({syncText:p})=>p(l.text));return Promise.all(c)}).then(l=>{if(!l)return;let[c,p]=l;p.add(c),t.batchedText||(t.batchedText=p)})}function bC(e,t){return e._members.has(t)}var Pq=.5;var xC=_.object({visible:_.boolean(),color:_.string(),flipToFaceCamera:_.boolean(),font:_.string().optional(),fontSize:_.number(),margin:_.union([_.number(),_.tuple([_.number(),_.number(),_.number(),_.number()])]),outlineColor:_.string(),outlineOpacity:_.number(),outlineBlur:_.union([_.number(),_.string()]),outlineWidth:_.number(),outlineOffsetX:_.number(),outlineOffsetY:_.number(),strokeWidth:_.number(),maxWidth:_.number().optional(),maxHeight:_.number().optional(),strokeOpacity:_.number(),strokeColor:_.string(),fillOpacity:_.number(),hoverColor:_.string().optional(),id:_.union([_.string(),_.number()]),type:_.literal("text3d"),position:_.tuple([_.number(),_.number(),_.number()]),content:_.string()}),EE=xC.partial().omit({id:!0,type:!0}).strict(),px=EE.omit({margin:!0,position:!0,maxWidth:!0,maxHeight:!0,content:!0}).strict(),DE=_.object({appearance:EE.optional(),parentId:_.string().optional()}).strict(),Wl=class{constructor(t){f(this,"mesh",new ai);f(this,"textMesh");f(this,"type","text3d");f(this,"feature");f(this,"parent");f(this,"batchedText");f(this,"polygonEntityId");this.feature=t}get visible(){return this.batchedText&&this.textMesh?bC(this.batchedText,this.textMesh):this.textMesh?this.textMesh.visible:!1}set visible(t){this.batchedText&&this.textMesh?t?this.batchedText.addText(this.textMesh):this.batchedText.removeText(this.textMesh):this.textMesh&&(this.textMesh.visible=t),this.mesh.visible=t}};u();var Df,Ff=class{constructor(t){f(this,"color");f(this,"dirty",!0);f(this,"enabled",!0);T(this,Df,!1);f(this,"edgeColors");f(this,"edgeVisibility");f(this,"geometry");f(this,"ranges");f(this,"topFaceVerticesIndices");this.color=t}get currentOpacity(){return this.edgeColors&&this.ranges?this.edgeColors.array[this.ranges.start*4+3]:0}set visible(t){if(!this.edgeVisibility||!this.ranges||a(this,Df)===t)return;w(this,Df,t);let r=this.edgeVisibility.array,n=t?1:0;for(let o=0;o<this.ranges.count;o++){let i=this.ranges.start+o;r[i]=n}this.edgeVisibility.needsUpdate=!0}get visible(){return a(this,Df)}get currentColor(){return this.edgeColors&&this.ranges?[this.edgeColors.array[this.ranges.start*4],this.edgeColors.array[this.ranges.start*4+1],this.edgeColors.array[this.ranges.start*4+2]]:[0,0,0]}};Df=new WeakMap;u();u();u();var ux=class extends JT{constructor(r){let n=r,o=3,i=o*4;super(new Uint8Array(r*i),o,r,tb,eb);f(this,"_width");f(this,"_height");f(this,"_propertiesLength");this._width=i,this._height=n,this._propertiesLength=o}setColor(r,n,o){let i=this.image.data,s=r*this._width;i[s]=Math.round(n.r*255),i[s+1]=Math.round(n.g*255),i[s+2]=Math.round(n.b*255),i[s+3]=0,i[s+4]=Math.round(o.r*255),i[s+5]=Math.round(o.g*255),i[s+6]=Math.round(o.b*255),i[s+7]=0,this.needsUpdate=!0}getColor(r){let n=this.image.data,o=r*this._width,i=new Nt(n[o]/255,n[o+1]/255,n[o+2]/255),s=new Nt(n[o+4]/255,n[o+5]/255,n[o+6]/255);return{color:i,topColor:s}}setTexture(r,n,o){let i=this.image.data,s=r*this._width;i[s+8]=n?255:0,i[s+9]=o?255:0,i[s+10]=0,i[s+11]=0,this.needsUpdate=!0}getTexture(r){let n=this.image.data,o=r*this._width,i=n[o+8]===255,s=n[o+9]===255;return{texture:i,topTexture:s}}};u();var FE=`#define LAMBERT
|
|
12
|
+
Pos: ${n.position?.toArray().join(", ")}`,"#caffbf")})}get _state(){return this.state}queueDebugMessage(r,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=r,this.debugPanel?.prepend(o),setTimeout(()=>{o.style.opacity="0",setTimeout(()=>{o.remove()},500)},2500)}getCursor(){return this.cursor}};vf=new WeakMap;function n_(e,t,r){let n=e.components[2];n&&n.hover!==!0&&(n.hover=t?"user-interaction":!1,n.dirty=!0);let o=e.components[0].textMesh?.userData.entityId;if(!o)return;let i=r.geometry3DMap.get(o);i?.type==="text3d"&&(i.components[1].hoverByPolygon=t,i.components[1].dirty=!0)}function tX(e,t,r){return t?"grabbing":e?"pointer":r?"grabbing":"grab"}function rX(e){let t=e;for(;t?.parent;){if(t instanceof al)return;if(t.userData.isSingleModel)return t;t=t.parent}}function nX(e,t){let r=rX(e);return r?t.get(r.userData.entityId):void 0}u();var k_=il(K3());var qh=4,JZ=8,qZ="0.6",F_="low-priority-pin",Q3=_.object({rank:_.union([_.enum(["low","medium","high","always-visible"]),_.number()]).optional(),interactive:_.union([_.boolean(),_.literal("pointer-events-auto")]).optional(),id:_.string().optional(),placement:_.union([_.enum(["top","bottom","left","right","center","top-left","top-right","bottom-left","bottom-right"]),_.array(_.enum(["top","bottom","left","right","center","top-left","top-right","bottom-left","bottom-right"]))]).optional(),dynamicResize:_.boolean().optional(),zIndex:_.number().optional(),lowPriorityPin:_.object({enabled:_.boolean().optional(),size:_.number().positive().optional(),color:_.string().optional()}).optional()});function A_(e,t,r){_.array(_.number()).min(2).max(3).parse(e),_.string().parse(t),Q3.parse(r)}var KZ=Object.freeze({enabled:!0,size:JZ,color:"#666"}),Tf=class Tf{constructor(t,r={}){f(this,"id");f(this,"type","marker");f(this,"rank",0);f(this,"initialRank",0);f(this,"activePlacement","center");f(this,"pointerEvents","none");f(this,"options",{rank:"low",interactive:!1,id:"",placement:"center",dynamicResize:!1,occluderId:0,zIndex:void 0,verticalOffset:0,lowPriorityPin:{...KZ}});f(this,"projection",new De);f(this,"enabled",!0);f(this,"canShow",!1);f(this,"visible",!0);f(this,"isOccluded",!1);f(this,"offscreen",!1);f(this,"strategyIndex",-1);f(this,"activeBoundingBox",{x:0,y:0,w:0,h:0});f(this,"dimensions",{width:0,height:0});f(this,"markerContainer");f(this,"containerEl");f(this,"contentEl",null);f(this,"contentHtml","");f(this,"style",{top:"0px",left:"0px"});f(this,"dirty",!1);f(this,"attachedDirty",!0);f(this,"collisionDirty",!0);f(this,"visibilityNeedsUpdate","show");f(this,"animation",null);f(this,"currentStrategyIndex",-1);f(this,"onStrategySelected",(t,r=!1)=>{if(this.currentStrategyIndex===t&&!r)return;if(this.currentStrategyIndex=t,t===this.lowPriorityPinStrategyIndex){this.activePlacement="center",this.markerContainer.setAttribute("data-placement",F_);let o=this.options.lowPriorityPin,i=o.size,s=o.color;this.markerContainer.style.setProperty("--mappedin-pin-size",`${i}px`),this.markerContainer.style.setProperty("--pin-color",s),this.markerContainer.style.opacity=qZ,this.style.top=-i/2+"px",this.style.left=-i/2+"px"}else{this.activePlacement=this.strategies[t]?.name??"center",this.markerContainer.setAttribute("data-placement",this.activePlacement),this.markerContainer.style.removeProperty("--mappedin-pin-size"),this.markerContainer.style.removeProperty("--pin-color"),this.markerContainer.style.opacity="1";let{width:o,height:i}=this.dimensions,s=-i/2+"px",l=-o/2+"px";switch(this.style.top=s,this.style.left=l,this.activePlacement){case"top":{this.style.top=-i+"px";break}case"bottom":{this.style.top="0px";break}case"left":{this.style.left=-o+"px";break}case"right":{this.style.left="0px";break}case"top-left":{this.style.top=-i+"px",this.style.left=-o+"px";break}case"top-right":{this.style.top=-i+"px",this.style.left="0px";break}case"bottom-left":{this.style.top="0px",this.style.left=-o+"px";break}case"bottom-right":{this.style.top="0px",this.style.left="0px";break}default:this.style.top=s,this.style.left=l}}this.markerContainer.style.top=this.style.top,this.markerContainer.style.left=this.style.left});f(this,"packedMessage",{x:0,y:0,enabled:!1,rank:0,bboxes:[],lockedToStrategyIndex:-1,shouldCollideWithScreenEdges:!1});if(this.id=r?.id||dt(),this.options=(0,k_.default)(this.options,r),typeof r.rank=="string")this.rank=xf(r.rank);else if(r.rank!=null&&r.rank>0)this.rank=r.rank;else{let n=Math.trunc(y.env.NODE_ENV==="test"?Tf.testId:Tf.testId*10)/10;Tf.testId+=.001,this.rank=n}typeof r.interactive=="string"&&(this.pointerEvents=r.interactive==="pointer-events-auto"?"auto":"none"),this.contentHtml=t,this.initialRank=this.rank,this.markerContainer=document.createElement("div"),this.markerContainer.className="mappedin-marker",this.markerContainer.style.opacity="0",this.markerContainer.innerHTML=`<div class="mappedin-marker-content">${this.contentHtml}</div>`,this.markerContainer.setAttribute("data-marker-id",this.id.toString()),this.containerEl=this.markerContainer.firstElementChild??null,this.contentEl=this.markerContainer.firstElementChild?.firstElementChild??null}updateDimensions(t,r){if(t!=null&&r!=null)this.dimensions={width:t,height:r};else{let{width:n,height:o}=this.markerContainer.getBoundingClientRect();this.dimensions={width:n,height:o}}Object.assign(this.markerContainer,{width:this.dimensions.width+"px",height:this.dimensions.height+"px"}),this.currentStrategyIndex=-1}get strategies(){let{width:t,height:r}=this.dimensions;if(t===0||r===0)return[];let o=(Array.isArray(this.options.placement)?this.options.placement:[this.options.placement]).map(i=>({name:i,getBoundingBox:()=>{let s=r/2,l=r/2,c=t/2,p=t/2;switch(i){case"top":{s=r,l=0;break}case"bottom":{s=0,l=r;break}case"left":{c=t,p=0;break}case"right":{c=0,p=t;break}case"top-left":{s=r,c=t,l=0,p=0;break}case"top-right":{s=r,p=t,l=0,c=0;break}case"bottom-left":{l=r,c=t,s=0,p=0;break}case"bottom-right":{l=r,p=t,s=0,c=0;break}}return[s+qh,l+qh,c+qh,p+qh]}}));if(this.options.lowPriorityPin?.enabled&&this.options.rank!=="always-visible"){let i={name:F_,getBoundingBox:()=>{let s=Math.max(2,qh/2);return[this.options.lowPriorityPin.size/2+s,this.options.lowPriorityPin.size/2+s,this.options.lowPriorityPin.size/2+s,this.options.lowPriorityPin.size/2+s]}};o.push(i)}return o}toPackedMessage(t=!1){this.packedMessage.x=this.projection.x,this.packedMessage.y=this.projection.y,this.packedMessage.enabled=this.enabled,this.packedMessage.rank=this.rank,this.packedMessage.shouldCollideWithScreenEdges=!0;let r=this.currentStrategyIndex!==-1&&this.currentStrategyIndex!==this.lowPriorityPinStrategyIndex;if(this.visible&&t&&r&&this.collisionDirty===!1?this.packedMessage.lockedToStrategyIndex=this.currentStrategyIndex:this.packedMessage.lockedToStrategyIndex=-1,r&&this.currentStrategyIndex!==this.packedMessage.bboxes[0]?.[4]){let n=this.packedMessage.bboxes.findIndex(o=>o[4]===this.currentStrategyIndex);if(n!==-1){let o=this.packedMessage.bboxes.splice(n,1)[0];this.packedMessage.bboxes.unshift(o)}}if(!this.collisionDirty)return this.packedMessage;this.packedMessage.bboxes=[];for(let n=0;n<this.strategies.length;n++){let o=this.strategies[n];n===this.currentStrategyIndex&&r?this.packedMessage.bboxes.unshift([...o.getBoundingBox(),n]):this.packedMessage.bboxes.push([...o.getBoundingBox(),n])}return this.collisionDirty=!1,this.packedMessage}get lowPriorityPinStrategyIndex(){return!this.options.lowPriorityPin?.enabled||this.options.rank==="always-visible"?-1:Array.isArray(this.options.placement)?this.options.placement.length:1}destroy(){}};f(Tf,"testId",0);var ws=Tf;u();u();u();u();u();var Mf=class{constructor(){f(this,"hover",!1);f(this,"dirty",!1)}};u();var wE=il(uC());u();u();u();var WJ=q.enum(p5),$J=e=>{let t=e[0];for(let r=1;r<e.length;r++){let n=e[r];if(n<=t)return!1;t=n}return!0},zJ=e=>{let t=e[0];for(let r=1;r<e.length;r++){let n=e[r];if(n>=t)return!1;t=n}return!0},XJ=e=>$J(e)||zJ(e),uE=q.object({on:q.literal("zoom-level"),input:q.array(q.number()).nonempty().refine(XJ,{message:"input array must be strictly increasing or decreasing"}),output:q.array(q.number()).nonempty(),easing:WJ.default("linear")}).refine(e=>e.input.length===e.output.length,{message:"input and output must have the same length"});u();function ox(e){"@babel/helpers - typeof";return ox=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ox(e)}var ZJ=/^\s+/,YJ=/\s+$/;function de(e,t){if(e=e||"",t=t||{},e instanceof de)return e;if(!(this instanceof de))return new de(e,t);var r=JJ(e);this._originalInput=e,this._r=r.r,this._g=r.g,this._b=r.b,this._a=r.a,this._roundA=Math.round(100*this._a)/100,this._format=t.format||r.format,this._gradientType=t.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=r.ok}de.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(t.r*299+t.g*587+t.b*114)/1e3},getLuminance:function(){var t=this.toRgb(),r,n,o,i,s,l;return r=t.r/255,n=t.g/255,o=t.b/255,r<=.03928?i=r/12.92:i=Math.pow((r+.055)/1.055,2.4),n<=.03928?s=n/12.92:s=Math.pow((n+.055)/1.055,2.4),o<=.03928?l=o/12.92:l=Math.pow((o+.055)/1.055,2.4),.2126*i+.7152*s+.0722*l},setAlpha:function(t){return this._a=bE(t),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var t=fE(this._r,this._g,this._b);return{h:t.h*360,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=fE(this._r,this._g,this._b),r=Math.round(t.h*360),n=Math.round(t.s*100),o=Math.round(t.v*100);return this._a==1?"hsv("+r+", "+n+"%, "+o+"%)":"hsva("+r+", "+n+"%, "+o+"%, "+this._roundA+")"},toHsl:function(){var t=dE(this._r,this._g,this._b);return{h:t.h*360,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=dE(this._r,this._g,this._b),r=Math.round(t.h*360),n=Math.round(t.s*100),o=Math.round(t.l*100);return this._a==1?"hsl("+r+", "+n+"%, "+o+"%)":"hsla("+r+", "+n+"%, "+o+"%, "+this._roundA+")"},toHex:function(t){return mE(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(t){return eq(this._r,this._g,this._b,this._a,t)},toHex8String:function(t){return"#"+this.toHex8(t)},toRgb:function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:Math.round(Kt(this._r,255)*100)+"%",g:Math.round(Kt(this._g,255)*100)+"%",b:Math.round(Kt(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+Math.round(Kt(this._r,255)*100)+"%, "+Math.round(Kt(this._g,255)*100)+"%, "+Math.round(Kt(this._b,255)*100)+"%)":"rgba("+Math.round(Kt(this._r,255)*100)+"%, "+Math.round(Kt(this._g,255)*100)+"%, "+Math.round(Kt(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:dq[mE(this._r,this._g,this._b,!0)]||!1},toFilter:function(t){var r="#"+hE(this._r,this._g,this._b,this._a),n=r,o=this._gradientType?"GradientType = 1, ":"";if(t){var i=de(t);n="#"+hE(i._r,i._g,i._b,i._a)}return"progid:DXImageTransform.Microsoft.gradient("+o+"startColorstr="+r+",endColorstr="+n+")"},toString:function(t){var r=!!t;t=t||this._format;var n=!1,o=this._a<1&&this._a>=0,i=!r&&o&&(t==="hex"||t==="hex6"||t==="hex3"||t==="hex4"||t==="hex8"||t==="name");return i?t==="name"&&this._a===0?this.toName():this.toRgbString():(t==="rgb"&&(n=this.toRgbString()),t==="prgb"&&(n=this.toPercentageRgbString()),(t==="hex"||t==="hex6")&&(n=this.toHexString()),t==="hex3"&&(n=this.toHexString(!0)),t==="hex4"&&(n=this.toHex8String(!0)),t==="hex8"&&(n=this.toHex8String()),t==="name"&&(n=this.toName()),t==="hsl"&&(n=this.toHslString()),t==="hsv"&&(n=this.toHsvString()),n||this.toHexString())},clone:function(){return de(this.toString())},_applyModification:function(t,r){var n=t.apply(null,[this].concat([].slice.call(r)));return this._r=n._r,this._g=n._g,this._b=n._b,this.setAlpha(n._a),this},lighten:function(){return this._applyModification(oq,arguments)},brighten:function(){return this._applyModification(iq,arguments)},darken:function(){return this._applyModification(sq,arguments)},desaturate:function(){return this._applyModification(tq,arguments)},saturate:function(){return this._applyModification(rq,arguments)},greyscale:function(){return this._applyModification(nq,arguments)},spin:function(){return this._applyModification(aq,arguments)},_applyCombination:function(t,r){return t.apply(null,[this].concat([].slice.call(r)))},analogous:function(){return this._applyCombination(pq,arguments)},complement:function(){return this._applyCombination(lq,arguments)},monochromatic:function(){return this._applyCombination(uq,arguments)},splitcomplement:function(){return this._applyCombination(cq,arguments)},triad:function(){return this._applyCombination(gE,[3])},tetrad:function(){return this._applyCombination(gE,[4])}};de.fromRatio=function(e,t){if(ox(e)=="object"){var r={};for(var n in e)e.hasOwnProperty(n)&&(n==="a"?r[n]=e[n]:r[n]=ng(e[n]));e=r}return de(e,t)};function JJ(e){var t={r:0,g:0,b:0},r=1,n=null,o=null,i=null,s=!1,l=!1;return typeof e=="string"&&(e=gq(e)),ox(e)=="object"&&(Ga(e.r)&&Ga(e.g)&&Ga(e.b)?(t=qJ(e.r,e.g,e.b),s=!0,l=String(e.r).substr(-1)==="%"?"prgb":"rgb"):Ga(e.h)&&Ga(e.s)&&Ga(e.v)?(n=ng(e.s),o=ng(e.v),t=QJ(e.h,n,o),s=!0,l="hsv"):Ga(e.h)&&Ga(e.s)&&Ga(e.l)&&(n=ng(e.s),i=ng(e.l),t=KJ(e.h,n,i),s=!0,l="hsl"),e.hasOwnProperty("a")&&(r=e.a)),r=bE(r),{ok:s,format:e.format||l,r:Math.min(255,Math.max(t.r,0)),g:Math.min(255,Math.max(t.g,0)),b:Math.min(255,Math.max(t.b,0)),a:r}}function qJ(e,t,r){return{r:Kt(e,255)*255,g:Kt(t,255)*255,b:Kt(r,255)*255}}function dE(e,t,r){e=Kt(e,255),t=Kt(t,255),r=Kt(r,255);var n=Math.max(e,t,r),o=Math.min(e,t,r),i,s,l=(n+o)/2;if(n==o)i=s=0;else{var c=n-o;switch(s=l>.5?c/(2-n-o):c/(n+o),n){case e:i=(t-r)/c+(t<r?6:0);break;case t:i=(r-e)/c+2;break;case r:i=(e-t)/c+4;break}i/=6}return{h:i,s,l}}function KJ(e,t,r){var n,o,i;e=Kt(e,360),t=Kt(t,100),r=Kt(r,100);function s(p,d,m){return m<0&&(m+=1),m>1&&(m-=1),m<1/6?p+(d-p)*6*m:m<1/2?d:m<2/3?p+(d-p)*(2/3-m)*6:p}if(t===0)n=o=i=r;else{var l=r<.5?r*(1+t):r+t-r*t,c=2*r-l;n=s(c,l,e+1/3),o=s(c,l,e),i=s(c,l,e-1/3)}return{r:n*255,g:o*255,b:i*255}}function fE(e,t,r){e=Kt(e,255),t=Kt(t,255),r=Kt(r,255);var n=Math.max(e,t,r),o=Math.min(e,t,r),i,s,l=n,c=n-o;if(s=n===0?0:c/n,n==o)i=0;else{switch(n){case e:i=(t-r)/c+(t<r?6:0);break;case t:i=(r-e)/c+2;break;case r:i=(e-t)/c+4;break}i/=6}return{h:i,s,v:l}}function QJ(e,t,r){e=Kt(e,360)*6,t=Kt(t,100),r=Kt(r,100);var n=Math.floor(e),o=e-n,i=r*(1-t),s=r*(1-o*t),l=r*(1-(1-o)*t),c=n%6,p=[r,s,i,i,l,r][c],d=[l,r,r,s,i,i][c],m=[i,i,l,r,r,s][c];return{r:p*255,g:d*255,b:m*255}}function mE(e,t,r,n){var o=[Di(Math.round(e).toString(16)),Di(Math.round(t).toString(16)),Di(Math.round(r).toString(16))];return n&&o[0].charAt(0)==o[0].charAt(1)&&o[1].charAt(0)==o[1].charAt(1)&&o[2].charAt(0)==o[2].charAt(1)?o[0].charAt(0)+o[1].charAt(0)+o[2].charAt(0):o.join("")}function eq(e,t,r,n,o){var i=[Di(Math.round(e).toString(16)),Di(Math.round(t).toString(16)),Di(Math.round(r).toString(16)),Di(xE(n))];return o&&i[0].charAt(0)==i[0].charAt(1)&&i[1].charAt(0)==i[1].charAt(1)&&i[2].charAt(0)==i[2].charAt(1)&&i[3].charAt(0)==i[3].charAt(1)?i[0].charAt(0)+i[1].charAt(0)+i[2].charAt(0)+i[3].charAt(0):i.join("")}function hE(e,t,r,n){var o=[Di(xE(n)),Di(Math.round(e).toString(16)),Di(Math.round(t).toString(16)),Di(Math.round(r).toString(16))];return o.join("")}de.equals=function(e,t){return!e||!t?!1:de(e).toRgbString()==de(t).toRgbString()};de.random=function(){return de.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function tq(e,t){t=t===0?0:t||10;var r=de(e).toHsl();return r.s-=t/100,r.s=ix(r.s),de(r)}function rq(e,t){t=t===0?0:t||10;var r=de(e).toHsl();return r.s+=t/100,r.s=ix(r.s),de(r)}function nq(e){return de(e).desaturate(100)}function oq(e,t){t=t===0?0:t||10;var r=de(e).toHsl();return r.l+=t/100,r.l=ix(r.l),de(r)}function iq(e,t){t=t===0?0:t||10;var r=de(e).toRgb();return r.r=Math.max(0,Math.min(255,r.r-Math.round(255*-(t/100)))),r.g=Math.max(0,Math.min(255,r.g-Math.round(255*-(t/100)))),r.b=Math.max(0,Math.min(255,r.b-Math.round(255*-(t/100)))),de(r)}function sq(e,t){t=t===0?0:t||10;var r=de(e).toHsl();return r.l-=t/100,r.l=ix(r.l),de(r)}function aq(e,t){var r=de(e).toHsl(),n=(r.h+t)%360;return r.h=n<0?360+n:n,de(r)}function lq(e){var t=de(e).toHsl();return t.h=(t.h+180)%360,de(t)}function gE(e,t){if(isNaN(t)||t<=0)throw new Error("Argument to polyad must be a positive number");for(var r=de(e).toHsl(),n=[de(e)],o=360/t,i=1;i<t;i++)n.push(de({h:(r.h+i*o)%360,s:r.s,l:r.l}));return n}function cq(e){var t=de(e).toHsl(),r=t.h;return[de(e),de({h:(r+72)%360,s:t.s,l:t.l}),de({h:(r+216)%360,s:t.s,l:t.l})]}function pq(e,t,r){t=t||6,r=r||30;var n=de(e).toHsl(),o=360/r,i=[de(e)];for(n.h=(n.h-(o*t>>1)+720)%360;--t;)n.h=(n.h+o)%360,i.push(de(n));return i}function uq(e,t){t=t||6;for(var r=de(e).toHsv(),n=r.h,o=r.s,i=r.v,s=[],l=1/t;t--;)s.push(de({h:n,s:o,v:i})),i=(i+l)%1;return s}de.mix=function(e,t,r){r=r===0?0:r||50;var n=de(e).toRgb(),o=de(t).toRgb(),i=r/100,s={r:(o.r-n.r)*i+n.r,g:(o.g-n.g)*i+n.g,b:(o.b-n.b)*i+n.b,a:(o.a-n.a)*i+n.a};return de(s)};de.readability=function(e,t){var r=de(e),n=de(t);return(Math.max(r.getLuminance(),n.getLuminance())+.05)/(Math.min(r.getLuminance(),n.getLuminance())+.05)};de.isReadable=function(e,t,r){var n=de.readability(e,t),o,i;switch(i=!1,o=yq(r),o.level+o.size){case"AAsmall":case"AAAlarge":i=n>=4.5;break;case"AAlarge":i=n>=3;break;case"AAAsmall":i=n>=7;break}return i};de.mostReadable=function(e,t,r){var n=null,o=0,i,s,l,c;r=r||{},s=r.includeFallbackColors,l=r.level,c=r.size;for(var p=0;p<t.length;p++)i=de.readability(e,t[p]),i>o&&(o=i,n=de(t[p]));return de.isReadable(e,n,{level:l,size:c})||!s?n:(r.includeFallbackColors=!1,de.mostReadable(e,["#fff","#000"],r))};var dC=de.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},dq=de.hexNames=fq(dC);function fq(e){var t={};for(var r in e)e.hasOwnProperty(r)&&(t[e[r]]=r);return t}function bE(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function Kt(e,t){mq(e)&&(e="100%");var r=hq(e);return e=Math.min(t,Math.max(0,parseFloat(e))),r&&(e=parseInt(e*t,10)/100),Math.abs(e-t)<1e-6?1:e%t/parseFloat(t)}function ix(e){return Math.min(1,Math.max(0,e))}function yo(e){return parseInt(e,16)}function mq(e){return typeof e=="string"&&e.indexOf(".")!=-1&&parseFloat(e)===1}function hq(e){return typeof e=="string"&&e.indexOf("%")!=-1}function Di(e){return e.length==1?"0"+e:""+e}function ng(e){return e<=1&&(e=e*100+"%"),e}function xE(e){return Math.round(parseFloat(e)*255).toString(16)}function yE(e){return yo(e)/255}var Ei=function(){var e="[-\\+]?\\d+%?",t="[-\\+]?\\d*\\.\\d+%?",r="(?:"+t+")|(?:"+e+")",n="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?",o="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?";return{CSS_UNIT:new RegExp(r),rgb:new RegExp("rgb"+n),rgba:new RegExp("rgba"+o),hsl:new RegExp("hsl"+n),hsla:new RegExp("hsla"+o),hsv:new RegExp("hsv"+n),hsva:new RegExp("hsva"+o),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function Ga(e){return!!Ei.CSS_UNIT.exec(e)}function gq(e){e=e.replace(ZJ,"").replace(YJ,"").toLowerCase();var t=!1;if(dC[e])e=dC[e],t=!0;else if(e=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var r;return(r=Ei.rgb.exec(e))?{r:r[1],g:r[2],b:r[3]}:(r=Ei.rgba.exec(e))?{r:r[1],g:r[2],b:r[3],a:r[4]}:(r=Ei.hsl.exec(e))?{h:r[1],s:r[2],l:r[3]}:(r=Ei.hsla.exec(e))?{h:r[1],s:r[2],l:r[3],a:r[4]}:(r=Ei.hsv.exec(e))?{h:r[1],s:r[2],v:r[3]}:(r=Ei.hsva.exec(e))?{h:r[1],s:r[2],v:r[3],a:r[4]}:(r=Ei.hex8.exec(e))?{r:yo(r[1]),g:yo(r[2]),b:yo(r[3]),a:yE(r[4]),format:t?"name":"hex8"}:(r=Ei.hex6.exec(e))?{r:yo(r[1]),g:yo(r[2]),b:yo(r[3]),format:t?"name":"hex"}:(r=Ei.hex4.exec(e))?{r:yo(r[1]+""+r[1]),g:yo(r[2]+""+r[2]),b:yo(r[3]+""+r[3]),a:yE(r[4]+""+r[4]),format:t?"name":"hex8"}:(r=Ei.hex3.exec(e))?{r:yo(r[1]+""+r[1]),g:yo(r[2]+""+r[2]),b:yo(r[3]+""+r[3]),format:t?"name":"hex"}:!1}function yq(e){var t,r;return e=e||{level:"AA",size:"small"},t=(e.level||"AA").toUpperCase(),r=(e.size||"small").toLowerCase(),t!=="AA"&&t!=="AAA"&&(t="AA"),r!=="small"&&r!=="large"&&(r="small"),{level:t,size:r}}var sx=_.object({margin:_.number().min(6).default(6),maxLines:_.number().min(1).default(2),textSize:_.number().min(0).default(11.5),maxWidth:_.number().min(0).default(150),lineHeight:_.number().min(0).default(1.2),color:_.string().default("#333"),outlineColor:_.string().default("white"),textColor:_.string().optional(),textOutlineColor:_.string().optional(),pinColor:_.string().optional(),pinOutlineColor:_.string().optional(),pinColorInactive:_.string().optional(),pinOutlineColorInactive:_.string().optional(),icon:_.string().optional(),iconSize:_.number().min(0).default(20),iconScale:_.union([_.number(),uE]).default(1),iconPadding:_.number().min(0).default(2),iconFit:_.enum(["fill","contain","cover"]).default("cover"),iconOverflow:_.enum(["visible","hidden"]).default("hidden"),iconVisibleAtZoomLevel:_.number().default(-1/0)}),vE=sx.transform(e=>({...e,textColor:e.textColor??e.color,textOutlineColor:e.textOutlineColor??e.outlineColor,pinColor:e.pinColor??e.color,pinOutlineColor:e.pinOutlineColor??e.outlineColor,pinColorInactive:e.pinColorInactive??de(e.pinColor??e.color).setAlpha(.5).toRgbString(),pinOutlineColorInactive:e.pinOutlineColorInactive??de(e.pinOutlineColor??e.outlineColor).setAlpha(.5).toRgbString()})),kDe=sx.strict(),ax=e=>vE.parse(e),bq=_.object({rank:bf.optional(),appearance:vE.optional(),interactive:_.boolean().default(!1)}),fC=e=>{bq.parse(e??{})},IE=(e,t,r)=>{_.array(_.number()).min(2).max(3).parse(e),_.string().parse(t),fC(r)},SE=["color","outlineColor","margin"],xq=[...SE,"maxLines","lineHeight","textSize","maxWidth","textColor","textOutlineColor"],vq=[...SE,"icon","pinColor","pinOutlineColor","pinColorInactive","pinOutlineColorInactive"],CE=(e,t)=>xq.some(r=>t[r]!=null&&e[r]!==t[r]),TE=(e,t)=>vq.some(r=>t[r]!=null&&e[r]!==t[r]);var Cq="LOW_PRIORITY",ME=4,Tq=6,PE=6.5,Mq={heightAbovePolygon:0},_f=class _f{constructor(t,r,n){f(this,"lines",0);f(this,"id");f(this,"rank");f(this,"type","label");f(this,"initialRank");f(this,"contextConfigured",!1);f(this,"fillText");f(this,"newStyle",{});f(this,"opacity",0);f(this,"visibilityNeedsUpdate",!1);f(this,"text");f(this,"style",{top:0,left:0,textLabelVisible:!0,pinVisibility:1,textAlign:"left"});f(this,"projection",new De);f(this,"labelCacheId");f(this,"_cache",{});f(this,"appearance");f(this,"options");f(this,"visible",!0);f(this,"enabled",!0);f(this,"isOccluded",!1);f(this,"offscreen",!1);f(this,"canShow",!1);f(this,"activeBoundingBox",{x:0,y:0,w:0,h:0});f(this,"dimensions",{width:0,height:0});f(this,"currentStrategyIndex",-1);f(this,"totalMarkerSize",0);f(this,"iconScale",1);f(this,"iconPadding");f(this,"dirty",!0);f(this,"textDirty",!0);f(this,"markerDirty",!0);f(this,"attachedDirty",!0);f(this,"collisionDirty",!0);f(this,"lastTextAlign");f(this,"imageHash");f(this,"markerSize",0);f(this,"iconVisible",!1);f(this,"dp");f(this,"animate",!0);f(this,"onStrategySelected",t=>{if(this.currentStrategyIndex===t)return;this.currentStrategyIndex=t;let r=this.strategies[this.currentStrategyIndex];if(r){r.onStrategySelected();let n=this.style;this.style=this.newStyle,this.newStyle=n}});f(this,"packedMessage",{x:0,y:0,enabled:!1,rank:0,bboxes:[],shouldCollideWithScreenEdges:!1,lockedToStrategyIndex:-1});if(this.id=r.id??dt(),this.options=(0,wE.default)({},r,Mq),this.text=t,this.dp=(i=1)=>i*n.pixelRatio,typeof r.rank=="string")this.rank=xf(r.rank),this.initialRank=this.rank;else if(r.rank!=null&&r.rank>0)this.rank=r.rank,this.initialRank=r.rank;else{let i=Math.trunc(y.env.NODE_ENV==="test"?_f.testId:_f.testId*10)/10;_f.testId+=.001,this.rank=i,this.initialRank=i}let o=ax(r.appearance??{});this.appearance=o,this.iconPadding=o.iconPadding}get scaledMarkerSize(){return this.totalMarkerSize*this.iconScale}get scaledIconPadding(){return this.appearance.iconPadding*this.iconScale}setEntity(){}calculateMarkerSize(){let t=this.dp();this.iconVisible&&typeof this.appearance.iconSize<"u"&&this.imageHash?this.markerSize=this.dp(this.appearance.iconSize):this.markerSize=this.dp(PE),this.totalMarkerSize=Math.ceil((this.markerSize+2.5)/t)}get lowPriorityStrategyIndex(){return this.text===""?-1:3}get strategies(){let{width:t,height:r}=this.dimensions,{margin:n}=this.appearance,o=Math.max(Tq,n),i=this.iconVisible?o/2:0,s=this.iconVisible?this.scaledMarkerSize:PE/2,l=[{name:"RIGHT",getBoundingBox:()=>{let c=Math.max(this.scaledMarkerSize,r);return[c/2+o,c/2+o,this.scaledMarkerSize/2+o,this.scaledMarkerSize/2+t+o]},onStrategySelected:()=>{this.newStyle.textAlign="left",this.newStyle.pinVisibility=1,this.newStyle.top=-r/2,this.newStyle.left=this.scaledMarkerSize/2+ME,this.newStyle.textLabelVisible=!0}},{name:"LEFT",getBoundingBox:()=>{let c=Math.max(this.scaledMarkerSize,r);return[c/2+o,c/2+o,this.scaledMarkerSize/2+t+o,this.scaledMarkerSize/2+o]},onStrategySelected:()=>{this.newStyle.textAlign="right",this.newStyle.pinVisibility=1,this.newStyle.top=-r/2,this.newStyle.left=-t-this.scaledMarkerSize/2-ME,this.newStyle.textLabelVisible=!0}},{name:"TOP",getBoundingBox:()=>{let c=this.dp();return[r+this.scaledMarkerSize/2/c+o,this.scaledMarkerSize/2+o,t/2+o,t/2+o]},onStrategySelected:()=>{this.newStyle.pinVisibility=1,this.newStyle.textAlign="center",this.newStyle.textLabelVisible=!0,this.newStyle.top=-r-this.scaledMarkerSize/2,this.newStyle.left=-t/2}},{name:Cq,getBoundingBox:()=>[s+i,s+i,s+i,s+i],onStrategySelected:()=>{this.newStyle.pinVisibility=.5,this.newStyle.textLabelVisible=!1,this.newStyle.top=0,this.newStyle.left=0}}];return this.text===""?[{name:"ICON_ONLY",getBoundingBox:()=>[this.scaledMarkerSize/2+o,this.scaledMarkerSize/2+o,this.scaledMarkerSize/2+o,this.scaledMarkerSize/2+o],onStrategySelected:()=>{this.newStyle.pinVisibility=1,this.newStyle.textLabelVisible=!1,this.newStyle.top=0,this.newStyle.left=0}}]:l}recomputeCurrentStrategy(t=this.iconScale){if(this.iconScale!==t||this.dirty){let r=this.strategies[this.currentStrategyIndex];if(this.iconScale=t,this.collisionDirty=!0,r){r.onStrategySelected(t);let n=this.style;this.style=this.newStyle,this.newStyle=n}this.dirty=!1}}updatePosition(){}disable(){this.visible=!1}toPackedMessage(t=!1){if(this.visible&&t&&this.collisionDirty===!1&&this.currentStrategyIndex!=null&&this.currentStrategyIndex!==-1&&this.currentStrategyIndex!==this.lowPriorityStrategyIndex?this.packedMessage.lockedToStrategyIndex=this.currentStrategyIndex:this.packedMessage.lockedToStrategyIndex=-1,this.packedMessage.x=this.projection.x,this.packedMessage.y=this.projection.y,this.packedMessage.enabled=this.enabled,this.packedMessage.rank=this.rank,this.currentStrategyIndex!==-1&&this.currentStrategyIndex!==this.lowPriorityStrategyIndex&&this.currentStrategyIndex!==this.packedMessage.bboxes[0]?.[4]){let r=this.packedMessage.bboxes.findIndex(n=>n[4]===this.currentStrategyIndex);if(r!==-1){let n=this.packedMessage.bboxes.splice(r,1)[0];this.packedMessage.bboxes.unshift(n)}}if(!this.collisionDirty)return this.packedMessage;this.packedMessage.bboxes=[];for(let r=0;r<this.strategies.length;r++){let n=this.strategies[r];r===this.currentStrategyIndex&&this.currentStrategyIndex!==-1&&this.currentStrategyIndex!==this.lowPriorityStrategyIndex?this.packedMessage.bboxes.unshift([...n.getBoundingBox(),r]):this.packedMessage.bboxes.push([...n.getBoundingBox(),r])}return this.packedMessage.shouldCollideWithScreenEdges=!1,this.collisionDirty=!1,this.packedMessage}destroy(){}};f(_f,"testId",0);var mC=_f,Os=mC;u();u();var lx=class extends Fe{constructor(r,n,o=!0){super();f(this,"rendererState");f(this,"convertTo3DMapPosition");f(this,"textSet",new Set);f(this,"batchedTextMap",new Map);f(this,"useWorker",!0);f(this,"debugTextAreaMesh",new Map);o===!1&&(this.useWorker=!1,cx(!1)),this.rendererState=r,this.convertTo3DMapPosition=n}remove(r){this.textSet.delete(r)}update(r){let n,o,i,s=[];for(let l of this.rendererState.geometry3DIdsInScene)if(n=this.rendererState.geometry3DMap.get(l),n?.type==="text3d"){o=n.components[0],i=n.components[1];let c=o.mesh?.parent;if(!c||!(c instanceof kt)||!(o instanceof Wl))continue;if("textArea"in o.feature.properties&&o.mesh!=null&&o.polygonEntityId!=null&&o.textMesh==null&&o.mesh.parent!=null&&o.feature.properties?.textArea?.position!=null){if(this.textSet.has(o.polygonEntityId))continue;this.textSet.add(o.polygonEntityId),this.batchedTextMap.has(c)||this.batchedTextMap.set(c,Ef().then(({BatchedText:m})=>{let g=new m;return g.type="batchedtext",c.add(g),g}));let d=this.batchedTextMap.get(c);if(!d)throw new Error("batched text required");s.push(OE({entityId:l,textComponent:o,styleComponent:i,convertTo3DMapPosition:this.convertTo3DMapPosition,batchedMeshPromise:d,rendererState:this.rendererState,type:"text-area"}).then(()=>{this.publish("render")}))}else if(o.mesh!=null&&o.textMesh==null&&o.mesh.parent!=null){if(this.textSet.has(l.toString()))continue;this.textSet.add(l.toString()),this.batchedTextMap.has(c)||this.batchedTextMap.set(c,Ef().then(({BatchedText:m})=>{let g=new m;return g.type="batchedtext",c.add(g),g}));let d=this.batchedTextMap.get(c);if(!d)throw new Error("batched text required");s.push(OE({entityId:l,textComponent:o,styleComponent:i,convertTo3DMapPosition:this.convertTo3DMapPosition,batchedMeshPromise:d,rendererState:this.rendererState,type:"point"}).then(()=>{this.publish("render")}))}let p=this.batchedTextMap.get(c);o.textMesh&&p&&o.polygonEntityId!=null&&Promise.all([p,Promise.resolve({meshComponent:o,styleComponent:i})]).then(([d,{meshComponent:m,styleComponent:g}])=>{let{textMesh:x}=m;if(d&&x){let v=bC(d,x);m.visible&&!v?d.add(x):!m.visible&&v&&d.remove(x)}g.flipToFaceCamera&&this.flipIfNeeded(m,r)})}return Promise.all(s)}flipIfNeeded(r,n){let o=r.textMesh;if(!o)return!1;let i=o.rotation.z,s=s2(i+n);s>Math.PI/2&&s<3*Math.PI/2&&(o.rotation.z=s2(i+Math.PI))}showTextAreaMesh(){let r,n;for(let o of this.rendererState.geometry3DIdsInScene)if(r=this.rendererState.geometry3DMap.get(o),r?.type==="text3d"&&(n=r.components[0],"textArea"in n.feature.properties)){let i=n.feature.properties.textArea;if(!i)continue;let s=new si(i.maxWidth,i.maxHeight),l=new Re(s,new Tr({color:"pink"})),{textMesh:c}=n;if(!c)continue;let p=this.convertTo3DMapPosition(i.position,og);l.position.copy(p),l.position.z=c.position.z-.1,l.rotation.z=c.rotation.z,gC.identity(),gC.makeRotationAxis(new ue(0,0,1),c.userData.rotationZ),og.set(i.maxWidth/2,0,0),og.applyMatrix4(gC),l.position.x-=og.x,l.position.y-=og.y,this.rendererState.entityScene.add(l),this.debugTextAreaMesh.set(o,l)}this.publish("render")}hideTextAreaMesh(){this.debugTextAreaMesh.forEach(r=>{this.rendererState.entityScene.remove(r)}),this.debugTextAreaMesh.clear(),this.publish("render")}};function cx(e){Ef().then(({configureTroikaTextBuilder:t})=>{t({useWorker:e})})}var gC=new to,og=new ue,yC;async function _E(e){let{preloadFont:t}=await Ef();return t(e)}function Ef(){return yC||(yC=import("./text3d-OX5R3UZU.js").then(e=>e)),yC}async function OE({entityId:e,textComponent:t,styleComponent:r,convertTo3DMapPosition:n,batchedMeshPromise:o,rendererState:i,type:s="text-area"}){return Promise.all([Ef(),Promise.resolve({entityId:e,meshComponent:t,styleComponent:r})]).then(([{createTroikaTextPoint:l,createTroikaTextArea:c},p])=>s==="text-area"?c(p.entityId,p.meshComponent,p.styleComponent,n):l(p.entityId,p.meshComponent,p.styleComponent,n)).catch(l=>{A.warn("Trouble creating text: ",l)}).then(l=>{if(!l?.text)return;let c=[Promise.resolve(l.text),o,Promise.resolve()];if(t.polygonEntityId){let p=i.geometry3DMap.get(t.polygonEntityId);if(p?.type==="geometry"){let d=p.components[0],m=p.components[1];d.textMesh=l.text,l.text.position.z=m.altitude+m.height+Pq}}else c[2]=Ef().then(({syncText:p})=>p(l.text));return Promise.all(c)}).then(l=>{if(!l)return;let[c,p]=l;p.add(c),t.batchedText||(t.batchedText=p)})}function bC(e,t){return e._members.has(t)}var Pq=.5;var xC=_.object({visible:_.boolean(),color:_.string(),flipToFaceCamera:_.boolean(),font:_.string().optional(),fontSize:_.number(),margin:_.union([_.number(),_.tuple([_.number(),_.number(),_.number(),_.number()])]),outlineColor:_.string(),outlineOpacity:_.number(),outlineBlur:_.union([_.number(),_.string()]),outlineWidth:_.number(),outlineOffsetX:_.number(),outlineOffsetY:_.number(),strokeWidth:_.number(),maxWidth:_.number().optional(),maxHeight:_.number().optional(),strokeOpacity:_.number(),strokeColor:_.string(),fillOpacity:_.number(),hoverColor:_.string().optional(),id:_.union([_.string(),_.number()]),type:_.literal("text3d"),position:_.tuple([_.number(),_.number(),_.number()]),content:_.string()}),EE=xC.partial().omit({id:!0,type:!0}).strict(),px=EE.omit({margin:!0,position:!0,maxWidth:!0,maxHeight:!0,content:!0}).strict(),DE=_.object({appearance:EE.optional(),parentId:_.string().optional()}).strict(),Wl=class{constructor(t){f(this,"mesh",new ai);f(this,"textMesh");f(this,"type","text3d");f(this,"feature");f(this,"parent");f(this,"batchedText");f(this,"polygonEntityId");this.feature=t}get visible(){return this.batchedText&&this.textMesh?bC(this.batchedText,this.textMesh):this.textMesh?this.textMesh.visible:!1}set visible(t){this.batchedText&&this.textMesh?t?this.batchedText.addText(this.textMesh):this.batchedText.removeText(this.textMesh):this.textMesh&&(this.textMesh.visible=t),this.mesh.visible=t}};u();var Df,Ff=class{constructor(t){f(this,"color");f(this,"dirty",!0);f(this,"enabled",!0);T(this,Df,!1);f(this,"edgeColors");f(this,"edgeVisibility");f(this,"geometry");f(this,"ranges");f(this,"topFaceVerticesIndices");this.color=t}get currentOpacity(){return this.edgeColors&&this.ranges?this.edgeColors.array[this.ranges.start*4+3]:0}set visible(t){if(!this.edgeVisibility||!this.ranges||a(this,Df)===t)return;w(this,Df,t);let r=this.edgeVisibility.array,n=t?1:0;for(let o=0;o<this.ranges.count;o++){let i=this.ranges.start+o;r[i]=n}this.edgeVisibility.needsUpdate=!0}get visible(){return a(this,Df)}get currentColor(){return this.edgeColors&&this.ranges?[this.edgeColors.array[this.ranges.start*4],this.edgeColors.array[this.ranges.start*4+1],this.edgeColors.array[this.ranges.start*4+2]]:[0,0,0]}};Df=new WeakMap;u();u();u();var ux=class extends JT{constructor(r){let n=r,o=3,i=o*4;super(new Uint8Array(r*i),o,r,tb,eb);f(this,"_width");f(this,"_height");f(this,"_propertiesLength");this._width=i,this._height=n,this._propertiesLength=o}setColor(r,n,o){let i=this.image.data,s=r*this._width;i[s]=Math.round(n.r*255),i[s+1]=Math.round(n.g*255),i[s+2]=Math.round(n.b*255),i[s+3]=0,i[s+4]=Math.round(o.r*255),i[s+5]=Math.round(o.g*255),i[s+6]=Math.round(o.b*255),i[s+7]=0,this.needsUpdate=!0}getColor(r){let n=this.image.data,o=r*this._width,i=new Nt(n[o]/255,n[o+1]/255,n[o+2]/255),s=new Nt(n[o+4]/255,n[o+5]/255,n[o+6]/255);return{color:i,topColor:s}}setTexture(r,n,o){let i=this.image.data,s=r*this._width;i[s+8]=n?255:0,i[s+9]=o?255:0,i[s+10]=0,i[s+11]=0,this.needsUpdate=!0}getTexture(r){let n=this.image.data,o=r*this._width,i=n[o+8]===255,s=n[o+9]===255;return{texture:i,topTexture:s}}};u();var FE=`#define LAMBERT
|
|
13
13
|
varying vec3 vViewPosition;
|
|
14
14
|
varying vec4 vPosition;
|
|
15
15
|
varying vec2 vUv;
|
|
@@ -199,7 +199,7 @@ void main() {
|
|
|
199
199
|
#include <dithering_fragment>
|
|
200
200
|
|
|
201
201
|
}
|
|
202
|
-
`;var wq=-.05,Oq=1,kp=class extends xo{constructor(r,n,o=1){super(r);f(this,"propertiesTexture");f(this,"uniforms",{uGradientIntensity:{value:0},uGradientEnd:{value:0},uGradientStart:{value:0},uTopTexture:{value:null},uTexture:{value:null},uRepeatYFactor:{value:1},uBlendTexture:{value:!1}});f(this,"colorSpace",mc);f(this,"showTextures",r=>{let n=!!this.uniforms.uTexture.value,o=!!this.uniforms.uTopTexture.value;(n||o)&&(this.propertiesTexture.setTexture(r,n,o),this.needsUpdate=!0)});this.alphaTest=.01,this.propertiesTexture=new ux(n),this.uniforms.uRepeatYFactor.value=o,this.onBeforeCompile=i=>{let s=this.uniforms.uGradientIntensity,l=this.uniforms.uGradientEnd,c=this.uniforms.uGradientStart,p=this.uniforms.uTopTexture,d=this.uniforms.uTexture,m=this.uniforms.uRepeatYFactor,g=this.uniforms.uBlendTexture;this.uniforms=i.uniforms,i.vertexShader=FE,i.fragmentShader=kE,Object.assign(this.uniforms,{uGradientIntensity:s,uGradientEnd:l,uGradientStart:c,uMinSideAlpha:{value:wq},uMaxSideAlpha:{value:Oq},uPropertiesTexture:{value:this.propertiesTexture},uTopTexture:p,uTexture:d,uRepeatYFactor:m,uBlendTexture:g})}}get repeatYFactor(){return this.uniforms.uRepeatYFactor.value}set repeatYFactor(r){r!==this.uniforms.uRepeatYFactor.value&&(this.uniforms.uRepeatYFactor.value=r,this.needsUpdate=!0)}get texture(){return this.uniforms.uTexture.value}set texture(r){r.wrapS=$i,r.wrapT=$i,r.colorSpace=this.colorSpace,this.uniforms.uTexture.value=r}get topTexture(){return this.uniforms.uTopTexture.value}set topTexture(r){r.wrapS=$i,r.wrapT=$i,r.colorSpace=this.colorSpace,this.uniforms.uTopTexture.value=r}get blendTexture(){return this.uniforms.uBlendTexture.value}set blendTexture(r){r!==this.uniforms.uBlendTexture.value&&(this.uniforms.uBlendTexture.value=r,this.colorSpace=r?UT:mc,this.texture&&(this.texture.colorSpace=this.colorSpace),this.topTexture&&(this.topTexture.colorSpace=this.colorSpace),this.needsUpdate=!0)}setGradientShading(r,n,o){this.uniforms.uGradientStart.value=r,this.uniforms.uGradientEnd.value=n,this.uniforms.uGradientIntensity.value=o}getGradientShading(){return{start:this.uniforms.uGradientStart.value,end:this.uniforms.uGradientEnd.value,intensity:this.uniforms.uGradientIntensity.value}}setColor(r,n,o){this.propertiesTexture.setColor(r,n,o)}getColor(r){return this.propertiesTexture.getColor(r)}hideTextures(r){let n=!!this.uniforms.uTexture.value,o=!!this.uniforms.uTopTexture.value;(n||o)&&(this.propertiesTexture.setTexture(r,!1,!1),this.needsUpdate=!0)}removeSideTexture(r){if(this.texture){this.texture.dispose(),this.uniforms.uTexture.value=null;let n=!!this.uniforms.uTopTexture.value;this.propertiesTexture.setTexture(r,!1,n),this.needsUpdate=!0}}removeTopTexture(r){if(this.topTexture){this.topTexture.dispose(),this.uniforms.uTopTexture.value=null;let n=!!this.uniforms.uTexture.value;this.propertiesTexture.setTexture(r,n,!1),this.needsUpdate=!0}}dispose(){super.dispose(),this.propertiesTexture.dispose()}};u();function AE(e,t){let r=0;for(let p of e)r+=p.components[0]?.geometry?.attributes.position.count||0;let n=new Nt(t.color),o;o=new kp({color:n,side:t.side==="back"?ym:t.side==="front"?fc:ni,opacity:t.opacity??1,transparent:t.opacity!==void 0?t.opacity<1:!1,polygonOffset:!0,polygonOffsetFactor:1,polygonOffsetUnits:1},e.length);let i=new fb(e.length,r,0,o);i.renderOrder=0;let s,l,c;for(let p of e)s=p.components[0],!(!(s instanceof or)||!s.geometry)&&(s.mesh=i,s.material=o,s.instanceIndex=i.addGeometry(s.geometry),i.addInstance(s.instanceIndex),i.userData.entities[s.instanceIndex]=p.id,o instanceof kp&&o.setColor(s.instanceIndex,n,t.topColor?new Nt(t.topColor):n),l=i.getGeometryIdAt(s.instanceIndex),s.batchedProps&&(c=i.getGeometryRangeAt(l),c&&(s.batchedProps.range=c),s.batchedProps.geometryId=l));return i.perObjectFrustumCulled=!0,i.matrixAutoUpdate=!1,i}function ig(e){return de(e).darken(30).toRgbString()}function LE(e,t,r,n){if(t.length<1)return;e.boundingBox||e.computeBoundingBox();let o=e.boundingBox,i=e.getAttribute("position"),s=e.getAttribute("normal"),l=e.getAttribute("uv"),c,p;e.index?(c=e.index.count/3,p=function(O,M){return e.index.getX(O*3+M)}):(c=i.count/3,p=function(O,M){return O*3+M});let d=new to;d.makeRotationFromQuaternion(new hc().setFromEuler(new Xs(0,0,r/180*Math.PI)));let m=t.find(O=>O.face==="top"),g;m&&(g={min:n(m.bounds[1],m.bounds[0],0),max:n(m.bounds[3],m.bounds[2],o.max.z)});let x=t.find(O=>O.face==="side"),v;if(x&&(v={min:n(x.bounds[1],x.bounds[0],0),max:n(x.bounds[3],x.bounds[2],o.max.z)}),!(!v&&!g))for(let O=0;O<c;++O){let M=s.getX(p(O,0))+s.getX(p(O,1))+s.getX(p(O,2)),E=s.getY(p(O,0))+s.getY(p(O,1))+s.getY(p(O,2)),B=s.getZ(p(O,0))+s.getZ(p(O,1))+s.getZ(p(O,2)),j=Math.abs(M),L=Math.abs(E),N=Math.abs(B);var C,I;j<=L&&j<=N?(C="x",L<=N?I="y":I="z"):L<=j&&L<=N?(C="y",j<=N?I="x":I="z"):(C="z",j<=L?I="x":I="y"),C==="z"&&(C=I,I="z");let X,Z,re,Q,xe,Ce;if(I==="z"||C==="z"){if(!x||!v)continue;X=x.repeat.u,Z=x.repeat.v,re=x.offset.u,Q=x.offset.v,xe=x.rotation,Ce=v}else{if(!m||!g)continue;X=m.repeat.u,Z=m.repeat.v,re=m.offset.u,Q=m.offset.v,xe=(360-r+m.rotation)%360,Ce=g}let{min:ye,max:Ee}=Ce,we=new oi;we.position.set(ye.x,ye.y,0),we.updateMatrix(),we.updateMatrixWorld();let pe=ye.clone().applyMatrix4(d),Ae=Ee.clone().applyMatrix4(d),mt=Math.abs(Ae.x-pe.x),Je=Math.abs(Ae.y-pe.y),ut=new ue(mt,Je,Ee.z).applyMatrix4(we.matrixWorld),qe=Math.abs(ut[C]-ye[C]),Te=Math.abs(ut[I]-ye[I]),xt=xe*Math.PI/180||0,Pt=Math.cos(xt),nr=Math.sin(xt),k=we.matrixWorld.clone().invert(),W=new hc().setFromEuler(new Xs(0,0,r/180*Math.PI));for(let D=0;D<3;D++){let K=new ue(i.getX(p(O,D)),i.getY(p(O,D)),i.getZ(p(O,D))).applyMatrix4(k);K.applyQuaternion(W);let ee=K.applyMatrix4(we.matrixWorld),Le=ee.x,Ft=ee.y,In=ee.z;var S,P;C==="x"?S=X*(Le-ye[C])/qe+re:C==="y"?S=X*(Ft-ye[C])/qe+re:S=X*(In-ye[C])/qe+re,I==="x"?P=Z*(Le-ye[I])/Te+Q:I==="y"?P=Z*(Ft-ye[I])/Te+Q:P=Z*(In-ye[I])/Te+Q,S-=.5,P-=.5;let Yr=S*Pt-P*nr+.5,pn=S*nr+P*Pt+.5;l.setX(p(O,D),Yr),l.setY(p(O,D),pn)}}}u();var ja=class{constructor(){f(this,"focusMesh");f(this,"dirty",!0)}};function $r(e,t,r){if(t!==void 0){if(e.type==="model"||e.type==="path"||e.type==="marker"||e.type==="label"||e.type==="geometry"||e.type==="group-container"||e.type==="custom-geometry")return t===!0?(e instanceof xc&&e.components[1]===void 0?(e.components[1]=new Mf,e.components[1].dirty=!0):e instanceof Ke&&e.components[2]===void 0?(e.components[2]=new Mf,e.components[2].dirty=!0):e instanceof kt&&e.components[0]===void 0&&(e.components[0]=new Mf,e.components[0].dirty=!0),!0):(e instanceof xc?e.components[1]=void 0:e instanceof Ke?e.components[2]=void 0:e instanceof kt&&(e.components[0]=void 0),!0);if(e.type==="geometry-group"){let n;for(let o of e.userData.entities3D.values())n=r.geometry3DMap.get(o),$r(n,t,r);return!0}}return!1}function RE(e,t,r){if(!(!r?.color&&!("topColor"in r))){if(r!==void 0&&e.type==="geometry-group"){let n;for(let o of e.userData.entities3D.values())n=t.geometry3DMap.get(o),n&&fx(n,r);return!0}return!1}}function Dq(e,t){t!==void 0&&e.type==="geometry"&&(e.components[1].shading=t,e.components[1].dirty=!0)}function BE(e,t,r){if(r!==void 0&&e.type==="geometry-group"){for(let n of e.userData.entities3D.values()){let o=t.geometry3DMap.get(n);o&&Dq(o,r)}return!0}return!1}function NE(e,t){t!==void 0&&e.type==="geometry"&&(t.showImage!==void 0&&(e.components[1].showImage=t.showImage),t.flipImageToFaceCamera!==void 0&&(e.components[1].flipImageToFaceCamera=t.flipImageToFaceCamera))}function dx(e,t,r){if(r!==void 0){if(e.type==="geometry"){let n=e.components[1];if(n.height!==r)return n.height=r,n.dirty=!0,e.components[3]&&(e.components[3].dirty=!0),!0}else if(e.type==="geometry-group"){for(let n of e.userData.entities3D.values()){let o=t.geometry3DMap.get(n);(o?.type==="geometry"||o?.type==="model")&&dx(o,t,r)}return!0}}return!1}function fx(e,t){if(t!==void 0){let r=!1;(e.type==="path"||e.type==="geometry")&&(t.initialColor!==void 0&&t.initialColor!==e.components[1].initialColor&&(e.components[1].initialColor=t.initialColor,r=!0),t.color!==void 0&&t.color!==e.components[1].color&&(e.components[1].color=t.color,r=!0,e.components[3]&&(e.components[3].color=ig(t.color),e.components[3].dirty=!0)),"topColor"in t&&(e.components[1].topColor=t.topColor,r=!0),r&&(e.components[1].dirty=!0))}}function vC(e,t,r){t!==void 0&&(e.type==="label"||e.type==="marker"?e.updatePosition(r(t[1],t[0],t[2]||0)):e.type==="custom-geometry"&&e.components[0].position.copy(r(t[1],t[0],t[2]||0)))}function IC(e,t){return t!==void 0&&(e.type==="marker"||e.type==="label"||e.type==="custom-geometry")&&e.parentObject3D!==t&&e.parentObject3D instanceof kt?(e.parentObject3D?.removeEntity(e),t.addEntity(e),!0):!1}function GE(e,t){t!==void 0&&(e.type==="marker"||e.type==="label")&&e.components[0].enabled!==t&&(e.components[0].enabled=t)}function jE(e,t,r){if(t!==void 0&&e.type==="marker"){let n=e.components[0];if(t.contentHTML!==void 0)return n.containerEl.innerHTML=t.contentHTML,n.contentHtml=t.contentHTML,!0;if(t.placement!==void 0&&(n.options.placement=t.placement,n.collisionDirty=!0),t.dynamicResize!==void 0)return n.options.dynamicResize=t.dynamicResize,!0;if(t.options!=null){try{Q3.parse(t.options||{})}catch(o){return A.error(o),!1}return t.options.interactive!=null&&(t.options.interactive==="pointer-events-auto"?(n.pointerEvents="auto",$r(e,!1,r)):(n.pointerEvents="none",$r(e,t.options.interactive,r))),UE(e,t.options.rank),!0}}return!1}function UE(e,t){return t!==void 0&&(e.type==="marker"||e.type==="label")?(e.components[0].rank=xf(t),!0):!1}function VE(e,t,r){if(t!==void 0&&e.type==="label"){let n=e.components[0];t.text!==void 0&&t.text!==n.text&&(n.text=t.text,n.textDirty=!0);try{fC(t.options??{})}catch(o){A.error(o);return}CE(n.appearance,t.options?.appearance||{})&&(n.textDirty=!0),TE(n.appearance,t.options?.appearance||{})&&(n.markerDirty=!0),F5(n.appearance,t.options?.appearance||{}),$r(e,t.options?.interactive,r),UE(e,t.options?.rank)}}function HE(e,t){t!==void 0&&e.type==="geometry"&&(e.components[1].hoverColor=t,e.components[1].dirty=!0)}function WE(e,t){if(t!==void 0){let r=e.components[2];if(e.type==="geometry"&&r!=null)return r.hover=t,r.dirty=!0,!0}return!1}function SC(e,t){t!==void 0&&e.type==="image"&&(e.components[1].flipImageToFaceCamera=t)}function _s(e,t,r){if(r!==void 0)if(e.type==="model"||e.type==="path"||e.type==="geometry"||e.type==="custom-geometry"||e.type==="image"||e.type==="text3d"){r!==e.components[1].visible&&(e.components[1].visible=r,e.components[1].dirty=!0);let n=e.components[3];return n&&(n.dirty=!0),!0}else{if(e.type==="geometry-group")return e.setVisible(r),!0;if(e.type==="group-container"){if(e.visible!==r)return e.setVisible(r),r===!1&&e.traverse(n=>{if(n instanceof S5){let o=t.geometry2DMap.get(n.userData.entityId);if(o){let i=o.components[0];i instanceof Os&&(i.canShow=r)}}}),!0}else if(e.type==="label")return e.components[0].visible=r,!0}return!1}function sg(e,t,r){if(r!==void 0)if(e.type==="geometry-group"){for(let n of e.userData.entities3D.values()){let o=t.geometry3DMap.get(n);(o?.type==="geometry"||o?.type==="model")&&sg(o,t,r)}return!0}else if(e.type==="group-container"){if(e.opacity!==r){e.setOpacity(r);let n=1;return e.parent instanceof kt&&(n=e.parent.opacity),$E(e,t,n),!0}}else e instanceof Ke&&e.components[1].opacity!==r&&(e.components[1].opacity=r,e.components[1].dirty=!0);return!1}function $E(e,t,r=1){if(e.type==="group-container"&&"children"in e&&e.children.length>0){let n=r*e.opacity;e.userData.computedOpacity=n;for(let o of e.children)(o instanceof ro&&o.type==="geometry-group"||o instanceof kt&&o.type==="group-container")&&$E(o,t,n)}else if(e.type==="geometry-group")for(let n of e.userData.entities3D.values()){let o=t.geometry3DMap.get(n),i;(o?.type==="geometry"||o?.type==="model")&&(i=o.components[1],i.dirty=!0)}}function zE(e,t,r){if(r!==void 0&&e.type==="geometry-group")for(let n of e.userData.entities3D.values()){let o=t.geometry3DMap.get(n);o&&CC(o,r)}}function CC(e,t){if(e.type==="geometry"){let r=!1,n=e.components[1];if(t?.texture!=null&&n.texture!==t?.texture&&(n.texture=t.texture,r=!0),t?.topTexture!=null&&n.topTexture!==t?.topTexture&&(n.topTexture=t.topTexture,r=!0),r&&e.components[0]instanceof or){let o=e.components[0];return o.detached===!1&&(o.detached=!0,o.dirty=!0),e.components[1].dirty=!0,!0}}return!1}function XE(e,t){if(t!==void 0&&e.type==="geometry"){let r=e.components[1];if(r.opacity!==t){r.opacity=t;let n=e.components[0],o=e.components[3];o&&(o.dirty=!0),n.detached===!1&&(n.detached=!0,n.dirty=!0),r.dirty=!0;let i=e.parentObject3D;return i?.type==="geometry-group"&&(i.userData.shadingDirty=!0),!0}}return!1}function kf(e,t){if(t!==void 0)if(e.type==="geometry"||e.type==="path"||e.type==="custom-geometry"){let r=e.components[1];if(r.altitude!==t)return r.altitude=t,r.dirty=!0,e.components[3]&&(e.components[3].dirty=!0),!0}else{if(e.type==="group-container"&&e.altitude!==t)return e.setAltitude(t),!0;if(e.type==="geometry-group"&&e.altitude!==t)return e.setAltitude(t),!0}return!1}function mx(e,t,r){if(r!==void 0){if(e.type==="geometry-group")for(let n of e.userData.entities3D.values()){let o=t.geometry3DMap.get(n);o instanceof Ke&&mx(o,t,r)}else if(e.type==="geometry"){let n=e.components[3],o=e.components[1];!n&&r===!0?e.components[3]=new Ff(ig(o.color)):n&&(n.enabled=r,n.dirty=!0)}return!0}return!1}function hx(e,t){if(t!==void 0){let r,n=4;if(e.type==="geometry"?(r=e.components[4],n=4):e.type==="group-container"&&(r=e.components[1],n=1),t===!0&&r==null)return e.components[n]=new ja,!0;if(t===!1&&r!=null)return e.components[n]=void 0,!0}return!1}function ZE(e,t){if(t!==void 0&&e.type==="geometry"){let r=e.components[1];if(r.renderOrder!==t){r.renderOrder=t;let n=e.components[0];return n.detached===!1&&(n.detached=!0,n.dirty=!0),n.imageMesh&&(n.imageMesh.renderOrder=t+1),r.dirty=!0,!0}}return!1}function gx(e,t,r){if(r!=null){if(e.type==="geometry"){let n=e.components[1];n.side!==r&&(n.side=r,n.dirty=!0)}else if(e.type==="geometry-group")for(let n of e.userData.entities3D.values()){let o=t.geometry3DMap.get(n);o instanceof Ke&&gx(o,t,r)}}}function YE(e,t,r){let{visible:n,color:o}=r;if(e.type!=="path")return;let i=e.components[0];n!=null&&_s(e,t,n),o!=null&&fx(e,{color:o}),Object.assign(i,TC(r)),O5(r)||(i.materialDirty=!0,r.width!=null&&(i.dirty=!0))}function TC(e){return gb(e,Fq)}var Fq=["animateArrowsOnPath","displayArrowsOnPath","width","accentColor","completeFraction","dashed","visibleThroughGeometry"];function JE(e){if(!(e instanceof Ke&&e.type==="text3d"))throw new Error("expect target is TextGeometry3D")}var qE=["visible","color","strokeWidth","outlineOffsetX","outlineOffsetY","outlineWidth","outlineBlur","outlineOpacity","outlineColor","strokeWidth","strokeColor","strokeOpacity","maxWidth","maxHeight","font","hoverColor","fillOpacity","fontSize","flipToFaceCamera"];function KE(e,t,r){_s(e,t,r.visible);let n=e.components[1],o=gb(r,qE);"margin"in r&&A.warn("update to margin is not supported atm"),"content"in r&&A.warn("content update is not supported atm");try{px.parse(o)}catch(i){A.error(i);return}Object.keys(o).length>0&&(Object.assign(n,o),n.dirty=!0)}var kq=["color","material","opacity","verticalOffset","rotation","position","scale"];function QE(e,t){let r=gb(t,kq),n=e.components[1],o=e.components[0];Object.keys(r).length>0&&(r.material&&(n.material=r.material),r.opacity!=null&&(n.opacity=r.opacity),r.visible!=null&&(n.visible=r.visible),r.verticalOffset!=null&&(n.verticalOffset=r.verticalOffset),r.color!=null&&(n.color=r.color),r.position!=null&&(o.feature.geometry.coordinates=r.position,o.positionDirty=!0),r.rotation!=null&&(n.rotation=r.rotation),r.scale!=null&&(n.scale=r.scale),n.dirty=!0)}var Ap,Es,yx,$l,e8,lg,bx,t8,r8,cg,xx,pg,ug,vx,ag=class{constructor(t){T(this,$l);T(this,Ap,null);T(this,Es);f(this,"getCurrentSceneGLTF",async t=>{let r={onlyVisible:!0,binary:!0,light:!0,scale:1,...t},n=await z(this,$l,e8).call(this),o=a(this,yx).call(this,r),i=await n.parseAsync(o,{trs:!1,maxTextureSize:1/0,onlyVisible:r.onlyVisible,binary:r.binary,scale:r.scale}),s;if(i instanceof ArrayBuffer)s=new Blob([i],{type:"application/octet-stream"});else{let l=JSON.stringify(i,null,2);s=new Blob([l],{type:"text/plain"})}return s});T(this,yx,t=>{let{scale:r,light:n,onlyVisible:o}=t,i=new al,s=new vr().setFromObject(a(this,Es).entityScene);if(a(this,lg).call(this,a(this,Es).entityScene,i,o),n){let l=new lb(16777215,.3*Math.PI);l.position.set(0,Math.max(s.max.x,s.max.y)*r*.5,s.max.y*r*4),l.lookAt(0,0,-1),l.target.position.set(0,0,-1),l.add(l.target),i.add(l)}return i});T(this,lg,(t,r,n)=>{t.material&&(t instanceof ib?z(this,$l,t8).call(this,t).forEach(o=>r.add(o)):t instanceof du&&r.add(z(this,$l,r8).call(this,t))),t.children.forEach(o=>{(!n||o.visible)&&a(this,lg).call(this,o,r,n)})});T(this,bx,(t,r,n)=>{let o=new e5({color:new Nt(t),metalness:0});return o.opacity=r,o.transparent=n,o});T(this,cg,t=>{let{geometry:r,material:n,position:o,rotation:i,quaternion:s,scale:l}=t;if(!r?.isBufferGeometry)return t;let c=r.attributes.position,p=r.attributes.normal,d=r.attributes.uv;return a(this,xx).call(this,c,p),a(this,ug).call(this,o,l,i,s),d&&a(this,vx).call(this,d),n?.map&&r.type==="PlaneGeometry"&&(t.side=ni),t});T(this,xx,(t,r)=>{let n=new ue,o=new ue;for(let i=0;i<t.count;i++)n.fromBufferAttribute(t,i),a(this,pg).call(this,n),t.setXYZ(i,n.x,n.y,n.z),r&&(o.fromBufferAttribute(r,i),a(this,pg).call(this,o),r.setXYZ(i,o.x,o.y,o.z))});T(this,pg,t=>{let r=t.y;t.y=t.z,t.z=-r});T(this,ug,(t,r,n,o)=>{let i=t.y;t.y=t.z,t.z=-i;let s=r.y;if(r.y=r.z,r.z=s,n instanceof Xs)n.order="YXZ",n.set(n.x,n.y,n.z,n.order);else{let l=o.y;o.set(o.x,o.z,-l,o.w)}});T(this,vx,t=>{for(let r=0;r<t.count;r++){let n=t.getX(r),o=t.getY(r);t.setXY(r,n,o)}});w(this,Es,t),a(this,Es).entityScene=t.entityScene,a(this,Es).geometry3DMap=t.geometry3DMap}destroy(){w(this,Ap,null)}};Ap=new WeakMap,Es=new WeakMap,yx=new WeakMap,$l=new WeakSet,e8=async function(){if(!a(this,Ap)){let{GLTFExporter:t}=await import("./GLTFExporter-LCU7NXUM.js");w(this,Ap,new t)}return a(this,Ap)},lg=new WeakMap,bx=new WeakMap,t8=function(t){let r=[],o=(t.userData?.entities?Object.values(t.userData?.entities):[]).map(s=>a(this,Es).geometry3DMap.get(s)),i=new Map;return o.forEach(s=>{if(!s||!(s instanceof Ke))return;let l=s.components[1],c=s.components[2];if(!l.visible||l instanceof Qi&&l.opacity===0||l instanceof Cm||l instanceof vb)return;let d=`${c?.hover?l.hoverColor||a(this,Es).hoverColor:l.color}-${l.opacity}-${Number(l.visible)}`;i.has(d)||i.set(d,[]),i.get(d)?.push(s)}),i.forEach((s,l)=>{let[c,p,d]=l.split("-"),m=s.reduce((C,I)=>{if(I.type==="custom-geometry")return C;let S=I.components[0];return"geometry"in S&&S.geometry instanceof ob&&C.push(S.geometry),C},[]),g=a(this,bx).call(this,c,Number(p),t.material.transparent),x=vo(m,!0),v=new Re(x,g);v.position.copy(t.position),v.rotation.copy(t.rotation),v.scale.copy(t.scale),v.visible=!!d,a(this,ug).call(this,v.position,v.scale,v.rotation,v.quaternion),r.push(a(this,cg).call(this,v))}),r},r8=function(t){let r=t.geometry.clone(),n=t.material,o=new Tr({color:n.color,side:ni});o.opacity=n.opacity,o.transparent=n.transparent;let i=new du(r,o);return i.position.copy(t.position),i.rotation.copy(t.rotation),i.scale.copy(t.scale),i.visible=t.visible,a(this,cg).call(this,i)},cg=new WeakMap,xx=new WeakMap,pg=new WeakMap,ug=new WeakMap,vx=new WeakMap;u();u();u();var wC=il(d8());function f8(e){this.name="JSClipperError",this.message=e,this.stack=new Error().stack}f8.prototype=Error.prototype;wC.default.Error=function(e){throw new f8(e)};var kr=wC.default;var PQ="gray",wQ=.1,mg=100,OC=new kr.ClipperOffset;function OQ(e,t){OC.Clear(),t/=2;let r=e.map(o=>({X:o.x*mg,Y:o.y*mg}));OC.AddPath(r,kr.JoinType.jtMiter,kr.EndType.etClosedPolygon);let n=new kr.Paths;return OC.Execute(n,t*mg),n.length?n.map(i=>i.map(s=>({x:s.X/mg,y:s.Y/mg}))):[e]}function Px(e,t,r){let{color:n=PQ,opacity:o=1,altitude:i=0,height:s=wQ}=r||{};Array.isArray(o)&&(o=1);let l={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}},p=e.geometry.coordinates[0].map(x=>{let v=t(x[1],x[0]);return l.min.x=Math.min(l.min.x,v.x),l.min.y=Math.min(l.min.y,v.y),l.max.x=Math.max(l.max.x,v.x),l.max.y=Math.max(l.max.y,v.y),v});e.properties?.style?.edgeOffset!=null&&e.properties.style.edgeOffset!==0||e.properties?.image!=null?p=OQ(p,e.properties?.style?.edgeOffset||0):p=[p];let d=[];for(let x of p){let v=new zi;v.moveTo(x[0].x,x[0].y),x.slice(1).forEach(P=>v.lineTo(P.x,P.y)),v.lineTo(x[0].x,x[0].y);let C=e.geometry.coordinates.slice(1);v.holes=C.map(P=>{let O=P.map(E=>t(E[1],E[0])),M=new cl;return M.moveTo(O[0].x,O[0].y),O.slice(1).forEach(E=>M.lineTo(E.x,E.y)),M.lineTo(O[0].x,O[0].y),M});let I=Im(r?.bevel,s),S=new Xi(v,I);S.userData={style:{color:n,opacity:o},usedBevelSettings:I},d.push(S)}if(d.length===1)return d[0];let m=vo(d);d.forEach(x=>x.dispose());let g=Im(r?.bevel,s);return m.userData={style:{color:n,opacity:o},usedBevelSettings:g,_split:!0},m}u();var _Q="gray",EQ=.1;function wx(e,t,r){let{color:n=_Q,opacity:o=1,altitude:i=0,height:s=EQ}=r||{};Array.isArray(o)&&(o=1);let l={min:{x:1/0,y:1/0,z:i},max:{x:-1/0,y:-1/0,z:s+i}},c=Im(r?.bevel,s),p=[];e.geometry.coordinates.forEach(m=>{let g=new zi,x=m[0].map(I=>{let S=t(I[1],I[0]);return l.min.x=Math.min(l.min.x,S.x),l.min.y=Math.min(l.min.y,S.y),l.max.x=Math.max(l.max.x,S.x),l.max.y=Math.max(l.max.y,S.y),S});g.moveTo(x[0].x,x[0].y),x.slice(1).forEach(I=>g.lineTo(I.x,I.y)),g.lineTo(x[0].x,x[0].y);let v=m.slice(1);g.holes=v.map(I=>{let S=I.map(O=>t(O[1],O[0])),P=new cl;return P.moveTo(S[0].x,S[0].y),S.slice(1).forEach(O=>P.lineTo(O.x,O.y)),P.lineTo(S[0].x,S[0].y),P});let C=new Xi(g,c);p.push(C)});let d=vo(p);return p.forEach(m=>m.dispose()),d.translate(0,0,i||0),d.userData={style:{color:n,opacity:o},usedBevelSettings:c},d}u();var DQ="gray",_C=new kr.ClipperOffset,Dn=100;function m8(e,t,r){let{color:n=DQ,opacity:o=1,width:i=1,join:s="round",cap:l="round",height:c=.01,altitude:p=0}=r||{};Array.isArray(o)&&(o=0);let d=[];for(let C=0;C<e.geometry.coordinates.length-1;C++){let I=t(e.geometry.coordinates[C][1],e.geometry.coordinates[C][0]),S=t(e.geometry.coordinates[C+1][1],e.geometry.coordinates[C+1][0]);d.push([I,S])}_C.AddPaths(d.map(C=>C.map(I=>({X:I.x*Dn,Y:I.y*Dn}))),s==="round"?kr.JoinType.jsRound:s==="miter"?kr.JoinType.jsMiter:kr.JoinType.jsSquare,l==="round"?kr.EndType.etOpenRound:l==="butt"?kr.EndType.etOpenButt:kr.EndType.etOpenSquare);let m=new kr.PolyTree;_C.Execute(m,i/2*Dn);let g=[],x={bevelEnabled:!1,depth:c};for(let C of m.m_AllPolys){let I=new zi;if(C.IsHole())continue;let S=C.m_polygon;I.moveTo(S[0].X/Dn,S[0].Y/Dn),S.slice(1).forEach(P=>I.lineTo(P.X/Dn,P.Y/Dn)),I.lineTo(S[0].X/Dn,S[0].Y/Dn),I.holes=C.m_Childs.map(P=>{let O=new cl,M=P.m_polygon;return O.moveTo(M[0].X/Dn,M[0].Y/Dn),M.slice(1).forEach(E=>O.lineTo(E.X/Dn,E.Y/Dn)),O.lineTo(M[0].X/Dn,M[0].Y/Dn),O}),g.push(new Xi(I,x))}let v=vo(g);return v.translate(0,0,p||0),v.userData={style:{color:n,opacity:o}},_C.Clear(),v}u();var Fn=100,FQ=.22,kQ=.01;function h8(e,t,r={}){let{width:n=FQ,height:o=kQ,color:i="gray",opacity:s=1,altitude:l=0}=r,c={min:{x:1/0,y:1/0,z:l},max:{x:-1/0,y:-1/0,z:l+o}},p={bevelEnabled:!1,depth:o},d=new kr.ClipperOffset,m=e.geometry.coordinates.map(C=>C.map(I=>t(I[1],I[0])));d.AddPaths(m.map(C=>C.map(I=>({X:I.x*Fn,Y:I.y*Fn}))),kr.JoinType.jsMiter,kr.EndType.etOpenRound);let g=new kr.PolyTree;d.Execute(g,n/2*Fn);let x=[];for(let C of g.m_AllPolys){let I=new zi;if(C.IsHole())continue;c.min.x=Math.min(c.min.x,C.m_polygon[0].X),c.min.y=Math.min(c.min.y,C.m_polygon[0].Y),c.max.x=Math.max(c.max.x,C.m_polygon[0].X),c.max.y=Math.max(c.max.y,C.m_polygon[0].Y);let S=C.m_polygon;I.moveTo(S[0].X/Fn,S[0].Y/Fn),S.slice(1).forEach(P=>I.lineTo(P.X/Fn,P.Y/Fn)),I.lineTo(S[0].X/Fn,S[0].Y/Fn),I.holes=C.m_Childs.map(P=>{let O=new cl,M=P.m_polygon;return O.moveTo(M[0].X/Fn,M[0].Y/Fn),M.slice(1).forEach(E=>O.lineTo(E.X/Fn,E.Y/Fn)),O.lineTo(M[0].X/Fn,M[0].Y/Fn),O}),x.push(new Xi(I,p))}let v=vo(x);return v.translate(0,0,l||0),v.userData={style:{color:i,opacity:s}},d.Clear(),v}u();u();var Rf=_.object({type:_.enum(["Point"]),coordinates:_.array(_.number()).min(2).max(3)});var EC=_.object({rotation:_.array(_.number()).length(3).optional(),altitude:_.number().optional(),scale:_.array(_.number()).length(3).optional(),interactive:_.boolean().optional(),verticalOffset:_.number().optional(),id:_.union([_.number(),_.string()]).optional()}),AQ=_.object({type:_.enum(["Feature"]),geometry:Rf,properties:EC}),LQ=_.object({type:_.enum(["FeatureCollection"]),features:_.array(AQ)}),DC=_.object({color:_.string()}),RQ=_.object({url:_.string(),color:_.string().optional(),opacity:_.number().optional(),material:_.record(_.string(),DC).optional()});function y8(e,t,r){_.union([_.number(),_.string()]).parse(e),LQ.parse(t),RQ.parse(r)}var hg,gg,Zl=class{constructor(t){f(this,"mesh");f(this,"type","model");f(this,"positionDirty",!0);f(this,"outline");f(this,"geometry");f(this,"material");f(this,"feature");f(this,"instanceIndex",-1);f(this,"visible",!0);f(this,"color",new Nt);f(this,"position",new ue);T(this,hg,0);T(this,gg,1);this.feature=t}setOpacity(){}setColor(){}get altitude(){return a(this,hg)}set altitude(t){this.mesh&&(this.mesh.position.z=t,w(this,hg,t))}getRotation(){return this.mesh?[this.mesh.rotation.x,this.mesh.rotation.y,this.mesh.rotation.z]:void 0}setRotation(t){this.mesh&&this.mesh.rotation.set(Xe.degToRad(t[0]),Xe.degToRad(t[1]),Xe.degToRad(t[2]))}getScale(){return this.mesh?[this.mesh.scale.x,this.mesh.scale.y,this.mesh.scale.z]:void 0}setScale(t){this.mesh&&this.mesh.scale.set(t[0],t[1],t[2])}get opacity(){return a(this,gg)}set opacity(t){if(this.mesh){if(this.mesh.children[0]instanceof ll){for(let r of this.mesh.children)if(r instanceof ll){r.userData?.originalOpacity===void 0&&(r.userData.originalOpacity=r.material.opacity);let n=yc(t,0,r.userData?.originalOpacity,0,1);r.material.opacity=n,r.material.transparent=n<1,r.material.needsUpdate=!0}}else this.mesh?.traverse(r=>{r instanceof Re&&r.material&&(Array.isArray(r.material)?r.material.forEach(n=>{g8(n,t)}):g8(r.material,t))});w(this,gg,t)}}};hg=new WeakMap,gg=new WeakMap;function g8(e,t){e.opacity!==t&&(t===1?(e.opacity=1,e.transparent=!1):(e.opacity=t,e.transparent=!0),e.needsUpdate=!0)}u();function Ox(e){let t=e.components[0],r=e.components[1];r.opacity!=null&&r.opacity!==t.opacity&&(t.opacity=r.opacity);let n=r.material,o=r.color;if(n||o){let l=BQ(o,n);t.mesh?.traverse(c=>{c instanceof Re&&c.material&&(Array.isArray(c.material)?c.material.forEach(p=>{l[p.name]?p.color.set(l[p.name].color):p.color.set(o)}):l[c.material.name]?c.material.color.set(l[c.material.name].color):c.material.color.set(o))})}let i=t.feature.geometry.coordinates[2]??0,s=r.verticalOffset+i;t.altitude!==s&&(t.altitude=s),r.visible!==t.visible&&(t.visible=r.visible),r.rotation&&t.setRotation(r.rotation),r.scale&&t.setScale(r.scale)}function BQ(e,t){let r={};if(e&&Object.assign(r,{Default:{color:e},Fabric:{color:e},Mpdn_Logo:{color:e},CouchLogo:{color:e}}),t)for(let n in t)t[n].color&&(r[n]?r[n].color=t[n].color:r[n]={color:t[n].color});return r}function b8(e,t){let r=e.components[0],o=e.components[1].verticalOffset??0,i=r.feature.geometry.coordinates.slice();i[2]=(i[2]??0)+o,r.mesh?r.mesh.position.copy(t(i)):r.position.copy(t(i))}function x8(e){return e instanceof or?e.material:null}function v8(e){return e.side===ym?"back":e.side===fc?"front":"double"}function I8(e,t){e.side=t==="back"?ym:t==="front"?fc:ni}function NQ(e){let{color:t,opacity:r,topColor:n,texture:o,topTexture:i}=e;return`${t}${r}${n||""}${o||""}${i||""}`}var _x=class extends Fe{constructor(r,n){super();f(this,"state");f(this,"convertTo3DMapPosition");f(this,"loader");f(this,"optimizePromise",[]);this.state=r,this.convertTo3DMapPosition=n}async getGLTFLoader(){if(this.loader)return this.loader;let{GLTFLoader:r}=await import("./GLTFLoader-M52U7R6R.js");return this.loader=new r,this.loader}createEntityFromFeature(r,n,o){let i=new or(n),s=n?.properties?.bevel,l=o&&"bevel"in o?o.bevel:void 0,c;l?c={...s,...l}:s&&(c=s);let p=new Ke(i,new Qi({...o,url:n.properties?.image?.path,bevel:c}));return o?.outline&&(p.components[3]=new Ff(ig(o.color))),o?.focusable&&(p.components[4]=new ja),p.id=r,p}createModelFromFeature(r,n,o){let i=new Zl(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 l=new vb(s),c=new Ke(i,l);return c.id=r,c}populateEntityMesh(r,n){let o=r.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=r.components[1].height,o.dirty=!1}async populateModelGroup(r,n,o){let i=new to,s=new Xs,l=new hc,c=new ue,p=new ai,d=await this.getGLTFLoader(),m=new Promise(g=>{d.load(n,x=>{"entities3D"in o.userData&&(o.userData.entities3D.size>1?x.scene.traverse(v=>{let C=v;if("isMesh"in C&&C.isMesh===!0){let I=new ll(C.geometry,C.material,r.size);I.userData={entities:{}},p.add(I),o.add(p)}}):(x.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())}),p.add(x.scene),o.add(p),p.userData.isSingleModel=!0,p.userData.entityId=r.values().next().value,p.userData.type="model")),g()})});return this.optimizePromise.push(m.then(()=>{let g=0,x;for(let v of r.values()){if(x=this.state.geometry3DMap.get(v),!x||x?.type!=="model")continue;let C=x.components[0],I=x.components[1],S=x.components[0].feature;C.mesh=p,C.instanceIndex=g,Ox(x),x.components[1].dirty=!1;let{x:P,y:O}=this.convertTo3DMapPosition(S.geometry.coordinates[1],S.geometry.coordinates[0],0);C.position.set(P,O,C.altitude),s.set(Xe.degToRad(I.rotation?.[0]??Iu[0]),Xe.degToRad(I.rotation?.[1]??Iu[1]),Xe.degToRad(I.rotation?.[2]??Iu[2])),c.set(I.scale?.[0]??vu[0],I.scale?.[1]??vu[1],I.scale?.[2]??vu[2]),l.setFromEuler(s),i.compose(C.position,l,c),p.children.forEach(M=>{!x||x?.type!=="model"||!(M instanceof ll)||(M.setMatrixAt(g,i),M.userData.entities[g]=x.id)}),C.mesh.userData.isSingleModel&&(C.mesh.matrix.copy(i),C.mesh.matrix.decompose(C.mesh.position,C.mesh.quaternion,C.mesh.scale)),g++}this.publish("model-loaded")})),p}populateEntityGroup(r){let n,o,i,s;for(let l of r.values())s=this.state.geometry3DMap.get(l),s.components[0]instanceof or&&(o=s.components[0].feature,i=s.components[1],o.geometry.type==="Polygon"?(n=Px(o,this.convertTo3DMapPosition,i),o.properties?.textures&&o.properties.textures.length>0&&LE(n,o.properties.textures,this.state.naturalBearing,this.convertTo3DMapPosition),this.populateEntityMesh(s,n)):o.geometry.type==="MultiPolygon"?(n=wx(o,this.convertTo3DMapPosition,i),this.populateEntityMesh(s,n)):o.geometry.type==="LineString"?(n=m8(o,this.convertTo3DMapPosition,i),this.populateEntityMesh(s,n)):o.geometry.type==="MultiLineString"&&(n=h8(o,this.convertTo3DMapPosition,i),this.populateEntityMesh(s,n)));return r}update(){for(let r of this.state.geometryGroupIdsToLoad.values()){let n=this.state.geometry3DMap.get(r);if(n instanceof ro&&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){A.warn(s)}let o,i={};for(let s of n.userData.entities3D.values()){o=this.state.geometry3DMap.get(s);let l=o?.components[0];if(o?.type==="geometry"){let c=o.components[1],p=NQ(c);i[p]===void 0&&(i[p]={style:c,entities:[]}),i[p].entities.push(o)}else l&&"mesh"in l&&l.mesh&&l.mesh?.parent!==n&&n.add(l.mesh)}for(let s in i){let l=AE(i[s].entities,i[s].style);n.add(l)}for(let s of n.userData.entities3D.values())if(o=this.state.geometry3DMap.get(s),o!=null&&o.entities2D.size>0)for(let l of o.entities2D.values())l&&(o.attach(l),this.publish("geometry-2d-added"));this.publish("geometry-group-added"),n.userData.dirty=!1}}return Promise.resolve()}};u();var Ex=class{constructor(t,r){f(this,"state");f(this,"dirty",!0);f(this,"domTree");this.state=t,this.domTree=r}update(){if(this.dirty){let t;for(let r of Array.from(this.domTree.children))if(t=this.state.geometry2DMap.get(r.userData.entityId),t){let n=t.components[0];(!n.enabled||!n.visible||!this.state.geometry2DIdsInScene.has(r.userData.entityId))&&this.domTree.removeChild(r)}else this.domTree.removeChild(r);for(let r of this.state.geometry2DIdsInScene)if(t=this.state.geometry2DMap.get(r),t){let n=t.components[0];n instanceof ws&&n.enabled&&n.markerContainer&&!this.domTree.contains(n.markerContainer)&&(n.markerContainer.userData={entityId:t.id},this.domTree.appendChild(n.markerContainer),n.updateDimensions())}this.dirty=!1}}};u();var Dx=class{constructor(t,r){f(this,"state");f(this,"project");this.state=t,this.project=r}update(){let t,r=0,n,o;for(let i of this.state.geometry2DIdsInScene)if(t=this.state.geometry2DMap.get(i),t){o=t.components[0];let s=t.attachedTo?this.state.geometry3DMap.get(t.attachedTo):void 0;if(s instanceof Ke)if(this.state.geometry3DIdsInScene.has(s.id)){n=s.components[1],o=t.components[0],(n.dirty||t.components[0].attachedDirty)&&(r=n.height,t.setAltitude(r));let l=n.visible;o.visible!==l&&(o.visible=l)}else o.visible===!0&&(o.visible=!1);this.project(t.components[0].projection,t.position),t.components[0].attachedDirty=!1}}};u();u();var GQ=function(){let t,r;return n=>{if((!r||!r)&&(t=document.createElement("canvas"),t.width=500*n,t.height=500*n,t.style.width="500px",t.style.height="500px",r=t.getContext("2d")),!r)throw new Error("Could not get 2D context");return{measureCanvas:t,measureCanvasContext:r}}}(),S8=({text:e,size:t,maxWidth:r,pixelRatio:n,maxLines:o=2,lineHeight:i=1.2,options:s={strokeText:!0}})=>{let l=`bold ${t*n}px 'InterUI-Regular', Helvetica Neue, Arial, sans-serif`,{measureCanvasContext:c}=GQ(n);c.font=l;let p=[],d=e.split(" "),m=0,g=0,x=0;for(;g<d.length;){let S=d[g];if(m===o&&m>0){p[m-1]+="...";break}if(p[m]==null&&(p[m]=S,g++),d.length===1){p[m]=S;break}if(d[g]==null)break;let{width:P}=c.measureText(p[m]+" "+d[g]);P<=r*n?(p[m]+=" "+d[g],g++):m++}p.forEach(S=>{let{width:P}=c.measureText(S);x=Math.max(P,x)});let v=t*n*i,C=p.length*v;return{maxWidth:x,maxHeight:C,lines:p.length,draw:(S,P,O)=>{p.length===1?(s.strokeText&&S.strokeText(p[0],P,O),S.fillText(p[0],P,O)):(s.strokeText&&(S.strokeText(p[0],P,O-v/2),S.strokeText(p[1],P,O+v/2)),S.fillText(p[0],P,O-v/2),S.fillText(p[1],P,O+v/2))}}};u();function C8(e){let t=new Image;return e&&(/<svg[\s\S]*>/i.test(e)?t.src=`data:image/svg+xml;base64,${btoa(e)}`:t.src=e),t}var Fx=class extends Fe{constructor(r,n,o){super();f(this,"dirty",!1);f(this,"state");f(this,"colliderContext");f(this,"colliderCanvas");f(this,"transformRequestFunc");f(this,"transformRequest",async r=>this.transformRequestFunc?await this.transformRequestFunc(r):{url:r});f(this,"pinCache",{});f(this,"imageCache",{});f(this,"imagePromiseCache",{});f(this,"imageDimensionsCache",{});f(this,"textCache",{});f(this,"update",r=>{let n=this.state.pixelRatio;this.colliderContext.clearRect(0,0,this.colliderCanvas.width,this.colliderCanvas.height);let o,i,s,l,c,p,d;for(let m of this.state.geometry2DIdsInScene)if(d=this.state.geometry2DMap.get(m),d!=null&&(p=d.components[0],p instanceof Os&&!d.disposed)){if(c=p.appearance.iconVisibleAtZoomLevel,p.appearance.icon!=null&&c&&r>=c!==p.iconVisible&&(p.iconVisible=r>=c,p.dirty=!0),(p.dirty||this.dirty)&&p.calculateMarkerSize(),i={active:p.appearance.pinColor,inactive:p.appearance.pinColorInactive},s={active:p.appearance.pinOutlineColor,inactive:p.appearance.pinOutlineColorInactive},l=Ji(p.markerSize,2),o=`${i.active}-${i.inactive}-${s.active}-${s.inactive}-${l}-${p.iconVisible}`,p.labelCacheId=o,(!this.pinCache[o]||this.dirty)&&(this.prepare(p,o,this.colliderContext),p.dirty=!0),(p.appearance.icon&&(!p.imageHash||p.markerDirty)||this.dirty)&&this.cacheImage(p),this.textCache[p.id]==null||p.textDirty||this.dirty){p.dirty=!0,this.textCache[p.id]={};let{textDrawFn:x,width:v,height:C}=this.processText(p.text,p.appearance.textSize,p.appearance.maxWidth,p.appearance.maxLines,p.appearance.lineHeight);["left","center","right"].forEach(I=>{this.textCache[p.id][I]=this.textToCanvas(x,p.appearance.textSize,I,v,C,p.appearance.textColor,p.appearance.textOutlineColor)}),p.dimensions={width:Math.ceil(v/n),height:Math.ceil(C/n)}}let g=1;if(p.appearance.iconScale)if(typeof p.appearance.iconScale=="number")g=p.appearance.iconScale;else{let{on:x,input:v,output:C,easing:I}=p.appearance.iconScale;x==="zoom-level"?g=m5(r,v,C,I??"linear"):A.warn(`Unsupported interpolation property: ${x}`)}p.recomputeCurrentStrategy(p.iconVisible?g:1),p.canShow&&p.visible&&(p.enabled||p.visibilityNeedsUpdate!==!1)&&this.draw(p,o,this.colliderContext),p.textDirty=!1,p.markerDirty=!1}this.dirty=!1});f(this,"processText",(r,n,o,i,s)=>{let l=this.state.pixelRatio,{draw:c,maxWidth:p,maxHeight:d}=S8({text:r,size:n,pixelRatio:l,maxWidth:o,maxLines:i,lineHeight:s});return{textDrawFn:c,width:p+2.5*l*2,height:d+2.5*l*2}});f(this,"textToCanvas",(r,n,o,i,s,l,c)=>{let p=this.state.pixelRatio,d,m=i,g=s;window.OffscreenCanvas!=null&&!w5()?d=new OffscreenCanvas(m,g):(d=document.createElement("canvas"),d.width=m,d.height=g,d.style.width=m+"px",d.style.height=g+"px");let x=d.getContext("2d",{willReadFrequently:!0});if(!x)return;let v=2.5*p;x.textAlign=o,x.font=`bold ${n*p}px 'InterUI-Regular', Helvetica Neue, Arial, sans-serif`,x.textBaseline="middle",x.lineJoin="miter",x.miterLimit=2,x.strokeStyle="white",x.lineWidth=v,x.fillStyle=l,x.strokeStyle=c;let C=o==="left"?v/2:o==="center"?m/2:m-v/2;return r(x,C,(g+v/2)/2),d});f(this,"cacheImage",r=>{if(!r.appearance.icon)return;let n=L5(r.appearance.icon);this.imagePromiseCache[n]||(this.imagePromiseCache[n]=new Promise(o=>{this.transformRequest(r.appearance.icon).then(i=>{let s=C8(i.url);s.onload=()=>{this.imageCache[n]=s,this.publish("img:loaded"),o(s)}})})),r.imageHash!==n&&(r.imageHash=n,this.imagePromiseCache[n].then(()=>{r.dirty=!0}))});f(this,"createPinCanvas",(r,n,o,i,s=1)=>{let l,c=this.state.pixelRatio,p=r.totalMarkerSize*2*c*s;window.OffscreenCanvas!=null?l=new OffscreenCanvas(p,p):(l=document.createElement("canvas"),l.width=p,l.height=p,l.style.width=p/c+"px",l.style.height=p/c+"px");let d=l.getContext("2d");return d.shadowColor="rgba(0,0,0,0.3)",d.shadowOffsetY=2*c,d.shadowBlur=5*c,d.beginPath(),d.arc(p/2,p/2,(n/2+2.5*c/2)*s,0,2*Math.PI),d.fillStyle=o,d.fill(),d.beginPath(),d.arc(p/2,p/2,n/2*s,0,2*Math.PI),d.shadowColor="transparent",d.fillStyle=i,d.fill(),l});f(this,"prepare",(r,n,o)=>{let i=this.state.pixelRatio;o.lineWidth=4*i;let s=typeof r.appearance.iconScale=="number"?[r.appearance.iconScale]:r.appearance.iconScale==null?[]:r.appearance.iconScale.output,l=s.length>0?Math.max(...s):void 0,c=this.createPinCanvas(r,r.markerSize,r.appearance.pinOutlineColor,r.appearance.pinColor,l),p=this.createPinCanvas(r,r.iconVisible?r.markerSize:3.5*i,r.appearance.pinOutlineColorInactive,r.appearance.pinColorInactive,l);this.pinCache[n]=[c,p]});this.state=r,this.colliderCanvas=n,this.colliderContext=n.getContext("2d"),this.transformRequestFunc=o}draw(r,n,o){if(!r.canShow||!r.visible)return;o.save(),o.globalAlpha=r.opacity;let i=this.state.pixelRatio,s=r.projection.x*i,l=r.projection.y*i,c=r.style.pinVisibility===1?this.pinCache[n][0]:this.pinCache[n][1];if(o.drawImage(c,s-r.scaledMarkerSize*i,l-r.scaledMarkerSize*i,r.scaledMarkerSize*2*i,r.scaledMarkerSize*2*i),r.appearance.icon&&r.iconVisible&&r.imageHash&&r.appearance.iconSize&&this.imageCache[r.imageHash]){let p=this.imageCache[r.imageHash],d=(r.scaledMarkerSize-r.scaledIconPadding)*i,m=r.appearance.iconFit,g=d,x=d,v=`${r.imageHash}_${m}`;if(this.imageDimensionsCache[v])g=this.imageDimensionsCache[v].width,x=this.imageDimensionsCache[v].height;else{let C=p.width*i,I=p.height*i;if(m==="contain"){let S=Math.sqrt(C**2+I**2),P=d/S;g=C*P,x=I*P}if(m==="cover"){let S=d/C,P=d/I,O=Math.max(S,P);g=C*O,x=I*O}}o.save(),o.beginPath(),o.arc(s,l,d/2,0,2*Math.PI),o.closePath(),r?.appearance?.iconOverflow!=="visible"&&o.clip(),o.drawImage(p,s-g/2,l-x/2,g,x),o.restore()}r.style.textLabelVisible&&r.style.textAlign!=null&&r.style.left!=null&&r.style.top!=null&&o.drawImage(this.textCache[r.id][r.style.textAlign],s+r.style.left*i,l+r.style.top*i),o.restore()}};u();u();var Np=class Np{constructor(){f(this,"loader");this.loader=new fu}static getInstance(){return Np.instance||(Np.instance=new Np),Np.instance}getLoader(){return this.loader}load(t){return new Promise((r,n)=>{this.loader.load(t,r,void 0,n)})}};f(Np,"instance");var kC=Np,Yl=kC.getInstance();function HQ(e,t){let r=e.components[2],n=e.components[1];return r?.hover?[n.hoverColor||t,n.hoverColor||t]:[n.color,n.topColor||n.color]}var Gp,yg,kx=class extends Fe{constructor(r,n){super();T(this,Gp);f(this,"state");f(this,"convertTo3DMapPosition");f(this,"textureLoadingCache",new Map);this.convertTo3DMapPosition=n,this.state=r}processTextures(r,n,o){if(n.texture!==r.texture&&n.texture!==""&&z(this,Gp,yg).call(this,n.texture,r,"texture"),n.topTexture!==r.topTexture&&n.topTexture!==""&&z(this,Gp,yg).call(this,n.topTexture,r,"topTexture"),(r.texture==null||r.topTexture==null)&&Array.isArray(r.feature.properties?.textures)&&r.feature.properties.textures.length>0)for(let i of r.feature.properties.textures)i.face==="top"&&r.topTexture!==i.path?z(this,Gp,yg).call(this,i.path,r,"topTexture"):i.face==="side"&&r.texture!==i.path&&z(this,Gp,yg).call(this,i.path,r,"texture"),r.blendTexture=!0;(r.texture!=null||r.topTexture!=null)&&(o?.hover&&r.texturesVisible?r.hideTextures():r.texturesVisible||r.showTextures(),n.texture===""&&r.removeSideTexture(),n.topTexture===""&&r.removeTopTexture())}update(){let r,n,o;for(let i of this.state.geometry3DIdsInScene)if(o=this.state.geometry3DMap.get(i),o&&(o.type==="geometry"||o.type==="custom-geometry")&&(o.components[1]?.dirty||o.components[2]?.dirty)){let s=o.components[0],l=o.components[1];n=o.components[2];let c=HQ(o,this.state.hoverColor);s.setColor(c[0],c[1]);let p=x8(s);if(l.visible!==s.visible&&(s.visible=l.visible,s instanceof or&&s.textMesh)){let m=this.state.geometry3DMap.get(s.textMesh.userData.entityId);m?.type==="text3d"&&m.components[0].polygonEntityId!=null&&(m.components[0].visible=l.visible)}l.altitude!==s.altitude&&(s.altitude=l.altitude);let d=l.opacity*bu(o);d!==s.opacity&&(s.opacity=d),l.renderOrder!==s.renderOrder&&(s.renderOrder=l.renderOrder),p&&l.side!==v8(p)&&I8(p,l.side),s instanceof or&&l.shading!=null&&(l.shading?.start!==p?.getGradientShading().start||l.shading?.end!==p?.getGradientShading().end||l.shading?.intensity!==p?.getGradientShading().intensity)&&p?.setGradientShading(l.shading?.start??0,l.shading?.end??0,l.shading?.intensity??0),l.dirty=!1,s instanceof or&&this.processTextures(s,l,n),o.components[2]&&(o.components[2].dirty=!1)}else if(o?.type==="model")o.components[1].dirty&&(Ox(o),o.components[1].dirty=!1),o.components[0].positionDirty&&(b8(o,this.convertTo3DMapPosition),o.components[0].positionDirty=!1);else if(o?.type==="image"&&o.components[1]?.dirty){r=o.components[0];let s=o.components[1];s.visible!==r.visible&&(r.visible=s.visible),s.dirty=!1}else if(o?.type==="text3d"&&o.components[1]?.dirty&&o.components[0].polygonEntityId!=null){r=o.components[0];let s=o.components[1];s.visible!=null&&s.visible!==r.visible&&(r.visible=s.visible);let{textMesh:l}=r;if(l){Object.assign(l,s.getState());let c=s.hoverColor??this.state.text3dHoverColor;l.color=s.hoverByPolygon?c:s.color??xu.color,l.outlineColor=s.hoverByPolygon?c:s.outlineColor??xu.outlineColor,l.strokeColor=s.hoverByPolygon?c:s.strokeColor??xu.strokeColor}s.dirty=!1}}destroy(){this.textureLoadingCache.forEach(async r=>{(await r).dispose()}),this.textureLoadingCache.clear()}};Gp=new WeakSet,yg=async function(r,n,o){if(!(!r||!n.showTextures))if(this.textureLoadingCache.has(r)){o==="topTexture"?n.topTexture=await this.textureLoadingCache.get(r):n.texture=await this.textureLoadingCache.get(r),n.showTextures();return}else{let i=new Promise((s,l)=>{Yl.getLoader().load(r,c=>{o==="topTexture"?n.topTexture=c:n.texture=c,n.showTextures(),this.publish("texture-loaded"),s(c)},void 0,()=>{A.error(`Failed to load texture: ${r}`),l(`Failed to load texture: ${r}`)})});this.textureLoadingCache.set(r,i)}};u();var Ax=class extends Fe{constructor(r){super();f(this,"state");f(this,"animating",new Map);f(this,"isAnimating",!1);f(this,"startTime",-1);f(this,"showDuration",300);f(this,"hideDuration",250);f(this,"update",()=>{this.animating.clear();let r,n;for(let o of this.state.geometry2DIdsInScene)r=this.state.geometry2DMap.get(o),r&&(n=r.components[0],n instanceof Os&&(n.visibilityNeedsUpdate==="show"?(n.canShow=!0,this.animating.set(n,[n.opacity,1])):n.visibilityNeedsUpdate==="hide"&&this.animating.set(n,[n.opacity,0])));this.startTime=performance.now(),this.publish("animate:2d")});f(this,"playAnimations");this.state=r,this.playAnimations=this._playAnimations}_playAnimations(){let r=performance.now();for(let[n,[o,i]]of this.animating.entries()){let s=i===1?this.showDuration:this.hideDuration,l=(r-this.startTime)/s;n.opacity=yc(l,0,1,o,i,i===0?u5:d5),r-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")}};u();var Lx=class extends Fe{constructor(r,n,o,i,s,l,c){super();f(this,"state");f(this,"renderer");f(this,"mode");f(this,"scene");f(this,"cameraObject");f(this,"viewCamera");f(this,"systems");f(this,"needs2DRecompute",!1);f(this,"twoDdirty",!0);f(this,"threeDdirty",!0);f(this,"frameId",null);f(this,"twoDFrameId",null);f(this,"animationFrameId",null);f(this,"nextFrame",null);f(this,"update",(r=!1)=>{if(this.renderer?.renderer==null)return Promise.resolve();if(r){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())})});f(this,"animate2D",()=>{this.animationFrameId=requestAnimationFrame(()=>{this.animationFrameId=null,this.systems.twoDVisiblitySystem.playAnimations()})});f(this,"drawEntities2D",()=>{this.twoDFrameId||(this.twoDFrameId=requestAnimationFrame(()=>{this.twoDFrameId=null,this.systems.twoDDrawSystem.update(this.systems.cameraSystem.getZoomLevel())}))});f(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())})});f(this,"commitRenderState",()=>{try{let r=[];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(),D5(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(),E5(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&&r.push(n),this.systems.meshModificationSystem.update(),this.systems.meshDetachmentSystem.update(),this.systems.imageSystem.update(this.systems.cameraSystem.getRotation()),r.push(this.systems.text3DSystem.update(this.systems.cameraSystem.getRotation())),this.systems.customGeometrySystem.update(),this.systems.panBoundsSystem.update(),this.systems.geometryInFocusSystem.update(this.systems.cameraSystem.isCameraMoving(),this.systems.cameraSystem.lastCameraStoppedMovingTime()),this.systems.outlineInterpolationSystem.update(this.systems.cameraSystem.getZoomLevel(),this.systems.cameraSystem.zoomDirty),this.systems.pathSystem.update(this.systems.cameraSystem.minZoomAltitude,this.systems.cameraSystem.maxZoomAltitude,this.systems.cameraSystem.getZoomAltitude(),this.systems.cameraSystem.getRotation()),this.systems.cameraSystem.postRender(),this.systems.domVisiblitySystem.update(),this.systems.domMutationSystem.update(),this.systems.twoDProjectionSystem.update(),this.systems.occlusion2DSystem.update(),this.systems.twoDDrawSystem.update(this.systems.cameraSystem.getZoomLevel()),this.systems.domDrawSystem.update(this.systems.cameraSystem.isUserInteracting()),this.systems.watermarkSystem.update();let 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.drawSystem.update(),this.systems.geometryDisposalSystem.update(),this.systems.cameraSystem.dirty=!1,this.systems.cameraSystem.zoomDirty=!1,this.systems.cameraSystem.rotationDirty=!1,this.systems.cameraSystem.stateDirty&&(this.publish("camera-state-change"),this.systems.cameraSystem.stateDirty=!1),this.publish("post-render"),Promise.all(r)}catch(r){return Promise.reject(r)}});this.renderer=r,this.state=n,this.mode=o,this.scene=i,this.cameraObject=s,this.viewCamera=l,this.systems=c,this.systems.collisionSystem.on("visibility-changed",this.updateEntities2D),this.systems.twoDVisiblitySystem.on("draw:2d",this.drawEntities2D),this.systems.twoDVisiblitySystem.on("animate:2d",this.animate2D),this.systems.cameraSystem.on("pan-start",()=>this.needs2DRecompute=!1),this.systems.cameraSystem.on("zoom-start",()=>this.needs2DRecompute=!1),this.systems.cameraSystem.on("zoom-end",()=>this.needs2DRecompute=!0),this.systems.cameraSystem.on("rotate-start",()=>this.needs2DRecompute=!1),this.systems.cameraSystem.on("rotate-end",()=>this.needs2DRecompute=!0)}paint(){this.renderer?.renderer&&(this.mode==="standalone"&&this.renderer.clear(),this.renderer.render(this.scene,this.state.useStandaloneCamera||this.mode==="standalone"?this.cameraObject:this.viewCamera))}destroy(){this.frameId&&cancelAnimationFrame(this.frameId),this.twoDFrameId&&cancelAnimationFrame(this.twoDFrameId),this.animationFrameId&&cancelAnimationFrame(this.animationFrameId),this.nextFrame&&cancelAnimationFrame(this.nextFrame),this.state.geometry2DIdsInScene.clear(),this.state.geometry3DIdsInScene.clear(),this.systems.domVisiblitySystem.dirty=!0,this.systems.collisionSystem.collidersDirty=!0,this.update(),this.systems.collisionSystem.off("visibility-changed",this.updateEntities2D),this.systems.twoDVisiblitySystem.off("draw:2d",this.drawEntities2D),this.systems.twoDVisiblitySystem.off("animate:2d",this.animate2D)}};u();var WQ=_.object({interactive:_.boolean().optional(),id:_.string().optional(),width:_.union([_.number(),_.object({on:_.literal("zoom-level").optional(),input:_.array(_.number()).nonempty(),output:_.array(_.number()).nonempty(),easing:_.string().optional()})]).optional(),accentColor:_.string().optional(),displayArrowsOnPath:_.boolean().optional(),animateArrowsOnPath:_.boolean().optional(),visibleThroughGeometry:_.boolean().optional(),dashed:_.boolean().optional()}),$Q=_.object({type:_.enum(["Feature"]),geometry:Rf,properties:_.object({parentId:_.any().optional()})});function T8(e,t){_.object({features:_.array($Q)}).parse(e),WQ.parse(t)}var bg,Jl=class{constructor(t,r){f(this,"type","path");f(this,"mesh",new ai);f(this,"material");f(this,"geometry");f(this,"outline");f(this,"feature");f(this,"options");f(this,"width",{on:"zoom-level",input:[17,22],output:[.8,.4]});f(this,"breakpoint",0);f(this,"altitudeBreakpoints");f(this,"accentColor","blue");f(this,"completeFraction",1);f(this,"altitudeAdjustment",1);f(this,"displayArrowsOnPath",!1);f(this,"animateArrowsOnPath",!1);f(this,"visibleThroughGeometry",!1);f(this,"dashed",!1);f(this,"isVertical",!1);f(this,"dirty",!0);f(this,"materialDirty",!0);f(this,"position",new ue);T(this,bg,0);this.feature=t,this.options=r||{},this.width=r?.width??this.width,this.accentColor=r?.accentColor??this.accentColor,this.displayArrowsOnPath=r?.displayArrowsOnPath??this.displayArrowsOnPath,this.animateArrowsOnPath=r?.animateArrowsOnPath??this.animateArrowsOnPath,this.visibleThroughGeometry=r?.visibleThroughGeometry??this.visibleThroughGeometry,this.dashed=r?.dashed??this.dashed}setColor(){}setOpacity(){}set visible(t){this.mesh&&(this.mesh.visible=t)}get visible(){return this.mesh?this.mesh.visible:!1}get altitude(){return a(this,bg)}set altitude(t){this.mesh&&(this.mesh.position.z=t,w(this,bg,t))}set complete(t){this.material&&(this.material.uniforms.complete.value=t,this.material.needsUpdate=!0)}};bg=new WeakMap;u();u();u();var Kn=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 t=1.70158;return e===1?1:e*e*((t+1)*e-t)},Out:function(e){var t=1.70158;return e===0?0:--e*e*((t+1)*e+t)+1},InOut:function(e){var t=2.5949095;return(e*=2)<1?.5*(e*e*((t+1)*e-t)):.5*((e-=2)*e*((t+1)*e+t)+2)}}),Bounce:Object.freeze({In:function(e){return 1-Kn.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?Kn.Bounce.In(e*2)*.5:Kn.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(t){return Math.pow(t,e)},Out:function(t){return 1-Math.pow(1-t,e)},InOut:function(t){return t<.5?Math.pow(t*2,e)/2:(1-Math.pow(2-t*2,e))/2+.5}}}}),xg=function(){return performance.now()},Rx=function(){function e(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];this._tweens={},this._tweensAddedDuringUpdate={},this.add.apply(this,t)}return e.prototype.getAll=function(){var t=this;return Object.keys(this._tweens).map(function(r){return t._tweens[r]})},e.prototype.removeAll=function(){this._tweens={}},e.prototype.add=function(){for(var t,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];for(var o=0,i=r;o<i.length;o++){var s=i[o];(t=s._group)===null||t===void 0||t.remove(s),s._group=this,this._tweens[s.getId()]=s,this._tweensAddedDuringUpdate[s.getId()]=s}},e.prototype.remove=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];for(var n=0,o=t;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(t){return!t.isPlaying()})},e.prototype.update=function(t,r){t===void 0&&(t=xg()),r===void 0&&(r=!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=!r;i&&i.update(t,s)===!1&&!r&&this.remove(i)}n=Object.keys(this._tweensAddedDuringUpdate)}},e}(),Bf={Linear:function(e,t){var r=e.length-1,n=r*t,o=Math.floor(n),i=Bf.Utils.Linear;return t<0?i(e[0],e[1],n):t>1?i(e[r],e[r-1],r-n):i(e[o],e[o+1>r?r:o+1],n-o)},Bezier:function(e,t){for(var r=0,n=e.length-1,o=Math.pow,i=Bf.Utils.Bernstein,s=0;s<=n;s++)r+=o(1-t,n-s)*o(t,s)*e[s]*i(n,s);return r},CatmullRom:function(e,t){var r=e.length-1,n=r*t,o=Math.floor(n),i=Bf.Utils.CatmullRom;return e[0]===e[r]?(t<0&&(o=Math.floor(n=r*(1+t))),i(e[(o-1+r)%r],e[o],e[(o+1)%r],e[(o+2)%r],n-o)):t<0?e[0]-(i(e[0],e[0],e[1],e[1],-n)-e[0]):t>1?e[r]-(i(e[r],e[r],e[r-1],e[r-1],n-r)-e[r]):i(e[o?o-1:0],e[o],e[r<o+1?r:o+1],e[r<o+2?r:o+2],n-o)},Utils:{Linear:function(e,t,r){return(t-e)*r+e},Bernstein:function(e,t){var r=Bf.Utils.Factorial;return r(e)/r(t)/r(e-t)},Factorial:function(){var e=[1];return function(t){var r=1;if(e[t])return e[t];for(var n=t;n>1;n--)r*=n;return e[t]=r,r}}(),CatmullRom:function(e,t,r,n,o){var i=(r-e)*.5,s=(n-t)*.5,l=o*o,c=o*l;return(2*t-2*r+i+s)*c+(-3*t+3*r-2*i-s)*l+i*o+t}}},M8=function(){function e(){}return e.nextId=function(){return e._nextId++},e._nextId=0,e}(),AC=new Rx,Fi=function(){function e(t,r){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=Kn.Linear.None,this._interpolationFunction=Bf.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=M8.nextId(),this._isChainStopped=!1,this._propertiesAreSetUp=!1,this._goToEnd=!1,this._object=t,typeof r=="object"?(this._group=r,r.add(this)):r===!0&&(this._group=AC,AC.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(t,r){if(r===void 0&&(r=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=t,this._propertiesAreSetUp=!1,this._duration=r<0?0:r,this},e.prototype.duration=function(t){return t===void 0&&(t=1e3),this._duration=t<0?0:t,this},e.prototype.dynamic=function(t){return t===void 0&&(t=!1),this._isDynamic=t,this},e.prototype.start=function(t,r){if(t===void 0&&(t=xg()),r===void 0&&(r=!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=t,this._startTime+=this._delayTime,!this._propertiesAreSetUp||r){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,r)}return this},e.prototype.startFromCurrentValues=function(t){return this.start(t,!0)},e.prototype._setupProperties=function(t,r,n,o,i){for(var s in n){var l=t[s],c=Array.isArray(l),p=c?"array":typeof l,d=!c&&Array.isArray(n[s]);if(!(p==="undefined"||p==="function")){if(d){var m=n[s];if(m.length===0)continue;for(var g=[l],x=0,v=m.length;x<v;x+=1){var C=this._handleRelativeValue(l,m[x]);if(isNaN(C)){d=!1,console.warn("Found invalid interpolation list. Skipping.");break}g.push(C)}d&&(n[s]=g)}if((p==="object"||c)&&l&&!d){r[s]=c?[]:{};var I=l;for(var S in I)r[s][S]=I[S];o[s]=c?[]:{};var m=n[s];if(!this._isDynamic){var P={};for(var S in m)P[S]=m[S];n[s]=m=P}this._setupProperties(I,r[s],m,o[s],i)}else(typeof r[s]>"u"||i)&&(r[s]=l),c||(r[s]*=1),d?o[s]=n[s].slice().reverse():o[s]=r[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(t){return t===void 0&&(t=xg()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=t,this)},e.prototype.resume=function(t){return t===void 0&&(t=xg()),!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=t-this._pauseStart,this._pauseStart=0,this)},e.prototype.stopChainedTweens=function(){for(var t=0,r=this._chainedTweens.length;t<r;t++)this._chainedTweens[t].stop();return this},e.prototype.group=function(t){return t?(t.add(this),this):(console.warn("tween.group() without args has been removed, use group.add(tween) instead."),this)},e.prototype.remove=function(){var t;return(t=this._group)===null||t===void 0||t.remove(this),this},e.prototype.delay=function(t){return t===void 0&&(t=0),this._delayTime=t,this},e.prototype.repeat=function(t){return t===void 0&&(t=0),this._initialRepeat=t,this._repeat=t,this},e.prototype.repeatDelay=function(t){return this._repeatDelayTime=t,this},e.prototype.yoyo=function(t){return t===void 0&&(t=!1),this._yoyo=t,this},e.prototype.easing=function(t){return t===void 0&&(t=Kn.Linear.None),this._easingFunction=t,this},e.prototype.interpolation=function(t){return t===void 0&&(t=Bf.Linear),this._interpolationFunction=t,this},e.prototype.chain=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return this._chainedTweens=t,this},e.prototype.onStart=function(t){return this._onStartCallback=t,this},e.prototype.onEveryStart=function(t){return this._onEveryStartCallback=t,this},e.prototype.onUpdate=function(t){return this._onUpdateCallback=t,this},e.prototype.onRepeat=function(t){return this._onRepeatCallback=t,this},e.prototype.onComplete=function(t){return this._onCompleteCallback=t,this},e.prototype.onStop=function(t){return this._onStopCallback=t,this},e.prototype.update=function(t,r){var n=this,o;if(t===void 0&&(t=xg()),r===void 0&&(r=e.autoStartOnUpdate),this._isPaused)return!0;var i;if(!this._goToEnd&&!this._isPlaying)if(r)this.start(t,!0);else return!1;if(this._goToEnd=!1,t<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=t-this._startTime,l=this._duration+((o=this._repeatDelayTime)!==null&&o!==void 0?o:this._delayTime),c=this._duration+this._repeat*l,p=function(){if(n._duration===0||s>c)return 1;var C=Math.trunc(s/l),I=s-C*l,S=Math.min(I/n._duration,1);return S===0&&s===n._duration?1:S},d=p(),m=this._easingFunction(d);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,m),this._onUpdateCallback&&this._onUpdateCallback(this._object,d),this._duration===0||s>=this._duration)if(this._repeat>0){var g=Math.min(Math.trunc((s-this._duration)/l)+1,this._repeat);isFinite(this._repeat)&&(this._repeat-=g);for(i in this._valuesStartRepeat)!this._yoyo&&typeof this._valuesEnd[i]=="string"&&(this._valuesStartRepeat[i]=this._valuesStartRepeat[i]+parseFloat(this._valuesEnd[i])),this._yoyo&&this._swapEndStartRepeatValues(i),this._valuesStart[i]=this._valuesStartRepeat[i];return this._yoyo&&(this._reversed=!this._reversed),this._startTime+=l*g,this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1,!0}else{this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var x=0,v=this._chainedTweens.length;x<v;x++)this._chainedTweens[x].start(this._startTime+this._duration,!1);return this._isPlaying=!1,!1}return!0},e.prototype._updateProperties=function(t,r,n,o){for(var i in n)if(r[i]!==void 0){var s=r[i]||0,l=n[i],c=Array.isArray(t[i]),p=Array.isArray(l),d=!c&&p;d?t[i]=this._interpolationFunction(l,o):typeof l=="object"&&l?this._updateProperties(t[i],s,l,o):(l=this._handleRelativeValue(s,l),typeof l=="number"&&(t[i]=s+(l-s)*o))}},e.prototype._handleRelativeValue=function(t,r){return typeof r!="string"?r:r.charAt(0)==="+"||r.charAt(0)==="-"?t+parseFloat(r):parseFloat(r)},e.prototype._swapEndStartRepeatValues=function(t){var r=this._valuesStartRepeat[t],n=this._valuesEnd[t];typeof n=="string"?this._valuesStartRepeat[t]=this._valuesStartRepeat[t]+parseFloat(n):this._valuesStartRepeat[t]=this._valuesEnd[t],this._valuesEnd[t]=r},e.autoStartOnUpdate=!1,e}();var vLe=M8.nextId,Ds=AC,ILe=Ds.getAll.bind(Ds),SLe=Ds.removeAll.bind(Ds),CLe=Ds.add.bind(Ds),TLe=Ds.remove.bind(Ds),MLe=Ds.update.bind(Ds);u();u();u();var P8=(e,t)=>(t-e+Math.PI)%(Math.PI*2)+Math.PI*2%(Math.PI*2)-Math.PI,w8=(e,t)=>new De(e.clientX-t.offsetLeft,e.clientY-t.offsetTop),LC=(e,t)=>Math.atan2(t.y-e.y,t.x-e.x),vg=(e,t)=>Math.sqrt((t.y-e.y)**2+(t.x-e.x)**2),RC=(e,t)=>new De((e.x+t.x)/2,(e.y+t.y)/2),BC=e=>{let t=0,{wheelDelta:r,detail:n}=e;return r!==void 0?t=r:n!==void 0&&(t=-n),t};var Bx=class{constructor(t,r){f(this,"input1");f(this,"input2");f(this,"lastAngle");f(this,"lastDistance");f(this,"totalDistance");f(this,"first");f(this,"second");this.input1=t,this.input2=r,this.lastAngle=LC(t,r),this.lastDistance=vg(t,r),this.totalDistance=0,this.first=t,this.second=r}update(t,r){let n=vg(t,r);this.input1=t,this.input2=r;let o=LC(t,r);this.lastAngle=o,this.lastDistance=n,this.totalDistance+=(vg(this.first,t)+vg(this.second,r))/2,this.first=RC(this.first,t),this.second=RC(this.second,r)}};u();var Ig=class{constructor(t,r,n){f(this,"touch");f(this,"camera");f(this,"cameraPlane");f(this,"viewCoordinate");f(this,"snapHolderMatrix");f(this,"snapCamera");f(this,"cameraPosition");f(this,"raycaster");f(this,"worldCoordinate");f(this,"snapshotted",!1);this.touch=t,this.camera=r,this.cameraPlane=n,this.viewCoordinate={x:t.x,y:t.y},this.camera.updateMatrixWorld(),this.camera.updateMatrix(),this.snapHolderMatrix=this.camera.matrixWorld.clone(),this.snapCamera=this.camera.clone(),this.snapshotCameraState()}snapshotCameraState(){this.camera.updateMatrix(),this.camera.updateMatrixWorld(),this.cameraPosition=this.camera.position.clone();let t=new De(this.viewCoordinate.x,this.viewCoordinate.y);this.raycaster=this.raycaster||new Zi,this.raycaster.setFromCamera(t,this.snapCamera);let r=this.raycaster.intersectObject(this.cameraPlane,!0);this.worldCoordinate=r&&r.length>0?r[0].point:null,this.snapshotted=!0}updateAnchorState(t,r){this.camera=t,this.snapCamera=t.clone(),this.snapHolderMatrix=t.matrixWorld.clone(),this.updateViewCoordinate(r),this.snapshotCameraState()}updateViewCoordinate(t){this.viewCoordinate={x:t.x,y:t.y}}reUnproject(){let t=new De(this.viewCoordinate.x,this.viewCoordinate.y);this.raycaster?.setFromCamera(t,this.snapCamera);let r=this.raycaster?.intersectObject(this.cameraPlane,!0)[0];return r?r.point:void 0}};var ki={};zs(ki,{BLOCK_MERCATOR_ZOOM_LEVEL:()=>XQ,CLIPPING_RADIUS:()=>Sg,CONTROL_OPTIONS:()=>zQ,DEFAULT_ANIMATION_DURATION:()=>VC,DEFAULT_BEARING:()=>KQ,DEFAULT_MAX_ZOOM_LEVEL:()=>JQ,DEFAULT_MIN_ZOOM_LEVEL:()=>HC,DEFAULT_PITCH:()=>qQ,DEFAULT_ZOOM_LEVEL:()=>YQ,EVENTS:()=>Ux,MAPLIBRE_TILE_SIZE:()=>Nx,MAX_LAT:()=>GC,MAX_MERCATOR_ZOOM_LEVEL:()=>jx,MIN_LAT:()=>NC,MIN_MERCATOR_ZOOM_LEVEL:()=>Gx,ROOM_MERCATOR_ZOOM_LEVEL:()=>ZQ,TWO_PI:()=>jC,WHEEL_ZOOM_MULTIPLIER:()=>UC,ZRANGE:()=>Nf});u();var Nx=512,NC=-85.051129,GC=85.051129,Sg=1e4,zQ={chain:"chain",cancel:"cancel"},jC=Math.PI*2,Nf=100,UC=1e4,Gx=0,jx=24,XQ=17,ZQ=20,VC=200,Ux=["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"],YQ=18,HC=12,JQ=22,qQ=0,KQ=0;u();function O8(e){e&&(e.map&&(e.map.dispose(),e.map=void 0),e.dispose())}function Qt(e){for(let t=e.children.length-1;t>=0;t--)Qt(e.children[t]);"geometry"in e&&e.geometry&&e.geometry.dispose(),e.parent&&e.parent.remove(e),"material"in e&&Array.isArray(e.material)?e.material.forEach(function(t){O8(t)}):"material"in e&&typeof e.material<"u"&&O8(e.material)}var Vx=!1,QQ=!1;var Hx,jp=class extends Fe{constructor(r,n,o,i,s){super();f(this,"dirty",!1);f(this,"zoomDirty",!1);f(this,"rotationDirty",!1);f(this,"panDirty",!1);f(this,"stateDirty",!1);T(this,Hx,HC);f(this,"zoomSpeed",5);f(this,"rotateSpeed",100);f(this,"enabled",!0);f(this,"enableZoom",!0);f(this,"enablePan",!0);f(this,"enablePedestal",!1);f(this,"maxPedestal",1/0);f(this,"minPedestal",0);f(this,"enableRotate",!0);f(this,"minZoomAltitude",0);f(this,"maxZoomAltitude",1/0);f(this,"ignoreZoomLimits",!1);f(this,"zoomFactor",1);f(this,"panBounds",{min:new ue(1/0,1/0),max:new ue(-1/0,-1/0),center:new ue(0,0,0),radius:1/0});f(this,"minTilt",0);f(this,"maxTilt",1.2);f(this,"MOUSE_BUTTONS",{ORBIT:Qy.RIGHT,ZOOM:Qy.MIDDLE,PAN:Qy.LEFT});f(this,"camera");f(this,"scene");f(this,"renderer");f(this,"elevation");f(this,"orbit");f(this,"cameraPlane");f(this,"raycaster",new Zi);f(this,"rendererState");f(this,"options");f(this,"state",-1);f(this,"intersection");f(this,"viewState",null);f(this,"tweens",new Map);f(this,"clock",new r5(!0));f(this,"coords",{mouse:new De,rotateStart:new De,rotateEnd:new De,rotateDelta:new De,panStart:new ue,panCameraStart:new ue,panEnd:new ue,panDelta:new ue,initialShiftPos:new De,initialPedestal:0,floorAnchor:new ue});f(this,"touch",{origin:{offsetLeft:0,offsetTop:0},touches:[],anchor1:null,anchor2:null,inputs:null});f(this,"scrollTimer",null);f(this,"lastWheelTime",0);f(this,"resetZoom",!1);f(this,"zoomStart");f(this,"pedestalScaleFactor",1);f(this,"isUserZooming",!1);f(this,"stayInsideBounds",!0);f(this,"userInteracting",!1);f(this,"cameraMoving",!1);f(this,"lastCameraMoveTime",Date.now());f(this,"raycastToFloor",r=>{this.raycaster.setFromCamera(r,this.camera);let n=this.raycaster.intersectObject(this.cameraPlane,!1)[0];return n?n.point:new ue});f(this,"isUserInteracting",()=>this.userInteracting);f(this,"getPosition",()=>new ue(this.orbit.position.x,this.orbit.position.y,this.orbit.position.z));f(this,"getPedestal",()=>this.orbit.position.z);f(this,"pan",(r,n)=>{isNaN(r)||isNaN(n)||(this.setPosition(this.orbit.position.x+r,this.orbit.position.y+n),this.publish("position-updated"))});f(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"))});f(this,"isCameraMoving",()=>this.cameraMoving);f(this,"lastCameraStoppedMovingTime",()=>this.lastCameraMoveTime);f(this,"setPosition",(r,n)=>{r===void 0||n===void 0||isNaN(r)||isNaN(n)||(this.state===-1&&this.publish("pan-start"),this.updateCameraPosition(r,n),this.publish("position-updated"),this.publish("change"),this.state===-1&&this.publish("pan-end"),this.dirty=!0,this.stateDirty=!0)});f(this,"updateCameraPosition",(r,n)=>{let o=r-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 l=Math.atan2(i,o),c={x:Math.cos(l)*this.panBounds.radius+this.panBounds.center.x,y:Math.sin(l)*this.panBounds.radius+this.panBounds.center.y};this.orbit.position.x=c.x,this.orbit.position.y=c.y}else this.orbit.position.x=r,this.orbit.position.y=n});f(this,"tilt",r=>{if(isNaN(r))return;this.state===-1&&this.publish("rotate-start");let n=this.stayInsideBounds?Math.max(Math.min(r+this.getTilt(),this.maxTilt),this.minTilt):r+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});f(this,"zoomIn",(r,n,o)=>{let i=this.getZoomAltitude();this.animateCamera({zoom:i/1.5},r,n,o)});f(this,"zoomOut",(r,n,o)=>{let i=this.getZoomAltitude();this.animateCamera({zoom:i*1.5},r,n,o)});f(this,"getRotation",()=>(-this.orbit.rotation.z+Math.PI*2)%(Math.PI*2));f(this,"cancelAnimation",()=>{let r=Array.from(this.tweens.keys()),n=r[r.length-1];n.state===7&&this.publish("multi-cancel",{zooming:!0,rotating:!0,tilting:!0}),this.completeTween(n)});f(this,"animateCamera",(r,n,o,i,s,l)=>{let c={interruptible:!0,...l},p={},d={},m=this.getPosition();if(r.position!=null&&(r.position.x!==void 0&&(p.x=m.x,d.x=r.position.x),r.position.y!==void 0&&(p.y=m.y,d.y=r.position.y),r.position.z!==void 0&&(p.z=m.z,d.z=r.position.z)),r.zoom!==void 0&&(p.zoom=this.stayInsideBounds?Math.min(Math.max(this.getZoomAltitude(),this.getZoomScaledMin()),this.getZoomScaledMax()):this.getZoomAltitude(),this.viewState==="multi_floor"||!this.stayInsideBounds?d.zoom=r.zoom:d.zoom=Math.min(Math.max(r.zoom,this.getZoomScaledMin()),this.getZoomScaledMax())),r.rotation!==void 0){let{start:O,end:M}=ub(this.getRotation(),r.rotation);p.rotation=O,d.rotation=M}r.tilt!==void 0&&(p.tilt=this.getTilt(),this.viewState==="multi_floor"||!this.stayInsideBounds?d.tilt=r.tilt:d.tilt=Math.max(Math.min(r.tilt,this.maxTilt),this.minTilt));let g=p.zoom!==d.zoom,x=p.rotation!==d.rotation,v=p.tilt!==d.tilt,C=new Fi(p).to(d,y.env.TESTING?0:n).onUpdate(O=>{this.setMulti({x:O.x,y:O.y,z:O.z},O.zoom,O.rotation,O.tilt)}).onComplete(()=>{this.completeTween(C),this.publish("multi-end",{zooming:g,rotating:x,tilting:v}),i&&i()}).onStart(()=>{this.state!==7&&(this.state=7,C.state=7,this.publish("multi-start",{zooming:g,rotating:x,tilting:v})),this.publish("change")});this.rendererState.internalTweenGroup.add(C);let I=Array.from(this.tweens.entries()),S=I[I.length-1],P=!1;return S!=null&&(S[1].interruptible?(typeof S[1].cancelledCallback=="function"&&S[1].cancelledCallback(),this.completeTween(S[0])):(P=!0,S[0].chain(C))),this.tweens.set(C,{cancelledCallback:s,interruptible:c.interruptible}),o?C.easing(o):C.easing(Kn.Quadratic.In),!r.doNotAutoStart&&!P&&(C.start(),this.publish("change")),C.cameraAnimation=!0,C});f(this,"setMulti",(r,n,o,i,s=!0)=>{this.state===-1&&this.publish("multi-start");let l=!1;r!=null&&(r.x!==void 0&&!isNaN(r.x)&&r.y!==void 0&&!isNaN(r.y)&&(this.updateCameraPosition(r.x,r.y),l=!0),r.z!==void 0&&!isNaN(r.z)&&(this.setPedestal(r.z,!0,!1),l=!0)),l&&this.publish("position-updated");let c={zooming:!1,tilting:!!n,rotating:!1};if(n!==void 0&&!isNaN(n)){let p=this.stayInsideBounds?Math.min(Math.max(n,this.getZoomScaledMin()),this.getZoomScaledMax()):n;p!==this.camera.position.z&&(c.zooming=!0,this.camera.position.z=p,this.publish("zoom-updated"),this.zoomDirty=!0,this.viewState==="multi_floor"?n>Sg&&(this.camera.near=n-Sg,this.camera.far=n+Sg):(this.camera.near=n/Nf,this.camera.far=n*Nf),this.camera.updateProjectionMatrix())}if(o!==void 0&&!isNaN(o)&&o!==this.getRotation()&&(c.rotating=!0,this.orbit.rotation.z=-o,this.publish("rotation-updated")),i!==void 0&&!isNaN(i)){let p=this.stayInsideBounds?Math.max(Math.min(i,this.maxTilt),this.minTilt):i;p!==this.elevation.rotation.x&&(c.tilting=!0,this.elevation.rotation.x=p,this.publish("tilt-updated"))}s&&this.publish("change"),this.state===-1&&this.publish("multi-end",c),this.stateDirty=!0});f(this,"getZoomScaledMin",()=>this.minZoomAltitude*this.zoomFactor);f(this,"getZoomScaledMax",()=>{let r=this.minZoomAltitude*this.zoomFactor;return Math.max(this.maxZoomAltitude,r)});f(this,"setRotation",(r,n)=>{if(isNaN(r))return;this.state===-1&&!n&&this.publish("rotate-start");let o=-(r%jC);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)});f(this,"setZoomAltitude",r=>{if(isNaN(r))return;this.state===-1&&this.publish("zoom-start");let n=this.stayInsideBounds?Math.min(Math.max(r,this.getZoomScaledMin()),this.getZoomScaledMax()):r;n!==this.camera.position.z&&(this.camera.position.z=n,this.publish("zoom-updated"),this.zoomDirty=!0),this.camera.near=n/Nf,this.camera.far=n*Nf,this.camera.updateProjectionMatrix(),this.publish("change"),this.state===-1&&this.publish("zoom-end"),this.dirty=!0,this.stateDirty=!0});f(this,"setZoomLevel",r=>{this.setZoomAltitude(this.convertZoomLevelToAltitude(r))});f(this,"getZoomAltitude",()=>this.camera.position.z);f(this,"getZoomLevel",()=>this.convertAltitudeToZoomLevel(this.getZoomAltitude()));f(this,"setTilt",(r,n)=>{if(isNaN(r))return;this.state===-1&&!n&&this.publish("rotate-start");let o=this.stayInsideBounds?Math.max(Math.min(r,this.maxTilt),this.minTilt):r;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)});f(this,"getTilt",()=>this.elevation.rotation.x);f(this,"setCameraPlaneElevation",r=>{this.cameraPlane.position.z=r});f(this,"zoom",r=>{if(isNaN(r))return;this.state===-1&&this.publish("zoom-start");let n=this.getZoomAltitude()-r;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});f(this,"getProjectionScaleFactor",(r,n,o)=>a2(r,n,o));f(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())});f(this,"setPedestal",(r,n=!1,o=!0)=>{typeof r=="number"&&!isNaN(r)&&(this.orbit.position.z=r,n&&(this.publishPedestalChangeEvent(r),this.publish("pedestal-change",{pedestal:r})),this.publish("change"),this.dirty=!0,o&&(this.stateDirty=!0))});f(this,"dispose",()=>{for(let r of Ux)r.endsWith("start")?(this.off(r,this.setCameraMoving),r.startsWith("user")&&this.off(r,this.setUserInteracting)):(r.endsWith("end")||r.endsWith("cancel"))&&(this.off(r,this.unsetCameraMoving),r.startsWith("user")&&this.off(r,this.unsetUserInteracting));this.removeEventListeners(),this.scene.remove(this.cameraPlane),this.destroy()});f(this,"createCameraPlane",()=>{let r=Vx?2e3:1e10,n=Vx?100:1,o=new si(r,r,n,n),i=new Tr({color:0,wireframe:Vx,visible:Vx}),s=new Re(o,i);return this.scene.add(s),s});f(this,"addEventListeners",()=>{let{domElement:r}=this.renderer;for(let n of Ux)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));r.addEventListener("contextmenu",this.onContextMenu,!1),r.addEventListener("mousedown",this.onMouseDown,!1),r.addEventListener("wheel",this.onMouseWheel,{passive:!1}),r.addEventListener("touchstart",this.onTouchStart,!1),r.addEventListener("touchend",this.onTouchEnd,!1),r.addEventListener("touchmove",this.onTouchMove,!1)});f(this,"addMouseEventListeners",()=>{this.addMouseMoveEventListeners(),window.addEventListener("mouseup",this.onMouseUp,!1),window.addEventListener("mouseout",this.onMouseUp,!1)});f(this,"addMouseMoveEventListeners",()=>{this.renderer.domElement.addEventListener("mousemove",this.onMouseMove,!1)});f(this,"removeMouseMoveEventListeners",()=>{this.renderer.domElement.removeEventListener("mousemove",this.onMouseMove,!1)});f(this,"removeEventListeners",()=>{let{domElement:r}=this.renderer;r.removeEventListener("contextmenu",this.onContextMenu,!1),r.removeEventListener("mousedown",this.onMouseDown,!1),r.removeEventListener("wheel",this.onMouseWheel,!1),r.removeEventListener("touchstart",this.onTouchStart,!1),r.removeEventListener("touchend",this.onTouchEnd,!1),r.removeEventListener("touchmove",this.onTouchMove,!1),r.removeEventListener("mousemove",this.onMouseMove,!1),window.removeEventListener("mouseup",this.onMouseUp,!1),window.removeEventListener("mouseout",this.onMouseUp,!1)});f(this,"removeMouseUpEventListeners",()=>{this.renderer.domElement.removeEventListener("mousemove",this.onMouseMove,!1),window.removeEventListener("mouseup",this.onMouseUp,!1),window.removeEventListener("mouseout",this.onMouseUp,!1)});f(this,"onContextMenu",r=>{r.preventDefault()});f(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}});f(this,"onMouseMove",r=>{if(this.enabled!==!1)if(r.preventDefault(),this.mouseToScene(r),this.state===0){if(this.enableRotate===!1)return;this.handleMouseMoveRotate(r)}else if(this.state===2){if(this.enablePan===!1)return;this.handleMouseMovePan()}else this.state===3?(this.resetZoom=!0,this.state=-1):this.state===8&&this.handleMouseMovePedestal(r)});f(this,"onTouchStart",r=>{if(this.enabled!==!1){switch(this.updateTouchOrigin(),this.touchToScene(r),r.touches.length){case 1:this.enablePedestal?(this.handleTouchStartPedestal(r),this.state=9):this.enablePan&&(this.handleTouchStartPan(r),this.state=6);break;case 2:this.touch.inputs=new Bx(this.touch.touches[0],this.touch.touches[1]);break;default:this.state=-1}this.state}});f(this,"onTouchMove",r=>{if(this.enabled!==!1)switch(this.touchToScene(r),r.touches.length){case 2:r.preventDefault(),r.stopPropagation();let n={...this.touch.inputs.first},o={...this.touch.inputs.second},i=new De(this.touch.touches[0].x,this.touch.touches[0].y),s=new De(this.touch.touches[1].x,this.touch.touches[1].y);if(this.touch.inputs.update(this.touch.touches[0],this.touch.touches[1]),this.enableRotate&&this.state===4)this.handleTouchMoveTilt(r);else if(this.state===5)this.handleTouchMoveDolly();else if(this.state!==5&&this.touch.inputs.totalDistance>.05){let l=n.y<i.y&&o.y<s.y,c=n.y>i.y&&o.y>s.y;this.enableRotate&&this.state!==4&&(c||l)?(this.handleTouchStartTilt(r),this.state=4):(this.handleTouchStartDolly(),this.state=5)}break;case 1:(this.enablePedestal||this.enablePan)&&(r.preventDefault(),r.stopPropagation()),this.enablePedestal&&this.state===9?this.handleTouchMovePedestal(r):this.enablePan&&this.state===6&&this.handleTouchMovePan(r);break;default:this.state=-1}});f(this,"onTouchEnd",r=>{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}r.touches.length?this.onTouchStart(r):this.state=-1}});f(this,"handleTouchMovePan",r=>{let n=Object.hasOwn(r,"x")?new De(r.x,r.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});f(this,"handleTouchStartDolly",()=>{let r=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 De(this.touch.touches[0].x-r/2,this.touch.touches[0].y-n/2);this.coords.floorAnchor=this.raycastToFloor(o),this.orbit.updateMatrixWorld(),this.touch.anchor1=new Ig(this.touch.touches[0],this.camera,this.cameraPlane),this.touch.anchor2=new Ig(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")});f(this,"handleMouseMovePan",()=>{let r=this.raycastToFloor(this.coords.mouse);this.coords.panEnd.set(r.x,r.y,0),this.coords.panDelta.subVectors(this.coords.panEnd,this.coords.panStart),this.setPosition(this.coords.panCameraStart.x-this.coords.panDelta.x,this.coords.panCameraStart.y-this.coords.panDelta.y),this.publish("change"),this.panDirty=!0});f(this,"handleTouchStartTilt",r=>{this.coords.rotateStart.set(r.touches[1].clientX,r.touches[1].clientY),this.publish("user-tilt-start"),this.publish("rotate-start")});f(this,"handleTouchMovePedestal",r=>{this.handleMouseMovePedestal(r.touches[0])});f(this,"handleTouchMoveTilt",r=>{this.coords.rotateEnd.set(r.touches[1].clientX,r.touches[1].clientY),this.coords.rotateDelta.subVectors(this.coords.rotateEnd,this.coords.rotateStart),this.setTilt(this.getTilt()-this.coords.rotateDelta.y/this.rotateSpeed),this.coords.rotateStart.copy(this.coords.rotateEnd)});f(this,"handleTouchMoveDolly",()=>{let r=this.touch.inputs.first,n=this.touch.inputs.second;this.touch.anchor1.viewCoordinate={x:r.x,y:r.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,r),this.touch.anchor2.updateAnchorState(this.camera,n)});f(this,"handleTouchEnd",()=>{this.state===4||this.state===5?this.publish("multi-end"):this.state===6&&this.publish("pan-end"),this.panDirty=!1});f(this,"handleTouchStartPan",r=>{let n=Object.hasOwn(r,"x")?new De(r.x,r.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")});f(this,"handleTouchStartPedestal",r=>{this.handleMouseDownPedestal(r.touches[0])});f(this,"onMouseDown",r=>{if(this.enabled!==!1){if(this.mouseToScene(r),r.preventDefault(),this.state===3&&this.publish("zoom-end"),r.button===this.MOUSE_BUTTONS.ORBIT){if(this.enableRotate===!1)return;this.handleMouseDownRotate(r),this.state=0}else r.button===this.MOUSE_BUTTONS.PAN&&(this.enablePan?(this.handleMouseDownPan(),this.state=2):this.enablePedestal&&(this.handleMouseDownPedestal(r),this.state=8));this.state!==-1&&this.addMouseEventListeners()}});f(this,"onMouseWheel",r=>{this.enabled===!1||this.enableZoom===!1||this.state!==-1&&this.state!==3||(r.preventDefault(),r.stopPropagation(),this.mouseToScene(r),this.canScrollZoom(r)&&(this.lastWheelTime=this.clock.getElapsedTime(),this.publishUserZoomEvent()),this.state!==3&&this.canScrollZoom(r)&&(this.addMouseMoveEventListeners(),this.state=3,this.zoomStart=this.getZoomAltitude(),this.coords.floorAnchor=this.raycastToFloor(this.coords.mouse),this.coords.panCameraStart.set(this.orbit.position.x,this.orbit.position.y,0),this.publish("zoom-start")),this.scrollTimer!=null&&clearTimeout(this.scrollTimer),this.scrollTimer=setTimeout(()=>{this.publish("zoom-end")},50),this.handleMouseWheel(r))});f(this,"handleMouseWheel",r=>{if(this.publish("zoom-start"),!this.canScrollZoom(r)){this.lastWheelTime>0&&this.publish("zoom-end"),this.lastWheelTime=0,this.state=-1;return}let n=this.getZoomAltitude(),o=n-BC(r)*n/UC*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")});f(this,"setCameraFromTransformMatrix",r=>{this.orbit.updateMatrixWorld();let n=new Xs;n.setFromRotationMatrix(r,"ZYX");let o=(r.elements[14]-this.cameraPlane.position.z)/Math.cos(n.x),i=n.z,s=new ue(0,0,1);s.applyEuler(n),s.setLength(o);let l=new ue;l.setFromMatrixPosition(r),l.sub(s),this.enablePan&&this.setPosition(l.x,l.y),this.enableZoom&&this.setZoomAltitude(o),this.enableRotate&&this.setRotation(-i)});f(this,"makeTransformFromTouchAnchors",(r,n)=>{this.orbit.updateMatrixWorld(),this.camera.updateProjectionMatrix();let o=this.camera.projectionMatrix.clone(),i=r.worldCoordinate,s=n.worldCoordinate,l=r.reUnproject(),c=n.reUnproject();if(!l||!c||!i||!s)return null;let p=r.viewCoordinate,d=n.viewCoordinate,m=s.x-i.x,g=s.y-i.y,x=Math.atan2(g,m),v=c.x-l.x,C=c.y-l.y,I=Math.atan2(C,v),S=P8(x,I),P=new to;P.makeRotationZ(-S);let O=P.clone();O.multiply(r.snapHolderMatrix);let M=(VF,HF,WF)=>VF.elements[(HF-1)*4+WF-1],E=M(o,1,1)*M(O,1,1)-p.x*M(o,3,4)*M(O,3,1),B=M(o,1,1)*M(O,1,2)-p.x*M(o,3,4)*M(O,3,2),j=M(o,1,1)*M(O,1,3)-p.x*M(o,3,4)*M(O,3,3),L=i.x*E+i.y*B+i.z*j,N=M(o,2,2)*M(O,2,1)-p.y*M(o,3,4)*M(O,3,1),X=M(o,2,2)*M(O,2,2)-p.y*M(o,3,4)*M(O,3,2),Z=M(o,2,2)*M(O,2,3)-p.y*M(o,3,4)*M(O,3,3),re=i.x*N+i.y*X+i.z*Z,Q=M(o,1,1)*M(O,1,1)-d.x*M(o,3,4)*M(O,3,1),xe=M(o,1,1)*M(O,1,2)-d.x*M(o,3,4)*M(O,3,2),Ce=M(o,1,1)*M(O,1,3)-d.x*M(o,3,4)*M(O,3,3),ye=s.x*Q+s.y*xe+s.z*Ce,Ee=M(o,2,2)*M(O,2,1)-d.y*M(o,3,4)*M(O,3,1),we=M(o,2,2)*M(O,2,2)-d.y*M(o,3,4)*M(O,3,2),pe=M(o,2,2)*M(O,2,3)-d.y*M(o,3,4)*M(O,3,3),Ae=s.x*Ee+s.y*we+s.z*pe,mt=Math.abs(Q-E),Je=Math.abs(xe-B),ut=Math.abs(Ce-j),qe=Math.abs(Q-N),Te=Math.abs(xe-X),xt=Math.abs(Ce-Z),Pt=Math.abs(Ee-E),nr=Math.abs(we-B),k=Math.abs(pe-j),W=Math.abs(Ee-N),D=Math.abs(we-X),ne=Math.abs(pe-Z),K=Math.min(mt+Je+ut,qe+Te+xt),ee=Math.min(Pt+nr+k,W+D+ne);K<ee&&(Q=Ee,xe=we,Ce=pe,ye=Ae);let Le=N*j-E*Z,Ft=X*j-B*Z,In=re*j-L*Z,Yr=Q*Z-N*Ce,pn=xe*Z-X*Ce,dc=ye*Z-re*Ce,$v=(dc*Ft-In*pn)/(Yr*Ft-Le*pn),zv=(dc*Le-In*Yr)/(pn*Le-Ft*Yr),RT=X*E-B*N,GF=Z*E-j*N,jF=re*E-L*N,BT=xe*N-X*Q,UF=Ce*N-Z*Q,NT=((ye*N-re*Q)*RT-jF*BT)/(UF*RT-GF*BT),Ky=O.clone();return Ky.elements[12]=$v,Ky.elements[13]=zv,Ky.elements[14]=NT,NT>0?Ky:null});f(this,"updateTouchOrigin",()=>{let r=this.renderer.domElement;this.touch.origin.offsetLeft=r.getBoundingClientRect().left,this.touch.origin.offsetTop=r.getBoundingClientRect().top});f(this,"touchToScene",r=>{this.touch.touches=[];for(let n=0,o=r.touches.length;n<o;n++){let i=r.touches[n],s=w8(i,this.touch.origin);this.touch.touches.push(new De(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]});f(this,"canScrollZoom",r=>{let n=BC(r),o=this.getZoomAltitude();return!(n<0&&o===this.getZoomScaledMax()||n>0&&o===this.getZoomScaledMin())});f(this,"mouseToScene",r=>{let n=this.getMousePos(r);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});f(this,"getMousePos",r=>({x:r.offsetX,y:r.offsetY}));f(this,"handleMouseDownRotate",r=>{this.coords.rotateStart.set(r.clientX,r.clientY),this.publish("rotate-start"),this.publish("user-rotate-start")});f(this,"handleMouseDownPan",()=>{let r=this.raycastToFloor(this.coords.mouse);this.coords.panStart.set(r.x,r.y,0),this.coords.panCameraStart.set(this.orbit.position.x,this.orbit.position.y,0),this.publish("pan-start"),this.publish("user-pan-start")});f(this,"handleMouseDownPedestal",r=>{let n=new De(r.clientX,r.clientY);this.coords.initialShiftPos=n,this.coords.initialPedestal=this.getPedestal(),this.pedestalScaleFactor=a2(this.camera.fov,this.renderer.domElement.clientHeight,this.getZoomAltitude()),this.publish("pedestal-start"),this.publish("user-pedestal-start")});f(this,"handleMouseMovePedestal",r=>{let n={x:r.clientX,y:r.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)});f(this,"handleMouseMoveRotate",r=>{this.coords.rotateEnd.set(r.clientX,r.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")});f(this,"publishUserZoomDebounced",Sm(()=>{this.isUserZooming=!1,this.publish("user-zoom-end")},250));f(this,"publishUserZoomEvent",()=>{this.isUserZooming?this.publishUserZoomDebounced():(this.publish("user-zoom-start"),this.isUserZooming=!0,this.publishUserZoomDebounced())});f(this,"setCameraMoving",()=>{this.cameraMoving=!0});f(this,"unsetCameraMoving",()=>{this.cameraMoving=!1,this.lastCameraMoveTime=Date.now()});f(this,"setUserInteracting",()=>{this.userInteracting=!0});f(this,"unsetUserInteracting",()=>{this.userInteracting=!1});f(this,"publishPedestalChangeEvent",r=>{this.publish("pedestal-change",{pedestal:r,scrolledToTop:this.scrolledToTop,scrolledToBottom:this.scrolledToBottom,scrollPercent:this.scrollPercent})});f(this,"convertAltitudeToZoomLevel",r=>{let[,n]=this.center,i=r*2*Math.tan(Xe.degToRad(this.camera.fov)/2)/this.options.canvasHeight,s=Math.cos(Xe.degToRad(n))*2*Math.PI*Xv/i;return Xe.clamp(Math.log2(s/512),Gx,jx)});f(this,"convertZoomLevelToAltitude",r=>{let[,n]=this.center,o=Xe.clamp(r,Gx,jx),i=Math.pow(2,o),s=Xe.clamp(n,NC,GC),l=i*512;return Math.cos(Xe.degToRad(s))*Math.PI*2*Xv/l*this.options.canvasHeight/2/Math.tan(Xe.degToRad(this.camera.fov)/2)});f(this,"completeTween",r=>{r.isPlaying()&&r.stop(),this.rendererState.internalTweenGroup.remove(r),this.tweens.delete(r)});f(this,"debugContainer",new oi);this.camera=r,this.renderer=o,this.rendererState=i,this.scene=n,this.options=s,this.elevation=r.parent,this.orbit=this.elevation.parent,this.cameraPlane=this.createCameraPlane(),this.zoomStart=r.position.z,s.mode!=="outdoors-overlay"&&this.addEventListeners()}get maxZoomLevel(){return this.convertAltitudeToZoomLevel(this.minZoomAltitude)}setMaxZoomLevel(r){this.minZoomAltitude=this.convertZoomLevelToAltitude(r),this.stateDirty=!0}get defaultMinZoomLevel(){return a(this,Hx)}get minZoomLevel(){return this.convertAltitudeToZoomLevel(this.maxZoomAltitude)}setMinZoomLevel(r){this.maxZoomAltitude=this.convertZoomLevelToAltitude(r),this.stateDirty=!0}get scrollPercent(){let r=this.minPedestal,n=this.maxPedestal,o=this.getPedestal();return o=Math.min(o,n),o=Math.max(o,r),(o-r)/(n-r)*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 r=this.getPosition(),{lat:n,lon:o}=yb(this.rendererState.center?.[1]??0,this.rendererState.center?.[0]??0,r.x,r.y);return[o,n]}setCenter(r,n){let{x:o,y:i}=bb(this.rendererState.center?.[1]??0,this.rendererState.center?.[0]??0,n,r);this.setPosition(o,i)}get isAnimating(){return this.rendererState.internalTweenGroup.getAll().some(r=>r.cameraAnimation)}getCameraFrameForCoordinates(r,n){let o=n.minZoom!==void 0?n.minZoom:this.minZoomAltitude,i=n.maxZoom!==void 0?n.maxZoom:this.maxZoomAltitude,s=this.options.canvasWidth,l=this.options.canvasHeight,c=this.getRotation(),p=this.getTilt(),d=this.getPosition();this.setRotation(n.rotation||c,!0),this.setTilt(n.tilt||p,!0);let m=_8(r,{canvasWidth:s,canvasHeight:l,paddingOption:n.padding,verticalPadding:n.verticalPadding,minZoom:o,maxZoom:i,position:d,camera:this.camera,orbit:this.orbit});return this.setRotation(c,!0),this.setTilt(p,!0),{center:m.position,zoomLevel:this.convertAltitudeToZoomLevel(m.zoom)}}focusOn(r,n){if(QQ){this.debugContainer&&Qt(this.debugContainer);let I=new ii(4,4,4),S=new Tr({color:65280,depthTest:!1}),P=new ll(I,S,r.length),O=new to;r.forEach((M,E)=>{O.setPosition(M),P.setMatrixAt(E,O)}),P.instanceMatrix.needsUpdate=!0,this.debugContainer.add(P),this.scene.add(this.debugContainer)}let o=n.curve,i=n.callback,s=n.cancelledCallback,l=n.minZoom!==void 0?n.minZoom:this.minZoomAltitude,c=n.maxZoom!==void 0?n.maxZoom:this.maxZoomAltitude,p=this.options.canvasWidth,d=this.options.canvasHeight,m;n.duration!==void 0?m=n.duration:y.env.TESTING==="true"?m=0:m=VC;let g=n.padding,x=this.getRotation(),v=this.getTilt();n.rotation!=null&&this.setRotation(n.rotation),n.tilt!=null&&this.setTilt(n.tilt);let C=_8(r,{canvasHeight:d,paddingOption:g,canvasWidth:p,minZoom:l,maxZoom:c,camera:this.camera,orbit:this.orbit,position:this.getPosition(),verticalPadding:n.verticalPadding});this.setRotation(x),this.setTilt(v),this.animateCamera({position:C.position,tilt:n.tilt,rotation:n.rotation,zoom:C.zoom},m,o,i,s,n)}resize(r,n){this.options.canvasWidth=r,this.options.canvasHeight=n}};Hx=new WeakMap,f(jp,"CAMERA_FRAME_PADDING_SIDES",["top","bottom","left","right"]);function _8(e,{canvasWidth:t,orbit:r,paddingOption:n,verticalPadding:o=0,canvasHeight:i,minZoom:s,maxZoom:l,camera:c,position:p}){let d={zoom:s,position:p};if(e.length===0)return d;for(let Le of jp.CAMERA_FRAME_PADDING_SIDES)typeof n[Le]!="number"&&(n[Le]=0);let m=n.type==="portion"?{top:n.top*i,bottom:n.bottom*i,left:n.left*t,right:n.right*t,type:"pixel"}:n;if(m.left+m.right>=t||m.top+m.bottom>=i)return d;r.updateMatrixWorld();let g=c.matrixWorldInverse,x=c.fov*(Math.PI/180)/2,v=x,I=Math.atan(Math.tan(x)*(t/i)),S=new ue(1/0,1/0,1/0),P=new ue(-1/0,-1/0,-1/0),O=new vr,M=new ue;for(let Le=0,Ft=e.length;Le<Ft;Le++)M.copy(e[Le]),O.expandByPoint(M),M.applyMatrix4(g),S.min(M),P.max(M),M.copy(e[Le]),M.z-=o,M.applyMatrix4(g),S.min(M),P.max(M),M.copy(e[Le]),M.z+=o,M.applyMatrix4(g),S.min(M),P.max(M);let E=P.x-S.x,B=P.y-S.y,j=t-m.left-m.right,L=i-m.top-m.bottom,N=(P.x+S.x)/2,X=(P.y+S.y)/2,Z=E/j,re=B/L,Q=s,xe=l,Ce=Q*Math.tan(I)*2,ye=xe*Math.tan(I)*2,Ee=Ce/t,we=ye/t,pe=Math.max(Z,re);pe=Xe.clamp(pe,Ee,we);let Ae=j*pe,mt=L*pe,Je={min:{x:N-Ae/2-m.left*pe,y:X-mt/2-m.bottom*pe},max:{x:N+Ae/2+m.right*pe,y:X+mt/2+m.top*pe}},ut=(Je.min.x+Je.max.x)/2,qe=(Je.min.y+Je.max.y)/2,Te=O.getCenter(new ue),xt=Math.abs(ut-Je.min.x),Pt=Math.abs(qe-Je.min.y),nr=xt/Math.tan(I),k=Pt/Math.tan(v),W=new ue;W.set(ut,qe,P.z+Math.max(nr,k)),W.applyMatrix4(c.matrixWorld);let D=new ue;D.set(ut,qe,P.z),D.applyMatrix4(c.matrixWorld);let ne=new ue().subVectors(D,W),K=(Te.z-W.z)/ne.z,ee=new ue().copy(W).add(ne.clone().multiplyScalar(K));return D.set(ee.x,ee.y,ee.z),W.sub(D),{position:ee,zoom:W.length()}}u();var eee=300,Cg,Tg,Wx=class{constructor(t){f(this,"state");T(this,Cg,new ue);T(this,Tg,new ue);this.state=t}update(t){let r,n;this.state.cameraObject.getWorldPosition(a(this,Tg));for(let o of this.state.geometry2DIdsInScene)if(r=this.state.geometry2DMap.get(o),r&&(n=r.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{r.object3d.getWorldPosition(a(this,Cg));let i=a(this,Tg).distanceTo(a(this,Cg));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=t?"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:eee,easing:"ease-in-out",fill:"forwards"}),n.visibilityNeedsUpdate=!1)}}};Cg=new WeakMap,Tg=new WeakMap;u();var $x=class extends Fe{constructor(r,n){super();f(this,"state");f(this,"dirty",!0);f(this,"domTree");f(this,"observers",new Map);f(this,"updateDimensions",r=>{r.forEach(n=>{let i=n.target.parentElement?.getAttribute("data-marker-id");if(i){let s=this.state.geometry2DMap.get(i),l=s?.components[0];s&&l instanceof ws&&(l.updateDimensions(n.contentRect.width,n.contentRect.height),l.collisionDirty=!0)}}),this.publish("dimensions-update")});this.state=r,this.domTree=n}setupObserver(){if(this.observers){for(let o of this.observers.values())o.disconnect();this.observers.clear()}let r,n;for(let o of this.domTree.children){let i=o.getAttribute("data-marker-id");if(i!=null&&(r=this.state.geometry2DMap.get(i),n=r.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 r of this.observers.values())r.disconnect();this.observers.clear()}};u();var tee=0,ree=90,nee=(y.env.NODE_ENV==="test",!1),Fs={linear:Kn.Linear.None,"ease-in":Kn.Quadratic.In,"ease-out":Kn.Quadratic.Out,"ease-in-out":Kn.Quadratic.InOut},oee=-50,me,Oe,Ua,Mg,Pg,$C,zx=class{constructor(t,r,n){T(this,Pg);T(this,me);T(this,Oe);T(this,Ua);T(this,Mg);w(this,me,t),w(this,Oe,r),w(this,Ua,n),a(this,me).map&&a(this,me).map.transform.setMinElevationForCurrentTile(oee),a(this,Oe).cameraSystem.on("pedestal-change",({pedestal:o})=>{a(this,Oe).cameraSystem.setCameraPlaneElevation(o)})}get center(){return a(this,me).mode==="outdoors-overlay"&&a(this,me).map?a(this,me).map.getCenter?.().toArray():a(this,Oe).cameraSystem.center}setCenter(t){if(a(this,me).mode==="outdoors-overlay"&&a(this,me).map){a(this,me).map?.setCenter(t),a(this,Oe).interactionSystem.handleHover();return}a(this,Oe).cameraSystem.setCenter(t[0],t[1]),a(this,Oe).interactionSystem.handleHover()}get zoomLevel(){return a(this,me).mode==="outdoors-overlay"&&a(this,me).map?a(this,me).map?.getZoom():a(this,Oe).cameraSystem.getZoomLevel()}setZoomLevel(t){a(this,me).mode==="outdoors-overlay"&&a(this,me).map&&a(this,me).map?.setZoom(t),a(this,Oe).cameraSystem.setZoomLevel(Yi(t,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,Oe).cameraSystem.isAnimating}cancelAnimation(){a(this,Oe).cameraSystem.cancelAnimation()}get maxZoomLevel(){return a(this,Oe).cameraSystem.maxZoomLevel}get minZoomLevel(){return a(this,Oe).cameraSystem.minZoomLevel}setAutoMinZoomLevel(t){a(this,Oe).panBoundsSystem.autoMinZoomLevel=t,t&&(a(this,Oe).panBoundsSystem.dirty=!0,a(this,Oe).panBoundsSystem.update())}get autoMinZoomLevel(){return a(this,Oe).panBoundsSystem.autoMinZoomLevel}setMinZoomLevel(t,r=!1){r&&this.setAutoMinZoomLevel(!1);let n=Yi(t,ki.MIN_MERCATOR_ZOOM_LEVEL,this.maxZoomLevel,`setMinZoomLevel was clamped. minZoomLevel must be between ${ki.MIN_MERCATOR_ZOOM_LEVEL} and maxZoomLevel.`);a(this,Oe).cameraSystem.setMinZoomLevel(n),this.zoomLevel<n&&this.setZoomLevel(n),a(this,me).map?.setMinZoom(n)}setMaxZoomLevel(t){let r=Yi(t,this.minZoomLevel,ki.MAX_MERCATOR_ZOOM_LEVEL,`setMaxZoomLevel was clamped. maxZoomLevel must be between minZoomLevel and ${ki.MAX_MERCATOR_ZOOM_LEVEL}.`);a(this,Oe).cameraSystem.setMaxZoomLevel(r),this.zoomLevel>r&&this.setZoomLevel(r),a(this,me).map?.setMaxZoom(r)}get maxPitch(){return a(this,me).mode==="outdoors-overlay"&&a(this,me).map?a(this,me).map?.getMaxPitch?.():Xe.radToDeg(a(this,Oe).cameraSystem.maxTilt)}get minPitch(){return a(this,me).mode==="outdoors-overlay"&&a(this,me).map?a(this,me).map?.getMinPitch?.():Xe.radToDeg(a(this,Oe).cameraSystem.minTilt)}setMinPitch(t){let r=Math.max(tee,t);a(this,me).map?.setMinPitch(r),a(this,Oe).cameraSystem.minTilt=Xe.degToRad(r)}setMaxPitch(t){let r=Math.min(ree,t);a(this,me).map?.setMaxPitch(r),a(this,Oe).cameraSystem.maxTilt=Xe.degToRad(r)}get bearing(){return a(this,me).mode==="outdoors-overlay"&&a(this,me).map?a(this,me).map?.getBearing():Xe.radToDeg(a(this,Oe).cameraSystem.getRotation())}setBearing(t){if(a(this,me).mode==="outdoors-overlay"&&a(this,me).map){a(this,me).map?.setBearing(t);return}a(this,Oe).cameraSystem.setRotation(Xe.degToRad(t))}get pitch(){return a(this,me).mode==="outdoors-overlay"&&a(this,me).map?a(this,me).map?.getPitch():Xe.radToDeg(a(this,Oe).cameraSystem.getTilt())}setPitch(t){if(a(this,me).mode==="outdoors-overlay"&&a(this,me).map){a(this,me).map?.setPitch(t);return}a(this,Oe).cameraSystem.setTilt(Xe.degToRad(Yi(t,this.minPitch,this.maxPitch,"pitch was clamped to minPitch/maxPitch bounds. Use mapView.Camera.setMinPitch() and mapView.Camera.setMaxPitch() to adjust limits.")))}get elevation(){return a(this,Oe).cameraSystem.getPedestal()}setElevation(t){a(this,Oe).cameraSystem.setPedestal(t,!0)}animateElevation(t,r){return a(this,Mg)&&a(this,Mg).stop(),new Promise(n=>{a(this,Oe).cameraSystem.animateCamera({position:{z:t}},r?.duration||300,Fs[r?.easing||"ease-in-out"],n,n,{interruptible:r?.interruptible??!0})})}get insetsPadding(){return a(this,Ua).insetsPadding}get panMode(){return a(this,Oe).cameraSystem.enablePan===!1&&a(this,Oe).cameraSystem.enablePedestal===!0?"elevation":"default"}setPanMode(t){if(t!=="default"&&t!=="elevation")throw new Error("Invalid pan mode");t!==this.panMode&&(t==="default"?(a(this,Oe).cameraSystem.enablePan=!0,a(this,Oe).cameraSystem.enablePedestal=!1):(a(this,Oe).cameraSystem.enablePan=!1,a(this,Oe).cameraSystem.enablePedestal=!0))}setInsetPadding(t){a(this,Ua).insetsPadding=Object.assign({},a(this,Ua).insetsPadding,t)}animateTo(t){if(a(this,me).mode==="outdoors-overlay"&&a(this,me).map)return a(this,me).map?.flyTo({center:t.center??this.center,zoom:t.zoomLevel??this.zoomLevel,bearing:t.bearing??this.bearing,pitch:t.pitch??this.pitch,duration:t.duration??600}),Promise.resolve();let r=t.center?a(this,me).convertTo3DMapPosition(t.center[1],t.center[0],t.center[2]||this.elevation):void 0,n=t.zoomLevel!==void 0?a(this,Oe).cameraSystem.convertZoomLevelToAltitude(Yi(t.zoomLevel,this.minZoomLevel,this.maxZoomLevel,"zoomLevel was clamped to minZoomLevel/maxZoomLevel bounds. Use mapView.Camera.setMinZoomLevel() and mapView.Camera.setMaxZoomLevel() to adjust limits.")):void 0,o=t.bearing!==void 0?Xe.degToRad(t.bearing):void 0,i=t.pitch!==void 0?Xe.degToRad(Yi(t.pitch,this.minPitch,this.maxPitch,"pitch was clamped to minPitch/maxPitch bounds. Use mapView.Camera.setMinPitch() and mapView.Camera.setMaxPitch() to adjust limits.")):void 0;return new Promise(s=>{a(this,Oe).cameraSystem.animateCamera({position:r,zoom:n,rotation:o,tilt:i},t.duration||0,Fs[t.easing||"ease-in-out"],()=>{a(this,Oe).interactionSystem.handleHover(),s()},s,{interruptible:t?.interruptible??!0})})}getCameraFrameForCoordinates(t,r){let n=z(this,Pg,$C).call(this,r||{},()=>Promise.resolve()),{pointCloud:o}=E8(t,a(this,me),a(this,Ua).geometry3DMap);if(o.length===0)return A.error("No valid coordinates found in targets:",t),{center:this.center,zoomLevel:this.zoomLevel};let{center:i,zoomLevel:s}=a(this,Oe).cameraSystem.getCameraFrameForCoordinates(o,n);return{center:a(this,me).convert3DMapPositionToCoordinate(i),zoomLevel:s}}focusOn(t,r){let{pointCloud:n,geoBounds:o,firstPosition:i}=E8(t,a(this,me),a(this,Ua).geometry3DMap);return n.length===0?(A.error("No valid coordinates found in targets:",t),Promise.resolve()):a(this,me).mode==="outdoors-overlay"&&a(this,me).map?(n.length===1&&i?a(this,me).map?.flyTo({center:[i[0],i[1]],duration:r?.duration||a(this,me).map.getBearing(),animate:!0,bearing:r?.bearing===void 0?a(this,me).map.getBearing():r?.bearing,pitch:r?.pitch===void 0?a(this,me).map.getPitch():r?.pitch,zoom:r?.maxZoomLevel||a(this,me).map.getMaxZoom()}):(nee&&iee(a(this,me),o),a(this,me).map?.fitBounds(o,{duration:r?.duration??ki.DEFAULT_ANIMATION_DURATION,bearing:r?.bearing===void 0?a(this,me).map.getBearing():r?.bearing,pitch:r?.pitch===void 0?a(this,me).map.getPitch():r?.pitch,maxZoom:r?.maxZoomLevel??a(this,me).map.getMaxZoom()})),a(this,Oe).interactionSystem.handleHover(),Promise.resolve()):new Promise(s=>{a(this,Oe).cameraSystem.focusOn(n,z(this,Pg,$C).call(this,r||{},s))})}};me=new WeakMap,Oe=new WeakMap,Ua=new WeakMap,Mg=new WeakMap,Pg=new WeakSet,$C=function(t,r){return{minZoom:t?.maxZoomLevel===void 0?void 0:a(this,Oe).cameraSystem.convertZoomLevelToAltitude(Yi(t.maxZoomLevel,this.minZoomLevel,this.maxZoomLevel,"maxZoomLevel was clamped to minZoomLevel/maxZoomLevel bounds. Use mapView.Camera.setMaxZoomLevel() to adjust limits.")),maxZoom:t?.minZoomLevel===void 0?void 0:a(this,Oe).cameraSystem.convertZoomLevelToAltitude(Yi(t.minZoomLevel,this.minZoomLevel,this.maxZoomLevel,"minZoomLevel was clamped to minZoomLevel/maxZoomLevel bounds. Use mapView.Camera.setMinZoomLevel() to adjust limits.")),padding:t?.padding?Object.assign({},mb,t?.padding):this.insetsPadding,curve:Fs[t?.easing||"ease-in-out"],rotation:t?.bearing===void 0?void 0:Xe.degToRad(t.bearing),tilt:t?.pitch!==void 0?Xe.degToRad(Yi(t.pitch,this.minPitch,this.maxPitch,"pitch was clamped to minPitch/maxPitch bounds. Use mapView.Camera.setMinPitch() and mapView.Camera.setMaxPitch() to adjust limits.")):void 0,duration:t?.duration,callback:()=>{a(this,Oe).interactionSystem.handleHover(),r()},cancelledCallback:r,interruptible:t?.interruptible??!0,verticalPadding:t?.verticalPadding}};function WC(e,t){e[0]=Math.min(e[0],t[0]),e[1]=Math.min(e[1],t[1]),e[2]=Math.max(e[2],t[0]),e[3]=Math.max(e[3],t[1])}function E8(e,t,r){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=t.getSystems().renderSystem;(s.threeDdirty||s.twoDdirty)&&t.renderSync();for(let l of e)if(typeof l=="string"){let c=r.get(l);if(!c){A.error("Entity not found with id:",l);continue}let p=new vr;P5(t,"userData"in c?c.userData.entityId??c.id:c.id,n,p,c instanceof kt?c.position.z:void 0);let d=t.convert3DMapPositionToCoordinate(p.min),m=t.convert3DMapPositionToCoordinate(p.max);WC(o,d),WC(o,m),i||(i=t.convert3DMapPositionToCoordinate(p.getCenter(new ue)))}else n.push(t.convertTo3DMapPosition(l[1],l[0],l[2]||0)),WC(o,l),i||(i=l);return{pointCloud:n,geoBounds:o,firstPosition:i}}function iee(e,t){let r=[[t[0],t[1]],[t[0],t[3]],[t[2],t[3]],[t[2],t[1]],[t[0],t[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:r}}}),e.map?.addLayer({id:"bounds-outline",type:"line",source:"bounds-source",layout:{},paint:{"line-color":"#FF0000","line-width":2,"line-opacity":.8}})}u();u();var D8=`uniform vec4 uSize;
|
|
202
|
+
`;var wq=-.05,Oq=1,kp=class extends xo{constructor(r,n,o=1){super(r);f(this,"propertiesTexture");f(this,"uniforms",{uGradientIntensity:{value:0},uGradientEnd:{value:0},uGradientStart:{value:0},uTopTexture:{value:null},uTexture:{value:null},uRepeatYFactor:{value:1},uBlendTexture:{value:!1}});f(this,"colorSpace",mc);f(this,"showTextures",r=>{let n=!!this.uniforms.uTexture.value,o=!!this.uniforms.uTopTexture.value;(n||o)&&(this.propertiesTexture.setTexture(r,n,o),this.needsUpdate=!0)});this.alphaTest=.01,this.propertiesTexture=new ux(n),this.uniforms.uRepeatYFactor.value=o,this.onBeforeCompile=i=>{let s=this.uniforms.uGradientIntensity,l=this.uniforms.uGradientEnd,c=this.uniforms.uGradientStart,p=this.uniforms.uTopTexture,d=this.uniforms.uTexture,m=this.uniforms.uRepeatYFactor,g=this.uniforms.uBlendTexture;this.uniforms=i.uniforms,i.vertexShader=FE,i.fragmentShader=kE,Object.assign(this.uniforms,{uGradientIntensity:s,uGradientEnd:l,uGradientStart:c,uMinSideAlpha:{value:wq},uMaxSideAlpha:{value:Oq},uPropertiesTexture:{value:this.propertiesTexture},uTopTexture:p,uTexture:d,uRepeatYFactor:m,uBlendTexture:g})}}get repeatYFactor(){return this.uniforms.uRepeatYFactor.value}set repeatYFactor(r){r!==this.uniforms.uRepeatYFactor.value&&(this.uniforms.uRepeatYFactor.value=r,this.needsUpdate=!0)}get texture(){return this.uniforms.uTexture.value}set texture(r){r.wrapS=$i,r.wrapT=$i,r.colorSpace=this.colorSpace,this.uniforms.uTexture.value=r}get topTexture(){return this.uniforms.uTopTexture.value}set topTexture(r){r.wrapS=$i,r.wrapT=$i,r.colorSpace=this.colorSpace,this.uniforms.uTopTexture.value=r}get blendTexture(){return this.uniforms.uBlendTexture.value}set blendTexture(r){r!==this.uniforms.uBlendTexture.value&&(this.uniforms.uBlendTexture.value=r,this.colorSpace=r?UT:mc,this.texture&&(this.texture.colorSpace=this.colorSpace),this.topTexture&&(this.topTexture.colorSpace=this.colorSpace),this.needsUpdate=!0)}setGradientShading(r,n,o){this.uniforms.uGradientStart.value=r,this.uniforms.uGradientEnd.value=n,this.uniforms.uGradientIntensity.value=o}getGradientShading(){return{start:this.uniforms.uGradientStart.value,end:this.uniforms.uGradientEnd.value,intensity:this.uniforms.uGradientIntensity.value}}setColor(r,n,o){this.propertiesTexture.setColor(r,n,o)}getColor(r){return this.propertiesTexture.getColor(r)}hideTextures(r){let n=!!this.uniforms.uTexture.value,o=!!this.uniforms.uTopTexture.value;(n||o)&&(this.propertiesTexture.setTexture(r,!1,!1),this.needsUpdate=!0)}removeSideTexture(r){if(this.texture){this.texture.dispose(),this.uniforms.uTexture.value=null;let n=!!this.uniforms.uTopTexture.value;this.propertiesTexture.setTexture(r,!1,n),this.needsUpdate=!0}}removeTopTexture(r){if(this.topTexture){this.topTexture.dispose(),this.uniforms.uTopTexture.value=null;let n=!!this.uniforms.uTexture.value;this.propertiesTexture.setTexture(r,n,!1),this.needsUpdate=!0}}dispose(){super.dispose(),this.propertiesTexture.dispose()}};u();function AE(e,t){let r=0;for(let p of e)r+=p.components[0]?.geometry?.attributes.position.count||0;let n=new Nt(t.color),o;o=new kp({color:n,side:t.side==="back"?ym:t.side==="front"?fc:ni,opacity:t.opacity??1,transparent:t.opacity!==void 0?t.opacity<1:!1,polygonOffset:!0,polygonOffsetFactor:1,polygonOffsetUnits:1},e.length);let i=new fb(e.length,r,0,o);i.renderOrder=0;let s,l,c;for(let p of e)s=p.components[0],!(!(s instanceof or)||!s.geometry)&&(s.mesh=i,s.material=o,s.instanceIndex=i.addGeometry(s.geometry),i.addInstance(s.instanceIndex),i.userData.entities[s.instanceIndex]=p.id,o instanceof kp&&o.setColor(s.instanceIndex,n,t.topColor?new Nt(t.topColor):n),l=i.getGeometryIdAt(s.instanceIndex),s.batchedProps&&(c=i.getGeometryRangeAt(l),c&&(s.batchedProps.range=c),s.batchedProps.geometryId=l));return i.perObjectFrustumCulled=!0,i.matrixAutoUpdate=!1,i}function ig(e){return de(e).darken(30).toRgbString()}function LE(e,t,r,n){if(t.length<1)return;e.boundingBox||e.computeBoundingBox();let o=e.boundingBox,i=e.getAttribute("position"),s=e.getAttribute("normal"),l=e.getAttribute("uv"),c,p;e.index?(c=e.index.count/3,p=function(O,M){return e.index.getX(O*3+M)}):(c=i.count/3,p=function(O,M){return O*3+M});let d=new to;d.makeRotationFromQuaternion(new hc().setFromEuler(new Xs(0,0,r/180*Math.PI)));let m=t.find(O=>O.face==="top"),g;m&&(g={min:n(m.bounds[1],m.bounds[0],0),max:n(m.bounds[3],m.bounds[2],o.max.z)});let x=t.find(O=>O.face==="side"),v;if(x&&(v={min:n(x.bounds[1],x.bounds[0],0),max:n(x.bounds[3],x.bounds[2],o.max.z)}),!(!v&&!g))for(let O=0;O<c;++O){let M=s.getX(p(O,0))+s.getX(p(O,1))+s.getX(p(O,2)),E=s.getY(p(O,0))+s.getY(p(O,1))+s.getY(p(O,2)),B=s.getZ(p(O,0))+s.getZ(p(O,1))+s.getZ(p(O,2)),j=Math.abs(M),L=Math.abs(E),N=Math.abs(B);var C,I;j<=L&&j<=N?(C="x",L<=N?I="y":I="z"):L<=j&&L<=N?(C="y",j<=N?I="x":I="z"):(C="z",j<=L?I="x":I="y"),C==="z"&&(C=I,I="z");let X,Z,re,Q,xe,Ce;if(I==="z"||C==="z"){if(!x||!v)continue;X=x.repeat.u,Z=x.repeat.v,re=x.offset.u,Q=x.offset.v,xe=x.rotation,Ce=v}else{if(!m||!g)continue;X=m.repeat.u,Z=m.repeat.v,re=m.offset.u,Q=m.offset.v,xe=(360-r+m.rotation)%360,Ce=g}let{min:ye,max:Ee}=Ce,we=new oi;we.position.set(ye.x,ye.y,0),we.updateMatrix(),we.updateMatrixWorld();let pe=ye.clone().applyMatrix4(d),Ae=Ee.clone().applyMatrix4(d),mt=Math.abs(Ae.x-pe.x),Je=Math.abs(Ae.y-pe.y),ut=new ue(mt,Je,Ee.z).applyMatrix4(we.matrixWorld),qe=Math.abs(ut[C]-ye[C]),Te=Math.abs(ut[I]-ye[I]),xt=xe*Math.PI/180||0,Pt=Math.cos(xt),nr=Math.sin(xt),k=we.matrixWorld.clone().invert(),W=new hc().setFromEuler(new Xs(0,0,r/180*Math.PI));for(let D=0;D<3;D++){let K=new ue(i.getX(p(O,D)),i.getY(p(O,D)),i.getZ(p(O,D))).applyMatrix4(k);K.applyQuaternion(W);let ee=K.applyMatrix4(we.matrixWorld),Le=ee.x,Ft=ee.y,In=ee.z;var S,P;C==="x"?S=X*(Le-ye[C])/qe+re:C==="y"?S=X*(Ft-ye[C])/qe+re:S=X*(In-ye[C])/qe+re,I==="x"?P=Z*(Le-ye[I])/Te+Q:I==="y"?P=Z*(Ft-ye[I])/Te+Q:P=Z*(In-ye[I])/Te+Q,S-=.5,P-=.5;let Yr=S*Pt-P*nr+.5,pn=S*nr+P*Pt+.5;l.setX(p(O,D),Yr),l.setY(p(O,D),pn)}}}u();var ja=class{constructor(){f(this,"focusMesh");f(this,"dirty",!0)}};function $r(e,t,r){if(t!==void 0){if(e.type==="model"||e.type==="path"||e.type==="marker"||e.type==="label"||e.type==="geometry"||e.type==="group-container"||e.type==="custom-geometry")return t===!0?(e instanceof xc&&e.components[1]===void 0?(e.components[1]=new Mf,e.components[1].dirty=!0):e instanceof Ke&&e.components[2]===void 0?(e.components[2]=new Mf,e.components[2].dirty=!0):e instanceof kt&&e.components[0]===void 0&&(e.components[0]=new Mf,e.components[0].dirty=!0),!0):(e instanceof xc?e.components[1]=void 0:e instanceof Ke?e.components[2]=void 0:e instanceof kt&&(e.components[0]=void 0),!0);if(e.type==="geometry-group"){let n;for(let o of e.userData.entities3D.values())n=r.geometry3DMap.get(o),$r(n,t,r);return!0}}return!1}function RE(e,t,r){if(!(!r?.color&&!("topColor"in r))){if(r!==void 0&&e.type==="geometry-group"){let n;for(let o of e.userData.entities3D.values())n=t.geometry3DMap.get(o),n&&fx(n,r);return!0}return!1}}function Dq(e,t){t!==void 0&&e.type==="geometry"&&(e.components[1].shading=t,e.components[1].dirty=!0)}function BE(e,t,r){if(r!==void 0&&e.type==="geometry-group"){for(let n of e.userData.entities3D.values()){let o=t.geometry3DMap.get(n);o&&Dq(o,r)}return!0}return!1}function NE(e,t){t!==void 0&&e.type==="geometry"&&(t.showImage!==void 0&&(e.components[1].showImage=t.showImage),t.flipImageToFaceCamera!==void 0&&(e.components[1].flipImageToFaceCamera=t.flipImageToFaceCamera))}function dx(e,t,r){if(r!==void 0){if(e.type==="geometry"){let n=e.components[1];if(n.height!==r)return n.height=r,n.dirty=!0,e.components[3]&&(e.components[3].dirty=!0),!0}else if(e.type==="geometry-group"){for(let n of e.userData.entities3D.values()){let o=t.geometry3DMap.get(n);(o?.type==="geometry"||o?.type==="model")&&dx(o,t,r)}return!0}}return!1}function fx(e,t){if(t!==void 0){let r=!1;(e.type==="path"||e.type==="geometry")&&(t.initialColor!==void 0&&t.initialColor!==e.components[1].initialColor&&(e.components[1].initialColor=t.initialColor,r=!0),t.color!==void 0&&t.color!==e.components[1].color&&(e.components[1].color=t.color,r=!0,e.components[3]&&(e.components[3].color=ig(t.color),e.components[3].dirty=!0)),"topColor"in t&&(e.components[1].topColor=t.topColor,r=!0),r&&(e.components[1].dirty=!0))}}function vC(e,t,r){t!==void 0&&(e.type==="label"||e.type==="marker"?e.updatePosition(r(t[1],t[0],t[2]||0)):e.type==="custom-geometry"&&e.components[0].position.copy(r(t[1],t[0],t[2]||0)))}function IC(e,t){return t!==void 0&&(e.type==="marker"||e.type==="label"||e.type==="custom-geometry")&&e.parentObject3D!==t&&e.parentObject3D instanceof kt?(e.parentObject3D?.removeEntity(e),t.addEntity(e),!0):!1}function GE(e,t){t!==void 0&&(e.type==="marker"||e.type==="label")&&e.components[0].enabled!==t&&(e.components[0].enabled=t)}function jE(e,t,r){if(t!==void 0&&e.type==="marker"){let n=e.components[0];if(t.contentHTML!==void 0)return n.containerEl.innerHTML=t.contentHTML,n.contentHtml=t.contentHTML,!0;if(t.placement!==void 0&&(n.options.placement=t.placement,n.collisionDirty=!0),t.dynamicResize!==void 0)return n.options.dynamicResize=t.dynamicResize,!0;if(t.options!=null){try{Q3.parse(t.options||{})}catch(o){return A.error(o),!1}return t.options.interactive!=null&&(t.options.interactive==="pointer-events-auto"?(n.pointerEvents="auto",$r(e,!1,r)):(n.pointerEvents="none",$r(e,t.options.interactive,r))),UE(e,t.options.rank),!0}}return!1}function UE(e,t){return t!==void 0&&(e.type==="marker"||e.type==="label")?(e.components[0].rank=xf(t),!0):!1}function VE(e,t,r){if(t!==void 0&&e.type==="label"){let n=e.components[0];t.text!==void 0&&t.text!==n.text&&(n.text=t.text,n.textDirty=!0);try{fC(t.options??{})}catch(o){A.error(o);return}CE(n.appearance,t.options?.appearance||{})&&(n.textDirty=!0),TE(n.appearance,t.options?.appearance||{})&&(n.markerDirty=!0),F5(n.appearance,t.options?.appearance||{}),$r(e,t.options?.interactive,r),UE(e,t.options?.rank)}}function HE(e,t){t!==void 0&&e.type==="geometry"&&(e.components[1].hoverColor=t,e.components[1].dirty=!0)}function WE(e,t){if(t!==void 0){let r=e.components[2];if(e.type==="geometry"&&r!=null)return r.hover=t,r.dirty=!0,!0}return!1}function SC(e,t){t!==void 0&&e.type==="image"&&(e.components[1].flipImageToFaceCamera=t)}function _s(e,t,r){if(r!==void 0)if(e.type==="model"||e.type==="path"||e.type==="geometry"||e.type==="custom-geometry"||e.type==="image"||e.type==="text3d"){r!==e.components[1].visible&&(e.components[1].visible=r,e.components[1].dirty=!0);let n=e.components[3];return n&&(n.dirty=!0),!0}else{if(e.type==="geometry-group")return e.setVisible(r),!0;if(e.type==="group-container"){if(e.visible!==r)return e.setVisible(r),r===!1&&e.traverse(n=>{if(n instanceof S5){let o=t.geometry2DMap.get(n.userData.entityId);if(o){let i=o.components[0];i instanceof Os&&(i.canShow=r)}}}),!0}else if(e.type==="label")return e.components[0].visible=r,!0}return!1}function sg(e,t,r){if(r!==void 0)if(e.type==="geometry-group"){for(let n of e.userData.entities3D.values()){let o=t.geometry3DMap.get(n);(o?.type==="geometry"||o?.type==="model")&&sg(o,t,r)}return!0}else if(e.type==="group-container"){if(e.opacity!==r){e.setOpacity(r);let n=1;return e.parent instanceof kt&&(n=e.parent.opacity),$E(e,t,n),!0}}else e instanceof Ke&&e.components[1].opacity!==r&&(e.components[1].opacity=r,e.components[1].dirty=!0);return!1}function $E(e,t,r=1){if(e.type==="group-container"&&"children"in e&&e.children.length>0){let n=r*e.opacity;e.userData.computedOpacity=n;for(let o of e.children)(o instanceof ro&&o.type==="geometry-group"||o instanceof kt&&o.type==="group-container")&&$E(o,t,n)}else if(e.type==="geometry-group")for(let n of e.userData.entities3D.values()){let o=t.geometry3DMap.get(n),i;(o?.type==="geometry"||o?.type==="model")&&(i=o.components[1],i.dirty=!0)}}function zE(e,t,r){if(r!==void 0&&e.type==="geometry-group")for(let n of e.userData.entities3D.values()){let o=t.geometry3DMap.get(n);o&&CC(o,r)}}function CC(e,t){if(e.type==="geometry"){let r=!1,n=e.components[1];if(t?.texture!=null&&n.texture!==t?.texture&&(n.texture=t.texture,r=!0),t?.topTexture!=null&&n.topTexture!==t?.topTexture&&(n.topTexture=t.topTexture,r=!0),r&&e.components[0]instanceof or){let o=e.components[0];return o.detached===!1&&(o.detached=!0,o.dirty=!0),e.components[1].dirty=!0,!0}}return!1}function XE(e,t){if(t!==void 0&&e.type==="geometry"){let r=e.components[1];if(r.opacity!==t){r.opacity=t;let n=e.components[0],o=e.components[3];o&&(o.dirty=!0),n.detached===!1&&(n.detached=!0,n.dirty=!0),r.dirty=!0;let i=e.parentObject3D;return i?.type==="geometry-group"&&(i.userData.shadingDirty=!0),!0}}return!1}function kf(e,t){if(t!==void 0)if(e.type==="geometry"||e.type==="path"||e.type==="custom-geometry"){let r=e.components[1];if(r.altitude!==t)return r.altitude=t,r.dirty=!0,e.components[3]&&(e.components[3].dirty=!0),!0}else{if(e.type==="group-container"&&e.altitude!==t)return e.setAltitude(t),!0;if(e.type==="geometry-group"&&e.altitude!==t)return e.setAltitude(t),!0}return!1}function mx(e,t,r){if(r!==void 0){if(e.type==="geometry-group")for(let n of e.userData.entities3D.values()){let o=t.geometry3DMap.get(n);o instanceof Ke&&mx(o,t,r)}else if(e.type==="geometry"){let n=e.components[3],o=e.components[1];!n&&r===!0?e.components[3]=new Ff(ig(o.color)):n&&(n.enabled=r,n.dirty=!0)}return!0}return!1}function hx(e,t){if(t!==void 0){let r,n=4;if(e.type==="geometry"?(r=e.components[4],n=4):e.type==="group-container"&&(r=e.components[1],n=1),t===!0&&r==null)return e.components[n]=new ja,!0;if(t===!1&&r!=null)return e.components[n]=void 0,!0}return!1}function ZE(e,t){if(t!==void 0&&e.type==="geometry"){let r=e.components[1];if(r.renderOrder!==t){r.renderOrder=t;let n=e.components[0];return n.detached===!1&&(n.detached=!0,n.dirty=!0),n.imageMesh&&(n.imageMesh.renderOrder=t+1),r.dirty=!0,!0}}return!1}function gx(e,t,r){if(r!=null){if(e.type==="geometry"){let n=e.components[1];n.side!==r&&(n.side=r,n.dirty=!0)}else if(e.type==="geometry-group")for(let n of e.userData.entities3D.values()){let o=t.geometry3DMap.get(n);o instanceof Ke&&gx(o,t,r)}}}function YE(e,t,r){let{visible:n,color:o}=r;if(e.type!=="path")return;let i=e.components[0];n!=null&&_s(e,t,n),o!=null&&fx(e,{color:o}),Object.assign(i,TC(r)),O5(r)||(i.materialDirty=!0,r.width!=null&&(i.dirty=!0))}function TC(e){return gb(e,Fq)}var Fq=["animateArrowsOnPath","displayArrowsOnPath","width","accentColor","completeFraction","dashed","visibleThroughGeometry"];function JE(e){if(!(e instanceof Ke&&e.type==="text3d"))throw new Error("expect target is TextGeometry3D")}var qE=["visible","color","strokeWidth","outlineOffsetX","outlineOffsetY","outlineWidth","outlineBlur","outlineOpacity","outlineColor","strokeWidth","strokeColor","strokeOpacity","maxWidth","maxHeight","font","hoverColor","fillOpacity","fontSize","flipToFaceCamera"];function KE(e,t,r){_s(e,t,r.visible);let n=e.components[1],o=gb(r,qE);"margin"in r&&A.warn("update to margin is not supported atm"),"content"in r&&A.warn("content update is not supported atm");try{px.parse(o)}catch(i){A.error(i);return}Object.keys(o).length>0&&(Object.assign(n,o),n.dirty=!0)}var kq=["color","material","opacity","verticalOffset","rotation","position","scale"];function QE(e,t){let r=gb(t,kq),n=e.components[1],o=e.components[0];Object.keys(r).length>0&&(r.material&&(n.material=r.material),r.opacity!=null&&(n.opacity=r.opacity),r.visible!=null&&(n.visible=r.visible),r.verticalOffset!=null&&(n.verticalOffset=r.verticalOffset),r.color!=null&&(n.color=r.color),r.position!=null&&(o.feature.geometry.coordinates=r.position,o.positionDirty=!0),r.rotation!=null&&(n.rotation=r.rotation),r.scale!=null&&(n.scale=r.scale),n.dirty=!0)}var Ap,Es,yx,$l,e8,lg,bx,t8,r8,cg,xx,pg,ug,vx,ag=class{constructor(t){T(this,$l);T(this,Ap,null);T(this,Es);f(this,"getCurrentSceneGLTF",async t=>{let r={onlyVisible:!0,binary:!0,light:!0,scale:1,...t},n=await z(this,$l,e8).call(this),o=a(this,yx).call(this,r),i=await n.parseAsync(o,{trs:!1,maxTextureSize:1/0,onlyVisible:r.onlyVisible,binary:r.binary,scale:r.scale}),s;if(i instanceof ArrayBuffer)s=new Blob([i],{type:"application/octet-stream"});else{let l=JSON.stringify(i,null,2);s=new Blob([l],{type:"text/plain"})}return s});T(this,yx,t=>{let{scale:r,light:n,onlyVisible:o}=t,i=new al,s=new vr().setFromObject(a(this,Es).entityScene);if(a(this,lg).call(this,a(this,Es).entityScene,i,o),n){let l=new lb(16777215,.3*Math.PI);l.position.set(0,Math.max(s.max.x,s.max.y)*r*.5,s.max.y*r*4),l.lookAt(0,0,-1),l.target.position.set(0,0,-1),l.add(l.target),i.add(l)}return i});T(this,lg,(t,r,n)=>{t.material&&(t instanceof ib?z(this,$l,t8).call(this,t).forEach(o=>r.add(o)):t instanceof du&&r.add(z(this,$l,r8).call(this,t))),t.children.forEach(o=>{(!n||o.visible)&&a(this,lg).call(this,o,r,n)})});T(this,bx,(t,r,n)=>{let o=new e5({color:new Nt(t),metalness:0});return o.opacity=r,o.transparent=n,o});T(this,cg,t=>{let{geometry:r,material:n,position:o,rotation:i,quaternion:s,scale:l}=t;if(!r?.isBufferGeometry)return t;let c=r.attributes.position,p=r.attributes.normal,d=r.attributes.uv;return a(this,xx).call(this,c,p),a(this,ug).call(this,o,l,i,s),d&&a(this,vx).call(this,d),n?.map&&r.type==="PlaneGeometry"&&(t.side=ni),t});T(this,xx,(t,r)=>{let n=new ue,o=new ue;for(let i=0;i<t.count;i++)n.fromBufferAttribute(t,i),a(this,pg).call(this,n),t.setXYZ(i,n.x,n.y,n.z),r&&(o.fromBufferAttribute(r,i),a(this,pg).call(this,o),r.setXYZ(i,o.x,o.y,o.z))});T(this,pg,t=>{let r=t.y;t.y=t.z,t.z=-r});T(this,ug,(t,r,n,o)=>{let i=t.y;t.y=t.z,t.z=-i;let s=r.y;if(r.y=r.z,r.z=s,n instanceof Xs)n.order="YXZ",n.set(n.x,n.y,n.z,n.order);else{let l=o.y;o.set(o.x,o.z,-l,o.w)}});T(this,vx,t=>{for(let r=0;r<t.count;r++){let n=t.getX(r),o=t.getY(r);t.setXY(r,n,o)}});w(this,Es,t),a(this,Es).entityScene=t.entityScene,a(this,Es).geometry3DMap=t.geometry3DMap}destroy(){w(this,Ap,null)}};Ap=new WeakMap,Es=new WeakMap,yx=new WeakMap,$l=new WeakSet,e8=async function(){if(!a(this,Ap)){let{GLTFExporter:t}=await import("./GLTFExporter-Z6JPGY7L.js");w(this,Ap,new t)}return a(this,Ap)},lg=new WeakMap,bx=new WeakMap,t8=function(t){let r=[],o=(t.userData?.entities?Object.values(t.userData?.entities):[]).map(s=>a(this,Es).geometry3DMap.get(s)),i=new Map;return o.forEach(s=>{if(!s||!(s instanceof Ke))return;let l=s.components[1],c=s.components[2];if(!l.visible||l instanceof Qi&&l.opacity===0||l instanceof Cm||l instanceof vb)return;let d=`${c?.hover?l.hoverColor||a(this,Es).hoverColor:l.color}-${l.opacity}-${Number(l.visible)}`;i.has(d)||i.set(d,[]),i.get(d)?.push(s)}),i.forEach((s,l)=>{let[c,p,d]=l.split("-"),m=s.reduce((C,I)=>{if(I.type==="custom-geometry")return C;let S=I.components[0];return"geometry"in S&&S.geometry instanceof ob&&C.push(S.geometry),C},[]),g=a(this,bx).call(this,c,Number(p),t.material.transparent),x=vo(m,!0),v=new Re(x,g);v.position.copy(t.position),v.rotation.copy(t.rotation),v.scale.copy(t.scale),v.visible=!!d,a(this,ug).call(this,v.position,v.scale,v.rotation,v.quaternion),r.push(a(this,cg).call(this,v))}),r},r8=function(t){let r=t.geometry.clone(),n=t.material,o=new Tr({color:n.color,side:ni});o.opacity=n.opacity,o.transparent=n.transparent;let i=new du(r,o);return i.position.copy(t.position),i.rotation.copy(t.rotation),i.scale.copy(t.scale),i.visible=t.visible,a(this,cg).call(this,i)},cg=new WeakMap,xx=new WeakMap,pg=new WeakMap,ug=new WeakMap,vx=new WeakMap;u();u();u();var wC=il(d8());function f8(e){this.name="JSClipperError",this.message=e,this.stack=new Error().stack}f8.prototype=Error.prototype;wC.default.Error=function(e){throw new f8(e)};var kr=wC.default;var PQ="gray",wQ=.1,mg=100,OC=new kr.ClipperOffset;function OQ(e,t){OC.Clear(),t/=2;let r=e.map(o=>({X:o.x*mg,Y:o.y*mg}));OC.AddPath(r,kr.JoinType.jtMiter,kr.EndType.etClosedPolygon);let n=new kr.Paths;return OC.Execute(n,t*mg),n.length?n.map(i=>i.map(s=>({x:s.X/mg,y:s.Y/mg}))):[e]}function Px(e,t,r){let{color:n=PQ,opacity:o=1,altitude:i=0,height:s=wQ}=r||{};Array.isArray(o)&&(o=1);let l={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}},p=e.geometry.coordinates[0].map(x=>{let v=t(x[1],x[0]);return l.min.x=Math.min(l.min.x,v.x),l.min.y=Math.min(l.min.y,v.y),l.max.x=Math.max(l.max.x,v.x),l.max.y=Math.max(l.max.y,v.y),v});e.properties?.style?.edgeOffset!=null&&e.properties.style.edgeOffset!==0||e.properties?.image!=null?p=OQ(p,e.properties?.style?.edgeOffset||0):p=[p];let d=[];for(let x of p){let v=new zi;v.moveTo(x[0].x,x[0].y),x.slice(1).forEach(P=>v.lineTo(P.x,P.y)),v.lineTo(x[0].x,x[0].y);let C=e.geometry.coordinates.slice(1);v.holes=C.map(P=>{let O=P.map(E=>t(E[1],E[0])),M=new cl;return M.moveTo(O[0].x,O[0].y),O.slice(1).forEach(E=>M.lineTo(E.x,E.y)),M.lineTo(O[0].x,O[0].y),M});let I=Im(r?.bevel,s),S=new Xi(v,I);S.userData={style:{color:n,opacity:o},usedBevelSettings:I},d.push(S)}if(d.length===1)return d[0];let m=vo(d);d.forEach(x=>x.dispose());let g=Im(r?.bevel,s);return m.userData={style:{color:n,opacity:o},usedBevelSettings:g,_split:!0},m}u();var _Q="gray",EQ=.1;function wx(e,t,r){let{color:n=_Q,opacity:o=1,altitude:i=0,height:s=EQ}=r||{};Array.isArray(o)&&(o=1);let l={min:{x:1/0,y:1/0,z:i},max:{x:-1/0,y:-1/0,z:s+i}},c=Im(r?.bevel,s),p=[];e.geometry.coordinates.forEach(m=>{let g=new zi,x=m[0].map(I=>{let S=t(I[1],I[0]);return l.min.x=Math.min(l.min.x,S.x),l.min.y=Math.min(l.min.y,S.y),l.max.x=Math.max(l.max.x,S.x),l.max.y=Math.max(l.max.y,S.y),S});g.moveTo(x[0].x,x[0].y),x.slice(1).forEach(I=>g.lineTo(I.x,I.y)),g.lineTo(x[0].x,x[0].y);let v=m.slice(1);g.holes=v.map(I=>{let S=I.map(O=>t(O[1],O[0])),P=new cl;return P.moveTo(S[0].x,S[0].y),S.slice(1).forEach(O=>P.lineTo(O.x,O.y)),P.lineTo(S[0].x,S[0].y),P});let C=new Xi(g,c);p.push(C)});let d=vo(p);return p.forEach(m=>m.dispose()),d.translate(0,0,i||0),d.userData={style:{color:n,opacity:o},usedBevelSettings:c},d}u();var DQ="gray",_C=new kr.ClipperOffset,Dn=100;function m8(e,t,r){let{color:n=DQ,opacity:o=1,width:i=1,join:s="round",cap:l="round",height:c=.01,altitude:p=0}=r||{};Array.isArray(o)&&(o=0);let d=[];for(let C=0;C<e.geometry.coordinates.length-1;C++){let I=t(e.geometry.coordinates[C][1],e.geometry.coordinates[C][0]),S=t(e.geometry.coordinates[C+1][1],e.geometry.coordinates[C+1][0]);d.push([I,S])}_C.AddPaths(d.map(C=>C.map(I=>({X:I.x*Dn,Y:I.y*Dn}))),s==="round"?kr.JoinType.jsRound:s==="miter"?kr.JoinType.jsMiter:kr.JoinType.jsSquare,l==="round"?kr.EndType.etOpenRound:l==="butt"?kr.EndType.etOpenButt:kr.EndType.etOpenSquare);let m=new kr.PolyTree;_C.Execute(m,i/2*Dn);let g=[],x={bevelEnabled:!1,depth:c};for(let C of m.m_AllPolys){let I=new zi;if(C.IsHole())continue;let S=C.m_polygon;I.moveTo(S[0].X/Dn,S[0].Y/Dn),S.slice(1).forEach(P=>I.lineTo(P.X/Dn,P.Y/Dn)),I.lineTo(S[0].X/Dn,S[0].Y/Dn),I.holes=C.m_Childs.map(P=>{let O=new cl,M=P.m_polygon;return O.moveTo(M[0].X/Dn,M[0].Y/Dn),M.slice(1).forEach(E=>O.lineTo(E.X/Dn,E.Y/Dn)),O.lineTo(M[0].X/Dn,M[0].Y/Dn),O}),g.push(new Xi(I,x))}let v=vo(g);return v.translate(0,0,p||0),v.userData={style:{color:n,opacity:o}},_C.Clear(),v}u();var Fn=100,FQ=.22,kQ=.01;function h8(e,t,r={}){let{width:n=FQ,height:o=kQ,color:i="gray",opacity:s=1,altitude:l=0}=r,c={min:{x:1/0,y:1/0,z:l},max:{x:-1/0,y:-1/0,z:l+o}},p={bevelEnabled:!1,depth:o},d=new kr.ClipperOffset,m=e.geometry.coordinates.map(C=>C.map(I=>t(I[1],I[0])));d.AddPaths(m.map(C=>C.map(I=>({X:I.x*Fn,Y:I.y*Fn}))),kr.JoinType.jsMiter,kr.EndType.etOpenRound);let g=new kr.PolyTree;d.Execute(g,n/2*Fn);let x=[];for(let C of g.m_AllPolys){let I=new zi;if(C.IsHole())continue;c.min.x=Math.min(c.min.x,C.m_polygon[0].X),c.min.y=Math.min(c.min.y,C.m_polygon[0].Y),c.max.x=Math.max(c.max.x,C.m_polygon[0].X),c.max.y=Math.max(c.max.y,C.m_polygon[0].Y);let S=C.m_polygon;I.moveTo(S[0].X/Fn,S[0].Y/Fn),S.slice(1).forEach(P=>I.lineTo(P.X/Fn,P.Y/Fn)),I.lineTo(S[0].X/Fn,S[0].Y/Fn),I.holes=C.m_Childs.map(P=>{let O=new cl,M=P.m_polygon;return O.moveTo(M[0].X/Fn,M[0].Y/Fn),M.slice(1).forEach(E=>O.lineTo(E.X/Fn,E.Y/Fn)),O.lineTo(M[0].X/Fn,M[0].Y/Fn),O}),x.push(new Xi(I,p))}let v=vo(x);return v.translate(0,0,l||0),v.userData={style:{color:i,opacity:s}},d.Clear(),v}u();u();var Rf=_.object({type:_.enum(["Point"]),coordinates:_.array(_.number()).min(2).max(3)});var EC=_.object({rotation:_.array(_.number()).length(3).optional(),altitude:_.number().optional(),scale:_.array(_.number()).length(3).optional(),interactive:_.boolean().optional(),verticalOffset:_.number().optional(),id:_.union([_.number(),_.string()]).optional()}),AQ=_.object({type:_.enum(["Feature"]),geometry:Rf,properties:EC}),LQ=_.object({type:_.enum(["FeatureCollection"]),features:_.array(AQ)}),DC=_.object({color:_.string()}),RQ=_.object({url:_.string(),color:_.string().optional(),opacity:_.number().optional(),material:_.record(_.string(),DC).optional()});function y8(e,t,r){_.union([_.number(),_.string()]).parse(e),LQ.parse(t),RQ.parse(r)}var hg,gg,Zl=class{constructor(t){f(this,"mesh");f(this,"type","model");f(this,"positionDirty",!0);f(this,"outline");f(this,"geometry");f(this,"material");f(this,"feature");f(this,"instanceIndex",-1);f(this,"visible",!0);f(this,"color",new Nt);f(this,"position",new ue);T(this,hg,0);T(this,gg,1);this.feature=t}setOpacity(){}setColor(){}get altitude(){return a(this,hg)}set altitude(t){this.mesh&&(this.mesh.position.z=t,w(this,hg,t))}getRotation(){return this.mesh?[this.mesh.rotation.x,this.mesh.rotation.y,this.mesh.rotation.z]:void 0}setRotation(t){this.mesh&&this.mesh.rotation.set(Xe.degToRad(t[0]),Xe.degToRad(t[1]),Xe.degToRad(t[2]))}getScale(){return this.mesh?[this.mesh.scale.x,this.mesh.scale.y,this.mesh.scale.z]:void 0}setScale(t){this.mesh&&this.mesh.scale.set(t[0],t[1],t[2])}get opacity(){return a(this,gg)}set opacity(t){if(this.mesh){if(this.mesh.children[0]instanceof ll){for(let r of this.mesh.children)if(r instanceof ll){r.userData?.originalOpacity===void 0&&(r.userData.originalOpacity=r.material.opacity);let n=yc(t,0,r.userData?.originalOpacity,0,1);r.material.opacity=n,r.material.transparent=n<1,r.material.needsUpdate=!0}}else this.mesh?.traverse(r=>{r instanceof Re&&r.material&&(Array.isArray(r.material)?r.material.forEach(n=>{g8(n,t)}):g8(r.material,t))});w(this,gg,t)}}};hg=new WeakMap,gg=new WeakMap;function g8(e,t){e.opacity!==t&&(t===1?(e.opacity=1,e.transparent=!1):(e.opacity=t,e.transparent=!0),e.needsUpdate=!0)}u();function Ox(e){let t=e.components[0],r=e.components[1];r.opacity!=null&&r.opacity!==t.opacity&&(t.opacity=r.opacity);let n=r.material,o=r.color;if(n||o){let l=BQ(o,n);t.mesh?.traverse(c=>{c instanceof Re&&c.material&&(Array.isArray(c.material)?c.material.forEach(p=>{l[p.name]?p.color.set(l[p.name].color):p.color.set(o)}):l[c.material.name]?c.material.color.set(l[c.material.name].color):c.material.color.set(o))})}let i=t.feature.geometry.coordinates[2]??0,s=r.verticalOffset+i;t.altitude!==s&&(t.altitude=s),r.visible!==t.visible&&(t.visible=r.visible),r.rotation&&t.setRotation(r.rotation),r.scale&&t.setScale(r.scale)}function BQ(e,t){let r={};if(e&&Object.assign(r,{Default:{color:e},Fabric:{color:e},Mpdn_Logo:{color:e},CouchLogo:{color:e}}),t)for(let n in t)t[n].color&&(r[n]?r[n].color=t[n].color:r[n]={color:t[n].color});return r}function b8(e,t){let r=e.components[0],o=e.components[1].verticalOffset??0,i=r.feature.geometry.coordinates.slice();i[2]=(i[2]??0)+o,r.mesh?r.mesh.position.copy(t(i)):r.position.copy(t(i))}function x8(e){return e instanceof or?e.material:null}function v8(e){return e.side===ym?"back":e.side===fc?"front":"double"}function I8(e,t){e.side=t==="back"?ym:t==="front"?fc:ni}function NQ(e){let{color:t,opacity:r,topColor:n,texture:o,topTexture:i}=e;return`${t}${r}${n||""}${o||""}${i||""}`}var _x=class extends Fe{constructor(r,n){super();f(this,"state");f(this,"convertTo3DMapPosition");f(this,"loader");f(this,"optimizePromise",[]);this.state=r,this.convertTo3DMapPosition=n}async getGLTFLoader(){if(this.loader)return this.loader;let{GLTFLoader:r}=await import("./GLTFLoader-QCSKNB7G.js");return this.loader=new r,this.loader}createEntityFromFeature(r,n,o){let i=new or(n),s=n?.properties?.bevel,l=o&&"bevel"in o?o.bevel:void 0,c;l?c={...s,...l}:s&&(c=s);let p=new Ke(i,new Qi({...o,url:n.properties?.image?.path,bevel:c}));return o?.outline&&(p.components[3]=new Ff(ig(o.color))),o?.focusable&&(p.components[4]=new ja),p.id=r,p}createModelFromFeature(r,n,o){let i=new Zl(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 l=new vb(s),c=new Ke(i,l);return c.id=r,c}populateEntityMesh(r,n){let o=r.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=r.components[1].height,o.dirty=!1}async populateModelGroup(r,n,o){let i=new to,s=new Xs,l=new hc,c=new ue,p=new ai,d=await this.getGLTFLoader(),m=new Promise(g=>{d.load(n,x=>{"entities3D"in o.userData&&(o.userData.entities3D.size>1?x.scene.traverse(v=>{let C=v;if("isMesh"in C&&C.isMesh===!0){let I=new ll(C.geometry,C.material,r.size);I.userData={entities:{}},p.add(I),o.add(p)}}):(x.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())}),p.add(x.scene),o.add(p),p.userData.isSingleModel=!0,p.userData.entityId=r.values().next().value,p.userData.type="model")),g()})});return this.optimizePromise.push(m.then(()=>{let g=0,x;for(let v of r.values()){if(x=this.state.geometry3DMap.get(v),!x||x?.type!=="model")continue;let C=x.components[0],I=x.components[1],S=x.components[0].feature;C.mesh=p,C.instanceIndex=g,Ox(x),x.components[1].dirty=!1;let{x:P,y:O}=this.convertTo3DMapPosition(S.geometry.coordinates[1],S.geometry.coordinates[0],0);C.position.set(P,O,C.altitude),s.set(Xe.degToRad(I.rotation?.[0]??Iu[0]),Xe.degToRad(I.rotation?.[1]??Iu[1]),Xe.degToRad(I.rotation?.[2]??Iu[2])),c.set(I.scale?.[0]??vu[0],I.scale?.[1]??vu[1],I.scale?.[2]??vu[2]),l.setFromEuler(s),i.compose(C.position,l,c),p.children.forEach(M=>{!x||x?.type!=="model"||!(M instanceof ll)||(M.setMatrixAt(g,i),M.userData.entities[g]=x.id)}),C.mesh.userData.isSingleModel&&(C.mesh.matrix.copy(i),C.mesh.matrix.decompose(C.mesh.position,C.mesh.quaternion,C.mesh.scale)),g++}this.publish("model-loaded")})),p}populateEntityGroup(r){let n,o,i,s;for(let l of r.values())s=this.state.geometry3DMap.get(l),s.components[0]instanceof or&&(o=s.components[0].feature,i=s.components[1],o.geometry.type==="Polygon"?(n=Px(o,this.convertTo3DMapPosition,i),o.properties?.textures&&o.properties.textures.length>0&&LE(n,o.properties.textures,this.state.naturalBearing,this.convertTo3DMapPosition),this.populateEntityMesh(s,n)):o.geometry.type==="MultiPolygon"?(n=wx(o,this.convertTo3DMapPosition,i),this.populateEntityMesh(s,n)):o.geometry.type==="LineString"?(n=m8(o,this.convertTo3DMapPosition,i),this.populateEntityMesh(s,n)):o.geometry.type==="MultiLineString"&&(n=h8(o,this.convertTo3DMapPosition,i),this.populateEntityMesh(s,n)));return r}update(){for(let r of this.state.geometryGroupIdsToLoad.values()){let n=this.state.geometry3DMap.get(r);if(n instanceof ro&&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){A.warn(s)}let o,i={};for(let s of n.userData.entities3D.values()){o=this.state.geometry3DMap.get(s);let l=o?.components[0];if(o?.type==="geometry"){let c=o.components[1],p=NQ(c);i[p]===void 0&&(i[p]={style:c,entities:[]}),i[p].entities.push(o)}else l&&"mesh"in l&&l.mesh&&l.mesh?.parent!==n&&n.add(l.mesh)}for(let s in i){let l=AE(i[s].entities,i[s].style);n.add(l)}for(let s of n.userData.entities3D.values())if(o=this.state.geometry3DMap.get(s),o!=null&&o.entities2D.size>0)for(let l of o.entities2D.values())l&&(o.attach(l),this.publish("geometry-2d-added"));this.publish("geometry-group-added"),n.userData.dirty=!1}}return Promise.resolve()}};u();var Ex=class{constructor(t,r){f(this,"state");f(this,"dirty",!0);f(this,"domTree");this.state=t,this.domTree=r}update(){if(this.dirty){let t;for(let r of Array.from(this.domTree.children))if(t=this.state.geometry2DMap.get(r.userData.entityId),t){let n=t.components[0];(!n.enabled||!n.visible||!this.state.geometry2DIdsInScene.has(r.userData.entityId))&&this.domTree.removeChild(r)}else this.domTree.removeChild(r);for(let r of this.state.geometry2DIdsInScene)if(t=this.state.geometry2DMap.get(r),t){let n=t.components[0];n instanceof ws&&n.enabled&&n.markerContainer&&!this.domTree.contains(n.markerContainer)&&(n.markerContainer.userData={entityId:t.id},this.domTree.appendChild(n.markerContainer),n.updateDimensions())}this.dirty=!1}}};u();var Dx=class{constructor(t,r){f(this,"state");f(this,"project");this.state=t,this.project=r}update(){let t,r=0,n,o;for(let i of this.state.geometry2DIdsInScene)if(t=this.state.geometry2DMap.get(i),t){o=t.components[0];let s=t.attachedTo?this.state.geometry3DMap.get(t.attachedTo):void 0;if(s instanceof Ke)if(this.state.geometry3DIdsInScene.has(s.id)){n=s.components[1],o=t.components[0],(n.dirty||t.components[0].attachedDirty)&&(r=n.height,t.setAltitude(r));let l=n.visible;o.visible!==l&&(o.visible=l)}else o.visible===!0&&(o.visible=!1);this.project(t.components[0].projection,t.position),t.components[0].attachedDirty=!1}}};u();u();var GQ=function(){let t,r;return n=>{if((!r||!r)&&(t=document.createElement("canvas"),t.width=500*n,t.height=500*n,t.style.width="500px",t.style.height="500px",r=t.getContext("2d")),!r)throw new Error("Could not get 2D context");return{measureCanvas:t,measureCanvasContext:r}}}(),S8=({text:e,size:t,maxWidth:r,pixelRatio:n,maxLines:o=2,lineHeight:i=1.2,options:s={strokeText:!0}})=>{let l=`bold ${t*n}px 'InterUI-Regular', Helvetica Neue, Arial, sans-serif`,{measureCanvasContext:c}=GQ(n);c.font=l;let p=[],d=e.split(" "),m=0,g=0,x=0;for(;g<d.length;){let S=d[g];if(m===o&&m>0){p[m-1]+="...";break}if(p[m]==null&&(p[m]=S,g++),d.length===1){p[m]=S;break}if(d[g]==null)break;let{width:P}=c.measureText(p[m]+" "+d[g]);P<=r*n?(p[m]+=" "+d[g],g++):m++}p.forEach(S=>{let{width:P}=c.measureText(S);x=Math.max(P,x)});let v=t*n*i,C=p.length*v;return{maxWidth:x,maxHeight:C,lines:p.length,draw:(S,P,O)=>{p.length===1?(s.strokeText&&S.strokeText(p[0],P,O),S.fillText(p[0],P,O)):(s.strokeText&&(S.strokeText(p[0],P,O-v/2),S.strokeText(p[1],P,O+v/2)),S.fillText(p[0],P,O-v/2),S.fillText(p[1],P,O+v/2))}}};u();function C8(e){let t=new Image;return e&&(/<svg[\s\S]*>/i.test(e)?t.src=`data:image/svg+xml;base64,${btoa(e)}`:t.src=e),t}var Fx=class extends Fe{constructor(r,n,o){super();f(this,"dirty",!1);f(this,"state");f(this,"colliderContext");f(this,"colliderCanvas");f(this,"transformRequestFunc");f(this,"transformRequest",async r=>this.transformRequestFunc?await this.transformRequestFunc(r):{url:r});f(this,"pinCache",{});f(this,"imageCache",{});f(this,"imagePromiseCache",{});f(this,"imageDimensionsCache",{});f(this,"textCache",{});f(this,"update",r=>{let n=this.state.pixelRatio;this.colliderContext.clearRect(0,0,this.colliderCanvas.width,this.colliderCanvas.height);let o,i,s,l,c,p,d;for(let m of this.state.geometry2DIdsInScene)if(d=this.state.geometry2DMap.get(m),d!=null&&(p=d.components[0],p instanceof Os&&!d.disposed)){if(c=p.appearance.iconVisibleAtZoomLevel,p.appearance.icon!=null&&c&&r>=c!==p.iconVisible&&(p.iconVisible=r>=c,p.dirty=!0),(p.dirty||this.dirty)&&p.calculateMarkerSize(),i={active:p.appearance.pinColor,inactive:p.appearance.pinColorInactive},s={active:p.appearance.pinOutlineColor,inactive:p.appearance.pinOutlineColorInactive},l=Ji(p.markerSize,2),o=`${i.active}-${i.inactive}-${s.active}-${s.inactive}-${l}-${p.iconVisible}`,p.labelCacheId=o,(!this.pinCache[o]||this.dirty)&&(this.prepare(p,o,this.colliderContext),p.dirty=!0),(p.appearance.icon&&(!p.imageHash||p.markerDirty)||this.dirty)&&this.cacheImage(p),this.textCache[p.id]==null||p.textDirty||this.dirty){p.dirty=!0,this.textCache[p.id]={};let{textDrawFn:x,width:v,height:C}=this.processText(p.text,p.appearance.textSize,p.appearance.maxWidth,p.appearance.maxLines,p.appearance.lineHeight);["left","center","right"].forEach(I=>{this.textCache[p.id][I]=this.textToCanvas(x,p.appearance.textSize,I,v,C,p.appearance.textColor,p.appearance.textOutlineColor)}),p.dimensions={width:Math.ceil(v/n),height:Math.ceil(C/n)}}let g=1;if(p.appearance.iconScale)if(typeof p.appearance.iconScale=="number")g=p.appearance.iconScale;else{let{on:x,input:v,output:C,easing:I}=p.appearance.iconScale;x==="zoom-level"?g=m5(r,v,C,I??"linear"):A.warn(`Unsupported interpolation property: ${x}`)}p.recomputeCurrentStrategy(p.iconVisible?g:1),p.canShow&&p.visible&&(p.enabled||p.visibilityNeedsUpdate!==!1)&&this.draw(p,o,this.colliderContext),p.textDirty=!1,p.markerDirty=!1}this.dirty=!1});f(this,"processText",(r,n,o,i,s)=>{let l=this.state.pixelRatio,{draw:c,maxWidth:p,maxHeight:d}=S8({text:r,size:n,pixelRatio:l,maxWidth:o,maxLines:i,lineHeight:s});return{textDrawFn:c,width:p+2.5*l*2,height:d+2.5*l*2}});f(this,"textToCanvas",(r,n,o,i,s,l,c)=>{let p=this.state.pixelRatio,d,m=i,g=s;window.OffscreenCanvas!=null&&!w5()?d=new OffscreenCanvas(m,g):(d=document.createElement("canvas"),d.width=m,d.height=g,d.style.width=m+"px",d.style.height=g+"px");let x=d.getContext("2d",{willReadFrequently:!0});if(!x)return;let v=2.5*p;x.textAlign=o,x.font=`bold ${n*p}px 'InterUI-Regular', Helvetica Neue, Arial, sans-serif`,x.textBaseline="middle",x.lineJoin="miter",x.miterLimit=2,x.strokeStyle="white",x.lineWidth=v,x.fillStyle=l,x.strokeStyle=c;let C=o==="left"?v/2:o==="center"?m/2:m-v/2;return r(x,C,(g+v/2)/2),d});f(this,"cacheImage",r=>{if(!r.appearance.icon)return;let n=L5(r.appearance.icon);this.imagePromiseCache[n]||(this.imagePromiseCache[n]=new Promise(o=>{this.transformRequest(r.appearance.icon).then(i=>{let s=C8(i.url);s.onload=()=>{this.imageCache[n]=s,this.publish("img:loaded"),o(s)}})})),r.imageHash!==n&&(r.imageHash=n,this.imagePromiseCache[n].then(()=>{r.dirty=!0}))});f(this,"createPinCanvas",(r,n,o,i,s=1)=>{let l,c=this.state.pixelRatio,p=r.totalMarkerSize*2*c*s;window.OffscreenCanvas!=null?l=new OffscreenCanvas(p,p):(l=document.createElement("canvas"),l.width=p,l.height=p,l.style.width=p/c+"px",l.style.height=p/c+"px");let d=l.getContext("2d");return d.shadowColor="rgba(0,0,0,0.3)",d.shadowOffsetY=2*c,d.shadowBlur=5*c,d.beginPath(),d.arc(p/2,p/2,(n/2+2.5*c/2)*s,0,2*Math.PI),d.fillStyle=o,d.fill(),d.beginPath(),d.arc(p/2,p/2,n/2*s,0,2*Math.PI),d.shadowColor="transparent",d.fillStyle=i,d.fill(),l});f(this,"prepare",(r,n,o)=>{let i=this.state.pixelRatio;o.lineWidth=4*i;let s=typeof r.appearance.iconScale=="number"?[r.appearance.iconScale]:r.appearance.iconScale==null?[]:r.appearance.iconScale.output,l=s.length>0?Math.max(...s):void 0,c=this.createPinCanvas(r,r.markerSize,r.appearance.pinOutlineColor,r.appearance.pinColor,l),p=this.createPinCanvas(r,r.iconVisible?r.markerSize:3.5*i,r.appearance.pinOutlineColorInactive,r.appearance.pinColorInactive,l);this.pinCache[n]=[c,p]});this.state=r,this.colliderCanvas=n,this.colliderContext=n.getContext("2d"),this.transformRequestFunc=o}draw(r,n,o){if(!r.canShow||!r.visible)return;o.save(),o.globalAlpha=r.opacity;let i=this.state.pixelRatio,s=r.projection.x*i,l=r.projection.y*i,c=r.style.pinVisibility===1?this.pinCache[n][0]:this.pinCache[n][1];if(o.drawImage(c,s-r.scaledMarkerSize*i,l-r.scaledMarkerSize*i,r.scaledMarkerSize*2*i,r.scaledMarkerSize*2*i),r.appearance.icon&&r.iconVisible&&r.imageHash&&r.appearance.iconSize&&this.imageCache[r.imageHash]){let p=this.imageCache[r.imageHash],d=(r.scaledMarkerSize-r.scaledIconPadding)*i,m=r.appearance.iconFit,g=d,x=d,v=`${r.imageHash}_${m}`;if(this.imageDimensionsCache[v])g=this.imageDimensionsCache[v].width,x=this.imageDimensionsCache[v].height;else{let C=p.width*i,I=p.height*i;if(m==="contain"){let S=Math.sqrt(C**2+I**2),P=d/S;g=C*P,x=I*P}if(m==="cover"){let S=d/C,P=d/I,O=Math.max(S,P);g=C*O,x=I*O}}o.save(),o.beginPath(),o.arc(s,l,d/2,0,2*Math.PI),o.closePath(),r?.appearance?.iconOverflow!=="visible"&&o.clip(),o.drawImage(p,s-g/2,l-x/2,g,x),o.restore()}r.style.textLabelVisible&&r.style.textAlign!=null&&r.style.left!=null&&r.style.top!=null&&o.drawImage(this.textCache[r.id][r.style.textAlign],s+r.style.left*i,l+r.style.top*i),o.restore()}};u();u();var Np=class Np{constructor(){f(this,"loader");this.loader=new fu}static getInstance(){return Np.instance||(Np.instance=new Np),Np.instance}getLoader(){return this.loader}load(t){return new Promise((r,n)=>{this.loader.load(t,r,void 0,n)})}};f(Np,"instance");var kC=Np,Yl=kC.getInstance();function HQ(e,t){let r=e.components[2],n=e.components[1];return r?.hover?[n.hoverColor||t,n.hoverColor||t]:[n.color,n.topColor||n.color]}var Gp,yg,kx=class extends Fe{constructor(r,n){super();T(this,Gp);f(this,"state");f(this,"convertTo3DMapPosition");f(this,"textureLoadingCache",new Map);this.convertTo3DMapPosition=n,this.state=r}processTextures(r,n,o){if(n.texture!==r.texture&&n.texture!==""&&z(this,Gp,yg).call(this,n.texture,r,"texture"),n.topTexture!==r.topTexture&&n.topTexture!==""&&z(this,Gp,yg).call(this,n.topTexture,r,"topTexture"),(r.texture==null||r.topTexture==null)&&Array.isArray(r.feature.properties?.textures)&&r.feature.properties.textures.length>0)for(let i of r.feature.properties.textures)i.face==="top"&&r.topTexture!==i.path?z(this,Gp,yg).call(this,i.path,r,"topTexture"):i.face==="side"&&r.texture!==i.path&&z(this,Gp,yg).call(this,i.path,r,"texture"),r.blendTexture=!0;(r.texture!=null||r.topTexture!=null)&&(o?.hover&&r.texturesVisible?r.hideTextures():r.texturesVisible||r.showTextures(),n.texture===""&&r.removeSideTexture(),n.topTexture===""&&r.removeTopTexture())}update(){let r,n,o;for(let i of this.state.geometry3DIdsInScene)if(o=this.state.geometry3DMap.get(i),o&&(o.type==="geometry"||o.type==="custom-geometry")&&(o.components[1]?.dirty||o.components[2]?.dirty)){let s=o.components[0],l=o.components[1];n=o.components[2];let c=HQ(o,this.state.hoverColor);s.setColor(c[0],c[1]);let p=x8(s);if(l.visible!==s.visible&&(s.visible=l.visible,s instanceof or&&s.textMesh)){let m=this.state.geometry3DMap.get(s.textMesh.userData.entityId);m?.type==="text3d"&&m.components[0].polygonEntityId!=null&&(m.components[0].visible=l.visible)}l.altitude!==s.altitude&&(s.altitude=l.altitude);let d=l.opacity*bu(o);d!==s.opacity&&(s.opacity=d),l.renderOrder!==s.renderOrder&&(s.renderOrder=l.renderOrder),p&&l.side!==v8(p)&&I8(p,l.side),s instanceof or&&l.shading!=null&&(l.shading?.start!==p?.getGradientShading().start||l.shading?.end!==p?.getGradientShading().end||l.shading?.intensity!==p?.getGradientShading().intensity)&&p?.setGradientShading(l.shading?.start??0,l.shading?.end??0,l.shading?.intensity??0),l.dirty=!1,s instanceof or&&this.processTextures(s,l,n),o.components[2]&&(o.components[2].dirty=!1)}else if(o?.type==="model")o.components[1].dirty&&(Ox(o),o.components[1].dirty=!1),o.components[0].positionDirty&&(b8(o,this.convertTo3DMapPosition),o.components[0].positionDirty=!1);else if(o?.type==="image"&&o.components[1]?.dirty){r=o.components[0];let s=o.components[1];s.visible!==r.visible&&(r.visible=s.visible),s.dirty=!1}else if(o?.type==="text3d"&&o.components[1]?.dirty&&o.components[0].polygonEntityId!=null){r=o.components[0];let s=o.components[1];s.visible!=null&&s.visible!==r.visible&&(r.visible=s.visible);let{textMesh:l}=r;if(l){Object.assign(l,s.getState());let c=s.hoverColor??this.state.text3dHoverColor;l.color=s.hoverByPolygon?c:s.color??xu.color,l.outlineColor=s.hoverByPolygon?c:s.outlineColor??xu.outlineColor,l.strokeColor=s.hoverByPolygon?c:s.strokeColor??xu.strokeColor}s.dirty=!1}}destroy(){this.textureLoadingCache.forEach(async r=>{(await r).dispose()}),this.textureLoadingCache.clear()}};Gp=new WeakSet,yg=async function(r,n,o){if(!(!r||!n.showTextures))if(this.textureLoadingCache.has(r)){o==="topTexture"?n.topTexture=await this.textureLoadingCache.get(r):n.texture=await this.textureLoadingCache.get(r),n.showTextures();return}else{let i=new Promise((s,l)=>{Yl.getLoader().load(r,c=>{o==="topTexture"?n.topTexture=c:n.texture=c,n.showTextures(),this.publish("texture-loaded"),s(c)},void 0,()=>{A.error(`Failed to load texture: ${r}`),l(`Failed to load texture: ${r}`)})});this.textureLoadingCache.set(r,i)}};u();var Ax=class extends Fe{constructor(r){super();f(this,"state");f(this,"animating",new Map);f(this,"isAnimating",!1);f(this,"startTime",-1);f(this,"showDuration",300);f(this,"hideDuration",250);f(this,"update",()=>{this.animating.clear();let r,n;for(let o of this.state.geometry2DIdsInScene)r=this.state.geometry2DMap.get(o),r&&(n=r.components[0],n instanceof Os&&(n.visibilityNeedsUpdate==="show"?(n.canShow=!0,this.animating.set(n,[n.opacity,1])):n.visibilityNeedsUpdate==="hide"&&this.animating.set(n,[n.opacity,0])));this.startTime=performance.now(),this.publish("animate:2d")});f(this,"playAnimations");this.state=r,this.playAnimations=this._playAnimations}_playAnimations(){let r=performance.now();for(let[n,[o,i]]of this.animating.entries()){let s=i===1?this.showDuration:this.hideDuration,l=(r-this.startTime)/s;n.opacity=yc(l,0,1,o,i,i===0?u5:d5),r-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")}};u();var Lx=class extends Fe{constructor(r,n,o,i,s,l,c){super();f(this,"state");f(this,"renderer");f(this,"mode");f(this,"scene");f(this,"cameraObject");f(this,"viewCamera");f(this,"systems");f(this,"needs2DRecompute",!1);f(this,"twoDdirty",!0);f(this,"threeDdirty",!0);f(this,"frameId",null);f(this,"twoDFrameId",null);f(this,"animationFrameId",null);f(this,"nextFrame",null);f(this,"update",(r=!1)=>{if(this.renderer?.renderer==null)return Promise.resolve();if(r){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())})});f(this,"animate2D",()=>{this.animationFrameId=requestAnimationFrame(()=>{this.animationFrameId=null,this.systems.twoDVisiblitySystem.playAnimations()})});f(this,"drawEntities2D",()=>{this.twoDFrameId||(this.twoDFrameId=requestAnimationFrame(()=>{this.twoDFrameId=null,this.systems.twoDDrawSystem.update(this.systems.cameraSystem.getZoomLevel())}))});f(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())})});f(this,"commitRenderState",()=>{try{let r=[];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(),D5(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(),E5(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&&r.push(n),this.systems.meshModificationSystem.update(),this.systems.meshDetachmentSystem.update(),this.systems.imageSystem.update(this.systems.cameraSystem.getRotation()),r.push(this.systems.text3DSystem.update(this.systems.cameraSystem.getRotation())),this.systems.customGeometrySystem.update(),this.systems.panBoundsSystem.update(),this.systems.geometryInFocusSystem.update(this.systems.cameraSystem.isCameraMoving(),this.systems.cameraSystem.lastCameraStoppedMovingTime()),this.systems.outlineInterpolationSystem.update(this.systems.cameraSystem.getZoomLevel(),this.systems.cameraSystem.zoomDirty),this.systems.pathSystem.update(this.systems.cameraSystem.minZoomAltitude,this.systems.cameraSystem.maxZoomAltitude,this.systems.cameraSystem.getZoomAltitude(),this.systems.cameraSystem.getRotation()),this.systems.cameraSystem.postRender(),this.systems.domVisiblitySystem.update(),this.systems.domMutationSystem.update(),this.systems.twoDProjectionSystem.update(),this.systems.occlusion2DSystem.update(),this.systems.twoDDrawSystem.update(this.systems.cameraSystem.getZoomLevel()),this.systems.domDrawSystem.update(this.systems.cameraSystem.isUserInteracting()),this.systems.watermarkSystem.update();let 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.drawSystem.update(),this.systems.geometryDisposalSystem.update(),this.systems.cameraSystem.dirty=!1,this.systems.cameraSystem.zoomDirty=!1,this.systems.cameraSystem.rotationDirty=!1,this.systems.cameraSystem.stateDirty&&(this.publish("camera-state-change"),this.systems.cameraSystem.stateDirty=!1),this.publish("post-render"),Promise.all(r)}catch(r){return Promise.reject(r)}});this.renderer=r,this.state=n,this.mode=o,this.scene=i,this.cameraObject=s,this.viewCamera=l,this.systems=c,this.systems.collisionSystem.on("visibility-changed",this.updateEntities2D),this.systems.twoDVisiblitySystem.on("draw:2d",this.drawEntities2D),this.systems.twoDVisiblitySystem.on("animate:2d",this.animate2D),this.systems.cameraSystem.on("pan-start",()=>this.needs2DRecompute=!1),this.systems.cameraSystem.on("zoom-start",()=>this.needs2DRecompute=!1),this.systems.cameraSystem.on("zoom-end",()=>this.needs2DRecompute=!0),this.systems.cameraSystem.on("rotate-start",()=>this.needs2DRecompute=!1),this.systems.cameraSystem.on("rotate-end",()=>this.needs2DRecompute=!0)}paint(){this.renderer?.renderer&&(this.mode==="standalone"&&this.renderer.clear(),this.renderer.render(this.scene,this.state.useStandaloneCamera||this.mode==="standalone"?this.cameraObject:this.viewCamera))}destroy(){this.frameId&&cancelAnimationFrame(this.frameId),this.twoDFrameId&&cancelAnimationFrame(this.twoDFrameId),this.animationFrameId&&cancelAnimationFrame(this.animationFrameId),this.nextFrame&&cancelAnimationFrame(this.nextFrame),this.state.geometry2DIdsInScene.clear(),this.state.geometry3DIdsInScene.clear(),this.systems.domVisiblitySystem.dirty=!0,this.systems.collisionSystem.collidersDirty=!0,this.update(),this.systems.collisionSystem.off("visibility-changed",this.updateEntities2D),this.systems.twoDVisiblitySystem.off("draw:2d",this.drawEntities2D),this.systems.twoDVisiblitySystem.off("animate:2d",this.animate2D)}};u();var WQ=_.object({interactive:_.boolean().optional(),id:_.string().optional(),width:_.union([_.number(),_.object({on:_.literal("zoom-level").optional(),input:_.array(_.number()).nonempty(),output:_.array(_.number()).nonempty(),easing:_.string().optional()})]).optional(),accentColor:_.string().optional(),displayArrowsOnPath:_.boolean().optional(),animateArrowsOnPath:_.boolean().optional(),visibleThroughGeometry:_.boolean().optional(),dashed:_.boolean().optional()}),$Q=_.object({type:_.enum(["Feature"]),geometry:Rf,properties:_.object({parentId:_.any().optional()})});function T8(e,t){_.object({features:_.array($Q)}).parse(e),WQ.parse(t)}var bg,Jl=class{constructor(t,r){f(this,"type","path");f(this,"mesh",new ai);f(this,"material");f(this,"geometry");f(this,"outline");f(this,"feature");f(this,"options");f(this,"width",{on:"zoom-level",input:[17,22],output:[.8,.4]});f(this,"breakpoint",0);f(this,"altitudeBreakpoints");f(this,"accentColor","blue");f(this,"completeFraction",1);f(this,"altitudeAdjustment",1);f(this,"displayArrowsOnPath",!1);f(this,"animateArrowsOnPath",!1);f(this,"visibleThroughGeometry",!1);f(this,"dashed",!1);f(this,"isVertical",!1);f(this,"dirty",!0);f(this,"materialDirty",!0);f(this,"position",new ue);T(this,bg,0);this.feature=t,this.options=r||{},this.width=r?.width??this.width,this.accentColor=r?.accentColor??this.accentColor,this.displayArrowsOnPath=r?.displayArrowsOnPath??this.displayArrowsOnPath,this.animateArrowsOnPath=r?.animateArrowsOnPath??this.animateArrowsOnPath,this.visibleThroughGeometry=r?.visibleThroughGeometry??this.visibleThroughGeometry,this.dashed=r?.dashed??this.dashed}setColor(){}setOpacity(){}set visible(t){this.mesh&&(this.mesh.visible=t)}get visible(){return this.mesh?this.mesh.visible:!1}get altitude(){return a(this,bg)}set altitude(t){this.mesh&&(this.mesh.position.z=t,w(this,bg,t))}set complete(t){this.material&&(this.material.uniforms.complete.value=t,this.material.needsUpdate=!0)}};bg=new WeakMap;u();u();u();var Kn=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 t=1.70158;return e===1?1:e*e*((t+1)*e-t)},Out:function(e){var t=1.70158;return e===0?0:--e*e*((t+1)*e+t)+1},InOut:function(e){var t=2.5949095;return(e*=2)<1?.5*(e*e*((t+1)*e-t)):.5*((e-=2)*e*((t+1)*e+t)+2)}}),Bounce:Object.freeze({In:function(e){return 1-Kn.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?Kn.Bounce.In(e*2)*.5:Kn.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(t){return Math.pow(t,e)},Out:function(t){return 1-Math.pow(1-t,e)},InOut:function(t){return t<.5?Math.pow(t*2,e)/2:(1-Math.pow(2-t*2,e))/2+.5}}}}),xg=function(){return performance.now()},Rx=function(){function e(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];this._tweens={},this._tweensAddedDuringUpdate={},this.add.apply(this,t)}return e.prototype.getAll=function(){var t=this;return Object.keys(this._tweens).map(function(r){return t._tweens[r]})},e.prototype.removeAll=function(){this._tweens={}},e.prototype.add=function(){for(var t,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];for(var o=0,i=r;o<i.length;o++){var s=i[o];(t=s._group)===null||t===void 0||t.remove(s),s._group=this,this._tweens[s.getId()]=s,this._tweensAddedDuringUpdate[s.getId()]=s}},e.prototype.remove=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];for(var n=0,o=t;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(t){return!t.isPlaying()})},e.prototype.update=function(t,r){t===void 0&&(t=xg()),r===void 0&&(r=!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=!r;i&&i.update(t,s)===!1&&!r&&this.remove(i)}n=Object.keys(this._tweensAddedDuringUpdate)}},e}(),Bf={Linear:function(e,t){var r=e.length-1,n=r*t,o=Math.floor(n),i=Bf.Utils.Linear;return t<0?i(e[0],e[1],n):t>1?i(e[r],e[r-1],r-n):i(e[o],e[o+1>r?r:o+1],n-o)},Bezier:function(e,t){for(var r=0,n=e.length-1,o=Math.pow,i=Bf.Utils.Bernstein,s=0;s<=n;s++)r+=o(1-t,n-s)*o(t,s)*e[s]*i(n,s);return r},CatmullRom:function(e,t){var r=e.length-1,n=r*t,o=Math.floor(n),i=Bf.Utils.CatmullRom;return e[0]===e[r]?(t<0&&(o=Math.floor(n=r*(1+t))),i(e[(o-1+r)%r],e[o],e[(o+1)%r],e[(o+2)%r],n-o)):t<0?e[0]-(i(e[0],e[0],e[1],e[1],-n)-e[0]):t>1?e[r]-(i(e[r],e[r],e[r-1],e[r-1],n-r)-e[r]):i(e[o?o-1:0],e[o],e[r<o+1?r:o+1],e[r<o+2?r:o+2],n-o)},Utils:{Linear:function(e,t,r){return(t-e)*r+e},Bernstein:function(e,t){var r=Bf.Utils.Factorial;return r(e)/r(t)/r(e-t)},Factorial:function(){var e=[1];return function(t){var r=1;if(e[t])return e[t];for(var n=t;n>1;n--)r*=n;return e[t]=r,r}}(),CatmullRom:function(e,t,r,n,o){var i=(r-e)*.5,s=(n-t)*.5,l=o*o,c=o*l;return(2*t-2*r+i+s)*c+(-3*t+3*r-2*i-s)*l+i*o+t}}},M8=function(){function e(){}return e.nextId=function(){return e._nextId++},e._nextId=0,e}(),AC=new Rx,Fi=function(){function e(t,r){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=Kn.Linear.None,this._interpolationFunction=Bf.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=M8.nextId(),this._isChainStopped=!1,this._propertiesAreSetUp=!1,this._goToEnd=!1,this._object=t,typeof r=="object"?(this._group=r,r.add(this)):r===!0&&(this._group=AC,AC.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(t,r){if(r===void 0&&(r=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=t,this._propertiesAreSetUp=!1,this._duration=r<0?0:r,this},e.prototype.duration=function(t){return t===void 0&&(t=1e3),this._duration=t<0?0:t,this},e.prototype.dynamic=function(t){return t===void 0&&(t=!1),this._isDynamic=t,this},e.prototype.start=function(t,r){if(t===void 0&&(t=xg()),r===void 0&&(r=!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=t,this._startTime+=this._delayTime,!this._propertiesAreSetUp||r){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,r)}return this},e.prototype.startFromCurrentValues=function(t){return this.start(t,!0)},e.prototype._setupProperties=function(t,r,n,o,i){for(var s in n){var l=t[s],c=Array.isArray(l),p=c?"array":typeof l,d=!c&&Array.isArray(n[s]);if(!(p==="undefined"||p==="function")){if(d){var m=n[s];if(m.length===0)continue;for(var g=[l],x=0,v=m.length;x<v;x+=1){var C=this._handleRelativeValue(l,m[x]);if(isNaN(C)){d=!1,console.warn("Found invalid interpolation list. Skipping.");break}g.push(C)}d&&(n[s]=g)}if((p==="object"||c)&&l&&!d){r[s]=c?[]:{};var I=l;for(var S in I)r[s][S]=I[S];o[s]=c?[]:{};var m=n[s];if(!this._isDynamic){var P={};for(var S in m)P[S]=m[S];n[s]=m=P}this._setupProperties(I,r[s],m,o[s],i)}else(typeof r[s]>"u"||i)&&(r[s]=l),c||(r[s]*=1),d?o[s]=n[s].slice().reverse():o[s]=r[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(t){return t===void 0&&(t=xg()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=t,this)},e.prototype.resume=function(t){return t===void 0&&(t=xg()),!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=t-this._pauseStart,this._pauseStart=0,this)},e.prototype.stopChainedTweens=function(){for(var t=0,r=this._chainedTweens.length;t<r;t++)this._chainedTweens[t].stop();return this},e.prototype.group=function(t){return t?(t.add(this),this):(console.warn("tween.group() without args has been removed, use group.add(tween) instead."),this)},e.prototype.remove=function(){var t;return(t=this._group)===null||t===void 0||t.remove(this),this},e.prototype.delay=function(t){return t===void 0&&(t=0),this._delayTime=t,this},e.prototype.repeat=function(t){return t===void 0&&(t=0),this._initialRepeat=t,this._repeat=t,this},e.prototype.repeatDelay=function(t){return this._repeatDelayTime=t,this},e.prototype.yoyo=function(t){return t===void 0&&(t=!1),this._yoyo=t,this},e.prototype.easing=function(t){return t===void 0&&(t=Kn.Linear.None),this._easingFunction=t,this},e.prototype.interpolation=function(t){return t===void 0&&(t=Bf.Linear),this._interpolationFunction=t,this},e.prototype.chain=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return this._chainedTweens=t,this},e.prototype.onStart=function(t){return this._onStartCallback=t,this},e.prototype.onEveryStart=function(t){return this._onEveryStartCallback=t,this},e.prototype.onUpdate=function(t){return this._onUpdateCallback=t,this},e.prototype.onRepeat=function(t){return this._onRepeatCallback=t,this},e.prototype.onComplete=function(t){return this._onCompleteCallback=t,this},e.prototype.onStop=function(t){return this._onStopCallback=t,this},e.prototype.update=function(t,r){var n=this,o;if(t===void 0&&(t=xg()),r===void 0&&(r=e.autoStartOnUpdate),this._isPaused)return!0;var i;if(!this._goToEnd&&!this._isPlaying)if(r)this.start(t,!0);else return!1;if(this._goToEnd=!1,t<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=t-this._startTime,l=this._duration+((o=this._repeatDelayTime)!==null&&o!==void 0?o:this._delayTime),c=this._duration+this._repeat*l,p=function(){if(n._duration===0||s>c)return 1;var C=Math.trunc(s/l),I=s-C*l,S=Math.min(I/n._duration,1);return S===0&&s===n._duration?1:S},d=p(),m=this._easingFunction(d);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,m),this._onUpdateCallback&&this._onUpdateCallback(this._object,d),this._duration===0||s>=this._duration)if(this._repeat>0){var g=Math.min(Math.trunc((s-this._duration)/l)+1,this._repeat);isFinite(this._repeat)&&(this._repeat-=g);for(i in this._valuesStartRepeat)!this._yoyo&&typeof this._valuesEnd[i]=="string"&&(this._valuesStartRepeat[i]=this._valuesStartRepeat[i]+parseFloat(this._valuesEnd[i])),this._yoyo&&this._swapEndStartRepeatValues(i),this._valuesStart[i]=this._valuesStartRepeat[i];return this._yoyo&&(this._reversed=!this._reversed),this._startTime+=l*g,this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1,!0}else{this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var x=0,v=this._chainedTweens.length;x<v;x++)this._chainedTweens[x].start(this._startTime+this._duration,!1);return this._isPlaying=!1,!1}return!0},e.prototype._updateProperties=function(t,r,n,o){for(var i in n)if(r[i]!==void 0){var s=r[i]||0,l=n[i],c=Array.isArray(t[i]),p=Array.isArray(l),d=!c&&p;d?t[i]=this._interpolationFunction(l,o):typeof l=="object"&&l?this._updateProperties(t[i],s,l,o):(l=this._handleRelativeValue(s,l),typeof l=="number"&&(t[i]=s+(l-s)*o))}},e.prototype._handleRelativeValue=function(t,r){return typeof r!="string"?r:r.charAt(0)==="+"||r.charAt(0)==="-"?t+parseFloat(r):parseFloat(r)},e.prototype._swapEndStartRepeatValues=function(t){var r=this._valuesStartRepeat[t],n=this._valuesEnd[t];typeof n=="string"?this._valuesStartRepeat[t]=this._valuesStartRepeat[t]+parseFloat(n):this._valuesStartRepeat[t]=this._valuesEnd[t],this._valuesEnd[t]=r},e.autoStartOnUpdate=!1,e}();var vLe=M8.nextId,Ds=AC,ILe=Ds.getAll.bind(Ds),SLe=Ds.removeAll.bind(Ds),CLe=Ds.add.bind(Ds),TLe=Ds.remove.bind(Ds),MLe=Ds.update.bind(Ds);u();u();u();var P8=(e,t)=>(t-e+Math.PI)%(Math.PI*2)+Math.PI*2%(Math.PI*2)-Math.PI,w8=(e,t)=>new De(e.clientX-t.offsetLeft,e.clientY-t.offsetTop),LC=(e,t)=>Math.atan2(t.y-e.y,t.x-e.x),vg=(e,t)=>Math.sqrt((t.y-e.y)**2+(t.x-e.x)**2),RC=(e,t)=>new De((e.x+t.x)/2,(e.y+t.y)/2),BC=e=>{let t=0,{wheelDelta:r,detail:n}=e;return r!==void 0?t=r:n!==void 0&&(t=-n),t};var Bx=class{constructor(t,r){f(this,"input1");f(this,"input2");f(this,"lastAngle");f(this,"lastDistance");f(this,"totalDistance");f(this,"first");f(this,"second");this.input1=t,this.input2=r,this.lastAngle=LC(t,r),this.lastDistance=vg(t,r),this.totalDistance=0,this.first=t,this.second=r}update(t,r){let n=vg(t,r);this.input1=t,this.input2=r;let o=LC(t,r);this.lastAngle=o,this.lastDistance=n,this.totalDistance+=(vg(this.first,t)+vg(this.second,r))/2,this.first=RC(this.first,t),this.second=RC(this.second,r)}};u();var Ig=class{constructor(t,r,n){f(this,"touch");f(this,"camera");f(this,"cameraPlane");f(this,"viewCoordinate");f(this,"snapHolderMatrix");f(this,"snapCamera");f(this,"cameraPosition");f(this,"raycaster");f(this,"worldCoordinate");f(this,"snapshotted",!1);this.touch=t,this.camera=r,this.cameraPlane=n,this.viewCoordinate={x:t.x,y:t.y},this.camera.updateMatrixWorld(),this.camera.updateMatrix(),this.snapHolderMatrix=this.camera.matrixWorld.clone(),this.snapCamera=this.camera.clone(),this.snapshotCameraState()}snapshotCameraState(){this.camera.updateMatrix(),this.camera.updateMatrixWorld(),this.cameraPosition=this.camera.position.clone();let t=new De(this.viewCoordinate.x,this.viewCoordinate.y);this.raycaster=this.raycaster||new Zi,this.raycaster.setFromCamera(t,this.snapCamera);let r=this.raycaster.intersectObject(this.cameraPlane,!0);this.worldCoordinate=r&&r.length>0?r[0].point:null,this.snapshotted=!0}updateAnchorState(t,r){this.camera=t,this.snapCamera=t.clone(),this.snapHolderMatrix=t.matrixWorld.clone(),this.updateViewCoordinate(r),this.snapshotCameraState()}updateViewCoordinate(t){this.viewCoordinate={x:t.x,y:t.y}}reUnproject(){let t=new De(this.viewCoordinate.x,this.viewCoordinate.y);this.raycaster?.setFromCamera(t,this.snapCamera);let r=this.raycaster?.intersectObject(this.cameraPlane,!0)[0];return r?r.point:void 0}};var ki={};zs(ki,{BLOCK_MERCATOR_ZOOM_LEVEL:()=>XQ,CLIPPING_RADIUS:()=>Sg,CONTROL_OPTIONS:()=>zQ,DEFAULT_ANIMATION_DURATION:()=>VC,DEFAULT_BEARING:()=>KQ,DEFAULT_MAX_ZOOM_LEVEL:()=>JQ,DEFAULT_MIN_ZOOM_LEVEL:()=>HC,DEFAULT_PITCH:()=>qQ,DEFAULT_ZOOM_LEVEL:()=>YQ,EVENTS:()=>Ux,MAPLIBRE_TILE_SIZE:()=>Nx,MAX_LAT:()=>GC,MAX_MERCATOR_ZOOM_LEVEL:()=>jx,MIN_LAT:()=>NC,MIN_MERCATOR_ZOOM_LEVEL:()=>Gx,ROOM_MERCATOR_ZOOM_LEVEL:()=>ZQ,TWO_PI:()=>jC,WHEEL_ZOOM_MULTIPLIER:()=>UC,ZRANGE:()=>Nf});u();var Nx=512,NC=-85.051129,GC=85.051129,Sg=1e4,zQ={chain:"chain",cancel:"cancel"},jC=Math.PI*2,Nf=100,UC=1e4,Gx=0,jx=24,XQ=17,ZQ=20,VC=200,Ux=["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"],YQ=18,HC=12,JQ=22,qQ=0,KQ=0;u();function O8(e){e&&(e.map&&(e.map.dispose(),e.map=void 0),e.dispose())}function Qt(e){for(let t=e.children.length-1;t>=0;t--)Qt(e.children[t]);"geometry"in e&&e.geometry&&e.geometry.dispose(),e.parent&&e.parent.remove(e),"material"in e&&Array.isArray(e.material)?e.material.forEach(function(t){O8(t)}):"material"in e&&typeof e.material<"u"&&O8(e.material)}var Vx=!1,QQ=!1;var Hx,jp=class extends Fe{constructor(r,n,o,i,s){super();f(this,"dirty",!1);f(this,"zoomDirty",!1);f(this,"rotationDirty",!1);f(this,"panDirty",!1);f(this,"stateDirty",!1);T(this,Hx,HC);f(this,"zoomSpeed",5);f(this,"rotateSpeed",100);f(this,"enabled",!0);f(this,"enableZoom",!0);f(this,"enablePan",!0);f(this,"enablePedestal",!1);f(this,"maxPedestal",1/0);f(this,"minPedestal",0);f(this,"enableRotate",!0);f(this,"minZoomAltitude",0);f(this,"maxZoomAltitude",1/0);f(this,"ignoreZoomLimits",!1);f(this,"zoomFactor",1);f(this,"panBounds",{min:new ue(1/0,1/0),max:new ue(-1/0,-1/0),center:new ue(0,0,0),radius:1/0});f(this,"minTilt",0);f(this,"maxTilt",1.2);f(this,"MOUSE_BUTTONS",{ORBIT:Qy.RIGHT,ZOOM:Qy.MIDDLE,PAN:Qy.LEFT});f(this,"camera");f(this,"scene");f(this,"renderer");f(this,"elevation");f(this,"orbit");f(this,"cameraPlane");f(this,"raycaster",new Zi);f(this,"rendererState");f(this,"options");f(this,"state",-1);f(this,"intersection");f(this,"viewState",null);f(this,"tweens",new Map);f(this,"clock",new r5(!0));f(this,"coords",{mouse:new De,rotateStart:new De,rotateEnd:new De,rotateDelta:new De,panStart:new ue,panCameraStart:new ue,panEnd:new ue,panDelta:new ue,initialShiftPos:new De,initialPedestal:0,floorAnchor:new ue});f(this,"touch",{origin:{offsetLeft:0,offsetTop:0},touches:[],anchor1:null,anchor2:null,inputs:null});f(this,"scrollTimer",null);f(this,"lastWheelTime",0);f(this,"resetZoom",!1);f(this,"zoomStart");f(this,"pedestalScaleFactor",1);f(this,"isUserZooming",!1);f(this,"stayInsideBounds",!0);f(this,"userInteracting",!1);f(this,"cameraMoving",!1);f(this,"lastCameraMoveTime",Date.now());f(this,"raycastToFloor",r=>{this.raycaster.setFromCamera(r,this.camera);let n=this.raycaster.intersectObject(this.cameraPlane,!1)[0];return n?n.point:new ue});f(this,"isUserInteracting",()=>this.userInteracting);f(this,"getPosition",()=>new ue(this.orbit.position.x,this.orbit.position.y,this.orbit.position.z));f(this,"getPedestal",()=>this.orbit.position.z);f(this,"pan",(r,n)=>{isNaN(r)||isNaN(n)||(this.setPosition(this.orbit.position.x+r,this.orbit.position.y+n),this.publish("position-updated"))});f(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"))});f(this,"isCameraMoving",()=>this.cameraMoving);f(this,"lastCameraStoppedMovingTime",()=>this.lastCameraMoveTime);f(this,"setPosition",(r,n)=>{r===void 0||n===void 0||isNaN(r)||isNaN(n)||(this.state===-1&&this.publish("pan-start"),this.updateCameraPosition(r,n),this.publish("position-updated"),this.publish("change"),this.state===-1&&this.publish("pan-end"),this.dirty=!0,this.stateDirty=!0)});f(this,"updateCameraPosition",(r,n)=>{let o=r-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 l=Math.atan2(i,o),c={x:Math.cos(l)*this.panBounds.radius+this.panBounds.center.x,y:Math.sin(l)*this.panBounds.radius+this.panBounds.center.y};this.orbit.position.x=c.x,this.orbit.position.y=c.y}else this.orbit.position.x=r,this.orbit.position.y=n});f(this,"tilt",r=>{if(isNaN(r))return;this.state===-1&&this.publish("rotate-start");let n=this.stayInsideBounds?Math.max(Math.min(r+this.getTilt(),this.maxTilt),this.minTilt):r+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});f(this,"zoomIn",(r,n,o)=>{let i=this.getZoomAltitude();this.animateCamera({zoom:i/1.5},r,n,o)});f(this,"zoomOut",(r,n,o)=>{let i=this.getZoomAltitude();this.animateCamera({zoom:i*1.5},r,n,o)});f(this,"getRotation",()=>(-this.orbit.rotation.z+Math.PI*2)%(Math.PI*2));f(this,"cancelAnimation",()=>{let r=Array.from(this.tweens.keys()),n=r[r.length-1];n.state===7&&this.publish("multi-cancel",{zooming:!0,rotating:!0,tilting:!0}),this.completeTween(n)});f(this,"animateCamera",(r,n,o,i,s,l)=>{let c={interruptible:!0,...l},p={},d={},m=this.getPosition();if(r.position!=null&&(r.position.x!==void 0&&(p.x=m.x,d.x=r.position.x),r.position.y!==void 0&&(p.y=m.y,d.y=r.position.y),r.position.z!==void 0&&(p.z=m.z,d.z=r.position.z)),r.zoom!==void 0&&(p.zoom=this.stayInsideBounds?Math.min(Math.max(this.getZoomAltitude(),this.getZoomScaledMin()),this.getZoomScaledMax()):this.getZoomAltitude(),this.viewState==="multi_floor"||!this.stayInsideBounds?d.zoom=r.zoom:d.zoom=Math.min(Math.max(r.zoom,this.getZoomScaledMin()),this.getZoomScaledMax())),r.rotation!==void 0){let{start:O,end:M}=ub(this.getRotation(),r.rotation);p.rotation=O,d.rotation=M}r.tilt!==void 0&&(p.tilt=this.getTilt(),this.viewState==="multi_floor"||!this.stayInsideBounds?d.tilt=r.tilt:d.tilt=Math.max(Math.min(r.tilt,this.maxTilt),this.minTilt));let g=p.zoom!==d.zoom,x=p.rotation!==d.rotation,v=p.tilt!==d.tilt,C=new Fi(p).to(d,y.env.TESTING?0:n).onUpdate(O=>{this.setMulti({x:O.x,y:O.y,z:O.z},O.zoom,O.rotation,O.tilt)}).onComplete(()=>{this.completeTween(C),this.publish("multi-end",{zooming:g,rotating:x,tilting:v}),i&&i()}).onStart(()=>{this.state!==7&&(this.state=7,C.state=7,this.publish("multi-start",{zooming:g,rotating:x,tilting:v})),this.publish("change")});this.rendererState.internalTweenGroup.add(C);let I=Array.from(this.tweens.entries()),S=I[I.length-1],P=!1;return S!=null&&(S[1].interruptible?(typeof S[1].cancelledCallback=="function"&&S[1].cancelledCallback(),this.completeTween(S[0])):(P=!0,S[0].chain(C))),this.tweens.set(C,{cancelledCallback:s,interruptible:c.interruptible}),o?C.easing(o):C.easing(Kn.Quadratic.In),!r.doNotAutoStart&&!P&&(C.start(),this.publish("change")),C.cameraAnimation=!0,C});f(this,"setMulti",(r,n,o,i,s=!0)=>{this.state===-1&&this.publish("multi-start");let l=!1;r!=null&&(r.x!==void 0&&!isNaN(r.x)&&r.y!==void 0&&!isNaN(r.y)&&(this.updateCameraPosition(r.x,r.y),l=!0),r.z!==void 0&&!isNaN(r.z)&&(this.setPedestal(r.z,!0,!1),l=!0)),l&&this.publish("position-updated");let c={zooming:!1,tilting:!!n,rotating:!1};if(n!==void 0&&!isNaN(n)){let p=this.stayInsideBounds?Math.min(Math.max(n,this.getZoomScaledMin()),this.getZoomScaledMax()):n;p!==this.camera.position.z&&(c.zooming=!0,this.camera.position.z=p,this.publish("zoom-updated"),this.zoomDirty=!0,this.viewState==="multi_floor"?n>Sg&&(this.camera.near=n-Sg,this.camera.far=n+Sg):(this.camera.near=n/Nf,this.camera.far=n*Nf),this.camera.updateProjectionMatrix())}if(o!==void 0&&!isNaN(o)&&o!==this.getRotation()&&(c.rotating=!0,this.orbit.rotation.z=-o,this.publish("rotation-updated")),i!==void 0&&!isNaN(i)){let p=this.stayInsideBounds?Math.max(Math.min(i,this.maxTilt),this.minTilt):i;p!==this.elevation.rotation.x&&(c.tilting=!0,this.elevation.rotation.x=p,this.publish("tilt-updated"))}s&&this.publish("change"),this.state===-1&&this.publish("multi-end",c),this.stateDirty=!0});f(this,"getZoomScaledMin",()=>this.minZoomAltitude*this.zoomFactor);f(this,"getZoomScaledMax",()=>{let r=this.minZoomAltitude*this.zoomFactor;return Math.max(this.maxZoomAltitude,r)});f(this,"setRotation",(r,n)=>{if(isNaN(r))return;this.state===-1&&!n&&this.publish("rotate-start");let o=-(r%jC);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)});f(this,"setZoomAltitude",r=>{if(isNaN(r))return;this.state===-1&&this.publish("zoom-start");let n=this.stayInsideBounds?Math.min(Math.max(r,this.getZoomScaledMin()),this.getZoomScaledMax()):r;n!==this.camera.position.z&&(this.camera.position.z=n,this.publish("zoom-updated"),this.zoomDirty=!0),this.camera.near=n/Nf,this.camera.far=n*Nf,this.camera.updateProjectionMatrix(),this.publish("change"),this.state===-1&&this.publish("zoom-end"),this.dirty=!0,this.stateDirty=!0});f(this,"setZoomLevel",r=>{this.setZoomAltitude(this.convertZoomLevelToAltitude(r))});f(this,"getZoomAltitude",()=>this.camera.position.z);f(this,"getZoomLevel",()=>this.convertAltitudeToZoomLevel(this.getZoomAltitude()));f(this,"setTilt",(r,n)=>{if(isNaN(r))return;this.state===-1&&!n&&this.publish("rotate-start");let o=this.stayInsideBounds?Math.max(Math.min(r,this.maxTilt),this.minTilt):r;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)});f(this,"getTilt",()=>this.elevation.rotation.x);f(this,"setCameraPlaneElevation",r=>{this.cameraPlane.position.z=r});f(this,"zoom",r=>{if(isNaN(r))return;this.state===-1&&this.publish("zoom-start");let n=this.getZoomAltitude()-r;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});f(this,"getProjectionScaleFactor",(r,n,o)=>a2(r,n,o));f(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())});f(this,"setPedestal",(r,n=!1,o=!0)=>{typeof r=="number"&&!isNaN(r)&&(this.orbit.position.z=r,n&&(this.publishPedestalChangeEvent(r),this.publish("pedestal-change",{pedestal:r})),this.publish("change"),this.dirty=!0,o&&(this.stateDirty=!0))});f(this,"dispose",()=>{for(let r of Ux)r.endsWith("start")?(this.off(r,this.setCameraMoving),r.startsWith("user")&&this.off(r,this.setUserInteracting)):(r.endsWith("end")||r.endsWith("cancel"))&&(this.off(r,this.unsetCameraMoving),r.startsWith("user")&&this.off(r,this.unsetUserInteracting));this.removeEventListeners(),this.scene.remove(this.cameraPlane),this.destroy()});f(this,"createCameraPlane",()=>{let r=Vx?2e3:1e10,n=Vx?100:1,o=new si(r,r,n,n),i=new Tr({color:0,wireframe:Vx,visible:Vx}),s=new Re(o,i);return this.scene.add(s),s});f(this,"addEventListeners",()=>{let{domElement:r}=this.renderer;for(let n of Ux)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));r.addEventListener("contextmenu",this.onContextMenu,!1),r.addEventListener("mousedown",this.onMouseDown,!1),r.addEventListener("wheel",this.onMouseWheel,{passive:!1}),r.addEventListener("touchstart",this.onTouchStart,!1),r.addEventListener("touchend",this.onTouchEnd,!1),r.addEventListener("touchmove",this.onTouchMove,!1)});f(this,"addMouseEventListeners",()=>{this.addMouseMoveEventListeners(),window.addEventListener("mouseup",this.onMouseUp,!1),window.addEventListener("mouseout",this.onMouseUp,!1)});f(this,"addMouseMoveEventListeners",()=>{this.renderer.domElement.addEventListener("mousemove",this.onMouseMove,!1)});f(this,"removeMouseMoveEventListeners",()=>{this.renderer.domElement.removeEventListener("mousemove",this.onMouseMove,!1)});f(this,"removeEventListeners",()=>{let{domElement:r}=this.renderer;r.removeEventListener("contextmenu",this.onContextMenu,!1),r.removeEventListener("mousedown",this.onMouseDown,!1),r.removeEventListener("wheel",this.onMouseWheel,!1),r.removeEventListener("touchstart",this.onTouchStart,!1),r.removeEventListener("touchend",this.onTouchEnd,!1),r.removeEventListener("touchmove",this.onTouchMove,!1),r.removeEventListener("mousemove",this.onMouseMove,!1),window.removeEventListener("mouseup",this.onMouseUp,!1),window.removeEventListener("mouseout",this.onMouseUp,!1)});f(this,"removeMouseUpEventListeners",()=>{this.renderer.domElement.removeEventListener("mousemove",this.onMouseMove,!1),window.removeEventListener("mouseup",this.onMouseUp,!1),window.removeEventListener("mouseout",this.onMouseUp,!1)});f(this,"onContextMenu",r=>{r.preventDefault()});f(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}});f(this,"onMouseMove",r=>{if(this.enabled!==!1)if(r.preventDefault(),this.mouseToScene(r),this.state===0){if(this.enableRotate===!1)return;this.handleMouseMoveRotate(r)}else if(this.state===2){if(this.enablePan===!1)return;this.handleMouseMovePan()}else this.state===3?(this.resetZoom=!0,this.state=-1):this.state===8&&this.handleMouseMovePedestal(r)});f(this,"onTouchStart",r=>{if(this.enabled!==!1){switch(this.updateTouchOrigin(),this.touchToScene(r),r.touches.length){case 1:this.enablePedestal?(this.handleTouchStartPedestal(r),this.state=9):this.enablePan&&(this.handleTouchStartPan(r),this.state=6);break;case 2:this.touch.inputs=new Bx(this.touch.touches[0],this.touch.touches[1]);break;default:this.state=-1}this.state}});f(this,"onTouchMove",r=>{if(this.enabled!==!1)switch(this.touchToScene(r),r.touches.length){case 2:r.preventDefault(),r.stopPropagation();let n={...this.touch.inputs.first},o={...this.touch.inputs.second},i=new De(this.touch.touches[0].x,this.touch.touches[0].y),s=new De(this.touch.touches[1].x,this.touch.touches[1].y);if(this.touch.inputs.update(this.touch.touches[0],this.touch.touches[1]),this.enableRotate&&this.state===4)this.handleTouchMoveTilt(r);else if(this.state===5)this.handleTouchMoveDolly();else if(this.state!==5&&this.touch.inputs.totalDistance>.05){let l=n.y<i.y&&o.y<s.y,c=n.y>i.y&&o.y>s.y;this.enableRotate&&this.state!==4&&(c||l)?(this.handleTouchStartTilt(r),this.state=4):(this.handleTouchStartDolly(),this.state=5)}break;case 1:(this.enablePedestal||this.enablePan)&&(r.preventDefault(),r.stopPropagation()),this.enablePedestal&&this.state===9?this.handleTouchMovePedestal(r):this.enablePan&&this.state===6&&this.handleTouchMovePan(r);break;default:this.state=-1}});f(this,"onTouchEnd",r=>{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}r.touches.length?this.onTouchStart(r):this.state=-1}});f(this,"handleTouchMovePan",r=>{let n=Object.hasOwn(r,"x")?new De(r.x,r.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});f(this,"handleTouchStartDolly",()=>{let r=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 De(this.touch.touches[0].x-r/2,this.touch.touches[0].y-n/2);this.coords.floorAnchor=this.raycastToFloor(o),this.orbit.updateMatrixWorld(),this.touch.anchor1=new Ig(this.touch.touches[0],this.camera,this.cameraPlane),this.touch.anchor2=new Ig(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")});f(this,"handleMouseMovePan",()=>{let r=this.raycastToFloor(this.coords.mouse);this.coords.panEnd.set(r.x,r.y,0),this.coords.panDelta.subVectors(this.coords.panEnd,this.coords.panStart),this.setPosition(this.coords.panCameraStart.x-this.coords.panDelta.x,this.coords.panCameraStart.y-this.coords.panDelta.y),this.publish("change"),this.panDirty=!0});f(this,"handleTouchStartTilt",r=>{this.coords.rotateStart.set(r.touches[1].clientX,r.touches[1].clientY),this.publish("user-tilt-start"),this.publish("rotate-start")});f(this,"handleTouchMovePedestal",r=>{this.handleMouseMovePedestal(r.touches[0])});f(this,"handleTouchMoveTilt",r=>{this.coords.rotateEnd.set(r.touches[1].clientX,r.touches[1].clientY),this.coords.rotateDelta.subVectors(this.coords.rotateEnd,this.coords.rotateStart),this.setTilt(this.getTilt()-this.coords.rotateDelta.y/this.rotateSpeed),this.coords.rotateStart.copy(this.coords.rotateEnd)});f(this,"handleTouchMoveDolly",()=>{let r=this.touch.inputs.first,n=this.touch.inputs.second;this.touch.anchor1.viewCoordinate={x:r.x,y:r.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,r),this.touch.anchor2.updateAnchorState(this.camera,n)});f(this,"handleTouchEnd",()=>{this.state===4||this.state===5?this.publish("multi-end"):this.state===6&&this.publish("pan-end"),this.panDirty=!1});f(this,"handleTouchStartPan",r=>{let n=Object.hasOwn(r,"x")?new De(r.x,r.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")});f(this,"handleTouchStartPedestal",r=>{this.handleMouseDownPedestal(r.touches[0])});f(this,"onMouseDown",r=>{if(this.enabled!==!1){if(this.mouseToScene(r),r.preventDefault(),this.state===3&&this.publish("zoom-end"),r.button===this.MOUSE_BUTTONS.ORBIT){if(this.enableRotate===!1)return;this.handleMouseDownRotate(r),this.state=0}else r.button===this.MOUSE_BUTTONS.PAN&&(this.enablePan?(this.handleMouseDownPan(),this.state=2):this.enablePedestal&&(this.handleMouseDownPedestal(r),this.state=8));this.state!==-1&&this.addMouseEventListeners()}});f(this,"onMouseWheel",r=>{this.enabled===!1||this.enableZoom===!1||this.state!==-1&&this.state!==3||(r.preventDefault(),r.stopPropagation(),this.mouseToScene(r),this.canScrollZoom(r)&&(this.lastWheelTime=this.clock.getElapsedTime(),this.publishUserZoomEvent()),this.state!==3&&this.canScrollZoom(r)&&(this.addMouseMoveEventListeners(),this.state=3,this.zoomStart=this.getZoomAltitude(),this.coords.floorAnchor=this.raycastToFloor(this.coords.mouse),this.coords.panCameraStart.set(this.orbit.position.x,this.orbit.position.y,0),this.publish("zoom-start")),this.scrollTimer!=null&&clearTimeout(this.scrollTimer),this.scrollTimer=setTimeout(()=>{this.publish("zoom-end")},50),this.handleMouseWheel(r))});f(this,"handleMouseWheel",r=>{if(this.publish("zoom-start"),!this.canScrollZoom(r)){this.lastWheelTime>0&&this.publish("zoom-end"),this.lastWheelTime=0,this.state=-1;return}let n=this.getZoomAltitude(),o=n-BC(r)*n/UC*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")});f(this,"setCameraFromTransformMatrix",r=>{this.orbit.updateMatrixWorld();let n=new Xs;n.setFromRotationMatrix(r,"ZYX");let o=(r.elements[14]-this.cameraPlane.position.z)/Math.cos(n.x),i=n.z,s=new ue(0,0,1);s.applyEuler(n),s.setLength(o);let l=new ue;l.setFromMatrixPosition(r),l.sub(s),this.enablePan&&this.setPosition(l.x,l.y),this.enableZoom&&this.setZoomAltitude(o),this.enableRotate&&this.setRotation(-i)});f(this,"makeTransformFromTouchAnchors",(r,n)=>{this.orbit.updateMatrixWorld(),this.camera.updateProjectionMatrix();let o=this.camera.projectionMatrix.clone(),i=r.worldCoordinate,s=n.worldCoordinate,l=r.reUnproject(),c=n.reUnproject();if(!l||!c||!i||!s)return null;let p=r.viewCoordinate,d=n.viewCoordinate,m=s.x-i.x,g=s.y-i.y,x=Math.atan2(g,m),v=c.x-l.x,C=c.y-l.y,I=Math.atan2(C,v),S=P8(x,I),P=new to;P.makeRotationZ(-S);let O=P.clone();O.multiply(r.snapHolderMatrix);let M=(VF,HF,WF)=>VF.elements[(HF-1)*4+WF-1],E=M(o,1,1)*M(O,1,1)-p.x*M(o,3,4)*M(O,3,1),B=M(o,1,1)*M(O,1,2)-p.x*M(o,3,4)*M(O,3,2),j=M(o,1,1)*M(O,1,3)-p.x*M(o,3,4)*M(O,3,3),L=i.x*E+i.y*B+i.z*j,N=M(o,2,2)*M(O,2,1)-p.y*M(o,3,4)*M(O,3,1),X=M(o,2,2)*M(O,2,2)-p.y*M(o,3,4)*M(O,3,2),Z=M(o,2,2)*M(O,2,3)-p.y*M(o,3,4)*M(O,3,3),re=i.x*N+i.y*X+i.z*Z,Q=M(o,1,1)*M(O,1,1)-d.x*M(o,3,4)*M(O,3,1),xe=M(o,1,1)*M(O,1,2)-d.x*M(o,3,4)*M(O,3,2),Ce=M(o,1,1)*M(O,1,3)-d.x*M(o,3,4)*M(O,3,3),ye=s.x*Q+s.y*xe+s.z*Ce,Ee=M(o,2,2)*M(O,2,1)-d.y*M(o,3,4)*M(O,3,1),we=M(o,2,2)*M(O,2,2)-d.y*M(o,3,4)*M(O,3,2),pe=M(o,2,2)*M(O,2,3)-d.y*M(o,3,4)*M(O,3,3),Ae=s.x*Ee+s.y*we+s.z*pe,mt=Math.abs(Q-E),Je=Math.abs(xe-B),ut=Math.abs(Ce-j),qe=Math.abs(Q-N),Te=Math.abs(xe-X),xt=Math.abs(Ce-Z),Pt=Math.abs(Ee-E),nr=Math.abs(we-B),k=Math.abs(pe-j),W=Math.abs(Ee-N),D=Math.abs(we-X),ne=Math.abs(pe-Z),K=Math.min(mt+Je+ut,qe+Te+xt),ee=Math.min(Pt+nr+k,W+D+ne);K<ee&&(Q=Ee,xe=we,Ce=pe,ye=Ae);let Le=N*j-E*Z,Ft=X*j-B*Z,In=re*j-L*Z,Yr=Q*Z-N*Ce,pn=xe*Z-X*Ce,dc=ye*Z-re*Ce,$v=(dc*Ft-In*pn)/(Yr*Ft-Le*pn),zv=(dc*Le-In*Yr)/(pn*Le-Ft*Yr),RT=X*E-B*N,GF=Z*E-j*N,jF=re*E-L*N,BT=xe*N-X*Q,UF=Ce*N-Z*Q,NT=((ye*N-re*Q)*RT-jF*BT)/(UF*RT-GF*BT),Ky=O.clone();return Ky.elements[12]=$v,Ky.elements[13]=zv,Ky.elements[14]=NT,NT>0?Ky:null});f(this,"updateTouchOrigin",()=>{let r=this.renderer.domElement;this.touch.origin.offsetLeft=r.getBoundingClientRect().left,this.touch.origin.offsetTop=r.getBoundingClientRect().top});f(this,"touchToScene",r=>{this.touch.touches=[];for(let n=0,o=r.touches.length;n<o;n++){let i=r.touches[n],s=w8(i,this.touch.origin);this.touch.touches.push(new De(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]});f(this,"canScrollZoom",r=>{let n=BC(r),o=this.getZoomAltitude();return!(n<0&&o===this.getZoomScaledMax()||n>0&&o===this.getZoomScaledMin())});f(this,"mouseToScene",r=>{let n=this.getMousePos(r);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});f(this,"getMousePos",r=>({x:r.offsetX,y:r.offsetY}));f(this,"handleMouseDownRotate",r=>{this.coords.rotateStart.set(r.clientX,r.clientY),this.publish("rotate-start"),this.publish("user-rotate-start")});f(this,"handleMouseDownPan",()=>{let r=this.raycastToFloor(this.coords.mouse);this.coords.panStart.set(r.x,r.y,0),this.coords.panCameraStart.set(this.orbit.position.x,this.orbit.position.y,0),this.publish("pan-start"),this.publish("user-pan-start")});f(this,"handleMouseDownPedestal",r=>{let n=new De(r.clientX,r.clientY);this.coords.initialShiftPos=n,this.coords.initialPedestal=this.getPedestal(),this.pedestalScaleFactor=a2(this.camera.fov,this.renderer.domElement.clientHeight,this.getZoomAltitude()),this.publish("pedestal-start"),this.publish("user-pedestal-start")});f(this,"handleMouseMovePedestal",r=>{let n={x:r.clientX,y:r.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)});f(this,"handleMouseMoveRotate",r=>{this.coords.rotateEnd.set(r.clientX,r.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")});f(this,"publishUserZoomDebounced",Sm(()=>{this.isUserZooming=!1,this.publish("user-zoom-end")},250));f(this,"publishUserZoomEvent",()=>{this.isUserZooming?this.publishUserZoomDebounced():(this.publish("user-zoom-start"),this.isUserZooming=!0,this.publishUserZoomDebounced())});f(this,"setCameraMoving",()=>{this.cameraMoving=!0});f(this,"unsetCameraMoving",()=>{this.cameraMoving=!1,this.lastCameraMoveTime=Date.now()});f(this,"setUserInteracting",()=>{this.userInteracting=!0});f(this,"unsetUserInteracting",()=>{this.userInteracting=!1});f(this,"publishPedestalChangeEvent",r=>{this.publish("pedestal-change",{pedestal:r,scrolledToTop:this.scrolledToTop,scrolledToBottom:this.scrolledToBottom,scrollPercent:this.scrollPercent})});f(this,"convertAltitudeToZoomLevel",r=>{let[,n]=this.center,i=r*2*Math.tan(Xe.degToRad(this.camera.fov)/2)/this.options.canvasHeight,s=Math.cos(Xe.degToRad(n))*2*Math.PI*Xv/i;return Xe.clamp(Math.log2(s/512),Gx,jx)});f(this,"convertZoomLevelToAltitude",r=>{let[,n]=this.center,o=Xe.clamp(r,Gx,jx),i=Math.pow(2,o),s=Xe.clamp(n,NC,GC),l=i*512;return Math.cos(Xe.degToRad(s))*Math.PI*2*Xv/l*this.options.canvasHeight/2/Math.tan(Xe.degToRad(this.camera.fov)/2)});f(this,"completeTween",r=>{r.isPlaying()&&r.stop(),this.rendererState.internalTweenGroup.remove(r),this.tweens.delete(r)});f(this,"debugContainer",new oi);this.camera=r,this.renderer=o,this.rendererState=i,this.scene=n,this.options=s,this.elevation=r.parent,this.orbit=this.elevation.parent,this.cameraPlane=this.createCameraPlane(),this.zoomStart=r.position.z,s.mode!=="outdoors-overlay"&&this.addEventListeners()}get maxZoomLevel(){return this.convertAltitudeToZoomLevel(this.minZoomAltitude)}setMaxZoomLevel(r){this.minZoomAltitude=this.convertZoomLevelToAltitude(r),this.stateDirty=!0}get defaultMinZoomLevel(){return a(this,Hx)}get minZoomLevel(){return this.convertAltitudeToZoomLevel(this.maxZoomAltitude)}setMinZoomLevel(r){this.maxZoomAltitude=this.convertZoomLevelToAltitude(r),this.stateDirty=!0}get scrollPercent(){let r=this.minPedestal,n=this.maxPedestal,o=this.getPedestal();return o=Math.min(o,n),o=Math.max(o,r),(o-r)/(n-r)*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 r=this.getPosition(),{lat:n,lon:o}=yb(this.rendererState.center?.[1]??0,this.rendererState.center?.[0]??0,r.x,r.y);return[o,n]}setCenter(r,n){let{x:o,y:i}=bb(this.rendererState.center?.[1]??0,this.rendererState.center?.[0]??0,n,r);this.setPosition(o,i)}get isAnimating(){return this.rendererState.internalTweenGroup.getAll().some(r=>r.cameraAnimation)}getCameraFrameForCoordinates(r,n){let o=n.minZoom!==void 0?n.minZoom:this.minZoomAltitude,i=n.maxZoom!==void 0?n.maxZoom:this.maxZoomAltitude,s=this.options.canvasWidth,l=this.options.canvasHeight,c=this.getRotation(),p=this.getTilt(),d=this.getPosition();this.setRotation(n.rotation||c,!0),this.setTilt(n.tilt||p,!0);let m=_8(r,{canvasWidth:s,canvasHeight:l,paddingOption:n.padding,verticalPadding:n.verticalPadding,minZoom:o,maxZoom:i,position:d,camera:this.camera,orbit:this.orbit});return this.setRotation(c,!0),this.setTilt(p,!0),{center:m.position,zoomLevel:this.convertAltitudeToZoomLevel(m.zoom)}}focusOn(r,n){if(QQ){this.debugContainer&&Qt(this.debugContainer);let I=new ii(4,4,4),S=new Tr({color:65280,depthTest:!1}),P=new ll(I,S,r.length),O=new to;r.forEach((M,E)=>{O.setPosition(M),P.setMatrixAt(E,O)}),P.instanceMatrix.needsUpdate=!0,this.debugContainer.add(P),this.scene.add(this.debugContainer)}let o=n.curve,i=n.callback,s=n.cancelledCallback,l=n.minZoom!==void 0?n.minZoom:this.minZoomAltitude,c=n.maxZoom!==void 0?n.maxZoom:this.maxZoomAltitude,p=this.options.canvasWidth,d=this.options.canvasHeight,m;n.duration!==void 0?m=n.duration:y.env.TESTING==="true"?m=0:m=VC;let g=n.padding,x=this.getRotation(),v=this.getTilt();n.rotation!=null&&this.setRotation(n.rotation),n.tilt!=null&&this.setTilt(n.tilt);let C=_8(r,{canvasHeight:d,paddingOption:g,canvasWidth:p,minZoom:l,maxZoom:c,camera:this.camera,orbit:this.orbit,position:this.getPosition(),verticalPadding:n.verticalPadding});this.setRotation(x),this.setTilt(v),this.animateCamera({position:C.position,tilt:n.tilt,rotation:n.rotation,zoom:C.zoom},m,o,i,s,n)}resize(r,n){this.options.canvasWidth=r,this.options.canvasHeight=n}};Hx=new WeakMap,f(jp,"CAMERA_FRAME_PADDING_SIDES",["top","bottom","left","right"]);function _8(e,{canvasWidth:t,orbit:r,paddingOption:n,verticalPadding:o=0,canvasHeight:i,minZoom:s,maxZoom:l,camera:c,position:p}){let d={zoom:s,position:p};if(e.length===0)return d;for(let Le of jp.CAMERA_FRAME_PADDING_SIDES)typeof n[Le]!="number"&&(n[Le]=0);let m=n.type==="portion"?{top:n.top*i,bottom:n.bottom*i,left:n.left*t,right:n.right*t,type:"pixel"}:n;if(m.left+m.right>=t||m.top+m.bottom>=i)return d;r.updateMatrixWorld();let g=c.matrixWorldInverse,x=c.fov*(Math.PI/180)/2,v=x,I=Math.atan(Math.tan(x)*(t/i)),S=new ue(1/0,1/0,1/0),P=new ue(-1/0,-1/0,-1/0),O=new vr,M=new ue;for(let Le=0,Ft=e.length;Le<Ft;Le++)M.copy(e[Le]),O.expandByPoint(M),M.applyMatrix4(g),S.min(M),P.max(M),M.copy(e[Le]),M.z-=o,M.applyMatrix4(g),S.min(M),P.max(M),M.copy(e[Le]),M.z+=o,M.applyMatrix4(g),S.min(M),P.max(M);let E=P.x-S.x,B=P.y-S.y,j=t-m.left-m.right,L=i-m.top-m.bottom,N=(P.x+S.x)/2,X=(P.y+S.y)/2,Z=E/j,re=B/L,Q=s,xe=l,Ce=Q*Math.tan(I)*2,ye=xe*Math.tan(I)*2,Ee=Ce/t,we=ye/t,pe=Math.max(Z,re);pe=Xe.clamp(pe,Ee,we);let Ae=j*pe,mt=L*pe,Je={min:{x:N-Ae/2-m.left*pe,y:X-mt/2-m.bottom*pe},max:{x:N+Ae/2+m.right*pe,y:X+mt/2+m.top*pe}},ut=(Je.min.x+Je.max.x)/2,qe=(Je.min.y+Je.max.y)/2,Te=O.getCenter(new ue),xt=Math.abs(ut-Je.min.x),Pt=Math.abs(qe-Je.min.y),nr=xt/Math.tan(I),k=Pt/Math.tan(v),W=new ue;W.set(ut,qe,P.z+Math.max(nr,k)),W.applyMatrix4(c.matrixWorld);let D=new ue;D.set(ut,qe,P.z),D.applyMatrix4(c.matrixWorld);let ne=new ue().subVectors(D,W),K=(Te.z-W.z)/ne.z,ee=new ue().copy(W).add(ne.clone().multiplyScalar(K));return D.set(ee.x,ee.y,ee.z),W.sub(D),{position:ee,zoom:W.length()}}u();var eee=300,Cg,Tg,Wx=class{constructor(t){f(this,"state");T(this,Cg,new ue);T(this,Tg,new ue);this.state=t}update(t){let r,n;this.state.cameraObject.getWorldPosition(a(this,Tg));for(let o of this.state.geometry2DIdsInScene)if(r=this.state.geometry2DMap.get(o),r&&(n=r.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{r.object3d.getWorldPosition(a(this,Cg));let i=a(this,Tg).distanceTo(a(this,Cg));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=t?"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:eee,easing:"ease-in-out",fill:"forwards"}),n.visibilityNeedsUpdate=!1)}}};Cg=new WeakMap,Tg=new WeakMap;u();var $x=class extends Fe{constructor(r,n){super();f(this,"state");f(this,"dirty",!0);f(this,"domTree");f(this,"observers",new Map);f(this,"updateDimensions",r=>{r.forEach(n=>{let i=n.target.parentElement?.getAttribute("data-marker-id");if(i){let s=this.state.geometry2DMap.get(i),l=s?.components[0];s&&l instanceof ws&&(l.updateDimensions(n.contentRect.width,n.contentRect.height),l.collisionDirty=!0)}}),this.publish("dimensions-update")});this.state=r,this.domTree=n}setupObserver(){if(this.observers){for(let o of this.observers.values())o.disconnect();this.observers.clear()}let r,n;for(let o of this.domTree.children){let i=o.getAttribute("data-marker-id");if(i!=null&&(r=this.state.geometry2DMap.get(i),n=r.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 r of this.observers.values())r.disconnect();this.observers.clear()}};u();var tee=0,ree=90,nee=(y.env.NODE_ENV==="test",!1),Fs={linear:Kn.Linear.None,"ease-in":Kn.Quadratic.In,"ease-out":Kn.Quadratic.Out,"ease-in-out":Kn.Quadratic.InOut},oee=-50,me,Oe,Ua,Mg,Pg,$C,zx=class{constructor(t,r,n){T(this,Pg);T(this,me);T(this,Oe);T(this,Ua);T(this,Mg);w(this,me,t),w(this,Oe,r),w(this,Ua,n),a(this,me).map&&a(this,me).map.transform.setMinElevationForCurrentTile(oee),a(this,Oe).cameraSystem.on("pedestal-change",({pedestal:o})=>{a(this,Oe).cameraSystem.setCameraPlaneElevation(o)})}get center(){return a(this,me).mode==="outdoors-overlay"&&a(this,me).map?a(this,me).map.getCenter?.().toArray():a(this,Oe).cameraSystem.center}setCenter(t){if(a(this,me).mode==="outdoors-overlay"&&a(this,me).map){a(this,me).map?.setCenter(t),a(this,Oe).interactionSystem.handleHover();return}a(this,Oe).cameraSystem.setCenter(t[0],t[1]),a(this,Oe).interactionSystem.handleHover()}get zoomLevel(){return a(this,me).mode==="outdoors-overlay"&&a(this,me).map?a(this,me).map?.getZoom():a(this,Oe).cameraSystem.getZoomLevel()}setZoomLevel(t){a(this,me).mode==="outdoors-overlay"&&a(this,me).map&&a(this,me).map?.setZoom(t),a(this,Oe).cameraSystem.setZoomLevel(Yi(t,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,Oe).cameraSystem.isAnimating}cancelAnimation(){a(this,Oe).cameraSystem.cancelAnimation()}get maxZoomLevel(){return a(this,Oe).cameraSystem.maxZoomLevel}get minZoomLevel(){return a(this,Oe).cameraSystem.minZoomLevel}setAutoMinZoomLevel(t){a(this,Oe).panBoundsSystem.autoMinZoomLevel=t,t&&(a(this,Oe).panBoundsSystem.dirty=!0,a(this,Oe).panBoundsSystem.update())}get autoMinZoomLevel(){return a(this,Oe).panBoundsSystem.autoMinZoomLevel}setMinZoomLevel(t,r=!1){r&&this.setAutoMinZoomLevel(!1);let n=Yi(t,ki.MIN_MERCATOR_ZOOM_LEVEL,this.maxZoomLevel,`setMinZoomLevel was clamped. minZoomLevel must be between ${ki.MIN_MERCATOR_ZOOM_LEVEL} and maxZoomLevel.`);a(this,Oe).cameraSystem.setMinZoomLevel(n),this.zoomLevel<n&&this.setZoomLevel(n),a(this,me).map?.setMinZoom(n)}setMaxZoomLevel(t){let r=Yi(t,this.minZoomLevel,ki.MAX_MERCATOR_ZOOM_LEVEL,`setMaxZoomLevel was clamped. maxZoomLevel must be between minZoomLevel and ${ki.MAX_MERCATOR_ZOOM_LEVEL}.`);a(this,Oe).cameraSystem.setMaxZoomLevel(r),this.zoomLevel>r&&this.setZoomLevel(r),a(this,me).map?.setMaxZoom(r)}get maxPitch(){return a(this,me).mode==="outdoors-overlay"&&a(this,me).map?a(this,me).map?.getMaxPitch?.():Xe.radToDeg(a(this,Oe).cameraSystem.maxTilt)}get minPitch(){return a(this,me).mode==="outdoors-overlay"&&a(this,me).map?a(this,me).map?.getMinPitch?.():Xe.radToDeg(a(this,Oe).cameraSystem.minTilt)}setMinPitch(t){let r=Math.max(tee,t);a(this,me).map?.setMinPitch(r),a(this,Oe).cameraSystem.minTilt=Xe.degToRad(r)}setMaxPitch(t){let r=Math.min(ree,t);a(this,me).map?.setMaxPitch(r),a(this,Oe).cameraSystem.maxTilt=Xe.degToRad(r)}get bearing(){return a(this,me).mode==="outdoors-overlay"&&a(this,me).map?a(this,me).map?.getBearing():Xe.radToDeg(a(this,Oe).cameraSystem.getRotation())}setBearing(t){if(a(this,me).mode==="outdoors-overlay"&&a(this,me).map){a(this,me).map?.setBearing(t);return}a(this,Oe).cameraSystem.setRotation(Xe.degToRad(t))}get pitch(){return a(this,me).mode==="outdoors-overlay"&&a(this,me).map?a(this,me).map?.getPitch():Xe.radToDeg(a(this,Oe).cameraSystem.getTilt())}setPitch(t){if(a(this,me).mode==="outdoors-overlay"&&a(this,me).map){a(this,me).map?.setPitch(t);return}a(this,Oe).cameraSystem.setTilt(Xe.degToRad(Yi(t,this.minPitch,this.maxPitch,"pitch was clamped to minPitch/maxPitch bounds. Use mapView.Camera.setMinPitch() and mapView.Camera.setMaxPitch() to adjust limits.")))}get elevation(){return a(this,Oe).cameraSystem.getPedestal()}setElevation(t){a(this,Oe).cameraSystem.setPedestal(t,!0)}animateElevation(t,r){return a(this,Mg)&&a(this,Mg).stop(),new Promise(n=>{a(this,Oe).cameraSystem.animateCamera({position:{z:t}},r?.duration||300,Fs[r?.easing||"ease-in-out"],n,n,{interruptible:r?.interruptible??!0})})}get insetsPadding(){return a(this,Ua).insetsPadding}get panMode(){return a(this,Oe).cameraSystem.enablePan===!1&&a(this,Oe).cameraSystem.enablePedestal===!0?"elevation":"default"}setPanMode(t){if(t!=="default"&&t!=="elevation")throw new Error("Invalid pan mode");t!==this.panMode&&(t==="default"?(a(this,Oe).cameraSystem.enablePan=!0,a(this,Oe).cameraSystem.enablePedestal=!1):(a(this,Oe).cameraSystem.enablePan=!1,a(this,Oe).cameraSystem.enablePedestal=!0))}setInsetPadding(t){a(this,Ua).insetsPadding=Object.assign({},a(this,Ua).insetsPadding,t)}animateTo(t){if(a(this,me).mode==="outdoors-overlay"&&a(this,me).map)return a(this,me).map?.flyTo({center:t.center??this.center,zoom:t.zoomLevel??this.zoomLevel,bearing:t.bearing??this.bearing,pitch:t.pitch??this.pitch,duration:t.duration??600}),Promise.resolve();let r=t.center?a(this,me).convertTo3DMapPosition(t.center[1],t.center[0],t.center[2]||this.elevation):void 0,n=t.zoomLevel!==void 0?a(this,Oe).cameraSystem.convertZoomLevelToAltitude(Yi(t.zoomLevel,this.minZoomLevel,this.maxZoomLevel,"zoomLevel was clamped to minZoomLevel/maxZoomLevel bounds. Use mapView.Camera.setMinZoomLevel() and mapView.Camera.setMaxZoomLevel() to adjust limits.")):void 0,o=t.bearing!==void 0?Xe.degToRad(t.bearing):void 0,i=t.pitch!==void 0?Xe.degToRad(Yi(t.pitch,this.minPitch,this.maxPitch,"pitch was clamped to minPitch/maxPitch bounds. Use mapView.Camera.setMinPitch() and mapView.Camera.setMaxPitch() to adjust limits.")):void 0;return new Promise(s=>{a(this,Oe).cameraSystem.animateCamera({position:r,zoom:n,rotation:o,tilt:i},t.duration||0,Fs[t.easing||"ease-in-out"],()=>{a(this,Oe).interactionSystem.handleHover(),s()},s,{interruptible:t?.interruptible??!0})})}getCameraFrameForCoordinates(t,r){let n=z(this,Pg,$C).call(this,r||{},()=>Promise.resolve()),{pointCloud:o}=E8(t,a(this,me),a(this,Ua).geometry3DMap);if(o.length===0)return A.error("No valid coordinates found in targets:",t),{center:this.center,zoomLevel:this.zoomLevel};let{center:i,zoomLevel:s}=a(this,Oe).cameraSystem.getCameraFrameForCoordinates(o,n);return{center:a(this,me).convert3DMapPositionToCoordinate(i),zoomLevel:s}}focusOn(t,r){let{pointCloud:n,geoBounds:o,firstPosition:i}=E8(t,a(this,me),a(this,Ua).geometry3DMap);return n.length===0?(A.error("No valid coordinates found in targets:",t),Promise.resolve()):a(this,me).mode==="outdoors-overlay"&&a(this,me).map?(n.length===1&&i?a(this,me).map?.flyTo({center:[i[0],i[1]],duration:r?.duration||a(this,me).map.getBearing(),animate:!0,bearing:r?.bearing===void 0?a(this,me).map.getBearing():r?.bearing,pitch:r?.pitch===void 0?a(this,me).map.getPitch():r?.pitch,zoom:r?.maxZoomLevel||a(this,me).map.getMaxZoom()}):(nee&&iee(a(this,me),o),a(this,me).map?.fitBounds(o,{duration:r?.duration??ki.DEFAULT_ANIMATION_DURATION,bearing:r?.bearing===void 0?a(this,me).map.getBearing():r?.bearing,pitch:r?.pitch===void 0?a(this,me).map.getPitch():r?.pitch,maxZoom:r?.maxZoomLevel??a(this,me).map.getMaxZoom()})),a(this,Oe).interactionSystem.handleHover(),Promise.resolve()):new Promise(s=>{a(this,Oe).cameraSystem.focusOn(n,z(this,Pg,$C).call(this,r||{},s))})}};me=new WeakMap,Oe=new WeakMap,Ua=new WeakMap,Mg=new WeakMap,Pg=new WeakSet,$C=function(t,r){return{minZoom:t?.maxZoomLevel===void 0?void 0:a(this,Oe).cameraSystem.convertZoomLevelToAltitude(Yi(t.maxZoomLevel,this.minZoomLevel,this.maxZoomLevel,"maxZoomLevel was clamped to minZoomLevel/maxZoomLevel bounds. Use mapView.Camera.setMaxZoomLevel() to adjust limits.")),maxZoom:t?.minZoomLevel===void 0?void 0:a(this,Oe).cameraSystem.convertZoomLevelToAltitude(Yi(t.minZoomLevel,this.minZoomLevel,this.maxZoomLevel,"minZoomLevel was clamped to minZoomLevel/maxZoomLevel bounds. Use mapView.Camera.setMinZoomLevel() to adjust limits.")),padding:t?.padding?Object.assign({},mb,t?.padding):this.insetsPadding,curve:Fs[t?.easing||"ease-in-out"],rotation:t?.bearing===void 0?void 0:Xe.degToRad(t.bearing),tilt:t?.pitch!==void 0?Xe.degToRad(Yi(t.pitch,this.minPitch,this.maxPitch,"pitch was clamped to minPitch/maxPitch bounds. Use mapView.Camera.setMinPitch() and mapView.Camera.setMaxPitch() to adjust limits.")):void 0,duration:t?.duration,callback:()=>{a(this,Oe).interactionSystem.handleHover(),r()},cancelledCallback:r,interruptible:t?.interruptible??!0,verticalPadding:t?.verticalPadding}};function WC(e,t){e[0]=Math.min(e[0],t[0]),e[1]=Math.min(e[1],t[1]),e[2]=Math.max(e[2],t[0]),e[3]=Math.max(e[3],t[1])}function E8(e,t,r){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=t.getSystems().renderSystem;(s.threeDdirty||s.twoDdirty)&&t.renderSync();for(let l of e)if(typeof l=="string"){let c=r.get(l);if(!c){A.error("Entity not found with id:",l);continue}let p=new vr;P5(t,"userData"in c?c.userData.entityId??c.id:c.id,n,p,c instanceof kt?c.position.z:void 0);let d=t.convert3DMapPositionToCoordinate(p.min),m=t.convert3DMapPositionToCoordinate(p.max);WC(o,d),WC(o,m),i||(i=t.convert3DMapPositionToCoordinate(p.getCenter(new ue)))}else n.push(t.convertTo3DMapPosition(l[1],l[0],l[2]||0)),WC(o,l),i||(i=l);return{pointCloud:n,geoBounds:o,firstPosition:i}}function iee(e,t){let r=[[t[0],t[1]],[t[0],t[3]],[t[2],t[3]],[t[2],t[1]],[t[0],t[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:r}}}),e.map?.addLayer({id:"bounds-outline",type:"line",source:"bounds-source",layout:{},paint:{"line-color":"#FF0000","line-width":2,"line-opacity":.8}})}u();u();var D8=`uniform vec4 uSize;
|
|
203
203
|
varying vec2 vUv;
|
|
204
204
|
void main() {
|
|
205
205
|
vUv = uv;
|
|
@@ -696,7 +696,7 @@ void main(void) {
|
|
|
696
696
|
void main() {
|
|
697
697
|
fragColor = vec4(vColor, 1.0);
|
|
698
698
|
}
|
|
699
|
-
`})}applyId(t,r){let n=t.attributes.position,o=new Float32Array(n.count*3);Yee(o,n.count,r),t.setAttribute("color",new Sn(o,3))}createOccluderMesh(t,r){let n=new Re(t,this.pickingMaterial);return n.layers.set(Bg),this.applyId(n.geometry,r),n.userData.occluderId=r,n}reserveOccluderId(){return this.color++,this.color}enable(){this.enabled=!0}disable(){this.enabled=!1}destroy(){this.destroyed=!0,this.pickingTexture?.dispose(),this.pickingMaterial.dispose(),this.pickingTexture=void 0,this.pixelBuffer=void 0}};u();var Iv=class{constructor(t){this.state=t;f(this,"dirty",!0)}update(){if(this.dirty){for(let t of this.state.geometry3DIdsInScene){let r=this.state.geometry3DMap.get(t);if(r instanceof Ke&&r.type==="geometry"&&r.components[0]?.geometry!=null){let n=r.components[0];n.geometry&&(n.geometry.dispose(),n.geometry=void 0)}}this.dirty=!1}}};var lD=new Zi;var{DEFAULT_PITCH:iT,DEFAULT_BEARING:sT,DEFAULT_ZOOM_LEVEL:aT,DEFAULT_MIN_ZOOM_LEVEL:Jee,DEFAULT_MAX_ZOOM_LEVEL:qee}=ki,Kee=Xe.radToDeg(.6435011087932844),ur,tr,Xp,Ng,zf,tc,Zp,Xf,cn,rT,G,Jo,Yp,bt,Gi,dr,qo,zr,R,Gg,Lr,Dt,cD,pD,uD,Wa,jg,Ug,Vg,Hg,Zf,Sv,Wg,$g,zg,Jp,nT,qp,Xg,Zg,An,Ln,oT,Cv,Tv,Yf,Yg,tT=class extends Fe{constructor(r,n={}){super();T(this,cn);f(this,"options");f(this,"container");f(this,"Debug");T(this,ur);T(this,tr);T(this,Xp);T(this,Ng);T(this,zf);T(this,tc);T(this,Zp);T(this,Xf);f(this,"rendererDomElement");T(this,G,{geometry3DMap:new Map,geometry2DMap:new Map,geometry2DIdsInScene:new Set,geometry3DIdsInScene:new Set,geometryGroupIdsToLoad:new Set,entityScene:new kt("__scene"),hoverColor:"#f6efff",text3dHoverColor:"white",insetsPadding:mb,shouldMeasureCanvas:!0,pixelRatio:this.resolutionScale,canvasWidth:0,canvasHeight:0,internalTweenGroup:new Rx,externalTweenGroup:new Rx,cameraObject:new Zv,naturalBearing:0,containerOffset:[0,0],useStandaloneCamera:!1});T(this,Jo,{});T(this,Yp,new AbortController);f(this,"camera");T(this,bt);T(this,Gi);T(this,dr);T(this,qo);T(this,zr);T(this,R,{});T(this,Gg,window.matchMedia("screen and (min-resolution: 2dppx)"));f(this,"map");T(this,Lr,()=>{this.aborted||!a(this,R)?.renderSystem||(a(this,R).renderSystem.twoDdirty=!0)});T(this,Dt,()=>{this.aborted||!a(this,R)?.renderSystem||(a(this,R).renderSystem.threeDdirty=!0)});T(this,Wa,"standalone");T(this,jg,()=>{a(this,R).geometryDisposalSystem.dirty=!0,this.render()});T(this,Ug,r=>Math.trunc(r*10)/10);T(this,Vg,()=>{z(this,cn,rT).call(this,yu()),a(this,R).twoDDrawSystem.dirty=!0,a(this,Zf).call(this,void 0,void 0,!0)});T(this,Hg,()=>{a(this,Zf).call(this)});T(this,Zf,(r,n,o=!1)=>{let i=r??this.rendererDomElement.clientWidth,s=n??this.rendererDomElement.clientHeight;if((i===0||s===0)&&!o)return;a(this,G).canvasWidth=i,a(this,G).canvasHeight=s,z(this,cn,rT).call(this,yu()),a(this,Jp).call(this),z(this,cn,uD).call(this),a(this,R).cameraSystem.resize(this.canvasWidth,this.canvasHeight),a(this,R).cameraSystem.dirty=!0,a(this,R).watermarkSystem.resize(this.canvasWidth,this.canvasHeight),a(this,R).htmlControlsSystem.resize(this.canvasWidth),a(this,R).geometryInFocusSystem.resize(),a(this,R).occlusion2DSystem.resize();let{top:l,left:c}=this.container.getBoundingClientRect();a(this,G).containerOffset=[l,c],this.publish("resize"),this.render()});T(this,Sv,()=>{this.renderSync()});T(this,Wg,new ue);T(this,$g,(r,n)=>{let o=this.mode==="standalone"?a(this,tr):this.viewCamera;if(a(this,tr).position.z+this.camera.elevation>n.z){a(this,Wg).copy(n);let i=a(this,Wg).project(o),s=(i.x+1)/2*this.canvasWidth-0/2,l=(-i.y+1)/2*this.canvasHeight-0/2,c=a(this,Ug).call(this,s),p=a(this,Ug).call(this,l);r.x=c,r.y=p}else r.x=-1e3,r.y=-1e3});T(this,zg,(r,n)=>{a(this,zr).setBufferSize(r,n),a(this,tr).aspect=r/n,a(this,tr).updateProjectionMatrix(),a(this,tr).updateMatrixWorld(!0),a(this,zf).x=r,a(this,zf).y=n});T(this,Jp,()=>{let r=a(this,G).canvasWidth=this.rendererDomElement.clientWidth,n=a(this,G).canvasHeight=this.rendererDomElement.clientHeight,o=Math.floor(r*this.resolutionScale),i=Math.floor(n*this.resolutionScale);a(this,zg).call(this,o,i),this.map?.resize(),a(this,G).shouldMeasureCanvas=!1});f(this,"getParentContainer",(r,n=!0)=>{if(!r)return n?a(this,G).entityScene:void 0;if(typeof r=="string"||typeof r=="number"){let o=a(this,G).geometry3DMap.get(r);return o instanceof kt?o:(A.warn(`Parent (${typeof r=="object"?r.id:r}) is not a valid container, adding to scene`),n?a(this,G).entityScene:void 0)}else if(r.type==="group-container"){let o=a(this,G).geometry3DMap.get(r.id);if(o instanceof kt)return o}return n?a(this,G).entityScene:void 0});f(this,"showCollisionBoxes",()=>{a(this,R).collisionSystem.showCollisionBoxes(),this.render()});f(this,"hideCollisionBoxes",()=>{a(this,R).collisionSystem.hideCollisionBoxes(),this.render()});f(this,"projectScreenXYToCoordinate",(r,n,o=!1)=>{let i=this.container.getBoundingClientRect(),s=(r-i.left)/a(this,G).canvasWidth*2-1,l=-((n-i.top)/a(this,G).canvasHeight)*2+1,c=new De(s,l),p,d;if(o?(lD.setFromCamera(c,a(this,tr)),p=lD.intersectObject(a(this,tc),!1)[0]?.point):(p=a(this,R).interactionSystem.getThreeDIntersectsFromXY(c)?.[0]?.point,d=a(this,R).interactionSystem.getGroupContainerIntersectsFromXY(c)),p)return{coordinate:this.convert3DMapPositionToCoordinate(p),groupContainers:d}});f(this,"projectCoordinateToScreenXY",r=>{let n=this.convertTo3DMapPosition(r[1],r[0],r[2]||0),o=new De;return a(this,$g).call(this,o,n),{x:o.x,y:o.y}});f(this,"convert3DMapPositionToCoordinate",r=>{let{lat:n,lon:o}=yb(a(this,G).center?.[1]??0,a(this,G).center?.[0]??0,r.x,r.y);return[o,n,r.z]});f(this,"setBackgroundColor",(r,n)=>{a(this,zr).setBackgroundColor(r,n)});f(this,"getMetresPerPixel",()=>{let r=this.container.clientWidth,n=this.container.clientHeight/2,o=this.projectScreenXYToCoordinate(0,n,!0),i=this.projectScreenXYToCoordinate(r,n,!0);return o==null||i==null?void 0:pb(o.coordinate,i.coordinate)/r});f(this,"hideOutdoorLayersUnderPoint",(r,n)=>{!this.map||n?.length===0||(a(this,R).outdoorLayersSystem.hideLayersUnderPoint(r,n),this.render())});f(this,"hideOutdoorLayersIntersectingPolygons",(r,n,o)=>{a(this,R).outdoorLayersSystem.hideLayersIntersectingPolygons(r,n,o),this.render()});T(this,qp,new qT);T(this,Xg,new to);T(this,Zg,r=>{A.error("Render failed: ",r,r.stack??"No stack trace available"),this.publish("render-error",{error:r})});f(this,"render",()=>{if(!(a(this,R)?.renderSystem==null||this.aborted))if(this.map&&(this.mode==="outdoors-interleaved"||this.mode==="outdoors-overlay"))this.map.triggerRepaint();else return a(this,R).renderSystem.update().catch(a(this,Zg))});f(this,"renderSync",()=>this.aborted?Promise.resolve():a(this,R).renderSystem.update(!0).catch(a(this,Zg)));T(this,An,Sm(()=>{this.publish("user-interaction-start",void 0)},0,!0));T(this,Ln,Sm(()=>{this.publish("user-interaction-end",void 0),this.render()},0,!0));f(this,"on",(r,n)=>{this.aborted||(super.on(r,n),["outdoor-view-loaded","outdoor-style-loaded"].includes(r)&&this.mode==="standalone"&&y.env.NODE_ENV!=="test"&&(A.warn(`"${r}" was subscribed to but outdoor view is disabled. The event has been triggered immediately. Enable outdoor view or remove the listener.`),this.publish(r)))});f(this,"off",(r,n)=>{super.off(r,n)});f(this,"getCursor",()=>a(this,R).interactionSystem.getCursor());T(this,Cv,()=>{if(a(this,G).entityScene.removeEventListener("childadded",a(this,Dt)),a(this,G).entityScene.removeEventListener("childadded",a(this,Lr)),a(this,G).entityScene.removeEventListener("childremoved",a(this,Dt)),a(this,G).entityScene.removeEventListener("childremoved",a(this,Lr)),window.removeEventListener("resize",a(this,Hg),!1),a(this,Gg).removeEventListener("change",a(this,Vg)),this.map){for(let r in a(this,Jo))for(let n of a(this,Jo)[r])this.map.off(r,n);w(this,Jo,{})}this._subscribers={}});T(this,Tv,()=>{try{a(this,Wa)!=="outdoors-overlay"&&(this.map&&this.map.remove(),this.container&&this.rendererDomElement&&this.container.contains(this.rendererDomElement)&&this.container.removeChild(this.rendererDomElement)),this.container&&(a(this,qo)&&this.container.contains(a(this,qo))&&this.container.removeChild(a(this,qo)),a(this,bt)&&this.container.contains(a(this,bt))&&this.container.removeChild(a(this,bt)))}catch(r){A.warn("Error during DOM cleanup, some elements may not have been removed:",r)}});f(this,"destroy",()=>{a(this,R)&&(this.aborted||a(this,Yp).abort(),a(this,Cv).call(this),this.remove("__scene"),a(this,R).renderSystem.destroy(),a(this,R).cameraSystem.dispose(),a(this,R).exporterSystem.destroy(),a(this,R).outdoorLayersSystem.destroy(),a(this,R).drawSystem.destroy(),a(this,Zp)&&a(this,Zp).disconnect(),a(this,zr).destroy(),a(this,ur)?.traverse(r=>{Qt(r),"dispose"in r&&typeof r.dispose=="function"&&r.dispose()}),w(this,ur,void 0),a(this,R).htmlControlsSystem.destroy(),a(this,R).collisionSystem.destroy(),a(this,R).interactionSystem.destroy(),a(this,R).domMutationSystem.destroy(),a(this,R).geometryInFocusSystem.destroy(),a(this,R).occlusion2DSystem.destroy(),w(this,R,void 0),a(this,Tv).call(this),w(this,zr,void 0))});T(this,Yf,new ue);T(this,Yg,new ue);if(w(this,Yp,new AbortController),a(this,G).useStandaloneCamera=n.useStandaloneCamera??!1,a(this,G).naturalBearing=n.naturalBearing??0,this.convertTo3DMapPosition=this.convertTo3DMapPosition.bind(this),!r.clientWidth||!r.clientHeight)throw new Error("[MappedinJS] Container width and height must be greater than 0");this.convertTo3DMapPosition=this.convertTo3DMapPosition.bind(this),(n.mode==="outdoors-interleaved"||n.mode==="outdoors-overlay")&&n.map&&(w(this,Wa,n.mode),this.map=n.map),a(this,G).entityScene.addEventListener("childadded",()=>{a(this,Dt).call(this),a(this,Lr).call(this)}),a(this,G).entityScene.addEventListener("childremoved",()=>{a(this,Dt).call(this),a(this,Lr).call(this)}),a(this,G).geometry3DMap.set(a(this,G).entityScene.userData.entityId,a(this,G).entityScene),n.center&&(a(this,G).center=n.center?[...n.center]:[0,0]),this.options=n,this.container=r,z(this,cn,cD).call(this),z(this,cn,pD).call(this),a(this,R).htmlControlsSystem=new qx(this.container,{outdoorEnabled:!!this.map}),a(this,Wa)!=="outdoors-overlay"&&a(this,R).htmlControlsSystem.addAttributionControl(this.options.attribution),window.MappedinDebug||(window.MappedinDebug={}),y.env.NODE_ENV==="test"&&(window.MappedinDebug.mapViewCoreInstance=this),w(this,zr,new B0({antialias:typeof n.antialias=="boolean"?n.antialias:!0,alpha:!1,canvas:this.mode!=="standalone"?n.gl?.canvas:void 0,onWebGLContextCreationError:n.onWebGLContextCreationError,onWebGLContextLost:n.onWebGLContextLost,onWebGLContextRestored:v=>{n.onWebGLContextRestored?.(v),a(this,Lr).call(this),a(this,Dt).call(this),this.render()},onWebGLRendererError:n.onWebGLRendererError,backgroundColor:n.backgroundColor||"#ffffff",backgroundAlpha:n.backgroundAlpha??1})),w(this,ur,new al),a(this,Wa)!=="standalone"&&a(this,ur).add(G5()),a(this,ur).add(a(this,G).entityScene);let o=window.__THREE_DEVTOOLS__;y.env.NODE_ENV==="dev"&&typeof o<"u"&&(o.dispatchEvent(new CustomEvent("observe",{detail:a(this,ur)})),o.dispatchEvent(new CustomEvent("observe",{detail:a(this,zr)}))),w(this,tr,new Zv(Kee,this.aspect,50,1e5)),a(this,G).cameraObject=a(this,tr),w(this,Ng,new YT),a(this,tr).renderOrder=999;let i=new oi;i.add(a(this,tr)),w(this,Xf,new oi),a(this,Xf).add(i),a(this,ur).add(a(this,Xf)),a(this,tr).updateProjectionMatrix(),a(this,tr).updateMatrixWorld(!0),this.referenceMap={scale:1,latitude:0,longitude:0,getNorth:()=>0,georeference:[{target:{x:0,y:0}},{target:{x:0,y:0}},{target:{x:0,y:0}},{target:{x:0,y:0}}]},this.rendererDomElement=a(this,zr).domElement(),w(this,zf,new De);let s=new si(1e6,1e6),l=new Tr({color:0,visible:!1});w(this,tc,new Re(s,l)),a(this,tc).name="worldPlane",a(this,ur).add(a(this,tc)),n.gl?.canvas||r.appendChild(this.rendererDomElement),window.addEventListener("resize",a(this,Hg),!1),a(this,Gg).addEventListener("change",a(this,Vg)),typeof ResizeObserver=="function"&&y.env?.NODE_ENV!=="test"&&(w(this,Zp,new ResizeObserver(C5(v=>{a(this,Zf).call(this,v[0].contentRect.width,v[0].contentRect.height)},50))),a(this,Zp)?.observe(r)),r.classList.add("mappedin-map"),this.rendererDomElement.style.width=globalThis.MappedinDebug?.TEST_IOS?"1080px":"100%",this.rendererDomElement.style.height=globalThis.MappedinDebug?.TEST_IOS?"1920px":"100%",y.env.NODE_ENV==="test"&&this.rendererDomElement.setAttribute("data-testid","mappedin-canvas"),this.mode!=="outdoors-overlay"&&this.rendererDomElement.tabIndex!==void 0&&this.rendererDomElement.removeAttribute("tabindex"),a(this,G).canvasWidth=this.rendererDomElement.clientWidth,a(this,G).canvasHeight=this.rendererDomElement.clientHeight,this.rendererDomElement.style.touchAction="manipulation";let c=this.canvasWidth,p=this.canvasHeight;a(this,R).watermarkSystem=new Xx(a(this,tr),a(this,G),n?.watermark),a(this,R).watermarkSystem.on("texture-loaded",this.render),a(this,G).shouldMeasureCanvas=!0,a(this,G).pixelRatio=this.resolutionScale,a(this,zg).call(this,Math.floor(c*this.resolutionScale),Math.floor(p*this.resolutionScale));let d=new lb(16777215,.3*Math.PI);d.position.set(-150,-150,350),a(this,ur).add(d);let m=new t5(16777215,.741*Math.PI);a(this,ur).add(m),a(this,R).cameraSystem=new jp(a(this,tr),a(this,ur),a(this,zr).renderer,a(this,G),{mode:this.mode,canvasHeight:p,canvasWidth:c}),a(this,R).cameraSystem.on("user-dolly-start",a(this,An)),a(this,R).cameraSystem.on("user-pan-start",a(this,An)),a(this,R).cameraSystem.on("user-rotate-start",a(this,An)),a(this,R).cameraSystem.on("user-zoom-start",a(this,An)),a(this,R).cameraSystem.on("user-tilt-start",a(this,An)),a(this,R).cameraSystem.on("user-pedestal-start",a(this,An)),a(this,R).cameraSystem.on("user-dolly-end",a(this,Ln)),a(this,R).cameraSystem.on("user-pan-end",a(this,Ln)),a(this,R).cameraSystem.on("user-rotate-end",a(this,Ln)),a(this,R).cameraSystem.on("user-zoom-end",a(this,Ln)),a(this,R).cameraSystem.on("user-tilt-end",a(this,Ln)),a(this,R).cameraSystem.on("user-pedestal-end",a(this,Ln)),a(this,R).cameraSystem.on("change",()=>{this.publish("camera-change",this.camera),a(this,R).geometryInFocusSystem&&(a(this,R).geometryInFocusSystem.cameraDirty=!0),this.render()}),this.onAbort(()=>{a(this,R).cameraSystem.off("user-dolly-start",a(this,An)),a(this,R).cameraSystem.off("user-pan-start",a(this,An)),a(this,R).cameraSystem.off("user-rotate-start",a(this,An)),a(this,R).cameraSystem.off("user-zoom-start",a(this,An)),a(this,R).cameraSystem.off("user-tilt-start",a(this,An)),a(this,R).cameraSystem.off("user-pedestal-start",a(this,An)),a(this,R).cameraSystem.off("user-dolly-end",a(this,Ln)),a(this,R).cameraSystem.off("user-pan-end",a(this,Ln)),a(this,R).cameraSystem.off("user-rotate-end",a(this,Ln)),a(this,R).cameraSystem.off("user-zoom-end",a(this,Ln)),a(this,R).cameraSystem.off("user-tilt-end",a(this,Ln)),a(this,R).cameraSystem.off("user-pedestal-end",a(this,Ln)),a(this,R).renderSystem.off("measure-canvas",a(this,Jp)),a(this,R).cameraSystem.off("change",this.render)}),a(this,R).pathSystem=new Rg(a(this,G),this.convertTo3DMapPosition,this.getParentContainer,a(this,R).cameraSystem.convertZoomLevelToAltitude),a(this,R).pathSystem.on("animate:path",this.render),this.onAbort(()=>{a(this,R).pathSystem.off("animate:path",this.render)}),a(this,R).panBoundsSystem=new Jx(a(this,G),a(this,R).cameraSystem);let g=()=>{let{panBounds:v,fov:C,convertAltitudeToZoomLevel:I}=a(this,R).cameraSystem;if(a(this,R).panBoundsSystem.autoMinZoomLevel){if(v.radius<=0)return;let S=Math.min(a(this,G).canvasWidth/a(this,G).canvasHeight,1),P=C*Math.PI/180*S,O=Math.tan(P/2),{radius:M,center:E}=a(this,R).cameraSystem.panBounds,B=M/O,j=this.getThreeCamera().getWorldPosition(new ue),L=E.distanceTo(j),N=Math.abs(j.z-E.z),X=B*N/L,Z=I(X);B5(Z,this.camera.minZoomLevel)&&this.camera.setMinZoomLevel(Z)}this.publish("pan-bounds-change",a(this,R).cameraSystem.panBounds)};a(this,R).panBoundsSystem.on("update",g),this.onAbort(()=>{a(this,R).panBoundsSystem.off("update",g)}),this.camera=new zx(this,a(this,R),a(this,G)),this.camera.setZoomLevel(n.zoomLevel??aT),this.camera.setBearing(n.bearing??sT),this.camera.setPitch(n.pitch??iT),this.camera.setMaxZoomLevel(qee),this.camera.setMinZoomLevel(Jee),a(this,R).domVisiblitySystem=new Ex(a(this,G),a(this,qo)),a(this,R).domMutationSystem=new $x(a(this,G),a(this,qo)),a(this,R).domMutationSystem.on("dimensions-update",()=>{a(this,R).collisionSystem.collidersDirty=!0,this.render()}),a(this,R).domDrawSystem=new Wx(a(this,G)),a(this,R).collisionSystem=new G0(a(this,Gi),a(this,G),(n.useCollisionWorker??!0)&&(n.useWorkers??!0)),a(this,R).twoDDrawSystem=new Fx(a(this,G),a(this,dr),n.transformImageRequest),a(this,R).twoDDrawSystem.on("img:loaded",this.render),a(this,R).interactionSystem=new $h(this.rendererDomElement,a(this,G),a(this,tr),a(this,tc),a(this,R).cameraSystem.isUserInteracting),a(this,R).interactionSystem.on("doubletap-with-onefinger",v=>{a(this,R).cameraSystem.enableZoom&&this.camera.animateTo({center:this.projectScreenXYToCoordinate(v.clientX,v.clientY)?.coordinate,zoomLevel:this.camera.zoomLevel+1,duration:r2,easing:"ease-out"})}),a(this,R).interactionSystem.on("singletap-with-twofinger",()=>{a(this,R).cameraSystem.enableZoom&&this.camera.animateTo({zoomLevel:this.camera.zoomLevel-1,duration:r2,easing:"ease-out"})}),a(this,R).interactionSystem.on("hover",this.render),a(this,R).interactionSystem.on("click",v=>{if(v.entity2D?.id==="watermark"&&typeof a(this,R).watermarkSystem.options.onClick=="function"&&a(this,R).watermarkSystem.options.interactive){a(this,R).watermarkSystem.options.onClick();return}let C=v.entity3D?[v.entity3D?.id]:[];v.entity3D?.parentObject3D?.userData?.entityId&&C.push(v.entity3D?.parentObject3D?.userData?.entityId),this.publish("click",{coordinate:this.convert3DMapPositionToCoordinate(v.position),geometry:C,paths:v.entity3D?.components[0]instanceof Jl?[v.entity3D.id]:[],markers:v.entity2D?.components[0]instanceof ws?[v.entity2D.id]:[],models:v.entity3D?.components[0]instanceof Zl?[v.entity3D.id]:[],labels:v.entity2D?.components[0]instanceof Os?[v.entity2D.id]:[],containers:Array.isArray(v.groupContainers)?v.groupContainers.map(I=>I.userData.entityId):[],pointerEvent:v.pointerEvent})}),a(this,R).interactionSystem.on("hover",v=>{v.position&&this.publish("hover",{coordinate:this.convert3DMapPositionToCoordinate(v.position),geometry:v.entity3D?[v.entity3D?.id]:[],paths:v.entity3D?.components[0]instanceof Jl?[v.entity3D.id]:[],markers:v.entity2D?.components[0]instanceof ws?[v.entity2D.id]:[],models:v.entity3D?.components[0]instanceof Zl?[v.entity3D.id]:[],labels:v.entity2D?.components[0]instanceof Os?[v.entity2D.id]:[],containers:Array.isArray(v.groupContainers)?v.groupContainers.map(C=>C.userData.entityId):[]})}),a(this,R).geometryInFocusSystem=new av(a(this,G),a(this,tr));let x=v=>{this.publish("geometry-in-focus",v)};a(this,R).geometryInFocusSystem.on("geometry-in-focus",x),this.onAbort(()=>{a(this,R).geometryInFocusSystem.off("geometry-in-focus",x)}),a(this,R).twoDVisiblitySystem=new Ax(a(this,G)),a(this,R).drawSystem=new kx(a(this,G),this.convertTo3DMapPosition),a(this,R).drawSystem.on("texture-loaded",this.render),a(this,R).twoDProjectionSystem=new Dx(a(this,G),a(this,$g)),a(this,R).exporterSystem=new ag(a(this,G)),a(this,R).meshOptimizationSystem=new _x(a(this,G),this.convertTo3DMapPosition),a(this,R).meshOptimizationSystem.on("model-loaded",this.render),a(this,R).meshOptimizationSystem.on("geometry-2d-added",this.render),a(this,R).meshOptimizationSystem.on("geometry-group-added",a(this,jg)),this.onAbort(()=>{a(this,R).meshOptimizationSystem.off("model-loaded",this.render),a(this,R).meshOptimizationSystem.off("geometry-2d-added",this.render),a(this,R).meshOptimizationSystem.off("geometry-group-added",a(this,jg))}),a(this,R).meshDetachmentSystem=new fv(a(this,G)),a(this,R).meshModificationSystem=new mv(a(this,G)),a(this,R).geometryDisposalSystem=new Iv(a(this,G)),a(this,R).customGeometrySystem=new Kx(a(this,G),this.convertTo3DMapPosition),a(this,R).outlineInterpolationSystem=new tv(a(this,G)),a(this,R).renderSystem=new Lx(a(this,zr),a(this,G),this.mode,a(this,ur),a(this,tr),this.viewCamera,a(this,R)),a(this,R).imageSystem=new sv(a(this,G),this.convertTo3DMapPosition,n.bearing,n.naturalBearing,n.imagePlacementOptions),a(this,R).text3DSystem=new lx(a(this,G),this.convertTo3DMapPosition,n.useWorkers??!0),a(this,R).text3DSystem.on("render",this.render),a(this,R).imageSystem.on("image-loaded",this.render),a(this,R).renderSystem.on("pre-render",()=>this.publish("pre-render")),a(this,R).renderSystem.on("post-render",()=>this.publish("post-render")),a(this,R).renderSystem.on("measure-canvas",a(this,Jp)),this.onAbort(()=>{a(this,R).renderSystem.off("pre-render",()=>this.publish("pre-render")),a(this,R).renderSystem.off("post-render",()=>this.publish("post-render")),a(this,R).renderSystem.off("measure-canvas",a(this,Jp))}),a(this,R).outdoorLayersSystem=new pv(this.map),a(this,R).occlusion2DSystem=new vv(a(this,G),this.convertTo3DMapPosition,a(this,zr)),n.occlusionEnabled&&a(this,R).occlusion2DSystem.enable(),this.Debug=new xv(this),n.environment!==!1&&w(this,Xp,z(this,cn,oT).call(this)),a(this,Sv).call(this)}get viewCamera(){return a(this,Ng)}get canvasWidth(){return a(this,G).canvasWidth}get canvasHeight(){return a(this,G).canvasHeight}get resolutionScale(){return this.map?._getClampedPixelRatio(this.canvasWidth,this.canvasHeight)??yu()}get aspect(){return this.canvasWidth/this.canvasHeight}get mode(){return a(this,Wa)}addGroupContainer(r,n,o){if(!a(this,G).geometry3DMap.has(r)&&!a(this,G).geometry2DMap.has(r)){let i=new kt(r);i.addEventListener("childadded",()=>{a(this,Dt).call(this),a(this,Lr).call(this)}),i.addEventListener("childremoved",()=>{a(this,Dt).call(this),a(this,Lr).call(this)}),n?.visible!==void 0&&(i.visible=n.visible),n?.altitude!==void 0&&i.setAltitude(n.altitude),n?.interactive!==void 0&&$r(i,n.interactive,a(this,G)),n?.focusable!==void 0&&hx(i,n.focusable),n?.preloadGeometry!==void 0&&(i.userData.preloadGeometry=n.preloadGeometry),a(this,G).geometry3DMap.set(r,i);let s=this.getParentContainer(o);s instanceof kt&&s.addEntity(i),a(this,Dt).call(this),this.render()}else A.error(`Group container with ID '${r}' already exists. The group container cannot be added.`);return{id:r,type:"group-container"}}addCustomGeometry(r,n,o,i,s){if(a(this,G).geometry3DMap.has(r))A.error(`Custom geometry with ID '${r}' already exists. The custom geometry cannot be added.`);else{let l=new Uf(n,o),c=new Ke(l,new Qi(i));i?.interactive!==void 0&&$r(c,i.interactive,a(this,G)),c.id=r,l.mesh.userData={entityId:r,type:"custom-geometry"},a(this,G).geometry3DMap.set(c.id,c);let p=this.getParentContainer(s);s&&p instanceof kt?p.addEntity(c):a(this,G).entityScene.addEntity(c),a(this,Dt).call(this),this.render()}return{id:r,type:"custom-geometry"}}addGeometryGroup(r,n,o,i){if(!a(this,G).geometry3DMap.has(r)&&!a(this,G).geometry2DMap.has(r)){let s=new ro(r);s.addEventListener("childadded",()=>{a(this,Dt).call(this),a(this,Lr).call(this)}),s.addEventListener("childremoved",()=>{a(this,Dt).call(this),a(this,Lr).call(this)}),s.userData.dirty=!0,a(this,G).geometry3DMap.set(r,s);for(let c of n.features){if(c.geometry==null||!["Polygon","MultiPolygon","LineString","MultiLineString"].includes(c.geometry.type))continue;let p=c?.id||c?.properties?.id||dt(),{visible:d,altitude:m,...g}=o||{color:I5},x=a(this,R).meshOptimizationSystem.createEntityFromFeature(p,c,{outline:!0,...g});a(this,G).geometry3DMap.set(p,x),s.userData.entities3D.add(p)}s.setVisible(o?.visible??!0),o?.altitude!=null&&s.setAltitude(o.altitude);let l=this.getParentContainer(i);l instanceof kt&&l.addEntity(s),a(this,Dt).call(this),this.render()}else A.error(`Geometry group with ID '${r}' already exists. The geometry group cannot be added.`);return a(this,R).outlineInterpolationSystem.geometries3DDirty=!0,{id:r,type:"geometry-group"}}addOccluder(r,n){let o=this.getParentContainer(n),i=a(this,R).occlusion2DSystem.reserveOccluderId();return o?.addOccluderFeature(r,i),i}addImage(r,n,o,i){try{$8(r,n,o)}catch(s){A.error(s);return}if(!a(this,G).geometry3DMap.has(r)&&!a(this,G).geometry2DMap.has(r)){let s=new iv(n),l=new Ke(s,new Qi(o));l.id=r||dt(),s.mesh.userData={entityId:l.id,type:"path"},a(this,G).geometry3DMap.set(l.id,l);let c=this.getParentContainer(i);c instanceof kt&&c.addEntity(l),a(this,Dt).call(this),this.render()}else A.error(`Image with ID '${r}' already exists. The image cannot be added.`);return{id:r,type:"image"}}addModelGroup(r,n,o,{parent:i,onComplete:s}={}){try{y8(r,n,o)}catch(l){A.error(l);return}if(!a(this,G).geometry3DMap.has(r)&&!a(this,G).geometry2DMap.has(r)){let l=new ro(r);l.addEventListener("childadded",()=>{a(this,Dt).call(this),a(this,Lr).call(this)}),l.addEventListener("childremoved",()=>{a(this,Dt).call(this),a(this,Lr).call(this)}),a(this,G).geometry3DMap.set(r,l),l.userData.dirty=!0,l.userData.modelURL=o.url;for(let p of n.features){let d=p.id||p.properties.id||dt(),m=a(this,R).meshOptimizationSystem.createModelFromFeature(d,p,{...o});(p.properties.interactive!==void 0||o.interactive!=null)&&$r(m,p.properties.interactive??o.interactive,a(this,G)),m.parentId=l.userData.entityId,a(this,G).geometry3DMap.set(d,m),l.userData.entities3D.add(d)}let c=this.getParentContainer(i);c instanceof kt&&c.addEntity(l),a(this,Dt).call(this),this.render()?.then(s)}else A.error(`Model group with ID '${r}' already exists. The model group cannot be added.`);return{id:r,type:"geometry-group"}}addMarker2D(r,n,o,i){let s=o?.id;try{A_(r,n,o||{})}catch(l){A.error(l);return}if(s===void 0||!a(this,G).geometry2DMap.has(s)&&!a(this,G).geometry3DMap.has(s)){let l=z(this,cn,nT).call(this,r,new ws(n,o),o?.occluderId,o?.verticalOffset);l.id=s||String(l.id),s=l.id,o?.interactive!=null&&o.interactive!=="pointer-events-auto"&&$r(l,o?.interactive,a(this,G));let c=typeof o?.attachTo=="string"||typeof o?.attachTo=="number"?a(this,G).geometry3DMap.get(o.attachTo):void 0;c instanceof Ke&&c.attach(l),this.getParentContainer(i)?.addEntity(l),this.render()}else A.error(`Marker2D with ID '${s}' already exists. The marker cannot be added.`);return{id:s,type:"marker"}}addText3D(r,n,o,i){if(!a(this,G).geometry3DMap.has(r)&&!a(this,G).geometry2DMap.has(r)){let s=new Wl({...n,properties:{...n.properties,id:r,content:n.properties.text}}),l=new Ke(s,new Cm(o?.appearance));l.id=r,s.mesh.userData.entityId=r.toString(),s.mesh.userData.type="text3d",a(this,G).geometry3DMap.set(r,l);let c=this.getParentContainer(i);c instanceof kt&&c.addEntity(l),a(this,Dt).call(this),this.render()}else A.error(`Text3D with ID '${r}' already exists. The text3d cannot be added.`);return{id:r,type:"text3d"}}labelText3D(r,n,o={}){try{if(!n||!r)throw new Error("content and meshGeometryId are required");DE.parse(o)}catch(p){A.error(p);return}let i=a(this,G).geometry3DMap.get(r);if(i?.type!=="geometry"){A.error(".labelText3D failed: target incorrect");return}let s=i?.components[0];if(!s.feature.properties.textArea)return;if(s.textEntityId){let p=a(this,G).geometry3DMap.get(s.textEntityId);if(p?.type!=="text3d"){A.error(".labelText3D failed: existing text3d not found");return}return{id:p.id,type:p.type}}let l=new Wl({type:"Feature",geometry:{coordinates:s.feature.properties.textArea?.position,type:"Point"},properties:{textArea:s.feature.properties.textArea,content:n,id:dt()}});l.polygonEntityId=r;let c=new Ke(l,new Cm(o?.appearance));return s.textEntityId=c.id.toString(),l.mesh.userData.entityId=c.id.toString(),l.mesh.userData.type="text3d",a(this,G).geometry3DMap.set(c.id.toString(),c),o.parentId&&this.getParentContainer(o.parentId)?.addEntity(c),this.render(),{id:c.id,type:"text3d"}}addLabel2D(r,n,o,i){let s=o?.id;try{IE(r,n,o||{})}catch(l){A.error(l);return}if(s===void 0||!a(this,G).geometry2DMap.has(s)&&!a(this,G).geometry3DMap.has(s)){let l=z(this,cn,nT).call(this,r,new Os(n,o||{},a(this,G)),o?.occluderId,o?.verticalOffset);l.id=s||String(l.id),s=l.id,o?.interactive!=null&&$r(l,o?.interactive,a(this,G));let c=typeof o?.attachTo=="string"||typeof o?.attachTo=="number"?a(this,G).geometry3DMap.get(o.attachTo):void 0;c instanceof Ke&&c.attach(l),this.getParentContainer(i)?.addEntity(l),a(this,Lr).call(this),this.render()}else A.error(`Label2D with ID '${s}' already exists. The label cannot be added.`);return{id:s,type:"label"}}addPath(r,n={},o){try{T8(r,n||{})}catch(c){A.error(c);return}let i=new Jl(r,TC(n)),s=new Ke(i,new Qi({color:n?.color??"#ff834c",altitude:n?.verticalOffset??.1}));s.id=n?.id||dt(),i.mesh.userData={entityId:s.id,type:"path"},a(this,G).geometry3DMap.set(s.id,s),n?.interactive!=null&&$r(s,n?.interactive,a(this,G));let l=this.getParentContainer(o);return l instanceof kt&&l.addEntity(s),a(this,Dt).call(this),this.render(),{id:s.id,type:"path"}}updateWatermark(r){a(this,R).watermarkSystem.options=r,a(this,R).watermarkSystem.dirty=!0,a(this,R).collisionSystem.collidersDirty=!0,this.render()}remove(r){let n;if(typeof r=="string"||typeof r=="number"?(n=a(this,G).geometry2DMap.get(r),n==null&&(n=a(this,G).geometry3DMap.get(r))):typeof r.id=="string"||typeof r.id=="number"?(n=a(this,G).geometry2DMap.get(r.id),n==null&&(n=a(this,G).geometry3DMap.get(r.id))):n=r,n!=null){if(n.type==="custom-geometry")a(this,G).geometry3DMap.delete(n.id),n.object3d&&Qt(n.object3d);else if(n.type==="group-container"){a(this,G).geometry3DMap.delete(n.userData.entityId);for(let i of n.childrenIds.values())this.remove(i),n.userData.entities2D.delete(i);let o=n.components[1];o&&o.focusMesh&&Qt(o.focusMesh),Qt(n)}else if(n.type==="geometry-group"){a(this,G).geometry3DMap.delete(n.userData.entityId);for(let o of n.userData.entities3D.values())this.remove(o),n.userData.entities3D.delete(o);Qt(n)}else if(n.type==="geometry"||n.type==="model"||n.type==="path"){let o=n.components[0],i=n.components[4];if(n.entities2D.size>0){for(let l of n.entities2D.values())this.remove(l);n.removeAllEntities()}let s=n.parentObject3D?.userData.entityId??n.parentId;if(s){let l=a(this,G).geometry3DMap.get(s);l instanceof ro&&l.userData.entities3D.delete(n.id)}if(n.object3d&&Qt(n.object3d),n.type==="geometry"){let l=n.components[3];l&&(l.enabled=!1,l.dirty=!0)}i&&"focusMesh"in i&&i.focusMesh!=null&&Qt(i.focusMesh),"textMesh"in o&&o.textMesh!=null&&this.remove(o.textMesh.userData.entityId),a(this,G).geometry3DMap.delete(n.id)}else if(n.type==="marker"||n.type==="label"){let o=n.attachedTo;if(o){let i=a(this,G).geometry3DMap.get(o);i instanceof Ke&&i.detach(n)}n.object3d&&Qt(n.object3d),n.type==="label"&&delete a(this,R).twoDDrawSystem.textCache[n.id],a(this,G).geometry2DMap.delete(n.id)}else if(n.type==="image")n.object3d&&Qt(n.object3d),a(this,G).geometry3DMap.delete(n.id);else if(n.type==="text3d"){Qt(n.object3d);let{batchedText:o,textMesh:i,polygonEntityId:s}=n.components[0];if(i&&(o&&o.removeText(i),Qt(i)),s){a(this,R).text3DSystem.remove(s);let l=a(this,G).geometry3DMap.get(s);l?.type==="geometry"&&(l.components[0].textMesh=void 0,l.components[0].textEntityId=void 0)}a(this,G).geometry3DMap.delete(n.id)}a(this,Dt).call(this),a(this,Lr).call(this),this.render()}}getScene(){return this.getState("__scene")}getThreeScene(){return a(this,ur)}getThreeCamera(){return a(this,tr)}async setEnvironment(r){if(a(this,ur))if(r==="basic"){a(this,Xp)||w(this,Xp,z(this,cn,oT).call(this));let n=await a(this,Xp);a(this,ur).environment=n}else a(this,ur).environment=null}getEnvironment(){return a(this,ur)?.environment?"basic":!1}getCurrentSceneGLTF(r){return a(this,R).exporterSystem.getCurrentSceneGLTF(r)}getBoundingArea(r){(a(this,R).renderSystem.threeDdirty||a(this,R).renderSystem.twoDdirty)&&this.renderSync();let n=new vr;if(r==null)n.setFromObject(a(this,G).entityScene);else{let o=gu(a(this,G),r);if(o?.type==="geometry"&&o?.object3d!=null){let i=o.components[0],s=i instanceof or?i.geometry:void 0;i.mesh instanceof ib&&s?(s.computeBoundingBox(),s.boundingBox&&n.union(s.boundingBox)):n.setFromObject(o.object3d)}else(o?.type==="geometry-group"||o?.type==="group-container")&&o?.userData.entityId!=null&&n.setFromObject(o)}if(gc(n))return M5(n).map(this.convert3DMapPositionToCoordinate)}hasState(r){return gu(a(this,G),r)!=null}getState(r){if(r==null)return{type:"map-view",hoverColor:a(this,G).hoverColor,text3dHoverColor:a(this,G).text3dHoverColor};let n=gu(a(this,G),r);if(n?.type==="custom-geometry"){let o=n.components[0],i=n.components[1];return{id:n.id,type:"custom-geometry",visible:i.visible,altitude:i.altitude,parent:n.parentObject3D?.userData.entityId,position:this.convert3DMapPositionToCoordinate(o.position)}}else if(n?.type==="geometry-group"){let o=Array.from(n.userData.entities3D.values()),i=o?.[0],s=i?this.getState(i):{};return{id:n.userData.entityId,type:"geometry-group",visible:n.visible,altitude:n.altitude,color:s?.color,initialColor:s?.initialColor,side:s?.side??"double",opacity:s?.opacity,height:s?.height,texture:s?.texture,topColor:s?.topColor,topTexture:s?.topTexture,interactive:s?.interactive,children:o,bevel:s?.bevel}}else{if(n?.type==="group-container")return{id:n.userData.entityId,type:"group-container",visible:n.visible,altitude:n.getWorldPosition(Qee).z??0,opacity:n.opacity,interactive:!!n.components[0],children:Array.from(n.childrenIds.values()).map(o=>this.getState(o)).filter(Boolean)};if(n?.type==="label"){let o=n.components[0],i=n.object3d.parent,s=i?.userData.entityId;return{id:n.id,type:"label",text:o.text||"",parent:{id:s,type:i?.type},position:this.convert3DMapPositionToCoordinate(n.position),enabled:o.enabled,visible:o.visible,initialRank:Hh(o.initialRank),options:{rank:Hh(o.rank),appearance:o.appearance,interactive:n.components[1]!=null,verticalOffset:n.verticalOffset,attachTo:n.attachedTo}}}else if(n?.type==="marker"){let o=n.components[0],i=n.object3d.parent,s=i?.userData.entityId;return{id:n.id,type:"marker",enabled:o.enabled,visible:o.visible,placement:o.options.placement,dynamicResize:o.options.dynamicResize,parent:{id:s,type:i?.type},position:this.convert3DMapPositionToCoordinate(n.position),element:o.containerEl,initialRank:Hh(o.initialRank),contentHTML:o.contentHtml,options:{rank:Hh(o.rank),interactive:n.components[1]!=null||!1,verticalOffset:n.verticalOffset,attachTo:n.attachedTo,lowPriorityPin:o.options.lowPriorityPin}}}else if(n?.type==="geometry"){let{color:o,hoverColor:i,initialColor:s,initialTopColor:l,topColor:c,altitude:p}=n.components[1],d=n.components[0],m=n.components[1],g=n.components[1],x=n.components[2],v=n.components[3],C=n.parentObject3D;return{id:n.id,type:"geometry",opacity:g.opacity,initialColor:s,color:o,focusable:m!=null&&m.focusMesh!=null,initialTopColor:l,topColor:c,side:g.side,hoverColor:i,hovered:!!x?.hover,height:g.height,visible:g.visible,outline:v?.enabled,showImage:g.showImage,texture:g.texture,topTexture:g.topTexture,flipImageToFaceCamera:g.flipImageToFaceCamera,parent:{id:C?.userData.entityId,type:C?.type},altitude:p,bevel:g.bevel,position:this.convert3DMapPositionToCoordinate(d.position),interactive:n.components[2]!=null}}else if(n?.type==="model"){let o=n.components[0],i=n.components[1],s=n.components[2];return{id:n.id,type:"model",position:o.mesh?this.convert3DMapPositionToCoordinate(o.mesh?.getWorldPosition(new ue)):this.convert3DMapPositionToCoordinate(o.position),interactive:s!=null,material:i.material,parent:n.parentObject3D?.parent?{id:n.parentObject3D.parent.userData.entityId,type:n.parentObject3D.parent.type}:void 0,visible:i.visible,verticalOffset:i.verticalOffset,color:i.color,opacity:i.opacity,rotation:i.rotation??Iu,scale:i.scale??vu}}else if(n?.type==="path"){let o=n.components[0],i=n.components[2],s=n.components[1];return{id:n.id,type:"path",position:this.convert3DMapPositionToCoordinate(o.position),visible:s.visible,interactive:i!=null,completeFraction:o.completeFraction,color:s.color,accentColor:o.accentColor,width:o.width,animateArrowsOnPath:o.animateArrowsOnPath,displayArrowsOnPath:o.displayArrowsOnPath,verticalOffset:s.altitude}}else if(n?.type==="image"){let o=n.components[0];return{id:n.id,type:"image",position:this.convert3DMapPositionToCoordinate(o.position),visible:n.components[1].visible,verticalOffset:o.feature.properties.verticalOffset??0,opacity:n.components[1].opacity,flipImageToFaceCamera:n.components[1].flipImageToFaceCamera,width:o.feature.properties.width??0,height:o.feature.properties.height??0,rotation:o.feature.properties.rotation??0}}else if(n?.type==="text3d"&&n.components[0]instanceof Wl&&"textArea"in n.components[0].feature.properties){JE(n);let o=n.components[0],i=n.components[1],{textMesh:s}=o,l=o.mesh?.parent;l instanceof kt&&l.children.find(d=>d.type==="batchedtext")?.getWorldPosition(a(this,Yg)),a(this,Yf).set(0,0,0);let c=s?s.getWorldPosition(a(this,Yf)):a(this,Yf);return Object.assign({},xu,i.getState(),{id:n.id,type:"text3d",position:this.convert3DMapPositionToCoordinate(c.add(a(this,Yg))),visible:o.visible??!1,content:o.feature.properties.content??""})}else return}}setState(r,n){if(typeof r=="object"&&n==null){"hoverColor"in r&&(xm(r.hoverColor)?a(this,G).hoverColor=r.hoverColor??a(this,G).hoverColor:A.warn(`Failed to update global hover color. Invalid color "${r.hoverColor}".`)),"text3dHoverColor"in r&&(a(this,G).text3dHoverColor=r.text3dHoverColor??a(this,G).text3dHoverColor);return}let o=gu(a(this,G),r);if(o!=null){if(o.type==="custom-geometry"){let i=a(this,G).geometry3DMap.get(o.id);if(i instanceof Ke&&i.components[0]instanceof Uf){let s=n;_s(o,a(this,G),s.visible),kf(o,s.altitude),vC(o,s.position,this.convertTo3DMapPosition),IC(o,this.getParentContainer(s.parent,!1)),$r(o,s.interactive,a(this,G))&&a(this,Dt).call(this)}}else if(o.type==="path"){let i=n;$r(o,i.interactive,a(this,G))&&a(this,Dt).call(this),kf(o,i.verticalOffset),YE(o,a(this,G),i)}else if(o.type==="model"){let i=n;$r(o,i.interactive,a(this,G))&&a(this,Dt).call(this),_s(o,a(this,G),i.visible),QE(o,i)}else if(o.type==="group-container"){let i=n;_s(o,a(this,G),i.visible)&&(a(this,R).pathSystem.verticalDistanceDirty=!0,a(this,R).geometryInFocusSystem.focusablesDirty=!0),kf(o,i.altitude)&&(a(this,R).pathSystem.verticalDistanceDirty=!0),$r(o,i.interactive,a(this,G))&&a(this,Dt).call(this),sg(o,a(this,G),i.opacity)&&(a(this,R).outlineInterpolationSystem.outlineOpacitiesDirty=!0),i.preloadGeometry&&o.userData.preloadGeometry!==!0&&(o.userData.preloadGeometry=!0,a(this,R).outlineInterpolationSystem.geometries3DDirty=!0),hx(o,i.focusable)&&(a(this,R).geometryInFocusSystem.focusablesDirty=!0)}else if(o.type==="geometry-group"){let i=n;_s(o,a(this,G),i.visible),RE(o,a(this,G),i),mx(o,a(this,G),i.outline),i.height!=null&&dx(o,a(this,G),i.height),kf(o,i.altitude),zE(o,a(this,G),i),BE(o,a(this,G),i.shading),sg(o,a(this,G),i.opacity)&&(a(this,R).outlineInterpolationSystem.outlineOpacitiesDirty=!0),$r(o,i.interactive,a(this,G))&&(a(this,Dt).call(this),a(this,Lr).call(this)),gx(o,a(this,G),i.side)}else if(o.type==="geometry"){if(o.components[0]instanceof or){let i=n;_s(o,a(this,G),i.visible),mx(o,a(this,G),i.outline),NE(o,i),hx(o,i.focusable)&&(a(this,R).geometryInFocusSystem.focusablesDirty=!0),ZE(o,i.renderOrder)&&(a(this,R).meshDetachmentSystem.dirty=!0),XE(o,i.opacity)&&(a(this,R).meshDetachmentSystem.dirty=!0,a(this,R).interactionSystem.dirty3D=!0,a(this,R).outlineInterpolationSystem.outlineOpacitiesDirty=!0),SC(o,i.flipImageToFaceCamera),kf(o,i.altitude),i.height!=null&&dx(o,a(this,G),i.height),CC(o,i)&&(a(this,R).meshDetachmentSystem.dirty=!0),fx(o,i),HE(o,i.hoverColor),$r(o,i.interactive,a(this,G)),WE(o,i.hovered),gx(o,a(this,G),i.side)}a(this,Dt).call(this)}else if(o.type==="label"||o.type==="marker"){let i=n;VE(o,n,a(this,G)),jE(o,n,a(this,G))&&(a(this,Lr).call(this),a(this,R).domMutationSystem.dirty=!0),vC(o,i.position,this.convertTo3DMapPosition),IC(o,this.getParentContainer(i.parent,!1))&&(a(this,Lr).call(this),a(this,R).panBoundsSystem.dirty=!0),GE(o,i.enabled),_s(o,a(this,G),i.visible)}else if(o.type==="image"){let i=n;_s(o,a(this,G),i.visible),sg(o,a(this,G),i.opacity),SC(o,i.flipImageToFaceCamera)}else if(o.type==="text3d"){let i=n;KE(o,a(this,G),i)}this.render()}}convertTo3DMapPosition(r,n,o=0,i){if(Array.isArray(r))return this.convertTo3DMapPosition(r[1],r[0],r[2]??o,typeof n=="function"?n:void 0);if(typeof n!="number")throw new Error("convertTo3DMapPosition failed: longitude must be a number");let{x:s,y:l}=bb(a(this,G).center?.[1]??0,a(this,G).center?.[0]??0,r,n);return i?(i.set(s,l,o),i):new ue(s,l,o)}get backgroundColor(){return typeof a(this,zr).backgroundColor=="string"?a(this,zr).backgroundColor:`#${a(this,zr).backgroundColor.getHexString()}`}get backgroundAlpha(){return a(this,zr).backgroundAlpha}getThreeRenderer(){return a(this,zr)}getCenter(r){let n=Array.isArray(r)?r:this.getBoundingArea(r);return n?R5(n):void 0}isInView(r){let n=gu(a(this,G),r);if(a(this,Xg).identity().multiply(a(this,tr).projectionMatrix).multiply(a(this,tr).matrixWorldInverse),a(this,qp).setFromProjectionMatrix(a(this,Xg)),n instanceof xc)return a(this,qp).containsPoint(n.position);if(n instanceof Ke){let o=n?.components[0];if(o instanceof Uf||o instanceof Zl)return a(this,qp).containsPoint(this.convertTo3DMapPosition(o.feature.geometry.coordinates));if(o instanceof or){let i=new vr(this.convertTo3DMapPosition(o.featureBbox[1],o.featureBbox[0],0),this.convertTo3DMapPosition(o.featureBbox[3],o.featureBbox[2],0));return a(this,qp).intersectsBox(i)}}return!1}onMapLibreEvent(r,n){if(!this.map){A.warn(`Tried to add event listener "${r}" but MapLibre map is not initialized.`);return}this.map.on(r,n),a(this,Jo)[r]=a(this,Jo)[r]||[],a(this,Jo)[r].push(n)}offMapLibreEvent(r,n){!this.map||!Array.isArray(a(this,Jo)[r])||(this.map.off(r,n),a(this,Jo)[r]=a(this,Jo)[r].filter(o=>o!==n))}get aborted(){return a(this,Yp).signal.aborted}onAbort(r){a(this,Yp).signal.addEventListener("abort",r,{once:!0})}getSystems(){return a(this,R)}getInternalState(){return a(this,G)}getInternalTweenGroup(){return a(this,G).internalTweenGroup}getExternalTweenGroup(){return a(this,G).externalTweenGroup}computeMinZOffsetBetweenContainers(r,n,o){if(!r||!n)return-1;mu(r,"group-container"),mu(n,"group-container");let i=xb(r,this.getThreeCamera()),s=n.clone(),l=xb(s,this.getThreeCamera());if(!gc(i)||!gc(l))return-1;let c=0,p;o&&this.container.querySelectorAll(".debug-box").forEach(m=>m.remove());do{if(c>1e4)return-1;if(c+=20,s.position.z=c,s.updateMatrixWorld(),l.makeEmpty(),xb(s,a(this,tr),l),p=i.intersectsBox(l),o){let d=l2(i,"blue",this.container),m=l2(l,p?"red":"green",this.container);d.classList.add("debug-box"),m.classList.add("debug-box")}}while(p);return c}};ur=new WeakMap,tr=new WeakMap,Xp=new WeakMap,Ng=new WeakMap,zf=new WeakMap,tc=new WeakMap,Zp=new WeakMap,Xf=new WeakMap,cn=new WeakSet,rT=function(r){a(this,Wa)!=="outdoors-overlay"&&this.map?.setPixelRatio(r),a(this,G).pixelRatio=this.resolutionScale},G=new WeakMap,Jo=new WeakMap,Yp=new WeakMap,bt=new WeakMap,Gi=new WeakMap,dr=new WeakMap,qo=new WeakMap,zr=new WeakMap,R=new WeakMap,Gg=new WeakMap,Lr=new WeakMap,Dt=new WeakMap,cD=function(){w(this,bt,document.createElement("div")),a(this,bt).classList.add("mappedin__smart-collision-engine__container"),w(this,Gi,document.createElement("canvas")),a(this,Gi).classList.add("mappedin__smart-collision-engine-debug__container"),this.container.appendChild(a(this,bt)),w(this,dr,document.createElement("canvas")),a(this,dr).classList.add("mappedin__smart-collision-engine__container"),a(this,dr).width=a(this,bt).clientWidth*this.resolutionScale,a(this,dr).height=a(this,bt).clientHeight*this.resolutionScale,a(this,dr).style.width=a(this,bt).clientWidth+"px",a(this,dr).style.height=a(this,bt).clientHeight+"px",a(this,bt).appendChild(a(this,Gi)),a(this,bt).appendChild(a(this,dr)),a(this,Gi).width=a(this,bt).clientWidth,a(this,Gi).height=a(this,bt).clientHeight,a(this,dr).width=a(this,bt).clientWidth*this.resolutionScale,a(this,dr).height=a(this,bt).clientHeight*this.resolutionScale,a(this,dr).style.width=a(this,bt).clientWidth+"px",a(this,dr).style.height=a(this,bt).clientHeight+"px"},pD=function(){w(this,qo,document.createElement("div")),a(this,qo).classList.add("mappedin-2d-entities"),Object.assign(a(this,qo).style,{position:"absolute",top:"0",left:"0",bottom:"0",right:"0",pointerEvents:"none","transform-style":"preserve-3d"}),this.container.appendChild(a(this,qo))},uD=function(){a(this,dr).width=a(this,bt).clientWidth*this.resolutionScale,a(this,dr).height=a(this,bt).clientHeight*this.resolutionScale,a(this,dr).style.width=a(this,bt).clientWidth+"px",a(this,dr).style.height=a(this,bt).clientHeight+"px",a(this,Gi).width=a(this,bt).clientWidth,a(this,Gi).height=a(this,bt).clientHeight,a(this,dr).width=a(this,bt).clientWidth*this.resolutionScale,a(this,dr).height=a(this,bt).clientHeight*this.resolutionScale,a(this,dr).style.width=a(this,bt).clientWidth+"px",a(this,dr).style.height=a(this,bt).clientHeight+"px",a(this,R).collisionSystem.collidersDirty=!0},Wa=new WeakMap,jg=new WeakMap,Ug=new WeakMap,Vg=new WeakMap,Hg=new WeakMap,Zf=new WeakMap,Sv=new WeakMap,Wg=new WeakMap,$g=new WeakMap,zg=new WeakMap,Jp=new WeakMap,nT=function(r,n,o,i){let s=new xc(n,this.convertTo3DMapPosition(r[1],r[0],r[2]||0),i);return s.occluderId=o??a(this,R).occlusion2DSystem.backgroundId,a(this,G).geometry2DMap.set(s.id,s),s},qp=new WeakMap,Xg=new WeakMap,Zg=new WeakMap,An=new WeakMap,Ln=new WeakMap,oT=async function(){return Yl.load(H9).then(r=>(a(this,ur)&&(a(this,ur).environment?.dispose(),r.mapping=jT,a(this,ur).environment=r,this.render()),r))},Cv=new WeakMap,Tv=new WeakMap,Yf=new WeakMap,Yg=new WeakMap;var Qee=new ue,lT=tT;u();function ete(e,t){tte(e,t)(e.getScene(),t),rte(e,t),t.addFolder("Export").add({export:async()=>{let s=await e.getCurrentSceneGLTF({binary:!0}),l=new Blob([s],{type:"application/octet-stream"});var c=document.createElement("a");document.body.appendChild(c),c.style.display="none";let p=window.URL.createObjectURL(l);c.href=p,c.download="scene.glb",c.click(),window.URL.revokeObjectURL(p)}},"export");let o=t.addFolder("Camera"),i={get bearing(){return e.camera.bearing},set bearing(s){e.camera.setBearing(s)},get pitch(){return e.camera.pitch},set pitch(s){e.camera.setPitch(s)},get zoomLevel(){return e.camera.zoomLevel},set zoomLevel(s){e.camera.setZoomLevel(s)}};o.add(i,"bearing",-359,359,1),o.add(i,"pitch",e.camera.minPitch,e.camera.maxPitch,1),o.add(i,"zoomLevel",e.camera.minZoomLevel,e.camera.maxZoomLevel,.1)}function tte(e,t){let r=t;return function n(o,i){let s=i.addFolder(`${[o.type]} ${o.id.slice(0,16)}`);if(i.close(),o.type==="geometry"||o.type==="model"||o.type==="path"||o.type==="image"){let l={get height(){let c=e.getState(o.id);return c?.type==="geometry"?c.height:0},set height(c){e.getState(o.id)?.type==="geometry"&&e.setState(o,{height:c})},set flipImageToFaceCamera(c){e.getState(o.id)?.type==="image"&&e.setState(o,{flipImageToFaceCamera:c})},get flipImageToFaceCamera(){let c=e.getState(o.id);return c?.type==="image"?c.flipImageToFaceCamera:!1},set visible(c){let p=e.getState(o.id);(p?.type==="geometry"||p?.type==="path"||p?.type==="image")&&e.setState(o,{visible:c})},get visible(){let c=e.getState(o.id);return c?.type==="geometry"||c?.type==="path"||c?.type==="image"?c.visible:!1},set outline(c){e.getState(o.id)?.type==="geometry"&&e.setState(o,{outline:c})},get outline(){let c=e.getState(o.id);return c?.type==="geometry"?c.outline:!1},get opacity(){let c=e.getState(o.id);return c?.type==="geometry"?c.opacity:1},set opacity(c){let p=e.getState(o.id);p?.type==="geometry"&&e.setState(p,{opacity:c})},get color(){let c=e.getState(o.id);return c?.type==="geometry"&&c.color?de(c.color).toHexString():"#ffffff"},set color(c){let p=e.getState(o.id);p?.type==="geometry"&&e.setState(p,{color:c})},set interactive(c){let p=e.getState(o.id);(p?.type==="geometry"||p?.type==="model"||p?.type==="path")&&(e.setState(o,{interactive:c}),r.controllersRecursive().forEach(d=>d.updateDisplay()))},get interactive(){let c=e.getState(o.id);return c?.type==="geometry"||c?.type==="model"||c?.type==="path"?c.interactive:!1},get completeFraction(){let c=e.getState(o.id);return c?.type==="path"?c.completeFraction:1},set completeFraction(c){let p=e.getState(o.id);p?.type==="path"&&e.setState(p,{completeFraction:c})},focus:()=>{}};s.add(l,"focus").onChange(()=>{let c=e.getState(o.id);c?.type==="model"||c?.type==="path"||c?.type==="image"?e.camera.focusOn([c.position]):c?.type==="geometry"&&e.camera.focusOn(e.getBoundingArea(c))}),s.add(l,"visible"),o.type==="image"?s.add(l,"flipImageToFaceCamera"):(s.add(l,"interactive"),o.type==="path"&&s.add(l,"completeFraction",0,1,.1),o.type!=="model"&&(s.addColor(l,"color"),s.add(l,"outline"))),o.type==="geometry"&&(s.add(l,"height"),s.add(l,"opacity",0,1,.1))}else if(o.type==="marker"){let l={get interactive(){let c=e.getState(o.id);return c?.type==="marker"?c.options?.interactive:!1},set interactive(c){let p=e.getState(o.id);p?.type==="marker"&&(e.setState(p,{options:{interactive:c}}),r.controllersRecursive().forEach(d=>d.updateDisplay()))},focus:()=>{}};s.add(l,"focus").onChange(()=>{let c=e.getState(o.id);c?.type==="marker"&&e.camera.focusOn([c.position])}),s.add(l,"interactive")}else if(o.type==="label"){let l={get interactive(){let c=e.getState(o.id);return c?.type==="label"?c.options?.interactive:!1},set interactive(c){let p=e.getState(o.id);p?.type==="label"&&(e.setState(p,{options:{interactive:c}}),r.controllersRecursive().forEach(d=>d.updateDisplay()))},get text(){let c=e.getState(o.id);return c?.type==="label"?c.text:""},set text(c){let p=e.getState(o.id);p?.type==="label"&&e.setState(p,{text:c})},get"Text Color"(){let c=e.getState(o.id);return c?.type==="label"?c.options.appearance?.textColor:"#000000"},set"Text Color"(c){e.getState(o.id)?.type==="label"&&e.setState(o.id,{text:l.text,options:{appearance:{textColor:c}}})},get"Text Size"(){let c=e.getState(o.id);return c?.type==="label"?c.options.appearance?.textSize:10},set"Text Size"(c){let p=e.getState(o.id);p?.type==="label"&&e.setState(p,{text:l.text,options:{appearance:{textSize:c}}})},get"Icon Size"(){let c=e.getState(o.id);return c?.type==="label"?c.options.appearance?.iconSize:10},set"Icon Size"(c){let p=e.getState(o.id);p?.type==="label"&&e.setState(p,{text:l.text,options:{appearance:{iconSize:c}}})},get"Pin Color"(){let c=e.getState(o.id);return c?.type==="label"?c.options.appearance?.pinColor:"#000000"},set"Pin Color"(c){let p=e.getState(o.id);p?.type==="label"&&e.setState(p,{text:l.text,options:{appearance:{pinColor:c}}})},get"Pin Color Inactive"(){let c=e.getState(o.id);return c?.type==="label"?c.options.appearance?.pinColorInactive:"#000000"},set"Pin Color Inactive"(c){let p=e.getState(o.id);p?.type==="label"&&e.setState(p,{text:l.text,options:{appearance:{pinColorInactive:c}}})},get"Pin Outline Color"(){let c=e.getState(o.id);return c?.type==="label"?c.options.appearance?.pinOutlineColor:"#000000"},set"Pin Outline Color"(c){let p=e.getState(o.id);p?.type==="label"&&e.setState(p,{text:l.text,options:{appearance:{pinOutlineColor:c}}})},get"Pin Outline Color Inactive"(){let c=e.getState(o.id);return c?.type==="label"?c.options.appearance?.pinOutlineColorInactive:"#000000"},set"Pin Outline Color Inactive"(c){let p=e.getState(o.id);p?.type==="label"&&e.setState(p,{text:l.text,options:{appearance:{pinOutlineColorInactive:c}}})},focus:()=>{}};s.add(l,"focus").onChange(()=>{let c=e.getState(o.id);c?.type==="label"&&e.camera.focusOn([c.position])}),s.add(l,"interactive"),s.add(l,"text"),s.add(l,"Text Size",10,50),s.add(l,"Icon Size",10,50),s.addColor(l,"Text Color"),s.addColor(l,"Active Background Color"),s.addColor(l,"Inactive Background Color"),s.addColor(l,"Active Foreground Color"),s.addColor(l,"Inactive Foreground Color")}else if(o.type==="geometry-group"){let l={get opacity(){let c=e.getState(o.id);return c?.type==="geometry-group"?c.opacity:1},set opacity(c){e.getState(o.id)?.type==="geometry-group"&&e.setState(o,{opacity:c})},set visible(c){e.getState(o.id)?.type==="geometry-group"&&e.setState(o,{visible:c})},get visible(){let c=e.getState(o.id);return c?.type==="geometry-group"?c.visible:!1},set outline(c){e.getState(o.id)?.type==="geometry-group"&&e.setState(o,{outline:c})},get outline(){let c=e.getState(o.id);return c?.type==="geometry-group"?c.outline:!1},set altitude(c){e.getState(o.id)?.type==="geometry-group"&&e.setState(o,{altitude:c})},get altitude(){let c=e.getState(o.id);return c?.type==="geometry-group"?c.altitude:0},set interactive(c){e.getState(o.id)?.type==="geometry-group"&&(e.setState(o,{interactive:c}),r.controllersRecursive().forEach(d=>d.updateDisplay()))},get interactive(){let c=e.getState(o.id);return c?.type==="geometry-group"?c.interactive:!1},get shadingStart(){let c=e.getState(o.id);return c?.type==="geometry-group"?c.shading?.start??0:0},set shadingStart(c){let p=e.getState(o.id);p?.type==="geometry-group"&&e.setState(p,{shading:{start:c}})},get shadingEnd(){let c=e.getState(o.id);return c?.type==="geometry-group"?c.shading?.end??0:0},set shadingEnd(c){let p=e.getState(o.id);p?.type==="geometry-group"&&e.setState(p,{shading:{end:c}})},get shadingIntensity(){let c=e.getState(o.id);return c?.type==="geometry-group"?c.shading?.intensity??0:0},set shadingIntensity(c){let p=e.getState(o.id);p?.type==="geometry-group"&&e.setState(p,{shading:{intensity:c}})}};s.add(l,"visible"),s.add(l,"opacity",0,1,.1),s.add(l,"interactive"),s.add(l,"outline"),s.add(l,"altitude",0,100,1),s.add(l,"shadingStart",0,1,.1),s.add(l,"shadingEnd",0,1,.1),s.add(l,"shadingIntensity",0,1,.1)}else if(o.type==="group-container"){let l={set visible(c){e.getState(o.id)?.type==="group-container"&&e.setState(o,{visible:c})},get visible(){let c=e.getState(o.id);return c?.type==="group-container"?c.visible:!1},set interactive(c){let p=e.getState(o.id);p?.type==="group-container"&&(e.setState(p,{interactive:c}),r.controllersRecursive().forEach(d=>d.updateDisplay()))},get interactive(){let c=e.getState(o.id);return c?.type==="group-container"?c.interactive:!1}};s.add(l,"visible"),s.add(l,"interactive")}if(s.close(),o.children)for(let l of o.children.values())n(l,s)}}function rte(e,t){let r=t.addFolder("Watermark"),n={padding:16,iconOnly:!1,position:"bottom-left",color:"dark",scale:1};r.add(n,"padding",0,100,1),r.add(n,"scale",.5,1.5,.1),r.add(n,"color",["dark","light"]),r.add(n,"position",["top-left","top-right","bottom-left","bottom-right","center","top","bottom","left","right"]),r.add(n,"iconOnly"),r.onChange(()=>{e.updateWatermark(n)})}var dD="https://tiles-cdn.mappedin.com/styles/mappedin/style.json",nte="https://auth.mappedin.com/oauth2/token";var Mv="";function cT(e){Mv=e,T5(e)}var wp="";function pT(e){wp=e}async function fD(e,t){let r=t?.useWorkers??!0,n={...t,watermark:t?.watermark,attribution:t?.attribution,antialias:t?.antialias,occlusionEnabled:t?.occlusionEnabled,transformImageRequest:t?.transformImageRequest,naturalBearing:t?.naturalBearing??0,imagePlacementOptions:t?.imagePlacementOptions,onWebGLContextCreationError:t?.onWebGLContextCreationError,onWebGLContextLost:t?.onWebGLContextLost,onWebGLContextRestored:t?.onWebGLContextRestored,onWebGLRendererError:t?.onWebGLRendererError,useStandaloneCamera:t?.useStandaloneCamera??!1,useCollisionWorker:t?.useCollisionWorker??!0,useWorkers:r};if(r===!0&&t?.outdoorView?.enabled){let{Map:o,MercatorCoordinate:i}=await import("./outdoor-context-v5-QR4KQTZR.js"),s=t.outdoorView.headers;s==null&&(s=await A5(nte));let l=t.center||[0,0],c=new o({container:e,style:t.outdoorView.style||dD,center:l,attributionControl:!1,zoom:t.zoomLevel??aT,pitch:t.pitch??iT,bearing:t.bearing??sT,transformRequest:_5(s),trackResize:!1,pixelRatio:t.outdoorView.lowDpi?1:yu(),canvasContextAttributes:{antialias:typeof t.antialias=="boolean"?t.antialias:!0,powerPreference:"high-performance"},interactive:!1,validateStyle:!1,centerClampedToGround:!1,boxZoom:!1,doubleClickZoom:!1,scrollZoom:!1,dragPan:!1,dragRotate:!1,keyboard:!1,touchZoomRotate:!1}),p=c.painter.context.gl,d=new lT(e,{center:l,zoomLevel:c.getZoom(),pitch:c.getPitch(),bearing:c.getBearing(),gl:p,map:c,mode:"outdoors-interleaved",...n}),m={center:c.getCenter().toArray(),zoom:c.getZoom(),bearing:c.getBearing(),pitch:c.getPitch(),elevation:c.getCenterElevation()};c.setMinZoom(d.camera.minZoomLevel),c.setMaxZoom(d.camera.maxZoomLevel),c.setMaxPitch(d.camera.maxPitch),c.setMinPitch(d.camera.minPitch),d.on("camera-change",E=>{m.center=E.center,m.zoom=E.zoomLevel,m.bearing=E.bearing,m.pitch=E.pitch,m.elevation=E.elevation,c.jumpTo(m)});let g=i.fromLngLat(l,0),x=k5(g,d.viewCamera,()=>{d.renderSync()}),v=async()=>{c&&(c.addLayer(x),d.renderSync())};d.onMapLibreEvent("style.load",v);let C=!1,I=!1,S=()=>{c&&(C||(d.publish("outdoor-view-loaded"),C=!0),I||(I=!0,d.publish("outdoor-style-loaded")))};d.onMapLibreEvent("idle",S);let P=E=>{E&&(E.sourceDataType==="metadata"||E.sourceDataType==="visibility"||E.dataType==="style"||E.type==="terrain")&&d.getSystems().htmlControlsSystem.updateData(c)},O=E=>{c&&E&&E.dataType==="style"&&E.type==="styledata"&&(I=!1),P(E)};d.onMapLibreEvent("styledata",O),d.onMapLibreEvent("sourcedata",P),d.onMapLibreEvent("terrain",P);let M=E=>{if(E.error?.url===dD){A.error(`Failed to load outdoor view style, possibly due to invalid token "${s["x-mappedin-tiles-key"]}"`);return}A.warn(E)};return d.onMapLibreEvent("error",M),d}else return new lT(e,n)}u();u();u();u();var Jg=class Jg{constructor(t,r,n){f(this,"id");f(this,"text");f(this,"target");f(this,"__type",Jg.__type);this.id=t,this.text=r,this.target=n}static is(t){return t.__type===Jg.__type}get focusTarget(){return this.target.anchorTarget}};f(Jg,"__type","Label");var rc=Jg;u();var Kp,Jf=class Jf{constructor(t,r,n){f(this,"id");T(this,Kp);f(this,"__type",Jf.__type);f(this,"contentEl");this.id=t,this.contentEl=r,w(this,Kp,n)}get target(){return a(this,Kp)}get coordinate(){return a(this,Kp).anchorTarget}toJSON(){return{id:this.id,__type:Jf.__type,target:this.target,coordinate:this.coordinate}}static is(t){return t.__type===Jf.__type}get focusTarget(){return this.target.anchorTarget}updateTarget(t){w(this,Kp,t)}};Kp=new WeakMap,f(Jf,"__type","Marker");var $a=Jf;u();var Kg,Qg,qg=class qg{constructor(t,r,n){T(this,Kg);T(this,Qg);f(this,"target");f(this,"__type",qg.__type);w(this,Kg,t),w(this,Qg,r),this.target=n}static is(t){return t.__type===qg.__type}get id(){return a(this,Kg)}get url(){return a(this,Qg)}};Kg=new WeakMap,Qg=new WeakMap,f(qg,"__type","Image3D");var Qp=qg;u();var eu,qf=class qf{constructor(t,r,n){f(this,"id");f(this,"groupId");f(this,"__type",qf.__type);T(this,eu);this.id=t,this.groupId=r,w(this,eu,n)}get target(){return a(this,eu)}static is(t){return t.__type===qf.__type}updateTarget(t){w(this,eu,t)}toJSON(){return{id:this.id,__type:qf.__type,groupId:this.groupId,target:a(this,eu)}}};eu=new WeakMap,f(qf,"__type","Model");var tu=qf;u();var ey=class ey{constructor(t,r){f(this,"id");f(this,"coordinates");f(this,"__type",ey.__type);this.id=t,this.coordinates=r}static is(t){return t.__type===ey.__type}get focusTarget(){return this.coordinates}};f(ey,"__type","PathSegment");var Qf=ey,Kf=class Kf{constructor(t,r,n,o){f(this,"id");f(this,"animation");f(this,"coordinates");f(this,"segments");f(this,"__type",Kf.__type);this.id=t,this.animation=r,this.coordinates=n,this.segments=o.map(({id:i,coordinates:s})=>new Qf(i.toString(),s))}static is(t){return t.__type===Kf.__type}get focusTarget(){return this.coordinates}toJSON(){return{__type:Kf.__type,id:this.id,coordinates:this.coordinates,segments:this.segments}}};f(Kf,"__type","Path");var Ko=Kf;u();var ote=7,nc,ru,ty=class{constructor(t,r){T(this,nc);T(this,ru);w(this,nc,t),w(this,ru,r?.precision??ote)}toJSON(){return{center:this.center,bearing:this.bearing,pitch:this.pitch,zoomLevel:this.zoomLevel}}get center(){let t=a(this,nc).center;if(a(this,ru)===-1)return t;let r=Ji(t.latitude,a(this,ru)),n=Ji(t.longitude,a(this,ru));return new ge({latitude:r,longitude:n,floorId:t.floorId,verticalOffset:t.verticalOffset})}get bearing(){return a(this,nc).bearing}get pitch(){return a(this,nc).pitch}get zoomLevel(){return Ji(a(this,nc).zoomLevel,5)}};nc=new WeakMap,ru=new WeakMap;u();var ry=class ry{constructor(t){f(this,"id");f(this,"__type",ry.__type);this.id=t}static is(t){return t.__type===ry.__type}get focusTarget(){return this}};f(ry,"__type","Shape");var za=ry;u();var Pv=class Pv{constructor(t,r){f(this,"id");f(this,"target");f(this,"__type","Text3D");this.id=t,this.target=r}static is(t){return t.__type===Pv.__type}};f(Pv,"__type","Text3D");var oc=Pv;u();u();u();var ite=new Map([["search-16x16",`<svg viewBox="0 0 16 16">
|
|
699
|
+
`})}applyId(t,r){let n=t.attributes.position,o=new Float32Array(n.count*3);Yee(o,n.count,r),t.setAttribute("color",new Sn(o,3))}createOccluderMesh(t,r){let n=new Re(t,this.pickingMaterial);return n.layers.set(Bg),this.applyId(n.geometry,r),n.userData.occluderId=r,n}reserveOccluderId(){return this.color++,this.color}enable(){this.enabled=!0}disable(){this.enabled=!1}destroy(){this.destroyed=!0,this.pickingTexture?.dispose(),this.pickingMaterial.dispose(),this.pickingTexture=void 0,this.pixelBuffer=void 0}};u();var Iv=class{constructor(t){this.state=t;f(this,"dirty",!0)}update(){if(this.dirty){for(let t of this.state.geometry3DIdsInScene){let r=this.state.geometry3DMap.get(t);if(r instanceof Ke&&r.type==="geometry"&&r.components[0]?.geometry!=null){let n=r.components[0];n.geometry&&(n.geometry.dispose(),n.geometry=void 0)}}this.dirty=!1}}};var lD=new Zi;var{DEFAULT_PITCH:iT,DEFAULT_BEARING:sT,DEFAULT_ZOOM_LEVEL:aT,DEFAULT_MIN_ZOOM_LEVEL:Jee,DEFAULT_MAX_ZOOM_LEVEL:qee}=ki,Kee=Xe.radToDeg(.6435011087932844),ur,tr,Xp,Ng,zf,tc,Zp,Xf,cn,rT,G,Jo,Yp,bt,Gi,dr,qo,zr,R,Gg,Lr,Dt,cD,pD,uD,Wa,jg,Ug,Vg,Hg,Zf,Sv,Wg,$g,zg,Jp,nT,qp,Xg,Zg,An,Ln,oT,Cv,Tv,Yf,Yg,tT=class extends Fe{constructor(r,n={}){super();T(this,cn);f(this,"options");f(this,"container");f(this,"Debug");T(this,ur);T(this,tr);T(this,Xp);T(this,Ng);T(this,zf);T(this,tc);T(this,Zp);T(this,Xf);f(this,"rendererDomElement");T(this,G,{geometry3DMap:new Map,geometry2DMap:new Map,geometry2DIdsInScene:new Set,geometry3DIdsInScene:new Set,geometryGroupIdsToLoad:new Set,entityScene:new kt("__scene"),hoverColor:"#f6efff",text3dHoverColor:"white",insetsPadding:mb,shouldMeasureCanvas:!0,pixelRatio:this.resolutionScale,canvasWidth:0,canvasHeight:0,internalTweenGroup:new Rx,externalTweenGroup:new Rx,cameraObject:new Zv,naturalBearing:0,containerOffset:[0,0],useStandaloneCamera:!1});T(this,Jo,{});T(this,Yp,new AbortController);f(this,"camera");T(this,bt);T(this,Gi);T(this,dr);T(this,qo);T(this,zr);T(this,R,{});T(this,Gg,window.matchMedia("screen and (min-resolution: 2dppx)"));f(this,"map");T(this,Lr,()=>{this.aborted||!a(this,R)?.renderSystem||(a(this,R).renderSystem.twoDdirty=!0)});T(this,Dt,()=>{this.aborted||!a(this,R)?.renderSystem||(a(this,R).renderSystem.threeDdirty=!0)});T(this,Wa,"standalone");T(this,jg,()=>{a(this,R).geometryDisposalSystem.dirty=!0,this.render()});T(this,Ug,r=>Math.trunc(r*10)/10);T(this,Vg,()=>{z(this,cn,rT).call(this,yu()),a(this,R).twoDDrawSystem.dirty=!0,a(this,Zf).call(this,void 0,void 0,!0)});T(this,Hg,()=>{a(this,Zf).call(this)});T(this,Zf,(r,n,o=!1)=>{let i=r??this.rendererDomElement.clientWidth,s=n??this.rendererDomElement.clientHeight;if((i===0||s===0)&&!o)return;a(this,G).canvasWidth=i,a(this,G).canvasHeight=s,z(this,cn,rT).call(this,yu()),a(this,Jp).call(this),z(this,cn,uD).call(this),a(this,R).cameraSystem.resize(this.canvasWidth,this.canvasHeight),a(this,R).cameraSystem.dirty=!0,a(this,R).watermarkSystem.resize(this.canvasWidth,this.canvasHeight),a(this,R).htmlControlsSystem.resize(this.canvasWidth),a(this,R).geometryInFocusSystem.resize(),a(this,R).occlusion2DSystem.resize();let{top:l,left:c}=this.container.getBoundingClientRect();a(this,G).containerOffset=[l,c],this.publish("resize"),this.render()});T(this,Sv,()=>{this.renderSync()});T(this,Wg,new ue);T(this,$g,(r,n)=>{let o=this.mode==="standalone"?a(this,tr):this.viewCamera;if(a(this,tr).position.z+this.camera.elevation>n.z){a(this,Wg).copy(n);let i=a(this,Wg).project(o),s=(i.x+1)/2*this.canvasWidth-0/2,l=(-i.y+1)/2*this.canvasHeight-0/2,c=a(this,Ug).call(this,s),p=a(this,Ug).call(this,l);r.x=c,r.y=p}else r.x=-1e3,r.y=-1e3});T(this,zg,(r,n)=>{a(this,zr).setBufferSize(r,n),a(this,tr).aspect=r/n,a(this,tr).updateProjectionMatrix(),a(this,tr).updateMatrixWorld(!0),a(this,zf).x=r,a(this,zf).y=n});T(this,Jp,()=>{let r=a(this,G).canvasWidth=this.rendererDomElement.clientWidth,n=a(this,G).canvasHeight=this.rendererDomElement.clientHeight,o=Math.floor(r*this.resolutionScale),i=Math.floor(n*this.resolutionScale);a(this,zg).call(this,o,i),this.map?.resize(),a(this,G).shouldMeasureCanvas=!1});f(this,"getParentContainer",(r,n=!0)=>{if(!r)return n?a(this,G).entityScene:void 0;if(typeof r=="string"||typeof r=="number"){let o=a(this,G).geometry3DMap.get(r);return o instanceof kt?o:(A.warn(`Parent (${typeof r=="object"?r.id:r}) is not a valid container, adding to scene`),n?a(this,G).entityScene:void 0)}else if(r.type==="group-container"){let o=a(this,G).geometry3DMap.get(r.id);if(o instanceof kt)return o}return n?a(this,G).entityScene:void 0});f(this,"showCollisionBoxes",()=>{a(this,R).collisionSystem.showCollisionBoxes(),this.render()});f(this,"hideCollisionBoxes",()=>{a(this,R).collisionSystem.hideCollisionBoxes(),this.render()});f(this,"projectScreenXYToCoordinate",(r,n,o=!1)=>{let i=this.container.getBoundingClientRect(),s=(r-i.left)/a(this,G).canvasWidth*2-1,l=-((n-i.top)/a(this,G).canvasHeight)*2+1,c=new De(s,l),p,d;if(o?(lD.setFromCamera(c,a(this,tr)),p=lD.intersectObject(a(this,tc),!1)[0]?.point):(p=a(this,R).interactionSystem.getThreeDIntersectsFromXY(c)?.[0]?.point,d=a(this,R).interactionSystem.getGroupContainerIntersectsFromXY(c)),p)return{coordinate:this.convert3DMapPositionToCoordinate(p),groupContainers:d}});f(this,"projectCoordinateToScreenXY",r=>{let n=this.convertTo3DMapPosition(r[1],r[0],r[2]||0),o=new De;return a(this,$g).call(this,o,n),{x:o.x,y:o.y}});f(this,"convert3DMapPositionToCoordinate",r=>{let{lat:n,lon:o}=yb(a(this,G).center?.[1]??0,a(this,G).center?.[0]??0,r.x,r.y);return[o,n,r.z]});f(this,"setBackgroundColor",(r,n)=>{a(this,zr).setBackgroundColor(r,n)});f(this,"getMetresPerPixel",()=>{let r=this.container.clientWidth,n=this.container.clientHeight/2,o=this.projectScreenXYToCoordinate(0,n,!0),i=this.projectScreenXYToCoordinate(r,n,!0);return o==null||i==null?void 0:pb(o.coordinate,i.coordinate)/r});f(this,"hideOutdoorLayersUnderPoint",(r,n)=>{!this.map||n?.length===0||(a(this,R).outdoorLayersSystem.hideLayersUnderPoint(r,n),this.render())});f(this,"hideOutdoorLayersIntersectingPolygons",(r,n,o)=>{a(this,R).outdoorLayersSystem.hideLayersIntersectingPolygons(r,n,o),this.render()});T(this,qp,new qT);T(this,Xg,new to);T(this,Zg,r=>{A.error("Render failed: ",r,r.stack??"No stack trace available"),this.publish("render-error",{error:r})});f(this,"render",()=>{if(!(a(this,R)?.renderSystem==null||this.aborted))if(this.map&&(this.mode==="outdoors-interleaved"||this.mode==="outdoors-overlay"))this.map.triggerRepaint();else return a(this,R).renderSystem.update().catch(a(this,Zg))});f(this,"renderSync",()=>this.aborted?Promise.resolve():a(this,R).renderSystem.update(!0).catch(a(this,Zg)));T(this,An,Sm(()=>{this.publish("user-interaction-start",void 0)},0,!0));T(this,Ln,Sm(()=>{this.publish("user-interaction-end",void 0),this.render()},0,!0));f(this,"on",(r,n)=>{this.aborted||(super.on(r,n),["outdoor-view-loaded","outdoor-style-loaded"].includes(r)&&this.mode==="standalone"&&y.env.NODE_ENV!=="test"&&(A.warn(`"${r}" was subscribed to but outdoor view is disabled. The event has been triggered immediately. Enable outdoor view or remove the listener.`),this.publish(r)))});f(this,"off",(r,n)=>{super.off(r,n)});f(this,"getCursor",()=>a(this,R).interactionSystem.getCursor());T(this,Cv,()=>{if(a(this,G).entityScene.removeEventListener("childadded",a(this,Dt)),a(this,G).entityScene.removeEventListener("childadded",a(this,Lr)),a(this,G).entityScene.removeEventListener("childremoved",a(this,Dt)),a(this,G).entityScene.removeEventListener("childremoved",a(this,Lr)),window.removeEventListener("resize",a(this,Hg),!1),a(this,Gg).removeEventListener("change",a(this,Vg)),this.map){for(let r in a(this,Jo))for(let n of a(this,Jo)[r])this.map.off(r,n);w(this,Jo,{})}this._subscribers={}});T(this,Tv,()=>{try{a(this,Wa)!=="outdoors-overlay"&&(this.map&&this.map.remove(),this.container&&this.rendererDomElement&&this.container.contains(this.rendererDomElement)&&this.container.removeChild(this.rendererDomElement)),this.container&&(a(this,qo)&&this.container.contains(a(this,qo))&&this.container.removeChild(a(this,qo)),a(this,bt)&&this.container.contains(a(this,bt))&&this.container.removeChild(a(this,bt)))}catch(r){A.warn("Error during DOM cleanup, some elements may not have been removed:",r)}});f(this,"destroy",()=>{a(this,R)&&(this.aborted||a(this,Yp).abort(),a(this,Cv).call(this),this.remove("__scene"),a(this,R).renderSystem.destroy(),a(this,R).cameraSystem.dispose(),a(this,R).exporterSystem.destroy(),a(this,R).outdoorLayersSystem.destroy(),a(this,R).drawSystem.destroy(),a(this,Zp)&&a(this,Zp).disconnect(),a(this,zr).destroy(),a(this,ur)?.traverse(r=>{Qt(r),"dispose"in r&&typeof r.dispose=="function"&&r.dispose()}),w(this,ur,void 0),a(this,R).htmlControlsSystem.destroy(),a(this,R).collisionSystem.destroy(),a(this,R).interactionSystem.destroy(),a(this,R).domMutationSystem.destroy(),a(this,R).geometryInFocusSystem.destroy(),a(this,R).occlusion2DSystem.destroy(),w(this,R,void 0),a(this,Tv).call(this),w(this,zr,void 0))});T(this,Yf,new ue);T(this,Yg,new ue);if(w(this,Yp,new AbortController),a(this,G).useStandaloneCamera=n.useStandaloneCamera??!1,a(this,G).naturalBearing=n.naturalBearing??0,this.convertTo3DMapPosition=this.convertTo3DMapPosition.bind(this),!r.clientWidth||!r.clientHeight)throw new Error("[MappedinJS] Container width and height must be greater than 0");this.convertTo3DMapPosition=this.convertTo3DMapPosition.bind(this),(n.mode==="outdoors-interleaved"||n.mode==="outdoors-overlay")&&n.map&&(w(this,Wa,n.mode),this.map=n.map),a(this,G).entityScene.addEventListener("childadded",()=>{a(this,Dt).call(this),a(this,Lr).call(this)}),a(this,G).entityScene.addEventListener("childremoved",()=>{a(this,Dt).call(this),a(this,Lr).call(this)}),a(this,G).geometry3DMap.set(a(this,G).entityScene.userData.entityId,a(this,G).entityScene),n.center&&(a(this,G).center=n.center?[...n.center]:[0,0]),this.options=n,this.container=r,z(this,cn,cD).call(this),z(this,cn,pD).call(this),a(this,R).htmlControlsSystem=new qx(this.container,{outdoorEnabled:!!this.map}),a(this,Wa)!=="outdoors-overlay"&&a(this,R).htmlControlsSystem.addAttributionControl(this.options.attribution),window.MappedinDebug||(window.MappedinDebug={}),y.env.NODE_ENV==="test"&&(window.MappedinDebug.mapViewCoreInstance=this),w(this,zr,new B0({antialias:typeof n.antialias=="boolean"?n.antialias:!0,alpha:!1,canvas:this.mode!=="standalone"?n.gl?.canvas:void 0,onWebGLContextCreationError:n.onWebGLContextCreationError,onWebGLContextLost:n.onWebGLContextLost,onWebGLContextRestored:v=>{n.onWebGLContextRestored?.(v),a(this,Lr).call(this),a(this,Dt).call(this),this.render()},onWebGLRendererError:n.onWebGLRendererError,backgroundColor:n.backgroundColor||"#ffffff",backgroundAlpha:n.backgroundAlpha??1})),w(this,ur,new al),a(this,Wa)!=="standalone"&&a(this,ur).add(G5()),a(this,ur).add(a(this,G).entityScene);let o=window.__THREE_DEVTOOLS__;y.env.NODE_ENV==="dev"&&typeof o<"u"&&(o.dispatchEvent(new CustomEvent("observe",{detail:a(this,ur)})),o.dispatchEvent(new CustomEvent("observe",{detail:a(this,zr)}))),w(this,tr,new Zv(Kee,this.aspect,50,1e5)),a(this,G).cameraObject=a(this,tr),w(this,Ng,new YT),a(this,tr).renderOrder=999;let i=new oi;i.add(a(this,tr)),w(this,Xf,new oi),a(this,Xf).add(i),a(this,ur).add(a(this,Xf)),a(this,tr).updateProjectionMatrix(),a(this,tr).updateMatrixWorld(!0),this.referenceMap={scale:1,latitude:0,longitude:0,getNorth:()=>0,georeference:[{target:{x:0,y:0}},{target:{x:0,y:0}},{target:{x:0,y:0}},{target:{x:0,y:0}}]},this.rendererDomElement=a(this,zr).domElement(),w(this,zf,new De);let s=new si(1e6,1e6),l=new Tr({color:0,visible:!1});w(this,tc,new Re(s,l)),a(this,tc).name="worldPlane",a(this,ur).add(a(this,tc)),n.gl?.canvas||r.appendChild(this.rendererDomElement),window.addEventListener("resize",a(this,Hg),!1),a(this,Gg).addEventListener("change",a(this,Vg)),typeof ResizeObserver=="function"&&y.env?.NODE_ENV!=="test"&&(w(this,Zp,new ResizeObserver(C5(v=>{a(this,Zf).call(this,v[0].contentRect.width,v[0].contentRect.height)},50))),a(this,Zp)?.observe(r)),r.classList.add("mappedin-map"),this.rendererDomElement.style.width=globalThis.MappedinDebug?.TEST_IOS?"1080px":"100%",this.rendererDomElement.style.height=globalThis.MappedinDebug?.TEST_IOS?"1920px":"100%",y.env.NODE_ENV==="test"&&this.rendererDomElement.setAttribute("data-testid","mappedin-canvas"),this.mode!=="outdoors-overlay"&&this.rendererDomElement.tabIndex!==void 0&&this.rendererDomElement.removeAttribute("tabindex"),a(this,G).canvasWidth=this.rendererDomElement.clientWidth,a(this,G).canvasHeight=this.rendererDomElement.clientHeight,this.rendererDomElement.style.touchAction="manipulation";let c=this.canvasWidth,p=this.canvasHeight;a(this,R).watermarkSystem=new Xx(a(this,tr),a(this,G),n?.watermark),a(this,R).watermarkSystem.on("texture-loaded",this.render),a(this,G).shouldMeasureCanvas=!0,a(this,G).pixelRatio=this.resolutionScale,a(this,zg).call(this,Math.floor(c*this.resolutionScale),Math.floor(p*this.resolutionScale));let d=new lb(16777215,.3*Math.PI);d.position.set(-150,-150,350),a(this,ur).add(d);let m=new t5(16777215,.741*Math.PI);a(this,ur).add(m),a(this,R).cameraSystem=new jp(a(this,tr),a(this,ur),a(this,zr).renderer,a(this,G),{mode:this.mode,canvasHeight:p,canvasWidth:c}),a(this,R).cameraSystem.on("user-dolly-start",a(this,An)),a(this,R).cameraSystem.on("user-pan-start",a(this,An)),a(this,R).cameraSystem.on("user-rotate-start",a(this,An)),a(this,R).cameraSystem.on("user-zoom-start",a(this,An)),a(this,R).cameraSystem.on("user-tilt-start",a(this,An)),a(this,R).cameraSystem.on("user-pedestal-start",a(this,An)),a(this,R).cameraSystem.on("user-dolly-end",a(this,Ln)),a(this,R).cameraSystem.on("user-pan-end",a(this,Ln)),a(this,R).cameraSystem.on("user-rotate-end",a(this,Ln)),a(this,R).cameraSystem.on("user-zoom-end",a(this,Ln)),a(this,R).cameraSystem.on("user-tilt-end",a(this,Ln)),a(this,R).cameraSystem.on("user-pedestal-end",a(this,Ln)),a(this,R).cameraSystem.on("change",()=>{this.publish("camera-change",this.camera),a(this,R).geometryInFocusSystem&&(a(this,R).geometryInFocusSystem.cameraDirty=!0),this.render()}),this.onAbort(()=>{a(this,R).cameraSystem.off("user-dolly-start",a(this,An)),a(this,R).cameraSystem.off("user-pan-start",a(this,An)),a(this,R).cameraSystem.off("user-rotate-start",a(this,An)),a(this,R).cameraSystem.off("user-zoom-start",a(this,An)),a(this,R).cameraSystem.off("user-tilt-start",a(this,An)),a(this,R).cameraSystem.off("user-pedestal-start",a(this,An)),a(this,R).cameraSystem.off("user-dolly-end",a(this,Ln)),a(this,R).cameraSystem.off("user-pan-end",a(this,Ln)),a(this,R).cameraSystem.off("user-rotate-end",a(this,Ln)),a(this,R).cameraSystem.off("user-zoom-end",a(this,Ln)),a(this,R).cameraSystem.off("user-tilt-end",a(this,Ln)),a(this,R).cameraSystem.off("user-pedestal-end",a(this,Ln)),a(this,R).renderSystem.off("measure-canvas",a(this,Jp)),a(this,R).cameraSystem.off("change",this.render)}),a(this,R).pathSystem=new Rg(a(this,G),this.convertTo3DMapPosition,this.getParentContainer,a(this,R).cameraSystem.convertZoomLevelToAltitude),a(this,R).pathSystem.on("animate:path",this.render),this.onAbort(()=>{a(this,R).pathSystem.off("animate:path",this.render)}),a(this,R).panBoundsSystem=new Jx(a(this,G),a(this,R).cameraSystem);let g=()=>{let{panBounds:v,fov:C,convertAltitudeToZoomLevel:I}=a(this,R).cameraSystem;if(a(this,R).panBoundsSystem.autoMinZoomLevel){if(v.radius<=0)return;let S=Math.min(a(this,G).canvasWidth/a(this,G).canvasHeight,1),P=C*Math.PI/180*S,O=Math.tan(P/2),{radius:M,center:E}=a(this,R).cameraSystem.panBounds,B=M/O,j=this.getThreeCamera().getWorldPosition(new ue),L=E.distanceTo(j),N=Math.abs(j.z-E.z),X=B*N/L,Z=I(X);B5(Z,this.camera.minZoomLevel)&&this.camera.setMinZoomLevel(Z)}this.publish("pan-bounds-change",a(this,R).cameraSystem.panBounds)};a(this,R).panBoundsSystem.on("update",g),this.onAbort(()=>{a(this,R).panBoundsSystem.off("update",g)}),this.camera=new zx(this,a(this,R),a(this,G)),this.camera.setZoomLevel(n.zoomLevel??aT),this.camera.setBearing(n.bearing??sT),this.camera.setPitch(n.pitch??iT),this.camera.setMaxZoomLevel(qee),this.camera.setMinZoomLevel(Jee),a(this,R).domVisiblitySystem=new Ex(a(this,G),a(this,qo)),a(this,R).domMutationSystem=new $x(a(this,G),a(this,qo)),a(this,R).domMutationSystem.on("dimensions-update",()=>{a(this,R).collisionSystem.collidersDirty=!0,this.render()}),a(this,R).domDrawSystem=new Wx(a(this,G)),a(this,R).collisionSystem=new G0(a(this,Gi),a(this,G),(n.useCollisionWorker??!0)&&(n.useWorkers??!0)),a(this,R).twoDDrawSystem=new Fx(a(this,G),a(this,dr),n.transformImageRequest),a(this,R).twoDDrawSystem.on("img:loaded",this.render),a(this,R).interactionSystem=new $h(this.rendererDomElement,a(this,G),a(this,tr),a(this,tc),a(this,R).cameraSystem.isUserInteracting),a(this,R).interactionSystem.on("doubletap-with-onefinger",v=>{a(this,R).cameraSystem.enableZoom&&this.camera.animateTo({center:this.projectScreenXYToCoordinate(v.clientX,v.clientY)?.coordinate,zoomLevel:this.camera.zoomLevel+1,duration:r2,easing:"ease-out"})}),a(this,R).interactionSystem.on("singletap-with-twofinger",()=>{a(this,R).cameraSystem.enableZoom&&this.camera.animateTo({zoomLevel:this.camera.zoomLevel-1,duration:r2,easing:"ease-out"})}),a(this,R).interactionSystem.on("hover",this.render),a(this,R).interactionSystem.on("click",v=>{if(v.entity2D?.id==="watermark"&&typeof a(this,R).watermarkSystem.options.onClick=="function"&&a(this,R).watermarkSystem.options.interactive){a(this,R).watermarkSystem.options.onClick();return}let C=v.entity3D?[v.entity3D?.id]:[];v.entity3D?.parentObject3D?.userData?.entityId&&C.push(v.entity3D?.parentObject3D?.userData?.entityId),this.publish("click",{coordinate:this.convert3DMapPositionToCoordinate(v.position),geometry:C,paths:v.entity3D?.components[0]instanceof Jl?[v.entity3D.id]:[],markers:v.entity2D?.components[0]instanceof ws?[v.entity2D.id]:[],models:v.entity3D?.components[0]instanceof Zl?[v.entity3D.id]:[],labels:v.entity2D?.components[0]instanceof Os?[v.entity2D.id]:[],containers:Array.isArray(v.groupContainers)?v.groupContainers.map(I=>I.userData.entityId):[],pointerEvent:v.pointerEvent})}),a(this,R).interactionSystem.on("hover",v=>{v.position&&this.publish("hover",{coordinate:this.convert3DMapPositionToCoordinate(v.position),geometry:v.entity3D?[v.entity3D?.id]:[],paths:v.entity3D?.components[0]instanceof Jl?[v.entity3D.id]:[],markers:v.entity2D?.components[0]instanceof ws?[v.entity2D.id]:[],models:v.entity3D?.components[0]instanceof Zl?[v.entity3D.id]:[],labels:v.entity2D?.components[0]instanceof Os?[v.entity2D.id]:[],containers:Array.isArray(v.groupContainers)?v.groupContainers.map(C=>C.userData.entityId):[]})}),a(this,R).geometryInFocusSystem=new av(a(this,G),a(this,tr));let x=v=>{this.publish("geometry-in-focus",v)};a(this,R).geometryInFocusSystem.on("geometry-in-focus",x),this.onAbort(()=>{a(this,R).geometryInFocusSystem.off("geometry-in-focus",x)}),a(this,R).twoDVisiblitySystem=new Ax(a(this,G)),a(this,R).drawSystem=new kx(a(this,G),this.convertTo3DMapPosition),a(this,R).drawSystem.on("texture-loaded",this.render),a(this,R).twoDProjectionSystem=new Dx(a(this,G),a(this,$g)),a(this,R).exporterSystem=new ag(a(this,G)),a(this,R).meshOptimizationSystem=new _x(a(this,G),this.convertTo3DMapPosition),a(this,R).meshOptimizationSystem.on("model-loaded",this.render),a(this,R).meshOptimizationSystem.on("geometry-2d-added",this.render),a(this,R).meshOptimizationSystem.on("geometry-group-added",a(this,jg)),this.onAbort(()=>{a(this,R).meshOptimizationSystem.off("model-loaded",this.render),a(this,R).meshOptimizationSystem.off("geometry-2d-added",this.render),a(this,R).meshOptimizationSystem.off("geometry-group-added",a(this,jg))}),a(this,R).meshDetachmentSystem=new fv(a(this,G)),a(this,R).meshModificationSystem=new mv(a(this,G)),a(this,R).geometryDisposalSystem=new Iv(a(this,G)),a(this,R).customGeometrySystem=new Kx(a(this,G),this.convertTo3DMapPosition),a(this,R).outlineInterpolationSystem=new tv(a(this,G)),a(this,R).renderSystem=new Lx(a(this,zr),a(this,G),this.mode,a(this,ur),a(this,tr),this.viewCamera,a(this,R)),a(this,R).imageSystem=new sv(a(this,G),this.convertTo3DMapPosition,n.bearing,n.naturalBearing,n.imagePlacementOptions),a(this,R).text3DSystem=new lx(a(this,G),this.convertTo3DMapPosition,n.useWorkers??!0),a(this,R).text3DSystem.on("render",this.render),a(this,R).imageSystem.on("image-loaded",this.render),a(this,R).renderSystem.on("pre-render",()=>this.publish("pre-render")),a(this,R).renderSystem.on("post-render",()=>this.publish("post-render")),a(this,R).renderSystem.on("measure-canvas",a(this,Jp)),this.onAbort(()=>{a(this,R).renderSystem.off("pre-render",()=>this.publish("pre-render")),a(this,R).renderSystem.off("post-render",()=>this.publish("post-render")),a(this,R).renderSystem.off("measure-canvas",a(this,Jp))}),a(this,R).outdoorLayersSystem=new pv(this.map),a(this,R).occlusion2DSystem=new vv(a(this,G),this.convertTo3DMapPosition,a(this,zr)),n.occlusionEnabled&&a(this,R).occlusion2DSystem.enable(),this.Debug=new xv(this),n.environment!==!1&&w(this,Xp,z(this,cn,oT).call(this)),a(this,Sv).call(this)}get viewCamera(){return a(this,Ng)}get canvasWidth(){return a(this,G).canvasWidth}get canvasHeight(){return a(this,G).canvasHeight}get resolutionScale(){return this.map?._getClampedPixelRatio(this.canvasWidth,this.canvasHeight)??yu()}get aspect(){return this.canvasWidth/this.canvasHeight}get mode(){return a(this,Wa)}addGroupContainer(r,n,o){if(!a(this,G).geometry3DMap.has(r)&&!a(this,G).geometry2DMap.has(r)){let i=new kt(r);i.addEventListener("childadded",()=>{a(this,Dt).call(this),a(this,Lr).call(this)}),i.addEventListener("childremoved",()=>{a(this,Dt).call(this),a(this,Lr).call(this)}),n?.visible!==void 0&&(i.visible=n.visible),n?.altitude!==void 0&&i.setAltitude(n.altitude),n?.interactive!==void 0&&$r(i,n.interactive,a(this,G)),n?.focusable!==void 0&&hx(i,n.focusable),n?.preloadGeometry!==void 0&&(i.userData.preloadGeometry=n.preloadGeometry),a(this,G).geometry3DMap.set(r,i);let s=this.getParentContainer(o);s instanceof kt&&s.addEntity(i),a(this,Dt).call(this),this.render()}else A.error(`Group container with ID '${r}' already exists. The group container cannot be added.`);return{id:r,type:"group-container"}}addCustomGeometry(r,n,o,i,s){if(a(this,G).geometry3DMap.has(r))A.error(`Custom geometry with ID '${r}' already exists. The custom geometry cannot be added.`);else{let l=new Uf(n,o),c=new Ke(l,new Qi(i));i?.interactive!==void 0&&$r(c,i.interactive,a(this,G)),c.id=r,l.mesh.userData={entityId:r,type:"custom-geometry"},a(this,G).geometry3DMap.set(c.id,c);let p=this.getParentContainer(s);s&&p instanceof kt?p.addEntity(c):a(this,G).entityScene.addEntity(c),a(this,Dt).call(this),this.render()}return{id:r,type:"custom-geometry"}}addGeometryGroup(r,n,o,i){if(!a(this,G).geometry3DMap.has(r)&&!a(this,G).geometry2DMap.has(r)){let s=new ro(r);s.addEventListener("childadded",()=>{a(this,Dt).call(this),a(this,Lr).call(this)}),s.addEventListener("childremoved",()=>{a(this,Dt).call(this),a(this,Lr).call(this)}),s.userData.dirty=!0,a(this,G).geometry3DMap.set(r,s);for(let c of n.features){if(c.geometry==null||!["Polygon","MultiPolygon","LineString","MultiLineString"].includes(c.geometry.type))continue;let p=c?.id||c?.properties?.id||dt(),{visible:d,altitude:m,...g}=o||{color:I5},x=a(this,R).meshOptimizationSystem.createEntityFromFeature(p,c,{outline:!0,...g});a(this,G).geometry3DMap.set(p,x),s.userData.entities3D.add(p)}s.setVisible(o?.visible??!0),o?.altitude!=null&&s.setAltitude(o.altitude);let l=this.getParentContainer(i);l instanceof kt&&l.addEntity(s),a(this,Dt).call(this),this.render()}else A.error(`Geometry group with ID '${r}' already exists. The geometry group cannot be added.`);return a(this,R).outlineInterpolationSystem.geometries3DDirty=!0,{id:r,type:"geometry-group"}}addOccluder(r,n){let o=this.getParentContainer(n),i=a(this,R).occlusion2DSystem.reserveOccluderId();return o?.addOccluderFeature(r,i),i}addImage(r,n,o,i){try{$8(r,n,o)}catch(s){A.error(s);return}if(!a(this,G).geometry3DMap.has(r)&&!a(this,G).geometry2DMap.has(r)){let s=new iv(n),l=new Ke(s,new Qi(o));l.id=r||dt(),s.mesh.userData={entityId:l.id,type:"path"},a(this,G).geometry3DMap.set(l.id,l);let c=this.getParentContainer(i);c instanceof kt&&c.addEntity(l),a(this,Dt).call(this),this.render()}else A.error(`Image with ID '${r}' already exists. The image cannot be added.`);return{id:r,type:"image"}}addModelGroup(r,n,o,{parent:i,onComplete:s}={}){try{y8(r,n,o)}catch(l){A.error(l);return}if(!a(this,G).geometry3DMap.has(r)&&!a(this,G).geometry2DMap.has(r)){let l=new ro(r);l.addEventListener("childadded",()=>{a(this,Dt).call(this),a(this,Lr).call(this)}),l.addEventListener("childremoved",()=>{a(this,Dt).call(this),a(this,Lr).call(this)}),a(this,G).geometry3DMap.set(r,l),l.userData.dirty=!0,l.userData.modelURL=o.url;for(let p of n.features){let d=p.id||p.properties.id||dt(),m=a(this,R).meshOptimizationSystem.createModelFromFeature(d,p,{...o});(p.properties.interactive!==void 0||o.interactive!=null)&&$r(m,p.properties.interactive??o.interactive,a(this,G)),m.parentId=l.userData.entityId,a(this,G).geometry3DMap.set(d,m),l.userData.entities3D.add(d)}let c=this.getParentContainer(i);c instanceof kt&&c.addEntity(l),a(this,Dt).call(this),this.render()?.then(s)}else A.error(`Model group with ID '${r}' already exists. The model group cannot be added.`);return{id:r,type:"geometry-group"}}addMarker2D(r,n,o,i){let s=o?.id;try{A_(r,n,o||{})}catch(l){A.error(l);return}if(s===void 0||!a(this,G).geometry2DMap.has(s)&&!a(this,G).geometry3DMap.has(s)){let l=z(this,cn,nT).call(this,r,new ws(n,o),o?.occluderId,o?.verticalOffset);l.id=s||String(l.id),s=l.id,o?.interactive!=null&&o.interactive!=="pointer-events-auto"&&$r(l,o?.interactive,a(this,G));let c=typeof o?.attachTo=="string"||typeof o?.attachTo=="number"?a(this,G).geometry3DMap.get(o.attachTo):void 0;c instanceof Ke&&c.attach(l),this.getParentContainer(i)?.addEntity(l),this.render()}else A.error(`Marker2D with ID '${s}' already exists. The marker cannot be added.`);return{id:s,type:"marker"}}addText3D(r,n,o,i){if(!a(this,G).geometry3DMap.has(r)&&!a(this,G).geometry2DMap.has(r)){let s=new Wl({...n,properties:{...n.properties,id:r,content:n.properties.text}}),l=new Ke(s,new Cm(o?.appearance));l.id=r,s.mesh.userData.entityId=r.toString(),s.mesh.userData.type="text3d",a(this,G).geometry3DMap.set(r,l);let c=this.getParentContainer(i);c instanceof kt&&c.addEntity(l),a(this,Dt).call(this),this.render()}else A.error(`Text3D with ID '${r}' already exists. The text3d cannot be added.`);return{id:r,type:"text3d"}}labelText3D(r,n,o={}){try{if(!n||!r)throw new Error("content and meshGeometryId are required");DE.parse(o)}catch(p){A.error(p);return}let i=a(this,G).geometry3DMap.get(r);if(i?.type!=="geometry"){A.error(".labelText3D failed: target incorrect");return}let s=i?.components[0];if(!s.feature.properties.textArea)return;if(s.textEntityId){let p=a(this,G).geometry3DMap.get(s.textEntityId);if(p?.type!=="text3d"){A.error(".labelText3D failed: existing text3d not found");return}return{id:p.id,type:p.type}}let l=new Wl({type:"Feature",geometry:{coordinates:s.feature.properties.textArea?.position,type:"Point"},properties:{textArea:s.feature.properties.textArea,content:n,id:dt()}});l.polygonEntityId=r;let c=new Ke(l,new Cm(o?.appearance));return s.textEntityId=c.id.toString(),l.mesh.userData.entityId=c.id.toString(),l.mesh.userData.type="text3d",a(this,G).geometry3DMap.set(c.id.toString(),c),o.parentId&&this.getParentContainer(o.parentId)?.addEntity(c),this.render(),{id:c.id,type:"text3d"}}addLabel2D(r,n,o,i){let s=o?.id;try{IE(r,n,o||{})}catch(l){A.error(l);return}if(s===void 0||!a(this,G).geometry2DMap.has(s)&&!a(this,G).geometry3DMap.has(s)){let l=z(this,cn,nT).call(this,r,new Os(n,o||{},a(this,G)),o?.occluderId,o?.verticalOffset);l.id=s||String(l.id),s=l.id,o?.interactive!=null&&$r(l,o?.interactive,a(this,G));let c=typeof o?.attachTo=="string"||typeof o?.attachTo=="number"?a(this,G).geometry3DMap.get(o.attachTo):void 0;c instanceof Ke&&c.attach(l),this.getParentContainer(i)?.addEntity(l),a(this,Lr).call(this),this.render()}else A.error(`Label2D with ID '${s}' already exists. The label cannot be added.`);return{id:s,type:"label"}}addPath(r,n={},o){try{T8(r,n||{})}catch(c){A.error(c);return}let i=new Jl(r,TC(n)),s=new Ke(i,new Qi({color:n?.color??"#ff834c",altitude:n?.verticalOffset??.1}));s.id=n?.id||dt(),i.mesh.userData={entityId:s.id,type:"path"},a(this,G).geometry3DMap.set(s.id,s),n?.interactive!=null&&$r(s,n?.interactive,a(this,G));let l=this.getParentContainer(o);return l instanceof kt&&l.addEntity(s),a(this,Dt).call(this),this.render(),{id:s.id,type:"path"}}updateWatermark(r){a(this,R).watermarkSystem.options=r,a(this,R).watermarkSystem.dirty=!0,a(this,R).collisionSystem.collidersDirty=!0,this.render()}remove(r){let n;if(typeof r=="string"||typeof r=="number"?(n=a(this,G).geometry2DMap.get(r),n==null&&(n=a(this,G).geometry3DMap.get(r))):typeof r.id=="string"||typeof r.id=="number"?(n=a(this,G).geometry2DMap.get(r.id),n==null&&(n=a(this,G).geometry3DMap.get(r.id))):n=r,n!=null){if(n.type==="custom-geometry")a(this,G).geometry3DMap.delete(n.id),n.object3d&&Qt(n.object3d);else if(n.type==="group-container"){a(this,G).geometry3DMap.delete(n.userData.entityId);for(let i of n.childrenIds.values())this.remove(i),n.userData.entities2D.delete(i);let o=n.components[1];o&&o.focusMesh&&Qt(o.focusMesh),Qt(n)}else if(n.type==="geometry-group"){a(this,G).geometry3DMap.delete(n.userData.entityId);for(let o of n.userData.entities3D.values())this.remove(o),n.userData.entities3D.delete(o);Qt(n)}else if(n.type==="geometry"||n.type==="model"||n.type==="path"){let o=n.components[0],i=n.components[4];if(n.entities2D.size>0){for(let l of n.entities2D.values())this.remove(l);n.removeAllEntities()}let s=n.parentObject3D?.userData.entityId??n.parentId;if(s){let l=a(this,G).geometry3DMap.get(s);l instanceof ro&&l.userData.entities3D.delete(n.id)}if(n.object3d&&Qt(n.object3d),n.type==="geometry"){let l=n.components[3];l&&(l.enabled=!1,l.dirty=!0)}i&&"focusMesh"in i&&i.focusMesh!=null&&Qt(i.focusMesh),"textMesh"in o&&o.textMesh!=null&&this.remove(o.textMesh.userData.entityId),a(this,G).geometry3DMap.delete(n.id)}else if(n.type==="marker"||n.type==="label"){let o=n.attachedTo;if(o){let i=a(this,G).geometry3DMap.get(o);i instanceof Ke&&i.detach(n)}n.object3d&&Qt(n.object3d),n.type==="label"&&delete a(this,R).twoDDrawSystem.textCache[n.id],a(this,G).geometry2DMap.delete(n.id)}else if(n.type==="image")n.object3d&&Qt(n.object3d),a(this,G).geometry3DMap.delete(n.id);else if(n.type==="text3d"){Qt(n.object3d);let{batchedText:o,textMesh:i,polygonEntityId:s}=n.components[0];if(i&&(o&&o.removeText(i),Qt(i)),s){a(this,R).text3DSystem.remove(s);let l=a(this,G).geometry3DMap.get(s);l?.type==="geometry"&&(l.components[0].textMesh=void 0,l.components[0].textEntityId=void 0)}a(this,G).geometry3DMap.delete(n.id)}a(this,Dt).call(this),a(this,Lr).call(this),this.render()}}getScene(){return this.getState("__scene")}getThreeScene(){return a(this,ur)}getThreeCamera(){return a(this,tr)}async setEnvironment(r){if(a(this,ur))if(r==="basic"){a(this,Xp)||w(this,Xp,z(this,cn,oT).call(this));let n=await a(this,Xp);a(this,ur).environment=n}else a(this,ur).environment=null}getEnvironment(){return a(this,ur)?.environment?"basic":!1}getCurrentSceneGLTF(r){return a(this,R).exporterSystem.getCurrentSceneGLTF(r)}getBoundingArea(r){(a(this,R).renderSystem.threeDdirty||a(this,R).renderSystem.twoDdirty)&&this.renderSync();let n=new vr;if(r==null)n.setFromObject(a(this,G).entityScene);else{let o=gu(a(this,G),r);if(o?.type==="geometry"&&o?.object3d!=null){let i=o.components[0],s=i instanceof or?i.geometry:void 0;i.mesh instanceof ib&&s?(s.computeBoundingBox(),s.boundingBox&&n.union(s.boundingBox)):n.setFromObject(o.object3d)}else(o?.type==="geometry-group"||o?.type==="group-container")&&o?.userData.entityId!=null&&n.setFromObject(o)}if(gc(n))return M5(n).map(this.convert3DMapPositionToCoordinate)}hasState(r){return gu(a(this,G),r)!=null}getState(r){if(r==null)return{type:"map-view",hoverColor:a(this,G).hoverColor,text3dHoverColor:a(this,G).text3dHoverColor};let n=gu(a(this,G),r);if(n?.type==="custom-geometry"){let o=n.components[0],i=n.components[1];return{id:n.id,type:"custom-geometry",visible:i.visible,altitude:i.altitude,parent:n.parentObject3D?.userData.entityId,position:this.convert3DMapPositionToCoordinate(o.position)}}else if(n?.type==="geometry-group"){let o=Array.from(n.userData.entities3D.values()),i=o?.[0],s=i?this.getState(i):{};return{id:n.userData.entityId,type:"geometry-group",visible:n.visible,altitude:n.altitude,color:s?.color,initialColor:s?.initialColor,side:s?.side??"double",opacity:s?.opacity,height:s?.height,texture:s?.texture,topColor:s?.topColor,topTexture:s?.topTexture,interactive:s?.interactive,children:o,bevel:s?.bevel}}else{if(n?.type==="group-container")return{id:n.userData.entityId,type:"group-container",visible:n.visible,altitude:n.getWorldPosition(Qee).z??0,opacity:n.opacity,interactive:!!n.components[0],children:Array.from(n.childrenIds.values()).map(o=>this.getState(o)).filter(Boolean)};if(n?.type==="label"){let o=n.components[0],i=n.object3d.parent,s=i?.userData.entityId;return{id:n.id,type:"label",text:o.text||"",parent:{id:s,type:i?.type},position:this.convert3DMapPositionToCoordinate(n.position),enabled:o.enabled,visible:o.visible,initialRank:Hh(o.initialRank),options:{rank:Hh(o.rank),appearance:o.appearance,interactive:n.components[1]!=null,verticalOffset:n.verticalOffset,attachTo:n.attachedTo}}}else if(n?.type==="marker"){let o=n.components[0],i=n.object3d.parent,s=i?.userData.entityId;return{id:n.id,type:"marker",enabled:o.enabled,visible:o.visible,placement:o.options.placement,dynamicResize:o.options.dynamicResize,parent:{id:s,type:i?.type},position:this.convert3DMapPositionToCoordinate(n.position),element:o.containerEl,initialRank:Hh(o.initialRank),contentHTML:o.contentHtml,options:{rank:Hh(o.rank),interactive:n.components[1]!=null||!1,verticalOffset:n.verticalOffset,attachTo:n.attachedTo,lowPriorityPin:o.options.lowPriorityPin}}}else if(n?.type==="geometry"){let{color:o,hoverColor:i,initialColor:s,initialTopColor:l,topColor:c,altitude:p}=n.components[1],d=n.components[0],m=n.components[1],g=n.components[1],x=n.components[2],v=n.components[3],C=n.parentObject3D;return{id:n.id,type:"geometry",opacity:g.opacity,initialColor:s,color:o,focusable:m!=null&&m.focusMesh!=null,initialTopColor:l,topColor:c,side:g.side,hoverColor:i,hovered:!!x?.hover,height:g.height,visible:g.visible,outline:v?.enabled,showImage:g.showImage,texture:g.texture,topTexture:g.topTexture,flipImageToFaceCamera:g.flipImageToFaceCamera,parent:{id:C?.userData.entityId,type:C?.type},altitude:p,bevel:g.bevel,position:this.convert3DMapPositionToCoordinate(d.position),interactive:n.components[2]!=null}}else if(n?.type==="model"){let o=n.components[0],i=n.components[1],s=n.components[2];return{id:n.id,type:"model",position:o.mesh?this.convert3DMapPositionToCoordinate(o.mesh?.getWorldPosition(new ue)):this.convert3DMapPositionToCoordinate(o.position),interactive:s!=null,material:i.material,parent:n.parentObject3D?.parent?{id:n.parentObject3D.parent.userData.entityId,type:n.parentObject3D.parent.type}:void 0,visible:i.visible,verticalOffset:i.verticalOffset,color:i.color,opacity:i.opacity,rotation:i.rotation??Iu,scale:i.scale??vu}}else if(n?.type==="path"){let o=n.components[0],i=n.components[2],s=n.components[1];return{id:n.id,type:"path",position:this.convert3DMapPositionToCoordinate(o.position),visible:s.visible,interactive:i!=null,completeFraction:o.completeFraction,color:s.color,accentColor:o.accentColor,width:o.width,animateArrowsOnPath:o.animateArrowsOnPath,displayArrowsOnPath:o.displayArrowsOnPath,verticalOffset:s.altitude}}else if(n?.type==="image"){let o=n.components[0];return{id:n.id,type:"image",position:this.convert3DMapPositionToCoordinate(o.position),visible:n.components[1].visible,verticalOffset:o.feature.properties.verticalOffset??0,opacity:n.components[1].opacity,flipImageToFaceCamera:n.components[1].flipImageToFaceCamera,width:o.feature.properties.width??0,height:o.feature.properties.height??0,rotation:o.feature.properties.rotation??0}}else if(n?.type==="text3d"&&n.components[0]instanceof Wl&&"textArea"in n.components[0].feature.properties){JE(n);let o=n.components[0],i=n.components[1],{textMesh:s}=o,l=o.mesh?.parent;l instanceof kt&&l.children.find(d=>d.type==="batchedtext")?.getWorldPosition(a(this,Yg)),a(this,Yf).set(0,0,0);let c=s?s.getWorldPosition(a(this,Yf)):a(this,Yf);return Object.assign({},xu,i.getState(),{id:n.id,type:"text3d",position:this.convert3DMapPositionToCoordinate(c.add(a(this,Yg))),visible:o.visible??!1,content:o.feature.properties.content??""})}else return}}setState(r,n){if(typeof r=="object"&&n==null){"hoverColor"in r&&(xm(r.hoverColor)?a(this,G).hoverColor=r.hoverColor??a(this,G).hoverColor:A.warn(`Failed to update global hover color. Invalid color "${r.hoverColor}".`)),"text3dHoverColor"in r&&(a(this,G).text3dHoverColor=r.text3dHoverColor??a(this,G).text3dHoverColor);return}let o=gu(a(this,G),r);if(o!=null){if(o.type==="custom-geometry"){let i=a(this,G).geometry3DMap.get(o.id);if(i instanceof Ke&&i.components[0]instanceof Uf){let s=n;_s(o,a(this,G),s.visible),kf(o,s.altitude),vC(o,s.position,this.convertTo3DMapPosition),IC(o,this.getParentContainer(s.parent,!1)),$r(o,s.interactive,a(this,G))&&a(this,Dt).call(this)}}else if(o.type==="path"){let i=n;$r(o,i.interactive,a(this,G))&&a(this,Dt).call(this),kf(o,i.verticalOffset),YE(o,a(this,G),i)}else if(o.type==="model"){let i=n;$r(o,i.interactive,a(this,G))&&a(this,Dt).call(this),_s(o,a(this,G),i.visible),QE(o,i)}else if(o.type==="group-container"){let i=n;_s(o,a(this,G),i.visible)&&(a(this,R).pathSystem.verticalDistanceDirty=!0,a(this,R).geometryInFocusSystem.focusablesDirty=!0),kf(o,i.altitude)&&(a(this,R).pathSystem.verticalDistanceDirty=!0),$r(o,i.interactive,a(this,G))&&a(this,Dt).call(this),sg(o,a(this,G),i.opacity)&&(a(this,R).outlineInterpolationSystem.outlineOpacitiesDirty=!0),i.preloadGeometry&&o.userData.preloadGeometry!==!0&&(o.userData.preloadGeometry=!0,a(this,R).outlineInterpolationSystem.geometries3DDirty=!0),hx(o,i.focusable)&&(a(this,R).geometryInFocusSystem.focusablesDirty=!0)}else if(o.type==="geometry-group"){let i=n;_s(o,a(this,G),i.visible),RE(o,a(this,G),i),mx(o,a(this,G),i.outline),i.height!=null&&dx(o,a(this,G),i.height),kf(o,i.altitude),zE(o,a(this,G),i),BE(o,a(this,G),i.shading),sg(o,a(this,G),i.opacity)&&(a(this,R).outlineInterpolationSystem.outlineOpacitiesDirty=!0),$r(o,i.interactive,a(this,G))&&(a(this,Dt).call(this),a(this,Lr).call(this)),gx(o,a(this,G),i.side)}else if(o.type==="geometry"){if(o.components[0]instanceof or){let i=n;_s(o,a(this,G),i.visible),mx(o,a(this,G),i.outline),NE(o,i),hx(o,i.focusable)&&(a(this,R).geometryInFocusSystem.focusablesDirty=!0),ZE(o,i.renderOrder)&&(a(this,R).meshDetachmentSystem.dirty=!0),XE(o,i.opacity)&&(a(this,R).meshDetachmentSystem.dirty=!0,a(this,R).interactionSystem.dirty3D=!0,a(this,R).outlineInterpolationSystem.outlineOpacitiesDirty=!0),SC(o,i.flipImageToFaceCamera),kf(o,i.altitude),i.height!=null&&dx(o,a(this,G),i.height),CC(o,i)&&(a(this,R).meshDetachmentSystem.dirty=!0),fx(o,i),HE(o,i.hoverColor),$r(o,i.interactive,a(this,G)),WE(o,i.hovered),gx(o,a(this,G),i.side)}a(this,Dt).call(this)}else if(o.type==="label"||o.type==="marker"){let i=n;VE(o,n,a(this,G)),jE(o,n,a(this,G))&&(a(this,Lr).call(this),a(this,R).domMutationSystem.dirty=!0),vC(o,i.position,this.convertTo3DMapPosition),IC(o,this.getParentContainer(i.parent,!1))&&(a(this,Lr).call(this),a(this,R).panBoundsSystem.dirty=!0),GE(o,i.enabled),_s(o,a(this,G),i.visible)}else if(o.type==="image"){let i=n;_s(o,a(this,G),i.visible),sg(o,a(this,G),i.opacity),SC(o,i.flipImageToFaceCamera)}else if(o.type==="text3d"){let i=n;KE(o,a(this,G),i)}this.render()}}convertTo3DMapPosition(r,n,o=0,i){if(Array.isArray(r))return this.convertTo3DMapPosition(r[1],r[0],r[2]??o,typeof n=="function"?n:void 0);if(typeof n!="number")throw new Error("convertTo3DMapPosition failed: longitude must be a number");let{x:s,y:l}=bb(a(this,G).center?.[1]??0,a(this,G).center?.[0]??0,r,n);return i?(i.set(s,l,o),i):new ue(s,l,o)}get backgroundColor(){return typeof a(this,zr).backgroundColor=="string"?a(this,zr).backgroundColor:`#${a(this,zr).backgroundColor.getHexString()}`}get backgroundAlpha(){return a(this,zr).backgroundAlpha}getThreeRenderer(){return a(this,zr)}getCenter(r){let n=Array.isArray(r)?r:this.getBoundingArea(r);return n?R5(n):void 0}isInView(r){let n=gu(a(this,G),r);if(a(this,Xg).identity().multiply(a(this,tr).projectionMatrix).multiply(a(this,tr).matrixWorldInverse),a(this,qp).setFromProjectionMatrix(a(this,Xg)),n instanceof xc)return a(this,qp).containsPoint(n.position);if(n instanceof Ke){let o=n?.components[0];if(o instanceof Uf||o instanceof Zl)return a(this,qp).containsPoint(this.convertTo3DMapPosition(o.feature.geometry.coordinates));if(o instanceof or){let i=new vr(this.convertTo3DMapPosition(o.featureBbox[1],o.featureBbox[0],0),this.convertTo3DMapPosition(o.featureBbox[3],o.featureBbox[2],0));return a(this,qp).intersectsBox(i)}}return!1}onMapLibreEvent(r,n){if(!this.map){A.warn(`Tried to add event listener "${r}" but MapLibre map is not initialized.`);return}this.map.on(r,n),a(this,Jo)[r]=a(this,Jo)[r]||[],a(this,Jo)[r].push(n)}offMapLibreEvent(r,n){!this.map||!Array.isArray(a(this,Jo)[r])||(this.map.off(r,n),a(this,Jo)[r]=a(this,Jo)[r].filter(o=>o!==n))}get aborted(){return a(this,Yp).signal.aborted}onAbort(r){a(this,Yp).signal.addEventListener("abort",r,{once:!0})}getSystems(){return a(this,R)}getInternalState(){return a(this,G)}getInternalTweenGroup(){return a(this,G).internalTweenGroup}getExternalTweenGroup(){return a(this,G).externalTweenGroup}computeMinZOffsetBetweenContainers(r,n,o){if(!r||!n)return-1;mu(r,"group-container"),mu(n,"group-container");let i=xb(r,this.getThreeCamera()),s=n.clone(),l=xb(s,this.getThreeCamera());if(!gc(i)||!gc(l))return-1;let c=0,p;o&&this.container.querySelectorAll(".debug-box").forEach(m=>m.remove());do{if(c>1e4)return-1;if(c+=20,s.position.z=c,s.updateMatrixWorld(),l.makeEmpty(),xb(s,a(this,tr),l),p=i.intersectsBox(l),o){let d=l2(i,"blue",this.container),m=l2(l,p?"red":"green",this.container);d.classList.add("debug-box"),m.classList.add("debug-box")}}while(p);return c}};ur=new WeakMap,tr=new WeakMap,Xp=new WeakMap,Ng=new WeakMap,zf=new WeakMap,tc=new WeakMap,Zp=new WeakMap,Xf=new WeakMap,cn=new WeakSet,rT=function(r){a(this,Wa)!=="outdoors-overlay"&&this.map?.setPixelRatio(r),a(this,G).pixelRatio=this.resolutionScale},G=new WeakMap,Jo=new WeakMap,Yp=new WeakMap,bt=new WeakMap,Gi=new WeakMap,dr=new WeakMap,qo=new WeakMap,zr=new WeakMap,R=new WeakMap,Gg=new WeakMap,Lr=new WeakMap,Dt=new WeakMap,cD=function(){w(this,bt,document.createElement("div")),a(this,bt).classList.add("mappedin__smart-collision-engine__container"),w(this,Gi,document.createElement("canvas")),a(this,Gi).classList.add("mappedin__smart-collision-engine-debug__container"),this.container.appendChild(a(this,bt)),w(this,dr,document.createElement("canvas")),a(this,dr).classList.add("mappedin__smart-collision-engine__container"),a(this,dr).width=a(this,bt).clientWidth*this.resolutionScale,a(this,dr).height=a(this,bt).clientHeight*this.resolutionScale,a(this,dr).style.width=a(this,bt).clientWidth+"px",a(this,dr).style.height=a(this,bt).clientHeight+"px",a(this,bt).appendChild(a(this,Gi)),a(this,bt).appendChild(a(this,dr)),a(this,Gi).width=a(this,bt).clientWidth,a(this,Gi).height=a(this,bt).clientHeight,a(this,dr).width=a(this,bt).clientWidth*this.resolutionScale,a(this,dr).height=a(this,bt).clientHeight*this.resolutionScale,a(this,dr).style.width=a(this,bt).clientWidth+"px",a(this,dr).style.height=a(this,bt).clientHeight+"px"},pD=function(){w(this,qo,document.createElement("div")),a(this,qo).classList.add("mappedin-2d-entities"),Object.assign(a(this,qo).style,{position:"absolute",top:"0",left:"0",bottom:"0",right:"0",pointerEvents:"none","transform-style":"preserve-3d"}),this.container.appendChild(a(this,qo))},uD=function(){a(this,dr).width=a(this,bt).clientWidth*this.resolutionScale,a(this,dr).height=a(this,bt).clientHeight*this.resolutionScale,a(this,dr).style.width=a(this,bt).clientWidth+"px",a(this,dr).style.height=a(this,bt).clientHeight+"px",a(this,Gi).width=a(this,bt).clientWidth,a(this,Gi).height=a(this,bt).clientHeight,a(this,dr).width=a(this,bt).clientWidth*this.resolutionScale,a(this,dr).height=a(this,bt).clientHeight*this.resolutionScale,a(this,dr).style.width=a(this,bt).clientWidth+"px",a(this,dr).style.height=a(this,bt).clientHeight+"px",a(this,R).collisionSystem.collidersDirty=!0},Wa=new WeakMap,jg=new WeakMap,Ug=new WeakMap,Vg=new WeakMap,Hg=new WeakMap,Zf=new WeakMap,Sv=new WeakMap,Wg=new WeakMap,$g=new WeakMap,zg=new WeakMap,Jp=new WeakMap,nT=function(r,n,o,i){let s=new xc(n,this.convertTo3DMapPosition(r[1],r[0],r[2]||0),i);return s.occluderId=o??a(this,R).occlusion2DSystem.backgroundId,a(this,G).geometry2DMap.set(s.id,s),s},qp=new WeakMap,Xg=new WeakMap,Zg=new WeakMap,An=new WeakMap,Ln=new WeakMap,oT=async function(){return Yl.load(H9).then(r=>(a(this,ur)&&(a(this,ur).environment?.dispose(),r.mapping=jT,a(this,ur).environment=r,this.render()),r))},Cv=new WeakMap,Tv=new WeakMap,Yf=new WeakMap,Yg=new WeakMap;var Qee=new ue,lT=tT;u();function ete(e,t){tte(e,t)(e.getScene(),t),rte(e,t),t.addFolder("Export").add({export:async()=>{let s=await e.getCurrentSceneGLTF({binary:!0}),l=new Blob([s],{type:"application/octet-stream"});var c=document.createElement("a");document.body.appendChild(c),c.style.display="none";let p=window.URL.createObjectURL(l);c.href=p,c.download="scene.glb",c.click(),window.URL.revokeObjectURL(p)}},"export");let o=t.addFolder("Camera"),i={get bearing(){return e.camera.bearing},set bearing(s){e.camera.setBearing(s)},get pitch(){return e.camera.pitch},set pitch(s){e.camera.setPitch(s)},get zoomLevel(){return e.camera.zoomLevel},set zoomLevel(s){e.camera.setZoomLevel(s)}};o.add(i,"bearing",-359,359,1),o.add(i,"pitch",e.camera.minPitch,e.camera.maxPitch,1),o.add(i,"zoomLevel",e.camera.minZoomLevel,e.camera.maxZoomLevel,.1)}function tte(e,t){let r=t;return function n(o,i){let s=i.addFolder(`${[o.type]} ${o.id.slice(0,16)}`);if(i.close(),o.type==="geometry"||o.type==="model"||o.type==="path"||o.type==="image"){let l={get height(){let c=e.getState(o.id);return c?.type==="geometry"?c.height:0},set height(c){e.getState(o.id)?.type==="geometry"&&e.setState(o,{height:c})},set flipImageToFaceCamera(c){e.getState(o.id)?.type==="image"&&e.setState(o,{flipImageToFaceCamera:c})},get flipImageToFaceCamera(){let c=e.getState(o.id);return c?.type==="image"?c.flipImageToFaceCamera:!1},set visible(c){let p=e.getState(o.id);(p?.type==="geometry"||p?.type==="path"||p?.type==="image")&&e.setState(o,{visible:c})},get visible(){let c=e.getState(o.id);return c?.type==="geometry"||c?.type==="path"||c?.type==="image"?c.visible:!1},set outline(c){e.getState(o.id)?.type==="geometry"&&e.setState(o,{outline:c})},get outline(){let c=e.getState(o.id);return c?.type==="geometry"?c.outline:!1},get opacity(){let c=e.getState(o.id);return c?.type==="geometry"?c.opacity:1},set opacity(c){let p=e.getState(o.id);p?.type==="geometry"&&e.setState(p,{opacity:c})},get color(){let c=e.getState(o.id);return c?.type==="geometry"&&c.color?de(c.color).toHexString():"#ffffff"},set color(c){let p=e.getState(o.id);p?.type==="geometry"&&e.setState(p,{color:c})},set interactive(c){let p=e.getState(o.id);(p?.type==="geometry"||p?.type==="model"||p?.type==="path")&&(e.setState(o,{interactive:c}),r.controllersRecursive().forEach(d=>d.updateDisplay()))},get interactive(){let c=e.getState(o.id);return c?.type==="geometry"||c?.type==="model"||c?.type==="path"?c.interactive:!1},get completeFraction(){let c=e.getState(o.id);return c?.type==="path"?c.completeFraction:1},set completeFraction(c){let p=e.getState(o.id);p?.type==="path"&&e.setState(p,{completeFraction:c})},focus:()=>{}};s.add(l,"focus").onChange(()=>{let c=e.getState(o.id);c?.type==="model"||c?.type==="path"||c?.type==="image"?e.camera.focusOn([c.position]):c?.type==="geometry"&&e.camera.focusOn(e.getBoundingArea(c))}),s.add(l,"visible"),o.type==="image"?s.add(l,"flipImageToFaceCamera"):(s.add(l,"interactive"),o.type==="path"&&s.add(l,"completeFraction",0,1,.1),o.type!=="model"&&(s.addColor(l,"color"),s.add(l,"outline"))),o.type==="geometry"&&(s.add(l,"height"),s.add(l,"opacity",0,1,.1))}else if(o.type==="marker"){let l={get interactive(){let c=e.getState(o.id);return c?.type==="marker"?c.options?.interactive:!1},set interactive(c){let p=e.getState(o.id);p?.type==="marker"&&(e.setState(p,{options:{interactive:c}}),r.controllersRecursive().forEach(d=>d.updateDisplay()))},focus:()=>{}};s.add(l,"focus").onChange(()=>{let c=e.getState(o.id);c?.type==="marker"&&e.camera.focusOn([c.position])}),s.add(l,"interactive")}else if(o.type==="label"){let l={get interactive(){let c=e.getState(o.id);return c?.type==="label"?c.options?.interactive:!1},set interactive(c){let p=e.getState(o.id);p?.type==="label"&&(e.setState(p,{options:{interactive:c}}),r.controllersRecursive().forEach(d=>d.updateDisplay()))},get text(){let c=e.getState(o.id);return c?.type==="label"?c.text:""},set text(c){let p=e.getState(o.id);p?.type==="label"&&e.setState(p,{text:c})},get"Text Color"(){let c=e.getState(o.id);return c?.type==="label"?c.options.appearance?.textColor:"#000000"},set"Text Color"(c){e.getState(o.id)?.type==="label"&&e.setState(o.id,{text:l.text,options:{appearance:{textColor:c}}})},get"Text Size"(){let c=e.getState(o.id);return c?.type==="label"?c.options.appearance?.textSize:10},set"Text Size"(c){let p=e.getState(o.id);p?.type==="label"&&e.setState(p,{text:l.text,options:{appearance:{textSize:c}}})},get"Icon Size"(){let c=e.getState(o.id);return c?.type==="label"?c.options.appearance?.iconSize:10},set"Icon Size"(c){let p=e.getState(o.id);p?.type==="label"&&e.setState(p,{text:l.text,options:{appearance:{iconSize:c}}})},get"Pin Color"(){let c=e.getState(o.id);return c?.type==="label"?c.options.appearance?.pinColor:"#000000"},set"Pin Color"(c){let p=e.getState(o.id);p?.type==="label"&&e.setState(p,{text:l.text,options:{appearance:{pinColor:c}}})},get"Pin Color Inactive"(){let c=e.getState(o.id);return c?.type==="label"?c.options.appearance?.pinColorInactive:"#000000"},set"Pin Color Inactive"(c){let p=e.getState(o.id);p?.type==="label"&&e.setState(p,{text:l.text,options:{appearance:{pinColorInactive:c}}})},get"Pin Outline Color"(){let c=e.getState(o.id);return c?.type==="label"?c.options.appearance?.pinOutlineColor:"#000000"},set"Pin Outline Color"(c){let p=e.getState(o.id);p?.type==="label"&&e.setState(p,{text:l.text,options:{appearance:{pinOutlineColor:c}}})},get"Pin Outline Color Inactive"(){let c=e.getState(o.id);return c?.type==="label"?c.options.appearance?.pinOutlineColorInactive:"#000000"},set"Pin Outline Color Inactive"(c){let p=e.getState(o.id);p?.type==="label"&&e.setState(p,{text:l.text,options:{appearance:{pinOutlineColorInactive:c}}})},focus:()=>{}};s.add(l,"focus").onChange(()=>{let c=e.getState(o.id);c?.type==="label"&&e.camera.focusOn([c.position])}),s.add(l,"interactive"),s.add(l,"text"),s.add(l,"Text Size",10,50),s.add(l,"Icon Size",10,50),s.addColor(l,"Text Color"),s.addColor(l,"Active Background Color"),s.addColor(l,"Inactive Background Color"),s.addColor(l,"Active Foreground Color"),s.addColor(l,"Inactive Foreground Color")}else if(o.type==="geometry-group"){let l={get opacity(){let c=e.getState(o.id);return c?.type==="geometry-group"?c.opacity:1},set opacity(c){e.getState(o.id)?.type==="geometry-group"&&e.setState(o,{opacity:c})},set visible(c){e.getState(o.id)?.type==="geometry-group"&&e.setState(o,{visible:c})},get visible(){let c=e.getState(o.id);return c?.type==="geometry-group"?c.visible:!1},set outline(c){e.getState(o.id)?.type==="geometry-group"&&e.setState(o,{outline:c})},get outline(){let c=e.getState(o.id);return c?.type==="geometry-group"?c.outline:!1},set altitude(c){e.getState(o.id)?.type==="geometry-group"&&e.setState(o,{altitude:c})},get altitude(){let c=e.getState(o.id);return c?.type==="geometry-group"?c.altitude:0},set interactive(c){e.getState(o.id)?.type==="geometry-group"&&(e.setState(o,{interactive:c}),r.controllersRecursive().forEach(d=>d.updateDisplay()))},get interactive(){let c=e.getState(o.id);return c?.type==="geometry-group"?c.interactive:!1},get shadingStart(){let c=e.getState(o.id);return c?.type==="geometry-group"?c.shading?.start??0:0},set shadingStart(c){let p=e.getState(o.id);p?.type==="geometry-group"&&e.setState(p,{shading:{start:c}})},get shadingEnd(){let c=e.getState(o.id);return c?.type==="geometry-group"?c.shading?.end??0:0},set shadingEnd(c){let p=e.getState(o.id);p?.type==="geometry-group"&&e.setState(p,{shading:{end:c}})},get shadingIntensity(){let c=e.getState(o.id);return c?.type==="geometry-group"?c.shading?.intensity??0:0},set shadingIntensity(c){let p=e.getState(o.id);p?.type==="geometry-group"&&e.setState(p,{shading:{intensity:c}})}};s.add(l,"visible"),s.add(l,"opacity",0,1,.1),s.add(l,"interactive"),s.add(l,"outline"),s.add(l,"altitude",0,100,1),s.add(l,"shadingStart",0,1,.1),s.add(l,"shadingEnd",0,1,.1),s.add(l,"shadingIntensity",0,1,.1)}else if(o.type==="group-container"){let l={set visible(c){e.getState(o.id)?.type==="group-container"&&e.setState(o,{visible:c})},get visible(){let c=e.getState(o.id);return c?.type==="group-container"?c.visible:!1},set interactive(c){let p=e.getState(o.id);p?.type==="group-container"&&(e.setState(p,{interactive:c}),r.controllersRecursive().forEach(d=>d.updateDisplay()))},get interactive(){let c=e.getState(o.id);return c?.type==="group-container"?c.interactive:!1}};s.add(l,"visible"),s.add(l,"interactive")}if(s.close(),o.children)for(let l of o.children.values())n(l,s)}}function rte(e,t){let r=t.addFolder("Watermark"),n={padding:16,iconOnly:!1,position:"bottom-left",color:"dark",scale:1};r.add(n,"padding",0,100,1),r.add(n,"scale",.5,1.5,.1),r.add(n,"color",["dark","light"]),r.add(n,"position",["top-left","top-right","bottom-left","bottom-right","center","top","bottom","left","right"]),r.add(n,"iconOnly"),r.onChange(()=>{e.updateWatermark(n)})}var dD="https://tiles-cdn.mappedin.com/styles/mappedin/style.json",nte="https://auth.mappedin.com/oauth2/token";var Mv="";function cT(e){Mv=e,T5(e)}var wp="";function pT(e){wp=e}async function fD(e,t){let r=t?.useWorkers??!0,n={...t,watermark:t?.watermark,attribution:t?.attribution,antialias:t?.antialias,occlusionEnabled:t?.occlusionEnabled,transformImageRequest:t?.transformImageRequest,naturalBearing:t?.naturalBearing??0,imagePlacementOptions:t?.imagePlacementOptions,onWebGLContextCreationError:t?.onWebGLContextCreationError,onWebGLContextLost:t?.onWebGLContextLost,onWebGLContextRestored:t?.onWebGLContextRestored,onWebGLRendererError:t?.onWebGLRendererError,useStandaloneCamera:t?.useStandaloneCamera??!1,useCollisionWorker:t?.useCollisionWorker??!0,useWorkers:r};if(r===!0&&t?.outdoorView?.enabled){let{Map:o,MercatorCoordinate:i}=await import("./outdoor-context-v5-TZEP6AEK.js"),s=t.outdoorView.headers;s==null&&(s=await A5(nte));let l=t.center||[0,0],c=new o({container:e,style:t.outdoorView.style||dD,center:l,attributionControl:!1,zoom:t.zoomLevel??aT,pitch:t.pitch??iT,bearing:t.bearing??sT,transformRequest:_5(s),trackResize:!1,pixelRatio:t.outdoorView.lowDpi?1:yu(),canvasContextAttributes:{antialias:typeof t.antialias=="boolean"?t.antialias:!0,powerPreference:"high-performance"},interactive:!1,validateStyle:!1,centerClampedToGround:!1,boxZoom:!1,doubleClickZoom:!1,scrollZoom:!1,dragPan:!1,dragRotate:!1,keyboard:!1,touchZoomRotate:!1}),p=c.painter.context.gl,d=new lT(e,{center:l,zoomLevel:c.getZoom(),pitch:c.getPitch(),bearing:c.getBearing(),gl:p,map:c,mode:"outdoors-interleaved",...n}),m={center:c.getCenter().toArray(),zoom:c.getZoom(),bearing:c.getBearing(),pitch:c.getPitch(),elevation:c.getCenterElevation()};c.setMinZoom(d.camera.minZoomLevel),c.setMaxZoom(d.camera.maxZoomLevel),c.setMaxPitch(d.camera.maxPitch),c.setMinPitch(d.camera.minPitch),d.on("camera-change",E=>{m.center=E.center,m.zoom=E.zoomLevel,m.bearing=E.bearing,m.pitch=E.pitch,m.elevation=E.elevation,c.jumpTo(m)});let g=i.fromLngLat(l,0),x=k5(g,d.viewCamera,()=>{d.renderSync()}),v=async()=>{c&&(c.addLayer(x),d.renderSync())};d.onMapLibreEvent("style.load",v);let C=!1,I=!1,S=()=>{c&&(C||(d.publish("outdoor-view-loaded"),C=!0),I||(I=!0,d.publish("outdoor-style-loaded")))};d.onMapLibreEvent("idle",S);let P=E=>{E&&(E.sourceDataType==="metadata"||E.sourceDataType==="visibility"||E.dataType==="style"||E.type==="terrain")&&d.getSystems().htmlControlsSystem.updateData(c)},O=E=>{c&&E&&E.dataType==="style"&&E.type==="styledata"&&(I=!1),P(E)};d.onMapLibreEvent("styledata",O),d.onMapLibreEvent("sourcedata",P),d.onMapLibreEvent("terrain",P);let M=E=>{if(E.error?.url===dD){A.error(`Failed to load outdoor view style, possibly due to invalid token "${s["x-mappedin-tiles-key"]}"`);return}A.warn(E)};return d.onMapLibreEvent("error",M),d}else return new lT(e,n)}u();u();u();u();var Jg=class Jg{constructor(t,r,n){f(this,"id");f(this,"text");f(this,"target");f(this,"__type",Jg.__type);this.id=t,this.text=r,this.target=n}static is(t){return t.__type===Jg.__type}get focusTarget(){return this.target.anchorTarget}};f(Jg,"__type","Label");var rc=Jg;u();var Kp,Jf=class Jf{constructor(t,r,n){f(this,"id");T(this,Kp);f(this,"__type",Jf.__type);f(this,"contentEl");this.id=t,this.contentEl=r,w(this,Kp,n)}get target(){return a(this,Kp)}get coordinate(){return a(this,Kp).anchorTarget}toJSON(){return{id:this.id,__type:Jf.__type,target:this.target,coordinate:this.coordinate}}static is(t){return t.__type===Jf.__type}get focusTarget(){return this.target.anchorTarget}updateTarget(t){w(this,Kp,t)}};Kp=new WeakMap,f(Jf,"__type","Marker");var $a=Jf;u();var Kg,Qg,qg=class qg{constructor(t,r,n){T(this,Kg);T(this,Qg);f(this,"target");f(this,"__type",qg.__type);w(this,Kg,t),w(this,Qg,r),this.target=n}static is(t){return t.__type===qg.__type}get id(){return a(this,Kg)}get url(){return a(this,Qg)}};Kg=new WeakMap,Qg=new WeakMap,f(qg,"__type","Image3D");var Qp=qg;u();var eu,qf=class qf{constructor(t,r,n){f(this,"id");f(this,"groupId");f(this,"__type",qf.__type);T(this,eu);this.id=t,this.groupId=r,w(this,eu,n)}get target(){return a(this,eu)}static is(t){return t.__type===qf.__type}updateTarget(t){w(this,eu,t)}toJSON(){return{id:this.id,__type:qf.__type,groupId:this.groupId,target:a(this,eu)}}};eu=new WeakMap,f(qf,"__type","Model");var tu=qf;u();var ey=class ey{constructor(t,r){f(this,"id");f(this,"coordinates");f(this,"__type",ey.__type);this.id=t,this.coordinates=r}static is(t){return t.__type===ey.__type}get focusTarget(){return this.coordinates}};f(ey,"__type","PathSegment");var Qf=ey,Kf=class Kf{constructor(t,r,n,o){f(this,"id");f(this,"animation");f(this,"coordinates");f(this,"segments");f(this,"__type",Kf.__type);this.id=t,this.animation=r,this.coordinates=n,this.segments=o.map(({id:i,coordinates:s})=>new Qf(i.toString(),s))}static is(t){return t.__type===Kf.__type}get focusTarget(){return this.coordinates}toJSON(){return{__type:Kf.__type,id:this.id,coordinates:this.coordinates,segments:this.segments}}};f(Kf,"__type","Path");var Ko=Kf;u();var ote=7,nc,ru,ty=class{constructor(t,r){T(this,nc);T(this,ru);w(this,nc,t),w(this,ru,r?.precision??ote)}toJSON(){return{center:this.center,bearing:this.bearing,pitch:this.pitch,zoomLevel:this.zoomLevel}}get center(){let t=a(this,nc).center;if(a(this,ru)===-1)return t;let r=Ji(t.latitude,a(this,ru)),n=Ji(t.longitude,a(this,ru));return new ge({latitude:r,longitude:n,floorId:t.floorId,verticalOffset:t.verticalOffset})}get bearing(){return a(this,nc).bearing}get pitch(){return a(this,nc).pitch}get zoomLevel(){return Ji(a(this,nc).zoomLevel,5)}};nc=new WeakMap,ru=new WeakMap;u();var ry=class ry{constructor(t){f(this,"id");f(this,"__type",ry.__type);this.id=t}static is(t){return t.__type===ry.__type}get focusTarget(){return this}};f(ry,"__type","Shape");var za=ry;u();var Pv=class Pv{constructor(t,r){f(this,"id");f(this,"target");f(this,"__type","Text3D");this.id=t,this.target=r}static is(t){return t.__type===Pv.__type}};f(Pv,"__type","Text3D");var oc=Pv;u();u();u();var ite=new Map([["search-16x16",`<svg viewBox="0 0 16 16">
|
|
700
700
|
<path
|
|
701
701
|
fillRule="evenodd"
|
|
702
702
|
clipRule="evenodd"
|
|
@@ -1134,7 +1134,7 @@ void main(void) {
|
|
|
1134
1134
|
d="M9.10678 11.2433C9.07993 11.2167 9.04367 11.2018 9.00589 11.2018C8.9681 11.2018 8.93184 11.2167 8.90499 11.2433L6.82999 13.3183C5.86928 14.279 4.24785 14.3808 3.18714 13.3183C2.12464 12.2558 2.22642 10.6362 3.18714 9.67546L5.26214 7.60046C5.31749 7.5451 5.31749 7.45403 5.26214 7.39868L4.55142 6.68796C4.52457 6.66138 4.48832 6.64646 4.45053 6.64646C4.41274 6.64646 4.37649 6.66138 4.34964 6.68796L2.27464 8.76296C0.763923 10.2737 0.763923 12.7183 2.27464 14.2272C3.78535 15.7362 6.22999 15.738 7.73892 14.2272L9.81392 12.1522C9.86928 12.0969 9.86928 12.0058 9.81392 11.9505L9.10678 11.2433ZM13.7246 2.77903C12.2139 1.26832 9.76928 1.26832 8.26035 2.77903L6.18357 4.85403C6.15698 4.88088 6.14207 4.91714 6.14207 4.95493C6.14207 4.99271 6.15698 5.02897 6.18357 5.05582L6.89249 5.76475C6.94785 5.8201 7.03892 5.8201 7.09428 5.76475L9.16928 3.68975C10.13 2.72903 11.7514 2.62725 12.8121 3.68975C13.8746 4.75225 13.7729 6.37189 12.8121 7.3326L10.7371 9.4076C10.7106 9.43445 10.6956 9.47071 10.6956 9.5085C10.6956 9.54628 10.7106 9.58254 10.7371 9.60939L11.4479 10.3201C11.5032 10.3755 11.5943 10.3755 11.6496 10.3201L13.7246 8.2451C15.2336 6.73439 15.2336 4.28975 13.7246 2.77903ZM9.75142 6.00939C9.72457 5.9828 9.68832 5.96789 9.65053 5.96789C9.61275 5.96789 9.57649 5.9828 9.54964 6.00939L5.50499 10.0522C5.47841 10.0791 5.46349 10.1154 5.46349 10.1531C5.46349 10.1909 5.47841 10.2272 5.50499 10.254L6.21214 10.9612C6.26749 11.0165 6.35857 11.0165 6.41392 10.9612L10.4568 6.91832C10.5121 6.86296 10.5121 6.77189 10.4568 6.71653L9.75142 6.00939Z"
|
|
1135
1135
|
stroke="none"
|
|
1136
1136
|
/>
|
|
1137
|
-
</svg>`]]),Tte=/<svg([^>]*)>/g;function CF(e,t,r){let n=Cte.get(e);return n?n.replace(Tte,`<svg$1 xmlns="http://www.w3.org/2000/svg" style="fill:${t}; width:${r}px; height:${r}px">`):""}var Uv={default:"#3D5676",connection:"#128387",washroom:"#3161B4",point:"#AD468F"};function DT(e){let t=CF(Mte(e),"white",12);return{appearance:{textColor:TF(e),pinColor:TF(e),icon:t,iconPadding:4,iconSize:12},interactive:!0,rank:wte(e)}}function Mte(e){return e.__type==="connection"?Pte(e.type):e.name.includes("Washroom")?"washroom-14x14":e.__type==="point-of-interest"?"point-of-interest-12x12":""}function Pte(e){let t="";switch(e){case"elevator":t="connection-elevator-12x12";break;case"escalator":t="connection-escalator-12x12";break;case"stairs":t="connection-stairs-12x12";break}return t}function TF(e){return e.__type==="connection"?Uv.connection:e.__type==="point-of-interest"?Uv.point:"name"in e&&e.name.includes("Washroom")?Uv.washroom:Uv.default}function wte(e){return e.__type==="connection"?"high":(e.__type==="point-of-interest","medium")}var Vv=.05,Zy,Yy,Xy=class extends Fe{constructor(r,n,o){super();f(this,"core");f(this,"mapObjects",[]);f(this,"id");f(this,"mapDataExternal",{});f(this,"mapsByFloorId",{});f(this,"mapData");f(this,"currentMap");f(this,"hiddenOutdoorGeometries",[]);f(this,"lastFacadeIntersected");T(this,Zy,!1);T(this,Yy,!1);f(this,"mapView");f(this,"externalPubSub");f(this,"Camera");f(this,"Labels");f(this,"Text3D");f(this,"Markers");f(this,"Models");f(this,"Paths");f(this,"Exporter");f(this,"Navigation");f(this,"Outdoor");f(this,"BlueDot");f(this,"Shapes");f(this,"Style");f(this,"Image3D");f(this,"update",()=>{this.core.render()});this.core=r,this.mapView=n,this.externalPubSub=o,this.Camera=new sy(this),this.id=this.core.addGroupContainer("root").id.toString();let i=new fy("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 GT(d instanceof Error?d.message:"Unknown error")})});let s=d=>{let m=this.getMapDataObject(d);switch(m?.__type){case"facade":return m;case"floor":return m.floorStack.facade;default:return null}};this.core.on("geometry-in-focus",d=>{let m=new Set;for(let g of d){let x=s(g);x&&m.add(x)}o.publish("facades-in-view-change",{facades:Array.from(m)})}),this.core.getSystems().renderSystem.on("camera-state-change",()=>{o.publish("state-change-internal",{Camera:this.getCameraState()})});let l=new ty(this.Camera,{precision:7});this.core.on("camera-change",()=>{o.publish("camera-change",l)});let c=d=>m=>{let g=[],x=[],v=[],C=[];m.labels.forEach(L=>{let N=this.Labels.getById(L.toString());N&&g.push(N.label)}),m.markers.forEach(L=>{let N=this.Markers.getById(L.toString())||this.Navigation.getMarkerById(L.toString());N&&x.push(N.marker)}),m.models.forEach(L=>{let N=this.Models.getById(L.toString());N&&v.push(N.model)}),m.paths.forEach(L=>{let N=this.Paths.getById(L.toString())||this.Navigation.getPathById(L.toString());N&&C.push(N.path)});let I=m.geometry.includes(Sy),S=m.geometry.filter(L=>L!==Sy),P;S.length>0&&(P=S.map(L=>this.getMapDataInternal()?.getById("space",L)).filter(Boolean)[0],P||(P=S.map(L=>this.getMapDataInternal()?.getById("object",L)).filter(Boolean)[0]),P||(P=S.map(L=>this.Shapes.getById(L)).filter(Boolean)[0]));let O=m.containers.reduce((L,N)=>{let X=this.getMapDataInternal()?.getById("floor",N);return X&&Wn.is(X)&&L.push(X),L},[]),M,E=0;if(O.length>0){M=O[0].id;let L=this.core.getState(M);E=m.coordinate[2]?m.coordinate[2]-L.altitude:E}let B;this.lastFacadeIntersected&&this.lastFacadeIntersected.spaces.forEach(L=>{this.core.setState(L.id,{hovered:!1})}),P&&_r.is(P)&&(B=S.map(L=>this.getMapDataInternal()?.facadesBySpaceId[L]).filter(Boolean)[0],B&&B.spaces.forEach(L=>{this.core.setState(L.id,{hovered:!0})})),this.lastFacadeIntersected=B;let j={coordinate:new ge({latitude:m.coordinate[1],longitude:m.coordinate[0],floorId:M,verticalOffset:E}),spaces:P&&_r.is(P)?[P]:[],objects:P&&$n.is(P)?[P]:[],shapes:P&&za.is(P)?[P]:[],markers:x,labels:g,models:v,paths:C,floors:O,facades:B?[B]:[]};"pointerEvent"in m&&(j.pointerEvent=m.pointerEvent),I&&(d==="click"?this.BlueDot.publish("click",{coordinate:new ge({longitude:m.coordinate[0],latitude:m.coordinate[1]})}):d==="hover"&&this.BlueDot.publish("hover")),o.publish(d,j)};this.core.on("hover",c("hover")),this.core.on("click",c("click")),this.core.on("user-interaction-start",()=>{o.publish("user-interaction-start")}),this.core.on("user-interaction-end",()=>{o.publish("user-interaction-end")});let p={currentMapGetter:()=>this.currentMap};this.Markers=new my(p),this.Models=new by(p),this.Labels=new cy(p),this.Text3D=new Ly(p),this.Exporter=new ly(p),this.Paths=new vy(p),this.Navigation=new oy(this.core,this,p.currentMapGetter),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.BlueDot=new lm(this.core,this),this.BlueDot.on("blue-dot-position-update",()=>{this._publishBlueDotState({coordinate:this.BlueDot.coordinate,heading:this.BlueDot.heading,accuracy:this.BlueDot.accuracy,floor:this.BlueDot.floor})}),this.BlueDot.on("blue-dot-state-change",()=>{this._publishBlueDotState({state:this.BlueDot.state})}),this.BlueDot.on("blue-dot-follow-change",()=>{this._publishBlueDotState({following:this.BlueDot.following})}),this.Outdoor=new cm(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 gy(p),this.Shapes=new _y(p),this.Style=new Dy(p)}get manualFloorVisibility(){return a(this,Zy)}set manualFloorVisibility(r){w(this,Zy,r),this.externalPubSub.publish("state-change-internal",{manualFloorVisibility:r})}get hidePathsNotOnCurrentFloor(){return a(this,Yy)}set hidePathsNotOnCurrentFloor(r){w(this,Yy,r),this.currentMap?.updatePathLayersVisibility()}preloadFloors(r){r.forEach(n=>{n instanceof Wn&&this.core.setState(n.id,{preloadGeometry:!0})})}updateState(r,n){if(n==null||typeof n!="object")return;if(r==="interior-walls"){this.currentMap.floors.forEach(i=>{let s=i.layers.get(yr);if(s){let l=s.layers.get(Ol);l&&this.core.hasState(l)&&this.core.setState(l,wT(rr(um,n,{warn:!0}),this.core.getState(l)))}});return}if(r==="exterior-walls"){this.currentMap.floors.forEach(i=>{let s=i.layers.get(yr);if(s){let l=s.layers.get(bs);l&&this.core.hasState(l)&&this.core.setState(l,wT(rr(um,n,{warn:!0}),this.core.getState(l)))}});return}if(r==="interior-doors"){this.currentMap.floors.forEach(i=>{let s=i.layers.get(yr);if(s){let l=s.layers.get(kd);l&&this.core.hasState(l)&&this.core.setState(l,Gv(rr(pu,n,{warn:!0}),this.core.getState(l)))}});return}if(r==="exterior-doors"){this.currentMap.floors.forEach(i=>{let s=i.layers.get(yr);if(s){let l=s.layers.get(Ad);l&&this.core.hasState(l)&&this.core.setState(l,Gv(rr(pu,n,{warn:!0}),this.core.getState(l)))}});return}let o=typeof r=="string"?this.getMapDataObject(r):r;if(o){if(o.__type!==Ko.__type&&!this.core.hasState(o.id)){A.warn(`Failed to update state for "${o.id}". No ${o.__type} found with that ID.`);return}if(rc.is(o))return this.core.setState(o.id,oF(rr(TT,n,{warn:!0}),this.core.getState(o.id)));if($a.is(o))return this.core.setState(o.id,aF(rr(PT,n,{warn:!0}),this.core.getState(o.id)));if(_r.is(o)||$n.is(o)){let i=this.core.getState(o.id);if(i!=null){let s=i.parent&&i.parent.type==="geometry-group"?this.core.getState(i.parent):void 0;this.core.setState(o.id,rF(rr($y,n,{warn:!0}),i,s))}}if(Qp.is(o)&&this.core.setState(o.id,rr(_T,n,{warn:!0})),Ci.is(o)&&this.core.setState(o.id,Gv(rr(pu,n,{warn:!0}),this.core.getState(o.id))),za.is(o)&&this.core.setState(o.id,rr(zy,n,{warn:!0})),tu.is(o)){let{position:i,scale:s,rotation:l,...c}=rr(IF,n,{warn:!0}),p=c;i&&(p.position=[i.longitude,i.latitude,i.verticalOffset]),s!=null&&(Array.isArray(s)?p.scale=s:p.scale=[s,s,s]),l!=null&&(Array.isArray(l)?p.rotation=l:p.rotation=[l,l,l]),i&&o.updateTarget(i),this.core.setState(o.id,p)}if(Wn.is(o)){let i=this.currentMap.floorsById.get(o.id);if(i==null)return;let s=rr(Wy,n,{warn:!0});this.core.setState(o.id,s);let l=i.layers.get(yr);l!=null&&"geometry"in n&&n.geometry&&this.core.setState(l.containerId,rr(Ny,n.geometry,{warn:!0}));let c=i.layers.get(xs);if(c!=null&&"labels"in n&&n.labels){let v=rr(Gy,n.labels,{warn:!0});"enabled"in v&&typeof v.enabled=="boolean"&&c.setVisible(v.enabled)}let p=i.layers.get(Ti);if(p!=null&&"markers"in n&&n.markers){let v=rr(jy,n.markers,{warn:!0});"enabled"in v&&typeof v.enabled=="boolean"&&p.setVisible(v.enabled)}let d=i.layers.get(Ld);d!=null&&"footprint"in n&&n.footprint&&this.core.setState(d.containerId,rr(By,n.footprint,{warn:!0}));let m=i.layers.get(_l);if(m!=null&&"occlusion"in n&&n.occlusion){let v=rr(Vy,n.occlusion,{warn:!0});"enabled"in v&&typeof v.enabled=="boolean"&&m.setVisible(v.enabled)}let g=i.layers.get(Rd);if(g!=null&&"images"in n&&n.images){let v=rr(Uy,n.images,{warn:!0});"visible"in v&&typeof v.visible=="boolean"&&g.setVisible(v.visible)}let x=i.layers.get(vs);if(x!=null&&"paths"in n&&n.paths!=null){let v=rr(Hy,n.paths,{warn:!0});v.visible!=null&&typeof v.visible=="boolean"&&x.setVisible(v.visible)}}if(Go.is(o)){let i=this.core.getState(o.id);for(let s of i.children)s.type==="group-container"&&this.core.setState(s.id,rr(Ry,n,{warn:!0}))}if(oc.is(o)&&this.core.setState(o.id,rr(hF,n,{warn:!0})),Ko.is(o))for(let i of o.segments)this.core.setState(i.id,rr(pm,n,{warn:!0}));Qf.is(o)&&this.core.setState(o.id,rr(pm,n,{warn:!0}))}}getMapDataObject(r){return this.getMapDataInternal()?.getMapDataById(r)}getMapDataInternal(){if(this.mapData)return Dm(this.mapData)}getMapData(){return this.mapData}addMap(r,n){return new Promise(o=>{let i;try{i=Dm(r)}catch(g){A.error("Error adding map",g),o(r);return}this.mapDataExternal[r.mapName]=r,this.mapData=r;let{mvf:s}=i,l=s["manifest.geojson"].features[0].geometry.coordinates;this.core.mode!=="outdoors-overlay"&&this.Camera.set({center:new ge(l[1],l[0])});let c=s["manifest.geojson"].features[0].properties.name,p=new fy(`mapObject-${c}`,i,n,this);this.currentMap=p,this.currentMap.loadAllFloors(),this.currentMap.setFloor(this.currentMap.startingFloorId);let d=this.core.getBoundingArea(p.currentFloor.id);d==null&&A.error("Could not determine bounding box for map:",p.currentFloor.id);let m=n?.outdoorView?.layersHiddenByGeometry??[];if(m.length>0){let g,x=[];for(let v of p.floorStacksById.values())if(v.defaultFloor.footprint&&v.defaultFloor.footprint.geometry!=null&&v.defaultFloor.footprint.geometry?.coordinates.length>0){let C=v.defaultFloor.footprint,I=v0(C);g==null?g=I:$6(g,I),x.push(C)}x.length>0&&g!=null&&(this.core.hideOutdoorLayersIntersectingPolygons(g,x,m),this.hiddenOutdoorGeometries.push([g,x,m]))}if(this.mapObjects.push(p),i.getMVFFeatureByType("floor").forEach(g=>{this.mapsByFloorId[g.id]=p}),p.on("floor-change-start",g=>{this.externalPubSub.publish("floor-change-start",{reason:g.reason,floor:this.getMapDataInternal()?.getById("floor",g.floorId)??this.currentFloor,previousFloor:this.getMapDataInternal()?.getById("floor",g.previousFloorId)??this.currentFloor})}),p.on("floor-change",g=>{this.externalPubSub.publish("floor-change",{reason:g.reason,floor:this.currentFloor,previousFloor:this.getMapDataInternal()?.getById("floor",g.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(r);else if(this.core.mode!=="outdoors-overlay"&&d){let g=n?.screenOffsets??{top:Vv*this.core.canvasHeight,left:Vv*this.core.canvasWidth,right:Vv*this.core.canvasWidth,bottom:Vv*this.core.canvasHeight};this.core.camera.focusOn(d,{duration:k6,padding:g}).then(()=>{this.Camera.setElevation(this.currentFloor.elevation),o(r)})}else o(r)})}setFloor(r,n){return this.currentMap.setFloor(Ih(r),n)}setFloorStack(r,n){return this.currentMap.setFloorStack(Ih(r),n)}updateWatermark(r){this.core.updateWatermark(r)}get currentFloorStack(){let r=this.currentMap.currentFloorStack.id;if(!r)throw new Br("Missing currentFloorStack.");let n=this.mapData?.getById("floor-stack",r);if(!n)throw new Br("FloorStack was not found in map data.");return n}get currentFloor(){let r=this.currentMap.currentFloor.id;if(!r)throw new Br("Missing currentFloor object from GeoJsonApi");let n=this.mapData?.getById("floor",r);if(!n)throw new Br("Missing currentFloor");return n}getState(r){typeof r=="object"&&Ko.is(r)&&A.warn("Cannot get state of a Path directly. Use getState() on individual segments within Path.segments[] instead.");let n=W6(r,this),o=this.core.getState(n);if(o){if(["interior-walls","exterior-walls"].includes(r)&&o.type==="geometry-group")return bF(o);if(["interior-doors","exterior-doors"].includes(r)&&o.type==="geometry-group")return HD(o);if(o.type==="geometry"){let i;return"parent"in o&&o.parent&&o.parent.type==="geometry-group"&&(i=this.core.getState(o.parent)),tF(o,i)}else{if(o.type==="label"&&o.options.appearance&&o.options.rank!==void 0&&o.options.interactive!==void 0)return nF(o);if(o.type==="marker"&&o.options?.rank!==void 0&&o.options.interactive!==void 0)return sF(o,this.Markers.getById(o.id.toString())?.marker);if(o.type==="model")return SF(o);if(o.type==="image")return xF(o);if(o.type==="text3d")return gF(o);if(o.type==="geometry-group"&&r&&typeof r!="string"&&za.is(r))return uF(o);if(o.type==="path")return cF(o);if(o.type==="group-container"&&typeof r!="string"&&Wn.is(r))return QD(o,this.currentMap.floorsById.get(r.id),this.core);if(o.type==="group-container"&&o.children.length>0&&typeof r!="string"&&Go.is(r)){let i=this.core.getState(o.children[0].id);return $D(i)}}}}setHoverColor(r){this.core.setState({hoverColor:r})}getHoverColor(){let r=this.core.getState();return r?.type==="map-view"?r.hoverColor:void 0}createCoordinateFromScreenCoordinate(r,n,o){if(o!=null){let p=this.core.projectScreenXYToCoordinate(r,n,!0);return p?new ge(p.coordinate[1],p.coordinate[0],o.id):void 0}let i=this.core.projectScreenXYToCoordinate(r,n);if(i==null||i.coordinate==null)return;let{coordinate:s,groupContainers:l}=i,c=l?.find(p=>{let d=p.userData.entityId.toString();return d.includes("f_")||d.includes("m_")})?.userData.entityId.toString();return new ge(s[1],s[0],c)}getScreenCoordinateFromCoordinate(r){let n=0;if(r.floorId!=null){let o=this.mapData?.getById("floor",r.floorId);o!=null&&(n=this.getState(o)?.altitude??0)}return this.core.projectCoordinateToScreenXY([r.longitude,r.latitude,n])}isInView(r){return this.core.isInView(typeof r=="string"?r:r.id)}__EXPERIMENTAL__auto(){let r=[],n=this.mapDataExternal[Object.keys(this.mapDataExternal)[0]];return[...n.getByType("connection"),...n.getByType("point-of-interest"),...n.getByType("space")].forEach(o=>{if(o.__type==="connection")o.coordinates.forEach(i=>{let s=o.name||o.externalId;if(s){let l=this.Labels.add(i,s,DT(o));r.push(l)}});else{o.__type==="space"&&o.name!==""&&this.updateState(o,{interactive:!0,hoverColor:"#F0F0F0"});let i=o.name;if(i){let s=this.Labels.add(o,i,DT(o));r.push(s)}}}),{labels:r}}tween(r){let n=new Fi(r);return this.core.getExternalTweenGroup().add(n),this.core.render(),n}removeTween(r){this.core.getExternalTweenGroup().remove(r)}tweenGroup(){return this.core.getExternalTweenGroup()}get __core(){return this.core}getCameraState(){return this.core.camera.getState()}getNavigationState(){return{isMultiFloor:this.Navigation.isMultiFloor,floorStacks:this.Navigation.floorStacks,floors:this.Navigation.floors,activeDirections:this.Navigation.activeDirections,activePath:this.Navigation.activePath,paths:this.Navigation.paths}}getAllState(){return{currentFloor:this.currentFloor,currentFloorStack:this.currentFloorStack,Camera:this.getCameraState(),Navigation:this.getNavigationState(),manualFloorVisibility:this.manualFloorVisibility}}publishAllState(){this.externalPubSub.publish("state-change-internal",this.getAllState())}clear(){this.Navigation.clear(),this.BlueDot.disable(),this.Shapes.removeAll(),this.Paths.removeAll(),this.Models.removeAll(),this.Markers.removeAll(),this.Image3D.removeAll(),this.Labels.removeAll()}destroy(){this.clear(),this.core.destroy()}_publishBlueDotState(r){let n;if(r)n=r;else{let{state:o,following:i,heading:s,accuracy:l,coordinate:c,floor:p}=this.BlueDot;n={state:o,following:i,heading:s,accuracy:l,coordinate:c,floor:p}}this.externalPubSub.publish("state-change-internal",{BlueDot:n})}getOptimalVisualDistanceBetweenFloors(r,n=!1){let o=this.currentMap;if(!o){A.error("Cannot compute optimal visual distance between floors. Missing current map.");return}if(r.length<2){A.warn("Cannot compute optimal visual distance between floors. Must provide at least 2 floors.");return}let i=o.renderer.getInternalState().geometry3DMap.get(r[0].id),s=o.renderer.getInternalState().geometry3DMap.get(r[1].id);if(!i||!s){A.warn("Cannot compute optimal visual distance between floors. Floors not found in current map.");return}if(mu(i,"group-container"),mu(s,"group-container"),n){let c=new vr;c.setFromObject(i);let p=new vr;if(p.setFromObject(s),i.children.forEach(I=>{I instanceof Re&&I.userData.debugBox&&Qt(I)}),s.children.forEach(I=>{I instanceof Re&&I.userData.debugBox&&Qt(I)}),!gc(c)||!gc(p))return;let d=new ii(c.max.x-c.min.x,c.max.y-c.min.y,c.max.z-c.min.z),m=new Tr({color:255,transparent:!0,opacity:.5}),g=new Re(d,m);g.position.set((c.min.x+c.max.x)/2,(c.min.y+c.max.y)/2,(c.min.z+c.max.z)/2),g.userData.debugBox=!0;let x=new ii(p.max.x-p.min.x,p.max.y-p.min.y,p.max.z-p.min.z),v=new Tr({color:"cyan",transparent:!0,opacity:.5}),C=new Re(x,v);C.position.set((p.min.x+p.max.x)/2,(p.min.y+p.max.y)/2,(p.min.z+p.max.z)/2),C.userData.debugBox=!0,i.add(g),s.add(C)}let l=o.renderer.computeMinZOffsetBetweenContainers(i,s);if(l!==-1)return l}};Zy=new WeakMap,Yy=new WeakMap;function Ote(e){if(e===""){pT(""),cT("");return}cT(`${e}/${o2}`),pT(`${e}/${n2}`)}u();var Hv=class{constructor(t){f(this,"state");f(this,"update");this.update=t.Debug.update.bind(t.Debug),this.state=t.Debug.state}};u();var MF=q.object({environment:q.union([q.literal("basic"),q.literal(!1)]).optional(),text3d:q.object({hoverColor:q.string().optional()}).optional(),geometry:q.object({hoverColor:q.string().optional()}).optional(),backgroundColor:q.string().optional(),backgroundAlpha:q.number().optional()}).strict();u();var FT=il(K3(),1);var _te=(e,t)=>{let r={},n=(o,i,s)=>{for(let l in i){let c=o[l],p=i[l];typeof p=="object"&&!Array.isArray(p)&&p!==null&&typeof c=="object"&&!Array.isArray(c)&&c!==null?(s[l]={},n(c,p,s[l])):s[l]=c}};return n(e,t,r),r},PF=(e,t)=>{let r=_te(e,t),n=(0,FT.default)({},r,t),o=(0,FT.default)({},r),i=(s,l,c,p=o)=>{for(let d in l){let m=s[d],g=l[d];if(typeof g=="number"&&typeof m=="number")p[d]=m+(g-m)*c;else if(typeof g=="string"&&typeof m=="string"){if(xm(m)&&xm(g)){let x=Kv(m),v=Kv(g);x&&v?p[d]=c5([x[0]+(v[0]-x[0])*c,x[1]+(v[1]-x[1])*c,x[2]+(v[2]-x[2])*c]):A.warn(`Color "${d}" could not be animated!`)}}else typeof g=="object"&&g!==null&&typeof m=="object"&&m!==null?i(m,g,c,p[d]):A.warn(`Value "${d}" could not be animated!`)}};return s=>(s=Math.min(Math.max(s,0),1),s===0?e:s===1?n:(i(r,t,s),o))};var uu,se,Ws,Jy=class{constructor(t){T(this,uu);T(this,se);T(this,Ws);f(this,"Camera");f(this,"Labels");f(this,"Text3D");f(this,"Markers");f(this,"Image3D");f(this,"Models");f(this,"Paths");f(this,"Exporter");f(this,"Navigation");f(this,"__BlueDot");f(this,"Style");f(this,"Shapes");f(this,"Outdoor");f(this,"update",()=>{a(this,se).core.render()});f(this,"__LEGACY_GET_DIRECTIONS_SYNC",(t,r,n)=>a(this,se).getMapData()?.__LEGACY_GET_DIRECTIONS_SYNC(t,r,n)??void 0);f(this,"getDirections",(t,r,n)=>a(this,se).getMapData()?.getDirections(t,r,n)??Promise.resolve(void 0));f(this,"__LEGACY_GET_DIRECTIONS_MULTI_DESTINATION_SYNC",(t,r,n)=>a(this,se).getMapData()?.__LEGACY_GET_DIRECTIONS_MULTI_DESTINATION_SYNC(t,r,n)??void 0);f(this,"getDirectionsMultiDestination",(t,r,n)=>a(this,se).getMapData()?.getDirectionsMultiDestination(t,r,n)??Promise.resolve(void 0));f(this,"on",(t,r)=>{a(this,uu).on(t,r)});f(this,"off",(t,r)=>{a(this,uu).off(t,r)});f(this,"Debug");w(this,uu,new Fe),w(this,Ws,t);let r=new Xy(t,this,a(this,uu));w(this,se,r),this.Camera=a(this,se).Camera,this.Markers=a(this,se).Markers,this.Models=a(this,se).Models,this.Labels=a(this,se).Labels,this.Text3D=a(this,se).Text3D,this.Exporter=a(this,se).Exporter,this.Paths=a(this,se).Paths,this.Navigation=a(this,se).Navigation,this.__BlueDot=a(this,se).BlueDot,this.Shapes=a(this,se).Shapes,this.Style=a(this,se).Style,this.Outdoor=a(this,se).Outdoor,this.Image3D=a(this,se).Image3D,a(this,Ws).container.dataset.version=y.env.npm_package_version,this.Debug=new Hv(a(this,se).core)}updateState(t,r){return a(this,se).updateState(t,r)}animateState(t,r,n){let o=a(this,se).getState(t);if(o==null)return A.warn(`Cannot animate state of ${t}.`),new Promise(p=>p({result:"completed"}));let i=PF(o,r),s=a(this,se).tween({percent:0}).to({percent:1},n?.duration??1e3).onUpdate(({percent:c})=>{a(this,se).updateState(t,i(c))});n?.easing&&n.easing in Fs&&s.easing(Fs[n.easing]);let l=new Promise(c=>{s.onComplete(()=>{a(this,se).removeTween(s),c({result:"completed"})}).onStop(()=>{a(this,se).removeTween(s),c({result:"cancelled"})}),s.start()});return l.cancel=()=>{s.stop(),a(this,se).updateState(t,i(0))},l}updateGlobalState(t){try{MF.parse(t)}catch(r){A.error("updateGlobalState",r);return}if(typeof t=="object"){let r={};if(t.text3d?.hoverColor&&(r.text3dHoverColor=t.text3d.hoverColor),t.geometry?.hoverColor&&(r.hoverColor=t.geometry.hoverColor),t.backgroundColor||t.backgroundAlpha!==void 0){let n=t.backgroundColor??a(this,se).core.backgroundColor,o=t.backgroundAlpha??a(this,se).core.backgroundAlpha;a(this,se).core.setBackgroundColor(n,o)}t.environment!=null&&a(this,se).core.setEnvironment(t.environment),a(this,se).core.setState(r)}}get options(){return R6(a(this,se).currentMap.options)}getGlobalState(){let t=a(this,se).core.getState();return{backgroundColor:a(this,se).core.backgroundColor,backgroundAlpha:a(this,se).core.backgroundAlpha,environment:a(this,se).core.getEnvironment(),geometry:{hoverColor:t.hoverColor},text3d:{hoverColor:t.text3dHoverColor}}}getMapData(){if(a(this,se).mapData==null)throw new Br("MapData not found.");return a(this,se).mapData}getDimensions(){return{width:a(this,Ws).canvasWidth,height:a(this,Ws).canvasHeight}}addMap(t,r){return a(this,se).addMap(t,r)}setFloor(t,r){return a(this,se).setFloor(t,r?.context)}setFloorStack(t,r){return a(this,se).setFloorStack(t,r?.context)}preloadFloors(t){a(this,se).preloadFloors(t)}tween(t){return a(this,se).tween(t)}removeTween(t){a(this,se).removeTween(t)}get tweenGroup(){return a(this,se).tweenGroup()}get currentFloorStack(){return a(this,se).currentFloorStack}get currentFloor(){return a(this,se).currentFloor}updateWatermark(t){a(this,se).updateWatermark(t)}getState(t){return a(this,se).getState(t)}setHoverColor(t){a(this,se).setHoverColor(t)}getHoverColor(){return a(this,se).getHoverColor()}convertAltitudeToMercatorZoomLevel(t){return a(this,se).core.getSystems().cameraSystem.convertAltitudeToZoomLevel(t)}convertMercatorZoomLevelToAltitude(t){return a(this,se).core.getSystems().cameraSystem.convertZoomLevelToAltitude(t)}isInView(t){return a(this,se).isInView(t)}getDistance(t,r){return a(this,se).getMapData()?.getDistance(t,r)}createCoordinate(t,r,n){return typeof t=="object"?new ge(t):new ge(t,r,n?.id)}createCoordinateFromScreenCoordinate(t,r,n){return a(this,se).createCoordinateFromScreenCoordinate(t,r,n)}getScreenCoordinateFromCoordinate(t){return a(this,se).getScreenCoordinateFromCoordinate(t)}__EXPERIMENTAL__auto(){a(this,se).__EXPERIMENTAL__auto()}get __core(){if(y.env.INTERNAL==="true")return a(this,se).core;throw new Error("__core is not available.")}get container(){return a(this,Ws).container}publishAllState(){a(this,se).publishAllState()}clear(){a(this,se).clear()}destroy(){a(this,se).destroy()}async enableDebug(t={}){let{Inspector:r}=await import("./inspector-2WXCEJZC.js");await new r(this,a(this,se)).enable(t)}async takeScreenshot(){return await a(this,Ws).renderSync(),a(this,Ws).rendererDomElement.toDataURL("image/png")}get manualFloorVisibility(){return a(this,se).manualFloorVisibility}set manualFloorVisibility(t){a(this,se).manualFloorVisibility=t}getOptimalVisualDistanceBetweenFloors(t){return a(this,se).getOptimalVisualDistanceBetweenFloors(t)}get __INTERNAL__hidePathsNotOnCurrentFloor(){return a(this,se).hidePathsNotOnCurrentFloor}set __INTERNAL__hidePathsNotOnCurrentFloor(t){a(this,se).hidePathsNotOnCurrentFloor=!!t}};uu=new WeakMap,se=new WeakMap,Ws=new WeakMap;u();var Ete=1e3*60*60*2,uc,fm,Vt,$s,Hi,ti,Wi,mm,hm,qy,Jt,wF,OF,dm,Wv,kT,AT,LT,gm=class{constructor(t,r){T(this,Jt);T(this,uc,new Fe);T(this,fm);T(this,Vt);T(this,$s);T(this,Hi);T(this,ti);T(this,Wi);T(this,mm);T(this,hm);T(this,qy,()=>{"key"in a(this,Vt)&&"secret"in a(this,Vt)&&z(this,Jt,dm).call(this),z(this,Jt,Wv).call(this)});f(this,"on",(t,r)=>a(this,uc).on(t,r));f(this,"off",(t,r)=>a(this,uc).off(t,r));w(this,fm,t),w(this,Vt,r)}setMapIds(t){w(this,fm,t)}setEnterprise(t){a(this,Vt).enterprise=t}async readySync(){if((!("key"in a(this,Vt))||!("secret"in a(this,Vt)))&&!("accessToken"in a(this,Vt))){A.error("No API keys or access token provided! Cannot preload tokens.");return}let t=[z(this,Jt,dm).call(this),null];a(this,Vt).enterprise||(t[1]=this.getSasTokensAsync());let[r,n]=await Promise.all(t);z(this,Jt,LT).call(this),z(this,Jt,kT).call(this,r),n!=null&&z(this,Jt,AT).call(this,n),bm()&&globalThis.addEventListener?.("focus",a(this,qy))}async refreshing(){let t=[];return a(this,$s)!=null&&t.push(a(this,$s)),a(this,Hi)!=null&&t.push(a(this,Hi)),Promise.all(t)}getAccessTokenAsync(){return z(this,Jt,dm).call(this)}getSasTokensAsync(){return z(this,Jt,Wv).call(this)}getAccessToken(){return a(this,ti)==null?(A.error("Tokens must be loaded before reading synchronously! Try awaiting readySync() first."),{token:""}):a(this,ti)}getSasToken(t){return this.isEnterpriseMode()?(A.error("SAS tokens are not available in the enterprise mode!"),{token:""}):a(this,Wi)==null?(A.error("Tokens must be loaded before reading synchronously! Try awaiting readySync() first."),{token:""}):t in a(this,Wi).tokens?a(this,Wi).tokens[t]:(A.error(`SAS token for map ${t} not found!`),{token:""})}isEnterpriseMode(){return a(this,Vt).enterprise??!1}destroy(){z(this,Jt,LT).call(this),a(this,uc).destroy(),bm()&&globalThis.removeEventListener("focus",a(this,qy))}};uc=new WeakMap,fm=new WeakMap,Vt=new WeakMap,$s=new WeakMap,Hi=new WeakMap,ti=new WeakMap,Wi=new WeakMap,mm=new WeakMap,hm=new WeakMap,qy=new WeakMap,Jt=new WeakSet,wF=function(t){let r=t.token!==a(this,ti)?.token;w(this,ti,t),r&&a(this,uc).publish("access-token-refreshed",{accessToken:t})},OF=function(t){let r=JSON.stringify(t.tokens)!==JSON.stringify(a(this,Wi)?.tokens);w(this,Wi,t),r&&a(this,uc).publish("sas-tokens-refreshed",{sasTokens:t.tokens})},dm=async function(t=!1){if("accessToken"in a(this,Vt)&&typeof a(this,Vt).accessToken=="string"){let r={token:a(this,Vt).accessToken,expires:Date.now()+72e5};return w(this,ti,r),r}if(!("key"in a(this,Vt))||!("secret"in a(this,Vt))||typeof a(this,Vt).key!="string"||typeof a(this,Vt).secret!="string")throw new Error("No API keys or access token provided!");return a(this,$s)!=null?a(this,$s):a(this,ti)!=null&&a(this,ti).expires!=null&&a(this,ti).expires>Date.now()&&!t?a(this,ti):(w(this,$s,yh({...a(this,Vt),key:a(this,Vt).key,secret:a(this,Vt).secret},a(this,Vt).enterprise??!1).then(r=>{let n={token:r.accessToken,expires:r.expiresTimestamp*1e3};return z(this,Jt,wF).call(this,n),n}).catch(r=>{throw r}).finally(()=>{w(this,$s,void 0)})),a(this,$s))},Wv=async function(t=!1){return this.isEnterpriseMode()?{tokens:{},expires:1/0}:a(this,Hi)!=null?a(this,Hi):a(this,Wi)!=null&&a(this,Wi).expires>Date.now()&&!t?a(this,Wi):(w(this,Hi,new Promise((r,n)=>{z(this,Jt,dm).call(this).then(o=>{let i={},s=a(this,fm).map(l=>wS({...a(this,Vt),mapId:l},o.token).then(c=>{i[l]={token:c.token,expires:c.expires}}).catch(c=>{A.error(`Error getting SAS token for map ${l}:`,c)}));Promise.all(s).then(()=>{let l={tokens:i,expires:Math.min(...Object.values(i).map(c=>c.expires??1/0))};z(this,Jt,OF).call(this,l),r(l)})}).catch(o=>{n(o)})})),a(this,Hi).catch(r=>{throw r}).finally(()=>{w(this,Hi,void 0)}),a(this,Hi))},kT=function(t){if(!("key"in a(this,Vt))||!("secret"in a(this,Vt)))return;let r=t.expires!=null?t.expires-Date.now():Ete;isFinite(r)&&w(this,mm,setTimeout(()=>{z(this,Jt,dm).call(this,!0).then(n=>{z(this,Jt,kT).call(this,n)})},r-t6))},AT=function(t){let r=t.expires-Date.now();isFinite(r)&&w(this,hm,setTimeout(()=>{z(this,Jt,Wv).call(this,!0).then(n=>{z(this,Jt,AT).call(this,n)})},r-o6))},LT=function(){a(this,mm)!=null&&clearTimeout(a(this,mm)),a(this,hm)!=null&&clearTimeout(a(this,hm))};u();var Dte=async(e,t)=>{let r=("mvfVersion"in(t??{})?t?.mvfVersion:void 0)??("options"in e&&"version"in(e.options??{})?e.options?.version:void 0),n={prefetchTokens:!0,...t||{},mvfVersion:r},o,i=Cl();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 s0(e.main,n.mvfVersion),s.languagePacks=[];for(let v of e.languagePacks??[])v.localePack instanceof Uint8Array&&s.languagePacks.push({language:v.language,localePack:await hd(v.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 l=i0(o),c=l.length>0?l:[n.mapId];n.baseAuthUri=i.getBaseAuthUri();let p=new gm(c,{...n,enterprise:s.enterprise}),d;if("accessToken"in n&&n.accessToken)d=n.accessToken;else if("key"in n&&"secret"in n){let v;try{v=await p.getAccessTokenAsync()}catch(C){A.error("Failed getting token during hydrateMapData",C)}d=v?.token||""}if(s.outdoorViewToken=d,s.env=i,s.getMapDataOptions=n,n.prefetchTokens)try{await p.readySync()}catch(v){A.error("Failed to ready token manager!",v)}Vh()&&(s.enterprise&&A.warn("forceEnterpriseLocations is enabled, but the map is already an enterprise map!"),n.mvfVersion!=="3.0.0"&&A.warn("mvfVersion must be '3.0.0' when forceEnterpriseLocations is enabled!"));let m=new Tp(o,s);d&&m.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 g=new Em(m),x=m.findPreferredLanguage({languageCode:n.language,fallbackToNavigatorLanguage:!1});if(x)try{await g.changeLanguage(x.code)}catch{}return typeof t?.onMVFParsed=="function"&&t.onMVFParsed(o),g};u();var _F=(e,{id:t}={})=>{let r=Array.isArray(e)?e:[e];if(!r.every(i=>typeof i=="string"))return;let n=r.join(""),o=null;if(t){let i=document.getElementById(t);i instanceof HTMLStyleElement&&(o=i)}o==null&&(o=document.createElement("style")),t&&t!==""&&(o.id=t),o.textContent=n,document.head.appendChild(o)};var EF=`:root {
|
|
1137
|
+
</svg>`]]),Tte=/<svg([^>]*)>/g;function CF(e,t,r){let n=Cte.get(e);return n?n.replace(Tte,`<svg$1 xmlns="http://www.w3.org/2000/svg" style="fill:${t}; width:${r}px; height:${r}px">`):""}var Uv={default:"#3D5676",connection:"#128387",washroom:"#3161B4",point:"#AD468F"};function DT(e){let t=CF(Mte(e),"white",12);return{appearance:{textColor:TF(e),pinColor:TF(e),icon:t,iconPadding:4,iconSize:12},interactive:!0,rank:wte(e)}}function Mte(e){return e.__type==="connection"?Pte(e.type):e.name.includes("Washroom")?"washroom-14x14":e.__type==="point-of-interest"?"point-of-interest-12x12":""}function Pte(e){let t="";switch(e){case"elevator":t="connection-elevator-12x12";break;case"escalator":t="connection-escalator-12x12";break;case"stairs":t="connection-stairs-12x12";break}return t}function TF(e){return e.__type==="connection"?Uv.connection:e.__type==="point-of-interest"?Uv.point:"name"in e&&e.name.includes("Washroom")?Uv.washroom:Uv.default}function wte(e){return e.__type==="connection"?"high":(e.__type==="point-of-interest","medium")}var Vv=.05,Zy,Yy,Xy=class extends Fe{constructor(r,n,o){super();f(this,"core");f(this,"mapObjects",[]);f(this,"id");f(this,"mapDataExternal",{});f(this,"mapsByFloorId",{});f(this,"mapData");f(this,"currentMap");f(this,"hiddenOutdoorGeometries",[]);f(this,"lastFacadeIntersected");T(this,Zy,!1);T(this,Yy,!1);f(this,"mapView");f(this,"externalPubSub");f(this,"Camera");f(this,"Labels");f(this,"Text3D");f(this,"Markers");f(this,"Models");f(this,"Paths");f(this,"Exporter");f(this,"Navigation");f(this,"Outdoor");f(this,"BlueDot");f(this,"Shapes");f(this,"Style");f(this,"Image3D");f(this,"update",()=>{this.core.render()});this.core=r,this.mapView=n,this.externalPubSub=o,this.Camera=new sy(this),this.id=this.core.addGroupContainer("root").id.toString();let i=new fy("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 GT(d instanceof Error?d.message:"Unknown error")})});let s=d=>{let m=this.getMapDataObject(d);switch(m?.__type){case"facade":return m;case"floor":return m.floorStack.facade;default:return null}};this.core.on("geometry-in-focus",d=>{let m=new Set;for(let g of d){let x=s(g);x&&m.add(x)}o.publish("facades-in-view-change",{facades:Array.from(m)})}),this.core.getSystems().renderSystem.on("camera-state-change",()=>{o.publish("state-change-internal",{Camera:this.getCameraState()})});let l=new ty(this.Camera,{precision:7});this.core.on("camera-change",()=>{o.publish("camera-change",l)});let c=d=>m=>{let g=[],x=[],v=[],C=[];m.labels.forEach(L=>{let N=this.Labels.getById(L.toString());N&&g.push(N.label)}),m.markers.forEach(L=>{let N=this.Markers.getById(L.toString())||this.Navigation.getMarkerById(L.toString());N&&x.push(N.marker)}),m.models.forEach(L=>{let N=this.Models.getById(L.toString());N&&v.push(N.model)}),m.paths.forEach(L=>{let N=this.Paths.getById(L.toString())||this.Navigation.getPathById(L.toString());N&&C.push(N.path)});let I=m.geometry.includes(Sy),S=m.geometry.filter(L=>L!==Sy),P;S.length>0&&(P=S.map(L=>this.getMapDataInternal()?.getById("space",L)).filter(Boolean)[0],P||(P=S.map(L=>this.getMapDataInternal()?.getById("object",L)).filter(Boolean)[0]),P||(P=S.map(L=>this.Shapes.getById(L)).filter(Boolean)[0]));let O=m.containers.reduce((L,N)=>{let X=this.getMapDataInternal()?.getById("floor",N);return X&&Wn.is(X)&&L.push(X),L},[]),M,E=0;if(O.length>0){M=O[0].id;let L=this.core.getState(M);E=m.coordinate[2]?m.coordinate[2]-L.altitude:E}let B;this.lastFacadeIntersected&&this.lastFacadeIntersected.spaces.forEach(L=>{this.core.setState(L.id,{hovered:!1})}),P&&_r.is(P)&&(B=S.map(L=>this.getMapDataInternal()?.facadesBySpaceId[L]).filter(Boolean)[0],B&&B.spaces.forEach(L=>{this.core.setState(L.id,{hovered:!0})})),this.lastFacadeIntersected=B;let j={coordinate:new ge({latitude:m.coordinate[1],longitude:m.coordinate[0],floorId:M,verticalOffset:E}),spaces:P&&_r.is(P)?[P]:[],objects:P&&$n.is(P)?[P]:[],shapes:P&&za.is(P)?[P]:[],markers:x,labels:g,models:v,paths:C,floors:O,facades:B?[B]:[]};"pointerEvent"in m&&(j.pointerEvent=m.pointerEvent),I&&(d==="click"?this.BlueDot.publish("click",{coordinate:new ge({longitude:m.coordinate[0],latitude:m.coordinate[1]})}):d==="hover"&&this.BlueDot.publish("hover")),o.publish(d,j)};this.core.on("hover",c("hover")),this.core.on("click",c("click")),this.core.on("user-interaction-start",()=>{o.publish("user-interaction-start")}),this.core.on("user-interaction-end",()=>{o.publish("user-interaction-end")});let p={currentMapGetter:()=>this.currentMap};this.Markers=new my(p),this.Models=new by(p),this.Labels=new cy(p),this.Text3D=new Ly(p),this.Exporter=new ly(p),this.Paths=new vy(p),this.Navigation=new oy(this.core,this,p.currentMapGetter),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.BlueDot=new lm(this.core,this),this.BlueDot.on("blue-dot-position-update",()=>{this._publishBlueDotState({coordinate:this.BlueDot.coordinate,heading:this.BlueDot.heading,accuracy:this.BlueDot.accuracy,floor:this.BlueDot.floor})}),this.BlueDot.on("blue-dot-state-change",()=>{this._publishBlueDotState({state:this.BlueDot.state})}),this.BlueDot.on("blue-dot-follow-change",()=>{this._publishBlueDotState({following:this.BlueDot.following})}),this.Outdoor=new cm(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 gy(p),this.Shapes=new _y(p),this.Style=new Dy(p)}get manualFloorVisibility(){return a(this,Zy)}set manualFloorVisibility(r){w(this,Zy,r),this.externalPubSub.publish("state-change-internal",{manualFloorVisibility:r})}get hidePathsNotOnCurrentFloor(){return a(this,Yy)}set hidePathsNotOnCurrentFloor(r){w(this,Yy,r),this.currentMap?.updatePathLayersVisibility()}preloadFloors(r){r.forEach(n=>{n instanceof Wn&&this.core.setState(n.id,{preloadGeometry:!0})})}updateState(r,n){if(n==null||typeof n!="object")return;if(r==="interior-walls"){this.currentMap.floors.forEach(i=>{let s=i.layers.get(yr);if(s){let l=s.layers.get(Ol);l&&this.core.hasState(l)&&this.core.setState(l,wT(rr(um,n,{warn:!0}),this.core.getState(l)))}});return}if(r==="exterior-walls"){this.currentMap.floors.forEach(i=>{let s=i.layers.get(yr);if(s){let l=s.layers.get(bs);l&&this.core.hasState(l)&&this.core.setState(l,wT(rr(um,n,{warn:!0}),this.core.getState(l)))}});return}if(r==="interior-doors"){this.currentMap.floors.forEach(i=>{let s=i.layers.get(yr);if(s){let l=s.layers.get(kd);l&&this.core.hasState(l)&&this.core.setState(l,Gv(rr(pu,n,{warn:!0}),this.core.getState(l)))}});return}if(r==="exterior-doors"){this.currentMap.floors.forEach(i=>{let s=i.layers.get(yr);if(s){let l=s.layers.get(Ad);l&&this.core.hasState(l)&&this.core.setState(l,Gv(rr(pu,n,{warn:!0}),this.core.getState(l)))}});return}let o=typeof r=="string"?this.getMapDataObject(r):r;if(o){if(o.__type!==Ko.__type&&!this.core.hasState(o.id)){A.warn(`Failed to update state for "${o.id}". No ${o.__type} found with that ID.`);return}if(rc.is(o))return this.core.setState(o.id,oF(rr(TT,n,{warn:!0}),this.core.getState(o.id)));if($a.is(o))return this.core.setState(o.id,aF(rr(PT,n,{warn:!0}),this.core.getState(o.id)));if(_r.is(o)||$n.is(o)){let i=this.core.getState(o.id);if(i!=null){let s=i.parent&&i.parent.type==="geometry-group"?this.core.getState(i.parent):void 0;this.core.setState(o.id,rF(rr($y,n,{warn:!0}),i,s))}}if(Qp.is(o)&&this.core.setState(o.id,rr(_T,n,{warn:!0})),Ci.is(o)&&this.core.setState(o.id,Gv(rr(pu,n,{warn:!0}),this.core.getState(o.id))),za.is(o)&&this.core.setState(o.id,rr(zy,n,{warn:!0})),tu.is(o)){let{position:i,scale:s,rotation:l,...c}=rr(IF,n,{warn:!0}),p=c;i&&(p.position=[i.longitude,i.latitude,i.verticalOffset]),s!=null&&(Array.isArray(s)?p.scale=s:p.scale=[s,s,s]),l!=null&&(Array.isArray(l)?p.rotation=l:p.rotation=[l,l,l]),i&&o.updateTarget(i),this.core.setState(o.id,p)}if(Wn.is(o)){let i=this.currentMap.floorsById.get(o.id);if(i==null)return;let s=rr(Wy,n,{warn:!0});this.core.setState(o.id,s);let l=i.layers.get(yr);l!=null&&"geometry"in n&&n.geometry&&this.core.setState(l.containerId,rr(Ny,n.geometry,{warn:!0}));let c=i.layers.get(xs);if(c!=null&&"labels"in n&&n.labels){let v=rr(Gy,n.labels,{warn:!0});"enabled"in v&&typeof v.enabled=="boolean"&&c.setVisible(v.enabled)}let p=i.layers.get(Ti);if(p!=null&&"markers"in n&&n.markers){let v=rr(jy,n.markers,{warn:!0});"enabled"in v&&typeof v.enabled=="boolean"&&p.setVisible(v.enabled)}let d=i.layers.get(Ld);d!=null&&"footprint"in n&&n.footprint&&this.core.setState(d.containerId,rr(By,n.footprint,{warn:!0}));let m=i.layers.get(_l);if(m!=null&&"occlusion"in n&&n.occlusion){let v=rr(Vy,n.occlusion,{warn:!0});"enabled"in v&&typeof v.enabled=="boolean"&&m.setVisible(v.enabled)}let g=i.layers.get(Rd);if(g!=null&&"images"in n&&n.images){let v=rr(Uy,n.images,{warn:!0});"visible"in v&&typeof v.visible=="boolean"&&g.setVisible(v.visible)}let x=i.layers.get(vs);if(x!=null&&"paths"in n&&n.paths!=null){let v=rr(Hy,n.paths,{warn:!0});v.visible!=null&&typeof v.visible=="boolean"&&x.setVisible(v.visible)}}if(Go.is(o)){let i=this.core.getState(o.id);for(let s of i.children)s.type==="group-container"&&this.core.setState(s.id,rr(Ry,n,{warn:!0}))}if(oc.is(o)&&this.core.setState(o.id,rr(hF,n,{warn:!0})),Ko.is(o))for(let i of o.segments)this.core.setState(i.id,rr(pm,n,{warn:!0}));Qf.is(o)&&this.core.setState(o.id,rr(pm,n,{warn:!0}))}}getMapDataObject(r){return this.getMapDataInternal()?.getMapDataById(r)}getMapDataInternal(){if(this.mapData)return Dm(this.mapData)}getMapData(){return this.mapData}addMap(r,n){return new Promise(o=>{let i;try{i=Dm(r)}catch(g){A.error("Error adding map",g),o(r);return}this.mapDataExternal[r.mapName]=r,this.mapData=r;let{mvf:s}=i,l=s["manifest.geojson"].features[0].geometry.coordinates;this.core.mode!=="outdoors-overlay"&&this.Camera.set({center:new ge(l[1],l[0])});let c=s["manifest.geojson"].features[0].properties.name,p=new fy(`mapObject-${c}`,i,n,this);this.currentMap=p,this.currentMap.loadAllFloors(),this.currentMap.setFloor(this.currentMap.startingFloorId);let d=this.core.getBoundingArea(p.currentFloor.id);d==null&&A.error("Could not determine bounding box for map:",p.currentFloor.id);let m=n?.outdoorView?.layersHiddenByGeometry??[];if(m.length>0){let g,x=[];for(let v of p.floorStacksById.values())if(v.defaultFloor.footprint&&v.defaultFloor.footprint.geometry!=null&&v.defaultFloor.footprint.geometry?.coordinates.length>0){let C=v.defaultFloor.footprint,I=v0(C);g==null?g=I:$6(g,I),x.push(C)}x.length>0&&g!=null&&(this.core.hideOutdoorLayersIntersectingPolygons(g,x,m),this.hiddenOutdoorGeometries.push([g,x,m]))}if(this.mapObjects.push(p),i.getMVFFeatureByType("floor").forEach(g=>{this.mapsByFloorId[g.id]=p}),p.on("floor-change-start",g=>{this.externalPubSub.publish("floor-change-start",{reason:g.reason,floor:this.getMapDataInternal()?.getById("floor",g.floorId)??this.currentFloor,previousFloor:this.getMapDataInternal()?.getById("floor",g.previousFloorId)??this.currentFloor})}),p.on("floor-change",g=>{this.externalPubSub.publish("floor-change",{reason:g.reason,floor:this.currentFloor,previousFloor:this.getMapDataInternal()?.getById("floor",g.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(r);else if(this.core.mode!=="outdoors-overlay"&&d){let g=n?.screenOffsets??{top:Vv*this.core.canvasHeight,left:Vv*this.core.canvasWidth,right:Vv*this.core.canvasWidth,bottom:Vv*this.core.canvasHeight};this.core.camera.focusOn(d,{duration:k6,padding:g}).then(()=>{this.Camera.setElevation(this.currentFloor.elevation),o(r)})}else o(r)})}setFloor(r,n){return this.currentMap.setFloor(Ih(r),n)}setFloorStack(r,n){return this.currentMap.setFloorStack(Ih(r),n)}updateWatermark(r){this.core.updateWatermark(r)}get currentFloorStack(){let r=this.currentMap.currentFloorStack.id;if(!r)throw new Br("Missing currentFloorStack.");let n=this.mapData?.getById("floor-stack",r);if(!n)throw new Br("FloorStack was not found in map data.");return n}get currentFloor(){let r=this.currentMap.currentFloor.id;if(!r)throw new Br("Missing currentFloor object from GeoJsonApi");let n=this.mapData?.getById("floor",r);if(!n)throw new Br("Missing currentFloor");return n}getState(r){typeof r=="object"&&Ko.is(r)&&A.warn("Cannot get state of a Path directly. Use getState() on individual segments within Path.segments[] instead.");let n=W6(r,this),o=this.core.getState(n);if(o){if(["interior-walls","exterior-walls"].includes(r)&&o.type==="geometry-group")return bF(o);if(["interior-doors","exterior-doors"].includes(r)&&o.type==="geometry-group")return HD(o);if(o.type==="geometry"){let i;return"parent"in o&&o.parent&&o.parent.type==="geometry-group"&&(i=this.core.getState(o.parent)),tF(o,i)}else{if(o.type==="label"&&o.options.appearance&&o.options.rank!==void 0&&o.options.interactive!==void 0)return nF(o);if(o.type==="marker"&&o.options?.rank!==void 0&&o.options.interactive!==void 0)return sF(o,this.Markers.getById(o.id.toString())?.marker);if(o.type==="model")return SF(o);if(o.type==="image")return xF(o);if(o.type==="text3d")return gF(o);if(o.type==="geometry-group"&&r&&typeof r!="string"&&za.is(r))return uF(o);if(o.type==="path")return cF(o);if(o.type==="group-container"&&typeof r!="string"&&Wn.is(r))return QD(o,this.currentMap.floorsById.get(r.id),this.core);if(o.type==="group-container"&&o.children.length>0&&typeof r!="string"&&Go.is(r)){let i=this.core.getState(o.children[0].id);return $D(i)}}}}setHoverColor(r){this.core.setState({hoverColor:r})}getHoverColor(){let r=this.core.getState();return r?.type==="map-view"?r.hoverColor:void 0}createCoordinateFromScreenCoordinate(r,n,o){if(o!=null){let p=this.core.projectScreenXYToCoordinate(r,n,!0);return p?new ge(p.coordinate[1],p.coordinate[0],o.id):void 0}let i=this.core.projectScreenXYToCoordinate(r,n);if(i==null||i.coordinate==null)return;let{coordinate:s,groupContainers:l}=i,c=l?.find(p=>{let d=p.userData.entityId.toString();return d.includes("f_")||d.includes("m_")})?.userData.entityId.toString();return new ge(s[1],s[0],c)}getScreenCoordinateFromCoordinate(r){let n=0;if(r.floorId!=null){let o=this.mapData?.getById("floor",r.floorId);o!=null&&(n=this.getState(o)?.altitude??0)}return this.core.projectCoordinateToScreenXY([r.longitude,r.latitude,n])}isInView(r){return this.core.isInView(typeof r=="string"?r:r.id)}__EXPERIMENTAL__auto(){let r=[],n=this.mapDataExternal[Object.keys(this.mapDataExternal)[0]];return[...n.getByType("connection"),...n.getByType("point-of-interest"),...n.getByType("space")].forEach(o=>{if(o.__type==="connection")o.coordinates.forEach(i=>{let s=o.name||o.externalId;if(s){let l=this.Labels.add(i,s,DT(o));r.push(l)}});else{o.__type==="space"&&o.name!==""&&this.updateState(o,{interactive:!0,hoverColor:"#F0F0F0"});let i=o.name;if(i){let s=this.Labels.add(o,i,DT(o));r.push(s)}}}),{labels:r}}tween(r){let n=new Fi(r);return this.core.getExternalTweenGroup().add(n),this.core.render(),n}removeTween(r){this.core.getExternalTweenGroup().remove(r)}tweenGroup(){return this.core.getExternalTweenGroup()}get __core(){return this.core}getCameraState(){return this.core.camera.getState()}getNavigationState(){return{isMultiFloor:this.Navigation.isMultiFloor,floorStacks:this.Navigation.floorStacks,floors:this.Navigation.floors,activeDirections:this.Navigation.activeDirections,activePath:this.Navigation.activePath,paths:this.Navigation.paths}}getAllState(){return{currentFloor:this.currentFloor,currentFloorStack:this.currentFloorStack,Camera:this.getCameraState(),Navigation:this.getNavigationState(),manualFloorVisibility:this.manualFloorVisibility}}publishAllState(){this.externalPubSub.publish("state-change-internal",this.getAllState())}clear(){this.Navigation.clear(),this.BlueDot.disable(),this.Shapes.removeAll(),this.Paths.removeAll(),this.Models.removeAll(),this.Markers.removeAll(),this.Image3D.removeAll(),this.Labels.removeAll()}destroy(){this.clear(),this.core.destroy()}_publishBlueDotState(r){let n;if(r)n=r;else{let{state:o,following:i,heading:s,accuracy:l,coordinate:c,floor:p}=this.BlueDot;n={state:o,following:i,heading:s,accuracy:l,coordinate:c,floor:p}}this.externalPubSub.publish("state-change-internal",{BlueDot:n})}getOptimalVisualDistanceBetweenFloors(r,n=!1){let o=this.currentMap;if(!o){A.error("Cannot compute optimal visual distance between floors. Missing current map.");return}if(r.length<2){A.warn("Cannot compute optimal visual distance between floors. Must provide at least 2 floors.");return}let i=o.renderer.getInternalState().geometry3DMap.get(r[0].id),s=o.renderer.getInternalState().geometry3DMap.get(r[1].id);if(!i||!s){A.warn("Cannot compute optimal visual distance between floors. Floors not found in current map.");return}if(mu(i,"group-container"),mu(s,"group-container"),n){let c=new vr;c.setFromObject(i);let p=new vr;if(p.setFromObject(s),i.children.forEach(I=>{I instanceof Re&&I.userData.debugBox&&Qt(I)}),s.children.forEach(I=>{I instanceof Re&&I.userData.debugBox&&Qt(I)}),!gc(c)||!gc(p))return;let d=new ii(c.max.x-c.min.x,c.max.y-c.min.y,c.max.z-c.min.z),m=new Tr({color:255,transparent:!0,opacity:.5}),g=new Re(d,m);g.position.set((c.min.x+c.max.x)/2,(c.min.y+c.max.y)/2,(c.min.z+c.max.z)/2),g.userData.debugBox=!0;let x=new ii(p.max.x-p.min.x,p.max.y-p.min.y,p.max.z-p.min.z),v=new Tr({color:"cyan",transparent:!0,opacity:.5}),C=new Re(x,v);C.position.set((p.min.x+p.max.x)/2,(p.min.y+p.max.y)/2,(p.min.z+p.max.z)/2),C.userData.debugBox=!0,i.add(g),s.add(C)}let l=o.renderer.computeMinZOffsetBetweenContainers(i,s);if(l!==-1)return l}};Zy=new WeakMap,Yy=new WeakMap;function Ote(e){if(e===""){pT(""),cT("");return}cT(`${e}/${o2}`),pT(`${e}/${n2}`)}u();var Hv=class{constructor(t){f(this,"state");f(this,"update");this.update=t.Debug.update.bind(t.Debug),this.state=t.Debug.state}};u();var MF=q.object({environment:q.union([q.literal("basic"),q.literal(!1)]).optional(),text3d:q.object({hoverColor:q.string().optional()}).optional(),geometry:q.object({hoverColor:q.string().optional()}).optional(),backgroundColor:q.string().optional(),backgroundAlpha:q.number().optional()}).strict();u();var FT=il(K3(),1);var _te=(e,t)=>{let r={},n=(o,i,s)=>{for(let l in i){let c=o[l],p=i[l];typeof p=="object"&&!Array.isArray(p)&&p!==null&&typeof c=="object"&&!Array.isArray(c)&&c!==null?(s[l]={},n(c,p,s[l])):s[l]=c}};return n(e,t,r),r},PF=(e,t)=>{let r=_te(e,t),n=(0,FT.default)({},r,t),o=(0,FT.default)({},r),i=(s,l,c,p=o)=>{for(let d in l){let m=s[d],g=l[d];if(typeof g=="number"&&typeof m=="number")p[d]=m+(g-m)*c;else if(typeof g=="string"&&typeof m=="string"){if(xm(m)&&xm(g)){let x=Kv(m),v=Kv(g);x&&v?p[d]=c5([x[0]+(v[0]-x[0])*c,x[1]+(v[1]-x[1])*c,x[2]+(v[2]-x[2])*c]):A.warn(`Color "${d}" could not be animated!`)}}else typeof g=="object"&&g!==null&&typeof m=="object"&&m!==null?i(m,g,c,p[d]):A.warn(`Value "${d}" could not be animated!`)}};return s=>(s=Math.min(Math.max(s,0),1),s===0?e:s===1?n:(i(r,t,s),o))};var uu,se,Ws,Jy=class{constructor(t){T(this,uu);T(this,se);T(this,Ws);f(this,"Camera");f(this,"Labels");f(this,"Text3D");f(this,"Markers");f(this,"Image3D");f(this,"Models");f(this,"Paths");f(this,"Exporter");f(this,"Navigation");f(this,"__BlueDot");f(this,"Style");f(this,"Shapes");f(this,"Outdoor");f(this,"update",()=>{a(this,se).core.render()});f(this,"__LEGACY_GET_DIRECTIONS_SYNC",(t,r,n)=>a(this,se).getMapData()?.__LEGACY_GET_DIRECTIONS_SYNC(t,r,n)??void 0);f(this,"getDirections",(t,r,n)=>a(this,se).getMapData()?.getDirections(t,r,n)??Promise.resolve(void 0));f(this,"__LEGACY_GET_DIRECTIONS_MULTI_DESTINATION_SYNC",(t,r,n)=>a(this,se).getMapData()?.__LEGACY_GET_DIRECTIONS_MULTI_DESTINATION_SYNC(t,r,n)??void 0);f(this,"getDirectionsMultiDestination",(t,r,n)=>a(this,se).getMapData()?.getDirectionsMultiDestination(t,r,n)??Promise.resolve(void 0));f(this,"on",(t,r)=>{a(this,uu).on(t,r)});f(this,"off",(t,r)=>{a(this,uu).off(t,r)});f(this,"Debug");w(this,uu,new Fe),w(this,Ws,t);let r=new Xy(t,this,a(this,uu));w(this,se,r),this.Camera=a(this,se).Camera,this.Markers=a(this,se).Markers,this.Models=a(this,se).Models,this.Labels=a(this,se).Labels,this.Text3D=a(this,se).Text3D,this.Exporter=a(this,se).Exporter,this.Paths=a(this,se).Paths,this.Navigation=a(this,se).Navigation,this.__BlueDot=a(this,se).BlueDot,this.Shapes=a(this,se).Shapes,this.Style=a(this,se).Style,this.Outdoor=a(this,se).Outdoor,this.Image3D=a(this,se).Image3D,a(this,Ws).container.dataset.version=y.env.npm_package_version,this.Debug=new Hv(a(this,se).core)}updateState(t,r){return a(this,se).updateState(t,r)}animateState(t,r,n){let o=a(this,se).getState(t);if(o==null)return A.warn(`Cannot animate state of ${t}.`),new Promise(p=>p({result:"completed"}));let i=PF(o,r),s=a(this,se).tween({percent:0}).to({percent:1},n?.duration??1e3).onUpdate(({percent:c})=>{a(this,se).updateState(t,i(c))});n?.easing&&n.easing in Fs&&s.easing(Fs[n.easing]);let l=new Promise(c=>{s.onComplete(()=>{a(this,se).removeTween(s),c({result:"completed"})}).onStop(()=>{a(this,se).removeTween(s),c({result:"cancelled"})}),s.start()});return l.cancel=()=>{s.stop(),a(this,se).updateState(t,i(0))},l}updateGlobalState(t){try{MF.parse(t)}catch(r){A.error("updateGlobalState",r);return}if(typeof t=="object"){let r={};if(t.text3d?.hoverColor&&(r.text3dHoverColor=t.text3d.hoverColor),t.geometry?.hoverColor&&(r.hoverColor=t.geometry.hoverColor),t.backgroundColor||t.backgroundAlpha!==void 0){let n=t.backgroundColor??a(this,se).core.backgroundColor,o=t.backgroundAlpha??a(this,se).core.backgroundAlpha;a(this,se).core.setBackgroundColor(n,o)}t.environment!=null&&a(this,se).core.setEnvironment(t.environment),a(this,se).core.setState(r)}}get options(){return R6(a(this,se).currentMap.options)}getGlobalState(){let t=a(this,se).core.getState();return{backgroundColor:a(this,se).core.backgroundColor,backgroundAlpha:a(this,se).core.backgroundAlpha,environment:a(this,se).core.getEnvironment(),geometry:{hoverColor:t.hoverColor},text3d:{hoverColor:t.text3dHoverColor}}}getMapData(){if(a(this,se).mapData==null)throw new Br("MapData not found.");return a(this,se).mapData}getDimensions(){return{width:a(this,Ws).canvasWidth,height:a(this,Ws).canvasHeight}}addMap(t,r){return a(this,se).addMap(t,r)}setFloor(t,r){return a(this,se).setFloor(t,r?.context)}setFloorStack(t,r){return a(this,se).setFloorStack(t,r?.context)}preloadFloors(t){a(this,se).preloadFloors(t)}tween(t){return a(this,se).tween(t)}removeTween(t){a(this,se).removeTween(t)}get tweenGroup(){return a(this,se).tweenGroup()}get currentFloorStack(){return a(this,se).currentFloorStack}get currentFloor(){return a(this,se).currentFloor}updateWatermark(t){a(this,se).updateWatermark(t)}getState(t){return a(this,se).getState(t)}setHoverColor(t){a(this,se).setHoverColor(t)}getHoverColor(){return a(this,se).getHoverColor()}convertAltitudeToMercatorZoomLevel(t){return a(this,se).core.getSystems().cameraSystem.convertAltitudeToZoomLevel(t)}convertMercatorZoomLevelToAltitude(t){return a(this,se).core.getSystems().cameraSystem.convertZoomLevelToAltitude(t)}isInView(t){return a(this,se).isInView(t)}getDistance(t,r){return a(this,se).getMapData()?.getDistance(t,r)}createCoordinate(t,r,n){return typeof t=="object"?new ge(t):new ge(t,r,n?.id)}createCoordinateFromScreenCoordinate(t,r,n){return a(this,se).createCoordinateFromScreenCoordinate(t,r,n)}getScreenCoordinateFromCoordinate(t){return a(this,se).getScreenCoordinateFromCoordinate(t)}__EXPERIMENTAL__auto(){a(this,se).__EXPERIMENTAL__auto()}get __core(){if(y.env.INTERNAL==="true")return a(this,se).core;throw new Error("__core is not available.")}get container(){return a(this,Ws).container}publishAllState(){a(this,se).publishAllState()}clear(){a(this,se).clear()}destroy(){a(this,se).destroy()}async enableDebug(t={}){let{Inspector:r}=await import("./inspector-YD6373IB.js");await new r(this,a(this,se)).enable(t)}async takeScreenshot(){return await a(this,Ws).renderSync(),a(this,Ws).rendererDomElement.toDataURL("image/png")}get manualFloorVisibility(){return a(this,se).manualFloorVisibility}set manualFloorVisibility(t){a(this,se).manualFloorVisibility=t}getOptimalVisualDistanceBetweenFloors(t){return a(this,se).getOptimalVisualDistanceBetweenFloors(t)}get __INTERNAL__hidePathsNotOnCurrentFloor(){return a(this,se).hidePathsNotOnCurrentFloor}set __INTERNAL__hidePathsNotOnCurrentFloor(t){a(this,se).hidePathsNotOnCurrentFloor=!!t}};uu=new WeakMap,se=new WeakMap,Ws=new WeakMap;u();var Ete=1e3*60*60*2,uc,fm,Vt,$s,Hi,ti,Wi,mm,hm,qy,Jt,wF,OF,dm,Wv,kT,AT,LT,gm=class{constructor(t,r){T(this,Jt);T(this,uc,new Fe);T(this,fm);T(this,Vt);T(this,$s);T(this,Hi);T(this,ti);T(this,Wi);T(this,mm);T(this,hm);T(this,qy,()=>{"key"in a(this,Vt)&&"secret"in a(this,Vt)&&z(this,Jt,dm).call(this),z(this,Jt,Wv).call(this)});f(this,"on",(t,r)=>a(this,uc).on(t,r));f(this,"off",(t,r)=>a(this,uc).off(t,r));w(this,fm,t),w(this,Vt,r)}setMapIds(t){w(this,fm,t)}setEnterprise(t){a(this,Vt).enterprise=t}async readySync(){if((!("key"in a(this,Vt))||!("secret"in a(this,Vt)))&&!("accessToken"in a(this,Vt))){A.error("No API keys or access token provided! Cannot preload tokens.");return}let t=[z(this,Jt,dm).call(this),null];a(this,Vt).enterprise||(t[1]=this.getSasTokensAsync());let[r,n]=await Promise.all(t);z(this,Jt,LT).call(this),z(this,Jt,kT).call(this,r),n!=null&&z(this,Jt,AT).call(this,n),bm()&&globalThis.addEventListener?.("focus",a(this,qy))}async refreshing(){let t=[];return a(this,$s)!=null&&t.push(a(this,$s)),a(this,Hi)!=null&&t.push(a(this,Hi)),Promise.all(t)}getAccessTokenAsync(){return z(this,Jt,dm).call(this)}getSasTokensAsync(){return z(this,Jt,Wv).call(this)}getAccessToken(){return a(this,ti)==null?(A.error("Tokens must be loaded before reading synchronously! Try awaiting readySync() first."),{token:""}):a(this,ti)}getSasToken(t){return this.isEnterpriseMode()?(A.error("SAS tokens are not available in the enterprise mode!"),{token:""}):a(this,Wi)==null?(A.error("Tokens must be loaded before reading synchronously! Try awaiting readySync() first."),{token:""}):t in a(this,Wi).tokens?a(this,Wi).tokens[t]:(A.error(`SAS token for map ${t} not found!`),{token:""})}isEnterpriseMode(){return a(this,Vt).enterprise??!1}destroy(){z(this,Jt,LT).call(this),a(this,uc).destroy(),bm()&&globalThis.removeEventListener("focus",a(this,qy))}};uc=new WeakMap,fm=new WeakMap,Vt=new WeakMap,$s=new WeakMap,Hi=new WeakMap,ti=new WeakMap,Wi=new WeakMap,mm=new WeakMap,hm=new WeakMap,qy=new WeakMap,Jt=new WeakSet,wF=function(t){let r=t.token!==a(this,ti)?.token;w(this,ti,t),r&&a(this,uc).publish("access-token-refreshed",{accessToken:t})},OF=function(t){let r=JSON.stringify(t.tokens)!==JSON.stringify(a(this,Wi)?.tokens);w(this,Wi,t),r&&a(this,uc).publish("sas-tokens-refreshed",{sasTokens:t.tokens})},dm=async function(t=!1){if("accessToken"in a(this,Vt)&&typeof a(this,Vt).accessToken=="string"){let r={token:a(this,Vt).accessToken,expires:Date.now()+72e5};return w(this,ti,r),r}if(!("key"in a(this,Vt))||!("secret"in a(this,Vt))||typeof a(this,Vt).key!="string"||typeof a(this,Vt).secret!="string")throw new Error("No API keys or access token provided!");return a(this,$s)!=null?a(this,$s):a(this,ti)!=null&&a(this,ti).expires!=null&&a(this,ti).expires>Date.now()&&!t?a(this,ti):(w(this,$s,yh({...a(this,Vt),key:a(this,Vt).key,secret:a(this,Vt).secret},a(this,Vt).enterprise??!1).then(r=>{let n={token:r.accessToken,expires:r.expiresTimestamp*1e3};return z(this,Jt,wF).call(this,n),n}).catch(r=>{throw r}).finally(()=>{w(this,$s,void 0)})),a(this,$s))},Wv=async function(t=!1){return this.isEnterpriseMode()?{tokens:{},expires:1/0}:a(this,Hi)!=null?a(this,Hi):a(this,Wi)!=null&&a(this,Wi).expires>Date.now()&&!t?a(this,Wi):(w(this,Hi,new Promise((r,n)=>{z(this,Jt,dm).call(this).then(o=>{let i={},s=a(this,fm).map(l=>wS({...a(this,Vt),mapId:l},o.token).then(c=>{i[l]={token:c.token,expires:c.expires}}).catch(c=>{A.error(`Error getting SAS token for map ${l}:`,c)}));Promise.all(s).then(()=>{let l={tokens:i,expires:Math.min(...Object.values(i).map(c=>c.expires??1/0))};z(this,Jt,OF).call(this,l),r(l)})}).catch(o=>{n(o)})})),a(this,Hi).catch(r=>{throw r}).finally(()=>{w(this,Hi,void 0)}),a(this,Hi))},kT=function(t){if(!("key"in a(this,Vt))||!("secret"in a(this,Vt)))return;let r=t.expires!=null?t.expires-Date.now():Ete;isFinite(r)&&w(this,mm,setTimeout(()=>{z(this,Jt,dm).call(this,!0).then(n=>{z(this,Jt,kT).call(this,n)})},r-t6))},AT=function(t){let r=t.expires-Date.now();isFinite(r)&&w(this,hm,setTimeout(()=>{z(this,Jt,Wv).call(this,!0).then(n=>{z(this,Jt,AT).call(this,n)})},r-o6))},LT=function(){a(this,mm)!=null&&clearTimeout(a(this,mm)),a(this,hm)!=null&&clearTimeout(a(this,hm))};u();var Dte=async(e,t)=>{let r=("mvfVersion"in(t??{})?t?.mvfVersion:void 0)??("options"in e&&"version"in(e.options??{})?e.options?.version:void 0),n={prefetchTokens:!0,...t||{},mvfVersion:r},o,i=Cl();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 s0(e.main,n.mvfVersion),s.languagePacks=[];for(let v of e.languagePacks??[])v.localePack instanceof Uint8Array&&s.languagePacks.push({language:v.language,localePack:await hd(v.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 l=i0(o),c=l.length>0?l:[n.mapId];n.baseAuthUri=i.getBaseAuthUri();let p=new gm(c,{...n,enterprise:s.enterprise}),d;if("accessToken"in n&&n.accessToken)d=n.accessToken;else if("key"in n&&"secret"in n){let v;try{v=await p.getAccessTokenAsync()}catch(C){A.error("Failed getting token during hydrateMapData",C)}d=v?.token||""}if(s.outdoorViewToken=d,s.env=i,s.getMapDataOptions=n,n.prefetchTokens)try{await p.readySync()}catch(v){A.error("Failed to ready token manager!",v)}Vh()&&(s.enterprise&&A.warn("forceEnterpriseLocations is enabled, but the map is already an enterprise map!"),n.mvfVersion!=="3.0.0"&&A.warn("mvfVersion must be '3.0.0' when forceEnterpriseLocations is enabled!"));let m=new Tp(o,s);d&&m.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 g=new Em(m),x=m.findPreferredLanguage({languageCode:n.language,fallbackToNavigatorLanguage:!1});if(x)try{await g.changeLanguage(x.code)}catch{}return typeof t?.onMVFParsed=="function"&&t.onMVFParsed(o),g};u();var _F=(e,{id:t}={})=>{let r=Array.isArray(e)?e:[e];if(!r.every(i=>typeof i=="string"))return;let n=r.join(""),o=null;if(t){let i=document.getElementById(t);i instanceof HTMLStyleElement&&(o=i)}o==null&&(o=document.createElement("style")),t&&t!==""&&(o.id=t),o.textContent=n,document.head.appendChild(o)};var EF=`:root {
|
|
1138
1138
|
--pin-shadow-hover-scale: 0.9;
|
|
1139
1139
|
--pin-shadow-width: 12px;
|
|
1140
1140
|
--pin-shadow-height: 5px;
|
|
@@ -2340,4 +2340,4 @@ a.maplibregl-ctrl-logo.maplibregl-compact {
|
|
|
2340
2340
|
`;u();function Nte(e){if(!(!e.languages||!bm()||!globalThis.navigator?.languages?.length))for(let t=0;t<globalThis.navigator.languages.length;t++){let r=e.languages.find(n=>n.code.toLowerCase()===globalThis.navigator.languages[t].toLowerCase());if(r)return{code:r.code,name:r.name}}}function N3(e,t){let r=t?.languageCode??"",n=t?.fallbackToNavigatorLanguage??!0,o=e?.languages?.find(s=>s.code.toLowerCase()===r.toLowerCase()),i;if(o)i=o;else if(n??!0)try{let s=Nte(e);s&&(i=s)}catch(s){A.error("fallbackToNavigatorLanguage is set, however, there was an error getting the navigator language",s)}return i??e.defaultLanguage}var Gte=[EF,DF,FF,kF,AF,LF],RF;function AZe(e){RF=e}var LZe=async(e,t)=>{let r,n=Cl();t&&n.updateByUserOption(t);try{t&&(r=(await yh({...t,baseAuthUri:n.getBaseAuthUri()})).accessToken)}catch(s){A.warn("Getting access token failed. Outdoor map disabled.",s)}let o=new Tp(e,{outdoorViewToken:r,languagePacks:t?.languagePacks,env:n});return new Em(o)},BF=!1;function RZe(e){BF=e}var NF=!1;function BZe(e){NF=e}function Vh(){return NF}var jte=async e=>{let t=BF,r,n=Cl();n.updateByUserOption(e);let o={prefetchTokens:!0,...e,fallbackToNavigatorLanguage:e.fallbackToNavigatorLanguage??!0},i=new gm([o.mapId],o);if("accessToken"in o&&o.accessToken){r=o.accessToken;let{aud:I,sub:S}=cb(r);(A6.some(P=>I.includes(P))||S&&S.startsWith("client"))&&(t=!0,n.setEnterprise(t),i.setEnterprise(t))}else if("key"in o&&"secret"in o){if(o.key.startsWith("mipk_"))throw new Error(`Partner API keys detected!
|
|
2341
2341
|
|
|
2342
2342
|
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_")||(t=!0,n.setEnterprise(t),i.setEnterprise(t)),o.baseAuthUri=n.getBaseAuthUri(),r=(await i.getAccessTokenAsync()).token}else throw new Error("Missing key or secret.");o.layoutId!=null&&(t?o.layoutId!=="draft"&&A.warn('Invalid layoutId! Use "draft" to load draft data or leave unspecified to load live data.'):A.warn("layoutId is currently unsupported!")),o.baseUri=n.getBaseUri();let s=performance.now(),l,c;if(t){let I={...o,venue:o.mapId,clientId:o.key,clientSecret:o.secret,version:"1.0.0",perspective:o.viewId,useDraftData:o.layoutId==="draft"},S=await ES(I);l=S.compressed,c=S.localePacks}else l=await DS(o,r);let p=performance.now(),d=await s0(l,o.mvfVersion),m=performance.now();typeof e.onMVFParsed=="function"&&e.onMVFParsed(d);let g=i0(d);if(g.length>0?i.setMapIds(g):i.setMapIds([o.mapId]),o.prefetchTokens)try{await i.readySync()}catch(I){A.error("Failed to ready token manager!",I)}Vh()&&(t&&A.warn("forceEnterpriseLocations is enabled, but the map is already an enterprise map!"),o.mvfVersion!=="3.0.0"&&A.warn("mvfVersion must be '3.0.0' when forceEnterpriseLocations is enabled!"));let x=new Tp(d,{env:n,outdoorViewToken:r,tokenManager:i,enterprise:t,localePacksUrls:c,binaryBundle:l,getMapDataOptions:o}),v=new Em(x,{search:e.search});x.Analytics.init({accessToken:r,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}),x.Analytics.sendGetMapDataEvent({parseDuration:m-p,downloadDuration:p-s,viewId:o.viewId});let C=x.findPreferredLanguage({languageCode:o.language,fallbackToNavigatorLanguage:o.fallbackToNavigatorLanguage});if(C)try{await v.changeLanguage(C.code)}catch{}return v},NZe=jte,Ute=async()=>{if(wp===""||Mv==="")return!1;let e=[fetch(wp,{mode:"same-origin"}),fetch(Mv,{mode:"same-origin"})],[t,r]=[{ok:!1},{ok:!1}];try{[t,r]=await Promise.all(e)}catch{}return{collision:t.ok,maplibre:r.ok}},Vte=async(e,t,r)=>{let n=performance.now(),o=l3(r,t);o&&a3(o),(o.injectStyles??!0)&&_F(Gte,{id:"mappedin__styles"});let i=L6(t.outdoorViewToken??""),s=Dm(t);o.outdoorView?.style&&s.envControl.updateTileServerBaseUrl(o.outdoorView?.style);let l=!1,c=!1,p=await Ute();p&&(p.collision||(l=!0),p.maplibre||(c=!0));let d=await fD(e,{center:[t.mapCenter.longitude,t.mapCenter.latitude],bearing:o.bearing,pitch:o.pitch,zoomLevel:o.zoomLevel,backgroundAlpha:o.style?.backgroundAlpha,backgroundColor:o.style?.backgroundColor,outdoorView:!c&&o.outdoorView?.token?{headers:{"x-mappedin-tiles-key":o.outdoorView?.token},style:t.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:RF||void 0},attribution:o.attribution,antialias:typeof o.antialiasing=="boolean"?o.antialiasing:!!o.antialiasing?.enabled,accessToken:t.outdoorViewToken,occlusionEnabled:!0,transformImageRequest:s.enterpriseMode?void 0:s.transformImageRequest,naturalBearing:t.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:!l}),m=new Jy(d);return await m.addMap(t,o),s.Analytics.sendMapViewLoadedEvent({firstRenderDuration:performance.now()-n,dimension:m.getDimensions(),collisionWorkerDisabled:l,outdoorsWorkerDisabled:c}),m},GZe=()=>y.env.npm_package_version,jZe=Vte;export{ge as a,Bo as b,Gc as c,Uc as d,va as e,Ci as f,_r as g,Wn as h,u$ as i,Dl as j,$n as k,Ca as l,Ta as m,m0 as n,Go as o,ys as p,h0 as q,v3 as r,FS as s,kS as t,s0 as u,G6 as v,I3 as w,j6 as x,y0 as y,b0 as z,Rl as A,_ as B,tp as C,g0 as D,uC as E,$9 as F,_E as G,Fs as H,ete as I,bT as J,Ite as K,CT as L,MT as M,Ote as N,Jy as O,Dte as P,N3 as Q,AZe as R,LZe as S,RZe as T,BZe as U,Vh as V,jte as W,NZe as X,Ute as Y,Vte as Z,GZe as _,jZe as $};
|
|
2343
|
-
//# sourceMappingURL=chunk-
|
|
2343
|
+
//# sourceMappingURL=chunk-VI2AJVL2.js.map
|