@mappedin/maplibre-overlay 6.0.1-beta.54

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ import{$ as _o,A as Bc,B as Fc,C as Lr,D as Gc,E as Xc,F as zc,G as It,H as Co,I as Me,J as lt,K as Yc,L as Ar,M as gt,N as ne,O as me,P as Po,Q as To,R as wa,S as Zc,T as ui,U as Uc,V as Vi,W as qi,X as Hc,Y as Mo,Z as Wc,_ as Ia,a as Ca,aa as wo,b as Pa,ba as jc,c as vo,ca as Vc,d as xo,da as qc,e as Dr,ea as Ea,f as Ic,fa as Jc,g as Ec,ga as Da,h as Ta,ha as $c,i as cr,ia as Kc,j as Dc,ja as ci,k as q,ka as Qc,l as Ma,la as eh,m as Oc,ma as Io,n as li,na as Oa,o as Lc,oa as Ji,p as Ac,pa as hi,q as So,qa as Eo,r as _t,ra as pi,s as Rc,sa as di,t as _a,u as wt,v as ie,w as kc,x as w,y as Or,z as Nc}from"./chunk-3N4I2ZNL.js";import{k as ac,w as lc}from"./chunk-MY2QYVOC.js";import{a as ut}from"./chunk-DMDOMXWY.js";import{$ as ae,$a as Mc,A as cc,Aa as Sa,B as ho,Ba as lr,C as po,Ca as ur,D as hc,Da as yt,E as pc,Ea as yo,Fa as Cc,G as dc,Ga as Pc,H as ee,I as K,Ia as Er,M as mc,N as fc,O as yc,P as Ir,Q as z,R as Ue,S as gc,Sa as go,T as ot,U as Xt,V as zt,W as ye,Wa as bo,Xa as Tc,Y as je,Z as $e,_ as mo,aa as rr,b as lo,bb as Mt,c as _r,ca as nr,d as ji,da as bc,db as _c,e as ft,ea as va,f as uc,fb as wc,g as Tt,ga as or,la as vc,oa as sr,p as uo,pa as xc,qa as fo,r as co,ra as xa,ta as ai,ya as Sc,z as wr,za as ar}from"./chunk-MSQIQNNK.js";import{a as x,b as D}from"./chunk-DZU6L3QB.js";import{a as se,b as Ze,c as a,d as sc,f as tr,g as lf,h as ao,i as d,j as u,k as L,l as B,m as Te}from"./chunk-CU2O7JF6.js";var $h=tr((Qi,yi)=>{x();var Ff=200,Dh="__lodash_hash_undefined__",Gf=800,Xf=16,Oh=9007199254740991,Lh="[object Arguments]",zf="[object Array]",Yf="[object AsyncFunction]",Zf="[object Boolean]",Uf="[object Date]",Hf="[object Error]",Ah="[object Function]",Wf="[object GeneratorFunction]",jf="[object Map]",Vf="[object Number]",qf="[object Null]",Rh="[object Object]",Jf="[object Proxy]",$f="[object RegExp]",Kf="[object Set]",Qf="[object String]",ey="[object Undefined]",ty="[object WeakMap]",ry="[object ArrayBuffer]",iy="[object DataView]",ny="[object Float32Array]",oy="[object Float64Array]",sy="[object Int8Array]",ay="[object Int16Array]",ly="[object Int32Array]",uy="[object Uint8Array]",cy="[object Uint8ClampedArray]",hy="[object Uint16Array]",py="[object Uint32Array]",dy=/[\\^$.*+?()[\]{}|]/g,my=/^\[object .+?Constructor\]$/,fy=/^(?:0|[1-9]\d*)$/,ge={};ge[ny]=ge[oy]=ge[sy]=ge[ay]=ge[ly]=ge[uy]=ge[cy]=ge[hy]=ge[py]=!0;ge[Lh]=ge[zf]=ge[ry]=ge[Zf]=ge[iy]=ge[Uf]=ge[Hf]=ge[Ah]=ge[jf]=ge[Vf]=ge[Rh]=ge[$f]=ge[Kf]=ge[Qf]=ge[ty]=!1;var kh=typeof global=="object"&&global&&global.Object===Object&&global,yy=typeof self=="object"&&self&&self.Object===Object&&self,rn=kh||yy||Function("return this")(),Nh=typeof Qi=="object"&&Qi&&!Qi.nodeType&&Qi,en=Nh&&typeof yi=="object"&&yi&&!yi.nodeType&&yi,Bh=en&&en.exports===Nh,Ba=Bh&&kh.process,Sh=function(){try{var e=en&&en.require&&en.require("util").types;return e||Ba&&Ba.binding&&Ba.binding("util")}catch(r){}}(),Ch=Sh&&Sh.isTypedArray;function Fh(e,r,t){switch(t.length){case 0:return e.call(r);case 1:return e.call(r,t[0]);case 2:return e.call(r,t[0],t[1]);case 3:return e.call(r,t[0],t[1],t[2])}return e.apply(r,t)}a(Fh,"apply");function gy(e,r){for(var t=-1,i=Array(e);++t<e;)i[t]=r(t);return i}a(gy,"baseTimes");function by(e){return function(r){return e(r)}}a(by,"baseUnary");function vy(e,r){return e==null?void 0:e[r]}a(vy,"getValue");function xy(e,r){return function(t){return e(r(t))}}a(xy,"overArg");var Sy=Array.prototype,Cy=Function.prototype,Bo=Object.prototype,Fa=rn["__core-js_shared__"],Fo=Cy.toString,Ht=Bo.hasOwnProperty,Ph=function(){var e=/[^.]+$/.exec(Fa&&Fa.keys&&Fa.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),Gh=Bo.toString,Py=Fo.call(Object),Ty=RegExp("^"+Fo.call(Ht).replace(dy,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ko=Bh?rn.Buffer:void 0,Th=rn.Symbol,Mh=rn.Uint8Array,_h=ko?ko.allocUnsafe:void 0,Xh=xy(Object.getPrototypeOf,Object),wh=Object.create,My=Bo.propertyIsEnumerable,_y=Sy.splice,Nr=Th?Th.toStringTag:void 0,No=function(){try{var e=Ha(Object,"defineProperty");return e({},"",{}),e}catch(r){}}(),wy=ko?ko.isBuffer:void 0,Ih=Math.max,Iy=Date.now,zh=Ha(rn,"Map"),tn=Ha(Object,"create"),Ey=function(){function e(){}return a(e,"object"),function(r){if(!Ut(r))return{};if(wh)return wh(r);e.prototype=r;var t=new e;return e.prototype=void 0,t}}();function Br(e){var r=-1,t=e==null?0:e.length;for(this.clear();++r<t;){var i=e[r];this.set(i[0],i[1])}}a(Br,"Hash");function Dy(){this.__data__=tn?tn(null):{},this.size=0}a(Dy,"hashClear");function Oy(e){var r=this.has(e)&&delete this.__data__[e];return this.size-=r?1:0,r}a(Oy,"hashDelete");function Ly(e){var r=this.__data__;if(tn){var t=r[e];return t===Dh?void 0:t}return Ht.call(r,e)?r[e]:void 0}a(Ly,"hashGet");function Ay(e){var r=this.__data__;return tn?r[e]!==void 0:Ht.call(r,e)}a(Ay,"hashHas");function Ry(e,r){var t=this.__data__;return this.size+=this.has(e)?0:1,t[e]=tn&&r===void 0?Dh:r,this}a(Ry,"hashSet");Br.prototype.clear=Dy;Br.prototype.delete=Oy;Br.prototype.get=Ly;Br.prototype.has=Ay;Br.prototype.set=Ry;function Wt(e){var r=-1,t=e==null?0:e.length;for(this.clear();++r<t;){var i=e[r];this.set(i[0],i[1])}}a(Wt,"ListCache");function ky(){this.__data__=[],this.size=0}a(ky,"listCacheClear");function Ny(e){var r=this.__data__,t=Go(r,e);if(t<0)return!1;var i=r.length-1;return t==i?r.pop():_y.call(r,t,1),--this.size,!0}a(Ny,"listCacheDelete");function By(e){var r=this.__data__,t=Go(r,e);return t<0?void 0:r[t][1]}a(By,"listCacheGet");function Fy(e){return Go(this.__data__,e)>-1}a(Fy,"listCacheHas");function Gy(e,r){var t=this.__data__,i=Go(t,e);return i<0?(++this.size,t.push([e,r])):t[i][1]=r,this}a(Gy,"listCacheSet");Wt.prototype.clear=ky;Wt.prototype.delete=Ny;Wt.prototype.get=By;Wt.prototype.has=Fy;Wt.prototype.set=Gy;function gi(e){var r=-1,t=e==null?0:e.length;for(this.clear();++r<t;){var i=e[r];this.set(i[0],i[1])}}a(gi,"MapCache");function Xy(){this.size=0,this.__data__={hash:new Br,map:new(zh||Wt),string:new Br}}a(Xy,"mapCacheClear");function zy(e){var r=zo(this,e).delete(e);return this.size-=r?1:0,r}a(zy,"mapCacheDelete");function Yy(e){return zo(this,e).get(e)}a(Yy,"mapCacheGet");function Zy(e){return zo(this,e).has(e)}a(Zy,"mapCacheHas");function Uy(e,r){var t=zo(this,e),i=t.size;return t.set(e,r),this.size+=t.size==i?0:1,this}a(Uy,"mapCacheSet");gi.prototype.clear=Xy;gi.prototype.delete=zy;gi.prototype.get=Yy;gi.prototype.has=Zy;gi.prototype.set=Uy;function bi(e){var r=this.__data__=new Wt(e);this.size=r.size}a(bi,"Stack");function Hy(){this.__data__=new Wt,this.size=0}a(Hy,"stackClear");function Wy(e){var r=this.__data__,t=r.delete(e);return this.size=r.size,t}a(Wy,"stackDelete");function jy(e){return this.__data__.get(e)}a(jy,"stackGet");function Vy(e){return this.__data__.has(e)}a(Vy,"stackHas");function qy(e,r){var t=this.__data__;if(t instanceof Wt){var i=t.__data__;if(!zh||i.length<Ff-1)return i.push([e,r]),this.size=++t.size,this;t=this.__data__=new gi(i)}return t.set(e,r),this.size=t.size,this}a(qy,"stackSet");bi.prototype.clear=Hy;bi.prototype.delete=Wy;bi.prototype.get=jy;bi.prototype.has=Vy;bi.prototype.set=qy;function Jy(e,r){var t=Ya(e),i=!t&&za(e),n=!t&&!i&&Wh(e),o=!t&&!i&&!n&&Vh(e),s=t||i||n||o,l=s?gy(e.length,String):[],h=l.length;for(var p in e)(r||Ht.call(e,p))&&!(s&&(p=="length"||n&&(p=="offset"||p=="parent")||o&&(p=="buffer"||p=="byteLength"||p=="byteOffset")||Uh(p,h)))&&l.push(p);return l}a(Jy,"arrayLikeKeys");function Ga(e,r,t){(t!==void 0&&!Yo(e[r],t)||t===void 0&&!(r in e))&&Za(e,r,t)}a(Ga,"assignMergeValue");function $y(e,r,t){var i=e[r];(!(Ht.call(e,r)&&Yo(i,t))||t===void 0&&!(r in e))&&Za(e,r,t)}a($y,"assignValue");function Go(e,r){for(var t=e.length;t--;)if(Yo(e[t][0],r))return t;return-1}a(Go,"assocIndexOf");function Za(e,r,t){r=="__proto__"&&No?No(e,r,{configurable:!0,enumerable:!0,value:t,writable:!0}):e[r]=t}a(Za,"baseAssignValue");var Ky=cg();function Xo(e){return e==null?e===void 0?ey:qf:Nr&&Nr in Object(e)?hg(e):gg(e)}a(Xo,"baseGetTag");function Eh(e){return nn(e)&&Xo(e)==Lh}a(Eh,"baseIsArguments");function Qy(e){if(!Ut(e)||fg(e))return!1;var r=ja(e)?Ty:my;return r.test(Sg(e))}a(Qy,"baseIsNative");function eg(e){return nn(e)&&jh(e.length)&&!!ge[Xo(e)]}a(eg,"baseIsTypedArray");function tg(e){if(!Ut(e))return yg(e);var r=Hh(e),t=[];for(var i in e)i=="constructor"&&(r||!Ht.call(e,i))||t.push(i);return t}a(tg,"baseKeysIn");function Ua(e,r,t,i,n){e!==r&&Ky(r,function(o,s){if(n||(n=new bi),Ut(o))rg(e,r,s,t,Ua,i,n);else{var l=i?i(Xa(e,s),o,s+"",e,r,n):void 0;l===void 0&&(l=o),Ga(e,s,l)}},qh)}a(Ua,"baseMerge");function rg(e,r,t,i,n,o,s){var l=Xa(e,t),h=Xa(r,t),p=s.get(h);if(p){Ga(e,t,p);return}var m=o?o(l,h,t+"",e,r,s):void 0,f=m===void 0;if(f){var v=Ya(h),y=!v&&Wh(h),C=!v&&!y&&Vh(h);m=h,v||y||C?Ya(l)?m=l:Cg(l)?m=ag(l):y?(f=!1,m=ng(h,!0)):C?(f=!1,m=sg(h,!0)):m=[]:Pg(h)||za(h)?(m=l,za(l)?m=Tg(l):(!Ut(l)||ja(l))&&(m=pg(h))):f=!1}f&&(s.set(h,m),n(m,h,i,o,s),s.delete(h)),Ga(e,t,m)}a(rg,"baseMergeDeep");function Yh(e,r){return vg(bg(e,r,Jh),e+"")}a(Yh,"baseRest");var ig=No?function(e,r){return No(e,"toString",{configurable:!0,enumerable:!1,value:wg(r),writable:!0})}:Jh;function ng(e,r){if(r)return e.slice();var t=e.length,i=_h?_h(t):new e.constructor(t);return e.copy(i),i}a(ng,"cloneBuffer");function og(e){var r=new e.constructor(e.byteLength);return new Mh(r).set(new Mh(e)),r}a(og,"cloneArrayBuffer");function sg(e,r){var t=r?og(e.buffer):e.buffer;return new e.constructor(t,e.byteOffset,e.length)}a(sg,"cloneTypedArray");function ag(e,r){var t=-1,i=e.length;for(r||(r=Array(i));++t<i;)r[t]=e[t];return r}a(ag,"copyArray");function lg(e,r,t,i){var n=!t;t||(t={});for(var o=-1,s=r.length;++o<s;){var l=r[o],h=i?i(t[l],e[l],l,t,e):void 0;h===void 0&&(h=e[l]),n?Za(t,l,h):$y(t,l,h)}return t}a(lg,"copyObject");function ug(e){return Yh(function(r,t){var i=-1,n=t.length,o=n>1?t[n-1]:void 0,s=n>2?t[2]:void 0;for(o=e.length>3&&typeof o=="function"?(n--,o):void 0,s&&dg(t[0],t[1],s)&&(o=n<3?void 0:o,n=1),r=Object(r);++i<n;){var l=t[i];l&&e(r,l,i,o)}return r})}a(ug,"createAssigner");function cg(e){return function(r,t,i){for(var n=-1,o=Object(r),s=i(r),l=s.length;l--;){var h=s[e?l:++n];if(t(o[h],h,o)===!1)break}return r}}a(cg,"createBaseFor");function Zh(e,r,t,i,n,o){return Ut(e)&&Ut(r)&&(o.set(r,e),Ua(e,r,void 0,Zh,o),o.delete(r)),e}a(Zh,"customDefaultsMerge");function zo(e,r){var t=e.__data__;return mg(r)?t[typeof r=="string"?"string":"hash"]:t.map}a(zo,"getMapData");function Ha(e,r){var t=vy(e,r);return Qy(t)?t:void 0}a(Ha,"getNative");function hg(e){var r=Ht.call(e,Nr),t=e[Nr];try{e[Nr]=void 0;var i=!0}catch(o){}var n=Gh.call(e);return i&&(r?e[Nr]=t:delete e[Nr]),n}a(hg,"getRawTag");function pg(e){return typeof e.constructor=="function"&&!Hh(e)?Ey(Xh(e)):{}}a(pg,"initCloneObject");function Uh(e,r){var t=typeof e;return r=r==null?Oh:r,!!r&&(t=="number"||t!="symbol"&&fy.test(e))&&e>-1&&e%1==0&&e<r}a(Uh,"isIndex");function dg(e,r,t){if(!Ut(t))return!1;var i=typeof r;return(i=="number"?Wa(t)&&Uh(r,t.length):i=="string"&&r in t)?Yo(t[r],e):!1}a(dg,"isIterateeCall");function mg(e){var r=typeof e;return r=="string"||r=="number"||r=="symbol"||r=="boolean"?e!=="__proto__":e===null}a(mg,"isKeyable");function fg(e){return!!Ph&&Ph in e}a(fg,"isMasked");function Hh(e){var r=e&&e.constructor,t=typeof r=="function"&&r.prototype||Bo;return e===t}a(Hh,"isPrototype");function yg(e){var r=[];if(e!=null)for(var t in Object(e))r.push(t);return r}a(yg,"nativeKeysIn");function gg(e){return Gh.call(e)}a(gg,"objectToString");function bg(e,r,t){return r=Ih(r===void 0?e.length-1:r,0),function(){for(var i=arguments,n=-1,o=Ih(i.length-r,0),s=Array(o);++n<o;)s[n]=i[r+n];n=-1;for(var l=Array(r+1);++n<r;)l[n]=i[n];return l[r]=t(s),Fh(e,this,l)}}a(bg,"overRest");function Xa(e,r){if(!(r==="constructor"&&typeof e[r]=="function")&&r!="__proto__")return e[r]}a(Xa,"safeGet");var vg=xg(ig);function xg(e){var r=0,t=0;return function(){var i=Iy(),n=Xf-(i-t);if(t=i,n>0){if(++r>=Gf)return arguments[0]}else r=0;return e.apply(void 0,arguments)}}a(xg,"shortOut");function Sg(e){if(e!=null){try{return Fo.call(e)}catch(r){}try{return e+""}catch(r){}}return""}a(Sg,"toSource");function Yo(e,r){return e===r||e!==e&&r!==r}a(Yo,"eq");var za=Eh(function(){return arguments}())?Eh:function(e){return nn(e)&&Ht.call(e,"callee")&&!My.call(e,"callee")},Ya=Array.isArray;function Wa(e){return e!=null&&jh(e.length)&&!ja(e)}a(Wa,"isArrayLike");function Cg(e){return nn(e)&&Wa(e)}a(Cg,"isArrayLikeObject");var Wh=wy||Ig;function ja(e){if(!Ut(e))return!1;var r=Xo(e);return r==Ah||r==Wf||r==Yf||r==Jf}a(ja,"isFunction");function jh(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=Oh}a(jh,"isLength");function Ut(e){var r=typeof e;return e!=null&&(r=="object"||r=="function")}a(Ut,"isObject");function nn(e){return e!=null&&typeof e=="object"}a(nn,"isObjectLike");function Pg(e){if(!nn(e)||Xo(e)!=Rh)return!1;var r=Xh(e);if(r===null)return!0;var t=Ht.call(r,"constructor")&&r.constructor;return typeof t=="function"&&t instanceof t&&Fo.call(t)==Py}a(Pg,"isPlainObject");var Vh=Ch?by(Ch):eg;function Tg(e){return lg(e,qh(e))}a(Tg,"toPlainObject");var Mg=Yh(function(e){return e.push(void 0,Zh),Fh(_g,void 0,e)});function qh(e){return Wa(e)?Jy(e,!0):tg(e)}a(qh,"keysIn");var _g=ug(function(e,r,t,i){Ua(e,r,t,i)});function wg(e){return function(){return e}}a(wg,"constant");function Jh(e){return e}a(Jh,"identity");function Ig(){return!1}a(Ig,"stubFalse");yi.exports=Mg});var Bp=tr((on,vi)=>{x();var Xg=200,bp="__lodash_hash_undefined__",zg=800,Yg=16,vp=9007199254740991,xp="[object Arguments]",Zg="[object Array]",Ug="[object AsyncFunction]",Hg="[object Boolean]",Wg="[object Date]",jg="[object Error]",Sp="[object Function]",Vg="[object GeneratorFunction]",qg="[object Map]",Jg="[object Number]",$g="[object Null]",Cp="[object Object]",Kg="[object Proxy]",Qg="[object RegExp]",eb="[object Set]",tb="[object String]",rb="[object Undefined]",ib="[object WeakMap]",nb="[object ArrayBuffer]",ob="[object DataView]",sb="[object Float32Array]",ab="[object Float64Array]",lb="[object Int8Array]",ub="[object Int16Array]",cb="[object Int32Array]",hb="[object Uint8Array]",pb="[object Uint8ClampedArray]",db="[object Uint16Array]",mb="[object Uint32Array]",fb=/[\\^$.*+?()[\]{}|]/g,yb=/^\[object .+?Constructor\]$/,gb=/^(?:0|[1-9]\d*)$/,be={};be[sb]=be[ab]=be[lb]=be[ub]=be[cb]=be[hb]=be[pb]=be[db]=be[mb]=!0;be[xp]=be[Zg]=be[nb]=be[Hg]=be[ob]=be[Wg]=be[jg]=be[Sp]=be[qg]=be[Jg]=be[Cp]=be[Qg]=be[eb]=be[tb]=be[ib]=!1;var Pp=typeof global=="object"&&global&&global.Object===Object&&global,bb=typeof self=="object"&&self&&self.Object===Object&&self,ln=Pp||bb||Function("return this")(),Tp=typeof on=="object"&&on&&!on.nodeType&&on,sn=Tp&&typeof vi=="object"&&vi&&!vi.nodeType&&vi,Mp=sn&&sn.exports===Tp,$a=Mp&&Pp.process,up=function(){try{var e=sn&&sn.require&&sn.require("util").types;return e||$a&&$a.binding&&$a.binding("util")}catch(r){}}(),cp=up&&up.isTypedArray;function vb(e,r,t){switch(t.length){case 0:return e.call(r);case 1:return e.call(r,t[0]);case 2:return e.call(r,t[0],t[1]);case 3:return e.call(r,t[0],t[1],t[2])}return e.apply(r,t)}a(vb,"apply");function xb(e,r){for(var t=-1,i=Array(e);++t<e;)i[t]=r(t);return i}a(xb,"baseTimes");function Sb(e){return function(r){return e(r)}}a(Sb,"baseUnary");function Cb(e,r){return e==null?void 0:e[r]}a(Cb,"getValue");function Pb(e,r){return function(t){return e(r(t))}}a(Pb,"overArg");var Tb=Array.prototype,Mb=Function.prototype,Ho=Object.prototype,Ka=ln["__core-js_shared__"],Wo=Mb.toString,jt=Ho.hasOwnProperty,hp=function(){var e=/[^.]+$/.exec(Ka&&Ka.keys&&Ka.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),_p=Ho.toString,_b=Wo.call(Object),wb=RegExp("^"+Wo.call(jt).replace(fb,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Zo=Mp?ln.Buffer:void 0,pp=ln.Symbol,dp=ln.Uint8Array,mp=Zo?Zo.allocUnsafe:void 0,wp=Pb(Object.getPrototypeOf,Object),fp=Object.create,Ib=Ho.propertyIsEnumerable,Eb=Tb.splice,Gr=pp?pp.toStringTag:void 0,Uo=function(){try{var e=nl(Object,"defineProperty");return e({},"",{}),e}catch(r){}}(),Db=Zo?Zo.isBuffer:void 0,yp=Math.max,Ob=Date.now,Ip=nl(ln,"Map"),an=nl(Object,"create"),Lb=function(){function e(){}return a(e,"object"),function(r){if(!zr(r))return{};if(fp)return fp(r);e.prototype=r;var t=new e;return e.prototype=void 0,t}}();function Xr(e){var r=-1,t=e==null?0:e.length;for(this.clear();++r<t;){var i=e[r];this.set(i[0],i[1])}}a(Xr,"Hash");function Ab(){this.__data__=an?an(null):{},this.size=0}a(Ab,"hashClear");function Rb(e){var r=this.has(e)&&delete this.__data__[e];return this.size-=r?1:0,r}a(Rb,"hashDelete");function kb(e){var r=this.__data__;if(an){var t=r[e];return t===bp?void 0:t}return jt.call(r,e)?r[e]:void 0}a(kb,"hashGet");function Nb(e){var r=this.__data__;return an?r[e]!==void 0:jt.call(r,e)}a(Nb,"hashHas");function Bb(e,r){var t=this.__data__;return this.size+=this.has(e)?0:1,t[e]=an&&r===void 0?bp:r,this}a(Bb,"hashSet");Xr.prototype.clear=Ab;Xr.prototype.delete=Rb;Xr.prototype.get=kb;Xr.prototype.has=Nb;Xr.prototype.set=Bb;function Vt(e){var r=-1,t=e==null?0:e.length;for(this.clear();++r<t;){var i=e[r];this.set(i[0],i[1])}}a(Vt,"ListCache");function Fb(){this.__data__=[],this.size=0}a(Fb,"listCacheClear");function Gb(e){var r=this.__data__,t=jo(r,e);if(t<0)return!1;var i=r.length-1;return t==i?r.pop():Eb.call(r,t,1),--this.size,!0}a(Gb,"listCacheDelete");function Xb(e){var r=this.__data__,t=jo(r,e);return t<0?void 0:r[t][1]}a(Xb,"listCacheGet");function zb(e){return jo(this.__data__,e)>-1}a(zb,"listCacheHas");function Yb(e,r){var t=this.__data__,i=jo(t,e);return i<0?(++this.size,t.push([e,r])):t[i][1]=r,this}a(Yb,"listCacheSet");Vt.prototype.clear=Fb;Vt.prototype.delete=Gb;Vt.prototype.get=Xb;Vt.prototype.has=zb;Vt.prototype.set=Yb;function xi(e){var r=-1,t=e==null?0:e.length;for(this.clear();++r<t;){var i=e[r];this.set(i[0],i[1])}}a(xi,"MapCache");function Zb(){this.size=0,this.__data__={hash:new Xr,map:new(Ip||Vt),string:new Xr}}a(Zb,"mapCacheClear");function Ub(e){var r=qo(this,e).delete(e);return this.size-=r?1:0,r}a(Ub,"mapCacheDelete");function Hb(e){return qo(this,e).get(e)}a(Hb,"mapCacheGet");function Wb(e){return qo(this,e).has(e)}a(Wb,"mapCacheHas");function jb(e,r){var t=qo(this,e),i=t.size;return t.set(e,r),this.size+=t.size==i?0:1,this}a(jb,"mapCacheSet");xi.prototype.clear=Zb;xi.prototype.delete=Ub;xi.prototype.get=Hb;xi.prototype.has=Wb;xi.prototype.set=jb;function Si(e){var r=this.__data__=new Vt(e);this.size=r.size}a(Si,"Stack");function Vb(){this.__data__=new Vt,this.size=0}a(Vb,"stackClear");function qb(e){var r=this.__data__,t=r.delete(e);return this.size=r.size,t}a(qb,"stackDelete");function Jb(e){return this.__data__.get(e)}a(Jb,"stackGet");function $b(e){return this.__data__.has(e)}a($b,"stackHas");function Kb(e,r){var t=this.__data__;if(t instanceof Vt){var i=t.__data__;if(!Ip||i.length<Xg-1)return i.push([e,r]),this.size=++t.size,this;t=this.__data__=new xi(i)}return t.set(e,r),this.size=t.size,this}a(Kb,"stackSet");Si.prototype.clear=Vb;Si.prototype.delete=qb;Si.prototype.get=Jb;Si.prototype.has=$b;Si.prototype.set=Kb;function Qb(e,r){var t=rl(e),i=!t&&tl(e),n=!t&&!i&&Lp(e),o=!t&&!i&&!n&&Rp(e),s=t||i||n||o,l=s?xb(e.length,String):[],h=l.length;for(var p in e)(r||jt.call(e,p))&&!(s&&(p=="length"||n&&(p=="offset"||p=="parent")||o&&(p=="buffer"||p=="byteLength"||p=="byteOffset")||Dp(p,h)))&&l.push(p);return l}a(Qb,"arrayLikeKeys");function Qa(e,r,t){(t!==void 0&&!Jo(e[r],t)||t===void 0&&!(r in e))&&il(e,r,t)}a(Qa,"assignMergeValue");function ev(e,r,t){var i=e[r];(!(jt.call(e,r)&&Jo(i,t))||t===void 0&&!(r in e))&&il(e,r,t)}a(ev,"assignValue");function jo(e,r){for(var t=e.length;t--;)if(Jo(e[t][0],r))return t;return-1}a(jo,"assocIndexOf");function il(e,r,t){r=="__proto__"&&Uo?Uo(e,r,{configurable:!0,enumerable:!0,value:t,writable:!0}):e[r]=t}a(il,"baseAssignValue");var tv=mv();function Vo(e){return e==null?e===void 0?rb:$g:Gr&&Gr in Object(e)?fv(e):Sv(e)}a(Vo,"baseGetTag");function gp(e){return un(e)&&Vo(e)==xp}a(gp,"baseIsArguments");function rv(e){if(!zr(e)||vv(e))return!1;var r=sl(e)?wb:yb;return r.test(Mv(e))}a(rv,"baseIsNative");function iv(e){return un(e)&&Ap(e.length)&&!!be[Vo(e)]}a(iv,"baseIsTypedArray");function nv(e){if(!zr(e))return xv(e);var r=Op(e),t=[];for(var i in e)i=="constructor"&&(r||!jt.call(e,i))||t.push(i);return t}a(nv,"baseKeysIn");function Ep(e,r,t,i,n){e!==r&&tv(r,function(o,s){if(n||(n=new Si),zr(o))ov(e,r,s,t,Ep,i,n);else{var l=i?i(el(e,s),o,s+"",e,r,n):void 0;l===void 0&&(l=o),Qa(e,s,l)}},kp)}a(Ep,"baseMerge");function ov(e,r,t,i,n,o,s){var l=el(e,t),h=el(r,t),p=s.get(h);if(p){Qa(e,t,p);return}var m=o?o(l,h,t+"",e,r,s):void 0,f=m===void 0;if(f){var v=rl(h),y=!v&&Lp(h),C=!v&&!y&&Rp(h);m=h,v||y||C?rl(l)?m=l:_v(l)?m=hv(l):y?(f=!1,m=lv(h,!0)):C?(f=!1,m=cv(h,!0)):m=[]:wv(h)||tl(h)?(m=l,tl(l)?m=Iv(l):(!zr(l)||sl(l))&&(m=yv(h))):f=!1}f&&(s.set(h,m),n(m,h,i,o,s),s.delete(h)),Qa(e,t,m)}a(ov,"baseMergeDeep");function sv(e,r){return Pv(Cv(e,r,Np),e+"")}a(sv,"baseRest");var av=Uo?function(e,r){return Uo(e,"toString",{configurable:!0,enumerable:!1,value:Dv(r),writable:!0})}:Np;function lv(e,r){if(r)return e.slice();var t=e.length,i=mp?mp(t):new e.constructor(t);return e.copy(i),i}a(lv,"cloneBuffer");function uv(e){var r=new e.constructor(e.byteLength);return new dp(r).set(new dp(e)),r}a(uv,"cloneArrayBuffer");function cv(e,r){var t=r?uv(e.buffer):e.buffer;return new e.constructor(t,e.byteOffset,e.length)}a(cv,"cloneTypedArray");function hv(e,r){var t=-1,i=e.length;for(r||(r=Array(i));++t<i;)r[t]=e[t];return r}a(hv,"copyArray");function pv(e,r,t,i){var n=!t;t||(t={});for(var o=-1,s=r.length;++o<s;){var l=r[o],h=i?i(t[l],e[l],l,t,e):void 0;h===void 0&&(h=e[l]),n?il(t,l,h):ev(t,l,h)}return t}a(pv,"copyObject");function dv(e){return sv(function(r,t){var i=-1,n=t.length,o=n>1?t[n-1]:void 0,s=n>2?t[2]:void 0;for(o=e.length>3&&typeof o=="function"?(n--,o):void 0,s&&gv(t[0],t[1],s)&&(o=n<3?void 0:o,n=1),r=Object(r);++i<n;){var l=t[i];l&&e(r,l,i,o)}return r})}a(dv,"createAssigner");function mv(e){return function(r,t,i){for(var n=-1,o=Object(r),s=i(r),l=s.length;l--;){var h=s[e?l:++n];if(t(o[h],h,o)===!1)break}return r}}a(mv,"createBaseFor");function qo(e,r){var t=e.__data__;return bv(r)?t[typeof r=="string"?"string":"hash"]:t.map}a(qo,"getMapData");function nl(e,r){var t=Cb(e,r);return rv(t)?t:void 0}a(nl,"getNative");function fv(e){var r=jt.call(e,Gr),t=e[Gr];try{e[Gr]=void 0;var i=!0}catch(o){}var n=_p.call(e);return i&&(r?e[Gr]=t:delete e[Gr]),n}a(fv,"getRawTag");function yv(e){return typeof e.constructor=="function"&&!Op(e)?Lb(wp(e)):{}}a(yv,"initCloneObject");function Dp(e,r){var t=typeof e;return r=r==null?vp:r,!!r&&(t=="number"||t!="symbol"&&gb.test(e))&&e>-1&&e%1==0&&e<r}a(Dp,"isIndex");function gv(e,r,t){if(!zr(t))return!1;var i=typeof r;return(i=="number"?ol(t)&&Dp(r,t.length):i=="string"&&r in t)?Jo(t[r],e):!1}a(gv,"isIterateeCall");function bv(e){var r=typeof e;return r=="string"||r=="number"||r=="symbol"||r=="boolean"?e!=="__proto__":e===null}a(bv,"isKeyable");function vv(e){return!!hp&&hp in e}a(vv,"isMasked");function Op(e){var r=e&&e.constructor,t=typeof r=="function"&&r.prototype||Ho;return e===t}a(Op,"isPrototype");function xv(e){var r=[];if(e!=null)for(var t in Object(e))r.push(t);return r}a(xv,"nativeKeysIn");function Sv(e){return _p.call(e)}a(Sv,"objectToString");function Cv(e,r,t){return r=yp(r===void 0?e.length-1:r,0),function(){for(var i=arguments,n=-1,o=yp(i.length-r,0),s=Array(o);++n<o;)s[n]=i[r+n];n=-1;for(var l=Array(r+1);++n<r;)l[n]=i[n];return l[r]=t(s),vb(e,this,l)}}a(Cv,"overRest");function el(e,r){if(!(r==="constructor"&&typeof e[r]=="function")&&r!="__proto__")return e[r]}a(el,"safeGet");var Pv=Tv(av);function Tv(e){var r=0,t=0;return function(){var i=Ob(),n=Yg-(i-t);if(t=i,n>0){if(++r>=zg)return arguments[0]}else r=0;return e.apply(void 0,arguments)}}a(Tv,"shortOut");function Mv(e){if(e!=null){try{return Wo.call(e)}catch(r){}try{return e+""}catch(r){}}return""}a(Mv,"toSource");function Jo(e,r){return e===r||e!==e&&r!==r}a(Jo,"eq");var tl=gp(function(){return arguments}())?gp:function(e){return un(e)&&jt.call(e,"callee")&&!Ib.call(e,"callee")},rl=Array.isArray;function ol(e){return e!=null&&Ap(e.length)&&!sl(e)}a(ol,"isArrayLike");function _v(e){return un(e)&&ol(e)}a(_v,"isArrayLikeObject");var Lp=Db||Ov;function sl(e){if(!zr(e))return!1;var r=Vo(e);return r==Sp||r==Vg||r==Ug||r==Kg}a(sl,"isFunction");function Ap(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=vp}a(Ap,"isLength");function zr(e){var r=typeof e;return e!=null&&(r=="object"||r=="function")}a(zr,"isObject");function un(e){return e!=null&&typeof e=="object"}a(un,"isObjectLike");function wv(e){if(!un(e)||Vo(e)!=Cp)return!1;var r=wp(e);if(r===null)return!0;var t=jt.call(r,"constructor")&&r.constructor;return typeof t=="function"&&t instanceof t&&Wo.call(t)==_b}a(wv,"isPlainObject");var Rp=cp?Sb(cp):iv;function Iv(e){return pv(e,kp(e))}a(Iv,"toPlainObject");function kp(e){return ol(e)?Qb(e,!0):nv(e)}a(kp,"keysIn");var Ev=dv(function(e,r,t){Ep(e,r,t)});function Dv(e){return function(){return e}}a(Dv,"constant");function Np(e){return e}a(Np,"identity");function Ov(){return!1}a(Ov,"stubFalse");vi.exports=Ev});var Xd=tr((ZE,wn)=>{"use strict";x();var g0=!1,jr=!1,Ad=!0,Rd=!1,c={},kd=!1;typeof wn<"u"&&wn.exports?(wn.exports=c,kd=!0):typeof document<"u"?window.ClipperLib=c:self.ClipperLib=c;var Ts;kd?(Re="chrome",Ts="Netscape"):(Re=navigator.userAgent.toString().toLowerCase(),Ts=navigator.appName);var Re,te={};Re.indexOf("chrome")!=-1&&Re.indexOf("chromium")==-1?te.chrome=1:te.chrome=0;Re.indexOf("chromium")!=-1?te.chromium=1:te.chromium=0;Re.indexOf("safari")!=-1&&Re.indexOf("chrome")==-1&&Re.indexOf("chromium")==-1?te.safari=1:te.safari=0;Re.indexOf("firefox")!=-1?te.firefox=1:te.firefox=0;Re.indexOf("firefox/17")!=-1?te.firefox17=1:te.firefox17=0;Re.indexOf("firefox/15")!=-1?te.firefox15=1:te.firefox15=0;Re.indexOf("firefox/3")!=-1?te.firefox3=1:te.firefox3=0;Re.indexOf("opera")!=-1?te.opera=1:te.opera=0;Re.indexOf("msie 10")!=-1?te.msie10=1:te.msie10=0;Re.indexOf("msie 9")!=-1?te.msie9=1:te.msie9=0;Re.indexOf("msie 8")!=-1?te.msie8=1:te.msie8=0;Re.indexOf("msie 7")!=-1?te.msie7=1:te.msie7=0;Re.indexOf("msie ")!=-1?te.msie=1:te.msie=0;c.biginteger_used=null;var yr,b0=0xdeadbeefcafe,Od=(b0&16777215)==15715070;function N(e,r,t){c.biginteger_used=1,e!=null&&(typeof e=="number"&&typeof r>"u"?this.fromInt(e):typeof e=="number"?this.fromNumber(e,r,t):r==null&&typeof e!="string"?this.fromString(e,256):this.fromString(e,r))}a(N,"BigInteger");function oe(){return new N(null)}a(oe,"nbi");function v0(e,r,t,i,n,o){for(;--o>=0;){var s=r*this[e++]+t[i]+n;n=Math.floor(s/67108864),t[i++]=s&67108863}return n}a(v0,"am1");function x0(e,r,t,i,n,o){for(var s=r&32767,l=r>>15;--o>=0;){var h=this[e]&32767,p=this[e++]>>15,m=l*h+p*s;h=s*h+((m&32767)<<15)+t[i]+(n&1073741823),n=(h>>>30)+(m>>>15)+l*p+(n>>>30),t[i++]=h&1073741823}return n}a(x0,"am2");function S0(e,r,t,i,n,o){for(var s=r&16383,l=r>>14;--o>=0;){var h=this[e]&16383,p=this[e++]>>14,m=l*h+p*s;h=s*h+((m&16383)<<14)+t[i]+n,n=(h>>28)+(m>>14)+l*p,t[i++]=h&268435455}return n}a(S0,"am3");Od&&Ts=="Microsoft Internet Explorer"?(N.prototype.am=x0,yr=30):Od&&Ts!="Netscape"?(N.prototype.am=v0,yr=26):(N.prototype.am=S0,yr=28);N.prototype.DB=yr;N.prototype.DM=(1<<yr)-1;N.prototype.DV=1<<yr;var Kl=52;N.prototype.FV=Math.pow(2,Kl);N.prototype.F1=Kl-yr;N.prototype.F2=2*yr-Kl;var C0="0123456789abcdefghijklmnopqrstuvwxyz",_s=new Array,Oi,dt;Oi=48;for(dt=0;dt<=9;++dt)_s[Oi++]=dt;Oi=97;for(dt=10;dt<36;++dt)_s[Oi++]=dt;Oi=65;for(dt=10;dt<36;++dt)_s[Oi++]=dt;function Ld(e){return C0.charAt(e)}a(Ld,"int2char");function Nd(e,r){var t=_s[e.charCodeAt(r)];return t==null?-1:t}a(Nd,"intAt");function P0(e){for(var r=this.t-1;r>=0;--r)e[r]=this[r];e.t=this.t,e.s=this.s}a(P0,"bnpCopyTo");function T0(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}a(T0,"bnpFromInt");function fr(e){var r=oe();return r.fromInt(e),r}a(fr,"nbv");function M0(e,r){var t;if(r==16)t=4;else if(r==8)t=3;else if(r==256)t=8;else if(r==2)t=1;else if(r==32)t=5;else if(r==4)t=2;else{this.fromRadix(e,r);return}this.t=0,this.s=0;for(var i=e.length,n=!1,o=0;--i>=0;){var s=t==8?e[i]&255:Nd(e,i);if(s<0){e.charAt(i)=="-"&&(n=!0);continue}n=!1,o==0?this[this.t++]=s:o+t>this.DB?(this[this.t-1]|=(s&(1<<this.DB-o)-1)<<o,this[this.t++]=s>>this.DB-o):this[this.t-1]|=s<<o,o+=t,o>=this.DB&&(o-=this.DB)}t==8&&(e[0]&128)!=0&&(this.s=-1,o>0&&(this[this.t-1]|=(1<<this.DB-o)-1<<o)),this.clamp(),n&&N.ZERO.subTo(this,this)}a(M0,"bnpFromString");function _0(){for(var e=this.s&this.DM;this.t>0&&this[this.t-1]==e;)--this.t}a(_0,"bnpClamp");function w0(e){if(this.s<0)return"-"+this.negate().toString(e);var r;if(e==16)r=4;else if(e==8)r=3;else if(e==2)r=1;else if(e==32)r=5;else if(e==4)r=2;else return this.toRadix(e);var t=(1<<r)-1,i,n=!1,o="",s=this.t,l=this.DB-s*this.DB%r;if(s-- >0)for(l<this.DB&&(i=this[s]>>l)>0&&(n=!0,o=Ld(i));s>=0;)l<r?(i=(this[s]&(1<<l)-1)<<r-l,i|=this[--s]>>(l+=this.DB-r)):(i=this[s]>>(l-=r)&t,l<=0&&(l+=this.DB,--s)),i>0&&(n=!0),n&&(o+=Ld(i));return n?o:"0"}a(w0,"bnToString");function I0(){var e=oe();return N.ZERO.subTo(this,e),e}a(I0,"bnNegate");function E0(){return this.s<0?this.negate():this}a(E0,"bnAbs");function D0(e){var r=this.s-e.s;if(r!=0)return r;var t=this.t;if(r=t-e.t,r!=0)return this.s<0?-r:r;for(;--t>=0;)if((r=this[t]-e[t])!=0)return r;return 0}a(D0,"bnCompareTo");function ws(e){var r=1,t;return(t=e>>>16)!=0&&(e=t,r+=16),(t=e>>8)!=0&&(e=t,r+=8),(t=e>>4)!=0&&(e=t,r+=4),(t=e>>2)!=0&&(e=t,r+=2),(t=e>>1)!=0&&(e=t,r+=1),r}a(ws,"nbits");function O0(){return this.t<=0?0:this.DB*(this.t-1)+ws(this[this.t-1]^this.s&this.DM)}a(O0,"bnBitLength");function L0(e,r){var t;for(t=this.t-1;t>=0;--t)r[t+e]=this[t];for(t=e-1;t>=0;--t)r[t]=0;r.t=this.t+e,r.s=this.s}a(L0,"bnpDLShiftTo");function A0(e,r){for(var t=e;t<this.t;++t)r[t-e]=this[t];r.t=Math.max(this.t-e,0),r.s=this.s}a(A0,"bnpDRShiftTo");function R0(e,r){var t=e%this.DB,i=this.DB-t,n=(1<<i)-1,o=Math.floor(e/this.DB),s=this.s<<t&this.DM,l;for(l=this.t-1;l>=0;--l)r[l+o+1]=this[l]>>i|s,s=(this[l]&n)<<t;for(l=o-1;l>=0;--l)r[l]=0;r[o]=s,r.t=this.t+o+1,r.s=this.s,r.clamp()}a(R0,"bnpLShiftTo");function k0(e,r){r.s=this.s;var t=Math.floor(e/this.DB);if(t>=this.t){r.t=0;return}var i=e%this.DB,n=this.DB-i,o=(1<<i)-1;r[0]=this[t]>>i;for(var s=t+1;s<this.t;++s)r[s-t-1]|=(this[s]&o)<<n,r[s-t]=this[s]>>i;i>0&&(r[this.t-t-1]|=(this.s&o)<<n),r.t=this.t-t,r.clamp()}a(k0,"bnpRShiftTo");function N0(e,r){for(var t=0,i=0,n=Math.min(e.t,this.t);t<n;)i+=this[t]-e[t],r[t++]=i&this.DM,i>>=this.DB;if(e.t<this.t){for(i-=e.s;t<this.t;)i+=this[t],r[t++]=i&this.DM,i>>=this.DB;i+=this.s}else{for(i+=this.s;t<e.t;)i-=e[t],r[t++]=i&this.DM,i>>=this.DB;i-=e.s}r.s=i<0?-1:0,i<-1?r[t++]=this.DV+i:i>0&&(r[t++]=i),r.t=t,r.clamp()}a(N0,"bnpSubTo");function B0(e,r){var t=this.abs(),i=e.abs(),n=t.t;for(r.t=n+i.t;--n>=0;)r[n]=0;for(n=0;n<i.t;++n)r[n+t.t]=t.am(0,i[n],r,n,0,t.t);r.s=0,r.clamp(),this.s!=e.s&&N.ZERO.subTo(r,r)}a(B0,"bnpMultiplyTo");function F0(e){for(var r=this.abs(),t=e.t=2*r.t;--t>=0;)e[t]=0;for(t=0;t<r.t-1;++t){var i=r.am(t,r[t],e,2*t,0,1);(e[t+r.t]+=r.am(t+1,2*r[t],e,2*t+1,i,r.t-t-1))>=r.DV&&(e[t+r.t]-=r.DV,e[t+r.t+1]=1)}e.t>0&&(e[e.t-1]+=r.am(t,r[t],e,2*t,0,1)),e.s=0,e.clamp()}a(F0,"bnpSquareTo");function G0(e,r,t){var i=e.abs();if(!(i.t<=0)){var n=this.abs();if(n.t<i.t){r!=null&&r.fromInt(0),t!=null&&this.copyTo(t);return}t==null&&(t=oe());var o=oe(),s=this.s,l=e.s,h=this.DB-ws(i[i.t-1]);h>0?(i.lShiftTo(h,o),n.lShiftTo(h,t)):(i.copyTo(o),n.copyTo(t));var p=o.t,m=o[p-1];if(m!=0){var f=m*(1<<this.F1)+(p>1?o[p-2]>>this.F2:0),v=this.FV/f,y=(1<<this.F1)/f,C=1<<this.F2,M=t.t,g=M-p,b=r==null?oe():r;for(o.dlShiftTo(g,b),t.compareTo(b)>=0&&(t[t.t++]=1,t.subTo(b,t)),N.ONE.dlShiftTo(p,b),b.subTo(o,o);o.t<p;)o[o.t++]=0;for(;--g>=0;){var P=t[--M]==m?this.DM:Math.floor(t[M]*v+(t[M-1]+C)*y);if((t[M]+=o.am(0,P,t,g,0,p))<P)for(o.dlShiftTo(g,b),t.subTo(b,t);t[M]<--P;)t.subTo(b,t)}r!=null&&(t.drShiftTo(p,r),s!=l&&N.ZERO.subTo(r,r)),t.t=p,t.clamp(),h>0&&t.rShiftTo(h,t),s<0&&N.ZERO.subTo(t,t)}}}a(G0,"bnpDivRemTo");function X0(e){var r=oe();return this.abs().divRemTo(e,null,r),this.s<0&&r.compareTo(N.ZERO)>0&&e.subTo(r,r),r}a(X0,"bnMod");function Vr(e){this.m=e}a(Vr,"Classic");function z0(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e}a(z0,"cConvert");function Y0(e){return e}a(Y0,"cRevert");function Z0(e){e.divRemTo(this.m,null,e)}a(Z0,"cReduce");function U0(e,r,t){e.multiplyTo(r,t),this.reduce(t)}a(U0,"cMulTo");function H0(e,r){e.squareTo(r),this.reduce(r)}a(H0,"cSqrTo");Vr.prototype.convert=z0;Vr.prototype.revert=Y0;Vr.prototype.reduce=Z0;Vr.prototype.mulTo=U0;Vr.prototype.sqrTo=H0;function W0(){if(this.t<1)return 0;var e=this[0];if((e&1)==0)return 0;var r=e&3;return r=r*(2-(e&15)*r)&15,r=r*(2-(e&255)*r)&255,r=r*(2-((e&65535)*r&65535))&65535,r=r*(2-e*r%this.DV)%this.DV,r>0?this.DV-r:-r}a(W0,"bnpInvDigit");function qr(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}a(qr,"Montgomery");function j0(e){var r=oe();return e.abs().dlShiftTo(this.m.t,r),r.divRemTo(this.m,null,r),e.s<0&&r.compareTo(N.ZERO)>0&&this.m.subTo(r,r),r}a(j0,"montConvert");function V0(e){var r=oe();return e.copyTo(r),this.reduce(r),r}a(V0,"montRevert");function q0(e){for(;e.t<=this.mt2;)e[e.t++]=0;for(var r=0;r<this.m.t;++r){var t=e[r]&32767,i=t*this.mpl+((t*this.mph+(e[r]>>15)*this.mpl&this.um)<<15)&e.DM;for(t=r+this.m.t,e[t]+=this.m.am(0,i,e,r,0,this.m.t);e[t]>=e.DV;)e[t]-=e.DV,e[++t]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)}a(q0,"montReduce");function J0(e,r){e.squareTo(r),this.reduce(r)}a(J0,"montSqrTo");function $0(e,r,t){e.multiplyTo(r,t),this.reduce(t)}a($0,"montMulTo");qr.prototype.convert=j0;qr.prototype.revert=V0;qr.prototype.reduce=q0;qr.prototype.mulTo=$0;qr.prototype.sqrTo=J0;function K0(){return(this.t>0?this[0]&1:this.s)==0}a(K0,"bnpIsEven");function Q0(e,r){if(e>4294967295||e<1)return N.ONE;var t=oe(),i=oe(),n=r.convert(this),o=ws(e)-1;for(n.copyTo(t);--o>=0;)if(r.sqrTo(t,i),(e&1<<o)>0)r.mulTo(i,n,t);else{var s=t;t=i,i=s}return r.revert(t)}a(Q0,"bnpExp");function ex(e,r){var t;return e<256||r.isEven()?t=new Vr(r):t=new qr(r),this.exp(e,t)}a(ex,"bnModPowInt");N.prototype.copyTo=P0;N.prototype.fromInt=T0;N.prototype.fromString=M0;N.prototype.clamp=_0;N.prototype.dlShiftTo=L0;N.prototype.drShiftTo=A0;N.prototype.lShiftTo=R0;N.prototype.rShiftTo=k0;N.prototype.subTo=N0;N.prototype.multiplyTo=B0;N.prototype.squareTo=F0;N.prototype.divRemTo=G0;N.prototype.invDigit=W0;N.prototype.isEven=K0;N.prototype.exp=Q0;N.prototype.toString=w0;N.prototype.negate=I0;N.prototype.abs=E0;N.prototype.compareTo=D0;N.prototype.bitLength=O0;N.prototype.mod=X0;N.prototype.modPowInt=ex;N.ZERO=fr(0);N.ONE=fr(1);function tx(){var e=oe();return this.copyTo(e),e}a(tx,"bnClone");function rx(){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]}a(rx,"bnIntValue");function ix(){return this.t==0?this.s:this[0]<<24>>24}a(ix,"bnByteValue");function nx(){return this.t==0?this.s:this[0]<<16>>16}a(nx,"bnShortValue");function ox(e){return Math.floor(Math.LN2*this.DB/Math.log(e))}a(ox,"bnpChunkSize");function sx(){return this.s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1}a(sx,"bnSigNum");function ax(e){if(e==null&&(e=10),this.signum()==0||e<2||e>36)return"0";var r=this.chunkSize(e),t=Math.pow(e,r),i=fr(t),n=oe(),o=oe(),s="";for(this.divRemTo(i,n,o);n.signum()>0;)s=(t+o.intValue()).toString(e).substr(1)+s,n.divRemTo(i,n,o);return o.intValue().toString(e)+s}a(ax,"bnpToRadix");function lx(e,r){this.fromInt(0),r==null&&(r=10);for(var t=this.chunkSize(r),i=Math.pow(r,t),n=!1,o=0,s=0,l=0;l<e.length;++l){var h=Nd(e,l);if(h<0){e.charAt(l)=="-"&&this.signum()==0&&(n=!0);continue}s=r*s+h,++o>=t&&(this.dMultiply(i),this.dAddOffset(s,0),o=0,s=0)}o>0&&(this.dMultiply(Math.pow(r,o)),this.dAddOffset(s,0)),n&&N.ZERO.subTo(this,this)}a(lx,"bnpFromRadix");function ux(e,r,t){if(typeof r=="number")if(e<2)this.fromInt(1);else for(this.fromNumber(e,t),this.testBit(e-1)||this.bitwiseTo(N.ONE.shiftLeft(e-1),Ql,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(r);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(N.ONE.shiftLeft(e-1),this);else{var i=new Array,n=e&7;i.length=(e>>3)+1,r.nextBytes(i),n>0?i[0]&=(1<<n)-1:i[0]=0,this.fromString(i,256)}}a(ux,"bnpFromNumber");function cx(){var e=this.t,r=new Array;r[0]=this.s;var t=this.DB-e*this.DB%8,i,n=0;if(e-- >0)for(t<this.DB&&(i=this[e]>>t)!=(this.s&this.DM)>>t&&(r[n++]=i|this.s<<this.DB-t);e>=0;)t<8?(i=(this[e]&(1<<t)-1)<<8-t,i|=this[--e]>>(t+=this.DB-8)):(i=this[e]>>(t-=8)&255,t<=0&&(t+=this.DB,--e)),(i&128)!=0&&(i|=-256),n==0&&(this.s&128)!=(i&128)&&++n,(n>0||i!=this.s)&&(r[n++]=i);return r}a(cx,"bnToByteArray");function hx(e){return this.compareTo(e)==0}a(hx,"bnEquals");function px(e){return this.compareTo(e)<0?this:e}a(px,"bnMin");function dx(e){return this.compareTo(e)>0?this:e}a(dx,"bnMax");function mx(e,r,t){var i,n,o=Math.min(e.t,this.t);for(i=0;i<o;++i)t[i]=r(this[i],e[i]);if(e.t<this.t){for(n=e.s&this.DM,i=o;i<this.t;++i)t[i]=r(this[i],n);t.t=this.t}else{for(n=this.s&this.DM,i=o;i<e.t;++i)t[i]=r(n,e[i]);t.t=e.t}t.s=r(this.s,e.s),t.clamp()}a(mx,"bnpBitwiseTo");function fx(e,r){return e&r}a(fx,"op_and");function yx(e){var r=oe();return this.bitwiseTo(e,fx,r),r}a(yx,"bnAnd");function Ql(e,r){return e|r}a(Ql,"op_or");function gx(e){var r=oe();return this.bitwiseTo(e,Ql,r),r}a(gx,"bnOr");function Bd(e,r){return e^r}a(Bd,"op_xor");function bx(e){var r=oe();return this.bitwiseTo(e,Bd,r),r}a(bx,"bnXor");function Fd(e,r){return e&~r}a(Fd,"op_andnot");function vx(e){var r=oe();return this.bitwiseTo(e,Fd,r),r}a(vx,"bnAndNot");function xx(){for(var e=oe(),r=0;r<this.t;++r)e[r]=this.DM&~this[r];return e.t=this.t,e.s=~this.s,e}a(xx,"bnNot");function Sx(e){var r=oe();return e<0?this.rShiftTo(-e,r):this.lShiftTo(e,r),r}a(Sx,"bnShiftLeft");function Cx(e){var r=oe();return e<0?this.lShiftTo(-e,r):this.rShiftTo(e,r),r}a(Cx,"bnShiftRight");function Px(e){if(e==0)return-1;var r=0;return(e&65535)==0&&(e>>=16,r+=16),(e&255)==0&&(e>>=8,r+=8),(e&15)==0&&(e>>=4,r+=4),(e&3)==0&&(e>>=2,r+=2),(e&1)==0&&++r,r}a(Px,"lbit");function Tx(){for(var e=0;e<this.t;++e)if(this[e]!=0)return e*this.DB+Px(this[e]);return this.s<0?this.t*this.DB:-1}a(Tx,"bnGetLowestSetBit");function Mx(e){for(var r=0;e!=0;)e&=e-1,++r;return r}a(Mx,"cbit");function _x(){for(var e=0,r=this.s&this.DM,t=0;t<this.t;++t)e+=Mx(this[t]^r);return e}a(_x,"bnBitCount");function wx(e){var r=Math.floor(e/this.DB);return r>=this.t?this.s!=0:(this[r]&1<<e%this.DB)!=0}a(wx,"bnTestBit");function Ix(e,r){var t=N.ONE.shiftLeft(e);return this.bitwiseTo(t,r,t),t}a(Ix,"bnpChangeBit");function Ex(e){return this.changeBit(e,Ql)}a(Ex,"bnSetBit");function Dx(e){return this.changeBit(e,Fd)}a(Dx,"bnClearBit");function Ox(e){return this.changeBit(e,Bd)}a(Ox,"bnFlipBit");function Lx(e,r){for(var t=0,i=0,n=Math.min(e.t,this.t);t<n;)i+=this[t]+e[t],r[t++]=i&this.DM,i>>=this.DB;if(e.t<this.t){for(i+=e.s;t<this.t;)i+=this[t],r[t++]=i&this.DM,i>>=this.DB;i+=this.s}else{for(i+=this.s;t<e.t;)i+=e[t],r[t++]=i&this.DM,i>>=this.DB;i+=e.s}r.s=i<0?-1:0,i>0?r[t++]=i:i<-1&&(r[t++]=this.DV+i),r.t=t,r.clamp()}a(Lx,"bnpAddTo");function Ax(e){var r=oe();return this.addTo(e,r),r}a(Ax,"bnAdd");function Rx(e){var r=oe();return this.subTo(e,r),r}a(Rx,"bnSubtract");function kx(e){var r=oe();return this.multiplyTo(e,r),r}a(kx,"bnMultiply");function Nx(){var e=oe();return this.squareTo(e),e}a(Nx,"bnSquare");function Bx(e){var r=oe();return this.divRemTo(e,r,null),r}a(Bx,"bnDivide");function Fx(e){var r=oe();return this.divRemTo(e,null,r),r}a(Fx,"bnRemainder");function Gx(e){var r=oe(),t=oe();return this.divRemTo(e,r,t),new Array(r,t)}a(Gx,"bnDivideAndRemainder");function Xx(e){this[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()}a(Xx,"bnpDMultiply");function zx(e,r){if(e!=0){for(;this.t<=r;)this[this.t++]=0;for(this[r]+=e;this[r]>=this.DV;)this[r]-=this.DV,++r>=this.t&&(this[this.t++]=0),++this[r]}}a(zx,"bnpDAddOffset");function In(){}a(In,"NullExp");function Gd(e){return e}a(Gd,"nNop");function Yx(e,r,t){e.multiplyTo(r,t)}a(Yx,"nMulTo");function Zx(e,r){e.squareTo(r)}a(Zx,"nSqrTo");In.prototype.convert=Gd;In.prototype.revert=Gd;In.prototype.mulTo=Yx;In.prototype.sqrTo=Zx;function Ux(e){return this.exp(e,new In)}a(Ux,"bnPow");function Hx(e,r,t){var i=Math.min(this.t+e.t,r);for(t.s=0,t.t=i;i>0;)t[--i]=0;var n;for(n=t.t-this.t;i<n;++i)t[i+this.t]=this.am(0,e[i],t,i,0,this.t);for(n=Math.min(e.t,r);i<n;++i)this.am(0,e[i],t,i,0,r-i);t.clamp()}a(Hx,"bnpMultiplyLowerTo");function Wx(e,r,t){--r;var i=t.t=this.t+e.t-r;for(t.s=0;--i>=0;)t[i]=0;for(i=Math.max(r-this.t,0);i<e.t;++i)t[this.t+i-r]=this.am(r-i,e[i],t,0,0,this.t+i-r);t.clamp(),t.drShiftTo(1,t)}a(Wx,"bnpMultiplyUpperTo");function Li(e){this.r2=oe(),this.q3=oe(),N.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e),this.m=e}a(Li,"Barrett");function jx(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 r=oe();return e.copyTo(r),this.reduce(r),r}a(jx,"barrettConvert");function Vx(e){return e}a(Vx,"barrettRevert");function qx(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)}a(qx,"barrettReduce");function Jx(e,r){e.squareTo(r),this.reduce(r)}a(Jx,"barrettSqrTo");function $x(e,r,t){e.multiplyTo(r,t),this.reduce(t)}a($x,"barrettMulTo");Li.prototype.convert=jx;Li.prototype.revert=Vx;Li.prototype.reduce=qx;Li.prototype.mulTo=$x;Li.prototype.sqrTo=Jx;function Kx(e,r){var t=e.bitLength(),i,n=fr(1),o;if(t<=0)return n;t<18?i=1:t<48?i=3:t<144?i=4:t<768?i=5:i=6,t<8?o=new Vr(r):r.isEven()?o=new Li(r):o=new qr(r);var s=new Array,l=3,h=i-1,p=(1<<i)-1;if(s[1]=o.convert(this),i>1){var m=oe();for(o.sqrTo(s[1],m);l<=p;)s[l]=oe(),o.mulTo(m,s[l-2],s[l]),l+=2}var f=e.t-1,v,y=!0,C=oe(),M;for(t=ws(e[f])-1;f>=0;){for(t>=h?v=e[f]>>t-h&p:(v=(e[f]&(1<<t+1)-1)<<h-t,f>0&&(v|=e[f-1]>>this.DB+t-h)),l=i;(v&1)==0;)v>>=1,--l;if((t-=l)<0&&(t+=this.DB,--f),y)s[v].copyTo(n),y=!1;else{for(;l>1;)o.sqrTo(n,C),o.sqrTo(C,n),l-=2;l>0?o.sqrTo(n,C):(M=n,n=C,C=M),o.mulTo(C,s[v],n)}for(;f>=0&&(e[f]&1<<t)==0;)o.sqrTo(n,C),M=n,n=C,C=M,--t<0&&(t=this.DB-1,--f)}return o.revert(n)}a(Kx,"bnModPow");function Qx(e){var r=this.s<0?this.negate():this.clone(),t=e.s<0?e.negate():e.clone();if(r.compareTo(t)<0){var i=r;r=t,t=i}var n=r.getLowestSetBit(),o=t.getLowestSetBit();if(o<0)return r;for(n<o&&(o=n),o>0&&(r.rShiftTo(o,r),t.rShiftTo(o,t));r.signum()>0;)(n=r.getLowestSetBit())>0&&r.rShiftTo(n,r),(n=t.getLowestSetBit())>0&&t.rShiftTo(n,t),r.compareTo(t)>=0?(r.subTo(t,r),r.rShiftTo(1,r)):(t.subTo(r,t),t.rShiftTo(1,t));return o>0&&t.lShiftTo(o,t),t}a(Qx,"bnGCD");function eS(e){if(e<=0)return 0;var r=this.DV%e,t=this.s<0?e-1:0;if(this.t>0)if(r==0)t=this[0]%e;else for(var i=this.t-1;i>=0;--i)t=(r*t+this[i])%e;return t}a(eS,"bnpModInt");function tS(e){var r=e.isEven();if(this.isEven()&&r||e.signum()==0)return N.ZERO;for(var t=e.clone(),i=this.clone(),n=fr(1),o=fr(0),s=fr(0),l=fr(1);t.signum()!=0;){for(;t.isEven();)t.rShiftTo(1,t),r?((!n.isEven()||!o.isEven())&&(n.addTo(this,n),o.subTo(e,o)),n.rShiftTo(1,n)):o.isEven()||o.subTo(e,o),o.rShiftTo(1,o);for(;i.isEven();)i.rShiftTo(1,i),r?((!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);t.compareTo(i)>=0?(t.subTo(i,t),r&&n.subTo(s,n),o.subTo(l,o)):(i.subTo(t,i),r&&s.subTo(n,s),l.subTo(o,l))}if(i.compareTo(N.ONE)!=0)return N.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}a(tS,"bnModInverse");var Ke=[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],rS=(1<<26)/Ke[Ke.length-1];function iS(e){var r,t=this.abs();if(t.t==1&&t[0]<=Ke[Ke.length-1]){for(r=0;r<Ke.length;++r)if(t[0]==Ke[r])return!0;return!1}if(t.isEven())return!1;for(r=1;r<Ke.length;){for(var i=Ke[r],n=r+1;n<Ke.length&&i<rS;)i*=Ke[n++];for(i=t.modInt(i);r<n;)if(i%Ke[r++]==0)return!1}return t.millerRabin(e)}a(iS,"bnIsProbablePrime");function nS(e){var r=this.subtract(N.ONE),t=r.getLowestSetBit();if(t<=0)return!1;var i=r.shiftRight(t);e=e+1>>1,e>Ke.length&&(e=Ke.length);for(var n=oe(),o=0;o<e;++o){n.fromInt(Ke[Math.floor(Math.random()*Ke.length)]);var s=n.modPow(i,this);if(s.compareTo(N.ONE)!=0&&s.compareTo(r)!=0){for(var l=1;l++<t&&s.compareTo(r)!=0;)if(s=s.modPowInt(2,this),s.compareTo(N.ONE)==0)return!1;if(s.compareTo(r)!=0)return!1}}return!0}a(nS,"bnpMillerRabin");N.prototype.chunkSize=ox;N.prototype.toRadix=ax;N.prototype.fromRadix=lx;N.prototype.fromNumber=ux;N.prototype.bitwiseTo=mx;N.prototype.changeBit=Ix;N.prototype.addTo=Lx;N.prototype.dMultiply=Xx;N.prototype.dAddOffset=zx;N.prototype.multiplyLowerTo=Hx;N.prototype.multiplyUpperTo=Wx;N.prototype.modInt=eS;N.prototype.millerRabin=nS;N.prototype.clone=tx;N.prototype.intValue=rx;N.prototype.byteValue=ix;N.prototype.shortValue=nx;N.prototype.signum=sx;N.prototype.toByteArray=cx;N.prototype.equals=hx;N.prototype.min=px;N.prototype.max=dx;N.prototype.and=yx;N.prototype.or=gx;N.prototype.xor=bx;N.prototype.andNot=vx;N.prototype.not=xx;N.prototype.shiftLeft=Sx;N.prototype.shiftRight=Cx;N.prototype.getLowestSetBit=Tx;N.prototype.bitCount=_x;N.prototype.testBit=wx;N.prototype.setBit=Ex;N.prototype.clearBit=Dx;N.prototype.flipBit=Ox;N.prototype.add=Ax;N.prototype.subtract=Rx;N.prototype.multiply=kx;N.prototype.divide=Bx;N.prototype.remainder=Fx;N.prototype.divideAndRemainder=Gx;N.prototype.modPow=Kx;N.prototype.modInverse=tS;N.prototype.pow=Ux;N.prototype.gcd=Qx;N.prototype.isProbablePrime=iS;N.prototype.square=Nx;var Q=N;Q.prototype.IsNegative=function(){return this.compareTo(Q.ZERO)==-1};Q.op_Equality=function(e,r){return e.compareTo(r)==0};Q.op_Inequality=function(e,r){return e.compareTo(r)!=0};Q.op_GreaterThan=function(e,r){return e.compareTo(r)>0};Q.op_LessThan=function(e,r){return e.compareTo(r)<0};Q.op_Addition=function(e,r){return new Q(e).add(new Q(r))};Q.op_Subtraction=function(e,r){return new Q(e).subtract(new Q(r))};Q.Int128Mul=function(e,r){return new Q(e).multiply(new Q(r))};Q.op_Division=function(e,r){return e.divide(r)};Q.prototype.ToDouble=function(){return parseFloat(this.toString())};typeof Ms>"u"&&(Ms=a(function(e,r){var t;if(typeof Object.getOwnPropertyNames>"u"){for(t in r.prototype)(typeof e.prototype[t]>"u"||e.prototype[t]==Object.prototype[t])&&(e.prototype[t]=r.prototype[t]);for(t in r)typeof e[t]>"u"&&(e[t]=r[t]);e.$baseCtor=r}else{for(var i=Object.getOwnPropertyNames(r.prototype),n=0;n<i.length;n++)typeof Object.getOwnPropertyDescriptor(e.prototype,i[n])>"u"&&Object.defineProperty(e.prototype,i[n],Object.getOwnPropertyDescriptor(r.prototype,i[n]));for(t in r)typeof e[t]>"u"&&(e[t]=r[t]);e.$baseCtor=r}},"Inherit"));var Ms;c.Path=function(){return[]};c.Paths=function(){return[]};c.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])};c.DoublePoint0=function(){this.X=0,this.Y=0};c.DoublePoint1=function(e){this.X=e.X,this.Y=e.Y};c.DoublePoint2=function(e,r){this.X=e,this.Y=r};c.PolyNode=function(){this.m_Parent=null,this.m_polygon=new c.Path,this.m_Index=0,this.m_jointype=0,this.m_endtype=0,this.m_Childs=[],this.IsOpen=!1};c.PolyNode.prototype.IsHoleNode=function(){for(var e=!0,r=this.m_Parent;r!==null;)e=!e,r=r.m_Parent;return e};c.PolyNode.prototype.ChildCount=function(){return this.m_Childs.length};c.PolyNode.prototype.Contour=function(){return this.m_polygon};c.PolyNode.prototype.AddChild=function(e){var r=this.m_Childs.length;this.m_Childs.push(e),e.m_Parent=this,e.m_Index=r};c.PolyNode.prototype.GetNext=function(){return this.m_Childs.length>0?this.m_Childs[0]:this.GetNextSiblingUp()};c.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]};c.PolyNode.prototype.Childs=function(){return this.m_Childs};c.PolyNode.prototype.Parent=function(){return this.m_Parent};c.PolyNode.prototype.IsHole=function(){return this.IsHoleNode()};c.PolyTree=function(){this.m_AllPolys=[],c.PolyNode.call(this)};c.PolyTree.prototype.Clear=function(){for(var e=0,r=this.m_AllPolys.length;e<r;e++)this.m_AllPolys[e]=null;this.m_AllPolys.length=0,this.m_Childs.length=0};c.PolyTree.prototype.GetFirst=function(){return this.m_Childs.length>0?this.m_Childs[0]:null};c.PolyTree.prototype.Total=function(){return this.m_AllPolys.length};Ms(c.PolyTree,c.PolyNode);c.Math_Abs_Int64=c.Math_Abs_Int32=c.Math_Abs_Double=function(e){return Math.abs(e)};c.Math_Max_Int32_Int32=function(e,r){return Math.max(e,r)};te.msie||te.opera||te.safari?c.Cast_Int32=function(e){return e|0}:c.Cast_Int32=function(e){return~~e};te.chrome?c.Cast_Int64=function(e){return e<-2147483648||e>2147483647?e<0?Math.ceil(e):Math.floor(e):~~e}:te.firefox&&typeof Number.toInteger=="function"?c.Cast_Int64=function(e){return Number.toInteger(e)}:te.msie7||te.msie8?c.Cast_Int64=function(e){return parseInt(e,10)}:te.msie?c.Cast_Int64=function(e){return e<-2147483648||e>2147483647?e<0?Math.ceil(e):Math.floor(e):e|0}:c.Cast_Int64=function(e){return e<0?Math.ceil(e):Math.floor(e)};c.Clear=function(e){e.length=0};c.PI=3.141592653589793;c.PI2=2*3.141592653589793;c.IntPoint=function(){var e=arguments,r=e.length;if(this.X=0,this.Y=0,jr)if(this.Z=0,r==3)this.X=e[0],this.Y=e[1],this.Z=e[2];else if(r==2)this.X=e[0],this.Y=e[1],this.Z=0;else if(r==1)if(e[0]instanceof c.DoublePoint){var t=e[0];this.X=c.Clipper.Round(t.X),this.Y=c.Clipper.Round(t.Y),this.Z=0}else{var i=e[0];typeof i.Z>"u"&&(i.Z=0),this.X=i.X,this.Y=i.Y,this.Z=i.Z}else this.X=0,this.Y=0,this.Z=0;else if(r==2)this.X=e[0],this.Y=e[1];else if(r==1)if(e[0]instanceof c.DoublePoint){var t=e[0];this.X=c.Clipper.Round(t.X),this.Y=c.Clipper.Round(t.Y)}else{var i=e[0];this.X=i.X,this.Y=i.Y}else this.X=0,this.Y=0};c.IntPoint.op_Equality=function(e,r){return e.X==r.X&&e.Y==r.Y};c.IntPoint.op_Inequality=function(e,r){return e.X!=r.X||e.Y!=r.Y};jr?(c.IntPoint0=function(){this.X=0,this.Y=0,this.Z=0},c.IntPoint1=function(e){this.X=e.X,this.Y=e.Y,this.Z=e.Z},c.IntPoint1dp=function(e){this.X=c.Clipper.Round(e.X),this.Y=c.Clipper.Round(e.Y),this.Z=0},c.IntPoint2=function(e,r){this.X=e,this.Y=r,this.Z=0},c.IntPoint3=function(e,r,t){this.X=e,this.Y=r,this.Z=t}):(c.IntPoint0=function(){this.X=0,this.Y=0},c.IntPoint1=function(e){this.X=e.X,this.Y=e.Y},c.IntPoint1dp=function(e){this.X=c.Clipper.Round(e.X),this.Y=c.Clipper.Round(e.Y)},c.IntPoint2=function(e,r){this.X=e,this.Y=r});c.IntRect=function(){var e=arguments,r=e.length;r==4?(this.left=e[0],this.top=e[1],this.right=e[2],this.bottom=e[3]):r==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)};c.IntRect0=function(){this.left=0,this.top=0,this.right=0,this.bottom=0};c.IntRect1=function(e){this.left=e.left,this.top=e.top,this.right=e.right,this.bottom=e.bottom};c.IntRect4=function(e,r,t,i){this.left=e,this.top=r,this.right=t,this.bottom=i};c.ClipType={ctIntersection:0,ctUnion:1,ctDifference:2,ctXor:3};c.PolyType={ptSubject:0,ptClip:1};c.PolyFillType={pftEvenOdd:0,pftNonZero:1,pftPositive:2,pftNegative:3};c.JoinType={jtSquare:0,jtRound:1,jtMiter:2};c.EndType={etOpenSquare:0,etOpenRound:1,etOpenButt:2,etClosedLine:3,etClosedPolygon:4};Rd&&(c.EndType_={etSquare:0,etRound:1,etButt:2,etClosed:3});c.EdgeSide={esLeft:0,esRight:1};c.Direction={dRightToLeft:0,dLeftToRight:1};c.TEdge=function(){this.Bot=new c.IntPoint,this.Curr=new c.IntPoint,this.Top=new c.IntPoint,this.Delta=new c.IntPoint,this.Dx=0,this.PolyTyp=c.PolyType.ptSubject,this.Side=c.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};c.IntersectNode=function(){this.Edge1=null,this.Edge2=null,this.Pt=new c.IntPoint};c.MyIntersectNodeSort=function(){};c.MyIntersectNodeSort.Compare=function(e,r){return r.Pt.Y-e.Pt.Y};c.LocalMinima=function(){this.Y=0,this.LeftBound=null,this.RightBound=null,this.Next=null};c.Scanbeam=function(){this.Y=0,this.Next=null};c.OutRec=function(){this.Idx=0,this.IsHole=!1,this.IsOpen=!1,this.FirstLeft=null,this.Pts=null,this.BottomPt=null,this.PolyNode=null};c.OutPt=function(){this.Idx=0,this.Pt=new c.IntPoint,this.Next=null,this.Prev=null};c.Join=function(){this.OutPt1=null,this.OutPt2=null,this.OffPt=new c.IntPoint};c.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};c.ClipperBase.horizontal=-9007199254740992;c.ClipperBase.Skip=-2;c.ClipperBase.Unassigned=-1;c.ClipperBase.tolerance=1e-20;g0?(c.ClipperBase.loRange=46340,c.ClipperBase.hiRange=46340):(c.ClipperBase.loRange=47453132,c.ClipperBase.hiRange=0xfffffffffffff);c.ClipperBase.near_zero=function(e){return e>-c.ClipperBase.tolerance&&e<c.ClipperBase.tolerance};c.ClipperBase.IsHorizontal=function(e){return e.Delta.Y===0};c.ClipperBase.prototype.PointIsVertex=function(e,r){var t=r;do{if(c.IntPoint.op_Equality(t.Pt,e))return!0;t=t.Next}while(t!=r);return!1};c.ClipperBase.prototype.PointOnLineSegment=function(e,r,t,i){return i?e.X==r.X&&e.Y==r.Y||e.X==t.X&&e.Y==t.Y||e.X>r.X==e.X<t.X&&e.Y>r.Y==e.Y<t.Y&&Q.op_Equality(Q.Int128Mul(e.X-r.X,t.Y-r.Y),Q.Int128Mul(t.X-r.X,e.Y-r.Y)):e.X==r.X&&e.Y==r.Y||e.X==t.X&&e.Y==t.Y||e.X>r.X==e.X<t.X&&e.Y>r.Y==e.Y<t.Y&&(e.X-r.X)*(t.Y-r.Y)==(t.X-r.X)*(e.Y-r.Y)};c.ClipperBase.prototype.PointOnPolygon=function(e,r,t){for(var i=r;;){if(this.PointOnLineSegment(e,i.Pt,i.Next.Pt,t))return!0;if(i=i.Next,i==r)break}return!1};c.ClipperBase.prototype.SlopesEqual=c.ClipperBase.SlopesEqual=function(){var e=arguments,r=e.length,t,i,n,o,s,l,h;return r==3?(t=e[0],i=e[1],h=e[2],h?Q.op_Equality(Q.Int128Mul(t.Delta.Y,i.Delta.X),Q.Int128Mul(t.Delta.X,i.Delta.Y)):c.Cast_Int64(t.Delta.Y*i.Delta.X)==c.Cast_Int64(t.Delta.X*i.Delta.Y)):r==4?(n=e[0],o=e[1],s=e[2],h=e[3],h?Q.op_Equality(Q.Int128Mul(n.Y-o.Y,o.X-s.X),Q.Int128Mul(n.X-o.X,o.Y-s.Y)):c.Cast_Int64((n.Y-o.Y)*(o.X-s.X))-c.Cast_Int64((n.X-o.X)*(o.Y-s.Y))===0):(n=e[0],o=e[1],s=e[2],l=e[3],h=e[4],h?Q.op_Equality(Q.Int128Mul(n.Y-o.Y,s.X-l.X),Q.Int128Mul(n.X-o.X,s.Y-l.Y)):c.Cast_Int64((n.Y-o.Y)*(s.X-l.X))-c.Cast_Int64((n.X-o.X)*(s.Y-l.Y))===0)};c.ClipperBase.SlopesEqual3=function(e,r,t){return t?Q.op_Equality(Q.Int128Mul(e.Delta.Y,r.Delta.X),Q.Int128Mul(e.Delta.X,r.Delta.Y)):c.Cast_Int64(e.Delta.Y*r.Delta.X)==c.Cast_Int64(e.Delta.X*r.Delta.Y)};c.ClipperBase.SlopesEqual4=function(e,r,t,i){return i?Q.op_Equality(Q.Int128Mul(e.Y-r.Y,r.X-t.X),Q.Int128Mul(e.X-r.X,r.Y-t.Y)):c.Cast_Int64((e.Y-r.Y)*(r.X-t.X))-c.Cast_Int64((e.X-r.X)*(r.Y-t.Y))===0};c.ClipperBase.SlopesEqual5=function(e,r,t,i,n){return n?Q.op_Equality(Q.Int128Mul(e.Y-r.Y,t.X-i.X),Q.Int128Mul(e.X-r.X,t.Y-i.Y)):c.Cast_Int64((e.Y-r.Y)*(t.X-i.X))-c.Cast_Int64((e.X-r.X)*(t.Y-i.Y))===0};c.ClipperBase.prototype.Clear=function(){this.DisposeLocalMinimaList();for(var e=0,r=this.m_edges.length;e<r;++e){for(var t=0,i=this.m_edges[e].length;t<i;++t)this.m_edges[e][t]=null;c.Clear(this.m_edges[e])}c.Clear(this.m_edges),this.m_UseFullRange=!1,this.m_HasOpenPaths=!1};c.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};c.ClipperBase.prototype.RangeTest=function(e,r){r.Value?(e.X>c.ClipperBase.hiRange||e.Y>c.ClipperBase.hiRange||-e.X>c.ClipperBase.hiRange||-e.Y>c.ClipperBase.hiRange)&&c.Error("Coordinate outside allowed range in RangeTest()."):(e.X>c.ClipperBase.loRange||e.Y>c.ClipperBase.loRange||-e.X>c.ClipperBase.loRange||-e.Y>c.ClipperBase.loRange)&&(r.Value=!0,this.RangeTest(e,r))};c.ClipperBase.prototype.InitEdge=function(e,r,t,i){e.Next=r,e.Prev=t,e.Curr.X=i.X,e.Curr.Y=i.Y,e.OutIdx=-1};c.ClipperBase.prototype.InitEdge2=function(e,r){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=r};c.ClipperBase.prototype.FindNextLocMin=function(e){for(var r;;){for(;c.IntPoint.op_Inequality(e.Bot,e.Prev.Bot)||c.IntPoint.op_Equality(e.Curr,e.Top);)e=e.Next;if(e.Dx!=c.ClipperBase.horizontal&&e.Prev.Dx!=c.ClipperBase.horizontal)break;for(;e.Prev.Dx==c.ClipperBase.horizontal;)e=e.Prev;for(r=e;e.Dx==c.ClipperBase.horizontal;)e=e.Next;if(e.Top.Y!=e.Prev.Bot.Y){r.Prev.Bot.X<e.Bot.X&&(e=r);break}}return e};c.ClipperBase.prototype.ProcessBound=function(e,r){var t=e,i=e,n,o;if(e.Dx==c.ClipperBase.horizontal&&(r?o=e.Prev.Bot.X:o=e.Next.Bot.X,e.Bot.X!=o&&this.ReverseHorizontal(e)),i.OutIdx!=c.ClipperBase.Skip)if(r){for(;i.Top.Y==i.Next.Bot.Y&&i.Next.OutIdx!=c.ClipperBase.Skip;)i=i.Next;if(i.Dx==c.ClipperBase.horizontal&&i.Next.OutIdx!=c.ClipperBase.Skip){for(n=i;n.Prev.Dx==c.ClipperBase.horizontal;)n=n.Prev;n.Prev.Top.X==i.Next.Top.X?r||(i=n.Prev):n.Prev.Top.X>i.Next.Top.X&&(i=n.Prev)}for(;e!=i;)e.NextInLML=e.Next,e.Dx==c.ClipperBase.horizontal&&e!=t&&e.Bot.X!=e.Prev.Top.X&&this.ReverseHorizontal(e),e=e.Next;e.Dx==c.ClipperBase.horizontal&&e!=t&&e.Bot.X!=e.Prev.Top.X&&this.ReverseHorizontal(e),i=i.Next}else{for(;i.Top.Y==i.Prev.Bot.Y&&i.Prev.OutIdx!=c.ClipperBase.Skip;)i=i.Prev;if(i.Dx==c.ClipperBase.horizontal&&i.Prev.OutIdx!=c.ClipperBase.Skip){for(n=i;n.Next.Dx==c.ClipperBase.horizontal;)n=n.Next;n.Next.Top.X==i.Prev.Top.X?r||(i=n.Next):n.Next.Top.X>i.Prev.Top.X&&(i=n.Next)}for(;e!=i;)e.NextInLML=e.Prev,e.Dx==c.ClipperBase.horizontal&&e!=t&&e.Bot.X!=e.Next.Top.X&&this.ReverseHorizontal(e),e=e.Prev;e.Dx==c.ClipperBase.horizontal&&e!=t&&e.Bot.X!=e.Next.Top.X&&this.ReverseHorizontal(e),i=i.Prev}if(i.OutIdx==c.ClipperBase.Skip){if(e=i,r){for(;e.Top.Y==e.Next.Bot.Y;)e=e.Next;for(;e!=i&&e.Dx==c.ClipperBase.horizontal;)e=e.Prev}else{for(;e.Top.Y==e.Prev.Bot.Y;)e=e.Prev;for(;e!=i&&e.Dx==c.ClipperBase.horizontal;)e=e.Next}if(e==i)r?i=e.Next:i=e.Prev;else{r?e=i.Next:e=i.Prev;var s=new c.LocalMinima;s.Next=null,s.Y=e.Bot.Y,s.LeftBound=null,s.RightBound=e,s.RightBound.WindDelta=0,i=this.ProcessBound(s.RightBound,r),this.InsertLocalMinima(s)}}return i};c.ClipperBase.prototype.AddPath=function(e,r,t){Ad?!t&&r==c.PolyType.ptClip&&c.Error("AddPath: Open paths must be subject."):t||c.Error("AddPath: Open paths have been disabled.");var i=e.length-1;if(t)for(;i>0&&c.IntPoint.op_Equality(e[i],e[0]);)--i;for(;i>0&&c.IntPoint.op_Equality(e[i],e[i-1]);)--i;if(t&&i<2||!t&&i<1)return!1;for(var n=new Array,o=0;o<=i;o++)n.push(new c.TEdge);var s=!0;n[1].Curr.X=e[1].X,n[1].Curr.Y=e[1].Y;var l={Value:this.m_UseFullRange};this.RangeTest(e[0],l),this.m_UseFullRange=l.Value,l.Value=this.m_UseFullRange,this.RangeTest(e[i],l),this.m_UseFullRange=l.Value,this.InitEdge(n[0],n[1],n[i],e[0]),this.InitEdge(n[i],n[0],n[i-1],e[i]);for(var o=i-1;o>=1;--o)l.Value=this.m_UseFullRange,this.RangeTest(e[o],l),this.m_UseFullRange=l.Value,this.InitEdge(n[o],n[o+1],n[o-1],e[o]);for(var h=n[0],p=h,m=h;;){if(c.IntPoint.op_Equality(p.Curr,p.Next.Curr)){if(p==p.Next)break;p==h&&(h=p.Next),p=this.RemoveEdge(p),m=p;continue}if(p.Prev==p.Next)break;if(t&&c.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==h&&(h=p.Next),p=this.RemoveEdge(p),p=p.Prev,m=p;continue}if(p=p.Next,p==m)break}if(!t&&p==p.Next||t&&p.Prev==p.Next)return!1;t||(this.m_HasOpenPaths=!0,h.Prev.OutIdx=c.ClipperBase.Skip);var f=h;p=h;do this.InitEdge2(p,r),p=p.Next,s&&p.Curr.Y!=h.Curr.Y&&(s=!1);while(p!=h);if(s){if(t)return!1;p.Prev.OutIdx=c.ClipperBase.Skip,p.Prev.Bot.X<p.Prev.Top.X&&this.ReverseHorizontal(p.Prev);var v=new c.LocalMinima;for(v.Next=null,v.Y=p.Bot.Y,v.LeftBound=null,v.RightBound=p,v.RightBound.Side=c.EdgeSide.esRight,v.RightBound.WindDelta=0;p.Next.OutIdx!=c.ClipperBase.Skip;)p.NextInLML=p.Next,p.Bot.X!=p.Prev.Top.X&&this.ReverseHorizontal(p),p=p.Next;return this.InsertLocalMinima(v),this.m_edges.push(n),!0}this.m_edges.push(n);for(var y,C=null;p=this.FindNextLocMin(p),p!=C;){C==null&&(C=p);var v=new c.LocalMinima;v.Next=null,v.Y=p.Bot.Y,p.Dx<p.Prev.Dx?(v.LeftBound=p.Prev,v.RightBound=p,y=!1):(v.LeftBound=p,v.RightBound=p.Prev,y=!0),v.LeftBound.Side=c.EdgeSide.esLeft,v.RightBound.Side=c.EdgeSide.esRight,t?v.LeftBound.Next==v.RightBound?v.LeftBound.WindDelta=-1:v.LeftBound.WindDelta=1:v.LeftBound.WindDelta=0,v.RightBound.WindDelta=-v.LeftBound.WindDelta,p=this.ProcessBound(v.LeftBound,y);var M=this.ProcessBound(v.RightBound,!y);v.LeftBound.OutIdx==c.ClipperBase.Skip?v.LeftBound=null:v.RightBound.OutIdx==c.ClipperBase.Skip&&(v.RightBound=null),this.InsertLocalMinima(v),y||(p=M)}return!0};c.ClipperBase.prototype.AddPaths=function(e,r,t){for(var i=!1,n=0,o=e.length;n<o;++n)this.AddPath(e[n],r,t)&&(i=!0);return i};c.ClipperBase.prototype.Pt2IsBetweenPt1AndPt3=function(e,r,t){return c.IntPoint.op_Equality(e,t)||c.IntPoint.op_Equality(e,r)||c.IntPoint.op_Equality(t,r)?!1:e.X!=t.X?r.X>e.X==r.X<t.X:r.Y>e.Y==r.Y<t.Y};c.ClipperBase.prototype.RemoveEdge=function(e){e.Prev.Next=e.Next,e.Next.Prev=e.Prev;var r=e.Next;return e.Prev=null,r};c.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=c.ClipperBase.horizontal:e.Dx=e.Delta.X/e.Delta.Y};c.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 r=this.m_MinimaList;r.Next!==null&&e.Y<r.Next.Y;)r=r.Next;e.Next=r.Next,r.Next=e}};c.ClipperBase.prototype.PopLocalMinima=function(){this.m_CurrentLM!==null&&(this.m_CurrentLM=this.m_CurrentLM.Next)};c.ClipperBase.prototype.ReverseHorizontal=function(e){var r=e.Top.X;e.Top.X=e.Bot.X,e.Bot.X=r,jr&&(r=e.Top.Z,e.Top.Z=e.Bot.Z,e.Bot.Z=r)};c.ClipperBase.prototype.Reset=function(){if(this.m_CurrentLM=this.m_MinimaList,this.m_CurrentLM!=null)for(var e=this.m_MinimaList;e!=null;){var r=e.LeftBound;r!=null&&(r.Curr.X=r.Bot.X,r.Curr.Y=r.Bot.Y,r.Side=c.EdgeSide.esLeft,r.OutIdx=c.ClipperBase.Unassigned),r=e.RightBound,r!=null&&(r.Curr.X=r.Bot.X,r.Curr.Y=r.Bot.Y,r.Side=c.EdgeSide.esRight,r.OutIdx=c.ClipperBase.Unassigned),e=e.Next}};c.Clipper=function(e){typeof e>"u"&&(e=0),this.m_PolyOuts=null,this.m_ClipType=c.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=c.PolyFillType.pftEvenOdd,this.m_SubjFillType=c.PolyFillType.pftEvenOdd,this.m_Joins=null,this.m_GhostJoins=null,this.m_UsingPolyTree=!1,this.ReverseSolution=!1,this.StrictlySimple=!1,c.ClipperBase.call(this),this.m_Scanbeam=null,this.m_ActiveEdges=null,this.m_SortedEdges=null,this.m_IntersectList=new Array,this.m_IntersectNodeComparer=c.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,jr&&(this.ZFillFunction=null)};c.Clipper.ioReverseSolution=1;c.Clipper.ioStrictlySimple=2;c.Clipper.ioPreserveCollinear=4;c.Clipper.prototype.Clear=function(){this.m_edges.length!==0&&(this.DisposeAllPolyPts(),c.ClipperBase.prototype.Clear.call(this))};c.Clipper.prototype.DisposeScanbeamList=function(){for(;this.m_Scanbeam!==null;){var e=this.m_Scanbeam.Next;this.m_Scanbeam=null,this.m_Scanbeam=e}};c.Clipper.prototype.Reset=function(){c.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};c.Clipper.prototype.InsertScanbeam=function(e){if(this.m_Scanbeam===null)this.m_Scanbeam=new c.Scanbeam,this.m_Scanbeam.Next=null,this.m_Scanbeam.Y=e;else if(e>this.m_Scanbeam.Y){var r=new c.Scanbeam;r.Y=e,r.Next=this.m_Scanbeam,this.m_Scanbeam=r}else{for(var t=this.m_Scanbeam;t.Next!==null&&e<=t.Next.Y;)t=t.Next;if(e==t.Y)return;var r=new c.Scanbeam;r.Y=e,r.Next=t.Next,t.Next=r}};c.Clipper.prototype.Execute=function(){var e=arguments,r=e.length,t=e[1]instanceof c.PolyTree;if(r==4&&!t){var i=e[0],n=e[1],o=e[2],s=e[3];if(this.m_ExecuteLocked)return!1;this.m_HasOpenPaths&&c.Error("Error: PolyTree struct is need for open path clipping."),this.m_ExecuteLocked=!0,c.Clear(n),this.m_SubjFillType=o,this.m_ClipFillType=s,this.m_ClipType=i,this.m_UsingPolyTree=!1;try{var l=this.ExecuteInternal();l&&this.BuildResult(n)}finally{this.DisposeAllPolyPts(),this.m_ExecuteLocked=!1}return l}else if(r==4&&t){var i=e[0],h=e[1],o=e[2],s=e[3];if(this.m_ExecuteLocked)return!1;this.m_ExecuteLocked=!0,this.m_SubjFillType=o,this.m_ClipFillType=s,this.m_ClipType=i,this.m_UsingPolyTree=!0;try{var l=this.ExecuteInternal();l&&this.BuildResult2(h)}finally{this.DisposeAllPolyPts(),this.m_ExecuteLocked=!1}return l}else if(r==2&&!t){var i=e[0],n=e[1];return this.Execute(i,n,c.PolyFillType.pftEvenOdd,c.PolyFillType.pftEvenOdd)}else if(r==2&&t){var i=e[0],h=e[1];return this.Execute(i,h,c.PolyFillType.pftEvenOdd,c.PolyFillType.pftEvenOdd)}};c.Clipper.prototype.FixHoleLinkage=function(e){if(!(e.FirstLeft===null||e.IsHole!=e.FirstLeft.IsHole&&e.FirstLeft.Pts!==null)){for(var r=e.FirstLeft;r!==null&&(r.IsHole==e.IsHole||r.Pts===null);)r=r.FirstLeft;e.FirstLeft=r}};c.Clipper.prototype.ExecuteInternal=function(){try{if(this.Reset(),this.m_CurrentLM===null)return!1;var e=this.PopScanbeam();do{if(this.InsertLocalMinimaIntoAEL(e),c.Clear(this.m_GhostJoins),this.ProcessHorizontals(!1),this.m_Scanbeam===null)break;var r=this.PopScanbeam();if(!this.ProcessIntersections(e,r))return!1;this.ProcessEdgesAtTopOfScanbeam(r),e=r}while(this.m_Scanbeam!==null||this.m_CurrentLM!==null);for(var t=0,i=this.m_PolyOuts.length;t<i;t++){var n=this.m_PolyOuts[t];n.Pts===null||n.IsOpen||(n.IsHole^this.ReverseSolution)==this.Area(n)>0&&this.ReversePolyPtLinks(n.Pts)}this.JoinCommonEdges();for(var t=0,i=this.m_PolyOuts.length;t<i;t++){var n=this.m_PolyOuts[t];n.Pts!==null&&!n.IsOpen&&this.FixupOutPolygon(n)}return this.StrictlySimple&&this.DoSimplePolygons(),!0}finally{c.Clear(this.m_Joins),c.Clear(this.m_GhostJoins)}};c.Clipper.prototype.PopScanbeam=function(){var e=this.m_Scanbeam.Y,r=this.m_Scanbeam;return this.m_Scanbeam=this.m_Scanbeam.Next,r=null,e};c.Clipper.prototype.DisposeAllPolyPts=function(){for(var e=0,r=this.m_PolyOuts.length;e<r;++e)this.DisposeOutRec(e);c.Clear(this.m_PolyOuts)};c.Clipper.prototype.DisposeOutRec=function(e){var r=this.m_PolyOuts[e];r.Pts!==null&&this.DisposeOutPts(r.Pts),r=null,this.m_PolyOuts[e]=null};c.Clipper.prototype.DisposeOutPts=function(e){if(e!==null){var r=null;for(e.Prev.Next=null;e!==null;)r=e,e=e.Next,r=null}};c.Clipper.prototype.AddJoin=function(e,r,t){var i=new c.Join;i.OutPt1=e,i.OutPt2=r,i.OffPt.X=t.X,i.OffPt.Y=t.Y,this.m_Joins.push(i)};c.Clipper.prototype.AddGhostJoin=function(e,r){var t=new c.Join;t.OutPt1=e,t.OffPt.X=r.X,t.OffPt.Y=r.Y,this.m_GhostJoins.push(t)};jr&&(c.Clipper.prototype.SetZ=function(e,r){e.Z=0,this.ZFillFunction!==null&&(r.OutIdx<0?this.ZFillFunction(r.Bot,r.Top,e):this.ZFillFunction(r.Top,r.Bot,e))});c.Clipper.prototype.InsertLocalMinimaIntoAEL=function(e){for(;this.m_CurrentLM!==null&&this.m_CurrentLM.Y==e;){var r=this.m_CurrentLM.LeftBound,t=this.m_CurrentLM.RightBound;this.PopLocalMinima();var i=null;if(r===null?(this.InsertEdgeIntoAEL(t,null),this.SetWindingCount(t),this.IsContributing(t)&&(i=this.AddOutPt(t,t.Bot))):t==null?(this.InsertEdgeIntoAEL(r,null),this.SetWindingCount(r),this.IsContributing(r)&&(i=this.AddOutPt(r,r.Bot)),this.InsertScanbeam(r.Top.Y)):(this.InsertEdgeIntoAEL(r,null),this.InsertEdgeIntoAEL(t,r),this.SetWindingCount(r),t.WindCnt=r.WindCnt,t.WindCnt2=r.WindCnt2,this.IsContributing(r)&&(i=this.AddLocalMinPoly(r,t,r.Bot)),this.InsertScanbeam(r.Top.Y)),t!=null&&(c.ClipperBase.IsHorizontal(t)?this.AddEdgeToSEL(t):this.InsertScanbeam(t.Top.Y)),!(r==null||t==null)){if(i!==null&&c.ClipperBase.IsHorizontal(t)&&this.m_GhostJoins.length>0&&t.WindDelta!==0)for(var n=0,o=this.m_GhostJoins.length;n<o;n++){var s=this.m_GhostJoins[n];this.HorzSegmentsOverlap(s.OutPt1.Pt,s.OffPt,t.Bot,t.Top)&&this.AddJoin(s.OutPt1,i,s.OffPt)}if(r.OutIdx>=0&&r.PrevInAEL!==null&&r.PrevInAEL.Curr.X==r.Bot.X&&r.PrevInAEL.OutIdx>=0&&c.ClipperBase.SlopesEqual(r.PrevInAEL,r,this.m_UseFullRange)&&r.WindDelta!==0&&r.PrevInAEL.WindDelta!==0){var l=this.AddOutPt(r.PrevInAEL,r.Bot);this.AddJoin(i,l,r.Top)}if(r.NextInAEL!=t){if(t.OutIdx>=0&&t.PrevInAEL.OutIdx>=0&&c.ClipperBase.SlopesEqual(t.PrevInAEL,t,this.m_UseFullRange)&&t.WindDelta!==0&&t.PrevInAEL.WindDelta!==0){var l=this.AddOutPt(t.PrevInAEL,t.Bot);this.AddJoin(i,l,t.Top)}var h=r.NextInAEL;if(h!==null)for(;h!=t;)this.IntersectEdges(t,h,r.Curr,!1),h=h.NextInAEL}}}};c.Clipper.prototype.InsertEdgeIntoAEL=function(e,r){if(this.m_ActiveEdges===null)e.PrevInAEL=null,e.NextInAEL=null,this.m_ActiveEdges=e;else if(r===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(r===null&&(r=this.m_ActiveEdges);r.NextInAEL!==null&&!this.E2InsertsBeforeE1(r.NextInAEL,e);)r=r.NextInAEL;e.NextInAEL=r.NextInAEL,r.NextInAEL!==null&&(r.NextInAEL.PrevInAEL=e),e.PrevInAEL=r,r.NextInAEL=e}};c.Clipper.prototype.E2InsertsBeforeE1=function(e,r){return r.Curr.X==e.Curr.X?r.Top.Y>e.Top.Y?r.Top.X<c.Clipper.TopX(e,r.Top.Y):e.Top.X>c.Clipper.TopX(r,e.Top.Y):r.Curr.X<e.Curr.X};c.Clipper.prototype.IsEvenOddFillType=function(e){return e.PolyTyp==c.PolyType.ptSubject?this.m_SubjFillType==c.PolyFillType.pftEvenOdd:this.m_ClipFillType==c.PolyFillType.pftEvenOdd};c.Clipper.prototype.IsEvenOddAltFillType=function(e){return e.PolyTyp==c.PolyType.ptSubject?this.m_ClipFillType==c.PolyFillType.pftEvenOdd:this.m_SubjFillType==c.PolyFillType.pftEvenOdd};c.Clipper.prototype.IsContributing=function(e){var r,t;switch(e.PolyTyp==c.PolyType.ptSubject?(r=this.m_SubjFillType,t=this.m_ClipFillType):(r=this.m_ClipFillType,t=this.m_SubjFillType),r){case c.PolyFillType.pftEvenOdd:if(e.WindDelta===0&&e.WindCnt!=1)return!1;break;case c.PolyFillType.pftNonZero:if(Math.abs(e.WindCnt)!=1)return!1;break;case c.PolyFillType.pftPositive:if(e.WindCnt!=1)return!1;break;default:if(e.WindCnt!=-1)return!1;break}switch(this.m_ClipType){case c.ClipType.ctIntersection:switch(t){case c.PolyFillType.pftEvenOdd:case c.PolyFillType.pftNonZero:return e.WindCnt2!==0;case c.PolyFillType.pftPositive:return e.WindCnt2>0;default:return e.WindCnt2<0}case c.ClipType.ctUnion:switch(t){case c.PolyFillType.pftEvenOdd:case c.PolyFillType.pftNonZero:return e.WindCnt2===0;case c.PolyFillType.pftPositive:return e.WindCnt2<=0;default:return e.WindCnt2>=0}case c.ClipType.ctDifference:if(e.PolyTyp==c.PolyType.ptSubject)switch(t){case c.PolyFillType.pftEvenOdd:case c.PolyFillType.pftNonZero:return e.WindCnt2===0;case c.PolyFillType.pftPositive:return e.WindCnt2<=0;default:return e.WindCnt2>=0}else switch(t){case c.PolyFillType.pftEvenOdd:case c.PolyFillType.pftNonZero:return e.WindCnt2!==0;case c.PolyFillType.pftPositive:return e.WindCnt2>0;default:return e.WindCnt2<0}case c.ClipType.ctXor:if(e.WindDelta===0)switch(t){case c.PolyFillType.pftEvenOdd:case c.PolyFillType.pftNonZero:return e.WindCnt2===0;case c.PolyFillType.pftPositive:return e.WindCnt2<=0;default:return e.WindCnt2>=0}else return!0}return!0};c.Clipper.prototype.SetWindingCount=function(e){for(var r=e.PrevInAEL;r!==null&&(r.PolyTyp!=e.PolyTyp||r.WindDelta===0);)r=r.PrevInAEL;if(r===null)e.WindCnt=e.WindDelta===0?1:e.WindDelta,e.WindCnt2=0,r=this.m_ActiveEdges;else if(e.WindDelta===0&&this.m_ClipType!=c.ClipType.ctUnion)e.WindCnt=1,e.WindCnt2=r.WindCnt2,r=r.NextInAEL;else if(this.IsEvenOddFillType(e)){if(e.WindDelta===0){for(var t=!0,i=r.PrevInAEL;i!==null;)i.PolyTyp==r.PolyTyp&&i.WindDelta!==0&&(t=!t),i=i.PrevInAEL;e.WindCnt=t?0:1}else e.WindCnt=e.WindDelta;e.WindCnt2=r.WindCnt2,r=r.NextInAEL}else r.WindCnt*r.WindDelta<0?Math.abs(r.WindCnt)>1?r.WindDelta*e.WindDelta<0?e.WindCnt=r.WindCnt:e.WindCnt=r.WindCnt+e.WindDelta:e.WindCnt=e.WindDelta===0?1:e.WindDelta:e.WindDelta===0?e.WindCnt=r.WindCnt<0?r.WindCnt-1:r.WindCnt+1:r.WindDelta*e.WindDelta<0?e.WindCnt=r.WindCnt:e.WindCnt=r.WindCnt+e.WindDelta,e.WindCnt2=r.WindCnt2,r=r.NextInAEL;if(this.IsEvenOddAltFillType(e))for(;r!=e;)r.WindDelta!==0&&(e.WindCnt2=e.WindCnt2===0?1:0),r=r.NextInAEL;else for(;r!=e;)e.WindCnt2+=r.WindDelta,r=r.NextInAEL};c.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)};c.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};c.Clipper.prototype.SwapPositionsInAEL=function(e,r){if(!(e.NextInAEL==e.PrevInAEL||r.NextInAEL==r.PrevInAEL)){if(e.NextInAEL==r){var t=r.NextInAEL;t!==null&&(t.PrevInAEL=e);var i=e.PrevInAEL;i!==null&&(i.NextInAEL=r),r.PrevInAEL=i,r.NextInAEL=e,e.PrevInAEL=r,e.NextInAEL=t}else if(r.NextInAEL==e){var t=e.NextInAEL;t!==null&&(t.PrevInAEL=r);var i=r.PrevInAEL;i!==null&&(i.NextInAEL=e),e.PrevInAEL=i,e.NextInAEL=r,r.PrevInAEL=e,r.NextInAEL=t}else{var t=e.NextInAEL,i=e.PrevInAEL;e.NextInAEL=r.NextInAEL,e.NextInAEL!==null&&(e.NextInAEL.PrevInAEL=e),e.PrevInAEL=r.PrevInAEL,e.PrevInAEL!==null&&(e.PrevInAEL.NextInAEL=e),r.NextInAEL=t,r.NextInAEL!==null&&(r.NextInAEL.PrevInAEL=r),r.PrevInAEL=i,r.PrevInAEL!==null&&(r.PrevInAEL.NextInAEL=r)}e.PrevInAEL===null?this.m_ActiveEdges=e:r.PrevInAEL===null&&(this.m_ActiveEdges=r)}};c.Clipper.prototype.SwapPositionsInSEL=function(e,r){if(!(e.NextInSEL===null&&e.PrevInSEL===null)&&!(r.NextInSEL===null&&r.PrevInSEL===null)){if(e.NextInSEL==r){var t=r.NextInSEL;t!==null&&(t.PrevInSEL=e);var i=e.PrevInSEL;i!==null&&(i.NextInSEL=r),r.PrevInSEL=i,r.NextInSEL=e,e.PrevInSEL=r,e.NextInSEL=t}else if(r.NextInSEL==e){var t=e.NextInSEL;t!==null&&(t.PrevInSEL=r);var i=r.PrevInSEL;i!==null&&(i.NextInSEL=e),e.PrevInSEL=i,e.NextInSEL=r,r.PrevInSEL=e,r.NextInSEL=t}else{var t=e.NextInSEL,i=e.PrevInSEL;e.NextInSEL=r.NextInSEL,e.NextInSEL!==null&&(e.NextInSEL.PrevInSEL=e),e.PrevInSEL=r.PrevInSEL,e.PrevInSEL!==null&&(e.PrevInSEL.NextInSEL=e),r.NextInSEL=t,r.NextInSEL!==null&&(r.NextInSEL.PrevInSEL=r),r.PrevInSEL=i,r.PrevInSEL!==null&&(r.PrevInSEL.NextInSEL=r)}e.PrevInSEL===null?this.m_SortedEdges=e:r.PrevInSEL===null&&(this.m_SortedEdges=r)}};c.Clipper.prototype.AddLocalMaxPoly=function(e,r,t){this.AddOutPt(e,t),r.WindDelta==0&&this.AddOutPt(r,t),e.OutIdx==r.OutIdx?(e.OutIdx=-1,r.OutIdx=-1):e.OutIdx<r.OutIdx?this.AppendPolygon(e,r):this.AppendPolygon(r,e)};c.Clipper.prototype.AddLocalMinPoly=function(e,r,t){var i,n,o;if(c.ClipperBase.IsHorizontal(r)||e.Dx>r.Dx?(i=this.AddOutPt(e,t),r.OutIdx=e.OutIdx,e.Side=c.EdgeSide.esLeft,r.Side=c.EdgeSide.esRight,n=e,n.PrevInAEL==r?o=r.PrevInAEL:o=n.PrevInAEL):(i=this.AddOutPt(r,t),e.OutIdx=r.OutIdx,e.Side=c.EdgeSide.esRight,r.Side=c.EdgeSide.esLeft,n=r,n.PrevInAEL==e?o=e.PrevInAEL:o=n.PrevInAEL),o!==null&&o.OutIdx>=0&&c.Clipper.TopX(o,t.Y)==c.Clipper.TopX(n,t.Y)&&c.ClipperBase.SlopesEqual(n,o,this.m_UseFullRange)&&n.WindDelta!==0&&o.WindDelta!==0){var s=this.AddOutPt(o,t);this.AddJoin(i,s,n.Top)}return i};c.Clipper.prototype.CreateOutRec=function(){var e=new c.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};c.Clipper.prototype.AddOutPt=function(e,r){var t=e.Side==c.EdgeSide.esLeft;if(e.OutIdx<0){var i=this.CreateOutRec();i.IsOpen=e.WindDelta===0;var n=new c.OutPt;return i.Pts=n,n.Idx=i.Idx,n.Pt.X=r.X,n.Pt.Y=r.Y,n.Next=n,n.Prev=n,i.IsOpen||this.SetHoleState(e,i),jr&&(c.IntPoint.op_Equality(r,e.Bot)?(n.Pt.X=e.Bot.X,n.Pt.Y=e.Bot.Y,n.Pt.Z=e.Bot.Z):c.IntPoint.op_Equality(r,e.Top)?(n.Pt.X=e.Top.X,n.Pt.Y=e.Top.Y,n.Pt.Z=e.Top.Z):this.SetZ(n.Pt,e)),e.OutIdx=i.Idx,n}else{var i=this.m_PolyOuts[e.OutIdx],o=i.Pts;if(t&&c.IntPoint.op_Equality(r,o.Pt))return o;if(!t&&c.IntPoint.op_Equality(r,o.Prev.Pt))return o.Prev;var n=new c.OutPt;return n.Idx=i.Idx,n.Pt.X=r.X,n.Pt.Y=r.Y,n.Next=o,n.Prev=o.Prev,n.Prev.Next=n,o.Prev=n,t&&(i.Pts=n),jr&&(c.IntPoint.op_Equality(r,e.Bot)?(n.Pt.X=e.Bot.X,n.Pt.Y=e.Bot.Y,n.Pt.Z=e.Bot.Z):c.IntPoint.op_Equality(r,e.Top)?(n.Pt.X=e.Top.X,n.Pt.Y=e.Top.Y,n.Pt.Z=e.Top.Z):this.SetZ(n.Pt,e)),n}};c.Clipper.prototype.SwapPoints=function(e,r){var t=new c.IntPoint(e.Value);e.Value.X=r.Value.X,e.Value.Y=r.Value.Y,r.Value.X=t.X,r.Value.Y=t.Y};c.Clipper.prototype.HorzSegmentsOverlap=function(e,r,t,i){return e.X>t.X==e.X<i.X||r.X>t.X==r.X<i.X||t.X>e.X==t.X<r.X||i.X>e.X==i.X<r.X||e.X==t.X&&r.X==i.X?!0:e.X==i.X&&r.X==t.X};c.Clipper.prototype.InsertPolyPtBetween=function(e,r,t){var i=new c.OutPt;return i.Pt.X=t.X,i.Pt.Y=t.Y,r==e.Next?(e.Next=i,r.Prev=i,i.Next=r,i.Prev=e):(r.Next=i,e.Prev=i,i.Next=e,i.Prev=r),i};c.Clipper.prototype.SetHoleState=function(e,r){for(var t=!1,i=e.PrevInAEL;i!==null;)i.OutIdx>=0&&i.WindDelta!=0&&(t=!t,r.FirstLeft===null&&(r.FirstLeft=this.m_PolyOuts[i.OutIdx])),i=i.PrevInAEL;t&&(r.IsHole=!0)};c.Clipper.prototype.GetDx=function(e,r){return e.Y==r.Y?c.ClipperBase.horizontal:(r.X-e.X)/(r.Y-e.Y)};c.Clipper.prototype.FirstIsBottomPt=function(e,r){for(var t=e.Prev;c.IntPoint.op_Equality(t.Pt,e.Pt)&&t!=e;)t=t.Prev;var i=Math.abs(this.GetDx(e.Pt,t.Pt));for(t=e.Next;c.IntPoint.op_Equality(t.Pt,e.Pt)&&t!=e;)t=t.Next;var n=Math.abs(this.GetDx(e.Pt,t.Pt));for(t=r.Prev;c.IntPoint.op_Equality(t.Pt,r.Pt)&&t!=r;)t=t.Prev;var o=Math.abs(this.GetDx(r.Pt,t.Pt));for(t=r.Next;c.IntPoint.op_Equality(t.Pt,r.Pt)&&t!=r;)t=t.Next;var s=Math.abs(this.GetDx(r.Pt,t.Pt));return i>=o&&i>=s||n>=o&&n>=s};c.Clipper.prototype.GetBottomPt=function(e){for(var r=null,t=e.Next;t!=e;)t.Pt.Y>e.Pt.Y?(e=t,r=null):t.Pt.Y==e.Pt.Y&&t.Pt.X<=e.Pt.X&&(t.Pt.X<e.Pt.X?(r=null,e=t):t.Next!=e&&t.Prev!=e&&(r=t)),t=t.Next;if(r!==null)for(;r!=t;)for(this.FirstIsBottomPt(t,r)||(e=r),r=r.Next;c.IntPoint.op_Inequality(r.Pt,e.Pt);)r=r.Next;return e};c.Clipper.prototype.GetLowermostRec=function(e,r){e.BottomPt===null&&(e.BottomPt=this.GetBottomPt(e.Pts)),r.BottomPt===null&&(r.BottomPt=this.GetBottomPt(r.Pts));var t=e.BottomPt,i=r.BottomPt;return t.Pt.Y>i.Pt.Y?e:t.Pt.Y<i.Pt.Y?r:t.Pt.X<i.Pt.X?e:t.Pt.X>i.Pt.X||t.Next==t?r:i.Next==i||this.FirstIsBottomPt(t,i)?e:r};c.Clipper.prototype.Param1RightOfParam2=function(e,r){do if(e=e.FirstLeft,e==r)return!0;while(e!==null);return!1};c.Clipper.prototype.GetOutRec=function(e){for(var r=this.m_PolyOuts[e];r!=this.m_PolyOuts[r.Idx];)r=this.m_PolyOuts[r.Idx];return r};c.Clipper.prototype.AppendPolygon=function(e,r){var t=this.m_PolyOuts[e.OutIdx],i=this.m_PolyOuts[r.OutIdx],n;this.Param1RightOfParam2(t,i)?n=i:this.Param1RightOfParam2(i,t)?n=t:n=this.GetLowermostRec(t,i);var o=t.Pts,s=o.Prev,l=i.Pts,h=l.Prev,p;e.Side==c.EdgeSide.esLeft?(r.Side==c.EdgeSide.esLeft?(this.ReversePolyPtLinks(l),l.Next=o,o.Prev=l,s.Next=h,h.Prev=s,t.Pts=h):(h.Next=o,o.Prev=h,l.Prev=s,s.Next=l,t.Pts=l),p=c.EdgeSide.esLeft):(r.Side==c.EdgeSide.esRight?(this.ReversePolyPtLinks(l),s.Next=h,h.Prev=s,l.Next=o,o.Prev=l):(s.Next=l,l.Prev=s,o.Prev=h,h.Next=o),p=c.EdgeSide.esRight),t.BottomPt=null,n==i&&(i.FirstLeft!=t&&(t.FirstLeft=i.FirstLeft),t.IsHole=i.IsHole),i.Pts=null,i.BottomPt=null,i.FirstLeft=t;var m=e.OutIdx,f=r.OutIdx;e.OutIdx=-1,r.OutIdx=-1;for(var v=this.m_ActiveEdges;v!==null;){if(v.OutIdx==f){v.OutIdx=m,v.Side=p;break}v=v.NextInAEL}i.Idx=t.Idx};c.Clipper.prototype.ReversePolyPtLinks=function(e){if(e!==null){var r,t;r=e;do t=r.Next,r.Next=r.Prev,r.Prev=t,r=t;while(r!=e)}};c.Clipper.SwapSides=function(e,r){var t=e.Side;e.Side=r.Side,r.Side=t};c.Clipper.SwapPolyIndexes=function(e,r){var t=e.OutIdx;e.OutIdx=r.OutIdx,r.OutIdx=t};c.Clipper.prototype.IntersectEdges=function(e,r,t,i){var n=!i&&e.NextInLML===null&&e.Top.X==t.X&&e.Top.Y==t.Y,o=!i&&r.NextInLML===null&&r.Top.X==t.X&&r.Top.Y==t.Y,s=e.OutIdx>=0,l=r.OutIdx>=0;if(Ad&&(e.WindDelta===0||r.WindDelta===0)){e.WindDelta===0&&r.WindDelta===0?(n||o)&&s&&l&&this.AddLocalMaxPoly(e,r,t):e.PolyTyp==r.PolyTyp&&e.WindDelta!=r.WindDelta&&this.m_ClipType==c.ClipType.ctUnion?e.WindDelta===0?l&&(this.AddOutPt(e,t),s&&(e.OutIdx=-1)):s&&(this.AddOutPt(r,t),l&&(r.OutIdx=-1)):e.PolyTyp!=r.PolyTyp&&(e.WindDelta===0&&Math.abs(r.WindCnt)==1&&(this.m_ClipType!=c.ClipType.ctUnion||r.WindCnt2===0)?(this.AddOutPt(e,t),s&&(e.OutIdx=-1)):r.WindDelta===0&&Math.abs(e.WindCnt)==1&&(this.m_ClipType!=c.ClipType.ctUnion||e.WindCnt2===0)&&(this.AddOutPt(r,t),l&&(r.OutIdx=-1))),n&&(e.OutIdx<0?this.DeleteFromAEL(e):c.Error("Error intersecting polylines")),o&&(r.OutIdx<0?this.DeleteFromAEL(r):c.Error("Error intersecting polylines"));return}if(e.PolyTyp==r.PolyTyp)if(this.IsEvenOddFillType(e)){var h=e.WindCnt;e.WindCnt=r.WindCnt,r.WindCnt=h}else e.WindCnt+r.WindDelta===0?e.WindCnt=-e.WindCnt:e.WindCnt+=r.WindDelta,r.WindCnt-e.WindDelta===0?r.WindCnt=-r.WindCnt:r.WindCnt-=e.WindDelta;else this.IsEvenOddFillType(r)?e.WindCnt2=e.WindCnt2===0?1:0:e.WindCnt2+=r.WindDelta,this.IsEvenOddFillType(e)?r.WindCnt2=r.WindCnt2===0?1:0:r.WindCnt2-=e.WindDelta;var p,m,f,v;e.PolyTyp==c.PolyType.ptSubject?(p=this.m_SubjFillType,f=this.m_ClipFillType):(p=this.m_ClipFillType,f=this.m_SubjFillType),r.PolyTyp==c.PolyType.ptSubject?(m=this.m_SubjFillType,v=this.m_ClipFillType):(m=this.m_ClipFillType,v=this.m_SubjFillType);var y,C;switch(p){case c.PolyFillType.pftPositive:y=e.WindCnt;break;case c.PolyFillType.pftNegative:y=-e.WindCnt;break;default:y=Math.abs(e.WindCnt);break}switch(m){case c.PolyFillType.pftPositive:C=r.WindCnt;break;case c.PolyFillType.pftNegative:C=-r.WindCnt;break;default:C=Math.abs(r.WindCnt);break}if(s&&l)n||o||y!==0&&y!=1||C!==0&&C!=1||e.PolyTyp!=r.PolyTyp&&this.m_ClipType!=c.ClipType.ctXor?this.AddLocalMaxPoly(e,r,t):(this.AddOutPt(e,t),this.AddOutPt(r,t),c.Clipper.SwapSides(e,r),c.Clipper.SwapPolyIndexes(e,r));else if(s)(C===0||C==1)&&(this.AddOutPt(e,t),c.Clipper.SwapSides(e,r),c.Clipper.SwapPolyIndexes(e,r));else if(l)(y===0||y==1)&&(this.AddOutPt(r,t),c.Clipper.SwapSides(e,r),c.Clipper.SwapPolyIndexes(e,r));else if((y===0||y==1)&&(C===0||C==1)&&!n&&!o){var M,g;switch(f){case c.PolyFillType.pftPositive:M=e.WindCnt2;break;case c.PolyFillType.pftNegative:M=-e.WindCnt2;break;default:M=Math.abs(e.WindCnt2);break}switch(v){case c.PolyFillType.pftPositive:g=r.WindCnt2;break;case c.PolyFillType.pftNegative:g=-r.WindCnt2;break;default:g=Math.abs(r.WindCnt2);break}if(e.PolyTyp!=r.PolyTyp)this.AddLocalMinPoly(e,r,t);else if(y==1&&C==1)switch(this.m_ClipType){case c.ClipType.ctIntersection:M>0&&g>0&&this.AddLocalMinPoly(e,r,t);break;case c.ClipType.ctUnion:M<=0&&g<=0&&this.AddLocalMinPoly(e,r,t);break;case c.ClipType.ctDifference:(e.PolyTyp==c.PolyType.ptClip&&M>0&&g>0||e.PolyTyp==c.PolyType.ptSubject&&M<=0&&g<=0)&&this.AddLocalMinPoly(e,r,t);break;case c.ClipType.ctXor:this.AddLocalMinPoly(e,r,t);break}else c.Clipper.SwapSides(e,r)}n!=o&&(n&&e.OutIdx>=0||o&&r.OutIdx>=0)&&(c.Clipper.SwapSides(e,r),c.Clipper.SwapPolyIndexes(e,r)),n&&this.DeleteFromAEL(e),o&&this.DeleteFromAEL(r)};c.Clipper.prototype.DeleteFromAEL=function(e){var r=e.PrevInAEL,t=e.NextInAEL;r===null&&t===null&&e!=this.m_ActiveEdges||(r!==null?r.NextInAEL=t:this.m_ActiveEdges=t,t!==null&&(t.PrevInAEL=r),e.NextInAEL=null,e.PrevInAEL=null)};c.Clipper.prototype.DeleteFromSEL=function(e){var r=e.PrevInSEL,t=e.NextInSEL;r===null&&t===null&&e!=this.m_SortedEdges||(r!==null?r.NextInSEL=t:this.m_SortedEdges=t,t!==null&&(t.PrevInSEL=r),e.NextInSEL=null,e.PrevInSEL=null)};c.Clipper.prototype.UpdateEdgeIntoAEL=function(e){e.NextInLML===null&&c.Error("UpdateEdgeIntoAEL: invalid call");var r=e.PrevInAEL,t=e.NextInAEL;return e.NextInLML.OutIdx=e.OutIdx,r!==null?r.NextInAEL=e.NextInLML:this.m_ActiveEdges=e.NextInLML,t!==null&&(t.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=r,e.NextInAEL=t,c.ClipperBase.IsHorizontal(e)||this.InsertScanbeam(e.Top.Y),e};c.Clipper.prototype.ProcessHorizontals=function(e){for(var r=this.m_SortedEdges;r!==null;)this.DeleteFromSEL(r),this.ProcessHorizontal(r,e),r=this.m_SortedEdges};c.Clipper.prototype.GetHorzDirection=function(e,r){e.Bot.X<e.Top.X?(r.Left=e.Bot.X,r.Right=e.Top.X,r.Dir=c.Direction.dLeftToRight):(r.Left=e.Top.X,r.Right=e.Bot.X,r.Dir=c.Direction.dRightToLeft)};c.Clipper.prototype.PrepareHorzJoins=function(e,r){var t=this.m_PolyOuts[e.OutIdx].Pts;e.Side!=c.EdgeSide.esLeft&&(t=t.Prev),r&&(c.IntPoint.op_Equality(t.Pt,e.Top)?this.AddGhostJoin(t,e.Bot):this.AddGhostJoin(t,e.Top))};c.Clipper.prototype.ProcessHorizontal=function(e,r){var t={Dir:null,Left:null,Right:null};this.GetHorzDirection(e,t);for(var i=t.Dir,n=t.Left,o=t.Right,s=e,l=null;s.NextInLML!==null&&c.ClipperBase.IsHorizontal(s.NextInLML);)s=s.NextInLML;for(s.NextInLML===null&&(l=this.GetMaximaPair(s));;){for(var h=e==s,p=this.GetNextInAEL(e,i);p!==null&&!(p.Curr.X==e.Top.X&&e.NextInLML!==null&&p.Dx<e.NextInLML.Dx);){var m=this.GetNextInAEL(p,i);if(i==c.Direction.dLeftToRight&&p.Curr.X<=o||i==c.Direction.dRightToLeft&&p.Curr.X>=n){if(e.OutIdx>=0&&e.WindDelta!=0&&this.PrepareHorzJoins(e,r),p==l&&h){i==c.Direction.dLeftToRight?this.IntersectEdges(e,p,p.Top,!1):this.IntersectEdges(p,e,p.Top,!1),l.OutIdx>=0&&c.Error("ProcessHorizontal error");return}else if(i==c.Direction.dLeftToRight){var f=new c.IntPoint(p.Curr.X,e.Curr.Y);this.IntersectEdges(e,p,f,!0)}else{var f=new c.IntPoint(p.Curr.X,e.Curr.Y);this.IntersectEdges(p,e,f,!0)}this.SwapPositionsInAEL(e,p)}else if(i==c.Direction.dLeftToRight&&p.Curr.X>=o||i==c.Direction.dRightToLeft&&p.Curr.X<=n)break;p=m}if(e.OutIdx>=0&&e.WindDelta!==0&&this.PrepareHorzJoins(e,r),e.NextInLML!==null&&c.ClipperBase.IsHorizontal(e.NextInLML)){e=this.UpdateEdgeIntoAEL(e),e.OutIdx>=0&&this.AddOutPt(e,e.Bot);var t={Dir:i,Left:n,Right:o};this.GetHorzDirection(e,t),i=t.Dir,n=t.Left,o=t.Right}else break}if(e.NextInLML!==null)if(e.OutIdx>=0){var v=this.AddOutPt(e,e.Top);if(e=this.UpdateEdgeIntoAEL(e),e.WindDelta===0)return;var y=e.PrevInAEL,m=e.NextInAEL;if(y!==null&&y.Curr.X==e.Bot.X&&y.Curr.Y==e.Bot.Y&&y.WindDelta!==0&&y.OutIdx>=0&&y.Curr.Y>y.Top.Y&&c.ClipperBase.SlopesEqual(e,y,this.m_UseFullRange)){var C=this.AddOutPt(y,e.Bot);this.AddJoin(v,C,e.Top)}else if(m!==null&&m.Curr.X==e.Bot.X&&m.Curr.Y==e.Bot.Y&&m.WindDelta!==0&&m.OutIdx>=0&&m.Curr.Y>m.Top.Y&&c.ClipperBase.SlopesEqual(e,m,this.m_UseFullRange)){var C=this.AddOutPt(m,e.Bot);this.AddJoin(v,C,e.Top)}}else e=this.UpdateEdgeIntoAEL(e);else l!==null?l.OutIdx>=0?(i==c.Direction.dLeftToRight?this.IntersectEdges(e,l,e.Top,!1):this.IntersectEdges(l,e,e.Top,!1),l.OutIdx>=0&&c.Error("ProcessHorizontal error")):(this.DeleteFromAEL(e),this.DeleteFromAEL(l)):(e.OutIdx>=0&&this.AddOutPt(e,e.Top),this.DeleteFromAEL(e))};c.Clipper.prototype.GetNextInAEL=function(e,r){return r==c.Direction.dLeftToRight?e.NextInAEL:e.PrevInAEL};c.Clipper.prototype.IsMinima=function(e){return e!==null&&e.Prev.NextInLML!=e&&e.Next.NextInLML!=e};c.Clipper.prototype.IsMaxima=function(e,r){return e!==null&&e.Top.Y==r&&e.NextInLML===null};c.Clipper.prototype.IsIntermediate=function(e,r){return e.Top.Y==r&&e.NextInLML!==null};c.Clipper.prototype.GetMaximaPair=function(e){var r=null;return c.IntPoint.op_Equality(e.Next.Top,e.Top)&&e.Next.NextInLML===null?r=e.Next:c.IntPoint.op_Equality(e.Prev.Top,e.Top)&&e.Prev.NextInLML===null&&(r=e.Prev),r!==null&&(r.OutIdx==-2||r.NextInAEL==r.PrevInAEL&&!c.ClipperBase.IsHorizontal(r))?null:r};c.Clipper.prototype.ProcessIntersections=function(e,r){if(this.m_ActiveEdges==null)return!0;try{if(this.BuildIntersectList(e,r),this.m_IntersectList.length==0)return!0;if(this.m_IntersectList.length==1||this.FixupIntersectionOrder())this.ProcessIntersectList();else return!1}catch(t){this.m_SortedEdges=null,this.m_IntersectList.length=0,c.Error("ProcessIntersections error")}return this.m_SortedEdges=null,!0};c.Clipper.prototype.BuildIntersectList=function(e,r){if(this.m_ActiveEdges!==null){var t=this.m_ActiveEdges;for(this.m_SortedEdges=t;t!==null;)t.PrevInSEL=t.PrevInAEL,t.NextInSEL=t.NextInAEL,t.Curr.X=c.Clipper.TopX(t,r),t=t.NextInAEL;for(var i=!0;i&&this.m_SortedEdges!==null;){for(i=!1,t=this.m_SortedEdges;t.NextInSEL!==null;){var n=t.NextInSEL,o=new c.IntPoint;if(t.Curr.X>n.Curr.X){!this.IntersectPoint(t,n,o)&&t.Curr.X>n.Curr.X+1&&c.Error("Intersection error"),o.Y>e&&(o.Y=e,Math.abs(t.Dx)>Math.abs(n.Dx)?o.X=c.Clipper.TopX(n,e):o.X=c.Clipper.TopX(t,e));var s=new c.IntersectNode;s.Edge1=t,s.Edge2=n,s.Pt.X=o.X,s.Pt.Y=o.Y,this.m_IntersectList.push(s),this.SwapPositionsInSEL(t,n),i=!0}else t=n}if(t.PrevInSEL!==null)t.PrevInSEL.NextInSEL=null;else break}this.m_SortedEdges=null}};c.Clipper.prototype.EdgesAdjacent=function(e){return e.Edge1.NextInSEL==e.Edge2||e.Edge1.PrevInSEL==e.Edge2};c.Clipper.IntersectNodeSort=function(e,r){return r.Pt.Y-e.Pt.Y};c.Clipper.prototype.FixupIntersectionOrder=function(){this.m_IntersectList.sort(this.m_IntersectNodeComparer),this.CopyAELToSEL();for(var e=this.m_IntersectList.length,r=0;r<e;r++){if(!this.EdgesAdjacent(this.m_IntersectList[r])){for(var t=r+1;t<e&&!this.EdgesAdjacent(this.m_IntersectList[t]);)t++;if(t==e)return!1;var i=this.m_IntersectList[r];this.m_IntersectList[r]=this.m_IntersectList[t],this.m_IntersectList[t]=i}this.SwapPositionsInSEL(this.m_IntersectList[r].Edge1,this.m_IntersectList[r].Edge2)}return!0};c.Clipper.prototype.ProcessIntersectList=function(){for(var e=0,r=this.m_IntersectList.length;e<r;e++){var t=this.m_IntersectList[e];this.IntersectEdges(t.Edge1,t.Edge2,t.Pt,!0),this.SwapPositionsInAEL(t.Edge1,t.Edge2)}this.m_IntersectList.length=0};var oS=a(function(e){return e<0?Math.ceil(e-.5):Math.round(e)},"R1"),sS=a(function(e){return e<0?Math.ceil(e-.5):Math.floor(e+.5)},"R2"),aS=a(function(e){return e<0?-Math.round(Math.abs(e)):Math.round(e)},"R3"),lS=a(function(e){return e<0?(e-=.5,e<-2147483648?Math.ceil(e):e|0):(e+=.5,e>2147483647?Math.floor(e):e|0)},"R4");te.msie?c.Clipper.Round=oS:te.chromium?c.Clipper.Round=aS:te.safari?c.Clipper.Round=lS:c.Clipper.Round=sS;c.Clipper.TopX=function(e,r){return r==e.Top.Y?e.Top.X:e.Bot.X+c.Clipper.Round(e.Dx*(r-e.Bot.Y))};c.Clipper.prototype.IntersectPoint=function(e,r,t){t.X=0,t.Y=0;var i,n;if(c.ClipperBase.SlopesEqual(e,r,this.m_UseFullRange)||e.Dx==r.Dx)return r.Bot.Y>e.Bot.Y?(t.X=r.Bot.X,t.Y=r.Bot.Y):(t.X=e.Bot.X,t.Y=e.Bot.Y),!1;if(e.Delta.X===0)t.X=e.Bot.X,c.ClipperBase.IsHorizontal(r)?t.Y=r.Bot.Y:(n=r.Bot.Y-r.Bot.X/r.Dx,t.Y=c.Clipper.Round(t.X/r.Dx+n));else if(r.Delta.X===0)t.X=r.Bot.X,c.ClipperBase.IsHorizontal(e)?t.Y=e.Bot.Y:(i=e.Bot.Y-e.Bot.X/e.Dx,t.Y=c.Clipper.Round(t.X/e.Dx+i));else{i=e.Bot.X-e.Bot.Y*e.Dx,n=r.Bot.X-r.Bot.Y*r.Dx;var o=(n-i)/(e.Dx-r.Dx);t.Y=c.Clipper.Round(o),Math.abs(e.Dx)<Math.abs(r.Dx)?t.X=c.Clipper.Round(e.Dx*o+i):t.X=c.Clipper.Round(r.Dx*o+n)}if(t.Y<e.Top.Y||t.Y<r.Top.Y){if(e.Top.Y>r.Top.Y)return t.Y=e.Top.Y,t.X=c.Clipper.TopX(r,e.Top.Y),t.X<e.Top.X;t.Y=r.Top.Y,Math.abs(e.Dx)<Math.abs(r.Dx)?t.X=c.Clipper.TopX(e,t.Y):t.X=c.Clipper.TopX(r,t.Y)}return!0};c.Clipper.prototype.ProcessEdgesAtTopOfScanbeam=function(e){for(var r=this.m_ActiveEdges;r!==null;){var t=this.IsMaxima(r,e);if(t){var i=this.GetMaximaPair(r);t=i===null||!c.ClipperBase.IsHorizontal(i)}if(t){var n=r.PrevInAEL;this.DoMaxima(r),n===null?r=this.m_ActiveEdges:r=n.NextInAEL}else{if(this.IsIntermediate(r,e)&&c.ClipperBase.IsHorizontal(r.NextInLML)?(r=this.UpdateEdgeIntoAEL(r),r.OutIdx>=0&&this.AddOutPt(r,r.Bot),this.AddEdgeToSEL(r)):(r.Curr.X=c.Clipper.TopX(r,e),r.Curr.Y=e),this.StrictlySimple){var n=r.PrevInAEL;if(r.OutIdx>=0&&r.WindDelta!==0&&n!==null&&n.OutIdx>=0&&n.Curr.X==r.Curr.X&&n.WindDelta!==0){var o=this.AddOutPt(n,r.Curr),s=this.AddOutPt(r,r.Curr);this.AddJoin(o,s,r.Curr)}}r=r.NextInAEL}}for(this.ProcessHorizontals(!0),r=this.m_ActiveEdges;r!==null;){if(this.IsIntermediate(r,e)){var o=null;r.OutIdx>=0&&(o=this.AddOutPt(r,r.Top)),r=this.UpdateEdgeIntoAEL(r);var n=r.PrevInAEL,l=r.NextInAEL;if(n!==null&&n.Curr.X==r.Bot.X&&n.Curr.Y==r.Bot.Y&&o!==null&&n.OutIdx>=0&&n.Curr.Y>n.Top.Y&&c.ClipperBase.SlopesEqual(r,n,this.m_UseFullRange)&&r.WindDelta!==0&&n.WindDelta!==0){var s=this.AddOutPt(n,r.Bot);this.AddJoin(o,s,r.Top)}else if(l!==null&&l.Curr.X==r.Bot.X&&l.Curr.Y==r.Bot.Y&&o!==null&&l.OutIdx>=0&&l.Curr.Y>l.Top.Y&&c.ClipperBase.SlopesEqual(r,l,this.m_UseFullRange)&&r.WindDelta!==0&&l.WindDelta!==0){var s=this.AddOutPt(l,r.Bot);this.AddJoin(o,s,r.Top)}}r=r.NextInAEL}};c.Clipper.prototype.DoMaxima=function(e){var r=this.GetMaximaPair(e);if(r===null){e.OutIdx>=0&&this.AddOutPt(e,e.Top),this.DeleteFromAEL(e);return}for(var t=e.NextInAEL,i=!0;t!==null&&t!=r;)this.IntersectEdges(e,t,e.Top,!0),this.SwapPositionsInAEL(e,t),t=e.NextInAEL;e.OutIdx==-1&&r.OutIdx==-1?(this.DeleteFromAEL(e),this.DeleteFromAEL(r)):e.OutIdx>=0&&r.OutIdx>=0?this.IntersectEdges(e,r,e.Top,!1):i&&e.WindDelta===0?(e.OutIdx>=0&&(this.AddOutPt(e,e.Top),e.OutIdx=-1),this.DeleteFromAEL(e),r.OutIdx>=0&&(this.AddOutPt(r,e.Top),r.OutIdx=-1),this.DeleteFromAEL(r)):c.Error("DoMaxima error")};c.Clipper.ReversePaths=function(e){for(var r=0,t=e.length;r<t;r++)e[r].reverse()};c.Clipper.Orientation=function(e){return c.Clipper.Area(e)>=0};c.Clipper.prototype.PointCount=function(e){if(e===null)return 0;var r=0,t=e;do r++,t=t.Next;while(t!=e);return r};c.Clipper.prototype.BuildResult=function(e){c.Clear(e);for(var r=0,t=this.m_PolyOuts.length;r<t;r++){var i=this.m_PolyOuts[r];if(i.Pts!==null){var n=i.Pts.Prev,o=this.PointCount(n);if(!(o<2)){for(var s=new Array(o),l=0;l<o;l++)s[l]=n.Pt,n=n.Prev;e.push(s)}}}};c.Clipper.prototype.BuildResult2=function(e){e.Clear();for(var r=0,t=this.m_PolyOuts.length;r<t;r++){var i=this.m_PolyOuts[r],n=this.PointCount(i.Pts);if(!(i.IsOpen&&n<2||!i.IsOpen&&n<3)){this.FixHoleLinkage(i);var o=new c.PolyNode;e.m_AllPolys.push(o),i.PolyNode=o,o.m_polygon.length=n;for(var s=i.Pts.Prev,l=0;l<n;l++)o.m_polygon[l]=s.Pt,s=s.Prev}}for(var r=0,t=this.m_PolyOuts.length;r<t;r++){var i=this.m_PolyOuts[r];i.PolyNode!==null&&(i.IsOpen?(i.PolyNode.IsOpen=!0,e.AddChild(i.PolyNode)):i.FirstLeft!==null&&i.FirstLeft.PolyNode!=null?i.FirstLeft.PolyNode.AddChild(i.PolyNode):e.AddChild(i.PolyNode))}};c.Clipper.prototype.FixupOutPolygon=function(e){var r=null;e.BottomPt=null;for(var t=e.Pts;;){if(t.Prev==t||t.Prev==t.Next){this.DisposeOutPts(t),e.Pts=null;return}if(c.IntPoint.op_Equality(t.Pt,t.Next.Pt)||c.IntPoint.op_Equality(t.Pt,t.Prev.Pt)||c.ClipperBase.SlopesEqual(t.Prev.Pt,t.Pt,t.Next.Pt,this.m_UseFullRange)&&(!this.PreserveCollinear||!this.Pt2IsBetweenPt1AndPt3(t.Prev.Pt,t.Pt,t.Next.Pt))){r=null;var i=t;t.Prev.Next=t.Next,t.Next.Prev=t.Prev,t=t.Prev,i=null}else{if(t==r)break;r===null&&(r=t),t=t.Next}}e.Pts=t};c.Clipper.prototype.DupOutPt=function(e,r){var t=new c.OutPt;return t.Pt.X=e.Pt.X,t.Pt.Y=e.Pt.Y,t.Idx=e.Idx,r?(t.Next=e.Next,t.Prev=e,e.Next.Prev=t,e.Next=t):(t.Prev=e.Prev,t.Next=e,e.Prev.Next=t,e.Prev=t),t};c.Clipper.prototype.GetOverlap=function(e,r,t,i,n){return e<r?t<i?(n.Left=Math.max(e,t),n.Right=Math.min(r,i)):(n.Left=Math.max(e,i),n.Right=Math.min(r,t)):t<i?(n.Left=Math.max(r,t),n.Right=Math.min(e,i)):(n.Left=Math.max(r,i),n.Right=Math.min(e,t)),n.Left<n.Right};c.Clipper.prototype.JoinHorz=function(e,r,t,i,n,o){var s=e.Pt.X>r.Pt.X?c.Direction.dRightToLeft:c.Direction.dLeftToRight,l=t.Pt.X>i.Pt.X?c.Direction.dRightToLeft:c.Direction.dLeftToRight;if(s==l)return!1;if(s==c.Direction.dLeftToRight){for(;e.Next.Pt.X<=n.X&&e.Next.Pt.X>=e.Pt.X&&e.Next.Pt.Y==n.Y;)e=e.Next;o&&e.Pt.X!=n.X&&(e=e.Next),r=this.DupOutPt(e,!o),c.IntPoint.op_Inequality(r.Pt,n)&&(e=r,e.Pt.X=n.X,e.Pt.Y=n.Y,r=this.DupOutPt(e,!o))}else{for(;e.Next.Pt.X>=n.X&&e.Next.Pt.X<=e.Pt.X&&e.Next.Pt.Y==n.Y;)e=e.Next;!o&&e.Pt.X!=n.X&&(e=e.Next),r=this.DupOutPt(e,o),c.IntPoint.op_Inequality(r.Pt,n)&&(e=r,e.Pt.X=n.X,e.Pt.Y=n.Y,r=this.DupOutPt(e,o))}if(l==c.Direction.dLeftToRight){for(;t.Next.Pt.X<=n.X&&t.Next.Pt.X>=t.Pt.X&&t.Next.Pt.Y==n.Y;)t=t.Next;o&&t.Pt.X!=n.X&&(t=t.Next),i=this.DupOutPt(t,!o),c.IntPoint.op_Inequality(i.Pt,n)&&(t=i,t.Pt.X=n.X,t.Pt.Y=n.Y,i=this.DupOutPt(t,!o))}else{for(;t.Next.Pt.X>=n.X&&t.Next.Pt.X<=t.Pt.X&&t.Next.Pt.Y==n.Y;)t=t.Next;!o&&t.Pt.X!=n.X&&(t=t.Next),i=this.DupOutPt(t,o),c.IntPoint.op_Inequality(i.Pt,n)&&(t=i,t.Pt.X=n.X,t.Pt.Y=n.Y,i=this.DupOutPt(t,o))}return s==c.Direction.dLeftToRight==o?(e.Prev=t,t.Next=e,r.Next=i,i.Prev=r):(e.Next=t,t.Prev=e,r.Prev=i,i.Next=r),!0};c.Clipper.prototype.JoinPoints=function(e,r,t){var i=e.OutPt1,n=new c.OutPt,o=e.OutPt2,s=new c.OutPt,l=e.OutPt1.Pt.Y==e.OffPt.Y;if(l&&c.IntPoint.op_Equality(e.OffPt,e.OutPt1.Pt)&&c.IntPoint.op_Equality(e.OffPt,e.OutPt2.Pt)){for(n=e.OutPt1.Next;n!=i&&c.IntPoint.op_Equality(n.Pt,e.OffPt);)n=n.Next;var h=n.Pt.Y>e.OffPt.Y;for(s=e.OutPt2.Next;s!=o&&c.IntPoint.op_Equality(s.Pt,e.OffPt);)s=s.Next;var p=s.Pt.Y>e.OffPt.Y;return h==p?!1:h?(n=this.DupOutPt(i,!1),s=this.DupOutPt(o,!0),i.Prev=o,o.Next=i,n.Next=s,s.Prev=n,e.OutPt1=i,e.OutPt2=n,!0):(n=this.DupOutPt(i,!0),s=this.DupOutPt(o,!1),i.Next=o,o.Prev=i,n.Prev=s,s.Next=n,e.OutPt1=i,e.OutPt2=n,!0)}else if(l){for(n=i;i.Prev.Pt.Y==i.Pt.Y&&i.Prev!=n&&i.Prev!=o;)i=i.Prev;for(;n.Next.Pt.Y==n.Pt.Y&&n.Next!=i&&n.Next!=o;)n=n.Next;if(n.Next==i||n.Next==o)return!1;for(s=o;o.Prev.Pt.Y==o.Pt.Y&&o.Prev!=s&&o.Prev!=n;)o=o.Prev;for(;s.Next.Pt.Y==s.Pt.Y&&s.Next!=o&&s.Next!=i;)s=s.Next;if(s.Next==o||s.Next==i)return!1;var m={Left:null,Right:null};if(!this.GetOverlap(i.Pt.X,n.Pt.X,o.Pt.X,s.Pt.X,m))return!1;var f=m.Left,v=m.Right,y=new c.IntPoint,C;return i.Pt.X>=f&&i.Pt.X<=v?(y.X=i.Pt.X,y.Y=i.Pt.Y,C=i.Pt.X>n.Pt.X):o.Pt.X>=f&&o.Pt.X<=v?(y.X=o.Pt.X,y.Y=o.Pt.Y,C=o.Pt.X>s.Pt.X):n.Pt.X>=f&&n.Pt.X<=v?(y.X=n.Pt.X,y.Y=n.Pt.Y,C=n.Pt.X>i.Pt.X):(y.X=s.Pt.X,y.Y=s.Pt.Y,C=s.Pt.X>o.Pt.X),e.OutPt1=i,e.OutPt2=o,this.JoinHorz(i,n,o,s,y,C)}else{for(n=i.Next;c.IntPoint.op_Equality(n.Pt,i.Pt)&&n!=i;)n=n.Next;var M=n.Pt.Y>i.Pt.Y||!c.ClipperBase.SlopesEqual(i.Pt,n.Pt,e.OffPt,this.m_UseFullRange);if(M){for(n=i.Prev;c.IntPoint.op_Equality(n.Pt,i.Pt)&&n!=i;)n=n.Prev;if(n.Pt.Y>i.Pt.Y||!c.ClipperBase.SlopesEqual(i.Pt,n.Pt,e.OffPt,this.m_UseFullRange))return!1}for(s=o.Next;c.IntPoint.op_Equality(s.Pt,o.Pt)&&s!=o;)s=s.Next;var g=s.Pt.Y>o.Pt.Y||!c.ClipperBase.SlopesEqual(o.Pt,s.Pt,e.OffPt,this.m_UseFullRange);if(g){for(s=o.Prev;c.IntPoint.op_Equality(s.Pt,o.Pt)&&s!=o;)s=s.Prev;if(s.Pt.Y>o.Pt.Y||!c.ClipperBase.SlopesEqual(o.Pt,s.Pt,e.OffPt,this.m_UseFullRange))return!1}return n==i||s==o||n==s||r==t&&M==g?!1:M?(n=this.DupOutPt(i,!1),s=this.DupOutPt(o,!0),i.Prev=o,o.Next=i,n.Next=s,s.Prev=n,e.OutPt1=i,e.OutPt2=n,!0):(n=this.DupOutPt(i,!0),s=this.DupOutPt(o,!1),i.Next=o,o.Prev=i,n.Prev=s,s.Next=n,e.OutPt1=i,e.OutPt2=n,!0)}};c.Clipper.GetBounds=function(e){for(var r=0,t=e.length;r<t&&e[r].length==0;)r++;if(r==t)return new c.IntRect(0,0,0,0);var i=new c.IntRect;for(i.left=e[r][0].X,i.right=i.left,i.top=e[r][0].Y,i.bottom=i.top;r<t;r++)for(var n=0,o=e[r].length;n<o;n++)e[r][n].X<i.left?i.left=e[r][n].X:e[r][n].X>i.right&&(i.right=e[r][n].X),e[r][n].Y<i.top?i.top=e[r][n].Y:e[r][n].Y>i.bottom&&(i.bottom=e[r][n].Y);return i};c.Clipper.prototype.GetBounds2=function(e){var r=e,t=new c.IntRect;for(t.left=e.Pt.X,t.right=e.Pt.X,t.top=e.Pt.Y,t.bottom=e.Pt.Y,e=e.Next;e!=r;)e.Pt.X<t.left&&(t.left=e.Pt.X),e.Pt.X>t.right&&(t.right=e.Pt.X),e.Pt.Y<t.top&&(t.top=e.Pt.Y),e.Pt.Y>t.bottom&&(t.bottom=e.Pt.Y),e=e.Next;return t};c.Clipper.PointInPolygon=function(e,r){var t=0,i=r.length;if(i<3)return 0;for(var n=r[0],o=1;o<=i;++o){var s=o==i?r[0]:r[o];if(s.Y==e.Y&&(s.X==e.X||n.Y==e.Y&&s.X>e.X==n.X<e.X))return-1;if(n.Y<e.Y!=s.Y<e.Y){if(n.X>=e.X)if(s.X>e.X)t=1-t;else{var l=(n.X-e.X)*(s.Y-e.Y)-(s.X-e.X)*(n.Y-e.Y);if(l==0)return-1;l>0==s.Y>n.Y&&(t=1-t)}else if(s.X>e.X){var l=(n.X-e.X)*(s.Y-e.Y)-(s.X-e.X)*(n.Y-e.Y);if(l==0)return-1;l>0==s.Y>n.Y&&(t=1-t)}}n=s}return t};c.Clipper.prototype.PointInPolygon=function(e,r){for(var t=0,i=r;;){var n=r.Pt.X,o=r.Pt.Y,s=r.Next.Pt.X,l=r.Next.Pt.Y;if(l==e.Y&&(s==e.X||o==e.Y&&s>e.X==n<e.X))return-1;if(o<e.Y!=l<e.Y){if(n>=e.X)if(s>e.X)t=1-t;else{var h=(n-e.X)*(l-e.Y)-(s-e.X)*(o-e.Y);if(h==0)return-1;h>0==l>o&&(t=1-t)}else if(s>e.X){var h=(n-e.X)*(l-e.Y)-(s-e.X)*(o-e.Y);if(h==0)return-1;h>0==l>o&&(t=1-t)}}if(r=r.Next,i==r)break}return t};c.Clipper.prototype.Poly2ContainsPoly1=function(e,r){var t=e;do{var i=this.PointInPolygon(t.Pt,r);if(i>=0)return i!=0;t=t.Next}while(t!=e);return!0};c.Clipper.prototype.FixupFirstLefts1=function(e,r){for(var t=0,i=this.m_PolyOuts.length;t<i;t++){var n=this.m_PolyOuts[t];n.Pts!==null&&n.FirstLeft==e&&this.Poly2ContainsPoly1(n.Pts,r.Pts)&&(n.FirstLeft=r)}};c.Clipper.prototype.FixupFirstLefts2=function(e,r){for(var t=0,i=this.m_PolyOuts,n=i.length,o=i[t];t<n;t++,o=i[t])o.FirstLeft==e&&(o.FirstLeft=r)};c.Clipper.ParseFirstLeft=function(e){for(;e!=null&&e.Pts==null;)e=e.FirstLeft;return e};c.Clipper.prototype.JoinCommonEdges=function(){for(var e=0,r=this.m_Joins.length;e<r;e++){var t=this.m_Joins[e],i=this.GetOutRec(t.OutPt1.Idx),n=this.GetOutRec(t.OutPt2.Idx);if(!(i.Pts==null||n.Pts==null)){var o;if(i==n?o=i:this.Param1RightOfParam2(i,n)?o=n:this.Param1RightOfParam2(n,i)?o=i:o=this.GetLowermostRec(i,n),!!this.JoinPoints(t,i,n))if(i==n){if(i.Pts=t.OutPt1,i.BottomPt=null,n=this.CreateOutRec(),n.Pts=t.OutPt2,this.UpdateOutPtIdxs(n),this.m_UsingPolyTree)for(var s=0,l=this.m_PolyOuts.length;s<l-1;s++){var h=this.m_PolyOuts[s];h.Pts==null||c.Clipper.ParseFirstLeft(h.FirstLeft)!=i||h.IsHole==i.IsHole||this.Poly2ContainsPoly1(h.Pts,t.OutPt2)&&(h.FirstLeft=n)}this.Poly2ContainsPoly1(n.Pts,i.Pts)?(n.IsHole=!i.IsHole,n.FirstLeft=i,this.m_UsingPolyTree&&this.FixupFirstLefts2(n,i),(n.IsHole^this.ReverseSolution)==this.Area(n)>0&&this.ReversePolyPtLinks(n.Pts)):this.Poly2ContainsPoly1(i.Pts,n.Pts)?(n.IsHole=i.IsHole,i.IsHole=!n.IsHole,n.FirstLeft=i.FirstLeft,i.FirstLeft=n,this.m_UsingPolyTree&&this.FixupFirstLefts2(i,n),(i.IsHole^this.ReverseSolution)==this.Area(i)>0&&this.ReversePolyPtLinks(i.Pts)):(n.IsHole=i.IsHole,n.FirstLeft=i.FirstLeft,this.m_UsingPolyTree&&this.FixupFirstLefts1(i,n))}else n.Pts=null,n.BottomPt=null,n.Idx=i.Idx,i.IsHole=o.IsHole,o==n&&(i.FirstLeft=n.FirstLeft),n.FirstLeft=i,this.m_UsingPolyTree&&this.FixupFirstLefts2(n,i)}}};c.Clipper.prototype.UpdateOutPtIdxs=function(e){var r=e.Pts;do r.Idx=e.Idx,r=r.Prev;while(r!=e.Pts)};c.Clipper.prototype.DoSimplePolygons=function(){for(var e=0;e<this.m_PolyOuts.length;){var r=this.m_PolyOuts[e++],t=r.Pts;if(t!==null)do{for(var i=t.Next;i!=r.Pts;){if(c.IntPoint.op_Equality(t.Pt,i.Pt)&&i.Next!=t&&i.Prev!=t){var n=t.Prev,o=i.Prev;t.Prev=o,o.Next=t,i.Prev=n,n.Next=i,r.Pts=t;var s=this.CreateOutRec();s.Pts=i,this.UpdateOutPtIdxs(s),this.Poly2ContainsPoly1(s.Pts,r.Pts)?(s.IsHole=!r.IsHole,s.FirstLeft=r):this.Poly2ContainsPoly1(r.Pts,s.Pts)?(s.IsHole=r.IsHole,r.IsHole=!s.IsHole,s.FirstLeft=r.FirstLeft,r.FirstLeft=s):(s.IsHole=r.IsHole,s.FirstLeft=r.FirstLeft),i=t}i=i.Next}t=t.Next}while(t!=r.Pts)}};c.Clipper.Area=function(e){var r=e.length;if(r<3)return 0;for(var t=0,i=0,n=r-1;i<r;++i)t+=(e[n].X+e[i].X)*(e[n].Y-e[i].Y),n=i;return-t*.5};c.Clipper.prototype.Area=function(e){var r=e.Pts;if(r==null)return 0;var t=0;do t=t+(r.Prev.Pt.X+r.Pt.X)*(r.Prev.Pt.Y-r.Pt.Y),r=r.Next;while(r!=e.Pts);return t*.5};Rd&&(c.Clipper.OffsetPaths=function(e,r,t,i,n){var o=new c.Paths,s=new c.ClipperOffset(n,n);return s.AddPaths(e,t,i),s.Execute(o,r),o});c.Clipper.SimplifyPolygon=function(e,r){var t=new Array,i=new c.Clipper(0);return i.StrictlySimple=!0,i.AddPath(e,c.PolyType.ptSubject,!0),i.Execute(c.ClipType.ctUnion,t,r,r),t};c.Clipper.SimplifyPolygons=function(e,r){typeof r>"u"&&(r=c.PolyFillType.pftEvenOdd);var t=new Array,i=new c.Clipper(0);return i.StrictlySimple=!0,i.AddPaths(e,c.PolyType.ptSubject,!0),i.Execute(c.ClipType.ctUnion,t,r,r),t};c.Clipper.DistanceSqrd=function(e,r){var t=e.X-r.X,i=e.Y-r.Y;return t*t+i*i};c.Clipper.DistanceFromLineSqrd=function(e,r,t){var i=r.Y-t.Y,n=t.X-r.X,o=i*r.X+n*r.Y;return o=i*e.X+n*e.Y-o,o*o/(i*i+n*n)};c.Clipper.SlopesNearCollinear=function(e,r,t,i){return c.Clipper.DistanceFromLineSqrd(r,e,t)<i};c.Clipper.PointsAreClose=function(e,r,t){var i=e.X-r.X,n=e.Y-r.Y;return i*i+n*n<=t};c.Clipper.ExcludeOp=function(e){var r=e.Prev;return r.Next=e.Next,e.Next.Prev=r,r.Idx=0,r};c.Clipper.CleanPolygon=function(e,r){typeof r>"u"&&(r=1.415);var t=e.length;if(t==0)return new Array;for(var i=new Array(t),n=0;n<t;++n)i[n]=new c.OutPt;for(var n=0;n<t;++n)i[n].Pt=e[n],i[n].Next=i[(n+1)%t],i[n].Next.Prev=i[n],i[n].Idx=0;for(var o=r*r,s=i[0];s.Idx==0&&s.Next!=s.Prev;)c.Clipper.PointsAreClose(s.Pt,s.Prev.Pt,o)?(s=c.Clipper.ExcludeOp(s),t--):c.Clipper.PointsAreClose(s.Prev.Pt,s.Next.Pt,o)?(c.Clipper.ExcludeOp(s.Next),s=c.Clipper.ExcludeOp(s),t-=2):c.Clipper.SlopesNearCollinear(s.Prev.Pt,s.Pt,s.Next.Pt,o)?(s=c.Clipper.ExcludeOp(s),t--):(s.Idx=1,s=s.Next);t<3&&(t=0);for(var l=new Array(t),n=0;n<t;++n)l[n]=new c.IntPoint(s.Pt),s=s.Next;return i=null,l};c.Clipper.CleanPolygons=function(e,r){for(var t=new Array(e.length),i=0,n=e.length;i<n;i++)t[i]=c.Clipper.CleanPolygon(e[i],r);return t};c.Clipper.Minkowski=function(e,r,t,i){var n=i?1:0,o=e.length,s=r.length,l=new Array;if(t)for(var h=0;h<s;h++){for(var p=new Array(o),m=0,f=e.length,v=e[m];m<f;m++,v=e[m])p[m]=new c.IntPoint(r[h].X+v.X,r[h].Y+v.Y);l.push(p)}else for(var h=0;h<s;h++){for(var p=new Array(o),m=0,f=e.length,v=e[m];m<f;m++,v=e[m])p[m]=new c.IntPoint(r[h].X-v.X,r[h].Y-v.Y);l.push(p)}for(var y=new Array,h=0;h<s-1+n;h++)for(var m=0;m<o;m++){var C=new Array;C.push(l[h%s][m%o]),C.push(l[(h+1)%s][m%o]),C.push(l[(h+1)%s][(m+1)%o]),C.push(l[h%s][(m+1)%o]),c.Clipper.Orientation(C)||C.reverse(),y.push(C)}var M=new c.Clipper(0);return M.AddPaths(y,c.PolyType.ptSubject,!0),M.Execute(c.ClipType.ctUnion,l,c.PolyFillType.pftNonZero,c.PolyFillType.pftNonZero),l};c.Clipper.MinkowskiSum=function(){var e=arguments,r=e.length;if(r==3){var t=e[0],i=e[1],n=e[2];return c.Clipper.Minkowski(t,i,!0,n)}else if(r==4){for(var t=e[0],o=e[1],s=e[2],n=e[3],l=new c.Clipper,h,p=0,m=o.length;p<m;++p){var h=c.Clipper.Minkowski(t,o[p],!0,n);l.AddPaths(h,c.PolyType.ptSubject,!0)}n&&l.AddPaths(o,c.PolyType.ptClip,!0);var f=new c.Paths;return l.Execute(c.ClipType.ctUnion,f,s,s),f}};c.Clipper.MinkowskiDiff=function(e,r,t){return c.Clipper.Minkowski(e,r,!1,t)};c.Clipper.PolyTreeToPaths=function(e){var r=new Array;return c.Clipper.AddPolyNodeToPaths(e,c.Clipper.NodeType.ntAny,r),r};c.Clipper.AddPolyNodeToPaths=function(e,r,t){var i=!0;switch(r){case c.Clipper.NodeType.ntOpen:return;case c.Clipper.NodeType.ntClosed:i=!e.IsOpen;break;default:break}e.m_polygon.length>0&&i&&t.push(e.m_polygon);for(var n=0,o=e.Childs(),s=o.length,l=o[n];n<s;n++,l=o[n])c.Clipper.AddPolyNodeToPaths(l,r,t)};c.Clipper.OpenPathsFromPolyTree=function(e){for(var r=new c.Paths,t=0,i=e.ChildCount();t<i;t++)e.Childs()[t].IsOpen&&r.push(e.Childs()[t].m_polygon);return r};c.Clipper.ClosedPathsFromPolyTree=function(e){var r=new c.Paths;return c.Clipper.AddPolyNodeToPaths(e,c.Clipper.NodeType.ntClosed,r),r};Ms(c.Clipper,c.ClipperBase);c.Clipper.NodeType={ntAny:0,ntOpen:1,ntClosed:2};c.ClipperOffset=function(e,r){typeof e>"u"&&(e=2),typeof r>"u"&&(r=c.ClipperOffset.def_arc_tolerance),this.m_destPolys=new c.Paths,this.m_srcPoly=new c.Path,this.m_destPoly=new c.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 c.IntPoint,this.m_polyNodes=new c.PolyNode,this.MiterLimit=e,this.ArcTolerance=r,this.m_lowest.X=-1};c.ClipperOffset.two_pi=6.28318530717959;c.ClipperOffset.def_arc_tolerance=.25;c.ClipperOffset.prototype.Clear=function(){c.Clear(this.m_polyNodes.Childs()),this.m_lowest.X=-1};c.ClipperOffset.Round=c.Clipper.Round;c.ClipperOffset.prototype.AddPath=function(e,r,t){var i=e.length-1;if(!(i<0)){var n=new c.PolyNode;if(n.m_jointype=r,n.m_endtype=t,t==c.EndType.etClosedLine||t==c.EndType.etClosedPolygon)for(;i>0&&c.IntPoint.op_Equality(e[0],e[i]);)i--;n.m_polygon.push(e[0]);for(var o=0,s=0,l=1;l<=i;l++)c.IntPoint.op_Inequality(n.m_polygon[o],e[l])&&(o++,n.m_polygon.push(e[l]),(e[l].Y>n.m_polygon[s].Y||e[l].Y==n.m_polygon[s].Y&&e[l].X<n.m_polygon[s].X)&&(s=o));if(!(t==c.EndType.etClosedPolygon&&o<2||t!=c.EndType.etClosedPolygon&&o<0)&&(this.m_polyNodes.AddChild(n),t==c.EndType.etClosedPolygon))if(this.m_lowest.X<0)this.m_lowest=new c.IntPoint(0,s);else{var h=this.m_polyNodes.Childs()[this.m_lowest.X].m_polygon[this.m_lowest.Y];(n.m_polygon[s].Y>h.Y||n.m_polygon[s].Y==h.Y&&n.m_polygon[s].X<h.X)&&(this.m_lowest=new c.IntPoint(this.m_polyNodes.ChildCount()-1,s))}}};c.ClipperOffset.prototype.AddPaths=function(e,r,t){for(var i=0,n=e.length;i<n;i++)this.AddPath(e[i],r,t)};c.ClipperOffset.prototype.FixOrientations=function(){if(this.m_lowest.X>=0&&!c.Clipper.Orientation(this.m_polyNodes.Childs()[this.m_lowest.X].m_polygon))for(var e=0;e<this.m_polyNodes.ChildCount();e++){var r=this.m_polyNodes.Childs()[e];(r.m_endtype==c.EndType.etClosedPolygon||r.m_endtype==c.EndType.etClosedLine&&c.Clipper.Orientation(r.m_polygon))&&r.m_polygon.reverse()}else for(var e=0;e<this.m_polyNodes.ChildCount();e++){var r=this.m_polyNodes.Childs()[e];r.m_endtype==c.EndType.etClosedLine&&!c.Clipper.Orientation(r.m_polygon)&&r.m_polygon.reverse()}};c.ClipperOffset.GetUnitNormal=function(e,r){var t=r.X-e.X,i=r.Y-e.Y;if(t==0&&i==0)return new c.DoublePoint(0,0);var n=1/Math.sqrt(t*t+i*i);return t*=n,i*=n,new c.DoublePoint(i,-t)};c.ClipperOffset.prototype.DoOffset=function(e){if(this.m_destPolys=new Array,this.m_delta=e,c.ClipperBase.near_zero(e)){for(var r=0;r<this.m_polyNodes.ChildCount();r++){var t=this.m_polyNodes.Childs()[r];t.m_endtype==c.EndType.etClosedPolygon&&this.m_destPolys.push(t.m_polygon)}return}this.MiterLimit>2?this.m_miterLim=2/(this.MiterLimit*this.MiterLimit):this.m_miterLim=.5;var i;this.ArcTolerance<=0?i=c.ClipperOffset.def_arc_tolerance:this.ArcTolerance>Math.abs(e)*c.ClipperOffset.def_arc_tolerance?i=Math.abs(e)*c.ClipperOffset.def_arc_tolerance:i=this.ArcTolerance;var n=3.14159265358979/Math.acos(1-i/Math.abs(e));this.m_sin=Math.sin(c.ClipperOffset.two_pi/n),this.m_cos=Math.cos(c.ClipperOffset.two_pi/n),this.m_StepsPerRad=n/c.ClipperOffset.two_pi,e<0&&(this.m_sin=-this.m_sin);for(var r=0;r<this.m_polyNodes.ChildCount();r++){var t=this.m_polyNodes.Childs()[r];this.m_srcPoly=t.m_polygon;var o=this.m_srcPoly.length;if(!(o==0||e<=0&&(o<3||t.m_endtype!=c.EndType.etClosedPolygon))){if(this.m_destPoly=new Array,o==1){if(t.m_jointype==c.JoinType.jtRound)for(var s=1,l=0,h=1;h<=n;h++){this.m_destPoly.push(new c.IntPoint(c.ClipperOffset.Round(this.m_srcPoly[0].X+s*e),c.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,h=0;h<4;++h)this.m_destPoly.push(new c.IntPoint(c.ClipperOffset.Round(this.m_srcPoly[0].X+s*e),c.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 h=0;h<o-1;h++)this.m_normals.push(c.ClipperOffset.GetUnitNormal(this.m_srcPoly[h],this.m_srcPoly[h+1]));if(t.m_endtype==c.EndType.etClosedLine||t.m_endtype==c.EndType.etClosedPolygon?this.m_normals.push(c.ClipperOffset.GetUnitNormal(this.m_srcPoly[o-1],this.m_srcPoly[0])):this.m_normals.push(new c.DoublePoint(this.m_normals[o-2])),t.m_endtype==c.EndType.etClosedPolygon){for(var m=o-1,h=0;h<o;h++)m=this.OffsetPoint(h,m,t.m_jointype);this.m_destPolys.push(this.m_destPoly)}else if(t.m_endtype==c.EndType.etClosedLine){for(var m=o-1,h=0;h<o;h++)m=this.OffsetPoint(h,m,t.m_jointype);this.m_destPolys.push(this.m_destPoly),this.m_destPoly=new Array;for(var f=this.m_normals[o-1],h=o-1;h>0;h--)this.m_normals[h]=new c.DoublePoint(-this.m_normals[h-1].X,-this.m_normals[h-1].Y);this.m_normals[0]=new c.DoublePoint(-f.X,-f.Y),m=0;for(var h=o-1;h>=0;h--)m=this.OffsetPoint(h,m,t.m_jointype);this.m_destPolys.push(this.m_destPoly)}else{for(var m=0,h=1;h<o-1;++h)m=this.OffsetPoint(h,m,t.m_jointype);var v;if(t.m_endtype==c.EndType.etOpenButt){var h=o-1;v=new c.IntPoint(c.ClipperOffset.Round(this.m_srcPoly[h].X+this.m_normals[h].X*e),c.ClipperOffset.Round(this.m_srcPoly[h].Y+this.m_normals[h].Y*e)),this.m_destPoly.push(v),v=new c.IntPoint(c.ClipperOffset.Round(this.m_srcPoly[h].X-this.m_normals[h].X*e),c.ClipperOffset.Round(this.m_srcPoly[h].Y-this.m_normals[h].Y*e)),this.m_destPoly.push(v)}else{var h=o-1;m=o-2,this.m_sinA=0,this.m_normals[h]=new c.DoublePoint(-this.m_normals[h].X,-this.m_normals[h].Y),t.m_endtype==c.EndType.etOpenSquare?this.DoSquare(h,m):this.DoRound(h,m)}for(var h=o-1;h>0;h--)this.m_normals[h]=new c.DoublePoint(-this.m_normals[h-1].X,-this.m_normals[h-1].Y);this.m_normals[0]=new c.DoublePoint(-this.m_normals[1].X,-this.m_normals[1].Y),m=o-1;for(var h=m-1;h>0;--h)m=this.OffsetPoint(h,m,t.m_jointype);t.m_endtype==c.EndType.etOpenButt?(v=new c.IntPoint(c.ClipperOffset.Round(this.m_srcPoly[0].X-this.m_normals[0].X*e),c.ClipperOffset.Round(this.m_srcPoly[0].Y-this.m_normals[0].Y*e)),this.m_destPoly.push(v),v=new c.IntPoint(c.ClipperOffset.Round(this.m_srcPoly[0].X+this.m_normals[0].X*e),c.ClipperOffset.Round(this.m_srcPoly[0].Y+this.m_normals[0].Y*e)),this.m_destPoly.push(v)):(m=1,this.m_sinA=0,t.m_endtype==c.EndType.etOpenSquare?this.DoSquare(0,1):this.DoRound(0,1)),this.m_destPolys.push(this.m_destPoly)}}}};c.ClipperOffset.prototype.Execute=function(){var e=arguments,r=e[0]instanceof c.PolyTree;if(r){var t=e[0],i=e[1];t.Clear(),this.FixOrientations(),this.DoOffset(i);var n=new c.Clipper(0);if(n.AddPaths(this.m_destPolys,c.PolyType.ptSubject,!0),i>0)n.Execute(c.ClipType.ctUnion,t,c.PolyFillType.pftPositive,c.PolyFillType.pftPositive);else{var o=c.Clipper.GetBounds(this.m_destPolys),s=new c.Path;if(s.push(new c.IntPoint(o.left-10,o.bottom+10)),s.push(new c.IntPoint(o.right+10,o.bottom+10)),s.push(new c.IntPoint(o.right+10,o.top-10)),s.push(new c.IntPoint(o.left-10,o.top-10)),n.AddPath(s,c.PolyType.ptSubject,!0),n.ReverseSolution=!0,n.Execute(c.ClipType.ctUnion,t,c.PolyFillType.pftNegative,c.PolyFillType.pftNegative),t.ChildCount()==1&&t.Childs()[0].ChildCount()>0){var l=t.Childs()[0];t.Childs()[0]=l.Childs()[0];for(var h=1;h<l.ChildCount();h++)t.AddChild(l.Childs()[h])}else t.Clear()}}else{var t=e[0],i=e[1];c.Clear(t),this.FixOrientations(),this.DoOffset(i);var n=new c.Clipper(0);if(n.AddPaths(this.m_destPolys,c.PolyType.ptSubject,!0),i>0)n.Execute(c.ClipType.ctUnion,t,c.PolyFillType.pftPositive,c.PolyFillType.pftPositive);else{var o=c.Clipper.GetBounds(this.m_destPolys),s=new c.Path;s.push(new c.IntPoint(o.left-10,o.bottom+10)),s.push(new c.IntPoint(o.right+10,o.bottom+10)),s.push(new c.IntPoint(o.right+10,o.top-10)),s.push(new c.IntPoint(o.left-10,o.top-10)),n.AddPath(s,c.PolyType.ptSubject,!0),n.ReverseSolution=!0,n.Execute(c.ClipType.ctUnion,t,c.PolyFillType.pftNegative,c.PolyFillType.pftNegative),t.length>0&&t.splice(0,1)}}};c.ClipperOffset.prototype.OffsetPoint=function(e,r,t){if(this.m_sinA=this.m_normals[r].X*this.m_normals[e].Y-this.m_normals[e].X*this.m_normals[r].Y,this.m_sinA<5e-5&&this.m_sinA>-5e-5)return r;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 c.IntPoint(c.ClipperOffset.Round(this.m_srcPoly[e].X+this.m_normals[r].X*this.m_delta),c.ClipperOffset.Round(this.m_srcPoly[e].Y+this.m_normals[r].Y*this.m_delta))),this.m_destPoly.push(new c.IntPoint(this.m_srcPoly[e])),this.m_destPoly.push(new c.IntPoint(c.ClipperOffset.Round(this.m_srcPoly[e].X+this.m_normals[e].X*this.m_delta),c.ClipperOffset.Round(this.m_srcPoly[e].Y+this.m_normals[e].Y*this.m_delta)));else switch(t){case c.JoinType.jtMiter:{var i=1+(this.m_normals[e].X*this.m_normals[r].X+this.m_normals[e].Y*this.m_normals[r].Y);i>=this.m_miterLim?this.DoMiter(e,r,i):this.DoSquare(e,r);break}case c.JoinType.jtSquare:this.DoSquare(e,r);break;case c.JoinType.jtRound:this.DoRound(e,r);break}return r=e,r};c.ClipperOffset.prototype.DoSquare=function(e,r){var t=Math.tan(Math.atan2(this.m_sinA,this.m_normals[r].X*this.m_normals[e].X+this.m_normals[r].Y*this.m_normals[e].Y)/4);this.m_destPoly.push(new c.IntPoint(c.ClipperOffset.Round(this.m_srcPoly[e].X+this.m_delta*(this.m_normals[r].X-this.m_normals[r].Y*t)),c.ClipperOffset.Round(this.m_srcPoly[e].Y+this.m_delta*(this.m_normals[r].Y+this.m_normals[r].X*t)))),this.m_destPoly.push(new c.IntPoint(c.ClipperOffset.Round(this.m_srcPoly[e].X+this.m_delta*(this.m_normals[e].X+this.m_normals[e].Y*t)),c.ClipperOffset.Round(this.m_srcPoly[e].Y+this.m_delta*(this.m_normals[e].Y-this.m_normals[e].X*t))))};c.ClipperOffset.prototype.DoMiter=function(e,r,t){var i=this.m_delta/t;this.m_destPoly.push(new c.IntPoint(c.ClipperOffset.Round(this.m_srcPoly[e].X+(this.m_normals[r].X+this.m_normals[e].X)*i),c.ClipperOffset.Round(this.m_srcPoly[e].Y+(this.m_normals[r].Y+this.m_normals[e].Y)*i)))};c.ClipperOffset.prototype.DoRound=function(e,r){for(var t=Math.atan2(this.m_sinA,this.m_normals[r].X*this.m_normals[e].X+this.m_normals[r].Y*this.m_normals[e].Y),i=c.Cast_Int32(c.ClipperOffset.Round(this.m_StepsPerRad*Math.abs(t))),n=this.m_normals[r].X,o=this.m_normals[r].Y,s,l=0;l<i;++l)this.m_destPoly.push(new c.IntPoint(c.ClipperOffset.Round(this.m_srcPoly[e].X+n*this.m_delta),c.ClipperOffset.Round(this.m_srcPoly[e].Y+o*this.m_delta))),s=n,n=n*this.m_cos-this.m_sin*o,o=s*this.m_sin+o*this.m_cos;this.m_destPoly.push(new c.IntPoint(c.ClipperOffset.Round(this.m_srcPoly[e].X+this.m_normals[e].X*this.m_delta),c.ClipperOffset.Round(this.m_srcPoly[e].Y+this.m_normals[e].Y*this.m_delta)))};c.Error=function(e){try{throw new Error(e)}catch(r){alert(r.message)}};c.JS={};c.JS.AreaOfPolygon=function(e,r){return r||(r=1),c.Clipper.Area(e)/(r*r)};c.JS.AreaOfPolygons=function(e,r){r||(r=1);for(var t=0,i=0;i<e.length;i++)t+=c.Clipper.Area(e[i]);return t/(r*r)};c.JS.BoundsOfPath=function(e,r){return c.JS.BoundsOfPaths([e],r)};c.JS.BoundsOfPaths=function(e,r){r||(r=1);var t=c.Clipper.GetBounds(e);return t.left/=r,t.bottom/=r,t.right/=r,t.top/=r,t};c.JS.Clean=function(i,r){if(!(i instanceof Array))return[];var t=i[0]instanceof Array,i=c.JS.Clone(i);if(typeof r!="number"||r===null)return c.Error("Delta is not a number in Clean()."),i;if(i.length===0||i.length==1&&i[0].length===0||r<0)return i;t||(i=[i]);for(var n=i.length,o,s,l,h,p,m,f,v=[],y=0;y<n;y++)if(s=i[y],o=s.length,o!==0){if(o<3){l=s,v.push(l);continue}for(l=s,h=r*r,p=s[0],m=1,f=1;f<o;f++)(s[f].X-p.X)*(s[f].X-p.X)+(s[f].Y-p.Y)*(s[f].Y-p.Y)<=h||(l[m]=s[f],p=s[f],m++);p=s[m-1],(s[0].X-p.X)*(s[0].X-p.X)+(s[0].Y-p.Y)*(s[0].Y-p.Y)<=h&&m--,m<o&&l.splice(m,o-m),l.length&&v.push(l)}return!t&&v.length?v=v[0]:!t&&v.length===0?v=[]:t&&v.length===0&&(v=[[]]),v};c.JS.Clone=function(e){if(!(e instanceof Array))return[];if(e.length===0)return[];if(e.length==1&&e[0].length===0)return[[]];var r=e[0]instanceof Array;r||(e=[e]);var t=e.length,i,n,o,s,l=new Array(t);for(n=0;n<t;n++){for(i=e[n].length,s=new Array(i),o=0;o<i;o++)s[o]={X:e[n][o].X,Y:e[n][o].Y};l[n]=s}return r||(l=l[0]),l};c.JS.Lighten=function(e,r){if(!(e instanceof Array))return[];if(typeof r!="number"||r===null)return c.Error("Tolerance is not a number in Lighten()."),c.JS.Clone(e);if(e.length===0||e.length==1&&e[0].length===0||r<0)return c.JS.Clone(e);e[0]instanceof Array||(e=[e]);var t,i,n,o,s,l,h,p,m,f,v,y,C,M,g,b,P,S=e.length,T=r*r,_=[];for(t=0;t<S;t++)if(n=e[t],l=n.length,l!=0){for(o=0;o<1e6;o++){for(s=[],l=n.length,n[l-1].X!=n[0].X||n[l-1].Y!=n[0].Y?(y=1,n.push({X:n[0].X,Y:n[0].Y}),l=n.length):y=0,v=[],i=0;i<l-2;i++)h=n[i],m=n[i+1],p=n[i+2],b=h.X,P=h.Y,C=p.X-b,M=p.Y-P,(C!==0||M!==0)&&(g=((m.X-b)*C+(m.Y-P)*M)/(C*C+M*M),g>1?(b=p.X,P=p.Y):g>0&&(b+=C*g,P+=M*g)),C=m.X-b,M=m.Y-P,f=C*C+M*M,f<=T&&(v[i+1]=1,i++);for(s.push({X:n[0].X,Y:n[0].Y}),i=1;i<l-1;i++)v[i]||s.push({X:n[i].X,Y:n[i].Y});if(s.push({X:n[l-1].X,Y:n[l-1].Y}),y&&n.pop(),v.length)n=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&&_.push(s)}return!e[0]instanceof Array&&(_=_[0]),typeof _>"u"&&(_=[[]]),_};c.JS.PerimeterOfPath=function(e,r,t){if(typeof e>"u")return 0;var i=Math.sqrt,n=0,o,s,l=0,h=0,p=0,m=0,f=e.length;if(f<2)return 0;for(r&&(e[f]=e[0],f++);--f;)o=e[f],l=o.X,h=o.Y,s=e[f-1],p=s.X,m=s.Y,n+=i((l-p)*(l-p)+(h-m)*(h-m));return r&&e.pop(),n/t};c.JS.PerimeterOfPaths=function(e,r,t){t||(t=1);for(var i=0,n=0;n<e.length;n++)i+=c.JS.PerimeterOfPath(e[n],r,t);return i};c.JS.ScaleDownPath=function(e,r){var t,i;for(r||(r=1),t=e.length;t--;)i=e[t],i.X=i.X/r,i.Y=i.Y/r};c.JS.ScaleDownPaths=function(e,r){var t,i,n,o=Math.round;for(r||(r=1),t=e.length;t--;)for(i=e[t].length;i--;)n=e[t][i],n.X=n.X/r,n.Y=n.Y/r};c.JS.ScaleUpPath=function(e,r){var t,i,n=Math.round;for(r||(r=1),t=e.length;t--;)i=e[t],i.X=n(i.X*r),i.Y=n(i.Y*r)};c.JS.ScaleUpPaths=function(e,r){var t,i,n,o=Math.round;for(r||(r=1),t=e.length;t--;)for(i=e[t].length;i--;)n=e[t][i],n.X=o(n.X*r),n.Y=o(n.Y*r)};c.ExPolygons=function(){return[]};c.ExPolygon=function(){this.outer=null,this.holes=null};c.JS.AddOuterPolyNodeToExPolygons=function(e,r){var t=new c.ExPolygon;t.outer=e.Contour();var i=e.Childs(),n=i.length;t.holes=new Array(n);var o,s,l,h,p,m;for(l=0;l<n;l++)for(o=i[l],t.holes[l]=o.Contour(),h=0,p=o.Childs(),m=p.length;h<m;h++)s=p[h],c.JS.AddOuterPolyNodeToExPolygons(s,r);r.push(t)};c.JS.ExPolygonsToPaths=function(e){var r,t,i,n,o=new c.Paths;for(r=0,i=e.length;r<i;r++)for(o.push(e[r].outer),t=0,n=e[r].holes.length;t<n;t++)o.push(e[r].holes[t]);return o};c.JS.PolyTreeToExPolygons=function(e){var r=new c.ExPolygons,t,i,n,o;for(i=0,n=e.Childs(),o=n.length;i<o;i++)t=n[i],c.JS.AddOuterPolyNodeToExPolygons(t,r);return r};wn.exports=c});var mm=tr((Eu,Du)=>{x();(function(e,r){typeof Eu=="object"&&typeof Du<"u"?Du.exports=r():typeof define=="function"&&define.amd?define(r):(e=e||self).RBush=r()})(Eu,function(){"use strict";function e(g,b,P,S,T){a(function _(R,A,k,F,G){for(;F>k;){if(F-k>600){var O=F-k+1,X=A-k+1,Z=Math.log(O),J=.5*Math.exp(2*Z/3),re=.5*Math.sqrt(Z*J*(O-J)/O)*(X-O/2<0?-1:1),$=Math.max(k,Math.floor(A-X*J/O+re)),ve=Math.min(F,Math.floor(A+(O-X)*J/O+re));_(R,A,$,ve,G)}var ue=R[A],le=k,ce=F;for(r(R,k,A),G(R[F],ue)>0&&r(R,k,F);le<ce;){for(r(R,le,ce),le++,ce--;G(R[le],ue)<0;)le++;for(;G(R[ce],ue)>0;)ce--}G(R[k],ue)===0?r(R,k,ce):r(R,++ce,F),ce<=A&&(k=ce+1),A<=ce&&(F=ce-1)}},"t")(g,b,P||0,S||g.length-1,T||t)}a(e,"t");function r(g,b,P){var S=g[b];g[b]=g[P],g[P]=S}a(r,"i");function t(g,b){return g<b?-1:g>b?1:0}a(t,"n");var i=a(function(g){g===void 0&&(g=9),this._maxEntries=Math.max(4,g),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()},"r");function n(g,b,P){if(!P)return b.indexOf(g);for(var S=0;S<b.length;S++)if(P(g,b[S]))return S;return-1}a(n,"e");function o(g,b){s(g,0,g.children.length,b,g)}a(o,"a");function s(g,b,P,S,T){T||(T=C(null)),T.minX=1/0,T.minY=1/0,T.maxX=-1/0,T.maxY=-1/0;for(var _=b;_<P;_++){var R=g.children[_];l(T,g.leaf?S(R):R)}return T}a(s,"h");function l(g,b){return g.minX=Math.min(g.minX,b.minX),g.minY=Math.min(g.minY,b.minY),g.maxX=Math.max(g.maxX,b.maxX),g.maxY=Math.max(g.maxY,b.maxY),g}a(l,"o");function h(g,b){return g.minX-b.minX}a(h,"s");function p(g,b){return g.minY-b.minY}a(p,"l");function m(g){return(g.maxX-g.minX)*(g.maxY-g.minY)}a(m,"f");function f(g){return g.maxX-g.minX+(g.maxY-g.minY)}a(f,"u");function v(g,b){return g.minX<=b.minX&&g.minY<=b.minY&&b.maxX<=g.maxX&&b.maxY<=g.maxY}a(v,"m");function y(g,b){return b.minX<=g.maxX&&b.minY<=g.maxY&&b.maxX>=g.minX&&b.maxY>=g.minY}a(y,"c");function C(g){return{children:g,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}a(C,"p");function M(g,b,P,S,T){for(var _=[b,P];_.length;)if(!((P=_.pop())-(b=_.pop())<=S)){var R=b+Math.ceil((P-b)/S/2)*S;e(g,R,b,P,T),_.push(b,R,R,P)}}return a(M,"d"),i.prototype.all=function(){return this._all(this.data,[])},i.prototype.search=function(g){var b=this.data,P=[];if(!y(g,b))return P;for(var S=this.toBBox,T=[];b;){for(var _=0;_<b.children.length;_++){var R=b.children[_],A=b.leaf?S(R):R;y(g,A)&&(b.leaf?P.push(R):v(g,A)?this._all(R,P):T.push(R))}b=T.pop()}return P},i.prototype.collides=function(g){var b=this.data;if(!y(g,b))return!1;for(var P=[];b;){for(var S=0;S<b.children.length;S++){var T=b.children[S],_=b.leaf?this.toBBox(T):T;if(y(g,_)){if(b.leaf||v(g,_))return!0;P.push(T)}}b=P.pop()}return!1},i.prototype.load=function(g){if(!g||!g.length)return this;if(g.length<this._minEntries){for(var b=0;b<g.length;b++)this.insert(g[b]);return this}var P=this._build(g.slice(),0,g.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 S=this.data;this.data=P,P=S}this._insert(P,this.data.height-P.height-1,!0)}else this.data=P;return this},i.prototype.insert=function(g){return g&&this._insert(g,this.data.height-1),this},i.prototype.clear=function(){return this.data=C([]),this},i.prototype.remove=function(g,b){if(!g)return this;for(var P,S,T,_=this.data,R=this.toBBox(g),A=[],k=[];_||A.length;){if(_||(_=A.pop(),S=A[A.length-1],P=k.pop(),T=!0),_.leaf){var F=n(g,_.children,b);if(F!==-1)return _.children.splice(F,1),A.push(_),this._condense(A),this}T||_.leaf||!v(_,R)?S?(P++,_=S.children[P],T=!1):_=null:(A.push(_),k.push(P),P=0,S=_,_=_.children[0])}return this},i.prototype.toBBox=function(g){return g},i.prototype.compareMinX=function(g,b){return g.minX-b.minX},i.prototype.compareMinY=function(g,b){return g.minY-b.minY},i.prototype.toJSON=function(){return this.data},i.prototype.fromJSON=function(g){return this.data=g,this},i.prototype._all=function(g,b){for(var P=[];g;)g.leaf?b.push.apply(b,g.children):P.push.apply(P,g.children),g=P.pop();return b},i.prototype._build=function(g,b,P,S){var T,_=P-b+1,R=this._maxEntries;if(_<=R)return o(T=C(g.slice(b,P+1)),this.toBBox),T;S||(S=Math.ceil(Math.log(_)/Math.log(R)),R=Math.ceil(_/Math.pow(R,S-1))),(T=C([])).leaf=!1,T.height=S;var A=Math.ceil(_/R),k=A*Math.ceil(Math.sqrt(R));M(g,b,P,k,this.compareMinX);for(var F=b;F<=P;F+=k){var G=Math.min(F+k-1,P);M(g,F,G,A,this.compareMinY);for(var O=F;O<=G;O+=A){var X=Math.min(O+A-1,G);T.children.push(this._build(g,O,X,S-1))}}return o(T,this.toBBox),T},i.prototype._chooseSubtree=function(g,b,P,S){for(;S.push(b),!b.leaf&&S.length-1!==P;){for(var T=1/0,_=1/0,R=void 0,A=0;A<b.children.length;A++){var k=b.children[A],F=m(k),G=(O=g,X=k,(Math.max(X.maxX,O.maxX)-Math.min(X.minX,O.minX))*(Math.max(X.maxY,O.maxY)-Math.min(X.minY,O.minY))-F);G<_?(_=G,T=F<T?F:T,R=k):G===_&&F<T&&(T=F,R=k)}b=R||b.children[0]}var O,X;return b},i.prototype._insert=function(g,b,P){var S=P?g:this.toBBox(g),T=[],_=this._chooseSubtree(S,this.data,b,T);for(_.children.push(g),l(_,S);b>=0&&T[b].children.length>this._maxEntries;)this._split(T,b),b--;this._adjustParentBBoxes(S,T,b)},i.prototype._split=function(g,b){var P=g[b],S=P.children.length,T=this._minEntries;this._chooseSplitAxis(P,T,S);var _=this._chooseSplitIndex(P,T,S),R=C(P.children.splice(_,P.children.length-_));R.height=P.height,R.leaf=P.leaf,o(P,this.toBBox),o(R,this.toBBox),b?g[b-1].children.push(R):this._splitRoot(P,R)},i.prototype._splitRoot=function(g,b){this.data=C([g,b]),this.data.height=g.height+1,this.data.leaf=!1,o(this.data,this.toBBox)},i.prototype._chooseSplitIndex=function(g,b,P){for(var S,T,_,R,A,k,F,G=1/0,O=1/0,X=b;X<=P-b;X++){var Z=s(g,0,X,this.toBBox),J=s(g,X,P,this.toBBox),re=(T=Z,_=J,R=void 0,A=void 0,k=void 0,F=void 0,R=Math.max(T.minX,_.minX),A=Math.max(T.minY,_.minY),k=Math.min(T.maxX,_.maxX),F=Math.min(T.maxY,_.maxY),Math.max(0,k-R)*Math.max(0,F-A)),$=m(Z)+m(J);re<G?(G=re,S=X,O=$<O?$:O):re===G&&$<O&&(O=$,S=X)}return S||P-b},i.prototype._chooseSplitAxis=function(g,b,P){var S=g.leaf?this.compareMinX:h,T=g.leaf?this.compareMinY:p;this._allDistMargin(g,b,P,S)<this._allDistMargin(g,b,P,T)&&g.children.sort(S)},i.prototype._allDistMargin=function(g,b,P,S){g.children.sort(S);for(var T=this.toBBox,_=s(g,0,b,T),R=s(g,P-b,P,T),A=f(_)+f(R),k=b;k<P-b;k++){var F=g.children[k];l(_,g.leaf?T(F):F),A+=f(_)}for(var G=P-b-1;G>=b;G--){var O=g.children[G];l(R,g.leaf?T(O):O),A+=f(R)}return A},i.prototype._adjustParentBBoxes=function(g,b,P){for(var S=P;S>=0;S--)l(b[S],g)},i.prototype._condense=function(g){for(var b=g.length-1,P=void 0;b>=0;b--)g[b].children.length===0?b>0?(P=g[b-1].children).splice(P.indexOf(g[b]),1):this.clear():o(g[b],this.toBBox)},i})});var ku=tr(W=>{"use strict";x();Object.defineProperty(W,"__esModule",{value:!0});W.earthRadius=63710088e-1;W.factors={centimeters:W.earthRadius*100,centimetres:W.earthRadius*100,degrees:W.earthRadius/111325,feet:W.earthRadius*3.28084,inches:W.earthRadius*39.37,kilometers:W.earthRadius/1e3,kilometres:W.earthRadius/1e3,meters:W.earthRadius,metres:W.earthRadius,miles:W.earthRadius/1609.344,millimeters:W.earthRadius*1e3,millimetres:W.earthRadius*1e3,nauticalmiles:W.earthRadius/1852,radians:1,yards:W.earthRadius*1.0936};W.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/W.earthRadius,yards:1.0936133};W.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 Cr(e,r,t){t===void 0&&(t={});var i={type:"Feature"};return(t.id===0||t.id)&&(i.id=t.id),t.bbox&&(i.bbox=t.bbox),i.properties=r||{},i.geometry=e,i}a(Cr,"feature");W.feature=Cr;function aC(e,r,t){switch(t===void 0&&(t={}),e){case"Point":return Ou(r).geometry;case"LineString":return Au(r).geometry;case"Polygon":return Lu(r).geometry;case"MultiPoint":return ym(r).geometry;case"MultiLineString":return fm(r).geometry;case"MultiPolygon":return gm(r).geometry;default:throw new Error(e+" is invalid")}}a(aC,"geometry");W.geometry=aC;function Ou(e,r,t){if(t===void 0&&(t={}),!e)throw new Error("coordinates is required");if(!Array.isArray(e))throw new Error("coordinates must be an Array");if(e.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!ea(e[0])||!ea(e[1]))throw new Error("coordinates must contain numbers");var i={type:"Point",coordinates:e};return Cr(i,r,t)}a(Ou,"point");W.point=Ou;function lC(e,r,t){return t===void 0&&(t={}),ta(e.map(function(i){return Ou(i,r)}),t)}a(lC,"points");W.points=lC;function Lu(e,r,t){t===void 0&&(t={});for(var i=0,n=e;i<n.length;i++){var o=n[i];if(o.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var s=0;s<o[o.length-1].length;s++)if(o[o.length-1][s]!==o[0][s])throw new Error("First and last Position are not equivalent.")}var l={type:"Polygon",coordinates:e};return Cr(l,r,t)}a(Lu,"polygon");W.polygon=Lu;function uC(e,r,t){return t===void 0&&(t={}),ta(e.map(function(i){return Lu(i,r)}),t)}a(uC,"polygons");W.polygons=uC;function Au(e,r,t){if(t===void 0&&(t={}),e.length<2)throw new Error("coordinates must be an array of two or more positions");var i={type:"LineString",coordinates:e};return Cr(i,r,t)}a(Au,"lineString");W.lineString=Au;function cC(e,r,t){return t===void 0&&(t={}),ta(e.map(function(i){return Au(i,r)}),t)}a(cC,"lineStrings");W.lineStrings=cC;function ta(e,r){r===void 0&&(r={});var t={type:"FeatureCollection"};return r.id&&(t.id=r.id),r.bbox&&(t.bbox=r.bbox),t.features=e,t}a(ta,"featureCollection");W.featureCollection=ta;function fm(e,r,t){t===void 0&&(t={});var i={type:"MultiLineString",coordinates:e};return Cr(i,r,t)}a(fm,"multiLineString");W.multiLineString=fm;function ym(e,r,t){t===void 0&&(t={});var i={type:"MultiPoint",coordinates:e};return Cr(i,r,t)}a(ym,"multiPoint");W.multiPoint=ym;function gm(e,r,t){t===void 0&&(t={});var i={type:"MultiPolygon",coordinates:e};return Cr(i,r,t)}a(gm,"multiPolygon");W.multiPolygon=gm;function hC(e,r,t){t===void 0&&(t={});var i={type:"GeometryCollection",geometries:e};return Cr(i,r,t)}a(hC,"geometryCollection");W.geometryCollection=hC;function pC(e,r){if(r===void 0&&(r=0),r&&!(r>=0))throw new Error("precision must be a positive number");var t=Math.pow(10,r||0);return Math.round(e*t)/t}a(pC,"round");W.round=pC;function bm(e,r){r===void 0&&(r="kilometers");var t=W.factors[r];if(!t)throw new Error(r+" units is invalid");return e*t}a(bm,"radiansToLength");W.radiansToLength=bm;function Ru(e,r){r===void 0&&(r="kilometers");var t=W.factors[r];if(!t)throw new Error(r+" units is invalid");return e/t}a(Ru,"lengthToRadians");W.lengthToRadians=Ru;function dC(e,r){return vm(Ru(e,r))}a(dC,"lengthToDegrees");W.lengthToDegrees=dC;function mC(e){var r=e%360;return r<0&&(r+=360),r}a(mC,"bearingToAzimuth");W.bearingToAzimuth=mC;function vm(e){var r=e%(2*Math.PI);return r*180/Math.PI}a(vm,"radiansToDegrees");W.radiansToDegrees=vm;function fC(e){var r=e%360;return r*Math.PI/180}a(fC,"degreesToRadians");W.degreesToRadians=fC;function yC(e,r,t){if(r===void 0&&(r="kilometers"),t===void 0&&(t="kilometers"),!(e>=0))throw new Error("length must be a positive number");return bm(Ru(e,r),t)}a(yC,"convertLength");W.convertLength=yC;function gC(e,r,t){if(r===void 0&&(r="meters"),t===void 0&&(t="kilometers"),!(e>=0))throw new Error("area must be a positive number");var i=W.areaFactors[r];if(!i)throw new Error("invalid original units");var n=W.areaFactors[t];if(!n)throw new Error("invalid final units");return e/i*n}a(gC,"convertArea");W.convertArea=gC;function ea(e){return!isNaN(e)&&e!==null&&!Array.isArray(e)}a(ea,"isNumber");W.isNumber=ea;function bC(e){return!!e&&e.constructor===Object}a(bC,"isObject");W.isObject=bC;function vC(e){if(!e)throw new Error("bbox is required");if(!Array.isArray(e))throw new Error("bbox must be an Array");if(e.length!==4&&e.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");e.forEach(function(r){if(!ea(r))throw new Error("bbox must only contain numbers")})}a(vC,"validateBBox");W.validateBBox=vC;function xC(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")}a(xC,"validateId");W.validateId=xC});var Bu=tr(Be=>{"use strict";x();Object.defineProperty(Be,"__esModule",{value:!0});var Ve=ku();function Xn(e,r,t){if(e!==null)for(var i,n,o,s,l,h,p,m=0,f=0,v,y=e.type,C=y==="FeatureCollection",M=y==="Feature",g=C?e.features.length:1,b=0;b<g;b++){p=C?e.features[b].geometry:M?e.geometry:e,v=p?p.type==="GeometryCollection":!1,l=v?p.geometries.length:1;for(var P=0;P<l;P++){var S=0,T=0;if(s=v?p.geometries[P]:p,s!==null){h=s.coordinates;var _=s.type;switch(m=t&&(_==="Polygon"||_==="MultiPolygon")?1:0,_){case null:break;case"Point":if(r(h,f,b,S,T)===!1)return!1;f++,S++;break;case"LineString":case"MultiPoint":for(i=0;i<h.length;i++){if(r(h[i],f,b,S,T)===!1)return!1;f++,_==="MultiPoint"&&S++}_==="LineString"&&S++;break;case"Polygon":case"MultiLineString":for(i=0;i<h.length;i++){for(n=0;n<h[i].length-m;n++){if(r(h[i][n],f,b,S,T)===!1)return!1;f++}_==="MultiLineString"&&S++,_==="Polygon"&&T++}_==="Polygon"&&S++;break;case"MultiPolygon":for(i=0;i<h.length;i++){for(T=0,n=0;n<h[i].length;n++){for(o=0;o<h[i][n].length-m;o++){if(r(h[i][n][o],f,b,S,T)===!1)return!1;f++}T++}S++}break;case"GeometryCollection":for(i=0;i<s.geometries.length;i++)if(Xn(s.geometries[i],r,t)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}a(Xn,"coordEach");function SC(e,r,t,i){var n=t;return Xn(e,function(o,s,l,h,p){s===0&&t===void 0?n=o:n=r(n,o,s,l,h,p)},i),n}a(SC,"coordReduce");function xm(e,r){var t;switch(e.type){case"FeatureCollection":for(t=0;t<e.features.length&&r(e.features[t].properties,t)!==!1;t++);break;case"Feature":r(e.properties,0);break}}a(xm,"propEach");function CC(e,r,t){var i=t;return xm(e,function(n,o){o===0&&t===void 0?i=n:i=r(i,n,o)}),i}a(CC,"propReduce");function Sm(e,r){if(e.type==="Feature")r(e,0);else if(e.type==="FeatureCollection")for(var t=0;t<e.features.length&&r(e.features[t],t)!==!1;t++);}a(Sm,"featureEach");function PC(e,r,t){var i=t;return Sm(e,function(n,o){o===0&&t===void 0?i=n:i=r(i,n,o)}),i}a(PC,"featureReduce");function TC(e){var r=[];return Xn(e,function(t){r.push(t)}),r}a(TC,"coordAll");function Nu(e,r){var t,i,n,o,s,l,h,p,m,f,v=0,y=e.type==="FeatureCollection",C=e.type==="Feature",M=y?e.features.length:1;for(t=0;t<M;t++){for(l=y?e.features[t].geometry:C?e.geometry:e,p=y?e.features[t].properties:C?e.properties:{},m=y?e.features[t].bbox:C?e.bbox:void 0,f=y?e.features[t].id:C?e.id:void 0,h=l?l.type==="GeometryCollection":!1,s=h?l.geometries.length:1,n=0;n<s;n++){if(o=h?l.geometries[n]:l,o===null){if(r(null,v,p,m,f)===!1)return!1;continue}switch(o.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(r(o,v,p,m,f)===!1)return!1;break}case"GeometryCollection":{for(i=0;i<o.geometries.length;i++)if(r(o.geometries[i],v,p,m,f)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}v++}}a(Nu,"geomEach");function MC(e,r,t){var i=t;return Nu(e,function(n,o,s,l,h){o===0&&t===void 0?i=n:i=r(i,n,o,s,l,h)}),i}a(MC,"geomReduce");function ra(e,r){Nu(e,function(t,i,n,o,s){var l=t===null?null:t.type;switch(l){case null:case"Point":case"LineString":case"Polygon":return r(Ve.feature(t,n,{bbox:o,id:s}),i,0)===!1?!1:void 0}var h;switch(l){case"MultiPoint":h="Point";break;case"MultiLineString":h="LineString";break;case"MultiPolygon":h="Polygon";break}for(var p=0;p<t.coordinates.length;p++){var m=t.coordinates[p],f={type:h,coordinates:m};if(r(Ve.feature(f,n),i,p)===!1)return!1}})}a(ra,"flattenEach");function _C(e,r,t){var i=t;return ra(e,function(n,o,s){o===0&&s===0&&t===void 0?i=n:i=r(i,n,o,s)}),i}a(_C,"flattenReduce");function Cm(e,r){ra(e,function(t,i,n){var o=0;if(t.geometry){var s=t.geometry.type;if(!(s==="Point"||s==="MultiPoint")){var l,h=0,p=0,m=0;if(Xn(t,function(f,v,y,C,M){if(l===void 0||i>h||C>p||M>m){l=f,h=i,p=C,m=M,o=0;return}var g=Ve.lineString([l,f],t.properties);if(r(g,i,n,M,o)===!1)return!1;o++,l=f})===!1)return!1}}})}a(Cm,"segmentEach");function wC(e,r,t){var i=t,n=!1;return Cm(e,function(o,s,l,h,p){n===!1&&t===void 0?i=o:i=r(i,o,s,l,h,p),n=!0}),i}a(wC,"segmentReduce");function Pm(e,r){if(!e)throw new Error("geojson is required");ra(e,function(t,i,n){if(t.geometry!==null){var o=t.geometry.type,s=t.geometry.coordinates;switch(o){case"LineString":if(r(t,i,n,0,0)===!1)return!1;break;case"Polygon":for(var l=0;l<s.length;l++)if(r(Ve.lineString(s[l],t.properties),i,n,l)===!1)return!1;break}}})}a(Pm,"lineEach");function IC(e,r,t){var i=t;return Pm(e,function(n,o,s,l){o===0&&t===void 0?i=n:i=r(i,n,o,s,l)}),i}a(IC,"lineReduce");function EC(e,r){if(r=r||{},!Ve.isObject(r))throw new Error("options is invalid");var t=r.featureIndex||0,i=r.multiFeatureIndex||0,n=r.geometryIndex||0,o=r.segmentIndex||0,s=r.properties,l;switch(e.type){case"FeatureCollection":t<0&&(t=e.features.length+t),s=s||e.features[t].properties,l=e.features[t].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 h=l.coordinates;switch(l.type){case"Point":case"MultiPoint":return null;case"LineString":return o<0&&(o=h.length+o-1),Ve.lineString([h[o],h[o+1]],s,r);case"Polygon":return n<0&&(n=h.length+n),o<0&&(o=h[n].length+o-1),Ve.lineString([h[n][o],h[n][o+1]],s,r);case"MultiLineString":return i<0&&(i=h.length+i),o<0&&(o=h[i].length+o-1),Ve.lineString([h[i][o],h[i][o+1]],s,r);case"MultiPolygon":return i<0&&(i=h.length+i),n<0&&(n=h[i].length+n),o<0&&(o=h[i][n].length-o-1),Ve.lineString([h[i][n][o],h[i][n][o+1]],s,r)}throw new Error("geojson is invalid")}a(EC,"findSegment");function DC(e,r){if(r=r||{},!Ve.isObject(r))throw new Error("options is invalid");var t=r.featureIndex||0,i=r.multiFeatureIndex||0,n=r.geometryIndex||0,o=r.coordIndex||0,s=r.properties,l;switch(e.type){case"FeatureCollection":t<0&&(t=e.features.length+t),s=s||e.features[t].properties,l=e.features[t].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 h=l.coordinates;switch(l.type){case"Point":return Ve.point(h,s,r);case"MultiPoint":return i<0&&(i=h.length+i),Ve.point(h[i],s,r);case"LineString":return o<0&&(o=h.length+o),Ve.point(h[o],s,r);case"Polygon":return n<0&&(n=h.length+n),o<0&&(o=h[n].length+o),Ve.point(h[n][o],s,r);case"MultiLineString":return i<0&&(i=h.length+i),o<0&&(o=h[i].length+o),Ve.point(h[i][o],s,r);case"MultiPolygon":return i<0&&(i=h.length+i),n<0&&(n=h[i].length+n),o<0&&(o=h[i][n].length-o),Ve.point(h[i][n][o],s,r)}throw new Error("geojson is invalid")}a(DC,"findPoint");Be.coordAll=TC;Be.coordEach=Xn;Be.coordReduce=SC;Be.featureEach=Sm;Be.featureReduce=PC;Be.findPoint=DC;Be.findSegment=EC;Be.flattenEach=ra;Be.flattenReduce=_C;Be.geomEach=Nu;Be.geomReduce=MC;Be.lineEach=Pm;Be.lineReduce=IC;Be.propEach=xm;Be.propReduce=CC;Be.segmentEach=Cm;Be.segmentReduce=wC});var Tm=tr(Gu=>{"use strict";x();Object.defineProperty(Gu,"__esModule",{value:!0});var OC=Bu();function Fu(e){var r=[1/0,1/0,-1/0,-1/0];return OC.coordEach(e,function(t){r[0]>t[0]&&(r[0]=t[0]),r[1]>t[1]&&(r[1]=t[1]),r[2]<t[0]&&(r[2]=t[0]),r[3]<t[1]&&(r[3]=t[1])}),r}a(Fu,"bbox");Fu.default=Fu;Gu.default=Fu});var Em=tr((mL,Xu)=>{x();var Nt=mm(),_m=ku(),wm=Bu(),Bi=Tm().default,LC=wm.featureEach,pL=wm.coordEach,dL=_m.polygon,Mm=_m.featureCollection;function Im(e){var r=new Nt(e);return r.insert=function(t){if(t.type!=="Feature")throw new Error("invalid feature");return t.bbox=t.bbox?t.bbox:Bi(t),Nt.prototype.insert.call(this,t)},r.load=function(t){var i=[];return Array.isArray(t)?t.forEach(function(n){if(n.type!=="Feature")throw new Error("invalid features");n.bbox=n.bbox?n.bbox:Bi(n),i.push(n)}):LC(t,function(n){if(n.type!=="Feature")throw new Error("invalid features");n.bbox=n.bbox?n.bbox:Bi(n),i.push(n)}),Nt.prototype.load.call(this,i)},r.remove=function(t,i){if(t.type!=="Feature")throw new Error("invalid feature");return t.bbox=t.bbox?t.bbox:Bi(t),Nt.prototype.remove.call(this,t,i)},r.clear=function(){return Nt.prototype.clear.call(this)},r.search=function(t){var i=Nt.prototype.search.call(this,this.toBBox(t));return Mm(i)},r.collides=function(t){return Nt.prototype.collides.call(this,this.toBBox(t))},r.all=function(){var t=Nt.prototype.all.call(this);return Mm(t)},r.toJSON=function(){return Nt.prototype.toJSON.call(this)},r.fromJSON=function(t){return Nt.prototype.fromJSON.call(this,t)},r.toBBox=function(t){var i;if(t.bbox)i=t.bbox;else if(Array.isArray(t)&&t.length===4)i=t;else if(Array.isArray(t)&&t.length===6)i=[t[0],t[1],t[3],t[4]];else if(t.type==="Feature")i=Bi(t);else if(t.type==="FeatureCollection")i=Bi(t);else throw new Error("invalid geojson");return{minX:i[0],minY:i[1],maxX:i[2],maxY:i[3]}},r}a(Im,"geojsonRbush");Xu.exports=Im;Xu.exports.default=Im});x();import{MapView as nP}from"@mappedin/mappedin-js";x();x();x();(function(){typeof globalThis!="object"&&(Object.defineProperty(Object.prototype,"__magic__",{get:a(function(){return this},"get"),configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__)})();var th="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=";x();x();var cf=!1;function rh(){return cf}a(rh,"isTestMode");var La=class La{constructor(r){d(this,"backgroundAlpha",1);d(this,"backgroundColor",new ye);d(this,"width",0);d(this,"height",0);d(this,"options",{});d(this,"renderer");d(this,"enabledLayers",new Set([0,1]));d(this,"handleWebGLContextCreationError",a(r=>{var t,i;(i=(t=this.options).onWebGLContextCreationError)==null||i.call(t,r)},"handleWebGLContextCreationError"));d(this,"handleWebGLContextLost",a(r=>{var t,i;(i=(t=this.options).onWebGLContextLost)==null||i.call(t,r)},"handleWebGLContextLost"));d(this,"handleWebGLContextRestored",a(r=>{var t,i;(i=(t=this.options).onWebGLContextRestored)==null||i.call(t,r)},"handleWebGLContextRestored"));var t,i,n,o,s;try{this.options=r,rh()?(this.renderer={setSize:a(()=>{},"setSize"),state:{reset:a(()=>{},"reset")},properties:{get:a(()=>{},"get")},getSize:a(()=>({width:window.innerWidth,height:innerHeight}),"getSize"),getDrawingBufferSize:a(()=>({width:window.innerWidth,height:innerHeight}),"getDrawingBufferSize"),getClearAlpha:a(()=>1,"getClearAlpha"),getClearColor:a(()=>new ye,"getClearColor"),autoUpdate:!0,shadowMap:{autoUpdate:!0},getContext:a(()=>({getContextAttributes(){return{alpha:!0,antialias:!1,depth:!0,stencil:!1}}}),"getContext"),readRenderTargetPixelsAsync:a(()=>Promise.resolve([]),"readRenderTargetPixelsAsync"),setRenderTarget:a(()=>{},"setRenderTarget"),setClearColor:a(()=>{},"setClearColor"),clear:a(()=>{},"clear"),render:a(()=>{},"render"),clearStencil:a(()=>{},"clearStencil"),clearDepth:a(()=>{},"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 wc({canvas:r.canvas,alpha:r.alpha||!1,stencil:!0,antialias:typeof r.antialias=="boolean"?r.antialias:!0,powerPreference:"high-performance",preserveDrawingBuffer:!0}),this.backgroundColor=new ye((t=r.backgroundColor)!=null?t:"#ffffff"),this.backgroundAlpha=(i=r.backgroundAlpha)!=null?i:1}catch(l){q.error(l),r.onWebGLRendererError&&r.onWebGLRendererError(l)}(n=this.domElement())==null||n.addEventListener("webglcontextlost",this.handleWebGLContextLost),(o=this.domElement())==null||o.addEventListener("webglcontextrestored",this.handleWebGLContextRestored),(s=this.domElement())==null||s.addEventListener("webglcontextcreationerror",this.handleWebGLContextCreationError)}destroy(){var r,t,i,n,o;this.renderer&&((t=(r=this.renderer).dispose)==null||t.call(r)),(i=this.domElement())==null||i.removeEventListener("webglcontextlost",this.handleWebGLContextLost),(n=this.domElement())==null||n.removeEventListener("webglcontextrestored",this.handleWebGLContextRestored),(o=this.domElement())==null||o.removeEventListener("webglcontextcreationerror",this.handleWebGLContextCreationError)}render(r,t){if(this.renderer){this.renderer.state.reset(),t.layers.disableAll();for(let i of this.enabledLayers.values())t.layers.enable(i);this.renderer.clearStencil(),this.renderer.autoClear=!1,this.renderer.setRenderTarget(null),this.renderer.render(r,t),this.renderer.clearDepth(),t.layers.disableAll(),t.layers.enable(To.ALWAYS_ON_TOP),this.renderer.render(r,t),this.renderer.state.reset()}}clear(){this.renderer&&(this.renderer.setClearColor(this.backgroundColor,this.backgroundAlpha),this.renderer.clear())}setBufferSize(r,t){D.env.NODE_ENV==="test"||!this.renderer||(this.width=r,this.height=t,this.renderer.setSize(r,t,!1))}setBackgroundColor(r,t){this.backgroundColor=r,this.backgroundAlpha=t}domElement(){var r;return(r=this.renderer)==null?void 0:r.domElement}};a(La,"Renderer");var Do=La;x();x();var ih='"use strict";(()=>{var He=Object.defineProperty,bt=Object.defineProperties;var kt=Object.getOwnPropertyDescriptors;var Ge=Object.getOwnPropertySymbols;var wt=Object.prototype.hasOwnProperty,Tt=Object.prototype.propertyIsEnumerable;var Fe=(r,e,t)=>e in r?He(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,c=(r,e)=>{for(var t in e||(e={}))wt.call(e,t)&&Fe(r,t,e[t]);if(Ge)for(var t of Ge(e))Tt.call(e,t)&&Fe(r,t,e[t]);return r},y=(r,e)=>bt(r,kt(e));var Rt=(r,e)=>{for(var t in e)He(r,t,{get:e[t],enumerable:!0})};var C=(r,e,t)=>Fe(r,typeof e!="symbol"?e+"":e,t);function et(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 tt(r,e){let[t,s]=e;return t>=r.x&&t<=r.x+r.w&&s>=r.y&&s<=r.y+r.h}function rt(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 V(r,e){for(let t=0;t<e.length;t++)r.push(e[t])}var w=class{constructor(e,t,s,n,a){C(this,"x");C(this,"y");C(this,"w");C(this,"h");C(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:et(this,e)}intersects(e){return rt(this,e)}intersectsPoint(e){return tt(this,e)}draw(e){e.fillStyle="rgba(123,222,26, 0.8)",e.fillRect(this.x,this.y,this.w,this.h)}};var Ae=class r{constructor(e,t){C(this,"topLeft");C(this,"topRight");C(this,"bottomLeft");C(this,"bottomRight");C(this,"divided",!1);C(this,"boundary");C(this,"capacity",16);C(this,"objects",[]);C(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 w(e,t,s/2,n/2),this),this.topRight=new r(new w(e+s/2,t,s/2,n/2),this),this.bottomLeft=new r(new w(e,t+n/2,s/2,n/2),this),this.bottomRight=new r(new w(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&&(V(t,this.topLeft.queryRect(e)),V(t,this.topRight.queryRect(e)),V(t,this.bottomLeft.queryRect(e)),V(t,this.bottomRight.queryRect(e))),t}queryPoint(e){let t=[];if(this.boundary.intersectsPoint(e))t.push(...this.objects);else return[];return this.divided&&(V(t,this.topLeft.queryPoint(e)),V(t,this.topRight.queryPoint(e)),V(t,this.bottomLeft.queryPoint(e)),V(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 we={};Rt(we,{BRAND:()=>Kt,DIRTY:()=>K,EMPTY_PATH:()=>Ot,INVALID:()=>m,NEVER:()=>Pr,OK:()=>S,ParseStatus:()=>R,Schema:()=>x,ZodAny:()=>q,ZodArray:()=>F,ZodBigInt:()=>H,ZodBoolean:()=>ee,ZodBranded:()=>Ie,ZodCatch:()=>le,ZodDate:()=>te,ZodDefault:()=>ue,ZodDiscriminatedUnion:()=>Pe,ZodEffects:()=>M,ZodEnum:()=>ce,ZodError:()=>A,ZodFirstPartyTypeKind:()=>g,ZodFunction:()=>$e,ZodIntersection:()=>ae,ZodIssueCode:()=>d,ZodLazy:()=>ie,ZodLiteral:()=>oe,ZodMap:()=>xe,ZodNaN:()=>ke,ZodNativeEnum:()=>de,ZodNever:()=>P,ZodNull:()=>se,ZodNullable:()=>L,ZodNumber:()=>G,ZodObject:()=>O,ZodOptional:()=>j,ZodParsedType:()=>h,ZodPipeline:()=>Ne,ZodPromise:()=>Y,ZodReadonly:()=>fe,ZodRecord:()=>Ze,ZodSchema:()=>x,ZodSet:()=>be,ZodString:()=>W,ZodSymbol:()=>_e,ZodTransformer:()=>M,ZodTuple:()=>$,ZodType:()=>x,ZodUndefined:()=>re,ZodUnion:()=>ne,ZodUnknown:()=>B,ZodVoid:()=>ve,addIssueToContext:()=>f,any:()=>ir,array:()=>ur,bigint:()=>tr,boolean:()=>ht,coerce:()=>Mr,custom:()=>ut,date:()=>rr,datetimeRegex:()=>ct,defaultErrorMap:()=>D,discriminatedUnion:()=>pr,effect:()=>Cr,enum:()=>wr,function:()=>xr,getErrorMap:()=>me,getParsedType:()=>Z,instanceof:()=>Ht,intersection:()=>mr,isAborted:()=>Ee,isAsync:()=>ye,isDirty:()=>Me,isValid:()=>U,late:()=>Gt,lazy:()=>br,literal:()=>kr,makeIssue:()=>Oe,map:()=>_r,nan:()=>er,nativeEnum:()=>Tr,never:()=>cr,null:()=>ar,nullable:()=>Ar,number:()=>ft,object:()=>lr,objectUtil:()=>Ue,oboolean:()=>Er,onumber:()=>jr,optional:()=>Sr,ostring:()=>Nr,pipeline:()=>Ir,preprocess:()=>Or,promise:()=>Rr,quotelessJson:()=>Ct,record:()=>gr,set:()=>vr,setErrorMap:()=>At,strictObject:()=>fr,string:()=>lt,symbol:()=>sr,transformer:()=>Cr,tuple:()=>yr,undefined:()=>nr,union:()=>hr,unknown:()=>or,util:()=>b,void:()=>dr});var b;(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"?"\'".concat(o,"\'"):o).join(a)}r.joinValues=s,r.jsonStringifyReplacer=(n,a)=>typeof a=="bigint"?a.toString():a})(b||(b={}));var Ue;(function(r){r.mergeShapes=(e,t)=>c(c({},e),t)})(Ue||(Ue={}));var h=b.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Z=r=>{switch(typeof r){case"undefined":return h.undefined;case"string":return h.string;case"number":return Number.isNaN(r)?h.nan:h.number;case"boolean":return h.boolean;case"function":return h.function;case"bigint":return h.bigint;case"symbol":return h.symbol;case"object":return Array.isArray(r)?h.array:r===null?h.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?h.promise:typeof Map<"u"&&r instanceof Map?h.map:typeof Set<"u"&&r instanceof Set?h.set:typeof Date<"u"&&r instanceof Date?h.date:h.object;default:return h.unknown}};var d=b.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"]),Ct=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:"),A=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: ".concat(e))}toString(){return this.message}get message(){return JSON.stringify(this.issues,b.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()}};A.create=r=>new A(r);var St=(r,e)=>{let t;switch(r.code){case d.invalid_type:r.received===h.undefined?t="Required":t="Expected ".concat(r.expected,", received ").concat(r.received);break;case d.invalid_literal:t="Invalid literal value, expected ".concat(JSON.stringify(r.expected,b.jsonStringifyReplacer));break;case d.unrecognized_keys:t="Unrecognized key(s) in object: ".concat(b.joinValues(r.keys,", "));break;case d.invalid_union:t="Invalid input";break;case d.invalid_union_discriminator:t="Invalid discriminator value. Expected ".concat(b.joinValues(r.options));break;case d.invalid_enum_value:t="Invalid enum value. Expected ".concat(b.joinValues(r.options),", received \'").concat(r.received,"\'");break;case d.invalid_arguments:t="Invalid function arguments";break;case d.invalid_return_type:t="Invalid function return type";break;case d.invalid_date:t="Invalid date";break;case d.invalid_string:typeof r.validation=="object"?"includes"in r.validation?(t=\'Invalid input: must include "\'.concat(r.validation.includes,\'"\'),typeof r.validation.position=="number"&&(t="".concat(t," at one or more positions greater than or equal to ").concat(r.validation.position))):"startsWith"in r.validation?t=\'Invalid input: must start with "\'.concat(r.validation.startsWith,\'"\'):"endsWith"in r.validation?t=\'Invalid input: must end with "\'.concat(r.validation.endsWith,\'"\'):b.assertNever(r.validation):r.validation!=="regex"?t="Invalid ".concat(r.validation):t="Invalid";break;case d.too_small:r.type==="array"?t="Array must contain ".concat(r.exact?"exactly":r.inclusive?"at least":"more than"," ").concat(r.minimum," element(s)"):r.type==="string"?t="String must contain ".concat(r.exact?"exactly":r.inclusive?"at least":"over"," ").concat(r.minimum," character(s)"):r.type==="number"?t="Number must be ".concat(r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than ").concat(r.minimum):r.type==="date"?t="Date must be ".concat(r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than ").concat(new Date(Number(r.minimum))):t="Invalid input";break;case d.too_big:r.type==="array"?t="Array must contain ".concat(r.exact?"exactly":r.inclusive?"at most":"less than"," ").concat(r.maximum," element(s)"):r.type==="string"?t="String must contain ".concat(r.exact?"exactly":r.inclusive?"at most":"under"," ").concat(r.maximum," character(s)"):r.type==="number"?t="Number must be ".concat(r.exact?"exactly":r.inclusive?"less than or equal to":"less than"," ").concat(r.maximum):r.type==="bigint"?t="BigInt must be ".concat(r.exact?"exactly":r.inclusive?"less than or equal to":"less than"," ").concat(r.maximum):r.type==="date"?t="Date must be ".concat(r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"," ").concat(new Date(Number(r.maximum))):t="Invalid input";break;case d.custom:t="Invalid input";break;case d.invalid_intersection_types:t="Intersection results could not be merged";break;case d.not_multiple_of:t="Number must be a multiple of ".concat(r.multipleOf);break;case d.not_finite:t="Number must be finite";break;default:t=e.defaultError,b.assertNever(r)}return{message:t}},D=St;var st=D;function At(r){st=r}function me(){return st}var Oe=r=>{let{data:e,path:t,errorMaps:s,issueData:n}=r,a=[...t,...n.path||[]],o=y(c({},n),{path:a});if(n.message!==void 0)return y(c({},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 y(c({},n),{path:a,message:i})},Ot=[];function f(r,e){let t=me(),s=Oe({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t,t===D?void 0:D].filter(n=>!!n)});r.common.issues.push(s)}var R=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 m;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 m;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}}},m=Object.freeze({status:"aborted"}),K=r=>({status:"dirty",value:r}),S=r=>({status:"valid",value:r}),Ee=r=>r.status==="aborted",Me=r=>r.status==="dirty",U=r=>r.status==="valid",ye=r=>typeof Promise<"u"&&r instanceof Promise;var p;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(p||(p={}));var E=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}},nt=(r,e)=>{if(U(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 A(r.common.issues);return this._error=t,this._error}}};function v(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)=>{var l,_;let{message:u}=r;return o.code==="invalid_enum_value"?{message:u!=null?u:i.defaultError}:typeof i.data>"u"?{message:(l=u!=null?u:s)!=null?l:i.defaultError}:o.code!=="invalid_type"?{message:i.defaultError}:{message:(_=u!=null?u:t)!=null?_:i.defaultError}},description:n}}var x=class{get description(){return this._def.description}_getType(e){return Z(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:Z(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new R,ctx:{common:e.parent.common,data:e.data,parsedType:Z(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(ye(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){var a;let s={common:{issues:[],async:(a=t==null?void 0:t.async)!=null?a:!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Z(e)},n=this._parseSync({data:e,path:s.path,parent:s});return nt(s,n)}"~validate"(e){var s,n;let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Z(e)};if(!this["~standard"].async)try{let a=this._parseSync({data:e,path:[],parent:t});return U(a)?{value:a.value}:{issues:t.common.issues}}catch(a){(n=(s=a==null?void 0:a.message)==null?void 0:s.toLowerCase())!=null&&n.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(a=>U(a)?{value:a.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==null?void 0:t.errorMap,async:!0},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Z(e)},n=this._parse({data:e,path:s.path,parent:s}),a=await(ye(n)?n:Promise.resolve(n));return nt(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(c({code:d.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 M({schema:this,typeName:g.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 j.create(this,this._def)}nullable(){return L.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return F.create(this)}promise(){return Y.create(this,this._def)}or(e){return ne.create([this,e],this._def)}and(e){return ae.create(this,e,this._def)}transform(e){return new M(y(c({},v(this._def)),{schema:this,typeName:g.ZodEffects,effect:{type:"transform",transform:e}}))}default(e){let t=typeof e=="function"?e:()=>e;return new ue(y(c({},v(this._def)),{innerType:this,defaultValue:t,typeName:g.ZodDefault}))}brand(){return new Ie(c({typeName:g.ZodBranded,type:this},v(this._def)))}catch(e){let t=typeof e=="function"?e:()=>e;return new le(y(c({},v(this._def)),{innerType:this,catchValue:t,typeName:g.ZodCatch}))}describe(e){let t=this.constructor;return new t(y(c({},this._def),{description:e}))}pipe(e){return Ne.create(this,e)}readonly(){return fe.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},It=/^c[^\\s-]{8,}$/i,Nt=/^[0-9a-z]+$/,jt=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Et=/^[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,Mt=/^[a-z0-9_-]{21}$/i,Pt=/^[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]*$/,Zt=/^[-+]?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)?)??$/,$t=/^(?!\\.)(?!.*\\.\\.)([A-Z0-9_\'+\\-\\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\\-]*\\.)+[A-Z]{2,}$/i,Lt="^(\\\\p{Extended_Pictographic}|\\\\p{Emoji_Component})+$",We,Vt=/^(?:(?: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])$/,Dt=/^(?:(?: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])$/,zt=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Bt=/^(([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])$/,Ft=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Ut=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,it="((\\\\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])))",Wt=new RegExp("^".concat(it,"$"));function ot(r){let e="[0-5]\\\\d";r.precision?e="".concat(e,"\\\\.\\\\d{").concat(r.precision,"}"):r.precision==null&&(e="".concat(e,"(\\\\.\\\\d+)?"));let t=r.precision?"+":"?";return"([01]\\\\d|2[0-3]):[0-5]\\\\d(:".concat(e,")").concat(t)}function qt(r){return new RegExp("^".concat(ot(r),"$"))}function ct(r){let e="".concat(it,"T").concat(ot(r)),t=[];return t.push(r.local?"Z?":"Z"),r.offset&&t.push("([+-]\\\\d{2}:?\\\\d{2})"),e="".concat(e,"(").concat(t.join("|"),")"),new RegExp("^".concat(e,"$"))}function Yt(r,e){return!!((e==="v4"||!e)&&Vt.test(r)||(e==="v6"||!e)&&zt.test(r))}function Xt(r,e){if(!Pt.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==null?void 0:n.typ)!=="JWT"||!n.alg||e&&n.alg!==e)}catch(t){return!1}}function Jt(r,e){return!!((e==="v4"||!e)&&Dt.test(r)||(e==="v6"||!e)&&Bt.test(r))}var W=class r extends x{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==h.string){let a=this._getOrReturnCtx(e);return f(a,{code:d.invalid_type,expected:h.string,received:a.parsedType}),m}let s=new R,n;for(let a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(n=this._getOrReturnCtx(e,n),f(n,{code:d.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),f(n,{code:d.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?f(n,{code:d.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):i&&f(n,{code:d.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),s.dirty())}else if(a.kind==="email")$t.test(e.data)||(n=this._getOrReturnCtx(e,n),f(n,{validation:"email",code:d.invalid_string,message:a.message}),s.dirty());else if(a.kind==="emoji")We||(We=new RegExp(Lt,"u")),We.test(e.data)||(n=this._getOrReturnCtx(e,n),f(n,{validation:"emoji",code:d.invalid_string,message:a.message}),s.dirty());else if(a.kind==="uuid")Et.test(e.data)||(n=this._getOrReturnCtx(e,n),f(n,{validation:"uuid",code:d.invalid_string,message:a.message}),s.dirty());else if(a.kind==="nanoid")Mt.test(e.data)||(n=this._getOrReturnCtx(e,n),f(n,{validation:"nanoid",code:d.invalid_string,message:a.message}),s.dirty());else if(a.kind==="cuid")It.test(e.data)||(n=this._getOrReturnCtx(e,n),f(n,{validation:"cuid",code:d.invalid_string,message:a.message}),s.dirty());else if(a.kind==="cuid2")Nt.test(e.data)||(n=this._getOrReturnCtx(e,n),f(n,{validation:"cuid2",code:d.invalid_string,message:a.message}),s.dirty());else if(a.kind==="ulid")jt.test(e.data)||(n=this._getOrReturnCtx(e,n),f(n,{validation:"ulid",code:d.invalid_string,message:a.message}),s.dirty());else if(a.kind==="url")try{new URL(e.data)}catch(o){n=this._getOrReturnCtx(e,n),f(n,{validation:"url",code:d.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),f(n,{validation:"regex",code:d.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),f(n,{code:d.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),f(n,{code:d.invalid_string,validation:{startsWith:a.value},message:a.message}),s.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(n=this._getOrReturnCtx(e,n),f(n,{code:d.invalid_string,validation:{endsWith:a.value},message:a.message}),s.dirty()):a.kind==="datetime"?ct(a).test(e.data)||(n=this._getOrReturnCtx(e,n),f(n,{code:d.invalid_string,validation:"datetime",message:a.message}),s.dirty()):a.kind==="date"?Wt.test(e.data)||(n=this._getOrReturnCtx(e,n),f(n,{code:d.invalid_string,validation:"date",message:a.message}),s.dirty()):a.kind==="time"?qt(a).test(e.data)||(n=this._getOrReturnCtx(e,n),f(n,{code:d.invalid_string,validation:"time",message:a.message}),s.dirty()):a.kind==="duration"?Zt.test(e.data)||(n=this._getOrReturnCtx(e,n),f(n,{validation:"duration",code:d.invalid_string,message:a.message}),s.dirty()):a.kind==="ip"?Yt(e.data,a.version)||(n=this._getOrReturnCtx(e,n),f(n,{validation:"ip",code:d.invalid_string,message:a.message}),s.dirty()):a.kind==="jwt"?Xt(e.data,a.alg)||(n=this._getOrReturnCtx(e,n),f(n,{validation:"jwt",code:d.invalid_string,message:a.message}),s.dirty()):a.kind==="cidr"?Jt(e.data,a.version)||(n=this._getOrReturnCtx(e,n),f(n,{validation:"cidr",code:d.invalid_string,message:a.message}),s.dirty()):a.kind==="base64"?Ft.test(e.data)||(n=this._getOrReturnCtx(e,n),f(n,{validation:"base64",code:d.invalid_string,message:a.message}),s.dirty()):a.kind==="base64url"?Ut.test(e.data)||(n=this._getOrReturnCtx(e,n),f(n,{validation:"base64url",code:d.invalid_string,message:a.message}),s.dirty()):b.assertNever(a);return{status:s.value,value:e.data}}_regex(e,t,s){return this.refinement(n=>e.test(n),c({validation:t,code:d.invalid_string},p.errToObj(s)))}_addCheck(e){return new r(y(c({},this._def),{checks:[...this._def.checks,e]}))}email(e){return this._addCheck(c({kind:"email"},p.errToObj(e)))}url(e){return this._addCheck(c({kind:"url"},p.errToObj(e)))}emoji(e){return this._addCheck(c({kind:"emoji"},p.errToObj(e)))}uuid(e){return this._addCheck(c({kind:"uuid"},p.errToObj(e)))}nanoid(e){return this._addCheck(c({kind:"nanoid"},p.errToObj(e)))}cuid(e){return this._addCheck(c({kind:"cuid"},p.errToObj(e)))}cuid2(e){return this._addCheck(c({kind:"cuid2"},p.errToObj(e)))}ulid(e){return this._addCheck(c({kind:"ulid"},p.errToObj(e)))}base64(e){return this._addCheck(c({kind:"base64"},p.errToObj(e)))}base64url(e){return this._addCheck(c({kind:"base64url"},p.errToObj(e)))}jwt(e){return this._addCheck(c({kind:"jwt"},p.errToObj(e)))}ip(e){return this._addCheck(c({kind:"ip"},p.errToObj(e)))}cidr(e){return this._addCheck(c({kind:"cidr"},p.errToObj(e)))}datetime(e){var t,s;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck(c({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(t=e==null?void 0:e.offset)!=null?t:!1,local:(s=e==null?void 0:e.local)!=null?s:!1},p.errToObj(e==null?void 0: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(c({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision},p.errToObj(e==null?void 0:e.message)))}duration(e){return this._addCheck(c({kind:"duration"},p.errToObj(e)))}regex(e,t){return this._addCheck(c({kind:"regex",regex:e},p.errToObj(t)))}includes(e,t){return this._addCheck(c({kind:"includes",value:e,position:t==null?void 0:t.position},p.errToObj(t==null?void 0:t.message)))}startsWith(e,t){return this._addCheck(c({kind:"startsWith",value:e},p.errToObj(t)))}endsWith(e,t){return this._addCheck(c({kind:"endsWith",value:e},p.errToObj(t)))}min(e,t){return this._addCheck(c({kind:"min",value:e},p.errToObj(t)))}max(e,t){return this._addCheck(c({kind:"max",value:e},p.errToObj(t)))}length(e,t){return this._addCheck(c({kind:"length",value:e},p.errToObj(t)))}nonempty(e){return this.min(1,p.errToObj(e))}trim(){return new r(y(c({},this._def),{checks:[...this._def.checks,{kind:"trim"}]}))}toLowerCase(){return new r(y(c({},this._def),{checks:[...this._def.checks,{kind:"toLowerCase"}]}))}toUpperCase(){return new r(y(c({},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}};W.create=r=>{var e;return new W(c({checks:[],typeName:g.ZodString,coerce:(e=r==null?void 0:r.coerce)!=null?e:!1},v(r)))};function Qt(r,e){let t=(r.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,n=t>s?t:s,a=Number.parseInt(r.toFixed(n).replace(".","")),o=Number.parseInt(e.toFixed(n).replace(".",""));return a%o/10**n}var G=class r extends x{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)!==h.number){let a=this._getOrReturnCtx(e);return f(a,{code:d.invalid_type,expected:h.number,received:a.parsedType}),m}let s,n=new R;for(let a of this._def.checks)a.kind==="int"?b.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{code:d.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),f(s,{code:d.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),f(s,{code:d.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):a.kind==="multipleOf"?Qt(e.data,a.value)!==0&&(s=this._getOrReturnCtx(e,s),f(s,{code:d.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{code:d.not_finite,message:a.message}),n.dirty()):b.assertNever(a);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,p.toString(t))}gt(e,t){return this.setLimit("min",e,!1,p.toString(t))}lte(e,t){return this.setLimit("max",e,!0,p.toString(t))}lt(e,t){return this.setLimit("max",e,!1,p.toString(t))}setLimit(e,t,s,n){return new r(y(c({},this._def),{checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:p.toString(n)}]}))}_addCheck(e){return new r(y(c({},this._def),{checks:[...this._def.checks,e]}))}int(e){return this._addCheck({kind:"int",message:p.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:p.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:p.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:p.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:p.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:p.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:p.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:p.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:p.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"&&b.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(t===null||s.value>t)&&(t=s.value):s.kind==="max"&&(e===null||s.value<e)&&(e=s.value)}return Number.isFinite(t)&&Number.isFinite(e)}};G.create=r=>new G(c({checks:[],typeName:g.ZodNumber,coerce:(r==null?void 0:r.coerce)||!1},v(r)));var H=class r extends x{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch(a){return this._getInvalidInput(e)}if(this._getType(e)!==h.bigint)return this._getInvalidInput(e);let s,n=new R;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),f(s,{code:d.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),f(s,{code:d.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),f(s,{code:d.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):b.assertNever(a);return{status:n.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return f(t,{code:d.invalid_type,expected:h.bigint,received:t.parsedType}),m}gte(e,t){return this.setLimit("min",e,!0,p.toString(t))}gt(e,t){return this.setLimit("min",e,!1,p.toString(t))}lte(e,t){return this.setLimit("max",e,!0,p.toString(t))}lt(e,t){return this.setLimit("max",e,!1,p.toString(t))}setLimit(e,t,s,n){return new r(y(c({},this._def),{checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:p.toString(n)}]}))}_addCheck(e){return new r(y(c({},this._def),{checks:[...this._def.checks,e]}))}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:p.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:p.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:p.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:p.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:p.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};H.create=r=>{var e;return new H(c({checks:[],typeName:g.ZodBigInt,coerce:(e=r==null?void 0:r.coerce)!=null?e:!1},v(r)))};var ee=class extends x{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==h.boolean){let s=this._getOrReturnCtx(e);return f(s,{code:d.invalid_type,expected:h.boolean,received:s.parsedType}),m}return S(e.data)}};ee.create=r=>new ee(c({typeName:g.ZodBoolean,coerce:(r==null?void 0:r.coerce)||!1},v(r)));var te=class r extends x{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==h.date){let a=this._getOrReturnCtx(e);return f(a,{code:d.invalid_type,expected:h.date,received:a.parsedType}),m}if(Number.isNaN(e.data.getTime())){let a=this._getOrReturnCtx(e);return f(a,{code:d.invalid_date}),m}let s=new R,n;for(let a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(n=this._getOrReturnCtx(e,n),f(n,{code:d.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),f(n,{code:d.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),s.dirty()):b.assertNever(a);return{status:s.value,value:new Date(e.data.getTime())}}_addCheck(e){return new r(y(c({},this._def),{checks:[...this._def.checks,e]}))}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:p.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:p.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}};te.create=r=>new te(c({checks:[],coerce:(r==null?void 0:r.coerce)||!1,typeName:g.ZodDate},v(r)));var _e=class extends x{_parse(e){if(this._getType(e)!==h.symbol){let s=this._getOrReturnCtx(e);return f(s,{code:d.invalid_type,expected:h.symbol,received:s.parsedType}),m}return S(e.data)}};_e.create=r=>new _e(c({typeName:g.ZodSymbol},v(r)));var re=class extends x{_parse(e){if(this._getType(e)!==h.undefined){let s=this._getOrReturnCtx(e);return f(s,{code:d.invalid_type,expected:h.undefined,received:s.parsedType}),m}return S(e.data)}};re.create=r=>new re(c({typeName:g.ZodUndefined},v(r)));var se=class extends x{_parse(e){if(this._getType(e)!==h.null){let s=this._getOrReturnCtx(e);return f(s,{code:d.invalid_type,expected:h.null,received:s.parsedType}),m}return S(e.data)}};se.create=r=>new se(c({typeName:g.ZodNull},v(r)));var q=class extends x{constructor(){super(...arguments),this._any=!0}_parse(e){return S(e.data)}};q.create=r=>new q(c({typeName:g.ZodAny},v(r)));var B=class extends x{constructor(){super(...arguments),this._unknown=!0}_parse(e){return S(e.data)}};B.create=r=>new B(c({typeName:g.ZodUnknown},v(r)));var P=class extends x{_parse(e){let t=this._getOrReturnCtx(e);return f(t,{code:d.invalid_type,expected:h.never,received:t.parsedType}),m}};P.create=r=>new P(c({typeName:g.ZodNever},v(r)));var ve=class extends x{_parse(e){if(this._getType(e)!==h.undefined){let s=this._getOrReturnCtx(e);return f(s,{code:d.invalid_type,expected:h.void,received:s.parsedType}),m}return S(e.data)}};ve.create=r=>new ve(c({typeName:g.ZodVoid},v(r)));var F=class r extends x{_parse(e){let{ctx:t,status:s}=this._processInputParams(e),n=this._def;if(t.parsedType!==h.array)return f(t,{code:d.invalid_type,expected:h.array,received:t.parsedType}),m;if(n.exactLength!==null){let o=t.data.length>n.exactLength.value,i=t.data.length<n.exactLength.value;(o||i)&&(f(t,{code:o?d.too_big:d.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&&(f(t,{code:d.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&&(f(t,{code:d.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 E(t,o,t.path,i)))).then(o=>R.mergeArray(s,o));let a=[...t.data].map((o,i)=>n.type._parseSync(new E(t,o,t.path,i)));return R.mergeArray(s,a)}get element(){return this._def.type}min(e,t){return new r(y(c({},this._def),{minLength:{value:e,message:p.toString(t)}}))}max(e,t){return new r(y(c({},this._def),{maxLength:{value:e,message:p.toString(t)}}))}length(e,t){return new r(y(c({},this._def),{exactLength:{value:e,message:p.toString(t)}}))}nonempty(e){return this.min(1,e)}};F.create=(r,e)=>new F(c({type:r,minLength:null,maxLength:null,exactLength:null,typeName:g.ZodArray},v(e)));function ge(r){if(r instanceof O){let e={};for(let t in r.shape){let s=r.shape[t];e[t]=j.create(ge(s))}return new O(y(c({},r._def),{shape:()=>e}))}else return r instanceof F?new F(y(c({},r._def),{type:ge(r.element)})):r instanceof j?j.create(ge(r.unwrap())):r instanceof L?L.create(ge(r.unwrap())):r instanceof $?$.create(r.items.map(e=>ge(e))):r}var O=class r extends x{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=b.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==h.object){let l=this._getOrReturnCtx(e);return f(l,{code:d.invalid_type,expected:h.object,received:l.parsedType}),m}let{status:s,ctx:n}=this._processInputParams(e),{shape:a,keys:o}=this._getCached(),i=[];if(!(this._def.catchall instanceof P&&this._def.unknownKeys==="strip"))for(let l in n.data)o.includes(l)||i.push(l);let u=[];for(let l of o){let _=a[l],T=n.data[l];u.push({key:{status:"valid",value:l},value:_._parse(new E(n,T,n.path,l)),alwaysSet:l in n.data})}if(this._def.catchall instanceof P){let l=this._def.unknownKeys;if(l==="passthrough")for(let _ of i)u.push({key:{status:"valid",value:_},value:{status:"valid",value:n.data[_]}});else if(l==="strict")i.length>0&&(f(n,{code:d.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 _ of i){let T=n.data[_];u.push({key:{status:"valid",value:_},value:l._parse(new E(n,T,n.path,_)),alwaysSet:_ in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let l=[];for(let _ of u){let T=await _.key,he=await _.value;l.push({key:T,value:he,alwaysSet:_.alwaysSet})}return l}).then(l=>R.mergeObjectSync(s,l)):R.mergeObjectSync(s,u)}get shape(){return this._def.shape()}strict(e){return p.errToObj,new r(c(y(c({},this._def),{unknownKeys:"strict"}),e!==void 0?{errorMap:(t,s)=>{var a,o,i,u;let n=(i=(o=(a=this._def).errorMap)==null?void 0:o.call(a,t,s).message)!=null?i:s.defaultError;return t.code==="unrecognized_keys"?{message:(u=p.errToObj(e).message)!=null?u:n}:{message:n}}}:{}))}strip(){return new r(y(c({},this._def),{unknownKeys:"strip"}))}passthrough(){return new r(y(c({},this._def),{unknownKeys:"passthrough"}))}extend(e){return new r(y(c({},this._def),{shape:()=>c(c({},this._def.shape()),e)}))}merge(e){return new r({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>c(c({},this._def.shape()),e._def.shape()),typeName:g.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new r(y(c({},this._def),{catchall:e}))}pick(e){let t={};for(let s of b.objectKeys(e))e[s]&&this.shape[s]&&(t[s]=this.shape[s]);return new r(y(c({},this._def),{shape:()=>t}))}omit(e){let t={};for(let s of b.objectKeys(this.shape))e[s]||(t[s]=this.shape[s]);return new r(y(c({},this._def),{shape:()=>t}))}deepPartial(){return ge(this)}partial(e){let t={};for(let s of b.objectKeys(this.shape)){let n=this.shape[s];e&&!e[s]?t[s]=n:t[s]=n.optional()}return new r(y(c({},this._def),{shape:()=>t}))}required(e){let t={};for(let s of b.objectKeys(this.shape))if(e&&!e[s])t[s]=this.shape[s];else{let a=this.shape[s];for(;a instanceof j;)a=a._def.innerType;t[s]=a}return new r(y(c({},this._def),{shape:()=>t}))}keyof(){return dt(b.objectKeys(this.shape))}};O.create=(r,e)=>new O(c({shape:()=>r,unknownKeys:"strip",catchall:P.create(),typeName:g.ZodObject},v(e)));O.strictCreate=(r,e)=>new O(c({shape:()=>r,unknownKeys:"strict",catchall:P.create(),typeName:g.ZodObject},v(e)));O.lazycreate=(r,e)=>new O(c({shape:r,unknownKeys:"strip",catchall:P.create(),typeName:g.ZodObject},v(e)));var ne=class extends x{_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 A(i.ctx.common.issues));return f(t,{code:d.invalid_union,unionErrors:o}),m}if(t.common.async)return Promise.all(s.map(async a=>{let o=y(c({},t),{common:y(c({},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=y(c({},t),{common:y(c({},t.common),{issues:[]}),parent:null}),_=u._parseSync({data:t.data,path:t.path,parent:l});if(_.status==="valid")return _;_.status==="dirty"&&!a&&(a={result:_,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 A(u));return f(t,{code:d.invalid_union,unionErrors:i}),m}}get options(){return this._def.options}};ne.create=(r,e)=>new ne(c({options:r,typeName:g.ZodUnion},v(e)));var z=r=>r instanceof ie?z(r.schema):r instanceof M?z(r.innerType()):r instanceof oe?[r.value]:r instanceof ce?r.options:r instanceof de?b.objectValues(r.enum):r instanceof ue?z(r._def.innerType):r instanceof re?[void 0]:r instanceof se?[null]:r instanceof j?[void 0,...z(r.unwrap())]:r instanceof L?[null,...z(r.unwrap())]:r instanceof Ie||r instanceof fe?z(r.unwrap()):r instanceof le?z(r._def.innerType):[],Pe=class r extends x{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==h.object)return f(t,{code:d.invalid_type,expected:h.object,received:t.parsedType}),m;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}):(f(t,{code:d.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),m)}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=z(a.shape[e]);if(!o.length)throw new Error("A discriminator value for key `".concat(e,"` could not be extracted from all schema options"));for(let i of o){if(n.has(i))throw new Error("Discriminator property ".concat(String(e)," has duplicate value ").concat(String(i)));n.set(i,a)}}return new r(c({typeName:g.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n},v(s)))}};function qe(r,e){let t=Z(r),s=Z(e);if(r===e)return{valid:!0,data:r};if(t===h.object&&s===h.object){let n=b.objectKeys(e),a=b.objectKeys(r).filter(i=>n.indexOf(i)!==-1),o=c(c({},r),e);for(let i of a){let u=qe(r[i],e[i]);if(!u.valid)return{valid:!1};o[i]=u.data}return{valid:!0,data:o}}else if(t===h.array&&s===h.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=qe(o,i);if(!u.valid)return{valid:!1};n.push(u.data)}return{valid:!0,data:n}}else return t===h.date&&s===h.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}var ae=class extends x{_parse(e){let{status:t,ctx:s}=this._processInputParams(e),n=(a,o)=>{if(Ee(a)||Ee(o))return m;let i=qe(a.value,o.value);return i.valid?((Me(a)||Me(o))&&t.dirty(),{status:t.value,value:i.data}):(f(s,{code:d.invalid_intersection_types}),m)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([a,o])=>n(a,o)):n(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}};ae.create=(r,e,t)=>new ae(c({left:r,right:e,typeName:g.ZodIntersection},v(t)));var $=class r extends x{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==h.array)return f(s,{code:d.invalid_type,expected:h.array,received:s.parsedType}),m;if(s.data.length<this._def.items.length)return f(s,{code:d.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),m;!this._def.rest&&s.data.length>this._def.items.length&&(f(s,{code:d.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 E(s,o,s.path,i)):null}).filter(o=>!!o);return s.common.async?Promise.all(a).then(o=>R.mergeArray(t,o)):R.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new r(y(c({},this._def),{rest:e}))}};$.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new $(c({items:r,typeName:g.ZodTuple,rest:null},v(e)))};var Ze=class r extends x{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!==h.object)return f(s,{code:d.invalid_type,expected:h.object,received:s.parsedType}),m;let n=[],a=this._def.keyType,o=this._def.valueType;for(let i in s.data)n.push({key:a._parse(new E(s,i,s.path,i)),value:o._parse(new E(s,s.data[i],s.path,i)),alwaysSet:i in s.data});return s.common.async?R.mergeObjectAsync(t,n):R.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,s){return t instanceof x?new r(c({keyType:e,valueType:t,typeName:g.ZodRecord},v(s))):new r(c({keyType:W.create(),valueType:e,typeName:g.ZodRecord},v(t)))}},xe=class extends x{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!==h.map)return f(s,{code:d.invalid_type,expected:h.map,received:s.parsedType}),m;let n=this._def.keyType,a=this._def.valueType,o=[...s.data.entries()].map(([i,u],l)=>({key:n._parse(new E(s,i,s.path,[l,"key"])),value:a._parse(new E(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,_=await u.value;if(l.status==="aborted"||_.status==="aborted")return m;(l.status==="dirty"||_.status==="dirty")&&t.dirty(),i.set(l.value,_.value)}return{status:t.value,value:i}})}else{let i=new Map;for(let u of o){let l=u.key,_=u.value;if(l.status==="aborted"||_.status==="aborted")return m;(l.status==="dirty"||_.status==="dirty")&&t.dirty(),i.set(l.value,_.value)}return{status:t.value,value:i}}}};xe.create=(r,e,t)=>new xe(c({valueType:e,keyType:r,typeName:g.ZodMap},v(t)));var be=class r extends x{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==h.set)return f(s,{code:d.invalid_type,expected:h.set,received:s.parsedType}),m;let n=this._def;n.minSize!==null&&s.data.size<n.minSize.value&&(f(s,{code:d.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&&(f(s,{code:d.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 _ of u){if(_.status==="aborted")return m;_.status==="dirty"&&t.dirty(),l.add(_.value)}return{status:t.value,value:l}}let i=[...s.data.values()].map((u,l)=>a._parse(new E(s,u,s.path,l)));return s.common.async?Promise.all(i).then(u=>o(u)):o(i)}min(e,t){return new r(y(c({},this._def),{minSize:{value:e,message:p.toString(t)}}))}max(e,t){return new r(y(c({},this._def),{maxSize:{value:e,message:p.toString(t)}}))}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};be.create=(r,e)=>new be(c({valueType:r,minSize:null,maxSize:null,typeName:g.ZodSet},v(e)));var $e=class r extends x{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==h.function)return f(t,{code:d.invalid_type,expected:h.function,received:t.parsedType}),m;function s(i,u){return Oe({data:i,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,me(),D].filter(l=>!!l),issueData:{code:d.invalid_arguments,argumentsError:u}})}function n(i,u){return Oe({data:i,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,me(),D].filter(l=>!!l),issueData:{code:d.invalid_return_type,returnTypeError:u}})}let a={errorMap:t.common.contextualErrorMap},o=t.data;if(this._def.returns instanceof Y){let i=this;return S(async function(...u){let l=new A([]),_=await i._def.args.parseAsync(u,a).catch(Te=>{throw l.addIssue(s(u,Te)),l}),T=await Reflect.apply(o,this,_);return await i._def.returns._def.type.parseAsync(T,a).catch(Te=>{throw l.addIssue(n(T,Te)),l})})}else{let i=this;return S(function(...u){let l=i._def.args.safeParse(u,a);if(!l.success)throw new A([s(u,l.error)]);let _=Reflect.apply(o,this,l.data),T=i._def.returns.safeParse(_,a);if(!T.success)throw new A([n(_,T.error)]);return T.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new r(y(c({},this._def),{args:$.create(e).rest(B.create())}))}returns(e){return new r(y(c({},this._def),{returns:e}))}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,s){return new r(c({args:e||$.create([]).rest(B.create()),returns:t||B.create(),typeName:g.ZodFunction},v(s)))}},ie=class extends x{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};ie.create=(r,e)=>new ie(c({getter:r,typeName:g.ZodLazy},v(e)));var oe=class extends x{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return f(t,{received:t.data,code:d.invalid_literal,expected:this._def.value}),m}return{status:"valid",value:e.data}}get value(){return this._def.value}};oe.create=(r,e)=>new oe(c({value:r,typeName:g.ZodLiteral},v(e)));function dt(r,e){return new ce(c({values:r,typeName:g.ZodEnum},v(e)))}var ce=class r extends x{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),s=this._def.values;return f(t,{expected:b.joinValues(s),received:t.parsedType,code:d.invalid_type}),m}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 f(t,{received:t.data,code:d.invalid_enum_value,options:s}),m}return S(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,c(c({},this._def),t))}exclude(e,t=this._def){return r.create(this.options.filter(s=>!e.includes(s)),c(c({},this._def),t))}};ce.create=dt;var de=class extends x{_parse(e){let t=b.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==h.string&&s.parsedType!==h.number){let n=b.objectValues(t);return f(s,{expected:b.joinValues(n),received:s.parsedType,code:d.invalid_type}),m}if(this._cache||(this._cache=new Set(b.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let n=b.objectValues(t);return f(s,{received:s.data,code:d.invalid_enum_value,options:n}),m}return S(e.data)}get enum(){return this._def.values}};de.create=(r,e)=>new de(c({values:r,typeName:g.ZodNativeEnum},v(e)));var Y=class extends x{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==h.promise&&t.common.async===!1)return f(t,{code:d.invalid_type,expected:h.promise,received:t.parsedType}),m;let s=t.parsedType===h.promise?t.data:Promise.resolve(t.data);return S(s.then(n=>this._def.type.parseAsync(n,{path:t.path,errorMap:t.common.contextualErrorMap})))}};Y.create=(r,e)=>new Y(c({type:r,typeName:g.ZodPromise},v(e)));var M=class extends x{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===g.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=>{f(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 m;let u=await this._def.schema._parseAsync({data:i,path:s.path,parent:s});return u.status==="aborted"?m:u.status==="dirty"?K(u.value):t.value==="dirty"?K(u.value):u});{if(t.value==="aborted")return m;let i=this._def.schema._parseSync({data:o,path:s.path,parent:s});return i.status==="aborted"?m:i.status==="dirty"?K(i.value):t.value==="dirty"?K(i.value):i}}if(n.type==="refinement"){let o=i=>{let u=n.refinement(i,a);if(s.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return i};if(s.common.async===!1){let i=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return i.status==="aborted"?m:(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"?m:(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(!U(o))return m;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=>U(o)?Promise.resolve(n.transform(o.value,a)).then(i=>({status:t.value,value:i})):m);b.assertNever(n)}};M.create=(r,e,t)=>new M(c({schema:r,typeName:g.ZodEffects,effect:e},v(t)));M.createWithPreprocess=(r,e,t)=>new M(c({schema:e,effect:{type:"preprocess",transform:r},typeName:g.ZodEffects},v(t)));var j=class extends x{_parse(e){return this._getType(e)===h.undefined?S(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};j.create=(r,e)=>new j(c({innerType:r,typeName:g.ZodOptional},v(e)));var L=class extends x{_parse(e){return this._getType(e)===h.null?S(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};L.create=(r,e)=>new L(c({innerType:r,typeName:g.ZodNullable},v(e)));var ue=class extends x{_parse(e){let{ctx:t}=this._processInputParams(e),s=t.data;return t.parsedType===h.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};ue.create=(r,e)=>new ue(c({innerType:r,typeName:g.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default},v(e)));var le=class extends x{_parse(e){let{ctx:t}=this._processInputParams(e),s=y(c({},t),{common:y(c({},t.common),{issues:[]})}),n=this._def.innerType._parse({data:s.data,path:s.path,parent:c({},s)});return ye(n)?n.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new A(s.common.issues)},input:s.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new A(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}};le.create=(r,e)=>new le(c({innerType:r,typeName:g.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch},v(e)));var ke=class extends x{_parse(e){if(this._getType(e)!==h.nan){let s=this._getOrReturnCtx(e);return f(s,{code:d.invalid_type,expected:h.nan,received:s.parsedType}),m}return{status:"valid",value:e.data}}};ke.create=r=>new ke(c({typeName:g.ZodNaN},v(r)));var Kt=Symbol("zod_brand"),Ie=class extends x{_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}},Ne=class r extends x{_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"?m:a.status==="dirty"?(t.dirty(),K(a.value)):this._def.out._parseAsync({data:a.value,path:s.path,parent:s})})();{let n=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return n.status==="aborted"?m: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:g.ZodPipeline})}},fe=class extends x{_parse(e){let t=this._def.innerType._parse(e),s=n=>(U(n)&&(n.value=Object.freeze(n.value)),n);return ye(t)?t.then(n=>s(n)):s(t)}unwrap(){return this._def.innerType}};fe.create=(r,e)=>new fe(c({innerType:r,typeName:g.ZodReadonly},v(e)));function at(r,e){let t=typeof r=="function"?r(e):typeof r=="string"?{message:r}:r;return typeof t=="string"?{message:t}:t}function ut(r,e={},t){return r?q.create().superRefine((s,n)=>{var o,i;let a=r(s);if(a instanceof Promise)return a.then(u=>{var l,_;if(!u){let T=at(e,s),he=(_=(l=T.fatal)!=null?l:t)!=null?_:!0;n.addIssue(y(c({code:"custom"},T),{fatal:he}))}});if(!a){let u=at(e,s),l=(i=(o=u.fatal)!=null?o:t)!=null?i:!0;n.addIssue(y(c({code:"custom"},u),{fatal:l}))}}):q.create()}var Gt={object:O.lazycreate},g;(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"})(g||(g={}));var Ht=(r,e={message:"Input not instance of ".concat(r.name)})=>ut(t=>t instanceof r,e),lt=W.create,ft=G.create,er=ke.create,tr=H.create,ht=ee.create,rr=te.create,sr=_e.create,nr=re.create,ar=se.create,ir=q.create,or=B.create,cr=P.create,dr=ve.create,ur=F.create,lr=O.create,fr=O.strictCreate,hr=ne.create,pr=Pe.create,mr=ae.create,yr=$.create,gr=Ze.create,_r=xe.create,vr=be.create,xr=$e.create,br=ie.create,kr=oe.create,wr=ce.create,Tr=de.create,Rr=Y.create,Cr=M.create,Sr=j.create,Ar=L.create,Or=M.createWithPreprocess,Ir=Ne.create,Nr=()=>lt().optional(),jr=()=>ft().optional(),Er=()=>ht().optional(),Mr={string:r=>W.create(y(c({},r),{coerce:!0})),number:r=>G.create(y(c({},r),{coerce:!0})),boolean:r=>ee.create(y(c({},r),{coerce:!0})),bigint:r=>H.create(y(c({},r),{coerce:!0})),date:r=>te.create(y(c({},r),{coerce:!0}))};var Pr=m;var Vs=we.union([we.enum(["low","medium","high","always-visible"]),we.number()]);var Le=5;var X=200,Ve=10;function pt(r,e,t,s,n,a,o="-1"){let i=1/0,u=1/0,l=-1/0,_=-1/0,T=new w(-Ve,0,5,t),he=new w(-Ve,0,e,5),Te=new w(e-5,0,e+Ve,t),yt=new w(0,t-5,e,t+Ve),gt=Zr(e,t,s,n,a),_t=[T,he,Te,yt],Ye=new w(-X,-X,e+X*2,t+X*2);for(let k of r){let Ce,Se;for(let I=0;I<k.bboxes.length;I++){if(k.bboxes[I]==null||(Ce=k.bboxes[I].boundingBox,Se=k.bboxes[I].index,k.lockedToStrategyIndex!==-1&&Se!==k.lockedToStrategyIndex))continue;let[je,N,J,Xe]=Ce,[Q,vt,Je,xt]=[k.y-je,k.y+N,k.x-J,k.x+Xe],ze=Je,Be=Q,Qe=xt-Je,Ke=vt-Q;i=Math.min(i,ze)-X,u=Math.min(u,Be)-X,l=Math.max(l,ze+Qe)+X,_=Math.max(_,Be+Ke)+X,k.bboxes[I].boundingRect=new w(ze,Be,Qe,Ke)}}let pe={msgId:o,colliders:new Array(r.length),debug:[]},De=new Ae(new w(i,u,l-i,_-u)),Re;for(let k=0;k<r.length;k++)if(Re=r[k],pe.colliders[k]=[-1,0],Re.enabledAndVisible){let[Ce,Se,I]=[1/0,-1,void 0];for(let{index:je,boundingRect:N}of Re.bboxes){if(N==null)continue;let J=[];if(J=De.queryRect(N).filter(Q=>N.intersects(Q)),Re.shouldCollideWithScreenEdges&&_t.forEach(Q=>{N.intersects(Q)&&J.push(Q)}),N.intersects(gt)){pe.colliders[k]=[-1,0,N];break}if(J.length<=Ce&&(I=N,Se=je,Ce=J.length),J.length===0){De.insert(N),pe.colliders[k]=[je,Ye.contains(N)?0:1,N];break}}Re.rank===Le&&I!=null&&(De.insert(I),pe.colliders[k]=[Se,Ye.contains(I)?0:1,I])}else pe.colliders[k]=[-1,0];return pe}function Zr(r,e,t,s,n){switch(n){case"top-right":return new w(r-t,0,t,s);case"bottom-left":return new w(0,e-s,t,s);case"bottom-right":return new w(r-t,e-s,t,s);case"top-left":return new w(0,0,t,s)}}function mt(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?Le: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=mt(r.data);self.postMessage(pt(e.colliders,e.totalWidth,e.totalHeight,e.watermarkWidth,e.watermarkHeight,e.watermarkPosition,e.msgId))};})();\n';x();x();x();x();x();function nh(e,r){return r.x+r.w<e.x+e.w&&r.x>e.x&&r.y>e.y&&r.y+r.h<e.y+e.h}a(nh,"contains");x();function oh(e,r){let[t,i]=r;return t>=e.x&&t<=e.x+e.w&&i>=e.y&&i<=e.y+e.h}a(oh,"intersectPoint");x();function sh(e,r){let t=r.x,i=r.y,n=r.x+r.w,o=r.y+r.h,s=e.x,l=e.y,h=e.x+e.w,p=e.y+e.h;return t<h&&s<n&&i<p&&l<o}a(sh,"intersects");x();function Yt(e,r){for(let t=0;t<r.length;t++)e.push(r[t])}a(Yt,"appendItems");x();var Aa=class Aa{constructor(r,t,i,n,o){d(this,"x");d(this,"y");d(this,"w");d(this,"h");d(this,"userData");this.userData=typeof o>"u"?null:o,this.x=r,this.y=t,this.w=i,this.h=n}contains(r){return r===this?!1:nh(this,r)}intersects(r){return sh(this,r)}intersectsPoint(r){return oh(this,r)}draw(r){r.fillStyle="rgba(123,222,26, 0.8)",r.fillRect(this.x,this.y,this.w,this.h)}};a(Aa,"Rectangle");var he=Aa;var Rr=class Rr{constructor(r,t){d(this,"topLeft");d(this,"topRight");d(this,"bottomLeft");d(this,"bottomRight");d(this,"divided",!1);d(this,"boundary");d(this,"capacity",16);d(this,"objects",[]);d(this,"parent");this.parent=t,this.boundary=r}getSize(){return this.divided?this.objects.length+this.topLeft.getSize()+this.topRight.getSize()+this.bottomLeft.getSize()+this.bottomRight.getSize():this.objects.length}subdivide(){let{x:r,y:t,w:i,h:n}=this.boundary;this.topLeft=new Rr(new he(r,t,i/2,n/2),this),this.topRight=new Rr(new he(r+i/2,t,i/2,n/2),this),this.bottomLeft=new Rr(new he(r,t+n/2,i/2,n/2),this),this.bottomRight=new Rr(new he(r+i/2,t+n/2,i/2,n/2),this),this.divided=!0}queryRect(r){let t=[];if(this.boundary.intersects(r))t.push(...this.objects);else return[];return this.divided&&(Yt(t,this.topLeft.queryRect(r)),Yt(t,this.topRight.queryRect(r)),Yt(t,this.bottomLeft.queryRect(r)),Yt(t,this.bottomRight.queryRect(r))),t}queryPoint(r){let t=[];if(this.boundary.intersectsPoint(r))t.push(...this.objects);else return[];return this.divided&&(Yt(t,this.topLeft.queryPoint(r)),Yt(t,this.topRight.queryPoint(r)),Yt(t,this.bottomLeft.queryPoint(r)),Yt(t,this.bottomRight.queryPoint(r))),t}insert(r){return(this.parent?!this.boundary.contains(r):!this.boundary.intersects(r))?!1:this.objects.length<this.capacity?(this.objects.push(r),!0):(this.divided||this.subdivide(),(this.topLeft.insert(r)||this.topRight.insert(r)||this.bottomLeft.insert(r)||this.bottomRight.insert(r))===!1&&this.objects.push(r),!0)}drawObjects(r){this.objects.forEach(t=>t.draw(r)),this.divided&&(this.topLeft.drawObjects(r),this.topRight.drawObjects(r),this.bottomLeft.drawObjects(r),this.bottomRight.drawObjects(r))}draw(r){r.rect(this.boundary.x,this.boundary.y,this.boundary.w,this.boundary.h),this.divided&&(this.topLeft.draw(r),this.topRight.draw(r),this.bottomLeft.draw(r),this.bottomRight.draw(r)),r.strokeStyle="black",r.lineWidth=4,r.stroke()}};a(Rr,"QuadTree");var ct=Rr;x();x();var ah=w.union([w.enum(["low","medium","high","always-visible"]),w.number()]),lh=["","","low","medium","high","always-visible"],hf=2,pf=3;var kr=5;function uh(e){return Math.min(kr,Math.max(hf,e))}a(uh,"clampTierNumber");function mi(e){if(typeof e=="number")return uh(e);let r=lh.indexOf(e);return r===-1?pf:r}a(mi,"convertCollisionRankingTierToNumber");function $i(e){let r=uh(e);return lh[r]}a($i,"convertNumberToCollisionRankingTier");function ch(e,r,t){let i,n,o,s=null,l=0;t||(t={});let h=a(function(){l=t.leading===!1?0:Date.now(),s=null,o=e.apply(i,n),s||(i=n=null)},"later");return function(){let p=Date.now();!l&&t.leading===!1&&(l=p);let m=r-(p-l);return i=globalThis,n=arguments,m<=0||m>r?(s&&(clearTimeout(s),s=null),l=p,o=e.apply(i,n),s||(i=n=null)):!s&&t.trailing!==!1&&(s=setTimeout(h,m)),o}}a(ch,"throttle");function hh(e){let r=e[0].map(t=>{let i=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?kr:0,x:t[3],y:t[4],shouldCollideWithScreenEdges:t[5]===1,bboxes:i,lockedToStrategyIndex:t[6]}});return{msgId:"-1",totalWidth:e[3],totalHeight:e[2],watermarkWidth:e[4],watermarkHeight:e[5],watermarkPosition:e[6],colliders:r,devicePixelRatio:e[1]}}a(hh,"unpackMessage");x();x();var hr=200,Oo=10;function ph(e,r,t,i,n,o,s="-1"){let l=1/0,h=1/0,p=-1/0,m=-1/0,f=new he(-Oo,0,5,t),v=new he(-Oo,0,r,5),y=new he(r-5,0,r+Oo,t),C=new he(0,t-5,r,t+Oo),M=df(r,t,i,n,o),g=[f,v,y,C],b=new he(-hr,-hr,r+hr*2,t+hr*2);for(let _ of e){let R,A;for(let k=0;k<_.bboxes.length;k++){if(_.bboxes[k]==null||(R=_.bboxes[k].boundingBox,A=_.bboxes[k].index,_.lockedToStrategyIndex!==-1&&A!==_.lockedToStrategyIndex))continue;let[F,G,O,X]=R,[Z,J,re,$]=[_.y-F,_.y+G,_.x-O,_.x+X],ve=re,ue=Z,le=$-re,ce=J-Z;l=Math.min(l,ve)-hr,h=Math.min(h,ue)-hr,p=Math.max(p,ve+le)+hr,m=Math.max(m,ue+ce)+hr,_.bboxes[k].boundingRect=new he(ve,ue,le,ce)}}let P={msgId:s,colliders:new Array(e.length),debug:[]},S=new ct(new he(l,h,p-l,m-h)),T;for(let _=0;_<e.length;_++)if(T=e[_],P.colliders[_]=[-1,0],T.enabledAndVisible){let[R,A,k]=[1/0,-1,void 0];for(let{index:F,boundingRect:G}of T.bboxes){if(G==null)continue;let O=[];if(O=S.queryRect(G).filter(Z=>G.intersects(Z)),T.shouldCollideWithScreenEdges&&g.forEach(Z=>{G.intersects(Z)&&O.push(Z)}),G.intersects(M)){P.colliders[_]=[-1,0,G];break}if(O.length<=R&&(k=G,A=F,R=O.length),O.length===0){S.insert(G),P.colliders[_]=[F,b.contains(G)?0:1,G];break}}T.rank===kr&&k!=null&&(S.insert(k),P.colliders[_]=[A,b.contains(k)?0:1,k])}else P.colliders[_]=[-1,0];return P}a(ph,"processColliders");function df(e,r,t,i,n){switch(n){case"top-right":return new he(e-t,0,t,i);case"bottom-left":return new he(0,r-i,t,i);case"bottom-right":return new he(e-t,r-i,t,i);case"top-left":return new he(0,0,t,i)}}a(df,"getWatermarkBoundary");var Ra=class Ra{constructor(){d(this,"onmessage",a(()=>{},"onmessage"));d(this,"postMessage",a(r=>{let t=hh(r);this.onmessage({data:ph(t.colliders,t.totalWidth,t.totalHeight,t.watermarkWidth,t.watermarkHeight,t.watermarkPosition,t.msgId)})},"postMessage"));d(this,"terminate",a(()=>{},"terminate"))}};a(Ra,"SyncWorker");var Lo=Ra;x();x();x();function Ao(e){"@babel/helpers - typeof";return Ao=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Ao(e)}a(Ao,"_typeof");var mf=/^\s+/,ff=/\s+$/;function Y(e,r){if(e=e||"",r=r||{},e instanceof Y)return e;if(!(this instanceof Y))return new Y(e,r);var t=yf(e);this._originalInput=e,this._r=t.r,this._g=t.g,this._b=t.b,this._a=t.a,this._roundA=Math.round(100*this._a)/100,this._format=r.format||t.format,this._gradientType=r.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=t.ok}a(Y,"tinycolor");Y.prototype={isDark:a(function(){return this.getBrightness()<128},"isDark"),isLight:a(function(){return!this.isDark()},"isLight"),isValid:a(function(){return this._ok},"isValid"),getOriginalInput:a(function(){return this._originalInput},"getOriginalInput"),getFormat:a(function(){return this._format},"getFormat"),getAlpha:a(function(){return this._a},"getAlpha"),getBrightness:a(function(){var r=this.toRgb();return(r.r*299+r.g*587+r.b*114)/1e3},"getBrightness"),getLuminance:a(function(){var r=this.toRgb(),t,i,n,o,s,l;return t=r.r/255,i=r.g/255,n=r.b/255,t<=.03928?o=t/12.92:o=Math.pow((t+.055)/1.055,2.4),i<=.03928?s=i/12.92:s=Math.pow((i+.055)/1.055,2.4),n<=.03928?l=n/12.92:l=Math.pow((n+.055)/1.055,2.4),.2126*o+.7152*s+.0722*l},"getLuminance"),setAlpha:a(function(r){return this._a=vh(r),this._roundA=Math.round(100*this._a)/100,this},"setAlpha"),toHsv:a(function(){var r=mh(this._r,this._g,this._b);return{h:r.h*360,s:r.s,v:r.v,a:this._a}},"toHsv"),toHsvString:a(function(){var r=mh(this._r,this._g,this._b),t=Math.round(r.h*360),i=Math.round(r.s*100),n=Math.round(r.v*100);return this._a==1?"hsv("+t+", "+i+"%, "+n+"%)":"hsva("+t+", "+i+"%, "+n+"%, "+this._roundA+")"},"toHsvString"),toHsl:a(function(){var r=dh(this._r,this._g,this._b);return{h:r.h*360,s:r.s,l:r.l,a:this._a}},"toHsl"),toHslString:a(function(){var r=dh(this._r,this._g,this._b),t=Math.round(r.h*360),i=Math.round(r.s*100),n=Math.round(r.l*100);return this._a==1?"hsl("+t+", "+i+"%, "+n+"%)":"hsla("+t+", "+i+"%, "+n+"%, "+this._roundA+")"},"toHslString"),toHex:a(function(r){return fh(this._r,this._g,this._b,r)},"toHex"),toHexString:a(function(r){return"#"+this.toHex(r)},"toHexString"),toHex8:a(function(r){return xf(this._r,this._g,this._b,this._a,r)},"toHex8"),toHex8String:a(function(r){return"#"+this.toHex8(r)},"toHex8String"),toRgb:a(function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},"toRgb"),toRgbString:a(function(){return this._a==1?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},"toRgbString"),toPercentageRgb:a(function(){return{r:Math.round(Ce(this._r,255)*100)+"%",g:Math.round(Ce(this._g,255)*100)+"%",b:Math.round(Ce(this._b,255)*100)+"%",a:this._a}},"toPercentageRgb"),toPercentageRgbString:a(function(){return this._a==1?"rgb("+Math.round(Ce(this._r,255)*100)+"%, "+Math.round(Ce(this._g,255)*100)+"%, "+Math.round(Ce(this._b,255)*100)+"%)":"rgba("+Math.round(Ce(this._r,255)*100)+"%, "+Math.round(Ce(this._g,255)*100)+"%, "+Math.round(Ce(this._b,255)*100)+"%, "+this._roundA+")"},"toPercentageRgbString"),toName:a(function(){return this._a===0?"transparent":this._a<1?!1:Lf[fh(this._r,this._g,this._b,!0)]||!1},"toName"),toFilter:a(function(r){var t="#"+yh(this._r,this._g,this._b,this._a),i=t,n=this._gradientType?"GradientType = 1, ":"";if(r){var o=Y(r);i="#"+yh(o._r,o._g,o._b,o._a)}return"progid:DXImageTransform.Microsoft.gradient("+n+"startColorstr="+t+",endColorstr="+i+")"},"toFilter"),toString:a(function(r){var t=!!r;r=r||this._format;var i=!1,n=this._a<1&&this._a>=0,o=!t&&n&&(r==="hex"||r==="hex6"||r==="hex3"||r==="hex4"||r==="hex8"||r==="name");return o?r==="name"&&this._a===0?this.toName():this.toRgbString():(r==="rgb"&&(i=this.toRgbString()),r==="prgb"&&(i=this.toPercentageRgbString()),(r==="hex"||r==="hex6")&&(i=this.toHexString()),r==="hex3"&&(i=this.toHexString(!0)),r==="hex4"&&(i=this.toHex8String(!0)),r==="hex8"&&(i=this.toHex8String()),r==="name"&&(i=this.toName()),r==="hsl"&&(i=this.toHslString()),r==="hsv"&&(i=this.toHsvString()),i||this.toHexString())},"toString"),clone:a(function(){return Y(this.toString())},"clone"),_applyModification:a(function(r,t){var i=r.apply(null,[this].concat([].slice.call(t)));return this._r=i._r,this._g=i._g,this._b=i._b,this.setAlpha(i._a),this},"_applyModification"),lighten:a(function(){return this._applyModification(Tf,arguments)},"lighten"),brighten:a(function(){return this._applyModification(Mf,arguments)},"brighten"),darken:a(function(){return this._applyModification(_f,arguments)},"darken"),desaturate:a(function(){return this._applyModification(Sf,arguments)},"desaturate"),saturate:a(function(){return this._applyModification(Cf,arguments)},"saturate"),greyscale:a(function(){return this._applyModification(Pf,arguments)},"greyscale"),spin:a(function(){return this._applyModification(wf,arguments)},"spin"),_applyCombination:a(function(r,t){return r.apply(null,[this].concat([].slice.call(t)))},"_applyCombination"),analogous:a(function(){return this._applyCombination(Df,arguments)},"analogous"),complement:a(function(){return this._applyCombination(If,arguments)},"complement"),monochromatic:a(function(){return this._applyCombination(Of,arguments)},"monochromatic"),splitcomplement:a(function(){return this._applyCombination(Ef,arguments)},"splitcomplement"),triad:a(function(){return this._applyCombination(gh,[3])},"triad"),tetrad:a(function(){return this._applyCombination(gh,[4])},"tetrad")};Y.fromRatio=function(e,r){if(Ao(e)=="object"){var t={};for(var i in e)e.hasOwnProperty(i)&&(i==="a"?t[i]=e[i]:t[i]=Ki(e[i]));e=t}return Y(e,r)};function yf(e){var r={r:0,g:0,b:0},t=1,i=null,n=null,o=null,s=!1,l=!1;return typeof e=="string"&&(e=Nf(e)),Ao(e)=="object"&&(Zt(e.r)&&Zt(e.g)&&Zt(e.b)?(r=gf(e.r,e.g,e.b),s=!0,l=String(e.r).substr(-1)==="%"?"prgb":"rgb"):Zt(e.h)&&Zt(e.s)&&Zt(e.v)?(i=Ki(e.s),n=Ki(e.v),r=vf(e.h,i,n),s=!0,l="hsv"):Zt(e.h)&&Zt(e.s)&&Zt(e.l)&&(i=Ki(e.s),o=Ki(e.l),r=bf(e.h,i,o),s=!0,l="hsl"),e.hasOwnProperty("a")&&(t=e.a)),t=vh(t),{ok:s,format:e.format||l,r:Math.min(255,Math.max(r.r,0)),g:Math.min(255,Math.max(r.g,0)),b:Math.min(255,Math.max(r.b,0)),a:t}}a(yf,"inputToRGB");function gf(e,r,t){return{r:Ce(e,255)*255,g:Ce(r,255)*255,b:Ce(t,255)*255}}a(gf,"rgbToRgb");function dh(e,r,t){e=Ce(e,255),r=Ce(r,255),t=Ce(t,255);var i=Math.max(e,r,t),n=Math.min(e,r,t),o,s,l=(i+n)/2;if(i==n)o=s=0;else{var h=i-n;switch(s=l>.5?h/(2-i-n):h/(i+n),i){case e:o=(r-t)/h+(r<t?6:0);break;case r:o=(t-e)/h+2;break;case t:o=(e-r)/h+4;break}o/=6}return{h:o,s,l}}a(dh,"rgbToHsl");function bf(e,r,t){var i,n,o;e=Ce(e,360),r=Ce(r,100),t=Ce(t,100);function s(p,m,f){return f<0&&(f+=1),f>1&&(f-=1),f<1/6?p+(m-p)*6*f:f<1/2?m:f<2/3?p+(m-p)*(2/3-f)*6:p}if(a(s,"hue2rgb"),r===0)i=n=o=t;else{var l=t<.5?t*(1+r):t+r-t*r,h=2*t-l;i=s(h,l,e+1/3),n=s(h,l,e),o=s(h,l,e-1/3)}return{r:i*255,g:n*255,b:o*255}}a(bf,"hslToRgb");function mh(e,r,t){e=Ce(e,255),r=Ce(r,255),t=Ce(t,255);var i=Math.max(e,r,t),n=Math.min(e,r,t),o,s,l=i,h=i-n;if(s=i===0?0:h/i,i==n)o=0;else{switch(i){case e:o=(r-t)/h+(r<t?6:0);break;case r:o=(t-e)/h+2;break;case t:o=(e-r)/h+4;break}o/=6}return{h:o,s,v:l}}a(mh,"rgbToHsv");function vf(e,r,t){e=Ce(e,360)*6,r=Ce(r,100),t=Ce(t,100);var i=Math.floor(e),n=e-i,o=t*(1-r),s=t*(1-n*r),l=t*(1-(1-n)*r),h=i%6,p=[t,s,o,o,l,t][h],m=[l,t,t,s,o,o][h],f=[o,o,l,t,t,s][h];return{r:p*255,g:m*255,b:f*255}}a(vf,"hsvToRgb");function fh(e,r,t,i){var n=[vt(Math.round(e).toString(16)),vt(Math.round(r).toString(16)),vt(Math.round(t).toString(16))];return i&&n[0].charAt(0)==n[0].charAt(1)&&n[1].charAt(0)==n[1].charAt(1)&&n[2].charAt(0)==n[2].charAt(1)?n[0].charAt(0)+n[1].charAt(0)+n[2].charAt(0):n.join("")}a(fh,"rgbToHex");function xf(e,r,t,i,n){var o=[vt(Math.round(e).toString(16)),vt(Math.round(r).toString(16)),vt(Math.round(t).toString(16)),vt(xh(i))];return n&&o[0].charAt(0)==o[0].charAt(1)&&o[1].charAt(0)==o[1].charAt(1)&&o[2].charAt(0)==o[2].charAt(1)&&o[3].charAt(0)==o[3].charAt(1)?o[0].charAt(0)+o[1].charAt(0)+o[2].charAt(0)+o[3].charAt(0):o.join("")}a(xf,"rgbaToHex");function yh(e,r,t,i){var n=[vt(xh(i)),vt(Math.round(e).toString(16)),vt(Math.round(r).toString(16)),vt(Math.round(t).toString(16))];return n.join("")}a(yh,"rgbaToArgbHex");Y.equals=function(e,r){return!e||!r?!1:Y(e).toRgbString()==Y(r).toRgbString()};Y.random=function(){return Y.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function Sf(e,r){r=r===0?0:r||10;var t=Y(e).toHsl();return t.s-=r/100,t.s=Ro(t.s),Y(t)}a(Sf,"_desaturate");function Cf(e,r){r=r===0?0:r||10;var t=Y(e).toHsl();return t.s+=r/100,t.s=Ro(t.s),Y(t)}a(Cf,"_saturate");function Pf(e){return Y(e).desaturate(100)}a(Pf,"_greyscale");function Tf(e,r){r=r===0?0:r||10;var t=Y(e).toHsl();return t.l+=r/100,t.l=Ro(t.l),Y(t)}a(Tf,"_lighten");function Mf(e,r){r=r===0?0:r||10;var t=Y(e).toRgb();return t.r=Math.max(0,Math.min(255,t.r-Math.round(255*-(r/100)))),t.g=Math.max(0,Math.min(255,t.g-Math.round(255*-(r/100)))),t.b=Math.max(0,Math.min(255,t.b-Math.round(255*-(r/100)))),Y(t)}a(Mf,"_brighten");function _f(e,r){r=r===0?0:r||10;var t=Y(e).toHsl();return t.l-=r/100,t.l=Ro(t.l),Y(t)}a(_f,"_darken");function wf(e,r){var t=Y(e).toHsl(),i=(t.h+r)%360;return t.h=i<0?360+i:i,Y(t)}a(wf,"_spin");function If(e){var r=Y(e).toHsl();return r.h=(r.h+180)%360,Y(r)}a(If,"_complement");function gh(e,r){if(isNaN(r)||r<=0)throw new Error("Argument to polyad must be a positive number");for(var t=Y(e).toHsl(),i=[Y(e)],n=360/r,o=1;o<r;o++)i.push(Y({h:(t.h+o*n)%360,s:t.s,l:t.l}));return i}a(gh,"polyad");function Ef(e){var r=Y(e).toHsl(),t=r.h;return[Y(e),Y({h:(t+72)%360,s:r.s,l:r.l}),Y({h:(t+216)%360,s:r.s,l:r.l})]}a(Ef,"_splitcomplement");function Df(e,r,t){r=r||6,t=t||30;var i=Y(e).toHsl(),n=360/t,o=[Y(e)];for(i.h=(i.h-(n*r>>1)+720)%360;--r;)i.h=(i.h+n)%360,o.push(Y(i));return o}a(Df,"_analogous");function Of(e,r){r=r||6;for(var t=Y(e).toHsv(),i=t.h,n=t.s,o=t.v,s=[],l=1/r;r--;)s.push(Y({h:i,s:n,v:o})),o=(o+l)%1;return s}a(Of,"_monochromatic");Y.mix=function(e,r,t){t=t===0?0:t||50;var i=Y(e).toRgb(),n=Y(r).toRgb(),o=t/100,s={r:(n.r-i.r)*o+i.r,g:(n.g-i.g)*o+i.g,b:(n.b-i.b)*o+i.b,a:(n.a-i.a)*o+i.a};return Y(s)};Y.readability=function(e,r){var t=Y(e),i=Y(r);return(Math.max(t.getLuminance(),i.getLuminance())+.05)/(Math.min(t.getLuminance(),i.getLuminance())+.05)};Y.isReadable=function(e,r,t){var i=Y.readability(e,r),n,o;switch(o=!1,n=Bf(t),n.level+n.size){case"AAsmall":case"AAAlarge":o=i>=4.5;break;case"AAlarge":o=i>=3;break;case"AAAsmall":o=i>=7;break}return o};Y.mostReadable=function(e,r,t){var i=null,n=0,o,s,l,h;t=t||{},s=t.includeFallbackColors,l=t.level,h=t.size;for(var p=0;p<r.length;p++)o=Y.readability(e,r[p]),o>n&&(n=o,i=Y(r[p]));return Y.isReadable(e,i,{level:l,size:h})||!s?i:(t.includeFallbackColors=!1,Y.mostReadable(e,["#fff","#000"],t))};var ka=Y.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"},Lf=Y.hexNames=Af(ka);function Af(e){var r={};for(var t in e)e.hasOwnProperty(t)&&(r[e[t]]=t);return r}a(Af,"flip");function vh(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}a(vh,"boundAlpha");function Ce(e,r){Rf(e)&&(e="100%");var t=kf(e);return e=Math.min(r,Math.max(0,parseFloat(e))),t&&(e=parseInt(e*r,10)/100),Math.abs(e-r)<1e-6?1:e%r/parseFloat(r)}a(Ce,"bound01");function Ro(e){return Math.min(1,Math.max(0,e))}a(Ro,"clamp01");function st(e){return parseInt(e,16)}a(st,"parseIntFromHex");function Rf(e){return typeof e=="string"&&e.indexOf(".")!=-1&&parseFloat(e)===1}a(Rf,"isOnePointZero");function kf(e){return typeof e=="string"&&e.indexOf("%")!=-1}a(kf,"isPercentage");function vt(e){return e.length==1?"0"+e:""+e}a(vt,"pad2");function Ki(e){return e<=1&&(e=e*100+"%"),e}a(Ki,"convertToPercentage");function xh(e){return Math.round(parseFloat(e)*255).toString(16)}a(xh,"convertDecimalToHex");function bh(e){return st(e)/255}a(bh,"convertHexToDecimal");var bt=function(){var e="[-\\+]?\\d+%?",r="[-\\+]?\\d*\\.\\d+%?",t="(?:"+r+")|(?:"+e+")",i="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?",n="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?";return{CSS_UNIT:new RegExp(t),rgb:new RegExp("rgb"+i),rgba:new RegExp("rgba"+n),hsl:new RegExp("hsl"+i),hsla:new RegExp("hsla"+n),hsv:new RegExp("hsv"+i),hsva:new RegExp("hsva"+n),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function Zt(e){return!!bt.CSS_UNIT.exec(e)}a(Zt,"isValidCSSUnit");function Nf(e){e=e.replace(mf,"").replace(ff,"").toLowerCase();var r=!1;if(ka[e])e=ka[e],r=!0;else if(e=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var t;return(t=bt.rgb.exec(e))?{r:t[1],g:t[2],b:t[3]}:(t=bt.rgba.exec(e))?{r:t[1],g:t[2],b:t[3],a:t[4]}:(t=bt.hsl.exec(e))?{h:t[1],s:t[2],l:t[3]}:(t=bt.hsla.exec(e))?{h:t[1],s:t[2],l:t[3],a:t[4]}:(t=bt.hsv.exec(e))?{h:t[1],s:t[2],v:t[3]}:(t=bt.hsva.exec(e))?{h:t[1],s:t[2],v:t[3],a:t[4]}:(t=bt.hex8.exec(e))?{r:st(t[1]),g:st(t[2]),b:st(t[3]),a:bh(t[4]),format:r?"name":"hex8"}:(t=bt.hex6.exec(e))?{r:st(t[1]),g:st(t[2]),b:st(t[3]),format:r?"name":"hex"}:(t=bt.hex4.exec(e))?{r:st(t[1]+""+t[1]),g:st(t[2]+""+t[2]),b:st(t[3]+""+t[3]),a:bh(t[4]+""+t[4]),format:r?"name":"hex8"}:(t=bt.hex3.exec(e))?{r:st(t[1]+""+t[1]),g:st(t[2]+""+t[2]),b:st(t[3]+""+t[3]),format:r?"name":"hex"}:!1}a(Nf,"stringInputToObject");function Bf(e){var r,t;return e=e||{level:"AA",size:"small"},r=(e.level||"AA").toUpperCase(),t=(e.size||"small").toLowerCase(),r!=="AA"&&r!=="AAA"&&(r="AA"),t!=="small"&&t!=="large"&&(t="small"),{level:r,size:t}}a(Bf,"validateWCAG2Parms");x();x();var Na=class Na{constructor(){d(this,"hover",!1);d(this,"dirty",!1)}};a(Na,"InteractionComponent");var fi=Na;x();var lp=ao($h());x();x();x();var Eg=a(e=>{let r=e[0];for(let t=1;t<e.length;t++){let i=e[t];if(i<=r)return!1;r=i}return!0},"isStrictlyIncreasing"),Dg=a(e=>{let r=e[0];for(let t=1;t<e.length;t++){let i=e[t];if(i>=r)return!1;r=i}return!0},"isStrictlyDecreasing"),Og=a(e=>Eg(e)||Dg(e),"isStrictlyIncreasingOrDecreasing"),Kh=Or.object({on:Or.literal("zoom-level"),input:Or.array(Or.number()).nonempty().refine(Og,{message:"input array must be strictly increasing or decreasing"}),output:Or.array(Or.number()).nonempty(),easing:Nc.default("linear")}).refine(e=>e.input.length===e.output.length,{message:"input and output must have the same length"});var Qh=w.object({margin:w.number().min(6).default(6),maxLines:w.number().min(1).default(2),textSize:w.number().min(0).default(11.5),maxWidth:w.number().min(0).default(150),lineHeight:w.number().min(0).default(1.2),color:w.string().default("#333"),outlineColor:w.string().default("white"),textColor:w.string().optional(),textOutlineColor:w.string().optional(),pinColor:w.string().optional(),pinOutlineColor:w.string().optional(),pinColorInactive:w.string().optional(),pinOutlineColorInactive:w.string().optional(),icon:w.string().optional(),iconSize:w.number().min(0).default(20),iconScale:w.union([w.number(),Kh]).default(1),iconPadding:w.number().min(0).default(2),iconFit:w.enum(["fill","contain","cover"]).default("cover"),iconOverflow:w.enum(["visible","hidden"]).default("hidden"),iconVisibleAtZoomLevel:w.number().default(-1/0)}),ep=Qh.transform(e=>{var r,t,i,n,o,s,l,h;return Ze(se({},e),{textColor:(r=e.textColor)!=null?r:e.color,textOutlineColor:(t=e.textOutlineColor)!=null?t:e.outlineColor,pinColor:(i=e.pinColor)!=null?i:e.color,pinOutlineColor:(n=e.pinOutlineColor)!=null?n:e.outlineColor,pinColorInactive:(s=e.pinColorInactive)!=null?s:Y((o=e.pinColor)!=null?o:e.color).setAlpha(.5).toRgbString(),pinOutlineColorInactive:(h=e.pinOutlineColorInactive)!=null?h:Y((l=e.pinOutlineColor)!=null?l:e.outlineColor).setAlpha(.5).toRgbString()})}),qT=Qh.strict(),tp=a(e=>ep.parse(e),"parseLabelAppearance"),Lg=w.object({rank:ah.optional(),appearance:ep.optional(),interactive:w.boolean().default(!1)}),Va=a(e=>{Lg.parse(e!=null?e:{})},"validateLabelOptions"),rp=a((e,r,t)=>{w.array(w.number()).min(2).max(3).parse(e),w.string().parse(r),Va(t)},"validateLabel"),ip=["color","outlineColor","margin"],Ag=[...ip,"maxLines","lineHeight","textSize","maxWidth","textColor","textOutlineColor"],Rg=[...ip,"icon","pinColor","pinOutlineColor","pinColorInactive","pinOutlineColorInactive"],np=a((e,r)=>Ag.some(t=>r[t]!=null&&e[t]!==r[t]),"isOneOfTextDirtyOptions"),op=a((e,r)=>Rg.some(t=>r[t]!=null&&e[t]!==r[t]),"isOneOfPinDirtyOptions");var Bg="LOW_PRIORITY",sp=4,Fg=6,ap=6.5,Gg={heightAbovePolygon:0},Fr=class Fr{constructor(r,t,i){d(this,"lines",0);d(this,"id");d(this,"rank");d(this,"type","label");d(this,"initialRank");d(this,"contextConfigured",!1);d(this,"fillText");d(this,"newStyle",{});d(this,"opacity",0);d(this,"visibilityNeedsUpdate",!1);d(this,"text");d(this,"style",{top:0,left:0,textLabelVisible:!0,pinVisibility:1,textAlign:"left"});d(this,"projection",new K);d(this,"labelCacheId");d(this,"_cache",{});d(this,"appearance");d(this,"options");d(this,"visible",!0);d(this,"enabled",!0);d(this,"isOccluded",!1);d(this,"offscreen",!1);d(this,"canShow",!1);d(this,"activeBoundingBox",{x:0,y:0,w:0,h:0});d(this,"dimensions",{width:0,height:0});d(this,"currentStrategyIndex",-1);d(this,"totalMarkerSize",0);d(this,"iconScale",1);d(this,"iconPadding");d(this,"dirty",!0);d(this,"textDirty",!0);d(this,"markerDirty",!0);d(this,"attachedDirty",!0);d(this,"collisionDirty",!0);d(this,"lastTextAlign");d(this,"imageHash");d(this,"markerSize",0);d(this,"iconVisible",!1);d(this,"dp");d(this,"animate",!0);d(this,"onStrategySelected",a(r=>{if(this.currentStrategyIndex===r)return;this.currentStrategyIndex=r;let t=this.strategies[this.currentStrategyIndex];if(t){t.onStrategySelected();let i=this.style;this.style=this.newStyle,this.newStyle=i}},"onStrategySelected"));d(this,"packedMessage",{x:0,y:0,enabled:!1,rank:0,bboxes:[],shouldCollideWithScreenEdges:!1,lockedToStrategyIndex:-1});var o,s;if(this.id=(o=t.id)!=null?o:wt(),this.options=(0,lp.default)({},t,Gg),this.text=r,this.dp=(l=1)=>l*i.pixelRatio,typeof t.rank=="string")this.rank=mi(t.rank),this.initialRank=this.rank;else if(t.rank!=null&&t.rank>0)this.rank=t.rank,this.initialRank=t.rank;else{let l=Math.trunc(D.env.NODE_ENV==="test"?Fr.testId:Fr.testId*10)/10;Fr.testId+=.001,this.rank=l,this.initialRank=l}let n=tp((s=t.appearance)!=null?s:{});this.appearance=n,this.iconPadding=n.iconPadding}get scaledMarkerSize(){return this.totalMarkerSize*this.iconScale}get scaledIconPadding(){return this.appearance.iconPadding*this.iconScale}setEntity(){}calculateMarkerSize(){let r=this.dp();this.iconVisible&&typeof this.appearance.iconSize<"u"&&this.imageHash?this.markerSize=this.dp(this.appearance.iconSize):this.markerSize=this.dp(ap),this.totalMarkerSize=Math.ceil((this.markerSize+2.5)/r)}get lowPriorityStrategyIndex(){return this.text===""?-1:3}get strategies(){let{width:r,height:t}=this.dimensions,{margin:i}=this.appearance,n=Math.max(Fg,i),o=this.iconVisible?n/2:0,s=this.iconVisible?this.scaledMarkerSize:ap/2,l=[{name:"RIGHT",getBoundingBox:a(()=>{let h=Math.max(this.scaledMarkerSize,t);return[h/2+n,h/2+n,this.scaledMarkerSize/2+n,this.scaledMarkerSize/2+r+n]},"getBoundingBox"),onStrategySelected:a(()=>{this.newStyle.textAlign="left",this.newStyle.pinVisibility=1,this.newStyle.top=-t/2,this.newStyle.left=this.scaledMarkerSize/2+sp,this.newStyle.textLabelVisible=!0},"onStrategySelected")},{name:"LEFT",getBoundingBox:a(()=>{let h=Math.max(this.scaledMarkerSize,t);return[h/2+n,h/2+n,this.scaledMarkerSize/2+r+n,this.scaledMarkerSize/2+n]},"getBoundingBox"),onStrategySelected:a(()=>{this.newStyle.textAlign="right",this.newStyle.pinVisibility=1,this.newStyle.top=-t/2,this.newStyle.left=-r-this.scaledMarkerSize/2-sp,this.newStyle.textLabelVisible=!0},"onStrategySelected")},{name:"TOP",getBoundingBox:a(()=>{let h=this.dp();return[t+this.scaledMarkerSize/2/h+n,this.scaledMarkerSize/2+n,r/2+n,r/2+n]},"getBoundingBox"),onStrategySelected:a(()=>{this.newStyle.pinVisibility=1,this.newStyle.textAlign="center",this.newStyle.textLabelVisible=!0,this.newStyle.top=-t-this.scaledMarkerSize/2,this.newStyle.left=-r/2},"onStrategySelected")},{name:Bg,getBoundingBox:a(()=>[s+o,s+o,s+o,s+o],"getBoundingBox"),onStrategySelected:a(()=>{this.newStyle.pinVisibility=.5,this.newStyle.textLabelVisible=!1,this.newStyle.top=0,this.newStyle.left=0},"onStrategySelected")}];return this.text===""?[{name:"ICON_ONLY",getBoundingBox:a(()=>[this.scaledMarkerSize/2+n,this.scaledMarkerSize/2+n,this.scaledMarkerSize/2+n,this.scaledMarkerSize/2+n],"getBoundingBox"),onStrategySelected:a(()=>{this.newStyle.pinVisibility=1,this.newStyle.textLabelVisible=!1,this.newStyle.top=0,this.newStyle.left=0},"onStrategySelected")}]:l}recomputeCurrentStrategy(r=this.iconScale){if(this.iconScale!==r||this.dirty){let t=this.strategies[this.currentStrategyIndex];if(this.iconScale=r,this.collisionDirty=!0,t){t.onStrategySelected(r);let i=this.style;this.style=this.newStyle,this.newStyle=i}this.dirty=!1}}updatePosition(){}disable(){this.visible=!1}toPackedMessage(r=!1){var t;if(this.visible&&r&&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!==((t=this.packedMessage.bboxes[0])==null?void 0:t[4])){let i=this.packedMessage.bboxes.findIndex(n=>n[4]===this.currentStrategyIndex);if(i!==-1){let n=this.packedMessage.bboxes.splice(i,1)[0];this.packedMessage.bboxes.unshift(n)}}if(!this.collisionDirty)return this.packedMessage;this.packedMessage.bboxes=[];for(let i=0;i<this.strategies.length;i++){let n=this.strategies[i];i===this.currentStrategyIndex&&this.currentStrategyIndex!==-1&&this.currentStrategyIndex!==this.lowPriorityStrategyIndex?this.packedMessage.bboxes.unshift([...n.getBoundingBox(),i]):this.packedMessage.bboxes.push([...n.getBoundingBox(),i])}return this.packedMessage.shouldCollideWithScreenEdges=!1,this.collisionDirty=!1,this.packedMessage}destroy(){}};a(Fr,"LabelComponent"),d(Fr,"testId",0);var qa=Fr,Et=qa;x();var Gp=ao(Bp());var cn=4,Lv=8,Av="0.6",Fp="low-priority-pin",al=w.object({rank:w.union([w.enum(["low","medium","high","always-visible"]),w.number()]).optional(),interactive:w.union([w.boolean(),w.literal("pointer-events-auto")]).optional(),id:w.string().optional(),placement:w.union([w.enum(["top","bottom","left","right","center","top-left","top-right","bottom-left","bottom-right"]),w.array(w.enum(["top","bottom","left","right","center","top-left","top-right","bottom-left","bottom-right"]))]).optional(),dynamicResize:w.boolean().optional(),zIndex:w.number().optional(),lowPriorityPin:w.object({enabled:w.boolean().optional(),size:w.number().positive().optional(),color:w.string().optional()}).optional()});function Xp(e,r,t){w.array(w.number()).min(2).max(3).parse(e),w.string().parse(r),al.parse(t)}a(Xp,"validateMarker");var Rv=Object.freeze({enabled:!0,size:Lv,color:"#666"}),Yr=class Yr{constructor(r,t={}){d(this,"id");d(this,"type","marker");d(this,"rank",0);d(this,"initialRank",0);d(this,"activePlacement","center");d(this,"pointerEvents","none");d(this,"options",{rank:"low",interactive:!1,id:"",placement:"center",dynamicResize:!1,occluderId:0,zIndex:void 0,verticalOffset:0,lowPriorityPin:se({},Rv)});d(this,"projection",new K);d(this,"enabled",!0);d(this,"canShow",!1);d(this,"visible",!0);d(this,"isOccluded",!1);d(this,"offscreen",!1);d(this,"strategyIndex",-1);d(this,"activeBoundingBox",{x:0,y:0,w:0,h:0});d(this,"dimensions",{width:0,height:0});d(this,"markerContainer");d(this,"containerEl");d(this,"contentEl",null);d(this,"contentHtml","");d(this,"style",{top:"0px",left:"0px"});d(this,"dirty",!1);d(this,"attachedDirty",!0);d(this,"collisionDirty",!0);d(this,"visibilityNeedsUpdate","show");d(this,"animation",null);d(this,"currentStrategyIndex",-1);d(this,"onStrategySelected",a((r,t=!1)=>{var n,o;if(this.currentStrategyIndex===r&&!t)return;if(this.currentStrategyIndex=r,r===this.lowPriorityPinStrategyIndex){this.activePlacement="center",this.markerContainer.setAttribute("data-placement",Fp);let s=this.options.lowPriorityPin,l=s.size,h=s.color;this.markerContainer.style.setProperty("--mappedin-pin-size","".concat(l,"px")),this.markerContainer.style.setProperty("--pin-color",h),this.markerContainer.style.opacity=Av,this.style.top=-l/2+"px",this.style.left=-l/2+"px"}else{this.activePlacement=(o=(n=this.strategies[r])==null?void 0:n.name)!=null?o:"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:s,height:l}=this.dimensions,h=-l/2+"px",p=-s/2+"px";switch(this.style.top=h,this.style.left=p,this.activePlacement){case"top":{this.style.top=-l+"px";break}case"bottom":{this.style.top="0px";break}case"left":{this.style.left=-s+"px";break}case"right":{this.style.left="0px";break}case"top-left":{this.style.top=-l+"px",this.style.left=-s+"px";break}case"top-right":{this.style.top=-l+"px",this.style.left="0px";break}case"bottom-left":{this.style.top="0px",this.style.left=-s+"px";break}case"bottom-right":{this.style.top="0px",this.style.left="0px";break}default:this.style.top=h,this.style.left=p}}this.markerContainer.style.top=this.style.top,this.markerContainer.style.left=this.style.left},"onStrategySelected"));d(this,"packedMessage",{x:0,y:0,enabled:!1,rank:0,bboxes:[],lockedToStrategyIndex:-1,shouldCollideWithScreenEdges:!1});var i,n,o;if(this.id=(t==null?void 0:t.id)||wt(),this.options=(0,Gp.default)(this.options,t),typeof t.rank=="string")this.rank=mi(t.rank);else if(t.rank!=null&&t.rank>0)this.rank=t.rank;else{let s=Math.trunc(D.env.NODE_ENV==="test"?Yr.testId:Yr.testId*10)/10;Yr.testId+=.001,this.rank=s}typeof t.interactive=="string"&&(this.pointerEvents=t.interactive==="pointer-events-auto"?"auto":"none"),this.contentHtml=r,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">'.concat(this.contentHtml,"</div>"),this.markerContainer.setAttribute("data-marker-id",this.id.toString()),this.containerEl=(i=this.markerContainer.firstElementChild)!=null?i:null,this.contentEl=(o=(n=this.markerContainer.firstElementChild)==null?void 0:n.firstElementChild)!=null?o:null}updateDimensions(r,t){if(r!=null&&t!=null)this.dimensions={width:r,height:t};else{let{width:i,height:n}=this.markerContainer.getBoundingClientRect();this.dimensions={width:i,height:n}}Object.assign(this.markerContainer,{width:this.dimensions.width+"px",height:this.dimensions.height+"px"}),this.currentStrategyIndex=-1}get strategies(){var o;let{width:r,height:t}=this.dimensions;if(r===0||t===0)return[];let n=(Array.isArray(this.options.placement)?this.options.placement:[this.options.placement]).map(s=>({name:s,getBoundingBox:a(()=>{let l=t/2,h=t/2,p=r/2,m=r/2;switch(s){case"top":{l=t,h=0;break}case"bottom":{l=0,h=t;break}case"left":{p=r,m=0;break}case"right":{p=0,m=r;break}case"top-left":{l=t,p=r,h=0,m=0;break}case"top-right":{l=t,m=r,h=0,p=0;break}case"bottom-left":{h=t,p=r,l=0,m=0;break}case"bottom-right":{h=t,m=r,l=0,p=0;break}}return[l+cn,h+cn,p+cn,m+cn]},"getBoundingBox")}));if((o=this.options.lowPriorityPin)!=null&&o.enabled&&this.options.rank!=="always-visible"){let s={name:Fp,getBoundingBox:a(()=>{let l=Math.max(2,cn/2);return[this.options.lowPriorityPin.size/2+l,this.options.lowPriorityPin.size/2+l,this.options.lowPriorityPin.size/2+l,this.options.lowPriorityPin.size/2+l]},"getBoundingBox")};n.push(s)}return n}toPackedMessage(r=!1){var i;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 t=this.currentStrategyIndex!==-1&&this.currentStrategyIndex!==this.lowPriorityPinStrategyIndex;if(this.visible&&r&&t&&this.collisionDirty===!1?this.packedMessage.lockedToStrategyIndex=this.currentStrategyIndex:this.packedMessage.lockedToStrategyIndex=-1,t&&this.currentStrategyIndex!==((i=this.packedMessage.bboxes[0])==null?void 0:i[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&&t?this.packedMessage.bboxes.unshift([...o.getBoundingBox(),n]):this.packedMessage.bboxes.push([...o.getBoundingBox(),n])}return this.collisionDirty=!1,this.packedMessage}get lowPriorityPinStrategyIndex(){var r;return!((r=this.options.lowPriorityPin)!=null&&r.enabled)||this.options.rank==="always-visible"?-1:Array.isArray(this.options.placement)?this.options.placement.length:1}destroy(){}};a(Yr,"MarkerComponent"),d(Yr,"testId",0);var Dt=Yr;x();x();x();var hl=class hl extends ie{constructor(t,i,n=!0){super();d(this,"rendererState");d(this,"convertTo3DMapPosition");d(this,"textSet",new Set);d(this,"batchedTextMap",new Map);d(this,"useWorker",!0);d(this,"debugTextAreaMesh",new Map);n===!1&&(this.useWorker=!1,Yp(!1)),this.rendererState=t,this.convertTo3DMapPosition=i}remove(t){this.textSet.delete(t)}update(t){var l,h,p;let i,n,o,s=[];for(let m of this.rendererState.geometry3DIdsInScene)if(i=this.rendererState.geometry3DMap.get(m),(i==null?void 0:i.type)==="text3d"){n=i.components[0],o=i.components[1];let f=(l=n.mesh)==null?void 0:l.parent;if(!f||!(f instanceof me)||!(n instanceof pr))continue;if("textArea"in n.feature.properties&&n.mesh!=null&&n.polygonEntityId!=null&&n.textMesh==null&&n.mesh.parent!=null&&((p=(h=n.feature.properties)==null?void 0:h.textArea)==null?void 0:p.position)!=null){if(this.textSet.has(n.polygonEntityId))continue;this.textSet.add(n.polygonEntityId),this.batchedTextMap.has(f)||this.batchedTextMap.set(f,pn().then(({BatchedText:C})=>{let M=new C;return M.type="batchedtext",f.add(M),M}));let y=this.batchedTextMap.get(f);if(!y)throw new Error("batched text required");s.push(zp({entityId:m,textComponent:n,styleComponent:o,convertTo3DMapPosition:this.convertTo3DMapPosition,batchedMeshPromise:y,rendererState:this.rendererState,type:"text-area"}).then(()=>{this.publish("render")}))}else if(n.mesh!=null&&n.textMesh==null&&n.mesh.parent!=null){if(this.textSet.has(m.toString()))continue;this.textSet.add(m.toString()),this.batchedTextMap.has(f)||this.batchedTextMap.set(f,pn().then(({BatchedText:C})=>{let M=new C;return M.type="batchedtext",f.add(M),M}));let y=this.batchedTextMap.get(f);if(!y)throw new Error("batched text required");s.push(zp({entityId:m,textComponent:n,styleComponent:o,convertTo3DMapPosition:this.convertTo3DMapPosition,batchedMeshPromise:y,rendererState:this.rendererState,type:"point"}).then(()=>{this.publish("render")}))}let v=this.batchedTextMap.get(f);n.textMesh&&v&&n.polygonEntityId!=null&&Promise.all([v,Promise.resolve({meshComponent:n,styleComponent:o})]).then(([y,{meshComponent:C,styleComponent:M}])=>{let{textMesh:g}=C;if(y&&g){let b=cl(y,g);C.visible&&!b?y.add(g):!C.visible&&b&&y.remove(g)}M.flipToFaceCamera&&this.flipIfNeeded(C,t)})}return Promise.all(s)}flipIfNeeded(t,i){let n=t.textMesh;if(!n)return!1;let o=n.rotation.z,s=Ia(o+i);s>Math.PI/2&&s<3*Math.PI/2&&(n.rotation.z=Ia(o+Math.PI))}showTextAreaMesh(){let t,i;for(let n of this.rendererState.geometry3DIdsInScene)if(t=this.rendererState.geometry3DMap.get(n),(t==null?void 0:t.type)==="text3d"&&(i=t.components[0],"textArea"in i.feature.properties)){let o=i.feature.properties.textArea;if(!o)continue;let s=new yt(o.maxWidth,o.maxHeight),l=new ae(s,new je({color:"pink"})),{textMesh:h}=i;if(!h)continue;let p=this.convertTo3DMapPosition(o.position,hn);l.position.copy(p),l.position.z=h.position.z-.1,l.rotation.z=h.rotation.z,ll.identity(),ll.makeRotationAxis(new z(0,0,1),h.userData.rotationZ),hn.set(o.maxWidth/2,0,0),hn.applyMatrix4(ll),l.position.x-=hn.x,l.position.y-=hn.y,this.rendererState.entityScene.add(l),this.debugTextAreaMesh.set(n,l)}this.publish("render")}hideTextAreaMesh(){this.debugTextAreaMesh.forEach(t=>{this.rendererState.entityScene.remove(t)}),this.debugTextAreaMesh.clear(),this.publish("render")}};a(hl,"Text3DSystem");var $o=hl;function Yp(e){pn().then(({configureTroikaTextBuilder:r})=>{r({useWorker:e})})}a(Yp,"configureWorker");var ll=new ot,hn=new z,ul;function pn(){return ul||(ul=import("./text3d-FS4EQ4SH.js").then(e=>e)),ul}a(pn,"getText3DService");async function zp({entityId:e,textComponent:r,styleComponent:t,convertTo3DMapPosition:i,batchedMeshPromise:n,rendererState:o,type:s="text-area"}){return Promise.all([pn(),Promise.resolve({entityId:e,meshComponent:r,styleComponent:t})]).then(([{createTroikaTextPoint:l,createTroikaTextArea:h},p])=>s==="text-area"?h(p.entityId,p.meshComponent,p.styleComponent,i):l(p.entityId,p.meshComponent,p.styleComponent,i)).catch(l=>{q.warn("Trouble creating text: ",l)}).then(l=>{if(!(l!=null&&l.text))return;let h=[Promise.resolve(l.text),n,Promise.resolve()];if(r.polygonEntityId){let p=o.geometry3DMap.get(r.polygonEntityId);if((p==null?void 0:p.type)==="geometry"){let m=p.components[0],f=p.components[1];m.textMesh=l.text,m.mesh!=null&&(l.text.position.z=f.altitude+f.height+kv)}}else h[2]=pn().then(({syncText:p})=>p(l.text));return Promise.all(h)}).then(l=>{if(!l)return;let[h,p]=l;p.add(h),r.batchedText||(r.batchedText=p)})}a(zp,"createText");function cl(e,r){return e._members.has(r)}a(cl,"doesBatchedTextContainsText");var kv=.5;var Nv=w.object({visible:w.boolean(),color:w.string(),flipToFaceCamera:w.boolean(),font:w.string().optional(),fontSize:w.number(),margin:w.union([w.number(),w.tuple([w.number(),w.number(),w.number(),w.number()])]),outlineColor:w.string(),outlineOpacity:w.number(),outlineBlur:w.union([w.number(),w.string()]),outlineWidth:w.number(),outlineOffsetX:w.number(),outlineOffsetY:w.number(),strokeWidth:w.number(),maxWidth:w.number().optional(),maxHeight:w.number().optional(),strokeOpacity:w.number(),strokeColor:w.string(),fillOpacity:w.number(),hoverColor:w.string().optional(),id:w.union([w.string(),w.number()]),type:w.literal("text3d"),position:w.tuple([w.number(),w.number(),w.number()]),content:w.string()}),Zp=Nv.partial().omit({id:!0,type:!0}).strict(),Up=Zp.omit({margin:!0,position:!0,maxWidth:!0,maxHeight:!0,content:!0}).strict(),Hp=w.object({appearance:Zp.optional(),parentId:w.string().optional()}).strict(),pl=class pl{constructor(r){d(this,"mesh",new gt);d(this,"textMesh");d(this,"type","text3d");d(this,"feature");d(this,"parent");d(this,"batchedText");d(this,"polygonEntityId");this.feature=r}get visible(){return this.batchedText&&this.textMesh?cl(this.batchedText,this.textMesh):this.textMesh?this.textMesh.visible:!1}set visible(r){this.batchedText&&this.textMesh?r?this.batchedText.addText(this.textMesh):this.batchedText.removeText(this.textMesh):this.textMesh&&(this.textMesh.visible=r),this.mesh.visible=r}};a(pl,"Text3DComponent");var pr=pl;x();var Ci,dl=class dl{constructor(r){d(this,"color");d(this,"dirty",!0);d(this,"enabled",!0);L(this,Ci,!1);d(this,"edgeColors");d(this,"edgeVisibility");d(this,"geometry");d(this,"ranges");d(this,"topFaceVerticesIndices");this.color=r}get currentOpacity(){return this.edgeColors&&this.ranges?this.edgeColors.array[this.ranges.start*4+3]:0}set visible(r){if(!this.edgeVisibility||!this.ranges||u(this,Ci)===r)return;B(this,Ci,r);let t=this.edgeVisibility.array,i=r?1:0;for(let n=0;n<this.ranges.count;n++){let o=this.ranges.start+n;t[o]=i}this.edgeVisibility.needsUpdate=!0}get visible(){return u(this,Ci)}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]}};Ci=new WeakMap,a(dl,"OutlineComponent");var Pi=dl;x();x();x();var ml=class ml extends vc{constructor(t){let i=t,n=3,o=n*4;super(new Uint8Array(t*o),n,t,co,uo);d(this,"_width");d(this,"_height");d(this,"_propertiesLength");this._width=o,this._height=i,this._propertiesLength=n}setColor(t,i,n){let o=this.image.data,s=t*this._width;o[s]=Math.round(i.r*255),o[s+1]=Math.round(i.g*255),o[s+2]=Math.round(i.b*255),o[s+3]=0,o[s+4]=Math.round(n.r*255),o[s+5]=Math.round(n.g*255),o[s+6]=Math.round(n.b*255),o[s+7]=0,this.needsUpdate=!0}getColor(t){let i=this.image.data,n=t*this._width,o=new ye(i[n]/255,i[n+1]/255,i[n+2]/255),s=new ye(i[n+4]/255,i[n+5]/255,i[n+6]/255);return{color:o,topColor:s}}setTexture(t,i,n){let o=this.image.data,s=t*this._width;o[s+8]=i?255:0,o[s+9]=n?255:0,o[s+10]=0,o[s+11]=0,this.needsUpdate=!0}getTexture(t){let i=this.image.data,n=t*this._width,o=i[n+8]===255,s=i[n+9]===255;return{texture:o,topTexture:s}}};a(ml,"BatchedPropertiesTexture");var Ko=ml;x();var Wp="#define LAMBERT\nvarying vec3 vViewPosition;\nvarying vec4 vPosition;\nvarying vec2 vUv;\nvarying vec4 finalPosition;\nvarying float vVerticalOffset;\nvarying vec3 worldNormal;\nvarying float vBatchId;\n\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n\nvoid main() {\n\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphinstance_vertex>\n #include <morphcolor_vertex>\n #include <batching_vertex>\n\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n\n vViewPosition = - mvPosition.xyz;\n\n #include <worldpos_vertex>\n #include <envmap_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n \n // To mitigate visual defects on machines such as windows and iOS\n vBatchId = getIndirectIndex(gl_DrawID) + 0.5;\n vViewPosition = - mvPosition.xyz;\n worldNormal = normal;\n vUv = uv;\n vVerticalOffset = position.z;\n}\n";x();var jp="#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nuniform float uGradientEnd;\nuniform float uGradientIntensity;\nuniform float uMinSideAlpha;\nuniform float uMaxSideAlpha;\nuniform float uGradientStart;\nuniform highp sampler2D uPropertiesTexture;\nuniform highp sampler2D uTopTexture;\nuniform highp sampler2D uTexture;\nuniform float uRepeatYFactor;\nuniform bool uBlendTexture;\nvarying float vBatchId;\n\nvarying vec2 vUv;\nvarying float vVerticalOffset;\nvarying vec3 worldNormal;\n\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_lambert_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\n\nvec3 blendTextureColor(vec3 diffuseColor, vec4 texColor) {\n vec3 texturedColor = diffuseColor * texColor.rgb;\n return mix(diffuseColor, texturedColor, texColor.a);\n}\n\nvoid main() {\n #include <clipping_planes_fragment>\n\n // get the normalized world normal of vertex fragment\n vec3 surfaceNormal = normalize(worldNormal);\n\n // get angle relative to Z up\n float angle = degrees(acos(abs(dot(surfaceNormal, vec3(0.0, 0.0, 1.0)))));\n\n int idx = int(vBatchId) * 1;\n vec3 diffuse = vec3(texelFetch(uPropertiesTexture, ivec2(0, idx), 0).rgb);\n bool shouldShowTexture = texelFetch(uPropertiesTexture, ivec2(2, idx), 0).r > 0.99;\n\n if(shouldShowTexture) {\n vec4 tex2d = texture2D(uTexture, vec2(vUv.x, vUv.y * uRepeatYFactor));\n diffuse = uBlendTexture ? blendTextureColor(diffuse, tex2d) : tex2d.rgb;\n }\n\n // if this is a fragment facing upwards, use topColor. Avoid any sort of '==' comparison, due to floating point precision issue\n if(angle < 0.02) {\n bool shouldShowTopTexture = texelFetch(uPropertiesTexture, ivec2(2, idx), 0).g > 0.99;\n\n if(shouldShowTopTexture) {\n vec4 topTex2d = texture2D(uTopTexture, vUv);\n diffuse = uBlendTexture ? blendTextureColor(diffuse, topTex2d) : topTex2d.rgb;\n } else {\n diffuse = vec3(texelFetch(uPropertiesTexture, ivec2(1, idx), 0).rgb);\n }\n }\n\n vec4 diffuseColor = vec4(diffuse, opacity);\n\n // only for vertical surfaces\n if(angle > 89.0 && angle < 91.0) {\n\n // get the percentage of the z position from the ground, up\n float percentFromZeroZ = max((abs(vVerticalOffset) - uGradientStart) / uGradientEnd, 0.0);\n\n // gradient based on percentage\n float alpha = smoothstep(uMinSideAlpha, uMaxSideAlpha, percentFromZeroZ);\n\n // mix the shadow color with the diffuse color based on the alpha and opacity\n diffuseColor = vec4(mix(diffuseColor.rgb, diffuseColor.rgb * (1.0 - uGradientIntensity), 1.0 - alpha), opacity);\n }\n\n ReflectedLight reflectedLight = ReflectedLight(vec3(0.0), vec3(0.0), vec3(0.0), vec3(0.0));\n vec3 totalEmissiveRadiance = emissive;\n\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <specularmap_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <emissivemap_fragment>\n\n // accumulation\n #include <lights_lambert_fragment>\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n\n // modulation\n #include <aomap_fragment>\n\n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\n #include <envmap_fragment>\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n\n}\n";var Bv=-.05,Fv=1,fl=class fl extends Er{constructor(t,i,n=1){super(t);d(this,"propertiesTexture");d(this,"uniforms",{uGradientIntensity:{value:0},uGradientEnd:{value:0},uGradientStart:{value:0},uTopTexture:{value:null},uTexture:{value:null},uRepeatYFactor:{value:1},uBlendTexture:{value:!1}});d(this,"colorSpace",wr);d(this,"showTextures",a(t=>{let i=!!this.uniforms.uTexture.value,n=!!this.uniforms.uTopTexture.value;(i||n)&&(this.propertiesTexture.setTexture(t,i,n),this.needsUpdate=!0)},"showTextures"));this.propertiesTexture=new Ko(i),this.uniforms.uRepeatYFactor.value=n,this.onBeforeCompile=o=>{let s=this.uniforms.uGradientIntensity,l=this.uniforms.uGradientEnd,h=this.uniforms.uGradientStart,p=this.uniforms.uTopTexture,m=this.uniforms.uTexture,f=this.uniforms.uRepeatYFactor,v=this.uniforms.uBlendTexture;this.uniforms=o.uniforms,o.vertexShader=Wp,o.fragmentShader=jp,Object.assign(this.uniforms,{uGradientIntensity:s,uGradientEnd:l,uGradientStart:h,uMinSideAlpha:{value:Bv},uMaxSideAlpha:{value:Fv},uPropertiesTexture:{value:this.propertiesTexture},uTopTexture:p,uTexture:m,uRepeatYFactor:f,uBlendTexture:v})}}get repeatYFactor(){return this.uniforms.uRepeatYFactor.value}set repeatYFactor(t){t!==this.uniforms.uRepeatYFactor.value&&(this.uniforms.uRepeatYFactor.value=t,this.needsUpdate=!0)}get texture(){return this.uniforms.uTexture.value}set texture(t){t.wrapS=Tt,t.wrapT=Tt,t.colorSpace=this.colorSpace,this.uniforms.uTexture.value=t}get topTexture(){return this.uniforms.uTopTexture.value}set topTexture(t){t.wrapS=Tt,t.wrapT=Tt,t.colorSpace=this.colorSpace,this.uniforms.uTopTexture.value=t}get blendTexture(){return this.uniforms.uBlendTexture.value}set blendTexture(t){t!==this.uniforms.uBlendTexture.value&&(this.uniforms.uBlendTexture.value=t,this.colorSpace=t?cc:wr,this.texture&&(this.texture.colorSpace=this.colorSpace),this.topTexture&&(this.topTexture.colorSpace=this.colorSpace),this.needsUpdate=!0)}setGradientShading(t,i,n){this.uniforms.uGradientStart.value=t,this.uniforms.uGradientEnd.value=i,this.uniforms.uGradientIntensity.value=n}getGradientShading(){return{start:this.uniforms.uGradientStart.value,end:this.uniforms.uGradientEnd.value,intensity:this.uniforms.uGradientIntensity.value}}setColor(t,i,n){this.propertiesTexture.setColor(t,i,n)}getColor(t){return this.propertiesTexture.getColor(t)}hideTextures(t){let i=!!this.uniforms.uTexture.value,n=!!this.uniforms.uTopTexture.value;(i||n)&&(this.propertiesTexture.setTexture(t,!1,!1),this.needsUpdate=!0)}removeSideTexture(t){if(this.texture){this.texture.dispose(),this.uniforms.uTexture.value=null;let i=!!this.uniforms.uTopTexture.value;this.propertiesTexture.setTexture(t,!1,i),this.needsUpdate=!0}}removeTopTexture(t){if(this.topTexture){this.topTexture.dispose(),this.uniforms.uTopTexture.value=null;let i=!!this.uniforms.uTexture.value;this.propertiesTexture.setTexture(t,i,!1),this.needsUpdate=!0}}dispose(){super.dispose(),this.propertiesTexture.dispose()}};a(fl,"BatchedStandardMaterial");var Zr=fl;x();function Vp(e,r){var p,m,f;let t=0;for(let v of e)t+=((m=(p=v.components[0])==null?void 0:p.geometry)==null?void 0:m.attributes.position.count)||0;let i=new ye(r.color),n;n=new Zr({color:i,side:r.side==="back"?ji:r.side==="front"?_r:ft,opacity:(f=r.opacity)!=null?f:1,transparent:r.opacity!==void 0?r.opacity<1:!1,polygonOffset:!0,polygonOffsetFactor:1,polygonOffsetUnits:1},e.length);let o=new Co(e.length,t,0,n);o.renderOrder=0;let s,l,h;for(let v of e)s=v.components[0],!(!(s instanceof Me)||!s.geometry)&&(s.mesh=o,s.material=n,s.instanceIndex=o.addGeometry(s.geometry),o.addInstance(s.instanceIndex),o.userData.entities[s.instanceIndex]=v.id,n instanceof Zr&&n.setColor(s.instanceIndex,i,r.topColor?new ye(r.topColor):i),l=o.getGeometryIdAt(s.instanceIndex),s.batchedProps&&(h=o.getGeometryRangeAt(l),h&&(s.batchedProps.range=h),s.batchedProps.geometryId=l));return o.perObjectFrustumCulled=!0,o.matrixAutoUpdate=!1,o}a(Vp,"batchGeometries");function dn(e){return Y(e).darken(30).toRgbString()}a(dn,"darkenColorForOutline");function qp(e,r,t,i){if(r.length<1)return;e.boundingBox||e.computeBoundingBox();let n=e.boundingBox,o=e.getAttribute("position"),s=e.getAttribute("normal"),l=e.getAttribute("uv"),h,p;e.index?(h=e.index.count/3,p=a(function(S,T){return e.index.getX(S*3+T)},"meshIndex")):(h=o.count/3,p=a(function(S,T){return S*3+T},"meshIndex"));let m=new ot;m.makeRotationFromQuaternion(new Ir().setFromEuler(new Xt(0,0,t/180*Math.PI)));let f=r.find(S=>S.face==="top"),v;f&&(v={min:i(f.bounds[1],f.bounds[0],0),max:i(f.bounds[3],f.bounds[2],n.max.z)});let y=r.find(S=>S.face==="side"),C;if(y&&(C={min:i(y.bounds[1],y.bounds[0],0),max:i(y.bounds[3],y.bounds[2],n.max.z)}),!(!C&&!v))for(let S=0;S<h;++S){let T=s.getX(p(S,0))+s.getX(p(S,1))+s.getX(p(S,2)),_=s.getY(p(S,0))+s.getY(p(S,1))+s.getY(p(S,2)),R=s.getZ(p(S,0))+s.getZ(p(S,1))+s.getZ(p(S,2)),A=Math.abs(T),k=Math.abs(_),F=Math.abs(R);var M,g;A<=k&&A<=F?(M="x",k<=F?g="y":g="z"):k<=A&&k<=F?(M="y",A<=F?g="x":g="z"):(M="z",A<=k?g="x":g="y"),M==="z"&&(M=g,g="z");let G,O,X,Z,J,re;if(g==="z"||M==="z"){if(!y||!C)continue;G=y.repeat.u,O=y.repeat.v,X=y.offset.u,Z=y.offset.v,J=y.rotation,re=C}else{if(!f||!v)continue;G=f.repeat.u,O=f.repeat.v,X=f.offset.u,Z=f.offset.v,J=(360-t+f.rotation)%360,re=v}let{min:$,max:ve}=re,ue=new zt;ue.position.set($.x,$.y,0),ue.updateMatrix(),ue.updateMatrixWorld();let le=$.clone().applyMatrix4(m),ce=ve.clone().applyMatrix4(m),ze=Math.abs(ce.x-le.x),Ie=Math.abs(ce.y-le.y),Le=new z(ze,Ie,ve.z).applyMatrix4(ue.matrixWorld),De=Math.abs(Le[M]-$[M]),xe=Math.abs(Le[g]-$[g]),qe=J*Math.PI/180||0,We=Math.cos(qe),at=Math.sin(qe),er=ue.matrixWorld.clone().invert(),nt=new Ir().setFromEuler(new Xt(0,0,t/180*Math.PI));for(let H=0;H<3;H++){let Se=new z(o.getX(p(S,H)),o.getY(p(S,H)),o.getZ(p(S,H))).applyMatrix4(er);Se.applyQuaternion(nt);let Je=Se.applyMatrix4(ue.matrixWorld),Ye=Je.x,Pt=Je.y,Gt=Je.z;var b,P;M==="x"?b=G*(Ye-$[M])/De+X:M==="y"?b=G*(Pt-$[M])/De+X:b=G*(Gt-$[M])/De+X,g==="x"?P=O*(Ye-$[g])/xe+Z:g==="y"?P=O*(Pt-$[g])/xe+Z:P=O*(Gt-$[g])/xe+Z,b-=.5,P-=.5;let Hi=b*We-P*at+.5,Wi=b*at+P*We+.5;l.setX(p(S,H),Hi),l.setY(p(S,H),Wi)}}}a(qp,"updateUVsLegacy");x();var yl=class yl{constructor(){d(this,"focusMesh");d(this,"dirty",!0)}};a(yl,"FocusableComponent");var qt=yl;function Fe(e,r,t){if(r!==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 r===!0?(e instanceof Ar&&e.components[1]===void 0?(e.components[1]=new fi,e.components[1].dirty=!0):e instanceof ne&&e.components[2]===void 0?(e.components[2]=new fi,e.components[2].dirty=!0):e instanceof me&&e.components[0]===void 0&&(e.components[0]=new fi,e.components[0].dirty=!0),!0):(e instanceof Ar?e.components[1]=void 0:e instanceof ne?e.components[2]=void 0:e instanceof me&&(e.components[0]=void 0),!0);if(e.type==="geometry-group"){let i;for(let n of e.userData.entities3D.values())i=t.geometry3DMap.get(n),Fe(i,r,t);return!0}}return!1}a(Fe,"updateInteractivity");function Jp(e,r,t){if(!(!(t!=null&&t.color)&&!("topColor"in t))){if(t!==void 0&&e.type==="geometry-group"){let i;for(let n of e.userData.entities3D.values())i=r.geometry3DMap.get(n),i&&es(i,t);return!0}return!1}}a(Jp,"updateGroupColor");function Yv(e,r){r!==void 0&&e.type==="geometry"&&(e.components[1].shading=r,e.components[1].dirty=!0)}a(Yv,"updateShading");function $p(e,r,t){if(t!==void 0&&e.type==="geometry-group"){for(let i of e.userData.entities3D.values()){let n=r.geometry3DMap.get(i);n&&Yv(n,t)}return!0}return!1}a($p,"updateGroupShading");function Kp(e,r){r!==void 0&&e.type==="geometry"&&(r.showImage!==void 0&&(e.components[1].showImage=r.showImage),r.flipImageToFaceCamera!==void 0&&(e.components[1].flipImageToFaceCamera=r.flipImageToFaceCamera))}a(Kp,"updateImageProps");function Qo(e,r,t){if(t!==void 0){if(e.type==="geometry"){let i=e.components[1];if(i.height!==t)return i.height=t,i.dirty=!0,e.components[3]&&(e.components[3].dirty=!0),!0}else if(e.type==="geometry-group"){for(let i of e.userData.entities3D.values()){let n=r.geometry3DMap.get(i);((n==null?void 0:n.type)==="geometry"||(n==null?void 0:n.type)==="model")&&Qo(n,r,t)}return!0}}return!1}a(Qo,"updateHeight");function es(e,r){if(r!==void 0){let t=!1;(e.type==="path"||e.type==="geometry")&&(r.initialColor!==void 0&&r.initialColor!==e.components[1].initialColor&&(e.components[1].initialColor=r.initialColor,t=!0),r.color!==void 0&&r.color!==e.components[1].color&&(e.components[1].color=r.color,t=!0,e.components[3]&&(e.components[3].color=dn(r.color),e.components[3].dirty=!0)),"topColor"in r&&(e.components[1].topColor=r.topColor,t=!0),t&&(e.components[1].dirty=!0))}}a(es,"updateColor");function bl(e,r,t){r!==void 0&&(e.type==="label"||e.type==="marker"?e.updatePosition(t(r[1],r[0],r[2]||0)):e.type==="custom-geometry"&&e.components[0].position.copy(t(r[1],r[0],r[2]||0)))}a(bl,"updatePosition");function vl(e,r){var t;return r!==void 0&&(e.type==="marker"||e.type==="label"||e.type==="custom-geometry")&&e.parentObject3D!==r&&e.parentObject3D instanceof me?((t=e.parentObject3D)==null||t.removeEntity(e),r.addEntity(e),!0):!1}a(vl,"updateParent");function Qp(e,r){r!==void 0&&(e.type==="marker"||e.type==="label")&&e.components[0].enabled!==r&&(e.components[0].enabled=r)}a(Qp,"updateEnabled");function ed(e,r,t){if(r!==void 0&&e.type==="marker"){let i=e.components[0];if(r.contentHTML!==void 0)return i.containerEl.innerHTML=r.contentHTML,i.contentHtml=r.contentHTML,!0;if(r.placement!==void 0&&(i.options.placement=r.placement,i.collisionDirty=!0),r.dynamicResize!==void 0)return i.options.dynamicResize=r.dynamicResize,!0;if(r.options!=null){try{al.parse(r.options||{})}catch(n){return q.error(n),!1}return r.options.interactive!=null&&(r.options.interactive==="pointer-events-auto"?(i.pointerEvents="auto",Fe(e,!1,t)):(i.pointerEvents="none",Fe(e,r.options.interactive,t))),td(e,r.options.rank),!0}}return!1}a(ed,"updateMarker");function td(e,r){return r!==void 0&&(e.type==="marker"||e.type==="label")?(e.components[0].rank=mi(r),!0):!1}a(td,"updateRank");function rd(e,r,t){var i,n,o,s,l,h;if(r!==void 0&&e.type==="label"){let p=e.components[0];r.text!==void 0&&r.text!==p.text&&(p.text=r.text,p.textDirty=!0);try{Va((i=r.options)!=null?i:{})}catch(m){q.error(m);return}np(p.appearance,((n=r.options)==null?void 0:n.appearance)||{})&&(p.textDirty=!0),op(p.appearance,((o=r.options)==null?void 0:o.appearance)||{})&&(p.markerDirty=!0),qc(p.appearance,((s=r.options)==null?void 0:s.appearance)||{}),Fe(e,(l=r.options)==null?void 0:l.interactive,t),td(e,(h=r.options)==null?void 0:h.rank)}}a(rd,"updateLabel");function id(e,r){r!==void 0&&e.type==="geometry"&&(e.components[1].hoverColor=r,e.components[1].dirty=!0)}a(id,"updateHoverColor");function nd(e,r){if(r!==void 0){let t=e.components[2];if(e.type==="geometry"&&t!=null)return t.hover=r,t.dirty=!0,!0}return!1}a(nd,"updateHovered");function xl(e,r){r!==void 0&&e.type==="image"&&(e.components[1].flipImageToFaceCamera=r)}a(xl,"updateFlipImageToFaceCamera");function Lt(e,r,t){if(t!==void 0)if(e.type==="model"||e.type==="path"||e.type==="geometry"||e.type==="custom-geometry"||e.type==="image"||e.type==="text3d"){t!==e.components[1].visible&&(e.components[1].visible=t,e.components[1].dirty=!0);let i=e.components[3];return i&&(i.dirty=!0),!0}else{if(e.type==="geometry-group")return e.setVisible(t),!0;if(e.type==="group-container"){if(e.visible!==t)return e.setVisible(t),t===!1&&e.traverse(i=>{if(i instanceof Yc){let n=r.geometry2DMap.get(i.userData.entityId);if(n){let o=n.components[0];o instanceof Et&&(o.canShow=t)}}}),!0}else if(e.type==="label")return e.components[0].visible=t,!0}return!1}a(Lt,"updateVisibility");function mn(e,r,t){if(t!==void 0)if(e.type==="geometry-group"){for(let i of e.userData.entities3D.values()){let n=r.geometry3DMap.get(i);((n==null?void 0:n.type)==="geometry"||(n==null?void 0:n.type)==="model")&&mn(n,r,t)}return!0}else if(e.type==="group-container"){if(e.opacity!==t){e.setOpacity(t);let i=1;return e.parent instanceof me&&(i=e.parent.opacity),od(e,r,i),!0}}else e instanceof ne&&e.components[1].opacity!==t&&(e.components[1].opacity=t,e.components[1].dirty=!0);return!1}a(mn,"updateOpacity");function od(e,r,t=1){if(e.type==="group-container"&&"children"in e&&e.children.length>0){let i=t*e.opacity;e.userData.computedOpacity=i;for(let n of e.children)(n instanceof lt&&n.type==="geometry-group"||n instanceof me&&n.type==="group-container")&&od(n,r,i)}else if(e.type==="geometry-group")for(let i of e.userData.entities3D.values()){let n=r.geometry3DMap.get(i),o;((n==null?void 0:n.type)==="geometry"||(n==null?void 0:n.type)==="model")&&(o=n.components[1],o.dirty=!0)}}a(od,"cascadeOpacity");function sd(e,r,t){if(t!==void 0&&e.type==="geometry-group")for(let i of e.userData.entities3D.values()){let n=r.geometry3DMap.get(i);n&&Sl(n,t)}}a(sd,"updateGroupTexture");function Sl(e,r){if(e.type==="geometry"){let t=!1,i=e.components[1];if((r==null?void 0:r.texture)!=null&&i.texture!==(r==null?void 0:r.texture)&&(i.texture=r.texture,t=!0),(r==null?void 0:r.topTexture)!=null&&i.topTexture!==(r==null?void 0:r.topTexture)&&(i.topTexture=r.topTexture,t=!0),t&&e.components[0]instanceof Me){let n=e.components[0];return n.detached===!1&&(n.detached=!0,n.dirty=!0),e.components[1].dirty=!0,!0}}return!1}a(Sl,"updateIndividualGeometryTexture");function ad(e,r){if(r!==void 0&&e.type==="geometry"){let t=e.components[1];if(t.opacity!==r){t.opacity=r;let i=e.components[0],n=e.components[3];n&&(n.dirty=!0),i.detached===!1&&(i.detached=!0,i.dirty=!0),t.dirty=!0;let o=e.parentObject3D;return(o==null?void 0:o.type)==="geometry-group"&&(o.userData.shadingDirty=!0),!0}}return!1}a(ad,"updateIndividualGeometryOpacity");function Ti(e,r){if(r!==void 0)if(e.type==="geometry"||e.type==="path"||e.type==="custom-geometry"){let t=e.components[1];if(t.altitude!==r)return t.altitude=r,t.dirty=!0,e.components[3]&&(e.components[3].dirty=!0),!0}else{if(e.type==="group-container"&&e.altitude!==r)return e.setAltitude(r),!0;if(e.type==="geometry-group"&&e.altitude!==r)return e.setAltitude(r),!0}return!1}a(Ti,"updateAltitude");function ts(e,r,t){if(t!==void 0){if(e.type==="geometry-group")for(let i of e.userData.entities3D.values()){let n=r.geometry3DMap.get(i);n instanceof ne&&ts(n,r,t)}else if(e.type==="geometry"){let i=e.components[3],n=e.components[1];!i&&t===!0?e.components[3]=new Pi(dn(n.color)):i&&(i.enabled=t,i.dirty=!0)}return!0}return!1}a(ts,"updateOutline");function rs(e,r){if(r!==void 0){let t,i=4;if(e.type==="geometry"?(t=e.components[4],i=4):e.type==="group-container"&&(t=e.components[1],i=1),r===!0&&t==null)return e.components[i]=new qt,!0;if(r===!1&&t!=null)return e.components[i]=void 0,!0}return!1}a(rs,"updateFocusable");function ld(e,r){if(r!==void 0&&e.type==="geometry"){let t=e.components[1];if(t.renderOrder!==r){t.renderOrder=r;let i=e.components[0];return i.detached===!1&&(i.detached=!0,i.dirty=!0),i.imageMesh&&(i.imageMesh.renderOrder=r+1),t.dirty=!0,!0}}return!1}a(ld,"updateIndividualGeometryRenderOrder");function is(e,r,t){if(t!=null){if(e.type==="geometry"){let i=e.components[1];i.side!==t&&(i.side=t,i.dirty=!0)}else if(e.type==="geometry-group")for(let i of e.userData.entities3D.values()){let n=r.geometry3DMap.get(i);n instanceof ne&&is(n,r,t)}}}a(is,"updateSide");function ud(e,r,t){let{visible:i,color:n}=t;if(e.type!=="path")return;let o=e.components[0];i!=null&&Lt(e,r,i),n!=null&&es(e,{color:n}),Object.assign(o,Cl(t)),Wc(t)||(o.materialDirty=!0,t.width!=null&&(o.dirty=!0))}a(ud,"handlePathUpdate");function Cl(e){return Mo(e,Zv)}a(Cl,"pickPathOptions");var Zv=["animateArrowsOnPath","displayArrowsOnPath","width","accentColor","completeFraction","dashed","visibleThroughGeometry"];function cd(e){if(!(e instanceof ne&&e.type==="text3d"))throw new Error("expect target is TextGeometry3D")}a(cd,"assetGeometryIsText3D");var hd=["visible","color","strokeWidth","outlineOffsetX","outlineOffsetY","outlineWidth","outlineBlur","outlineOpacity","outlineColor","strokeWidth","strokeColor","strokeOpacity","maxWidth","maxHeight","font","hoverColor","fillOpacity","fontSize","flipToFaceCamera"];function pd(e,r,t){Lt(e,r,t.visible);let i=e.components[1],n=Mo(t,hd);"margin"in t&&q.warn("update to margin is not supported atm"),"content"in t&&q.warn("content update is not supported atm");try{Up.parse(n)}catch(o){q.error(o);return}Object.keys(n).length>0&&(Object.assign(i,n),i.dirty=!0)}a(pd,"handleText3DUpdate");var Uv=["color","material","opacity","verticalOffset","rotation","position","scale"];function dd(e,r){let t=Mo(r,Uv),i=e.components[1],n=e.components[0];Object.keys(t).length>0&&(t.material&&(i.material=t.material),t.opacity!=null&&(i.opacity=t.opacity),t.visible!=null&&(i.visible=t.visible),t.verticalOffset!=null&&(i.verticalOffset=t.verticalOffset),t.color!=null&&(i.color=t.color),t.position!=null&&(n.feature.geometry.coordinates=t.position,n.positionDirty=!0),t.rotation!=null&&(i.rotation=t.rotation),t.scale!=null&&(i.scale=t.scale),i.dirty=!0)}a(dd,"handleModelStyleUpdate");x();x();x();x();x();x();x();x();x();x();function Pl(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")}a(Pl,"getCoord");function Ur(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")}a(Ur,"getCoords");function Mi(e){return e.type==="Feature"?e.geometry:e}a(Mi,"getGeom");function dr(e,r,t){if(t===void 0&&(t={}),!e)throw new Error("point is required");if(!r)throw new Error("polygon is required");var i=Pl(e),n=Mi(r),o=n.type,s=r.bbox,l=n.coordinates;if(s&&Hv(i,s)===!1)return!1;o==="Polygon"&&(l=[l]);for(var h=!1,p=0;p<l.length&&!h;p++)if(md(i,l[p][0],t.ignoreBoundary)){for(var m=!1,f=1;f<l[p].length&&!m;)md(i,l[p][f],!t.ignoreBoundary)&&(m=!0),f++;m||(h=!0)}return h}a(dr,"booleanPointInPolygon");function md(e,r,t){var i=!1;r[0][0]===r[r.length-1][0]&&r[0][1]===r[r.length-1][1]&&(r=r.slice(0,r.length-1));for(var n=0,o=r.length-1;n<r.length;o=n++){var s=r[n][0],l=r[n][1],h=r[o][0],p=r[o][1],m=e[1]*(s-h)+l*(h-e[0])+p*(e[0]-s)===0&&(s-e[0])*(h-e[0])<=0&&(l-e[1])*(p-e[1])<=0;if(m)return!t;var f=l>e[1]!=p>e[1]&&e[0]<(h-s)*(e[1]-l)/(p-l)+s;f&&(i=!i)}return i}a(md,"inRing");function Hv(e,r){return r[0]<=e[0]&&r[1]<=e[1]&&r[2]>=e[0]&&r[3]>=e[1]}a(Hv,"inBBox");x();x();x();x();x();x();x();x();x();var Tl="\xA9 Mappedin",qv="https://info.mappedin.com/feedback",_l=["top-left","top-right","bottom-left","bottom-right"],Jv=640,$v=a(()=>"<svg xmlns='http://www.w3.org/2000/svg' width='15' height='15' fill-rule='evenodd' viewBox='0 0 20 20'>\n <circle cx='10' cy='10' r='5.9' style='fill:rgba(255,255,255,1);'/>\n <path style='fill:rgba(0,0,0,0.7);' d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/>\n </svg>","getAttributionButtonIcon"),Ml={custom:[],position:"bottom-right",feedback:!0},_i,wl=class wl{constructor(r,t={}){d(this,"controlContainerEl");d(this,"controlPositions");d(this,"compact");L(this,_i);d(this,"attribContainerEl");d(this,"attribInnerEl");d(this,"attribButtonEl");d(this,"feedbackLinkEl");d(this,"attribHTML",Tl);d(this,"customAttributions",[]);d(this,"toggleAttribution",a(r=>{this.attribContainerEl!=null&&(r.preventDefault(),this.attribContainerEl.classList.contains("mappedin-compact")&&(this.attribContainerEl.classList.contains("mappedin-compact-show")?(this.attribContainerEl.removeAttribute("open"),this.attribContainerEl.classList.remove("mappedin-compact-show")):(this.attribContainerEl.classList.add("mappedin-compact-show"),this.attribContainerEl.setAttribute("open",""))))},"toggleAttribution"));B(this,_i,!!t.outdoorEnabled),this.controlContainerEl=document.createElement("div"),this.controlContainerEl.classList.add("mappedin-control-container"),r.appendChild(this.controlContainerEl),this.controlPositions=_l.reduce((i,n)=>{let o=document.createElement("div");return o.classList.add("mappedin-ctrl-".concat(n)),this.controlContainerEl.appendChild(o),i[n]=o,i},{})}addAttributionControl(r=Ml){var n;let t=r.position&&_l.includes(r.position)?r.position:Ml.position;this.attribContainerEl=document.createElement("details"),this.attribContainerEl.classList.add("mappedin-ctrl-attrib","mappedin-ctrl-attrib-".concat(t)),this.attribContainerEl.open=!0,this.attribContainerEl.ariaLabel="Attribution",this.controlPositions[t].appendChild(this.attribContainerEl),this.attribButtonEl=document.createElement("summary"),this.attribButtonEl.addEventListener("click",this.toggleAttribution),this.attribButtonEl.classList.add("mappedin-ctrl-attrib-button"),this.attribButtonEl.title="Toggle attribution",this.attribButtonEl.ariaLabel="Toggle attribution",this.attribButtonEl.tabIndex=0,this.attribButtonEl.innerHTML=$v(),this.attribContainerEl.appendChild(this.attribButtonEl),this.attribInnerEl=document.createElement("div"),this.attribInnerEl.classList.add("mappedin-ctrl-attrib-inner"),this.attribHTML=u(this,_i)?Tl:"",this.attribInnerEl.innerHTML=this.attribHTML,this.attribContainerEl.appendChild(this.attribInnerEl),((n=r.feedback)!=null?n:Ml.feedback)&&(this.feedbackLinkEl=document.createElement("a"),this.feedbackLinkEl.href=qv,this.feedbackLinkEl.target="_blank",this.feedbackLinkEl.rel="noopener",this.feedbackLinkEl.textContent="Provide Feedback",this.feedbackLinkEl.classList.add("mappedin-ctrl-attrib-inner"),this.feedbackLinkEl.classList.add("mappedin-ctrl-attrib-inner-bold"),this.attribContainerEl.appendChild(this.feedbackLinkEl)),r.custom&&(this.customAttributions=r.custom),this.updateAttributionDisplay()}updateAttribution(r){if(!r.style||!this.attribInnerEl||!this.attribContainerEl)return;let t=u(this,_i)?[Tl]:[],i=r.style.sourceCaches;for(let n in i){let o=i[n];if(o.used||o.usedForTerrain){let s=o.getSource();s.attribution&&t.indexOf(s.attribution)<0&&t.push(s.attribution)}}t=t.filter(n=>String(n).trim()),t=t.filter((n,o)=>{for(let s=o+1;s<t.length;s++)if(t[s].indexOf(n)>=0)return!1;return!0}),this.attribHTML=t.join(" "),this.updateAttributionDisplay()}updateAttributionDisplay(){let r=[...new Set([this.attribHTML,...this.customAttributions])].filter(Boolean).join(" ");this.attribInnerEl&&(this.attribInnerEl.innerHTML=r)}resizeAttribution(r){this.attribContainerEl&&(r<=Jv||this.compact?this.compact===!1?this.attribContainerEl.setAttribute("open",""):!this.attribContainerEl.classList.contains("mappedin-compact")&&!this.attribContainerEl.classList.contains("mappedin-attrib-empty")&&(this.attribContainerEl.setAttribute("open",""),this.attribContainerEl.classList.add("mappedin-compact","mappedin-compact-show")):(this.attribContainerEl.setAttribute("open",""),this.attribContainerEl.classList.contains("mappedin-compact")&&this.attribContainerEl.classList.remove("mappedin-compact","mappedin-compact-show")))}destroyAttributionControl(){this.attribButtonEl&&this.attribButtonEl.removeEventListener("click",this.toggleAttribution),this.attribContainerEl&&(this.attribContainerEl.remove(),this.attribContainerEl=void 0,this.attribInnerEl=void 0,this.attribButtonEl=void 0)}resize(r){this.resizeAttribution(r)}updateData(r){this.updateAttribution(r)}destroy(){this.destroyAttributionControl(),this.controlContainerEl.remove(),this.compact=void 0}};_i=new WeakMap,a(wl,"HTMLControlsSystem");var ns=wl;x();x();var ht=Object.freeze({Linear:Object.freeze({None:a(function(e){return e},"None"),In:a(function(e){return e},"In"),Out:a(function(e){return e},"Out"),InOut:a(function(e){return e},"InOut")}),Quadratic:Object.freeze({In:a(function(e){return e*e},"In"),Out:a(function(e){return e*(2-e)},"Out"),InOut:a(function(e){return(e*=2)<1?.5*e*e:-.5*(--e*(e-2)-1)},"InOut")}),Cubic:Object.freeze({In:a(function(e){return e*e*e},"In"),Out:a(function(e){return--e*e*e+1},"Out"),InOut:a(function(e){return(e*=2)<1?.5*e*e*e:.5*((e-=2)*e*e+2)},"InOut")}),Quartic:Object.freeze({In:a(function(e){return e*e*e*e},"In"),Out:a(function(e){return 1- --e*e*e*e},"Out"),InOut:a(function(e){return(e*=2)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2)},"InOut")}),Quintic:Object.freeze({In:a(function(e){return e*e*e*e*e},"In"),Out:a(function(e){return--e*e*e*e*e+1},"Out"),InOut:a(function(e){return(e*=2)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2)},"InOut")}),Sinusoidal:Object.freeze({In:a(function(e){return 1-Math.sin((1-e)*Math.PI/2)},"In"),Out:a(function(e){return Math.sin(e*Math.PI/2)},"Out"),InOut:a(function(e){return .5*(1-Math.sin(Math.PI*(.5-e)))},"InOut")}),Exponential:Object.freeze({In:a(function(e){return e===0?0:Math.pow(1024,e-1)},"In"),Out:a(function(e){return e===1?1:1-Math.pow(2,-10*e)},"Out"),InOut:a(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)},"InOut")}),Circular:Object.freeze({In:a(function(e){return 1-Math.sqrt(1-e*e)},"In"),Out:a(function(e){return Math.sqrt(1- --e*e)},"Out"),InOut:a(function(e){return(e*=2)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1)},"InOut")}),Elastic:Object.freeze({In:a(function(e){return e===0?0:e===1?1:-Math.pow(2,10*(e-1))*Math.sin((e-1.1)*5*Math.PI)},"In"),Out:a(function(e){return e===0?0:e===1?1:Math.pow(2,-10*e)*Math.sin((e-.1)*5*Math.PI)+1},"Out"),InOut:a(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)},"InOut")}),Back:Object.freeze({In:a(function(e){var r=1.70158;return e===1?1:e*e*((r+1)*e-r)},"In"),Out:a(function(e){var r=1.70158;return e===0?0:--e*e*((r+1)*e+r)+1},"Out"),InOut:a(function(e){var r=2.5949095;return(e*=2)<1?.5*(e*e*((r+1)*e-r)):.5*((e-=2)*e*((r+1)*e+r)+2)},"InOut")}),Bounce:Object.freeze({In:a(function(e){return 1-ht.Bounce.Out(1-e)},"In"),Out:a(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},"Out"),InOut:a(function(e){return e<.5?ht.Bounce.In(e*2)*.5:ht.Bounce.Out(e*2-1)*.5+.5},"InOut")}),generatePow:a(function(e){return e===void 0&&(e=4),e=e<Number.EPSILON?Number.EPSILON:e,e=e>1e4?1e4:e,{In:a(function(r){return Math.pow(r,e)},"In"),Out:a(function(r){return 1-Math.pow(1-r,e)},"Out"),InOut:a(function(r){return r<.5?Math.pow(r*2,e)/2:(1-Math.pow(2-r*2,e))/2+.5},"InOut")}},"generatePow")}),fn=a(function(){return performance.now()},"now"),os=function(){function e(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];this._tweens={},this._tweensAddedDuringUpdate={},this.add.apply(this,r)}return a(e,"Group"),e.prototype.getAll=function(){var r=this;return Object.keys(this._tweens).map(function(t){return r._tweens[t]})},e.prototype.removeAll=function(){this._tweens={}},e.prototype.add=function(){for(var r,t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];for(var n=0,o=t;n<o.length;n++){var s=o[n];(r=s._group)===null||r===void 0||r.remove(s),s._group=this,this._tweens[s.getId()]=s,this._tweensAddedDuringUpdate[s.getId()]=s}},e.prototype.remove=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];for(var i=0,n=r;i<n.length;i++){var o=n[i];o._group=void 0,delete this._tweens[o.getId()],delete this._tweensAddedDuringUpdate[o.getId()]}},e.prototype.allStopped=function(){return this.getAll().every(function(r){return!r.isPlaying()})},e.prototype.update=function(r,t){r===void 0&&(r=fn()),t===void 0&&(t=!0);var i=Object.keys(this._tweens);if(i.length!==0)for(;i.length>0;){this._tweensAddedDuringUpdate={};for(var n=0;n<i.length;n++){var o=this._tweens[i[n]],s=!t;o&&o.update(r,s)===!1&&!t&&this.remove(o)}i=Object.keys(this._tweensAddedDuringUpdate)}},e}(),wi={Linear:a(function(e,r){var t=e.length-1,i=t*r,n=Math.floor(i),o=wi.Utils.Linear;return r<0?o(e[0],e[1],i):r>1?o(e[t],e[t-1],t-i):o(e[n],e[n+1>t?t:n+1],i-n)},"Linear"),Bezier:a(function(e,r){for(var t=0,i=e.length-1,n=Math.pow,o=wi.Utils.Bernstein,s=0;s<=i;s++)t+=n(1-r,i-s)*n(r,s)*e[s]*o(i,s);return t},"Bezier"),CatmullRom:a(function(e,r){var t=e.length-1,i=t*r,n=Math.floor(i),o=wi.Utils.CatmullRom;return e[0]===e[t]?(r<0&&(n=Math.floor(i=t*(1+r))),o(e[(n-1+t)%t],e[n],e[(n+1)%t],e[(n+2)%t],i-n)):r<0?e[0]-(o(e[0],e[0],e[1],e[1],-i)-e[0]):r>1?e[t]-(o(e[t],e[t],e[t-1],e[t-1],i-t)-e[t]):o(e[n?n-1:0],e[n],e[t<n+1?t:n+1],e[t<n+2?t:n+2],i-n)},"CatmullRom"),Utils:{Linear:a(function(e,r,t){return(r-e)*t+e},"Linear"),Bernstein:a(function(e,r){var t=wi.Utils.Factorial;return t(e)/t(r)/t(e-r)},"Bernstein"),Factorial:function(){var e=[1];return function(r){var t=1;if(e[r])return e[r];for(var i=r;i>1;i--)t*=i;return e[r]=t,t}}(),CatmullRom:a(function(e,r,t,i,n){var o=(t-e)*.5,s=(i-r)*.5,l=n*n,h=n*l;return(2*r-2*t+o+s)*h+(-3*r+3*t-2*o-s)*l+o*n+r},"CatmullRom")}},yd=function(){function e(){}return a(e,"Sequence"),e.nextId=function(){return e._nextId++},e._nextId=0,e}(),Il=new os,gd=function(){function e(r,t){this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._isDynamic=!1,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=ht.Linear.None,this._interpolationFunction=wi.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=yd.nextId(),this._isChainStopped=!1,this._propertiesAreSetUp=!1,this._goToEnd=!1,this._object=r,typeof t=="object"?(this._group=t,t.add(this)):t===!0&&(this._group=Il,Il.add(this))}return a(e,"Tween"),e.prototype.getId=function(){return this._id},e.prototype.isPlaying=function(){return this._isPlaying},e.prototype.isPaused=function(){return this._isPaused},e.prototype.getDuration=function(){return this._duration},e.prototype.to=function(r,t){if(t===void 0&&(t=1e3),this._isPlaying)throw new Error("Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.");return this._valuesEnd=r,this._propertiesAreSetUp=!1,this._duration=t<0?0:t,this},e.prototype.duration=function(r){return r===void 0&&(r=1e3),this._duration=r<0?0:r,this},e.prototype.dynamic=function(r){return r===void 0&&(r=!1),this._isDynamic=r,this},e.prototype.start=function(r,t){if(r===void 0&&(r=fn()),t===void 0&&(t=!1),this._isPlaying)return this;if(this._repeat=this._initialRepeat,this._reversed){this._reversed=!1;for(var i in this._valuesStartRepeat)this._swapEndStartRepeatValues(i),this._valuesStart[i]=this._valuesStartRepeat[i]}if(this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=r,this._startTime+=this._delayTime,!this._propertiesAreSetUp||t){if(this._propertiesAreSetUp=!0,!this._isDynamic){var n={};for(var o in this._valuesEnd)n[o]=this._valuesEnd[o];this._valuesEnd=n}this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat,t)}return this},e.prototype.startFromCurrentValues=function(r){return this.start(r,!0)},e.prototype._setupProperties=function(r,t,i,n,o){for(var s in i){var l=r[s],h=Array.isArray(l),p=h?"array":typeof l,m=!h&&Array.isArray(i[s]);if(!(p==="undefined"||p==="function")){if(m){var f=i[s];if(f.length===0)continue;for(var v=[l],y=0,C=f.length;y<C;y+=1){var M=this._handleRelativeValue(l,f[y]);if(isNaN(M)){m=!1,console.warn("Found invalid interpolation list. Skipping.");break}v.push(M)}m&&(i[s]=v)}if((p==="object"||h)&&l&&!m){t[s]=h?[]:{};var g=l;for(var b in g)t[s][b]=g[b];n[s]=h?[]:{};var f=i[s];if(!this._isDynamic){var P={};for(var b in f)P[b]=f[b];i[s]=f=P}this._setupProperties(g,t[s],f,n[s],o)}else(typeof t[s]>"u"||o)&&(t[s]=l),h||(t[s]*=1),m?n[s]=i[s].slice().reverse():n[s]=t[s]||0}}},e.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},e.prototype.end=function(){return this._goToEnd=!0,this.update(this._startTime+this._duration),this},e.prototype.pause=function(r){return r===void 0&&(r=fn()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=r,this)},e.prototype.resume=function(r){return r===void 0&&(r=fn()),!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=r-this._pauseStart,this._pauseStart=0,this)},e.prototype.stopChainedTweens=function(){for(var r=0,t=this._chainedTweens.length;r<t;r++)this._chainedTweens[r].stop();return this},e.prototype.group=function(r){return r?(r.add(this),this):(console.warn("tween.group() without args has been removed, use group.add(tween) instead."),this)},e.prototype.remove=function(){var r;return(r=this._group)===null||r===void 0||r.remove(this),this},e.prototype.delay=function(r){return r===void 0&&(r=0),this._delayTime=r,this},e.prototype.repeat=function(r){return r===void 0&&(r=0),this._initialRepeat=r,this._repeat=r,this},e.prototype.repeatDelay=function(r){return this._repeatDelayTime=r,this},e.prototype.yoyo=function(r){return r===void 0&&(r=!1),this._yoyo=r,this},e.prototype.easing=function(r){return r===void 0&&(r=ht.Linear.None),this._easingFunction=r,this},e.prototype.interpolation=function(r){return r===void 0&&(r=wi.Linear),this._interpolationFunction=r,this},e.prototype.chain=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return this._chainedTweens=r,this},e.prototype.onStart=function(r){return this._onStartCallback=r,this},e.prototype.onEveryStart=function(r){return this._onEveryStartCallback=r,this},e.prototype.onUpdate=function(r){return this._onUpdateCallback=r,this},e.prototype.onRepeat=function(r){return this._onRepeatCallback=r,this},e.prototype.onComplete=function(r){return this._onCompleteCallback=r,this},e.prototype.onStop=function(r){return this._onStopCallback=r,this},e.prototype.update=function(r,t){var i=this,n;if(r===void 0&&(r=fn()),t===void 0&&(t=e.autoStartOnUpdate),this._isPaused)return!0;var o;if(!this._goToEnd&&!this._isPlaying)if(t)this.start(r,!0);else return!1;if(this._goToEnd=!1,r<this._startTime)return!0;this._onStartCallbackFired===!1&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),this._onEveryStartCallbackFired===!1&&(this._onEveryStartCallback&&this._onEveryStartCallback(this._object),this._onEveryStartCallbackFired=!0);var s=r-this._startTime,l=this._duration+((n=this._repeatDelayTime)!==null&&n!==void 0?n:this._delayTime),h=this._duration+this._repeat*l,p=a(function(){if(i._duration===0||s>h)return 1;var M=Math.trunc(s/l),g=s-M*l,b=Math.min(g/i._duration,1);return b===0&&s===i._duration?1:b},"calculateElapsedPortion"),m=p(),f=this._easingFunction(m);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,f),this._onUpdateCallback&&this._onUpdateCallback(this._object,m),this._duration===0||s>=this._duration)if(this._repeat>0){var v=Math.min(Math.trunc((s-this._duration)/l)+1,this._repeat);isFinite(this._repeat)&&(this._repeat-=v);for(o in this._valuesStartRepeat)!this._yoyo&&typeof this._valuesEnd[o]=="string"&&(this._valuesStartRepeat[o]=this._valuesStartRepeat[o]+parseFloat(this._valuesEnd[o])),this._yoyo&&this._swapEndStartRepeatValues(o),this._valuesStart[o]=this._valuesStartRepeat[o];return this._yoyo&&(this._reversed=!this._reversed),this._startTime+=l*v,this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1,!0}else{this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var y=0,C=this._chainedTweens.length;y<C;y++)this._chainedTweens[y].start(this._startTime+this._duration,!1);return this._isPlaying=!1,!1}return!0},e.prototype._updateProperties=function(r,t,i,n){for(var o in i)if(t[o]!==void 0){var s=t[o]||0,l=i[o],h=Array.isArray(r[o]),p=Array.isArray(l),m=!h&&p;m?r[o]=this._interpolationFunction(l,n):typeof l=="object"&&l?this._updateProperties(r[o],s,l,n):(l=this._handleRelativeValue(s,l),typeof l=="number"&&(r[o]=s+(l-s)*n))}},e.prototype._handleRelativeValue=function(r,t){return typeof t!="string"?t:t.charAt(0)==="+"||t.charAt(0)==="-"?r+parseFloat(t):parseFloat(t)},e.prototype._swapEndStartRepeatValues=function(r){var t=this._valuesStartRepeat[r],i=this._valuesEnd[r];typeof i=="string"?this._valuesStartRepeat[r]=this._valuesStartRepeat[r]+parseFloat(i):this._valuesStartRepeat[r]=this._valuesEnd[r],this._valuesEnd[r]=t},e.autoStartOnUpdate=!1,e}();var vw=yd.nextId,At=Il,xw=At.getAll.bind(At),Sw=At.removeAll.bind(At),Cw=At.add.bind(At),Pw=At.remove.bind(At),Tw=At.update.bind(At);x();x();x();x();x();var bd=a((e,r)=>(r-e+Math.PI)%(Math.PI*2)+Math.PI*2%(Math.PI*2)-Math.PI,"differenceBetweenAngles"),vd=a((e,r)=>new K(e.clientX-r.offsetLeft,e.clientY-r.offsetTop),"getTouchPos"),El=a((e,r)=>Math.atan2(r.y-e.y,r.x-e.x),"angle"),yn=a((e,r)=>Math.sqrt((r.y-e.y)**2+(r.x-e.x)**2),"distance"),Dl=a((e,r)=>new K((e.x+r.x)/2,(e.y+r.y)/2),"average"),Ol=a(e=>{let r=0,{wheelDelta:t,detail:i}=e;return t!==void 0?r=t:i!==void 0&&(r=-i),r},"getScrollDelta");var Ll=class Ll{constructor(r,t){d(this,"input1");d(this,"input2");d(this,"lastAngle");d(this,"lastDistance");d(this,"totalDistance");d(this,"first");d(this,"second");this.input1=r,this.input2=t,this.lastAngle=El(r,t),this.lastDistance=yn(r,t),this.totalDistance=0,this.first=r,this.second=t}update(r,t){let i=yn(r,t);this.input1=r,this.input2=t;let n=El(r,t);this.lastAngle=n,this.lastDistance=i,this.totalDistance+=(yn(this.first,r)+yn(this.second,t))/2,this.first=Dl(this.first,r),this.second=Dl(this.second,t)}};a(Ll,"InputSet");var ss=Ll;x();var Al=class Al{constructor(r,t,i){d(this,"touch");d(this,"camera");d(this,"cameraPlane");d(this,"viewCoordinate");d(this,"snapHolderMatrix");d(this,"snapCamera");d(this,"cameraPosition");d(this,"raycaster");d(this,"worldCoordinate");d(this,"snapshotted",!1);this.touch=r,this.camera=t,this.cameraPlane=i,this.viewCoordinate={x:r.x,y:r.y},this.camera.updateMatrixWorld(),this.camera.updateMatrix(),this.snapHolderMatrix=this.camera.matrixWorld.clone(),this.snapCamera=this.camera.clone(),this.snapshotCameraState()}snapshotCameraState(){this.camera.updateMatrix(),this.camera.updateMatrixWorld(),this.cameraPosition=this.camera.position.clone();let r=new K(this.viewCoordinate.x,this.viewCoordinate.y);this.raycaster=this.raycaster||new Mt,this.raycaster.setFromCamera(r,this.snapCamera);let t=this.raycaster.intersectObject(this.cameraPlane,!0);this.worldCoordinate=t&&t.length>0?t[0].point:null,this.snapshotted=!0}updateAnchorState(r,t){this.camera=r,this.snapCamera=r.clone(),this.snapHolderMatrix=r.matrixWorld.clone(),this.updateViewCoordinate(t),this.snapshotCameraState()}updateViewCoordinate(r){this.viewCoordinate={x:r.x,y:r.y}}reUnproject(){var i,n;let r=new K(this.viewCoordinate.x,this.viewCoordinate.y);(i=this.raycaster)==null||i.setFromCamera(r,this.snapCamera);let t=(n=this.raycaster)==null?void 0:n.intersectObject(this.cameraPlane,!0)[0];return t?t.point:void 0}};a(Al,"TouchAnchor");var gn=Al;var pt={};lf(pt,{BLOCK_MERCATOR_ZOOM_LEVEL:()=>Qv,CLIPPING_RADIUS:()=>bn,CONTROL_OPTIONS:()=>Kv,DEFAULT_ANIMATION_DURATION:()=>Fl,DEFAULT_BEARING:()=>n0,DEFAULT_MAX_ZOOM_LEVEL:()=>r0,DEFAULT_MIN_ZOOM_LEVEL:()=>Gl,DEFAULT_PITCH:()=>i0,DEFAULT_ZOOM_LEVEL:()=>t0,EVENTS:()=>cs,MAPLIBRE_TILE_SIZE:()=>as,MAX_LAT:()=>kl,MAX_MERCATOR_ZOOM_LEVEL:()=>us,MIN_LAT:()=>Rl,MIN_MERCATOR_ZOOM_LEVEL:()=>ls,ROOM_MERCATOR_ZOOM_LEVEL:()=>e0,TWO_PI:()=>Nl,WHEEL_ZOOM_MULTIPLIER:()=>Bl,ZRANGE:()=>Ii});x();var as=512,Rl=-85.051129,kl=85.051129,bn=1e4,Kv={chain:"chain",cancel:"cancel"},Nl=Math.PI*2,Ii=100,Bl=1e4,ls=0,us=24,Qv=17,e0=20,Fl=200,cs=["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"],t0=18,Gl=12,r0=22,i0=0,n0=0;x();function xd(e){e&&(e.map&&(e.map.dispose(),e.map=void 0),e.dispose())}a(xd,"scrubMaterial");function Ee(e){for(let r=e.children.length-1;r>=0;r--)Ee(e.children[r]);"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(r){xd(r)}):"material"in e&&typeof e.material<"u"&&xd(e.material)}a(Ee,"destroyObject3D");var hs=!1,o0=!1;var ps,ds=class ds extends ie{constructor(t,i,n,o,s){super();d(this,"dirty",!1);d(this,"zoomDirty",!1);d(this,"rotationDirty",!1);d(this,"panDirty",!1);d(this,"stateDirty",!1);L(this,ps,Gl);d(this,"zoomSpeed",5);d(this,"rotateSpeed",100);d(this,"enabled",!0);d(this,"enableZoom",!0);d(this,"enablePan",!0);d(this,"enablePedestal",!1);d(this,"maxPedestal",1/0);d(this,"minPedestal",0);d(this,"enableRotate",!0);d(this,"minZoomAltitude",0);d(this,"maxZoomAltitude",1/0);d(this,"ignoreZoomLimits",!1);d(this,"zoomFactor",1);d(this,"panBounds",{min:new z(1/0,1/0),max:new z(-1/0,-1/0),center:new z(0,0,0),radius:1/0});d(this,"minTilt",0);d(this,"maxTilt",1.2);d(this,"MOUSE_BUTTONS",{ORBIT:lo.RIGHT,ZOOM:lo.MIDDLE,PAN:lo.LEFT});d(this,"camera");d(this,"scene");d(this,"renderer");d(this,"elevation");d(this,"orbit");d(this,"cameraPlane");d(this,"raycaster",new Mt);d(this,"rendererState");d(this,"options");d(this,"state",-1);d(this,"intersection");d(this,"viewState",null);d(this,"tweens",new Map);d(this,"clock",new Mc(!0));d(this,"coords",{mouse:new K,rotateStart:new K,rotateEnd:new K,rotateDelta:new K,panStart:new z,panCameraStart:new z,panEnd:new z,panDelta:new z,initialShiftPos:new K,initialPedestal:0,floorAnchor:new z});d(this,"touch",{origin:{offsetLeft:0,offsetTop:0},touches:[],anchor1:null,anchor2:null,inputs:null});d(this,"scrollTimer",null);d(this,"lastWheelTime",0);d(this,"resetZoom",!1);d(this,"zoomStart");d(this,"pedestalScaleFactor",1);d(this,"isUserZooming",!1);d(this,"stayInsideBounds",!0);d(this,"userInteracting",!1);d(this,"cameraMoving",!1);d(this,"lastCameraMoveTime",Date.now());d(this,"raycastToFloor",a(t=>{this.raycaster.setFromCamera(t,this.camera);let i=this.raycaster.intersectObject(this.cameraPlane,!1)[0];return i?i.point:new z},"raycastToFloor"));d(this,"isUserInteracting",a(()=>this.userInteracting,"isUserInteracting"));d(this,"getPosition",a(()=>new z(this.orbit.position.x,this.orbit.position.y,this.orbit.position.z),"getPosition"));d(this,"getPedestal",a(()=>this.orbit.position.z,"getPedestal"));d(this,"pan",a((t,i)=>{isNaN(t)||isNaN(i)||(this.setPosition(this.orbit.position.x+t,this.orbit.position.y+i),this.publish("position-updated"))},"pan"));d(this,"postRender",a(()=>{(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"))},"postRender"));d(this,"isCameraMoving",a(()=>this.cameraMoving,"isCameraMoving"));d(this,"lastCameraStoppedMovingTime",a(()=>this.lastCameraMoveTime,"lastCameraStoppedMovingTime"));d(this,"setPosition",a((t,i)=>{t===void 0||i===void 0||isNaN(t)||isNaN(i)||(this.state===-1&&this.publish("pan-start"),this.updateCameraPosition(t,i),this.publish("position-updated"),this.publish("change"),this.state===-1&&this.publish("pan-end"),this.dirty=!0,this.stateDirty=!0)},"setPosition"));d(this,"updateCameraPosition",a((t,i)=>{let n=t-this.panBounds.center.x,o=i-this.panBounds.center.y,s=Math.sqrt(n*n+o*o);if(this.stayInsideBounds&&s>this.panBounds.radius){let l=Math.atan2(o,n),h={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=h.x,this.orbit.position.y=h.y}else this.orbit.position.x=t,this.orbit.position.y=i},"updateCameraPosition"));d(this,"tilt",a(t=>{if(isNaN(t))return;this.state===-1&&this.publish("rotate-start");let i=this.stayInsideBounds?Math.max(Math.min(t+this.getTilt(),this.maxTilt),this.minTilt):t+this.getTilt();i!==this.elevation.rotation.x&&(this.elevation.rotation.x=i,this.publish("tilt-updated")),this.publish("change"),this.state===-1&&this.publish("rotate-end"),this.stateDirty=!0},"tilt"));d(this,"zoomIn",a((t,i,n)=>{let o=this.getZoomAltitude();this.animateCamera({zoom:o/1.5},t,i,n)},"zoomIn"));d(this,"zoomOut",a((t,i,n)=>{let o=this.getZoomAltitude();this.animateCamera({zoom:o*1.5},t,i,n)},"zoomOut"));d(this,"getRotation",a(()=>(-this.orbit.rotation.z+Math.PI*2)%(Math.PI*2),"getRotation"));d(this,"cancelAnimation",a(()=>{let t=Array.from(this.tweens.keys()),i=t[t.length-1];i.state===7&&this.publish("multi-cancel",{zooming:!0,rotating:!0,tilting:!0}),this.completeTween(i)},"cancelAnimation"));d(this,"animateCamera",a((t,i,n,o,s,l)=>{let h=se({interruptible:!0},l),p={},m={},f=this.getPosition();if(t.position!=null&&(t.position.x!==void 0&&(p.x=f.x,m.x=t.position.x),t.position.y!==void 0&&(p.y=f.y,m.y=t.position.y),t.position.z!==void 0&&(p.z=f.z,m.z=t.position.z)),t.zoom!==void 0&&(p.zoom=this.stayInsideBounds?Math.min(Math.max(this.getZoomAltitude(),this.getZoomScaledMin()),this.getZoomScaledMax()):this.getZoomAltitude(),this.viewState==="multi_floor"||!this.stayInsideBounds?m.zoom=t.zoom:m.zoom=Math.min(Math.max(t.zoom,this.getZoomScaledMin()),this.getZoomScaledMax())),t.rotation!==void 0){let{start:S,end:T}=Ac(this.getRotation(),t.rotation);p.rotation=S,m.rotation=T}t.tilt!==void 0&&(p.tilt=this.getTilt(),this.viewState==="multi_floor"||!this.stayInsideBounds?m.tilt=t.tilt:m.tilt=Math.max(Math.min(t.tilt,this.maxTilt),this.minTilt));let v=p.zoom!==m.zoom,y=p.rotation!==m.rotation,C=p.tilt!==m.tilt,M=new gd(p).to(m,D.env.TESTING?0:i).onUpdate(S=>{this.setMulti({x:S.x,y:S.y,z:S.z},S.zoom,S.rotation,S.tilt)}).onComplete(()=>{this.completeTween(M),this.publish("multi-end",{zooming:v,rotating:y,tilting:C}),o&&o()}).onStart(()=>{this.state!==7&&(this.state=7,M.state=7,this.publish("multi-start",{zooming:v,rotating:y,tilting:C})),this.publish("change")});this.rendererState.internalTweenGroup.add(M);let g=Array.from(this.tweens.entries()),b=g[g.length-1],P=!1;return b!=null&&(b[1].interruptible?(typeof b[1].cancelledCallback=="function"&&b[1].cancelledCallback(),this.completeTween(b[0])):(P=!0,b[0].chain(M))),this.tweens.set(M,{cancelledCallback:s,interruptible:h.interruptible}),n?M.easing(n):M.easing(ht.Quadratic.In),!t.doNotAutoStart&&!P&&(M.start(),this.publish("change")),M.cameraAnimation=!0,M},"animateCamera"));d(this,"setMulti",a((t,i,n,o,s=!0)=>{this.state===-1&&this.publish("multi-start");let l=!1;t!=null&&(t.x!==void 0&&!isNaN(t.x)&&t.y!==void 0&&!isNaN(t.y)&&(this.updateCameraPosition(t.x,t.y),l=!0),t.z!==void 0&&!isNaN(t.z)&&(this.setPedestal(t.z,!0,!1),l=!0)),l&&this.publish("position-updated");let h={zooming:!1,tilting:!!i,rotating:!1};if(i!==void 0&&!isNaN(i)){let p=this.stayInsideBounds?Math.min(Math.max(i,this.getZoomScaledMin()),this.getZoomScaledMax()):i;p!==this.camera.position.z&&(h.zooming=!0,this.camera.position.z=p,this.publish("zoom-updated"),this.zoomDirty=!0,this.viewState==="multi_floor"?i>bn&&(this.camera.near=i-bn,this.camera.far=i+bn):(this.camera.near=i/Ii,this.camera.far=i*Ii),this.camera.updateProjectionMatrix())}if(n!==void 0&&!isNaN(n)&&n!==this.getRotation()&&(h.rotating=!0,this.orbit.rotation.z=-n,this.publish("rotation-updated")),o!==void 0&&!isNaN(o)){let p=this.stayInsideBounds?Math.max(Math.min(o,this.maxTilt),this.minTilt):o;p!==this.elevation.rotation.x&&(h.tilting=!0,this.elevation.rotation.x=p,this.publish("tilt-updated"))}s&&this.publish("change"),this.state===-1&&this.publish("multi-end",h),this.stateDirty=!0},"setMulti"));d(this,"getZoomScaledMin",a(()=>this.minZoomAltitude*this.zoomFactor,"getZoomScaledMin"));d(this,"getZoomScaledMax",a(()=>{let t=this.minZoomAltitude*this.zoomFactor;return Math.max(this.maxZoomAltitude,t)},"getZoomScaledMax"));d(this,"setRotation",a((t,i)=>{if(isNaN(t))return;this.state===-1&&!i&&this.publish("rotate-start");let n=-(t%Nl);n!==this.orbit.rotation.z&&(this.orbit.rotation.z=n,i||this.publish("rotation-updated")),i||this.publish("change"),this.state===-1&&!i&&this.publish("rotate-end"),this.dirty=!0,this.rotationDirty=!0,i||(this.stateDirty=!0)},"setRotation"));d(this,"setZoomAltitude",a(t=>{if(isNaN(t))return;this.state===-1&&this.publish("zoom-start");let i=this.stayInsideBounds?Math.min(Math.max(t,this.getZoomScaledMin()),this.getZoomScaledMax()):t;i!==this.camera.position.z&&(this.camera.position.z=i,this.publish("zoom-updated"),this.zoomDirty=!0),this.camera.near=i/Ii,this.camera.far=i*Ii,this.camera.updateProjectionMatrix(),this.publish("change"),this.state===-1&&this.publish("zoom-end"),this.dirty=!0,this.stateDirty=!0},"setZoomAltitude"));d(this,"setZoomLevel",a(t=>{this.setZoomAltitude(this.convertZoomLevelToAltitude(t))},"setZoomLevel"));d(this,"getZoomAltitude",a(()=>this.camera.position.z,"getZoomAltitude"));d(this,"getZoomLevel",a(()=>this.convertAltitudeToZoomLevel(this.getZoomAltitude()),"getZoomLevel"));d(this,"setTilt",a((t,i)=>{if(isNaN(t))return;this.state===-1&&!i&&this.publish("rotate-start");let n=this.stayInsideBounds?Math.max(Math.min(t,this.maxTilt),this.minTilt):t;n!==this.elevation.rotation.x&&(this.elevation.rotation.x=n,i||this.publish("tilt-updated")),i||this.publish("change"),this.state===-1&&!i&&this.publish("rotate-end"),this.dirty=!0,i||(this.stateDirty=!0)},"setTilt"));d(this,"getTilt",a(()=>this.elevation.rotation.x,"getTilt"));d(this,"setCameraPlaneElevation",a(t=>{this.cameraPlane.position.z=t},"setCameraPlaneElevation"));d(this,"zoom",a(t=>{if(isNaN(t))return;this.state===-1&&this.publish("zoom-start");let i=this.getZoomAltitude()-t;this.camera.position.z=this.stayInsideBounds?Math.min(Math.max(i,this.minZoomAltitude*this.zoomFactor),this.maxZoomAltitude*this.zoomFactor):i,this.publish("zoom-updated"),this.zoomDirty=!0,this.publish("change"),this.state===-1&&this.publish("zoom-end"),this.stateDirty=!0},"zoom"));d(this,"getProjectionScaleFactor",a((t,i,n)=>Da(t,i,n),"getProjectionScaleFactor"));d(this,"update",a(()=>{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())},"update"));d(this,"setPedestal",a((t,i=!1,n=!0)=>{typeof t=="number"&&!isNaN(t)&&(this.orbit.position.z=t,i&&(this.publishPedestalChangeEvent(t),this.publish("pedestal-change",{pedestal:t})),this.publish("change"),this.dirty=!0,n&&(this.stateDirty=!0))},"setPedestal"));d(this,"dispose",a(()=>{for(let t of cs)t.endsWith("start")?(this.off(t,this.setCameraMoving),t.startsWith("user")&&this.off(t,this.setUserInteracting)):(t.endsWith("end")||t.endsWith("cancel"))&&(this.off(t,this.unsetCameraMoving),t.startsWith("user")&&this.off(t,this.unsetUserInteracting));this.removeEventListeners(),this.scene.remove(this.cameraPlane)},"dispose"));d(this,"createCameraPlane",a(()=>{let t=hs?2e3:1e10,i=hs?100:1,n=new yt(t,t,i,i),o=new je({color:0,wireframe:hs,visible:hs}),s=new ae(n,o);return this.scene.add(s),s},"createCameraPlane"));d(this,"addEventListeners",a(()=>{let{domElement:t}=this.renderer;for(let i of cs)i.endsWith("start")?(this.on(i,this.setCameraMoving),i.startsWith("user")&&this.on(i,this.setUserInteracting)):(i.endsWith("end")||i.endsWith("cancel"))&&(this.on(i,this.unsetCameraMoving),i.startsWith("user")&&this.on(i,this.unsetUserInteracting));t.addEventListener("contextmenu",this.onContextMenu,!1),t.addEventListener("mousedown",this.onMouseDown,!1),t.addEventListener("wheel",this.onMouseWheel,{passive:!1}),t.addEventListener("touchstart",this.onTouchStart,!1),t.addEventListener("touchend",this.onTouchEnd,!1),t.addEventListener("touchmove",this.onTouchMove,!1)},"addEventListeners"));d(this,"addMouseEventListeners",a(()=>{this.addMouseMoveEventListeners(),window.addEventListener("mouseup",this.onMouseUp,!1),window.addEventListener("mouseout",this.onMouseUp,!1)},"addMouseEventListeners"));d(this,"addMouseMoveEventListeners",a(()=>{this.renderer.domElement.addEventListener("mousemove",this.onMouseMove,!1)},"addMouseMoveEventListeners"));d(this,"removeMouseMoveEventListeners",a(()=>{this.renderer.domElement.removeEventListener("mousemove",this.onMouseMove,!1)},"removeMouseMoveEventListeners"));d(this,"removeEventListeners",a(()=>{let{domElement:t}=this.renderer;t.removeEventListener("contextmenu",this.onContextMenu,!1),t.removeEventListener("mousedown",this.onMouseDown,!1),t.removeEventListener("wheel",this.onMouseWheel,!1),t.removeEventListener("touchstart",this.onTouchStart,!1),t.removeEventListener("touchend",this.onTouchEnd,!1),t.removeEventListener("touchmove",this.onTouchMove,!1),t.removeEventListener("mousemove",this.onMouseMove,!1),window.removeEventListener("mouseup",this.onMouseUp,!1),window.removeEventListener("mouseout",this.onMouseUp,!1)},"removeEventListeners"));d(this,"removeMouseUpEventListeners",a(()=>{this.renderer.domElement.removeEventListener("mousemove",this.onMouseMove,!1),window.removeEventListener("mouseup",this.onMouseUp,!1),window.removeEventListener("mouseout",this.onMouseUp,!1)},"removeMouseUpEventListeners"));d(this,"onContextMenu",a(t=>{t.preventDefault()},"onContextMenu"));d(this,"onMouseUp",a(()=>{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}},"onMouseUp"));d(this,"onMouseMove",a(t=>{if(this.enabled!==!1)if(t.preventDefault(),this.mouseToScene(t),this.state===0){if(this.enableRotate===!1)return;this.handleMouseMoveRotate(t)}else if(this.state===2){if(this.enablePan===!1)return;this.handleMouseMovePan()}else this.state===3?(this.resetZoom=!0,this.state=-1):this.state===8&&this.handleMouseMovePedestal(t)},"onMouseMove"));d(this,"onTouchStart",a(t=>{if(this.enabled!==!1){switch(this.updateTouchOrigin(),this.touchToScene(t),t.touches.length){case 1:this.enablePedestal?(this.handleTouchStartPedestal(t),this.state=9):this.enablePan&&(this.handleTouchStartPan(t),this.state=6);break;case 2:this.touch.inputs=new ss(this.touch.touches[0],this.touch.touches[1]);break;default:this.state=-1}this.state}},"onTouchStart"));d(this,"onTouchMove",a(t=>{if(this.enabled!==!1)switch(this.touchToScene(t),t.touches.length){case 2:t.preventDefault(),t.stopPropagation();let i=se({},this.touch.inputs.first),n=se({},this.touch.inputs.second),o=new K(this.touch.touches[0].x,this.touch.touches[0].y),s=new K(this.touch.touches[1].x,this.touch.touches[1].y);if(this.touch.inputs.update(this.touch.touches[0],this.touch.touches[1]),this.enableRotate&&this.state===4)this.handleTouchMoveTilt(t);else if(this.state===5)this.handleTouchMoveDolly();else if(this.state!==5&&this.touch.inputs.totalDistance>.05){let l=i.y<o.y&&n.y<s.y,h=i.y>o.y&&n.y>s.y;this.enableRotate&&this.state!==4&&(h||l)?(this.handleTouchStartTilt(t),this.state=4):(this.handleTouchStartDolly(),this.state=5)}break;case 1:(this.enablePedestal||this.enablePan)&&(t.preventDefault(),t.stopPropagation()),this.enablePedestal&&this.state===9?this.handleTouchMovePedestal(t):this.enablePan&&this.state===6&&this.handleTouchMovePan(t);break;default:this.state=-1}},"onTouchMove"));d(this,"onTouchEnd",a(t=>{if(this.enabled!==!1){switch(this.handleTouchEnd(),this.state){case 2:case 6:this.publish("user-pan-end");break;case 4:this.publish("pan-end"),this.publish("user-tilt-end");break;case 1:case 5:this.publish("zoom-end"),this.publish("user-dolly-end");break;case 0:this.publish("rotate-end"),this.publish("user-rotate-end");break;case 8:case 9:this.publish("pedestal-end"),this.publish("user-pedestal-end");break}t.touches.length?this.onTouchStart(t):this.state=-1}},"onTouchEnd"));d(this,"handleTouchMovePan",a(t=>{let i=Object.hasOwn(t,"x")?new K(t.x,t.y):this.touch.touches[0],n=this.raycastToFloor(i);this.coords.panEnd.set(n.x,n.y,0),this.coords.panDelta.subVectors(this.coords.panEnd,this.coords.panStart),this.setPosition(this.coords.panCameraStart.x-this.coords.panDelta.x,this.coords.panCameraStart.y-this.coords.panDelta.y),this.publish("change"),this.panDirty=!0},"handleTouchMovePan"));d(this,"handleTouchStartDolly",a(()=>{let t=this.touch.touches[0].x-this.touch.touches[1].x,i=this.touch.touches[0].y-this.touch.touches[1].y;this.zoomStart=this.getZoomAltitude();let n=new K(this.touch.touches[0].x-t/2,this.touch.touches[0].y-i/2);this.coords.floorAnchor=this.raycastToFloor(n),this.orbit.updateMatrixWorld(),this.touch.anchor1=new gn(this.touch.touches[0],this.camera,this.cameraPlane),this.touch.anchor2=new gn(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")},"handleTouchStartDolly"));d(this,"handleMouseMovePan",a(()=>{let t=this.raycastToFloor(this.coords.mouse);this.coords.panEnd.set(t.x,t.y,0),this.coords.panDelta.subVectors(this.coords.panEnd,this.coords.panStart),this.setPosition(this.coords.panCameraStart.x-this.coords.panDelta.x,this.coords.panCameraStart.y-this.coords.panDelta.y),this.publish("change"),this.panDirty=!0},"handleMouseMovePan"));d(this,"handleTouchStartTilt",a(t=>{this.coords.rotateStart.set(t.touches[1].clientX,t.touches[1].clientY),this.publish("user-tilt-start"),this.publish("rotate-start")},"handleTouchStartTilt"));d(this,"handleTouchMovePedestal",a(t=>{this.handleMouseMovePedestal(t.touches[0])},"handleTouchMovePedestal"));d(this,"handleTouchMoveTilt",a(t=>{this.coords.rotateEnd.set(t.touches[1].clientX,t.touches[1].clientY),this.coords.rotateDelta.subVectors(this.coords.rotateEnd,this.coords.rotateStart),this.setTilt(this.getTilt()-this.coords.rotateDelta.y/this.rotateSpeed),this.coords.rotateStart.copy(this.coords.rotateEnd)},"handleTouchMoveTilt"));d(this,"handleTouchMoveDolly",a(()=>{let t=this.touch.inputs.first,i=this.touch.inputs.second;this.touch.anchor1.viewCoordinate={x:t.x,y:t.y},this.touch.anchor2.viewCoordinate={x:i.x,y:i.y};let n=this.makeTransformFromTouchAnchors(this.touch.anchor1,this.touch.anchor2);n&&this.setCameraFromTransformMatrix(n),this.orbit.updateMatrixWorld(),this.touch.anchor1.updateAnchorState(this.camera,t),this.touch.anchor2.updateAnchorState(this.camera,i)},"handleTouchMoveDolly"));d(this,"handleTouchEnd",a(()=>{this.state===4||this.state===5?this.publish("multi-end"):this.state===6&&this.publish("pan-end"),this.panDirty=!1},"handleTouchEnd"));d(this,"handleTouchStartPan",a(t=>{let i=Object.hasOwn(t,"x")?new K(t.x,t.y):this.touch.touches[0],n=this.raycastToFloor(i);this.coords.panStart.set(n.x,n.y,0),this.coords.panCameraStart.set(this.orbit.position.x,this.orbit.position.y,0),this.publish("user-pan-start"),this.publish("pan-start")},"handleTouchStartPan"));d(this,"handleTouchStartPedestal",a(t=>{this.handleMouseDownPedestal(t.touches[0])},"handleTouchStartPedestal"));d(this,"onMouseDown",a(t=>{if(this.enabled!==!1){if(this.mouseToScene(t),t.preventDefault(),this.state===3&&this.publish("zoom-end"),t.button===this.MOUSE_BUTTONS.ORBIT){if(this.enableRotate===!1)return;this.handleMouseDownRotate(t),this.state=0}else t.button===this.MOUSE_BUTTONS.PAN&&(this.enablePan?(this.handleMouseDownPan(),this.state=2):this.enablePedestal&&(this.handleMouseDownPedestal(t),this.state=8));this.state!==-1&&this.addMouseEventListeners()}},"onMouseDown"));d(this,"onMouseWheel",a(t=>{this.enabled===!1||this.enableZoom===!1||this.state!==-1&&this.state!==3||(t.preventDefault(),t.stopPropagation(),this.mouseToScene(t),this.canScrollZoom(t)&&(this.lastWheelTime=this.clock.getElapsedTime(),this.publishUserZoomEvent()),this.state!==3&&this.canScrollZoom(t)&&(this.addMouseMoveEventListeners(),this.state=3,this.zoomStart=this.getZoomAltitude(),this.coords.floorAnchor=this.raycastToFloor(this.coords.mouse),this.coords.panCameraStart.set(this.orbit.position.x,this.orbit.position.y,0),this.publish("zoom-start")),this.scrollTimer!=null&&clearTimeout(this.scrollTimer),this.scrollTimer=setTimeout(()=>{this.publish("zoom-end")},50),this.handleMouseWheel(t))},"onMouseWheel"));d(this,"handleMouseWheel",a(t=>{if(this.publish("zoom-start"),!this.canScrollZoom(t)){this.lastWheelTime>0&&this.publish("zoom-end"),this.lastWheelTime=0,this.state=-1;return}let i=this.getZoomAltitude(),n=i-Ol(t)*i/Bl*this.zoomSpeed;if(this.setZoomAltitude(n),this.enablePan){let o=n/this.zoomStart;this.coords.panDelta.subVectors(this.coords.floorAnchor,this.coords.panCameraStart).multiplyScalar(1-o),this.setPosition(this.coords.panCameraStart.x+this.coords.panDelta.x,this.coords.panCameraStart.y+this.coords.panDelta.y)}this.publish("change")},"handleMouseWheel"));d(this,"setCameraFromTransformMatrix",a(t=>{this.orbit.updateMatrixWorld();let i=new Xt;i.setFromRotationMatrix(t,"ZYX");let n=(t.elements[14]-this.cameraPlane.position.z)/Math.cos(i.x),o=i.z,s=new z(0,0,1);s.applyEuler(i),s.setLength(n);let l=new z;l.setFromMatrixPosition(t),l.sub(s),this.enablePan&&this.setPosition(l.x,l.y),this.enableZoom&&this.setZoomAltitude(n),this.enableRotate&&this.setRotation(-o)},"setCameraFromTransformMatrix"));d(this,"makeTransformFromTouchAnchors",a((t,i)=>{this.orbit.updateMatrixWorld(),this.camera.updateProjectionMatrix();let n=this.camera.projectionMatrix.clone(),o=t.worldCoordinate,s=i.worldCoordinate,l=t.reUnproject(),h=i.reUnproject();if(!l||!h||!o||!s)return null;let p=t.viewCoordinate,m=i.viewCoordinate,f=s.x-o.x,v=s.y-o.y,y=Math.atan2(v,f),C=h.x-l.x,M=h.y-l.y,g=Math.atan2(M,C),b=bd(y,g),P=new ot;P.makeRotationZ(-b);let S=P.clone();S.multiply(t.snapHolderMatrix);let T=a((of,sf,af)=>of.elements[(sf-1)*4+af-1],"m"),_=T(n,1,1)*T(S,1,1)-p.x*T(n,3,4)*T(S,3,1),R=T(n,1,1)*T(S,1,2)-p.x*T(n,3,4)*T(S,3,2),A=T(n,1,1)*T(S,1,3)-p.x*T(n,3,4)*T(S,3,3),k=o.x*_+o.y*R+o.z*A,F=T(n,2,2)*T(S,2,1)-p.y*T(n,3,4)*T(S,3,1),G=T(n,2,2)*T(S,2,2)-p.y*T(n,3,4)*T(S,3,2),O=T(n,2,2)*T(S,2,3)-p.y*T(n,3,4)*T(S,3,3),X=o.x*F+o.y*G+o.z*O,Z=T(n,1,1)*T(S,1,1)-m.x*T(n,3,4)*T(S,3,1),J=T(n,1,1)*T(S,1,2)-m.x*T(n,3,4)*T(S,3,2),re=T(n,1,1)*T(S,1,3)-m.x*T(n,3,4)*T(S,3,3),$=s.x*Z+s.y*J+s.z*re,ve=T(n,2,2)*T(S,2,1)-m.y*T(n,3,4)*T(S,3,1),ue=T(n,2,2)*T(S,2,2)-m.y*T(n,3,4)*T(S,3,2),le=T(n,2,2)*T(S,2,3)-m.y*T(n,3,4)*T(S,3,3),ce=s.x*ve+s.y*ue+s.z*le,ze=Math.abs(Z-_),Ie=Math.abs(J-R),Le=Math.abs(re-A),De=Math.abs(Z-F),xe=Math.abs(J-G),qe=Math.abs(re-O),We=Math.abs(ve-_),at=Math.abs(ue-R),er=Math.abs(le-A),nt=Math.abs(ve-F),H=Math.abs(ue-G),j=Math.abs(le-O),Se=Math.min(ze+Ie+Le,De+xe+qe),Je=Math.min(We+at+er,nt+H+j);Se<Je&&(Z=ve,J=ue,re=le,$=ce);let Ye=F*A-_*O,Pt=G*A-R*O,Gt=X*A-k*O,Hi=Z*O-F*re,Wi=J*O-G*re,rc=$*O-X*re,Qm=(rc*Pt-Gt*Wi)/(Hi*Pt-Ye*Wi),ef=(rc*Ye-Gt*Hi)/(Wi*Ye-Pt*Hi),ic=G*_-R*F,tf=O*_-A*F,rf=X*_-k*F,nc=J*F-G*Z,nf=re*F-O*Z,oc=(($*F-X*Z)*ic-rf*nc)/(nf*ic-tf*nc),so=S.clone();return so.elements[12]=Qm,so.elements[13]=ef,so.elements[14]=oc,oc>0?so:null},"makeTransformFromTouchAnchors"));d(this,"updateTouchOrigin",a(()=>{let t=this.renderer.domElement;this.touch.origin.offsetLeft=t.getBoundingClientRect().left,this.touch.origin.offsetTop=t.getBoundingClientRect().top},"updateTouchOrigin"));d(this,"touchToScene",a(t=>{this.touch.touches=[];for(let i=0,n=t.touches.length;i<n;i++){let o=t.touches[i],s=vd(o,this.touch.origin);this.touch.touches.push(new K(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]},"touchToScene"));d(this,"canScrollZoom",a(t=>{let i=Ol(t),n=this.getZoomAltitude();return!(i<0&&n===this.getZoomScaledMax()||i>0&&n===this.getZoomScaledMin())},"canScrollZoom"));d(this,"mouseToScene",a(t=>{let i=this.getMousePos(t);return this.coords.mouse.x=i.x/this.renderer.domElement.width*this.rendererState.pixelRatio*2-1,this.coords.mouse.y=-(i.y/this.renderer.domElement.height*this.rendererState.pixelRatio)*2+1,this.coords.mouse},"mouseToScene"));d(this,"getMousePos",a(t=>({x:t.offsetX,y:t.offsetY}),"getMousePos"));d(this,"handleMouseDownRotate",a(t=>{this.coords.rotateStart.set(t.clientX,t.clientY),this.publish("rotate-start"),this.publish("user-rotate-start")},"handleMouseDownRotate"));d(this,"handleMouseDownPan",a(()=>{let t=this.raycastToFloor(this.coords.mouse);this.coords.panStart.set(t.x,t.y,0),this.coords.panCameraStart.set(this.orbit.position.x,this.orbit.position.y,0),this.publish("pan-start"),this.publish("user-pan-start")},"handleMouseDownPan"));d(this,"handleMouseDownPedestal",a(t=>{let i=new K(t.clientX,t.clientY);this.coords.initialShiftPos=i,this.coords.initialPedestal=this.getPedestal(),this.pedestalScaleFactor=Da(this.camera.fov,this.renderer.domElement.clientHeight,this.getZoomAltitude()),this.publish("pedestal-start"),this.publish("user-pedestal-start")},"handleMouseDownPedestal"));d(this,"handleMouseMovePedestal",a(t=>{let i={x:t.clientX,y:t.clientY},n=this.coords.initialPedestal+this.pedestalScaleFactor*(i.y-this.coords.initialShiftPos.y);this.stayInsideBounds&&(n<this.minPedestal?n=Math.max(n,this.minPedestal):n>this.maxPedestal&&(n=Math.min(n,this.maxPedestal))),n!==this.getPedestal()&&this.setPedestal(n,!0)},"handleMouseMovePedestal"));d(this,"handleMouseMoveRotate",a(t=>{this.coords.rotateEnd.set(t.clientX,t.clientY),this.coords.rotateDelta.subVectors(this.coords.rotateEnd,this.coords.rotateStart),this.setRotation(this.getRotation()+this.coords.rotateDelta.x/this.rotateSpeed),this.setTilt(this.getTilt()-this.coords.rotateDelta.y/this.rotateSpeed),this.coords.rotateStart.copy(this.coords.rotateEnd),this.publish("change")},"handleMouseMoveRotate"));d(this,"publishUserZoomDebounced",qi(()=>{this.isUserZooming=!1,this.publish("user-zoom-end")},250));d(this,"publishUserZoomEvent",a(()=>{this.isUserZooming?this.publishUserZoomDebounced():(this.publish("user-zoom-start"),this.isUserZooming=!0,this.publishUserZoomDebounced())},"publishUserZoomEvent"));d(this,"setCameraMoving",a(()=>{this.cameraMoving=!0},"setCameraMoving"));d(this,"unsetCameraMoving",a(()=>{this.cameraMoving=!1,this.lastCameraMoveTime=Date.now()},"unsetCameraMoving"));d(this,"setUserInteracting",a(()=>{this.userInteracting=!0},"setUserInteracting"));d(this,"unsetUserInteracting",a(()=>{this.userInteracting=!1},"unsetUserInteracting"));d(this,"publishPedestalChangeEvent",a(t=>{this.publish("pedestal-change",{pedestal:t,scrolledToTop:this.scrolledToTop,scrolledToBottom:this.scrolledToBottom,scrollPercent:this.scrollPercent})},"publishPedestalChangeEvent"));d(this,"convertAltitudeToZoomLevel",a(t=>{let[,i]=this.center,o=t*2*Math.tan(ee.degToRad(this.camera.fov)/2)/this.options.canvasHeight,s=Math.cos(ee.degToRad(i))*2*Math.PI*Ma/o;return ee.clamp(Math.log2(s/512),ls,us)},"convertAltitudeToZoomLevel"));d(this,"convertZoomLevelToAltitude",a(t=>{let[,i]=this.center,n=ee.clamp(t,ls,us),o=Math.pow(2,n),s=ee.clamp(i,Rl,kl),l=o*512;return Math.cos(ee.degToRad(s))*Math.PI*2*Ma/l*this.options.canvasHeight/2/Math.tan(ee.degToRad(this.camera.fov)/2)},"convertZoomLevelToAltitude"));d(this,"completeTween",a(t=>{t.isPlaying()&&t.stop(),this.rendererState.internalTweenGroup.remove(t),this.tweens.delete(t)},"completeTween"));d(this,"debugContainer",new zt);this.camera=t,this.renderer=n,this.rendererState=o,this.scene=i,this.options=s,this.elevation=t.parent,this.orbit=this.elevation.parent,this.cameraPlane=this.createCameraPlane(),this.zoomStart=t.position.z,s.mode!=="outdoors-overlay"&&this.addEventListeners()}get maxZoomLevel(){return this.convertAltitudeToZoomLevel(this.minZoomAltitude)}setMaxZoomLevel(t){this.minZoomAltitude=this.convertZoomLevelToAltitude(t),this.stateDirty=!0}get defaultMinZoomLevel(){return u(this,ps)}get minZoomLevel(){return this.convertAltitudeToZoomLevel(this.maxZoomAltitude)}setMinZoomLevel(t){this.maxZoomAltitude=this.convertZoomLevelToAltitude(t),this.stateDirty=!0}get scrollPercent(){let t=this.minPedestal,i=this.maxPedestal,n=this.getPedestal();return n=Math.min(n,i),n=Math.max(n,t),(n-t)/(i-t)*100}get fov(){return this.camera.fov}get scrolledToBottom(){return this.minPedestal===0||Math.floor(this.getPedestal())<=this.minPedestal}get scrolledToTop(){return this.maxPedestal===0||Math.ceil(this.getPedestal())>=this.maxPedestal}get center(){var o,s,l,h;let t=this.getPosition(),{lat:i,lon:n}=_o((s=(o=this.rendererState.center)==null?void 0:o[1])!=null?s:0,(h=(l=this.rendererState.center)==null?void 0:l[0])!=null?h:0,t.x,t.y);return[n,i]}setCenter(t,i){var s,l,h,p;let{x:n,y:o}=wo((l=(s=this.rendererState.center)==null?void 0:s[1])!=null?l:0,(p=(h=this.rendererState.center)==null?void 0:h[0])!=null?p:0,i,t);this.setPosition(n,o)}get isAnimating(){return this.rendererState.internalTweenGroup.getAll().some(t=>t.cameraAnimation)}getCameraFrameForCoordinates(t,i){let n=i.minZoom!==void 0?i.minZoom:this.minZoomAltitude,o=i.maxZoom!==void 0?i.maxZoom:this.maxZoomAltitude,s=this.options.canvasWidth,l=this.options.canvasHeight,h=this.getRotation(),p=this.getTilt(),m=this.getPosition();this.setRotation(i.rotation||h,!0),this.setTilt(i.tilt||p,!0);let f=Sd(t,{canvasWidth:s,canvasHeight:l,paddingOption:i.padding,verticalPadding:i.verticalPadding,minZoom:n,maxZoom:o,position:m,camera:this.camera,orbit:this.orbit});return this.setRotation(h,!0),this.setTilt(p,!0),{center:f.position,zoomLevel:this.convertAltitudeToZoomLevel(f.zoom)}}focusOn(t,i){if(o0){this.debugContainer&&Ee(this.debugContainer);let g=new rr(4,4,4),b=new je({color:65280,depthTest:!1}),P=new sr(g,b,t.length),S=new ot;t.forEach((T,_)=>{S.setPosition(T),P.setMatrixAt(_,S)}),P.instanceMatrix.needsUpdate=!0,this.debugContainer.add(P),this.scene.add(this.debugContainer)}let n=i.curve,o=i.callback,s=i.cancelledCallback,l=i.minZoom!==void 0?i.minZoom:this.minZoomAltitude,h=i.maxZoom!==void 0?i.maxZoom:this.maxZoomAltitude,p=this.options.canvasWidth,m=this.options.canvasHeight,f;i.duration!==void 0?f=i.duration:D.env.TESTING==="true"?f=0:f=Fl;let v=i.padding,y=this.getRotation(),C=this.getTilt();i.rotation!=null&&this.setRotation(i.rotation),i.tilt!=null&&this.setTilt(i.tilt);let M=Sd(t,{canvasHeight:m,paddingOption:v,canvasWidth:p,minZoom:l,maxZoom:h,camera:this.camera,orbit:this.orbit,position:this.getPosition(),verticalPadding:i.verticalPadding});this.setRotation(y),this.setTilt(C),this.animateCamera({position:M.position,tilt:i.tilt,rotation:i.rotation,zoom:M.zoom},f,n,o,s,i)}resize(t,i){this.options.canvasWidth=t,this.options.canvasHeight=i}};ps=new WeakMap,a(ds,"CameraSystem"),d(ds,"CAMERA_FRAME_PADDING_SIDES",["top","bottom","left","right"]);var Ei=ds;function Sd(e,{canvasWidth:r,orbit:t,paddingOption:i,verticalPadding:n=0,canvasHeight:o,minZoom:s,maxZoom:l,camera:h,position:p}){let m={zoom:s,position:p};if(e.length===0)return m;for(let Ye of Ei.CAMERA_FRAME_PADDING_SIDES)typeof i[Ye]!="number"&&(i[Ye]=0);let f=i.type==="portion"?{top:i.top*o,bottom:i.bottom*o,left:i.left*r,right:i.right*r,type:"pixel"}:i;if(f.left+f.right>=r||f.top+f.bottom>=o)return m;t.updateMatrixWorld();let v=h.matrixWorldInverse,y=h.fov*(Math.PI/180)/2,C=y,g=Math.atan(Math.tan(y)*(r/o)),b=new z(1/0,1/0,1/0),P=new z(-1/0,-1/0,-1/0),S=new Ue,T=new z;for(let Ye=0,Pt=e.length;Ye<Pt;Ye++)T.copy(e[Ye]),S.expandByPoint(T),T.applyMatrix4(v),b.min(T),P.max(T),T.copy(e[Ye]),T.z-=n,T.applyMatrix4(v),b.min(T),P.max(T),T.copy(e[Ye]),T.z+=n,T.applyMatrix4(v),b.min(T),P.max(T);let _=P.x-b.x,R=P.y-b.y,A=r-f.left-f.right,k=o-f.top-f.bottom,F=(P.x+b.x)/2,G=(P.y+b.y)/2,O=_/A,X=R/k,Z=s,J=l,re=Z*Math.tan(g)*2,$=J*Math.tan(g)*2,ve=re/r,ue=$/r,le=Math.max(O,X);le=ee.clamp(le,ve,ue);let ce=A*le,ze=k*le,Ie={min:{x:F-ce/2-f.left*le,y:G-ze/2-f.bottom*le},max:{x:F+ce/2+f.right*le,y:G+ze/2+f.top*le}},Le=(Ie.min.x+Ie.max.x)/2,De=(Ie.min.y+Ie.max.y)/2,xe=S.getCenter(new z),qe=Math.abs(Le-Ie.min.x),We=Math.abs(De-Ie.min.y),at=qe/Math.tan(g),er=We/Math.tan(C),nt=new z;nt.set(Le,De,P.z+Math.max(at,er)),nt.applyMatrix4(h.matrixWorld);let H=new z;H.set(Le,De,P.z),H.applyMatrix4(h.matrixWorld);let j=new z().subVectors(H,nt),Se=(xe.z-nt.z)/j.z,Je=new z().copy(nt).add(j.clone().multiplyScalar(Se));return H.set(Je.x,Je.y,Je.z),nt.sub(H),{position:Je,zoom:nt.length()}}a(Sd,"getCameraFrameForPoints");var s0=0,a0=90,l0=(D.env.NODE_ENV==="test",!1),ms={linear:ht.Linear.None,"ease-in":ht.Quadratic.In,"ease-out":ht.Quadratic.Out,"ease-in-out":ht.Quadratic.InOut},u0=-50,U,V,Jt,vn,xn,zl,Yl=class Yl{constructor(r,t,i){L(this,xn);L(this,U);L(this,V);L(this,Jt);L(this,vn);B(this,U,r),B(this,V,t),B(this,Jt,i),u(this,U).map&&u(this,U).map.transform.setMinElevationForCurrentTile(u0),u(this,V).cameraSystem.on("pedestal-change",({pedestal:n})=>{u(this,V).cameraSystem.setCameraPlaneElevation(n)})}get center(){var r,t;return u(this,U).mode==="outdoors-overlay"&&u(this,U).map?(t=(r=u(this,U).map).getCenter)==null?void 0:t.call(r).toArray():u(this,V).cameraSystem.center}setCenter(r){var t;if(u(this,U).mode==="outdoors-overlay"&&u(this,U).map){(t=u(this,U).map)==null||t.setCenter(r),u(this,V).interactionSystem.handleHover();return}u(this,V).cameraSystem.setCenter(r[0],r[1]),u(this,V).interactionSystem.handleHover()}get zoomLevel(){var r;return u(this,U).mode==="outdoors-overlay"&&u(this,U).map?(r=u(this,U).map)==null?void 0:r.getZoom():u(this,V).cameraSystem.getZoomLevel()}setZoomLevel(r){var t;u(this,U).mode==="outdoors-overlay"&&u(this,U).map&&((t=u(this,U).map)==null||t.setZoom(r)),u(this,V).cameraSystem.setZoomLevel(_t(r,this.minZoomLevel,this.maxZoomLevel,"zoomLevel was clamped to minZoomLevel/maxZoomLevel bounds. Use mapView.Camera.setMinZoomLevel() and mapView.Camera.setMaxZoomLevel() to adjust limits."))}getState(){return{zoomLevel:this.zoomLevel,minZoomLevel:this.minZoomLevel,maxZoomLevel:this.maxZoomLevel,minPitch:this.minPitch,maxPitch:this.maxPitch,autoMinZoomLevel:this.autoMinZoomLevel,panMode:this.panMode,screenOffsets:this.insetsPadding,center:this.center,bearing:this.bearing,pitch:this.pitch,elevation:this.elevation}}get isAnimating(){return u(this,V).cameraSystem.isAnimating}cancelAnimation(){u(this,V).cameraSystem.cancelAnimation()}get maxZoomLevel(){return u(this,V).cameraSystem.maxZoomLevel}get minZoomLevel(){return u(this,V).cameraSystem.minZoomLevel}setAutoMinZoomLevel(r){u(this,V).panBoundsSystem.autoMinZoomLevel=r,r&&(u(this,V).panBoundsSystem.dirty=!0,u(this,V).panBoundsSystem.update())}get autoMinZoomLevel(){return u(this,V).panBoundsSystem.autoMinZoomLevel}setMinZoomLevel(r,t=!1){var n;t&&this.setAutoMinZoomLevel(!1);let i=_t(r,pt.MIN_MERCATOR_ZOOM_LEVEL,this.maxZoomLevel,"setMinZoomLevel was clamped. minZoomLevel must be between ".concat(pt.MIN_MERCATOR_ZOOM_LEVEL," and maxZoomLevel."));u(this,V).cameraSystem.setMinZoomLevel(i),this.zoomLevel<i&&this.setZoomLevel(i),(n=u(this,U).map)==null||n.setMinZoom(i)}setMaxZoomLevel(r){var i;let t=_t(r,this.minZoomLevel,pt.MAX_MERCATOR_ZOOM_LEVEL,"setMaxZoomLevel was clamped. maxZoomLevel must be between minZoomLevel and ".concat(pt.MAX_MERCATOR_ZOOM_LEVEL,"."));u(this,V).cameraSystem.setMaxZoomLevel(t),this.zoomLevel>t&&this.setZoomLevel(t),(i=u(this,U).map)==null||i.setMaxZoom(t)}get maxPitch(){var r,t;return u(this,U).mode==="outdoors-overlay"&&u(this,U).map?(t=(r=u(this,U).map)==null?void 0:r.getMaxPitch)==null?void 0:t.call(r):ee.radToDeg(u(this,V).cameraSystem.maxTilt)}get minPitch(){var r,t;return u(this,U).mode==="outdoors-overlay"&&u(this,U).map?(t=(r=u(this,U).map)==null?void 0:r.getMinPitch)==null?void 0:t.call(r):ee.radToDeg(u(this,V).cameraSystem.minTilt)}setMinPitch(r){var i;let t=Math.max(s0,r);(i=u(this,U).map)==null||i.setMinPitch(t),u(this,V).cameraSystem.minTilt=ee.degToRad(t)}setMaxPitch(r){var i;let t=Math.min(a0,r);(i=u(this,U).map)==null||i.setMaxPitch(t),u(this,V).cameraSystem.maxTilt=ee.degToRad(t)}get bearing(){var r;return u(this,U).mode==="outdoors-overlay"&&u(this,U).map?(r=u(this,U).map)==null?void 0:r.getBearing():ee.radToDeg(u(this,V).cameraSystem.getRotation())}setBearing(r){var t;if(u(this,U).mode==="outdoors-overlay"&&u(this,U).map){(t=u(this,U).map)==null||t.setBearing(r);return}u(this,V).cameraSystem.setRotation(ee.degToRad(r))}get pitch(){var r;return u(this,U).mode==="outdoors-overlay"&&u(this,U).map?(r=u(this,U).map)==null?void 0:r.getPitch():ee.radToDeg(u(this,V).cameraSystem.getTilt())}setPitch(r){var t;if(u(this,U).mode==="outdoors-overlay"&&u(this,U).map){(t=u(this,U).map)==null||t.setPitch(r);return}u(this,V).cameraSystem.setTilt(ee.degToRad(_t(r,this.minPitch,this.maxPitch,"pitch was clamped to minPitch/maxPitch bounds. Use mapView.Camera.setMinPitch() and mapView.Camera.setMaxPitch() to adjust limits.")))}get elevation(){return u(this,V).cameraSystem.getPedestal()}setElevation(r){u(this,V).cameraSystem.setPedestal(r,!0)}animateElevation(r,t){return u(this,vn)&&u(this,vn).stop(),new Promise(i=>{var n;u(this,V).cameraSystem.animateCamera({position:{z:r}},(t==null?void 0:t.duration)||300,ms[(t==null?void 0:t.easing)||"ease-in-out"],i,i,{interruptible:(n=t==null?void 0:t.interruptible)!=null?n:!0})})}get insetsPadding(){return u(this,Jt).insetsPadding}get panMode(){return u(this,V).cameraSystem.enablePan===!1&&u(this,V).cameraSystem.enablePedestal===!0?"elevation":"default"}setPanMode(r){if(r!=="default"&&r!=="elevation")throw new Error("Invalid pan mode");r!==this.panMode&&(r==="default"?(u(this,V).cameraSystem.enablePan=!0,u(this,V).cameraSystem.enablePedestal=!1):(u(this,V).cameraSystem.enablePan=!1,u(this,V).cameraSystem.enablePedestal=!0))}setInsetPadding(r){u(this,Jt).insetsPadding=Object.assign({},u(this,Jt).insetsPadding,r)}animateTo(r){var s,l,h,p,m,f;if(u(this,U).mode==="outdoors-overlay"&&u(this,U).map)return(f=u(this,U).map)==null||f.flyTo({center:(s=r.center)!=null?s:this.center,zoom:(l=r.zoomLevel)!=null?l:this.zoomLevel,bearing:(h=r.bearing)!=null?h:this.bearing,pitch:(p=r.pitch)!=null?p:this.pitch,duration:(m=r.duration)!=null?m:600}),Promise.resolve();let t=r.center?u(this,U).convertTo3DMapPosition(r.center[1],r.center[0],r.center[2]||this.elevation):void 0,i=r.zoomLevel!==void 0?u(this,V).cameraSystem.convertZoomLevelToAltitude(_t(r.zoomLevel,this.minZoomLevel,this.maxZoomLevel,"zoomLevel was clamped to minZoomLevel/maxZoomLevel bounds. Use mapView.Camera.setMinZoomLevel() and mapView.Camera.setMaxZoomLevel() to adjust limits.")):void 0,n=r.bearing!==void 0?ee.degToRad(r.bearing):void 0,o=r.pitch!==void 0?ee.degToRad(_t(r.pitch,this.minPitch,this.maxPitch,"pitch was clamped to minPitch/maxPitch bounds. Use mapView.Camera.setMinPitch() and mapView.Camera.setMaxPitch() to adjust limits.")):void 0;return new Promise(v=>{var y;u(this,V).cameraSystem.animateCamera({position:t,zoom:i,rotation:n,tilt:o},r.duration||0,ms[r.easing||"ease-in-out"],()=>{u(this,V).interactionSystem.handleHover(),v()},v,{interruptible:(y=r==null?void 0:r.interruptible)!=null?y:!0})})}getCameraFrameForCoordinates(r,t){let i=Te(this,xn,zl).call(this,t||{},()=>Promise.resolve()),{pointCloud:n}=Cd(r,u(this,U),u(this,Jt).geometry3DMap);if(n.length===0)return q.error("No valid coordinates found in targets:",r),{center:this.center,zoomLevel:this.zoomLevel};let{center:o,zoomLevel:s}=u(this,V).cameraSystem.getCameraFrameForCoordinates(n,i);return{center:u(this,U).convert3DMapPositionToCoordinate(o),zoomLevel:s}}focusOn(r,t){var s,l,h,p;let{pointCloud:i,geoBounds:n,firstPosition:o}=Cd(r,u(this,U),u(this,Jt).geometry3DMap);return i.length===0?(q.error("No valid coordinates found in targets:",r),Promise.resolve()):u(this,U).mode==="outdoors-overlay"&&u(this,U).map?(i.length===1&&o?(s=u(this,U).map)==null||s.flyTo({center:[o[0],o[1]],duration:(t==null?void 0:t.duration)||u(this,U).map.getBearing(),animate:!0,bearing:(t==null?void 0:t.bearing)===void 0?u(this,U).map.getBearing():t==null?void 0:t.bearing,pitch:(t==null?void 0:t.pitch)===void 0?u(this,U).map.getPitch():t==null?void 0:t.pitch,zoom:(t==null?void 0:t.maxZoomLevel)||u(this,U).map.getMaxZoom()}):(l0&&c0(u(this,U),n),(p=u(this,U).map)==null||p.fitBounds(n,{duration:(l=t==null?void 0:t.duration)!=null?l:pt.DEFAULT_ANIMATION_DURATION,bearing:(t==null?void 0:t.bearing)===void 0?u(this,U).map.getBearing():t==null?void 0:t.bearing,pitch:(t==null?void 0:t.pitch)===void 0?u(this,U).map.getPitch():t==null?void 0:t.pitch,maxZoom:(h=t==null?void 0:t.maxZoomLevel)!=null?h:u(this,U).map.getMaxZoom()})),u(this,V).interactionSystem.handleHover(),Promise.resolve()):new Promise(m=>{u(this,V).cameraSystem.focusOn(i,Te(this,xn,zl).call(this,t||{},m))})}};U=new WeakMap,V=new WeakMap,Jt=new WeakMap,vn=new WeakMap,xn=new WeakSet,zl=a(function(r,t){var i;return{minZoom:(r==null?void 0:r.maxZoomLevel)===void 0?void 0:u(this,V).cameraSystem.convertZoomLevelToAltitude(_t(r.maxZoomLevel,this.minZoomLevel,this.maxZoomLevel,"maxZoomLevel was clamped to minZoomLevel/maxZoomLevel bounds. Use mapView.Camera.setMaxZoomLevel() to adjust limits.")),maxZoom:(r==null?void 0:r.minZoomLevel)===void 0?void 0:u(this,V).cameraSystem.convertZoomLevelToAltitude(_t(r.minZoomLevel,this.minZoomLevel,this.maxZoomLevel,"minZoomLevel was clamped to minZoomLevel/maxZoomLevel bounds. Use mapView.Camera.setMinZoomLevel() to adjust limits.")),padding:r!=null&&r.padding?Object.assign({},Po,r==null?void 0:r.padding):this.insetsPadding,curve:ms[(r==null?void 0:r.easing)||"ease-in-out"],rotation:(r==null?void 0:r.bearing)===void 0?void 0:ee.degToRad(r.bearing),tilt:(r==null?void 0:r.pitch)!==void 0?ee.degToRad(_t(r.pitch,this.minPitch,this.maxPitch,"pitch was clamped to minPitch/maxPitch bounds. Use mapView.Camera.setMinPitch() and mapView.Camera.setMaxPitch() to adjust limits.")):void 0,duration:r==null?void 0:r.duration,callback:a(()=>{u(this,V).interactionSystem.handleHover(),t()},"callback"),cancelledCallback:t,interruptible:(i=r==null?void 0:r.interruptible)!=null?i:!0,verticalPadding:r==null?void 0:r.verticalPadding}},"#convertToLegacy"),a(Yl,"Camera");var fs=Yl;function Xl(e,r){e[0]=Math.min(e[0],r[0]),e[1]=Math.min(e[1],r[1]),e[2]=Math.max(e[2],r[0]),e[3]=Math.max(e[3],r[1])}a(Xl,"updateBounds");function Cd(e,r,t){var l;let i=[],n=[1/0,1/0,-1/0,-1/0],o=null;if(!e||!Array.isArray(e)||e.length===0)return{pointCloud:i,geoBounds:n,firstPosition:o};let s=r.getSystems().renderSystem;(s.threeDdirty||s.twoDdirty)&&r.renderSync();for(let h of e)if(typeof h=="string"){let p=t.get(h);if(!p){q.error("Entity not found with id:",h);continue}let m=new Ue;Uc(r,"userData"in p&&(l=p.userData.entityId)!=null?l:p.id,i,m,p instanceof me?p.position.z:void 0);let f=r.convert3DMapPositionToCoordinate(m.min),v=r.convert3DMapPositionToCoordinate(m.max);Xl(n,f),Xl(n,v),o||(o=r.convert3DMapPositionToCoordinate(m.getCenter(new z)))}else i.push(r.convertTo3DMapPosition(h[1],h[0],h[2]||0)),Xl(n,h),o||(o=h);return{pointCloud:i,geoBounds:n,firstPosition:o}}a(Cd,"processTargets");function c0(e,r){var i,n,o,s;let t=[[r[0],r[1]],[r[0],r[3]],[r[2],r[3]],[r[2],r[1]],[r[0],r[1]]];(i=e.map)!=null&&i.getLayer("bounds-outline")&&e.map.removeLayer("bounds-outline"),(n=e.map)!=null&&n.getSource("bounds-source")&&e.map.removeSource("bounds-source"),(o=e.map)==null||o.addSource("bounds-source",{type:"geojson",data:{type:"Feature",properties:{},geometry:{type:"LineString",coordinates:t}}}),(s=e.map)==null||s.addLayer({id:"bounds-outline",type:"line",source:"bounds-source",layout:{},paint:{"line-color":"#FF0000","line-width":2,"line-opacity":.8}})}a(c0,"drawBounds");var Zl="";var Hr=!1,h0=150,Hl=class Hl extends ie{constructor(t,i,n=!0){super();d(this,"worker");d(this,"debugContext");d(this,"debugCanvas");d(this,"collidersDirty",!0);d(this,"packedMessage",[[],0,0,0,0,0,"bottom-left"]);d(this,"visibleCollidersQTree",new ct(new he(0,0,0,0)));d(this,"interactiveCollidersQTree",new ct(new he(0,0,0,0)));d(this,"coreState");d(this,"postMessage");d(this,"showCollisionBoxes",a(()=>{Hr=!0,this.debugCanvas.style.display="block"},"showCollisionBoxes"));d(this,"hideCollisionBoxes",a(()=>{Hr=!1,this.debugContext.clearRect(0,0,this.debugCanvas.width,this.debugCanvas.height),this.debugCanvas.style.display="none"},"hideCollisionBoxes"));d(this,"currentMsgId","");d(this,"working",!1);d(this,"_postMessage",a(()=>{this.worker.postMessage(this.packedMessage)},"_postMessage"));d(this,"componentArray",[]);d(this,"update",a((t,i,n="bottom-left",o=!1)=>{let s=!1;if(this.collidersDirty){this.packedMessage=[[],0,0,0,0,0,"bottom-left"],this.componentArray=[];let l;for(let h of this.coreState.geometry2DIdsInScene){let p=this.coreState.geometry2DMap.get(h);p&&(l=p.components[0],this.componentArray.push(l))}this.resize(t,i,n),this.collidersDirty=!1,s=!0}else s=this.componentArray.some(l=>l.collisionDirty===!0);s&&this.componentArray.sort((l,h)=>h.rank-l.rank);for(let l=0;l<this.componentArray.length;l++)if(this.packedMessage){let h=this.componentArray[l].toPackedMessage(o&&!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]=h.bboxes,this.packedMessage[0][l][1]=h.enabled&&this.componentArray[l].visible&&!this.componentArray[l].isOccluded?1:0,this.packedMessage[0][l][2]=h.rank===kr?1:0,this.packedMessage[0][l][3]=h.x,this.packedMessage[0][l][4]=h.y,this.packedMessage[0][l][5]=h.shouldCollideWithScreenEdges?1:0,this.packedMessage[0][l][6]=h.lockedToStrategyIndex}this.working||this.postMessage()},"update"));d(this,"resolve",a(t=>{if(this.working=!1,this.collidersDirty||!t.data)return;let i=t.data.colliders,n=-1,o,s,l;Hr&&(this.visibleCollidersQTree=new ct(new he(0,0,this.debugCanvas.width,this.debugCanvas.height))),this.interactiveCollidersQTree=new ct(new he(0,0,this.debugCanvas.width,this.debugCanvas.height));for(let h=0;h<this.componentArray.length;h++){let p=this.componentArray[h];i[h]!=null&&(n=i[h][0],o=i[h][2],p.offscreen=i[h][1]===1,n!==-1&&o!=null?(l=new he(o.x,o.y,o.w,o.h,{entityId:p.id}),Hr&&this.visibleCollidersQTree.insert(l),s=this.coreState.geometry2DMap.get(p.id),(s==null?void 0:s.components[1])!=null&&this.interactiveCollidersQTree.insert(new he(o.x,o.y,o.w,o.h,{entityId:p.id})),(p.canShow===!1||p.visibilityNeedsUpdate!==!1)&&"visibilityNeedsUpdate"in p&&(p.visibilityNeedsUpdate="show"),n!==-1&&n!==p.currentStrategyIndex&&(p.activeBoundingBox=l,p.onStrategySelected(n))):((p.canShow===!0||p.visibilityNeedsUpdate!==!1)&&"visibilityNeedsUpdate"in p&&(p.visibilityNeedsUpdate="hide"),n!==-1&&n!==p.currentStrategyIndex&&p.onStrategySelected(n)))}Hr&&this.drawDebug(),this.publish("visibility-changed")},"resolve"));d(this,"drawDebug",a(()=>{Hr&&this.visibleCollidersQTree&&(this.debugContext.clearRect(0,0,this.debugCanvas.width,this.debugCanvas.height),this.debugContext.beginPath(),this.visibleCollidersQTree.drawObjects(this.debugContext))},"drawDebug"));d(this,"destroy",a(()=>{this.worker.terminate()},"destroy"));this.worker=n===!1?new Lo:Zl!==""?new Worker(Zl):new Worker(URL.createObjectURL(new Blob([ih],{type:"text/javascript"}))),this.coreState=i,this.debugCanvas=t,this.debugContext=t.getContext("2d"),this.worker.onmessage=o=>this.resolve(o),this.postMessage=ch(this._postMessage,h0,!1),Hr?this.showCollisionBoxes():this.hideCollisionBoxes()}resize(t,i,n){this.packedMessage[6]=n,this.packedMessage[5]=i,this.packedMessage[4]=t,this.packedMessage[3]=this.debugCanvas.width,this.packedMessage[2]=this.debugCanvas.height}};a(Hl,"CollisionSystem");var ys=Hl;x();x();x();x();var jl=class jl{constructor(r){d(this,"type");d(this,"event");this.type=0,this.event=r}get timestamp(){return this.event.timeStamp}};a(jl,"Tap");var gs=jl,Vl=class Vl{constructor(){d(this,"taps",[])}add(r){this.lastPointerDown&&r.timestamp-this.lastPointerDown.timestamp<50?this.lastPointerDown.type=1:this.taps.push(r)}get lastPointerDown(){return this.taps.length>=1?this.taps[this.taps.length-1]:void 0}get isSingleTapWithTwoFingers(){var r;return this.isSingleTap&&((r=this.lastPointerDown)==null?void 0:r.type)===1}get isSingleTapWithOneFinger(){var r;return this.isSingleTap&&((r=this.lastPointerDown)==null?void 0:r.type)===0}get isDoubleTapWithOneFinger(){var r,t;return this.isDoubleTap&&((r=this.taps[0])==null?void 0:r.type)===0&&((t=this.taps[1])==null?void 0:t.type)===0}get isSingleTap(){return this.taps.length===1}get isDoubleTap(){return this.taps.length===2}discardOutsideOfWaitWindow(r){this.taps=this.taps.filter(t=>r-t.timestamp<300)}flush(){this.taps=[]}get _taps(){return this.taps}destroy(){this.flush()}};a(Vl,"TapsController");var bs=Vl;x();function ql(e){let r=new Set;for(let t of e){let i=t.object;for(;i.visible&&i.parent&&i.parent.visible===!0&&!r.has(i.parent);)i=i.parent,i instanceof me&&i.type==="group-container"&&i.visible&&i.components[0]&&r.add(i)}return Array.from(r)}a(ql,"getUniqueIntersectedGroupContainers");var Di,Jl=class Jl extends ie{constructor(t,i,n,o,s){super();d(this,"raycaster",new Mt);d(this,"state",{hovered3DEntity:void 0,hovered2DEntity:void 0,hovered3DContainers:void 0,lastHover:void 0,interaction:{mouseDownStart:void 0,distanceFromMouseDown:void 0,isPanning:!1}});d(this,"coreState");d(this,"camera");d(this,"worldPlane");d(this,"_quadtree",new ct(new he(0,0,0,0)));d(this,"_container");d(this,"lastPointerEvent");d(this,"cursor","grab");d(this,"touchesCount",0);d(this,"isUserInteracting");d(this,"hasTouched",!1);L(this,Di);d(this,"onPointerMoveRaf",a(t=>{this.lastPointerEvent=t,u(this,Di)&&cancelAnimationFrame(u(this,Di)),B(this,Di,requestAnimationFrame(()=>{this.onPointerMove(t)}))},"onPointerMoveRaf"));d(this,"onPointerMove",a(t=>{t.preventDefault(),this.updateInteractionStateIfPanning(t),(t.pointerType!=="touch"||t.pointerType===void 0&&this.hasTouched)&&this.handleHover(t),this.handleCursor()},"onPointerMove"));d(this,"tapsControl",new bs);d(this,"onPointerDown",a(t=>{t.target===this._container&&(this._container.addEventListener("pointerup",this.onPointerUp,!1),this._container.addEventListener("pointercancel",this.onPointerUp,!1),this.state.interaction.mouseDownStart={time:Date.now(),timestamp:t.timeStamp,clientX:t.clientX,clientY:t.clientY},this.lastPointerEvent=t,this.state.interaction.distanceFromMouseDown=0,this.handleCursor(),t.pointerType==="touch"&&(this.tapsControl.add(new gs(t)),this.touchesCount=Math.max(0,this.touchesCount+1)))},"onPointerDown"));d(this,"clickTimeout");d(this,"onPointerUp",a(t=>{this.tapsControl.discardOutsideOfWaitWindow(t.timeStamp),this.lastPointerEvent=t,this.touchesCount=Math.max(0,this.touchesCount-1),this.touchesCount===0&&(this._container.removeEventListener("pointerup",this.onPointerUp,!1),this._container.removeEventListener("pointercancel",this.onPointerUp,!1)),this.updateInteractionStateIfPanning(t);let{mouseDownStart:i}=this.state.interaction;!i||this.state.interaction.distanceFromMouseDown==null||(Date.now()<i.time+300&&(this.tapsControl.isSingleTapWithTwoFingers||this.state.interaction.distanceFromMouseDown<=15)&&(t.pointerType==="touch"?this.tapsControl.isSingleTapWithTwoFingers?(this.publish("singletap-with-twofinger",t),this.flush()):this.tapsControl.isSingleTapWithOneFinger&&this.touchesCount===0?(this.clickTimeout&&clearTimeout(this.clickTimeout),this.clickTimeout=window.setTimeout(()=>{this.handleClick(t),this.flush()},300)):this.tapsControl.isDoubleTapWithOneFinger&&(this.publish("doubletap-with-onefinger",t),this.flush()):this.handleClick(t)),this.state.interaction.mouseDownStart=void 0,this.state.interaction.distanceFromMouseDown=void 0,this.state.interaction.isPanning=!1,this.handleCursor())},"onPointerUp"));d(this,"dirty3D",!0);d(this,"cachedHitBoxes",{entities:[]});d(this,"ndcPoint",new K);d(this,"debugPanel");this.isUserInteracting=s,this.raycaster.layers.enableAll(),this.raycaster.layers.disable(1),this.camera=n,this._container=t,this.coreState=i,this.worldPlane=o,this._container.addEventListener("pointerdown",this.onPointerDown,!1),this._container.addEventListener("pointermove",this.onPointerMoveRaf,!1),this._container.classList.add("mappedin-interactive")}updateQuadtree(t){this._quadtree=t}setHovered3DEntityInteractionComponentDirty(){if(this.state.hovered3DEntity){let t=this.state.hovered3DEntity.components[2];t&&(t.dirty=!0)}}getThreeDIntersectsFromXY(t){this.raycaster.setFromCamera(t,this.camera),this.raycaster.layers.enable(0);let i=this.raycaster.intersectObjects(this._hitBoxes.entities,!0).filter(o=>{var s,l;return((s=o.object)==null?void 0:s.name)==="worldPlane"||((l=o.object)==null?void 0:l.visible)}),n=i.findIndex(o=>{var s;return((s=o.object)==null?void 0:s.name)==="worldPlane"});return n!==-1&&i.push(i.splice(n,1)[0]),i}getGroupContainerIntersectsFromXY(t){let i=this.getThreeDIntersectsFromXY(t),n;return i!=null&&i.length>0&&(n=ql(i)),n}flush(){this.tapsControl.flush(),this.clickTimeout!=null&&(clearTimeout(this.clickTimeout),this.clickTimeout=void 0)}handleHover(t){let i=t||this.lastPointerEvent;if(this.state.interaction.mouseDownStart||!i||this.isUserInteracting())return;let{entity3D:n,entity2D:o,position:s,groupContainers:l}=this.intersect(i);(this.detect3DEntityHover(n)||this.detect2DEntityHover(o)||this.detect3DContainerHover(l))&&(this.state.hovered3DEntity=n,this.state.lastHover=n,this.state.hovered2DEntity=o,this.state.hovered3DContainers=l,this.publish("hover",{entity2D:this.state.hovered2DEntity,entity3D:this.state.hovered3DEntity,position:s,groupContainers:l})),this.handleCursor()}handleCursor(){var s;let t=!!(this.state.hovered3DEntity&&((s=this.state.hovered3DEntity)!=null&&s.components[2])||this.state.hovered2DEntity),i=!!this.state.interaction.mouseDownStart,n=this.state.interaction.isPanning,o=m0(t,n,i);this.cursor!==o&&(this.cursor=o,o==="pointer"?this._container.classList.add("mappedin-interaction-hover"):this._container.classList.remove("mappedin-interaction-hover"))}detect2DEntityHover(t){return this.state.hovered2DEntity!==t}handleClick(t){let i=this.intersect(t);this.publish("click",{entity2D:i.entity2D,entity3D:i.entity3D,position:i.position,groupContainers:i.groupContainers,pointerEvent:{button:t.button}})}get _hitBoxes(){if(this.dirty3D){this.cachedHitBoxes.entities=[];let t;for(let i of this.coreState.geometry3DIdsInScene)t=this.coreState.geometry3DMap.get(i),((t==null?void 0:t.type)==="geometry"||(t==null?void 0:t.type)==="model"||(t==null?void 0:t.type)==="path"||(t==null?void 0:t.type)==="custom-geometry")&&t.components[0].mesh&&!this.cachedHitBoxes.entities.includes(t.components[0].mesh)&&this.cachedHitBoxes.entities.push(t.components[0].mesh);return this.dirty3D=!1,this.cachedHitBoxes.entities.push(this.worldPlane),this.cachedHitBoxes}return this.cachedHitBoxes}intersect(t){var b,P,S,T,_;let i=[t.offsetX,t.offsetY],n=this._quadtree.queryPoint(i),[o]=n.filter(R=>R.intersectsPoint(i)),s=this.coreState.containerOffset[0],l=this.coreState.containerOffset[1];this.ndcPoint.x=(t.clientX-l)/this._container.clientWidth*2-1,this.ndcPoint.y=-((t.clientY-s)/this._container.clientHeight)*2+1;let h=this.getThreeDIntersectsFromXY(this.ndcPoint),p=(b=h[0])==null?void 0:b.point,m=[],f=[],v=h.filter(R=>R.object.name!=="worldPlane");for(let R of v)R.object instanceof ae&&R.object.material.depthTest===!1?m.push(R):f.push(R);let y=(S=(P=m[0])!=null?P:f[0])!=null?S:void 0,C,M;if(y!=null){if(C=y0(y.object,this.coreState.geometry3DMap),!C){let R=(T=y==null?void 0:y.instanceId)!=null?T:y==null?void 0:y.batchId;C=R!=null&&(y!=null&&y.object.userData.entities)?this.coreState.geometry3DMap.get(y==null?void 0:y.object.userData.entities[R]):this.coreState.geometry3DMap.get(y==null?void 0:y.object.userData.entityId)}C!=null&&C.components[2]&&(M=C)}let g=ql(v);return{entity2D:((_=o==null?void 0:o.userData)==null?void 0:_.entityId)==="watermark"?{id:"watermark"}:this.coreState.geometry2DMap.get(o==null?void 0:o.userData.entityId),entity3D:M,position:p,groupContainers:g.length>0?g:void 0}}detect3DEntityHover(t){return this.state.lastHover!==t&&(this.state.lastHover&&wd(this.state.lastHover,!1,this.coreState),t&&wd(t,!0,this.coreState)),this.state.hovered3DEntity!==t}detect3DContainerHover(t){return!Rc(this.state.hovered3DContainers,t)}updateInteractionStateIfPanning(t){this.state.interaction.mouseDownStart&&(this.state.interaction.distanceFromMouseDown=Math.sqrt(Math.pow(t.clientX-this.state.interaction.mouseDownStart.clientX,2)+Math.pow(t.clientY-this.state.interaction.mouseDownStart.clientY,2)),!this.state.interaction.isPanning&&this.state.interaction.distanceFromMouseDown>15&&(this.state.interaction.isPanning=!0))}getMouseRayIntersects(){return this.raycaster.intersectObjects([this.worldPlane],!1)}destroy(){this._container.removeEventListener("pointerdown",this.onPointerDown,!1),this._container.removeEventListener("pointermove",this.onPointerMoveRaf,!1),this._container.removeEventListener("pointerup",this.onPointerUp,!1),this._container.removeEventListener("pointercancel",this.onPointerUp,!1)}enableDebug(){let t=document.createElement("div");t.style.position="absolute",t.style.top="0",t.style.right="0",t.style.backgroundColor="white",t.style.padding="10px",document.body.append(t),t.id="interaction-debug-panel",this.debugPanel=t,this.on("doubletap-with-onefinger",()=>{this.queueDebugMessage("doubletap-with-onefinger","#ffadad")}),this.on("singletap-with-twofinger",()=>{this.queueDebugMessage("singletap-with-twofinger","#ffd6a5")}),this.on("click",i=>{var n,o,s;this.queueDebugMessage("CLICK \n3D: ".concat((n=i.entity3D)==null?void 0:n.id," \n2D: ").concat((o=i.entity2D)==null?void 0:o.id," \nPos: ").concat((s=i.position)==null?void 0:s.toArray().join(", ")),"#fdffb6")}),this.on("hover",i=>{var n,o,s;this.queueDebugMessage("HOVER \n3D: ".concat((n=i.entity3D)==null?void 0:n.id," \n2D: ").concat((o=i.entity2D)==null?void 0:o.id," \nPos: ").concat((s=i.position)==null?void 0:s.toArray().join(", ")),"#caffbf")})}get _state(){return this.state}queueDebugMessage(t,i){var o;let n=document.createElement("pre");n.style.maxWidth="300px",n.style.transition="opacity 500ms cubic-bezier(0.4, 0, 0.2, 1)",n.style.backgroundColor=i,n.textContent=t,(o=this.debugPanel)==null||o.prepend(n),setTimeout(()=>{n.style.opacity="0",setTimeout(()=>{n.remove()},500)},2500)}getCursor(){return this.cursor}};Di=new WeakMap,a(Jl,"InteractionSystem");var Sn=Jl;function wd(e,r,t){var s;let i=e.components[2];i&&i.hover!==!0&&(i.hover=r?"user-interaction":!1,i.dirty=!0);let n=(s=e.components[0].textMesh)==null?void 0:s.userData.entityId;if(!n)return;let o=t.geometry3DMap.get(n);(o==null?void 0:o.type)==="text3d"&&(o.components[1].hoverByPolygon=r,o.components[1].dirty=!0)}a(wd,"updateHover");function m0(e,r,t){return r?"grabbing":e?"pointer":t?"grabbing":"grab"}a(m0,"processCursor");function f0(e){let r=e;for(;r!=null&&r.parent;){if(r instanceof or)return;if(r.userData.isSingleModel)return r;r=r.parent}}a(f0,"findModelParent");function y0(e,r){let t=f0(e);return t?r.get(t.userData.entityId):void 0}a(y0,"findModelParentEntity");x();x();var Wr,Rt,vs,mr,Id,Pn,xs,Ed,Dd,Tn,Ss,Mn,_n,Cs,$l=class $l{constructor(r){L(this,mr);L(this,Wr,null);L(this,Rt);d(this,"getCurrentSceneGLTF",a(async r=>{let t=se({onlyVisible:!0,binary:!0,light:!0,scale:1},r),i=await Te(this,mr,Id).call(this),n=u(this,vs).call(this,t),o=await i.parseAsync(n,{trs:!1,maxTextureSize:1/0,onlyVisible:t.onlyVisible,binary:t.binary,scale:t.scale}),s;if(o instanceof ArrayBuffer)s=new Blob([o],{type:"application/octet-stream"});else{let l=JSON.stringify(o,null,2);s=new Blob([l],{type:"text/plain"})}return s},"getCurrentSceneGLTF"));L(this,vs,a(r=>{let{scale:t,light:i,onlyVisible:n}=r,o=new or,s=new Ue().setFromObject(u(this,Rt).entityScene);if(u(this,Pn).call(this,u(this,Rt).entityScene,o,n),i){let l=new bo(16777215,.3*Math.PI);l.position.set(0,Math.max(s.max.x,s.max.y)*t*.5,s.max.y*t*4),l.lookAt(0,0,-1),l.target.position.set(0,0,-1),l.add(l.target),o.add(l)}return o},"#getExportedScene"));L(this,Pn,a((r,t,i)=>{r.material&&(r instanceof fo?Te(this,mr,Ed).call(this,r).forEach(n=>t.add(n)):r instanceof ai&&t.add(Te(this,mr,Dd).call(this,r))),r.children.forEach(n=>{(!i||n.visible)&&u(this,Pn).call(this,n,t,i)})},"#processObject3D"));L(this,xs,a((r,t,i)=>{let n=new Pc({color:new ye(r),metalness:0});return n.opacity=t,n.transparent=i,n},"#createStandardMaterial"));L(this,Tn,a(r=>{let{geometry:t,material:i,position:n,rotation:o,quaternion:s,scale:l}=r;if(!(t!=null&&t.isBufferGeometry))return r;let h=t.attributes.position,p=t.attributes.normal,m=t.attributes.uv;return u(this,Ss).call(this,h,p),u(this,_n).call(this,n,l,o,s),m&&u(this,Cs).call(this,m),i!=null&&i.map&&t.type==="PlaneGeometry"&&(r.side=ft),r},"#convertGeometry"));L(this,Ss,a((r,t)=>{let i=new z,n=new z;for(let o=0;o<r.count;o++)i.fromBufferAttribute(r,o),u(this,Mn).call(this,i),r.setXYZ(o,i.x,i.y,i.z),t&&(n.fromBufferAttribute(t,o),u(this,Mn).call(this,n),t.setXYZ(o,n.x,n.y,n.z))},"#convertAttributes"));L(this,Mn,a(r=>{let t=r.y;r.y=r.z,r.z=-t},"#convertVector"));L(this,_n,a((r,t,i,n)=>{let o=r.y;r.y=r.z,r.z=-o;let s=t.y;if(t.y=t.z,t.z=s,i instanceof Xt)i.order="YXZ",i.set(i.x,i.y,i.z,i.order);else{let l=n.y;n.set(n.x,n.z,-l,n.w)}},"#convertObjectProperties"));L(this,Cs,a(r=>{for(let t=0;t<r.count;t++){let i=r.getX(t),n=r.getY(t);r.setXY(t,i,n)}},"#convertUVs"));B(this,Rt,r),u(this,Rt).entityScene=r.entityScene,u(this,Rt).geometry3DMap=r.geometry3DMap}destroy(){B(this,Wr,null)}};Wr=new WeakMap,Rt=new WeakMap,vs=new WeakMap,mr=new WeakSet,Id=a(async function(){if(!u(this,Wr)){let{GLTFExporter:r}=await import("./GLTFExporter-CVG4TSMU.js");B(this,Wr,new r)}return u(this,Wr)},"#getGLTFExporter"),Pn=new WeakMap,xs=new WeakMap,Ed=a(function(r){var s,l;let t=[],n=((s=r.userData)!=null&&s.entities?Object.values((l=r.userData)==null?void 0:l.entities):[]).map(h=>u(this,Rt).geometry3DMap.get(h)),o=new Map;return n.forEach(h=>{var y;if(!h||!(h instanceof ne))return;let p=h.components[1],m=h.components[2];if(!p.visible||p instanceof It&&p.opacity===0||p instanceof Ji||p instanceof Eo)return;let f=m!=null&&m.hover?p.hoverColor||u(this,Rt).hoverColor:p.color,v="".concat(f,"-").concat(p.opacity,"-").concat(Number(p.visible));o.has(v)||o.set(v,[]),(y=o.get(v))==null||y.push(h)}),o.forEach((h,p)=>{let[m,f,v]=p.split("-"),y=h.reduce((b,P)=>{if(P.type==="custom-geometry")return b;let S=P.components[0];return"geometry"in S&&S.geometry instanceof mo&&b.push(S.geometry),b},[]),C=u(this,xs).call(this,m,Number(f),r.material.transparent),M=ut(y,!0),g=new ae(M,C);g.position.copy(r.position),g.rotation.copy(r.rotation),g.scale.copy(r.scale),g.visible=!!v,u(this,_n).call(this,g.position,g.scale,g.rotation,g.quaternion),t.push(u(this,Tn).call(this,g))}),t},"#processBatchedMesh"),Dd=a(function(r){let t=r.geometry.clone(),i=r.material,n=new je({color:i.color,side:ft});n.opacity=i.opacity,n.transparent=i.transparent;let o=new ai(t,n);return o.position.copy(r.position),o.rotation.copy(r.rotation),o.scale.copy(r.scale),o.visible=r.visible,u(this,Tn).call(this,o)},"#processLineSegments"),Tn=new WeakMap,Ss=new WeakMap,Mn=new WeakMap,_n=new WeakMap,Cs=new WeakMap,a($l,"ExporterSystem");var Cn=$l;x();x();x();var eu=ao(Xd());function zd(e){this.name="JSClipperError",this.message=e,this.stack=new Error().stack}a(zd,"JSClipperError");zd.prototype=Error.prototype;eu.default.Error=function(e){throw new zd(e)};var ke=eu.default;var uS="gray",cS=.1,En=100,tu=new ke.ClipperOffset;function hS(e,r){tu.Clear(),r/=2;let t=e.map(n=>({X:n.x*En,Y:n.y*En}));tu.AddPath(t,ke.JoinType.jtMiter,ke.EndType.etClosedPolygon);let i=new ke.Paths;return tu.Execute(i,r*En),i.length?i.map(o=>o.map(s=>({x:s.X/En,y:s.Y/En}))):[e]}a(hS,"offset");function Is(e,r,t){var v,y,C,M,g;let{color:i=uS,opacity:n=1,altitude:o=0,height:s=cS}=t||{};Array.isArray(n)&&(n=1);let l={min:{x:1/0,y:1/0,z:o},max:{x:-1/0,y:-1/0,z:s+o},center:{x:0,y:0,z:(s+o)/2}},p=e.geometry.coordinates[0].map(b=>{let P=r(b[1],b[0]);return l.min.x=Math.min(l.min.x,P.x),l.min.y=Math.min(l.min.y,P.y),l.max.x=Math.max(l.max.x,P.x),l.max.y=Math.max(l.max.y,P.y),P});((y=(v=e.properties)==null?void 0:v.style)==null?void 0:y.edgeOffset)!=null&&e.properties.style.edgeOffset!==0||((C=e.properties)==null?void 0:C.image)!=null?p=hS(p,((g=(M=e.properties)==null?void 0:M.style)==null?void 0:g.edgeOffset)||0):p=[p];let m=[];for(let b of p){let P=new lr;P.moveTo(b[0].x,b[0].y),b.slice(1).forEach(R=>P.lineTo(R.x,R.y)),P.lineTo(b[0].x,b[0].y);let S=e.geometry.coordinates.slice(1);P.holes=S.map(R=>{let A=R.map(F=>r(F[1],F[0])),k=new ar;return k.moveTo(A[0].x,A[0].y),A.slice(1).forEach(F=>k.lineTo(F.x,F.y)),k.lineTo(A[0].x,A[0].y),k});let T={bevelEnabled:!1,depth:s},_=new ur(P,T);_.userData={style:{color:i,opacity:n}},m.push(_)}if(m.length===1)return m[0];let f=ut(m);return f.userData={style:{color:i,opacity:n},_split:!0},f}a(Is,"renderPolygonGeometry");x();var pS="gray",dS=.1;function Es(e,r,t){let{color:i=pS,opacity:n=1,altitude:o=0,height:s=dS}=t||{};Array.isArray(n)&&(n=1);let l={min:{x:1/0,y:1/0,z:o},max:{x:-1/0,y:-1/0,z:s+o}},h={bevelEnabled:!1,depth:s},p=[];e.geometry.coordinates.forEach(f=>{let v=new lr,y=f[0].map(g=>{let b=r(g[1],g[0]);return l.min.x=Math.min(l.min.x,b.x),l.min.y=Math.min(l.min.y,b.y),l.max.x=Math.max(l.max.x,b.x),l.max.y=Math.max(l.max.y,b.y),b});v.moveTo(y[0].x,y[0].y),y.slice(1).forEach(g=>v.lineTo(g.x,g.y)),v.lineTo(y[0].x,y[0].y);let C=f.slice(1);v.holes=C.map(g=>{let b=g.map(S=>r(S[1],S[0])),P=new ar;return P.moveTo(b[0].x,b[0].y),b.slice(1).forEach(S=>P.lineTo(S.x,S.y)),P.lineTo(b[0].x,b[0].y),P});let M=new ur(v,h);p.push(M)});let m=ut(p);return m.translate(0,0,o||0),m.userData={style:{color:i,opacity:n}},m}a(Es,"renderMultiPolygonGeometry");x();var mS="gray",ru=new ke.ClipperOffset,Qe=100;function Yd(e,r,t){let{color:i=mS,opacity:n=1,width:o=1,join:s="round",cap:l="round",height:h=.01,altitude:p=0}=t||{};Array.isArray(n)&&(n=0);let m=[];for(let M=0;M<e.geometry.coordinates.length-1;M++){let g=r(e.geometry.coordinates[M][1],e.geometry.coordinates[M][0]),b=r(e.geometry.coordinates[M+1][1],e.geometry.coordinates[M+1][0]);m.push([g,b])}ru.AddPaths(m.map(M=>M.map(g=>({X:g.x*Qe,Y:g.y*Qe}))),s==="round"?ke.JoinType.jsRound:s==="miter"?ke.JoinType.jsMiter:ke.JoinType.jsSquare,l==="round"?ke.EndType.etOpenRound:l==="butt"?ke.EndType.etOpenButt:ke.EndType.etOpenSquare);let f=new ke.PolyTree;ru.Execute(f,o/2*Qe);let v=[],y={bevelEnabled:!1,depth:h};for(let M of f.m_AllPolys){let g=new lr;if(M.IsHole())continue;let b=M.m_polygon;g.moveTo(b[0].X/Qe,b[0].Y/Qe),b.slice(1).forEach(P=>g.lineTo(P.X/Qe,P.Y/Qe)),g.lineTo(b[0].X/Qe,b[0].Y/Qe),g.holes=M.m_Childs.map(P=>{let S=new ar,T=P.m_polygon;return S.moveTo(T[0].X/Qe,T[0].Y/Qe),T.slice(1).forEach(_=>S.lineTo(_.X/Qe,_.Y/Qe)),S.lineTo(T[0].X/Qe,T[0].Y/Qe),S}),v.push(new ur(g,y))}let C=ut(v);return C.translate(0,0,p||0),C.userData={style:{color:i,opacity:n}},ru.Clear(),C}a(Yd,"renderLineStringGeometry");x();var et=100,fS=.22,yS=.01;function Zd(e,r,t={}){let{width:i=fS,height:n=yS,color:o="gray",opacity:s=1,altitude:l=0}=t,h={min:{x:1/0,y:1/0,z:l},max:{x:-1/0,y:-1/0,z:l+n}},p={bevelEnabled:!1,depth:n},m=new ke.ClipperOffset,f=e.geometry.coordinates.map(M=>M.map(g=>r(g[1],g[0])));m.AddPaths(f.map(M=>M.map(g=>({X:g.x*et,Y:g.y*et}))),ke.JoinType.jsMiter,ke.EndType.etOpenRound);let v=new ke.PolyTree;m.Execute(v,i/2*et);let y=[];for(let M of v.m_AllPolys){let g=new lr;if(M.IsHole())continue;h.min.x=Math.min(h.min.x,M.m_polygon[0].X),h.min.y=Math.min(h.min.y,M.m_polygon[0].Y),h.max.x=Math.max(h.max.x,M.m_polygon[0].X),h.max.y=Math.max(h.max.y,M.m_polygon[0].Y);let b=M.m_polygon;g.moveTo(b[0].X/et,b[0].Y/et),b.slice(1).forEach(P=>g.lineTo(P.X/et,P.Y/et)),g.lineTo(b[0].X/et,b[0].Y/et),g.holes=M.m_Childs.map(P=>{let S=new ar,T=P.m_polygon;return S.moveTo(T[0].X/et,T[0].Y/et),T.slice(1).forEach(_=>S.lineTo(_.X/et,_.Y/et)),S.lineTo(T[0].X/et,T[0].Y/et),S}),y.push(new ur(g,p))}let C=ut(y);return C.translate(0,0,l||0),C.userData={style:{color:o,opacity:s}},m.Clear(),C}a(Zd,"renderMultiLineStringGeometry");x();x();var Ai=w.object({type:w.enum(["Point"]),coordinates:w.array(w.number()).min(2).max(3)});var gS=w.object({rotation:w.array(w.number()).length(3).optional(),altitude:w.number().optional(),scale:w.array(w.number()).length(3).optional(),interactive:w.boolean().optional(),verticalOffset:w.number().optional(),id:w.union([w.number(),w.string()]).optional()}),bS=w.object({type:w.enum(["Feature"]),geometry:Ai,properties:gS}),vS=w.object({type:w.enum(["FeatureCollection"]),features:w.array(bS)}),xS=w.object({color:w.string()}),SS=w.object({url:w.string(),color:w.string().optional(),opacity:w.number().optional(),material:w.record(w.string(),xS).optional()});function Hd(e,r,t){w.union([w.number(),w.string()]).parse(e),vS.parse(r),SS.parse(t)}a(Hd,"validateModelGroup");var Dn,On,iu=class iu{constructor(r){d(this,"mesh");d(this,"type","model");d(this,"positionDirty",!0);d(this,"outline");d(this,"geometry");d(this,"material");d(this,"feature");d(this,"instanceIndex",-1);d(this,"visible",!0);d(this,"color",new ye);d(this,"position",new z);L(this,Dn,0);L(this,On,1);this.feature=r}setOpacity(){}setColor(){}get altitude(){return u(this,Dn)}set altitude(r){this.mesh&&(this.mesh.position.z=r,B(this,Dn,r))}getRotation(){return this.mesh?[this.mesh.rotation.x,this.mesh.rotation.y,this.mesh.rotation.z]:void 0}setRotation(r){this.mesh&&this.mesh.rotation.set(ee.degToRad(r[0]),ee.degToRad(r[1]),ee.degToRad(r[2]))}getScale(){return this.mesh?[this.mesh.scale.x,this.mesh.scale.y,this.mesh.scale.z]:void 0}setScale(r){this.mesh&&this.mesh.scale.set(r[0],r[1],r[2])}get opacity(){return u(this,On)}set opacity(r){var t,i,n;if(this.mesh){if(this.mesh.children[0]instanceof sr){for(let o of this.mesh.children)if(o instanceof sr){((t=o.userData)==null?void 0:t.originalOpacity)===void 0&&(o.userData.originalOpacity=o.material.opacity);let s=Lr(r,0,(i=o.userData)==null?void 0:i.originalOpacity,0,1);o.material.opacity=s,o.material.transparent=s<1,o.material.needsUpdate=!0}}else(n=this.mesh)==null||n.traverse(o=>{o instanceof ae&&o.material&&(Array.isArray(o.material)?o.material.forEach(s=>{Ud(s,r)}):Ud(o.material,r))});B(this,On,r)}}};Dn=new WeakMap,On=new WeakMap,a(iu,"ModelComponent");var gr=iu;function Ud(e,r){e.opacity!==r&&(r===1?(e.opacity=1,e.transparent=!1):(e.opacity=r,e.transparent=!0),e.needsUpdate=!0)}a(Ud,"updateMaterialOpacity");x();function Ds(e){var l,h;let r=e.components[0],t=e.components[1];t.opacity!=null&&t.opacity!==r.opacity&&(r.opacity=t.opacity);let i=t.material,n=t.color;if(i||n){let p=CS(n,i);(l=r.mesh)==null||l.traverse(m=>{m instanceof ae&&m.material&&(Array.isArray(m.material)?m.material.forEach(f=>{p[f.name]?f.color.set(p[f.name].color):f.color.set(n)}):p[m.material.name]?m.material.color.set(p[m.material.name].color):m.material.color.set(n))})}let o=(h=r.feature.geometry.coordinates[2])!=null?h:0,s=t.verticalOffset+o;r.altitude!==s&&(r.altitude=s),t.visible!==r.visible&&(r.visible=t.visible),t.rotation&&r.setRotation(t.rotation),t.scale&&r.setScale(t.scale)}a(Ds,"applyModelGeometryStyle");function CS(e,r){let t={};if(e&&Object.assign(t,{Default:{color:e},Fabric:{color:e},Mpdn_Logo:{color:e},CouchLogo:{color:e}}),r)for(let i in r)r[i].color&&(t[i]?t[i].color=r[i].color:t[i]={color:r[i].color});return t}a(CS,"consolidateColorAndMaterial");function Wd(e,r){var s,l;let t=e.components[0],n=(s=e.components[1].verticalOffset)!=null?s:0,o=t.feature.geometry.coordinates.slice();o[2]=((l=o[2])!=null?l:0)+n,t.mesh?t.mesh.position.copy(r(o)):t.position.copy(r(o))}a(Wd,"applyModelPosition");function jd(e){return e instanceof Me?e.material:null}a(jd,"getMaterial");function Vd(e){return e.side===ji?"back":e.side===_r?"front":"double"}a(Vd,"getMaterialSide");function qd(e,r){e.side=r==="back"?ji:r==="front"?_r:ft}a(qd,"setMaterialSide");function PS(e){let{color:r,opacity:t,topColor:i,texture:n,topTexture:o}=e;return"".concat(r).concat(t).concat(i||"").concat(n||"").concat(o||"")}a(PS,"generateIndex");var nu=class nu extends ie{constructor(t,i){super();d(this,"state");d(this,"convertTo3DMapPosition");d(this,"loader");d(this,"optimizePromise",[]);this.state=t,this.convertTo3DMapPosition=i}async getGLTFLoader(){if(this.loader)return this.loader;let{GLTFLoader:t}=await import("./GLTFLoader-N7FATKQH.js");return this.loader=new t,this.loader}createEntityFromFeature(t,i,n){var l,h;let o=new Me(i),s=new ne(o,new It(Ze(se({},n),{url:(h=(l=i.properties)==null?void 0:l.image)==null?void 0:h.path})));return n!=null&&n.outline&&(s.components[3]=new Pi(dn(n.color))),n!=null&&n.focusable&&(s.components[4]=new qt),s.id=t,s}createModelFromFeature(t,i,n){let o=new gr(i),s=se({},n);i.properties.verticalOffset!=null&&(s.verticalOffset=i.properties.verticalOffset),i.properties.rotation!=null&&(s.rotation=i.properties.rotation),i.properties.scale!=null&&(s.scale=i.properties.scale);let l=new Eo(s),h=new ne(o,l);return h.id=t,h}populateEntityMesh(t,i){let n=t.components[0];n.geometry=i,n.batchedProps={range:{start:0,count:1/0,indexCount:1/0,indexStart:0,vertexCount:1/0,vertexStart:0,reservedVertexCount:1/0,reservedIndexCount:1/0},geometryId:-1,positionCount:i.attributes.position.count},n.currentHeight=t.components[1].height,n.dirty=!1}async populateModelGroup(t,i,n){let o=new ot,s=new Xt,l=new Ir,h=new z,p=new gt,m=await this.getGLTFLoader(),f=new Promise(v=>{m.load(i,y=>{"entities3D"in n.userData&&(n.userData.entities3D.size>1?y.scene.traverse(C=>{let M=C;if("isMesh"in M&&M.isMesh===!0){let g=new sr(M.geometry,M.material,t.size);g.userData={entities:{}},p.add(g),n.add(p)}}):(y.scene.traverse(C=>{"isMesh"in C&&C.isMesh===!0&&(C.position.set(0,0,0),C.rotation.set(0,0,0),C.scale.set(1,1,1),C.updateMatrix())}),p.add(y.scene),n.add(p),p.userData.isSingleModel=!0,p.userData.entityId=t.values().next().value,p.userData.type="model")),v()})});return this.optimizePromise.push(f.then(()=>{var C,M,g,b,P,S,T,_,R,A,k,F;let v=0,y;for(let G of t.values()){if(y=this.state.geometry3DMap.get(G),!y||(y==null?void 0:y.type)!=="model")continue;let O=y.components[0],X=y.components[1],Z=y.components[0].feature;O.mesh=p,O.instanceIndex=v,Ds(y),y.components[1].dirty=!1;let{x:J,y:re}=this.convertTo3DMapPosition(Z.geometry.coordinates[1],Z.geometry.coordinates[0],0);O.position.set(J,re,O.altitude),s.set(ee.degToRad((M=(C=X.rotation)==null?void 0:C[0])!=null?M:di[0]),ee.degToRad((b=(g=X.rotation)==null?void 0:g[1])!=null?b:di[1]),ee.degToRad((S=(P=X.rotation)==null?void 0:P[2])!=null?S:di[2])),h.set((_=(T=X.scale)==null?void 0:T[0])!=null?_:pi[0],(A=(R=X.scale)==null?void 0:R[1])!=null?A:pi[1],(F=(k=X.scale)==null?void 0:k[2])!=null?F:pi[2]),l.setFromEuler(s),o.compose(O.position,l,h),p.children.forEach($=>{!y||(y==null?void 0:y.type)!=="model"||!($ instanceof sr)||($.setMatrixAt(v,o),$.userData.entities[v]=y.id)}),O.mesh.userData.isSingleModel&&(O.mesh.matrix.copy(o),O.mesh.matrix.decompose(O.mesh.position,O.mesh.quaternion,O.mesh.scale)),v++}this.publish("model-loaded")})),p}populateEntityGroup(t){var l;let i,n,o,s;for(let h of t.values())s=this.state.geometry3DMap.get(h),s.components[0]instanceof Me&&(n=s.components[0].feature,o=s.components[1],n.geometry.type==="Polygon"?(i=Is(n,this.convertTo3DMapPosition,o),(l=n.properties)!=null&&l.textures&&n.properties.textures.length>0&&qp(i,n.properties.textures,this.state.naturalBearing,this.convertTo3DMapPosition),this.populateEntityMesh(s,i)):n.geometry.type==="MultiPolygon"?(i=Es(n,this.convertTo3DMapPosition,o),this.populateEntityMesh(s,i)):n.geometry.type==="LineString"?(i=Yd(n,this.convertTo3DMapPosition,o),this.populateEntityMesh(s,i)):n.geometry.type==="MultiLineString"&&(i=Zd(n,this.convertTo3DMapPosition,o),this.populateEntityMesh(s,i)));return t}update(){var t;for(let i of this.state.geometryGroupIdsToLoad.values()){let n=this.state.geometry3DMap.get(i);if(n instanceof lt&&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(l){q.warn(l)}let o,s={};for(let l of n.userData.entities3D.values()){o=this.state.geometry3DMap.get(l);let h=o==null?void 0:o.components[0];if((o==null?void 0:o.type)==="geometry"){let p=o.components[1],m=PS(p);s[m]===void 0&&(s[m]={style:p,entities:[]}),s[m].entities.push(o)}else h&&"mesh"in h&&h.mesh&&((t=h.mesh)==null?void 0:t.parent)!==n&&n.add(h.mesh)}for(let l in s){let h=Vp(s[l].entities,s[l].style);n.add(h)}for(let l of n.userData.entities3D.values())if(o=this.state.geometry3DMap.get(l),o!=null&&o.entities2D.size>0)for(let h of o.entities2D.values())h&&(o.attach(h),this.publish("geometry-2d-added"));this.publish("geometry-group-added"),n.userData.dirty=!1}}return Promise.resolve()}};a(nu,"MeshCreationAndOptimizationSystem");var Os=nu;x();var ou=class ou{constructor(r,t){d(this,"state");d(this,"dirty",!0);d(this,"domTree");this.state=r,this.domTree=t}update(){if(this.dirty){let r;for(let t of Array.from(this.domTree.children))if(r=this.state.geometry2DMap.get(t.userData.entityId),r){let i=r.components[0];(!i.enabled||!i.visible||!this.state.geometry2DIdsInScene.has(t.userData.entityId))&&this.domTree.removeChild(t)}else this.domTree.removeChild(t);for(let t of this.state.geometry2DIdsInScene)if(r=this.state.geometry2DMap.get(t),r){let i=r.components[0];i instanceof Dt&&i.enabled&&i.markerContainer&&!this.domTree.contains(i.markerContainer)&&(i.markerContainer.userData={entityId:r.id},this.domTree.appendChild(i.markerContainer),i.updateDimensions())}this.dirty=!1}}};a(ou,"DOMVisibilitySystem");var Ls=ou;x();var su=class su{constructor(r,t){d(this,"state");d(this,"project");this.state=r,this.project=t}update(){let r,t=0,i,n;for(let o of this.state.geometry2DIdsInScene)if(r=this.state.geometry2DMap.get(o),r){n=r.components[0];let s=r.attachedTo?this.state.geometry3DMap.get(r.attachedTo):void 0;if(s instanceof ne)if(this.state.geometry3DIdsInScene.has(s.id)){i=s.components[1],n=r.components[0],(i.dirty||r.components[0].attachedDirty)&&(t=i.height,r.setAltitude(t));let l=i.visible;n.visible!==l&&(n.visible=l)}else n.visible===!0&&(n.visible=!1);this.project(r.components[0].projection,r.position),r.components[0].attachedDirty=!1}}};a(su,"TwoDProjectionSystem");var As=su;x();x();var TS=a(function(){let r,t;return i=>{if((!t||!t)&&(r=document.createElement("canvas"),r.width=500*i,r.height=500*i,r.style.width="500px",r.style.height="500px",t=r.getContext("2d")),!t)throw new Error("Could not get 2D context");return{measureCanvas:r,measureCanvasContext:t}}},"createMeasureCanvasContext")(),Jd=a(({text:e,size:r,maxWidth:t,pixelRatio:i,maxLines:n=2,lineHeight:o=1.2,options:s={strokeText:!0}})=>{let l="bold ".concat(r*i,"px 'InterUI-Regular', Helvetica Neue, Arial, sans-serif"),{measureCanvasContext:h}=TS(i);h.font=l;let p=[],m=e.split(" "),f=0,v=0,y=0;for(;v<m.length;){let b=m[v];if(f===n&&f>0){p[f-1]+="...";break}if(p[f]==null&&(p[f]=b,v++),m.length===1){p[f]=b;break}if(m[v]==null)break;let{width:P}=h.measureText(p[f]+" "+m[v]);P<=t*i?(p[f]+=" "+m[v],v++):f++}p.forEach(b=>{let{width:P}=h.measureText(b);y=Math.max(P,y)});let C=r*i*o,M=p.length*C;return{maxWidth:y,maxHeight:M,lines:p.length,draw:a((b,P,S)=>{p.length===1?(s.strokeText&&b.strokeText(p[0],P,S),b.fillText(p[0],P,S)):(s.strokeText&&(b.strokeText(p[0],P,S-C/2),b.strokeText(p[1],P,S+C/2)),b.fillText(p[0],P,S-C/2),b.fillText(p[1],P,S+C/2))},"draw")}},"shaveText");x();function $d(e){let r=new Image;return e&&(/<svg[\s\S]*>/i.test(e)?r.src="data:image/svg+xml;base64,".concat(btoa(e)):r.src=e),r}a($d,"createImage");var au=class au extends ie{constructor(t,i,n){super();d(this,"dirty",!1);d(this,"state");d(this,"colliderContext");d(this,"colliderCanvas");d(this,"transformRequestFunc");d(this,"transformRequest",a(async t=>this.transformRequestFunc?await this.transformRequestFunc(t):{url:t},"transformRequest"));d(this,"pinCache",{});d(this,"imageCache",{});d(this,"imagePromiseCache",{});d(this,"imageDimensionsCache",{});d(this,"textCache",{});d(this,"update",a(t=>{let i=this.state.pixelRatio;this.colliderContext.clearRect(0,0,this.colliderCanvas.width,this.colliderCanvas.height);let n,o,s,l,h,p,m;for(let f of this.state.geometry2DIdsInScene)if(m=this.state.geometry2DMap.get(f),m!=null&&(p=m.components[0],p instanceof Et&&!m.disposed)){if(h=p.appearance.iconVisibleAtZoomLevel,p.appearance.icon!=null&&h&&t>=h!==p.iconVisible&&(p.iconVisible=t>=h,p.dirty=!0),(p.dirty||this.dirty)&&p.calculateMarkerSize(),o={active:p.appearance.pinColor,inactive:p.appearance.pinColorInactive},s={active:p.appearance.pinOutlineColor,inactive:p.appearance.pinOutlineColorInactive},l=li(p.markerSize,2),n="".concat(o.active,"-").concat(o.inactive,"-").concat(s.active,"-").concat(s.inactive,"-").concat(l,"-").concat(p.iconVisible),p.labelCacheId=n,(!this.pinCache[n]||this.dirty)&&(this.prepare(p,n,this.colliderContext),p.dirty=!0),(p.appearance.icon&&(!p.imageHash||p.markerDirty)||this.dirty)&&this.cacheImage(p),this.textCache[p.id]==null||p.textDirty||this.dirty){p.dirty=!0,this.textCache[p.id]={};let{textDrawFn:y,width:C,height:M}=this.processText(p.text,p.appearance.textSize,p.appearance.maxWidth,p.appearance.maxLines,p.appearance.lineHeight);["left","center","right"].forEach(g=>{this.textCache[p.id][g]=this.textToCanvas(y,p.appearance.textSize,g,C,M,p.appearance.textColor,p.appearance.textOutlineColor)}),p.dimensions={width:Math.ceil(C/i),height:Math.ceil(M/i)}}let v=1;if(p.appearance.iconScale)if(typeof p.appearance.iconScale=="number")v=p.appearance.iconScale;else{let{on:y,input:C,output:M,easing:g}=p.appearance.iconScale;y==="zoom-level"?v=Xc(t,C,M,g!=null?g:"linear"):q.warn("Unsupported interpolation property: ".concat(y))}p.recomputeCurrentStrategy(p.iconVisible?v:1),p.canShow&&p.visible&&(p.enabled||p.visibilityNeedsUpdate!==!1)&&this.draw(p,n,this.colliderContext),p.textDirty=!1,p.markerDirty=!1}this.dirty=!1},"update"));d(this,"processText",a((t,i,n,o,s)=>{let l=this.state.pixelRatio,{draw:h,maxWidth:p,maxHeight:m}=Jd({text:t,size:i,pixelRatio:l,maxWidth:n,maxLines:o,lineHeight:s});return{textDrawFn:h,width:p+2.5*l*2,height:m+2.5*l*2}},"processText"));d(this,"textToCanvas",a((t,i,n,o,s,l,h)=>{let p=this.state.pixelRatio,m,f=o,v=s;window.OffscreenCanvas!=null&&!Hc()?m=new OffscreenCanvas(f,v):(m=document.createElement("canvas"),m.width=f,m.height=v,m.style.width=f+"px",m.style.height=v+"px");let y=m.getContext("2d",{willReadFrequently:!0});if(!y)return;y.textAlign=n,y.font="bold ".concat(i*p,"px 'InterUI-Regular', Helvetica Neue, Arial, sans-serif"),y.textBaseline="middle",y.lineJoin="miter",y.miterLimit=2,y.strokeStyle="white",y.lineWidth=2.5*p,y.fillStyle=l,y.strokeStyle=h;let C=n==="left"?0:n==="center"?f/2:f-2.5*p/2;return t(y,C,(v+2.5*p/2)/2),m},"textToCanvas"));d(this,"cacheImage",a(t=>{if(!t.appearance.icon)return;let i=Jc(t.appearance.icon);this.imagePromiseCache[i]||(this.imagePromiseCache[i]=new Promise(n=>{this.transformRequest(t.appearance.icon).then(o=>{let s=$d(o.url);s.onload=()=>{this.imageCache[i]=s,this.publish("img:loaded"),n(s)}})})),t.imageHash!==i&&(t.imageHash=i,this.imagePromiseCache[i].then(()=>{t.dirty=!0}))},"cacheImage"));d(this,"createPinCanvas",a((t,i,n,o,s=1)=>{let l,h=this.state.pixelRatio,p=t.totalMarkerSize*2*h*s;window.OffscreenCanvas!=null?l=new OffscreenCanvas(p,p):(l=document.createElement("canvas"),l.width=p,l.height=p,l.style.width=p/h+"px",l.style.height=p/h+"px");let m=l.getContext("2d");return m.shadowColor="rgba(0,0,0,0.3)",m.shadowOffsetY=2*h,m.shadowBlur=5*h,m.beginPath(),m.arc(p/2,p/2,(i/2+2.5*h/2)*s,0,2*Math.PI),m.fillStyle=n,m.fill(),m.beginPath(),m.arc(p/2,p/2,i/2*s,0,2*Math.PI),m.shadowColor="transparent",m.fillStyle=o,m.fill(),l},"createPinCanvas"));d(this,"prepare",a((t,i,n)=>{let o=this.state.pixelRatio;n.lineWidth=4*o;let s=typeof t.appearance.iconScale=="number"?[t.appearance.iconScale]:t.appearance.iconScale==null?[]:t.appearance.iconScale.output,l=s.length>0?Math.max(...s):void 0,h=this.createPinCanvas(t,t.markerSize,t.appearance.pinOutlineColor,t.appearance.pinColor,l),p=this.createPinCanvas(t,t.iconVisible?t.markerSize:3.5*o,t.appearance.pinOutlineColorInactive,t.appearance.pinColorInactive,l);this.pinCache[i]=[h,p]},"prepare"));this.state=t,this.colliderCanvas=i,this.colliderContext=i.getContext("2d"),this.transformRequestFunc=n}draw(t,i,n){var p;if(!t.canShow||!t.visible)return;n.save(),n.globalAlpha=t.opacity;let o=this.state.pixelRatio,s=t.projection.x*o,l=t.projection.y*o,h=t.style.pinVisibility===1?this.pinCache[i][0]:this.pinCache[i][1];if(n.drawImage(h,s-t.scaledMarkerSize*o,l-t.scaledMarkerSize*o,t.scaledMarkerSize*2*o,t.scaledMarkerSize*2*o),t.appearance.icon&&t.iconVisible&&t.imageHash&&t.appearance.iconSize&&this.imageCache[t.imageHash]){let m=this.imageCache[t.imageHash],f=(t.scaledMarkerSize-t.scaledIconPadding)*o,v=t.appearance.iconFit,y=f,C=f,M="".concat(t.imageHash,"_").concat(v);if(this.imageDimensionsCache[M])y=this.imageDimensionsCache[M].width,C=this.imageDimensionsCache[M].height;else{let g=m.width*o,b=m.height*o;if(v==="contain"){let P=Math.sqrt(g**2+b**2),S=f/P;y=g*S,C=b*S}if(v==="cover"){let P=f/g,S=f/b,T=Math.max(P,S);y=g*T,C=b*T}}n.save(),n.beginPath(),n.arc(s,l,f/2,0,2*Math.PI),n.closePath(),((p=t==null?void 0:t.appearance)==null?void 0:p.iconOverflow)!=="visible"&&n.clip(),n.drawImage(m,s-y/2,l-C/2,y,C),n.restore()}t.style.textLabelVisible&&t.style.textAlign!=null&&t.style.left!=null&&t.style.top!=null&&n.drawImage(this.textCache[t.id][t.style.textAlign],s+t.style.left*o,l+t.style.top*o),n.restore()}};a(au,"TwoDDrawSystem");var Rs=au;x();x();var br=class br{constructor(){d(this,"loader");this.loader=new go}static getInstance(){return br.instance||(br.instance=new br),br.instance}getLoader(){return this.loader}load(r){return new Promise((t,i)=>{this.loader.load(r,t,void 0,i)})}};a(br,"TextureLoaderSingleton"),d(br,"instance");var lu=br,vr=lu.getInstance();function IS(e,r){let t=e.components[2],i=e.components[1];return t!=null&&t.hover?[i.hoverColor||r,i.hoverColor||r]:[i.color,i.topColor||i.color]}a(IS,"processColor");var Jr,An,uu=class uu extends ie{constructor(t,i){super();L(this,Jr);d(this,"state");d(this,"convertTo3DMapPosition");d(this,"textureLoadingCache",new Map);this.convertTo3DMapPosition=i,this.state=t}processTextures(t,i,n){var o;if(i.texture!==t.texture&&i.texture!==""&&Te(this,Jr,An).call(this,i.texture,t,"texture"),i.topTexture!==t.topTexture&&i.topTexture!==""&&Te(this,Jr,An).call(this,i.topTexture,t,"topTexture"),(t.texture==null||t.topTexture==null)&&Array.isArray((o=t.feature.properties)==null?void 0:o.textures)&&t.feature.properties.textures.length>0)for(let s of t.feature.properties.textures)s.face==="top"&&t.topTexture!==s.path?Te(this,Jr,An).call(this,s.path,t,"topTexture"):s.face==="side"&&t.texture!==s.path&&Te(this,Jr,An).call(this,s.path,t,"texture"),t.blendTexture=!0;(t.texture!=null||t.topTexture!=null)&&(n!=null&&n.hover&&t.texturesVisible?t.hideTextures():t.texturesVisible||t.showTextures(),i.texture===""&&t.removeSideTexture(),i.topTexture===""&&t.removeTopTexture())}update(){var o,s,l,h,p,m,f,v,y,C,M,g,b,P,S,T,_;let t,i,n;for(let R of this.state.geometry3DIdsInScene)if(n=this.state.geometry3DMap.get(R),n&&(n.type==="geometry"||n.type==="custom-geometry")&&((o=n.components[1])!=null&&o.dirty||(s=n.components[2])!=null&&s.dirty)){let A=n.components[0],k=n.components[1];i=n.components[2];let F=IS(n,this.state.hoverColor);A.setColor(F[0],F[1]);let G=jd(A);if(k.visible!==A.visible&&(A.visible=k.visible,A instanceof Me&&A.textMesh)){let X=this.state.geometry3DMap.get(A.textMesh.userData.entityId);(X==null?void 0:X.type)==="text3d"&&X.components[0].polygonEntityId!=null&&(X.components[0].visible=k.visible)}k.altitude!==A.altitude&&(A.altitude=k.altitude);let O=k.opacity*ci(n);O!==A.opacity&&(A.opacity=O),k.renderOrder!==A.renderOrder&&(A.renderOrder=k.renderOrder),G&&k.side!==Vd(G)&&qd(G,k.side),A instanceof Me&&k.shading!=null&&(((l=k.shading)==null?void 0:l.start)!==(G==null?void 0:G.getGradientShading().start)||((h=k.shading)==null?void 0:h.end)!==(G==null?void 0:G.getGradientShading().end)||((p=k.shading)==null?void 0:p.intensity)!==(G==null?void 0:G.getGradientShading().intensity))&&(G==null||G.setGradientShading((f=(m=k.shading)==null?void 0:m.start)!=null?f:0,(y=(v=k.shading)==null?void 0:v.end)!=null?y:0,(M=(C=k.shading)==null?void 0:C.intensity)!=null?M:0)),k.dirty=!1,A instanceof Me&&this.processTextures(A,k,i),n.components[2]&&(n.components[2].dirty=!1)}else if((n==null?void 0:n.type)==="model")n.components[1].dirty&&(Ds(n),n.components[1].dirty=!1),n.components[0].positionDirty&&(Wd(n,this.convertTo3DMapPosition),n.components[0].positionDirty=!1);else if((n==null?void 0:n.type)==="image"&&((g=n.components[1])!=null&&g.dirty)){t=n.components[0];let A=n.components[1];A.visible!==t.visible&&(t.visible=A.visible),A.dirty=!1}else if((n==null?void 0:n.type)==="text3d"&&((b=n.components[1])!=null&&b.dirty)&&n.components[0].polygonEntityId!=null){t=n.components[0];let A=n.components[1];A.visible!=null&&A.visible!==t.visible&&(t.visible=A.visible);let{textMesh:k}=t;if(k){Object.assign(k,A.getState());let F=(P=A.hoverColor)!=null?P:this.state.text3dHoverColor;k.color=A.hoverByPolygon?F:(S=A.color)!=null?S:hi.color,k.outlineColor=A.hoverByPolygon?F:(T=A.outlineColor)!=null?T:hi.outlineColor,k.strokeColor=A.hoverByPolygon?F:(_=A.strokeColor)!=null?_:hi.strokeColor}A.dirty=!1}}destroy(){this.textureLoadingCache.forEach(async t=>{(await t).dispose()}),this.textureLoadingCache.clear()}};Jr=new WeakSet,An=a(async function(t,i,n){if(!(!t||!i.showTextures))if(this.textureLoadingCache.has(t)){n==="topTexture"?i.topTexture=await this.textureLoadingCache.get(t):i.texture=await this.textureLoadingCache.get(t),i.showTextures();return}else{let o=new Promise((s,l)=>{vr.getLoader().load(t,h=>{n==="topTexture"?i.topTexture=h:i.texture=h,i.showTextures(),this.publish("texture-loaded"),s(h)},void 0,()=>{q.error("Failed to load texture: ".concat(t)),l("Failed to load texture: ".concat(t))})});this.textureLoadingCache.set(t,o)}},"#loadTexture"),a(uu,"DrawSystem");var ks=uu;x();var cu=class cu extends ie{constructor(t){super();d(this,"state");d(this,"animating",new Map);d(this,"isAnimating",!1);d(this,"startTime",-1);d(this,"showDuration",300);d(this,"hideDuration",250);d(this,"update",a(()=>{this.animating.clear();let t,i;for(let n of this.state.geometry2DIdsInScene)t=this.state.geometry2DMap.get(n),t&&(i=t.components[0],i instanceof Et&&(i.visibilityNeedsUpdate==="show"?(i.canShow=!0,this.animating.set(i,[i.opacity,1])):i.visibilityNeedsUpdate==="hide"&&this.animating.set(i,[i.opacity,0])));this.startTime=performance.now(),this.publish("animate:2d")},"update"));d(this,"playAnimations");this.state=t,this.playAnimations=this._playAnimations}_playAnimations(){let t=performance.now();for(let[i,[n,o]]of this.animating.entries()){let s=o===1?this.showDuration:this.hideDuration,l=(t-this.startTime)/s;i.opacity=Lr(l,0,1,n,o,o===0?Bc:Fc),t-this.startTime>=s&&(o===1?i.canShow=!0:o===0&&(i.canShow=!1),i.visibilityNeedsUpdate=!1,this.animating.delete(i))}this.publish("draw:2d"),this.animating.size>0&&this.publish("animate:2d")}};a(cu,"TwoDVisibilitySystem");var Ns=cu;x();var hu=class hu extends ie{constructor(t,i,n,o,s,l,h){super();d(this,"state");d(this,"renderer");d(this,"mode");d(this,"scene");d(this,"cameraObject");d(this,"viewCamera");d(this,"systems");d(this,"needs2DRecompute",!1);d(this,"twoDdirty",!0);d(this,"threeDdirty",!0);d(this,"frameId",null);d(this,"twoDFrameId",null);d(this,"animationFrameId",null);d(this,"nextFrame",null);d(this,"update",a((t=!1)=>{var i;if(((i=this.renderer)==null?void 0:i.renderer)==null)return Promise.resolve();if(t){let n=this.commitRenderState();return this.paint(),n}else return this.frameId?Promise.resolve():new Promise((n,o)=>{this.frameId=requestAnimationFrame(()=>{var s,l;return((s=this.renderer)==null?void 0:s.renderer)==null?n():this.mode==="standalone"?(l=this.commitRenderState())==null?void 0:l.then(()=>{this.paint(),n()}).catch(h=>{o(h)}):n()})})},"update"));d(this,"animate2D",a(()=>{this.animationFrameId=requestAnimationFrame(()=>{this.animationFrameId=null,this.systems.twoDVisiblitySystem.playAnimations()})},"animate2D"));d(this,"drawEntities2D",a(()=>{this.twoDFrameId||(this.twoDFrameId=requestAnimationFrame(()=>{this.twoDFrameId=null,this.systems.twoDDrawSystem.update(this.systems.cameraSystem.getZoomLevel())}))},"drawEntities2D"));d(this,"updateEntities2D",a(()=>{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())})},"updateEntities2D"));d(this,"commitRenderState",a(()=>{try{let t=[];this.frameId=null,this.publish("pre-render"),this.state.internalTweenGroup.update(),this.state.externalTweenGroup.update(),(this.mode==="outdoors-interleaved"||this.mode==="standalone")&&this.systems.cameraSystem.update(),this.state.shouldMeasureCanvas&&(this.state.shouldMeasureCanvas=!1,this.publish("measure-canvas")),this.twoDdirty&&(this.state.geometry2DIdsInScene.clear(),Vc(this.state.entityScene,this.state.geometry2DIdsInScene),this.systems.domVisiblitySystem.dirty=!0,this.systems.collisionSystem.collidersDirty=!0,this.systems.domMutationSystem.dirty=!0,this.systems.panBoundsSystem.dirty=!0,this.twoDdirty=!1),this.threeDdirty&&(this.state.geometry3DIdsInScene.clear(),this.state.geometryGroupIdsToLoad.clear(),jc(this.state.entityScene,this.state.geometry3DIdsInScene,this.state.geometryGroupIdsToLoad),this.threeDdirty=!1,this.systems.interactionSystem.dirty3D=!0,this.systems.panBoundsSystem.dirty=!0,this.systems.outlineInterpolationSystem.geometries3DDirty=!0,this.systems.geometryInFocusSystem.focusablesDirty=!0);let i=this.systems.meshOptimizationSystem.update();i&&t.push(i),this.systems.meshModificationSystem.update(),this.systems.meshDetachmentSystem.update(),this.systems.imageSystem.update(this.systems.cameraSystem.getRotation()),t.push(this.systems.text3DSystem.update(this.systems.cameraSystem.getRotation())),this.systems.customGeometrySystem.update(),this.systems.panBoundsSystem.update(),this.systems.geometryInFocusSystem.update(this.systems.cameraSystem.isCameraMoving(),this.systems.cameraSystem.lastCameraStoppedMovingTime()),this.systems.outlineInterpolationSystem.update(this.systems.cameraSystem.getZoomLevel(),this.systems.cameraSystem.zoomDirty),this.systems.pathSystem.update(this.systems.cameraSystem.minZoomAltitude,this.systems.cameraSystem.maxZoomAltitude,this.systems.cameraSystem.getZoomAltitude(),this.systems.cameraSystem.getRotation()),this.systems.cameraSystem.postRender(),this.systems.domVisiblitySystem.update(),this.systems.domMutationSystem.update(),this.systems.twoDProjectionSystem.update(),this.systems.occlusion2DSystem.update(),this.systems.twoDDrawSystem.update(this.systems.cameraSystem.getZoomLevel()),this.systems.domDrawSystem.update(this.systems.cameraSystem.isUserInteracting()),this.systems.watermarkSystem.update();let n=this.needs2DRecompute;return this.nextFrame=requestAnimationFrame(()=>{this.systems.collisionSystem.update(this.systems.watermarkSystem.width,this.systems.watermarkSystem.height,this.systems.watermarkSystem.options.position,!n)}),this.systems.drawSystem.update(),this.systems.geometryDisposalSystem.update(),this.systems.cameraSystem.dirty=!1,this.systems.cameraSystem.zoomDirty=!1,this.systems.cameraSystem.rotationDirty=!1,this.systems.cameraSystem.stateDirty&&(this.publish("camera-state-change"),this.systems.cameraSystem.stateDirty=!1),this.publish("post-render"),Promise.all(t)}catch(t){return Promise.reject(t)}},"commitRenderState"));this.renderer=t,this.state=i,this.mode=n,this.scene=o,this.cameraObject=s,this.viewCamera=l,this.systems=h,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(){var t;(t=this.renderer)!=null&&t.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)}};a(hu,"RenderSystem");var Bs=hu;x();var ES=w.object({interactive:w.boolean().optional(),id:w.string().optional(),width:w.union([w.number(),w.object({on:w.literal("zoom-level").optional(),input:w.array(w.number()).nonempty(),output:w.array(w.number()).nonempty(),easing:w.string().optional()})]).optional(),accentColor:w.string().optional(),displayArrowsOnPath:w.boolean().optional(),animateArrowsOnPath:w.boolean().optional(),visibleThroughGeometry:w.boolean().optional(),dashed:w.boolean().optional()}),DS=w.object({type:w.enum(["Feature"]),geometry:Ai,properties:w.object({parentId:w.any().optional()})});function Kd(e,r){w.object({features:w.array(DS)}).parse(e),ES.parse(r)}a(Kd,"validatePath");var Rn,pu=class pu{constructor(r,t){d(this,"type","path");d(this,"mesh",new gt);d(this,"material");d(this,"geometry");d(this,"outline");d(this,"feature");d(this,"options");d(this,"width",{on:"zoom-level",input:[17,22],output:[.4,.8]});d(this,"breakpoint",0);d(this,"altitudeBreakpoints");d(this,"accentColor","blue");d(this,"completeFraction",1);d(this,"altitudeAdjustment",1);d(this,"displayArrowsOnPath",!1);d(this,"animateArrowsOnPath",!1);d(this,"visibleThroughGeometry",!1);d(this,"dashed",!1);d(this,"isVertical",!1);d(this,"dirty",!0);d(this,"materialDirty",!0);d(this,"position",new z);L(this,Rn,0);var i,n,o,s,l,h;this.feature=r,this.options=t||{},this.width=(i=t==null?void 0:t.width)!=null?i:this.width,this.accentColor=(n=t==null?void 0:t.accentColor)!=null?n:this.accentColor,this.displayArrowsOnPath=(o=t==null?void 0:t.displayArrowsOnPath)!=null?o:this.displayArrowsOnPath,this.animateArrowsOnPath=(s=t==null?void 0:t.animateArrowsOnPath)!=null?s:this.animateArrowsOnPath,this.visibleThroughGeometry=(l=t==null?void 0:t.visibleThroughGeometry)!=null?l:this.visibleThroughGeometry,this.dashed=(h=t==null?void 0:t.dashed)!=null?h:this.dashed}setColor(){}setOpacity(){}set visible(r){this.mesh&&(this.mesh.visible=r)}get visible(){return this.mesh?this.mesh.visible:!1}get altitude(){return u(this,Rn)}set altitude(r){this.mesh&&(this.mesh.position.z=r,B(this,Rn,r))}set complete(r){this.material&&(this.material.uniforms.complete.value=r,this.material.needsUpdate=!0)}};Rn=new WeakMap,a(pu,"PathComponent");var xr=pu;x();var OS=300,kn,Nn,du=class du{constructor(r){d(this,"state");L(this,kn,new z);L(this,Nn,new z);this.state=r}update(r){var n;let t,i;this.state.cameraObject.getWorldPosition(u(this,Nn));for(let o of this.state.geometry2DIdsInScene)if(t=this.state.geometry2DMap.get(o),t&&(i=t.components[0],i&&"containerEl"in i&&i.markerContainer!=null)){if(i.visibilityNeedsUpdate!==!1&&(i.visibilityNeedsUpdate==="show"?i.canShow=!0:i.canShow=!1),(i.canShow&&i.visible===!0||((n=i.animation)==null?void 0:n.pending)===!0)&&!i.offscreen)if(i.options.zIndex!=null)i.markerContainer.style.transform="translate3D(".concat(i.projection.x,"px, ").concat(i.projection.y,"px, ").concat(i.options.zIndex,"px)");else{t.object3d.getWorldPosition(u(this,kn));let s=u(this,Nn).distanceTo(u(this,kn));i.markerContainer.style.transform="translate3D(".concat(i.projection.x,"px, ").concat(i.projection.y,"px, ").concat(-s,"px)")}if(i.canShow===!0&&i.visible===!0?i.markerContainer.style.pointerEvents=r?"none":i.pointerEvents:i.markerContainer.style.pointerEvents="none",i.currentStrategyIndex===-1&&i.visible&&i.visibilityNeedsUpdate==="show")continue;i.visibilityNeedsUpdate!==!1&&!i.offscreen&&(i.visibilityNeedsUpdate==="show"&&(i.markerContainer.style.opacity="0"),i.animation&&i.animation.cancel(),i.animation=i.markerContainer.animate([{opacity:i.canShow&&i.visible?"1":"0"}],{duration:OS,easing:"ease-in-out",fill:"forwards"}),i.visibilityNeedsUpdate=!1)}}};kn=new WeakMap,Nn=new WeakMap,a(du,"DOMDrawSystem");var Fs=du;x();var mu=class mu extends ie{constructor(t,i){super();d(this,"state");d(this,"dirty",!0);d(this,"domTree");d(this,"observers",new Map);d(this,"updateDimensions",a(t=>{t.forEach(i=>{var s;let o=(s=i.target.parentElement)==null?void 0:s.getAttribute("data-marker-id");if(o){let l=this.state.geometry2DMap.get(o),h=l==null?void 0:l.components[0];l&&h instanceof Dt&&(h.updateDimensions(i.contentRect.width,i.contentRect.height),h.collisionDirty=!0)}}),this.publish("dimensions-update")},"updateDimensions"));this.state=t,this.domTree=i}setupObserver(){var n;if(this.observers){for(let o of this.observers.values())o.disconnect();this.observers.clear()}let t,i;for(let o of this.domTree.children){let s=o.getAttribute("data-marker-id");if(s!=null&&(t=this.state.geometry2DMap.get(s),i=t.components[0],(n=i.options)!=null&&n.dynamicResize)){let l=new ResizeObserver(this.updateDimensions);l.observe(i.containerEl),this.observers.set(o.userData.entityId,l)}}}update(){this.dirty&&(this.setupObserver(),this.dirty=!1)}destroy(){for(let t of this.observers.values())t.disconnect();this.observers.clear()}};a(mu,"DOMResizeSystem");var Gs=mu;x();x();var Qd="uniform vec4 uSize;\nvarying vec2 vUv;\nvoid main() {\n vUv = uv;\n // Scale the position by the size of the quad\n // and shift to top left corner for 0,0\n vec2 transformed = position.xy * uSize.xy - vec2(1.0, -1.0);\n // Apply width .x and height .y of image\n transformed += vec2(uSize.x, -uSize.y);\n // Apply left .w and top .z offset\n transformed += vec2(uSize.w, -uSize.z) * 2.0;\n gl_Position = vec4(transformed, 1.0, 1.0);\n}";x();var em="varying vec2 vUv;\nuniform sampler2D uTexture;\nuniform float uOpacity;\nvoid main() {\n #ifndef debug\n vec4 texture = texture2D(uTexture, vUv);\n gl_FragColor = vec4(texture.rgb, texture.a * uOpacity);\n #else\n gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);\n #endif\n}";x();var tm=4.291666666666667,rm=15,im=25,nm=43/60;x();var om=["horizontal","icon"],LS=new Map([[om[0],'<svg viewBox="0 0 206 48">\n <path d="M27.2678 14.2261H22.3187C21.0695 14.2261 20.4695 14.7801 20.4695 15.9852V31.142L10.3966 15.5591C9.69665 14.4784 9.2475 14.2773 7.8475 14.2261H2.97462C1.67462 14.2261 1.07631 14.7801 1.07631 15.9852V44.7665C1.07631 45.9716 1.67462 46.5256 2.97462 46.5256H7.92377C9.22207 46.5256 9.82207 45.9716 9.82207 44.7665V29.6847L19.9441 45.1926C20.695 46.3244 21.095 46.5256 22.4933 46.5256H27.2933C28.5916 46.5256 29.1916 45.9716 29.1916 44.7665V15.9852C29.1407 14.7801 28.5424 14.2261 27.2678 14.2261Z"/>\n <path d="M5.44915 10.9602C8.45863 10.9602 10.8983 8.50669 10.8983 5.48011C10.8983 2.45353 8.45863 0 5.44915 0C2.43967 0 0 2.45353 0 5.48011C0 8.50669 2.43967 10.9602 5.44915 10.9602Z"/>\n <path d="M61.7899 25.0449C63.2306 23.1903 65.078 22.2051 67.556 22.2051C72.0526 22.2051 74.7611 25.3347 74.7611 29.4511V39.2489C74.8187 39.7125 74.5306 39.9443 74.0695 39.9443H72.5136C72.0526 39.9443 71.7645 39.7125 71.8221 39.2489V29.5091C71.8221 27.1909 69.9187 25.2187 67.4984 25.2187C65.1339 25.2187 63.2323 27.1329 63.2323 29.2773V39.2489C63.2899 39.7125 63.0018 39.9443 62.5407 39.9443H60.9831C60.5221 39.9443 60.2916 39.7125 60.2916 39.2489V29.4511C60.2916 27.1329 58.3899 25.2187 56.0255 25.2187C53.7204 25.2187 51.7594 27.075 51.7594 29.2773V39.3068C51.817 39.7705 51.5289 40.0023 51.0102 40.0023H49.5119C49.0509 40.0023 48.7628 39.7705 48.7628 39.3068V23.25C48.7051 22.7864 48.9933 22.4966 49.5119 22.4966H50.9526C51.356 22.4966 51.5289 22.6704 51.5289 23.0182V24.2352C52.7407 22.9602 54.239 22.2648 56.0255 22.2648C58.4475 22.2068 60.3492 23.192 61.7899 25.0466V25.0449ZM77.1255 31.2477C77.1255 26.3216 81.1018 22.2051 86.1187 22.2051C88.539 22.2051 90.6136 23.1903 92.3441 25.1608V23.1903C92.3441 22.7267 92.5746 22.5528 93.0357 22.5528H94.4187C94.8797 22.5528 95.1102 22.7847 95.1102 23.3062V39.3648C95.1102 39.8284 94.8797 40.0602 94.4187 40.0602H93.0357C92.5746 40.0602 92.3441 39.8284 92.3441 39.4227V37.4523C90.6712 39.3648 88.5967 40.35 86.1746 40.35C81.1018 40.2341 77.1238 36.1773 77.1238 31.2477H77.1255ZM92.1136 31.2477C92.1136 27.8284 89.4611 25.2187 86.0594 25.2187C82.7746 25.2187 80.1221 27.8864 80.1221 31.2477C80.1221 34.6687 82.7746 37.2784 86.1187 37.2784C86.9062 37.2789 87.6861 37.1232 88.4138 36.8202C89.1414 36.5173 89.8026 36.0731 90.3593 35.513C90.9161 34.9528 91.3577 34.2878 91.6587 33.556C91.9597 32.8241 92.1143 32.0397 92.1136 31.2477ZM100.992 37.3943V46.3807C101.049 46.8443 100.761 47.1341 100.298 47.1341H98.7424C98.2814 47.1341 97.9933 46.9023 97.9933 46.3807V23.1903C97.9933 22.7267 98.2238 22.4369 98.7424 22.4369H100.183C100.646 22.379 100.934 22.6687 100.934 23.0744V24.9869C102.605 23.0744 104.68 22.1472 107.044 22.1472C112.002 22.1472 116.037 26.2619 116.037 31.1898C116.037 36.1176 112.059 40.2341 107.044 40.2341C104.622 40.2341 102.603 39.3068 100.992 37.3943ZM106.987 25.2187C103.7 25.2187 101.049 27.8864 101.049 31.2477C101.049 34.6687 103.7 37.2784 107.044 37.2784C110.446 37.2784 113.039 34.6108 113.039 31.2477C113.039 27.8864 110.388 25.2187 106.987 25.2187ZM121.11 37.3943V46.3807C121.168 46.8443 120.88 47.1341 120.419 47.1341H118.861C118.4 47.1341 118.112 46.9023 118.112 46.3807V23.1903C118.112 22.7267 118.342 22.4369 118.861 22.4369H120.302C120.764 22.379 121.053 22.6687 121.053 23.0744V24.9869C122.724 23.0744 124.798 22.1472 127.163 22.1472C132.12 22.1472 136.156 26.2619 136.156 31.1898C136.156 36.1176 132.178 40.2341 127.163 40.2341C124.742 40.2341 122.781 39.3068 121.11 37.3943ZM127.105 25.2187C123.819 25.2187 121.168 27.8864 121.168 31.2477C121.168 34.6687 123.819 37.2784 127.163 37.2784C130.564 37.2784 133.158 34.6108 133.158 31.2477C133.158 27.8864 130.507 25.2187 127.107 25.2187H127.105ZM153.97 32.3506H141.054C141.342 35.2483 143.995 37.4523 147.164 37.4523C148.893 37.4523 150.393 37.0466 151.719 36.0597C152.007 35.8858 152.295 35.7699 152.353 35.7699C152.583 35.7699 152.756 35.8858 152.929 36.1773L153.505 37.1625C153.622 37.3364 153.68 37.4523 153.68 37.5682C153.68 37.8 153.507 38.0318 153.103 38.3216C151.258 39.5966 149.183 40.292 146.992 40.292C141.688 40.292 137.883 36.3511 137.883 31.2477C137.883 26.204 141.803 22.2051 146.703 22.2051C151.546 22.2051 154.717 25.7983 154.717 31.0176C154.717 31.5972 154.717 32.3506 153.968 32.3506H153.97ZM141.056 30.0324H151.72C151.432 26.8432 149.473 24.929 146.648 24.929C145.241 24.8904 143.875 25.3995 142.833 26.3501C141.791 27.3007 141.154 28.6194 141.056 30.0307V30.0324ZM156.332 31.2477C156.332 26.3216 160.31 22.2051 165.326 22.2051C167.748 22.2051 169.707 23.1324 171.32 25.0449V16.2324C171.263 15.7687 171.551 15.479 172.012 15.479H173.57C174.031 15.479 174.319 15.7108 174.319 16.2324V39.3068C174.319 39.7705 174.088 40.0023 173.57 40.0023H172.129C171.666 40.0602 171.378 39.7705 171.378 39.3648V37.3943C169.649 39.3068 167.632 40.292 165.268 40.292C160.31 40.2341 156.332 36.1773 156.332 31.2477ZM171.264 31.2477C171.264 27.8284 168.612 25.2187 165.21 25.2187C161.924 25.2187 159.273 27.8864 159.273 31.2477C159.273 34.6687 161.924 37.2784 165.268 37.2784C166.057 37.2838 166.839 37.1316 167.569 36.8304C168.299 36.5292 168.962 36.0852 169.52 35.5241C170.077 34.963 170.519 34.296 170.818 33.5619C171.117 32.8277 171.268 32.0411 171.263 31.2477H171.264ZM177.72 19.0739C177.715 18.8594 177.754 18.646 177.833 18.4468C177.912 18.2476 178.031 18.0667 178.182 17.915C178.333 17.7633 178.512 17.6439 178.71 17.5642C178.909 17.4845 179.121 17.446 179.334 17.4511C179.546 17.4507 179.756 17.4923 179.952 17.5737C180.148 17.6551 180.326 17.7746 180.476 17.9254C180.626 18.0762 180.745 18.2553 180.826 18.4523C180.907 18.6494 180.948 18.8606 180.948 19.0739C180.953 19.2884 180.914 19.5017 180.835 19.7009C180.756 19.9001 180.637 20.081 180.486 20.2327C180.335 20.3845 180.156 20.5038 179.957 20.5835C179.759 20.6633 179.547 20.7017 179.334 20.6966C178.412 20.7545 177.72 20.0591 177.72 19.0739ZM177.836 39.2489V23.1903C177.836 22.7267 178.066 22.4369 178.527 22.4369H180.083C180.544 22.4369 180.832 22.6687 180.775 23.1903V39.2489C180.832 39.7125 180.544 39.9443 180.083 39.9443H178.527C178.066 39.9443 177.836 39.7125 177.836 39.2489ZM186.944 23.0165V24.1756C188.212 22.8426 189.71 22.2051 191.497 22.2051C195.937 22.2051 198.646 25.2767 198.646 29.3932V39.2489C198.703 39.7125 198.415 39.9443 197.954 39.9443H196.398C195.936 39.9443 195.705 39.7125 195.705 39.2489V29.4511C195.705 27.1329 193.803 25.2187 191.439 25.2187C189.134 25.2187 187.175 27.075 187.175 29.2773V39.3068C187.232 39.7705 186.944 40.0023 186.424 40.0023H184.868C184.407 40.0023 184.119 39.7705 184.119 39.3068V23.1903C184.061 22.7267 184.349 22.4949 184.868 22.4949H186.309C186.712 22.4949 186.944 22.6687 186.944 23.0165Z"/>\n <path d="M204 40C205.115 40 206 39.0857 206 38V37.9886C206 36.9029 205.126 36 204 36C202.885 36 202 36.9143 202 38V38.0114C202 39.0971 202.874 40 204 40ZM204 39.7829C202.989 39.7829 202.23 38.9829 202.23 38.0114V38C202.23 37.0286 203 36.2171 204 36.2171C205.011 36.2171 205.77 37.0171 205.77 37.9886V38C205.77 38.9714 205 39.7829 204 39.7829ZM203.218 38.9714H203.609V38.2743H204.034L204.517 38.9714H204.989L204.448 38.2057C204.724 38.1257 204.92 37.92 204.92 37.5886C204.92 37.1657 204.586 36.9486 204.138 36.9486H203.218V38.9714ZM203.609 37.9543V37.2914H204.103C204.368 37.2914 204.517 37.4057 204.517 37.6229C204.517 37.8171 204.368 37.9543 204.103 37.9543H203.609Z"/>\n </svg>'],[om[1],'<svg viewBox="0 0 43 60">\n <path d="M14.0291 7.06645C14.0291 10.9691 10.8885 14.1329 7.01453 14.1329C3.14051 14.1329 0 10.9691 0 7.06645C0 3.16376 3.14051 0 7.01453 0C10.8885 0 14.0291 3.16376 14.0291 7.06645Z"/>\n <path d="M28.7335 18.3468H35.1045C36.7455 18.3468 37.5178 19.0599 37.5821 20.6158V57.7309C37.5821 59.2868 36.8099 60 35.1367 60H28.9588C27.1569 60 26.642 59.7406 25.6767 58.282L12.6452 38.282V57.7309C12.6452 59.2868 11.8729 60 10.1997 60H3.82873C2.15554 60 1.3833 59.2868 1.3833 57.7309V20.6158C1.3833 19.0599 2.15554 18.3468 3.82873 18.3468H10.1032C11.9051 18.4116 12.4843 18.671 13.3852 20.0648L26.3524 40.162V20.6158C26.3524 19.0599 27.1247 18.3468 28.7335 18.3468Z"/>\n <path d="M41.5 60C42.3362 60 43 59.3143 43 58.5V58.4914C43 57.6771 42.3448 57 41.5 57C40.6638 57 40 57.6857 40 58.5V58.5086C40 59.3229 40.6552 60 41.5 60ZM41.5 59.8371C40.7414 59.8371 40.1724 59.2371 40.1724 58.5086V58.5C40.1724 57.7714 40.75 57.1629 41.5 57.1629C42.2586 57.1629 42.8276 57.7629 42.8276 58.4914V58.5C42.8276 59.2286 42.25 59.8371 41.5 59.8371ZM40.9138 59.2286H41.2069V58.7057H41.5259L41.8879 59.2286H42.2414L41.8362 58.6543C42.0431 58.5943 42.1897 58.44 42.1897 58.1914C42.1897 57.8743 41.9397 57.7114 41.6034 57.7114H40.9138V59.2286ZM41.2069 58.4657V57.9686H41.5776C41.7759 57.9686 41.8879 58.0543 41.8879 58.2171C41.8879 58.3629 41.7759 58.4657 41.5776 58.4657H41.2069Z"/>\n </svg>']]),AS=/<svg([^>]*)>/g;function sm(e,r,t,i){let n=LS.get(e);return n?n.replace(AS,'<svg$1 width="'.concat(t,'" height="').concat(i,'" xmlns="http://www.w3.org/2000/svg" style="fill: ').concat(r,';">')):""}a(sm,"getLogoIcon");var am=!1,de,$t,Ri,Ne,tt,$r,xt,kt,fu=class fu extends ie{constructor(t,i,n){super();L(this,de,{padding:16,scale:1,iconOnly:!1,position:"bottom-left",color:"dark",onClick:a(()=>{window!=null&&window.open("https://www.mappedin.com")},"onClick"),interactive:!0,visible:!0});L(this,$t);L(this,Ri);L(this,Ne);L(this,tt);L(this,$r);L(this,xt,0);L(this,kt,0);d(this,"dirty",!0);d(this,"getPositionAlignedCanvasCoordinates",a((t,i)=>({"top-left":{x:0,y:0},"top-right":{x:t,y:0},"bottom-left":{x:0,y:i},"bottom-right":{x:t,y:i},center:{x:t/2,y:i/2},top:{x:t/2,y:0},bottom:{x:t/2,y:i},left:{x:0,y:i/2},right:{x:t,y:i/2}})[u(this,de).position],"getPositionAlignedCanvasCoordinates"));d(this,"getPositionAlignedPadding",a(()=>{var n,o,s,l;let t=u(this,de).padding;if(typeof t=="number")return{"top-left":{x:t,y:t},"top-right":{x:-t,y:t},"bottom-left":{x:t,y:-t},"bottom-right":{x:-t,y:-t},center:{x:0,y:0},top:{x:0,y:t},bottom:{x:0,y:-t},left:{x:t,y:0},right:{x:-t,y:0}}[u(this,de).position];let i={top:(n=t.top)!=null?n:0,right:(o=t.right)!=null?o:0,bottom:(s=t.bottom)!=null?s:0,left:(l=t.left)!=null?l:0};return{x:i.left-i.right,y:i.top-i.bottom}},"getPositionAlignedPadding"));n&&Object.entries(n).forEach(([o,s])=>{s!==void 0&&(u(this,de)[o]=s)}),B(this,Ri,t),B(this,$t,i)}get color(){return u(this,de).color==="light"?"white":"#293136"}get iconName(){return u(this,de).iconOnly?"icon":"horizontal"}get minWidth(){return u(this,de).iconOnly?rm:75}get defaultWidth(){return u(this,de).iconOnly?im:150}get aspectRatio(){return u(this,de).iconOnly?nm:tm}get options(){return se({},u(this,de))}set options(t){var i,n;B(this,de,{padding:t.padding||u(this,de).padding,position:t.position||u(this,de).position,iconOnly:t.iconOnly||u(this,de).iconOnly,color:t.color||u(this,de).color,scale:t.scale||u(this,de).scale,onClick:u(this,de).onClick,interactive:(i=t.interactive)!=null?i:u(this,de).interactive,visible:(n=t.visible)!=null?n:u(this,de).visible})}get icon(){return sm(this.iconName,this.color,u(this,xt)*u(this,$t).pixelRatio,u(this,kt)*u(this,$t).pixelRatio)}setSize(t,i){u(this,tt)&&(u(this,tt).uniforms.uSize.value.x=t,u(this,tt).uniforms.uSize.value.y=i)}setXY(t,i){u(this,tt)&&(u(this,tt).uniforms.uSize.value.w=t,u(this,tt).uniforms.uSize.value.z=i)}get width(){return u(this,xt)}get height(){return u(this,kt)}getPositionAlignedOffset(t,i){return{"top-left":{x:0,y:0},"top-right":{x:-t,y:0},"bottom-left":{x:0,y:-i},"bottom-right":{x:-t,y:-i},center:{x:-(t/2),y:-(i/2)},top:{x:-(t/2),y:0},bottom:{x:-(t/2),y:-i},left:{x:0,y:-(i/2)},right:{x:-t,y:-(i/2)}}[u(this,de).position]}insertIntoQuadTree(t){u(this,$r)!=null&&typeof u(this,de).onClick=="function"&&u(this,de).interactive&&t.insert(u(this,$r))}resize(t,i){if(u(this,de).visible!==!0)return;let n=this.getPositionAlignedCanvasCoordinates(t,i),o=this.getPositionAlignedPadding(),s=this.getPositionAlignedOffset(u(this,xt),u(this,kt)),l=Math.min(t-u(this,xt),Math.max(0,n.x+o.x+s.x)),h=Math.min(i-u(this,kt),Math.max(0,n.y+o.y+s.y));this.setSize(u(this,xt)/t,u(this,kt)/i),this.setXY(l/t,h/i),B(this,$r,new he(l,h,u(this,xt),u(this,kt),{entityId:"watermark"}))}update(){this.dirty&&(u(this,de).visible===!0?(B(this,xt,Math.min(u(this,$t).canvasWidth,Math.max(this.minWidth,this.defaultWidth*u(this,de).scale))),B(this,kt,u(this,xt)/this.aspectRatio),vr.getLoader().load("data:image/svg+xml;base64,".concat(btoa(this.icon)),t=>{if(B(this,tt,new nr({uniforms:{uTexture:{value:t},uSize:{value:new fc(0,0,0,0)},uOpacity:{value:.7}},vertexShader:Qd,fragmentShader:em,depthWrite:!1,depthTest:!1,defines:{debug:am},wireframe:am,transparent:!0,visible:!0})),u(this,Ne))u(this,Ne).visible=!0,u(this,Ne).material=u(this,tt),u(this,Ne).material.needsUpdate=!0;else{let i=new yt(2,2,1,1);B(this,Ne,new ae(i,u(this,tt))),u(this,Ne).position.set(0,0,-1),u(this,Ne).frustumCulled=!1,u(this,Ne).renderOrder=999;let n=new rr(1,1,1),o=new ae(n,new je({transparent:!0,opacity:0,depthTest:!1,depthWrite:!1}));o.frustumCulled=!1,o.layers.set(1),u(this,Ne).add(o),u(this,Ri).add(u(this,Ne))}this.resize(u(this,$t).canvasWidth,u(this,$t).canvasHeight),this.publish("texture-loaded")})):u(this,Ne)&&(u(this,Ne).visible=!1),this.dirty=!1)}destroy(){u(this,Ne)&&(u(this,Ri).remove(u(this,Ne)),Ee(u(this,Ne))),B(this,Ne,void 0),u(this,tt)&&u(this,tt).dispose(),B(this,tt,void 0),B(this,$r,void 0)}};de=new WeakMap,$t=new WeakMap,Ri=new WeakMap,Ne=new WeakMap,tt=new WeakMap,$r=new WeakMap,xt=new WeakMap,kt=new WeakMap,a(fu,"WatermarkSystem");var Xs=fu;x();var zs=100,NS=!1,yu=class yu extends ie{constructor(t,i){super();d(this,"currentTotalBoundingBox");d(this,"state");d(this,"cameraSystem");d(this,"debugMesh",null);d(this,"dirty",!0);d(this,"autoMinZoomLevel",!0);this.state=t,this.cameraSystem=i}update(){if(this.dirty){this.currentTotalBoundingBox==null&&(this.currentTotalBoundingBox=new Ue,this.state.entityScene.children.length===0?this.currentTotalBoundingBox.setFromCenterAndSize(new z(0,0,0),new z(zs*2,zs*2,0)):(this.currentTotalBoundingBox.setFromObject(this.state.entityScene),this.currentTotalBoundingBox.expandByScalar(zs)));let t=new Ue().setFromObject(this.state.entityScene);this.currentTotalBoundingBox.union(t);let i=t.getSize(new z),n=Math.max(i.x,i.y,i.z);for(let s of this.state.geometry2DMap.values())s.positionDirty===!0&&(this.currentTotalBoundingBox.expandByPoint(s.position),s.positionDirty=!1);let o=Ys.copy(this.currentTotalBoundingBox).expandByScalar(Math.max(n,zs)).getBoundingSphere(BS).radius;if(this.cameraSystem.panBounds={center:this.currentTotalBoundingBox.getCenter(new z),min:Ys.min,max:Ys.max,radius:o},this.publish("update"),this.cameraSystem.dirty=!0,this.dirty=!1,NS&&this.state.entityScene.parent instanceof or){this.debugMesh&&(this.state.entityScene.parent.remove(this.debugMesh),this.debugMesh=null),this.debugMesh=new zt,this.debugMesh.add(new ae(new yo(this.cameraSystem.panBounds.radius),new je({color:16711680,transparent:!0,opacity:.2}))),this.debugMesh.position.copy(this.cameraSystem.panBounds.center),this.state.entityScene.parent.add(this.debugMesh);let s=new z;Ys.getSize(s);let l=new rr(s.x,s.y,s.z),h=new je({color:65280,wireframe:!0,transparent:!0,opacity:.5}),p=new ae(l,h);p.position.copy(this.currentTotalBoundingBox.getCenter(new z)),this.debugMesh.add(p)}}}};a(yu,"PanBoundsSystem");var Zs=yu,Ys=new Ue,BS=new gc;x();var Bn,Fn,gu=class gu{constructor(r,t){d(this,"mesh");d(this,"type","custom-geometry");d(this,"dirty",!0);d(this,"feature");d(this,"builder");d(this,"outline");L(this,Bn,1);d(this,"color",new ye);L(this,Fn,0);this.mesh=new gt,this.feature=r,this.builder=t}get visible(){return this.mesh.visible}set visible(r){this.mesh.visible=r}set opacity(r){B(this,Bn,r)}get opacity(){return u(this,Bn)}setColor(r){this.color.set(r)}get position(){var r;return(r=this.mesh)==null?void 0:r.position}get altitude(){return u(this,Fn)}set altitude(r){this.mesh&&(this.mesh.position.z=r,B(this,Fn,r))}get renderOrder(){return this.mesh?this.mesh.renderOrder:0}set renderOrder(r){this.mesh&&(this.mesh.renderOrder=r)}};Bn=new WeakMap,Fn=new WeakMap,a(gu,"CustomGeometryComponent");var ki=gu;x();var bu=class bu{constructor(r,t){d(this,"state");d(this,"convertTo3DMapPosition");this.state=r,this.convertTo3DMapPosition=t}update(){let r,t;for(let i of this.state.geometry3DIdsInScene){let n=this.state.geometry3DMap.get(i);(n==null?void 0:n.type)==="custom-geometry"&&(r=n.components[0],t=n.components[1],r.dirty&&t.visible!==!1&&(r.position.copy(this.convertTo3DMapPosition(r.feature.geometry.coordinates[1],r.feature.geometry.coordinates[0],t.altitude)),r.builder.setup(r.mesh),r.mesh.traverse(o=>{o.userData=Ze(se({},o.userData),{entityId:i,type:"custom-geometry"})}),r.dirty=!1),t.visible!==!1&&r.builder.update(r.mesh))}}};a(bu,"CustomGeometrySystem");var Us=bu;x();x();function lm(e){return e.children.some(r=>r.userData.isOutline)}a(lm,"hasOutline");function um(e,r){var i;let t=e.userData.entities3D.values().next().value;return t?((i=r.geometry3DMap.get(t))==null?void 0:i.components[3])!==void 0:!1}a(um,"needsOutline");function Hs(e,r,t,i){let o=e.getAttribute("position").array,s=-1/0;for(let l=0;l<r.count;l++){let p=(r.start+l)*3,m=o[p+2];s=Math.max(s,m)}for(let l=0;l<r.count;l++){let p=(r.start+l)*3,m=o[p+2];Math.abs(m-s)<1e-4?o[p+2]=Math.max(t+i,2e-4+i):o[p+2]=i}e.attributes.position.needsUpdate=!0}a(Hs,"updateBufferGeometryHeight");x();function vu(e){var p,m;let r=new mo,t=(p=e.mesh)==null?void 0:p.geometry;if(!t||!((m=e.batchedProps)!=null&&m.range))return;let i=e.batchedProps.range,n=i.start,o=i.count,s=t.getAttribute("position");if(s){let f=new Float32Array(o*3);for(let v=0;v<o;v++){let y=n+v;f[v*3]=s.array[y*3],f[v*3+1]=s.array[y*3+1],f[v*3+2]=s.array[y*3+2]}r.setAttribute("position",new $e(f,3))}let l=t.getAttribute("normal");if(l){let f=new Float32Array(o*3);for(let v=0;v<o;v++){let y=n+v;f[v*3]=l.array[y*3],f[v*3+1]=l.array[y*3+1],f[v*3+2]=l.array[y*3+2]}r.setAttribute("normal",new $e(f,3))}let h=t.getAttribute("uv");if(h){let f=new Float32Array(o*2);for(let v=0;v<o;v++){let y=n+v;f[v*2]=h.array[y*2],f[v*2+1]=h.array[y*2+1]}r.setAttribute("uv",new $e(f,2))}if(t.index){let f=t.index,v=new Uint32Array(o);for(let y=0;y<o;y++)v[y]=f.array[n+y];r.setIndex(new $e(v,1))}return r}a(vu,"extractBufferGeometryFromBatchedGeometry");function cm(e,r){let t=vu(e);if(!t||!e.mesh)return;e.mesh.deleteInstance(e.instanceIndex),e.mesh.optimize();let i=r.addGeometry(t);r.addInstance(i);let n=r.getGeometryIdAt(i),o=r.getGeometryRangeAt(n);return o&&e.batchedProps&&(e.batchedProps.range=o),t.dispose(),i}a(cm,"transferGeometryToNewBatchedMesh");x();var xu=class xu extends xa{constructor(r){super(r),this.onBeforeCompile=t=>{t.vertexShader=t.vertexShader.replace("#include <common>","#include <common>\n attribute float visibility;"),t.vertexShader=t.vertexShader.replace("#include <project_vertex>","#include <project_vertex>\n if (visibility < 0.5) {\n gl_Position = vec4(-2.0, -2.0, -2.0, 1.0);\n }")}}};a(xu,"OutlineLineMaterial");var Ws=xu;var XS=80,Kr,Ni,Vs,qs,Su=class Su{constructor(r){d(this,"rendererState");d(this,"outlineOpacitiesDirty",!0);L(this,Kr,!0);L(this,Ni,-1/0);L(this,Vs,new Map);L(this,qs,new Ws({vertexColors:!0,linewidth:1,transparent:!0,opacity:1,side:_r}));this.rendererState=r}get geometries3DDirty(){return u(this,Kr)}set geometries3DDirty(r){B(this,Kr,r)}update(r,t=!0){let i;if(this.geometries3DDirty){for(let o of this.rendererState.geometry3DIdsInScene){let s=this.rendererState.geometry3DMap.get(o);if(s instanceof lt&&um(s,this.rendererState)&&!lm(s)&&s.userData.entities3D.size>0){let l=[];for(let g of s.userData.entities3D.values()){let b=this.rendererState.geometry3DMap.get(g);if(b instanceof ne&&b.type==="geometry"&&b.components[3]&&b.components[3].dirty===!0&&b.components[0].material!=null){let P=b.components[0].geometry,S=!1;P||(P=vu(b.components[0]),S=!0),l.push([b.components[3],new Sa(P,XS)]),S&&(P==null||P.dispose(),P=void 0)}}if(l.length===0)continue;let h=ut(l.map(g=>g[1]),!1);if(h==null)continue;let p=h.getAttribute("position"),m=new Float32Array(p.count*4),f=new $e(m,4);h.setAttribute("color",f);let v=new Uint8Array(p.count);v.fill(0);let y=new $e(v,1,!1);h.setAttribute("visibility",y);let C=0;for(let g=0;g<l.length;g++){let[b,P]=l[g],S=P.getAttribute("position").count;b.edgeColors=f,b.edgeVisibility=y,b.geometry=h,b.ranges={count:S,start:C},C+=S,P.dispose()}let M=new ai(h,u(this,qs));M.userData.isOutline=!0,s.add(M)}}B(this,Kr,!1),this.outlineOpacitiesDirty=!0}for(let o of this.rendererState.geometry3DIdsInScene){let s=this.rendererState.geometry3DMap.get(o);if(s instanceof ne&&s.type==="geometry"&&s.components[3]&&s.components[3].dirty===!0&&s.components[0].material!=null&&s.parentObject3D instanceof lt){let l=s.components[3].geometry;if(!l)continue;let h=s.components[3];if(!h)continue;let p=h.enabled&&s.components[1].visible;if(h.visible!==p&&(h.visible=p),!h.visible)continue;let m=h.edgeColors;if(!m||!h.ranges)continue;let f=new ye(h.color);for(let C=0;C<h.ranges.count;C++){let M=h.ranges.start+C;m.setXYZ(M,f.r,f.g,f.b)}let v=s.components[1].height,y=s.components[1].altitude;Hs(l,h.ranges,v,y),l.attributes.color.needsUpdate=!0,l.computeBoundingSphere(),h.dirty=!1}}let n=t?Lr(r,16,19,0,1):u(this,Ni);if((n!==u(this,Ni)||this.outlineOpacitiesDirty)&&this.rendererState.geometry3DIdsInScene.size>0){for(let o of this.rendererState.geometry3DIdsInScene)if(i=this.rendererState.geometry3DMap.get(o),(i==null?void 0:i.type)==="geometry"&&i.components[0]instanceof Me){let s=i.components[3];if(s&&s.edgeColors&&s.geometry&&s.visible){let l=Math.min(n,i.components[1].opacity*ci(i));if(s.currentOpacity!==l){for(let h=0;h<s.ranges.count;h++){let p=s.ranges.start+h;s.edgeColors.setW(p,l)}s.geometry.attributes.color.needsUpdate=!0}}}}B(this,Ni,n),B(this,Kr,!1),this.outlineOpacitiesDirty=!1}destroy(){u(this,Vs).clear()}};Kr=new WeakMap,Ni=new WeakMap,Vs=new WeakMap,qs=new WeakMap,a(Su,"OutlineInterpolationSystem");var js=Su;x();x();var Cu=class Cu extends ae{constructor(){super(...arguments);d(this,"userData",{entityId:""})}};a(Cu,"EntityMesh");var Js=Cu,zS=w.object({flipImageToFaceCamera:w.boolean().optional(),url:w.string()}),YS=w.object({type:w.enum(["Feature"]),properties:w.object({width:w.number(),height:w.number(),rotation:w.number().min(0).max(360).optional(),verticalOffset:w.number().optional()}),geometry:Ai});function hm(e,r,t){w.union([w.number(),w.string()]).parse(e),YS.parse(r),zS.parse(t)}a(hm,"validateImage");var Pu=class Pu{constructor(r){d(this,"mesh",new gt);d(this,"imageMesh");d(this,"outline");d(this,"type","image");d(this,"instanceIndex",-1);d(this,"geometry");d(this,"material");d(this,"feature");d(this,"position",new z);this.feature=r}get visible(){var r,t;return(t=(r=this.mesh)==null?void 0:r.visible)!=null?t:!1}set visible(r){this.mesh&&(this.mesh.visible=r)}};a(Pu,"ImageComponent");var $s=Pu;x();function Tu(e,r){return{x:e.x*Math.cos(r)-e.y*Math.sin(r),y:e.x*Math.sin(r)+e.y*Math.cos(r)}}a(Tu,"rotatePoint");function ZS(e,r){return e.map(t=>Tu(t,r))}a(ZS,"rotatePoints");function US(e){let r=1/0,t=1/0,i=-1/0,n=-1/0;for(let o of e)r=Math.min(r,o.x),t=Math.min(t,o.y),i=Math.max(i,o.x),n=Math.max(n,o.y);return{minX:r,minY:t,maxX:i,maxY:n}}a(US,"getBounds");function HS(e,r){let t=!1;for(let i=0,n=r.length-1;i<r.length;n=i++){let o=r[i].x,s=r[i].y,l=r[n].x,h=r[n].y;s>e.y!=h>e.y&&e.x<(l-o)*(e.y-s)/(h-s)+o&&(t=!t)}return t}a(HS,"pointInPolygon");function pm(e,r,t,i,n){for(let o=0;o<n;o++)for(let s=0;s<i;s++)if(e[t+o][r+s]!==1)return!1;return!0}a(pm,"isValidRectangle");function WS(e,r,t){let i=e.maxX-e.minX,n=e.maxY-e.minY,o,s,l=se({},e);return i/n>r?(s=n/t,o=s*r,l.minX+=(i-o*t)/2):(o=i/t,s=o/r,l.minY+=(n-s*t)/2),{dx:o,dy:s,gridBounds:l}}a(WS,"calculateGridDimensions");function jS(e,r,t,i,n){let o=Array(t).fill(0).map(()=>Array(t).fill(0));for(let s=0;s<t;s++)for(let l=0;l<t;l++){let h={x:r.minX+l*i,y:r.minY+s*n};HS(h,e)&&(o[s][l]=1)}return o}a(jS,"createAndFillGrid");function VS(e,r){let t=Array(r).fill(0).map(()=>Array(r).fill(0));for(let i=0;i<r;i++)for(let n=0;n<r;n++)if(e[i][n]===1){let o=0;for(let s=1;s<=Math.min(r-n,r-i)&&pm(e,n,i,s,s);s++)o=s;t[i][n]=o}return t}a(VS,"calculateRectSizes");function qS(e,r,t,i,n,o){let s=0,l=0,h=0;for(let p=0;p<i;p++)for(let m=0;m<i;m++)if(e[p][m]===1){let f=Math.pow(r[p][m],2),v=t.minX+m*n,y=t.minY+p*o;s+=f,l+=v*f,h+=y*f}return{x:l/s,y:h/s}}a(qS,"calculatePolygonCenter");function JS(e,r,t,i,n,o,s){let l=-1/0,h=null,p=e.length,m=Math.sqrt(Math.pow(r.maxX-r.minX,2)+Math.pow(r.maxY-r.minY,2));for(let f=0;f<p;f++)for(let v=0;v<p;v++)if(e[f][v]===1)for(let y=1;y<=p-v;y++){let C=y;if(!(C>p-f)&&pm(e,v,f,y,C)){let M=y*C,g=r.minX+(v+y/2)*t,b=r.minY+(f+C/2)*i,P={x:g,y:b},T=Math.sqrt(Math.pow(P.x-n.x,2)+Math.pow(P.y-n.y,2))/m,_=M*(1-o)-T*o*M;_>l&&(l=_,h={center:P,width:y*t*s,height:y*i*s})}}return h}a(JS,"findBestRectangle");function Mu(e,r,t,i={}){let{scaleFactor:n=.9,centerPriority:o=.5,resolution:s=100,minimumSizeRatio:l=.5}=i,h=Oc(t),p=e.width/e.height,m=ZS(r,h),f=US(m),{dx:v,dy:y,gridBounds:C}=WS(f,p,s),M=jS(m,C,s,v,y),g=VS(M,s),b=qS(M,g,C,s,v,y),P=JS(M,C,v,y,b,o,n);return!P||P.width<e.width*l||P.height<e.height*l?e:Ze(se({},P),{center:Tu(P.center,-h),rotation:t,polygonCenter:Tu(b,-h)})}a(Mu,"findLargestInteriorRectangle");var Gn=Math.PI*2,$S=Math.PI/2,KS=Math.PI*1.5,QS=li($S,2),eC=li(KS,2),tC=.01,dm=!1,_u=class _u extends ie{constructor(t,i,n=0,o=0,s={}){super();d(this,"rendererState");d(this,"convertTo3DMapPosition");d(this,"initialBearing",0);d(this,"naturalBearing",0);d(this,"imagePlacementOptions");d(this,"imageLoadingCache",new Map);this.rendererState=t,this.convertTo3DMapPosition=i,this.initialBearing=n,this.naturalBearing=o,this.imagePlacementOptions=s}createImageMesh(t,i,n,o=0,s,l){var C,M,g;let h={width:n.width,height:n.height,center:this.convertTo3DMapPosition(s),rotation:(C=n.rotation)!=null?C:0},p=(M=this.imagePlacementOptions.mode)!=null?M:"default",m=(()=>{switch(p){case"fit-nearest-90":let b=(this.initialBearing-this.naturalBearing+360)%180;return b>=45&&b<=135?Mu(h,l,h.rotation+90,this.imagePlacementOptions):h;case"fit-initial-bearing":return Mu(h,l,this.initialBearing,this.imagePlacementOptions);case"default":case"none":default:return h}})();if(dm&&m.polygonCenter){let b=new ae(new yo(1),new Er({color:65280}));b.position.set(m.polygonCenter.x,m.polygonCenter.y,o),this.rendererState.entityScene.add(b)}let f=new Er({transparent:!0,depthWrite:!1,side:ft}),v=new yt(m.width,m.height),y=new Js(v);if(y.visible=!1,y.renderOrder=1,(g=this.getOrDownloadImage(i))==null||g.then(b=>{f.map=b,f.needsUpdate=!0,f.map.colorSpace=wr,y.visible=!0,this.publish("image-loaded")}),y.userData.entityId=t,y.material=f,dm){let b=new ae(new yt(n.width,n.height),new Er({color:"gray"}));y.add(b);let P=new _c;y.add(P),P.scale.set(10,10,10)}return y.position.set(m.center.x,m.center.y,o+tC),y.rotation.z=(-ee.degToRad(m.rotation)+Gn)%Gn,y}getOrDownloadImage(t){var i;if(this.imageLoadingCache.has(t))return(i=this.imageLoadingCache.get(t))==null?void 0:i.promise;{let n=new Promise(o=>{vr.getLoader().load(t,s=>{let l=this.imageLoadingCache.get(t);l&&!l.loaded&&(l.loaded=!0),o(s)})});return this.imageLoadingCache.set(t,{loaded:!1,promise:n}),n}}flipIfNeeded(t,i){if(t.imageMesh==null)return;let n=-i,o=t.imageMesh.rotation.z,s=li((o-n+Gn)%Gn,2);s>QS&&s<eC&&(t.imageMesh.rotation.z=(o+Math.PI)%Gn)}update(t){var s,l,h,p,m;let i,n,o;for(let f of this.rendererState.geometry3DIdsInScene)if(i=this.rendererState.geometry3DMap.get(f),(i==null?void 0:i.type)==="image"){if(n=i.components[0],o=i.components[1],o.url&&n.imageMesh==null){let v=this.convertTo3DMapPosition(n.feature.geometry.coordinates),y={x:v.x,y:v.y};n.imageMesh=this.createImageMesh(i.id,o.url,n.feature.properties,n.feature.properties.verticalOffset,n.feature.geometry.coordinates,[y]),n.mesh.add(n.imageMesh),n.position.copy(n.imageMesh.position)}n.imageMesh&&(o.flipImageToFaceCamera&&this.flipIfNeeded(n,t),n.imageMesh.material instanceof Er&&o.dirty&&(n.imageMesh.material.opacity=o.opacity))}else if((i==null?void 0:i.type)==="geometry"){if(n=i.components[0],o=i.components[1],o.showImage&&((s=n.feature.properties)!=null&&s.image)&&n.imageMesh==null&&n.visible&&n.mesh!=null&&n.mesh.parent!=null&&((l=n.feature.properties)==null?void 0:l.image.position)!=null&&n.feature.geometry.coordinates!=null&&n.feature.geometry.coordinates.length>0){let v=n.feature.geometry.coordinates[0].map(C=>{let M=this.convertTo3DMapPosition(C);return{x:M.x,y:M.y}}),y=this.createImageMesh(f,(h=n.feature.properties)==null?void 0:h.image.path,(p=n.feature.properties)==null?void 0:p.image,o.height,(m=n.feature.properties)==null?void 0:m.image.position,v);n.mesh.parent.add(y),n.imageMesh=y}if(n.imageMesh){if(!n.visible)n.imageMesh.visible=!1;else if(o.showImage&&!n.imageMesh.visible)if(o.url){let v=this.imageLoadingCache.get(o.url);v&&v.loaded&&(n.imageMesh.visible=!0)}else n.imageMesh.visible=!0;else!o.showImage&&n.imageMesh.visible&&(n.imageMesh.visible=!1);o.flipImageToFaceCamera&&this.flipIfNeeded(n,t)}}}};a(_u,"ImageSystem");var Ks=_u;x();var rC=250,Sr,wu=class wu extends ie{constructor(t,i){super();d(this,"cameraDirty",!0);d(this,"focusablesDirty",!0);d(this,"state");d(this,"camera");d(this,"debugEl",null);d(this,"raycasters",[]);d(this,"collisions",new Map);d(this,"focusableEntities",new Set);d(this,"debugRaycasters",!1);L(this,Sr);d(this,"update",a((t=!1,i=Date.now())=>{this.focusablesDirty&&this.updateFocusableEntities(),!t&&(Date.now()-i>rC||(u(this,Sr)&&cancelAnimationFrame(u(this,Sr)),B(this,Sr,requestAnimationFrame(()=>{this.updateRaf()}))))},"update"));this.state=t,this.camera=i,this.buildRaycasters()}resize(){this.buildRaycasters()}buildRaycasters(){this.debugEl&&this.debugEl.remove();let t=new K(this.state.canvasWidth/2,this.state.canvasHeight/2),i=new K(t.x/1.2,t.y/1.2),n=new K(t.x+(t.x-i.x),i.y),o=new K(i.x,t.y+(t.y-i.y)),s=new K(n.x,o.y),l=new K(t.x,t.y/1.5),h=new K(t.x,t.y+(t.y-l.y));this.debugEl=document.createElement("div"),Object.assign(this.debugEl.style,{position:"absolute",top:"0",left:"0",width:"100%",height:"100%",pointerEvents:"none"}),document.body.append(this.debugEl),this.raycasters=[t,l,h,i,n,o,s].map((p,m)=>{if(this.debugRaycasters){let M=document.createElement("div");M.style.position="absolute",M.style.top=p.y+"px",M.style.left=p.x+"px",M.style.width="10px",M.style.height="10px",M.style.backgroundColor="red",this.debugEl.append(M)}let f=p.x/this.state.canvasWidth*2-1,v=-(p.y/this.state.canvasHeight)*2+1,y=new K(f,v),C=new Mt;return C.setFromCamera(y,this.camera),[C,y,m===0?10:m<7?2:1]})}updateFocusableEntities(){this.focusableEntities.clear();let t,i,n;for(let o of this.state.geometry3DIdsInScene)if(n=this.state.geometry3DMap.get(o),n!=null){if(n.type==="group-container"&&n.components[1]!==void 0&&n.components[1]instanceof qt){if(i=n.components[1],i.dirty===!0||i.focusMesh==null){i.focusMesh&&Ee(i.focusMesh);let s=new Ue;s.setFromObject(n);let l=s.max.x-s.min.x,h=s.max.y-s.min.y,p=s.max.z-s.min.z;if(!isFinite(l)||!isFinite(h)||!isFinite(p)||isNaN(l)||isNaN(h)||isNaN(p)||l<=0||h<=0||p<=0)continue;let m=new rr(l,h,p),f={transparent:!0,opacity:this.debugRaycasters?1:0,visible:this.debugRaycasters};if(this.debugRaycasters){let C=["red","green","blue","yellow","purple","orange","pink","brown","gray","black"];f.color=C[Math.floor(Math.random()*C.length)]}let v=new je(f),y=new ae(m,v);y.position.set((s.min.x+s.max.x)/2,(s.min.y+s.max.y)/2,0),y.userData={entityId:n.userData.entityId},i.focusMesh=y,n.add(y),n.components[1].dirty=!1}this.focusableEntities.add(i.focusMesh)}else if(n.type==="geometry"&&n.components[4]&&n.components[4]instanceof qt&&(t=n.components[0],i=n.components[4],t instanceof Me&&t.geometry!=null&&(i.dirty===!0||i.focusMesh==null))){if(i.focusMesh==null){let s=new ae(t.geometry);s.userData={entityId:n.id},i.focusMesh=s}this.focusableEntities.add(i.focusMesh)}}this.focusablesDirty=!1}updateRaf(){if(this.focusableEntities.size===0){this.publish("geometry-in-focus",[]);return}this.cameraDirty&&this.raycast()}raycast(){this.collisions.clear();for(let[i,n]of this.raycasters)i.setFromCamera(n,this.camera);for(let[i,n,o]of this.raycasters)i.intersectObjects(Array.from(this.focusableEntities.values())).forEach(l=>{var h;if((l==null?void 0:l.object)!=null&&"isMesh"in l.object&&(l!=null&&l.object.isMesh)){let p=l.object.userData.entityId,m=(h=this.collisions.get(p))!=null?h:0;this.collisions.set(p,m+o)}});let t=Array.from(this.collisions,([i,n])=>({entityId:i,weight:n})).sort((i,n)=>n.weight-i.weight).map(({entityId:i})=>i);this.publish("geometry-in-focus",t),this.cameraDirty=!1}showRaycasters(){this.debugRaycasters=!0,this.buildRaycasters()}hideRaycasters(){this.debugRaycasters=!1,this.buildRaycasters()}destroy(){u(this,Sr)&&cancelAnimationFrame(u(this,Sr)),this.debugEl&&this.debugEl.remove(),this.collisions.clear(),this.focusableEntities.clear(),this.raycasters=[]}};Sr=new WeakMap,a(wu,"GeometryInFocusSystem");var Qs=wu;x();x();x();x();x();function iC(e){if(!e)throw new Error("geojson is required");var r=[];return cr(e,function(t){nC(t,r)}),Dr(r)}a(iC,"lineSegment");function nC(e,r){var t=[],i=e.geometry;if(i!==null){switch(i.type){case"Polygon":t=Ur(i);break;case"LineString":t=[Ur(i)]}t.forEach(function(n){var o=oC(n,e.properties);o.forEach(function(s){s.id=r.length,r.push(s)})})}}a(nC,"lineSegmentFeature");function oC(e,r){var t=[];return e.reduce(function(i,n){var o=xo([i,n],r);return o.bbox=sC(i,n),t.push(o),n}),t}a(oC,"createSegments");function sC(e,r){var t=e[0],i=e[1],n=r[0],o=r[1],s=t<n?t:n,l=i<o?i:o,h=t>n?t:n,p=i>o?i:o;return[s,l,h,p]}a(sC,"bbox");var Iu=iC;var Om=ao(Em(),1);function AC(e,r){var t={},i=[];if(e.type==="LineString"&&(e=Ca(e)),r.type==="LineString"&&(r=Ca(r)),e.type==="Feature"&&r.type==="Feature"&&e.geometry!==null&&r.geometry!==null&&e.geometry.type==="LineString"&&r.geometry.type==="LineString"&&e.geometry.coordinates.length===2&&r.geometry.coordinates.length===2){var n=Dm(e,r);return n&&i.push(n),Dr(i)}var o=(0,Om.default)();return o.load(Iu(r)),Ta(Iu(e),function(s){Ta(o.search(s),function(l){var h=Dm(s,l);if(h){var p=Ur(h).join(",");t[p]||(t[p]=!0,i.push(h))}})}),Dr(i)}a(AC,"lineIntersect");function Dm(e,r){var t=Ur(e),i=Ur(r);if(t.length!==2)throw new Error("<intersects> line1 must only contain 2 coordinates");if(i.length!==2)throw new Error("<intersects> line2 must only contain 2 coordinates");var n=t[0][0],o=t[0][1],s=t[1][0],l=t[1][1],h=i[0][0],p=i[0][1],m=i[1][0],f=i[1][1],v=(f-p)*(s-n)-(m-h)*(l-o),y=(m-h)*(o-p)-(f-p)*(n-h),C=(s-n)*(o-p)-(l-o)*(n-h);if(v===0)return null;var M=y/v,g=C/v;if(M>=0&&M<=1&&g>=0&&g<=1){var b=n+M*(s-n),P=o+M*(l-o);return Pa([b,P])}return null}a(Dm,"intersects");var ia=AC;x();function zn(e,r){r===void 0&&(r={});var t=Mi(e);switch(!r.properties&&e.type==="Feature"&&(r.properties=e.properties),t.type){case"Polygon":return RC(t,r);case"MultiPolygon":return kC(t,r);default:throw new Error("invalid poly")}}a(zn,"default");function RC(e,r){r===void 0&&(r={});var t=Mi(e),i=t.coordinates,n=r.properties?r.properties:e.type==="Feature"?e.properties:{};return Lm(i,n)}a(RC,"polygonToLine");function kC(e,r){r===void 0&&(r={});var t=Mi(e),i=t.coordinates,n=r.properties?r.properties:e.type==="Feature"?e.properties:{},o=[];return i.forEach(function(s){o.push(Lm(s,n))}),Dr(o)}a(kC,"multiPolygonToLine");function Lm(e,r){return e.length>1?Ic(e,r):xo(e[0],r)}a(Lm,"coordsToLine");function NC(e,r){var t=!0;return cr(e,function(i){cr(r,function(n){if(t===!1)return!1;t=BC(i.geometry,n.geometry)})}),t}a(NC,"booleanDisjoint");function BC(e,r){switch(e.type){case"Point":switch(r.type){case"Point":return!zC(e.coordinates,r.coordinates);case"LineString":return!Am(r,e);case"Polygon":return!dr(e,r)}break;case"LineString":switch(r.type){case"Point":return!Am(e,r);case"LineString":return!FC(e,r);case"Polygon":return!Rm(r,e)}break;case"Polygon":switch(r.type){case"Point":return!dr(r,e);case"LineString":return!Rm(e,r);case"Polygon":return!GC(r,e)}}return!1}a(BC,"disjoint");function Am(e,r){for(var t=0;t<e.coordinates.length-1;t++)if(XC(e.coordinates[t],e.coordinates[t+1],r.coordinates))return!0;return!1}a(Am,"isPointOnLine");function FC(e,r){var t=ia(e,r);return t.features.length>0}a(FC,"isLineOnLine");function Rm(e,r){for(var t=0,i=r.coordinates;t<i.length;t++){var n=i[t];if(dr(n,e))return!0}var o=ia(r,zn(e));return o.features.length>0}a(Rm,"isLineInPoly");function GC(e,r){for(var t=0,i=e.coordinates[0];t<i.length;t++){var n=i[t];if(dr(n,r))return!0}for(var o=0,s=r.coordinates[0];o<s.length;o++){var l=s[o];if(dr(l,e))return!0}var h=ia(zn(e),zn(r));return h.features.length>0}a(GC,"isPolyInPoly");function XC(e,r,t){var i=t[0]-e[0],n=t[1]-e[1],o=r[0]-e[0],s=r[1]-e[1],l=i*s-n*o;return l!==0?!1:Math.abs(o)>=Math.abs(s)?o>0?e[0]<=t[0]&&t[0]<=r[0]:r[0]<=t[0]&&t[0]<=e[0]:s>0?e[1]<=t[1]&&t[1]<=r[1]:r[1]<=t[1]&&t[1]<=e[1]}a(XC,"isPointOnLineSegment");function zC(e,r){return e[0]===r[0]&&e[1]===r[1]}a(zC,"compareCoords");var km=NC;function zu(e,r){var t=!1;return cr(e,function(i){cr(r,function(n){if(t===!0)return!0;t=!km(i.geometry,n.geometry)})}),t}a(zu,"booleanIntersects");var Nm=20,YC=5e3,mt,Yn,Zn,Pr,Qr,ei,oa,Un,Yu=class Yu{constructor(r){d(this,"dirty",!0);d(this,"map");d(this,"stylesheetId","");d(this,"userHiddenLayers",new Set);d(this,"hiddenLayersInStyle",new Set);d(this,"centerPoint");d(this,"bbox");d(this,"polygons");L(this,mt,null);L(this,Yn,a(()=>{u(this,mt)&&(clearTimeout(u(this,mt)),B(this,mt,null),this.dirty=!1)},"#stopTrying"));L(this,Zn,a(()=>{u(this,mt)&&(clearTimeout(u(this,mt)),B(this,mt,null)),B(this,mt,setTimeout(()=>{u(this,Yn).call(this)},YC))},"#startTrying"));d(this,"handleRender",a(async()=>{if(!(!this.map||!this.dirty)&&!(!this.hiddenLayersInStyle||this.hiddenLayersInStyle.size===0)){if(u(this,Pr)&&(u(this,oa).call(this),B(this,Pr,!1)),this.centerPoint){let r=this.map.project(this.centerPoint),t=this.map.queryRenderedFeatures(r,{layers:Array.from(this.hiddenLayersInStyle)});if(t.length>0){for(let i of t)this.expr.push(["!=",["id"],i.id]);this.expr.length>0&&this.hiddenLayersInStyle.forEach(i=>{this.map.setFilter(i,["all",...this.expr])}),this.expr=[],B(this,Pr,!1),this.dirty=!1}}else if(this.bbox&&this.polygons){let r=this.map.queryRenderedFeatures([this.map.project([this.bbox[0],this.bbox[1]]),this.map.project([this.bbox[2],this.bbox[3]])],{layers:Array.from(this.hiddenLayersInStyle)});if(r.length>0){B(this,Pr,!0);for(let t=0;t<r.length;t+=Nm){let i=r.slice(t,t+Nm);u(this,Qr).push(()=>{for(let n of i)if(n.geometry!=null&&"coordinates"in n.geometry){if(this.polygons==null)return;let o;if(n.geometry.type==="Polygon"?o=vo(n.geometry.coordinates):n.geometry.type==="MultiPolygon"&&(o=Ec(n.geometry.coordinates)),!o)continue;for(let s of this.polygons)if(zu(s,o)){this.expr.push(["!=",["id"],n.id]);continue}}})}u(this,Un).call(this)}}}},"handleRender"));d(this,"expr",[]);L(this,Pr,!1);L(this,Qr,[]);L(this,ei,null);L(this,oa,a(()=>{u(this,ei)&&(globalThis.cancelAnimationFrame(u(this,ei)),B(this,ei,null)),B(this,Qr,[])},"#cancelJobs"));L(this,Un,a(()=>{let r=u(this,Qr).pop();typeof r=="function"&&(r(),u(this,Qr).length>0&&B(this,ei,globalThis.requestAnimationFrame(u(this,Un)))),this.expr.length>0&&(this.hiddenLayersInStyle.forEach(t=>{this.map.setFilter(t,["all",...this.expr])}),this.dirty=!1),this.expr=[],B(this,Pr,!1),u(this,Yn).call(this)},"#runJobs"));d(this,"handleStyleChange",a(r=>{var t,i;if(this.map&&r&&r.dataType==="style"&&r.type==="styledata"&&this.userHiddenLayers.size>0){let n=(i=(t=r==null?void 0:r.style)==null?void 0:t.stylesheet)==null?void 0:i.id;(!n||n!==this.stylesheetId)&&(this.stylesheetId=n,this.filterStylesInMap(),this.dirty=!0)}},"handleStyleChange"));r&&(this.map=r,this.map.on("styledata",this.handleStyleChange),this.map.on("render",this.handleRender))}hideLayersUnderPoint(r,t){u(this,Zn).call(this),this.centerPoint=r;for(let i of t)this.userHiddenLayers.add(i);this.dirty=!0,this.filterStylesInMap(),this.handleRender()}hideLayersIntersectingPolygons(r,t,i){u(this,mt)&&clearTimeout(u(this,mt)),u(this,Zn).call(this),this.bbox=r,this.polygons=t.reduce((n,o)=>{if(o.geometry.type==="Polygon"){let s=vo(o.geometry.coordinates);n.push(s)}else o.geometry.type==="MultiPolygon"&&n.push(...o.geometry.coordinates.map(s=>vo(s)));return n},[]);for(let n of i)this.userHiddenLayers.add(n);this.dirty=!0,this.filterStylesInMap(),this.handleRender()}filterStylesInMap(){if(this.hiddenLayersInStyle=new Set,this.map)for(let r of this.userHiddenLayers)this.map.getLayer(r)&&this.hiddenLayersInStyle.add(r)}destroy(){this.map&&(this.map.off("styledata",this.handleStyleChange),this.map.off("render",this.handleRender))}};mt=new WeakMap,Yn=new WeakMap,Zn=new WeakMap,Pr=new WeakMap,Qr=new WeakMap,ei=new WeakMap,oa=new WeakMap,Un=new WeakMap,a(Yu,"OutdoorLayers");var na=Yu;x();x();x();x();var sa="attribute float pathDistance;\nattribute vec3 pathNormal;\nattribute vec3 pathTangent;\n\nuniform vec2 uvScale;\nuniform float vertexes;\nuniform float complete;\nuniform float nearRadius;\nuniform float farRadius;\nuniform float nearZoom;\nuniform float farZoom;\nuniform float pulse;\nuniform float pulseLength;\nuniform bool pathIsVertical;\nuniform bool displayArrowsOnPath;\nuniform vec2 cameraParameters;\nuniform float flattenFactor;\n\nvarying float zoomLevel;\nvarying float radius;\nvarying vec2 fragTexcoord;\nvarying float fragTopTextureU;\nvarying float fragPathDistance;\n\n// Map the x value from the range [xMin, xMax] to the range [yMin, yMax] using\n// linear interpolation/extrapolation.\n//\n// This performs a pure linear mapping y = mx + b where\n// 'm = (yMax - yMin) / (xMax - xMin)',\n// 'b = -xMin * (yMax - yMin) / (xMax - xMin) + yMin'.\nfloat remap(float x, float xMin, float xMax, float yMin, float yMax) {\n return (x - xMin) / (xMax - xMin) * (yMax - yMin) + yMin;\n}\n\n// Map the x value from [xMin, xMax] to the range [yMin, yMax] using linear\n// interpolation, clamping result values outside [yMin, yMax].\nfloat clampRemap(float x, float xMin, float xMax, float yMin, float yMax) {\n return clamp(remap(x, xMin, xMax, yMin, yMax), yMin, yMax);\n}\n\nvoid main() {\n fragPathDistance = pathDistance;\n\n // We can get an origin point for the cross-section of the path by\n // subtracting the surface normal times the radius, since the surface normal\n // points strictly away from the centre.\n vec3 origin = position - nearRadius * normal;\n\n // Inflate the path along its surface normal to increase its radius from\n // 'nearRadius' to 'farRadius' when the camera is at 'farZoom'.\n vec3 adjustedPosition = position;\n zoomLevel = clampRemap(cameraParameters.x, nearZoom, farZoom, 0.0, 1.0);\n adjustedPosition += normal * (farRadius - nearRadius) * zoomLevel;\n\n // Determine how far the path extends \"up\" or \"down\" in the direction of the\n // path normal.\n float height = dot(adjustedPosition - origin, pathNormal);\n\n // Flatten the bottom half of the path entirely so that it's flat\n // against the floor. This makes the path look nicer when it's\n // semitransparent behind opaque geometry, so you don't see it\n // peeking through.\n float desiredHeight = max(height, 0.0);\n\n desiredHeight = desiredHeight * flattenFactor;\n\n float flattenMagnitude = height - desiredHeight;\n adjustedPosition = adjustedPosition - pathNormal * flattenMagnitude;\n\n // Transform the vertices into NDC.\n vec4 mvPosition = modelViewMatrix * vec4(adjustedPosition, 1.0);\n gl_Position = projectionMatrix * mvPosition;\n\n fragTexcoord = uv;\n\n // Compute a texture coordinate for mapping the arrow texture to the path.\n // We don't want to use the u-value that Three.js provides, because the\n // path may end up twisting arbitrarily -- but we want the arrow texture to\n // always be on the top of the path.\n vec3 bitangent = cross(normal, pathTangent);\n fragTopTextureU = -dot(bitangent, pathNormal) * 0.5 + 0.5;\n\n radius = mix(nearRadius, farRadius, zoomLevel);\n}\n";x();var Zu="#define ARROW_FADING_POINT 0.15\n\nuniform float complete;\nuniform float nearRadius;\nuniform float farRadius;\nuniform vec2 resolution;\nuniform vec2 cameraParameters;\nuniform vec3 color;\nuniform float pathLength;\nuniform bool showPulse;\nuniform vec3 pulseColor;\nuniform float pulse;\nuniform float pulseLength;\nuniform bool pathIsVertical;\nuniform bool displayArrowsOnPath;\nuniform float arrowAnimationTimer;\nuniform float opacityMultiplier;\nuniform bool dashed;\nuniform sampler2D arrowTexture;\n\nvarying float zoomLevel;\nvarying float radius;\nvarying vec2 fragTexcoord;\nvarying float fragTopTextureU;\nvarying float fragPathDistance;\n\n// How long the arrow should be, as a factor of pathRadius. Since we've\n// mostly flattened the top of the path, values near 2.0 (the diameter)\n// will probably look best.\nconst float arrowLength = 2.0;\n\n// How much of a relative margin the arrow texture should have inside the\n// area laid out for it. Useful to pull the arrow away from the edges of the\n// path, which slope down.\nconst float arrowMargin = 0.1;\n\n// How many arrow-lengths of space should be between arrows on a short path.\nconst float arrowSpacingOnShortPath = 6.0;\n\n// How many arrow-lengths of space should be between arrows on a long path.\nconst float arrowSpacingOnLongPath = 7.5;\n\n// How long a path must be to be considered \"long\", as a factor of\n// the path radius.\nconst float longPathLength = 200.;\n\n// How long a path must be to be considered \"short\", as a factor of the\n// path radius.\nconst float shortPathLength = 75.;\n\n// How much of the path's length the fade-in should comprise when going from\n// zero opacity to full opacity.\nconst float completeLength = 0.1;\n\n// Map the x value from the range [xMin, xMax] to the range [yMin, yMax] using\n// linear interpolation/extrapolation.\n//\n// This performs a pure linear mapping 'y = mx + b' where\n// 'm = (yMax - yMin) / (xMax - xMin)',\n// 'b = -xMin * (yMax - yMin) / (xMax - xMin) + yMin'.\nfloat remap(float x, float xMin, float xMax, float yMin, float yMax) {\n return (x - xMin) / (xMax - xMin) * (yMax - yMin) + yMin;\n}\n\n// Map the x value from [xMin, xMax] to the range [yMin, yMax] using linear\n// interpolation, clamping result values outside [yMin, yMax].\nfloat clampRemap(float x, float xMin, float xMax, float yMin, float yMax) {\n return clamp(remap(x, xMin, xMax, yMin, yMax), yMin, yMax);\n}\n\nvoid main(void) {\n // Compute the opacity of the path based on the distance from the current\n // fragment to the 'complete' value as it varies from 0.0 to 1.0.\n // Fragments that are at the 'complete' value or past it will be fully\n // transparent, while fragments that are at 'complete - completeLength'\n // or before it will be fully opaque. However, we adjust the 'complete'\n // value here so that it overshoots by one full 'completeLength', so that\n // the entire path will be opaque when the 'complete' value is at 1.0.\n float completeLocation = complete * (1.0 + completeLength);\n float completeAmount = clampRemap(\n fragPathDistance,\n completeLocation - completeLength,\n completeLocation,\n 0.0,\n 1.0\n );\n float opacity = 1.0 - smoothstep(0.0, 1.0, completeAmount);\n\n // 2020/01/09 Terence Dickson\n // When we render the background and overlay for the mapbox outdoor context\n // behind everything else in single-buffer rendering, the fact that the path\n // writes to the depth buffer means that the background and overlay will not\n // be drawn behind the path even when the path is still fading in. The effect\n // is subtle and is only visible in single-buffer rendering so this quick fix\n // prevents writes to the depth buffer for zero opacity fragments, which gets\n // rid of the most visually-offensive ghosting.\n if (opacity <= 0.0) {\n discard;\n }\n\n // Push in the texture coordinates so that they ramp up\n // at 'arrowMargin' instead of at zero; this remapping looks somewhat\n // like this:\n // 1 ^ ___\n // | /\n // | /\n // | /\n // | /\n // |___/\n // 0 +---------->\n // 0 ^ 1\n // arrowMargin\n // Making the arrows narrower on the path.\n float u = fragTopTextureU;\n u = clamp(\n u * (1. / (1. - arrowMargin * 2.)) - (1. / (1. - arrowMargin * 2.) - 1.) / 2.,\n 0.0,\n 1.0\n );\n\n float arrowSpacing = clampRemap(\n pathLength,\n shortPathLength * radius,\n longPathLength * radius,\n arrowSpacingOnShortPath,\n arrowSpacingOnLongPath\n );\n\n // Reduce the spacing between arrows when the camera zooms out, as increasing\n // the path radius will increase the arrow size and thus be able to fit\n // fewer arrows on in total, and this secondary movement of the arrows\n // \"zooming off\" the end of the path is unpleasant\n float expandAmount = mix(1.0, farRadius / nearRadius, zoomLevel);\n float effectiveArrowSpacing =\n arrowSpacing * 1.0 / expandAmount +\n arrowMargin * 2.0;\n\n float effectiveArrowLength = arrowLength * radius * (1. - arrowMargin * 2.0);\n\n // Adjust the slope of the vertical texture coordinate so that it goes\n // from 0 to 1 along the length of the arrow plus the spacing between\n // arrows, and adjust its x-intercept so that one arrow moves to the\n // exact position of the next arrow as 'arrowAnimationTimer' goes\n // from 0 to 1\n float v = (\n fragTexcoord.x * (pathLength / effectiveArrowLength)\n - arrowAnimationTimer * (1. + effectiveArrowSpacing)\n );\n\n // Compute a \"looping sawtooth\" wave for determining the vertical texture\n // coordinates of the arrow texture, roughly as follows:\n // 3 ^ /\n // | ___/\n // 2 | /\n // | ___/\n // 1 | /\n // |___/\n // 0 +--------------->\n // 0 ^ ^\n // ^ |_|\n // | effectiveArrowLength\n // |___|\n // effectiveArrowSpacing\n //\n // This is effectively equivalent to this sort of sawtooth wave:\n // ^\n // 1 | / / /\n // |___/ ___/ ___/\n // 0 +--------------->\n //\n // Causing the image of the arrow to repeat, with dead space (the bottom\n // edge of the texture stretched out) between the arrows at the provided\n // spacing. The reason why the \"looping\" design is preferred is because\n // it takes advantage of WebGL's 'GL_REPEAT' texture wrapping behaviour\n // to avoid the discontinuity that can end up causing visual artifacts.\n if (mod(v, (1. + effectiveArrowSpacing)) < 1.) {\n v = v - effectiveArrowSpacing * floor(v / (1. + effectiveArrowSpacing));\n } else {\n v = ceil(v / (1. + effectiveArrowSpacing));\n }\n\n // Use the r-component of the texture to determine whether the arrow covers\n // this fragment or not\n vec2 sampleTexcoord = vec2(u, v);\n float arrowAmount = 0.0;\n vec3 secondColor = pulseColor;\n\n if (displayArrowsOnPath) {\n arrowAmount = texture2D(arrowTexture, sampleTexcoord).r;\n float delta = 1.0 - abs(fragPathDistance * 2.0 - 1.0);\n secondColor = mix(color, pulseColor, 1.0 - smoothstep(ARROW_FADING_POINT, 0.0, delta));\n }\n\n if (dashed) {\n float dashLength = 0.1; // Adjust this value to change the dash length\n float gapLength = 0.1; // Adjust this value to change the gap length\n float totalLength = dashLength + gapLength;\n float numSegments = ceil(1.0 / totalLength);\n float adjustedTotalLength = 1.0 / numSegments;\n float adjustedDashLength = adjustedTotalLength * (dashLength / (dashLength + gapLength));\n float pattern = mod(fragPathDistance, adjustedTotalLength);\n opacity = pattern < adjustedDashLength ? 1.0 : 0.0;\n }\n\n\n if (showPulse) {\n // Add the pulse color to the path by determining how far the current fragment\n // is from 'pulse'\n float pulseLocation = remap(\n pulse,\n 0.0,\n 1.0,\n -pulseLength,\n 1.0 + pulseLength\n );\n float pulseDistance = smoothstep(\n 0.0,\n pulseLength,\n abs(fragPathDistance - pulseLocation)\n );\n\n // Blend the pulse color to the path based on how close this fragment is to\n // the 'pulse' value and whether it's covered by an arrow -- but if it's\n // covered by *both*, then we go back to using the regular path color\n // (making arrows look like \"holes\" when they're overlapping the pulse.)\n float pulseLevel = abs(1.0 - pulseDistance - arrowAmount);\n\n gl_FragColor = vec4(mix(color, secondColor, pulseLevel), opacity * opacityMultiplier);\n } else if (displayArrowsOnPath) {\n gl_FragColor = vec4(mix(color, pulseColor, arrowAmount), opacity * opacityMultiplier);\n } else {\n gl_FragColor = vec4(color, opacity * opacityMultiplier);\n }\n #include <colorspace_fragment>\n}\n";x();var Bm="uniform float complete;\nuniform float nearRadius;\nuniform float farRadius;\nvarying float fragPathDistance;\nconst float completeLength = 0.1;\n\n// Map the x value from the range [xMin, xMax] to the range [yMin, yMax] using\n// linear interpolation/extrapolation.\n//\n// This performs a pure linear mapping 'y = mx + b' where\n// 'm = (yMax - yMin) / (xMax - xMin)',\n// 'b = -xMin * (yMax - yMin) / (xMax - xMin) + yMin'.\nfloat remap(float x, float xMin, float xMax, float yMin, float yMax) {\n return (x - xMin) / (xMax - xMin) * (yMax - yMin) + yMin;\n}\n\n// Map the x value from [xMin, xMax] to the range [yMin, yMax] using linear\n// interpolation, clamping result values outside [yMin, yMax].\nfloat clampRemap(float x, float xMin, float xMax, float yMin, float yMax) {\n return clamp(remap(x, xMin, xMax, yMin, yMax), yMin, yMax);\n}\n\nvoid main(void) {\n // this ensures that the stencil mask moves along with the path above it, to avoid the progress bar effect\n float completeLocation = complete * (1.0 + completeLength);\n float completeAmount = clampRemap(\n fragPathDistance,\n completeLocation - completeLength,\n completeLocation,\n 0.0,\n 1.0\n );\n float opacity = 1.0 - smoothstep(0.0, 1.0, completeAmount);\n\n // 2020/01/09 Terence Dickson\n // When we render the background and overlay for the mapbox outdoor context\n // behind everything else in single-buffer rendering, the fact that the path\n // writes to the depth buffer means that the background and overlay will not\n // be drawn behind the path even when the path is still fading in. The effect\n // is subtle and is only visible in single-buffer rendering so this quick fix\n // prevents writes to the depth buffer for zero opacity fragments, which gets\n // rid of the most visually-offensive ghosting.\n if (opacity <= 0.0) {\n discard;\n }\n\n gl_FragColor = vec4(0.0, 1.0, 0.0, opacity);\n}";var Fm="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAAAAAB5Gfe6AAAQkHpUWHRSYXcgcHJvZmlsZSB0eXBlIGV4aWYAAHjarZpZciQ7rkT/uYpeAicQ5HI4mr0dvOX3ATOl0li3q3SVJkUqFMEBcHc4IuX2///fcf/hK7cSXRatpZXi+cott9h5U/3j63EMPt+fL1/h+fPdeff6NnJMHNPjD2U/7+qcl183aH6eH+/PO52PN7E+B3qZ+Tlgspkjb57X1edAKT7Oh+fvrj3v6/nNdp7ftd057abHnz78npVgLGG8FF3cKSTPz2oXJFaQWuocCz9D0mhnEu8Tx54k6dexc98F77vY+f48n96HwvnyvKB8iNHzfJCvY3cj9HZF4dfM7/6QZ4j+7deb2J2z6jn7sbueC5Eq7rmpl63cd1w4GCrd2wov5Vt4r/fVeFW2OMnYIpuD13ShhUi0T8hhhR5O2Pc4w2SJOe5IuGOMM6Z7rhL+FudNSrZXOFFJz3KpkqtJ1hKn4+tawp233flmqMy8AlfGwGCBOz693Fcn/+b1OtA5Bt0QfH2NFeuKFnCWYZmzn1xFQsJ5xlRufO/LvcGNf5PYRAblhrmywe7HY4gh4Re20s1z4jrx2fkHNYKu5wCEiLmFxYREBnwJSUIJXmPUEIhjJT+dlceU4yADQSSu4A65SamQnBptbu7RcK+NEh+nkRYSIZBGSQ0EIlk5C/jRXMFQlyTZiUgRlSpNekklFymlaDGN6po0q2hR1apNe001V6mlaq211d5iS0iYtNLUtdpa651JO0N37u5c0fuII408ZJSho442+gQ+M0+ZZeqss82+4koL+q+y1K262uo7bKC085Zdtu662+4HrJ108pFTjp562umvWXtm9X3WwofM/T5r4Zk1y1i+1+mvrHFa9WWIYHIiljMyFnMg42oZANDRcuZryDla5ixnvkVIIZGsBbHkrGAZI4N5hygnvObuV+Z+mzcn+Y/yFr/LnLPU/RuZc5a6Z+Y+5+2LrK1+K0q6CTIWWkx9OggbF+zaY+1Wk/766H46wF8ONFY+O8hBMEc7oc4Vdh+8JsE+PUSrVjr70Zz1+H56PH3o9sRR1ql5Ha8bUMQxpe89Tki8Sb0tE23cw3DcfEo+ugnj2G3WEmononVfoag71pVjR+EmAE53eT5tqYfEHl/7ThMusaI+St0jktFa9gKnreiQqCNpZ2mJdSkbaiK6DrovYR4/JhJfRsx5d5EVZnEIPetHnU5KynJPTSuCPuC0lOuXH7n1DNq7DpUtHbhM5lDA0c2bnDCJoOObMnyj+aPjPwx0yiDUxKKsg35VnRnBEVhonKwK5hOk5NttUrhr2+tMOXkPJb1RZ+iAelYjL2MuO3pGRQ78GdxwOOaTAcJZcewq7ilB1RJCSozUdSEdwVJVb6asiBsHH1Bqgbiv3Cmkkis6ktVnZGRRwMNJjUA3Ao2127YWdhAIblxF51hzMcZsVZc0r0dJo5Liqfn41Q+q193SGhhkMkgaLJRNnEpqBtyVvbcVffIk+LE9QPFBTMTQe0aWkMXMnx3dy5sfHreDE60Ql50E+SqRcmfK16L2p0Ol8JFATu3qASXy7SvmiGW2cdMBxsty44CvtLogfGlv7WkCSV0WId2270EaD5Ym40cs+SAwZuNjPSTywAvEfLmzQhtLDntfCnhl/fNmUNnzyA2g76Zn0SP+c+I6bCC0FONUQ4L50e95dif+DH/m9htQjBEhPPpOjYjmm2ChbfEMIUaYtAIxmWJHlilLU8ZRs9pCsHbDpFaRgZljz2QandjDIBPZDGTuoZW1KdlYh52ALzisKJRNWSQmLAWx8iv9mGttT15bBc2oxd57bZtVF98CYtK3UH22Yd/A7WaKa+ZjNTOXEzNhMJ5kmQOvfzsbxbZALJ2xwGBjX2HFQybhi7kpbA7DVpS3RxMJwFyHwGk5gs6a4lrRHVqhYT0QTJC9UZcC9Yrelkn6yXch68NKNtG7CiU3vf/zMZAYXPWdrR9XZ/ctMV1sJQ2wJEGxzaHs7LmmHIwnUwbwnNAapBY9xhE19DNJW3ua0dDk/AjwITacR0PqZxkbyJ+E5jYbxI84x1TBE+y90hwDCYZIM0tqAKPZfCzFrbH8kYCm3eqQkZ2+2GovcL8Suokyg8yyCJes6dcouSLiNSLb0ETJU+/N/WFsBBSOXBbm9Cwp4CzlOag7ro7R2vC19nSsCPmAjIEMiobFwaoVXhjTU2XMpgEsDH/L3Sx54OCTMUSXI/IIA2V4QcLQpwVz12pInI0bY56pIQ2BSGRLL+yLfZ7JkiimbK+aepsbwRStpokx5gCqe1hjdMAwcINbkk5jmedrNRAG5pUXPe0sZIoXy1h7lSDxApzheg24JeDNtDS1oBDBUC4iWZFilBPhZx0Kqx2lihpbG9q4sYidksCN4yRYhNM4nxfBbTi4E3AT6B3igbvs9Gv8ZkHsIfdlep+2HelEDbkJdNjqZQ90B7k6OIoFfkkPNoY+z0gzACa1f2qcBYxVJpT2QQgS19dKQlbC24S92xiEAFRKB5Uy1qrBgOtwIge55G0kRPfIytGx0tMOrGfrijB2FHOk/TKcMjDTMPeBo4FnXD5cQ8vtdgoAN0yuzZQHQI09wm/5vAB6RHyI9rYKiZ6YWC6rbaiLmDtoaToC1bViXQFNtgWsOfEEKCleC3GWPSfgQWRQWMgw/9FDgvOZrFAT3SmsA3DLbqlsSppQG5QeOjPXavUUkxF/qgLM05vW5o7UakuBqo2ZW8Nj0LB7imVJC9QSA+wd7RPztIUZ80xQZq0ROrc8CSVncWzkTA/RwmunldCPAQKjqVC7bhRuTIv0plbk7gOX4m5OAi2YesYZ0KBQRToG8iv9x8dgGtgECYRBeEU87OxoSc8epu+s7Mq/MN0VbBT19dii7ekO66UZwdAMtoAVQd13J5nwZe98OgGslmVqAGBkeLZNVNVlWpV18qihntXKnBZvrDIVgFpx4q5poLqREOVplMPSpTF2KvjBAzDpprkruXIaaUmUD4Xo2yrGWcYlixKIwRFjl0jPQhKznUXZAoSjlg9c/NwAI4p3Q/w5bCNfhUZS7bGfqesHqKAlyZZxZgNrhGevZXccaqBys4NEqB3Vqfptji9uUrhCL6yXFqxtm0hhLyYU3Tjd8I/HZaWD1oyVjnG5hhpCN5yHSf8BQUZlVNd00OP4M0TK+JSM7iqWi01SinFkCQXWxiZJLqqAHiEt3G3I2WYd46KU9pIJIOkoRQYCcEAAPguHo0Y4k8Hl6SW50MoW0uZU8jJOUghKo38Nl5ZSwsJNAUC2/lFZWkfMjrU8dFrTjHpJnUrLCILQIxINiYdQlDXaE/razQ4jjQluN5jW1Eh/S7yYvI5gigSjdLYU9TiFXAcHjISiLhQd9obb3OQmwY+YqVwiBMCkOGLXaK/ljBShh56c1g0uyIb2lBRKO7ZTAFncw5c5UGjGSy3CsI1Jt2mtruZkfhBZmbR+842Yu1eDiWEl0V6LZcGem6Ct+LW4Wy3oAjyNObazKBHomhJ3HMKEKHgiGksH+Ig1nTidfNMyA+oYHqVFaRGLiQreVLc9GvQgftKjW9cfUSKNYL80rqU7Um2rwqQJR1ai31Wq7vzKJEsFHDj0bAEMUKXgvfD5bWbaLPBTKz1Nk/Fg+GUZvUzFw80CLaKtPAACVAWrismh863FU4IJ0716SXBUNVb/SDMVvZgDt34CXoOq1JKvg0n08gPHTwXBNgD5W8pZZ8E9EVWcv1DZMB2NFysIwkqBSaH5QRmsAHdkHB+UANvLJvFpQKAahSmYTLEd2AFO+5rsqRRU6sVv5IP0wsSPLcWsbC1Y95mte71CUm6RJJWwkg6Q4k+xWMM0ByElJPQ6j2ED5hY42ALpZRytx9RlgQlJLijzhKi5eX5JBSIRGfo9o2xhd/0aWku8OS+4D9ZnovHDQMPaYo4qm2mlZbUnd7pR6oQj29Z2BqJ9n3LRT+MTLu3IR+ZP2TCPh3EDw8H1NHpoT7FibNYU8WHd9ESHcY12aDOQCUBddi4Ucp+4yuzz8ybcCCu1h8zvzXhDN4HYLq1R+U0xzUqg5QSA3iSBgdDouy55Ifx0DaeEhgezxBRGmoEJ6AJitVuzwtKPlUskHgU2F0LS7AFIwW5jPu0RUL7sp+fkNk0ee8P6uXYgl40WM+cdCOW21r13e0ivt0ff/mYcUfrQZWs2BiN6G+MDTGz1BKORmUTNQp9YGSHFxAeTkQrKd6FoVUogyytW25OLy3OpaO5oZCQp46aPzb5LnJiFEIwAKkmbYVYIjzVv3vj7rA6HignEeQAXTAHKDhoD7Uujh0QjtsB6fTP1NzO7T1Nzq4F1GnfHdXCG1Yxjwdtjf+PGRGTzEtEAUCz7KLfTdItLwCXuSOAzVjaZB6LvbUZhYGWmifSZlcMDnGHPd6gPeiK9erhpiw7ZP9ahTrMhFDa1J53m9ri2DloziqGETTcVSppCbTDDjExg6RrZ6cPEzB8XArEjQSB29odrUoLyoS/65RfM9fprGGjlHpbhGgbYD8MtmW1eFcAWX5dbcMHcl8sUI2k+H7GPW9VrArw3G+BefcCrCaAT/N53YLvP26Uy0kMFnDEZz0DJkmQqEOlL7SlKweYhH8gxpYeAYi0f9magqPbMYZuUI6007lSZQoyoGfYQHsNRzHXR3MMINTSMZpq1KD2A5MDJgtMLdRU6R4CEOJcKGiIJ7K6P/vAM6xpECHI8rRHsaEj6smkngAUjXTzrRoSI48ZpHOqgOY5OejKVdpnmiYUChQnVdIPa6ekGqRSRgEO119oDHOiIUQ5ciYVgaF1oG8Udo8WYtD+DEi8D/w8rAJE2k2PoyV0oMtpauxreaFjpujAvxFlwBhjuNqM9P0IfI5iD8Nh8y1kG4igjJkDNkOijnlLhItAd9lhRd670yNRTu95cR/Xuu0c5WO4DEFk5YQAPtLvU4TYPGRh4APPEDNiuuwR6SC21JoFbQBBMr+zJmT32QplNI6p16PbculN/pCX1wAyTWGTeJ774aln0gvQikw7TmkfsNbdQNs0adutYUDqNtGc0RqngUYdhUYuHSL1/eLrgvqDTC5neu++vufRkEgP9D2T64Kg/c4n+s7k3dDr3me8nOr0c72MRNmgF7D4WySPP0YAI/bI4eixwc7K13QiRiL85A8fnSsUj+mvTrsZtVUEQZ6sTpVafW8nYJZyaZS0U+0xIb6et9PhhtoObozQbjKAoDf6eiFgx1UUvpUYj1GweH0MNMrofhynfWn7+KYu7n5r83hN9aqm+6qjcH7dUlgvZVLV3xqq4fbP16qv+eofuTz43eomAqfS7GBAB9zEE31WJ37eVIPtdGN5A8nMYPvvLt8t2/V/6gM19G4g/hIL7UXf9JgbuLRZ+AoW//AzyMxTcWyz8BAruLRZ+AgX3r3y2+mT/PwfiN1DoVI+QT3CZDmvb8022JeYb6HiQPQpPPvboFB+i1MZdcqWZqthHmix6vttw0UAI1z8oEnGwVe++c7JamxslC+8xKJE41XJmug1npz+6CUAKyURd9gSxo+kWxvtZth848GBlws/0SKjYhmbZ9IiV+mcGBSdWHk8sqSr2zz5J7QME/0yD+z4Pe+JuGn1MV/vUyZwOHojWPlmPXgf9CuoeN9UAT+FGwaLg44v3dWe6QpvuL3Ln/p3k/2AgqNDcfwHgqUmIIqn+hwAAAAJiS0dEAACqjSMyAAAACXBIWXMAAAsSAAALEgHS3X78AAAAB3RJTUUH4wYRESAMujenGAAAB9FJREFUeNrtnWlsFVUUx899fS1gUoKioEY+WBRUEohGkUhAKxgEjSgGoRGB4AJCNKAIJBJZJSiyGYMKKkIoLlEUKhUraxFkKUE2kU1aCrRgW2jpg9f29R2/sBTo67v3zL2zvfP73MzM+XU6mf+5504BGIZhGIZhGIZhGIZhGMZGGq3JvSmR62++BXHH7Ylbf9ouRMT99yVq/e0PICIiHumUmPV3PooXOf5EItafXoCXOdUn8ep/pgjrUDY40ervX4JXUTEiocoXL5/FawiNEwlU/6hzeB3hqQljQIwJYT3UzEkQA2JiGOslsiAhDIgZ1RiD6NIEMBD8NIKxyQr6vv7FtdgQa31uILg0ig2zsZmv4//yePUj7rjNv/U3yUEJ/r7Xr/XfvBmlOPKwT+vfhpIUdvdj/Wm7UZpTz/mv/g4HUYGyQb5r/+SjEhXD/VV/j5OoSGisj16LRe9iVCY8xTcGxIulSKBmtk8MiKHlSMIn8ViMqkQivojHgfcuIJ0VAc/XPzmMVljrcQOBmdVojY1NvVx/8mcRtEqeh+NxypJatM6+ezxb/7Io6uBwR4/e/1moicJunvz956A2ip/1Xv3Nt6JGSgd6rf47/0KtlHssHrfZi5rxVDwWDx5C7XgoHotHC9AANbO8YqBXERohMt8bv/8X/kNDRDM9cA+IgWVojhWuNxAYXo4mWePyeBwYHUKz5Lo6HidNvICmybvVxfXPqEbz7Gvr2vrn1KAdHH7IpX//8yNoD8dcGY+TM6NoF26MxzLTL26Mx0majtM4q5ed7yhNulVsd5WAxqset/mGS6/d5CIBLXI62/7I6ZKyzjUC0rIfsP+hE3zkxt9c8vy7tPnJbiKfuyP+Xdn8ZDeuiMei+zF0juWOGyBNv+iMxw4bEBkl6CzOxmPx6ll0mryWDtb/ViU6z17H4rEYG0I3cMiheByYFEZ34Ew8Dn5UjW7BiXisY/rFDfGYmgWCCwcngXto0q08z1YBSUsy3NWgb5Qe2WSjgJRlfdy2RJPcNXm9bQIarexpsP5VdxHjcbMcm2Q3/5P64i71U8k/ELuLNsVjcct2cnST+rGg+Jo4XmhLPBZ376GOfoOkAIB5NWTHxuu/nzj9ElkA8gLgA+pLlvF43IU4/VI9G1QEAHnIPjfVaP1PnqRdVngKqAkActDMa2Hw/u9zijjjNg5UBcBr1FbD3jbG6h9QSruk8ovfyFESABnUWSNT8VgMI06/lF7aBqomAJ4n3m+G4nHgbeJfZfHljcCKAqDHcWo87m2g/gnE53LhlS+lqQqATv9S4/FL2u//qcT2T34XoAuAdvuJBspf11z/LOKbyYG6q4bqAqDVTqKByjFa21/U6ZfdaWBNADTdTDQQnqSv/pRMYjrZevVLCUUAiF+JBqpnaqv/J2I+zb3mxZwkAMTPDq8ep1A3P/1y3ZOEJABgiaPxuOnvxLN/B7oEwELq/sPl1utvSdz8VPsl6BMAn1AbBKut1t96F+3ENXOFTgFiehXRwAZL8Vi0JW5+qppW7+HIAgDGnyca2G4hHouOh2knvTARdAuAkedsj8cinTj9Ujka9AuAV87YHI/F08TNT2eHgQkB0I/aIDhGmuIU/YnnKxkAZgTAU8SGHC0eDyJufiqKfTKrAqBrPtFAiXo8HlFBO1VBA7ebZQHQifhUVo7H4p2QgQeOdQHQbp8t8Tg4idj+2dPgwJIGAdBqhw3xmDz9EuelQ4cASP3DeDwOziW+ecdbldEiACDbcDxOWkBs/8QNHpoEAPXjLNFMmfpv+IZ4+PjRU5cAWGwwHqcQNz/J2NUmAMgjavHjMfEPTGpvvz4BQH1MrzMkoHoW2CsAppEaBFskemQUA+HJYLcAeJfQINgpNVuvbiA0FuwXAG8qNwh2S07WqxqQ/saPXgEwRDGu7W8te2Q1A6XSH0HWLAD6nVa5zoPS9asZKJb/DLZuAdDzhPx1Hu2gkobkDRQq/J8w7QJAfstevuI3+WQN1F39dkAAtP9H7jpPdFVtiMgZOKC0Z9aAAEiT+mrbScLQjIyBXWngtABokRf/kKefonRF4xvYqrjmYEQApG6Md8SyvrS+eDwDG5QbzUYExL3QMxnUlZGGD5wFbhEADQ7YVwyhr401YCD6LbhHACyK3SA4N9TK6mhMA5EvwE0CYF6sBkFopLXl8exYq9/gLgHwYf3x+PxoqwMC9RoIvw9uE1D/gH3VeOsjItnSq9/OCqhvwL5qAoABA5XU28qsAHjj2tW8mukABgzEXP12WgAMvrpBEPkYwICB2KvfjguAvnUH7GvnARgwUGRhEt24gLoD9tGvAAwYKLDyySzzAqDzpQH76CIAAwYOWtqNYoMAaH9xwP57AAMG9ljbj2SHALhjJyLijwAGDGyzuCPNFgGQuhlxpfw1yR94dfAxi5cmojI/lRyx+rtaX9XDhADr2CVABc//JycWwAJYAAtgASyABbAAFsACWAALYAEsgAWwABbAAlgAC2ABLIAFsAAWwAJYAAtgASyABbAAFsACWAALYAEsgAWwABbAAlgAC2ABLIAFsAAWwAJYAAtgASyABbAAFsACWAALYAEsgAWwABbAAlgAC2ABLIAFsAAWwAJYAAtgASyABbAAFsACWIDToH8FyJUWtVWAALedDoFhGIZhGIZhGIZhGIYxyf+YwEMsIhMo/AAAAABJRU5ErkJggg==";var UC=new go;function Gm(e,r,t){var nt;let{breakpoint:i,width:n,accentColor:o,completeFraction:s,isVertical:l,visibleThroughGeometry:h,dashed:p}=r,{color:m}=t,f=!0,v=0,y=1/0,C=r.displayArrowsOnPath,M=!0,g=C,b=typeof n=="object"?Number(n.output[i])/2:n/2,P=typeof n=="object"?Number((nt=n.output[i+1])!=null?nt:n.output[i])/2:n/2,S=b/2+HC,T=0;e[0].z+=S;for(let H=1;H<e.length;++H){e[H].z+=S;let j=e[H].x-e[H-1].x,Se=e[H].z-e[H-1].z;if(l)T+=Math.sqrt(j*j+Se*Se);else{let Je=e[H].y-e[H-1].y;T+=Math.sqrt(j*j+Je*Je+Se*Se)}}if(!l){let H=e[0],j=e[e.length-1];e.push(j.clone().setZ(j.z-.01)),e.unshift(H.clone().setZ(H.z-.01))}let _=new mc;g&&(_=UC.load(Fm),_.colorSpace=wr);let R=new ye(m),A=new ye(o),k={vertexes:{type:"f",value:1},resolution:{type:"v2",value:new K(1,1)},cameraParameters:{type:"v2",value:new K(v,0)},complete:{type:"f",value:f?0:1},color:{type:"c",value:R},pathLength:{type:"f",value:T},nearRadius:{type:"f",value:b},farRadius:{type:"f",value:P},nearZoom:{type:"f",value:v},farZoom:{type:"f",value:y},pulseColor:{type:"c",value:A},pulse:{type:"f",value:0},pulseLength:{type:"f",value:.075},pathIsVertical:{type:"b",value:l},arrowAnimationTimer:{type:"f",value:0},arrowTexture:{type:"t",value:_},displayArrowsOnPath:{type:"b",value:C},showPulse:{type:"b",value:M},opacityMultiplier:{type:"f",value:1},dashed:{type:"b",value:p}},F=new Sc(e);F.curveType="catmullrom",F.tension=0;let G=30,O=8,X=G*e.length,Z=new Cc(F,X,b,O,!1),J=new Float32Array(Z.attributes.position.count);for(let H=e.length;H<J.length;H++)J[H]=H;Z.setAttribute("vertexIndex",new $e(J,1));let re=new Float32Array(Z.attributes.position.count),$=new $e(re,1);for(let H=0;H<=X;H++)for(let j=0;j<=O;++j)$.setX(H*(O+1)+j,H/X);Z.setAttribute("pathDistance",$);let ve=new Float32Array(Z.attributes.normal.count*3),ue=new $e(ve,3);for(let H=0;H<X;H++){let j=Z.tangents[H];for(let Se=0;Se<=O;++Se)ue.setXYZ(H*(O+1)+Se,j.x,j.y,j.z)}Z.setAttribute("pathTangent",ue);let le=new Float32Array(Z.attributes.normal.count*3),ce=new $e(le,3);for(let H=0;H<X;H++){let j=Z.tangents[H];var ze,Ie,Le;l?(ze=j.x*j.y,Ie=-1+j.y*j.y,Le=j.z*j.y):(ze=-j.x*j.z,Ie=-j.y*j.z,Le=1-j.z*j.z);let Se=Math.sqrt(ze*ze+Ie*Ie+Le*Le);Se===0&&(Se=1);let Je=ze/Se,Ye=Ie/Se,Pt=Le/Se;for(let Gt=0;Gt<=O;++Gt)ce.setXYZ(H*(O+1)+Gt,Je,Ye,Pt)}Z.setAttribute("pathNormal",ce);let De=new nr({uniforms:k,vertexShader:sa,fragmentShader:Zu});De.transparent=!0,De.alphaTest=.5,k.resolution.value.x=1,k.resolution.value.y=1,k.vertexes.value=J.length,k.arrowTexture.value.wrapS=Tt,k.arrowTexture.value.wrapT=Tt,k.arrowTexture.value.anisotropy=16;let xe=new ae(Z,De),qe=xe.clone(),We=Ze(se({},k),{opacityMultiplier:{type:"f",value:.25}});We.complete.value=1,qe.material=new nr({uniforms:We,vertexShader:sa,fragmentShader:Zu}),qe.material.transparent=!0,qe.material.alphaTest=.5,qe.material.depthWrite=!1,qe.material.depthTest=!1,We.resolution.value.x=1,We.resolution.value.y=1,We.vertexes.value=J.length,We.arrowTexture.value.wrapS=Tt,We.arrowTexture.value.wrapT=Tt,We.arrowTexture.value.anisotropy=16,We.complete.value=s,xe.userData=qe.userData=r.mesh.userData;let at=r.mesh;if(!h){let H=new nr({uniforms:k,vertexShader:sa,fragmentShader:Bm}),j=new ae(Z,H);j.name="stencil",j.material.colorWrite=!1,j.material.stencilWrite=!0,j.material.stencilRef=1,j.material.stencilFunc=pc,j.material.stencilZPass=po,j.material.stencilZFail=po,j.material.stencilFail=po,j.material.depthWrite=!1,j.material.depthTest=!1,j.userData=r.mesh.userData,at.add(j),at.add(qe),qe.renderOrder=0,xe.renderOrder=1}if(at.add(xe),l){let H=new Ue().setFromObject(xe),j=new z;H.getCenter(j),at.children.forEach(Se=>{Se.geometry.center(),Se.position.copy(j)})}h&&(xe.material.stencilWrite=!0,xe.material.stencilRef=1,xe.material.stencilFunc=hc,xe.material.stencilZPass=ho,xe.material.stencilZFail=ho,xe.material.stencilFail=ho,xe.material.needsUpdate=!0,xe.layers.disableAll(),xe.layers.enable(To.ALWAYS_ON_TOP)),Z.computeBoundingBox();let er=new z;return Z.boundingBox.getCenter(er),{mesh:at,material:De,center:er}}a(Gm,"buildPath");var HC=.15;var WC=.5,Uu=class Uu extends ie{constructor(t,i,n,o){super();d(this,"rendererState");d(this,"altitudeDirty",!0);d(this,"convertTo3DMapPosition");d(this,"getParentContainer");d(this,"convertZoomLevelToAltitude");this.rendererState=t,this.convertTo3DMapPosition=i,this.getParentContainer=n,this.convertZoomLevelToAltitude=o}update(t,i,n,o=0){let s,l=!1;for(let h of this.rendererState.geometry3DIdsInScene)if(s=this.rendererState.geometry3DMap.get(h),s&&s.type==="path"&&s.components[0].type==="path"){let p=s.components[0],m=s.components[1],f=p.isVertical&&this.altitudeDirty;if(!(p instanceof xr))continue;let v=[];if(p.dirty||f){if(p.mesh.parent!=null)for(let y=p.mesh.children.length-1;y>=0;y--)Ee(p.mesh.children[0]);if(p.feature.features.length===2&&p.feature.features[0].properties.parentId&&p.feature.features[1].properties.parentId){let y=p.feature.features[0],C=p.feature.features[p.feature.features.length-1],M,g,b=y.geometry.coordinates[2]||0,P=C.geometry.coordinates[2]||0;y.properties.parentId&&(M=this.getParentContainer(y.properties.parentId,!0),M!=null&&M.altitude!=null&&(b+=M.altitude,p.isVertical=!0)),C.properties.parentId&&(g=this.getParentContainer(C.properties.parentId,!0),g!=null&&g.altitude!=null&&(P+=g.altitude,p.isVertical=!0));let S=this.convertTo3DMapPosition(y.geometry.coordinates[1],y.geometry.coordinates[0],b),T=this.convertTo3DMapPosition(C.geometry.coordinates[1],C.geometry.coordinates[0],P);Math.abs(S.z-T.z)>WC&&M!=null&&M.visible&&g!=null&&g.visible&&(v=[S,T])}else{let y=p.feature.features;for(let C=0;C<y.length;C++)if(C===0||!Qc(y[C].geometry.coordinates,y[C-1].geometry.coordinates)){let M=this.convertTo3DMapPosition(y[C].geometry.coordinates[1],y[C].geometry.coordinates[0],y[C].geometry.coordinates[2]||0);v.push(M)}}if(v.length>1){let{mesh:y,material:C,center:M}=Gm(v,p,{color:m.color});p.mesh=y,p.material=C,p.position=M}p.dirty&&typeof p.width=="object"&&p.width.on==="zoom-level"&&(p.altitudeBreakpoints=p.width.input.map(y=>this.convertZoomLevelToAltitude(y))),p.dirty=!1}m.dirty&&(p.mesh.children.forEach(y=>{y.name!=="stencil"&&(y.material.uniforms.color.value.set(m.color),y.material.visible=m.visible,y.material.needsUpdate=!0)}),p.mesh.position.z=m.altitude,m.dirty=!1),p.isVertical&&p.mesh.children.forEach(y=>{y.rotation.z=-o}),p.material&&(p.mesh.children.forEach(y=>{var M,g,b,P,S,T,_;let C=y.material.uniforms;if(y.name==="stencil"){p.materialDirty&&(C.complete.value=p.completeFraction);return}if(typeof p.width=="object"&&p.width.on==="zoom-level"){p.altitudeBreakpoints&&p.altitudeBreakpoints.length>2&&q.warn("Path width interpolation does not yet support more than 2 breakpoints! This will be added in a future version. Path width will only use the first two breakpoints.");let R=Gc(n,(g=(M=p.altitudeBreakpoints)==null?void 0:M.slice(0,2))!=null?g:[t,i]);p.breakpoint=R,C.nearZoom.value=(P=(b=p.altitudeBreakpoints)==null?void 0:b[R])!=null?P:t,C.farZoom.value=(T=(S=p.altitudeBreakpoints)==null?void 0:S[R+1])!=null?T:i,C.nearRadius.value=Number(p.width.output[R])/2,C.farRadius.value=Number((_=p.width.output[R+1])!=null?_:p.width.output[R])/2}C.cameraParameters.value.x=n,p.materialDirty&&(C.displayArrowsOnPath.value=p.displayArrowsOnPath,C.pulseColor.value.set(p.accentColor),C.complete.value=p.completeFraction,typeof p.width=="number"&&(C.nearZoom.value=t,C.farZoom.value=i,C.nearRadius.value=Number(p.width)/2,C.farRadius.value=Number(p.width)/2))}),p.displayArrowsOnPath&&p.animateArrowsOnPath&&(p.mesh.children.forEach(y=>{y.name!=="stencil"&&(y.material.uniforms.arrowAnimationTimer.value=performance.now()/3e3,y.material.needsUpdate=!0)}),l=!0),p.materialDirty=!1)}this.altitudeDirty=!1,l&&this.publish("animate:path")}};a(Uu,"PathSystem");var Hn=Uu;x();var Oe,Fi,Kt,Hu=class Hu{constructor(r){d(this,"rendererState");d(this,"dirty",!1);L(this,Oe);L(this,Fi);L(this,Kt);this.rendererState=r}updateOne(r){if(r instanceof ne&&r.components[0]instanceof Me&&r.components[1]instanceof It&&r.parentObject3D instanceof lt&&(B(this,Oe,r.components[0]),B(this,Kt,r.components[1]),u(this,Oe).detached&&u(this,Oe).dirty&&u(this,Oe).mesh!=null&&u(this,Oe).material!=null&&u(this,Oe).batchedProps!=null)){B(this,Fi,r.parentObject3D),u(this,Oe).visible=!1;let t=new ye(u(this,Kt).color),i=u(this,Kt).opacity*ci(r),n=new Zr({color:t,side:ft,opacity:i!=null?i:1,transparent:i!==void 0?i<1:!1},1,u(this,Oe).material.repeatYFactor),o=new Co(1,u(this,Oe).batchedProps.positionCount,0,n),s=cm(u(this,Oe),o);if(s==null)return;o.userData={entities:{0:r.id},detached:!0},u(this,Oe).instanceIndex=s,u(this,Oe).material.setColor(u(this,Oe).instanceIndex,t,u(this,Kt).topColor?new ye(u(this,Kt).topColor):t),u(this,Oe).mesh=o,u(this,Oe).material=n,u(this,Fi).add(o),u(this,Oe).dirty=!1}}update(){if(!this.dirty)return;let r;for(let t of this.rendererState.geometry3DIdsInScene)r=this.rendererState.geometry3DMap.get(t),this.updateOne(r);this.dirty=!1,this.cleanup()}cleanup(){B(this,Oe,void 0),B(this,Fi,void 0),B(this,Kt,void 0)}};Oe=new WeakMap,Fi=new WeakMap,Kt=new WeakMap,a(Hu,"MeshDetachmentSystem");var aa=Hu;x();x();function Xm(e,r,t){var i;if((i=e.batchedProps)!=null&&i.range&&e.mesh){let n=r||1e-4,o=n/Math.max(t,1e-4);return Hs(e.mesh.geometry,e.batchedProps.range,n,0),e.material&&(e.material.repeatYFactor=o),e.currentHeight=n,!0}return!1}a(Xm,"updateHeight");function zm(e,r,t,i,n,o){return e.mesh&&e.instanceIndex!==-1?(e.mesh.getMatrixAt(e.instanceIndex,t),t.decompose(i,n,o),i.z=r,t.compose(i,n,o),e.mesh.setMatrixAt(e.instanceIndex,t),e.altitude=r,!0):!1}a(zm,"updateAltitude");var St,Bt,ua,ca,ha,pa,Wu=class Wu{constructor(r){d(this,"rendererState");d(this,"dirty",!1);L(this,St);L(this,Bt);L(this,ua,new ot);L(this,ca,new z);L(this,ha,new Ir);L(this,pa,new z);this.rendererState=r}updateOne(r){var t;if(r instanceof ne&&r.type==="geometry"&&((t=r.components[1])!=null&&t.dirty)&&(B(this,St,r.components[0]),B(this,Bt,r.components[1]),r.type==="geometry")){let i=!1;u(this,Bt).height!==u(this,St).currentHeight&&(i=Xm(u(this,St),u(this,Bt).height,u(this,Bt).initialHeight)),u(this,Bt).altitude!==u(this,St).altitude&&(i=zm(u(this,St),u(this,Bt).altitude,u(this,ua),u(this,ca),u(this,ha),u(this,pa))),i&&u(this,St).mesh!=null&&u(this,St).mesh.computeBoundingSphere()}}update(){let r;for(let t of this.rendererState.geometry3DIdsInScene)r=this.rendererState.geometry3DMap.get(t),this.updateOne(r);this.cleanup()}cleanup(){B(this,St,void 0),B(this,Bt,void 0)}};St=new WeakMap,Bt=new WeakMap,ua=new WeakMap,ca=new WeakMap,ha=new WeakMap,pa=new WeakMap,a(Wu,"MeshModificationSystem");var la=Wu;x();var jC={showPolygonLabelTextAreaMesh:!1,showEnvMap:!1,showCollisionBoxes:!1},ju=class ju{constructor(r){d(this,"state",jC);d(this,"core");this.core=r}update(r){let t={};for(let[i,n]of Object.entries(r))i in this.state&&this.state[i]!==r[i]&&(this.state[i]=n,t[i]=n);this.handleUpdate(t)}handleUpdate(r){r.showPolygonLabelTextAreaMesh!=null&&(r.showPolygonLabelTextAreaMesh?this.core.getSystems().text3DSystem.showTextAreaMesh():this.core.getSystems().text3DSystem.hideTextAreaMesh()),r.showEnvMap!=null&&(r.showEnvMap?this.core.setEnvironment("basic"):this.core.setEnvironment(!1)),r.showCollisionBoxes!=null&&(r.showCollisionBoxes?(this.core.getSystems().collisionSystem.showCollisionBoxes(),this.core.render()):this.core.getSystems().collisionSystem.hideCollisionBoxes())}};a(ju,"Debug");var da=ju;x();var Wn=9,VC=!1,Ym=.1;function qC(e,r,t){for(let i=0;i<r;i++){let n=(t&16711680)>>16,o=(t&65280)>>8,s=t&255;e[i*3]=n/255,e[i*3+1]=o/255,e[i*3+2]=s/255}}a(qC,"fillArrayWithColor");var Vu=class Vu{constructor(r,t,i){d(this,"state");d(this,"renderer");d(this,"renderService");d(this,"pickingTexture");d(this,"pickingMaterial");d(this,"pixelBuffer");d(this,"width",0);d(this,"height",0);d(this,"scale",1/2);d(this,"color",1);d(this,"convertTo3DMapPosition");d(this,"destroyed",!1);d(this,"enabled",!1);d(this,"backgroundId",16777215);d(this,"resize",a(()=>{let r=this.state.pixelRatio;this.width=Math.floor(this.renderer.domElement.width/r*this.scale),this.height=Math.floor(this.renderer.domElement.height/r*this.scale),this.pixelBuffer=new Uint8Array(4*this.width*this.height),this.pickingTexture=new yc(this.width,this.height,{format:co,type:uo,internalFormat:"RGBA"})},"resize"));d(this,"shouldShowByXY",a((r,t,i)=>{if(this.pixelBuffer==null)return!1;let n=r+(this.height-t-1)*this.width,o=this.pixelBuffer[n*4],s=this.pixelBuffer[n*4+1],l=this.pixelBuffer[n*4+2],h=o<<16|s<<8|l;return h===i||h===this.backgroundId},"shouldShowByXY"));d(this,"activeOccluders",new Set);d(this,"update",a(()=>{if(!this.enabled||(this.activeOccluders.clear(),this.activeOccluders.add(this.backgroundId),!this.pickingTexture||!this.pixelBuffer))return;let r,t;for(let n of this.state.geometry3DIdsInScene){let o=this.state.geometry3DMap.get(n);if(o&&o instanceof me&&o.userData.occluderFeature!=null&&o.userData.occluderId!=null&&(this.activeOccluders.add(o.userData.occluderId),o.userData.occluderDirty)){if(r=o.userData.occluderFeature,r.geometry.type==="Polygon"){let s=Is(r,this.convertTo3DMapPosition,{color:"white",height:Ym});t=this.createOccluderMesh(s,o.userData.occluderId),o.add(t)}else if(r.geometry.type==="MultiPolygon"){let s=Es(r,this.convertTo3DMapPosition,{color:"white",height:Ym});t=this.createOccluderMesh(s,o.userData.occluderId),o==null||o.add(t)}o.userData.occluderDirty=!1}}this.renderer.setRenderTarget(this.pickingTexture);let i=new ye(this.backgroundId);this.renderer.setClearColor(i),this.renderer.clear(),this.state.cameraObject.layers.disableAll(),this.state.cameraObject.layers.enable(Wn),this.renderer.render(this.state.entityScene.parent,this.state.cameraObject),this.renderer.setRenderTarget(null),this.state.cameraObject.layers.disable(Wn),VC?this.renderService.enabledLayers.add(Wn):this.renderService.enabledLayers.delete(Wn),this.renderer.readRenderTargetPixelsAsync(this.pickingTexture,0,0,this.width,this.height,this.pixelBuffer).then(()=>{if(!this.destroyed)for(let n of this.state.geometry2DIdsInScene){let o=this.state.geometry2DMap.get(n);if(o&&(o==null?void 0:o.occluderId)!=null&&this.activeOccluders.has(o==null?void 0:o.occluderId)){let s=o.components[0].projection,l=Math.floor(s.x*this.scale),h=Math.floor(s.y*this.scale),p=this.shouldShowByXY(l,h,o.occluderId);o.components[0].isOccluded=!p}}})},"update"));if(this.state=r,this.convertTo3DMapPosition=t,(i==null?void 0:i.renderer)==null)throw new Error("No Renderer");this.renderService=i,this.renderer=i.renderer,this.resize(),this.pickingMaterial=new nr({glslVersion:dc,vertexShader:"\n attribute vec3 color;\n varying vec3 vColor;\n void main() {\n vColor = color;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }\n ",fragmentShader:"\n varying vec3 vColor;\n out vec4 fragColor;\n\n void main() {\n fragColor = vec4(vColor, 1.0);\n }\n "})}applyId(r,t){let i=r.attributes.position,n=new Float32Array(i.count*3);qC(n,i.count,t),r.setAttribute("color",new $e(n,3))}createOccluderMesh(r,t){let i=new ae(r,this.pickingMaterial);return i.layers.set(Wn),this.applyId(i.geometry,t),i.userData.occluderId=t,i}reserveOccluderId(){return this.color++,this.color}enable(){this.enabled=!0}disable(){this.enabled=!1}destroy(){var r;this.destroyed=!0,(r=this.pickingTexture)==null||r.dispose(),this.pickingMaterial.dispose(),this.pickingTexture=void 0,this.pixelBuffer=void 0}};a(Vu,"Occlusion2DSystem");var ma=Vu;x();var qu=class qu{constructor(r){this.state=r;d(this,"dirty",!0)}update(){var r;if(this.dirty){for(let t of this.state.geometry3DIdsInScene){let i=this.state.geometry3DMap.get(t);if(i instanceof ne&&i.type==="geometry"&&((r=i.components[0])==null?void 0:r.geometry)!=null){let n=i.components[0];n.geometry&&(n.geometry.dispose(),n.geometry=void 0)}}this.dirty=!1}}};a(qu,"GeometryDisposalSystem");var fa=qu;var Zm=new Mt;var{DEFAULT_PITCH:Pd,DEFAULT_BEARING:Td,DEFAULT_ZOOM_LEVEL:Md,DEFAULT_MIN_ZOOM_LEVEL:JC,DEFAULT_MAX_ZOOM_LEVEL:$C}=pt,KC=ee.radToDeg(.6435011087932844),_e,Pe,ti,jn,Gi,Tr,ri,Xi,He,$u,I,pe,Ct,we,Ft,Ge,E,Vn,Xe,fe,Um,Hm,Wm,Qt,ya,qn,Jn,$n,zi,ga,Kn,Qn,eo,Yi,Ku,ii,to,ro,rt,it,Qu,Zi,io,ec=class ec extends ie{constructor(t,i={}){var v,y,C,M,g,b,P,S,T,_,R,A,k,F,G;super();L(this,He);d(this,"options");d(this,"container");d(this,"Debug");L(this,_e);L(this,Pe);L(this,ti);L(this,jn);L(this,Gi);L(this,Tr);L(this,ri);L(this,Xi);d(this,"rendererDomElement");L(this,I,{geometry3DMap:new Map,geometry2DMap:new Map,geometry2DIdsInScene:new Set,geometry3DIdsInScene:new Set,geometryGroupIdsToLoad:new Set,entityScene:new me("__scene"),hoverColor:"#f6efff",text3dHoverColor:"white",insetsPadding:Po,shouldMeasureCanvas:!0,pixelRatio:this.resolutionScale,canvasWidth:0,canvasHeight:0,internalTweenGroup:new os,externalTweenGroup:new os,cameraObject:new va,naturalBearing:0,containerOffset:[0,0],useStandaloneCamera:!1});d(this,"camera");L(this,pe);L(this,Ct);L(this,we);L(this,Ft);L(this,Ge);L(this,E,{});L(this,Vn,window.matchMedia("screen and (min-resolution: 2dppx)"));d(this,"map");L(this,Xe,a(()=>{u(this,E).renderSystem.twoDdirty=!0},"#invalidate2DEntities"));L(this,fe,a(()=>{u(this,E).renderSystem.threeDdirty=!0},"#invalidate3DEntities"));L(this,Qt,"standalone");L(this,ya,a(()=>{u(this,E).geometryDisposalSystem.dirty=!0,this.render()},"#setGeometryDisposalDirty"));L(this,qn,a(t=>Math.trunc(t*10)/10,"#round10"));L(this,Jn,a(()=>{Te(this,He,$u).call(this,Vi()),u(this,E).twoDDrawSystem.dirty=!0,u(this,zi).call(this,void 0,void 0,!0)},"#handlePixelRatioChange"));L(this,$n,a(()=>{u(this,zi).call(this)},"#handleWindowResizeWithEvent"));L(this,zi,a((t,i,n=!1)=>{let o=t!=null?t:this.rendererDomElement.clientWidth,s=i!=null?i:this.rendererDomElement.clientHeight;if((o===0||s===0)&&!n)return;u(this,I).canvasWidth=o,u(this,I).canvasHeight=s,Te(this,He,$u).call(this,Vi()),u(this,Yi).call(this),Te(this,He,Wm).call(this),u(this,E).cameraSystem.resize(this.canvasWidth,this.canvasHeight),u(this,E).cameraSystem.dirty=!0,u(this,E).watermarkSystem.resize(this.canvasWidth,this.canvasHeight),u(this,E).htmlControlsSystem.resize(this.canvasWidth),u(this,E).geometryInFocusSystem.resize(),u(this,E).occlusion2DSystem.resize();let{top:l,left:h}=this.container.getBoundingClientRect();u(this,I).containerOffset=[l,h],this.publish("resize"),this.render()},"#handleWindowResize"));L(this,ga,a(()=>{this.renderSync()},"#renderFull"));L(this,Kn,new z);L(this,Qn,a((t,i)=>{let n=this.mode==="standalone"?u(this,Pe):this.viewCamera;if(u(this,Pe).position.z+this.camera.elevation>i.z){u(this,Kn).copy(i);let o=u(this,Kn).project(n),s=(o.x+1)/2*this.canvasWidth-0/2,l=(-o.y+1)/2*this.canvasHeight-0/2,h=u(this,qn).call(this,s),p=u(this,qn).call(this,l);t.x=h,t.y=p}else t.x=-1e3,t.y=-1e3},"#project"));L(this,eo,a((t,i)=>{u(this,Ge).setBufferSize(t,i),u(this,Pe).aspect=t/i,u(this,Pe).updateProjectionMatrix(),u(this,Pe).updateMatrixWorld(!0),u(this,Gi).x=t,u(this,Gi).y=i},"#setBufferSize"));L(this,Yi,a(()=>{var s;let t=u(this,I).canvasWidth=this.rendererDomElement.clientWidth,i=u(this,I).canvasHeight=this.rendererDomElement.clientHeight,n=Math.floor(t*this.resolutionScale),o=Math.floor(i*this.resolutionScale);u(this,eo).call(this,n,o),(s=this.map)==null||s.resize(),u(this,I).shouldMeasureCanvas=!1},"#measureCanvas"));d(this,"getParentContainer",a((t,i=!0)=>{if(!t)return i?u(this,I).entityScene:void 0;if(typeof t=="string"||typeof t=="number"){let n=u(this,I).geometry3DMap.get(t);return n instanceof me?n:(q.warn("Parent (".concat(typeof t=="object"?t.id:t,") is not a valid container, adding to scene")),i?u(this,I).entityScene:void 0)}else if(t.type==="group-container"){let n=u(this,I).geometry3DMap.get(t.id);if(n instanceof me)return n}return i?u(this,I).entityScene:void 0},"getParentContainer"));d(this,"showCollisionBoxes",a(()=>{u(this,E).collisionSystem.showCollisionBoxes(),this.render()},"showCollisionBoxes"));d(this,"hideCollisionBoxes",a(()=>{u(this,E).collisionSystem.hideCollisionBoxes(),this.render()},"hideCollisionBoxes"));d(this,"projectScreenXYToCoordinate",a((t,i,n=!1)=>{var v,y;let o=u(this,I).containerOffset[0],s=u(this,I).containerOffset[1],l=(t-s)/u(this,I).canvasWidth*2-1,h=-((i-o)/u(this,I).canvasHeight)*2+1,p=new K(l,h),m,f;if(n)Zm.setFromCamera(p,u(this,Pe)),m=(v=Zm.intersectObject(u(this,Tr),!1)[0])==null?void 0:v.point;else{let C=u(this,E).interactionSystem.getThreeDIntersectsFromXY(p);m=(y=C==null?void 0:C[0])==null?void 0:y.point,f=u(this,E).interactionSystem.getGroupContainerIntersectsFromXY(p)}if(m)return{coordinate:this.convert3DMapPositionToCoordinate(m),groupContainers:f}},"projectScreenXYToCoordinate"));d(this,"projectCoordinateToScreenXY",a(t=>{let i=this.convertTo3DMapPosition(t[1],t[0],t[2]||0),n=new K;return u(this,Qn).call(this,n,i),{x:n.x,y:n.y}},"projectCoordinateToScreenXY"));d(this,"convert3DMapPositionToCoordinate",a(t=>{var o,s,l,h;let{lat:i,lon:n}=_o((s=(o=u(this,I).center)==null?void 0:o[1])!=null?s:0,(h=(l=u(this,I).center)==null?void 0:l[0])!=null?h:0,t.x,t.y);return[n,i,t.z]},"convert3DMapPositionToCoordinate"));d(this,"setBackgroundColor",a((t,i)=>{u(this,Ge).setBackgroundColor(t,i)},"setBackgroundColor"));d(this,"getMetresPerPixel",a(()=>{let t=this.container.clientWidth,i=this.container.clientHeight/2,n=this.projectScreenXYToCoordinate(0,i,!0),o=this.projectScreenXYToCoordinate(t,i,!0);return n==null||o==null?void 0:Lc(n.coordinate,o.coordinate)/t},"getMetresPerPixel"));d(this,"hideOutdoorLayersUnderPoint",a((t,i)=>{!this.map||(i==null?void 0:i.length)===0||(u(this,E).outdoorLayersSystem.hideLayersUnderPoint(t,i),this.render())},"hideOutdoorLayersUnderPoint"));d(this,"hideOutdoorLayersIntersectingPolygons",a((t,i,n)=>{u(this,E).outdoorLayersSystem.hideLayersIntersectingPolygons(t,i,n),this.render()},"hideOutdoorLayersIntersectingPolygons"));L(this,ii,new xc);L(this,to,new ot);L(this,ro,a(t=>{var i;q.error("Render failed: ",t,(i=t.stack)!=null?i:"No stack trace available"),this.publish("render-error",{error:t})},"#onRenderError"));d(this,"render",a(()=>{var t;if(((t=u(this,E))==null?void 0:t.renderSystem)!=null)if(this.map&&(this.mode==="outdoors-interleaved"||this.mode==="outdoors-overlay"))this.map.triggerRepaint();else return u(this,E).renderSystem.update().catch(u(this,ro))},"render"));d(this,"renderSync",a(()=>u(this,E).renderSystem.update(!0).catch(u(this,ro)),"renderSync"));L(this,rt,qi(()=>{this.publish("user-interaction-start",void 0)},0,!0));L(this,it,qi(()=>{this.publish("user-interaction-end",void 0),this.render()},0,!0));d(this,"on",a((t,i)=>{super.on(t,i),["outdoor-view-loaded","outdoor-style-loaded"].includes(t)&&this.mode==="standalone"&&D.env.NODE_ENV!=="test"&&(q.warn('"'.concat(t,'" was subscribed to but outdoor view is disabled. The event has been triggered immediately. Enable outdoor view or remove the listener.')),this.publish(t))},"on"));d(this,"off",a((t,i)=>{super.off(t,i)},"off"));d(this,"getCursor",a(()=>u(this,E).interactionSystem.getCursor(),"getCursor"));d(this,"destroy",a(()=>{var t;u(this,E)&&(u(this,E).cameraSystem.off("user-dolly-start",u(this,rt)),u(this,E).cameraSystem.off("user-pan-start",u(this,rt)),u(this,E).cameraSystem.off("user-rotate-start",u(this,rt)),u(this,E).cameraSystem.off("user-zoom-start",u(this,rt)),u(this,E).cameraSystem.off("user-tilt-start",u(this,rt)),u(this,E).cameraSystem.off("user-pedestal-start",u(this,rt)),u(this,E).cameraSystem.off("user-dolly-end",u(this,it)),u(this,E).cameraSystem.off("user-pan-end",u(this,it)),u(this,E).cameraSystem.off("user-rotate-end",u(this,it)),u(this,E).cameraSystem.off("user-zoom-end",u(this,it)),u(this,E).cameraSystem.off("user-tilt-end",u(this,it)),u(this,E).cameraSystem.off("user-pedestal-end",u(this,it)),u(this,E).renderSystem.off("measure-canvas",u(this,Yi)),u(this,E).meshOptimizationSystem.off("geometry-2d-added",this.render),u(this,E).meshOptimizationSystem.off("model-loaded",this.render),this.remove("__scene"),u(this,Xe).call(this),u(this,fe).call(this),this.renderSync(),u(this,E).renderSystem.destroy(),u(this,E).cameraSystem.off("change",this.render),u(this,E).pathSystem.off("animate:path",this.render),u(this,E).cameraSystem.dispose(),u(this,E).exporterSystem.destroy(),u(this,E).outdoorLayersSystem.destroy(),u(this,E).drawSystem.destroy(),window.removeEventListener("resize",u(this,$n),!1),u(this,Vn).removeEventListener("change",u(this,Jn)),u(this,ri)&&u(this,ri).disconnect(),this._subscribers={},u(this,Ge).destroy(),(t=u(this,_e))==null||t.traverse(i=>{Ee(i),"dispose"in i&&typeof i.dispose=="function"&&i.dispose()}),B(this,_e,void 0),u(this,E).htmlControlsSystem.destroy(),u(this,E).collisionSystem.destroy(),u(this,E).interactionSystem.destroy(),u(this,E).domMutationSystem.destroy(),u(this,E).geometryInFocusSystem.destroy(),B(this,E,void 0),u(this,Qt)!=="outdoors-overlay"&&(this.map&&this.map.remove(),this.container.contains(this.rendererDomElement)&&this.container.removeChild(this.rendererDomElement)),this.container.removeChild(u(this,Ft)),this.container.removeChild(u(this,pe)),B(this,Ge,void 0))},"destroy"));L(this,Zi,new z);L(this,io,new z);if(u(this,I).useStandaloneCamera=(v=i.useStandaloneCamera)!=null?v:!1,u(this,I).naturalBearing=(y=i.naturalBearing)!=null?y:0,this.convertTo3DMapPosition=this.convertTo3DMapPosition.bind(this),!t.clientWidth||!t.clientHeight)throw new Error("[MappedinJS] Container width and height must be greater than 0");this.convertTo3DMapPosition=this.convertTo3DMapPosition.bind(this),(i.mode==="outdoors-interleaved"||i.mode==="outdoors-overlay")&&i.map&&(B(this,Qt,i.mode),this.map=i.map),u(this,I).entityScene.addEventListener("childadded",()=>{u(this,fe).call(this),u(this,Xe).call(this)}),u(this,I).entityScene.addEventListener("childremoved",()=>{u(this,fe).call(this),u(this,Xe).call(this)}),u(this,I).geometry3DMap.set(u(this,I).entityScene.userData.entityId,u(this,I).entityScene),i.center&&(u(this,I).center=i.center?[...i.center]:[0,0]),this.options=i,this.container=t,Te(this,He,Um).call(this),Te(this,He,Hm).call(this),u(this,E).htmlControlsSystem=new ns(this.container,{outdoorEnabled:!!this.map}),u(this,Qt)!=="outdoors-overlay"&&u(this,E).htmlControlsSystem.addAttributionControl(this.options.attribution),window.MappedinDebug||(window.MappedinDebug={}),D.env.NODE_ENV==="test"&&(window.MappedinDebug.mapViewCoreInstance=this),B(this,Ge,new Do({antialias:typeof i.antialias=="boolean"?i.antialias:!0,alpha:!1,canvas:this.mode!=="standalone"?(C=i.gl)==null?void 0:C.canvas:void 0,onWebGLContextCreationError:i.onWebGLContextCreationError,onWebGLContextLost:i.onWebGLContextLost,onWebGLContextRestored:a(O=>{var X;(X=i.onWebGLContextRestored)==null||X.call(i,O),u(this,Xe).call(this),u(this,fe).call(this),this.render()},"onWebGLContextRestored"),onWebGLRendererError:i.onWebGLRendererError,backgroundColor:i.backgroundColor||"#ffffff",backgroundAlpha:(M=i.backgroundAlpha)!=null?M:1})),B(this,_e,new or),u(this,Qt)!=="standalone"&&u(this,_e).add(eh()),u(this,_e).add(u(this,I).entityScene);let n=window.__THREE_DEVTOOLS__;D.env.NODE_ENV==="dev"&&typeof n<"u"&&(n.dispatchEvent(new CustomEvent("observe",{detail:u(this,_e)})),n.dispatchEvent(new CustomEvent("observe",{detail:u(this,Ge)}))),B(this,Pe,new va(KC,this.aspect,50,1e5)),u(this,I).cameraObject=u(this,Pe),B(this,jn,new bc),u(this,Pe).renderOrder=999;let o=new zt;o.add(u(this,Pe)),B(this,Xi,new zt),u(this,Xi).add(o),u(this,_e).add(u(this,Xi)),u(this,Pe).updateProjectionMatrix(),u(this,Pe).updateMatrixWorld(!0),this.referenceMap={scale:1,latitude:0,longitude:0,getNorth:a(()=>0,"getNorth"),georeference:[{target:{x:0,y:0}},{target:{x:0,y:0}},{target:{x:0,y:0}},{target:{x:0,y:0}}]},this.rendererDomElement=u(this,Ge).domElement(),B(this,Gi,new K);let s=new yt(1e6,1e6),l=new je({color:0,visible:!1});B(this,Tr,new ae(s,l)),u(this,Tr).name="worldPlane",u(this,_e).add(u(this,Tr)),(g=i.gl)!=null&&g.canvas||t.appendChild(this.rendererDomElement),window.addEventListener("resize",u(this,$n),!1),u(this,Vn).addEventListener("change",u(this,Jn)),typeof ResizeObserver=="function"&&((b=D.env)==null?void 0:b.NODE_ENV)!=="test"&&(B(this,ri,new ResizeObserver(lc(O=>{u(this,zi).call(this,O[0].contentRect.width,O[0].contentRect.height)},50))),(P=u(this,ri))==null||P.observe(t)),t.classList.add("mappedin-map"),this.rendererDomElement.style.width=(S=globalThis.MappedinDebug)!=null&&S.TEST_IOS?"1080px":"100%",this.rendererDomElement.style.height=(T=globalThis.MappedinDebug)!=null&&T.TEST_IOS?"1920px":"100%",D.env.NODE_ENV==="test"&&this.rendererDomElement.setAttribute("data-testid","mappedin-canvas"),this.mode!=="outdoors-overlay"&&this.rendererDomElement.tabIndex!==void 0&&this.rendererDomElement.removeAttribute("tabindex"),u(this,I).canvasWidth=this.rendererDomElement.clientWidth,u(this,I).canvasHeight=this.rendererDomElement.clientHeight,this.rendererDomElement.style.touchAction="manipulation";let h=this.canvasWidth,p=this.canvasHeight;u(this,E).watermarkSystem=new Xs(u(this,Pe),u(this,I),i==null?void 0:i.watermark),u(this,E).watermarkSystem.on("texture-loaded",this.render),u(this,I).shouldMeasureCanvas=!0,u(this,I).pixelRatio=this.resolutionScale,u(this,eo).call(this,Math.floor(h*this.resolutionScale),Math.floor(p*this.resolutionScale));let m=new bo(16777215,.3*Math.PI);m.position.set(-150,-150,350),u(this,_e).add(m);let f=new Tc(16777215,.741*Math.PI);u(this,_e).add(f),u(this,E).cameraSystem=new Ei(u(this,Pe),u(this,_e),u(this,Ge).renderer,u(this,I),{mode:this.mode,canvasHeight:p,canvasWidth:h}),u(this,E).cameraSystem.on("user-dolly-start",u(this,rt)),u(this,E).cameraSystem.on("user-pan-start",u(this,rt)),u(this,E).cameraSystem.on("user-rotate-start",u(this,rt)),u(this,E).cameraSystem.on("user-zoom-start",u(this,rt)),u(this,E).cameraSystem.on("user-tilt-start",u(this,rt)),u(this,E).cameraSystem.on("user-pedestal-start",u(this,rt)),u(this,E).cameraSystem.on("user-dolly-end",u(this,it)),u(this,E).cameraSystem.on("user-pan-end",u(this,it)),u(this,E).cameraSystem.on("user-rotate-end",u(this,it)),u(this,E).cameraSystem.on("user-zoom-end",u(this,it)),u(this,E).cameraSystem.on("user-tilt-end",u(this,it)),u(this,E).cameraSystem.on("user-pedestal-end",u(this,it)),u(this,E).cameraSystem.on("change",()=>{this.publish("camera-change",this.camera),u(this,E).geometryInFocusSystem&&(u(this,E).geometryInFocusSystem.cameraDirty=!0),this.render()}),u(this,E).pathSystem=new Hn(u(this,I),this.convertTo3DMapPosition,this.getParentContainer,u(this,E).cameraSystem.convertZoomLevelToAltitude),u(this,E).pathSystem.on("animate:path",this.render),u(this,E).panBoundsSystem=new Zs(u(this,I),u(this,E).cameraSystem),u(this,E).panBoundsSystem.on("update",()=>{let{panBounds:O,fov:X,convertAltitudeToZoomLevel:Z}=u(this,E).cameraSystem;if(u(this,E).panBoundsSystem.autoMinZoomLevel){if(O.radius<=0)return;let J=Math.min(u(this,I).canvasWidth/u(this,I).canvasHeight,1),re=X*Math.PI/180*J,$=Math.tan(re/2),{radius:ve,center:ue}=u(this,E).cameraSystem.panBounds,le=ve/$,ce=this.getThreeCamera().getWorldPosition(new z),ze=ue.distanceTo(ce),Ie=Math.abs(ce.z-ue.z),Le=le*Ie/ze,De=Z(Le);Kc(De,this.camera.minZoomLevel)&&this.camera.setMinZoomLevel(De)}this.publish("pan-bounds-change",u(this,E).cameraSystem.panBounds)}),this.camera=new fs(this,u(this,E),u(this,I)),this.camera.setZoomLevel((_=i.zoomLevel)!=null?_:Md),this.camera.setBearing((R=i.bearing)!=null?R:Td),this.camera.setPitch((A=i.pitch)!=null?A:Pd),this.camera.setMaxZoomLevel($C),this.camera.setMinZoomLevel(JC),u(this,E).domVisiblitySystem=new Ls(u(this,I),u(this,Ft)),u(this,E).domMutationSystem=new Gs(u(this,I),u(this,Ft)),u(this,E).domMutationSystem.on("dimensions-update",()=>{u(this,E).collisionSystem.collidersDirty=!0,this.render()}),u(this,E).domDrawSystem=new Fs(u(this,I)),u(this,E).collisionSystem=new ys(u(this,Ct),u(this,I),((k=i.useCollisionWorker)!=null?k:!0)&&((F=i.useWorkers)!=null?F:!0)),u(this,E).twoDDrawSystem=new Rs(u(this,I),u(this,we),i.transformImageRequest),u(this,E).twoDDrawSystem.on("img:loaded",this.render),u(this,E).interactionSystem=new Sn(this.rendererDomElement,u(this,I),u(this,Pe),u(this,Tr),u(this,E).cameraSystem.isUserInteracting),u(this,E).interactionSystem.on("doubletap-with-onefinger",O=>{var X;this.camera.animateTo({center:(X=this.projectScreenXYToCoordinate(O.clientX,O.clientY))==null?void 0:X.coordinate,zoomLevel:this.camera.zoomLevel+1,duration:wa,easing:"ease-out"})}),u(this,E).interactionSystem.on("singletap-with-twofinger",()=>{this.camera.animateTo({zoomLevel:this.camera.zoomLevel-1,duration:wa,easing:"ease-out"})}),u(this,E).interactionSystem.on("hover",this.render),u(this,E).interactionSystem.on("click",O=>{var Z,J,re,$,ve,ue,le,ce,ze,Ie,Le,De;if(((Z=O.entity2D)==null?void 0:Z.id)==="watermark"&&typeof u(this,E).watermarkSystem.options.onClick=="function"&&u(this,E).watermarkSystem.options.interactive){u(this,E).watermarkSystem.options.onClick();return}let X=O.entity3D?[(J=O.entity3D)==null?void 0:J.id]:[];(ve=($=(re=O.entity3D)==null?void 0:re.parentObject3D)==null?void 0:$.userData)!=null&&ve.entityId&&X.push((ce=(le=(ue=O.entity3D)==null?void 0:ue.parentObject3D)==null?void 0:le.userData)==null?void 0:ce.entityId),this.publish("click",{coordinate:this.convert3DMapPositionToCoordinate(O.position),geometry:X,paths:((ze=O.entity3D)==null?void 0:ze.components[0])instanceof xr?[O.entity3D.id]:[],markers:((Ie=O.entity2D)==null?void 0:Ie.components[0])instanceof Dt?[O.entity2D.id]:[],models:((Le=O.entity3D)==null?void 0:Le.components[0])instanceof gr?[O.entity3D.id]:[],labels:((De=O.entity2D)==null?void 0:De.components[0])instanceof Et?[O.entity2D.id]:[],containers:Array.isArray(O.groupContainers)?O.groupContainers.map(xe=>xe.userData.entityId):[],pointerEvent:O.pointerEvent})}),u(this,E).interactionSystem.on("hover",O=>{var X,Z,J,re,$;O.position&&this.publish("hover",{coordinate:this.convert3DMapPositionToCoordinate(O.position),geometry:O.entity3D?[(X=O.entity3D)==null?void 0:X.id]:[],paths:((Z=O.entity3D)==null?void 0:Z.components[0])instanceof xr?[O.entity3D.id]:[],markers:((J=O.entity2D)==null?void 0:J.components[0])instanceof Dt?[O.entity2D.id]:[],models:((re=O.entity3D)==null?void 0:re.components[0])instanceof gr?[O.entity3D.id]:[],labels:(($=O.entity2D)==null?void 0:$.components[0])instanceof Et?[O.entity2D.id]:[],containers:Array.isArray(O.groupContainers)?O.groupContainers.map(ve=>ve.userData.entityId):[]})}),u(this,E).geometryInFocusSystem=new Qs(u(this,I),u(this,Pe)),u(this,E).geometryInFocusSystem.on("geometry-in-focus",O=>{this.publish("geometry-in-focus",O)}),u(this,E).twoDVisiblitySystem=new Ns(u(this,I)),u(this,E).drawSystem=new ks(u(this,I),this.convertTo3DMapPosition),u(this,E).drawSystem.on("texture-loaded",this.render),u(this,E).twoDProjectionSystem=new As(u(this,I),u(this,Qn)),u(this,E).exporterSystem=new Cn(u(this,I)),u(this,E).meshOptimizationSystem=new Os(u(this,I),this.convertTo3DMapPosition),u(this,E).meshOptimizationSystem.on("model-loaded",this.render),u(this,E).meshOptimizationSystem.on("geometry-2d-added",this.render),u(this,E).meshOptimizationSystem.on("geometry-group-added",u(this,ya)),u(this,E).meshDetachmentSystem=new aa(u(this,I)),u(this,E).meshModificationSystem=new la(u(this,I)),u(this,E).geometryDisposalSystem=new fa(u(this,I)),u(this,E).customGeometrySystem=new Us(u(this,I),this.convertTo3DMapPosition),u(this,E).outlineInterpolationSystem=new js(u(this,I)),u(this,E).renderSystem=new Bs(u(this,Ge),u(this,I),this.mode,u(this,_e),u(this,Pe),this.viewCamera,u(this,E)),u(this,E).imageSystem=new Ks(u(this,I),this.convertTo3DMapPosition,i.bearing,i.naturalBearing,i.imagePlacementOptions),u(this,E).text3DSystem=new $o(u(this,I),this.convertTo3DMapPosition,(G=i.useWorkers)!=null?G:!0),u(this,E).text3DSystem.on("render",this.render),u(this,E).imageSystem.on("image-loaded",this.render),u(this,E).renderSystem.on("pre-render",()=>this.publish("pre-render")),u(this,E).renderSystem.on("post-render",()=>this.publish("post-render")),u(this,E).renderSystem.on("measure-canvas",u(this,Yi)),u(this,E).outdoorLayersSystem=new na(this.map),u(this,E).occlusion2DSystem=new ma(u(this,I),this.convertTo3DMapPosition,u(this,Ge)),i.occlusionEnabled&&u(this,E).occlusion2DSystem.enable(),this.Debug=new da(this),i.environment!==!1&&B(this,ti,Te(this,He,Qu).call(this)),u(this,ga).call(this)}get viewCamera(){return u(this,jn)}get canvasWidth(){return u(this,I).canvasWidth}get canvasHeight(){return u(this,I).canvasHeight}get resolutionScale(){var t,i;return(i=(t=this.map)==null?void 0:t._getClampedPixelRatio(this.canvasWidth,this.canvasHeight))!=null?i:Vi()}get aspect(){return this.canvasWidth/this.canvasHeight}get mode(){return u(this,Qt)}addGroupContainer(t,i,n){if(!u(this,I).geometry3DMap.has(t)&&!u(this,I).geometry2DMap.has(t)){let o=new me(t);o.addEventListener("childadded",()=>{u(this,fe).call(this),u(this,Xe).call(this)}),o.addEventListener("childremoved",()=>{u(this,fe).call(this),u(this,Xe).call(this)}),(i==null?void 0:i.visible)!==void 0&&(o.visible=i.visible),(i==null?void 0:i.altitude)!==void 0&&o.setAltitude(i.altitude),(i==null?void 0:i.interactive)!==void 0&&Fe(o,i.interactive,u(this,I)),(i==null?void 0:i.focusable)!==void 0&&rs(o,i.focusable),(i==null?void 0:i.preloadGeometry)!==void 0&&(o.userData.preloadGeometry=i.preloadGeometry),u(this,I).geometry3DMap.set(t,o);let s=this.getParentContainer(n);s instanceof me&&s.addEntity(o),u(this,fe).call(this),this.render()}else q.error("Group container with ID '".concat(t,"' already exists. The group container cannot be added."));return{id:t,type:"group-container"}}addCustomGeometry(t,i,n,o,s){if(u(this,I).geometry3DMap.has(t))q.error("Custom geometry with ID '".concat(t,"' already exists. The custom geometry cannot be added."));else{let l=new ki(i,n),h=new ne(l,new It(o));(o==null?void 0:o.interactive)!==void 0&&Fe(h,o.interactive,u(this,I)),h.id=t,l.mesh.userData={entityId:t,type:"custom-geometry"},u(this,I).geometry3DMap.set(h.id,h);let p=this.getParentContainer(s);s&&p instanceof me?p.addEntity(h):u(this,I).entityScene.addEntity(h),u(this,fe).call(this),this.render()}return{id:t,type:"custom-geometry"}}addGeometryGroup(t,i,n,o){var s,h;if(!u(this,I).geometry3DMap.has(t)&&!u(this,I).geometry2DMap.has(t)){let p=new lt(t);p.addEventListener("childadded",()=>{u(this,fe).call(this),u(this,Xe).call(this)}),p.addEventListener("childremoved",()=>{u(this,fe).call(this),u(this,Xe).call(this)}),p.userData.dirty=!0,u(this,I).geometry3DMap.set(t,p);for(let f of i.features){if(f.geometry==null||!["Polygon","MultiPolygon","LineString","MultiLineString"].includes(f.geometry.type))continue;let v=(f==null?void 0:f.id)||((s=f==null?void 0:f.properties)==null?void 0:s.id)||wt(),l=n||{color:zc},{visible:y,altitude:C}=l,M=sc(l,["visible","altitude"]),g=u(this,E).meshOptimizationSystem.createEntityFromFeature(v,f,se({outline:!0},M));u(this,I).geometry3DMap.set(v,g),p.userData.entities3D.add(v)}p.setVisible((h=n==null?void 0:n.visible)!=null?h:!0),(n==null?void 0:n.altitude)!=null&&p.setAltitude(n.altitude);let m=this.getParentContainer(o);m instanceof me&&m.addEntity(p),u(this,fe).call(this),this.render()}else q.error("Geometry group with ID '".concat(t,"' already exists. The geometry group cannot be added."));return u(this,E).outlineInterpolationSystem.geometries3DDirty=!0,{id:t,type:"geometry-group"}}addOccluder(t,i){let n=this.getParentContainer(i),o=u(this,E).occlusion2DSystem.reserveOccluderId();return n==null||n.addOccluderFeature(t,o),o}addImage(t,i,n,o){try{hm(t,i,n)}catch(s){q.error(s);return}if(!u(this,I).geometry3DMap.has(t)&&!u(this,I).geometry2DMap.has(t)){let s=new $s(i),l=new ne(s,new It(n));l.id=t||wt(),s.mesh.userData={entityId:l.id,type:"path"},u(this,I).geometry3DMap.set(l.id,l);let h=this.getParentContainer(o);h instanceof me&&h.addEntity(l),u(this,fe).call(this),this.render()}else q.error("Image with ID '".concat(t,"' already exists. The image cannot be added."));return{id:t,type:"image"}}addModelGroup(t,i,n,{parent:o,onComplete:s}={}){var l,h;try{Hd(t,i,n)}catch(p){q.error(p);return}if(!u(this,I).geometry3DMap.has(t)&&!u(this,I).geometry2DMap.has(t)){let p=new lt(t);p.addEventListener("childadded",()=>{u(this,fe).call(this),u(this,Xe).call(this)}),p.addEventListener("childremoved",()=>{u(this,fe).call(this),u(this,Xe).call(this)}),u(this,I).geometry3DMap.set(t,p),p.userData.dirty=!0,p.userData.modelURL=n.url;for(let f of i.features){let v=f.id||f.properties.id||wt(),y=u(this,E).meshOptimizationSystem.createModelFromFeature(v,f,se({},n));(f.properties.interactive!==void 0||n.interactive!=null)&&Fe(y,(l=f.properties.interactive)!=null?l:n.interactive,u(this,I)),u(this,I).geometry3DMap.set(v,y),p.userData.entities3D.add(v)}let m=this.getParentContainer(o);m instanceof me&&m.addEntity(p),u(this,fe).call(this),(h=this.render())==null||h.then(s)}else q.error("Model group with ID '".concat(t,"' already exists. The model group cannot be added."));return{id:t,type:"geometry-group"}}addMarker2D(t,i,n,o){var l;let s=n==null?void 0:n.id;try{Xp(t,i,n||{})}catch(h){q.error(h);return}if(s===void 0||!u(this,I).geometry2DMap.has(s)&&!u(this,I).geometry3DMap.has(s)){let h=Te(this,He,Ku).call(this,t,new Dt(i,n),n==null?void 0:n.occluderId,n==null?void 0:n.verticalOffset);h.id=s||String(h.id),s=h.id,(n==null?void 0:n.interactive)!=null&&n.interactive!=="pointer-events-auto"&&Fe(h,n==null?void 0:n.interactive,u(this,I));let p=typeof(n==null?void 0:n.attachTo)=="string"||typeof(n==null?void 0:n.attachTo)=="number"?u(this,I).geometry3DMap.get(n.attachTo):void 0;p instanceof ne&&p.attach(h),(l=this.getParentContainer(o))==null||l.addEntity(h),this.render()}else q.error("Marker2D with ID '".concat(s,"' already exists. The marker cannot be added."));return{id:s,type:"marker"}}addText3D(t,i,n,o){if(!u(this,I).geometry3DMap.has(t)&&!u(this,I).geometry2DMap.has(t)){let s=new pr(Ze(se({},i),{properties:Ze(se({},i.properties),{id:t,content:i.properties.text})})),l=new ne(s,new Ji(n==null?void 0:n.appearance));l.id=t,s.mesh.userData.entityId=t.toString(),s.mesh.userData.type="text3d",u(this,I).geometry3DMap.set(t,l);let h=this.getParentContainer(o);h instanceof me&&h.addEntity(l),u(this,fe).call(this),this.render()}else q.error("Text3D with ID '".concat(t,"' already exists. The text3d cannot be added."));return{id:t,type:"text3d"}}labelText3D(t,i,n={}){var p,m;try{if(!i||!t)throw new Error("content and meshGeometryId are required");Hp.parse(n)}catch(f){q.error(f);return}let o=u(this,I).geometry3DMap.get(t);if((o==null?void 0:o.type)!=="geometry"){q.error(".labelText3D failed: target incorrect");return}let s=o==null?void 0:o.components[0];if(!s.feature.properties.textArea)return;if(s.textEntityId){let f=u(this,I).geometry3DMap.get(s.textEntityId);if((f==null?void 0:f.type)!=="text3d"){q.error(".labelText3D failed: existing text3d not found");return}return{id:f.id,type:f.type}}let l=new pr({type:"Feature",geometry:{coordinates:(p=s.feature.properties.textArea)==null?void 0:p.position,type:"Point"},properties:{textArea:s.feature.properties.textArea,content:i,id:wt()}});l.polygonEntityId=t;let h=new ne(l,new Ji(n==null?void 0:n.appearance));return s.textEntityId=h.id.toString(),l.mesh.userData.entityId=h.id.toString(),l.mesh.userData.type="text3d",u(this,I).geometry3DMap.set(h.id.toString(),h),n.parentId&&((m=this.getParentContainer(n.parentId))==null||m.addEntity(h)),this.render(),{id:h.id,type:"text3d"}}addLabel2D(t,i,n,o){var l;let s=n==null?void 0:n.id;try{rp(t,i,n||{})}catch(h){q.error(h);return}if(s===void 0||!u(this,I).geometry2DMap.has(s)&&!u(this,I).geometry3DMap.has(s)){let h=Te(this,He,Ku).call(this,t,new Et(i,n||{},u(this,I)),n==null?void 0:n.occluderId,n==null?void 0:n.verticalOffset);h.id=s||String(h.id),s=h.id,(n==null?void 0:n.interactive)!=null&&Fe(h,n==null?void 0:n.interactive,u(this,I));let p=typeof(n==null?void 0:n.attachTo)=="string"||typeof(n==null?void 0:n.attachTo)=="number"?u(this,I).geometry3DMap.get(n.attachTo):void 0;p instanceof ne&&p.attach(h),(l=this.getParentContainer(o))==null||l.addEntity(h),u(this,Xe).call(this),this.render()}else q.error("Label2D with ID '".concat(s,"' already exists. The label cannot be added."));return{id:s,type:"label"}}addPath(t,i={},n){var h;try{Kd(t,i||{})}catch(p){q.error(p);return}let o=new xr(t,Cl(i)),s=new ne(o,new It({color:(h=i==null?void 0:i.color)!=null?h:"#ff834c"}));s.id=(i==null?void 0:i.id)||wt(),o.mesh.userData={entityId:s.id,type:"path"},u(this,I).geometry3DMap.set(s.id,s),(i==null?void 0:i.interactive)!=null&&Fe(s,i==null?void 0:i.interactive,u(this,I));let l=this.getParentContainer(n);return l instanceof me&&l.addEntity(s),u(this,fe).call(this),this.render(),{id:s.id,type:"path"}}updateWatermark(t){u(this,E).watermarkSystem.options=t,u(this,E).watermarkSystem.dirty=!0,u(this,E).collisionSystem.collidersDirty=!0,this.render()}remove(t){var n;let i;if(typeof t=="string"||typeof t=="number"?(i=u(this,I).geometry2DMap.get(t),i==null&&(i=u(this,I).geometry3DMap.get(t))):typeof t.id=="string"||typeof t.id=="number"?(i=u(this,I).geometry2DMap.get(t.id),i==null&&(i=u(this,I).geometry3DMap.get(t.id))):i=t,i!=null){if(i.type==="custom-geometry")u(this,I).geometry3DMap.delete(i.id),i.object3d&&Ee(i.object3d);else if(i.type==="group-container"){u(this,I).geometry3DMap.delete(i.userData.entityId);for(let s of i.childrenIds.values())this.remove(s),i.userData.entities2D.delete(s);let o=i.components[1];o&&o.focusMesh&&Ee(o.focusMesh),Ee(i)}else if(i.type==="geometry-group"){u(this,I).geometry3DMap.delete(i.userData.entityId);for(let o of i.userData.entities3D.values())this.remove(o),i.userData.entities3D.delete(o);Ee(i)}else if(i.type==="geometry"||i.type==="model"||i.type==="path"){let o=i.components[0],s=i.components[4];if(i.entities2D.size>0){for(let l of i.entities2D.values())this.remove(l);i.removeAllEntities()}if(i.object3d&&(((n=i.parentObject3D)==null?void 0:n.type)==="geometry-group"&&i.parentObject3D.userData.entities3D.delete(i.id),Ee(i.object3d)),i.type==="geometry"){let l=i.components[3];l&&(l.enabled=!1,l.dirty=!0)}s&&"focusMesh"in s&&s.focusMesh!=null&&Ee(s.focusMesh),"textMesh"in o&&o.textMesh!=null&&this.remove(o.textMesh.userData.entityId),u(this,I).geometry3DMap.delete(i.id)}else if(i.type==="marker"||i.type==="label"){let o=i.attachedTo;if(o){let s=u(this,I).geometry3DMap.get(o);s instanceof ne&&s.detach(i)}i.object3d&&Ee(i.object3d),i.type==="label"&&delete u(this,E).twoDDrawSystem.textCache[i.id],u(this,I).geometry2DMap.delete(i.id)}else if(i.type==="image")i.object3d&&Ee(i.object3d),u(this,I).geometry3DMap.delete(i.id);else if(i.type==="text3d"){Ee(i.object3d);let{batchedText:o,textMesh:s,polygonEntityId:l}=i.components[0];if(s&&(o&&o.removeText(s),Ee(s)),l){u(this,E).text3DSystem.remove(l);let h=u(this,I).geometry3DMap.get(l);(h==null?void 0:h.type)==="geometry"&&(h.components[0].textMesh=void 0,h.components[0].textEntityId=void 0)}u(this,I).geometry3DMap.delete(i.id)}u(this,fe).call(this),u(this,Xe).call(this),this.render()}}getScene(){return this.getState("__scene")}getThreeScene(){return u(this,_e)}getThreeCamera(){return u(this,Pe)}async setEnvironment(t){if(u(this,_e))if(t==="basic"){u(this,ti)||B(this,ti,Te(this,He,Qu).call(this));let i=await u(this,ti);u(this,_e).environment=i}else u(this,_e).environment=null}getEnvironment(){var t;return(t=u(this,_e))!=null&&t.environment?"basic":!1}getCurrentSceneGLTF(t){return u(this,E).exporterSystem.getCurrentSceneGLTF(t)}getBoundingArea(t){(u(this,E).renderSystem.threeDdirty||u(this,E).renderSystem.twoDdirty)&&this.renderSync();let i=new Ue;if(t==null)i.setFromObject(u(this,I).entityScene);else{let n=ui(u(this,I),t);if((n==null?void 0:n.type)==="geometry"&&(n==null?void 0:n.object3d)!=null){let o=n.components[0],s=o instanceof Me?o.geometry:void 0;o.mesh instanceof fo&&s?(s.computeBoundingBox(),s.boundingBox&&i.union(s.boundingBox)):i.setFromObject(n.object3d)}else((n==null?void 0:n.type)==="geometry-group"||(n==null?void 0:n.type)==="group-container")&&(n==null?void 0:n.userData.entityId)!=null&&i.setFromObject(n)}if(So(i))return Zc(i).map(this.convert3DMapPositionToCoordinate)}hasState(t){return ui(u(this,I),t)!=null}getState(t){var n,o,s,l,h,p,m,f,v,y,C,M,g,b,P;if(t==null)return{type:"map-view",hoverColor:u(this,I).hoverColor,text3dHoverColor:u(this,I).text3dHoverColor};let i=ui(u(this,I),t);if((i==null?void 0:i.type)==="custom-geometry"){let S=i.components[0],T=i.components[1];return{id:i.id,type:"custom-geometry",visible:T.visible,altitude:T.altitude,parent:(n=i.parentObject3D)==null?void 0:n.userData.entityId,position:this.convert3DMapPositionToCoordinate(S.position)}}else if((i==null?void 0:i.type)==="geometry-group"){let S=[];for(let R of i.userData.entities3D.values()){let A=this.getState(R);((A==null?void 0:A.type)==="geometry"||(A==null?void 0:A.type)==="model")&&S.push(A)}let T=i.userData.entities3D.values().next().value,_=T?this.getState(T):{};return{id:i.userData.entityId,type:"geometry-group",visible:i.visible,altitude:i.altitude,color:_==null?void 0:_.color,initialColor:_==null?void 0:_.initialColor,side:(o=_==null?void 0:_.side)!=null?o:"double",opacity:_==null?void 0:_.opacity,height:_==null?void 0:_.height,texture:_==null?void 0:_.texture,topColor:_==null?void 0:_.topColor,topTexture:_==null?void 0:_.topTexture,interactive:Array.from(i.userData.entities3D.values()).map(R=>u(this,I).geometry3DMap.get(R)).every(R=>R&&R.components[2]!=null),children:Array.from(i.userData.entities3D.values()).map(R=>this.getState(R)).filter(Boolean)}}else{if((i==null?void 0:i.type)==="group-container")return{id:i.userData.entityId,type:"group-container",visible:i.visible,altitude:(s=i.getWorldPosition(QC).z)!=null?s:0,opacity:i.opacity,interactive:!!i.components[0],children:Array.from(i.childrenIds.values()).map(S=>this.getState(S)).filter(Boolean)};if((i==null?void 0:i.type)==="label"){let S=i.components[0],T=i.object3d.parent,_=T==null?void 0:T.userData.entityId;return{id:i.id,type:"label",text:S.text||"",parent:{id:_,type:T==null?void 0:T.type},position:this.convert3DMapPositionToCoordinate(i.position),enabled:S.enabled,visible:S.visible,initialRank:$i(S.initialRank),options:{rank:$i(S.rank),appearance:S.appearance,interactive:i.components[1]!=null,verticalOffset:i.verticalOffset,attachTo:i.attachedTo}}}else if((i==null?void 0:i.type)==="marker"){let S=i.components[0],T=i.object3d.parent,_=T==null?void 0:T.userData.entityId;return{id:i.id,type:"marker",enabled:S.enabled,visible:S.visible,placement:S.options.placement,dynamicResize:S.options.dynamicResize,parent:{id:_,type:T==null?void 0:T.type},position:this.convert3DMapPositionToCoordinate(i.position),element:S.containerEl,initialRank:$i(S.initialRank),contentHTML:S.contentHtml,options:{rank:$i(S.rank),interactive:i.components[1]!=null||!1,verticalOffset:i.verticalOffset,attachTo:i.attachedTo,lowPriorityPin:S.options.lowPriorityPin}}}else if((i==null?void 0:i.type)==="geometry"){let{color:S,hoverColor:T,initialColor:_,initialTopColor:R,topColor:A,altitude:k}=i.components[1],F=i.components[0],G=i.components[1],O=i.components[1],X=i.components[2],Z=i.components[3],J=i.parentObject3D;return{id:i.id,type:"geometry",opacity:O.opacity,initialColor:_,color:S,focusable:G!=null&&G.focusMesh!=null,initialTopColor:R,topColor:A,side:O.side,hoverColor:T,hovered:!!(X!=null&&X.hover),height:O.height,visible:O.visible,outline:Z==null?void 0:Z.enabled,showImage:O.showImage,texture:O.texture,topTexture:O.topTexture,flipImageToFaceCamera:O.flipImageToFaceCamera,parent:{id:J==null?void 0:J.userData.entityId,type:J==null?void 0:J.type},altitude:k,position:this.convert3DMapPositionToCoordinate(F.position),interactive:i.components[2]!=null}}else if((i==null?void 0:i.type)==="model"){let S=i.components[0],T=i.components[1],_=i.components[2];return{id:i.id,type:"model",position:S.mesh?this.convert3DMapPositionToCoordinate((l=S.mesh)==null?void 0:l.getWorldPosition(new z)):this.convert3DMapPositionToCoordinate(S.position),interactive:_!=null,material:T.material,parent:(h=i.parentObject3D)!=null&&h.parent?{id:i.parentObject3D.parent.userData.entityId,type:i.parentObject3D.parent.type}:void 0,visible:T.visible,verticalOffset:T.verticalOffset,color:T.color,opacity:T.opacity,rotation:(p=T.rotation)!=null?p:di,scale:(m=T.scale)!=null?m:pi}}else if((i==null?void 0:i.type)==="path"){let S=i.components[0],T=i.components[2],_=i.components[1];return{id:i.id,type:"path",position:this.convert3DMapPositionToCoordinate(S.position),visible:_.visible,interactive:T!=null,completeFraction:S.completeFraction,color:_.color,accentColor:S.accentColor,width:S.width,animateArrowsOnPath:S.animateArrowsOnPath,displayArrowsOnPath:S.displayArrowsOnPath,altitude:_.altitude}}else if((i==null?void 0:i.type)==="image"){let S=i.components[0];return{id:i.id,type:"image",position:this.convert3DMapPositionToCoordinate(S.position),visible:i.components[1].visible,verticalOffset:(f=S.feature.properties.verticalOffset)!=null?f:0,opacity:i.components[1].opacity,flipImageToFaceCamera:i.components[1].flipImageToFaceCamera,width:(v=S.feature.properties.width)!=null?v:0,height:(y=S.feature.properties.height)!=null?y:0,rotation:(C=S.feature.properties.rotation)!=null?C:0}}else if((i==null?void 0:i.type)==="text3d"&&i.components[0]instanceof pr&&"textArea"in i.components[0].feature.properties){cd(i);let S=i.components[0],T=i.components[1],{textMesh:_}=S,R=(M=S.mesh)==null?void 0:M.parent;R instanceof me&&((g=R.children.find(F=>F.type==="batchedtext"))==null||g.getWorldPosition(u(this,io))),u(this,Zi).set(0,0,0);let A=_?_.getWorldPosition(u(this,Zi)):u(this,Zi);return Object.assign({},hi,T.getState(),{id:i.id,type:"text3d",position:this.convert3DMapPositionToCoordinate(A.add(u(this,io))),visible:(b=S.visible)!=null?b:!1,content:(P=S.feature.properties.content)!=null?P:""})}else return}}setState(t,i){var o,s;if(typeof t=="object"&&i==null){"hoverColor"in t&&(kc(t.hoverColor)?u(this,I).hoverColor=(o=t.hoverColor)!=null?o:u(this,I).hoverColor:q.warn('Failed to update global hover color. Invalid color "'.concat(t.hoverColor,'".'))),"text3dHoverColor"in t&&(u(this,I).text3dHoverColor=(s=t.text3dHoverColor)!=null?s:u(this,I).text3dHoverColor);return}let n=ui(u(this,I),t);if(n!=null){if(n.type==="custom-geometry"){let l=u(this,I).geometry3DMap.get(n.id);if(l instanceof ne&&l.components[0]instanceof ki){let h=i;Lt(n,u(this,I),h.visible),Ti(n,h.altitude),bl(n,h.position,this.convertTo3DMapPosition),vl(n,this.getParentContainer(h.parent,!1)),Fe(n,h.interactive,u(this,I))&&u(this,fe).call(this)}}else if(n.type==="path"){let l=i;Fe(n,l.interactive,u(this,I))&&u(this,fe).call(this),Ti(n,l.altitude),ud(n,u(this,I),l)}else if(n.type==="model"){let l=i;Fe(n,l.interactive,u(this,I))&&u(this,fe).call(this),Lt(n,u(this,I),l.visible),dd(n,l)}else if(n.type==="group-container"){let l=i;Lt(n,u(this,I),l.visible)&&(u(this,E).pathSystem.altitudeDirty=!0,u(this,E).geometryInFocusSystem.focusablesDirty=!0),Ti(n,l.altitude)&&(u(this,E).pathSystem.altitudeDirty=!0),Fe(n,l.interactive,u(this,I))&&u(this,fe).call(this),mn(n,u(this,I),l.opacity)&&(u(this,E).outlineInterpolationSystem.outlineOpacitiesDirty=!0),l.preloadGeometry&&n.userData.preloadGeometry!==!0&&(n.userData.preloadGeometry=!0,u(this,E).outlineInterpolationSystem.geometries3DDirty=!0),rs(n,l.focusable)&&(u(this,E).geometryInFocusSystem.focusablesDirty=!0)}else if(n.type==="geometry-group"){let l=i;Lt(n,u(this,I),l.visible),Jp(n,u(this,I),l),ts(n,u(this,I),l.outline),l.height!=null&&Qo(n,u(this,I),l.height),Ti(n,l.altitude),sd(n,u(this,I),l),$p(n,u(this,I),l.shading),mn(n,u(this,I),l.opacity)&&(u(this,E).outlineInterpolationSystem.outlineOpacitiesDirty=!0),Fe(n,l.interactive,u(this,I))&&(u(this,fe).call(this),u(this,Xe).call(this)),is(n,u(this,I),l.side)}else if(n.type==="geometry"){if(n.components[0]instanceof Me){let l=i;Lt(n,u(this,I),l.visible),ts(n,u(this,I),l.outline),Kp(n,l),rs(n,l.focusable)&&(u(this,E).geometryInFocusSystem.focusablesDirty=!0),ld(n,l.renderOrder)&&(u(this,E).meshDetachmentSystem.dirty=!0),ad(n,l.opacity)&&(u(this,E).meshDetachmentSystem.dirty=!0,u(this,E).interactionSystem.dirty3D=!0,u(this,E).outlineInterpolationSystem.outlineOpacitiesDirty=!0),xl(n,l.flipImageToFaceCamera),Ti(n,l.altitude),l.height!=null&&Qo(n,u(this,I),l.height),Sl(n,l)&&(u(this,E).meshDetachmentSystem.dirty=!0),es(n,l),id(n,l.hoverColor),Fe(n,l.interactive,u(this,I)),nd(n,l.hovered),is(n,u(this,I),l.side)}u(this,fe).call(this)}else if(n.type==="label"||n.type==="marker"){let l=i;rd(n,i,u(this,I)),ed(n,i,u(this,I))&&(u(this,Xe).call(this),u(this,E).domMutationSystem.dirty=!0),bl(n,l.position,this.convertTo3DMapPosition),vl(n,this.getParentContainer(l.parent,!1))&&(u(this,Xe).call(this),u(this,E).panBoundsSystem.dirty=!0),Qp(n,l.enabled),Lt(n,u(this,I),l.visible)}else if(n.type==="image"){let l=i;Lt(n,u(this,I),l.visible),mn(n,u(this,I),l.opacity),xl(n,l.flipImageToFaceCamera)}else if(n.type==="text3d"){let l=i;pd(n,u(this,I),l)}this.render()}}convertTo3DMapPosition(t,i,n=0,o){var h,p,m,f,v;if(Array.isArray(t))return this.convertTo3DMapPosition(t[1],t[0],(h=t[2])!=null?h:n,typeof i=="function"?i:void 0);if(typeof i!="number")throw new Error("convertTo3DMapPosition failed: longitude must be a number");let{x:s,y:l}=wo((m=(p=u(this,I).center)==null?void 0:p[1])!=null?m:0,(v=(f=u(this,I).center)==null?void 0:f[0])!=null?v:0,t,i);return o?(o.set(s,l,n),o):new z(s,l,n)}get backgroundColor(){return typeof u(this,Ge).backgroundColor=="string"?u(this,Ge).backgroundColor:"#".concat(u(this,Ge).backgroundColor.getHexString())}get backgroundAlpha(){return u(this,Ge).backgroundAlpha}getThreeRenderer(){return u(this,Ge)}getCenter(t){let i=Array.isArray(t)?t:this.getBoundingArea(t);return i?$c(i):void 0}isInView(t){let i=ui(u(this,I),t);if(u(this,to).identity().multiply(u(this,Pe).projectionMatrix).multiply(u(this,Pe).matrixWorldInverse),u(this,ii).setFromProjectionMatrix(u(this,to)),i instanceof Ar)return u(this,ii).containsPoint(i.position);if(i instanceof ne){let n=i==null?void 0:i.components[0];if(n instanceof ki||n instanceof gr)return u(this,ii).containsPoint(this.convertTo3DMapPosition(n.feature.geometry.coordinates));if(n instanceof Me){let o=new Ue(this.convertTo3DMapPosition(n.featureBbox[1],n.featureBbox[0],0),this.convertTo3DMapPosition(n.featureBbox[3],n.featureBbox[2],0));return u(this,ii).intersectsBox(o)}}return!1}getSystems(){return u(this,E)}getInternalState(){return u(this,I)}getInternalTweenGroup(){return u(this,I).internalTweenGroup}getExternalTweenGroup(){return u(this,I).externalTweenGroup}computeMinZOffsetBetweenContainers(t,i,n){if(!t||!i)return-1;_a(t,"group-container"),_a(i,"group-container");let o=Io(t,this.getThreeCamera()),s=i.clone(),l=Io(s,this.getThreeCamera());if(!So(o)||!So(l))return-1;let h=0,p;n&&this.container.querySelectorAll(".debug-box").forEach(f=>f.remove());do{if(h>1e4)return-1;if(h+=20,s.position.z=h,s.updateMatrixWorld(),l.makeEmpty(),Io(s,u(this,Pe),l),p=o.intersectsBox(l),n){let m=Oa(o,"blue",this.container),f=Oa(l,p?"red":"green",this.container);m.classList.add("debug-box"),f.classList.add("debug-box")}}while(p);return h}};_e=new WeakMap,Pe=new WeakMap,ti=new WeakMap,jn=new WeakMap,Gi=new WeakMap,Tr=new WeakMap,ri=new WeakMap,Xi=new WeakMap,He=new WeakSet,$u=a(function(t){var i;u(this,Qt)!=="outdoors-overlay"&&((i=this.map)==null||i.setPixelRatio(t)),u(this,I).pixelRatio=this.resolutionScale},"#setResolutionScale"),I=new WeakMap,pe=new WeakMap,Ct=new WeakMap,we=new WeakMap,Ft=new WeakMap,Ge=new WeakMap,E=new WeakMap,Vn=new WeakMap,Xe=new WeakMap,fe=new WeakMap,Um=a(function(){B(this,pe,document.createElement("div")),u(this,pe).classList.add("mappedin__smart-collision-engine__container"),B(this,Ct,document.createElement("canvas")),u(this,Ct).classList.add("mappedin__smart-collision-engine-debug__container"),this.container.appendChild(u(this,pe)),B(this,we,document.createElement("canvas")),u(this,we).classList.add("mappedin__smart-collision-engine__container"),u(this,we).width=u(this,pe).clientWidth*this.resolutionScale,u(this,we).height=u(this,pe).clientHeight*this.resolutionScale,u(this,we).style.width=u(this,pe).clientWidth+"px",u(this,we).style.height=u(this,pe).clientHeight+"px",u(this,pe).appendChild(u(this,Ct)),u(this,pe).appendChild(u(this,we)),u(this,Ct).width=u(this,pe).clientWidth,u(this,Ct).height=u(this,pe).clientHeight,u(this,we).width=u(this,pe).clientWidth*this.resolutionScale,u(this,we).height=u(this,pe).clientHeight*this.resolutionScale,u(this,we).style.width=u(this,pe).clientWidth+"px",u(this,we).style.height=u(this,pe).clientHeight+"px"},"#renderEntity2DContainer"),Hm=a(function(){B(this,Ft,document.createElement("div")),u(this,Ft).classList.add("mappedin-2d-entities"),Object.assign(u(this,Ft).style,{position:"absolute",top:"0",left:"0",bottom:"0",right:"0",pointerEvents:"none","transform-style":"preserve-3d"}),this.container.appendChild(u(this,Ft))},"#renderEntityDOMContainer"),Wm=a(function(){u(this,we).width=u(this,pe).clientWidth*this.resolutionScale,u(this,we).height=u(this,pe).clientHeight*this.resolutionScale,u(this,we).style.width=u(this,pe).clientWidth+"px",u(this,we).style.height=u(this,pe).clientHeight+"px",u(this,Ct).width=u(this,pe).clientWidth,u(this,Ct).height=u(this,pe).clientHeight,u(this,we).width=u(this,pe).clientWidth*this.resolutionScale,u(this,we).height=u(this,pe).clientHeight*this.resolutionScale,u(this,we).style.width=u(this,pe).clientWidth+"px",u(this,we).style.height=u(this,pe).clientHeight+"px",u(this,E).collisionSystem.collidersDirty=!0},"#resizeCollisionCanvas"),Qt=new WeakMap,ya=new WeakMap,qn=new WeakMap,Jn=new WeakMap,$n=new WeakMap,zi=new WeakMap,ga=new WeakMap,Kn=new WeakMap,Qn=new WeakMap,eo=new WeakMap,Yi=new WeakMap,Ku=a(function(t,i,n,o){let s=new Ar(i,this.convertTo3DMapPosition(t[1],t[0],t[2]||0),o);return s.occluderId=n!=null?n:u(this,E).occlusion2DSystem.backgroundId,u(this,I).geometry2DMap.set(s.id,s),s},"#createEntity2D"),ii=new WeakMap,to=new WeakMap,ro=new WeakMap,rt=new WeakMap,it=new WeakMap,Qu=a(async function(){return vr.load(th).then(t=>{var i;return u(this,_e)&&((i=u(this,_e).environment)==null||i.dispose(),t.mapping=uc,u(this,_e).environment=t,this.render()),t})},"#loadEnvMap"),Zi=new WeakMap,io=new WeakMap,a(ec,"Core");var Ju=ec,QC=new z,Ul=Ju;var tc=class tc extends ie{constructor(t){super();d(this,"gl");d(this,"el",document.createElement("div"));d(this,"core");d(this,"origin");d(this,"map");d(this,"layer");d(this,"handleStyleChange",a(()=>{!this.map||!this.layer||this.map.getLayer(this.layer.id)||(this.map.addLayer(this.layer),this.core.camera.setMinZoomLevel(this.map.getMinZoom()),this.core.camera.setMaxZoomLevel(this.map.getMaxZoom()),this.core.camera.setMinPitch(this.map.getMinPitch()),this.core.camera.setMaxPitch(this.map.getMaxPitch()))},"handleStyleChange"));d(this,"handleMove",a(()=>{if(!this.map)return;let[t,i]=this.map.getCenter().toArray();this.core.getSystems().cameraSystem.setCenter(t,i),this.core.getSystems().cameraSystem.setZoomLevel(this.map.getZoom()),this.core.getSystems().cameraSystem.setRotation(ee.degToRad(this.map.getBearing())),this.core.getSystems().cameraSystem.setTilt(ee.degToRad(this.map.getPitch()))},"handleMove"));d(this,"handleError",a(t=>{q.warn(t)},"handleError"));this.origin=t}onAdd(t){this.origin=this.origin||t.getCenter().toArray(),this.gl=t.painter.context.gl,this.core=new Ul(t._container,{center:this.origin,zoomLevel:t.getZoom(),pitch:t.getPitch(),bearing:t.getBearing(),gl:this.gl,map:t,mode:"outdoors-overlay"}),this.map=t,this.core.camera.setMinZoomLevel(t.getMinZoom()),this.core.camera.setMaxZoomLevel(t.getMaxZoom()),this.core.camera.setMinPitch(t.getMinPitch()),this.core.camera.setMaxPitch(t.getMaxPitch()),this.map.on("error",this.handleError);let i=ac.fromLngLat(this.origin,0);return this.layer=Ea(i,this.core.viewCamera,()=>{this.core.renderSync()}),this.map.on("styledata",this.handleStyleChange),this.map.on("move",this.handleMove),this.handleStyleChange(),this.el}onRemove(){this.map&&(this.map.off("styledata",this.handleStyleChange),this.map.off("move",this.handleMove),this.map.off("error",this.handleError),this.layer&&this.map.removeLayer(this.layer.id)),this.layer=void 0,this.map=void 0,this.core&&this.core.destroy(),this.core=void 0}};a(tc,"MapLibreOverlay");var ba=tc;x();var jm=Dc("",{prefix:"[MapLibreOverlay]"});x();var Vm=a((e,{id:r}={})=>{let t=Array.isArray(e)?e:[e];if(!t.every(o=>typeof o=="string"))return;let i=t.join(""),n=null;if(r){let o=document.getElementById(r);o instanceof HTMLStyleElement&&(n=o)}n==null&&(n=document.createElement("style")),r&&r!==""&&(n.id=r),n.textContent=i,document.head.appendChild(n)},"injectCSS");var qm=".mappedin-marker {\n font-family: 'InterUI-Regular', Helvetica, Arial, sans-serif;\n font-weight: normal;\n top: 0;\n position: absolute;\n font-weight: bold;\n color: black;\n display: flex;\n flex-direction: row;\n will-change: transform, opacity;\n transition: opacity 150ms ease-in-out;\n justify-content: center;\n opacity: 0;\n}\n\n/* Low priority pin strategy styles */\n\n/* Hide child elements as well */\n.mappedin-marker[data-placement='low-priority-pin'] > .mappedin-marker-content {\n visibility: hidden;\n}\n\n/* Create the pin using ::before pseudo-element */\n.mappedin-marker::before {\n content: '';\n display: none;\n border-radius: 50%;\n position: relative;\n /* Default values - will be overridden by inline styles */\n width: var(--mappedin-pin-size, 2px);\n height: var(--mappedin-pin-size, 2px);\n background-color: var(--pin-color, #666);\n}\n\n.mappedin-marker[data-placement='low-priority-pin']::before {\n display: block;\n}\n";var Jm=".mappedin__smart-collision-engine__container {\n position: absolute;\n left: 0px;\n top: 0px;\n bottom: 0px;\n right: 0px;\n pointer-events: none;\n /* Enables colliders to use translate3D */\n transform-style: preserve-3d;\n font-family: 'InterUI-Regular', Helvetica, Arial, sans-serif;\n}\n\n.mappedin__smart-collision-engine-debug__container {\n position: absolute;\n left: 0px;\n top: 0px;\n bottom: 0px;\n right: 0px;\n transition: opacity 300ms ease-in-out;\n pointer-events: none;\n will-change: opacity;\n &.interacting {\n opacity: 0.2;\n }\n}\n";var $m=".mappedin-map {\n .mappedin-interactive {\n cursor: grab;\n\n &:active {\n cursor: grabbing;\n }\n\n &.mappedin-interaction-hover {\n cursor: pointer;\n }\n }\n}\n";var Km=".mappedin-map {\n .mappedin-control-container {\n position: absolute;\n left: 0px;\n top: 0px;\n bottom: 0px;\n right: 0px;\n pointer-events: none;\n font-family: 'InterUI-Regular', Helvetica, Arial, sans-serif;\n\n .mappedin-ctrl-top-left,\n .mappedin-ctrl-top-right,\n .mappedin-ctrl-bottom-left,\n .mappedin-ctrl-bottom-right {\n position: absolute;\n pointer-events: none;\n }\n\n .mappedin-ctrl-top-left {\n top: 0;\n left: 0;\n }\n\n .mappedin-ctrl-top-right {\n top: 0;\n right: 0;\n }\n\n .mappedin-ctrl-bottom-left {\n bottom: 0;\n left: 0;\n }\n\n .mappedin-ctrl-bottom-right {\n bottom: 0;\n right: 0;\n }\n\n .mappedin-ctrl-attrib {\n display: block;\n position: relative;\n pointer-events: auto;\n font: 9px/11px 'InterUI-Regular', Helvetica, Arial, sans-serif;\n padding: 3px 5px 1px 5px;\n background-color: rgba(255, 255, 255, 0.5);\n margin: 0;\n min-width: 11px;\n min-height: 11px;\n user-select: none;\n\n summary.mappedin-ctrl-attrib-button {\n appearance: none;\n list-style: none;\n }\n\n summary.mappedin-ctrl-attrib-button::-webkit-details-marker {\n display: none;\n }\n\n &.mappedin-compact .mappedin-ctrl-attrib-button,\n &.mappedin-compact-show .mappedin-ctrl-attrib-inner {\n display: inline-block;\n }\n\n &.mappedin-compact {\n background-color: transparent;\n }\n\n &.mappedin-compact-show {\n min-width: 15px;\n min-height: 15px;\n box-sizing: border-box;\n background-color: rgba(255, 255, 255, 0.5);\n }\n }\n\n .mappedin-ctrl-attrib-top-left {\n float: left;\n border-bottom-right-radius: 4px;\n }\n\n .mappedin-ctrl-attrib-top-right {\n float: right;\n border-bottom-left-radius: 4px;\n }\n\n .mappedin-ctrl-attrib-bottom-left {\n float: left;\n border-top-right-radius: 4px;\n }\n\n .mappedin-ctrl-attrib-bottom-right {\n float: right;\n border-top-left-radius: 4px;\n }\n .mappedin-ctrl-attrib-top-left,\n .mappedin-ctrl-attrib-bottom-left {\n padding: 3px 5px 1px 20px;\n }\n\n .mappedin-ctrl-attrib-inner {\n display: inline-block;\n margin-right: 12px;\n }\n\n .mappedin-ctrl-attrib-inner,\n .mappedin-ctrl-attrib-inner a {\n color: rgba(0, 0, 0, 0.75);\n text-decoration: none;\n }\n\n .mappedin-ctrl-attrib-inner-bold,\n .mappedin-ctrl-attrib-inner-bold a {\n font-weight: bold;\n }\n\n .mappedin-ctrl-attrib-inner a:hover {\n color: #017ef1;\n text-decoration: underline;\n cursor: pointer;\n }\n\n .mappedin-ctrl-attrib-button {\n display: none;\n cursor: pointer;\n position: absolute;\n width: 15px;\n height: 15px;\n box-sizing: border-box;\n border-radius: 50%;\n top: 0;\n right: 2px;\n border: 1px;\n }\n .mappedin-ctrl-attrib-top-left .mappedin-ctrl-attrib-button,\n .mappedin-ctrl-attrib-bottom-left .mappedin-ctrl-attrib-button {\n left: 2px;\n }\n }\n}\n";var oP=[qm,Jm,$m,Km],Gk=a((e,r)=>{no.instance!=null&&jm.warn("Only a single map venue is supported at this time.");let t=new no([e.mapCenter.longitude,e.mapCenter.latitude],e,r);return no.instance=t,t},"createMapLibreOverlay"),sP=3,aP={debug:!1,pitch:45,bearing:0,antialiasing:{enabled:!0},shadingAndOutlines:!0,outdoorView:{layersHiddenByGeometry:["building","building-top"]},imagePlacementOptions:{mode:"default"},flipImagesToFaceCamera:!0,multiFloorView:{enabled:!1,floorGap:sP}},ni,oi,Ui,Mr,si,oo=class oo{constructor(r,t,i){L(this,ni);L(this,oi);L(this,Ui);L(this,Mr);L(this,si);d(this,"on",a((r,t)=>{u(this,ni).on(r,t)},"on"));d(this,"off",a((r,t)=>{u(this,ni).off(r,t)},"off"));B(this,ni,new ie),B(this,si,new ba(r)),B(this,oi,t),B(this,Ui,i)}onAdd(r){var n,o,s;let t=u(this,si).onAdd(r),i=Ze(se(se({},aP),(n=u(this,Ui))!=null?n:{}),{outdoorView:se({token:u(this,oi).outdoorViewToken},(o=u(this,Ui))==null?void 0:o.outdoorView)});return B(this,Mr,new nP(u(this,si).core)),((s=i.injectStyles)==null||s)&&Vm(oP,{id:"mappedin__styles"}),u(this,Mr).addMap(u(this,oi),i).then(()=>{u(this,ni).publish("loaded",{mapView:u(this,Mr),mapData:u(this,oi)})}),t}onRemove(){u(this,Mr)&&u(this,Mr).clear(),oo.instance=null,u(this,si).onRemove()}};ni=new WeakMap,oi=new WeakMap,Ui=new WeakMap,Mr=new WeakMap,si=new WeakMap,a(oo,"MappedinMapLibreOverlay"),d(oo,"instance");var no=oo;export{aP as DEFAULT_MAP_OPTIONS,sP as FLOOR_GAP,no as MappedinMapLibreOverlay,Gk as createMapLibreOverlay};